method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private static void removeAllView(final BreakpointManager manager, final INaviView view) { final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>(); for (int i = 0; i < manager.getNumberOfBreakpoints(BreakpointType.REGULAR); i++) { final BreakpointAddress address = manager.getBreakpoint(BreakpointType.REGULAR, i).getAddress(); if (CViewHelpers.containsAddress(view, address.getAddress())) { addresses.add(address); } } CGraphDebugger.removeBreakpoints(addresses, manager); }
static void function(final BreakpointManager manager, final INaviView view) { final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>(); for (int i = 0; i < manager.getNumberOfBreakpoints(BreakpointType.REGULAR); i++) { final BreakpointAddress address = manager.getBreakpoint(BreakpointType.REGULAR, i).getAddress(); if (CViewHelpers.containsAddress(view, address.getAddress())) { addresses.add(address); } } CGraphDebugger.removeBreakpoints(addresses, manager); }
/** * Removes all breakpoints of a given breakpoint manager that belong to a given view. * * @param manager The breakpoints manager whose breakpoints are removed. * @param view The view that decides what breakpoints are removed. */
Removes all breakpoints of a given breakpoint manager that belong to a given view
removeAllView
{ "repo_name": "google/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/Gui/Debug/BreakpointTable/Implementations/CBreakpointRemoveFunctions.java", "license": "apache-2.0", "size": 10349 }
[ "com.google.security.zynamics.binnavi.Gui", "com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress", "com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager", "com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.BreakpointType", "com.google....
import com.google.security.zynamics.binnavi.Gui; import com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress; import com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager; import com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.BreakpointType; import com.google.security.zynamics.binnavi.disassembly.views.CViewHelpers; import com.google.security.zynamics.binnavi.disassembly.views.INaviView; import java.util.HashSet; import java.util.Set;
import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.binnavi.debug.models.breakpoints.*; import com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.*; import com.google.security.zynamics.binnavi.disassembly.views.*; import java.util.*;
[ "com.google.security", "java.util" ]
com.google.security; java.util;
1,596,216
logger.info("AccountController.find: id=" + id); Account accountResponse = this.service.findAccount(id); return new ResponseEntity<>(accountResponse, getNoCacheHeaders(), HttpStatus.OK); }
logger.info(STR + id); Account accountResponse = this.service.findAccount(id); return new ResponseEntity<>(accountResponse, getNoCacheHeaders(), HttpStatus.OK); }
/** * REST call to retrieve the account with the given id as userId. * * @param id The id of the user to retrieve the account for. * @return The account object if found. */
REST call to retrieve the account with the given id as userId
find
{ "repo_name": "cqueiroz-pivotal/cf-SpringBootTrader", "path": "springboottrades-accounts/src/main/java/io/pivotal/accounts/controller/AccountController.java", "license": "apache-2.0", "size": 6666 }
[ "io.pivotal.accounts.domain.Account", "org.springframework.http.HttpStatus", "org.springframework.http.ResponseEntity" ]
import io.pivotal.accounts.domain.Account; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity;
import io.pivotal.accounts.domain.*; import org.springframework.http.*;
[ "io.pivotal.accounts", "org.springframework.http" ]
io.pivotal.accounts; org.springframework.http;
2,301,957
public BluetoothMasInstance getInstanceData() { return mMas; } /** * Connects to MAS instance * <p> * Upon completion callback handler will receive {@link #EVENT_CONNECT}
BluetoothMasInstance function() { return mMas; } /** * Connects to MAS instance * <p> * Upon completion callback handler will receive {@link #EVENT_CONNECT}
/** * Retrieves MAS instance data associated with client * * @return instance data object */
Retrieves MAS instance data associated with client
getInstanceData
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "frameworks/opt/bluetooth/src/android/bluetooth/client/map/BluetoothMasClient.java", "license": "gpl-3.0", "size": 37741 }
[ "android.bluetooth.BluetoothMasInstance" ]
import android.bluetooth.BluetoothMasInstance;
import android.bluetooth.*;
[ "android.bluetooth" ]
android.bluetooth;
2,547,972
public InstallationJob getJob(Plugin plugin) { List<UpdateCenterJob> jobList = getJobs(); Collections.reverse(jobList); for (UpdateCenterJob job : jobList) if (job instanceof InstallationJob) { InstallationJob ij = (InstallationJob)job; if (ij.plugin.name.equals(plugin.name) && ij.plugin.sourceId.equals(plugin.sourceId)) return ij; } return null; }
InstallationJob function(Plugin plugin) { List<UpdateCenterJob> jobList = getJobs(); Collections.reverse(jobList); for (UpdateCenterJob job : jobList) if (job instanceof InstallationJob) { InstallationJob ij = (InstallationJob)job; if (ij.plugin.name.equals(plugin.name) && ij.plugin.sourceId.equals(plugin.sourceId)) return ij; } return null; }
/** * Returns latest install/upgrade job for the given plugin. * @return InstallationJob or null if not found */
Returns latest install/upgrade job for the given plugin
getJob
{ "repo_name": "ktan2020/jenkins-1.507", "path": "core/src/main/java/hudson/model/UpdateCenter.java", "license": "mit", "size": 52328 }
[ "hudson.model.UpdateSite", "java.util.Collections", "java.util.List" ]
import hudson.model.UpdateSite; import java.util.Collections; import java.util.List;
import hudson.model.*; import java.util.*;
[ "hudson.model", "java.util" ]
hudson.model; java.util;
1,334,262
public File getBlockFile(int dnIndex, ExtendedBlock block) { // Check for block file in the two storage directories of the datanode for (int i = 0; i <=1 ; i++) { File storageDir = getStorageDir(dnIndex, i); File blockFile = getBlockFile(storageDir, block); if (blockFile.exists()) { return blockFile; } } return null; }
File function(int dnIndex, ExtendedBlock block) { for (int i = 0; i <=1 ; i++) { File storageDir = getStorageDir(dnIndex, i); File blockFile = getBlockFile(storageDir, block); if (blockFile.exists()) { return blockFile; } } return null; }
/** * Get the block data file for a block from a given datanode * @param dnIndex Index of the datanode to get block files for * @param block block for which corresponding files are needed */
Get the block data file for a block from a given datanode
getBlockFile
{ "repo_name": "anjuncc/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/MiniDFSCluster.java", "license": "apache-2.0", "size": 106857 }
[ "java.io.File", "org.apache.hadoop.hdfs.protocol.ExtendedBlock" ]
import java.io.File; import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
818,111
public void ensureRoleHighEnoughToDisassociateDocumentFromOtherUsers( final Document.Role role, final Collection<String> usernames, final String documentId) throws ServiceException { for(String username : usernames) { ensureRoleHighEnoughToDisassociateOtherUserFromDocument(role, username, documentId); } }
void function( final Document.Role role, final Collection<String> usernames, final String documentId) throws ServiceException { for(String username : usernames) { ensureRoleHighEnoughToDisassociateOtherUserFromDocument(role, username, documentId); } }
/** * Verifies that a given role has enough permissions to disassociate a * document and each of the users in a collection based on the users' * individual roles with the document. * * @param role The maximum role of the user that is attempting to * disassociate the classes and document. * * @param usernames The other users' usernames. * * @param documentId The document's unique identifier. * * @throws ServiceException Thrown if the role is not high enough to * disassociate a user and document. */
Verifies that a given role has enough permissions to disassociate a document and each of the users in a collection based on the users' individual roles with the document
ensureRoleHighEnoughToDisassociateDocumentFromOtherUsers
{ "repo_name": "HaiJiaoXinHeng/server-1", "path": "src/org/ohmage/service/UserDocumentServices.java", "license": "apache-2.0", "size": 18458 }
[ "java.util.Collection", "org.ohmage.domain.Document", "org.ohmage.exception.ServiceException" ]
import java.util.Collection; import org.ohmage.domain.Document; import org.ohmage.exception.ServiceException;
import java.util.*; import org.ohmage.domain.*; import org.ohmage.exception.*;
[ "java.util", "org.ohmage.domain", "org.ohmage.exception" ]
java.util; org.ohmage.domain; org.ohmage.exception;
575,294
//------------------------------------------------------------------------------- private void moveInterval(int start, int end, int to) { int temp = to; ClassPathPair[] path = new ClassPathPair[end - start + 1]; for (int i = start;i <= end; ++i) path[i - start] = (ClassPathPair) owner.getClassPathListModel().get(i); owner.getClassPathListModel().removeRange(start,end); for (ClassPathPair pair : path) owner.getClassPathListModel().add(temp++,pair); }
void function(int start, int end, int to) { int temp = to; ClassPathPair[] path = new ClassPathPair[end - start + 1]; for (int i = start;i <= end; ++i) path[i - start] = (ClassPathPair) owner.getClassPathListModel().get(i); owner.getClassPathListModel().removeRange(start,end); for (ClassPathPair pair : path) owner.getClassPathListModel().add(temp++,pair); }
/** Moves the elements in the classpath list. The indices of the moved elements * are in the interval [<code>start</code>,<code>end</code>]. * @param to the new index of the first element */
Moves the elements in the classpath list. The indices of the moved elements are in the interval [<code>start</code>,<code>end</code>]
moveInterval
{ "repo_name": "lgulyas/MEME", "path": "src/ai/aitia/meme/paramsweep/gui/Page_LoadModel.java", "license": "gpl-3.0", "size": 42056 }
[ "ai.aitia.meme.paramsweep.utils.ClassPathPair" ]
import ai.aitia.meme.paramsweep.utils.ClassPathPair;
import ai.aitia.meme.paramsweep.utils.*;
[ "ai.aitia.meme" ]
ai.aitia.meme;
532,394
public static <T, E extends Exception> Consumer<T> wrapConsumer( final ExceptionThrowingConsumer<T, E> wrappedConsumer) { return consumed -> { try { wrappedConsumer.accept(consumed); } catch (RuntimeException runtimeException) { throw runtimeException; } catch (Exception exception) { if (exception instanceof IOException) { throw new UncheckedIOException((IOException)exception); } else { throw new RuntimeException(exception); } } }; }
static <T, E extends Exception> Consumer<T> function( final ExceptionThrowingConsumer<T, E> wrappedConsumer) { return consumed -> { try { wrappedConsumer.accept(consumed); } catch (RuntimeException runtimeException) { throw runtimeException; } catch (Exception exception) { if (exception instanceof IOException) { throw new UncheckedIOException((IOException)exception); } else { throw new RuntimeException(exception); } } }; }
/** * Accepts a Consumer that potentially throws an Exception * (even a checked exception), but only throws an unchecked * exception when the checked or unchecked exception is * encountered. * * @param wrappedConsumer Consumer that potentially throws * a checked exception. * @param <T> Input argument. * @param <E> Potential exception thrown by provided Consumer. * @return Standard JDK Consumer that only throws unchecked exceptions. */
Accepts a Consumer that potentially throws an Exception (even a checked exception), but only throws an unchecked exception when the checked or unchecked exception is encountered
wrapConsumer
{ "repo_name": "dustinmarx/javautilities", "path": "dustin/utilities/function/ExceptionThrowingFunctionWrappers.java", "license": "apache-2.0", "size": 6707 }
[ "java.io.IOException", "java.io.UncheckedIOException", "java.util.function.Consumer" ]
import java.io.IOException; import java.io.UncheckedIOException; import java.util.function.Consumer;
import java.io.*; import java.util.function.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,074,439
@Override public ResourceLocator getPluginResourceLocator() { return plugin; }
ResourceLocator function() { return plugin; }
/** * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @return the singleton instance. * @generated */
Returns the singleton instance of the Eclipse plugin.
getPluginResourceLocator
{ "repo_name": "drbgfc/mdht", "path": "core/plugins/org.openhealthtools.mdht.uml.validation/src/org/openhealthtools/mdht/uml/validation/internal/ValidationPlugin.java", "license": "epl-1.0", "size": 2203 }
[ "org.eclipse.emf.common.util.ResourceLocator" ]
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,382,773
public static int getId( Object object ) { try { Method method = object.getClass().getMethod( "getId" ); return (Integer) method.invoke( object ); } catch ( NoSuchMethodException ex ) { return -1; } catch ( InvocationTargetException ex ) { return -1; } catch ( IllegalAccessException ex ) { return -1; } }
static int function( Object object ) { try { Method method = object.getClass().getMethod( "getId" ); return (Integer) method.invoke( object ); } catch ( NoSuchMethodException ex ) { return -1; } catch ( InvocationTargetException ex ) { return -1; } catch ( IllegalAccessException ex ) { return -1; } }
/** * Invokes method getId() for this object and returns the return value. An * int return type is expected. If the operation fails -1 is returned. * * @param object object to call getId() on. * @return The identifier. */
Invokes method getId() for this object and returns the return value. An int return type is expected. If the operation fails -1 is returned
getId
{ "repo_name": "vietnguyen/dhis2-core", "path": "dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java", "license": "bsd-3-clause", "size": 15853 }
[ "java.lang.reflect.InvocationTargetException", "java.lang.reflect.Method" ]
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,647,161
public void setParameter(final List<Parameter> parameters) { m_parameters.clear(); m_parameters.addAll(parameters); }
void function(final List<Parameter> parameters) { m_parameters.clear(); m_parameters.addAll(parameters); }
/** * Sets the value of '_parameterList' by copying the given * Vector. All elements will be checked for type safety. * * @param parameters the Vector to copy. */
Sets the value of '_parameterList' by copying the given Vector. All elements will be checked for type safety
setParameter
{ "repo_name": "RangerRick/opennms", "path": "opennms-config-model/src/main/java/org/opennms/netmgt/config/datacollection/StorageStrategy.java", "license": "gpl-2.0", "size": 12065 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,684,912
@Override public void actionPerformed(ActionEvent arg0) { int projectIndex; int issueIndex; Object selectedIssueKey; HashMap selectedIssue; lblInfo.setText("Info"); System.out.println(arg0.getActionCommand()+":"); switch (arg0.getActionCommand()){ case LOGIN: showPanel(JiraPanel.JIRA_PANEL); jp.JiraLogin(); jiraUser = tfUsername.getText(); lblUsername.setText(jiraUser); break; case CHANGE_LOGIN: // return to the login panel System.out.println("\t - returning to the login panel..."); showPanel(JiraPanel.LOGIN_PANEL); break; case PROJECT_SELECTED: // fill in versions and components for the selected project projectIndex = cbProjects.getSelectedIndex(); init(); Object[] versions = jp.JiraGetVersions(projectIndex); jp.setVersions(versions); if (jp.getJiraVersions()!=null){ setComboValues(cbVersions,jp.getProperty(versions,"name")); cbVersions.setEnabled(true); } Object[] components = jp.JiraGetComponents(projectIndex); jp.setComponents(components); if (jp.getJiraComponents()!=null){ setComboValues(cbComponents,jp.getProperty(components,"name")); cbComponents.setEnabled(true); } jp.JiraGetIssues(projectIndex); break; case VERSION_SELECTED: // filter issue list by the selected version projectIndex = cbProjects.getSelectedIndex(); int versionIndex = cbVersions.getSelectedIndex(); jp.JiraGetIssues(projectIndex,versionIndex,AFFECTS_VERSION); break; case COMPONENT_SELECTED: // filter the issue list by the selected component projectIndex = cbProjects.getSelectedIndex(); int componentIndex = cbComponents.getSelectedIndex(); jp.JiraGetIssues(projectIndex,componentIndex,JiraPanel.COMPONENT); break; case PUSH_CREATE_ISSUE_BTN: // create and display the window for issue creation new IssueFrame(JiraPanel.ISSUE_FIELD_NAMES_CREATE,new HashMap()); break; case PUSH_EDIT_ISSUE_BTN: // create and display the window for issue editing issueIndex = issuesTable.getSelectedRow(); selectedIssueKey = issuesTable.getValueAt(issueIndex, 0); selectedIssue = jp.getIssueByKey((String)selectedIssueKey); if (selectedIssue!=null){ new IssueFrame(JiraPanel.ISSUE_FIELD_NAMES_CREATE,selectedIssue); } else { lblInfo.setText("You must select an issue from the table"); } break; case PUSH_ADD_ATTACHMENT: // create and display a window for managing attachments issueIndex = issuesTable.getSelectedRow(); selectedIssueKey = issuesTable.getValueAt(issueIndex, 0); selectedIssue = jp.getIssueByKey((String)selectedIssueKey); if (selectedIssue!=null){ AttachmentChooser ac = new AttachmentChooser(selectedIssue); attachmentsPopup = new JFrame("Attachment Chooser for issue "+selectedIssue.get("key")); attachmentsPopup.getContentPane().add(ac); attachmentsPopup.pack(); attachmentsPopup.setVisible(true); } else { lblInfo.setText("You must select an issue from the table"); } break; case PUSH_SEE_COMMENT: // create and display a window for adding / editing comments issueIndex = issuesTable.getSelectedRow(); selectedIssueKey = issuesTable.getValueAt(issueIndex, 0); selectedIssue = jp.getIssueByKey((String)selectedIssueKey); if (selectedIssue!=null){ commentsPopup = new JFrame("Comments"); commentsPopup.setMaximumSize(new Dimension(400,650)); commentsPanel = createCommentsPanel((String)selectedIssue.get("key"), new JPanel()); commentsPopup.getContentPane().add(commentsPanel); commentsPopup.pack(); commentsPopup.setVisible(true); } else { lblInfo.setText("You must select an issue from the table"); } break; case PUSH_SEARCH_BTN: // search issues by user query jp.JiraGetIssues(tfSearchIssue.getText()); break; } }
void function(ActionEvent arg0) { int projectIndex; int issueIndex; Object selectedIssueKey; HashMap selectedIssue; lblInfo.setText("Info"); System.out.println(arg0.getActionCommand()+":"); switch (arg0.getActionCommand()){ case LOGIN: showPanel(JiraPanel.JIRA_PANEL); jp.JiraLogin(); jiraUser = tfUsername.getText(); lblUsername.setText(jiraUser); break; case CHANGE_LOGIN: System.out.println(STR); showPanel(JiraPanel.LOGIN_PANEL); break; case PROJECT_SELECTED: projectIndex = cbProjects.getSelectedIndex(); init(); Object[] versions = jp.JiraGetVersions(projectIndex); jp.setVersions(versions); if (jp.getJiraVersions()!=null){ setComboValues(cbVersions,jp.getProperty(versions,"name")); cbVersions.setEnabled(true); } Object[] components = jp.JiraGetComponents(projectIndex); jp.setComponents(components); if (jp.getJiraComponents()!=null){ setComboValues(cbComponents,jp.getProperty(components,"name")); cbComponents.setEnabled(true); } jp.JiraGetIssues(projectIndex); break; case VERSION_SELECTED: projectIndex = cbProjects.getSelectedIndex(); int versionIndex = cbVersions.getSelectedIndex(); jp.JiraGetIssues(projectIndex,versionIndex,AFFECTS_VERSION); break; case COMPONENT_SELECTED: projectIndex = cbProjects.getSelectedIndex(); int componentIndex = cbComponents.getSelectedIndex(); jp.JiraGetIssues(projectIndex,componentIndex,JiraPanel.COMPONENT); break; case PUSH_CREATE_ISSUE_BTN: new IssueFrame(JiraPanel.ISSUE_FIELD_NAMES_CREATE,new HashMap()); break; case PUSH_EDIT_ISSUE_BTN: issueIndex = issuesTable.getSelectedRow(); selectedIssueKey = issuesTable.getValueAt(issueIndex, 0); selectedIssue = jp.getIssueByKey((String)selectedIssueKey); if (selectedIssue!=null){ new IssueFrame(JiraPanel.ISSUE_FIELD_NAMES_CREATE,selectedIssue); } else { lblInfo.setText(STR); } break; case PUSH_ADD_ATTACHMENT: issueIndex = issuesTable.getSelectedRow(); selectedIssueKey = issuesTable.getValueAt(issueIndex, 0); selectedIssue = jp.getIssueByKey((String)selectedIssueKey); if (selectedIssue!=null){ AttachmentChooser ac = new AttachmentChooser(selectedIssue); attachmentsPopup = new JFrame(STR+selectedIssue.get("key")); attachmentsPopup.getContentPane().add(ac); attachmentsPopup.pack(); attachmentsPopup.setVisible(true); } else { lblInfo.setText(STR); } break; case PUSH_SEE_COMMENT: issueIndex = issuesTable.getSelectedRow(); selectedIssueKey = issuesTable.getValueAt(issueIndex, 0); selectedIssue = jp.getIssueByKey((String)selectedIssueKey); if (selectedIssue!=null){ commentsPopup = new JFrame(STR); commentsPopup.setMaximumSize(new Dimension(400,650)); commentsPanel = createCommentsPanel((String)selectedIssue.get("key"), new JPanel()); commentsPopup.getContentPane().add(commentsPanel); commentsPopup.pack(); commentsPopup.setVisible(true); } else { lblInfo.setText(STR); } break; case PUSH_SEARCH_BTN: jp.JiraGetIssues(tfSearchIssue.getText()); break; } }
/** * This method treats the user events that occur in the main GUI window. * @param arg0 - the user event */
This method treats the user events that occur in the main GUI window
actionPerformed
{ "repo_name": "ctgriffiths/twister", "path": "plugins/JiraPanel.java", "license": "apache-2.0", "size": 55105 }
[ "java.awt.Dimension", "java.awt.event.ActionEvent", "java.util.HashMap", "javax.swing.JFrame", "javax.swing.JPanel" ]
import java.awt.Dimension; import java.awt.event.ActionEvent; import java.util.HashMap; import javax.swing.JFrame; import javax.swing.JPanel;
import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*;
[ "java.awt", "java.util", "javax.swing" ]
java.awt; java.util; javax.swing;
1,208,133
@Nullable public static Object[] readArray(ObjectInput in) throws IOException, ClassNotFoundException { int len = in.readInt(); Object[] arr = null; if (len > 0) { arr = new Object[len]; for (int i = 0; i < len; i++) arr[i] = in.readObject(); } return arr; }
@Nullable static Object[] function(ObjectInput in) throws IOException, ClassNotFoundException { int len = in.readInt(); Object[] arr = null; if (len > 0) { arr = new Object[len]; for (int i = 0; i < len; i++) arr[i] = in.readObject(); } return arr; }
/** * Reads array from input stream. * * @param in Input stream. * @return Deserialized array. * @throws IOException If failed. * @throws ClassNotFoundException If class not found. */
Reads array from input stream
readArray
{ "repo_name": "murador/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 294985 }
[ "java.io.IOException", "java.io.ObjectInput", "org.jetbrains.annotations.Nullable" ]
import java.io.IOException; import java.io.ObjectInput; import org.jetbrains.annotations.Nullable;
import java.io.*; import org.jetbrains.annotations.*;
[ "java.io", "org.jetbrains.annotations" ]
java.io; org.jetbrains.annotations;
1,945,029
@Transient public String getValueString() { if(this.getType() != ContactMechanismType.EMAIL && !StringUtils.isBlank(this.value)){ String tempPhoneNumber = this.value.replaceAll("-", ""); String phoneNumberString = tempPhoneNumber.substring(0, 3) + "-" +tempPhoneNumber.substring(3, 6) + "-" + tempPhoneNumber.substring(6); return phoneNumberString; }else{ return this.value ; } }
String function() { if(this.getType() != ContactMechanismType.EMAIL && !StringUtils.isBlank(this.value)){ String tempPhoneNumber = this.value.replaceAll("-", STR-STR-" + tempPhoneNumber.substring(6); return phoneNumberString; }else{ return this.value ; } }
/** * Gets the value string. * * @return the value string */
Gets the value string
getValueString
{ "repo_name": "NCIP/c3pr", "path": "codebase/projects/core/src/java/edu/duke/cabig/c3pr/domain/ContactMechanism.java", "license": "bsd-3-clause", "size": 5225 }
[ "edu.duke.cabig.c3pr.constants.ContactMechanismType", "edu.duke.cabig.c3pr.utils.StringUtils" ]
import edu.duke.cabig.c3pr.constants.ContactMechanismType; import edu.duke.cabig.c3pr.utils.StringUtils;
import edu.duke.cabig.c3pr.constants.*; import edu.duke.cabig.c3pr.utils.*;
[ "edu.duke.cabig" ]
edu.duke.cabig;
2,541,748
List<Person> getAllByAddedWidget(String widgetId);
List<Person> getAllByAddedWidget(String widgetId);
/** * List of persons whom have added the supplied widget to one or more pages * * @param widgetId the entityId of the Widget to search * @return List of Person objects in alphabetical order sorted by familyname, givenname */
List of persons whom have added the supplied widget to one or more pages
getAllByAddedWidget
{ "repo_name": "dhara-uom/ravecore", "path": "rave-components/rave-core/src/main/java/org/apache/rave/portal/service/UserService.java", "license": "apache-2.0", "size": 8641 }
[ "java.util.List", "org.apache.rave.model.Person" ]
import java.util.List; import org.apache.rave.model.Person;
import java.util.*; import org.apache.rave.model.*;
[ "java.util", "org.apache.rave" ]
java.util; org.apache.rave;
488,454
ChunkCoordinates getPlayerCoordinates();
ChunkCoordinates getPlayerCoordinates();
/** * Return the position for this command sender. */
Return the position for this command sender
getPlayerCoordinates
{ "repo_name": "draknyte1/MiscUtils", "path": "src/Java/miscutil/gregtech/util/VanillaChatCommandSender.java", "license": "gpl-2.0", "size": 1211 }
[ "net.minecraft.util.ChunkCoordinates" ]
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.*;
[ "net.minecraft.util" ]
net.minecraft.util;
1,060,625
public static void removeChildren(Node target) { while (target.hasChildNodes()) { target.removeChild(target.getFirstChild()); } }
static void function(Node target) { while (target.hasChildNodes()) { target.removeChild(target.getFirstChild()); } }
/** * Remove the child nodes under another node. * * @param target * the <code>Node</code> to remove the children from. */
Remove the child nodes under another node
removeChildren
{ "repo_name": "TheRingbearer/HAWKS", "path": "ode/utils/src/main/java/org/apache/ode/utils/DOMUtils.java", "license": "apache-2.0", "size": 40920 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,402,923
@XmlElement(name = "routeProperty") @Metadata(label = "advanced") public void setRouteProperties(List<PropertyDefinition> routeProperties) { this.routeProperties = routeProperties; } // **************************** // Static helpers // ****************************
@XmlElement(name = STR) @Metadata(label = STR) void function(List<PropertyDefinition> routeProperties) { this.routeProperties = routeProperties; }
/** * To set metadata as properties on the route. */
To set metadata as properties on the route
setRouteProperties
{ "repo_name": "apache/camel", "path": "core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java", "license": "apache-2.0", "size": 35893 }
[ "java.util.List", "javax.xml.bind.annotation.XmlElement", "org.apache.camel.spi.Metadata" ]
import java.util.List; import javax.xml.bind.annotation.XmlElement; import org.apache.camel.spi.Metadata;
import java.util.*; import javax.xml.bind.annotation.*; import org.apache.camel.spi.*;
[ "java.util", "javax.xml", "org.apache.camel" ]
java.util; javax.xml; org.apache.camel;
2,663,290
private boolean isExistURLorDOI(List<BibEntry> selectEntryList) { if (selectEntryList.size() == 1) { BibEntry selectedEntry = selectEntryList.get(0); return (selectedEntry.getField(FieldName.URL).isPresent() || selectedEntry.getField(FieldName.DOI).isPresent()); } return false; }
boolean function(List<BibEntry> selectEntryList) { if (selectEntryList.size() == 1) { BibEntry selectedEntry = selectEntryList.get(0); return (selectedEntry.getField(FieldName.URL).isPresent() selectedEntry.getField(FieldName.DOI).isPresent()); } return false; }
/** * Return a boolean, if the selected entry have url or doi * @param selectEntryList A selected entries list of the current base pane * @return true, if the selected entry contains url or doi. * false, if multiple entries are selected or the selected entry doesn't contains url or doi */
Return a boolean, if the selected entry have url or doi
isExistURLorDOI
{ "repo_name": "legalice/DC-UFSCar-ES2-201701-Daniel-Maicon-Osires-Rafael", "path": "src/main/java/org/jabref/gui/JabRefFrame.java", "license": "mit", "size": 104034 }
[ "java.util.List", "org.jabref.model.entry.BibEntry", "org.jabref.model.entry.FieldName" ]
import java.util.List; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.FieldName;
import java.util.*; import org.jabref.model.entry.*;
[ "java.util", "org.jabref.model" ]
java.util; org.jabref.model;
2,510,576
public HttpServletRequest mock() { return this.request; }
HttpServletRequest function() { return this.request; }
/** * Mock it. * @return Mocked request */
Mock it
mock
{ "repo_name": "krzyk/rexsl", "path": "src/main/java/com/rexsl/mock/HttpServletRequestMocker.java", "license": "bsd-3-clause", "size": 5247 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,509,559
void setAsDefault(int modelInternalId) throws AdeException;
void setAsDefault(int modelInternalId) throws AdeException;
/** * Sets the given model as the default model for this analysis group * * @throws AdeException * if this model doesn't exist or if it is not associated with an * analysis group */
Sets the given model as the default model for this analysis group
setAsDefault
{ "repo_name": "openmainframeproject/ade", "path": "ade-core/src/main/java/org/openmainframe/ade/dataStore/IDataStoreModels.java", "license": "gpl-3.0", "size": 6488 }
[ "org.openmainframe.ade.exceptions.AdeException" ]
import org.openmainframe.ade.exceptions.AdeException;
import org.openmainframe.ade.exceptions.*;
[ "org.openmainframe.ade" ]
org.openmainframe.ade;
847,419
protected static String getDataDirectoryPath(Map<String, String> commandParameters) { return getCommandParameterValue(commandParameters, DATA_DIRECTORY); }
static String function(Map<String, String> commandParameters) { return getCommandParameterValue(commandParameters, DATA_DIRECTORY); }
/** * Given a (command parameter) Map, attempts to safely retrieve the "data_directory" property. * * @param commandParameters a Map containing the dictionary of data to interrogate * @return a String indicating the data directory or null (if not found or set) */
Given a (command parameter) Map, attempts to safely retrieve the "data_directory" property
getDataDirectoryPath
{ "repo_name": "alexryndin/ambari", "path": "ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerAction.java", "license": "apache-2.0", "size": 23624 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,346,095
private Node parseAndRecordTypeNameNode(JsDocToken token, int lineno, int startCharno, boolean matchingLC) { return parseAndRecordTypeNode(token, lineno, startCharno, matchingLC, true); }
Node function(JsDocToken token, int lineno, int startCharno, boolean matchingLC) { return parseAndRecordTypeNode(token, lineno, startCharno, matchingLC, true); }
/** * Looks for a type expression at the current token and if found, * returns it. Note that this method consumes input. * * @param token The current token. * @param lineno The line of the type expression. * @param startCharno The starting character position of the type expression. * @param matchingLC Whether the type expression starts with a "{". * @return The type expression found or null if none. */
Looks for a type expression at the current token and if found, returns it. Note that this method consumes input
parseAndRecordTypeNameNode
{ "repo_name": "Medium/closure-compiler", "path": "src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java", "license": "apache-2.0", "size": 85063 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,253,426
@WebMethod @WebResult(name = "rval", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201809") @RequestWrapper(localName = "upload", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201809", className = "com.google.api.ads.adwords.jaxws.v201809.cm.MediaServiceInterfaceupload") @ResponseWrapper(localName = "uploadResponse", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201809", className = "com.google.api.ads.adwords.jaxws.v201809.cm.MediaServiceInterfaceuploadResponse") public List<Media> upload( @WebParam(name = "media", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201809") List<Media> media) throws ApiException_Exception ;
@WebResult(name = "rval", targetNamespace = STRuploadSTRhttps: @ResponseWrapper(localName = "uploadResponseSTRhttps: List<Media> function( @WebParam(name = "mediaSTRhttps: List<Media> media) throws ApiException_Exception ;
/** * * Uploads new media. Currently, you can upload {@link Image} files and {@link MediaBundle}s. * * @param media A list of {@code Media} objects, each containing the data to * be uploaded. * @return A list of uploaded media in the same order as the argument list. * * * @param media * @return * returns java.util.List<com.google.api.ads.adwords.jaxws.v201809.cm.Media> * @throws ApiException_Exception */
Uploads new media. Currently, you can upload <code>Image</code> files and <code>MediaBundle</code>s
upload
{ "repo_name": "googleads/googleads-java-lib", "path": "modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201809/cm/MediaServiceInterface.java", "license": "apache-2.0", "size": 5101 }
[ "java.util.List", "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.ws.ResponseWrapper" ]
import java.util.List; import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.ResponseWrapper;
import java.util.*; import javax.jws.*; import javax.xml.ws.*;
[ "java.util", "javax.jws", "javax.xml" ]
java.util; javax.jws; javax.xml;
1,130,427
public static BufferDataSet makeDataSet( int rank, int reclen, int recoffs, int len0, int len1, int len2, int len3, ByteBuffer buf, Object type ) { BufferDataSet result; if ( rank==1 && len1>1 ) throw new IllegalArgumentException("rank is 1, but len1 is not 1"); int nperRec= len1 * len2 * len3; // assumes unused params are "1" if ( reclen < byteCount(type) ) { throw new IllegalArgumentException("reclen " + reclen + " is smaller than length of type "+type); } if ( reclen < nperRec * byteCount(type) ) { throw new IllegalArgumentException("reclen " + reclen + " is smaller than length of " + nperRec +" type "+type); } if ( (long)(reclen) * len0 > buf.limit() ) { throw new IllegalArgumentException( String.format( "buffer length (%d bytes) is too small to contain data (%d %d-byte records)", buf.limit(), len0, reclen ) ); } if ( type.equals(DOUBLE) ) { result=new DoubleDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(FLOAT) ) { result=new FloatDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(VAX_FLOAT) ) { result= new VaxFloatDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(INT24) ) { result= new Int24DataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(UINT24) ) { result= new UInt24DataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(NYBBLE) ) { result= new NybbleDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(LONG) ) { result=new LongDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(INT) || type.equals(INTEGER) ) { result=new IntDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(UINT) ) { result=new UIntDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(SHORT) ) { result=new ShortDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(USHORT) ) { result=new UShortDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(TRUNCATEDFLOAT) ) { result=new TruncatedFloatDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(BYTE) ) { result=new ByteDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if (type.equals(UBYTE) ) { result=new UByteDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if (type.toString().startsWith("time") ) { result= new TimeDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf, type ); } else { throw new IllegalArgumentException("bad data type: "+type); } return result; }
static BufferDataSet function( int rank, int reclen, int recoffs, int len0, int len1, int len2, int len3, ByteBuffer buf, Object type ) { BufferDataSet result; if ( rank==1 && len1>1 ) throw new IllegalArgumentException(STR); int nperRec= len1 * len2 * len3; if ( reclen < byteCount(type) ) { throw new IllegalArgumentException(STR + reclen + STR+type); } if ( reclen < nperRec * byteCount(type) ) { throw new IllegalArgumentException(STR + reclen + STR + nperRec +STR+type); } if ( (long)(reclen) * len0 > buf.limit() ) { throw new IllegalArgumentException( String.format( STR, buf.limit(), len0, reclen ) ); } if ( type.equals(DOUBLE) ) { result=new DoubleDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(FLOAT) ) { result=new FloatDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(VAX_FLOAT) ) { result= new VaxFloatDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(INT24) ) { result= new Int24DataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(UINT24) ) { result= new UInt24DataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(NYBBLE) ) { result= new NybbleDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(LONG) ) { result=new LongDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(INT) type.equals(INTEGER) ) { result=new IntDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(UINT) ) { result=new UIntDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(SHORT) ) { result=new ShortDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(USHORT) ) { result=new UShortDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(TRUNCATEDFLOAT) ) { result=new TruncatedFloatDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if ( type.equals(BYTE) ) { result=new ByteDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if (type.equals(UBYTE) ) { result=new UByteDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf ); } else if (type.toString().startsWith("time") ) { result= new TimeDataSet( rank, reclen, recoffs, len0, len1, len2, len3, buf, type ); } else { throw new IllegalArgumentException(STR+type); } return result; }
/** * Make a BufferDataSet of the given type. * @param rank the rank (number of indeces) of the data. * @param reclen length in bytes of each record. This may be longer than len1*len2*len3*byteCount(type) * @param recoffs byte offset of each record * @param len0 number of elements in the first index * @param len1 number of elements in the second index * @param len2 number of elements in the third index * @param len3 number of elements in the fourth index * @param buf ByteBuffer containing the data, which should be at least recoffs + reclen * len0 bytes long. * @param type BufferDataSet.INT, BufferDataSet.DOUBLE, etc... * @return BufferDataSet of the given type. */
Make a BufferDataSet of the given type
makeDataSet
{ "repo_name": "autoplot/app", "path": "QDataSet/src/org/das2/qds/buffer/BufferDataSet.java", "license": "gpl-2.0", "size": 58579 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
2,591,518
long getStreamPosition() throws IOException; /** * Sets the current stream position to the desired location. * The next read will occur at this location. * <p> * An {@code IndexOutOfBoundsException} will be thrown if pPosition is smaller * than the flushed position (as returned by {@link #getFlushedPosition()}). * </p> * <p> * It is legal to seek past the end of the file; an {@code EOFException}
long getStreamPosition() throws IOException; /** * Sets the current stream position to the desired location. * The next read will occur at this location. * <p> * An {@code IndexOutOfBoundsException} will be thrown if pPosition is smaller * than the flushed position (as returned by {@link #getFlushedPosition()}). * </p> * <p> * It is legal to seek past the end of the file; an {@code EOFException}
/** * Returns the current byte position of the stream. The next read will take * place starting at this offset. * * @return a {@code long} containing the position of the stream. * @throws IOException if an I/O error occurs. */
Returns the current byte position of the stream. The next read will take place starting at this offset
getStreamPosition
{ "repo_name": "jbobnar/TwelveMonkeys", "path": "common/common-io/src/main/java/com/twelvemonkeys/io/Seekable.java", "license": "bsd-3-clause", "size": 7359 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,453,165
private WorkflowTaskState getState(WebScriptRequest req) { String stateName = req.getParameter(PARAM_STATE); if (stateName != null) { try { return WorkflowTaskState.valueOf(stateName.toUpperCase()); } catch (IllegalArgumentException e) { String msg = "Unrecognised State parameter: " + stateName; throw new WebScriptException(HttpStatus.SC_BAD_REQUEST, msg); } } return null; }
WorkflowTaskState function(WebScriptRequest req) { String stateName = req.getParameter(PARAM_STATE); if (stateName != null) { try { return WorkflowTaskState.valueOf(stateName.toUpperCase()); } catch (IllegalArgumentException e) { String msg = STR + stateName; throw new WebScriptException(HttpStatus.SC_BAD_REQUEST, msg); } } return null; }
/** * Gets the specified {@link WorkflowTaskState}, null if not requested * * @param req * @return */
Gets the specified <code>WorkflowTaskState</code>, null if not requested
getState
{ "repo_name": "IntesysOpenway/openway-tasklist", "path": "openway-tasklist-alfresco/src/main/java/it/openway/tasklist/alfresco/webscript/TaskInstancesGet.java", "license": "lgpl-3.0", "size": 19558 }
[ "org.alfresco.service.cmr.workflow.WorkflowTaskState", "org.apache.http.HttpStatus", "org.springframework.extensions.webscripts.WebScriptException", "org.springframework.extensions.webscripts.WebScriptRequest" ]
import org.alfresco.service.cmr.workflow.WorkflowTaskState; import org.apache.http.HttpStatus; import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest;
import org.alfresco.service.cmr.workflow.*; import org.apache.http.*; import org.springframework.extensions.webscripts.*;
[ "org.alfresco.service", "org.apache.http", "org.springframework.extensions" ]
org.alfresco.service; org.apache.http; org.springframework.extensions;
776,446
public void testUpdateACLRemove() throws Exception { // remove user1 as a writer ArrayList<Link> removedWriters = new ArrayList<Link>(); removedWriters.add(new Link(user1)); Thread.sleep(1000); acm.removeWriters(childNode, removedWriters); // remove user2 as a reader ArrayList<Link> removedReaders = new ArrayList<Link>(); removedReaders.add(new Link(user2)); acm.removeReaders(childNode, removedReaders); // get the ACL (at the child node) and check the updates ACL aclRetrieved = acm.getEffectiveACL(grandchildNode); LinkedList<Link> childACLLinks = aclRetrieved.contents(); Iterator<Link> iter = childACLLinks.iterator(); // user0 is a manager Link l = (Link) iter.next(); Assert.assertTrue(l.targetName().equals(user0)); Assert.assertTrue(l.targetLabel().equals("rw+")); // there is no other link in the ACL Assert.assertFalse(iter.hasNext()); }
void function() throws Exception { ArrayList<Link> removedWriters = new ArrayList<Link>(); removedWriters.add(new Link(user1)); Thread.sleep(1000); acm.removeWriters(childNode, removedWriters); ArrayList<Link> removedReaders = new ArrayList<Link>(); removedReaders.add(new Link(user2)); acm.removeReaders(childNode, removedReaders); ACL aclRetrieved = acm.getEffectiveACL(grandchildNode); LinkedList<Link> childACLLinks = aclRetrieved.contents(); Iterator<Link> iter = childACLLinks.iterator(); Link l = (Link) iter.next(); Assert.assertTrue(l.targetName().equals(user0)); Assert.assertTrue(l.targetLabel().equals("rw+")); Assert.assertFalse(iter.hasNext()); }
/** * Remove user1 as a writer and user2 as a reader of the child node * @throws Exception */
Remove user1 as a writer and user2 as a reader of the child node
testUpdateACLRemove
{ "repo_name": "StefanoSalsano/alien-ofelia-conet-ccnx", "path": "javasrc/src/org/ccnx/ccn/test/profiles/security/access/group/GroupAccessControlManagerTestRepo.java", "license": "lgpl-2.1", "size": 8348 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.LinkedList", "junit.framework.Assert", "org.ccnx.ccn.io.content.Link" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import junit.framework.Assert; import org.ccnx.ccn.io.content.Link;
import java.util.*; import junit.framework.*; import org.ccnx.ccn.io.content.*;
[ "java.util", "junit.framework", "org.ccnx.ccn" ]
java.util; junit.framework; org.ccnx.ccn;
918,390
private native void _setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, IllegalStateException;
native void function(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, IllegalStateException;
/** * Sets the data source (file-path or http/rtsp/mms URL) to use. * * @param path the path of the file, or the http/rtsp/mms URL of the stream you * want to play * @param keys AVOption key * @param values AVOption value * @throws IllegalStateException if it is called in an invalid state */
Sets the data source (file-path or http/rtsp/mms URL) to use
_setDataSource
{ "repo_name": "menggang20/meiShi-master", "path": "vitamio/src/main/java/io/vov/vitamio/MediaPlayer.java", "license": "apache-2.0", "size": 52680 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,656,767
@Override public TemplateModelIterator iterator() throws TemplateModelException { return new SimpleCollection(categories, wrapper).iterator(); }
TemplateModelIterator function() throws TemplateModelException { return new SimpleCollection(categories, wrapper).iterator(); }
/** * Returns the iterator of the list. * * @return The iterator of the list * @throws TemplateModelException Error while returning the iterator */
Returns the iterator of the list
iterator
{ "repo_name": "tortlepp/BlogBuilder", "path": "src/main/java/eu/ortlepp/blogbuilder/model/freemarker/CategoryListModel.java", "license": "mit", "size": 1380 }
[ "freemarker.template.SimpleCollection", "freemarker.template.TemplateModelException", "freemarker.template.TemplateModelIterator" ]
import freemarker.template.SimpleCollection; import freemarker.template.TemplateModelException; import freemarker.template.TemplateModelIterator;
import freemarker.template.*;
[ "freemarker.template" ]
freemarker.template;
208,268
public Write<T> withPublishRequestFn(SerializableFunction<T, PublishRequest> publishRequestFn) { return builder().setPublishRequestFn(publishRequestFn).build(); }
Write<T> function(SerializableFunction<T, PublishRequest> publishRequestFn) { return builder().setPublishRequestFn(publishRequestFn).build(); }
/** * Specify a function for converting a message into PublishRequest object, this function is * mandatory. * * @param publishRequestFn publishRequestFn */
Specify a function for converting a message into PublishRequest object, this function is mandatory
withPublishRequestFn
{ "repo_name": "RyanSkraba/beam", "path": "sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/sns/SnsIO.java", "license": "apache-2.0", "size": 14417 }
[ "org.apache.beam.sdk.transforms.SerializableFunction", "software.amazon.awssdk.services.sns.model.PublishRequest" ]
import org.apache.beam.sdk.transforms.SerializableFunction; import software.amazon.awssdk.services.sns.model.PublishRequest;
import org.apache.beam.sdk.transforms.*; import software.amazon.awssdk.services.sns.model.*;
[ "org.apache.beam", "software.amazon.awssdk" ]
org.apache.beam; software.amazon.awssdk;
1,883,310
@Basic @Column(name = "TOTAL_DAYS_SERVED_EU", precision = 20) public long getTotalDaysServedEu() { return totalDaysServedEu; }
@Column(name = STR, precision = 20) long function() { return totalDaysServedEu; }
/** * Gets the value of the totalDaysServedEu property. * */
Gets the value of the totalDaysServedEu property
getTotalDaysServedEu
{ "repo_name": "Hack23/cia", "path": "model.internal.application.user.impl/src/main/java/com/hack23/cia/model/internal/application/data/politician/impl/ViewRiksdagenPolitician.java", "license": "apache-2.0", "size": 27153 }
[ "javax.persistence.Column" ]
import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
2,323,503
private boolean commandHelp( CommandSender sender ) { sender.sendMessage( ChatColor.WHITE + "[" + ChatColor.GOLD + "PvP Protection" + ChatColor.WHITE + "] Usage: " ); sender.sendMessage( ChatColor.WHITE + "/campfire about" ); sender.sendMessage( ChatColor.GRAY + "About this plugin" ); sender.sendMessage( ChatColor.WHITE + "/campfire terminate" ); sender.sendMessage( ChatColor.GRAY + "Removes your protection early" ); sender.sendMessage( ChatColor.WHITE + "/campfire timeleft [player]" ); sender.sendMessage( ChatColor.GRAY + "Gives the duration left for a player's protection" ); if ( sender.hasPermission( "campfire.reset" ) ) { sender.sendMessage( ChatColor.WHITE + "/campfire reset <player> " ); sender.sendMessage( ChatColor.GRAY + "Resets a player's protection status" ); } if ( sender.hasPermission( "campfire.reload" ) ) { sender.sendMessage( ChatColor.WHITE + "/campfire reload" ); sender.sendMessage( ChatColor.GRAY + "Clean reload of the plugin" ); } return true; }
boolean function( CommandSender sender ) { sender.sendMessage( ChatColor.WHITE + "[" + ChatColor.GOLD + STR + ChatColor.WHITE + STR ); sender.sendMessage( ChatColor.WHITE + STR ); sender.sendMessage( ChatColor.GRAY + STR ); sender.sendMessage( ChatColor.WHITE + STR ); sender.sendMessage( ChatColor.GRAY + STR ); sender.sendMessage( ChatColor.WHITE + STR ); sender.sendMessage( ChatColor.GRAY + STR ); if ( sender.hasPermission( STR ) ) { sender.sendMessage( ChatColor.WHITE + STR ); sender.sendMessage( ChatColor.GRAY + STR ); } if ( sender.hasPermission( STR ) ) { sender.sendMessage( ChatColor.WHITE + STR ); sender.sendMessage( ChatColor.GRAY + STR ); } return true; }
/** * Send the default command usage to the sender * @param sender Command sender */
Send the default command usage to the sender
commandHelp
{ "repo_name": "dpedu/campfire", "path": "src/com/bitdagger/CommandParser.java", "license": "mit", "size": 9644 }
[ "org.bukkit.ChatColor", "org.bukkit.command.CommandSender" ]
import org.bukkit.ChatColor; import org.bukkit.command.CommandSender;
import org.bukkit.*; import org.bukkit.command.*;
[ "org.bukkit", "org.bukkit.command" ]
org.bukkit; org.bukkit.command;
2,025,574
public JsonWriter value(long value) throws IOException { writeDeferredName(); beforeValue(); out.write(Long.toString(value)); return this; }
JsonWriter function(long value) throws IOException { writeDeferredName(); beforeValue(); out.write(Long.toString(value)); return this; }
/** * Encodes {@code value}. * * @return this writer. */
Encodes value
value
{ "repo_name": "pablocabillon/GamesOfDronesBackEnd", "path": "src/com/google/gson/stream/JsonWriter.java", "license": "epl-1.0", "size": 19588 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,310,782
boolean expectNotNullOrUndefined( NodeTraversal t, Node n, JSType type, String msg, JSType expectedType) { if (!type.isNoType() && !type.isUnknownType() && type.isSubtype(nullOrUndefined) && !containsForwardDeclaredUnresolvedName(type)) { // There's one edge case right now that we don't handle well, and // that we don't want to warn about. // if (this.x == null) { // this.initializeX(); // this.x.foo(); // } // In this case, we incorrectly type x because of how we // infer properties locally. See issue 109. // http://code.google.com/p/closure-compiler/issues/detail?id=109 // // We do not do this inference globally. if (n.getType() == Token.GETPROP && !t.inGlobalScope() && type.isNullType()) { return true; } mismatch(t, n, msg, type, expectedType); return false; } return true; }
boolean expectNotNullOrUndefined( NodeTraversal t, Node n, JSType type, String msg, JSType expectedType) { if (!type.isNoType() && !type.isUnknownType() && type.isSubtype(nullOrUndefined) && !containsForwardDeclaredUnresolvedName(type)) { if (n.getType() == Token.GETPROP && !t.inGlobalScope() && type.isNullType()) { return true; } mismatch(t, n, msg, type, expectedType); return false; } return true; }
/** * Expect the type to be anything but the null or void type. If the * expectation is not met, issue a warning at the provided node's * source code position. Note that a union type that includes the * void type and at least one other type meets the expectation. * @return Whether the expectation was met. */
Expect the type to be anything but the null or void type. If the expectation is not met, issue a warning at the provided node's source code position. Note that a union type that includes the void type and at least one other type meets the expectation
expectNotNullOrUndefined
{ "repo_name": "nuxleus/closure-compiler", "path": "src/com/google/javascript/jscomp/TypeValidator.java", "license": "apache-2.0", "size": 29320 }
[ "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token", "com.google.javascript.rhino.jstype.JSType" ]
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; import com.google.javascript.rhino.jstype.JSType;
import com.google.javascript.rhino.*; import com.google.javascript.rhino.jstype.*;
[ "com.google.javascript" ]
com.google.javascript;
2,829,675
private static void assertUpEdge(ControlFlowGraph<Node> cfg, Token startToken, Token endToken, Branch type) { assertTrue("No up edge found", 0 != getAllDownEdges(cfg, endToken, startToken, type).size()); }
static void function(ControlFlowGraph<Node> cfg, Token startToken, Token endToken, Branch type) { assertTrue(STR, 0 != getAllDownEdges(cfg, endToken, startToken, type).size()); }
/** * Assert that there exists a control flow edge of the given type * from some node with the first token to some node with the second token. * This edge must flow from a node to one of its ancestors. */
Assert that there exists a control flow edge of the given type from some node with the first token to some node with the second token. This edge must flow from a node to one of its ancestors
assertUpEdge
{ "repo_name": "tdelmas/closure-compiler", "path": "test/com/google/javascript/jscomp/ControlFlowAnalysisTest.java", "license": "apache-2.0", "size": 66289 }
[ "com.google.javascript.jscomp.ControlFlowGraph", "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token" ]
import com.google.javascript.jscomp.ControlFlowGraph; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token;
import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,789,164
void remove(StorageSession session);
void remove(StorageSession session);
/** * Removes the link. <br> * <p> * <b>Important Note:</b> this is just a sugar method that, in fact, executes the * {@link StorageSession#removeLink(StorageLink)}. * * @param session the storage session */
Removes the link. Important Note: this is just a sugar method that, in fact, executes the <code>StorageSession#removeLink(StorageLink)</code>
remove
{ "repo_name": "porcelli/OpenSpotLight", "path": "osl-persistence/osl-persistence-api/src/main/java/org/openspotlight/storage/domain/StorageLink.java", "license": "lgpl-3.0", "size": 4002 }
[ "org.openspotlight.storage.StorageSession" ]
import org.openspotlight.storage.StorageSession;
import org.openspotlight.storage.*;
[ "org.openspotlight.storage" ]
org.openspotlight.storage;
2,301,782
protected void devolverResultado(HttpServletResponse response, boolean pbEsComprimido, IListaElementos poResultado) throws ServletException, IOException { response.setContentType("application/x-java-serialized-object"); ObjectOutputStream salida = null; GZIPOutputStream gzipout = null; try{ if(pbEsComprimido){ gzipout = new GZIPOutputStream(response.getOutputStream()); salida = new ObjectOutputStream(gzipout); }else{ salida = new ObjectOutputStream(response.getOutputStream()); } salida.writeObject(poResultado); salida.flush(); if(gzipout != null) { gzipout.flush(); } }finally{ if(gzipout != null) { gzipout.close(); } if(salida != null) { salida.close(); } } }
void function(HttpServletResponse response, boolean pbEsComprimido, IListaElementos poResultado) throws ServletException, IOException { response.setContentType(STR); ObjectOutputStream salida = null; GZIPOutputStream gzipout = null; try{ if(pbEsComprimido){ gzipout = new GZIPOutputStream(response.getOutputStream()); salida = new ObjectOutputStream(gzipout); }else{ salida = new ObjectOutputStream(response.getOutputStream()); } salida.writeObject(poResultado); salida.flush(); if(gzipout != null) { gzipout.flush(); } }finally{ if(gzipout != null) { gzipout.close(); } if(salida != null) { salida.close(); } } }
/** * Devuelve el resultado al cliente * @param response respuesta servlet * @param pbEsComprimido si se devuelve comprimido * @param poResultado objeto resultado a devolver * @throws ServletException error * @throws IOException error */
Devuelve el resultado al cliente
devolverResultado
{ "repo_name": "Creativa3d/box3d", "path": "paquetes/src/utilesBD/servletAcciones/AListaPropiedadesHTTP.java", "license": "gpl-2.0", "size": 4454 }
[ "java.io.IOException", "java.io.ObjectOutputStream", "java.util.zip.GZIPOutputStream", "javax.servlet.ServletException", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import java.io.ObjectOutputStream; import java.util.zip.GZIPOutputStream; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.util.zip.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "java.util", "javax.servlet" ]
java.io; java.util; javax.servlet;
1,603,951
public void reloadChallengeConfig() { if (challengeConfigFile == null) { challengeConfigFile = new File(plugin.getDataFolder(), "challenges.yml"); } challengeFile = YamlConfiguration.loadConfiguration(challengeConfigFile); // Look for defaults in the jar Settings.challengeList = getChallengeConfig().getConfigurationSection("challenges.challengeList").getKeys(false); // This code below handles the edge case where the levels is set to '' if (getChallengeConfig().getString("challenges.levels","").isEmpty()) { Settings.challengeLevels = new ArrayList<String>(); } else { Settings.challengeLevels = Arrays.asList(getChallengeConfig().getString("challenges.levels","").split(" ")); } Settings.freeLevels = Arrays.asList(getChallengeConfig().getString("challenges.freelevels","").split(" ")); Settings.waiverAmount = getChallengeConfig().getInt("challenges.waiveramount", 1); if (Settings.waiverAmount < 0) { Settings.waiverAmount = 0; } populateChallengeList(); }
void function() { if (challengeConfigFile == null) { challengeConfigFile = new File(plugin.getDataFolder(), STR); } challengeFile = YamlConfiguration.loadConfiguration(challengeConfigFile); Settings.challengeList = getChallengeConfig().getConfigurationSection(STR).getKeys(false); if (getChallengeConfig().getString(STR,"").isEmpty()) { Settings.challengeLevels = new ArrayList<String>(); } else { Settings.challengeLevels = Arrays.asList(getChallengeConfig().getString(STR,"STR STRchallenges.freelevels","STR STRchallenges.waiveramount", 1); if (Settings.waiverAmount < 0) { Settings.waiverAmount = 0; } populateChallengeList(); }
/** * Reloads the challenge config file */
Reloads the challenge config file
reloadChallengeConfig
{ "repo_name": "tastybento/askyblock", "path": "src/com/wasteofplastic/askyblock/commands/Challenges.java", "license": "gpl-2.0", "size": 125600 }
[ "com.wasteofplastic.askyblock.Settings", "java.io.File", "java.util.ArrayList", "java.util.Arrays", "org.bukkit.configuration.file.YamlConfiguration" ]
import com.wasteofplastic.askyblock.Settings; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import org.bukkit.configuration.file.YamlConfiguration;
import com.wasteofplastic.askyblock.*; import java.io.*; import java.util.*; import org.bukkit.configuration.file.*;
[ "com.wasteofplastic.askyblock", "java.io", "java.util", "org.bukkit.configuration" ]
com.wasteofplastic.askyblock; java.io; java.util; org.bukkit.configuration;
1,955,896
public static MozuUrl getChildCategoriesUrl(Integer categoryId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/children?responseFields={responseFields}"); formatter.formatUrl("categoryId", categoryId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
static MozuUrl function(Integer categoryId, String responseFields) { UrlFormatter formatter = new UrlFormatter(STR); formatter.formatUrl(STR, categoryId); formatter.formatUrl(STR, responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
/** * Get Resource Url for GetChildCategories * @param categoryId Unique identifier of the category for which to retrieve subcategories. * @param responseFields Use this field to include those fields which are not included by default. * @return String Resource Url */
Get Resource Url for GetChildCategories
getChildCategoriesUrl
{ "repo_name": "eileenzhuang1/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CategoryUrl.java", "license": "mit", "size": 5731 }
[ "com.mozu.api.MozuUrl", "com.mozu.api.utils.UrlFormatter" ]
import com.mozu.api.MozuUrl; import com.mozu.api.utils.UrlFormatter;
import com.mozu.api.*; import com.mozu.api.utils.*;
[ "com.mozu.api" ]
com.mozu.api;
1,660,851
public DeleteByQueryRequestBuilder setSource(Map<String, Object> source) { request().source(source); return this; }
DeleteByQueryRequestBuilder function(Map<String, Object> source) { request().source(source); return this; }
/** * The source to execute in the form of a map. */
The source to execute in the form of a map
setSource
{ "repo_name": "anti-social/elasticsearch", "path": "src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequestBuilder.java", "license": "apache-2.0", "size": 4529 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
842,332
private static String[] getUnixBasedPortNames(String searchPath, Pattern pattern, Comparator<String> comparator) { searchPath = (searchPath.equals("") ? searchPath : (searchPath.endsWith("/") ? searchPath : searchPath + "/")); String[] returnArray = new String[]{}; File dir = new File(searchPath); if(dir.exists() && dir.isDirectory()){ File[] files = dir.listFiles(); if(files.length > 0){ TreeSet<String> portsTree = new TreeSet<String>(comparator); for(File file : files){ String fileName = file.getName(); if(!file.isDirectory() && !file.isFile() && pattern.matcher(fileName).find()){ String portName = searchPath + fileName; long portHandle = serialInterface.openPort(portName, false);//Open port without TIOCEXCL if(portHandle < 0 && portHandle != SerialNativeInterface.ERR_PORT_BUSY){ continue; } else if(portHandle != SerialNativeInterface.ERR_PORT_BUSY) { serialInterface.closePort(portHandle); } portsTree.add(portName); } } returnArray = portsTree.toArray(returnArray); } } return returnArray; }
static String[] function(String searchPath, Pattern pattern, Comparator<String> comparator) { searchPath = (searchPath.equals(STR/STR/")); String[] returnArray = new String[]{}; File dir = new File(searchPath); if(dir.exists() && dir.isDirectory()){ File[] files = dir.listFiles(); if(files.length > 0){ TreeSet<String> portsTree = new TreeSet<String>(comparator); for(File file : files){ String fileName = file.getName(); if(!file.isDirectory() && !file.isFile() && pattern.matcher(fileName).find()){ String portName = searchPath + fileName; long portHandle = serialInterface.openPort(portName, false); if(portHandle < 0 && portHandle != SerialNativeInterface.ERR_PORT_BUSY){ continue; } else if(portHandle != SerialNativeInterface.ERR_PORT_BUSY) { serialInterface.closePort(portHandle); } portsTree.add(portName); } } returnArray = portsTree.toArray(returnArray); } } return returnArray; }
/** * Universal method for getting port names of _nix based systems */
Universal method for getting port names of _nix based systems
getUnixBasedPortNames
{ "repo_name": "myrridin/qz-print", "path": "jssc_2.8.0_qz/src/jssc/SerialPortList.java", "license": "lgpl-2.1", "size": 13220 }
[ "java.io.File", "java.util.Comparator", "java.util.TreeSet", "java.util.regex.Pattern" ]
import java.io.File; import java.util.Comparator; import java.util.TreeSet; import java.util.regex.Pattern;
import java.io.*; import java.util.*; import java.util.regex.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,581,127
public Color getMapColor() { int color_value = blockMC.getMaterial().getMaterialMapColor().colorValue; return new Color(color_value & 0xFF0000, color_value & 0x00FF00, color_value & 0x0000FF); }
Color function() { int color_value = blockMC.getMaterial().getMaterialMapColor().colorValue; return new Color(color_value & 0xFF0000, color_value & 0x00FF00, color_value & 0x0000FF); }
/** This method returns the color that appears on a map to represent this {@link BlockType}. * * @return a standard Java {@link Color} object representing the color that this {@link BlockType} is represented by on a map. */
This method returns the color that appears on a map to represent this <code>BlockType</code>
getMapColor
{ "repo_name": "asusoda/Corundum", "path": "Corundum/org/corundummc/blocks/Block.java", "license": "mit", "size": 33885 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,243,771
HashCode getSecondaryInputHash();
HashCode getSecondaryInputHash();
/** * The hash of the secondary inputs of the transformer. * * This includes the parameters and the implementation. */
The hash of the secondary inputs of the transformer. This includes the parameters and the implementation
getSecondaryInputHash
{ "repo_name": "gradle/gradle", "path": "subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/transform/Transformer.java", "license": "apache-2.0", "size": 2883 }
[ "org.gradle.internal.hash.HashCode" ]
import org.gradle.internal.hash.HashCode;
import org.gradle.internal.hash.*;
[ "org.gradle.internal" ]
org.gradle.internal;
806,084
protected void wrapJobWithGridStartLauncher(Job job) { String launcher = job.vdsNS.getStringValue(Pegasus.GRIDSTART_LAUNCHER_KEY); String launcherArguments = job.vdsNS.getStringValue(Pegasus.GRIDSTART_LAUNCHER_ARGUMENTS_KEY); if (launcher == null) { return; } String existingExecutable = job.getRemoteExecutable(); String existingArguments = job.getArguments(); StringBuilder updatedArgs = new StringBuilder(); if (launcherArguments != null) { updatedArgs.append(launcherArguments).append(" "); } updatedArgs.append(existingExecutable); if (existingArguments != null) { updatedArgs.append(" "); updatedArgs.append(existingArguments); } // launcher is the new executable for the job job.setRemoteExecutable(launcher); job.setArguments(updatedArgs.toString()); mLogger.log( "Wrapped job " + job.getID() + " with launcher " + job.getRemoteExecutable() + " " + job.getArguments(), LogManager.DEBUG_MESSAGE_LEVEL); return; }
void function(Job job) { String launcher = job.vdsNS.getStringValue(Pegasus.GRIDSTART_LAUNCHER_KEY); String launcherArguments = job.vdsNS.getStringValue(Pegasus.GRIDSTART_LAUNCHER_ARGUMENTS_KEY); if (launcher == null) { return; } String existingExecutable = job.getRemoteExecutable(); String existingArguments = job.getArguments(); StringBuilder updatedArgs = new StringBuilder(); if (launcherArguments != null) { updatedArgs.append(launcherArguments).append(" "); } updatedArgs.append(existingExecutable); if (existingArguments != null) { updatedArgs.append(" "); updatedArgs.append(existingArguments); } job.setRemoteExecutable(launcher); job.setArguments(updatedArgs.toString()); mLogger.log( STR + job.getID() + STR + job.getRemoteExecutable() + " " + job.getArguments(), LogManager.DEBUG_MESSAGE_LEVEL); return; }
/** * <<<<<<< HEAD Wrap invocation with a user specified GridStart launcher ======= <<<<<<< HEAD * Indicates whether the enabling mechanism can set the X bit on the executable on the remote * grid site, in addition to launching it on the remote grid stie ======= Wrap invocation with a * user specified GridStart launcher >>>>>>> 4.9 * * @param job */
>>>>>> 4.9
wrapJobWithGridStartLauncher
{ "repo_name": "pegasus-isi/pegasus", "path": "src/edu/isi/pegasus/planner/code/gridstart/NoGridStart.java", "license": "apache-2.0", "size": 27559 }
[ "edu.isi.pegasus.common.logging.LogManager", "edu.isi.pegasus.planner.classes.Job", "edu.isi.pegasus.planner.namespace.Pegasus" ]
import edu.isi.pegasus.common.logging.LogManager; import edu.isi.pegasus.planner.classes.Job; import edu.isi.pegasus.planner.namespace.Pegasus;
import edu.isi.pegasus.common.logging.*; import edu.isi.pegasus.planner.classes.*; import edu.isi.pegasus.planner.namespace.*;
[ "edu.isi.pegasus" ]
edu.isi.pegasus;
1,999,347
@SuppressWarnings("unchecked") private boolean materializeUnresolvedEvent(List<Element> eDataEvents, Date nominalTime, Date actualTime, Configuration conf) throws Exception { for (Element dEvent : eDataEvents) { if (dEvent.getChild("unresolved-instances", dEvent.getNamespace()) == null) { continue; } ELEvaluator eval = CoordELEvaluator.createLazyEvaluator(actualTime, nominalTime, dEvent, conf); String uresolvedInstance = dEvent.getChild("unresolved-instances", dEvent.getNamespace()).getTextTrim(); String unresolvedList[] = uresolvedInstance.split(CoordELFunctions.INSTANCE_SEPARATOR); StringBuffer resolvedTmp = new StringBuffer(); for (int i = 0; i < unresolvedList.length; i++) { String ret = CoordELFunctions.evalAndWrap(eval, unresolvedList[i]); Boolean isResolved = (Boolean) eval.getVariable("is_resolved"); if (isResolved == false) { LOG.info("[" + actionId + "]::Cannot resolve: " + ret); return false; } if (resolvedTmp.length() > 0) { resolvedTmp.append(CoordELFunctions.INSTANCE_SEPARATOR); } resolvedTmp.append((String) eval.getVariable("resolved_path")); } if (resolvedTmp.length() > 0) { if (dEvent.getChild("uris", dEvent.getNamespace()) != null) { resolvedTmp.append(CoordELFunctions.INSTANCE_SEPARATOR).append( dEvent.getChild("uris", dEvent.getNamespace()).getTextTrim()); dEvent.removeChild("uris", dEvent.getNamespace()); } Element uriInstance = new Element("uris", dEvent.getNamespace()); uriInstance.addContent(resolvedTmp.toString()); dEvent.getContent().add(1, uriInstance); } dEvent.removeChild("unresolved-instances", dEvent.getNamespace()); } return true; }
@SuppressWarnings(STR) boolean function(List<Element> eDataEvents, Date nominalTime, Date actualTime, Configuration conf) throws Exception { for (Element dEvent : eDataEvents) { if (dEvent.getChild(STR, dEvent.getNamespace()) == null) { continue; } ELEvaluator eval = CoordELEvaluator.createLazyEvaluator(actualTime, nominalTime, dEvent, conf); String uresolvedInstance = dEvent.getChild(STR, dEvent.getNamespace()).getTextTrim(); String unresolvedList[] = uresolvedInstance.split(CoordELFunctions.INSTANCE_SEPARATOR); StringBuffer resolvedTmp = new StringBuffer(); for (int i = 0; i < unresolvedList.length; i++) { String ret = CoordELFunctions.evalAndWrap(eval, unresolvedList[i]); Boolean isResolved = (Boolean) eval.getVariable(STR); if (isResolved == false) { LOG.info("[" + actionId + STR + ret); return false; } if (resolvedTmp.length() > 0) { resolvedTmp.append(CoordELFunctions.INSTANCE_SEPARATOR); } resolvedTmp.append((String) eval.getVariable(STR)); } if (resolvedTmp.length() > 0) { if (dEvent.getChild("uris", dEvent.getNamespace()) != null) { resolvedTmp.append(CoordELFunctions.INSTANCE_SEPARATOR).append( dEvent.getChild("uris", dEvent.getNamespace()).getTextTrim()); dEvent.removeChild("uris", dEvent.getNamespace()); } Element uriInstance = new Element("uris", dEvent.getNamespace()); uriInstance.addContent(resolvedTmp.toString()); dEvent.getContent().add(1, uriInstance); } dEvent.removeChild(STR, dEvent.getNamespace()); } return true; }
/** * Resolve the list of data input paths * * @param eDataEvents the list of data input elements * @param nominalTime action nominal time * @param actualTime current time * @param conf action configuration * @return true if all unresolved URIs can be resolved * @throws Exception thrown if failed to resolve data input paths */
Resolve the list of data input paths
materializeUnresolvedEvent
{ "repo_name": "sunmeng007/oozie", "path": "core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java", "license": "apache-2.0", "size": 21982 }
[ "java.util.Date", "java.util.List", "org.apache.hadoop.conf.Configuration", "org.apache.oozie.coord.CoordELEvaluator", "org.apache.oozie.coord.CoordELFunctions", "org.apache.oozie.util.ELEvaluator", "org.jdom.Element" ]
import java.util.Date; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.oozie.coord.CoordELEvaluator; import org.apache.oozie.coord.CoordELFunctions; import org.apache.oozie.util.ELEvaluator; import org.jdom.Element;
import java.util.*; import org.apache.hadoop.conf.*; import org.apache.oozie.coord.*; import org.apache.oozie.util.*; import org.jdom.*;
[ "java.util", "org.apache.hadoop", "org.apache.oozie", "org.jdom" ]
java.util; org.apache.hadoop; org.apache.oozie; org.jdom;
939,316
@Override public OperationResponse handleGet(HttpServletRequest request) throws Exception { // initialize LOGGER.finer("Handling CSW request URL..."); OperationContext context = this.getOperationContext(); IProviderFactory factory = context.getProviderFactory(); ServiceProperties svcProps = context.getServiceProperties(); ParseHelper pHelper = new ParseHelper(); ValidationHelper vHelper = new ValidationHelper(); String locator; String[] parsed; ISupportedValues supported; // determine the operation name and provider String opName = null; IOperationProvider opProvider = null; locator = "request"; parsed = pHelper.getParameterValues(request,locator); supported = svcProps.getSupportedValues(CswConstants.Parameter_OperationName); opName = vHelper.validateValue(supported,locator,parsed,true); context.setOperationName(opName); if (opName != null) { opProvider = factory.makeOperationProvider(context,opName); } // ensure a valid operation provider if (opProvider == null) { if ((opName == null) || (opName.length() == 0)) { throw new OwsException(OwsException.OWSCODE_MissingParameterValue, "request","The request parameter was missing."); } else { throw new OwsException(OwsException.OWSCODE_OperationNotSupported, "request","Unsupported operation: "+opName); } } // parse the service and version this.parseServiceAndVersion(context,request); // parse and execute the operation opProvider.handleGet(context,request); return context.getOperationResponse(); }
OperationResponse function(HttpServletRequest request) throws Exception { LOGGER.finer(STR); OperationContext context = this.getOperationContext(); IProviderFactory factory = context.getProviderFactory(); ServiceProperties svcProps = context.getServiceProperties(); ParseHelper pHelper = new ParseHelper(); ValidationHelper vHelper = new ValidationHelper(); String locator; String[] parsed; ISupportedValues supported; String opName = null; IOperationProvider opProvider = null; locator = STR; parsed = pHelper.getParameterValues(request,locator); supported = svcProps.getSupportedValues(CswConstants.Parameter_OperationName); opName = vHelper.validateValue(supported,locator,parsed,true); context.setOperationName(opName); if (opName != null) { opProvider = factory.makeOperationProvider(context,opName); } if (opProvider == null) { if ((opName == null) (opName.length() == 0)) { throw new OwsException(OwsException.OWSCODE_MissingParameterValue, STR,STR); } else { throw new OwsException(OwsException.OWSCODE_OperationNotSupported, STR,STR+opName); } } this.parseServiceAndVersion(context,request); opProvider.handleGet(context,request); return context.getOperationResponse(); }
/** * Handles a URL based request (HTTP GET). * @param request the HTTP request * @throws Exception if a processing exception occurs */
Handles a URL based request (HTTP GET)
handleGet
{ "repo_name": "Esri/geoportal-server", "path": "geoportal/src/com/esri/gpt/server/csw/provider/local/RequestHandler.java", "license": "apache-2.0", "size": 18930 }
[ "com.esri.gpt.server.csw.components.CswConstants", "com.esri.gpt.server.csw.components.IOperationProvider", "com.esri.gpt.server.csw.components.IProviderFactory", "com.esri.gpt.server.csw.components.ISupportedValues", "com.esri.gpt.server.csw.components.OperationContext", "com.esri.gpt.server.csw.componen...
import com.esri.gpt.server.csw.components.CswConstants; import com.esri.gpt.server.csw.components.IOperationProvider; import com.esri.gpt.server.csw.components.IProviderFactory; import com.esri.gpt.server.csw.components.ISupportedValues; import com.esri.gpt.server.csw.components.OperationContext; import com.esri.gpt.server.csw.components.OperationResponse; import com.esri.gpt.server.csw.components.OwsException; import com.esri.gpt.server.csw.components.ParseHelper; import com.esri.gpt.server.csw.components.ServiceProperties; import com.esri.gpt.server.csw.components.ValidationHelper; import javax.servlet.http.HttpServletRequest;
import com.esri.gpt.server.csw.components.*; import javax.servlet.http.*;
[ "com.esri.gpt", "javax.servlet" ]
com.esri.gpt; javax.servlet;
940,748
void handlePreferences(GenericPreferencesEvent event);
void handlePreferences(GenericPreferencesEvent event);
/** * Called in response to receiving a Preferences event * * @param event The generic Preferences event */
Called in response to receiving a Preferences event
handlePreferences
{ "repo_name": "oscarguindzberg/multibit-hd", "path": "mbhd-swing/src/main/java/org/multibit/hd/ui/platform/handler/GenericPreferencesHandler.java", "license": "mit", "size": 1176 }
[ "org.multibit.hd.ui.platform.listener.GenericPreferencesEvent" ]
import org.multibit.hd.ui.platform.listener.GenericPreferencesEvent;
import org.multibit.hd.ui.platform.listener.*;
[ "org.multibit.hd" ]
org.multibit.hd;
1,676,632
@Override public void deserializeVector(Object rowBlob, int rowsInBlob, VectorizedRowBatch reuseBatch) throws SerDeException { BytesRefArrayWritable[] refArray = (BytesRefArrayWritable[]) rowBlob; DataOutputBuffer buffer = new DataOutputBuffer(); for (int i = 0; i < rowsInBlob; i++) { Object row = deserialize(refArray[i]); try { VectorizedBatchUtil.addRowToBatch(row, (StructObjectInspector) cachedObjectInspector, i, reuseBatch, buffer); } catch (HiveException e) { throw new SerDeException(e); } } }
void function(Object rowBlob, int rowsInBlob, VectorizedRowBatch reuseBatch) throws SerDeException { BytesRefArrayWritable[] refArray = (BytesRefArrayWritable[]) rowBlob; DataOutputBuffer buffer = new DataOutputBuffer(); for (int i = 0; i < rowsInBlob; i++) { Object row = deserialize(refArray[i]); try { VectorizedBatchUtil.addRowToBatch(row, (StructObjectInspector) cachedObjectInspector, i, reuseBatch, buffer); } catch (HiveException e) { throw new SerDeException(e); } } }
/** * Deserializes the rowBlob into Vectorized row batch * @param rowBlob * rowBlob row batch to deserialize * @param rowsInBlob * Total number of rows in rowBlob to deserialize * @param reuseBatch * VectorizedRowBatch to which the rows should be serialized * * @throws SerDeException */
Deserializes the rowBlob into Vectorized row batch
deserializeVector
{ "repo_name": "WANdisco/amplab-hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedColumnarSerDe.java", "license": "apache-2.0", "size": 10845 }
[ "org.apache.hadoop.hive.ql.metadata.HiveException", "org.apache.hadoop.hive.serde2.SerDeException", "org.apache.hadoop.hive.serde2.columnar.BytesRefArrayWritable", "org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector", "org.apache.hadoop.io.DataOutputBuffer" ]
import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.serde2.SerDeException; import org.apache.hadoop.hive.serde2.columnar.BytesRefArrayWritable; import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.hive.ql.metadata.*; import org.apache.hadoop.hive.serde2.*; import org.apache.hadoop.hive.serde2.columnar.*; import org.apache.hadoop.hive.serde2.objectinspector.*; import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,485,095
if ((value instanceof List) && (value == null)) { throw new IllegalArgumentException("Null and List type Objects cannot be added to MOVMap"); } Object oldValue = null; List valueList = null; if ((oldValue = get(key)) != null) { if (oldValue instanceof List) { log("Value is already a list"); ((List) oldValue).add(value); super.put(key, oldValue); } else { log("Adding value which is not a list, so creating list"); valueList = new ArrayList(); valueList.add(oldValue); valueList.add(value); super.put(key, valueList); } } else { log("Adding value for the first time, so its NOT list"); super.put(key, value); } return value; }
if ((value instanceof List) && (value == null)) { throw new IllegalArgumentException(STR); } Object oldValue = null; List valueList = null; if ((oldValue = get(key)) != null) { if (oldValue instanceof List) { log(STR); ((List) oldValue).add(value); super.put(key, oldValue); } else { log(STR); valueList = new ArrayList(); valueList.add(oldValue); valueList.add(value); super.put(key, valueList); } } else { log(STR); super.put(key, value); } return value; }
/** * Puts the Object into the Map with a given Key. * * @param key the key for the given Object * @param value the Object value for a given key * * @throws IllegalArgumentException If Null or List type Objects are passed */
Puts the Object into the Map with a given Key
put
{ "repo_name": "tarun3kumar/seleniumtestsframework", "path": "src/main/java/com/seleniumtests/xmldog/MOVMap.java", "license": "apache-2.0", "size": 4102 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
521,800
@Override public void close() { if (Thread.currentThread() instanceof NonBlocking) { // Avoid blocking operation if we're in an event loop, because otherwise we might see a dead lock // while waiting for the channels to be closed. closeable.closeAsync(); } else { closeable.close(); } } static final class PoolKey { final String host; final String ipAddr; final int port; final int hashCode; final ProxyConfig proxyConfig; PoolKey(String host, String ipAddr, int port, ProxyConfig proxyConfig) { this.host = host; this.ipAddr = ipAddr; this.port = port; this.proxyConfig = proxyConfig; hashCode = ((host.hashCode() * 31 + ipAddr.hashCode()) * 31 + port) * 31 + proxyConfig.hashCode(); }
void function() { if (Thread.currentThread() instanceof NonBlocking) { closeable.closeAsync(); } else { closeable.close(); } } static final class PoolKey { final String host; final String ipAddr; final int port; final int hashCode; final ProxyConfig proxyConfig; PoolKey(String host, String ipAddr, int port, ProxyConfig proxyConfig) { this.host = host; this.ipAddr = ipAddr; this.port = port; this.proxyConfig = proxyConfig; hashCode = ((host.hashCode() * 31 + ipAddr.hashCode()) * 31 + port) * 31 + proxyConfig.hashCode(); }
/** * Closes all {@link Channel}s managed by this pool. */
Closes all <code>Channel</code>s managed by this pool
close
{ "repo_name": "line/armeria", "path": "core/src/main/java/com/linecorp/armeria/client/HttpChannelPool.java", "license": "apache-2.0", "size": 36443 }
[ "com.linecorp.armeria.client.proxy.ProxyConfig" ]
import com.linecorp.armeria.client.proxy.ProxyConfig;
import com.linecorp.armeria.client.proxy.*;
[ "com.linecorp.armeria" ]
com.linecorp.armeria;
790,741
@FIXVersion(introduced="5.0SP1") @TagNumRef(tagNum=TagNum.SideSettlCurrency) public void setSideSettlCurrency(Currency sideSettlCurrency) { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
@FIXVersion(introduced=STR) @TagNumRef(tagNum=TagNum.SideSettlCurrency) void function(Currency sideSettlCurrency) { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
/** * Message field setter. * @param sideSettlCurrency field value */
Message field setter
setSideSettlCurrency
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/group/TrdCapRptAckSideGroup.java", "license": "gpl-3.0", "size": 98727 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.Currency", "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.Currency; 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,254,585
public static final class ReportRootGetMailboxUsageDetailParameterSetBuilder { @Nullable protected String period; @Nonnull public ReportRootGetMailboxUsageDetailParameterSetBuilder withPeriod(@Nullable final String val) { this.period = val; return this; } @Nullable protected ReportRootGetMailboxUsageDetailParameterSetBuilder(){}
static final class ReportRootGetMailboxUsageDetailParameterSetBuilder { protected String period; public ReportRootGetMailboxUsageDetailParameterSetBuilder function(@Nullable final String val) { this.period = val; return this; } protected ReportRootGetMailboxUsageDetailParameterSetBuilder(){}
/** * Sets the Period * @param val the value to set it to * @return the current builder object */
Sets the Period
withPeriod
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/models/ReportRootGetMailboxUsageDetailParameterSet.java", "license": "mit", "size": 3439 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,659,537
public void captureScreen() { File capturedImage = getNewImageFile(); TestToolImages.saveImage(screen.capture().getImage(), capturedImage); testCase.attachFile(capturedImage, Attachment.Type.IMAGE); }
void function() { File capturedImage = getNewImageFile(); TestToolImages.saveImage(screen.capture().getImage(), capturedImage); testCase.attachFile(capturedImage, Attachment.Type.IMAGE); }
/** * Saves a screenshot and attaches the file to the test result. */
Saves a screenshot and attaches the file to the test result
captureScreen
{ "repo_name": "mbordas/qualify", "path": "src/main/java/qualify/tools/TestToolSikuli.java", "license": "bsd-3-clause", "size": 38343 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
60,844
public synchronized void setSnapshotHandlerForTesting( final TableName tableName, final SnapshotSentinel handler) { if (handler != null) { this.snapshotHandlers.put(tableName, handler); } else { this.snapshotHandlers.remove(tableName); } }
synchronized void function( final TableName tableName, final SnapshotSentinel handler) { if (handler != null) { this.snapshotHandlers.put(tableName, handler); } else { this.snapshotHandlers.remove(tableName); } }
/** * Set the handler for the current snapshot * <p> * Exposed for TESTING * @param tableName * @param handler handler the master should use * * TODO get rid of this if possible, repackaging, modify tests. */
Set the handler for the current snapshot Exposed for TESTING
setSnapshotHandlerForTesting
{ "repo_name": "throughsky/lywebank", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java", "license": "apache-2.0", "size": 44056 }
[ "org.apache.hadoop.hbase.TableName", "org.apache.hadoop.hbase.master.SnapshotSentinel" ]
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.master.SnapshotSentinel;
import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.master.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,415,572
public void setTableTypes(String tableTypes) { ArrayList types = new ArrayList(); if (tableTypes != null) { StringTokenizer tokenizer = new StringTokenizer(tableTypes, ","); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken().trim(); if (token.length() > 0) { types.add(token); } } } _tableTypes = (String[])types.toArray(new String[types.size()]); }
void function(String tableTypes) { ArrayList types = new ArrayList(); if (tableTypes != null) { StringTokenizer tokenizer = new StringTokenizer(tableTypes, ","); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken().trim(); if (token.length() > 0) { types.add(token); } } } _tableTypes = (String[])types.toArray(new String[types.size()]); }
/** * Specifies the table types to be processed. For details and typical table types see * <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String[])">java.sql.DatabaseMetaData#getTables</a>. * * @param tableTypes The table types to read * @ant.not-required By default, all types of tables are read. */
Specifies the table types to be processed. For details and typical table types see java.sql.DatabaseMetaData#getTables
setTableTypes
{ "repo_name": "etiago/apache-ddlutils", "path": "src/java/org/apache/ddlutils/task/DumpMetadataTask.java", "license": "apache-2.0", "size": 51605 }
[ "java.util.ArrayList", "java.util.StringTokenizer" ]
import java.util.ArrayList; import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
1,661,821
private boolean showLicenses(List<ComponentDescription> toInstall) { Map<URL, SortedSet<ComponentDescription>> licenseGroups = new HashMap<>(); // Group components by their license: for (ComponentDescription cd : toInstall) { URL licenseURL = cd.getLicenseURL(); // may be null // null is an acceptable key for HashMaps, so it's OK. SortedSet<ComponentDescription> compsUnderLicense = licenseGroups.get(licenseURL); if (compsUnderLicense == null) { compsUnderLicense = new TreeSet<>(); licenseGroups.put(licenseURL, compsUnderLicense); } assert compsUnderLicense != null; compsUnderLicense.add(cd); } // Now show license for each group for (URL licenseURL : licenseGroups.keySet()) { if (licenseURL == null) { continue; }
boolean function(List<ComponentDescription> toInstall) { Map<URL, SortedSet<ComponentDescription>> licenseGroups = new HashMap<>(); for (ComponentDescription cd : toInstall) { URL licenseURL = cd.getLicenseURL(); SortedSet<ComponentDescription> compsUnderLicense = licenseGroups.get(licenseURL); if (compsUnderLicense == null) { compsUnderLicense = new TreeSet<>(); licenseGroups.put(licenseURL, compsUnderLicense); } assert compsUnderLicense != null; compsUnderLicense.add(cd); } for (URL licenseURL : licenseGroups.keySet()) { if (licenseURL == null) { continue; }
/** * Show the licenses for the components in toInstall * * @param toInstall * the components to install * @return true if all licenses were accepted, false otherwise */
Show the licenses for the components in toInstall
showLicenses
{ "repo_name": "TypeTalk/TypeTalk", "path": "src/main/java/org/typetalk/ui/InstallerGUI.java", "license": "gpl-3.0", "size": 38633 }
[ "java.util.HashMap", "java.util.List", "java.util.Map", "java.util.SortedSet", "java.util.TreeSet" ]
import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.SortedSet; import java.util.TreeSet;
import java.util.*;
[ "java.util" ]
java.util;
1,696,212
boolean shouldPeriodicallyFlush() { final Engine engine = getEngineOrNull(); if (engine != null) { try { return engine.shouldPeriodicallyFlush(); } catch (final AlreadyClosedException e) { // we are already closed, no need to flush or roll } } return false; }
boolean shouldPeriodicallyFlush() { final Engine engine = getEngineOrNull(); if (engine != null) { try { return engine.shouldPeriodicallyFlush(); } catch (final AlreadyClosedException e) { } } return false; }
/** * Tests whether or not the engine should be flushed periodically. * This test is based on the current size of the translog compared to the configured flush threshold size. * * @return {@code true} if the engine should be flushed */
Tests whether or not the engine should be flushed periodically. This test is based on the current size of the translog compared to the configured flush threshold size
shouldPeriodicallyFlush
{ "repo_name": "HonzaKral/elasticsearch", "path": "server/src/main/java/org/elasticsearch/index/shard/IndexShard.java", "license": "apache-2.0", "size": 171709 }
[ "org.apache.lucene.store.AlreadyClosedException", "org.elasticsearch.index.engine.Engine" ]
import org.apache.lucene.store.AlreadyClosedException; import org.elasticsearch.index.engine.Engine;
import org.apache.lucene.store.*; import org.elasticsearch.index.engine.*;
[ "org.apache.lucene", "org.elasticsearch.index" ]
org.apache.lucene; org.elasticsearch.index;
982,337
public static String join(Iterator iterator, char separator) { // handle null, zero and one elements before building a buffer if (iterator == null) { return null; } if (!iterator.hasNext()) { return EMPTY; } Object first = iterator.next(); if (!iterator.hasNext()) { return ObjectUtils.toString(first); } // two or more elements StringBuffer buf = new StringBuffer(256); // Java default is 16, // probably too small if (first != null) { buf.append(first); } while (iterator.hasNext()) { buf.append(separator); Object obj = iterator.next(); if (obj != null) { buf.append(obj); } } return buf.toString(); }
static String function(Iterator iterator, char separator) { if (iterator == null) { return null; } if (!iterator.hasNext()) { return EMPTY; } Object first = iterator.next(); if (!iterator.hasNext()) { return ObjectUtils.toString(first); } StringBuffer buf = new StringBuffer(256); if (first != null) { buf.append(first); } while (iterator.hasNext()) { buf.append(separator); Object obj = iterator.next(); if (obj != null) { buf.append(obj); } } return buf.toString(); }
/** * <p> * Joins the elements of the provided <code>Iterator</code> into a single * String containing the provided elements. * </p> * * <p> * No delimiter is added before or after the list. Null objects or empty * strings within the iteration are represented by empty strings. * </p> * * <p> * See the examples here: {@link #join(Object[],char)}. * </p> * * @param iterator * the <code>Iterator</code> of values to join together, may be * null * @param separator * the separator character to use * @return the joined String, <code>null</code> if null iterator input * @since 2.0 */
Joins the elements of the provided <code>Iterator</code> into a single String containing the provided elements. No delimiter is added before or after the list. Null objects or empty strings within the iteration are represented by empty strings. See the examples here: <code>#join(Object[],char)</code>.
join
{ "repo_name": "mjoyner-vbservices-net/CherokeeDictionary", "path": "src/main/java/commons/lang3/StringUtils.java", "license": "lgpl-2.1", "size": 238495 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
571,575
static native void redefineClasses(Instrumentation inst, ClassDefinition[] definitions);
static native void redefineClasses(Instrumentation inst, ClassDefinition[] definitions);
/** * Redefines classes given as parameters. The method has to call * the callTransformers from InstrumentationImpl * * @param inst an instrumentation object * @param definitions an array of bytecode<->class correspondance * * @throws ClassNotFoundException if a class cannot be found * @throws UnmodifiableClassException if a class cannot be modified * @throws UnsupportedOperationException if the JVM does not support * redefinition or the redefinition made unsupported changes * @throws ClassFormatError if a class file is not valid * @throws NoClassDefFoundError if a class name is not equal to the name * in the class file specified * @throws UnsupportedClassVersionError if the class file version numbers * are unsupported * @throws ClassCircularityError if circularity occured with the new * classes * @throws LinkageError if a linkage error occurs */
Redefines classes given as parameters. The method has to call the callTransformers from InstrumentationImpl
redefineClasses
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/vm/reference/gnu/java/lang/VMInstrumentationImpl.java", "license": "bsd-3-clause", "size": 4009 }
[ "java.lang.instrument.ClassDefinition", "java.lang.instrument.Instrumentation" ]
import java.lang.instrument.ClassDefinition; import java.lang.instrument.Instrumentation;
import java.lang.instrument.*;
[ "java.lang" ]
java.lang;
316,797
public int doEndTag() throws JspException { PutListTagParent enclosingParent = findEnclosingParent(); enclosingParent.processNestedTag(this); // Clear list to avoid reuse releaseInternal(); return EVAL_PAGE; }
int function() throws JspException { PutListTagParent enclosingParent = findEnclosingParent(); enclosingParent.processNestedTag(this); releaseInternal(); return EVAL_PAGE; }
/** * Do end tag. */
Do end tag
doEndTag
{ "repo_name": "shuliangtao/struts-1.3.10", "path": "src/tiles/src/main/java/org/apache/struts/tiles/taglib/PutListTag.java", "license": "apache-2.0", "size": 5863 }
[ "javax.servlet.jsp.JspException" ]
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.*;
[ "javax.servlet" ]
javax.servlet;
934,833
public void testFieldsCannotBeSetToNull() { SimpleQueryStringBuilder qb = createTestQueryBuilder(); try { qb.fields(null); fail("Expected NullPointerException"); } catch (NullPointerException e) { assertThat(e.getMessage(), is("fields cannot be null")); } }
void function() { SimpleQueryStringBuilder qb = createTestQueryBuilder(); try { qb.fields(null); fail(STR); } catch (NullPointerException e) { assertThat(e.getMessage(), is(STR)); } }
/** * The following should fail fast - never silently set the map containing * fields and weights to null but refuse to accept null instead. * */
The following should fail fast - never silently set the map containing fields and weights to null but refuse to accept null instead
testFieldsCannotBeSetToNull
{ "repo_name": "mmaracic/elasticsearch", "path": "core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTests.java", "license": "apache-2.0", "size": 19051 }
[ "org.hamcrest.Matchers" ]
import org.hamcrest.Matchers;
import org.hamcrest.*;
[ "org.hamcrest" ]
org.hamcrest;
2,377,567
private void generateMinion(ExpressionClassBuilder acb, MethodBuilder mb, boolean genChildResultSet) throws StandardException { MethodBuilder userExprFun; ValueNode searchClause = null; ValueNode equijoinClause = null; verifyProperties(getDataDictionary()); // build up the tree. if (searchPredicateList != null) { // Remove any redundant predicates before restoring searchPredicateList.removeRedundantPredicates(); searchClause = searchPredicateList.restorePredicates(); searchPredicateList = null; } // for the single table predicates, we generate an exprFun // that evaluates the expression of the clause // against the current row of the child's result. // if the restriction is empty, simply pass null // to optimize for run time performance. // generate the function and initializer: // Note: Boolean lets us return nulls (boolean would not) // private Boolean exprN() // { // return <<searchClause.generate(ps)>>; // } // static Method exprN = method pointer to exprN; // Map the result columns to the source columns ResultColumnList.ColumnMapping mappingArrays = resultColumns.mapSourceColumns(); int[] mapArray = mappingArrays.mapArray; int mapArrayItem = acb.addItem(new ReferencedColumnsDescriptorImpl(mapArray)); // Save the hash key columns FormatableIntHolder[] fihArray = FormatableIntHolder.getFormatableIntHolders(hashKeyColumns()); FormatableArrayHolder hashKeyHolder = new FormatableArrayHolder(fihArray); int hashKeyItem = acb.addItem(hashKeyHolder); acb.pushGetResultSetFactoryExpression(mb); if (genChildResultSet) childResult.generateResultSet(acb, mb); else childResult.generate((ActivationClassBuilder) acb, mb); assignResultSetNumber(); if (pSubqueryList != null && pSubqueryList.size() > 0) { pSubqueryList.setPointOfAttachment(resultSetNumber); if (SanityManager.DEBUG) { SanityManager.ASSERT(pSubqueryList.size() == 0, "pSubqueryList.size() expected to be 0"); } } if (rSubqueryList != null && rSubqueryList.size() > 0) { rSubqueryList.setPointOfAttachment(resultSetNumber); if (SanityManager.DEBUG) { SanityManager.ASSERT(rSubqueryList.size() == 0, "rSubqueryList.size() expected to be 0"); } } // Get the final cost estimate based on child's cost. costEstimate = childResult.getFinalCostEstimate(); // if there is no searchClause, we just want to pass null. if (searchClause == null) { mb.pushNull(ClassName.GeneratedMethod); } else { // this sets up the method and the static field. // generates: // DataValueDescriptor userExprFun { } userExprFun = acb.newUserExprFun(); // searchClause knows it is returning its value; searchClause.generateExpression(acb, userExprFun); userExprFun.methodReturn(); // we are done modifying userExprFun, complete it. userExprFun.complete(); // searchClause is used in the final result set as an access of the new static // field holding a reference to this new method. // generates: // ActivationClass.userExprFun // which is the static field that "points" to the userExprFun // that evaluates the where clause. acb.pushMethodReference(mb, userExprFun); } joinPredicateList.generateQualifiers(acb, mb, (Optimizable) childResult, false); if (reflectionNeededForProjection()) { // for the resultColumns, we generate a userExprFun // that creates a new row from expressions against // the current row of the child's result. // (Generate optimization: see if we can simply // return the current row -- we could, but don't, optimize // the function call out and have execution understand // that a null function pointer means take the current row // as-is, with the performance trade-off as discussed above.) resultColumns.generateCore(acb, mb, false); } else { mb.pushNull(ClassName.GeneratedMethod); } mb.push(resultSetNumber); mb.push(mapArrayItem); mb.push(resultColumns.reusableResult()); mb.push(hashKeyItem); mb.push(false); mb.push(-1L); mb.push(initialCapacity); mb.push(loadFactor); mb.push(costEstimate.singleScanRowCount()); mb.push(costEstimate.getEstimatedCost()); mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getHashTableResultSet", ClassName.NoPutResultSet, 14); }
void function(ExpressionClassBuilder acb, MethodBuilder mb, boolean genChildResultSet) throws StandardException { MethodBuilder userExprFun; ValueNode searchClause = null; ValueNode equijoinClause = null; verifyProperties(getDataDictionary()); if (searchPredicateList != null) { searchPredicateList.removeRedundantPredicates(); searchClause = searchPredicateList.restorePredicates(); searchPredicateList = null; } ResultColumnList.ColumnMapping mappingArrays = resultColumns.mapSourceColumns(); int[] mapArray = mappingArrays.mapArray; int mapArrayItem = acb.addItem(new ReferencedColumnsDescriptorImpl(mapArray)); FormatableIntHolder[] fihArray = FormatableIntHolder.getFormatableIntHolders(hashKeyColumns()); FormatableArrayHolder hashKeyHolder = new FormatableArrayHolder(fihArray); int hashKeyItem = acb.addItem(hashKeyHolder); acb.pushGetResultSetFactoryExpression(mb); if (genChildResultSet) childResult.generateResultSet(acb, mb); else childResult.generate((ActivationClassBuilder) acb, mb); assignResultSetNumber(); if (pSubqueryList != null && pSubqueryList.size() > 0) { pSubqueryList.setPointOfAttachment(resultSetNumber); if (SanityManager.DEBUG) { SanityManager.ASSERT(pSubqueryList.size() == 0, STR); } } if (rSubqueryList != null && rSubqueryList.size() > 0) { rSubqueryList.setPointOfAttachment(resultSetNumber); if (SanityManager.DEBUG) { SanityManager.ASSERT(rSubqueryList.size() == 0, STR); } } costEstimate = childResult.getFinalCostEstimate(); if (searchClause == null) { mb.pushNull(ClassName.GeneratedMethod); } else { userExprFun = acb.newUserExprFun(); searchClause.generateExpression(acb, userExprFun); userExprFun.methodReturn(); userExprFun.complete(); acb.pushMethodReference(mb, userExprFun); } joinPredicateList.generateQualifiers(acb, mb, (Optimizable) childResult, false); if (reflectionNeededForProjection()) { resultColumns.generateCore(acb, mb, false); } else { mb.pushNull(ClassName.GeneratedMethod); } mb.push(resultSetNumber); mb.push(mapArrayItem); mb.push(resultColumns.reusableResult()); mb.push(hashKeyItem); mb.push(false); mb.push(-1L); mb.push(initialCapacity); mb.push(loadFactor); mb.push(costEstimate.singleScanRowCount()); mb.push(costEstimate.getEstimatedCost()); mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, STR, ClassName.NoPutResultSet, 14); }
/** * Logic shared by generate() and generateResultSet(). * * @param acb The ExpressionClassBuilder for the class being built * @param mb the method the expression will go into * * @exception StandardException Thrown on error */
Logic shared by generate() and generateResultSet()
generateMinion
{ "repo_name": "viaper/DBPlus", "path": "DerbyHodgepodge/java/engine/org/apache/derby/impl/sql/compile/HashTableNode.java", "license": "apache-2.0", "size": 13161 }
[ "org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl", "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.reference.ClassName", "org.apache.derby.iapi.services.classfile.VMOpcode", "org.apache.derby.iapi.services.compiler.MethodBuilder", "org.apache.derby.iapi.services.io.F...
import org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl; import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.ClassName; import org.apache.derby.iapi.services.classfile.VMOpcode; import org.apache.derby.iapi.services.compiler.MethodBuilder; import org.apache.derby.iapi.services.io.FormatableArrayHolder; import org.apache.derby.iapi.services.io.FormatableIntHolder; import org.apache.derby.iapi.services.sanity.SanityManager; import org.apache.derby.iapi.sql.compile.Optimizable;
import org.apache.derby.catalog.types.*; import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.reference.*; import org.apache.derby.iapi.services.classfile.*; import org.apache.derby.iapi.services.compiler.*; import org.apache.derby.iapi.services.io.*; import org.apache.derby.iapi.services.sanity.*; import org.apache.derby.iapi.sql.compile.*;
[ "org.apache.derby" ]
org.apache.derby;
367,418
@Generated @Selector("isUndefined") public native boolean isUndefined();
@Selector(STR) native boolean function();
/** * True if the value represents a missing or undefined value */
True if the value represents a missing or undefined value
isUndefined
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/coreml/MLFeatureValue.java", "license": "apache-2.0", "size": 13298 }
[ "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;
713,465
String getClassOrElementName() throws MappingException;
String getClassOrElementName() throws MappingException;
/** * Returns the returned class name itself or the element type if an array */
Returns the returned class name itself or the element type if an array
getClassOrElementName
{ "repo_name": "ControlSystemStudio/cs-studio", "path": "thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/annotations/src/main/java/org/hibernate/cfg/PropertyData.java", "license": "epl-1.0", "size": 2404 }
[ "org.hibernate.MappingException" ]
import org.hibernate.MappingException;
import org.hibernate.*;
[ "org.hibernate" ]
org.hibernate;
885,438
BigDecimal exchange(Currency from, BigDecimal amount, Currency to);
BigDecimal exchange(Currency from, BigDecimal amount, Currency to);
/** * Converts a {@link java.math.BigDecimal} value from one currency to another. * @param from {@link java.util.Currency} of the value. * @param amount the value to be converted. * @param to the {@link java.util.Currency} the value needs to be converted to. * @return the amount in the target currency. */
Converts a <code>java.math.BigDecimal</code> value from one currency to another
exchange
{ "repo_name": "Chrams/openfleet", "path": "src/main/java/com/markbudai/openfleet/services/ExchangeService.java", "license": "apache-2.0", "size": 997 }
[ "java.math.BigDecimal", "java.util.Currency" ]
import java.math.BigDecimal; import java.util.Currency;
import java.math.*; import java.util.*;
[ "java.math", "java.util" ]
java.math; java.util;
1,899,520
void onReceived(IIntArray data);
void onReceived(IIntArray data);
/** * Callback on a new incoming message received * @param data data */
Callback on a new incoming message received
onReceived
{ "repo_name": "mitrakov/applerush", "path": "core/src/ru/mitrakov/self/rush/net/IHandler.java", "license": "gpl-3.0", "size": 475 }
[ "ru.mitrakov.self.rush.utils.collections.IIntArray" ]
import ru.mitrakov.self.rush.utils.collections.IIntArray;
import ru.mitrakov.self.rush.utils.collections.*;
[ "ru.mitrakov.self" ]
ru.mitrakov.self;
269,298
@Generated @Selector("isReadyForDisplay") public native boolean isReadyForDisplay();
@Selector(STR) native boolean function();
/** * [@property] readyForDisplay * <p> * Boolean indicating that the first video frame has been made ready for display for the current item of the associated AVPlayer. */
[@property] readyForDisplay Boolean indicating that the first video frame has been made ready for display for the current item of the associated AVPlayer
isReadyForDisplay
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/avkit/AVPlayerViewController.java", "license": "apache-2.0", "size": 16042 }
[ "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,583,559
public Date getClosedDate() { return this.closedDate; }
Date function() { return this.closedDate; }
/** * Retrieves the closedDate value * @return The closedDate value. */
Retrieves the closedDate value
getClosedDate
{ "repo_name": "vasttrafik/wso2-community-api", "path": "java/src/main/java/org/vasttrafik/wso2/carbon/community/api/model/TopicDTO.java", "license": "mit", "size": 7991 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,707,501
public @Nullable Executor callbackExecutor() { return callbackExecutor; }
@Nullable Executor function() { return callbackExecutor; }
/** * The executor used for {@link Callback} methods on a {@link Call}. This may be {@code null}, in * which case callbacks should be made synchronously on the background thread. */
The executor used for <code>Callback</code> methods on a <code>Call</code>. This may be null, in which case callbacks should be made synchronously on the background thread
callbackExecutor
{ "repo_name": "ze-pequeno/retrofit", "path": "retrofit/src/main/java/retrofit2/Retrofit.java", "license": "apache-2.0", "size": 25763 }
[ "java.util.concurrent.Executor", "javax.annotation.Nullable" ]
import java.util.concurrent.Executor; import javax.annotation.Nullable;
import java.util.concurrent.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
115,748
protected void produceMessages(final int start, String topic, int numMessages) { KafkaProducer producer = getKafkaProducer(); for (int i = start; i < numMessages + start; i++) { try { LOG.info("producing " + i); producer.send(new ProducerRecord(topic, i % 2, String.valueOf(i), String.valueOf(i).getBytes())).get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } }
void function(final int start, String topic, int numMessages) { KafkaProducer producer = getKafkaProducer(); for (int i = start; i < numMessages + start; i++) { try { LOG.info(STR + i); producer.send(new ProducerRecord(topic, i % 2, String.valueOf(i), String.valueOf(i).getBytes())).get(); } catch (InterruptedException ExecutionException e) { e.printStackTrace(); } } }
/** * Produces the provided number of messages to the topic. */
Produces the provided number of messages to the topic
produceMessages
{ "repo_name": "TiVo/samza", "path": "samza-test/src/test/java/org/apache/samza/processor/TestZkStreamProcessorBase.java", "license": "apache-2.0", "size": 14844 }
[ "java.util.concurrent.ExecutionException", "org.apache.kafka.clients.producer.KafkaProducer", "org.apache.kafka.clients.producer.ProducerRecord" ]
import java.util.concurrent.ExecutionException; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerRecord;
import java.util.concurrent.*; import org.apache.kafka.clients.producer.*;
[ "java.util", "org.apache.kafka" ]
java.util; org.apache.kafka;
144,349
public Table createTable(TableName tableName, byte[][] families, byte[][] splitKeys, int replicaCount, final Configuration c) throws IOException { TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName).setRegionReplication(replicaCount).build(); return createTable(htd, families, splitKeys, c); }
Table function(TableName tableName, byte[][] families, byte[][] splitKeys, int replicaCount, final Configuration c) throws IOException { TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName).setRegionReplication(replicaCount).build(); return createTable(htd, families, splitKeys, c); }
/** * Create a table. * @param tableName the table name * @param families the families * @param splitKeys the split keys * @param replicaCount the replica count * @param c Configuration to use * @return A Table instance for the created table. */
Create a table
createTable
{ "repo_name": "ndimiduk/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java", "license": "apache-2.0", "size": 151074 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.client.Table", "org.apache.hadoop.hbase.client.TableDescriptor", "org.apache.hadoop.hbase.client.TableDescriptorBuilder" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
756,841
public static boolean evalBoolean(PageContextImpl pageContext, com.caucho.xpath.Expr select) throws XPathException, JspException { try { Env env = XPath.createEnv(); env.setVarEnv(((PageContextImpl) pageContext).getVarEnv()); Node node = pageContext.getNodeEnv(); boolean test = select.evalBoolean(node, env); env.free(); return test; } catch (javax.el.ELException e) { throw new JspException(e); } }
static boolean function(PageContextImpl pageContext, com.caucho.xpath.Expr select) throws XPathException, JspException { try { Env env = XPath.createEnv(); env.setVarEnv(((PageContextImpl) pageContext).getVarEnv()); Node node = pageContext.getNodeEnv(); boolean test = select.evalBoolean(node, env); env.free(); return test; } catch (javax.el.ELException e) { throw new JspException(e); } }
/** * Evaluates as a boolean. */
Evaluates as a boolean
evalBoolean
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/jstl/el/XmlIfTag.java", "license": "gpl-2.0", "size": 3219 }
[ "com.caucho.jsp.PageContextImpl", "com.caucho.xpath.Env", "com.caucho.xpath.XPath", "com.caucho.xpath.XPathException", "javax.servlet.jsp.JspException", "org.w3c.dom.Node" ]
import com.caucho.jsp.PageContextImpl; import com.caucho.xpath.Env; import com.caucho.xpath.XPath; import com.caucho.xpath.XPathException; import javax.servlet.jsp.JspException; import org.w3c.dom.Node;
import com.caucho.jsp.*; import com.caucho.xpath.*; import javax.servlet.jsp.*; import org.w3c.dom.*;
[ "com.caucho.jsp", "com.caucho.xpath", "javax.servlet", "org.w3c.dom" ]
com.caucho.jsp; com.caucho.xpath; javax.servlet; org.w3c.dom;
863,857
protected void deactivate() { isActive.set(false); this.refQueueThread.interrupt(); if (plugin != null) { plugin.dispose(); plugin = null; } if (mapEntries != null) { mapEntries.dispose(); mapEntries = MapEntries.EMPTY; } resolverStackHolder = null; }
void function() { isActive.set(false); this.refQueueThread.interrupt(); if (plugin != null) { plugin.dispose(); plugin = null; } if (mapEntries != null) { mapEntries.dispose(); mapEntries = MapEntries.EMPTY; } resolverStackHolder = null; }
/** * Deactivates this component */
Deactivates this component
deactivate
{ "repo_name": "Nimco/sling", "path": "bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java", "license": "apache-2.0", "size": 16085 }
[ "org.apache.sling.resourceresolver.impl.mapping.MapEntries" ]
import org.apache.sling.resourceresolver.impl.mapping.MapEntries;
import org.apache.sling.resourceresolver.impl.mapping.*;
[ "org.apache.sling" ]
org.apache.sling;
737,393
@Override public void visit(ReturnNode n, State state) { transferReturn(n, state, null); }
void function(ReturnNode n, State state) { transferReturn(n, state, null); }
/** * 12.9 and 13.2.1 'return' statement. */
12.9 and 13.2.1 'return' statement
visit
{ "repo_name": "keil/TbDA", "path": "src/dk/brics/tajs/analysis/NodeTransfer.java", "license": "apache-2.0", "size": 56883 }
[ "dk.brics.tajs.flowgraph.nodes.ReturnNode" ]
import dk.brics.tajs.flowgraph.nodes.ReturnNode;
import dk.brics.tajs.flowgraph.nodes.*;
[ "dk.brics.tajs" ]
dk.brics.tajs;
1,323,276
public PropertyEditor getEditor() { return m_Editor; }
PropertyEditor function() { return m_Editor; }
/** * Gets the current property editor. * * @return a value of type 'PropertyEditor' */
Gets the current property editor
getEditor
{ "repo_name": "paolopavan/cfr", "path": "src/weka/gui/PropertyDialog.java", "license": "gpl-3.0", "size": 2310 }
[ "java.beans.PropertyEditor" ]
import java.beans.PropertyEditor;
import java.beans.*;
[ "java.beans" ]
java.beans;
1,780,763
boolean checkForDuplicatePerson(Award award, AwardPerson newProjectPerson) { boolean valid = true; for(AwardPerson p: award.getProjectPersons()) { if (p.getClass().equals(newProjectPerson.getClass()) && p.getContact().getIdentifier().equals(newProjectPerson.getContact().getIdentifier())) { valid = false; break; } } if(!valid) { GlobalVariables.getMessageMap().putError(AWARD_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_AWARD_PROJECT_PERSON_EXISTS, newProjectPerson.getContact().getFullName()); } return valid; }
boolean checkForDuplicatePerson(Award award, AwardPerson newProjectPerson) { boolean valid = true; for(AwardPerson p: award.getProjectPersons()) { if (p.getClass().equals(newProjectPerson.getClass()) && p.getContact().getIdentifier().equals(newProjectPerson.getContact().getIdentifier())) { valid = false; break; } } if(!valid) { GlobalVariables.getMessageMap().putError(AWARD_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_AWARD_PROJECT_PERSON_EXISTS, newProjectPerson.getContact().getFullName()); } return valid; }
/** * Verify no duplicate person * @param award * @param newProjectPerson * @return */
Verify no duplicate person
checkForDuplicatePerson
{ "repo_name": "mukadder/kc", "path": "coeus-impl/src/main/java/org/kuali/kra/award/contacts/AwardProjectPersonAddRuleImpl.java", "license": "agpl-3.0", "size": 4141 }
[ "org.kuali.kra.award.home.Award", "org.kuali.rice.krad.util.GlobalVariables" ]
import org.kuali.kra.award.home.Award; import org.kuali.rice.krad.util.GlobalVariables;
import org.kuali.kra.award.home.*; import org.kuali.rice.krad.util.*;
[ "org.kuali.kra", "org.kuali.rice" ]
org.kuali.kra; org.kuali.rice;
785,364
public static Company readCompany(String filename) { Object o = null; try { FileInputStream fis = new FileInputStream(filename); ObjectInputStream in = new ObjectInputStream(fis); o = in.readObject(); in.close(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return (Company) o; }
static Company function(String filename) { Object o = null; try { FileInputStream fis = new FileInputStream(filename); ObjectInputStream in = new ObjectInputStream(fis); o = in.readObject(); in.close(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return (Company) o; }
/** * Read (say, deserialize) a company */
Read (say, deserialize) a company
readCompany
{ "repo_name": "amritbhat786/DocIT", "path": "101repo/contributions/javaVisitor/org/softlang/features/Serialization.java", "license": "mit", "size": 1090 }
[ "java.io.FileInputStream", "java.io.IOException", "java.io.ObjectInputStream", "org.softlang.company.Company" ]
import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import org.softlang.company.Company;
import java.io.*; import org.softlang.company.*;
[ "java.io", "org.softlang.company" ]
java.io; org.softlang.company;
2,725,326
public int getForegroundGravity() { return mForegroundGravity; } /** * Describes how the foreground is positioned. Defaults to START and TOP. * * @param foregroundGravity See {@link android.view.Gravity}
int function() { return mForegroundGravity; } /** * Describes how the foreground is positioned. Defaults to START and TOP. * * @param foregroundGravity See {@link android.view.Gravity}
/** * Describes how the foreground is positioned. * * @return foreground gravity. * * @see #setForegroundGravity(int) */
Describes how the foreground is positioned
getForegroundGravity
{ "repo_name": "OpenSilk/Orpheus", "path": "common-ui/src/main/java/org/opensilk/common/ui/widget/ForegroundRelativeLayout.java", "license": "gpl-3.0", "size": 7537 }
[ "android.view.Gravity" ]
import android.view.Gravity;
import android.view.*;
[ "android.view" ]
android.view;
167,464
private static boolean isDlLiteDataPropertyDomainAxiom (OWLDataPropertyDomainAxiom ax){ boolean isDlLite = false; OWLClassExpression dom = ((OWLDataPropertyDomainAxiom)ax).getDomain(); OWLDataPropertyExpression prop = ((OWLDataPropertyDomainAxiom)ax).getProperty(); if(isDlLiteSuperClassExpression(dom) && prop instanceof OWLDataProperty){ isDlLite = true; } return isDlLite; }
static boolean function (OWLDataPropertyDomainAxiom ax){ boolean isDlLite = false; OWLClassExpression dom = ((OWLDataPropertyDomainAxiom)ax).getDomain(); OWLDataPropertyExpression prop = ((OWLDataPropertyDomainAxiom)ax).getProperty(); if(isDlLiteSuperClassExpression(dom) && prop instanceof OWLDataProperty){ isDlLite = true; } return isDlLite; }
/************************************************************************** * This method accepts as input an OWLDataPropertyDomainAxiom and returns * true if it is a valid OWLDataPropertyDomainAxiom for Dl-Lite. * <p> * DataPropertyDomain := PropertyDomain (axiomAnnotations * DataPropertyExpression superClassExpression) * <p> * DataPropertyExpression := DataProperty * @param ax the input OWLDataPropertyDomainAxiom * @return True when the the input OWLDataPropertyDomainAxiom is * valid syntactically in Dl Lite and False in the opposite case. *************************************************************************/
This method accepts as input an OWLDataPropertyDomainAxiom and returns true if it is a valid OWLDataPropertyDomainAxiom for Dl-Lite. DataPropertyDomain := PropertyDomain (axiomAnnotations DataPropertyExpression superClassExpression) DataPropertyExpression := DataProperty
isDlLiteDataPropertyDomainAxiom
{ "repo_name": "ontop/ontoprox", "path": "src/main/java/org/semanticweb/ontop/beyondql/approximation/DLLiteAGrammarChecker.java", "license": "apache-2.0", "size": 56444 }
[ "org.semanticweb.owlapi.model.OWLClassExpression", "org.semanticweb.owlapi.model.OWLDataProperty", "org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom", "org.semanticweb.owlapi.model.OWLDataPropertyExpression" ]
import org.semanticweb.owlapi.model.OWLClassExpression; import org.semanticweb.owlapi.model.OWLDataProperty; import org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom; import org.semanticweb.owlapi.model.OWLDataPropertyExpression;
import org.semanticweb.owlapi.model.*;
[ "org.semanticweb.owlapi" ]
org.semanticweb.owlapi;
406,377
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>GET</code> method
doGet
{ "repo_name": "MadisonGelowitz/Accessibility", "path": "AccessibilityWebsite2/AccessibilityWebsite2-war/src/java/servlets/UserServlet.java", "license": "mit", "size": 11805 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
1,546,580
@Test public void testTimeoutForUnusedTaskManager() throws Exception { final long taskManagerTimeout = 50L; final CompletableFuture<InstanceID> releasedResourceFuture = new CompletableFuture<>(); final ResourceActions resourceManagerActions = new TestingResourceActionsBuilder() .setReleaseResourceConsumer((instanceID, e) -> releasedResourceFuture.complete(instanceID)) .build(); final ResourceManagerId resourceManagerId = ResourceManagerId.generate(); final ScheduledExecutor scheduledExecutor = TestingUtils.defaultScheduledExecutor(); final ResourceID resourceId = ResourceID.generate(); final JobID jobId = new JobID(); final AllocationID allocationId = new AllocationID(); final ResourceProfile resourceProfile = ResourceProfile.fromResources(1.0, 1); final SlotRequest slotRequest = new SlotRequest(jobId, allocationId, resourceProfile, "foobar"); final CompletableFuture<SlotID> requestedSlotFuture = new CompletableFuture<>(); final TaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder() .setRequestSlotFunction(tuple6 -> { requestedSlotFuture.complete(tuple6.f0); return CompletableFuture.completedFuture(Acknowledge.get()); }) .createTestingTaskExecutorGateway(); final TaskExecutorConnection taskManagerConnection = new TaskExecutorConnection(resourceId, taskExecutorGateway); final SlotID slotId1 = new SlotID(resourceId, 0); final SlotID slotId2 = new SlotID(resourceId, 1); final SlotStatus slotStatus1 = new SlotStatus(slotId1, resourceProfile); final SlotStatus slotStatus2 = new SlotStatus(slotId2, resourceProfile); final SlotReport initialSlotReport = new SlotReport(Arrays.asList(slotStatus1, slotStatus2)); final Executor mainThreadExecutor = TestingUtils.defaultExecutor(); try (final SlotManagerImpl slotManager = createSlotManagerBuilder() .setTaskManagerTimeout(Time.of(taskManagerTimeout, TimeUnit.MILLISECONDS)) .setRedundantTaskManagerNum(0) .build()) { slotManager.start(resourceManagerId, mainThreadExecutor, resourceManagerActions); CompletableFuture.supplyAsync( () -> { try { return slotManager.registerSlotRequest(slotRequest); } catch (ResourceManagerException e) { throw new CompletionException(e); } }, mainThreadExecutor) .thenRun(() -> slotManager.registerTaskManager(taskManagerConnection, initialSlotReport)); final SlotID slotId = requestedSlotFuture.get(); CompletableFuture<Boolean> idleFuture = CompletableFuture.supplyAsync( () -> slotManager.isTaskManagerIdle(taskManagerConnection.getInstanceID()), mainThreadExecutor); // check that the TaskManager is not idle assertFalse(idleFuture.get()); CompletableFuture<TaskManagerSlot> slotFuture = CompletableFuture.supplyAsync( () -> slotManager.getSlot(slotId), mainThreadExecutor); TaskManagerSlot slot = slotFuture.get(); assertTrue(slot.getState() == TaskManagerSlot.State.ALLOCATED); assertEquals(allocationId, slot.getAllocationId()); CompletableFuture<Boolean> idleFuture2 = CompletableFuture.runAsync( () -> slotManager.freeSlot(slotId, allocationId), mainThreadExecutor) .thenApply((Object value) -> slotManager.isTaskManagerIdle(taskManagerConnection.getInstanceID())); assertTrue(idleFuture2.get()); assertThat(releasedResourceFuture.get(), is(equalTo(taskManagerConnection.getInstanceID()))); } } /** * Tests that a task manager timeout does not remove the slots from the SlotManager. * A timeout should only trigger the {@link ResourceActions#releaseResource(InstanceID, Exception)}
void function() throws Exception { final long taskManagerTimeout = 50L; final CompletableFuture<InstanceID> releasedResourceFuture = new CompletableFuture<>(); final ResourceActions resourceManagerActions = new TestingResourceActionsBuilder() .setReleaseResourceConsumer((instanceID, e) -> releasedResourceFuture.complete(instanceID)) .build(); final ResourceManagerId resourceManagerId = ResourceManagerId.generate(); final ScheduledExecutor scheduledExecutor = TestingUtils.defaultScheduledExecutor(); final ResourceID resourceId = ResourceID.generate(); final JobID jobId = new JobID(); final AllocationID allocationId = new AllocationID(); final ResourceProfile resourceProfile = ResourceProfile.fromResources(1.0, 1); final SlotRequest slotRequest = new SlotRequest(jobId, allocationId, resourceProfile, STR); final CompletableFuture<SlotID> requestedSlotFuture = new CompletableFuture<>(); final TaskExecutorGateway taskExecutorGateway = new TestingTaskExecutorGatewayBuilder() .setRequestSlotFunction(tuple6 -> { requestedSlotFuture.complete(tuple6.f0); return CompletableFuture.completedFuture(Acknowledge.get()); }) .createTestingTaskExecutorGateway(); final TaskExecutorConnection taskManagerConnection = new TaskExecutorConnection(resourceId, taskExecutorGateway); final SlotID slotId1 = new SlotID(resourceId, 0); final SlotID slotId2 = new SlotID(resourceId, 1); final SlotStatus slotStatus1 = new SlotStatus(slotId1, resourceProfile); final SlotStatus slotStatus2 = new SlotStatus(slotId2, resourceProfile); final SlotReport initialSlotReport = new SlotReport(Arrays.asList(slotStatus1, slotStatus2)); final Executor mainThreadExecutor = TestingUtils.defaultExecutor(); try (final SlotManagerImpl slotManager = createSlotManagerBuilder() .setTaskManagerTimeout(Time.of(taskManagerTimeout, TimeUnit.MILLISECONDS)) .setRedundantTaskManagerNum(0) .build()) { slotManager.start(resourceManagerId, mainThreadExecutor, resourceManagerActions); CompletableFuture.supplyAsync( () -> { try { return slotManager.registerSlotRequest(slotRequest); } catch (ResourceManagerException e) { throw new CompletionException(e); } }, mainThreadExecutor) .thenRun(() -> slotManager.registerTaskManager(taskManagerConnection, initialSlotReport)); final SlotID slotId = requestedSlotFuture.get(); CompletableFuture<Boolean> idleFuture = CompletableFuture.supplyAsync( () -> slotManager.isTaskManagerIdle(taskManagerConnection.getInstanceID()), mainThreadExecutor); assertFalse(idleFuture.get()); CompletableFuture<TaskManagerSlot> slotFuture = CompletableFuture.supplyAsync( () -> slotManager.getSlot(slotId), mainThreadExecutor); TaskManagerSlot slot = slotFuture.get(); assertTrue(slot.getState() == TaskManagerSlot.State.ALLOCATED); assertEquals(allocationId, slot.getAllocationId()); CompletableFuture<Boolean> idleFuture2 = CompletableFuture.runAsync( () -> slotManager.freeSlot(slotId, allocationId), mainThreadExecutor) .thenApply((Object value) -> slotManager.isTaskManagerIdle(taskManagerConnection.getInstanceID())); assertTrue(idleFuture2.get()); assertThat(releasedResourceFuture.get(), is(equalTo(taskManagerConnection.getInstanceID()))); } } /** * Tests that a task manager timeout does not remove the slots from the SlotManager. * A timeout should only trigger the {@link ResourceActions#releaseResource(InstanceID, Exception)}
/** * Tests that formerly used task managers can again timeout after all of their slots have * been freed. */
Tests that formerly used task managers can again timeout after all of their slots have been freed
testTimeoutForUnusedTaskManager
{ "repo_name": "darionyaphet/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerImplTest.java", "license": "apache-2.0", "size": 72818 }
[ "java.util.Arrays", "java.util.concurrent.CompletableFuture", "java.util.concurrent.CompletionException", "java.util.concurrent.Executor", "java.util.concurrent.TimeUnit", "org.apache.flink.api.common.JobID", "org.apache.flink.api.common.time.Time", "org.apache.flink.runtime.clusterframework.types.All...
import java.util.Arrays; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import org.apache.flink.api.common.JobID; import org.apache.flink.api.common.time.Time; import org.apache.flink.runtime.clusterframework.types.AllocationID; import org.apache.flink.runtime.clusterframework.types.ResourceID; import org.apache.flink.runtime.clusterframework.types.ResourceProfile; import org.apache.flink.runtime.clusterframework.types.SlotID; import org.apache.flink.runtime.concurrent.ScheduledExecutor; import org.apache.flink.runtime.instance.InstanceID; import org.apache.flink.runtime.messages.Acknowledge; import org.apache.flink.runtime.resourcemanager.ResourceManagerId; import org.apache.flink.runtime.resourcemanager.SlotRequest; import org.apache.flink.runtime.resourcemanager.exceptions.ResourceManagerException; import org.apache.flink.runtime.resourcemanager.registration.TaskExecutorConnection; import org.apache.flink.runtime.taskexecutor.SlotReport; import org.apache.flink.runtime.taskexecutor.SlotStatus; import org.apache.flink.runtime.taskexecutor.TaskExecutorGateway; import org.apache.flink.runtime.taskexecutor.TestingTaskExecutorGatewayBuilder; import org.apache.flink.runtime.testingUtils.TestingUtils; import org.hamcrest.Matchers; import org.junit.Assert;
import java.util.*; import java.util.concurrent.*; import org.apache.flink.api.common.*; import org.apache.flink.api.common.time.*; import org.apache.flink.runtime.*; import org.apache.flink.runtime.clusterframework.types.*; import org.apache.flink.runtime.concurrent.*; import org.apache.flink.runtime.instance.*; import org.apache.flink.runtime.messages.*; import org.apache.flink.runtime.resourcemanager.*; import org.apache.flink.runtime.resourcemanager.exceptions.*; import org.apache.flink.runtime.resourcemanager.registration.*; import org.apache.flink.runtime.taskexecutor.*; import org.hamcrest.*; import org.junit.*;
[ "java.util", "org.apache.flink", "org.hamcrest", "org.junit" ]
java.util; org.apache.flink; org.hamcrest; org.junit;
1,421,218
@Override public void onFailure(@NonNull Call<List<UserBase>> call, @NonNull Throwable throwable) { try { Timber.tag(TAG).e(throwable); resetFlipperState(); } catch (Exception e) { Timber.tag(TAG).e(throwable); e.printStackTrace(); } }
void function(@NonNull Call<List<UserBase>> call, @NonNull Throwable throwable) { try { Timber.tag(TAG).e(throwable); resetFlipperState(); } catch (Exception e) { Timber.tag(TAG).e(throwable); e.printStackTrace(); } }
/** * Invoked when a network exception occurred talking to the server or when an unexpected * exception occurred creating the request or processing the response. * * @param call the origination requesting object * @param throwable contains information about the error */
Invoked when a network exception occurred talking to the server or when an unexpected exception occurred creating the request or processing the response
onFailure
{ "repo_name": "wax911/AniTrendApp", "path": "app/src/main/java/com/mxt/anitrend/base/custom/view/widget/FavouriteWidget.java", "license": "lgpl-3.0", "size": 6117 }
[ "androidx.annotation.NonNull", "com.mxt.anitrend.model.entity.base.UserBase", "java.util.List" ]
import androidx.annotation.NonNull; import com.mxt.anitrend.model.entity.base.UserBase; import java.util.List;
import androidx.annotation.*; import com.mxt.anitrend.model.entity.base.*; import java.util.*;
[ "androidx.annotation", "com.mxt.anitrend", "java.util" ]
androidx.annotation; com.mxt.anitrend; java.util;
2,129,916
String browseVDC(ClaudiaData claudiaData) throws ClaudiaResourceNotFoundException;
String browseVDC(ClaudiaData claudiaData) throws ClaudiaResourceNotFoundException;
/** * Browse the selected VDC for the given organization (browseVDC). */
Browse the selected VDC for the given organization (browseVDC)
browseVDC
{ "repo_name": "hmunfru/fiware-paas", "path": "core/src/main/java/com/telefonica/euro_iaas/paasmanager/claudia/ClaudiaClient.java", "license": "apache-2.0", "size": 7534 }
[ "com.telefonica.euro_iaas.paasmanager.exception.ClaudiaResourceNotFoundException", "com.telefonica.euro_iaas.paasmanager.model.ClaudiaData" ]
import com.telefonica.euro_iaas.paasmanager.exception.ClaudiaResourceNotFoundException; import com.telefonica.euro_iaas.paasmanager.model.ClaudiaData;
import com.telefonica.euro_iaas.paasmanager.exception.*; import com.telefonica.euro_iaas.paasmanager.model.*;
[ "com.telefonica.euro_iaas" ]
com.telefonica.euro_iaas;
2,561,846
public EjbJarDescriptor removeEnterpriseBeans() { model.removeChildren("enterprise-beans"); return this; } // --------------------------------------------------------------------------------------------------------|| // ClassName: EjbJarDescriptor ElementName: javaee:interceptorsType ElementType : interceptors // MaxOccurs: - isGeneric: false isAttribute: false isEnum: false isDataType: false // --------------------------------------------------------------------------------------------------------||
EjbJarDescriptor function() { model.removeChildren(STR); return this; }
/** * Removes the <code>enterprise-beans</code> element * @return the current instance of <code>EjbJarDescriptor</code> */
Removes the <code>enterprise-beans</code> element
removeEnterpriseBeans
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar31/EjbJarDescriptorImpl.java", "license": "epl-1.0", "size": 21195 }
[ "org.jboss.shrinkwrap.descriptor.api.ejbjar31.EjbJarDescriptor" ]
import org.jboss.shrinkwrap.descriptor.api.ejbjar31.EjbJarDescriptor;
import org.jboss.shrinkwrap.descriptor.api.ejbjar31.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
2,840,357
public static String toString(JSONArray ja) throws JSONException { Object e; int i; JSONObject jo; String k; Iterator keys; int length; StringBuffer sb = new StringBuffer(); String tagName; String v; // Emit <tagName tagName = ja.getString(0); XML.noSpace(tagName); tagName = XML.escape(tagName); sb.append('<'); sb.append(tagName); e = ja.opt(1); if (e instanceof JSONObject) { i = 2; jo = (JSONObject)e; // Emit the attributes keys = jo.keys(); while (keys.hasNext()) { k = keys.next().toString(); XML.noSpace(k); v = jo.optString(k); if (v != null) { sb.append(' '); sb.append(XML.escape(k)); sb.append('='); sb.append('"'); sb.append(XML.escape(v)); sb.append('"'); } } } else { i = 1; } //Emit content in body length = ja.length(); if (i >= length) { sb.append('/'); sb.append('>'); } else { sb.append('>'); do { e = ja.get(i); i += 1; if (e != null) { if (e instanceof String) { sb.append(XML.escape(e.toString())); } else if (e instanceof JSONObject) { sb.append(toString((JSONObject)e)); } else if (e instanceof JSONArray) { sb.append(toString((JSONArray)e)); } } } while (i < length); sb.append('<'); sb.append('/'); sb.append(tagName); sb.append('>'); } return sb.toString(); }
static String function(JSONArray ja) throws JSONException { Object e; int i; JSONObject jo; String k; Iterator keys; int length; StringBuffer sb = new StringBuffer(); String tagName; String v; tagName = ja.getString(0); XML.noSpace(tagName); tagName = XML.escape(tagName); sb.append('<'); sb.append(tagName); e = ja.opt(1); if (e instanceof JSONObject) { i = 2; jo = (JSONObject)e; keys = jo.keys(); while (keys.hasNext()) { k = keys.next().toString(); XML.noSpace(k); v = jo.optString(k); if (v != null) { sb.append(' '); sb.append(XML.escape(k)); sb.append('='); sb.append('STR'); } } } else { i = 1; } length = ja.length(); if (i >= length) { sb.append('/'); sb.append('>'); } else { sb.append('>'); do { e = ja.get(i); i += 1; if (e != null) { if (e instanceof String) { sb.append(XML.escape(e.toString())); } else if (e instanceof JSONObject) { sb.append(toString((JSONObject)e)); } else if (e instanceof JSONArray) { sb.append(toString((JSONArray)e)); } } } while (i < length); sb.append('<'); sb.append('/'); sb.append(tagName); sb.append('>'); } return sb.toString(); }
/** * Reverse the JSONML transformation, making an XML text from a JSONArray. * @param ja A JSONArray. * @return An XML string. * @throws JSONException */
Reverse the JSONML transformation, making an XML text from a JSONArray
toString
{ "repo_name": "VysakhV/eeplat-social-api", "path": "source/163/t4j/org/json/JSONML.java", "license": "mit", "size": 14853 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,850,744
private static void optionPane(final Player player) { Interface optionPane = new Interface(false, 2, GUIName, player); List<String> optionList = new ArrayList<String>(); for (String option: ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Options").replace(" ", "").split(",")) { if (option != null && !option.isEmpty()) { optionList.add(option); } } SchedulerUtils.runAsync(() -> { optionPane.addButton(new Button(ItemHandler.getItem("DIAMOND_CHESTPLATE", 1, StringUtils.containsValue(optionList, "PROTECT"), "&e&lProtect", "&7", "&7*Prevents ALL players from", "&7having their first-join and", "&7first-world items cleared.", "&9&lENABLED: &a" + (StringUtils.containsValue(optionList, "PROTECT") + "").toUpperCase()), event -> { if (StringUtils.containsValue(optionList, "PROTECT")) { optionList.remove("PROTECT"); } else { optionList.add("PROTECT"); } if (optionList.isEmpty()) { optionList.add("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLED")) { optionList.remove("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLE")) { optionList.remove("DISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), "config.yml"); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set("Clear-Items.Options", optionList.toString().replace("[", "").replace("]", "")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml"); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem("DIAMOND", 1, StringUtils.containsValue(optionList, "PROTECT_OP"), "&e&lProtect OP", "&7", "&7*Prevents OP players from", "&7having their first-join and", "&7first-world items cleared.", "&9&lENABLED: &a" + (StringUtils.containsValue(optionList, "PROTECT_OP") + "").toUpperCase()), event -> { if (StringUtils.containsValue(optionList, "PROTECT_OP")) { optionList.remove("PROTECT_OP"); } else { optionList.add("PROTECT_OP"); } if (optionList.isEmpty()) { optionList.add("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLED")) { optionList.remove("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLE")) { optionList.remove("DISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), "config.yml"); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set("Clear-Items.Options", optionList.toString().replace("[", "").replace("]", "")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml"); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_APPLE" : "322"), 1, StringUtils.containsValue(optionList, "PROTECT_CREATIVE"), "&e&lProtect Creative", "&7", "&7*Prevents players in creative mode", "&7from having their first-join", "&7and first-world items cleared.", "&9&lENABLED: &a" + (StringUtils.containsValue(optionList, "PROTECT_CREATIVE") + "").toUpperCase()), event -> { if (StringUtils.containsValue(optionList, "PROTECT_CREATIVE")) { optionList.remove("PROTECT_CREATIVE"); } else { optionList.add("PROTECT_CREATIVE"); } if (optionList.isEmpty()) { optionList.add("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLED")) { optionList.remove("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLE")) { optionList.remove("DISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), "config.yml"); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set("Clear-Items.Options", optionList.toString().replace("[", "").replace("]", "")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml"); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem("GOLD_BLOCK", 1, (StringUtils.containsValue(optionList, "RETURN") && DependAPI.getDepends(false).getGuard().guardEnabled()), "&e&lReturn Regions", "&7*Returns the cleared player inventory", "&7when exiting a cleared region", "&7or entering a region which is", "&7not listed as clearable.", (DependAPI.getDepends(false).getGuard().guardEnabled() ? "&9&lENABLED: &a" + (StringUtils.containsValue(optionList, "RETURN") ? "true" : "false") : ""), (DependAPI.getDepends(false).getGuard().guardEnabled() ? "" : "&7"), (DependAPI.getDepends(false).getGuard().guardEnabled() ? "" : "&c&lERROR: &7WorldGuard was NOT found."), (DependAPI.getDepends(false).getGuard().guardEnabled() ? "" : "&7This button will do nothing...")), event -> { if (DependAPI.getDepends(false).getGuard().guardEnabled()) { if (StringUtils.containsValue(optionList, "RETURN")) { optionList.remove("RETURN"); } else { optionList.add("RETURN"); } if (optionList.isEmpty()) { optionList.add("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLED")) { optionList.remove("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLE")) { optionList.remove("DISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), "config.yml"); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set("Clear-Items.Options", optionList.toString().replace("[", "").replace("]", "")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml"); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); } })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GRASS_BLOCK" : "2"), 1, StringUtils.containsValue(optionList, "RETURN_SWITCH"), "&e&lReturn Worlds", "&7", "&7*Returns the prior cleared", "&7player inventory from the", "&7prior world upon returning", "&7to that prior world.", "&9&lENABLED: &a" + (StringUtils.containsValue(optionList, "RETURN_SWITCH") + "").toUpperCase()), event -> { if (StringUtils.containsValue(optionList, "RETURN_SWITCH")) { optionList.remove("RETURN_SWITCH"); } else { optionList.add("RETURN_SWITCH"); } if (optionList.isEmpty()) { optionList.add("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLED")) { optionList.remove("DISABLED"); } else if (StringUtils.containsValue(optionList, "DISABLE")) { optionList.remove("DISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), "config.yml"); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set("Clear-Items.Options", optionList.toString().replace("[", "").replace("]", "")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml"); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the clear settings."), event -> clearPane(player))); optionPane.addButton(new Button(fillerPaneBItem), 7); optionPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the clear settings."), event -> clearPane(player))); }); optionPane.open(player); }
static void function(final Player player) { Interface optionPane = new Interface(false, 2, GUIName, player); List<String> optionList = new ArrayList<String>(); for (String option: ConfigHandler.getConfig().getFile(STR).getString(STR).replace(" ", STR,STRDIAMOND_CHESTPLATESTRPROTECTSTR&e&lProtectSTR&7STR&7*Prevents ALL players fromSTR&7having their first-join andSTR&7first-world items cleared.STR&9&lENABLED: &aSTRPROTECTSTRSTRPROTECTSTRPROTECTSTRPROTECTSTRDISABLEDSTRDISABLEDSTRDISABLEDSTRDISABLESTRDISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), STR); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set(STR, optionList.toString().replace("[STRSTR]STR")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, STR); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem("DIAMONDSTRPROTECT_OPSTR&e&lProtect OPSTR&7STR&7*Prevents OP players fromSTR&7having their first-join andSTR&7first-world items cleared.STR&9&lENABLED: &aSTRPROTECT_OPSTRSTRPROTECT_OPSTRPROTECT_OPSTRPROTECT_OPSTRDISABLEDSTRDISABLEDSTRDISABLEDSTRDISABLESTRDISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), STR); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set(STR, optionList.toString().replace("[STRSTR]STR")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, STR); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13STRGOLDEN_APPLESTR322STRPROTECT_CREATIVESTR&e&lProtect CreativeSTR&7STR&7*Prevents players in creative modeSTR&7from having their first-joinSTR&7and first-world items cleared.STR&9&lENABLED: &aSTRPROTECT_CREATIVESTRSTRPROTECT_CREATIVESTRPROTECT_CREATIVESTRPROTECT_CREATIVESTRDISABLEDSTRDISABLEDSTRDISABLEDSTRDISABLESTRDISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), STR); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set(STR, optionList.toString().replace("[STRSTR]STR")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, STR); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem("GOLD_BLOCKSTRRETURNSTR&e&lReturn RegionsSTR&7*Returns the cleared player inventorySTR&7when exiting a cleared regionSTR&7or entering a region which isSTR&7not listed as clearable.STR&9&lENABLED: &aSTRRETURNSTRtrueSTRfalseSTRSTRSTR&7STRSTR&c&lERROR: &7WorldGuard was NOT found.STRSTR&7This button will do nothing...STRRETURNSTRRETURNSTRRETURNSTRDISABLEDSTRDISABLEDSTRDISABLEDSTRDISABLESTRDISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), STR); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set(STR, optionList.toString().replace("[STRSTR]STR")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, STR); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); } })); optionPane.addButton(new Button(fillerPaneBItem)); optionPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13STRGRASS_BLOCKSTR2STRRETURN_SWITCHSTR&e&lReturn WorldsSTR&7STR&7*Returns the prior clearedSTR&7player inventory from theSTR&7prior world upon returningSTR&7to that prior world.STR&9&lENABLED: &aSTRRETURN_SWITCHSTRSTRRETURN_SWITCHSTRRETURN_SWITCHSTRRETURN_SWITCHSTRDISABLEDSTRDISABLEDSTRDISABLEDSTRDISABLESTRDISABLE"); } File fileFolder = new File (ItemJoin.getInstance().getDataFolder(), STR); FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder); dataFile.set(STR, optionList.toString().replace("[STRSTR]STR")); ConfigHandler.getConfig().saveFile(dataFile, fileFolder, STR); ConfigHandler.getConfig().softReload(); SchedulerUtils.runLater(2L, () -> optionPane(player)); })); optionPane.addButton(new Button(ItemHandler.getItem("BARRIERSTR&c&l&nReturnSTR&7STR&7*Returns you to the clear settings.STRBARRIERSTR&c&l&nReturnSTR&7STR&7*Returns you to the clear settings."), event -> clearPane(player))); }); optionPane.open(player); }
/** * Opens the Pane for the Player. * * @param player - The Player to have the Pane opened. */
Opens the Pane for the Player
optionPane
{ "repo_name": "RockinChaos/ItemJoin", "path": "src/me/RockinChaos/itemjoin/utils/interfaces/menus/Menu.java", "license": "lgpl-3.0", "size": 522918 }
[ "java.io.File", "java.util.ArrayList", "java.util.List", "org.bukkit.configuration.file.FileConfiguration", "org.bukkit.configuration.file.YamlConfiguration", "org.bukkit.entity.Player" ]
import java.io.File; import java.util.ArrayList; import java.util.List; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player;
import java.io.*; import java.util.*; import org.bukkit.configuration.file.*; import org.bukkit.entity.*;
[ "java.io", "java.util", "org.bukkit.configuration", "org.bukkit.entity" ]
java.io; java.util; org.bukkit.configuration; org.bukkit.entity;
281,966
@Test public void testCompactionRecordDoesntBlockRolling() throws Exception { Table table = null; // When the hbase:meta table can be opened, the region servers are running Table t = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME); try { table = createTestTable(getName()); server = TEST_UTIL.getRSForFirstRegionInTable(table.getName()); HRegion region = server.getRegions(table.getName()).get(0); final WAL log = server.getWAL(region.getRegionInfo()); Store s = region.getStore(HConstants.CATALOG_FAMILY); // Put some stuff into table, to make sure we have some files to compact. for (int i = 1; i <= 2; ++i) { doPut(table, i); admin.flush(table.getName()); } doPut(table, 3); // don't flush yet, or compaction might trigger before we roll WAL assertEquals("Should have no WAL after initial writes", 0, AbstractFSWALProvider.getNumRolledLogFiles(log)); assertEquals(2, s.getStorefilesCount()); // Roll the log and compact table, to have compaction record in the 2nd WAL. log.rollWriter(); assertEquals("Should have WAL; one table is not flushed", 1, AbstractFSWALProvider.getNumRolledLogFiles(log)); admin.flush(table.getName()); region.compact(false); // Wait for compaction in case if flush triggered it before us. Assert.assertNotNull(s); for (int waitTime = 3000; s.getStorefilesCount() > 1 && waitTime > 0; waitTime -= 200) { Threads.sleepWithoutInterrupt(200); } assertEquals("Compaction didn't happen", 1, s.getStorefilesCount()); // Write some value to the table so the WAL cannot be deleted until table is flushed. doPut(table, 0); // Now 2nd WAL will have both compaction and put record for table. log.rollWriter(); // 1st WAL deleted, 2nd not deleted yet. assertEquals("Should have WAL; one table is not flushed", 1, AbstractFSWALProvider.getNumRolledLogFiles(log)); // Flush table to make latest WAL obsolete; write another record, and roll again. admin.flush(table.getName()); doPut(table, 1); log.rollWriter(); // Now 2nd WAL is deleted and 3rd is added. assertEquals("Should have 1 WALs at the end", 1, AbstractFSWALProvider.getNumRolledLogFiles(log)); } finally { if (t != null) t.close(); if (table != null) table.close(); } }
void function() throws Exception { Table table = null; Table t = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME); try { table = createTestTable(getName()); server = TEST_UTIL.getRSForFirstRegionInTable(table.getName()); HRegion region = server.getRegions(table.getName()).get(0); final WAL log = server.getWAL(region.getRegionInfo()); Store s = region.getStore(HConstants.CATALOG_FAMILY); for (int i = 1; i <= 2; ++i) { doPut(table, i); admin.flush(table.getName()); } doPut(table, 3); assertEquals(STR, 0, AbstractFSWALProvider.getNumRolledLogFiles(log)); assertEquals(2, s.getStorefilesCount()); log.rollWriter(); assertEquals(STR, 1, AbstractFSWALProvider.getNumRolledLogFiles(log)); admin.flush(table.getName()); region.compact(false); Assert.assertNotNull(s); for (int waitTime = 3000; s.getStorefilesCount() > 1 && waitTime > 0; waitTime -= 200) { Threads.sleepWithoutInterrupt(200); } assertEquals(STR, 1, s.getStorefilesCount()); doPut(table, 0); log.rollWriter(); assertEquals(STR, 1, AbstractFSWALProvider.getNumRolledLogFiles(log)); admin.flush(table.getName()); doPut(table, 1); log.rollWriter(); assertEquals(STR, 1, AbstractFSWALProvider.getNumRolledLogFiles(log)); } finally { if (t != null) t.close(); if (table != null) table.close(); } }
/** * Tests that logs are deleted when some region has a compaction * record in WAL and no other records. See HBASE-8597. */
Tests that logs are deleted when some region has a compaction record in WAL and no other records. See HBASE-8597
testCompactionRecordDoesntBlockRolling
{ "repo_name": "Eshcar/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestLogRolling.java", "license": "apache-2.0", "size": 11710 }
[ "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.TableName", "org.apache.hadoop.hbase.client.Table", "org.apache.hadoop.hbase.regionserver.HRegion", "org.apache.hadoop.hbase.regionserver.Store", "org.apache.hadoop.hbase.util.Threads", "org.apache.hadoop.hbase.wal.AbstractFSWALProvider", ...
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.Store; import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.wal.AbstractFSWALProvider; import org.junit.Assert;
import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.hbase.wal.*; import org.junit.*;
[ "org.apache.hadoop", "org.junit" ]
org.apache.hadoop; org.junit;
760,570
private int describeFunction(Hive db, DescFunctionDesc descFunc) throws HiveException, SQLException { String funcName = descFunc.getName(); // write the results in the file DataOutputStream outStream = getOutputStream(descFunc.getResFile()); try { // get the function documentation Description desc = null; Class<?> funcClass = null; FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo(funcName); if (functionInfo != null) { funcClass = functionInfo.getFunctionClass(); } if (funcClass != null) { desc = AnnotationUtils.getAnnotation(funcClass, Description.class); } if (desc != null) { outStream.writeBytes(desc.value().replace("_FUNC_", funcName)); if (descFunc.isExtended()) { Set<String> synonyms = FunctionRegistry.getFunctionSynonyms(funcName); if (synonyms.size() > 0) { outStream.writeBytes("\nSynonyms: " + join(synonyms, ", ")); } if (desc.extended().length() > 0) { outStream.writeBytes("\n" + desc.extended().replace("_FUNC_", funcName)); } } } else { if (funcClass != null) { outStream.writeBytes("There is no documentation for function '" + funcName + "'"); } else { outStream.writeBytes("Function '" + funcName + "' does not exist."); } } outStream.write(terminator); } catch (FileNotFoundException e) { LOG.warn("describe function: " + stringifyException(e)); return 1; } catch (IOException e) { LOG.warn("describe function: " + stringifyException(e)); return 1; } catch (Exception e) { throw new HiveException(e); } finally { IOUtils.closeStream(outStream); } return 0; }
int function(Hive db, DescFunctionDesc descFunc) throws HiveException, SQLException { String funcName = descFunc.getName(); DataOutputStream outStream = getOutputStream(descFunc.getResFile()); try { Description desc = null; Class<?> funcClass = null; FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo(funcName); if (functionInfo != null) { funcClass = functionInfo.getFunctionClass(); } if (funcClass != null) { desc = AnnotationUtils.getAnnotation(funcClass, Description.class); } if (desc != null) { outStream.writeBytes(desc.value().replace(STR, funcName)); if (descFunc.isExtended()) { Set<String> synonyms = FunctionRegistry.getFunctionSynonyms(funcName); if (synonyms.size() > 0) { outStream.writeBytes(STR + join(synonyms, STR)); } if (desc.extended().length() > 0) { outStream.writeBytes("\n" + desc.extended().replace(STR, funcName)); } } } else { if (funcClass != null) { outStream.writeBytes(STR + funcName + "'"); } else { outStream.writeBytes(STR + funcName + STR); } } outStream.write(terminator); } catch (FileNotFoundException e) { LOG.warn(STR + stringifyException(e)); return 1; } catch (IOException e) { LOG.warn(STR + stringifyException(e)); return 1; } catch (Exception e) { throw new HiveException(e); } finally { IOUtils.closeStream(outStream); } return 0; }
/** * Shows a description of a function. * @param db * * @param descFunc * is the function we are describing * @throws HiveException */
Shows a description of a function
describeFunction
{ "repo_name": "BUPTAnderson/apache-hive-2.1.1-src", "path": "ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java", "license": "apache-2.0", "size": 173241 }
[ "java.io.DataOutputStream", "java.io.FileNotFoundException", "java.io.IOException", "java.sql.SQLException", "java.util.Set", "org.apache.commons.lang.StringUtils", "org.apache.hadoop.hive.ql.metadata.Hive", "org.apache.hadoop.hive.ql.metadata.HiveException", "org.apache.hadoop.hive.ql.plan.DescFunc...
import java.io.DataOutputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.SQLException; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.plan.DescFunctionDesc; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.util.StringUtils; import org.apache.hive.common.util.AnnotationUtils;
import java.io.*; import java.sql.*; import java.util.*; import org.apache.commons.lang.*; import org.apache.hadoop.hive.ql.metadata.*; import org.apache.hadoop.hive.ql.plan.*; import org.apache.hadoop.io.*; import org.apache.hadoop.util.*; import org.apache.hive.common.util.*;
[ "java.io", "java.sql", "java.util", "org.apache.commons", "org.apache.hadoop", "org.apache.hive" ]
java.io; java.sql; java.util; org.apache.commons; org.apache.hadoop; org.apache.hive;
2,392,738
private String getAMQPTransportBindAddress() { return AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_BIND_ADDRESS); }
String function() { return AndesConfigurationManager.readValue(AndesConfiguration.TRANSPORTS_AMQP_BIND_ADDRESS); }
/*** * This applies the AMQPbindAddress from broker.xml instead of the hostname from carbon.xml within MB. * @return host name as derived from broker.xml */
This applies the AMQPbindAddress from broker.xml instead of the hostname from carbon.xml within MB
getAMQPTransportBindAddress
{ "repo_name": "ThilankaBowala/carbon-business-messaging", "path": "components/andes/org.wso2.carbon.andes/src/main/java/org/wso2/carbon/andes/internal/QpidServiceComponent.java", "license": "apache-2.0", "size": 21454 }
[ "org.wso2.andes.configuration.AndesConfigurationManager", "org.wso2.andes.configuration.enums.AndesConfiguration" ]
import org.wso2.andes.configuration.AndesConfigurationManager; import org.wso2.andes.configuration.enums.AndesConfiguration;
import org.wso2.andes.configuration.*; import org.wso2.andes.configuration.enums.*;
[ "org.wso2.andes" ]
org.wso2.andes;
2,636,779
public void removeLayoutComponent(Component child) { // You should not be removing stuff from this component. }
void function(Component child) { }
/** * This method removes a child component from the layout. * * @param child The child to remove. */
This method removes a child component from the layout
removeLayoutComponent
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java", "license": "bsd-3-clause", "size": 41982 }
[ "java.awt.Component" ]
import java.awt.Component;
import java.awt.*;
[ "java.awt" ]
java.awt;
968,961
public void setSigma(final int cSigma) throws ImageError { if ((cSigma <= 1) || (cSigma >= nCoeff.length)) { throw new ImageError(ImageError.PACKAGE.ALGORITHM, AlgorithmErrorCodes.PARAMETER_OUT_OF_RANGE, new Integer(cSigma).toString(), new Integer(1).toString(), new Integer(nCoeff.length).toString()); } this.cSigma = cSigma; }
void function(final int cSigma) throws ImageError { if ((cSigma <= 1) (cSigma >= nCoeff.length)) { throw new ImageError(ImageError.PACKAGE.ALGORITHM, AlgorithmErrorCodes.PARAMETER_OUT_OF_RANGE, new Integer(cSigma).toString(), new Integer(1).toString(), new Integer(nCoeff.length).toString()); } this.cSigma = cSigma; }
/** * sets a new value for sigma. Sigma controls the frequency of edges that * the operator responds to. A small sigma value gives higher frequency * edges, while a larger sigma gives lower frequency edges. * * @param cSigma * the new sigma value * @throws ImageError * if cSigma is out of range. */
sets a new value for sigma. Sigma controls the frequency of edges that the operator responds to. A small sigma value gives higher frequency edges, while a larger sigma gives lower frequency edges
setSigma
{ "repo_name": "daleasberry/ojil-core", "path": "src/main/java/com/github/ojil/algorithm/Gray8CannyHoriz.java", "license": "lgpl-3.0", "size": 12976 }
[ "com.github.ojil.core.ImageError" ]
import com.github.ojil.core.ImageError;
import com.github.ojil.core.*;
[ "com.github.ojil" ]
com.github.ojil;
1,325,620
public MirageTask<Void, Void, Bitmap> executeGoTask(MirageTask<Void, Void, Bitmap> task, MirageRequest request) { if (task == null || task.isCancelled()) { return null; } // exit early if the lifecycle is not active. Lifecycle lifecycle = request.lifecycle(); if (lifecycle != null && lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { return null; } // TODO: clean up this duplicate if (request.memoryCache() == null) request.memoryCache(defaultMemoryCache); if (request.diskCache() == null) request.diskCache(defaultDiskCache); if (request.executor() == null) request.executor(defaultExecutor); if (request.urlFactory() == null) request.urlFactory(defaultUrlConnectionFactory); // if the url is blank, fault out immediately // TODO: clean up this duplicate if ((request.uri() == null || TextUtils.isEmpty(request.uri().toString())) && request.provider() == null) { if (request.target() != null) request.target().onError( new IllegalArgumentException("Uri is null"), Source.MEMORY, request); return null; } Bitmap resource; // Check immediately if the resource is in the memory cache MemoryCache<String, Bitmap> memCache = request.memoryCache(); if (memCache != null) { resource = memCache.get(request.getResultKey()); if (resource != null) { if (request.target() != null) request.target().onResult(resource, Source.MEMORY, request); return null; } } // Check immediately if the resource is in the error cache LoadError error = getLoadError(request.provider().id()); if (error != null && error.isValid()) { if (request.target() != null) request.target().onError(error.getException(), Source.MEMORY, request); return null; } Executor executor = request.executor(); if (request.target() != null) request.target().onPreparingLoad(); task.executeOnExecutor(executor); return task; }
MirageTask<Void, Void, Bitmap> function(MirageTask<Void, Void, Bitmap> task, MirageRequest request) { if (task == null task.isCancelled()) { return null; } Lifecycle lifecycle = request.lifecycle(); if (lifecycle != null && lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { return null; } if (request.memoryCache() == null) request.memoryCache(defaultMemoryCache); if (request.diskCache() == null) request.diskCache(defaultDiskCache); if (request.executor() == null) request.executor(defaultExecutor); if (request.urlFactory() == null) request.urlFactory(defaultUrlConnectionFactory); if ((request.uri() == null TextUtils.isEmpty(request.uri().toString())) && request.provider() == null) { if (request.target() != null) request.target().onError( new IllegalArgumentException(STR), Source.MEMORY, request); return null; } Bitmap resource; MemoryCache<String, Bitmap> memCache = request.memoryCache(); if (memCache != null) { resource = memCache.get(request.getResultKey()); if (resource != null) { if (request.target() != null) request.target().onResult(resource, Source.MEMORY, request); return null; } } LoadError error = getLoadError(request.provider().id()); if (error != null && error.isValid()) { if (request.target() != null) request.target().onError(error.getException(), Source.MEMORY, request); return null; } Executor executor = request.executor(); if (request.target() != null) request.target().onPreparingLoad(); task.executeOnExecutor(executor); return task; }
/** * Runs the go task. * * @param task the mirage task * @param request the configured request for the resource to load * @return The AsyncTask responsible for running the request. It could be null if the resource is in the memory cache */
Runs the go task
executeGoTask
{ "repo_name": "TheClimateCorporation/mirage", "path": "library/src/main/java/com/climate/mirage/Mirage.java", "license": "apache-2.0", "size": 20781 }
[ "android.arch.lifecycle.Lifecycle", "android.graphics.Bitmap", "android.text.TextUtils", "com.climate.mirage.cache.memory.MemoryCache", "com.climate.mirage.errors.LoadError", "com.climate.mirage.requests.MirageRequest", "com.climate.mirage.tasks.MirageTask", "java.util.concurrent.Executor" ]
import android.arch.lifecycle.Lifecycle; import android.graphics.Bitmap; import android.text.TextUtils; import com.climate.mirage.cache.memory.MemoryCache; import com.climate.mirage.errors.LoadError; import com.climate.mirage.requests.MirageRequest; import com.climate.mirage.tasks.MirageTask; import java.util.concurrent.Executor;
import android.arch.lifecycle.*; import android.graphics.*; import android.text.*; import com.climate.mirage.cache.memory.*; import com.climate.mirage.errors.*; import com.climate.mirage.requests.*; import com.climate.mirage.tasks.*; import java.util.concurrent.*;
[ "android.arch", "android.graphics", "android.text", "com.climate.mirage", "java.util" ]
android.arch; android.graphics; android.text; com.climate.mirage; java.util;
1,860,560
static Notification constructProgressNotification( Context context, int type, String description, String tickerText, int jobId, String displayName, int totalCount, int currentCount) { // Note: We cannot use extra values here (like setIntExtra()), as PendingIntent doesn't // preserve them across multiple Notifications. PendingIntent preserves the first extras // (when flag is not set), or update them when PendingIntent#getActivity() is called // (See PendingIntent#FLAG_UPDATE_CURRENT). In either case, we cannot preserve extras as we // expect (for each vCard import/export request). // // We use query parameter in Uri instead. // Scheme and Authority is arbitorary, assuming CancelActivity never refers them. final Intent intent = new Intent(context, CancelActivity.class); final Uri uri = (new Uri.Builder()) .scheme("invalidscheme") .authority("invalidauthority") .appendQueryParameter(CancelActivity.JOB_ID, String.valueOf(jobId)) .appendQueryParameter(CancelActivity.DISPLAY_NAME, displayName) .appendQueryParameter(CancelActivity.TYPE, String.valueOf(type)).build(); intent.setData(uri); final Notification.Builder builder = new Notification.Builder(context); builder.setOngoing(true) .setProgress(totalCount, currentCount, totalCount == - 1) .setTicker(tickerText) .setContentTitle(description) .setSmallIcon(type == VCardService.TYPE_IMPORT ? android.R.drawable.stat_sys_download : android.R.drawable.stat_sys_upload) .setContentIntent(PendingIntent.getActivity(context, 0, intent, 0)); if (totalCount > 0) { builder.setContentText(context.getString(R.string.percentage, String.valueOf(currentCount * 100 / totalCount))); } return builder.getNotification(); }
static Notification constructProgressNotification( Context context, int type, String description, String tickerText, int jobId, String displayName, int totalCount, int currentCount) { final Intent intent = new Intent(context, CancelActivity.class); final Uri uri = (new Uri.Builder()) .scheme(STR) .authority(STR) .appendQueryParameter(CancelActivity.JOB_ID, String.valueOf(jobId)) .appendQueryParameter(CancelActivity.DISPLAY_NAME, displayName) .appendQueryParameter(CancelActivity.TYPE, String.valueOf(type)).build(); intent.setData(uri); final Notification.Builder builder = new Notification.Builder(context); builder.setOngoing(true) .setProgress(totalCount, currentCount, totalCount == - 1) .setTicker(tickerText) .setContentTitle(description) .setSmallIcon(type == VCardService.TYPE_IMPORT ? android.R.drawable.stat_sys_download : android.R.drawable.stat_sys_upload) .setContentIntent(PendingIntent.getActivity(context, 0, intent, 0)); if (totalCount > 0) { builder.setContentText(context.getString(R.string.percentage, String.valueOf(currentCount * 100 / totalCount))); } return builder.getNotification(); }
/** * Constructs a {@link Notification} showing the current status of import/export. * Users can cancel the process with the Notification. * * @param context * @param type import/export * @param description Content of the Notification. * @param tickerText * @param jobId * @param displayName Name to be shown to the Notification (e.g. "finished importing XXXX"). * Typycally a file name. * @param totalCount The number of vCard entries to be imported. Used to show progress bar. * -1 lets the system show the progress bar with "indeterminate" state. * @param currentCount The index of current vCard. Used to show progress bar. */
Constructs a <code>Notification</code> showing the current status of import/export. Users can cancel the process with the Notification
constructProgressNotification
{ "repo_name": "risingsunm/Contacts_4.0", "path": "src/com/android/contacts/vcard/NotificationImportExportListener.java", "license": "gpl-2.0", "size": 13300 }
[ "android.app.Notification", "android.app.PendingIntent", "android.content.Context", "android.content.Intent", "android.net.Uri" ]
import android.app.Notification; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.net.Uri;
import android.app.*; import android.content.*; import android.net.*;
[ "android.app", "android.content", "android.net" ]
android.app; android.content; android.net;
1,684,032
@Override public void contributeToToolBar(IToolBarManager toolBarManager) { toolBarManager.add(new Separator("flow-settings")); toolBarManager.add(new Separator("flow-additions")); }
void function(IToolBarManager toolBarManager) { toolBarManager.add(new Separator(STR)); toolBarManager.add(new Separator(STR)); }
/** * This adds Separators for editor additions to the tool bar. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds Separators for editor additions to the tool bar.
contributeToToolBar
{ "repo_name": "INSA-Rennes/TP4INFO", "path": "IDM/IDM.editor/src/robotG/flow/presentation/FlowActionBarContributor.java", "license": "gpl-3.0", "size": 13977 }
[ "org.eclipse.jface.action.IToolBarManager", "org.eclipse.jface.action.Separator" ]
import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
1,865,595
@MXBeanDescription("Pending messages registered.") public long getPendingMessagesRegistered();
@MXBeanDescription(STR) long function();
/** * Gets pending messages registered count. * * @return Pending messages registered count. */
Gets pending messages registered count
getPendingMessagesRegistered
{ "repo_name": "ilantukh/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiMBean.java", "license": "apache-2.0", "size": 8612 }
[ "org.apache.ignite.mxbean.MXBeanDescription" ]
import org.apache.ignite.mxbean.MXBeanDescription;
import org.apache.ignite.mxbean.*;
[ "org.apache.ignite" ]
org.apache.ignite;
443,067
public RoutingNodes routingNodes() { return routingNodes; }
RoutingNodes function() { return routingNodes; }
/** * Get current routing nodes * @return routing nodes */
Get current routing nodes
routingNodes
{ "repo_name": "zkidkid/elasticsearch", "path": "core/src/main/java/org/elasticsearch/cluster/routing/allocation/RoutingAllocation.java", "license": "apache-2.0", "size": 10157 }
[ "org.elasticsearch.cluster.routing.RoutingNodes" ]
import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
23,925
public TIntObjectHashMap getAllMappings() { return idToObject; }
TIntObjectHashMap function() { return idToObject; }
/** * Get all of the objects that are mapped. * @return a map of id to object for all objects * held by this canonical id holder. */
Get all of the objects that are mapped
getAllMappings
{ "repo_name": "papicella/snappy-store", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/CanonicalIdHolder.java", "license": "apache-2.0", "size": 2587 }
[ "com.gemstone.gnu.trove.TIntObjectHashMap" ]
import com.gemstone.gnu.trove.TIntObjectHashMap;
import com.gemstone.gnu.trove.*;
[ "com.gemstone.gnu" ]
com.gemstone.gnu;
672,217
public static String getZKQuorumServersString(Configuration conf) { return getZKQuorumServersStringFromHbaseConfig(conf); }
static String function(Configuration conf) { return getZKQuorumServersStringFromHbaseConfig(conf); }
/** * Return the ZK Quorum servers string given the specified configuration. * @return Quorum servers */
Return the ZK Quorum servers string given the specified configuration
getZKQuorumServersString
{ "repo_name": "mahak/hbase", "path": "hbase-common/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java", "license": "apache-2.0", "size": 14144 }
[ "org.apache.hadoop.conf.Configuration" ]
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
27,637
public List<Criteria> getCriteria() { return criteria; }
List<Criteria> function() { return criteria; }
/** * Gets the list of criteria * * @return list of criteria */
Gets the list of criteria
getCriteria
{ "repo_name": "smartsheet-platform/smartsheet-java-sdk", "path": "src/main/java/com/smartsheet/api/models/SheetFilterDetails.java", "license": "apache-2.0", "size": 2533 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
153,291