method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void onRowDblClckSelect(SelectEvent event) throws IOException { UserCard obj = (UserCard) event.getObject(); FacesContext.getCurrentInstance().getExternalContext().redirect("user.xhtml?id=" + obj.getId()); }
void function(SelectEvent event) throws IOException { UserCard obj = (UserCard) event.getObject(); FacesContext.getCurrentInstance().getExternalContext().redirect(STR + obj.getId()); }
/** * Double click handler. * * @param event * @throws IOException */
Double click handler
onRowDblClckSelect
{ "repo_name": "gladorange/meraee", "path": "prokofiev/6_7/user-card/src/main/java/com/seprokof/usercard/ui/UserCardViewBean.java", "license": "apache-2.0", "size": 2387 }
[ "com.seprokof.usercard.dao.UserCard", "java.io.IOException", "javax.faces.context.FacesContext", "org.primefaces.event.SelectEvent" ]
import com.seprokof.usercard.dao.UserCard; import java.io.IOException; import javax.faces.context.FacesContext; import org.primefaces.event.SelectEvent;
import com.seprokof.usercard.dao.*; import java.io.*; import javax.faces.context.*; import org.primefaces.event.*;
[ "com.seprokof.usercard", "java.io", "javax.faces", "org.primefaces.event" ]
com.seprokof.usercard; java.io; javax.faces; org.primefaces.event;
2,226,940
public AgendaDefinition getAgendaByNameAndContextId(String name, String contextId);
AgendaDefinition function(String name, String contextId);
/** * Retrieves an Agenda from the repository based on the provided agenda name * and context id. * * @param name the name of the Agenda to retrieve. * @param contextId the id of the context that the agenda belongs to. * @return an {@link AgendaDefinition} identified by the given name and namespace. * A null reference is returned if an invalid or non-existent name and * namespace combination is supplied. */
Retrieves an Agenda from the repository based on the provided agenda name and context id
getAgendaByNameAndContextId
{ "repo_name": "sbower/kuali-rice-1", "path": "krms/impl/src/main/java/org/kuali/rice/krms/impl/repository/AgendaBoService.java", "license": "apache-2.0", "size": 5842 }
[ "org.kuali.rice.krms.api.repository.agenda.AgendaDefinition" ]
import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition;
import org.kuali.rice.krms.api.repository.agenda.*;
[ "org.kuali.rice" ]
org.kuali.rice;
2,903,540
void accept(double value, DoubleConsumer dc); }
void accept(double value, DoubleConsumer dc); }
/** * Replaces the given {@code value} with zero or more values by feeding the mapped * values to the {@code dc} consumer. * * @param value the double value coming from upstream * @param dc a {@code DoubleConsumer} accepting the mapped values */
Replaces the given value with zero or more values by feeding the mapped values to the dc consumer
accept
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/java/util/stream/DoubleStream.java", "license": "apache-2.0", "size": 54716 }
[ "java.util.function.DoubleConsumer" ]
import java.util.function.DoubleConsumer;
import java.util.function.*;
[ "java.util" ]
java.util;
2,587,983
public void setBalancerBandwidth(long bandwidth) throws IOException { dfs.setBalancerBandwidth(bandwidth); }
void function(long bandwidth) throws IOException { dfs.setBalancerBandwidth(bandwidth); }
/** * Requests the namenode to tell all datanodes to use a new, non-persistent * bandwidth value for dfs.balance.bandwidthPerSec. * The bandwidth parameter is the max number of bytes per second of network * bandwidth to be used by a datanode during balancing. * * @param bandwidth Balancer bandwidth in bytes per second for all datanodes. * @throws IOException */
Requests the namenode to tell all datanodes to use a new, non-persistent bandwidth value for dfs.balance.bandwidthPerSec. The bandwidth parameter is the max number of bytes per second of network bandwidth to be used by a datanode during balancing
setBalancerBandwidth
{ "repo_name": "jonathangizmo/HadoopDistJ", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java", "license": "mit", "size": 65083 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,018,332
public SoyType getOrCreateUnionType(Collection<SoyType> members) { SoyType type = UnionType.of(members); if (type instanceof UnionType) { type = unionTypes.intern((UnionType) type); } return type; }
SoyType function(Collection<SoyType> members) { SoyType type = UnionType.of(members); if (type instanceof UnionType) { type = unionTypes.intern((UnionType) type); } return type; }
/** * Factory function which creates a union type, given the member types. * This folds identical union types together. * * @param members The members of the union. * @return The union type. */
Factory function which creates a union type, given the member types. This folds identical union types together
getOrCreateUnionType
{ "repo_name": "atul-bhouraskar/closure-templates", "path": "java/src/com/google/template/soy/types/SoyTypeRegistry.java", "license": "apache-2.0", "size": 6736 }
[ "com.google.template.soy.types.aggregate.UnionType", "java.util.Collection" ]
import com.google.template.soy.types.aggregate.UnionType; import java.util.Collection;
import com.google.template.soy.types.aggregate.*; import java.util.*;
[ "com.google.template", "java.util" ]
com.google.template; java.util;
788,140
public static KualiDecimal getTotalFringeBenefit(List<EffortCertificationDetail> effortCertificationDetailLines) { KualiDecimal totalFringeBenefit = KualiDecimal.ZERO; for (EffortCertificationDetail detailLine : effortCertificationDetailLines) { totalFringeBenefit = totalFringeBenefit.add(detailLine.getFringeBenefitAmount()); } return totalFringeBenefit; }
static KualiDecimal function(List<EffortCertificationDetail> effortCertificationDetailLines) { KualiDecimal totalFringeBenefit = KualiDecimal.ZERO; for (EffortCertificationDetail detailLine : effortCertificationDetailLines) { totalFringeBenefit = totalFringeBenefit.add(detailLine.getFringeBenefitAmount()); } return totalFringeBenefit; }
/** * Gets the totalFringeBenefit attribute. * * @return Returns the totalFringeBenefit. */
Gets the totalFringeBenefit attribute
getTotalFringeBenefit
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/ec/businessobject/EffortCertificationDetail.java", "license": "agpl-3.0", "size": 32057 }
[ "java.util.List", "org.kuali.rice.core.api.util.type.KualiDecimal" ]
import java.util.List; import org.kuali.rice.core.api.util.type.KualiDecimal;
import java.util.*; import org.kuali.rice.core.api.util.type.*;
[ "java.util", "org.kuali.rice" ]
java.util; org.kuali.rice;
159,769
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeLater(new Runnable() {
/** * Launch the application. */
Launch the application
main
{ "repo_name": "MichaelRobertBell/GlassScriptManagementPS", "path": "GlassScriptManagement/src/scriptImport.java", "license": "mit", "size": 6291 }
[ "java.awt.EventQueue" ]
import java.awt.EventQueue;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,941,855
protected Button newPagingNavigationButton(String id, IPageable pageable, int pageNumber) { return new PagingNavigationButton(id, pageable, pageNumber); }
Button function(String id, IPageable pageable, int pageNumber) { return new PagingNavigationButton(id, pageable, pageNumber); }
/** * Create a new pagenumber link. May be subclassed to make use of * specialized links, e.g. Ajaxian links. * * @param id * the link id * @param pageable * the pageable to control * @param pageNumber * the page to jump to * @return the pagenumber link */
Create a new pagenumber link. May be subclassed to make use of specialized links, e.g. Ajaxian links
newPagingNavigationButton
{ "repo_name": "marktriggs/nyu-sakai-10.4", "path": "sakai-wicket-for-scorm/tool/src/java/org/sakaiproject/wicket/ajax/markup/html/navigation/paging/ClassicPagingNavigator.java", "license": "apache-2.0", "size": 5241 }
[ "org.apache.wicket.markup.html.form.Button", "org.apache.wicket.markup.html.navigation.paging.IPageable" ]
import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.navigation.paging.IPageable;
import org.apache.wicket.markup.html.form.*; import org.apache.wicket.markup.html.navigation.paging.*;
[ "org.apache.wicket" ]
org.apache.wicket;
2,244,003
public static Aggregate<Map<String, Concept>, Optional<?>> max(String varName) { return new MaxAggregate(varName); }
static Aggregate<Map<String, Concept>, Optional<?>> function(String varName) { return new MaxAggregate(varName); }
/** * Aggregate that finds maximum of a match query. */
Aggregate that finds maximum of a match query
max
{ "repo_name": "denislobanov/grakn", "path": "mindmaps-graql/src/main/java/io/mindmaps/graql/internal/query/aggregate/Aggregates.java", "license": "gpl-3.0", "size": 3396 }
[ "io.mindmaps.concept.Concept", "io.mindmaps.graql.Aggregate", "java.util.Map", "java.util.Optional" ]
import io.mindmaps.concept.Concept; import io.mindmaps.graql.Aggregate; import java.util.Map; import java.util.Optional;
import io.mindmaps.concept.*; import io.mindmaps.graql.*; import java.util.*;
[ "io.mindmaps.concept", "io.mindmaps.graql", "java.util" ]
io.mindmaps.concept; io.mindmaps.graql; java.util;
1,902,452
public R getMember(byte channel, int playerId) { Map<Integer, R> channelMembers = remoteMembers.get(Byte.valueOf(channel)); if (channelMembers != null) return channelMembers.get(Integer.valueOf(playerId)); return null; }
R function(byte channel, int playerId) { Map<Integer, R> channelMembers = remoteMembers.get(Byte.valueOf(channel)); if (channelMembers != null) return channelMembers.get(Integer.valueOf(playerId)); return null; }
/** * Gets the RemoteMember in the specified channel. * This IntraworldGroupList must be at least read locked when this method is called. * @param playerId * @return */
Gets the RemoteMember in the specified channel. This IntraworldGroupList must be at least read locked when this method is called
getMember
{ "repo_name": "Kevin-Jin/argonms-server", "path": "src/argonms/game/character/IntraworldGroupList.java", "license": "agpl-3.0", "size": 10697 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
986,052
public void testEquals() { assertTrue( GradientPaintTransformType.HORIZONTAL.equals(GradientPaintTransformType.HORIZONTAL) ); }
void function() { assertTrue( GradientPaintTransformType.HORIZONTAL.equals(GradientPaintTransformType.HORIZONTAL) ); }
/** * Tests the equals() method. */
Tests the equals() method
testEquals
{ "repo_name": "tekkies/jcommon-serialdate-refactor", "path": "source/org/jfree/ui/junit/GradientPaintTransformTypeTests.java", "license": "lgpl-2.1", "size": 3621 }
[ "org.jfree.ui.GradientPaintTransformType" ]
import org.jfree.ui.GradientPaintTransformType;
import org.jfree.ui.*;
[ "org.jfree.ui" ]
org.jfree.ui;
2,771,237
public static void checkEdtAndReadAction(@NotNull ProcessHandler processHandler) { Application application = ApplicationManager.getApplication(); if (application == null || !application.isInternal() || application.isHeadlessEnvironment()) { return; } String message = null; if (application.isDispatchThread()) { message = "Synchronous execution on EDT: "; } else if (application.isReadAccessAllowed()) { message = "Synchronous execution under ReadAction: "; } if (message != null && REPORTED_EXECUTIONS.add(ExceptionUtil.currentStackTrace())) { LOG.error(message + processHandler); } }
static void function(@NotNull ProcessHandler processHandler) { Application application = ApplicationManager.getApplication(); if (application == null !application.isInternal() application.isHeadlessEnvironment()) { return; } String message = null; if (application.isDispatchThread()) { message = STR; } else if (application.isReadAccessAllowed()) { message = STR; } if (message != null && REPORTED_EXECUTIONS.add(ExceptionUtil.currentStackTrace())) { LOG.error(message + processHandler); } }
/** * Checks if we are going to wait for {@code processHandler} to finish on EDT or under ReadAction. Logs error if we do so. * * @apiNote works only in internal mode with UI. Reports once per running session per stacktrace per cause. */
Checks if we are going to wait for processHandler to finish on EDT or under ReadAction. Logs error if we do so
checkEdtAndReadAction
{ "repo_name": "paplorinc/intellij-community", "path": "platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java", "license": "apache-2.0", "size": 8043 }
[ "com.intellij.openapi.application.Application", "com.intellij.openapi.application.ApplicationManager", "com.intellij.util.ExceptionUtil", "org.jetbrains.annotations.NotNull" ]
import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.util.ExceptionUtil; import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.application.*; import com.intellij.util.*; import org.jetbrains.annotations.*;
[ "com.intellij.openapi", "com.intellij.util", "org.jetbrains.annotations" ]
com.intellij.openapi; com.intellij.util; org.jetbrains.annotations;
2,667,000
void setRotation(Vector3d rotation);
void setRotation(Vector3d rotation);
/** * Sets the rotation of this entity. * * <p>The format of the rotation is represented by:</p> * * <ul><code>x -> yaw</code>, <code>y -> pitch</code>, <code>z -> roll * </code></ul> * * @param rotation The rotation to set the entity to */
Sets the rotation of this entity. The format of the rotation is represented by: <code>x -> yaw</code>, <code>y -> pitch</code>, <code>z -> roll </code>
setRotation
{ "repo_name": "caseif/SpongeAPI", "path": "src/main/java/org/spongepowered/api/entity/Entity.java", "license": "mit", "size": 8804 }
[ "com.flowpowered.math.vector.Vector3d" ]
import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.*;
[ "com.flowpowered.math" ]
com.flowpowered.math;
887,137
public ModelCriterion getSelection() { return selection; }
ModelCriterion function() { return selection; }
/** * Returns the selected element * @return */
Returns the selected element
getSelection
{ "repo_name": "kbabioch/arx", "path": "src/gui/org/deidentifier/arx/gui/view/impl/menu/DialogDefaultParameters.java", "license": "apache-2.0", "size": 5623 }
[ "org.deidentifier.arx.gui.model.ModelCriterion" ]
import org.deidentifier.arx.gui.model.ModelCriterion;
import org.deidentifier.arx.gui.model.*;
[ "org.deidentifier.arx" ]
org.deidentifier.arx;
184,869
public void sendS08Reach(EntityPlayerMP player, float reachDistance) { PacketBuffer payload = new PacketBuffer(Unpooled.buffer()); payload.writeByte(S08REACH); payload.writeFloat(reachDistance); this.channel.sendTo(new FMLProxyPacket(payload, Reference.CHANNEL), player); }
void function(EntityPlayerMP player, float reachDistance) { PacketBuffer payload = new PacketBuffer(Unpooled.buffer()); payload.writeByte(S08REACH); payload.writeFloat(reachDistance); this.channel.sendTo(new FMLProxyPacket(payload, Reference.CHANNEL), player); }
/** * Sends a packet setting the players reach distance * @param player the player who receives the packet * @param reachDistance the reach distance */
Sends a packet setting the players reach distance
sendS08Reach
{ "repo_name": "MrNobody98/morecommands", "path": "src/main/java/com/mrnobody/morecommands/network/PacketDispatcher.java", "license": "lgpl-3.0", "size": 27915 }
[ "com.mrnobody.morecommands.util.Reference", "io.netty.buffer.Unpooled", "net.minecraft.entity.player.EntityPlayerMP", "net.minecraft.network.PacketBuffer", "net.minecraftforge.fml.common.network.internal.FMLProxyPacket" ]
import com.mrnobody.morecommands.util.Reference; import io.netty.buffer.Unpooled; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
import com.mrnobody.morecommands.util.*; import io.netty.buffer.*; import net.minecraft.entity.player.*; import net.minecraft.network.*; import net.minecraftforge.fml.common.network.internal.*;
[ "com.mrnobody.morecommands", "io.netty.buffer", "net.minecraft.entity", "net.minecraft.network", "net.minecraftforge.fml" ]
com.mrnobody.morecommands; io.netty.buffer; net.minecraft.entity; net.minecraft.network; net.minecraftforge.fml;
1,649,952
@Deprecated public Collection<String> getGraylistedTrackerNames() { return Collections.emptySet(); }
Collection<String> function() { return Collections.emptySet(); }
/** * Get the names of graylisted task trackers in the cluster. * * The gray list of trackers is no longer available on M/R 2.x. The function * is kept to be compatible with M/R 1.x applications. * * @return an empty graylisted task trackers in the cluster. */
Get the names of graylisted task trackers in the cluster. The gray list of trackers is no longer available on M/R 2.x. The function is kept to be compatible with M/R 1.x applications
getGraylistedTrackerNames
{ "repo_name": "tseen/Federated-HDFS", "path": "tseenliu/FedHDFS-hadoop-src/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/ClusterStatus.java", "license": "apache-2.0", "size": 17375 }
[ "java.util.Collection", "java.util.Collections" ]
import java.util.Collection; import java.util.Collections;
import java.util.*;
[ "java.util" ]
java.util;
1,932,772
public void updateShuffleState() { switch (MusicUtils.getShuffleMode()) { case MusicPlaybackService.SHUFFLE_NORMAL: setContentDescription(getResources().getString(R.string.accessibility_shuffle_all)); setAlpha(ACTIVE_ALPHA); break; case MusicPlaybackService.SHUFFLE_AUTO: setContentDescription(getResources().getString(R.string.accessibility_shuffle_all)); setAlpha(ACTIVE_ALPHA); break; case MusicPlaybackService.SHUFFLE_NONE: setContentDescription(getResources().getString(R.string.accessibility_shuffle)); setAlpha(INACTIVE_ALPHA); break; default: break; } }
void function() { switch (MusicUtils.getShuffleMode()) { case MusicPlaybackService.SHUFFLE_NORMAL: setContentDescription(getResources().getString(R.string.accessibility_shuffle_all)); setAlpha(ACTIVE_ALPHA); break; case MusicPlaybackService.SHUFFLE_AUTO: setContentDescription(getResources().getString(R.string.accessibility_shuffle_all)); setAlpha(ACTIVE_ALPHA); break; case MusicPlaybackService.SHUFFLE_NONE: setContentDescription(getResources().getString(R.string.accessibility_shuffle)); setAlpha(INACTIVE_ALPHA); break; default: break; } }
/** * Sets the correct drawable for the shuffle state. */
Sets the correct drawable for the shuffle state
updateShuffleState
{ "repo_name": "YouKim/ExoPlayer", "path": "twelve/src/main/java/com/dolzzo/twelve/widgets/ShuffleButton.java", "license": "apache-2.0", "size": 2089 }
[ "com.dolzzo.twelve.MusicPlaybackService", "com.dolzzo.twelve.utils.MusicUtils" ]
import com.dolzzo.twelve.MusicPlaybackService; import com.dolzzo.twelve.utils.MusicUtils;
import com.dolzzo.twelve.*; import com.dolzzo.twelve.utils.*;
[ "com.dolzzo.twelve" ]
com.dolzzo.twelve;
1,157,839
private static Set<SearchFilter> loadDestSearchFiltersFromPreferences() throws WorkbenchException { String filters = getPreferences().get(DEST_SEARCH_FILTERS, null); if (filters == null || filters.isEmpty()) { return null; } Reader reader = new StringReader(filters); XMLMemento memento = XMLMemento.createReadRoot(reader); IMemento[] nodes = memento.getChildren(DEST_SEARCH_FILTER); for (IMemento node : nodes) { if (destSearchFilters == null) { destSearchFilters = new LinkedHashSet<SearchFilter>(); } String name = node.getString(NAME); boolean enabled = node.getBoolean(ENABLED); boolean parent = node.getBoolean(FILTER_PARENT); IMemento child = node.getChild(FILTER_EXTENTION_TARGETS); List<Extension> targets = null; if (child != null) { targets = new ArrayList<Extension>(); IMemento[] children = child.getChildren(EXTENTION_TARGET); for (IMemento iMemento : children) { Extension extension = new Extension(iMemento.getID(), iMemento.getBoolean(ENABLED), false); String childRef = iMemento.getString(FILTER_CHILD_REF); if (childRef != null) { extension.setChildRef(childRef); } targets.add(extension); } } IMemento child2 = node.getChild(FILTER_PACKAGE_TARGETS); List<WSPackage> wsPackages = null; if (child2 != null) { wsPackages = new ArrayList<WSPackage>(); IMemento[] children2 = child2.getChildren(PACKAGE_TARGET); for (IMemento iMemento : children2) { wsPackages.add(new WSPackage(name, iMemento.getID(), iMemento.getBoolean(ENABLED))); } } SearchFilter filter = new SearchFilter(name, targets, wsPackages, enabled); filter.setParent(parent); destSearchFilters.add(filter); } return destSearchFilters; }
static Set<SearchFilter> function() throws WorkbenchException { String filters = getPreferences().get(DEST_SEARCH_FILTERS, null); if (filters == null filters.isEmpty()) { return null; } Reader reader = new StringReader(filters); XMLMemento memento = XMLMemento.createReadRoot(reader); IMemento[] nodes = memento.getChildren(DEST_SEARCH_FILTER); for (IMemento node : nodes) { if (destSearchFilters == null) { destSearchFilters = new LinkedHashSet<SearchFilter>(); } String name = node.getString(NAME); boolean enabled = node.getBoolean(ENABLED); boolean parent = node.getBoolean(FILTER_PARENT); IMemento child = node.getChild(FILTER_EXTENTION_TARGETS); List<Extension> targets = null; if (child != null) { targets = new ArrayList<Extension>(); IMemento[] children = child.getChildren(EXTENTION_TARGET); for (IMemento iMemento : children) { Extension extension = new Extension(iMemento.getID(), iMemento.getBoolean(ENABLED), false); String childRef = iMemento.getString(FILTER_CHILD_REF); if (childRef != null) { extension.setChildRef(childRef); } targets.add(extension); } } IMemento child2 = node.getChild(FILTER_PACKAGE_TARGETS); List<WSPackage> wsPackages = null; if (child2 != null) { wsPackages = new ArrayList<WSPackage>(); IMemento[] children2 = child2.getChildren(PACKAGE_TARGET); for (IMemento iMemento : children2) { wsPackages.add(new WSPackage(name, iMemento.getID(), iMemento.getBoolean(ENABLED))); } } SearchFilter filter = new SearchFilter(name, targets, wsPackages, enabled); filter.setParent(parent); destSearchFilters.add(filter); } return destSearchFilters; }
/** * Get Plugin setting than the porting filter information.<br/> * * @return Porting filter group * @throws WorkbenchException * Workbench exception */
Get Plugin setting than the porting filter information
loadDestSearchFiltersFromPreferences
{ "repo_name": "azkaoru/migration-tool", "path": "src/tubame.wsearch/src/tubame/wsearch/Activator.java", "license": "apache-2.0", "size": 56325 }
[ "java.io.Reader", "java.io.StringReader", "java.util.ArrayList", "java.util.LinkedHashSet", "java.util.List", "java.util.Set", "org.eclipse.ui.IMemento", "org.eclipse.ui.WorkbenchException", "org.eclipse.ui.XMLMemento" ]
import java.io.Reader; import java.io.StringReader; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.eclipse.ui.IMemento; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.XMLMemento;
import java.io.*; import java.util.*; import org.eclipse.ui.*;
[ "java.io", "java.util", "org.eclipse.ui" ]
java.io; java.util; org.eclipse.ui;
448,120
public void onAttach(Context context) { if (!shownByMe) { dismissed = false; } }
void function(Context context) { if (!shownByMe) { dismissed = false; } }
/** * Corresponding onAttach() method * * @param context Context to match the Fragment API, unused. */
Corresponding onAttach() method
onAttach
{ "repo_name": "bernaferrari/bottomsheet", "path": "bottomsheet-commons/src/main/java/com/flipboard/bottomsheet/commons/BottomSheetFragmentDelegate.java", "license": "bsd-3-clause", "size": 10774 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
4,938
Multimap<String, HashCode> getRootHashes();
Multimap<String, HashCode> getRootHashes();
/** * The Merkle hashes of the roots which make up this file collection fingerprint. */
The Merkle hashes of the roots which make up this file collection fingerprint
getRootHashes
{ "repo_name": "lsmaira/gradle", "path": "subprojects/snapshots/src/main/java/org/gradle/internal/fingerprint/FileCollectionFingerprint.java", "license": "apache-2.0", "size": 1956 }
[ "com.google.common.collect.Multimap", "org.gradle.internal.hash.HashCode" ]
import com.google.common.collect.Multimap; import org.gradle.internal.hash.HashCode;
import com.google.common.collect.*; import org.gradle.internal.hash.*;
[ "com.google.common", "org.gradle.internal" ]
com.google.common; org.gradle.internal;
1,985,817
private boolean isSteeringDeliveryService(final DeliveryService deliveryService) { return deliveryService != null && steeringRegistry.has(deliveryService.getId()); }
boolean function(final DeliveryService deliveryService) { return deliveryService != null && steeringRegistry.has(deliveryService.getId()); }
/** * Returns whether or not the given Delivery Service is of the STEERING or CLIENT_STEERING type. */
Returns whether or not the given Delivery Service is of the STEERING or CLIENT_STEERING type
isSteeringDeliveryService
{ "repo_name": "hbeatty/incubator-trafficcontrol", "path": "traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/router/TrafficRouter.java", "license": "apache-2.0", "size": 83595 }
[ "com.comcast.cdn.traffic_control.traffic_router.core.ds.DeliveryService" ]
import com.comcast.cdn.traffic_control.traffic_router.core.ds.DeliveryService;
import com.comcast.cdn.traffic_control.traffic_router.core.ds.*;
[ "com.comcast.cdn" ]
com.comcast.cdn;
521,415
public int getAndMoveToFirst( final K k ) { final K key[] = this.key; final boolean used[] = this.used; final int mask = this.mask; // The starting point. int pos = ( it.unimi.dsi.fastutil.HashCommon.murmurHash3( strategy.hashCode( (K) (k)) ) ) & mask; // There's always an unused entry. while( used[ pos ] ) { if( ( strategy.equals( (k), (K) (key[ pos ]) ) ) ) { moveIndexToFirst( pos ); return value[ pos ]; } pos = ( pos + 1 ) & mask; } return defRetValue; }
int function( final K k ) { final K key[] = this.key; final boolean used[] = this.used; final int mask = this.mask; int pos = ( it.unimi.dsi.fastutil.HashCommon.murmurHash3( strategy.hashCode( (K) (k)) ) ) & mask; while( used[ pos ] ) { if( ( strategy.equals( (k), (K) (key[ pos ]) ) ) ) { moveIndexToFirst( pos ); return value[ pos ]; } pos = ( pos + 1 ) & mask; } return defRetValue; }
/** Returns the value to which the given key is mapped; if the key is present, it is moved to the first position of the iteration order. * * @param k the key. * @return the corresponding value, or the {@linkplain #defaultReturnValue() default return value} if no value was present for the given key. */
Returns the value to which the given key is mapped; if the key is present, it is moved to the first position of the iteration order
getAndMoveToFirst
{ "repo_name": "karussell/fastutil", "path": "src/it/unimi/dsi/fastutil/objects/Object2IntLinkedOpenCustomHashMap.java", "license": "apache-2.0", "size": 49557 }
[ "it.unimi.dsi.fastutil.HashCommon" ]
import it.unimi.dsi.fastutil.HashCommon;
import it.unimi.dsi.fastutil.*;
[ "it.unimi.dsi" ]
it.unimi.dsi;
619,999
public Collection<I> getValuesByFirstKey(K1 firstKey) { Map<K2, I> map = main.get(firstKey); if (map == null) { return null; } return map.values(); }
Collection<I> function(K1 firstKey) { Map<K2, I> map = main.get(firstKey); if (map == null) { return null; } return map.values(); }
/** * Get all values referenced by a first level key. * <p> * <i>Examples: </i> * <ul> * <li> * <code>getValuesByFirstKey("Project A") => ("Testing", "Documentation")</code> * </li> * </ul> * * @param firstKey * the first level key * @return a list of values referenced by the specified first level key */
Get all values referenced by a first level key. Examples: <code>getValuesByFirstKey("Project A") => ("Testing", "Documentation")</code>
getValuesByFirstKey
{ "repo_name": "vimaier/conqat", "path": "org.conqat.engine.core/external/commons-src/org/conqat/lib/commons/collections/TwoDimHashMap.java", "license": "apache-2.0", "size": 8136 }
[ "java.util.Collection", "java.util.Map" ]
import java.util.Collection; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
72,326
public List<HttpCookie> getHttpCookies(String defaultDomain) { List<HttpCookie> cookies = new LinkedList<>(); List<String> cookiesS = getHeaderValues(HttpHeader.SET_COOKIE); for (String c : cookiesS) { cookies.addAll(parseCookieString(c, defaultDomain)); } cookiesS = getHeaderValues(HttpHeader.SET_COOKIE2); for (String c : cookiesS) { cookies.addAll(parseCookieString(c, defaultDomain)); } return cookies; }
List<HttpCookie> function(String defaultDomain) { List<HttpCookie> cookies = new LinkedList<>(); List<String> cookiesS = getHeaderValues(HttpHeader.SET_COOKIE); for (String c : cookiesS) { cookies.addAll(parseCookieString(c, defaultDomain)); } cookiesS = getHeaderValues(HttpHeader.SET_COOKIE2); for (String c : cookiesS) { cookies.addAll(parseCookieString(c, defaultDomain)); } return cookies; }
/** * Parses the response headers and build a lis of all the http cookies set. For the cookies * whose domain could not be determined, the {@code defaultDomain} is set. * * @param defaultDomain the default domain * @return the http cookies */
Parses the response headers and build a lis of all the http cookies set. For the cookies whose domain could not be determined, the defaultDomain is set
getHttpCookies
{ "repo_name": "meitar/zaproxy", "path": "zap/src/main/java/org/parosproxy/paros/network/HttpResponseHeader.java", "license": "apache-2.0", "size": 12587 }
[ "java.net.HttpCookie", "java.util.LinkedList", "java.util.List" ]
import java.net.HttpCookie; import java.util.LinkedList; import java.util.List;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
1,742,675
public void setScheduledStartTime(@Nullable final Date scheduledStartTime) { this.scheduledStartTime = scheduledStartTime; }
void function(@Nullable final Date scheduledStartTime) { this.scheduledStartTime = scheduledStartTime; }
/** * Specifies the earliest time that the task should be eligible to start * running. * * @param scheduledStartTime The earliest time that the task should be * eligible to start running. It may be * {@code null} if the task should be eligible to * start immediately (or as soon as all of its * dependencies have been satisfied). */
Specifies the earliest time that the task should be eligible to start running
setScheduledStartTime
{ "repo_name": "UnboundID/ldapsdk", "path": "src/com/unboundid/ldap/sdk/unboundidds/tasks/CollectSupportDataTaskProperties.java", "license": "gpl-2.0", "size": 61360 }
[ "com.unboundid.util.Nullable", "java.util.Date" ]
import com.unboundid.util.Nullable; import java.util.Date;
import com.unboundid.util.*; import java.util.*;
[ "com.unboundid.util", "java.util" ]
com.unboundid.util; java.util;
1,717,358
private static void processTripsAndStopTimes(List<String> routeIds) { logger.info("Processing trips and stop times..."); // Create the trips and stop_times GTFS files String fileName = gtfsDirectory.getValue() + "/" + agencyId + "/trips.txt"; GtfsTripsWriter tripsWriter = new GtfsTripsWriter(fileName); fileName = gtfsDirectory.getValue() + "/" + agencyId + "/stop_times.txt"; GtfsStopTimesWriter stopTimesWriter = new GtfsStopTimesWriter(fileName); for (String routeId : routeIds) { // Read in the route info from API and add resulting // GtfsRoute to routes file try { // Get the schedule XML document Document scheduleDoc = getNextBusApiInputStream("schedule", "r=" + routeId); // Process trips and stop_times for route processTripsAndStopTimesForRoute(tripsWriter, stopTimesWriter, routeId, scheduleDoc); } catch (IOException | JDOMException e) { logger.error("Problem processing data for route {}", routeId, e); } } // Close the files tripsWriter.close(); stopTimesWriter.close(); }
static void function(List<String> routeIds) { logger.info(STR); String fileName = gtfsDirectory.getValue() + "/" + agencyId + STR; GtfsTripsWriter tripsWriter = new GtfsTripsWriter(fileName); fileName = gtfsDirectory.getValue() + "/" + agencyId + STR; GtfsStopTimesWriter stopTimesWriter = new GtfsStopTimesWriter(fileName); for (String routeId : routeIds) { try { Document scheduleDoc = getNextBusApiInputStream(STR, "r=" + routeId); processTripsAndStopTimesForRoute(tripsWriter, stopTimesWriter, routeId, scheduleDoc); } catch (IOException JDOMException e) { logger.error(STR, routeId, e); } } tripsWriter.close(); stopTimesWriter.close(); }
/** * Uses NextBus API schedule command to determine trips and stop times * and create the corresponding GTFS files. * * @param routeIds */
Uses NextBus API schedule command to determine trips and stop times and create the corresponding GTFS files
processTripsAndStopTimes
{ "repo_name": "edsfocci/Transitime_core", "path": "transitime/src/main/java/org/transitime/custom/missionBay/GtfsFromNextBus.java", "license": "gpl-3.0", "size": 35513 }
[ "java.io.IOException", "java.util.List", "org.jdom2.Document", "org.jdom2.JDOMException", "org.transitime.gtfs.writers.GtfsStopTimesWriter", "org.transitime.gtfs.writers.GtfsTripsWriter" ]
import java.io.IOException; import java.util.List; import org.jdom2.Document; import org.jdom2.JDOMException; import org.transitime.gtfs.writers.GtfsStopTimesWriter; import org.transitime.gtfs.writers.GtfsTripsWriter;
import java.io.*; import java.util.*; import org.jdom2.*; import org.transitime.gtfs.writers.*;
[ "java.io", "java.util", "org.jdom2", "org.transitime.gtfs" ]
java.io; java.util; org.jdom2; org.transitime.gtfs;
54,949
public void testFindRangeBounds() { StatisticalLineAndShapeRenderer r = new StatisticalLineAndShapeRenderer(); assertNull(r.findRangeBounds(null)); // an empty dataset should return a null range DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); assertNull(r.findRangeBounds(dataset)); dataset.add(1.0, 0.5, "R1", "C1"); assertEquals(new Range(0.5, 1.5), r.findRangeBounds(dataset)); dataset.add(-2.0, 0.2, "R1", "C2"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(null, null, "R1", "C3"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(5.0, 1.0, "R2", "C3"); assertEquals(new Range(-2.2, 6.0), r.findRangeBounds(dataset)); // check that the series visible flag is observed r.setSeriesVisible(1, Boolean.FALSE); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); }
void function() { StatisticalLineAndShapeRenderer r = new StatisticalLineAndShapeRenderer(); assertNull(r.findRangeBounds(null)); DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); assertNull(r.findRangeBounds(dataset)); dataset.add(1.0, 0.5, "R1", "C1"); assertEquals(new Range(0.5, 1.5), r.findRangeBounds(dataset)); dataset.add(-2.0, 0.2, "R1", "C2"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(null, null, "R1", "C3"); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); dataset.add(5.0, 1.0, "R2", "C3"); assertEquals(new Range(-2.2, 6.0), r.findRangeBounds(dataset)); r.setSeriesVisible(1, Boolean.FALSE); assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset)); }
/** * Some checks for the findRangeBounds() method. */
Some checks for the findRangeBounds() method
testFindRangeBounds
{ "repo_name": "JSansalone/JFreeChart", "path": "tests/org/jfree/chart/renderer/category/junit/StatisticalLineAndShapeRendererTests.java", "license": "lgpl-2.1", "size": 8239 }
[ "org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer", "org.jfree.data.Range", "org.jfree.data.statistics.DefaultStatisticalCategoryDataset" ]
import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer; import org.jfree.data.Range; import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
import org.jfree.chart.renderer.category.*; import org.jfree.data.*; import org.jfree.data.statistics.*;
[ "org.jfree.chart", "org.jfree.data" ]
org.jfree.chart; org.jfree.data;
1,134,191
public List<DatabaseTable> getOwnedTables() { return super.getOwnedTables(); }
List<DatabaseTable> function() { return super.getOwnedTables(); }
/** * This owns (can access) the child's extra tables as well as its parent's tables * so we should pull these from super (which gets them from the current descriptor) */
This owns (can access) the child's extra tables as well as its parent's tables so we should pull these from super (which gets them from the current descriptor)
getOwnedTables
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/expressions/TreatAsExpression.java", "license": "epl-1.0", "size": 25857 }
[ "java.util.List", "org.eclipse.persistence.internal.helper.DatabaseTable" ]
import java.util.List; import org.eclipse.persistence.internal.helper.DatabaseTable;
import java.util.*; import org.eclipse.persistence.internal.helper.*;
[ "java.util", "org.eclipse.persistence" ]
java.util; org.eclipse.persistence;
1,095,184
public static SignUpResponse signUp(SignUpCredentials signUpCredentials){ return getAM().signUp(signUpCredentials); }
static SignUpResponse function(SignUpCredentials signUpCredentials){ return getAM().signUp(signUpCredentials); }
/** * Perform syncronously sign up attempt. * @param signUpCredentials credentials used for sign up attempt. * @return signup results. */
Perform syncronously sign up attempt
signUp
{ "repo_name": "HiddenStage/divide", "path": "Client/java-client/src/main/java/io/divide/client/BackendUser.java", "license": "apache-2.0", "size": 8262 }
[ "io.divide.client.auth.SignUpResponse", "io.divide.client.auth.credentials.SignUpCredentials" ]
import io.divide.client.auth.SignUpResponse; import io.divide.client.auth.credentials.SignUpCredentials;
import io.divide.client.auth.*; import io.divide.client.auth.credentials.*;
[ "io.divide.client" ]
io.divide.client;
1,623,313
public static FilterProtos.Filter toFilter(Filter filter) throws IOException { FilterProtos.Filter.Builder builder = FilterProtos.Filter.newBuilder(); builder.setName(filter.getClass().getName()); builder.setSerializedFilter(ByteStringer.wrap(filter.toByteArray())); return builder.build(); }
static FilterProtos.Filter function(Filter filter) throws IOException { FilterProtos.Filter.Builder builder = FilterProtos.Filter.newBuilder(); builder.setName(filter.getClass().getName()); builder.setSerializedFilter(ByteStringer.wrap(filter.toByteArray())); return builder.build(); }
/** * Convert a client Filter to a protocol buffer Filter * * @param filter the Filter to convert * @return the converted protocol buffer Filter */
Convert a client Filter to a protocol buffer Filter
toFilter
{ "repo_name": "drewpope/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java", "license": "apache-2.0", "size": 114457 }
[ "java.io.IOException", "org.apache.hadoop.hbase.filter.Filter", "org.apache.hadoop.hbase.protobuf.generated.FilterProtos", "org.apache.hadoop.hbase.util.ByteStringer" ]
import java.io.IOException; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; import org.apache.hadoop.hbase.util.ByteStringer;
import java.io.*; import org.apache.hadoop.hbase.filter.*; import org.apache.hadoop.hbase.protobuf.generated.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
106,020
public EmrCluster terminateCluster(EmrClusterAlternateKeyDto emrClusterAlternateKeyDto, boolean overrideTerminationProtection, String emrClusterId, String accountId) throws Exception;
EmrCluster function(EmrClusterAlternateKeyDto emrClusterAlternateKeyDto, boolean overrideTerminationProtection, String emrClusterId, String accountId) throws Exception;
/** * Terminates the EMR Cluster. * * @param emrClusterAlternateKeyDto the EMR cluster alternate key * @param overrideTerminationProtection parameter for whether to override termination protection * @param emrClusterId the id of the cluster * @param accountId the optional AWS account that EMR cluster is running in * * @return the terminated EMR cluster object * @throws Exception if there were any errors while terminating the cluster */
Terminates the EMR Cluster
terminateCluster
{ "repo_name": "kusid/herd", "path": "herd-code/herd-service/src/main/java/org/finra/herd/service/EmrService.java", "license": "apache-2.0", "size": 3859 }
[ "org.finra.herd.model.api.xml.EmrCluster", "org.finra.herd.model.dto.EmrClusterAlternateKeyDto" ]
import org.finra.herd.model.api.xml.EmrCluster; import org.finra.herd.model.dto.EmrClusterAlternateKeyDto;
import org.finra.herd.model.api.xml.*; import org.finra.herd.model.dto.*;
[ "org.finra.herd" ]
org.finra.herd;
2,048,954
public DateTime creationTime() { return this.creationTime; }
DateTime function() { return this.creationTime; }
/** * Get gets the creation date and time of the storage account in UTC. * * @return the creationTime value */
Get gets the creation date and time of the storage account in UTC
creationTime
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageAccountInner.java", "license": "mit", "size": 16912 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
1,117,091
return configuration.getFlowId(); } /** * Compiles the target flow graph and returns its jobflow model. * @param graph the target flow graph * @return the compiled model * @throws IOException if error was occurred while creating artifacts * @throws IllegalArgumentException if the parameter is {@code null}
return configuration.getFlowId(); } /** * Compiles the target flow graph and returns its jobflow model. * @param graph the target flow graph * @return the compiled model * @throws IOException if error was occurred while creating artifacts * @throws IllegalArgumentException if the parameter is {@code null}
/** * Returns the target flow ID. * @return the target flow ID */
Returns the target flow ID
getTargetFlowId
{ "repo_name": "cocoatomo/asakusafw", "path": "mapreduce/compiler/core/src/main/java/com/asakusafw/compiler/flow/FlowCompiler.java", "license": "apache-2.0", "size": 9085 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,671,232
boolean setAttributeWithNullValue(final PerunSession sess, final String key, final Attribute attribute) throws InternalErrorException;
boolean setAttributeWithNullValue(final PerunSession sess, final String key, final Attribute attribute) throws InternalErrorException;
/** * Set entityless attribute with null value (for key and attribute). Shouldn't be called from upper layer !!! * * @param sess * @param key key for storing entityless attribute * @param attribute attribute to set * * @return true if insert is ok * * @throws InternalErrorException if runtimeException is thrown */
Set entityless attribute with null value (for key and attribute). Shouldn't be called from upper layer !!
setAttributeWithNullValue
{ "repo_name": "Natrezim/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/AttributesManagerImplApi.java", "license": "bsd-2-clause", "size": 104335 }
[ "cz.metacentrum.perun.core.api.Attribute", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException" ]
import cz.metacentrum.perun.core.api.Attribute; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
961,683
public static Map<Node, Node> mapMainToClone(Node main, Node clone) { Preconditions.checkState(main.isEquivalentTo(clone)); Map<Node, Node> mtoc = new HashMap<>(); mtoc.put(main, clone); mtocHelper(mtoc, main, clone); return mtoc; }
static Map<Node, Node> function(Node main, Node clone) { Preconditions.checkState(main.isEquivalentTo(clone)); Map<Node, Node> mtoc = new HashMap<>(); mtoc.put(main, clone); mtocHelper(mtoc, main, clone); return mtoc; }
/** * Given an AST and its copy, map the root node of each scope of main to the * corresponding root node of clone */
Given an AST and its copy, map the root node of each scope of main to the corresponding root node of clone
mapMainToClone
{ "repo_name": "tntim96/closure-compiler", "path": "src/com/google/javascript/jscomp/NodeUtil.java", "license": "apache-2.0", "size": 117627 }
[ "com.google.common.base.Preconditions", "com.google.javascript.rhino.Node", "java.util.HashMap", "java.util.Map" ]
import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node; import java.util.HashMap; import java.util.Map;
import com.google.common.base.*; import com.google.javascript.rhino.*; import java.util.*;
[ "com.google.common", "com.google.javascript", "java.util" ]
com.google.common; com.google.javascript; java.util;
16,957
public byte[] toEntropy(List<String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException { if (words.size() % 3 > 0) throw new MnemonicException.MnemonicLengthException("Word list size must be multiple of three words."); // Look up all the words in the list and construct the // concatenation of the original entropy and the checksum. // int concatLenBits = words.size() * 11; boolean[] concatBits = new boolean[concatLenBits]; int wordindex = 0; for (String word : words) { // Find the words index in the wordlist. int ndx = Collections.binarySearch(this.wordList, word); if (ndx < 0) throw new MnemonicException.MnemonicWordException(word); // Set the next 11 bits to the value of the index. for (int ii = 0; ii < 11; ++ii) concatBits[(wordindex * 11) + ii] = (ndx & (1 << (10 - ii))) != 0; ++wordindex; } int checksumLengthBits = concatLenBits / 33; int entropyLengthBits = concatLenBits - checksumLengthBits; // Extract original entropy as bytes. byte[] entropy = new byte[entropyLengthBits / 8]; for (int ii = 0; ii < entropy.length; ++ii) for (int jj = 0; jj < 8; ++jj) if (concatBits[(ii * 8) + jj]) entropy[ii] |= 1 << (7 - jj); // Take the digest of the entropy. byte[] hash = Sha256Hash.create(entropy).getBytes(); boolean[] hashBits = bytesToBits(hash); // Check all the checksum bits. for (int i = 0; i < checksumLengthBits; ++i) if (concatBits[entropyLengthBits + i] != hashBits[i]) throw new MnemonicException.MnemonicChecksumException(); return entropy; }
byte[] function(List<String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException { if (words.size() % 3 > 0) throw new MnemonicException.MnemonicLengthException(STR); boolean[] concatBits = new boolean[concatLenBits]; int wordindex = 0; for (String word : words) { int ndx = Collections.binarySearch(this.wordList, word); if (ndx < 0) throw new MnemonicException.MnemonicWordException(word); for (int ii = 0; ii < 11; ++ii) concatBits[(wordindex * 11) + ii] = (ndx & (1 << (10 - ii))) != 0; ++wordindex; } int checksumLengthBits = concatLenBits / 33; int entropyLengthBits = concatLenBits - checksumLengthBits; byte[] entropy = new byte[entropyLengthBits / 8]; for (int ii = 0; ii < entropy.length; ++ii) for (int jj = 0; jj < 8; ++jj) if (concatBits[(ii * 8) + jj]) entropy[ii] = 1 << (7 - jj); byte[] hash = Sha256Hash.create(entropy).getBytes(); boolean[] hashBits = bytesToBits(hash); for (int i = 0; i < checksumLengthBits; ++i) if (concatBits[entropyLengthBits + i] != hashBits[i]) throw new MnemonicException.MnemonicChecksumException(); return entropy; }
/** * Convert mnemonic word list to original entropy value. */
Convert mnemonic word list to original entropy value
toEntropy
{ "repo_name": "mysweetyweed/weedtokensj", "path": "core/src/main/java/com/google/bitcoin/crypto/MnemonicCode.java", "license": "apache-2.0", "size": 7911 }
[ "com.google.bitcoin.core.Sha256Hash", "java.util.Collections", "java.util.List" ]
import com.google.bitcoin.core.Sha256Hash; import java.util.Collections; import java.util.List;
import com.google.bitcoin.core.*; import java.util.*;
[ "com.google.bitcoin", "java.util" ]
com.google.bitcoin; java.util;
1,721,683
public static String getExtension(final String s) { if (s == null) { return null; } for(int i = s.length() - 1; i >= 0; i--){ final char c = s.charAt(i); if(c == File.separatorChar || c == '/' ) return ""; if(c == '.'){ return s.substring(i+1).trim().toLowerCase(); } } return ""; }
static String function(final String s) { if (s == null) { return null; } for(int i = s.length() - 1; i >= 0; i--){ final char c = s.charAt(i); if(c == File.separatorChar c == '/' ) return STR"; }
/** * Returns the lowercase of the extension of a file. */
Returns the lowercase of the extension of a file
getExtension
{ "repo_name": "SDX2000/freeplane", "path": "freeplane/src/org/freeplane/core/util/FileUtils.java", "license": "gpl-2.0", "size": 8829 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
823,016
static public MembershipManager newMembershipManager(DistributedMembershipListener listener, DistributionConfig config, RemoteTransportConfig transport, DMStats stats) { return services.newMembershipManager(listener, config, transport, stats); }
static MembershipManager function(DistributedMembershipListener listener, DistributionConfig config, RemoteTransportConfig transport, DMStats stats) { return services.newMembershipManager(listener, config, transport, stats); }
/** * Create a new MembershipManager. Be sure to send the manager a postConnect() message * before you start using it. * * @param listener the listener to notify for callbacks * @param config the configuration of connection to distributed system * @param transport holds configuration information that can be used by the manager to configure itself * @param stats are used for recording statistical communications information * @return a MembershipManager */
Create a new MembershipManager. Be sure to send the manager a postConnect() message before you start using it
newMembershipManager
{ "repo_name": "sshcherbakov/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/MemberFactory.java", "license": "apache-2.0", "size": 3851 }
[ "com.gemstone.gemfire.distributed.internal.DMStats", "com.gemstone.gemfire.distributed.internal.DistributionConfig", "com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig" ]
import com.gemstone.gemfire.distributed.internal.DMStats; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.internal.admin.remote.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
1,697,701
public List<List<String>> getAttributeAsStringMatrix (String key , List<List<String>> defaultValue) { checkAttachedToNetPlanObject(); final String val = attributes.get(key); if (val == null) return defaultValue; if (val.equals("")) return new ArrayList<> (); try { final String [] rows = val.split(MATRIX_ROWSEPARATOR,-1); final List<List<String>> res = new ArrayList<> (rows.length); int numCols = 0; for (String row : rows) { //if (row.equals("")) continue; final List<String> rowVals = new LinkedList<> (); res.add(rowVals); for (String cell : row.split(MATRIX_COLSEPARATOR,-1)) { //if (cell.equals("")) continue; rowVals.add(StringUtils.unescapedStringRead(cell)); } numCols = Math.max(numCols, rowVals.size()); } return res; } catch (Exception ee) { return defaultValue; } }
List<List<String>> function (String key , List<List<String>> defaultValue) { checkAttachedToNetPlanObject(); final String val = attributes.get(key); if (val == null) return defaultValue; if (val.equals("")) return new ArrayList<> (); try { final String [] rows = val.split(MATRIX_ROWSEPARATOR,-1); final List<List<String>> res = new ArrayList<> (rows.length); int numCols = 0; for (String row : rows) { final List<String> rowVals = new LinkedList<> (); res.add(rowVals); for (String cell : row.split(MATRIX_COLSEPARATOR,-1)) { rowVals.add(StringUtils.unescapedStringRead(cell)); } numCols = Math.max(numCols, rowVals.size()); } return res; } catch (Exception ee) { return defaultValue; } }
/** * Returns the value of a given attribute for this network element, in form of a list of list of strings, as stored using the setAttributeAsStringMatrix method * @param key Attribute name * @param defaultValue default value to return if not found, or could not be parsed * @return see above */
Returns the value of a given attribute for this network element, in form of a list of list of strings, as stored using the setAttributeAsStringMatrix method
getAttributeAsStringMatrix
{ "repo_name": "girtel/Net2Plan", "path": "Net2Plan-Core/src/main/java/com/net2plan/interfaces/networkDesign/NetworkElement.java", "license": "bsd-2-clause", "size": 21575 }
[ "com.net2plan.utils.StringUtils", "java.util.ArrayList", "java.util.LinkedList", "java.util.List" ]
import com.net2plan.utils.StringUtils; import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
import com.net2plan.utils.*; import java.util.*;
[ "com.net2plan.utils", "java.util" ]
com.net2plan.utils; java.util;
1,265,170
@FIXVersion(introduced="4.0") @TagNumRef(tagNum=TagNum.ExecID) public String getExecID() { return execID; }
@FIXVersion(introduced="4.0") @TagNumRef(tagNum=TagNum.ExecID) String function() { return execID; }
/** * Message field getter. * @return field value */
Message field getter
getExecID
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/group/ExecAllocGroup.java", "license": "gpl-3.0", "size": 13509 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.TagNum" ]
import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum;
import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "net.hades.fix" ]
net.hades.fix;
1,937,537
TransformInputBuilder addJarInput(List<String> filePaths) { for (String filePath : filePaths) { addJarInput(new File(filePath)); } return this; }
TransformInputBuilder addJarInput(List<String> filePaths) { for (String filePath : filePaths) { addJarInput(new File(filePath)); } return this; }
/** * Adds multiple jar inputs for this transform input. * * @param filePaths the paths of the jars. * @return this instance of the builder. */
Adds multiple jar inputs for this transform input
addJarInput
{ "repo_name": "Piasy/OkBuck", "path": "transform-cli/src/main/java/com/uber/okbuck/transform/TransformInputBuilder.java", "license": "mit", "size": 4834 }
[ "java.io.File", "java.util.List" ]
import java.io.File; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
196,537
@Generated @Selector("damping") @NFloat public native double damping();
@Selector(STR) native double function();
/** * damping value from 0.0 to 1.0. 1.0 is the least oscillation. */
damping value from 0.0 to 1.0. 1.0 is the least oscillation
damping
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UISnapBehavior.java", "license": "apache-2.0", "size": 5795 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
1,832,532
public Timestamp getTransactionEntryProcessedTimestamp() { return super.getTransactionEntryProcessedTs(); }
Timestamp function() { return super.getTransactionEntryProcessedTs(); }
/** * Gets the TransactionEntryProcessedTs. * * @see org.kuali.kfs.module.ld.businessobject.LaborTransaction#getTransactionEntryProcessedTimestamp() */
Gets the TransactionEntryProcessedTs
getTransactionEntryProcessedTimestamp
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-ld/src/main/java/org/kuali/kfs/module/ld/businessobject/LaborLedgerPendingEntry.java", "license": "agpl-3.0", "size": 15595 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,392,741
public void checkoutProjectTemplate(final GeneratorDto dto) throws NotificationException { final ProjectEntity entity = dto.getProject(); String destDirString = Constants.TMP_DIR + Constants.FILE_SEP + entity.getTargetPath(); final File destDir = new File(destDirString); String srcDir = entity.getTemplate().getLocation(); String branch = Constants.DEFAULT_BRANCH; if (entity.getTemplate().getBranch() != null) { branch = entity.getTemplate().getBranch(); } if (dto.getProject().getTemplate().isCredentialsRequired()) { dto.setPassword(dto.getPassword().replaceAll("@", "%40")); srcDir = srcDir.replaceAll("://", "://" + dto.getUsername() + ":" + dto.getPassword() + "@"); } try { Git.gitClone(destDir.toPath(), srcDir, branch); } catch (IOException | InterruptedException e) { this.deleteTempURLProject(Constants.TMP_DIR + Constants.FILE_SEP + destDirString); LOG.error("Error copying files for project template.", e); final ResponseMetadata data = new ResponseMetadata(ResponseCode.ERROR, "error.projectcheckout.checkoutprojecttemplate.transport"); throw new NotificationException(data); } }
void function(final GeneratorDto dto) throws NotificationException { final ProjectEntity entity = dto.getProject(); String destDirString = Constants.TMP_DIR + Constants.FILE_SEP + entity.getTargetPath(); final File destDir = new File(destDirString); String srcDir = entity.getTemplate().getLocation(); String branch = Constants.DEFAULT_BRANCH; if (entity.getTemplate().getBranch() != null) { branch = entity.getTemplate().getBranch(); } if (dto.getProject().getTemplate().isCredentialsRequired()) { dto.setPassword(dto.getPassword().replaceAll("@", "%40")); srcDir = srcDir.replaceAll(STRError copying files for project template.STRerror.projectcheckout.checkoutprojecttemplate.transport"); throw new NotificationException(data); } }
/** * Copies the project template and tomee to an new project location. * * @param entity * @return * @throws NotificationException */
Copies the project template and tomee to an new project location
checkoutProjectTemplate
{ "repo_name": "witchpou/lj-projectbuilder", "path": "ljprojectbuilder/generator/src/main/java/de/starwit/generator/services/ProjectCheckout.java", "license": "apache-2.0", "size": 4291 }
[ "de.starwit.generator.config.Constants", "de.starwit.generator.dto.GeneratorDto", "de.starwit.ljprojectbuilder.entity.ProjectEntity", "de.starwit.ljprojectbuilder.exception.NotificationException", "java.io.File" ]
import de.starwit.generator.config.Constants; import de.starwit.generator.dto.GeneratorDto; import de.starwit.ljprojectbuilder.entity.ProjectEntity; import de.starwit.ljprojectbuilder.exception.NotificationException; import java.io.File;
import de.starwit.generator.config.*; import de.starwit.generator.dto.*; import de.starwit.ljprojectbuilder.entity.*; import de.starwit.ljprojectbuilder.exception.*; import java.io.*;
[ "de.starwit.generator", "de.starwit.ljprojectbuilder", "java.io" ]
de.starwit.generator; de.starwit.ljprojectbuilder; java.io;
1,300,027
public List<IconType<EjbJarDescriptor>> getAllIcon() { List<IconType<EjbJarDescriptor>> list = new ArrayList<IconType<EjbJarDescriptor>>(); List<Node> nodeList = model.get("icon"); for(Node node: nodeList) { IconType<EjbJarDescriptor> type = new IconTypeImpl<EjbJarDescriptor>(this, "icon", model, node); list.add(type); } return list; }
List<IconType<EjbJarDescriptor>> function() { List<IconType<EjbJarDescriptor>> list = new ArrayList<IconType<EjbJarDescriptor>>(); List<Node> nodeList = model.get("icon"); for(Node node: nodeList) { IconType<EjbJarDescriptor> type = new IconTypeImpl<EjbJarDescriptor>(this, "icon", model, node); list.add(type); } return list; }
/** * Returns all <code>icon</code> elements * @return list of <code>icon</code> */
Returns all <code>icon</code> elements
getAllIcon
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar31/EjbJarDescriptorImpl.java", "license": "epl-1.0", "size": 21195 }
[ "java.util.ArrayList", "java.util.List", "org.jboss.shrinkwrap.descriptor.api.ejbjar31.EjbJarDescriptor", "org.jboss.shrinkwrap.descriptor.api.javaee6.IconType", "org.jboss.shrinkwrap.descriptor.impl.javaee6.IconTypeImpl", "org.jboss.shrinkwrap.descriptor.spi.node.Node" ]
import java.util.ArrayList; import java.util.List; import org.jboss.shrinkwrap.descriptor.api.ejbjar31.EjbJarDescriptor; import org.jboss.shrinkwrap.descriptor.api.javaee6.IconType; import org.jboss.shrinkwrap.descriptor.impl.javaee6.IconTypeImpl; import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import java.util.*; import org.jboss.shrinkwrap.descriptor.api.ejbjar31.*; import org.jboss.shrinkwrap.descriptor.api.javaee6.*; import org.jboss.shrinkwrap.descriptor.impl.javaee6.*; import org.jboss.shrinkwrap.descriptor.spi.node.*;
[ "java.util", "org.jboss.shrinkwrap" ]
java.util; org.jboss.shrinkwrap;
2,840,381
Set<V> readUnion(String... names);
Set<V> readUnion(String... names);
/** * Union sets specified by name with current set * without current set state change. * * @param names - name of sets * @return values */
Union sets specified by name with current set without current set state change
readUnion
{ "repo_name": "mrniko/redisson", "path": "redisson/src/main/java/org/redisson/api/RSet.java", "license": "apache-2.0", "size": 7153 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,654,866
private static Map<String, SnmpOid> buildPoolIndexMap(SnmpTableHandler handler) { // optimization... if (handler instanceof SnmpCachedData) return buildPoolIndexMap((SnmpCachedData)handler); // not optimizable... too bad. final Map<String, SnmpOid> m = new HashMap<>(); SnmpOid index=null; while ((index = handler.getNext(index))!=null) { final MemoryPoolMXBean mpm = (MemoryPoolMXBean)handler.getData(index); if (mpm == null) continue; final String name = mpm.getName(); if (name == null) continue; m.put(name,index); } return m; }
static Map<String, SnmpOid> function(SnmpTableHandler handler) { if (handler instanceof SnmpCachedData) return buildPoolIndexMap((SnmpCachedData)handler); final Map<String, SnmpOid> m = new HashMap<>(); SnmpOid index=null; while ((index = handler.getNext(index))!=null) { final MemoryPoolMXBean mpm = (MemoryPoolMXBean)handler.getData(index); if (mpm == null) continue; final String name = mpm.getName(); if (name == null) continue; m.put(name,index); } return m; }
/** * Builds a map pool-name => pool-index from the SnmpTableHandler * of the JvmMemPoolTable. **/
Builds a map pool-name => pool-index from the SnmpTableHandler of the JvmMemPoolTable
buildPoolIndexMap
{ "repo_name": "openjdk/jdk7u", "path": "jdk/src/share/classes/sun/management/snmp/jvminstr/JvmMemMgrPoolRelTableMetaImpl.java", "license": "gpl-2.0", "size": 19684 }
[ "com.sun.jmx.snmp.SnmpOid", "java.lang.management.MemoryPoolMXBean", "java.util.HashMap", "java.util.Map" ]
import com.sun.jmx.snmp.SnmpOid; import java.lang.management.MemoryPoolMXBean; import java.util.HashMap; import java.util.Map;
import com.sun.jmx.snmp.*; import java.lang.management.*; import java.util.*;
[ "com.sun.jmx", "java.lang", "java.util" ]
com.sun.jmx; java.lang; java.util;
2,144,047
protected boolean initMinimumOptions() { // create and initialize the common options for most commands if (options == null) options = new Options(); SmtProperty sp = SmtProperty.SMT_HELP; Option help = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_VERSION; Option version = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_READ_CONFIG; Option cFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_LOG_FILE; Option log_file = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_LOG_LEVEL; Option log_level = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); options.addOption(cFile); options.addOption(log_file); options.addOption(log_level); options.addOption(help); options.addOption(version); return true; }
boolean function() { if (options == null) options = new Options(); SmtProperty sp = SmtProperty.SMT_HELP; Option help = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_VERSION; Option version = new Option(sp.getShortName(), sp.getName(), false, sp.getDescription()); sp = SmtProperty.SMT_READ_CONFIG; Option cFile = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_LOG_FILE; Option log_file = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); sp = SmtProperty.SMT_LOG_LEVEL; Option log_level = OptionBuilder.hasArg(true).hasArgs(1).withArgName(sp.getArgName()) .withValueSeparator('=').withDescription(sp.getDescription()).withLongOpt(sp.getName()) .create(sp.getShortName()); options.addOption(cFile); options.addOption(log_file); options.addOption(log_level); options.addOption(help); options.addOption(version); return true; }
/** * All the options that are common to all SMT commands. This method should be * included within every init() method, near the top. * * @see describe related java objects * * @return ***********************************************************/
All the options that are common to all SMT commands. This method should be included within every init() method, near the top
initMinimumOptions
{ "repo_name": "meier/opensm-smt", "path": "src/main/java/gov/llnl/lc/smt/command/SmtCommand.java", "license": "gpl-2.0", "size": 58041 }
[ "gov.llnl.lc.smt.props.SmtProperty", "org.apache.commons.cli.Option", "org.apache.commons.cli.OptionBuilder", "org.apache.commons.cli.Options" ]
import gov.llnl.lc.smt.props.SmtProperty; import org.apache.commons.cli.Option; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options;
import gov.llnl.lc.smt.props.*; import org.apache.commons.cli.*;
[ "gov.llnl.lc", "org.apache.commons" ]
gov.llnl.lc; org.apache.commons;
1,008,696
@Bean @Conditional(InsightsSAMLBeanInitializationCondition.class) public InsightsExternalAPIAuthenticationFilter insightsExternalProcessingFilter() { return new InsightsExternalAPIAuthenticationFilter(); }
@Conditional(InsightsSAMLBeanInitializationCondition.class) InsightsExternalAPIAuthenticationFilter function() { return new InsightsExternalAPIAuthenticationFilter(); }
/** This bean use to validate External Request * @return */
This bean use to validate External Request
insightsExternalProcessingFilter
{ "repo_name": "CognizantOneDevOps/Insights", "path": "PlatformService/src/main/java/com/cognizant/devops/platformservice/security/config/saml/InsightsSecurityConfigurationAdapterSAML.java", "license": "apache-2.0", "size": 26210 }
[ "com.cognizant.devops.platformservice.security.config.InsightsExternalAPIAuthenticationFilter", "org.springframework.context.annotation.Conditional" ]
import com.cognizant.devops.platformservice.security.config.InsightsExternalAPIAuthenticationFilter; import org.springframework.context.annotation.Conditional;
import com.cognizant.devops.platformservice.security.config.*; import org.springframework.context.annotation.*;
[ "com.cognizant.devops", "org.springframework.context" ]
com.cognizant.devops; org.springframework.context;
2,607,901
public Iterable<Long> lengthAll(final byte[] key) throws IOException { return new BlobLengths(key); } private class BlobLengths extends LookAheadIterator<Long> { private final Iterator<blobItem> bii; private final byte[] key; public BlobLengths(final byte[] key) { this.bii = ArrayStack.this.blobs.iterator(); this.key = key; }
Iterable<Long> function(final byte[] key) throws IOException { return new BlobLengths(key); } private class BlobLengths extends LookAheadIterator<Long> { private final Iterator<blobItem> bii; private final byte[] key; public BlobLengths(final byte[] key) { this.bii = ArrayStack.this.blobs.iterator(); this.key = key; }
/** * get all BLOBs in the array. * this is useful when it is not clear if an entry is unique in all BLOBs in this array. * @param key * @return * @throws IOException */
get all BLOBs in the array. this is useful when it is not clear if an entry is unique in all BLOBs in this array
lengthAll
{ "repo_name": "automenta/kelondro", "path": "src/main/java/yacy/kelondro/blob/ArrayStack.java", "license": "lgpl-2.1", "size": 46847 }
[ "java.io.IOException", "java.util.Iterator", "net.yacy.cora.util.LookAheadIterator" ]
import java.io.IOException; import java.util.Iterator; import net.yacy.cora.util.LookAheadIterator;
import java.io.*; import java.util.*; import net.yacy.cora.util.*;
[ "java.io", "java.util", "net.yacy.cora" ]
java.io; java.util; net.yacy.cora;
659,076
protected boolean checkAssetLocked(MaintenanceDocument document) { Asset asset = (Asset) document.getNewMaintainableObject().getBusinessObject(); return !getCapitalAssetManagementModuleService().isAssetLocked(retrieveAssetNumberForLocking(asset), CamsConstants.DocumentTypeName.ASSET_EDIT, document.getDocumentNumber()); }
boolean function(MaintenanceDocument document) { Asset asset = (Asset) document.getNewMaintainableObject().getBusinessObject(); return !getCapitalAssetManagementModuleService().isAssetLocked(retrieveAssetNumberForLocking(asset), CamsConstants.DocumentTypeName.ASSET_EDIT, document.getDocumentNumber()); }
/** * Check if asset is locked by other document. * * @param document * @param valid * @return */
Check if asset is locked by other document
checkAssetLocked
{ "repo_name": "kuali/kfs", "path": "kfs-cam/src/main/java/org/kuali/kfs/module/cam/document/validation/impl/AssetRule.java", "license": "agpl-3.0", "size": 36025 }
[ "org.kuali.kfs.module.cam.CamsConstants", "org.kuali.kfs.module.cam.businessobject.Asset", "org.kuali.rice.kns.document.MaintenanceDocument" ]
import org.kuali.kfs.module.cam.CamsConstants; import org.kuali.kfs.module.cam.businessobject.Asset; import org.kuali.rice.kns.document.MaintenanceDocument;
import org.kuali.kfs.module.cam.*; import org.kuali.kfs.module.cam.businessobject.*; import org.kuali.rice.kns.document.*;
[ "org.kuali.kfs", "org.kuali.rice" ]
org.kuali.kfs; org.kuali.rice;
2,844,252
@ApiModelProperty(required = true, value = "the short name of the alliance") public String getTicker() { return ticker; }
@ApiModelProperty(required = true, value = STR) String function() { return ticker; }
/** * the short name of the alliance * * @return ticker **/
the short name of the alliance
getTicker
{ "repo_name": "burberius/eve-esi", "path": "src/main/java/net/troja/eve/esi/model/AllianceResponse.java", "license": "apache-2.0", "size": 7938 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
466,425
SyncedFlushService service = cluster.getInstance(SyncedFlushService.class); LatchedListener<ShardsSyncedFlushResult> listener = new LatchedListener(); service.attemptSyncedFlush(shardId, listener); try { listener.latch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (listener.error != null) { throw ExceptionsHelper.convertToElastic(listener.error); } return listener.result; } public static final class LatchedListener<T> implements ActionListener<T> { public volatile T result; public volatile Exception error; public final CountDownLatch latch = new CountDownLatch(1);
SyncedFlushService service = cluster.getInstance(SyncedFlushService.class); LatchedListener<ShardsSyncedFlushResult> listener = new LatchedListener(); service.attemptSyncedFlush(shardId, listener); try { listener.latch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } if (listener.error != null) { throw ExceptionsHelper.convertToElastic(listener.error); } return listener.result; } public static final class LatchedListener<T> implements ActionListener<T> { public volatile T result; public volatile Exception error; public final CountDownLatch latch = new CountDownLatch(1);
/** * Blocking version of {@link SyncedFlushService#attemptSyncedFlush(ShardId, ActionListener)} */
Blocking version of <code>SyncedFlushService#attemptSyncedFlush(ShardId, ActionListener)</code>
attemptSyncedFlush
{ "repo_name": "strahanjen/strahanjen.github.io", "path": "elasticsearch-master/core/src/test/java/org/elasticsearch/indices/flush/SyncedFlushUtil.java", "license": "bsd-3-clause", "size": 3382 }
[ "java.util.concurrent.CountDownLatch", "org.elasticsearch.ExceptionsHelper", "org.elasticsearch.action.ActionListener" ]
import java.util.concurrent.CountDownLatch; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionListener;
import java.util.concurrent.*; import org.elasticsearch.*; import org.elasticsearch.action.*;
[ "java.util", "org.elasticsearch", "org.elasticsearch.action" ]
java.util; org.elasticsearch; org.elasticsearch.action;
2,349,047
static DynamicState handleKillAndRelaunch(DynamicState dynamicState, StaticState staticState) throws Exception { assert(dynamicState.container != null); assert(dynamicState.currentAssignment != null); if (dynamicState.container.areAllProcessesDead()) { if (equivalent(dynamicState.newAssignment, dynamicState.currentAssignment)) { dynamicState.container.cleanUpForRestart(); dynamicState.container.relaunch(); return dynamicState.withState(MachineState.WAITING_FOR_WORKER_START); } //Scheduling changed after we killed all of the processes return prepareForNewAssignmentNoWorkersRunning(cleanupCurrentContainer(dynamicState, staticState, null), staticState); } //The child processes typically exit in < 1 sec. If 2 mins later they are still around something is wrong if ((Time.currentTimeMillis() - dynamicState.startTime) > 120_000) { throw new RuntimeException("Not all processes in " + dynamicState.container + " exited after 120 seconds"); } numForceKill.mark(); dynamicState.container.forceKill(); Time.sleep(staticState.killSleepMs); return dynamicState; }
static DynamicState handleKillAndRelaunch(DynamicState dynamicState, StaticState staticState) throws Exception { assert(dynamicState.container != null); assert(dynamicState.currentAssignment != null); if (dynamicState.container.areAllProcessesDead()) { if (equivalent(dynamicState.newAssignment, dynamicState.currentAssignment)) { dynamicState.container.cleanUpForRestart(); dynamicState.container.relaunch(); return dynamicState.withState(MachineState.WAITING_FOR_WORKER_START); } return prepareForNewAssignmentNoWorkersRunning(cleanupCurrentContainer(dynamicState, staticState, null), staticState); } if ((Time.currentTimeMillis() - dynamicState.startTime) > 120_000) { throw new RuntimeException(STR + dynamicState.container + STR); } numForceKill.mark(); dynamicState.container.forceKill(); Time.sleep(staticState.killSleepMs); return dynamicState; }
/** * State Transitions for KILL_AND_RELAUNCH state. * PRECONDITION: container.kill() was called * PRECONDITION: container != null && currentAssignment != null * @param dynamicState current state * @param staticState static data * @return the next state * @throws Exception on any error */
State Transitions for KILL_AND_RELAUNCH state
handleKillAndRelaunch
{ "repo_name": "srishtyagrawal/storm", "path": "storm-server/src/main/java/org/apache/storm/daemon/supervisor/Slot.java", "license": "apache-2.0", "size": 56416 }
[ "org.apache.storm.utils.Time" ]
import org.apache.storm.utils.Time;
import org.apache.storm.utils.*;
[ "org.apache.storm" ]
org.apache.storm;
2,757,676
public void addFeedbackNature() throws CoreException { ProjectNatureProjectDecorator.of(getProject()).addNature(Ids.NATURE); }
void function() throws CoreException { ProjectNatureProjectDecorator.of(getProject()).addNature(Ids.NATURE); }
/** * Adds the feedback nature to the project. */
Adds the feedback nature to the project
addFeedbackNature
{ "repo_name": "harinigunabalan/PerformanceHat", "path": "cw-feedback-eclipse-tests/src/eu/cloudwave/wp5/feedback/eclipse/tests/fixtures/base/FeedbackProjectFixture.java", "license": "apache-2.0", "size": 2329 }
[ "eu.cloudwave.wp5.feedback.eclipse.base.resources.decorators.ProjectNatureProjectDecorator", "eu.cloudwave.wp5.feedback.eclipse.performance.Ids", "org.eclipse.core.runtime.CoreException" ]
import eu.cloudwave.wp5.feedback.eclipse.base.resources.decorators.ProjectNatureProjectDecorator; import eu.cloudwave.wp5.feedback.eclipse.performance.Ids; import org.eclipse.core.runtime.CoreException;
import eu.cloudwave.wp5.feedback.eclipse.base.resources.decorators.*; import eu.cloudwave.wp5.feedback.eclipse.performance.*; import org.eclipse.core.runtime.*;
[ "eu.cloudwave.wp5", "org.eclipse.core" ]
eu.cloudwave.wp5; org.eclipse.core;
1,943,488
final String fileName = file.getName(); if (fileName.equalsIgnoreCase("(dirty)") || fileName.equalsIgnoreCase("[dirty]") || fileName.equalsIgnoreCase("(explicit)") || fileName.equalsIgnoreCase("[explicit]")) { return true; } else { // Check ID3 tag information Mp3File mp3 = new Mp3File(file.getAbsolutePath()); if (mp3.hasId3v2Tag()) { if (StringUtil.containsKeyword(mp3.getId3v2Tag().getTitle(), explicitContentIndicatorKeys)) { return true; } } else if (mp3.hasId3v1Tag()) { if (StringUtil.containsKeyword(mp3.getId3v1Tag().getTitle(), explicitContentIndicatorKeys)) { return true; } } else { throw new IllegalStateException("Given mp3 file has no readable ID3 tag information"); } } return false; }
final String fileName = file.getName(); if (fileName.equalsIgnoreCase(STR) fileName.equalsIgnoreCase(STR) fileName.equalsIgnoreCase(STR) fileName.equalsIgnoreCase(STR)) { return true; } else { Mp3File mp3 = new Mp3File(file.getAbsolutePath()); if (mp3.hasId3v2Tag()) { if (StringUtil.containsKeyword(mp3.getId3v2Tag().getTitle(), explicitContentIndicatorKeys)) { return true; } } else if (mp3.hasId3v1Tag()) { if (StringUtil.containsKeyword(mp3.getId3v1Tag().getTitle(), explicitContentIndicatorKeys)) { return true; } } else { throw new IllegalStateException(STR); } } return false; }
/** * Returns whether the file-name contains indicators for explicit content. * * @param file The file to analyse * @return Whether an indicator for explicit content has been found within the filename * @throws Exception */
Returns whether the file-name contains indicators for explicit content
mp3fileContainsExplicitContentIndicator
{ "repo_name": "ssmits/DML", "path": "src/main/java/de/dml/application/musicFileManagement/util/MusicFileManagementUtil.java", "license": "gpl-2.0", "size": 3534 }
[ "com.mpatric.mp3agic.Mp3File", "de.dml.application.util.StringUtil" ]
import com.mpatric.mp3agic.Mp3File; import de.dml.application.util.StringUtil;
import com.mpatric.mp3agic.*; import de.dml.application.util.*;
[ "com.mpatric.mp3agic", "de.dml.application" ]
com.mpatric.mp3agic; de.dml.application;
1,620,186
protected static void postPane(DesktopNotify window){ if(frame==null){ boolean bool = JDialog.isDefaultLookAndFeelDecorated(); JDialog.setDefaultLookAndFeelDecorated(false); frame = new DesktopLayoutFrame(); JDialog.setDefaultLookAndFeelDecorated(bool); } if(!frame.isVisible()) frame.setVisible(true); window.setWidth(300); window.sortMessage(); window.setVisible(true); windows.add(window); sparkControlThread(); }
static void function(DesktopNotify window){ if(frame==null){ boolean bool = JDialog.isDefaultLookAndFeelDecorated(); JDialog.setDefaultLookAndFeelDecorated(false); frame = new DesktopLayoutFrame(); JDialog.setDefaultLookAndFeelDecorated(bool); } if(!frame.isVisible()) frame.setVisible(true); window.setWidth(300); window.sortMessage(); window.setVisible(true); windows.add(window); sparkControlThread(); }
/** * Invoked by DesktopNotify, adds a notification to the queue. Notifications * are shown only when there is room for them to fit in the screen. * * @param window a <code>DesktopNotify</code> object */
Invoked by DesktopNotify, adds a notification to the queue. Notifications are shown only when there is room for them to fit in the screen
postPane
{ "repo_name": "DragShot/DS-Desktop-Notify", "path": "src/ds/desktop/notify/DesktopNotifyDriver.java", "license": "mit", "size": 7648 }
[ "javax.swing.JDialog" ]
import javax.swing.JDialog;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
1,296,913
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jStandardAttackBox = new javax.swing.JComboBox(); jButton3 = new javax.swing.JButton(); jUnitContainer = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); jSettingsButton = new javax.swing.JButton(); jXCollapsiblePane1 = new org.jdesktop.swingx.JXCollapsiblePane(); jPanel2.setLayout(new java.awt.GridBagLayout()); jLabel1.setText("Standardangriffe"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel2.add(jLabel1, gridBagConstraints); jStandardAttackBox.setMinimumSize(new java.awt.Dimension(120, 18)); jStandardAttackBox.setPreferredSize(new java.awt.Dimension(120, 20)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel2.add(jStandardAttackBox, gridBagConstraints);
@SuppressWarnings(STR) void function() { java.awt.GridBagConstraints gridBagConstraints; jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jStandardAttackBox = new javax.swing.JComboBox(); jButton3 = new javax.swing.JButton(); jUnitContainer = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); jSettingsButton = new javax.swing.JButton(); jXCollapsiblePane1 = new org.jdesktop.swingx.JXCollapsiblePane(); jPanel2.setLayout(new java.awt.GridBagLayout()); jLabel1.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel2.add(jLabel1, gridBagConstraints); jStandardAttackBox.setMinimumSize(new java.awt.Dimension(120, 18)); jStandardAttackBox.setPreferredSize(new java.awt.Dimension(120, 20)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel2.add(jStandardAttackBox, gridBagConstraints);
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this * method is always regenerated by the Form Editor. */
method is always regenerated by the Form Editor
initComponents
{ "repo_name": "Akeshihiro/dsworkbench", "path": "Core/src/main/java/de/tor/tribes/ui/panels/TroopSelectionPanel.java", "license": "apache-2.0", "size": 14050 }
[ "java.awt.Dimension", "java.awt.GridBagConstraints" ]
import java.awt.Dimension; import java.awt.GridBagConstraints;
import java.awt.*;
[ "java.awt" ]
java.awt;
136,035
synchronized public void updateAll() throws IOException { parentMan.updateAll(); Map<String, FlumeConfigData> updates = new HashMap<String, FlumeConfigData>(); for (Entry<String, FlumeConfigData> ent : parentMan.getTranslatedConfigs() .entrySet()) { String node = ent.getKey(); // get the original name FlumeConfigData fcd = ent.getValue(); String src = fcd.getSourceConfig(); String snk = fcd.getSinkConfig(); String xsnk, xsrc; try { xsnk = translateSink(node, snk); xsrc = translateSource(node, src); FlumeConfigData selfData = selfMan.getConfig(node); if (selfData != null && xsnk.equals(selfData.getSinkConfig()) && xsrc.equals(selfData.getSourceConfig())) { // same as before? do nothing LOG.debug("xsnk==snk = " + xsnk); LOG.debug("xsrc==src = " + xsrc); continue; } FlumeConfigData xfcd = new FlumeConfigData(fcd); xfcd.setSourceConfig(xsrc); xfcd.setSinkConfig(xsnk); updates.put(node, xfcd); } catch (FlumeSpecException e) { LOG.error("Internal Error: " + e.getLocalizedMessage(), e); throw new IOException("Internal Error: " + e.getMessage()); } } selfMan.setBulkConfig(updates); }
synchronized void function() throws IOException { parentMan.updateAll(); Map<String, FlumeConfigData> updates = new HashMap<String, FlumeConfigData>(); for (Entry<String, FlumeConfigData> ent : parentMan.getTranslatedConfigs() .entrySet()) { String node = ent.getKey(); FlumeConfigData fcd = ent.getValue(); String src = fcd.getSourceConfig(); String snk = fcd.getSinkConfig(); String xsnk, xsrc; try { xsnk = translateSink(node, snk); xsrc = translateSource(node, src); FlumeConfigData selfData = selfMan.getConfig(node); if (selfData != null && xsnk.equals(selfData.getSinkConfig()) && xsrc.equals(selfData.getSourceConfig())) { LOG.debug(STR + xsnk); LOG.debug(STR + xsrc); continue; } FlumeConfigData xfcd = new FlumeConfigData(fcd); xfcd.setSourceConfig(xsrc); xfcd.setSinkConfig(xsnk); updates.put(node, xfcd); } catch (FlumeSpecException e) { LOG.error(STR + e.getLocalizedMessage(), e); throw new IOException(STR + e.getMessage()); } } selfMan.setBulkConfig(updates); }
/** * This reads a configuration and updates the version stamp only if the new * configuration is different from the previous configuration. */
This reads a configuration and updates the version stamp only if the new configuration is different from the previous configuration
updateAll
{ "repo_name": "hammer/flume", "path": "src/java/com/cloudera/flume/master/TranslatingConfigurationManager.java", "license": "apache-2.0", "size": 15298 }
[ "com.cloudera.flume.conf.FlumeSpecException", "com.cloudera.flume.conf.thrift.FlumeConfigData", "java.io.IOException", "java.util.HashMap", "java.util.Map" ]
import com.cloudera.flume.conf.FlumeSpecException; import com.cloudera.flume.conf.thrift.FlumeConfigData; import java.io.IOException; import java.util.HashMap; import java.util.Map;
import com.cloudera.flume.conf.*; import com.cloudera.flume.conf.thrift.*; import java.io.*; import java.util.*;
[ "com.cloudera.flume", "java.io", "java.util" ]
com.cloudera.flume; java.io; java.util;
57,884
public static List<GridSet> readJSONData(Context context) { if (context == null) { return null; } try { final FileInputStream fis = context.openFileInput(DATA_FILE_NAME); final InputStreamReader inputStreamReader = new InputStreamReader(fis); final BufferedReader bufferedReader = new BufferedReader(inputStreamReader); final StringBuilder sb = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { sb.append(line); } final GridSet[] gridSets = new Gson().fromJson(sb.toString(), GridSet[].class); return new ArrayList<>(Arrays.asList(gridSets)); } catch (FileNotFoundException ex) { Log.e(TAG, "Data file not found: " + ex.getMessage()); } catch (Exception ex) { Log.e(TAG, "Exception: " + ex.getMessage()); } return null; }
static List<GridSet> function(Context context) { if (context == null) { return null; } try { final FileInputStream fis = context.openFileInput(DATA_FILE_NAME); final InputStreamReader inputStreamReader = new InputStreamReader(fis); final BufferedReader bufferedReader = new BufferedReader(inputStreamReader); final StringBuilder sb = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { sb.append(line); } final GridSet[] gridSets = new Gson().fromJson(sb.toString(), GridSet[].class); return new ArrayList<>(Arrays.asList(gridSets)); } catch (FileNotFoundException ex) { Log.e(TAG, STR + ex.getMessage()); } catch (Exception ex) { Log.e(TAG, STR + ex.getMessage()); } return null; }
/** * Reads a JSON data file and returns a JSON object. * @param context A valid Context object * @return A JSONArray representation of the data (GridSets) in the file. */
Reads a JSON data file and returns a JSON object
readJSONData
{ "repo_name": "kabojnk/gridly", "path": "source/app/src/main/java/us/poitot/gridly/util/DataUtil.java", "license": "mit", "size": 2776 }
[ "android.content.Context", "android.util.Log", "com.google.gson.Gson", "java.io.BufferedReader", "java.io.FileInputStream", "java.io.FileNotFoundException", "java.io.InputStreamReader", "java.util.ArrayList", "java.util.Arrays", "java.util.List", "us.poitot.gridly.models.GridSet" ]
import android.content.Context; import android.util.Log; import com.google.gson.Gson; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import us.poitot.gridly.models.GridSet;
import android.content.*; import android.util.*; import com.google.gson.*; import java.io.*; import java.util.*; import us.poitot.gridly.models.*;
[ "android.content", "android.util", "com.google.gson", "java.io", "java.util", "us.poitot.gridly" ]
android.content; android.util; com.google.gson; java.io; java.util; us.poitot.gridly;
1,672,240
public List<mxImageBundle> getImageBundles() { return imageBundles; }
List<mxImageBundle> function() { return imageBundles; }
/** * Returns the image bundles */
Returns the image bundles
getImageBundles
{ "repo_name": "luartmg/WMA", "path": "WMA/LibreriaJGraphx/src/com/mxgraph/view/mxGraph.java", "license": "apache-2.0", "size": 204261 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
542,312
private static double calcDiffBetweenLastAndFirstRecord(List<Record> recordList) throws AggregationException { if (recordList.size() < 2) { throw new AggregationException("List holds less than 2 records, calculation of difference not possible."); } double end = AggregatorUtil.findLastRecordIn(recordList).getValue().asDouble(); double start = recordList.get(0).getValue().asDouble(); return end - start; }
static double function(List<Record> recordList) throws AggregationException { if (recordList.size() < 2) { throw new AggregationException(STR); } double end = AggregatorUtil.findLastRecordIn(recordList).getValue().asDouble(); double start = recordList.get(0).getValue().asDouble(); return end - start; }
/** * Calculates the difference between the last and first value of the list. <br> * Can be used to determine the energy per interval */
Calculates the difference between the last and first value of the list. Can be used to determine the energy per interval
calcDiffBetweenLastAndFirstRecord
{ "repo_name": "isc-konstanz/OpenMUC", "path": "projects/driver/aggregator/src/main/java/org/openmuc/framework/driver/aggregator/types/DiffAggregation.java", "license": "gpl-3.0", "size": 2548 }
[ "java.util.List", "org.openmuc.framework.data.Record", "org.openmuc.framework.driver.aggregator.AggregationException", "org.openmuc.framework.driver.aggregator.AggregatorUtil" ]
import java.util.List; import org.openmuc.framework.data.Record; import org.openmuc.framework.driver.aggregator.AggregationException; import org.openmuc.framework.driver.aggregator.AggregatorUtil;
import java.util.*; import org.openmuc.framework.data.*; import org.openmuc.framework.driver.aggregator.*;
[ "java.util", "org.openmuc.framework" ]
java.util; org.openmuc.framework;
1,655,275
@Deprecated public MacacaClient sendKeys(String keys) throws Exception { JSONObject jsonObject = new JSONObject(); ArrayList<String> values = new ArrayList<String>(); values.add(keys); jsonObject.put("value", values); element.setValue(jsonObject); return this; }
MacacaClient function(String keys) throws Exception { JSONObject jsonObject = new JSONObject(); ArrayList<String> values = new ArrayList<String>(); values.add(keys); jsonObject.put("value", values); element.setValue(jsonObject); return this; }
/** * <p> * Send a sequence of key strokes to the active element.<br> * Support: Android iOS Web(WebView) * * @param keys The keys sequence to be sent. * @return The currently instance of MacacaClient * attention: * if the textfiled has text already,you need clear it then sendkeys * @throws Exception */
Send a sequence of key strokes to the active element. Support: Android iOS Web(WebView)
sendKeys
{ "repo_name": "macacajs/wd.java", "path": "src/main/java/macaca/client/MacacaClient.java", "license": "mit", "size": 51693 }
[ "com.alibaba.fastjson.JSONObject", "java.util.ArrayList" ]
import com.alibaba.fastjson.JSONObject; import java.util.ArrayList;
import com.alibaba.fastjson.*; import java.util.*;
[ "com.alibaba.fastjson", "java.util" ]
com.alibaba.fastjson; java.util;
2,588,364
public void setRaw(int value) { PWMJNI.setPWMRaw(m_handle, (short) value); }
void function(int value) { PWMJNI.setPWMRaw(m_handle, (short) value); }
/** * Set the PWM value directly to the hardware. * * <p>Write a raw value to a PWM channel. * * @param value Raw PWM value. Range 0 - 255. */
Set the PWM value directly to the hardware. Write a raw value to a PWM channel
setRaw
{ "repo_name": "PeterMitrano/allwpilib", "path": "wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWM.java", "license": "bsd-3-clause", "size": 9403 }
[ "edu.wpi.first.wpilibj.hal.PWMJNI" ]
import edu.wpi.first.wpilibj.hal.PWMJNI;
import edu.wpi.first.wpilibj.hal.*;
[ "edu.wpi.first" ]
edu.wpi.first;
2,727,512
@Override public T_URIAGE_MEISAI rename(String name) { return new T_URIAGE_MEISAI(DSL.name(name), null); }
T_URIAGE_MEISAI function(String name) { return new T_URIAGE_MEISAI(DSL.name(name), null); }
/** * Rename this table */
Rename this table
rename
{ "repo_name": "ShowKa/HanbaiKanri", "path": "src/main/java/com/showka/table/public_/tables/T_URIAGE_MEISAI.java", "license": "mit", "size": 7545 }
[ "org.jooq.impl.DSL" ]
import org.jooq.impl.DSL;
import org.jooq.impl.*;
[ "org.jooq.impl" ]
org.jooq.impl;
2,712,291
private void checkFirstRecord() throws DatabaseException { DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setAllowCreate(false); dbConfig.setReadOnly(true); dbConfig.setSortedDuplicates(true); Database db = env.openDatabase(null, "db1", dbConfig); Cursor cursor = db.openCursor(null, null); DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); OperationStatus status = cursor.getFirst(key, data, null); assertEquals(OperationStatus.SUCCESS, status); assertEquals(3, value(key)); assertEquals(0, value(data)); cursor.close(); db.close(); }
void function() throws DatabaseException { DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setAllowCreate(false); dbConfig.setReadOnly(true); dbConfig.setSortedDuplicates(true); Database db = env.openDatabase(null, "db1", dbConfig); Cursor cursor = db.openCursor(null, null); DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); OperationStatus status = cursor.getFirst(key, data, null); assertEquals(OperationStatus.SUCCESS, status); assertEquals(3, value(key)); assertEquals(0, value(data)); cursor.close(); db.close(); }
/** * First and only record in db1 should be {3,0}. */
First and only record in db1 should be {3,0}
checkFirstRecord
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/je-3.2.74/test/com/sleepycat/je/test/SR11297Test.java", "license": "gpl-2.0", "size": 6352 }
[ "com.sleepycat.je.Cursor", "com.sleepycat.je.Database", "com.sleepycat.je.DatabaseConfig", "com.sleepycat.je.DatabaseEntry", "com.sleepycat.je.DatabaseException", "com.sleepycat.je.OperationStatus" ]
import com.sleepycat.je.Cursor; import com.sleepycat.je.Database; import com.sleepycat.je.DatabaseConfig; import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.DatabaseException; import com.sleepycat.je.OperationStatus;
import com.sleepycat.je.*;
[ "com.sleepycat.je" ]
com.sleepycat.je;
2,296,519
public void testCloning() { DefaultKeyedValues2D v1 = new DefaultKeyedValues2D(); v1.setValue(new Integer(1), "V1", "C1"); v1.setValue(null, "V2", "C1"); v1.setValue(new Integer(3), "V3", "C2"); DefaultKeyedValues2D v2 = null; try { v2 = (DefaultKeyedValues2D) v1.clone(); } catch (CloneNotSupportedException e) { System.err.println("Failed to clone."); } assertTrue(v1 != v2); assertTrue(v1.getClass() == v2.getClass()); assertTrue(v1.equals(v2)); // check that clone is independent of the original v2.setValue(new Integer(2), "V2", "C1"); assertFalse(v1.equals(v2)); }
void function() { DefaultKeyedValues2D v1 = new DefaultKeyedValues2D(); v1.setValue(new Integer(1), "V1", "C1"); v1.setValue(null, "V2", "C1"); v1.setValue(new Integer(3), "V3", "C2"); DefaultKeyedValues2D v2 = null; try { v2 = (DefaultKeyedValues2D) v1.clone(); } catch (CloneNotSupportedException e) { System.err.println(STR); } assertTrue(v1 != v2); assertTrue(v1.getClass() == v2.getClass()); assertTrue(v1.equals(v2)); v2.setValue(new Integer(2), "V2", "C1"); assertFalse(v1.equals(v2)); }
/** * Some checks for the clone() method. */
Some checks for the clone() method
testCloning
{ "repo_name": "raedle/univis", "path": "lib/jfreechart-1.0.1/src/org/jfree/data/junit/DefaultKeyedValues2DTests.java", "license": "lgpl-2.1", "size": 5625 }
[ "org.jfree.data.DefaultKeyedValues2D" ]
import org.jfree.data.DefaultKeyedValues2D;
import org.jfree.data.*;
[ "org.jfree.data" ]
org.jfree.data;
1,058,718
public interface Identifier extends Module { public Set<FormatIdentification> identify(JHOVE2 jhove2, Source source, Input input) throws IOException, JHOVE2Exception;
interface Identifier extends Module { public Set<FormatIdentification> function(JHOVE2 jhove2, Source source, Input input) throws IOException, JHOVE2Exception;
/** * Presumptively identify the format of a source unit. * * @param jhove2 * JHOVE2 framework * @param source * Source unit * @param input * Source input * @return Set of presumptive format identifications * @throws IOException * I/O exception encountered identifying the source unit * @throws JHOVE2Exception */
Presumptively identify the format of a source unit
identify
{ "repo_name": "opf-labs/jhove2", "path": "src/main/java/org/jhove2/module/identify/Identifier.java", "license": "bsd-2-clause", "size": 3868 }
[ "java.io.IOException", "java.util.Set", "org.jhove2.core.JHOVE2Exception", "org.jhove2.core.format.FormatIdentification", "org.jhove2.core.io.Input", "org.jhove2.core.source.Source", "org.jhove2.module.Module" ]
import java.io.IOException; import java.util.Set; import org.jhove2.core.JHOVE2Exception; import org.jhove2.core.format.FormatIdentification; import org.jhove2.core.io.Input; import org.jhove2.core.source.Source; import org.jhove2.module.Module;
import java.io.*; import java.util.*; import org.jhove2.core.*; import org.jhove2.core.format.*; import org.jhove2.core.io.*; import org.jhove2.core.source.*; import org.jhove2.module.*;
[ "java.io", "java.util", "org.jhove2.core", "org.jhove2.module" ]
java.io; java.util; org.jhove2.core; org.jhove2.module;
1,757,998
protected void deleteDhcpLease(final DhcpLease lease) { SQLiteConnection connection = null; SQLiteStatement statement = null; try { connection = getSQLiteConnection(); statement = connection.prepare("delete from dhcplease" + " where ipaddress=?"); statement.bind(1, lease.getIpAddress().getAddress()); while (statement.step()) { log.debug("deleteDhcpLease: step=true"); } } catch (SQLiteException ex) { log.error("deleteDhcpLease failed", ex); throw new RuntimeException(ex); } finally { closeStatement(statement); closeConnection(connection); } }
void function(final DhcpLease lease) { SQLiteConnection connection = null; SQLiteStatement statement = null; try { connection = getSQLiteConnection(); statement = connection.prepare(STR + STR); statement.bind(1, lease.getIpAddress().getAddress()); while (statement.step()) { log.debug(STR); } } catch (SQLiteException ex) { log.error(STR, ex); throw new RuntimeException(ex); } finally { closeStatement(statement); closeConnection(connection); } }
/** * Delete dhcp lease. * * @param lease the lease */
Delete dhcp lease
deleteDhcpLease
{ "repo_name": "marosmars/dhcp", "path": "Jagornet-DHCP/src/com/jagornet/dhcp/db/SqliteLeaseManager.java", "license": "gpl-3.0", "size": 21368 }
[ "com.almworks.sqlite4java.SQLiteConnection", "com.almworks.sqlite4java.SQLiteException", "com.almworks.sqlite4java.SQLiteStatement" ]
import com.almworks.sqlite4java.SQLiteConnection; import com.almworks.sqlite4java.SQLiteException; import com.almworks.sqlite4java.SQLiteStatement;
import com.almworks.sqlite4java.*;
[ "com.almworks.sqlite4java" ]
com.almworks.sqlite4java;
2,568,272
@Nullable private Color parseColor(String cstr) { if (cstr == null) { return null; } cstr = cstr.trim(); if (cstr.startsWith("#")) { // skip over '#' prefix used for HTML color codes allowed by Google Earth // but invalid wrt KML XML Schema. log.debug("Skip '#' in color code: {}", cstr); cstr = cstr.substring(1); } if (cstr.length() == 8) { try { int alpha = Integer.parseInt(cstr.substring(0, 2), 16); int blue = Integer.parseInt(cstr.substring(2, 4), 16); int green = Integer.parseInt(cstr.substring(4, 6), 16); int red = Integer.parseInt(cstr.substring(6, 8), 16); return new Color(red, green, blue, alpha); } catch (IllegalArgumentException ex) { // fall through and log bad value } } log.warn("Invalid color value: " + cstr); return null; }
Color function(String cstr) { if (cstr == null) { return null; } cstr = cstr.trim(); if (cstr.startsWith("#")) { log.debug(STR, cstr); cstr = cstr.substring(1); } if (cstr.length() == 8) { try { int alpha = Integer.parseInt(cstr.substring(0, 2), 16); int blue = Integer.parseInt(cstr.substring(2, 4), 16); int green = Integer.parseInt(cstr.substring(4, 6), 16); int red = Integer.parseInt(cstr.substring(6, 8), 16); return new Color(red, green, blue, alpha); } catch (IllegalArgumentException ex) { } } log.warn(STR + cstr); return null; }
/** * Parse the color from a kml file, in {@code AABBGGRR} order. * * @param cstr a hex encoded string, must be exactly 8 characters long. * @return the color value, null if value is null, empty or invalid */
Parse the color from a kml file, in AABBGGRR order
parseColor
{ "repo_name": "automenta/climatenet", "path": "src/main/java/automenta/climatenet/data/gis/KmlInputStream.java", "license": "agpl-3.0", "size": 131581 }
[ "org.opensextant.giscore.utils.Color" ]
import org.opensextant.giscore.utils.Color;
import org.opensextant.giscore.utils.*;
[ "org.opensextant.giscore" ]
org.opensextant.giscore;
288,420
public Observable<ServiceResponse<Page<EndpointServiceResultInner>>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<EndpointServiceResultInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * List what values of endpoint services are available for use. * ServiceResponse<PageImpl<EndpointServiceResultInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;EndpointServiceResultInner&gt; object wrapped in {@link ServiceResponse} if successful. */
List what values of endpoint services are available for use
listNextSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/implementation/AvailableEndpointServicesInner.java", "license": "mit", "size": 15786 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
163,260
protected void addShowPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_TemporalDatumRefType_show_feature"), getString("_UI_PropertyDescriptor_description", "_UI_TemporalDatumRefType_show_feature", "_UI_TemporalDatumRefType_type"), GmlPackage.eINSTANCE.getTemporalDatumRefType_Show(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), GmlPackage.eINSTANCE.getTemporalDatumRefType_Show(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Show feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Show feature.
addShowPropertyDescriptor
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/TemporalDatumRefTypeItemProvider.java", "license": "apache-2.0", "size": 12089 }
[ "net.opengis.gml.GmlPackage", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import net.opengis.gml.GmlPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import net.opengis.gml.*; import org.eclipse.emf.edit.provider.*;
[ "net.opengis.gml", "org.eclipse.emf" ]
net.opengis.gml; org.eclipse.emf;
2,190,362
public static InputStream byteMail(StringWriter mailContent) { return new ByteArrayInputStream(mailContent.toString().getBytes()); }
static InputStream function(StringWriter mailContent) { return new ByteArrayInputStream(mailContent.toString().getBytes()); }
/** * Special method to translate mail content * as StringWriter to InputStream object * * @param mail content * @return stream */
Special method to translate mail content as StringWriter to InputStream object
byteMail
{ "repo_name": "mozartframework/cms", "path": "src/com/mozartframework/web/mail/MailSender.java", "license": "gpl-3.0", "size": 17514 }
[ "java.io.ByteArrayInputStream", "java.io.InputStream", "java.io.StringWriter" ]
import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.StringWriter;
import java.io.*;
[ "java.io" ]
java.io;
1,693,973
public void importBmpImg(File f) { try { if (f == null) return; if (!f.exists()) throw new FileNotFoundException(); BattleSprite sp = getSelectedSprite(); FileInputStream in = new FileInputStream(f); Image img = mainWindow.createImage(BMPReader.getBMPImage(in)); if (img == null) { System.out .println("How can img be null here!? battle sprite editor"); return; } in.close(); int w = img.getWidth(mainWindow), h = img.getHeight(mainWindow); if (!BATTLE_SPRITE_SIZES[sp.getSize()].equals(new Dimension(w, h))) { JOptionPane.showMessageDialog(mainWindow, "Invalid image size (" + w + ", " + h + ").\n" + "Make sure the image size matches the\n" + "sprite size you have selected.", "Bad Image Size", JOptionPane.ERROR_MESSAGE); return; } byte[][] sprite = new byte[w][h]; int[] pixels = new int[w * h]; PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pixels, 0, w); try { pg.grabPixels(); } catch (InterruptedException e) { System.err.println("Interrupted waiting for pixels!"); return; } if (sprite == null) System.out .println("How can sprite be null here!? battle sprite editor bmp import"); if (BITMAP_REV_PAL == null) System.out .println("How can BITMAP_REV_PAL be null here!? battle sprite editor bmp import"); for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { sprite[i][j] = ((Byte) BITMAP_REV_PAL.get(new Integer( pixels[j * w + i]))).byteValue(); } } sp.setSprite(sprite); da.setImage(sp.getSprite()); da.repaint(); } catch (IOException e) { System.out.println("Unable to read image: " + f.toString()); e.printStackTrace(); } }
void function(File f) { try { if (f == null) return; if (!f.exists()) throw new FileNotFoundException(); BattleSprite sp = getSelectedSprite(); FileInputStream in = new FileInputStream(f); Image img = mainWindow.createImage(BMPReader.getBMPImage(in)); if (img == null) { System.out .println(STR); return; } in.close(); int w = img.getWidth(mainWindow), h = img.getHeight(mainWindow); if (!BATTLE_SPRITE_SIZES[sp.getSize()].equals(new Dimension(w, h))) { JOptionPane.showMessageDialog(mainWindow, STR + w + STR + h + ").\n" + STR + "sprite size you have selected.STRBad Image Size", JOptionPane.ERROR_MESSAGE); return; } byte[][] sprite = new byte[w][h]; int[] pixels = new int[w * h]; PixelGrabber pg = new PixelGrabber(img, 0, 0, w, h, pixels, 0, w); try { pg.grabPixels(); } catch (InterruptedException e) { System.err.println(STR); return; } if (sprite == null) System.out .println(STR); if (BITMAP_REV_PAL == null) System.out .println(STR); for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { sprite[i][j] = ((Byte) BITMAP_REV_PAL.get(new Integer( pixels[j * w + i]))).byteValue(); } } sp.setSprite(sprite); da.setImage(sp.getSprite()); da.repaint(); } catch (IOException e) { System.out.println(STR + f.toString()); e.printStackTrace(); } }
/** * Sets the current Sprite to the image in the specified file. This uses the * default palette of a 16-color bitmap to store color indexes as colors. * * @param f File to import image from. */
Sets the current Sprite to the image in the specified file. This uses the default palette of a 16-color bitmap to store color indexes as colors
importBmpImg
{ "repo_name": "dperelman/jhack", "path": "src/net/starmen/pkhack/eb/BattleSpriteEditor.java", "license": "gpl-3.0", "size": 37530 }
[ "java.awt.Dimension", "java.awt.Image", "java.awt.image.PixelGrabber", "java.io.File", "java.io.FileInputStream", "java.io.FileNotFoundException", "java.io.IOException", "javax.swing.JOptionPane", "net.starmen.pkhack.BMPReader" ]
import java.awt.Dimension; import java.awt.Image; import java.awt.image.PixelGrabber; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import javax.swing.JOptionPane; import net.starmen.pkhack.BMPReader;
import java.awt.*; import java.awt.image.*; import java.io.*; import javax.swing.*; import net.starmen.pkhack.*;
[ "java.awt", "java.io", "javax.swing", "net.starmen.pkhack" ]
java.awt; java.io; javax.swing; net.starmen.pkhack;
2,673,070
@Override public boolean onPreferenceClick(final Preference preference) { if (preference.equals(mPrefFrag.findPreference(PREFS_KEY_EXPORT_TO_DROPBOX))) { mApp.setLastExportType(MainApplication.PREFS_VAL_LAST_EXPORT_DROPBOX); AndroidHelper.exportDropbox(mApp, this); } else if (preference.equals(mPrefFrag.findPreference(PREFS_KEY_IMPORT_FROM_DROPBOX))) { mApp.getDropboxImportExport().importDatabase(this); } else if (preference.equals(mPrefFrag.findPreference(PREFS_KEY_EXPORT_TO_DEVICE))) { mApp.setLastExportType(MainApplication.PREFS_VAL_LAST_EXPORT_DROPBOX); AndroidHelper.exportDevice(this); Map<String, String> extra = new HashMap<>(); extra.put(FileChooserActivity.FILECHOOSER_TYPE_KEY, "" + FileChooserActivity.FILECHOOSER_TYPE_DIRECTORY_ONLY); extra.put(FileChooserActivity.FILECHOOSER_TITLE_KEY, getString(R.string.pref_title_export)); extra.put(FileChooserActivity.FILECHOOSER_MESSAGE_KEY, getString(R.string.use_folder) + ":? "); extra.put(FileChooserActivity.FILECHOOSER_DEFAULT_DIR, Environment .getExternalStorageDirectory().getAbsolutePath()); extra.put(FileChooserActivity.FILECHOOSER_SHOW_KEY, "" + FileChooserActivity.FILECHOOSER_SHOW_DIRECTORY_ONLY); myStartActivity(extra, FileChooserActivity.class, FileChooserActivity.FILECHOOSER_SELECTION_TYPE_DIRECTORY); } else if (preference.equals(mPrefFrag.findPreference(PREFS_KEY_IMPORT_FROM_DEVICE))) { final Intent i = new Intent(getApplicationContext(), FileChooserActivity.class); i.putExtra(FileChooserActivity.FILECHOOSER_TYPE_KEY, "" + FileChooserActivity.FILECHOOSER_TYPE_FILE_AND_DIRECTORY); i.putExtra(FileChooserActivity.FILECHOOSER_TITLE_KEY, getString(R.string.pref_title_import)); i.putExtra(FileChooserActivity.FILECHOOSER_MESSAGE_KEY, getString(R.string.use_file) + ":? "); i.putExtra(FileChooserActivity.FILECHOOSER_DEFAULT_DIR, Environment .getExternalStorageDirectory().getAbsolutePath()); i.putExtra(FileChooserActivity.FILECHOOSER_SHOW_KEY, "" + FileChooserActivity.FILECHOOSER_SHOW_FILE_AND_DIRECTORY); startActivityForResult(i, FileChooserActivity.FILECHOOSER_SELECTION_TYPE_FILE); } return true; }
boolean function(final Preference preference) { if (preference.equals(mPrefFrag.findPreference(PREFS_KEY_EXPORT_TO_DROPBOX))) { mApp.setLastExportType(MainApplication.PREFS_VAL_LAST_EXPORT_DROPBOX); AndroidHelper.exportDropbox(mApp, this); } else if (preference.equals(mPrefFrag.findPreference(PREFS_KEY_IMPORT_FROM_DROPBOX))) { mApp.getDropboxImportExport().importDatabase(this); } else if (preference.equals(mPrefFrag.findPreference(PREFS_KEY_EXPORT_TO_DEVICE))) { mApp.setLastExportType(MainApplication.PREFS_VAL_LAST_EXPORT_DROPBOX); AndroidHelper.exportDevice(this); Map<String, String> extra = new HashMap<>(); extra.put(FileChooserActivity.FILECHOOSER_TYPE_KEY, STR:? STRSTRSTR:? STR" + FileChooserActivity.FILECHOOSER_SHOW_FILE_AND_DIRECTORY); startActivityForResult(i, FileChooserActivity.FILECHOOSER_SELECTION_TYPE_FILE); } return true; }
/** * Called when a preference is clicked. * @param preference The preference. * @return boolean */
Called when a preference is clicked
onPreferenceClick
{ "repo_name": "Keidan/WorkTime", "path": "app/src/main/java/fr/ralala/worktime/ui/activities/settings/SettingsImportExportActivity.java", "license": "gpl-3.0", "size": 8228 }
[ "android.preference.Preference", "fr.ralala.worktime.MainApplication", "fr.ralala.worktime.ui.activities.FileChooserActivity", "fr.ralala.worktime.utils.AndroidHelper", "java.util.HashMap", "java.util.Map" ]
import android.preference.Preference; import fr.ralala.worktime.MainApplication; import fr.ralala.worktime.ui.activities.FileChooserActivity; import fr.ralala.worktime.utils.AndroidHelper; import java.util.HashMap; import java.util.Map;
import android.preference.*; import fr.ralala.worktime.*; import fr.ralala.worktime.ui.activities.*; import fr.ralala.worktime.utils.*; import java.util.*;
[ "android.preference", "fr.ralala.worktime", "java.util" ]
android.preference; fr.ralala.worktime; java.util;
2,261,427
public String getInQueueForString() { long duration = System.currentTimeMillis() - this.inQueueSince; return Util.getTimeSpanString(duration); } @WithBridgeMethods(Future.class) public QueueTaskFuture<Executable> getFuture() { return future; }
String function() { long duration = System.currentTimeMillis() - this.inQueueSince; return Util.getTimeSpanString(duration); } @WithBridgeMethods(Future.class) public QueueTaskFuture<Executable> getFuture() { return future; }
/** * Returns a human readable presentation of how long this item is already in the queue. * E.g. something like '3 minutes 40 seconds' */
Returns a human readable presentation of how long this item is already in the queue. E.g. something like '3 minutes 40 seconds'
getInQueueForString
{ "repo_name": "kohsuke/hudson", "path": "core/src/main/java/hudson/model/Queue.java", "license": "mit", "size": 115775 }
[ "com.infradna.tool.bridge_method_injector.WithBridgeMethods", "hudson.model.queue.QueueTaskFuture", "java.util.concurrent.Future" ]
import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import hudson.model.queue.QueueTaskFuture; import java.util.concurrent.Future;
import com.infradna.tool.bridge_method_injector.*; import hudson.model.queue.*; import java.util.concurrent.*;
[ "com.infradna.tool", "hudson.model.queue", "java.util" ]
com.infradna.tool; hudson.model.queue; java.util;
1,076,728
public void addUserToRole(String userdn, String organization, String role) { DirContext context = null; //role: cn=name,o=organization,dc=nn,dc=fi String ROLE_CTX = "cn="+role+",o="+organization+","+getDomainComponents(); if (role.equals(Role.ROLE_PUBLIC)) { Vector<String> orgRoles = getOrganizationRoles(organization); // check if public role exists if (orgRoles == null || orgRoles.isEmpty() || !orgRoles.contains(Role.ROLE_PUBLIC)) { // create public role this.createRole(Role.ROLE_PUBLIC, organization, Role.getPublicRoleAccessrights(organization)); logger.info("LdapManager: "+Role.ROLE_PUBLIC+" role created"); } } try { context = getContext(); ModificationItem[] mods = new ModificationItem[1]; //user: cn=name,ou=group,o=organization,dc=nn,dc=fi Attribute mod0 = new BasicAttribute(LdapManager.ROLE_USER, userdn); mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, mod0); context.modifyAttributes(ROLE_CTX, mods); logger.debug("LdapManager: role '"+role+"' modified."); context.close(); } catch (NamingException e) { logger.error("LdapManager error: Error adding user to role, "+e); } }
void function(String userdn, String organization, String role) { DirContext context = null; String ROLE_CTX = "cn="+role+",o="+organization+","+getDomainComponents(); if (role.equals(Role.ROLE_PUBLIC)) { Vector<String> orgRoles = getOrganizationRoles(organization); if (orgRoles == null orgRoles.isEmpty() !orgRoles.contains(Role.ROLE_PUBLIC)) { this.createRole(Role.ROLE_PUBLIC, organization, Role.getPublicRoleAccessrights(organization)); logger.info(STR+Role.ROLE_PUBLIC+STR); } } try { context = getContext(); ModificationItem[] mods = new ModificationItem[1]; Attribute mod0 = new BasicAttribute(LdapManager.ROLE_USER, userdn); mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, mod0); context.modifyAttributes(ROLE_CTX, mods); logger.debug(STR+role+STR); context.close(); } catch (NamingException e) { logger.error(STR+e); } }
/** * Add user to ldap role * @param userdn * @param organization * @param role */
Add user to ldap role
addUserToRole
{ "repo_name": "mikkeliamk/osa", "path": "src/fi/mamk/osa/auth/LdapManager.java", "license": "agpl-3.0", "size": 47569 }
[ "java.util.Vector", "javax.naming.NamingException", "javax.naming.directory.Attribute", "javax.naming.directory.BasicAttribute", "javax.naming.directory.DirContext", "javax.naming.directory.ModificationItem" ]
import java.util.Vector; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.BasicAttribute; import javax.naming.directory.DirContext; import javax.naming.directory.ModificationItem;
import java.util.*; import javax.naming.*; import javax.naming.directory.*;
[ "java.util", "javax.naming" ]
java.util; javax.naming;
1,273,684
public Validation getLineValuesAllowedValidation() { return lineValuesAllowedValidation; }
Validation function() { return lineValuesAllowedValidation; }
/** * Gets the lineValuesAllowedValidation attribute. * @return Returns the lineValuesAllowedValidation. */
Gets the lineValuesAllowedValidation attribute
getLineValuesAllowedValidation
{ "repo_name": "bhutchinson/kfs", "path": "kfs-core/src/main/java/org/kuali/kfs/sys/document/validation/impl/AccountingLineCheckValidationHutch.java", "license": "agpl-3.0", "size": 5269 }
[ "org.kuali.kfs.sys.document.validation.Validation" ]
import org.kuali.kfs.sys.document.validation.Validation;
import org.kuali.kfs.sys.document.validation.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,289,900
public void setAppRole2EmployeePersistence( AppRole2EmployeePersistence appRole2EmployeePersistence) { this.appRole2EmployeePersistence = appRole2EmployeePersistence; }
void function( AppRole2EmployeePersistence appRole2EmployeePersistence) { this.appRole2EmployeePersistence = appRole2EmployeePersistence; }
/** * Sets the app role2 employee persistence. * * @param appRole2EmployeePersistence the app role2 employee persistence */
Sets the app role2 employee persistence
setAppRole2EmployeePersistence
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-ssomgt-portlet/docroot/WEB-INF/src/org/oep/ssomgt/service/base/AppMessageServiceBaseImpl.java", "license": "apache-2.0", "size": 21159 }
[ "org.oep.ssomgt.service.persistence.AppRole2EmployeePersistence" ]
import org.oep.ssomgt.service.persistence.AppRole2EmployeePersistence;
import org.oep.ssomgt.service.persistence.*;
[ "org.oep.ssomgt" ]
org.oep.ssomgt;
1,445,444
public @Nonnull Iterable<String> listShares(@Nonnull String snapshotId) throws InternalException, CloudException;
@Nonnull Iterable<String> function(@Nonnull String snapshotId) throws InternalException, CloudException;
/** * Lists all accounts with which this snapshot is shared. If snapshot sharing is not supported, this method will * return an empty list. * @param snapshotId the unique ID of the snapshot being checked * @return a list of accounts with which the snapshot is shared * @throws InternalException an error occurred within the Dasein Cloud implementation * @throws CloudException an error occurred with the cloud provider */
Lists all accounts with which this snapshot is shared. If snapshot sharing is not supported, this method will return an empty list
listShares
{ "repo_name": "OSS-TheWeatherCompany/dasein-cloud-core", "path": "src/main/java/org/dasein/cloud/compute/SnapshotSupport.java", "license": "apache-2.0", "size": 21945 }
[ "javax.annotation.Nonnull", "org.dasein.cloud.CloudException", "org.dasein.cloud.InternalException" ]
import javax.annotation.Nonnull; import org.dasein.cloud.CloudException; import org.dasein.cloud.InternalException;
import javax.annotation.*; import org.dasein.cloud.*;
[ "javax.annotation", "org.dasein.cloud" ]
javax.annotation; org.dasein.cloud;
977,622
List<String> getAddresses();
List<String> getAddresses();
/** * Returns the addresses (vanadium object names) that the service is served on. */
Returns the addresses (vanadium object names) that the service is served on
getAddresses
{ "repo_name": "vanadium/java", "path": "lib/src/main/java/io/v/v23/discovery/Update.java", "license": "bsd-3-clause", "size": 2905 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,297,470
public static <N, E extends N> E getFirstChildElement(ReadableDocument<N, E, ?> doc, E element) { return getNextElementInclusive(doc, doc.getFirstChild(element), true); }
static <N, E extends N> E function(ReadableDocument<N, E, ?> doc, E element) { return getNextElementInclusive(doc, doc.getFirstChild(element), true); }
/** * Gets the first child element of an element, if there is one. * * @param doc document accessor * @param element parent element * @return the first child element of {@code element} if there is one, * otherwise {@code null}. */
Gets the first child element of an element, if there is one
getFirstChildElement
{ "repo_name": "processone/google-wave-api", "path": "wave-model/src/main/java/org/waveprotocol/wave/model/document/util/DocHelper.java", "license": "apache-2.0", "size": 34765 }
[ "org.waveprotocol.wave.model.document.ReadableDocument" ]
import org.waveprotocol.wave.model.document.ReadableDocument;
import org.waveprotocol.wave.model.document.*;
[ "org.waveprotocol.wave" ]
org.waveprotocol.wave;
1,788,842
private static void setLogLevel(CommandLine commandLine) { Level logLevel = Level.INFO; if (commandLine.hasOption("debug")) { logLevel = Level.DEBUG; } ConsoleAppender console = new ConsoleAppender(); // create appender String pattern = "%d [%p|%c|%C{1}] %m%n"; console.setLayout(new PatternLayout(pattern)); console.activateOptions(); if (commandLine.hasOption("verbose")) { console.setThreshold(logLevel); } else { console.setThreshold(Level.ERROR); } Logger.getLogger("com.google.api.ads.adwords.awreporting").addAppender(console); FileAppender fa = new FileAppender(); fa.setName("FileLogger"); fa.setFile("aw-reporting.log"); fa.setLayout(new PatternLayout("%d %-5p [%c{1}] %m%n")); fa.setThreshold(logLevel); fa.setAppend(true); fa.activateOptions(); Logger.getLogger("com.google.api.ads.adwords.awreporting").addAppender(fa); }
static void function(CommandLine commandLine) { Level logLevel = Level.INFO; if (commandLine.hasOption("debug")) { logLevel = Level.DEBUG; } ConsoleAppender console = new ConsoleAppender(); String pattern = STR; console.setLayout(new PatternLayout(pattern)); console.activateOptions(); if (commandLine.hasOption(STR)) { console.setThreshold(logLevel); } else { console.setThreshold(Level.ERROR); } Logger.getLogger(STR).addAppender(console); FileAppender fa = new FileAppender(); fa.setName(STR); fa.setFile(STR); fa.setLayout(new PatternLayout(STR)); fa.setThreshold(logLevel); fa.setAppend(true); fa.activateOptions(); Logger.getLogger(STR).addAppender(fa); }
/** * Sets the Log level based on the command line arguments * * @param commandLine the command line */
Sets the Log level based on the command line arguments
setLogLevel
{ "repo_name": "tsib0/AWReporting", "path": "src/main/java/com/google/api/ads/adwords/awreporting/AwReporting.java", "license": "apache-2.0", "size": 17700 }
[ "org.apache.commons.cli.CommandLine", "org.apache.log4j.ConsoleAppender", "org.apache.log4j.FileAppender", "org.apache.log4j.Level", "org.apache.log4j.Logger", "org.apache.log4j.PatternLayout" ]
import org.apache.commons.cli.CommandLine; import org.apache.log4j.ConsoleAppender; import org.apache.log4j.FileAppender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout;
import org.apache.commons.cli.*; import org.apache.log4j.*;
[ "org.apache.commons", "org.apache.log4j" ]
org.apache.commons; org.apache.log4j;
911,656
public List<ProjectExpectedStudy> getAllStudiesByPhase(Long phaseId);
List<ProjectExpectedStudy> function(Long phaseId);
/** * This method gets a list of ALL projectExpectedStudy that are active up to a given phase * * @return a list of ProjectExpectedStudy null if no exist records */
This method gets a list of ALL projectExpectedStudy that are active up to a given phase
getAllStudiesByPhase
{ "repo_name": "CCAFS/MARLO", "path": "marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/ProjectExpectedStudyManager.java", "license": "gpl-3.0", "size": 6986 }
[ "java.util.List", "org.cgiar.ccafs.marlo.data.model.ProjectExpectedStudy" ]
import java.util.List; import org.cgiar.ccafs.marlo.data.model.ProjectExpectedStudy;
import java.util.*; import org.cgiar.ccafs.marlo.data.model.*;
[ "java.util", "org.cgiar.ccafs" ]
java.util; org.cgiar.ccafs;
2,833,887
private void ensureNamespaceExists(Id.Namespace namespace) throws Exception { if (!Id.Namespace.SYSTEM.equals(namespace)) { namespaceClient.get(namespace); } }
void function(Id.Namespace namespace) throws Exception { if (!Id.Namespace.SYSTEM.equals(namespace)) { namespaceClient.get(namespace); } }
/** * Throws an exception if the specified namespace is not the system namespace and does not exist */
Throws an exception if the specified namespace is not the system namespace and does not exist
ensureNamespaceExists
{ "repo_name": "mpouttuclarke/cdap", "path": "cdap-data-fabric/src/main/java/co/cask/cdap/data2/datafabric/dataset/service/DatasetInstanceService.java", "license": "apache-2.0", "size": 16397 }
[ "co.cask.cdap.proto.Id" ]
import co.cask.cdap.proto.Id;
import co.cask.cdap.proto.*;
[ "co.cask.cdap" ]
co.cask.cdap;
753,526
@Test public void whenHasNextCallThenReturnsTrue() { Iterator<Integer> it = new IteratorOfIterators() .convert(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()).iterator()); assertTrue(it.hasNext()); }
void function() { Iterator<Integer> it = new IteratorOfIterators() .convert(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()).iterator()); assertTrue(it.hasNext()); }
/** * Test hasNext method. */
Test hasNext method
whenHasNextCallThenReturnsTrue
{ "repo_name": "roman-sd/java-a-to-z", "path": "chapter_005/src/test/java/ru/sdroman/pro/iterator/IteratorOfIteratorsTest.java", "license": "apache-2.0", "size": 2684 }
[ "java.util.Arrays", "java.util.Iterator", "org.junit.Assert" ]
import java.util.Arrays; import java.util.Iterator; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
2,608,337
public final Object process(final Element elResultSet) throws Exception { LOG.debug(">> process(elResultSet)"); if (elResultSet == null) { throw new SQLUnitException(IErrorCodes.ELEMENT_IS_NULL, new String[] {"resultset"}); } ResultSetBean resultset = new ResultSetBean(); resultset.setId(XMLUtils.getAttributeValue(elResultSet, "id")); resultset.setPartial(XMLUtils.getAttributeValue( elResultSet, "partial")); int rowcount = -1; try { rowcount = Integer.parseInt( XMLUtils.getAttributeValue(elResultSet, "rowcount")); } catch (Exception e) { //:IGNORE: reset to default } // if rowcount specified, dont bother building the rows if (rowcount > -1) { resultset.setRowCount(rowcount); return resultset; } List elRows = elResultSet.getChildren("row"); Row[] rows = new Row[elRows.size()]; for (int i = 0; i < rows.length; i++) { Element elRow = (Element) elRows.get(i); IHandler rowHandler = HandlerFactory.getInstance(elRow.getName()); rows[i] = (Row) rowHandler.process(elRow); } resultset.setRows(rows); // check if there is a specific order-by attribute String orderBy = XMLUtils.getAttributeValue(elResultSet, "order-by"); if (orderBy != null && orderBy.trim().length() > 0) { resultset.setSortBy(orderBy); } return resultset; }
final Object function(final Element elResultSet) throws Exception { LOG.debug(STR); if (elResultSet == null) { throw new SQLUnitException(IErrorCodes.ELEMENT_IS_NULL, new String[] {STR}); } ResultSetBean resultset = new ResultSetBean(); resultset.setId(XMLUtils.getAttributeValue(elResultSet, "id")); resultset.setPartial(XMLUtils.getAttributeValue( elResultSet, STR)); int rowcount = -1; try { rowcount = Integer.parseInt( XMLUtils.getAttributeValue(elResultSet, STR)); } catch (Exception e) { } if (rowcount > -1) { resultset.setRowCount(rowcount); return resultset; } List elRows = elResultSet.getChildren("row"); Row[] rows = new Row[elRows.size()]; for (int i = 0; i < rows.length; i++) { Element elRow = (Element) elRows.get(i); IHandler rowHandler = HandlerFactory.getInstance(elRow.getName()); rows[i] = (Row) rowHandler.process(elRow); } resultset.setRows(rows); String orderBy = XMLUtils.getAttributeValue(elResultSet, STR); if (orderBy != null && orderBy.trim().length() > 0) { resultset.setSortBy(orderBy); } return resultset; }
/** * Processes a JDOM Element representing a database resultset. * @param elResultSet the JDOM Element to use. * @return a populated ResultSet object. Caller must cast. * @exception Exception if there was a problem creating the ResultSet object. */
Processes a JDOM Element representing a database resultset
process
{ "repo_name": "ecalo/SQLUnit-5.0-Fork", "path": "src/net/sourceforge/sqlunit/handlers/ResultSetHandler.java", "license": "gpl-3.0", "size": 5594 }
[ "java.util.List", "net.sourceforge.sqlunit.HandlerFactory", "net.sourceforge.sqlunit.IErrorCodes", "net.sourceforge.sqlunit.IHandler", "net.sourceforge.sqlunit.SQLUnitException", "net.sourceforge.sqlunit.beans.ResultSetBean", "net.sourceforge.sqlunit.beans.Row", "net.sourceforge.sqlunit.utils.XMLUtils", "org.jdom.Element" ]
import java.util.List; import net.sourceforge.sqlunit.HandlerFactory; import net.sourceforge.sqlunit.IErrorCodes; import net.sourceforge.sqlunit.IHandler; import net.sourceforge.sqlunit.SQLUnitException; import net.sourceforge.sqlunit.beans.ResultSetBean; import net.sourceforge.sqlunit.beans.Row; import net.sourceforge.sqlunit.utils.XMLUtils; import org.jdom.Element;
import java.util.*; import net.sourceforge.sqlunit.*; import net.sourceforge.sqlunit.beans.*; import net.sourceforge.sqlunit.utils.*; import org.jdom.*;
[ "java.util", "net.sourceforge.sqlunit", "org.jdom" ]
java.util; net.sourceforge.sqlunit; org.jdom;
2,792,935
Node getNodeFromGraphSubject(final Resource subject) throws RepositoryException;
Node getNodeFromGraphSubject(final Resource subject) throws RepositoryException;
/** * Translate an RDF resource into a JCR node * @param subject an RDF URI resource * @return a JCR node, or null if one couldn't be found * @throws RepositoryException */
Translate an RDF resource into a JCR node
getNodeFromGraphSubject
{ "repo_name": "mikedurbin/fcrepo4", "path": "fcrepo-kernel/src/main/java/org/fcrepo/kernel/rdf/GraphSubjects.java", "license": "apache-2.0", "size": 2195 }
[ "com.hp.hpl.jena.rdf.model.Resource", "javax.jcr.Node", "javax.jcr.RepositoryException" ]
import com.hp.hpl.jena.rdf.model.Resource; import javax.jcr.Node; import javax.jcr.RepositoryException;
import com.hp.hpl.jena.rdf.model.*; import javax.jcr.*;
[ "com.hp.hpl", "javax.jcr" ]
com.hp.hpl; javax.jcr;
154,052
public static void registerOperators(String name, InputStream operatorsXML, ClassLoader classLoader) { registerOperators(name, operatorsXML, classLoader, null); }
static void function(String name, InputStream operatorsXML, ClassLoader classLoader) { registerOperators(name, operatorsXML, classLoader, null); }
/** * Registers all operators from a given XML input stream. Closes the stream. */
Registers all operators from a given XML input stream. Closes the stream
registerOperators
{ "repo_name": "aborg0/rapidminer-studio", "path": "src/main/java/com/rapidminer/tools/OperatorService.java", "license": "agpl-3.0", "size": 36825 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,679,708
public void testConstrChar() { char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; BigDecimal result = new BigDecimal(value); String res = "-1.23804738E-419"; int resScale = 427; assertEquals("incorrect value", res, result.toString()); assertEquals("incorrect scale", resScale, result.scale()); try { // Regression for HARMONY-783 new BigDecimal(new char[] {}); fail("NumberFormatException has not been thrown"); } catch (NumberFormatException e) { } }
void function() { char value[] = {'-', '1', '2', '3', '8', '0', '.', '4', '7', '3', '8', 'E', '-', '4', '2', '3'}; BigDecimal result = new BigDecimal(value); String res = STR; int resScale = 427; assertEquals(STR, res, result.toString()); assertEquals(STR, resScale, result.scale()); try { new BigDecimal(new char[] {}); fail(STR); } catch (NumberFormatException e) { } }
/** * new BigDecimal(char[] value); */
new BigDecimal(char[] value)
testConstrChar
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/java6/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java", "license": "apache-2.0", "size": 26190 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
1,262,457
public void selectCompleteLine() { if (doc.getNumberOfLines() == 1) { this.textSelection = new CoreTextSelection(doc, 0, doc.getLength()); return; } IRegion endLine = getEndLine(); IRegion startLine = getStartLine(); this.textSelection = new CoreTextSelection(doc, startLine.getOffset(), endLine.getOffset() + endLine.getLength() - startLine.getOffset()); }
void function() { if (doc.getNumberOfLines() == 1) { this.textSelection = new CoreTextSelection(doc, 0, doc.getLength()); return; } IRegion endLine = getEndLine(); IRegion startLine = getStartLine(); this.textSelection = new CoreTextSelection(doc, startLine.getOffset(), endLine.getOffset() + endLine.getLength() - startLine.getOffset()); }
/** * In event of partial selection, used to select the full lines involved. */
In event of partial selection, used to select the full lines involved
selectCompleteLine
{ "repo_name": "fabioz/Pydev", "path": "plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/string/TextSelectionUtils.java", "license": "epl-1.0", "size": 40147 }
[ "org.eclipse.jface.text.IRegion" ]
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
313,038
public void testMappingsUpgrade() throws Exception { switch (CLUSTER_TYPE) { case OLD: createAndOpenTestJob(); break; case MIXED: // We don't know whether the job is on an old or upgraded node, so cannot assert that the mappings have been upgraded break; case UPGRADED: assertUpgradedResultsMappings(); assertUpgradedAnnotationsMappings(); closeAndReopenTestJob(); assertUpgradedConfigMappings(); IndexMappingTemplateAsserter.assertMlMappingsMatchTemplates(client()); break; default: throw new UnsupportedOperationException("Unknown cluster type [" + CLUSTER_TYPE + "]"); } }
void function() throws Exception { switch (CLUSTER_TYPE) { case OLD: createAndOpenTestJob(); break; case MIXED: break; case UPGRADED: assertUpgradedResultsMappings(); assertUpgradedAnnotationsMappings(); closeAndReopenTestJob(); assertUpgradedConfigMappings(); IndexMappingTemplateAsserter.assertMlMappingsMatchTemplates(client()); break; default: throw new UnsupportedOperationException(STR + CLUSTER_TYPE + "]"); } }
/** * The purpose of this test is to ensure that when a job is open through a rolling upgrade we upgrade the results * index mappings when it is assigned to an upgraded node even if no other ML endpoint is called after the upgrade */
The purpose of this test is to ensure that when a job is open through a rolling upgrade we upgrade the results index mappings when it is assigned to an upgraded node even if no other ML endpoint is called after the upgrade
testMappingsUpgrade
{ "repo_name": "nknize/elasticsearch", "path": "x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/MlMappingsUpgradeIT.java", "license": "apache-2.0", "size": 9064 }
[ "org.elasticsearch.xpack.test.rest.IndexMappingTemplateAsserter" ]
import org.elasticsearch.xpack.test.rest.IndexMappingTemplateAsserter;
import org.elasticsearch.xpack.test.rest.*;
[ "org.elasticsearch.xpack" ]
org.elasticsearch.xpack;
2,576,357
private void colorValues(){ HashMap <String, Integer> colors = new HashMap<String, Integer>(); Resources r = getResources(); String[] color = r.getStringArray(R.array.color_toggle); colors.put(color[0], Color.BLACK); colors.put(color[1], Color.BLUE); colors.put(color[2], Color.RED); colors.put(color[3], Color.GREEN); colors.put(color[4], Color.YELLOW); colors.put(color[5], Color.MAGENTA); colors.put(color[6], Color.WHITE); colors.put(color[7],Color.LTGRAY); colors.put(color[8], Color.DKGRAY); colors.put(color[9], Color.CYAN); colorValueDictionary = colors; }//end themeValues
void function(){ HashMap <String, Integer> colors = new HashMap<String, Integer>(); Resources r = getResources(); String[] color = r.getStringArray(R.array.color_toggle); colors.put(color[0], Color.BLACK); colors.put(color[1], Color.BLUE); colors.put(color[2], Color.RED); colors.put(color[3], Color.GREEN); colors.put(color[4], Color.YELLOW); colors.put(color[5], Color.MAGENTA); colors.put(color[6], Color.WHITE); colors.put(color[7],Color.LTGRAY); colors.put(color[8], Color.DKGRAY); colors.put(color[9], Color.CYAN); colorValueDictionary = colors; }
/** * Sets colorValue dictionary for Settings * @return dictionary of colorValue */
Sets colorValue dictionary for Settings
colorValues
{ "repo_name": "AmarBhatt/scrollME", "path": "ScrollMEProject/ScrollME/src/main/java/com/BHATT/scrollme/MainActivity.java", "license": "mit", "size": 39278 }
[ "android.content.res.Resources", "android.graphics.Color", "java.util.HashMap" ]
import android.content.res.Resources; import android.graphics.Color; import java.util.HashMap;
import android.content.res.*; import android.graphics.*; import java.util.*;
[ "android.content", "android.graphics", "java.util" ]
android.content; android.graphics; java.util;
630,603
private WhereOptions buildWhereClause(JSONArray fields, String searchTerm, boolean hasPhoneNumber) { ArrayList<String> where = new ArrayList<String>(); ArrayList<String> whereArgs = new ArrayList<String>(); WhereOptions options = new WhereOptions(); if (isWildCardSearch(fields)) { // Get all contacts with all properties if ("%".equals(searchTerm) && !hasPhoneNumber) { options.setWhere("(" + ContactsContract.Contacts.DISPLAY_NAME + " LIKE ? )"); options.setWhereArgs(new String[] { searchTerm }); return options; } else { // Get all contacts that match the filter but return all properties where.add("(" + dbMap.get("displayName") + " LIKE ? )"); whereArgs.add(searchTerm); where.add("(" + dbMap.get("name") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("nickname") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Nickname.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("phoneNumbers") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Phone.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("emails") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Email.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("addresses") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("ims") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Im.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("organizations") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Organization.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("note") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Note.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("urls") + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Website.CONTENT_ITEM_TYPE); } } if ("%".equals(searchTerm) && !hasPhoneNumber) { options.setWhere("(" + ContactsContract.Contacts.DISPLAY_NAME + " LIKE ? )"); options.setWhereArgs(new String[] { searchTerm }); return options; }else if(!("%".equals(searchTerm))){ String key; try { //Log.d(LOG_TAG, "How many fields do we have = " + fields.length()); for (int i = 0; i < fields.length(); i++) { key = fields.getString(i); if (key.equals("id")) { where.add("(" + dbMap.get(key) + " = ? )"); whereArgs.add(searchTerm.substring(1, searchTerm.length() - 1)); } else if (key.startsWith("displayName")) { where.add("(" + dbMap.get(key) + " LIKE ? )"); whereArgs.add(searchTerm); } else if (key.startsWith("name")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE); } else if (key.startsWith("nickname")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Nickname.CONTENT_ITEM_TYPE); } else if (key.startsWith("phoneNumbers")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Phone.CONTENT_ITEM_TYPE); } else if (key.startsWith("emails")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Email.CONTENT_ITEM_TYPE); } else if (key.startsWith("addresses")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE); } else if (key.startsWith("ims")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Im.CONTENT_ITEM_TYPE); } else if (key.startsWith("organizations")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Organization.CONTENT_ITEM_TYPE); } // else if (key.startsWith("birthday")) { // where.add("(" + dbMap.get(key) + " LIKE ? AND " // + ContactsContract.Data.MIMETYPE + " = ? )"); // } else if (key.startsWith("note")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Note.CONTENT_ITEM_TYPE); } else if (key.startsWith("urls")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Website.CONTENT_ITEM_TYPE); } } } catch (JSONException e) { Log.e(LOG_TAG, e.getMessage(), e); } } // Creating the where string StringBuffer selection = new StringBuffer(); for (int i = 0; i < where.size(); i++) { selection.append(where.get(i)); if (i != (where.size() - 1)) { selection.append(" OR "); } } //Only contacts with phone number informed if(hasPhoneNumber){ if(where.size()>0){ selection.insert(0,"("); selection.append(") AND (" + ContactsContract.Contacts.HAS_PHONE_NUMBER + " = ?)"); whereArgs.add("1"); }else{ selection.append("(" + ContactsContract.Contacts.HAS_PHONE_NUMBER + " = ?)"); whereArgs.add("1"); } } options.setWhere(selection.toString()); // Creating the where args array String[] selectionArgs = new String[whereArgs.size()]; for (int i = 0; i < whereArgs.size(); i++) { selectionArgs[i] = whereArgs.get(i); } options.setWhereArgs(selectionArgs); return options; }
WhereOptions function(JSONArray fields, String searchTerm, boolean hasPhoneNumber) { ArrayList<String> where = new ArrayList<String>(); ArrayList<String> whereArgs = new ArrayList<String>(); WhereOptions options = new WhereOptions(); if (isWildCardSearch(fields)) { if ("%".equals(searchTerm) && !hasPhoneNumber) { options.setWhere("(" + ContactsContract.Contacts.DISPLAY_NAME + STR); options.setWhereArgs(new String[] { searchTerm }); return options; } else { where.add("(" + dbMap.get(STR) + STR); whereArgs.add(searchTerm); where.add("(" + dbMap.get("name") + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get(STR) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Nickname.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get(STR) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Phone.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get(STR) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Email.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get(STR) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("ims") + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Im.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get(STR) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Organization.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("note") + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Note.CONTENT_ITEM_TYPE); where.add("(" + dbMap.get("urls") + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Website.CONTENT_ITEM_TYPE); } } if ("%".equals(searchTerm) && !hasPhoneNumber) { options.setWhere("(" + ContactsContract.Contacts.DISPLAY_NAME + STR); options.setWhereArgs(new String[] { searchTerm }); return options; }else if(!("%".equals(searchTerm))){ String key; try { for (int i = 0; i < fields.length(); i++) { key = fields.getString(i); if (key.equals("id")) { where.add("(" + dbMap.get(key) + STR); whereArgs.add(searchTerm.substring(1, searchTerm.length() - 1)); } else if (key.startsWith(STR)) { where.add("(" + dbMap.get(key) + STR); whereArgs.add(searchTerm); } else if (key.startsWith("name")) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE); } else if (key.startsWith(STR)) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Nickname.CONTENT_ITEM_TYPE); } else if (key.startsWith(STR)) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Phone.CONTENT_ITEM_TYPE); } else if (key.startsWith(STR)) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Email.CONTENT_ITEM_TYPE); } else if (key.startsWith(STR)) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE); } else if (key.startsWith("ims")) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Im.CONTENT_ITEM_TYPE); } else if (key.startsWith(STR)) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Organization.CONTENT_ITEM_TYPE); } else if (key.startsWith("note")) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Note.CONTENT_ITEM_TYPE); } else if (key.startsWith("urls")) { where.add("(" + dbMap.get(key) + STR + ContactsContract.Data.MIMETYPE + STR); whereArgs.add(searchTerm); whereArgs.add(CommonDataKinds.Website.CONTENT_ITEM_TYPE); } } } catch (JSONException e) { Log.e(LOG_TAG, e.getMessage(), e); } } StringBuffer selection = new StringBuffer(); for (int i = 0; i < where.size(); i++) { selection.append(where.get(i)); if (i != (where.size() - 1)) { selection.append(STR); } } if(hasPhoneNumber){ if(where.size()>0){ selection.insert(0,"("); selection.append(STR + ContactsContract.Contacts.HAS_PHONE_NUMBER + STR); whereArgs.add("1"); }else{ selection.append("(" + ContactsContract.Contacts.HAS_PHONE_NUMBER + STR); whereArgs.add("1"); } } options.setWhere(selection.toString()); String[] selectionArgs = new String[whereArgs.size()]; for (int i = 0; i < whereArgs.size(); i++) { selectionArgs[i] = whereArgs.get(i); } options.setWhereArgs(selectionArgs); return options; }
/** * Take the search criteria passed into the method and create a SQL WHERE clause. * @param fields the properties to search against * @param searchTerm the string to search for * @return an object containing the selection and selection args */
Take the search criteria passed into the method and create a SQL WHERE clause
buildWhereClause
{ "repo_name": "purplecabbage/cordova-plugin-contacts", "path": "src/android/ContactAccessorSdk5.java", "license": "apache-2.0", "size": 101760 }
[ "android.provider.ContactsContract", "android.util.Log", "java.util.ArrayList", "org.json.JSONArray", "org.json.JSONException" ]
import android.provider.ContactsContract; import android.util.Log; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException;
import android.provider.*; import android.util.*; import java.util.*; import org.json.*;
[ "android.provider", "android.util", "java.util", "org.json" ]
android.provider; android.util; java.util; org.json;
2,259,847
static Account fromJson(JSONObject json) throws JSONException { return new Account(json); }
static Account fromJson(JSONObject json) throws JSONException { return new Account(json); }
/** * Deserializes a {@link JSONObject} to an account object. * @param json The {@link JSONObject} to deserialize. * @return An account object deserialized from the {@link JSONObject}. * @throws JSONException If parsing the {@link JSONObject} fails. */
Deserializes a <code>JSONObject</code> to an account object
fromJson
{ "repo_name": "vgkholla/ambry", "path": "ambry-api/src/main/java/com.github.ambry/account/Account.java", "license": "apache-2.0", "size": 12836 }
[ "org.json.JSONException", "org.json.JSONObject" ]
import org.json.JSONException; import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
2,628,485
public List<Alert> getAllActiveAlerts(User user) throws APIException; /** * @deprecated use {@link #getAlertsByUser(User)}
List<Alert> function(User user) throws APIException; /** * @deprecated use {@link #getAlertsByUser(User)}
/** * Find all alerts for a user that have not expired * * @param user * @return alerts that are unread _or_ read that have not expired * @see #getAlerts(User, boolean, boolean) * @throws APIException */
Find all alerts for a user that have not expired
getAllActiveAlerts
{ "repo_name": "Bhamni/openmrs-core", "path": "api/src/main/java/org/openmrs/notification/AlertService.java", "license": "mpl-2.0", "size": 5795 }
[ "java.util.List", "org.openmrs.User", "org.openmrs.api.APIException" ]
import java.util.List; import org.openmrs.User; import org.openmrs.api.APIException;
import java.util.*; import org.openmrs.*; import org.openmrs.api.*;
[ "java.util", "org.openmrs", "org.openmrs.api" ]
java.util; org.openmrs; org.openmrs.api;
1,487,849
public final void setHeaderTextColorSelected(@ColorInt int color) { mHeaderTextColorSelected = color; }
final void function(@ColorInt int color) { mHeaderTextColorSelected = color; }
/** * Set the color of the header text when it is selected. */
Set the color of the header text when it is selected
setHeaderTextColorSelected
{ "repo_name": "philliphsu/BottomSheetPickers", "path": "bottomsheetpickers/src/main/java/com/philliphsu/bottomsheetpickers/time/grid/GridTimePickerDialog.java", "license": "apache-2.0", "size": 48718 }
[ "android.support.annotation.ColorInt" ]
import android.support.annotation.ColorInt;
import android.support.annotation.*;
[ "android.support" ]
android.support;
2,444,566
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE) TenantMetaData getTenantMetadata(long tenantId);
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE) TenantMetaData getTenantMetadata(long tenantId);
/** * Returns {@link TenantMetaData} of given tenant ID. * * @param tenantId * to retrieve data for * @return {@link TenantMetaData} of given tenant */
Returns <code>TenantMetaData</code> of given tenant ID
getTenantMetadata
{ "repo_name": "stormc/hawkbit", "path": "hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/SystemManagement.java", "license": "epl-1.0", "size": 4727 }
[ "org.eclipse.hawkbit.im.authentication.SpPermission", "org.eclipse.hawkbit.repository.model.TenantMetaData", "org.springframework.security.access.prepost.PreAuthorize" ]
import org.eclipse.hawkbit.im.authentication.SpPermission; import org.eclipse.hawkbit.repository.model.TenantMetaData; import org.springframework.security.access.prepost.PreAuthorize;
import org.eclipse.hawkbit.im.authentication.*; import org.eclipse.hawkbit.repository.model.*; import org.springframework.security.access.prepost.*;
[ "org.eclipse.hawkbit", "org.springframework.security" ]
org.eclipse.hawkbit; org.springframework.security;
18,080
public interface StatusInfo extends EObject { TimeStamp getT();
interface StatusInfo extends EObject { TimeStamp function();
/** * Returns the value of the '<em><b>T</b></em>' reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>T</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>T</em>' reference. * @see #setT(TimeStamp) * @see substationStandard.Dataclasses.DataclassesPackage#getStatusInfo_T() * @model required="true" * @generated */
Returns the value of the 'T' reference. If the meaning of the 'T' reference isn't clear, there really should be more of a description here...
getT
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/substationStandard/Dataclasses/StatusInfo.java", "license": "mit", "size": 2974 }
[ "org.eclipse.emf.ecore.EObject" ]
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
754,986
void clearJob(JobID jobID) throws IOException;
void clearJob(JobID jobID) throws IOException;
/** * Clear job state form the registry, usually called after job finish. * * @param jobID The id of the job to check. * @throws IOException Thrown when the communication with the highly-available storage or * registry failed and could not be retried. */
Clear job state form the registry, usually called after job finish
clearJob
{ "repo_name": "rmetzger/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/RunningJobsRegistry.java", "license": "apache-2.0", "size": 3752 }
[ "java.io.IOException", "org.apache.flink.api.common.JobID" ]
import java.io.IOException; import org.apache.flink.api.common.JobID;
import java.io.*; import org.apache.flink.api.common.*;
[ "java.io", "org.apache.flink" ]
java.io; org.apache.flink;
158,955