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 LineTag findLinkToElementTag(Doclet testMethodDoclet, boolean isOwnedMember) { LineTag bestMatch = null; for (LineTag tag : testMethodDoclet.getLineTags()) { if (isOwnedMember && "testee".equals(tag.getTitle().getTitle())) { bestMatch = tag; // testee always is the best match break; } else if ("testeeFromType".equals(tag.getTitle().getTitle())) { bestMatch = tag; // testeeFromType overrules testeeMember and reqid } else if ("testeeMember".equals(tag.getTitle().getTitle())) { if (bestMatch == null || "reqid".equals(bestMatch.getTitle().getTitle())) { bestMatch = tag; // testeeMember overrules reqid } } else if (isOwnedMember && "reqid".equals(tag.getTitle().getTitle())) { if (bestMatch == null) { bestMatch = tag; // lowes prio } } } return bestMatch; }
LineTag function(Doclet testMethodDoclet, boolean isOwnedMember) { LineTag bestMatch = null; for (LineTag tag : testMethodDoclet.getLineTags()) { if (isOwnedMember && STR.equals(tag.getTitle().getTitle())) { bestMatch = tag; break; } else if (STR.equals(tag.getTitle().getTitle())) { bestMatch = tag; } else if (STR.equals(tag.getTitle().getTitle())) { if (bestMatch == null "reqid".equals(bestMatch.getTitle().getTitle())) { bestMatch = tag; } } else if (isOwnedMember && "reqid".equals(tag.getTitle().getTitle())) { if (bestMatch == null) { bestMatch = tag; } } } return bestMatch; }
/** * Returns the best matching tag which links the test to either a type, member, or reqid. */
Returns the best matching tag which links the test to either a type, member, or reqid
findLinkToElementTag
{ "repo_name": "lbeurerkellner/n4js", "path": "plugins/org.eclipse.n4js.jsdoc2spec/src/org/eclipse/n4js/jsdoc2spec/N4JSDReader.java", "license": "epl-1.0", "size": 14432 }
[ "org.eclipse.n4js.jsdoc.dom.Doclet", "org.eclipse.n4js.jsdoc.dom.LineTag" ]
import org.eclipse.n4js.jsdoc.dom.Doclet; import org.eclipse.n4js.jsdoc.dom.LineTag;
import org.eclipse.n4js.jsdoc.dom.*;
[ "org.eclipse.n4js" ]
org.eclipse.n4js;
128,379
@Generated @Selector("alignment") @NInt public native long alignment();
@Selector(STR) native long function();
/** * The layout of the arrangedSubviews transverse to the axis; * e.g., leading/trailing edges in a vertical stack */
The layout of the arrangedSubviews transverse to the axis; e.g., leading/trailing edges in a vertical stack
alignment
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIStackView.java", "license": "apache-2.0", "size": 25877 }
[ "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,052,193
public void close() { synchronized (portLock) { logger.info("Closing DSMR port"); portState = PortState.CLOSED; // Close resources if (bis != null) { try { bis.close(); } catch (IOException ioe) { logger.debug("Failed to close reader", ioe); } } if (serialPort != null) { serialPort.close(); } // Release resources bis = null; serialPort = null; } }
void function() { synchronized (portLock) { logger.info(STR); portState = PortState.CLOSED; if (bis != null) { try { bis.close(); } catch (IOException ioe) { logger.debug(STR, ioe); } } if (serialPort != null) { serialPort.close(); } bis = null; serialPort = null; } }
/** * Closes the DSMRPort and release OS resources */
Closes the DSMRPort and release OS resources
close
{ "repo_name": "rahulopengts/myhome", "path": "bundles/binding/org.openhab.binding.dsmr/src/main/java/org/openhab/binding/dsmr/internal/DSMRPort.java", "license": "epl-1.0", "size": 10517 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,223,000
@FIXVersion(introduced = "5.0SP1") @TagNumRef(tagNum = TagNum.DerivativeMaturityTime) public void setDerivativeMaturityTime(Date derivativeMaturityTime) { this.derivativeMaturityTime = derivativeMaturityTime; }
@FIXVersion(introduced = STR) @TagNumRef(tagNum = TagNum.DerivativeMaturityTime) void function(Date derivativeMaturityTime) { this.derivativeMaturityTime = derivativeMaturityTime; }
/** * Message field setter. * @param derivativeMaturityTime field value */
Message field setter
setDerivativeMaturityTime
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/comp/DerivativeInstrument.java", "license": "gpl-3.0", "size": 83551 }
[ "java.util.Date", "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.TagNum" ]
import java.util.Date; import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum;
import java.util.*; import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "java.util", "net.hades.fix" ]
java.util; net.hades.fix;
2,057,146
public java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI> getSubterm_strings_LessThanHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.strings.impl.LessThanImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI( (fr.lip6.move.pnml.hlpn.strings.LessThan)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.strings.impl.LessThanImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.strings.hlapi.LessThanHLAPI( (fr.lip6.move.pnml.hlpn.strings.LessThan)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of LessThanHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_strings_LessThanHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/booleans/hlapi/InequalityHLAPI.java", "license": "epl-1.0", "size": 108490 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,910,187
public void onRecordingStopped(Uri recordedProgramUri) { } /** * This is called when an issue has occurred. It may be called at any time after the current * recording session is created until it is released. * * @param error The error code. Should be one of the followings. * <ul> * <li>{@link TvInputManager#RECORDING_ERROR_UNKNOWN} * <li>{@link TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE} * <li>{@link TvInputManager#RECORDING_ERROR_RESOURCE_BUSY}
void function(Uri recordedProgramUri) { } /** * This is called when an issue has occurred. It may be called at any time after the current * recording session is created until it is released. * * @param error The error code. Should be one of the followings. * <ul> * <li>{@link TvInputManager#RECORDING_ERROR_UNKNOWN} * <li>{@link TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE} * <li>{@link TvInputManager#RECORDING_ERROR_RESOURCE_BUSY}
/** * This is called when the current recording session has stopped recording and created a * new data entry in the {@link TvContract.RecordedPrograms} table that describes the newly * recorded program. * * @param recordedProgramUri The URI for the newly recorded program. */
This is called when the current recording session has stopped recording and created a new data entry in the <code>TvContract.RecordedPrograms</code> table that describes the newly recorded program
onRecordingStopped
{ "repo_name": "xorware/android_frameworks_base", "path": "media/java/android/media/tv/TvRecordingClient.java", "license": "apache-2.0", "size": 16234 }
[ "android.media.tv.TvInputManager", "android.net.Uri" ]
import android.media.tv.TvInputManager; import android.net.Uri;
import android.media.tv.*; import android.net.*;
[ "android.media", "android.net" ]
android.media; android.net;
65,827
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; informationPanel = new javax.swing.JPanel(); infoPanel = new javax.swing.JPanel(); title = new javax.swing.JLabel(); yearValue = new javax.swing.JLabel(); authors = new javax.swing.JLabel(); genresValue = new javax.swing.JLabel(); statusValue = new javax.swing.JLabel(); vote_averageValue = new javax.swing.JLabel(); goToHomepage = new javax.swing.JButton(); rateBar = new com.luxoboy.collectionmanager.view.RateBar(); descriptionPanel = new javax.swing.JPanel(); addButton = new javax.swing.JButton(); descriptionScrollPane = new javax.swing.JScrollPane(); descriptionText = new javax.swing.JTextArea(); picturePanel = new javax.swing.JPanel(); backButton = new com.luxoboy.collectionmanager.view.BackButton(); setLayout(new java.awt.GridBagLayout()); informationPanel.setLayout(new java.awt.GridBagLayout()); infoPanel.setLayout(new java.awt.GridBagLayout()); title.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N title.setText("Title"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; infoPanel.add(title, gridBagConstraints); yearValue.setFont(new java.awt.Font("Calibri", 2, 18)); // NOI18N yearValue.setText("00/00/00"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; infoPanel.add(yearValue, gridBagConstraints); createdBy.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N createdBy.setText("Created by"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(createdBy, gridBagConstraints); authors.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N authors.setText("Vince Gilligan"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(authors, gridBagConstraints); genres.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N genres.setText("Genres"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(genres, gridBagConstraints); genresValue.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N genresValue.setText("Drama"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(genresValue, gridBagConstraints); status.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N status.setText("Status"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(status, gridBagConstraints); statusValue.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N statusValue.setText("Ended"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(statusValue, gridBagConstraints); vote_average.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N vote_average.setText("Vote average"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(vote_average, gridBagConstraints); vote_averageValue.setFont(new java.awt.Font("Calibri", 1, 14)); // NOI18N vote_averageValue.setText("9.1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(vote_averageValue, gridBagConstraints);
@SuppressWarnings(STR) void function() { java.awt.GridBagConstraints gridBagConstraints; informationPanel = new javax.swing.JPanel(); infoPanel = new javax.swing.JPanel(); title = new javax.swing.JLabel(); yearValue = new javax.swing.JLabel(); authors = new javax.swing.JLabel(); genresValue = new javax.swing.JLabel(); statusValue = new javax.swing.JLabel(); vote_averageValue = new javax.swing.JLabel(); goToHomepage = new javax.swing.JButton(); rateBar = new com.luxoboy.collectionmanager.view.RateBar(); descriptionPanel = new javax.swing.JPanel(); addButton = new javax.swing.JButton(); descriptionScrollPane = new javax.swing.JScrollPane(); descriptionText = new javax.swing.JTextArea(); picturePanel = new javax.swing.JPanel(); backButton = new com.luxoboy.collectionmanager.view.BackButton(); setLayout(new java.awt.GridBagLayout()); informationPanel.setLayout(new java.awt.GridBagLayout()); infoPanel.setLayout(new java.awt.GridBagLayout()); title.setFont(new java.awt.Font(STR, 1, 24)); title.setText("Title"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; infoPanel.add(title, gridBagConstraints); yearValue.setFont(new java.awt.Font(STR, 2, 18)); yearValue.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; infoPanel.add(yearValue, gridBagConstraints); createdBy.setFont(new java.awt.Font(STR, 0, 14)); createdBy.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(createdBy, gridBagConstraints); authors.setFont(new java.awt.Font(STR, 1, 14)); authors.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(authors, gridBagConstraints); genres.setFont(new java.awt.Font(STR, 0, 14)); genres.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(genres, gridBagConstraints); genresValue.setFont(new java.awt.Font(STR, 1, 14)); genresValue.setText("Drama"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(genresValue, gridBagConstraints); status.setFont(new java.awt.Font(STR, 0, 14)); status.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(status, gridBagConstraints); statusValue.setFont(new java.awt.Font(STR, 1, 14)); statusValue.setText("Ended"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(statusValue, gridBagConstraints); vote_average.setFont(new java.awt.Font(STR, 0, 14)); vote_average.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(vote_average, gridBagConstraints); vote_averageValue.setFont(new java.awt.Font(STR, 1, 14)); vote_averageValue.setText("9.1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; infoPanel.add(vote_averageValue, gridBagConstraints);
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */
This method is called from within the constructor to initialize the form. regenerated by the Form Editor
initComponents
{ "repo_name": "Luxoboy/CollectionManager", "path": "com/luxoboy/collectionmanager/view/MovieDetailsView.java", "license": "mit", "size": 14532 }
[ "javax.swing.JLabel" ]
import javax.swing.JLabel;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
587,530
public boolean printData(PrintWriter out, int iPrintOptions) { if (this.getProperty(DBParams.XML) != null) return this.getScreenFieldView().printData(out, iPrintOptions); else return super.printData(out, iPrintOptions); }
boolean function(PrintWriter out, int iPrintOptions) { if (this.getProperty(DBParams.XML) != null) return this.getScreenFieldView().printData(out, iPrintOptions); else return super.printData(out, iPrintOptions); }
/** * Display this screen in html input format. * @return true if default params were found for this form. * @param out The http output stream. * @exception DBException File exception. */
Display this screen in html input format
printData
{ "repo_name": "jbundle/jbundle", "path": "base/screen/model/src/main/java/org/jbundle/base/screen/model/report/BaseParserScreen.java", "license": "gpl-3.0", "size": 5384 }
[ "java.io.PrintWriter", "org.jbundle.base.model.DBParams" ]
import java.io.PrintWriter; import org.jbundle.base.model.DBParams;
import java.io.*; import org.jbundle.base.model.*;
[ "java.io", "org.jbundle.base" ]
java.io; org.jbundle.base;
441,457
@Test public void testGetListUnknownWithDefault() { PropertiesConfiguration config = new PropertiesConfiguration(); List<Integer> defValue = Arrays.asList(1, 2, 3); assertEquals("Wrong result", defValue, config.getList(Integer.class, KEY_PREFIX, defValue)); }
void function() { PropertiesConfiguration config = new PropertiesConfiguration(); List<Integer> defValue = Arrays.asList(1, 2, 3); assertEquals(STR, defValue, config.getList(Integer.class, KEY_PREFIX, defValue)); }
/** * Tests a conversion to a list if the property is unknown and a default * list is provided. */
Tests a conversion to a list if the property is unknown and a default list is provided
testGetListUnknownWithDefault
{ "repo_name": "mohanaraosv/commons-configuration", "path": "src/test/java/org/apache/commons/configuration2/TestAbstractConfigurationBasicFeatures.java", "license": "apache-2.0", "size": 42180 }
[ "java.util.Arrays", "java.util.List", "org.junit.Assert" ]
import java.util.Arrays; import java.util.List; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,818,275
public ListenableFuture<StompSession> connect(String url, WebSocketHttpHeaders handshakeHeaders, StompHeaders connectHeaders, StompSessionHandler handler, Object... uriVariables) { Assert.notNull(url, "'url' must not be null"); URI uri = UriComponentsBuilder.fromUriString(url).buildAndExpand(uriVariables).encode().toUri(); return connect(uri, handshakeHeaders, connectHeaders, handler); } /** * An overloaded version of * {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
ListenableFuture<StompSession> function(String url, WebSocketHttpHeaders handshakeHeaders, StompHeaders connectHeaders, StompSessionHandler handler, Object... uriVariables) { Assert.notNull(url, STR); URI uri = UriComponentsBuilder.fromUriString(url).buildAndExpand(uriVariables).encode().toUri(); return connect(uri, handshakeHeaders, connectHeaders, handler); } /** * An overloaded version of * {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
/** * An overloaded version of * {@link #connect(String, StompSessionHandler, Object...)} that also accepts * {@link WebSocketHttpHeaders} to use for the WebSocket handshake and * {@link StompHeaders} for the STOMP CONNECT frame. * @param url the url to connect to * @param handshakeHeaders headers for the WebSocket handshake * @param connectHeaders headers for the STOMP CONNECT frame * @param handler the session handler * @param uriVariables URI variables to expand into the URL * @return ListenableFuture for access to the session when ready for use */
An overloaded version of <code>#connect(String, StompSessionHandler, Object...)</code> that also accepts <code>WebSocketHttpHeaders</code> to use for the WebSocket handshake and <code>StompHeaders</code> for the STOMP CONNECT frame
connect
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.websocket/org/springframework/web/socket/messaging/WebSocketStompClient.java", "license": "mit", "size": 16783 }
[ "org.springframework.messaging.simp.stomp.StompHeaders", "org.springframework.messaging.simp.stomp.StompSession", "org.springframework.messaging.simp.stomp.StompSessionHandler", "org.springframework.util.Assert", "org.springframework.util.concurrent.ListenableFuture", "org.springframework.web.socket.WebSocketHttpHeaders", "org.springframework.web.util.UriComponentsBuilder" ]
import org.springframework.messaging.simp.stomp.StompHeaders; import org.springframework.messaging.simp.stomp.StompSession; import org.springframework.messaging.simp.stomp.StompSessionHandler; import org.springframework.util.Assert; import org.springframework.util.concurrent.ListenableFuture; import org.springframework.web.socket.WebSocketHttpHeaders; import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.messaging.simp.stomp.*; import org.springframework.util.*; import org.springframework.util.concurrent.*; import org.springframework.web.socket.*; import org.springframework.web.util.*;
[ "org.springframework.messaging", "org.springframework.util", "org.springframework.web" ]
org.springframework.messaging; org.springframework.util; org.springframework.web;
1,108,189
@SuppressWarnings("unchecked") public static DBInterface getDBInterface() throws JDtnException { try { // XXX Should we make this a singleton? String dbClassName = BPManagement.getInstance().getDbInterfaceClassName(); Class<DBInterface> dbifClass = null; dbifClass = (Class<DBInterface>)Class.forName( dbClassName); DBInterface dbif = dbifClass.newInstance(); return dbif; } catch (ClassNotFoundException e) { throw new JDtnException(e); } catch (InstantiationException e) { throw new JDtnException(e); } catch (IllegalAccessException e) { throw new JDtnException(e); } }
@SuppressWarnings(STR) static DBInterface function() throws JDtnException { try { String dbClassName = BPManagement.getInstance().getDbInterfaceClassName(); Class<DBInterface> dbifClass = null; dbifClass = (Class<DBInterface>)Class.forName( dbClassName); DBInterface dbif = dbifClass.newInstance(); return dbif; } catch (ClassNotFoundException e) { throw new JDtnException(e); } catch (InstantiationException e) { throw new JDtnException(e); } catch (IllegalAccessException e) { throw new JDtnException(e); } }
/** * Get an instance of DBInterface, an interface to a SQL database. * @return Instance of DBInterface specific to the platform. * @throws JDtnException on errors */
Get an instance of DBInterface, an interface to a SQL database
getDBInterface
{ "repo_name": "KritikalFabric/corefabric.io", "path": "src/contrib/java/com/cisco/qte/jdtn/general/Platform.java", "license": "apache-2.0", "size": 4238 }
[ "com.cisco.qte.jdtn.bp.BPManagement", "com.cisco.qte.jdtn.persistance.DBInterface" ]
import com.cisco.qte.jdtn.bp.BPManagement; import com.cisco.qte.jdtn.persistance.DBInterface;
import com.cisco.qte.jdtn.bp.*; import com.cisco.qte.jdtn.persistance.*;
[ "com.cisco.qte" ]
com.cisco.qte;
1,643,224
@Test public void testGrabbingImagesFromQuay() { ContainersApi containersApi = setupWebService(); DockstoreTool tool = containersApi.getContainerByToolPath(QUAY_TOOL_PATH, null); assertEquals(0, containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(0).getImages().size()); UsersApi usersApi = new UsersApi(containersApi.getApiClient()); final Long userid = usersApi.getUser().getId(); usersApi.refreshToolsByOrganization(userid, "dockstoretestuser2", DOCKSTORE_TOOL_IMPORTS); // Check that the image information has been grabbed on refresh. List<Tag> tags = containersApi.getContainer(tool.getId(), null).getWorkflowVersions(); for (Tag tag : tags) { assertNotNull(tag.getImages().get(0).getChecksums().get(0).getType()); assertNotNull(tag.getImages().get(0).getChecksums().get(0).getChecksum()); } // Check for case where user deletes tag and creates new one of same name. // Check that the new imageid and checksums are grabbed from Quay on refresh. Also check the old images have been deleted. String imageID = tags.get(0).getImages().get(0).getImageID(); String imageID2 = tags.get(1).getImages().get(0).getImageID(); final long count = testingPostgres.runSelectStatement("select count(*) from image", long.class); testingPostgres.runUpdateStatement("update image set image_id = 'dummyid'"); assertEquals("dummyid", containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(0).getImages().get(0).getImageID()); usersApi.refreshToolsByOrganization(userid, "dockstoretestuser2", DOCKSTORE_TOOL_IMPORTS); final long count2 = testingPostgres.runSelectStatement("select count(*) from image", long.class); assertEquals(imageID, containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(0).getImages().get(0).getImageID()); assertEquals(imageID2, containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(1).getImages().get(0).getImageID()); assertEquals(count, count2); }
void function() { ContainersApi containersApi = setupWebService(); DockstoreTool tool = containersApi.getContainerByToolPath(QUAY_TOOL_PATH, null); assertEquals(0, containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(0).getImages().size()); UsersApi usersApi = new UsersApi(containersApi.getApiClient()); final Long userid = usersApi.getUser().getId(); usersApi.refreshToolsByOrganization(userid, STR, DOCKSTORE_TOOL_IMPORTS); List<Tag> tags = containersApi.getContainer(tool.getId(), null).getWorkflowVersions(); for (Tag tag : tags) { assertNotNull(tag.getImages().get(0).getChecksums().get(0).getType()); assertNotNull(tag.getImages().get(0).getChecksums().get(0).getChecksum()); } String imageID = tags.get(0).getImages().get(0).getImageID(); String imageID2 = tags.get(1).getImages().get(0).getImageID(); final long count = testingPostgres.runSelectStatement(STR, long.class); testingPostgres.runUpdateStatement(STR); assertEquals(STR, containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(0).getImages().get(0).getImageID()); usersApi.refreshToolsByOrganization(userid, STR, DOCKSTORE_TOOL_IMPORTS); final long count2 = testingPostgres.runSelectStatement(STR, long.class); assertEquals(imageID, containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(0).getImages().get(0).getImageID()); assertEquals(imageID2, containersApi.getContainer(tool.getId(), null).getWorkflowVersions().get(1).getImages().get(0).getImageID()); assertEquals(count, count2); }
/** * Tests that image and checksum information can be grabbed from Quay and update db correctly. */
Tests that image and checksum information can be grabbed from Quay and update db correctly
testGrabbingImagesFromQuay
{ "repo_name": "ga4gh/dockstore", "path": "dockstore-integration-testing/src/test/java/io/dockstore/client/cli/GeneralIT.java", "license": "apache-2.0", "size": 91354 }
[ "io.swagger.client.api.ContainersApi", "io.swagger.client.api.UsersApi", "io.swagger.client.model.DockstoreTool", "io.swagger.client.model.Tag", "java.util.List", "org.junit.Assert" ]
import io.swagger.client.api.ContainersApi; import io.swagger.client.api.UsersApi; import io.swagger.client.model.DockstoreTool; import io.swagger.client.model.Tag; import java.util.List; import org.junit.Assert;
import io.swagger.client.api.*; import io.swagger.client.model.*; import java.util.*; import org.junit.*;
[ "io.swagger.client", "java.util", "org.junit" ]
io.swagger.client; java.util; org.junit;
1,704,166
private JSDocInfo parseInlineTypeDoc(Comment node) { String comment = node.value; int lineno = lineno(node.location.start); int charno = charno(node.location.start); // The JsDocInfoParser expects the comment without the initial '/**'. int numOpeningChars = 3; JsDocInfoParser parser = new JsDocInfoParser( new JsDocTokenStream(comment.substring(numOpeningChars), lineno, charno + numOpeningChars), comment, node.location.start.offset, null, sourceFile, config, errorReporter); return parser.parseInlineTypeDoc(); }
JSDocInfo function(Comment node) { String comment = node.value; int lineno = lineno(node.location.start); int charno = charno(node.location.start); int numOpeningChars = 3; JsDocInfoParser parser = new JsDocInfoParser( new JsDocTokenStream(comment.substring(numOpeningChars), lineno, charno + numOpeningChars), comment, node.location.start.offset, null, sourceFile, config, errorReporter); return parser.parseInlineTypeDoc(); }
/** * Parses inline type info. */
Parses inline type info
parseInlineTypeDoc
{ "repo_name": "blickly/closure-compiler", "path": "src/com/google/javascript/jscomp/parsing/NewIRFactory.java", "license": "apache-2.0", "size": 76799 }
[ "com.google.javascript.jscomp.parsing.parser.trees.Comment", "com.google.javascript.rhino.JSDocInfo" ]
import com.google.javascript.jscomp.parsing.parser.trees.Comment; import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.jscomp.parsing.parser.trees.*; import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,811,335
DBCTrace getExecutionTrace();
DBCTrace getExecutionTrace();
/** * Returns execution trace. * Returns null if trace is not enabled. */
Returns execution trace. Returns null if trace is not enabled
getExecutionTrace
{ "repo_name": "dbeaver/dbeaver", "path": "plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/exec/DBCResultSetTrace.java", "license": "apache-2.0", "size": 944 }
[ "org.jkiss.dbeaver.model.exec.trace.DBCTrace" ]
import org.jkiss.dbeaver.model.exec.trace.DBCTrace;
import org.jkiss.dbeaver.model.exec.trace.*;
[ "org.jkiss.dbeaver" ]
org.jkiss.dbeaver;
2,638,695
public static QuotaType toQuotaScope(final QuotaProtos.QuotaType proto) { switch (proto) { case THROTTLE: return QuotaType.THROTTLE; case SPACE: return QuotaType.SPACE; } throw new RuntimeException("Invalid QuotaType " + proto); }
static QuotaType function(final QuotaProtos.QuotaType proto) { switch (proto) { case THROTTLE: return QuotaType.THROTTLE; case SPACE: return QuotaType.SPACE; } throw new RuntimeException(STR + proto); }
/** * Convert a protocol buffer QuotaType to a client QuotaType * * @param proto * @return the converted client QuotaType */
Convert a protocol buffer QuotaType to a client QuotaType
toQuotaScope
{ "repo_name": "ultratendency/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java", "license": "apache-2.0", "size": 132790 }
[ "org.apache.hadoop.hbase.quotas.QuotaType", "org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos" ]
import org.apache.hadoop.hbase.quotas.QuotaType; import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos;
import org.apache.hadoop.hbase.quotas.*; import org.apache.hadoop.hbase.shaded.protobuf.generated.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,562,113
public String getMaxChangeDate() { String data = null; try { List<Feature> response = featureRepo .findTopByCollectorIdAndChangeDateGreaterThanOrderByChangeDateDesc( featureCollectorRepository.findByName(FeatureCollectorConstants.JIRA).getId(), featureSettings.getDeltaStartDate()); if ((response != null) && !response.isEmpty()) { data = response.get(0).getChangeDate(); } } catch (Exception e) { LOGGER.error("There was a problem retrieving or parsing data from the local " + "repository while retrieving a max change date\nReturning null", e); } return data; }
String function() { String data = null; try { List<Feature> response = featureRepo .findTopByCollectorIdAndChangeDateGreaterThanOrderByChangeDateDesc( featureCollectorRepository.findByName(FeatureCollectorConstants.JIRA).getId(), featureSettings.getDeltaStartDate()); if ((response != null) && !response.isEmpty()) { data = response.get(0).getChangeDate(); } } catch (Exception e) { LOGGER.error(STR + STR, e); } return data; }
/** * Retrieves the maximum change date for a given query. * * @return A list object of the maximum change date */
Retrieves the maximum change date for a given query
getMaxChangeDate
{ "repo_name": "wolfspyre/Hygieia", "path": "collectors/feature/jira/src/main/java/com/capitalone/dashboard/client/story/StoryDataClientImpl.java", "license": "apache-2.0", "size": 26294 }
[ "com.capitalone.dashboard.model.Feature", "com.capitalone.dashboard.util.FeatureCollectorConstants", "java.util.List" ]
import com.capitalone.dashboard.model.Feature; import com.capitalone.dashboard.util.FeatureCollectorConstants; import java.util.List;
import com.capitalone.dashboard.model.*; import com.capitalone.dashboard.util.*; import java.util.*;
[ "com.capitalone.dashboard", "java.util" ]
com.capitalone.dashboard; java.util;
2,828,325
public static String makePostRequest(URL url, Map<String, String> parameters) throws IOException { return GoogleAuthTokenFactory.makePostRequest(url, parameters); }
static String function(URL url, Map<String, String> parameters) throws IOException { return GoogleAuthTokenFactory.makePostRequest(url, parameters); }
/** * Makes a HTTP POST request to the provided {@code url} given the * provided {@code parameters}. It returns the output from the POST * handler as a String object. * * @param url the URL to post the request * @param parameters the parameters to post to the handler * @return the output from the handler * @throws IOException if an I/O exception occurs while creating, writing, * or reading the request */
Makes a HTTP POST request to the provided url given the provided parameters. It returns the output from the POST handler as a String object
makePostRequest
{ "repo_name": "ermh/Gdata-mavenized", "path": "java/src/com/google/gdata/client/GoogleService.java", "license": "apache-2.0", "size": 26971 }
[ "java.io.IOException", "java.util.Map" ]
import java.io.IOException; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
370,326
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.legendLine = SerialUtilities.readShape(stream); }
void function(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.legendLine = SerialUtilities.readShape(stream); }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */
Provides serialization support
readObject
{ "repo_name": "fluidware/Eastwood-Charts", "path": "source/org/jfree/chart/renderer/xy/StandardXYItemRenderer.java", "license": "lgpl-2.1", "size": 41764 }
[ "java.io.IOException", "java.io.ObjectInputStream", "org.jfree.io.SerialUtilities" ]
import java.io.IOException; import java.io.ObjectInputStream; import org.jfree.io.SerialUtilities;
import java.io.*; import org.jfree.io.*;
[ "java.io", "org.jfree.io" ]
java.io; org.jfree.io;
1,725,800
@Override public void refresh(Object entity, Map<String, Object> properties) { refresh(entity, null, properties); }
void function(Object entity, Map<String, Object> properties) { refresh(entity, null, properties); }
/** * Refresh the state of the instance from the database, using the specified * properties, and overwriting changes made to the entity, if any. If a * vendor-specific property or hint is not recognized, it is silently * ignored. * * @param entity * @param properties * standard and vendor-specific properties * @throws IllegalArgumentException * if the instance is not an entity or the entity is not managed * @throws TransactionRequiredException * if invoked on a container-managed entity manager of type * PersistenceContextType.TRANSACTION and there is no * transaction. * @throws EntityNotFoundException * if the entity no longer exists in the database * * @since Java Persistence API 2.0 */
Refresh the state of the instance from the database, using the specified properties, and overwriting changes made to the entity, if any. If a vendor-specific property or hint is not recognized, it is silently ignored
refresh
{ "repo_name": "gameduell/eclipselink.runtime", "path": "jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/EntityManagerImpl.java", "license": "epl-1.0", "size": 135266 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,338,835
public void waitForIdle(long timeoutMs) throws InterruptedException { Random rand = ThreadLocalRandom.current(); //wait until all workers, supervisors, and nimbus is waiting final long endTime = System.currentTimeMillis() + timeoutMs; while (!(nimbus.isWaiting() && areAllSupervisorsWaiting() && areAllWorkersWaiting())) { if (System.currentTimeMillis() >= endTime) { LOG.info("Cluster was not idle in {} ms", timeoutMs); LOG.info(Utils.threadDump()); throw new AssertionError("Test timed out (" + timeoutMs + "ms) cluster not idle"); } Thread.sleep(rand.nextInt(20)); } }
void function(long timeoutMs) throws InterruptedException { Random rand = ThreadLocalRandom.current(); final long endTime = System.currentTimeMillis() + timeoutMs; while (!(nimbus.isWaiting() && areAllSupervisorsWaiting() && areAllWorkersWaiting())) { if (System.currentTimeMillis() >= endTime) { LOG.info(STR, timeoutMs); LOG.info(Utils.threadDump()); throw new AssertionError(STR + timeoutMs + STR); } Thread.sleep(rand.nextInt(20)); } }
/** * Wait for the cluster to be idle. This is intended to be used with * Simulated time and is for internal testing. * @param timeoutMs the number of ms to wait before throwing an error. * @throws InterruptedException if interrupted while waiting. * @throws AssertionError if the cluster did not come to an idle point with * a timeout. */
Wait for the cluster to be idle. This is intended to be used with Simulated time and is for internal testing
waitForIdle
{ "repo_name": "hmcc/storm", "path": "storm-server/src/main/java/org/apache/storm/LocalCluster.java", "license": "apache-2.0", "size": 44006 }
[ "java.util.Random", "java.util.concurrent.ThreadLocalRandom", "org.apache.storm.utils.Utils" ]
import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import org.apache.storm.utils.Utils;
import java.util.*; import java.util.concurrent.*; import org.apache.storm.utils.*;
[ "java.util", "org.apache.storm" ]
java.util; org.apache.storm;
2,367,858
static void configureStoragePolicy(final Configuration conf, final FileSystem fs, byte[] tableAndFamily, Path cfPath) { if (null == conf || null == fs || null == tableAndFamily || null == cfPath) { return; } String policy = conf.get(STORAGE_POLICY_PROPERTY_CF_PREFIX + Bytes.toString(tableAndFamily), conf.get(STORAGE_POLICY_PROPERTY)); FSUtils.setStoragePolicy(fs, cfPath, policy); } static class WriterLength { long written = 0; StoreFileWriter writer = null; }
static void configureStoragePolicy(final Configuration conf, final FileSystem fs, byte[] tableAndFamily, Path cfPath) { if (null == conf null == fs null == tableAndFamily null == cfPath) { return; } String policy = conf.get(STORAGE_POLICY_PROPERTY_CF_PREFIX + Bytes.toString(tableAndFamily), conf.get(STORAGE_POLICY_PROPERTY)); FSUtils.setStoragePolicy(fs, cfPath, policy); } static class WriterLength { long written = 0; StoreFileWriter writer = null; }
/** * Configure block storage policy for CF after the directory is created. */
Configure block storage policy for CF after the directory is created
configureStoragePolicy
{ "repo_name": "gustavoanatoly/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java", "license": "apache-2.0", "size": 38612 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.regionserver.StoreFileWriter", "org.apache.hadoop.hbase.util.Bytes", "org.apache.hadoop.hbase.util.FSUtils" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.regionserver.StoreFileWriter; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.FSUtils;
import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,867,902
public static Job create(EntityManager em, JobCreator jobCreator) throws KapuaException { // // Create Job JobImpl jobImpl = new JobImpl(jobCreator.getScopeId()); jobImpl.setName(jobCreator.getName()); jobImpl.setDescription(jobCreator.getDescription()); return ServiceDAO.create(em, jobImpl); }
static Job function(EntityManager em, JobCreator jobCreator) throws KapuaException { JobImpl jobImpl = new JobImpl(jobCreator.getScopeId()); jobImpl.setName(jobCreator.getName()); jobImpl.setDescription(jobCreator.getDescription()); return ServiceDAO.create(em, jobImpl); }
/** * Creates and return new Job * * @param em * @param jobCreator * @return * @throws KapuaException */
Creates and return new Job
create
{ "repo_name": "stzilli/kapua", "path": "service/job/internal/src/main/java/org/eclipse/kapua/service/job/internal/JobDAO.java", "license": "epl-1.0", "size": 3791 }
[ "org.eclipse.kapua.KapuaException", "org.eclipse.kapua.commons.jpa.EntityManager", "org.eclipse.kapua.commons.service.internal.ServiceDAO", "org.eclipse.kapua.service.job.Job", "org.eclipse.kapua.service.job.JobCreator" ]
import org.eclipse.kapua.KapuaException; import org.eclipse.kapua.commons.jpa.EntityManager; import org.eclipse.kapua.commons.service.internal.ServiceDAO; import org.eclipse.kapua.service.job.Job; import org.eclipse.kapua.service.job.JobCreator;
import org.eclipse.kapua.*; import org.eclipse.kapua.commons.jpa.*; import org.eclipse.kapua.commons.service.internal.*; import org.eclipse.kapua.service.job.*;
[ "org.eclipse.kapua" ]
org.eclipse.kapua;
1,335,631
@SuppressWarnings("unchecked") public void testGetAnnotationEnumDefaults_defaultNotFound() { configuration.remove("ModuleUtilsTest.TestModule.ModuleUtilsTest.TestAnnotation2.testEnum.default"); Map<Class<? extends Annotation>, Map<String, String>> result = getAnnotationPropertyDefaults(TestModule.class, configuration, TestAnnotation1.class, TestAnnotation2.class); TestEnum enumValue1 = getEnumValueReplaceDefault(TestAnnotation1.class, "testEnum", TestEnum.DEFAULT, result); assertSame(TestEnum.VALUE1, enumValue1); try { getEnumValueReplaceDefault(TestAnnotation2.class, "testEnum", TestEnum.DEFAULT, result); fail("Expected UnitilsException"); } catch (UnitilsException e) { // expected } }
@SuppressWarnings(STR) void function() { configuration.remove(STR); Map<Class<? extends Annotation>, Map<String, String>> result = getAnnotationPropertyDefaults(TestModule.class, configuration, TestAnnotation1.class, TestAnnotation2.class); TestEnum enumValue1 = getEnumValueReplaceDefault(TestAnnotation1.class, STR, TestEnum.DEFAULT, result); assertSame(TestEnum.VALUE1, enumValue1); try { getEnumValueReplaceDefault(TestAnnotation2.class, STR, TestEnum.DEFAULT, result); fail(STR); } catch (UnitilsException e) { } }
/** * Test the loading of the default values. TestAnnotation2 has no default value configured. * Default for test enum in annotation 1 should still be loaded correctly. */
Test the loading of the default values. TestAnnotation2 has no default value configured. Default for test enum in annotation 1 should still be loaded correctly
testGetAnnotationEnumDefaults_defaultNotFound
{ "repo_name": "arteam/unitils", "path": "unitils-test/src/test/java/org/unitils/util/ModuleUtilsTest.java", "license": "apache-2.0", "size": 7566 }
[ "java.lang.annotation.Annotation", "java.util.Map", "org.unitils.core.UnitilsException", "org.unitils.util.ModuleUtils" ]
import java.lang.annotation.Annotation; import java.util.Map; import org.unitils.core.UnitilsException; import org.unitils.util.ModuleUtils;
import java.lang.annotation.*; import java.util.*; import org.unitils.core.*; import org.unitils.util.*;
[ "java.lang", "java.util", "org.unitils.core", "org.unitils.util" ]
java.lang; java.util; org.unitils.core; org.unitils.util;
1,300,068
public DataObject createDataObject(SecurityContext ctx, DataObject newObject, DataObject parent, Collection children) throws DSOutOfServiceException, DSAccessException;
DataObject function(SecurityContext ctx, DataObject newObject, DataObject parent, Collection children) throws DSOutOfServiceException, DSAccessException;
/** * Creates a new <code>DataObject</code> and links it to the specified * parent. The parent will be <code>null</code> if the * <code>DataObject</code> to create is either a <code>Project</code>. * * @param ctx The security context. * @param newObject The <code>DataObject</code> to create. * Mustn't be <code>null</code>. * @param parent The parent of the <code>DataObject</code> or Can be * <code>null</code> if no parent specified. * @param children The nodes to add to the newly created * <code>DataObject</code>. * @return The newly created <code>DataObject</code> * @throws DSOutOfServiceException If the connection is broken, or logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. */
Creates a new <code>DataObject</code> and links it to the specified parent. The parent will be <code>null</code> if the <code>DataObject</code> to create is either a <code>Project</code>
createDataObject
{ "repo_name": "joansmith/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OmeroDataService.java", "license": "gpl-2.0", "size": 20864 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
882,502
public SessionBuilder setSurfaceHolder(SurfaceHolder surfaceHolder) { mSurfaceHolder = surfaceHolder; return this; }
SessionBuilder function(SurfaceHolder surfaceHolder) { mSurfaceHolder = surfaceHolder; return this; }
/** * Sets the Surface required by MediaRecorder to record video. * @param surfaceHolder A SurfaceHolder wrapping a valid surface **/
Sets the Surface required by MediaRecorder to record video
setSurfaceHolder
{ "repo_name": "jamesrdelaney/ecg_over_rtp", "path": "src/net/majorkernelpanic/streaming/SessionBuilder.java", "license": "gpl-3.0", "size": 8806 }
[ "android.view.SurfaceHolder" ]
import android.view.SurfaceHolder;
import android.view.*;
[ "android.view" ]
android.view;
1,595,036
public User getValidator() { if (StringUtil.isDefined(validationBy)) { if (validator == null || !validationBy.equals(validator.getId())) { validator = User.getById(validationBy); } } else { validator = null; } return validator; }
User function() { if (StringUtil.isDefined(validationBy)) { if (validator == null !validationBy.equals(validator.getId())) { validator = User.getById(validationBy); } } else { validator = null; } return validator; }
/** * Gets the validator of the contribution. * @return a user detail object that represents the validator of the contribution. */
Gets the validator of the contribution
getValidator
{ "repo_name": "auroreallibe/Silverpeas-Core", "path": "core-library/src/main/java/org/silverpeas/core/contribution/model/ContributionValidation.java", "license": "agpl-3.0", "size": 6651 }
[ "org.silverpeas.core.admin.user.model.User", "org.silverpeas.core.util.StringUtil" ]
import org.silverpeas.core.admin.user.model.User; import org.silverpeas.core.util.StringUtil;
import org.silverpeas.core.admin.user.model.*; import org.silverpeas.core.util.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
1,218,770
private List<ValidationResult> validateCheckerParams(List<Parameter> params, Map<String, CheckerExtension> knownCheckers) { List<ValidationResult> resultsList = new ArrayList<ValidationResult>(); //clear the parameter list inside each Checker initializeParams(knownCheckers); if ((knownCheckers != null) && !knownCheckers.isEmpty()) { if (!params.isEmpty()) { for (Parameter param : params) { String checkerId = param.getValue(); ValidationResultData resultData = new ValidationResultData(); if (checkerId == null) { resultData.setSeverity(SEVERITY.ERROR); resultData.setIssueDescription(NLS.bind( PreflightingCoreNLS.ValidationManager_IncorrectSyntax, param.getParameterType())); } else if (!knownCheckers.keySet().contains(checkerId)) { resultData.setSeverity(SEVERITY.ERROR); resultData.setIssueDescription(NLS.bind( PreflightingCoreNLS.ValidationManager_UnknownCheckerMessage, checkerId)); } else { List<Parameter> subParameters = null; IChecker checker = knownCheckers.get(checkerId).getChecker(); if (param instanceof ComplexParameter) { ComplexParameter complexParam = (ComplexParameter) param; subParameters = complexParam.getParameters(); } else { subParameters = new ArrayList<Parameter>(); } IStatus validationStatus = setParameters(checker, subParameters); if (validationStatus.isOK()) { resultData.setSeverity(SEVERITY.OK); validationStatus = checker.validateInputParams(subParameters); if (validationStatus.isOK()) { resultData.setSeverity(SEVERITY.OK); } else { if (validationStatus.getSeverity() == Status.INFO) { resultData.setSeverity(SEVERITY.WARNING); } else { resultData.setSeverity(SEVERITY.ERROR); } resultData.setIssueDescription(validationStatus.getMessage()); } } else { resultData.setSeverity(SEVERITY.ERROR); resultData.setIssueDescription(validationStatus.getMessage()); } } ValidationResult result = new ValidationResult(checkerId, LimitedList.UNLIMITED); if (!resultData.getSeverity().equals(SEVERITY.OK)) { result.addValidationResult(resultData); resultsList.add(result); } } } else //Validate the empty list, because some checkers can have mandatory parameters { validateMandatoryParams(params, knownCheckers, resultsList); } } return resultsList; }
List<ValidationResult> function(List<Parameter> params, Map<String, CheckerExtension> knownCheckers) { List<ValidationResult> resultsList = new ArrayList<ValidationResult>(); initializeParams(knownCheckers); if ((knownCheckers != null) && !knownCheckers.isEmpty()) { if (!params.isEmpty()) { for (Parameter param : params) { String checkerId = param.getValue(); ValidationResultData resultData = new ValidationResultData(); if (checkerId == null) { resultData.setSeverity(SEVERITY.ERROR); resultData.setIssueDescription(NLS.bind( PreflightingCoreNLS.ValidationManager_IncorrectSyntax, param.getParameterType())); } else if (!knownCheckers.keySet().contains(checkerId)) { resultData.setSeverity(SEVERITY.ERROR); resultData.setIssueDescription(NLS.bind( PreflightingCoreNLS.ValidationManager_UnknownCheckerMessage, checkerId)); } else { List<Parameter> subParameters = null; IChecker checker = knownCheckers.get(checkerId).getChecker(); if (param instanceof ComplexParameter) { ComplexParameter complexParam = (ComplexParameter) param; subParameters = complexParam.getParameters(); } else { subParameters = new ArrayList<Parameter>(); } IStatus validationStatus = setParameters(checker, subParameters); if (validationStatus.isOK()) { resultData.setSeverity(SEVERITY.OK); validationStatus = checker.validateInputParams(subParameters); if (validationStatus.isOK()) { resultData.setSeverity(SEVERITY.OK); } else { if (validationStatus.getSeverity() == Status.INFO) { resultData.setSeverity(SEVERITY.WARNING); } else { resultData.setSeverity(SEVERITY.ERROR); } resultData.setIssueDescription(validationStatus.getMessage()); } } else { resultData.setSeverity(SEVERITY.ERROR); resultData.setIssueDescription(validationStatus.getMessage()); } } ValidationResult result = new ValidationResult(checkerId, LimitedList.UNLIMITED); if (!resultData.getSeverity().equals(SEVERITY.OK)) { result.addValidationResult(resultData); resultsList.add(result); } } } else { validateMandatoryParams(params, knownCheckers, resultsList); } } return resultsList; }
/** * Validate two things: 1- all checkers passed are known on the framework, * and 2- all parameters passed for the checkers are valid * * @param params * The checkers parameters * @param knownCheckers * The map of known checkers * * @return A list of ValidationResult. Each ValidationResult of its checker. * Return an empty list if no problems are found. */
Validate two things: 1- all checkers passed are known on the framework, and 2- all parameters passed for the checkers are valid
validateCheckerParams
{ "repo_name": "rex-xxx/mt6572_x201", "path": "tools/motodev/src/plugins/preflighting.core/src/com/motorolamobility/preflighting/core/validation/ValidationManager.java", "license": "gpl-2.0", "size": 84748 }
[ "com.motorolamobility.preflighting.core.checker.CheckerExtension", "com.motorolamobility.preflighting.core.checker.IChecker", "com.motorolamobility.preflighting.core.i18n.PreflightingCoreNLS", "com.motorolamobility.preflighting.core.utils.LimitedList", "java.util.ArrayList", "java.util.List", "java.util.Map", "org.eclipse.core.runtime.IStatus", "org.eclipse.core.runtime.Status", "org.eclipse.osgi.util.NLS" ]
import com.motorolamobility.preflighting.core.checker.CheckerExtension; import com.motorolamobility.preflighting.core.checker.IChecker; import com.motorolamobility.preflighting.core.i18n.PreflightingCoreNLS; import com.motorolamobility.preflighting.core.utils.LimitedList; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.osgi.util.NLS;
import com.motorolamobility.preflighting.core.checker.*; import com.motorolamobility.preflighting.core.i18n.*; import com.motorolamobility.preflighting.core.utils.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.osgi.util.*;
[ "com.motorolamobility.preflighting", "java.util", "org.eclipse.core", "org.eclipse.osgi" ]
com.motorolamobility.preflighting; java.util; org.eclipse.core; org.eclipse.osgi;
2,753,749
public static int execute(ProcessBuilder processBuilder, ProcessTerminator terminator) throws SecurityException, IOException { return ExecUtil.execute(processBuilder, ExecUtil.DEFAULT_TIMEOUT, ExecUtil.DEFAULT_TIMEOUT_UNITS, terminator); }
static int function(ProcessBuilder processBuilder, ProcessTerminator terminator) throws SecurityException, IOException { return ExecUtil.execute(processBuilder, ExecUtil.DEFAULT_TIMEOUT, ExecUtil.DEFAULT_TIMEOUT_UNITS, terminator); }
/** * Runs a process using the default timeout and a custom terminator. * * @param processBuilder A process builder used to configure and construct * the process to be run. * @param terminator The terminator. * * @return the exit value of the process * * @throws SecurityException if a security manager exists and vetoes any * aspect of running the process. * @throws IOException if an I/O error occurs. */
Runs a process using the default timeout and a custom terminator
execute
{ "repo_name": "maxrp/autopsy", "path": "Core/src/org/sleuthkit/autopsy/coreutils/ExecUtil.java", "license": "apache-2.0", "size": 16518 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
352,187
public DbConfig getDbConfig() { return configData; }
DbConfig function() { return configData; }
/** * Makes the config data available to all * @return */
Makes the config data available to all
getDbConfig
{ "repo_name": "sheldonabrown/core", "path": "transitime/src/main/java/org/transitime/applications/Core.java", "license": "gpl-3.0", "size": 16158 }
[ "org.transitime.gtfs.DbConfig" ]
import org.transitime.gtfs.DbConfig;
import org.transitime.gtfs.*;
[ "org.transitime.gtfs" ]
org.transitime.gtfs;
2,203,074
if (!StringUtils.isEmpty(operation)) { return Enum.valueOf(ContentLifeCycleOperation.class, operation); } else { return null; } } }
if (!StringUtils.isEmpty(operation)) { return Enum.valueOf(ContentLifeCycleOperation.class, operation); } else { return null; } } }
/** * get the enum type of the operation given * * @param operation * @return enum type of the operation */
get the enum type of the operation given
getOperation
{ "repo_name": "dejan-brkic/studio2", "path": "src/main/java/org/craftercms/studio/api/v1/service/content/DmContentLifeCycleService.java", "license": "gpl-3.0", "size": 1968 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
1,925,769
private XYDataset createBaselineDataset(RawDataFile dataFile, RawDataFile newDataFile, TICPlotType plotType) { XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries bl_series = new XYSeries("Baseline"); double intensity; Scan sc, new_sc; DataPoint dp, new_dp; // Get scan numbers from original file. final int[] scanNumbers = dataFile.getScanNumbers(1); final int numScans = scanNumbers.length; for (int scanIndex = 0; scanIndex < numScans; ++scanIndex) { sc = dataFile.getScan(scanNumbers[scanIndex]); new_sc = newDataFile.getScan(scanNumbers[scanIndex]); if (plotType == TICPlotType.BASEPEAK) { dp = sc.getHighestDataPoint(); new_dp = new_sc.getHighestDataPoint(); if (dp == null) { intensity = 0.0; } else if (new_dp == null) { intensity = dp.getIntensity(); } else { intensity = dp.getIntensity() - new_dp.getIntensity(); } } else { intensity = sc.getTIC() - new_sc.getTIC(); } bl_series.add(sc.getRetentionTime(), intensity); } dataset.addSeries(bl_series); return dataset; } // // @Override // public void statusChanged(TaskEvent e) { // if (e.getStatus() == TaskStatus.ERROR) { // LOG.log(Level.SEVERE, "Baseline correction error", // e.getSource().getErrorMessage()); // MZmineCore.getDesktop().displayErrorMessage( "Error of preview task ", // e.getSource().getErrorMessage()); // hidePreview(); // } // }
XYDataset function(RawDataFile dataFile, RawDataFile newDataFile, TICPlotType plotType) { XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries bl_series = new XYSeries(STR); double intensity; Scan sc, new_sc; DataPoint dp, new_dp; final int[] scanNumbers = dataFile.getScanNumbers(1); final int numScans = scanNumbers.length; for (int scanIndex = 0; scanIndex < numScans; ++scanIndex) { sc = dataFile.getScan(scanNumbers[scanIndex]); new_sc = newDataFile.getScan(scanNumbers[scanIndex]); if (plotType == TICPlotType.BASEPEAK) { dp = sc.getHighestDataPoint(); new_dp = new_sc.getHighestDataPoint(); if (dp == null) { intensity = 0.0; } else if (new_dp == null) { intensity = dp.getIntensity(); } else { intensity = dp.getIntensity() - new_dp.getIntensity(); } } else { intensity = sc.getTIC() - new_sc.getTIC(); } bl_series.add(sc.getRetentionTime(), intensity); } dataset.addSeries(bl_series); return dataset; }
/** * Quick way to recover the baseline plot (by subtracting the corrected file * from the original one). * * @param dataFile * original datafile * @param newDataFile * corrected datafile * @param plotType * expected plot type * @return the baseline additional dataset */
Quick way to recover the baseline plot (by subtracting the corrected file from the original one)
createBaselineDataset
{ "repo_name": "tomas-pluskal/mzmine2", "path": "src/main/java/net/sf/mzmine/modules/rawdatamethods/filtering/baselinecorrection/BaselineCorrectorSetupDialog.java", "license": "gpl-2.0", "size": 17733 }
[ "net.sf.mzmine.datamodel.DataPoint", "net.sf.mzmine.datamodel.RawDataFile", "net.sf.mzmine.datamodel.Scan", "net.sf.mzmine.modules.visualization.tic.TICPlotType", "org.jfree.data.xy.XYDataset", "org.jfree.data.xy.XYSeries", "org.jfree.data.xy.XYSeriesCollection" ]
import net.sf.mzmine.datamodel.DataPoint; import net.sf.mzmine.datamodel.RawDataFile; import net.sf.mzmine.datamodel.Scan; import net.sf.mzmine.modules.visualization.tic.TICPlotType; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection;
import net.sf.mzmine.datamodel.*; import net.sf.mzmine.modules.visualization.tic.*; import org.jfree.data.xy.*;
[ "net.sf.mzmine", "org.jfree.data" ]
net.sf.mzmine; org.jfree.data;
2,014,024
public Accessible getAccessibleChild(JComponent a, int b) { Accessible returnValue = ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b); } return returnValue; }
Accessible function(JComponent a, int b) { Accessible returnValue = ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b); } return returnValue; }
/** * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */
Invokes the <code>getAccessibleChild</code> method on each UI handled by this object
getAccessibleChild
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/javax/swing/plaf/multi/MultiViewportUI.java", "license": "apache-2.0", "size": 6432 }
[ "javax.accessibility.Accessible", "javax.swing.JComponent", "javax.swing.plaf.ComponentUI" ]
import javax.accessibility.Accessible; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI;
import javax.accessibility.*; import javax.swing.*; import javax.swing.plaf.*;
[ "javax.accessibility", "javax.swing" ]
javax.accessibility; javax.swing;
1,424,220
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_ASSET, defaultValue = "") @SimpleProperty public void BackgroundImage(String path) { view.setBackgroundImage(path); } /** * Returns the currently specified paint color as an alpha-red-green-blue * integer, i.e., {@code 0xAARRGGBB}. An alpha of {@code 00}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_ASSET, defaultValue = "") void function(String path) { view.setBackgroundImage(path); } /** * Returns the currently specified paint color as an alpha-red-green-blue * integer, i.e., {@code 0xAARRGGBB}. An alpha of {@code 00}
/** * Specifies the path of the canvas background image. * * <p/>See {@link MediaUtil#determineMediaSource} for information about what * a path can be. * * @param path the path of the canvas background image */
Specifies the path of the canvas background image. See <code>MediaUtil#determineMediaSource</code> for information about what a path can be
BackgroundImage
{ "repo_name": "shilpamagrawal15/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/Canvas.java", "license": "mit", "size": 50230 }
[ "com.google.appinventor.components.annotations.DesignerProperty", "com.google.appinventor.components.common.PropertyTypeConstants" ]
import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*;
[ "com.google.appinventor" ]
com.google.appinventor;
1,801,783
public double acquire(int permits) { long microsToWait = reserve(permits); stopwatch.sleepMicrosUninterruptibly(microsToWait); return 1.0 * microsToWait / SECONDS.toMicros(1L); }
double function(int permits) { long microsToWait = reserve(permits); stopwatch.sleepMicrosUninterruptibly(microsToWait); return 1.0 * microsToWait / SECONDS.toMicros(1L); }
/** * Acquires the given number of permits from this {@code RateLimiter}, blocking until the * request can be granted. Tells the amount of time slept, if any. * * @param permits the number of permits to acquire * @return time spent sleeping to enforce rate, in seconds; 0.0 if not rate-limited * @throws IllegalArgumentException if the requested number of permits is negative or zero * @since 16.0 (present in 13.0 with {@code void} return type}) */
Acquires the given number of permits from this RateLimiter, blocking until the request can be granted. Tells the amount of time slept, if any
acquire
{ "repo_name": "paulmartel/voltdb", "path": "third_party/java/src/com/google_voltpatches/common/util/concurrent/RateLimiter.java", "license": "agpl-3.0", "size": 18381 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,256,737
public static int getRegistryPort(Registry registry) { int port = -1; try { RemoteRef remoteRef = ((RegistryImpl)registry).getRef(); LiveRef liveRef = ((UnicastServerRef)remoteRef).getLiveRef(); Endpoint endpoint = liveRef.getChannel().getEndpoint(); TCPEndpoint tcpEndpoint = (TCPEndpoint) endpoint; port = tcpEndpoint.getPort(); } catch (Exception ex) { throw new RuntimeException("Error getting registry port.", ex); } return port; }
static int function(Registry registry) { int port = -1; try { RemoteRef remoteRef = ((RegistryImpl)registry).getRef(); LiveRef liveRef = ((UnicastServerRef)remoteRef).getLiveRef(); Endpoint endpoint = liveRef.getChannel().getEndpoint(); TCPEndpoint tcpEndpoint = (TCPEndpoint) endpoint; port = tcpEndpoint.getPort(); } catch (Exception ex) { throw new RuntimeException(STR, ex); } return port; }
/** * Returns the port number the RMI {@link Registry} is running on. * * @param registry the registry to find the port of. * @return the port number the registry is using. * @throws RuntimeException if there was a problem getting the port number. */
Returns the port number the RMI <code>Registry</code> is running on
getRegistryPort
{ "repo_name": "openjdk/jdk8u", "path": "jdk/test/java/rmi/testlibrary/TestLibrary.java", "license": "gpl-2.0", "size": 19452 }
[ "java.rmi.registry.Registry", "java.rmi.server.RemoteRef" ]
import java.rmi.registry.Registry; import java.rmi.server.RemoteRef;
import java.rmi.registry.*; import java.rmi.server.*;
[ "java.rmi" ]
java.rmi;
2,423,254
void removeServiceFromServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage, Service service) throws ServicesPackageNotExistsException, ServiceNotExistsException, PrivilegeException, ServiceAlreadyRemovedFromServicePackageException;
void removeServiceFromServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage, Service service) throws ServicesPackageNotExistsException, ServiceNotExistsException, PrivilegeException, ServiceAlreadyRemovedFromServicePackageException;
/** * Remove Service from Services Package * * @param perunSession * @param servicesPackage services package from which the service supposed to be removed * @param service service that will be removed from the services package * * @throws InternalErrorException * @throws PrivilegeException * @throws ServicesPackageNotExistsException * @throws ServiceAlreadyRemovedFromServicePackageException there are 0 rows affected by removing service from servicePackage in DB * @throws ServiceNotExistsException */
Remove Service from Services Package
removeServiceFromServicesPackage
{ "repo_name": "martin-kuba/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/ServicesManager.java", "license": "bsd-2-clause", "size": 46186 }
[ "cz.metacentrum.perun.core.api.exceptions.PrivilegeException", "cz.metacentrum.perun.core.api.exceptions.ServiceAlreadyRemovedFromServicePackageException", "cz.metacentrum.perun.core.api.exceptions.ServiceNotExistsException", "cz.metacentrum.perun.core.api.exceptions.ServicesPackageNotExistsException" ]
import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.ServiceAlreadyRemovedFromServicePackageException; import cz.metacentrum.perun.core.api.exceptions.ServiceNotExistsException; import cz.metacentrum.perun.core.api.exceptions.ServicesPackageNotExistsException;
import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
1,327,191
@Override protected SQLException executeMSBatch(int size, int executeSize, ArrayList counts) throws SQLException { if (parameters.length == 0) { // There are no parameters, each SQL call is the same so execute as a simple batch return super.executeMSBatch(size, executeSize, counts); } SQLException sqlEx = null; String procHandle[] = null; // Prepare any statements before executing the batch if (connection.getPrepareSql() == TdsCore.TEMPORARY_STORED_PROCEDURES || connection.getPrepareSql() == TdsCore.PREPARE) { procHandle = new String[size]; for (int i = 0; i < size; i++) { // Prepare the statement procHandle[i] = connection.prepareSQL(this, sql, (ParamInfo[]) batchValues.get(i), false, false); } } for (int i = 0; i < size;) { Object value = batchValues.get(i); String proc = (procHandle == null) ? procName : procHandle[i]; ++i; // Execute batch now if max size reached or end of batch boolean executeNow = (i % executeSize == 0) || i == size; tds.startBatch(); tds.executeSQL(sql, proc, (ParamInfo[]) value, false, 0, -1, -1, executeNow); // If the batch has been sent, process the results if (executeNow) { sqlEx = tds.getBatchCounts(counts, sqlEx); // If a serious error then we stop execution now as count // is too small. if (sqlEx != null && counts.size() != i) { break; } } } return sqlEx; }
SQLException function(int size, int executeSize, ArrayList counts) throws SQLException { if (parameters.length == 0) { return super.executeMSBatch(size, executeSize, counts); } SQLException sqlEx = null; String procHandle[] = null; if (connection.getPrepareSql() == TdsCore.TEMPORARY_STORED_PROCEDURES connection.getPrepareSql() == TdsCore.PREPARE) { procHandle = new String[size]; for (int i = 0; i < size; i++) { procHandle[i] = connection.prepareSQL(this, sql, (ParamInfo[]) batchValues.get(i), false, false); } } for (int i = 0; i < size;) { Object value = batchValues.get(i); String proc = (procHandle == null) ? procName : procHandle[i]; ++i; boolean executeNow = (i % executeSize == 0) i == size; tds.startBatch(); tds.executeSQL(sql, proc, (ParamInfo[]) value, false, 0, -1, -1, executeNow); if (executeNow) { sqlEx = tds.getBatchCounts(counts, sqlEx); if (sqlEx != null && counts.size() != i) { break; } } } return sqlEx; }
/** * Execute the SQL batch on a MS server. * <p/> * When running with <code>prepareSQL=1</code> or <code>3</code>, the driver will first prepare temporary stored * procedures or statements for each parameter combination found in the batch. The handles to these pre-preared * statements will then be used to execute the actual batch statements. * * @param size the total size of the batch * @param executeSize the maximum number of statements to send in one request * @param counts the returned update counts * @return chained exceptions linked to a <code>SQLException</code> * @throws SQLException if a serious error occurs during execution */
Execute the SQL batch on a MS server. When running with <code>prepareSQL=1</code> or <code>3</code>, the driver will first prepare temporary stored procedures or statements for each parameter combination found in the batch. The handles to these pre-preared statements will then be used to execute the actual batch statements
executeMSBatch
{ "repo_name": "milesibastos/jTDS", "path": "src/main/net/sourceforge/jtds/jdbc/JtdsPreparedStatement.java", "license": "lgpl-2.1", "size": 48646 }
[ "java.sql.SQLException", "java.util.ArrayList" ]
import java.sql.SQLException; import java.util.ArrayList;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
33,313
int decode(byte[] recordHeader, byte[] recordData) throws IOException { if (cipher != null) { // Cipher algorithm is not NULL (ctxt needs to be decrypted) try { // We have a stream cipher (NOTE: assuming CLIENT role) // We can decode in place w/o using additional memory cipher.update(recordData, 0, recordData.length, recordData, 0); } catch (Exception e) { throw new IOException("Decode caught " + e); } } int length = recordData.length - digestLength; if (digest != null) { byte[] expMAC = null; // expected MAC expMAC = getMAC(recordHeader[0], recordData, 0, length); if (!Utils.byteMatch(expMAC, 0, recordData, length, digestLength)) { throw new IOException("Bad MAC"); } } incrementSequenceNumber(); return length; }
int decode(byte[] recordHeader, byte[] recordData) throws IOException { if (cipher != null) { try { cipher.update(recordData, 0, recordData.length, recordData, 0); } catch (Exception e) { throw new IOException(STR + e); } } int length = recordData.length - digestLength; if (digest != null) { byte[] expMAC = null; expMAC = getMAC(recordHeader[0], recordData, 0, length); if (!Utils.byteMatch(expMAC, 0, recordData, length, digestLength)) { throw new IOException(STR); } } incrementSequenceNumber(); return length; }
/** * Converts a byte array containing an SSLCiphertext structure * to the corresponding SSLPlaintext structure. The process * typically involves decryption followed by MAC verification * and MAC stripping. * @param recordHeader record header * @param recordData record data * @return Length of the decrypted data in the input buffer. * * @exception IOException if a problem is encountered during decryption * or MAC verification */
Converts a byte array containing an SSLCiphertext structure to the corresponding SSLPlaintext structure. The process typically involves decryption followed by MAC verification and MAC stripping
decode
{ "repo_name": "mariotaku/twidere.j2me", "path": "src/repackaged/com/sun/midp/ssl/Record.java", "license": "gpl-3.0", "size": 33419 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
724,445
public static final Cipher getInstance(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { return getCipher(transformation, null); }
static final Cipher function(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { return getCipher(transformation, null); }
/** * Creates a new Cipher for the specified transformation. The installed * providers are searched in order for an implementation of the specified * transformation. The first found provider providing the transformation is * used to create the cipher. If no provider is found an exception is * thrown. * * @param transformation * the name of the transformation to create a cipher for. * @return a cipher for the requested transformation. * @throws NoSuchAlgorithmException * if no installed provider can provide the * <i>transformation</i>, or it is {@code null}, empty or in an * invalid format. * @throws NoSuchPaddingException * if no installed provider can provide the padding scheme in * the <i>transformation</i>. */
Creates a new Cipher for the specified transformation. The installed providers are searched in order for an implementation of the specified transformation. The first found provider providing the transformation is used to create the cipher. If no provider is found an exception is thrown
getInstance
{ "repo_name": "webos21/xi", "path": "java/jcl/src/java/javax/crypto/Cipher.java", "license": "apache-2.0", "size": 49554 }
[ "java.security.NoSuchAlgorithmException" ]
import java.security.NoSuchAlgorithmException;
import java.security.*;
[ "java.security" ]
java.security;
631,339
@Deprecated public static <T> T anyObject() { reportMatcher(Any.ANY); return null; } /** * Matches any object of given type, excluding nulls. * * <p> * This matcher will perform a type check with the given type, thus excluding values. * See examples in javadoc for {@link ArgumentMatchers} class. * * This is an alias of: {@link #isA(Class)}}
static <T> T function() { reportMatcher(Any.ANY); return null; } /** * Matches any object of given type, excluding nulls. * * <p> * This matcher will perform a type check with the given type, thus excluding values. * See examples in javadoc for {@link ArgumentMatchers} class. * * This is an alias of: {@link #isA(Class)}}
/** * Matches anything, including <code>null</code>. * * <p> * This is an alias of: {@link #any()}. * See examples in javadoc for {@link ArgumentMatchers} class. * </p> * * @return <code>null</code>. * @see #any() * @see #any(Class) * @see #notNull() * @see #notNull(Class) * @deprecated This will be removed in Mockito 4.0 This method is only used for generic * friendliness to avoid casting, this is not anymore needed in Java 8. */
Matches anything, including <code>null</code>. This is an alias of: <code>#any()</code>. See examples in javadoc for <code>ArgumentMatchers</code> class.
anyObject
{ "repo_name": "ze-pequeno/mockito", "path": "src/main/java/org/mockito/ArgumentMatchers.java", "license": "mit", "size": 43459 }
[ "org.mockito.internal.matchers.Any", "org.mockito.internal.matchers.Matches" ]
import org.mockito.internal.matchers.Any; import org.mockito.internal.matchers.Matches;
import org.mockito.internal.matchers.*;
[ "org.mockito.internal" ]
org.mockito.internal;
1,060,222
public String toXMLFragment() { StringBuffer xml = new StringBuffer(); java.util.List<PaymentExecutionDetailItem> paymentExecutionDetailItemList = getPaymentExecutionDetailItem(); for (PaymentExecutionDetailItem paymentExecutionDetailItem : paymentExecutionDetailItemList) { xml.append("<PaymentExecutionDetailItem>"); xml.append(paymentExecutionDetailItem.toXMLFragment()); xml.append("</PaymentExecutionDetailItem>"); } return xml.toString(); }
String function() { StringBuffer xml = new StringBuffer(); java.util.List<PaymentExecutionDetailItem> paymentExecutionDetailItemList = getPaymentExecutionDetailItem(); for (PaymentExecutionDetailItem paymentExecutionDetailItem : paymentExecutionDetailItemList) { xml.append(STR); xml.append(paymentExecutionDetailItem.toXMLFragment()); xml.append(STR); } return xml.toString(); }
/** * * XML fragment representation of this object * * @return XML fragment for this object. Name for outer * tag expected to be set by calling method. This fragment * returns inner properties representation only */
XML fragment representation of this object
toXMLFragment
{ "repo_name": "VDuda/SyncRunner-Pub", "path": "src/API/amazon/mws/orders/model/PaymentExecutionDetailItemList.java", "license": "mit", "size": 7908 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
902,512
@Override @SuppressWarnings("deprecation") public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if(Build.VERSION.SDK_INT >= 21) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } else { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } }
@SuppressWarnings(STR) void function(@NonNull AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if(Build.VERSION.SDK_INT >= 21) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } else { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } }
/** * Necessary for accessibility, to ensure we support "scrolling" forward and backward * in the circle. */
Necessary for accessibility, to ensure we support "scrolling" forward and backward in the circle
onInitializeAccessibilityNodeInfo
{ "repo_name": "freezy/MaterialDateTimePicker", "path": "library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java", "license": "apache-2.0", "size": 35850 }
[ "android.os.Build", "android.support.annotation.NonNull", "android.view.accessibility.AccessibilityNodeInfo" ]
import android.os.Build; import android.support.annotation.NonNull; import android.view.accessibility.AccessibilityNodeInfo;
import android.os.*; import android.support.annotation.*; import android.view.accessibility.*;
[ "android.os", "android.support", "android.view" ]
android.os; android.support; android.view;
2,675,912
public void showInstallFailureUi() { if (mInstallStartToast != null) { mInstallStartToast.cancel(); mInstallStartToast = null; } Context context = mDelegate.getContext(); WindowAndroid windowAndroid = mDelegate.getWindowAndroid(); if (context == null || windowAndroid == null) { if (mFailureUiListener != null) mFailureUiListener.onFailureUiResponse(false); return; }
void function() { if (mInstallStartToast != null) { mInstallStartToast.cancel(); mInstallStartToast = null; } Context context = mDelegate.getContext(); WindowAndroid windowAndroid = mDelegate.getWindowAndroid(); if (context == null windowAndroid == null) { if (mFailureUiListener != null) mFailureUiListener.onFailureUiResponse(false); return; }
/** * Show UI indicating the failure of a module install. Upon interaction with the UI the * |failureUiListener| will be invoked. */
Show UI indicating the failure of a module install. Upon interaction with the UI the |failureUiListener| will be invoked
showInstallFailureUi
{ "repo_name": "chromium/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/modules/ModuleInstallUi.java", "license": "bsd-3-clause", "size": 5003 }
[ "android.content.Context", "org.chromium.ui.base.WindowAndroid" ]
import android.content.Context; import org.chromium.ui.base.WindowAndroid;
import android.content.*; import org.chromium.ui.base.*;
[ "android.content", "org.chromium.ui" ]
android.content; org.chromium.ui;
1,368,995
static boolean understandFormat(Path path, Reader reader) { if (reader.getFileVersion() == Version.FUTURE) { LOG.info("Can't merge {} because it has a future version.", path); return false; } if (reader.getWriterVersion() == WriterVersion.FUTURE) { LOG.info("Can't merge {} because it has a future writerVersion.", path); return false; } return true; }
static boolean understandFormat(Path path, Reader reader) { if (reader.getFileVersion() == Version.FUTURE) { LOG.info(STR, path); return false; } if (reader.getWriterVersion() == WriterVersion.FUTURE) { LOG.info(STR, path); return false; } return true; }
/** * Do we understand the version in the reader? * @param path the path of the file * @param reader the ORC file reader * @return is the version understood by this writer? */
Do we understand the version in the reader
understandFormat
{ "repo_name": "chunyang-wen/orc", "path": "java/core/src/java/org/apache/orc/OrcFile.java", "license": "apache-2.0", "size": 27232 }
[ "org.apache.hadoop.fs.Path" ]
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
915,464
public String nextSid(String objectNamespace) throws RepositoryException { return getSidList(objectNamespace).nextSid(); }
String function(String objectNamespace) throws RepositoryException { return getSidList(objectNamespace).nextSid(); }
/** * Get the next sid for the given objectNamespace. * * @param objectNamespace * a namespace that matches one of the "retainPIDs" values configured for the repository * @return next sid for the given objectNamespace * @throws RepositoryException * as the common base class for checked exceptions */
Get the next sid for the given objectNamespace
nextSid
{ "repo_name": "DANS-KNAW/dccd-legacy-libs", "path": "fedora/src/main/java/nl/knaw/dans/common/fedora/ObjectManager.java", "license": "apache-2.0", "size": 20559 }
[ "nl.knaw.dans.common.lang.RepositoryException" ]
import nl.knaw.dans.common.lang.RepositoryException;
import nl.knaw.dans.common.lang.*;
[ "nl.knaw.dans" ]
nl.knaw.dans;
1,639,334
KeyManagerFactory keyManagerFactory; try { keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); } catch (NoSuchAlgorithmException e) { throw SeedException.wrap(e, CryptoErrorCode.ALGORITHM_CANNOT_BE_FOUND); } try { keyManagerFactory.init(keyStore, password); return keyManagerFactory.getKeyManagers(); } catch (UnrecoverableKeyException e) { throw SeedException.wrap(e, CryptoErrorCode.UNRECOVERABLE_KEY); } catch (NoSuchAlgorithmException e) { throw SeedException.wrap(e, CryptoErrorCode.ALGORITHM_CANNOT_BE_FOUND); } catch (KeyStoreException e) { throw SeedException.wrap(e, CryptoErrorCode.UNEXPECTED_EXCEPTION); } }
KeyManagerFactory keyManagerFactory; try { keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); } catch (NoSuchAlgorithmException e) { throw SeedException.wrap(e, CryptoErrorCode.ALGORITHM_CANNOT_BE_FOUND); } try { keyManagerFactory.init(keyStore, password); return keyManagerFactory.getKeyManagers(); } catch (UnrecoverableKeyException e) { throw SeedException.wrap(e, CryptoErrorCode.UNRECOVERABLE_KEY); } catch (NoSuchAlgorithmException e) { throw SeedException.wrap(e, CryptoErrorCode.ALGORITHM_CANNOT_BE_FOUND); } catch (KeyStoreException e) { throw SeedException.wrap(e, CryptoErrorCode.UNEXPECTED_EXCEPTION); } }
/** * Gets the {@link javax.net.ssl.KeyManager}s from the ssl KeyStore. * * @return an array of KeyManagers */
Gets the <code>javax.net.ssl.KeyManager</code>s from the ssl KeyStore
getKeyManagers
{ "repo_name": "adrienlauer/seed", "path": "core/src/main/java/org/seedstack/seed/core/internal/crypto/SSLLoader.java", "license": "mpl-2.0", "size": 3494 }
[ "java.security.KeyStoreException", "java.security.NoSuchAlgorithmException", "java.security.UnrecoverableKeyException", "javax.net.ssl.KeyManagerFactory", "org.seedstack.seed.SeedException" ]
import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import javax.net.ssl.KeyManagerFactory; import org.seedstack.seed.SeedException;
import java.security.*; import javax.net.ssl.*; import org.seedstack.seed.*;
[ "java.security", "javax.net", "org.seedstack.seed" ]
java.security; javax.net; org.seedstack.seed;
1,696,264
public static JpegData getJpegData(File inFile) { try { // Call library (if found) if (_exifLibrary != null) { JpegData data = _exifLibrary.getJpegData(inFile); return data; } } catch (LinkageError nolib) { System.err.println("Link: " + nolib.getMessage()); nolib.printStackTrace(); } // Not successful - warn if necessary if (!_exifFailWarned) { JOptionPane.showMessageDialog(null, I18nManager.getText("error.jpegload.exifreadfailed"), I18nManager.getText("error.jpegload.dialogtitle"), JOptionPane.WARNING_MESSAGE); _exifFailWarned = true; } return null; }
static JpegData function(File inFile) { try { if (_exifLibrary != null) { JpegData data = _exifLibrary.getJpegData(inFile); return data; } } catch (LinkageError nolib) { System.err.println(STR + nolib.getMessage()); nolib.printStackTrace(); } if (!_exifFailWarned) { JOptionPane.showMessageDialog(null, I18nManager.getText(STR), I18nManager.getText(STR), JOptionPane.WARNING_MESSAGE); _exifFailWarned = true; } return null; }
/** * Get the Jpeg data from the given file * @param inFile file to read * @return jpeg data, or null if none found */
Get the Jpeg data from the given file
getJpegData
{ "repo_name": "sebastic/GpsPrune", "path": "tim/prune/jpeg/ExifGateway.java", "license": "gpl-2.0", "size": 3189 }
[ "java.io.File", "javax.swing.JOptionPane" ]
import java.io.File; import javax.swing.JOptionPane;
import java.io.*; import javax.swing.*;
[ "java.io", "javax.swing" ]
java.io; javax.swing;
2,703,449
public Map<String, String> matches(String text, Map<String, String> result, boolean guaranteeNonNullResult) { final MatchResult matches = patternMatches(text); if (matches.matches) { result = matches.getAttributes(result); if (result == null && guaranteeNonNullResult) result = EMPTY_ATTRIBUTES; } return result; }
Map<String, String> function(String text, Map<String, String> result, boolean guaranteeNonNullResult) { final MatchResult matches = patternMatches(text); if (matches.matches) { result = matches.getAttributes(result); if (result == null && guaranteeNonNullResult) result = EMPTY_ATTRIBUTES; } return result; }
/** * If the text matches, populate result with features. */
If the text matches, populate result with features
matches
{ "repo_name": "KoehlerSB747/sd-tools", "path": "src/main/java/org/sd/atn/RegexData.java", "license": "apache-2.0", "size": 11457 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,061,762
String numLocationsReported = mContext.getResources().getQuantityString( R.plurals.num_locations_reported, mLocations.size(), mLocations.size()); return numLocationsReported + ": " + DateFormat.getDateTimeInstance().format(new Date()); }
String numLocationsReported = mContext.getResources().getQuantityString( R.plurals.num_locations_reported, mLocations.size(), mLocations.size()); return numLocationsReported + STR + DateFormat.getDateTimeInstance().format(new Date()); }
/** * Returns the title for reporting about a list of {@link Location} objects. */
Returns the title for reporting about a list of <code>Location</code> objects
getLocationResultTitle
{ "repo_name": "googlecodelabs/background-location-updates-android-o", "path": "BackgroundLocationUpdates_Finished/app/src/main/java/com/google/android/gms/location/sample/backgroundlocationupdates/LocationResultHelper.java", "license": "apache-2.0", "size": 5283 }
[ "java.text.DateFormat", "java.util.Date" ]
import java.text.DateFormat; import java.util.Date;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
2,811,161
protected String generateEventUri(ICalendarAccount owner, VEvent event) { Validate.notNull(event, "event argument cannot be null"); Validate.notNull(event.getUid(), "cannot generateEventUri for event with null UID"); String accountHome = this.caldavDialect.getCalendarAccountHome(owner); StringBuilder eventUri = new StringBuilder(accountHome); eventUri.append(event.getUid().getValue()); eventUri.append(".ics"); return eventUri.toString(); }
String function(ICalendarAccount owner, VEvent event) { Validate.notNull(event, STR); Validate.notNull(event.getUid(), STR); String accountHome = this.caldavDialect.getCalendarAccountHome(owner); StringBuilder eventUri = new StringBuilder(accountHome); eventUri.append(event.getUid().getValue()); eventUri.append(".ics"); return eventUri.toString(); }
/** * This method is intended to generate a unique URI to use with the PUT method * in {@link #createAppointment(IScheduleVisitor, IScheduleOwner, AvailableBlock, String)}. * * It is implemented by the following: * <pre> caldavDialect.calculateCalendarAccountHome(owner.getCalendarAccount) + "/sched-assist-" + randomAlphanumeric + ".ics" * </pre> * @param owner * @return */
This method is intended to generate a unique URI to use with the PUT method in <code>#createAppointment(IScheduleVisitor, IScheduleOwner, AvailableBlock, String)</code>. It is implemented by the following: <code> </code>
generateEventUri
{ "repo_name": "Jasig/sched-assist", "path": "sched-assist-spi-caldav/src/main/java/org/jasig/schedassist/impl/caldav/CaldavCalendarDataDaoImpl.java", "license": "apache-2.0", "size": 50408 }
[ "net.fortuna.ical4j.model.component.VEvent", "org.apache.commons.lang.Validate", "org.jasig.schedassist.model.ICalendarAccount" ]
import net.fortuna.ical4j.model.component.VEvent; import org.apache.commons.lang.Validate; import org.jasig.schedassist.model.ICalendarAccount;
import net.fortuna.ical4j.model.component.*; import org.apache.commons.lang.*; import org.jasig.schedassist.model.*;
[ "net.fortuna.ical4j", "org.apache.commons", "org.jasig.schedassist" ]
net.fortuna.ical4j; org.apache.commons; org.jasig.schedassist;
2,280,946
@Test public void testAddNodesCopy() { AbstractHierarchicalConfigurationTestImpl configDest = new AbstractHierarchicalConfigurationTestImpl( new InMemoryNodeModel()); configDest.addProperty("test", "TEST"); Collection<ImmutableNode> nodes = getRootNode().getChildren(); assertEquals("Wrong number of children", 1, nodes.size()); configDest.addNodes("newNodes", nodes); for (int i = 0; i < NodeStructureHelper.tablesLength(); i++) { String keyTab = "newNodes.tables.table(" + i + ")."; assertEquals("Table " + i + " not found", NodeStructureHelper.table(i), configDest.getString(keyTab + "name")); for (int j = 0; j < NodeStructureHelper.fieldsLength(i); j++) { assertEquals( "Invalid field " + j + " in table " + i, NodeStructureHelper.field(i, j), configDest.getString(keyTab + "fields.field(" + j + ").name")); } } }
void function() { AbstractHierarchicalConfigurationTestImpl configDest = new AbstractHierarchicalConfigurationTestImpl( new InMemoryNodeModel()); configDest.addProperty("test", "TEST"); Collection<ImmutableNode> nodes = getRootNode().getChildren(); assertEquals(STR, 1, nodes.size()); configDest.addNodes(STR, nodes); for (int i = 0; i < NodeStructureHelper.tablesLength(); i++) { String keyTab = STR + i + ")."; assertEquals(STR + i + STR, NodeStructureHelper.table(i), configDest.getString(keyTab + "name")); for (int j = 0; j < NodeStructureHelper.fieldsLength(i); j++) { assertEquals( STR + j + STR + i, NodeStructureHelper.field(i, j), configDest.getString(keyTab + STR + j + STR)); } } }
/** * Tests copying nodes from one configuration to another one. */
Tests copying nodes from one configuration to another one
testAddNodesCopy
{ "repo_name": "mohanaraosv/commons-configuration", "path": "src/test/java/org/apache/commons/configuration2/TestAbstractHierarchicalConfiguration.java", "license": "apache-2.0", "size": 42005 }
[ "java.util.Collection", "org.apache.commons.configuration2.tree.ImmutableNode", "org.apache.commons.configuration2.tree.InMemoryNodeModel", "org.apache.commons.configuration2.tree.NodeStructureHelper", "org.junit.Assert" ]
import java.util.Collection; import org.apache.commons.configuration2.tree.ImmutableNode; import org.apache.commons.configuration2.tree.InMemoryNodeModel; import org.apache.commons.configuration2.tree.NodeStructureHelper; import org.junit.Assert;
import java.util.*; import org.apache.commons.configuration2.tree.*; import org.junit.*;
[ "java.util", "org.apache.commons", "org.junit" ]
java.util; org.apache.commons; org.junit;
2,682,520
ValueMatcher makeMatcher(ColumnSelectorFactory factory);
ValueMatcher makeMatcher(ColumnSelectorFactory factory);
/** * Get a ValueMatcher that applies this filter to row values. * * @param factory Object used to create ValueMatchers * * @return ValueMatcher that applies this filter to row values. */
Get a ValueMatcher that applies this filter to row values
makeMatcher
{ "repo_name": "andy256/druid", "path": "processing/src/main/java/io/druid/query/filter/Filter.java", "license": "apache-2.0", "size": 4491 }
[ "io.druid.segment.ColumnSelectorFactory" ]
import io.druid.segment.ColumnSelectorFactory;
import io.druid.segment.*;
[ "io.druid.segment" ]
io.druid.segment;
149,671
public void setupListeners(MapBean aMap) { if (aMap != null) { // Wire up the beans for event passing addZoomListener((ZoomListener) aMap); aMap.addProjectionListener(this); // set the scaleEntry scaleField.setText("1:" + String.valueOf(aMap.getScale())); } }
void function(MapBean aMap) { if (aMap != null) { addZoomListener((ZoomListener) aMap); aMap.addProjectionListener(this); scaleField.setText("1:" + String.valueOf(aMap.getScale())); } }
/** * Convenience function to set up listeners of the components. If * you are hooking the MapBean up to the ScaleTextPanel, this is * one of two methods you need to call. The other is * addMouseModes(), if the MapBean has more than one Mouse Mode. * * @param aMap a map object. */
Convenience function to set up listeners of the components. If you are hooking the MapBean up to the ScaleTextPanel, this is one of two methods you need to call. The other is addMouseModes(), if the MapBean has more than one Mouse Mode
setupListeners
{ "repo_name": "d2fn/passage", "path": "src/main/java/com/bbn/openmap/gui/ScaleTextPanel.java", "license": "mit", "size": 8880 }
[ "com.bbn.openmap.MapBean", "com.bbn.openmap.event.ZoomListener" ]
import com.bbn.openmap.MapBean; import com.bbn.openmap.event.ZoomListener;
import com.bbn.openmap.*; import com.bbn.openmap.event.*;
[ "com.bbn.openmap" ]
com.bbn.openmap;
640,404
@Test public void testCreate() { Platform.runLater(() -> { // CHECKSTYLE.OFF: MagicNumber assertEquals(2, minimap.getChildren().size()); // CHECKSTYLE.ON: MagicNumber }); }
void function() { Platform.runLater(() -> { assertEquals(2, minimap.getChildren().size()); }); }
/** * Test creation of a minimap. * Ensure that three children are present. */
Test creation of a minimap. Ensure that three children are present
testCreate
{ "repo_name": "AbeelLab/dnainator", "path": "dnainator-javafx/src/test/java/nl/tudelft/dnainator/javafx/widgets/MinimapTest.java", "license": "bsd-3-clause", "size": 2230 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,974,531
private void moveChildClassesToPackages(EClass theClass,String packageName,String entryPackageName) throws MapperException { String nextPackageName = packageName; for (Iterator<EStructuralFeature> it = theClass.getEStructuralFeatures().iterator(); it.hasNext();) { EStructuralFeature next = it.next(); if (next instanceof EReference) { EReference ref = (EReference)next; // only allow one change of package name from the top, at a new section (not an observation, etc.) if (packageName.equals(entryPackageName)) { // if the association name is 'component_ProblemSection' make the package name 'problemSection' if ((ref.getName().startsWith("component_")) && (ref.getName().length() > "component_T".length())) nextPackageName = GenUtil.initialLowerCase(ref.getName().substring("component_".length())); // do not make separate packages for these associations if (nextPackageName.endsWith("EntriesOptional")) nextPackageName = nextPackageName.substring(0,nextPackageName.length() - "EntriesOptional".length()); } EClass nextClass = (EClass)ref.getEType(); // stop the recursion if this class has already been moved, or is in the datatypes package if (moveClassToPackage(nextClass,nextPackageName)) moveChildClassesToPackages(nextClass,nextPackageName, entryPackageName); } } }
void function(EClass theClass,String packageName,String entryPackageName) throws MapperException { String nextPackageName = packageName; for (Iterator<EStructuralFeature> it = theClass.getEStructuralFeatures().iterator(); it.hasNext();) { EStructuralFeature next = it.next(); if (next instanceof EReference) { EReference ref = (EReference)next; if (packageName.equals(entryPackageName)) { if ((ref.getName().startsWith(STR)) && (ref.getName().length() > STR.length())) nextPackageName = GenUtil.initialLowerCase(ref.getName().substring(STR.length())); if (nextPackageName.endsWith(STR)) nextPackageName = nextPackageName.substring(0,nextPackageName.length() - STR.length()); } EClass nextClass = (EClass)ref.getEType(); if (moveClassToPackage(nextClass,nextPackageName)) moveChildClassesToPackages(nextClass,nextPackageName, entryPackageName); } } }
/** * recursive descent of the class tree, moving classes to new packages * @param theClass * @param packageName * @param entryPackageName passed down the recursion unchanged */
recursive descent of the class tree, moving classes to new packages
moveChildClassesToPackages
{ "repo_name": "openmapsoftware/mappingtools", "path": "openmap-mapper-health/src/main/java/com/openMap1/mapper/health/actions/ImportMDHTModel.java", "license": "epl-1.0", "size": 93111 }
[ "java.util.Iterator", "org.eclipse.emf.ecore.EClass", "org.eclipse.emf.ecore.EReference", "org.eclipse.emf.ecore.EStructuralFeature" ]
import java.util.Iterator; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.*; import org.eclipse.emf.ecore.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
2,105,693
protected void addHeader() { // create the view for side columns SideColumnsView sideColumns = new SideColumnsView("sideHeaderColumns", null); add(sideColumns); if (columns != null) { for (int i = 0; i < columns.length; i++) { IColumn column = columns[i]; if ((column.getLocation().getAlignment() == Alignment.LEFT) || (column.getLocation().getAlignment() == Alignment.RIGHT)) { TreeTableItem component = new TreeTableItem(i); Component cell = column.newHeader(sideColumns, TreeTableItem.ID); component.add(cell); sideColumns.addColumn(column, component, null); } } } // create the view for middle columns MiddleColumnsView middleColumns = new MiddleColumnsView("middleHeaderColumns", null, hasLeftColumn()); add(middleColumns); if (columns != null) { for (int i = 0; i < columns.length; i++) { IColumn column = columns[i]; if (column.getLocation().getAlignment() == Alignment.MIDDLE) { TreeTableItem component = new TreeTableItem(i); Component cell = column.newHeader(middleColumns, TreeTableItem.ID); component.add(cell); middleColumns.addColumn(column, component, null); } } } }
void function() { SideColumnsView sideColumns = new SideColumnsView(STR, null); add(sideColumns); if (columns != null) { for (int i = 0; i < columns.length; i++) { IColumn column = columns[i]; if ((column.getLocation().getAlignment() == Alignment.LEFT) (column.getLocation().getAlignment() == Alignment.RIGHT)) { TreeTableItem component = new TreeTableItem(i); Component cell = column.newHeader(sideColumns, TreeTableItem.ID); component.add(cell); sideColumns.addColumn(column, component, null); } } } MiddleColumnsView middleColumns = new MiddleColumnsView(STR, null, hasLeftColumn()); add(middleColumns); if (columns != null) { for (int i = 0; i < columns.length; i++) { IColumn column = columns[i]; if (column.getLocation().getAlignment() == Alignment.MIDDLE) { TreeTableItem component = new TreeTableItem(i); Component cell = column.newHeader(middleColumns, TreeTableItem.ID); component.add(cell); middleColumns.addColumn(column, component, null); } } } }
/** * Adds the header to the TreeTable. */
Adds the header to the TreeTable
addHeader
{ "repo_name": "wicketstuff/wicket1.5-tree", "path": "src/main/java/org/apache/wicket/extensions/markup/html/tree/table/TreeTable.java", "license": "apache-2.0", "size": 11475 }
[ "org.apache.wicket.Component", "org.apache.wicket.extensions.markup.html.tree.table.ColumnLocation" ]
import org.apache.wicket.Component; import org.apache.wicket.extensions.markup.html.tree.table.ColumnLocation;
import org.apache.wicket.*; import org.apache.wicket.extensions.markup.html.tree.table.*;
[ "org.apache.wicket" ]
org.apache.wicket;
128,806
public Message writeRequest(GMailEndpoint endpoint, Exchange exchange, Message request) { Message message = new Message(); writeFrom(endpoint, exchange, message); writeTo(endpoint, exchange, message); writeCc(endpoint, exchange, message); writeBcc(endpoint, exchange, message); writeSubject(endpoint, exchange, message); writeBody(endpoint, exchange, message); writeAttachments(endpoint, exchange, message); return message; }
Message function(GMailEndpoint endpoint, Exchange exchange, Message request) { Message message = new Message(); writeFrom(endpoint, exchange, message); writeTo(endpoint, exchange, message); writeCc(endpoint, exchange, message); writeBcc(endpoint, exchange, message); writeSubject(endpoint, exchange, message); writeBody(endpoint, exchange, message); writeAttachments(endpoint, exchange, message); return message; }
/** * Reads data from <code>exchange</code> and writes it to a newly created * {@link Message} instance. The <code>request</code> parameter is * ignored. * * @param endpoint * @param exchange * @param request * ignored. * @return a newly created {@link Message} instance containing data from * <code>exchange</code>. */
Reads data from <code>exchange</code> and writes it to a newly created <code>Message</code> instance. The <code>request</code> parameter is ignored
writeRequest
{ "repo_name": "aaronwalker/camel", "path": "components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailBinding.java", "license": "apache-2.0", "size": 5047 }
[ "com.google.appengine.api.mail.MailService", "org.apache.camel.Exchange" ]
import com.google.appengine.api.mail.MailService; import org.apache.camel.Exchange;
import com.google.appengine.api.mail.*; import org.apache.camel.*;
[ "com.google.appengine", "org.apache.camel" ]
com.google.appengine; org.apache.camel;
425,295
// ---------------------------------------- // User methods // ---------------------------------------- UserEntity createUser(Revision revision, UserDTO userDTO);
UserEntity createUser(Revision revision, UserDTO userDTO);
/** * Creates a user. * @param revision The starting revision * @param userDTO The user DTO * @return The user transfer object */
Creates a user
createUser
{ "repo_name": "mcgilman/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java", "license": "apache-2.0", "size": 85713 }
[ "org.apache.nifi.web.api.dto.UserDTO", "org.apache.nifi.web.api.entity.UserEntity" ]
import org.apache.nifi.web.api.dto.UserDTO; import org.apache.nifi.web.api.entity.UserEntity;
import org.apache.nifi.web.api.dto.*; import org.apache.nifi.web.api.entity.*;
[ "org.apache.nifi" ]
org.apache.nifi;
2,542,516
private void delete(SnapshotId snapshotId, Version version, IndexId indexId, ShardId shardId) { Context context = new Context(snapshotId, version, indexId, shardId, shardId); context.delete(); }
void function(SnapshotId snapshotId, Version version, IndexId indexId, ShardId shardId) { Context context = new Context(snapshotId, version, indexId, shardId, shardId); context.delete(); }
/** * Delete shard snapshot * * @param snapshotId snapshot id * @param shardId shard id */
Delete shard snapshot
delete
{ "repo_name": "alexshadow007/elasticsearch", "path": "core/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java", "license": "apache-2.0", "size": 80085 }
[ "org.elasticsearch.Version", "org.elasticsearch.index.shard.ShardId", "org.elasticsearch.repositories.IndexId", "org.elasticsearch.snapshots.SnapshotId" ]
import org.elasticsearch.Version; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.repositories.IndexId; import org.elasticsearch.snapshots.SnapshotId;
import org.elasticsearch.*; import org.elasticsearch.index.shard.*; import org.elasticsearch.repositories.*; import org.elasticsearch.snapshots.*;
[ "org.elasticsearch", "org.elasticsearch.index", "org.elasticsearch.repositories", "org.elasticsearch.snapshots" ]
org.elasticsearch; org.elasticsearch.index; org.elasticsearch.repositories; org.elasticsearch.snapshots;
2,571,224
public ToolbarBuilder buttonTranslations(String... translations) { if (translations != null) { int cnt = 0; int len = translations.length; for (ToolbarButtonBuilder b : buttons) { if (cnt < len) { b.aria(translations[cnt], true); } cnt++; } } return this; }
ToolbarBuilder function(String... translations) { if (translations != null) { int cnt = 0; int len = translations.length; for (ToolbarButtonBuilder b : buttons) { if (cnt < len) { b.aria(translations[cnt], true); } cnt++; } } return this; }
/** * Set the translations to the existing buttons. The order is important. * @param translations the already added button's translations * @return the {@link ToolbarBuilder} for chaining */
Set the translations to the existing buttons. The order is important
buttonTranslations
{ "repo_name": "moberwasserlechner/vaadin-medium-editor", "path": "addon/src/main/java/com/byteowls/vaadin/mediumeditor/options/Toolbar.java", "license": "mit", "size": 13878 }
[ "com.byteowls.vaadin.mediumeditor.options.ToolbarButton" ]
import com.byteowls.vaadin.mediumeditor.options.ToolbarButton;
import com.byteowls.vaadin.mediumeditor.options.*;
[ "com.byteowls.vaadin" ]
com.byteowls.vaadin;
1,315,211
@Override public void safeRun() { long scheduleCountLocal = scheduleCountUpdater.get(this); while (true) { PendingReadRequest nextRequest = null; synchronized (readQueue) { nextRequest = readQueue.peek(); } // if read queue is empty, nothing to read, return if (null == nextRequest) { scheduleCountUpdater.set(this, 0L); return; } // if the oldest pending promise is interrupted then we must // mark the reader in error and abort all pending reads since // we don't know the last consumed read if (null == lastExceptionUpdater.get(this)) { if (nextRequest.getPromise().isCancelled()) { completeExceptionally(new DLInterruptedException("Interrupted on reading log segment " + getSegment() + " : " + nextRequest.getPromise().isCancelled()), false); } } // if the reader is in error state, stop read if (checkClosedOrInError()) { return; } // read entries from readahead cache to satisfy next read request readEntriesFromReadAheadCache(nextRequest); // check if we can satisfy the read request if (nextRequest.hasReadEntries()) { PendingReadRequest request; synchronized (readQueue) { request = readQueue.poll(); } if (null != request && nextRequest == request) { request.complete(); } else { DLIllegalStateException ise = new DLIllegalStateException("Unexpected condition at reading from " + getSegment()); nextRequest.completeExceptionally(ise); if (null != request) { request.completeExceptionally(ise); } completeExceptionally(ise, false); } } else { if (0 == scheduleCountLocal) { return; } scheduleCountLocal = scheduleCountUpdater.decrementAndGet(this); } } }
void function() { long scheduleCountLocal = scheduleCountUpdater.get(this); while (true) { PendingReadRequest nextRequest = null; synchronized (readQueue) { nextRequest = readQueue.peek(); } if (null == nextRequest) { scheduleCountUpdater.set(this, 0L); return; } if (null == lastExceptionUpdater.get(this)) { if (nextRequest.getPromise().isCancelled()) { completeExceptionally(new DLInterruptedException(STR + getSegment() + STR + nextRequest.getPromise().isCancelled()), false); } } if (checkClosedOrInError()) { return; } readEntriesFromReadAheadCache(nextRequest); if (nextRequest.hasReadEntries()) { PendingReadRequest request; synchronized (readQueue) { request = readQueue.poll(); } if (null != request && nextRequest == request) { request.complete(); } else { DLIllegalStateException ise = new DLIllegalStateException(STR + getSegment()); nextRequest.completeExceptionally(ise); if (null != request) { request.completeExceptionally(ise); } completeExceptionally(ise, false); } } else { if (0 == scheduleCountLocal) { return; } scheduleCountLocal = scheduleCountUpdater.decrementAndGet(this); } } }
/** * The core function to propagate fetched entries to read requests. */
The core function to propagate fetched entries to read requests
safeRun
{ "repo_name": "sijie/bookkeeper", "path": "stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/logsegment/BKLogSegmentEntryReader.java", "license": "apache-2.0", "size": 31585 }
[ "org.apache.distributedlog.exceptions.DLIllegalStateException", "org.apache.distributedlog.exceptions.DLInterruptedException" ]
import org.apache.distributedlog.exceptions.DLIllegalStateException; import org.apache.distributedlog.exceptions.DLInterruptedException;
import org.apache.distributedlog.exceptions.*;
[ "org.apache.distributedlog" ]
org.apache.distributedlog;
2,741,242
public void readout(final Marker marker, final MessageSupplier msgSupplier) { logger.logIfEnabled(FQCN, READOUT, marker, msgSupplier, (Throwable) null); } /** * Logs a message (only to be constructed if the logging level is the {@code READOUT} * level) with the specified Marker and including the stack trace of the {@link Throwable}
void function(final Marker marker, final MessageSupplier msgSupplier) { logger.logIfEnabled(FQCN, READOUT, marker, msgSupplier, (Throwable) null); } /** * Logs a message (only to be constructed if the logging level is the {@code READOUT} * level) with the specified Marker and including the stack trace of the {@link Throwable}
/** * Logs a message which is only to be constructed if the logging level is the * {@code READOUT} level with the specified Marker. The {@code MessageSupplier} may or may * not use the {@link MessageFactory} to construct the {@code Message}. * * @param marker the marker data specific to this log statement * @param msgSupplier A function, which when called, produces the desired log message. * @since Log4j-2.4 */
Logs a message which is only to be constructed if the logging level is the READOUT level with the specified Marker. The MessageSupplier may or may not use the <code>MessageFactory</code> to construct the Message
readout
{ "repo_name": "Betalord/BHBot", "path": "src/main/java/BHBotLogger.java", "license": "gpl-3.0", "size": 177002 }
[ "org.apache.logging.log4j.Marker", "org.apache.logging.log4j.util.MessageSupplier" ]
import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.util.MessageSupplier;
import org.apache.logging.log4j.*; import org.apache.logging.log4j.util.*;
[ "org.apache.logging" ]
org.apache.logging;
1,153,308
public static LearnerGraph mergeCollectionOfVertices(LearnerGraph original,CmpVertex redVertex, Collection<EquivalenceClass<CmpVertex,LearnerGraphCachedData>> mergedVertices, boolean updateAuxInformation) { LearnerGraph result = new LearnerGraph(original.config);result.initEmpty(); Configuration cloneConfig = result.config.copy();cloneConfig.setLearnerCloneGraph(true); LearnerGraph configHolder = new LearnerGraph(cloneConfig); // Build a map from old vertices to the corresponding equivalence classes Map<CmpVertex,EquivalenceClass<CmpVertex,LearnerGraphCachedData>> origToNew = new HashMap<CmpVertex,EquivalenceClass<CmpVertex,LearnerGraphCachedData>>(); Collection<EquivalenceClass<CmpVertex,LearnerGraphCachedData>> mergedForCompatibility = null; Map<VertID,Collection<VertID>> mergedToHard = null; if (updateAuxInformation) { mergedToHard = AbstractLearnerGraph.constructMap(cloneConfig,original); mergedForCompatibility = new ArrayList<EquivalenceClass<CmpVertex,LearnerGraphCachedData>>();mergedForCompatibility.addAll(mergedVertices); } for(EquivalenceClass<CmpVertex,LearnerGraphCachedData> eqClass:mergedVertices) { eqClass.constructMergedVertex(configHolder,false,true); for(CmpVertex v:eqClass.getStates()) origToNew.put(v, eqClass); if (updateAuxInformation) { Collection<VertID> hardVertices = new ArrayList<VertID>();mergedToHard.put(eqClass.getMergedVertex(), hardVertices); for(CmpVertex v:eqClass.getStates()) { Map<VertID,Collection<VertID>> hardOrig = original.learnerCache.getMergedToHardFacts(); if (hardOrig != null && hardOrig.containsKey(v)) { hardVertices.addAll(hardOrig.get(v)); } else hardVertices.add(v); } } } CmpVertex initVertexOriginal= original.getInit(), initVertexResult = null; EquivalenceClass<CmpVertex, LearnerGraphCachedData> initEqClass = origToNew.get(initVertexOriginal); if (initEqClass != null) { initVertexOriginal = initEqClass.getRepresentative();initVertexResult = initEqClass.getMergedVertex(); } else initVertexResult = AMEquivalenceClass.constructMergedVertexFrom(original.getInit(),original.getInit().getColour(),result,false,true);// cloning vertex here. result.transitionMatrix.put(initVertexResult, result.createNewRow()); result.setInit(initVertexResult); result.vertNegativeID = original.vertNegativeID;result.vertPositiveID=original.vertPositiveID; Queue<CmpVertex> currentExplorationBoundary = new LinkedList<CmpVertex>();// FIFO queue containing vertices to be explored // This map associates vertices in the original graph to those in the cloned one. It is populated when new vertices are explored and therefore doubles as a 'visited' set. Map<CmpVertex,CmpVertex> originalVertexToClonedVertex = original.config.getTransitionMatrixImplType() == STATETREE.STATETREE_ARRAY? new ArrayMapWithSearch<CmpVertex,CmpVertex>(original.vertPositiveID,original.vertNegativeID): new HashMap<CmpVertex,CmpVertex>(); currentExplorationBoundary.add(initVertexOriginal);originalVertexToClonedVertex.put(initVertexOriginal,initVertexResult); while(!currentExplorationBoundary.isEmpty()) {// In order to build a new transition diagram consisting of equivalence classes, I need to // navigate the existing transition diagram, in its entirety. CmpVertex current = currentExplorationBoundary.remove(); Map<Label,CmpVertex> row = result.transitionMatrix.get(originalVertexToClonedVertex.get(current)); EquivalenceClass<CmpVertex, LearnerGraphCachedData> eqClass = origToNew.get(current); assert row != null; if (eqClass != null) {// current vertex is a member of an equivalence class for(CmpVertex equivalentVertex:eqClass.getStates()) // eqClass.getOutgoing() will return a singleton at this stage because they are built to do this by the generalised score computation. processVertex(row,equivalentVertex,original,result,origToNew,originalVertexToClonedVertex,currentExplorationBoundary,mergedToHard); } else {// current vertex is standalone (that is, a singleton equivalence class) processVertex(row,current,original,result,origToNew,originalVertexToClonedVertex,currentExplorationBoundary,mergedToHard); if (mergedForCompatibility != null) {// add a singleton equivalence class with this state Map<CmpVertex,JUConstants.PAIRCOMPATIBILITY> vertexToValue = original.pairCompatibility.compatibility.get(current); if (vertexToValue != null) {// if we have any vertices associated with the current one Collection<CmpVertex> incompatibleVertices = new LinkedList<CmpVertex>(); for(Entry<CmpVertex,JUConstants.PAIRCOMPATIBILITY> entry:vertexToValue.entrySet()) if (entry.getValue() == JUConstants.PAIRCOMPATIBILITY.INCOMPATIBLE) incompatibleVertices.add(entry.getKey()); mergedForCompatibility.add(new EquivalenceClassForConstructionOfCompatibility(current, originalVertexToClonedVertex.get(current), incompatibleVertices)); } } } } result.layoutOptions = original.layoutOptions.copy();result.learnerCache.invalidate(); if (redVertex != null) { CmpVertex vertInSource = redVertex; EquivalenceClass<CmpVertex, LearnerGraphCachedData> redEqClass = origToNew.get(redVertex); if (redEqClass != null) vertInSource=redEqClass.getMergedVertex(); result.learnerCache.stateLearnt=originalVertexToClonedVertex.get(vertInSource); } if (updateAuxInformation) { AMEquivalenceClass.populateCompatible(result, mergedForCompatibility); result.learnerCache.setMergedStates(mergedVertices);result.learnerCache.mergedToHardFacts=mergedToHard; result.pathroutines.updateDepthLabelling(); } return result; } public static class EquivalenceClassForConstructionOfCompatibility implements EquivalenceClass<CmpVertex,LearnerGraphCachedData> { private final CmpVertex representative,merged; private final Collection<CmpVertex> incompatibleVertices; private final Set<CmpVertex> states = new TreeSet<CmpVertex>(); public EquivalenceClassForConstructionOfCompatibility(CmpVertex representative, CmpVertex merged, Collection<CmpVertex> incompatibleVertices) { this.representative = representative;this.merged = merged;this.incompatibleVertices = incompatibleVertices;states.add(representative); }
static LearnerGraph function(LearnerGraph original,CmpVertex redVertex, Collection<EquivalenceClass<CmpVertex,LearnerGraphCachedData>> mergedVertices, boolean updateAuxInformation) { LearnerGraph result = new LearnerGraph(original.config);result.initEmpty(); Configuration cloneConfig = result.config.copy();cloneConfig.setLearnerCloneGraph(true); LearnerGraph configHolder = new LearnerGraph(cloneConfig); Map<CmpVertex,EquivalenceClass<CmpVertex,LearnerGraphCachedData>> origToNew = new HashMap<CmpVertex,EquivalenceClass<CmpVertex,LearnerGraphCachedData>>(); Collection<EquivalenceClass<CmpVertex,LearnerGraphCachedData>> mergedForCompatibility = null; Map<VertID,Collection<VertID>> mergedToHard = null; if (updateAuxInformation) { mergedToHard = AbstractLearnerGraph.constructMap(cloneConfig,original); mergedForCompatibility = new ArrayList<EquivalenceClass<CmpVertex,LearnerGraphCachedData>>();mergedForCompatibility.addAll(mergedVertices); } for(EquivalenceClass<CmpVertex,LearnerGraphCachedData> eqClass:mergedVertices) { eqClass.constructMergedVertex(configHolder,false,true); for(CmpVertex v:eqClass.getStates()) origToNew.put(v, eqClass); if (updateAuxInformation) { Collection<VertID> hardVertices = new ArrayList<VertID>();mergedToHard.put(eqClass.getMergedVertex(), hardVertices); for(CmpVertex v:eqClass.getStates()) { Map<VertID,Collection<VertID>> hardOrig = original.learnerCache.getMergedToHardFacts(); if (hardOrig != null && hardOrig.containsKey(v)) { hardVertices.addAll(hardOrig.get(v)); } else hardVertices.add(v); } } } CmpVertex initVertexOriginal= original.getInit(), initVertexResult = null; EquivalenceClass<CmpVertex, LearnerGraphCachedData> initEqClass = origToNew.get(initVertexOriginal); if (initEqClass != null) { initVertexOriginal = initEqClass.getRepresentative();initVertexResult = initEqClass.getMergedVertex(); } else initVertexResult = AMEquivalenceClass.constructMergedVertexFrom(original.getInit(),original.getInit().getColour(),result,false,true); result.transitionMatrix.put(initVertexResult, result.createNewRow()); result.setInit(initVertexResult); result.vertNegativeID = original.vertNegativeID;result.vertPositiveID=original.vertPositiveID; Queue<CmpVertex> currentExplorationBoundary = new LinkedList<CmpVertex>(); Map<CmpVertex,CmpVertex> originalVertexToClonedVertex = original.config.getTransitionMatrixImplType() == STATETREE.STATETREE_ARRAY? new ArrayMapWithSearch<CmpVertex,CmpVertex>(original.vertPositiveID,original.vertNegativeID): new HashMap<CmpVertex,CmpVertex>(); currentExplorationBoundary.add(initVertexOriginal);originalVertexToClonedVertex.put(initVertexOriginal,initVertexResult); while(!currentExplorationBoundary.isEmpty()) { CmpVertex current = currentExplorationBoundary.remove(); Map<Label,CmpVertex> row = result.transitionMatrix.get(originalVertexToClonedVertex.get(current)); EquivalenceClass<CmpVertex, LearnerGraphCachedData> eqClass = origToNew.get(current); assert row != null; if (eqClass != null) { for(CmpVertex equivalentVertex:eqClass.getStates()) processVertex(row,equivalentVertex,original,result,origToNew,originalVertexToClonedVertex,currentExplorationBoundary,mergedToHard); } else { processVertex(row,current,original,result,origToNew,originalVertexToClonedVertex,currentExplorationBoundary,mergedToHard); if (mergedForCompatibility != null) { Map<CmpVertex,JUConstants.PAIRCOMPATIBILITY> vertexToValue = original.pairCompatibility.compatibility.get(current); if (vertexToValue != null) { Collection<CmpVertex> incompatibleVertices = new LinkedList<CmpVertex>(); for(Entry<CmpVertex,JUConstants.PAIRCOMPATIBILITY> entry:vertexToValue.entrySet()) if (entry.getValue() == JUConstants.PAIRCOMPATIBILITY.INCOMPATIBLE) incompatibleVertices.add(entry.getKey()); mergedForCompatibility.add(new EquivalenceClassForConstructionOfCompatibility(current, originalVertexToClonedVertex.get(current), incompatibleVertices)); } } } } result.layoutOptions = original.layoutOptions.copy();result.learnerCache.invalidate(); if (redVertex != null) { CmpVertex vertInSource = redVertex; EquivalenceClass<CmpVertex, LearnerGraphCachedData> redEqClass = origToNew.get(redVertex); if (redEqClass != null) vertInSource=redEqClass.getMergedVertex(); result.learnerCache.stateLearnt=originalVertexToClonedVertex.get(vertInSource); } if (updateAuxInformation) { AMEquivalenceClass.populateCompatible(result, mergedForCompatibility); result.learnerCache.setMergedStates(mergedVertices);result.learnerCache.mergedToHardFacts=mergedToHard; result.pathroutines.updateDepthLabelling(); } return result; } public static class EquivalenceClassForConstructionOfCompatibility implements EquivalenceClass<CmpVertex,LearnerGraphCachedData> { private final CmpVertex representative,merged; private final Collection<CmpVertex> incompatibleVertices; private final Set<CmpVertex> states = new TreeSet<CmpVertex>(); public EquivalenceClassForConstructionOfCompatibility(CmpVertex representative, CmpVertex merged, Collection<CmpVertex> incompatibleVertices) { this.representative = representative;this.merged = merged;this.incompatibleVertices = incompatibleVertices;states.add(representative); }
/** Merges the supplied pair of states states of the supplied machine. * Returns the result of merging and populates the collection containing equivalence classes. * * @param original the machine in which to merge two states * @param redVertex the vertex from the original graph corresponding to <em>result.learnerCache.stateLearnt</em> * of the new one. * @param updateAuxInformation if false, does not update any auxiliary information such as depth, mergedtohard, compatible vertices etc. * @return result of merging, which is a shallow copy of the original LearnerGraph. * In addition, mergedStates of the graph returned is set to equivalence classes * relating original and merged states. */
Merges the supplied pair of states states of the supplied machine. Returns the result of merging and populates the collection containing equivalence classes
mergeCollectionOfVertices
{ "repo_name": "kirilluk/statechum", "path": "src/statechum/analysis/learning/rpnicore/MergeStates.java", "license": "gpl-3.0", "size": 29139 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.HashMap", "java.util.LinkedList", "java.util.Map", "java.util.Queue", "java.util.Set", "java.util.TreeSet" ]
import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Queue; import java.util.Set; import java.util.TreeSet;
import java.util.*;
[ "java.util" ]
java.util;
482,902
@SuppressWarnings({"WaitNotInLoop", "WaitWhileNotSynced"}) public static void wait(Object mux) throws IgniteInterruptedCheckedException { try { mux.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IgniteInterruptedCheckedException(e); } }
@SuppressWarnings({STR, STR}) static void function(Object mux) throws IgniteInterruptedCheckedException { try { mux.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IgniteInterruptedCheckedException(e); } }
/** * Converts {@link InterruptedException} to {@link IgniteCheckedException}. * * @param mux Mux to wait on. * @throws IgniteInterruptedCheckedException If interrupted. */
Converts <code>InterruptedException</code> to <code>IgniteCheckedException</code>
wait
{ "repo_name": "mcherkasov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 316648 }
[ "org.apache.ignite.internal.IgniteInterruptedCheckedException" ]
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,321,778
public void cleanUserResources(long userId, Collection<Long> tempBlockIdList) { Collection<Long> blockIds = mLockedBlocksPerUser.removeAll(userId); for (long blockId : blockIds) { mUserPerLockedBlock.remove(blockId, userId); } for (Long tempBlockId : tempBlockIdList) { mTempBlockAllocatedBytes.remove(new Pair<Long, Long>(userId, tempBlockId)); } try { mFs.delete(getUserTempPath(userId), true); } catch (IOException e) { LOG.error(e.getMessage(), e); } returnSpace(userId); }
void function(long userId, Collection<Long> tempBlockIdList) { Collection<Long> blockIds = mLockedBlocksPerUser.removeAll(userId); for (long blockId : blockIds) { mUserPerLockedBlock.remove(blockId, userId); } for (Long tempBlockId : tempBlockIdList) { mTempBlockAllocatedBytes.remove(new Pair<Long, Long>(userId, tempBlockId)); } try { mFs.delete(getUserTempPath(userId), true); } catch (IOException e) { LOG.error(e.getMessage(), e); } returnSpace(userId); }
/** * Clean resources related to the removed user * * @param userId id of the removed user * @param tempBlockIdList list of block ids that are being written by the user */
Clean resources related to the removed user
cleanUserResources
{ "repo_name": "carsonwang/tachyon", "path": "core/src/main/java/tachyon/worker/hierarchy/StorageDir.java", "license": "apache-2.0", "size": 22993 }
[ "java.io.IOException", "java.util.Collection" ]
import java.io.IOException; import java.util.Collection;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,706,795
@SuppressWarnings("unused") protected void setFormatter( @NotNull final ValueObjectFieldFormatter<V, ValueObjectField<V>> formatter) { immutableSetFormatter(formatter); }
@SuppressWarnings(STR) void function( @NotNull final ValueObjectFieldFormatter<V, ValueObjectField<V>> formatter) { immutableSetFormatter(formatter); }
/** * Sets the formatter. * @param formatter the formatter itself. */
Sets the formatter
setFormatter
{ "repo_name": "rydnr/java-commons", "path": "src/main/java/org/acmsl/commons/patterns/dao/ValueObjectField.java", "license": "gpl-2.0", "size": 6429 }
[ "org.jetbrains.annotations.NotNull" ]
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
351,049
public void testGetAcquireSet() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1, ai.getAcquire()); ai.set(2); assertEquals(2, ai.getAcquire()); ai.set(-3); assertEquals(-3, ai.getAcquire()); }
void function() { AtomicInteger ai = new AtomicInteger(1); assertEquals(1, ai.getAcquire()); ai.set(2); assertEquals(2, ai.getAcquire()); ai.set(-3); assertEquals(-3, ai.getAcquire()); }
/** * getAcquire returns the last value set */
getAcquire returns the last value set
testGetAcquireSet
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "test/java/util/concurrent/tck/AtomicInteger9Test.java", "license": "gpl-2.0", "size": 6723 }
[ "java.util.concurrent.atomic.AtomicInteger" ]
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.*;
[ "java.util" ]
java.util;
2,411,567
public static AccessPermissions getAccessPermissions() throws JSONException { String jsonString = getLimitsSharedPreferences().getString( CommonUtils.getStringResource(R.string.setting_account_access_permissions), ""); AccessPermissions result = null; if (!TextUtils.isEmpty(jsonString)) { result = AccessPermissions.fromJson(new JSONObject(jsonString)); } return result; }
static AccessPermissions function() throws JSONException { String jsonString = getLimitsSharedPreferences().getString( CommonUtils.getStringResource(R.string.setting_account_access_permissions), ""); AccessPermissions result = null; if (!TextUtils.isEmpty(jsonString)) { result = AccessPermissions.fromJson(new JSONObject(jsonString)); } return result; }
/** * Get the cached access permissions information * * @return * @throws JSONException */
Get the cached access permissions information
getAccessPermissions
{ "repo_name": "photo/mobile-android", "path": "app/src/com/trovebox/android/app/Preferences.java", "license": "apache-2.0", "size": 17549 }
[ "android.text.TextUtils", "com.trovebox.android.common.model.ProfileInformation", "com.trovebox.android.common.util.CommonUtils", "org.json.JSONException", "org.json.JSONObject" ]
import android.text.TextUtils; import com.trovebox.android.common.model.ProfileInformation; import com.trovebox.android.common.util.CommonUtils; import org.json.JSONException; import org.json.JSONObject;
import android.text.*; import com.trovebox.android.common.model.*; import com.trovebox.android.common.util.*; import org.json.*;
[ "android.text", "com.trovebox.android", "org.json" ]
android.text; com.trovebox.android; org.json;
528,310
public synchronized Lease allocate(@Nonnull FilePath base) throws InterruptedException { return allocate(base,new Object()); } /** * See {@link #allocate(FilePath)}
synchronized Lease function(@Nonnull FilePath base) throws InterruptedException { return allocate(base,new Object()); } /** * See {@link #allocate(FilePath)}
/** * Allocates a workspace by adding some variation to the given base to make it unique. * * <p> * This method doesn't block prolonged amount of time. Whenever a desired workspace * is in use, the unique variation is added. */
Allocates a workspace by adding some variation to the given base to make it unique. This method doesn't block prolonged amount of time. Whenever a desired workspace is in use, the unique variation is added
allocate
{ "repo_name": "Wilfred/jenkins", "path": "core/src/main/java/hudson/slaves/WorkspaceList.java", "license": "mit", "size": 9173 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,482,042
public static ChecksumOpt processChecksumOpt(ChecksumOpt defaultOpt, ChecksumOpt userOpt, int userBytesPerChecksum) { final boolean useDefaultType; final DataChecksum.Type type; if (userOpt != null && userOpt.getChecksumType() != DataChecksum.Type.DEFAULT) { useDefaultType = false; type = userOpt.getChecksumType(); } else { useDefaultType = true; type = defaultOpt.getChecksumType(); } // bytesPerChecksum - order of preference // user specified value in bytesPerChecksum // user specified value in checksumOpt // default. if (userBytesPerChecksum > 0) { return new ChecksumOpt(type, userBytesPerChecksum); } else if (userOpt != null && userOpt.getBytesPerChecksum() > 0) { return !useDefaultType? userOpt : new ChecksumOpt(type, userOpt.getBytesPerChecksum()); } else { return useDefaultType? defaultOpt : new ChecksumOpt(type, defaultOpt.getBytesPerChecksum()); } }
static ChecksumOpt function(ChecksumOpt defaultOpt, ChecksumOpt userOpt, int userBytesPerChecksum) { final boolean useDefaultType; final DataChecksum.Type type; if (userOpt != null && userOpt.getChecksumType() != DataChecksum.Type.DEFAULT) { useDefaultType = false; type = userOpt.getChecksumType(); } else { useDefaultType = true; type = defaultOpt.getChecksumType(); } if (userBytesPerChecksum > 0) { return new ChecksumOpt(type, userBytesPerChecksum); } else if (userOpt != null && userOpt.getBytesPerChecksum() > 0) { return !useDefaultType? userOpt : new ChecksumOpt(type, userOpt.getBytesPerChecksum()); } else { return useDefaultType? defaultOpt : new ChecksumOpt(type, defaultOpt.getBytesPerChecksum()); } }
/** * A helper method for processing user input and default value to * create a combined checksum option. This is a bit complicated because * bytesPerChecksum is kept for backward compatibility. * * @param defaultOpt Default checksum option * @param userOpt User-specified checksum option. Ignored if null. * @param userBytesPerChecksum User-specified bytesPerChecksum * Ignored if < 0. */
A helper method for processing user input and default value to create a combined checksum option. This is a bit complicated because bytesPerChecksum is kept for backward compatibility
processChecksumOpt
{ "repo_name": "tseen/Federated-HDFS", "path": "tseenliu/FedHDFS-hadoop-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Options.java", "license": "apache-2.0", "size": 10319 }
[ "org.apache.hadoop.util.DataChecksum" ]
import org.apache.hadoop.util.DataChecksum;
import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,177,265
public boolean match(CRL crl) { if (!(crl instanceof X509CRL)) { return false; } X509CRL crlist = (X509CRL) crl; if ((issuerNames != null) && // the search speed depends on the class of issuerNames !(issuerNames.contains( crlist.getIssuerX500Principal().getName( X500Principal.CANONICAL)))) { return false; } if ((minCRL != null) || (maxCRL != null)) { try { // As specified in rfc 3280 (http://www.ietf.org/rfc/rfc3280.txt) // CRL Number Extension's OID is 2.5.29.20 . byte[] bytes = crlist.getExtensionValue("2.5.29.20"); //$NON-NLS-1$ bytes = (byte[]) ASN1OctetString.getInstance().decode(bytes); BigInteger crlNumber = new BigInteger((byte[]) ASN1Integer.getInstance().decode(bytes)); if ((minCRL != null) && (crlNumber.compareTo(minCRL) < 0)) { return false; } if ((maxCRL != null) && (crlNumber.compareTo(maxCRL) > 0)) { return false; } } catch (IOException e) { return false; } } if (dateAndTime != -1) { Date thisUp = crlist.getThisUpdate(); Date nextUp = crlist.getNextUpdate(); if ((thisUp == null) || (nextUp == null)) { return false; } if ((dateAndTime < thisUp.getTime()) || (dateAndTime > nextUp.getTime())) { return false; } } return true; }
boolean function(CRL crl) { if (!(crl instanceof X509CRL)) { return false; } X509CRL crlist = (X509CRL) crl; if ((issuerNames != null) && !(issuerNames.contains( crlist.getIssuerX500Principal().getName( X500Principal.CANONICAL)))) { return false; } if ((minCRL != null) (maxCRL != null)) { try { byte[] bytes = crlist.getExtensionValue(STR); bytes = (byte[]) ASN1OctetString.getInstance().decode(bytes); BigInteger crlNumber = new BigInteger((byte[]) ASN1Integer.getInstance().decode(bytes)); if ((minCRL != null) && (crlNumber.compareTo(minCRL) < 0)) { return false; } if ((maxCRL != null) && (crlNumber.compareTo(maxCRL) > 0)) { return false; } } catch (IOException e) { return false; } } if (dateAndTime != -1) { Date thisUp = crlist.getThisUpdate(); Date nextUp = crlist.getNextUpdate(); if ((thisUp == null) (nextUp == null)) { return false; } if ((dateAndTime < thisUp.getTime()) (dateAndTime > nextUp.getTime())) { return false; } } return true; }
/** * Returns whether the specified CRL matches all the criteria collected in * this instance. * * @param crl * the CRL to check. * @return {@code true} if the CRL matches all the criteria, otherwise * {@code false}. */
Returns whether the specified CRL matches all the criteria collected in this instance
match
{ "repo_name": "freeVM/freeVM", "path": "enhanced/java/classlib/modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java", "license": "apache-2.0", "size": 16056 }
[ "java.io.IOException", "java.math.BigInteger", "java.util.Date", "javax.security.auth.x500.X500Principal", "org.apache.harmony.security.asn1.ASN1Integer", "org.apache.harmony.security.asn1.ASN1OctetString" ]
import java.io.IOException; import java.math.BigInteger; import java.util.Date; import javax.security.auth.x500.X500Principal; import org.apache.harmony.security.asn1.ASN1Integer; import org.apache.harmony.security.asn1.ASN1OctetString;
import java.io.*; import java.math.*; import java.util.*; import javax.security.auth.x500.*; import org.apache.harmony.security.asn1.*;
[ "java.io", "java.math", "java.util", "javax.security", "org.apache.harmony" ]
java.io; java.math; java.util; javax.security; org.apache.harmony;
892,252
void importData(CmsObject cms, String importFile, String importPath, I_CmsReport report) throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException;
void importData(CmsObject cms, String importFile, String importPath, I_CmsReport report) throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException;
/** * Imports the data into the Cms.<p> * * @param cms the current OpenCms context object * @param importFile the name (absolute path) of the resource (zip file or folder) to be imported * @param importPath the name (absolute path) of the destination folder in the Cms (if required) * @param report a Cms report to print log messages * * @throws CmsImportExportException if operation was not successful * @throws CmsRoleViolationException if the current user has not the required role * @throws CmsXmlException if the manifest of the import could not be unmarshalled * @throws CmsException in case of errors accessing the VFS * * @deprecated use {@link #importData(CmsObject, I_CmsReport)} instead */
Imports the data into the Cms
importData
{ "repo_name": "comundus/opencms-comundus", "path": "src/main/java/org/opencms/importexport/I_CmsImportExportHandler.java", "license": "lgpl-2.1", "size": 6414 }
[ "org.opencms.file.CmsObject", "org.opencms.main.CmsException", "org.opencms.security.CmsRoleViolationException", "org.opencms.xml.CmsXmlException" ]
import org.opencms.file.CmsObject; import org.opencms.main.CmsException; import org.opencms.security.CmsRoleViolationException; import org.opencms.xml.CmsXmlException;
import org.opencms.file.*; import org.opencms.main.*; import org.opencms.security.*; import org.opencms.xml.*;
[ "org.opencms.file", "org.opencms.main", "org.opencms.security", "org.opencms.xml" ]
org.opencms.file; org.opencms.main; org.opencms.security; org.opencms.xml;
407,818
public Collection<Entity> getSelectedEntities() { return _selectedEntities.getAll(); }
Collection<Entity> function() { return _selectedEntities.getAll(); }
/** * Returns the currently selected entities. * @return The selected entities. */
Returns the currently selected entities
getSelectedEntities
{ "repo_name": "ISibboI/AgentSim", "path": "src/main/java/de/isibboi/agentsim/ui/EntitySelectionManager.java", "license": "mit", "size": 7065 }
[ "de.isibboi.agentsim.game.entities.Entity", "java.util.Collection" ]
import de.isibboi.agentsim.game.entities.Entity; import java.util.Collection;
import de.isibboi.agentsim.game.entities.*; import java.util.*;
[ "de.isibboi.agentsim", "java.util" ]
de.isibboi.agentsim; java.util;
1,325,106
@NotNull(message = "pull is never NULL") Pull get(int number);
@NotNull(message = STR) Pull get(int number);
/** * Get specific get by number. * @param number Pull request number * @return Pull request * @see <a href="http://developer.github.com/v3/pulls/#get-a-single-pull-request">Get a Single Pull Request</a> */
Get specific get by number
get
{ "repo_name": "cvrebert/typed-github", "path": "src/main/java/com/jcabi/github/Pulls.java", "license": "bsd-3-clause", "size": 3346 }
[ "javax.validation.constraints.NotNull" ]
import javax.validation.constraints.NotNull;
import javax.validation.constraints.*;
[ "javax.validation" ]
javax.validation;
889,998
public void initUIEvent(String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, int detailArg) { initEvent(typeArg, canBubbleArg, cancelableArg); this.view = viewArg; this.detail = detailArg; }
void function(String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, int detailArg) { initEvent(typeArg, canBubbleArg, cancelableArg); this.view = viewArg; this.detail = detailArg; }
/** * DOM: The <code>initUIEvent</code> method is used to initialize * the value of a <code>UIEvent</code> created through the * <code>DocumentEvent</code> interface. This method may only be * called before the <code>UIEvent</code> has been dispatched via * the <code>dispatchEvent</code> method, though it may be called * multiple times during that phase if necessary. If called * multiple times, the final invocation takes precedence. * * @param typeArg Specifies the event type. * @param canBubbleArg Specifies whether or not the event can bubble. * @param cancelableArg Specifies whether or not the event's default * action can be prevented. * @param viewArg Specifies the <code>Event</code>'s * <code>AbstractView</code>. * @param detailArg Specifies the <code>Event</code>'s detail. */
the value of a <code>UIEvent</code> created through the <code>DocumentEvent</code> interface. This method may only be called before the <code>UIEvent</code> has been dispatched via the <code>dispatchEvent</code> method, though it may be called multiple times during that phase if necessary. If called multiple times, the final invocation takes precedence
initUIEvent
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/dom/events/DOMUIEvent.java", "license": "apache-2.0", "size": 4387 }
[ "org.w3c.dom.views.AbstractView" ]
import org.w3c.dom.views.AbstractView;
import org.w3c.dom.views.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,948,946
private void updateForegroundCall(CallManager cm) { if (DBG) log("updateForegroundCall()..."); // if (DBG) PhoneUtils.dumpCallManager(); Call fgCall = cm.getActiveFgCall(); Call bgCall = cm.getFirstActiveBgCall(); if (fgCall.getState() == Call.State.IDLE) { if (DBG) log("updateForegroundCall: no active call, show holding call"); // TODO: make sure this case agrees with the latest UI spec. // Display the background call in the main info area of the // CallCard, since there is no foreground call. Note that // displayMainCallStatus() will notice if the call we passed in is on // hold, and display the "on hold" indication. fgCall = bgCall; // And be sure to not display anything in the "on hold" box. bgCall = null; } displayMainCallStatus(cm, fgCall); Phone phone = fgCall.getPhone(); int phoneType = phone.getPhoneType(); if (phoneType == Phone.PHONE_TYPE_CDMA) { if ((mApplication.cdmaPhoneCallState.getCurrentCallState() == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && mApplication.cdmaPhoneCallState.IsThreeWayCallOrigStateDialing()) { displayOnHoldCallStatus(cm, fgCall); } else { //This is required so that even if a background call is not present // we need to clean up the background call area. displayOnHoldCallStatus(cm, bgCall); } } else if ((phoneType == Phone.PHONE_TYPE_GSM) || (phoneType == Phone.PHONE_TYPE_SIP)) { displayOnHoldCallStatus(cm, bgCall); } }
void function(CallManager cm) { if (DBG) log(STR); Call fgCall = cm.getActiveFgCall(); Call bgCall = cm.getFirstActiveBgCall(); if (fgCall.getState() == Call.State.IDLE) { if (DBG) log(STR); fgCall = bgCall; bgCall = null; } displayMainCallStatus(cm, fgCall); Phone phone = fgCall.getPhone(); int phoneType = phone.getPhoneType(); if (phoneType == Phone.PHONE_TYPE_CDMA) { if ((mApplication.cdmaPhoneCallState.getCurrentCallState() == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && mApplication.cdmaPhoneCallState.IsThreeWayCallOrigStateDialing()) { displayOnHoldCallStatus(cm, fgCall); } else { displayOnHoldCallStatus(cm, bgCall); } } else if ((phoneType == Phone.PHONE_TYPE_GSM) (phoneType == Phone.PHONE_TYPE_SIP)) { displayOnHoldCallStatus(cm, bgCall); } }
/** * Updates the UI for the state where the phone is in use, but not ringing. */
Updates the UI for the state where the phone is in use, but not ringing
updateForegroundCall
{ "repo_name": "risingsunm/Phone_4.0", "path": "src/com/android/phone/CallCard.java", "license": "gpl-3.0", "size": 103627 }
[ "com.android.internal.telephony.Call", "com.android.internal.telephony.CallManager", "com.android.internal.telephony.Phone" ]
import com.android.internal.telephony.Call; import com.android.internal.telephony.CallManager; import com.android.internal.telephony.Phone;
import com.android.internal.telephony.*;
[ "com.android.internal" ]
com.android.internal;
192,828
public void addWarning(I_CmsXmlContentValue value, String message) { m_hasWarnings = true; Locale locale = value.getLocale(); Map<String, String> localeWarnings = getLocalIssueMap(m_warnings, locale); localeWarnings.put(value.getPath(), message); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_XMLCONTENT_VALIDATION_WARN_2, value.getPath(), message)); } }
void function(I_CmsXmlContentValue value, String message) { m_hasWarnings = true; Locale locale = value.getLocale(); Map<String, String> localeWarnings = getLocalIssueMap(m_warnings, locale); localeWarnings.put(value.getPath(), message); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_XMLCONTENT_VALIDATION_WARN_2, value.getPath(), message)); } }
/** * Adds an warning message to the internal list of errors, * also raised the "has warning" flag.<p> * * @param value the value that contians the warning * @param message the warning message to add */
Adds an warning message to the internal list of errors, also raised the "has warning" flag
addWarning
{ "repo_name": "mediaworx/opencms-core", "path": "src/org/opencms/xml/content/CmsXmlContentErrorHandler.java", "license": "lgpl-2.1", "size": 7250 }
[ "java.util.Locale", "java.util.Map" ]
import java.util.Locale; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
875,585
public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setBoolean("PlayerCreated", this.isPlayerCreated()); }
void function(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setBoolean(STR, this.isPlayerCreated()); }
/** * (abstract) Protected helper method to write subclass entity data to NBT. */
(abstract) Protected helper method to write subclass entity data to NBT
writeEntityToNBT
{ "repo_name": "Im-Jrotica/forge_latest", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/monster/EntityIronGolem.java", "license": "lgpl-2.1", "size": 10238 }
[ "net.minecraft.nbt.NBTTagCompound" ]
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.*;
[ "net.minecraft.nbt" ]
net.minecraft.nbt;
1,337,903
protected void processCloudletStatus(SimEvent ev) { int cloudletId = 0; int userId = 0; int vmId = 0; int status = -1; try { // if a sender using cloudletXXX() methods int data[] = (int[]) ev.getData(); cloudletId = data[0]; userId = data[1]; vmId = data[2]; status = getVmAllocationPolicy().getHost(vmId, userId).getVm(vmId,userId).getCloudletScheduler() .getCloudletStatus(cloudletId); } // if a sender using normal send() methods catch (ClassCastException c) { try { Cloudlet cl = (Cloudlet) ev.getData(); cloudletId = cl.getCloudletId(); userId = cl.getUserId(); status = getVmAllocationPolicy().getHost(vmId, userId).getVm(vmId,userId) .getCloudletScheduler().getCloudletStatus(cloudletId); } catch (Exception e) { Log.printLine(getName() + ": Error in processing CloudSimTags.CLOUDLET_STATUS"); Log.printLine(e.getMessage()); return; } } catch (Exception e) { Log.printLine(getName() + ": Error in processing CloudSimTags.CLOUDLET_STATUS"); Log.printLine(e.getMessage()); return; } int[] array = new int[3]; array[0] = getId(); array[1] = cloudletId; array[2] = status; int tag = CloudSimTags.CLOUDLET_STATUS; sendNow(userId, tag, array); }
void function(SimEvent ev) { int cloudletId = 0; int userId = 0; int vmId = 0; int status = -1; try { int data[] = (int[]) ev.getData(); cloudletId = data[0]; userId = data[1]; vmId = data[2]; status = getVmAllocationPolicy().getHost(vmId, userId).getVm(vmId,userId).getCloudletScheduler() .getCloudletStatus(cloudletId); } catch (ClassCastException c) { try { Cloudlet cl = (Cloudlet) ev.getData(); cloudletId = cl.getCloudletId(); userId = cl.getUserId(); status = getVmAllocationPolicy().getHost(vmId, userId).getVm(vmId,userId) .getCloudletScheduler().getCloudletStatus(cloudletId); } catch (Exception e) { Log.printLine(getName() + STR); Log.printLine(e.getMessage()); return; } } catch (Exception e) { Log.printLine(getName() + STR); Log.printLine(e.getMessage()); return; } int[] array = new int[3]; array[0] = getId(); array[1] = cloudletId; array[2] = status; int tag = CloudSimTags.CLOUDLET_STATUS; sendNow(userId, tag, array); }
/** * Process the event for an User/Broker who wants to know the status of a Cloudlet. This * PowerDatacenter will then send the status back to the User/Broker. * * @param ev a Sim_event object * @pre ev != null * @post $none */
Process the event for an User/Broker who wants to know the status of a Cloudlet. This PowerDatacenter will then send the status back to the User/Broker
processCloudletStatus
{ "repo_name": "Sukoon-Sharma/OpenSim", "path": "src/org/cloudbus/cloudsim/Datacenter.java", "license": "lgpl-3.0", "size": 33697 }
[ "org.cloudbus.cloudsim.core.CloudSimTags", "org.cloudbus.cloudsim.core.SimEvent" ]
import org.cloudbus.cloudsim.core.CloudSimTags; import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.*;
[ "org.cloudbus.cloudsim" ]
org.cloudbus.cloudsim;
2,237,546
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<StorageEncryptedAssetDecryptionDataInner> getEncryptionKeyAsync( String resourceGroupName, String accountName, String assetName) { return getEncryptionKeyWithResponseAsync(resourceGroupName, accountName, assetName) .flatMap( (Response<StorageEncryptedAssetDecryptionDataInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<StorageEncryptedAssetDecryptionDataInner> function( String resourceGroupName, String accountName, String assetName) { return getEncryptionKeyWithResponseAsync(resourceGroupName, accountName, assetName) .flatMap( (Response<StorageEncryptedAssetDecryptionDataInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
/** * Gets the Asset storage encryption keys used to decrypt content created by version 2 of the Media Services API. * * @param resourceGroupName The name of the resource group within the Azure subscription. * @param accountName The Media Services account name. * @param assetName The Asset name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the Asset storage encryption keys used to decrypt content created by version 2 of the Media Services API. */
Gets the Asset storage encryption keys used to decrypt content created by version 2 of the Media Services API
getEncryptionKeyAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mediaservices/azure-resourcemanager-mediaservices/src/main/java/com/azure/resourcemanager/mediaservices/implementation/AssetsClientImpl.java", "license": "mit", "size": 84704 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.resourcemanager.mediaservices.fluent.models.StorageEncryptedAssetDecryptionDataInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.mediaservices.fluent.models.StorageEncryptedAssetDecryptionDataInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.mediaservices.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
423,176
public void setServices(Collection<RemoteAmbariClusterServiceEntity> services) { this.services = services; }
void function(Collection<RemoteAmbariClusterServiceEntity> services) { this.services = services; }
/** * Set the services installed on the cluster * * @param services */
Set the services installed on the cluster
setServices
{ "repo_name": "radicalbit/ambari", "path": "ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RemoteAmbariClusterEntity.java", "license": "apache-2.0", "size": 5113 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,746,734
final ProcessManager processManager = getDebugger().getProcessManager(); // When the debug client notifies BinNavi that a // breakpoint was hit, it is necessary to mark the // breakpoint as hit. // TODO: Check for success RelocatedAddress eventAddress = null; final RegisterValues registerValues = reply.getRegisterValues(); final long tid = reply.getThreadId(); for (final ThreadRegisters threadRegisters : registerValues) { if (tid == threadRegisters.getTid()) { for (final RegisterValue registerValue : threadRegisters) { if (registerValue.isPc()) { eventAddress = new RelocatedAddress(new CAddress(registerValue.getValue())); } } } } if (eventAddress != null) { updateHitBreakpoints(DebuggerHelpers.getBreakpointAddress(getDebugger(), eventAddress)); } else { throw new IllegalStateException("IE00173: register reply did not include program counter"); } try { final TargetProcessThread thread = processManager.getThread(reply.getThreadId()); // Update the thread with the new register values. for (final ThreadRegisters threadRegisters : registerValues) { if (tid == threadRegisters.getTid()) { thread.setRegisterValues(threadRegisters.getRegisters()); break; } } processManager.setActiveThread(thread); thread.setCurrentAddress(eventAddress); } catch (final MaybeNullException exception) { NaviLogger.info("Error: there is no thread with the specified thread id %d Exception: %s", reply.getThreadId(), exception); } }
final ProcessManager processManager = getDebugger().getProcessManager(); RelocatedAddress eventAddress = null; final RegisterValues registerValues = reply.getRegisterValues(); final long tid = reply.getThreadId(); for (final ThreadRegisters threadRegisters : registerValues) { if (tid == threadRegisters.getTid()) { for (final RegisterValue registerValue : threadRegisters) { if (registerValue.isPc()) { eventAddress = new RelocatedAddress(new CAddress(registerValue.getValue())); } } } } if (eventAddress != null) { updateHitBreakpoints(DebuggerHelpers.getBreakpointAddress(getDebugger(), eventAddress)); } else { throw new IllegalStateException(STR); } try { final TargetProcessThread thread = processManager.getThread(reply.getThreadId()); for (final ThreadRegisters threadRegisters : registerValues) { if (tid == threadRegisters.getTid()) { thread.setRegisterValues(threadRegisters.getRegisters()); break; } } processManager.setActiveThread(thread); thread.setCurrentAddress(eventAddress); } catch (final MaybeNullException exception) { NaviLogger.info(STR, reply.getThreadId(), exception); } }
/** * Handles incoming Breakpoint Hit replies. * * @param reply The incoming Breakpoint Hit reply to handle. */
Handles incoming Breakpoint Hit replies
handleSuccess
{ "repo_name": "google/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/debug/debugger/synchronizers/BreakpointHitSynchronizer.java", "license": "apache-2.0", "size": 4458 }
[ "com.google.security.zynamics.binnavi.Exceptions", "com.google.security.zynamics.binnavi.Log", "com.google.security.zynamics.binnavi.debug.debugger.DebuggerHelpers", "com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager", "com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread", "com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue", "com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues", "com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters", "com.google.security.zynamics.binnavi.disassembly.RelocatedAddress", "com.google.security.zynamics.zylib.disassembly.CAddress" ]
import com.google.security.zynamics.binnavi.Exceptions; import com.google.security.zynamics.binnavi.Log; import com.google.security.zynamics.binnavi.debug.debugger.DebuggerHelpers; import com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager; import com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread; import com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue; import com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues; import com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters; import com.google.security.zynamics.binnavi.disassembly.RelocatedAddress; import com.google.security.zynamics.zylib.disassembly.CAddress;
import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.binnavi.debug.debugger.*; import com.google.security.zynamics.binnavi.debug.models.processmanager.*; import com.google.security.zynamics.binnavi.debug.models.targetinformation.*; import com.google.security.zynamics.binnavi.disassembly.*; import com.google.security.zynamics.zylib.disassembly.*;
[ "com.google.security" ]
com.google.security;
2,317,272
protected static void printMapProperties(MapBean mapBean, PrintStream ps, Properties createdProperties) { // warning...hackish... com.bbn.openmap.proj.Proj proj = mapBean.projection; ps.println("\n### OpenMap initial Map Settings ###"); Point2D llp = proj.getCenter(); printProperties(Environment.Latitude, Double.toString(llp.getY()), ps, createdProperties); printProperties(Environment.Longitude, Double.toString(llp.getX()), ps, createdProperties); printProperties(Environment.Scale, Float.toString(proj.getScale()), ps, createdProperties); printProperties(Environment.Projection, proj.getName(), ps, createdProperties); printProperties(Environment.BackgroundColor, Integer.toHexString(mapBean.getBackground().getRGB()), ps, createdProperties); // Height and Width are in the OpenMapFrame properties, or // whatever other component contains everything. }
static void function(MapBean mapBean, PrintStream ps, Properties createdProperties) { com.bbn.openmap.proj.Proj proj = mapBean.projection; ps.println(STR); Point2D llp = proj.getCenter(); printProperties(Environment.Latitude, Double.toString(llp.getY()), ps, createdProperties); printProperties(Environment.Longitude, Double.toString(llp.getX()), ps, createdProperties); printProperties(Environment.Scale, Float.toString(proj.getScale()), ps, createdProperties); printProperties(Environment.Projection, proj.getName(), ps, createdProperties); printProperties(Environment.BackgroundColor, Integer.toHexString(mapBean.getBackground().getRGB()), ps, createdProperties); }
/** * A helper function to createOpenMapProperties that gets the current * properties of the MapBean and prints them out to the PrintStream and the * provided Properties object. * * @param mapBean MapBean to get parameters from. * @param ps PrintStream to write properties to, may be null. * @param createdProperties Properties object to store properties in, may be * null. */
A helper function to createOpenMapProperties that gets the current properties of the MapBean and prints them out to the PrintStream and the provided Properties object
printMapProperties
{ "repo_name": "d2fn/passage", "path": "src/main/java/com/bbn/openmap/PropertyHandler.java", "license": "mit", "size": 65414 }
[ "java.awt.geom.Point2D", "java.io.PrintStream", "java.util.Properties" ]
import java.awt.geom.Point2D; import java.io.PrintStream; import java.util.Properties;
import java.awt.geom.*; import java.io.*; import java.util.*;
[ "java.awt", "java.io", "java.util" ]
java.awt; java.io; java.util;
66,452
@Test public void testVoronoiSpatialPartitioing() throws Exception { PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, 10, StorageLevel.MEMORY_ONLY()); spatialRDD.spatialPartitioning(GridType.VORONOI); for (Envelope d : spatialRDD.grids) { //System.out.println("PointRDD spatial partitioning grids: "+d.grid); } }
void function() throws Exception { PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, 10, StorageLevel.MEMORY_ONLY()); spatialRDD.spatialPartitioning(GridType.VORONOI); for (Envelope d : spatialRDD.grids) { } }
/** * Test voronoi spatial partitioing. * * @throws Exception the exception */
Test voronoi spatial partitioing
testVoronoiSpatialPartitioing
{ "repo_name": "Sarwat/GeoSpark", "path": "core/src/test/java/org/datasyslab/geospark/spatialRDD/PolygonRDDTest.java", "license": "mit", "size": 10621 }
[ "com.vividsolutions.jts.geom.Envelope", "org.apache.spark.storage.StorageLevel", "org.datasyslab.geospark.enums.GridType" ]
import com.vividsolutions.jts.geom.Envelope; import org.apache.spark.storage.StorageLevel; import org.datasyslab.geospark.enums.GridType;
import com.vividsolutions.jts.geom.*; import org.apache.spark.storage.*; import org.datasyslab.geospark.enums.*;
[ "com.vividsolutions.jts", "org.apache.spark", "org.datasyslab.geospark" ]
com.vividsolutions.jts; org.apache.spark; org.datasyslab.geospark;
1,872,582
public static long getLoginId(Context context) { // Get the output file for the login information File loginFile = getLoginFile(context); // Line 59 String out = null; // If it already exists, read the login ID and return it if (loginFile != null && loginFile.exists()) { try { Scanner sc = new Scanner(loginFile); out = sc.nextLine(); sc.close(); return Long.parseLong(out); } catch (Exception e) { // This should never really happen Log.e(LOG_TAG, "Unable to get LoginID from file"); // Line 72 } } return 0; }
static long function(Context context) { File loginFile = getLoginFile(context); String out = null; if (loginFile != null && loginFile.exists()) { try { Scanner sc = new Scanner(loginFile); out = sc.nextLine(); sc.close(); return Long.parseLong(out); } catch (Exception e) { Log.e(LOG_TAG, STR); } } return 0; }
/** * Returns the last LoginId input into this activity, or 0 if none is set. */
Returns the last LoginId input into this activity, or 0 if none is set
getLoginId
{ "repo_name": "ridethepenguin/coursera", "path": "POSA-14/W7-A6-VulnCheck/iRemember/peers/LoginActivityStudent2.java", "license": "gpl-2.0", "size": 3629 }
[ "android.content.Context", "android.util.Log", "java.io.File", "java.util.Scanner" ]
import android.content.Context; import android.util.Log; import java.io.File; import java.util.Scanner;
import android.content.*; import android.util.*; import java.io.*; import java.util.*;
[ "android.content", "android.util", "java.io", "java.util" ]
android.content; android.util; java.io; java.util;
1,483,363
private boolean hasTokenValue(Installation installation) { return (installation.getDeviceToken() != null && (!installation.getDeviceToken().isEmpty())); }
boolean function(Installation installation) { return (installation.getDeviceToken() != null && (!installation.getDeviceToken().isEmpty())); }
/** * A simple validation util that checks if a token is present */
A simple validation util that checks if a token is present
hasTokenValue
{ "repo_name": "sharathkiranipeer/Sharath-Repo", "path": "service/src/main/java/org/jboss/aerogear/unifiedpush/service/impl/ClientInstallationServiceImpl.java", "license": "apache-2.0", "size": 9160 }
[ "org.jboss.aerogear.unifiedpush.api.Installation" ]
import org.jboss.aerogear.unifiedpush.api.Installation;
import org.jboss.aerogear.unifiedpush.api.*;
[ "org.jboss.aerogear" ]
org.jboss.aerogear;
597,684
@Override public Iterator<T> iterator() { return this.itemList.iterator(); }
Iterator<T> function() { return this.itemList.iterator(); }
/** * Get an iterator over the items in this indexed set, in the order of increasing indices * * @return a new iterator over the items in this indexed set */
Get an iterator over the items in this indexed set, in the order of increasing indices
iterator
{ "repo_name": "nevik/JavaIndexedSetView", "path": "src/nevik/IndexedSetView.java", "license": "isc", "size": 11046 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
443,181
void setOptions(Map<String, String> options);
void setOptions(Map<String, String> options);
/** * Set extractor specific options * * @param options options to use */
Set extractor specific options
setOptions
{ "repo_name": "sidheshenator/autopsy", "path": "KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/TextExtractor.java", "license": "apache-2.0", "size": 5254 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,226,749
public String profileForDNA(List<Pair<String, String>> alin, GapManager gap) { StringBuilder sb = new StringBuilder(); int Len = alin.get(0).getSecond().length(); for (int x=0; x<Len;x++) { Set<Character> cs = getCharsAtColumn(alin,x,gap); if (cs.size()==1) { sb.append("*"); } else { sb.append(" "); }; } return sb.toString(); }
String function(List<Pair<String, String>> alin, GapManager gap) { StringBuilder sb = new StringBuilder(); int Len = alin.get(0).getSecond().length(); for (int x=0; x<Len;x++) { Set<Character> cs = getCharsAtColumn(alin,x,gap); if (cs.size()==1) { sb.append("*"); } else { sb.append(" "); }; } return sb.toString(); }
/** * Creates a profile for a DNA molecule * @param alin * @return */
Creates a profile for a DNA molecule
profileForDNA
{ "repo_name": "javieriserte/bioUtils", "path": "src/utils/ConservationImage/ClustalProfiler.java", "license": "gpl-3.0", "size": 4972 }
[ "java.util.List", "java.util.Set" ]
import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
689,345
void onDismiss(View view, Object token); }
void onDismiss(View view, Object token); }
/** * Called when the user has indicated they she would like to dismiss the view. * * @param view The originating {@link android.view.View} to be dismissed. * @param token The optional token passed to this object's constructor. */
Called when the user has indicated they she would like to dismiss the view
onDismiss
{ "repo_name": "christoandrew/Gula", "path": "library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissTopBottomTouchListener.java", "license": "mit", "size": 11456 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,624,334
public boolean equals(XMLString obj2) { if (!obj2.hasString()) return obj2.equals(this); else return str().equals(obj2.toString()); }
boolean function(XMLString obj2) { if (!obj2.hasString()) return obj2.equals(this); else return str().equals(obj2.toString()); }
/** * Compares this string to the specified object. * The result is <code>true</code> if and only if the argument is not * <code>null</code> and is a <code>String</code> object that represents * the same sequence of characters as this object. * * @param obj2 the object to compare this <code>String</code> * against. * @return <code>true</code> if the <code>String </code>are equal; * <code>false</code> otherwise. * @see java.lang.String#compareTo(java.lang.String) * @see java.lang.String#equalsIgnoreCase(java.lang.String) */
Compares this string to the specified object. The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>String</code> object that represents the same sequence of characters as this object
equals
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xpath/internal/objects/XString.java", "license": "gpl-2.0", "size": 37074 }
[ "com.sun.org.apache.xml.internal.utils.XMLString" ]
import com.sun.org.apache.xml.internal.utils.XMLString;
import com.sun.org.apache.xml.internal.utils.*;
[ "com.sun.org" ]
com.sun.org;
1,964,629
public void request(int seg) throws IOException { Packet packet = new Packet(Packet.Type.RequestAgain); packet.putProperty("Id", Integer.valueOf(owner.getID())); packet.putProperty("ShareName", filename); packet.putProperty("Segment", Integer.valueOf(seg)); owner.sendPacket(packet); }
void function(int seg) throws IOException { Packet packet = new Packet(Packet.Type.RequestAgain); packet.putProperty("Id", Integer.valueOf(owner.getID())); packet.putProperty(STR, filename); packet.putProperty(STR, Integer.valueOf(seg)); owner.sendPacket(packet); }
/** * Requests that a specific file segment be re-sent. This is used if the * packet carrying a segment was dropped. * * @param seg * The file segment ID. * @throws IOException * If the request cannot be sent due to a network error. * @see #getFilename */
Requests that a specific file segment be re-sent. This is used if the packet carrying a segment was dropped
request
{ "repo_name": "mdippery/snodes", "path": "src/main/java/snodes/net/FileTransfer.java", "license": "gpl-2.0", "size": 7530 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
656,406
public MapsGeofenceEventProperties withGeometries(List<MapsGeofenceGeometry> geometries) { this.geometries = geometries; return this; }
MapsGeofenceEventProperties function(List<MapsGeofenceGeometry> geometries) { this.geometries = geometries; return this; }
/** * Set lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence. * * @param geometries the geometries value to set * @return the MapsGeofenceEventProperties object itself. */
Set lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer around the fence
withGeometries
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/eventgrid/microsoft-azure-eventgrid/src/main/java/com/microsoft/azure/eventgrid/models/MapsGeofenceEventProperties.java", "license": "mit", "size": 4708 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,331,148
public void setValue(int _index, Value _value) { switch(_index) { case NAME : if(myGroup!=null) { myGroup.rename(this, _value.toString()); } break; } }
void function(int _index, Value _value) { switch(_index) { case NAME : if(myGroup!=null) { myGroup.rename(this, _value.toString()); } break; } }
/** * Sets the value of the registered variables. * Subclasses with internal values should extend this * Order is crucial here: it must match exactly that of the getPropertyList() * method. * @param int _index A keyword index that distinguishes among variables * @param Value _value The object holding the value for the variable. */
Sets the value of the registered variables. Subclasses with internal values should extend this Order is crucial here: it must match exactly that of the getPropertyList() method
setValue
{ "repo_name": "dobrown/tracker-mvn", "path": "src/main/java/org/opensourcephysics/ejs/control/ControlElement.java", "license": "gpl-3.0", "size": 42764 }
[ "org.opensourcephysics.ejs.control.value.Value" ]
import org.opensourcephysics.ejs.control.value.Value;
import org.opensourcephysics.ejs.control.value.*;
[ "org.opensourcephysics.ejs" ]
org.opensourcephysics.ejs;
2,629,147
default AdvancedKubernetesPodsEndpointConsumerBuilder exchangePattern( ExchangePattern exchangePattern) { doSetProperty("exchangePattern", exchangePattern); return this; }
default AdvancedKubernetesPodsEndpointConsumerBuilder exchangePattern( ExchangePattern exchangePattern) { doSetProperty(STR, exchangePattern); return this; }
/** * Sets the exchange pattern when the consumer creates an exchange. * * The option is a: <code>org.apache.camel.ExchangePattern</code> type. * * Group: consumer (advanced) */
Sets the exchange pattern when the consumer creates an exchange. The option is a: <code>org.apache.camel.ExchangePattern</code> type. Group: consumer (advanced)
exchangePattern
{ "repo_name": "ullgren/camel", "path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KubernetesPodsEndpointBuilderFactory.java", "license": "apache-2.0", "size": 45233 }
[ "org.apache.camel.ExchangePattern" ]
import org.apache.camel.ExchangePattern;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
1,345,562
public void publish(String topic, byte[] payload, byte qos) { MQTTPublish publish = MQTTPublish.newInstance(topic, payload, qos, mMqttIdentifierHelper.getIdentifier()); sendMessage(publish); }
void function(String topic, byte[] payload, byte qos) { MQTTPublish publish = MQTTPublish.newInstance(topic, payload, qos, mMqttIdentifierHelper.getIdentifier()); sendMessage(publish); }
/** * Publish a message (byte[]) to a specified topic. * * @param topic the topic * @param payload the message * @param qos the desired quality of service */
Publish a message (byte[]) to a specified topic
publish
{ "repo_name": "Qatja/android", "path": "qatja-android/src/main/java/se/wetcat/qatja/android/QatjaService.java", "license": "apache-2.0", "size": 35522 }
[ "se.wetcat.qatja.messages.MQTTPublish" ]
import se.wetcat.qatja.messages.MQTTPublish;
import se.wetcat.qatja.messages.*;
[ "se.wetcat.qatja" ]
se.wetcat.qatja;
550,165
private static void openConfigFolder(String causeFileExtNotAssociated) { try { // Open folder Desktop.getDesktop().open(getFileOrFolder("/")); if (causeFileExtNotAssociated != null) { // Open the folder because the specified file type is not associated and cannot be opened trayIcon.displayMessage(SUBZERO_POPUP_NAME, String.format("No editor has been found for file type '%s'. The config folder has been opened instead", causeFileExtNotAssociated), TrayIcon.MessageType.WARNING); } } catch (Exception e2) { trayIcon.displayMessage(SUBZERO_POPUP_NAME, "Error while opening config foler :(", TrayIcon.MessageType.ERROR); log.error("Error while opening config foler", e2); } }
static void function(String causeFileExtNotAssociated) { try { Desktop.getDesktop().open(getFileOrFolder("/")); if (causeFileExtNotAssociated != null) { trayIcon.displayMessage(SUBZERO_POPUP_NAME, String.format(STR, causeFileExtNotAssociated), TrayIcon.MessageType.WARNING); } } catch (Exception e2) { trayIcon.displayMessage(SUBZERO_POPUP_NAME, STR, TrayIcon.MessageType.ERROR); log.error(STR, e2); } }
/** * Open config folder * @param causeFileExtNotAssociated */
Open config folder
openConfigFolder
{ "repo_name": "ahuh/subzero", "path": "subzero-tool/src/main/java/org/subzero/tool/SubZeroSysTray.java", "license": "mit", "size": 20274 }
[ "java.awt.Desktop", "java.awt.TrayIcon" ]
import java.awt.Desktop; import java.awt.TrayIcon;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,479,920
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> setVpnclientIpsecParametersWithResponseAsync( String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (virtualNetworkGatewayName == null) { return Mono .error( new IllegalArgumentException( "Parameter virtualNetworkGatewayName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (vpnclientIpsecParams == null) { return Mono .error(new IllegalArgumentException("Parameter vpnclientIpsecParams is required and cannot be null.")); } else { vpnclientIpsecParams.validate(); } final String apiVersion = "2020-05-01"; context = this.client.mergeContext(context); return service .setVpnclientIpsecParameters( this.client.getEndpoint(), resourceGroupName, virtualNetworkGatewayName, apiVersion, this.client.getSubscriptionId(), vpnclientIpsecParams, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (virtualNetworkGatewayName == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (vpnclientIpsecParams == null) { return Mono .error(new IllegalArgumentException(STR)); } else { vpnclientIpsecParams.validate(); } final String apiVersion = STR; context = this.client.mergeContext(context); return service .setVpnclientIpsecParameters( this.client.getEndpoint(), resourceGroupName, virtualNetworkGatewayName, apiVersion, this.client.getSubscriptionId(), vpnclientIpsecParams, context); }
/** * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network * gateway in the specified resource group through Network resource provider. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkGatewayName The name of the virtual network gateway. * @param vpnclientIpsecParams An IPSec parameters for a virtual network gateway P2S connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an IPSec parameters for a virtual network gateway P2S connection. */
The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider
setVpnclientIpsecParametersWithResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/VirtualNetworkGatewaysClientImpl.java", "license": "mit", "size": 322151 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.network.fluent.models.VpnClientIPsecParametersInner", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.network.fluent.models.VpnClientIPsecParametersInner; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.fluent.models.*; import java.nio.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.nio" ]
com.azure.core; com.azure.resourcemanager; java.nio;
2,797,385
assertThat(monad(Stream.of(2,8,3,1)).reduceM(optionalAdd).unwrap(),equalTo(Optional.of(14))); }</pre> * * * @param reducer * @return */ default <NT,R> Monad<NT,R> reduceM(Monoid<NT> reducer){ // List(2, 8, 3, 1).foldLeftM(0) {binSmalls} -> Optional(14) // convert to list Optionals return asMonad(monad(stream()).map(value ->new ComprehenderSelector() .selectComprehender(reducer.zero().getClass()).of(value)) .sequence().reduce((Monoid)reducer)); }
assertThat(monad(Stream.of(2,8,3,1)).reduceM(optionalAdd).unwrap(),equalTo(Optional.of(14))); }</pre> * * * @param reducer * */ default <NT,R> Monad<NT,R> reduceM(Monoid<NT> reducer){ return asMonad(monad(stream()).map(value ->new ComprehenderSelector() .selectComprehender(reducer.zero().getClass()).of(value)) .sequence().reduce((Monoid)reducer)); }
/** * Perform a reduction where NT is a (native) Monad type * e.g. * <pre>{@code * Monoid<Optional<Integer>> optionalAdd = Monoid.of(Optional.of(0), (a,b)-> Optional.of(a.get()+b.get())); assertThat(monad(Stream.of(2,8,3,1)).reduceM(optionalAdd).unwrap(),equalTo(Optional.of(14))); }</pre> * * * @param reducer * @return */
Perform a reduction where NT is a (native) Monad type e.g. <code>{@code Monoid> optionalAdd = Monoid.of(Optional.of(0), (a,b)-> Optional.of(a.get()+b.get()))
reduceM
{ "repo_name": "sjfloat/cyclops", "path": "cyclops-base/src/main/java/com/aol/cyclops/internal/MonadFunctions.java", "license": "mit", "size": 3581 }
[ "com.aol.cyclops.internal.AsGenericMonad", "com.aol.cyclops.lambda.api.Monoid", "com.aol.cyclops.lambda.monads.ComprehenderSelector", "java.util.stream.Stream" ]
import com.aol.cyclops.internal.AsGenericMonad; import com.aol.cyclops.lambda.api.Monoid; import com.aol.cyclops.lambda.monads.ComprehenderSelector; import java.util.stream.Stream;
import com.aol.cyclops.internal.*; import com.aol.cyclops.lambda.api.*; import com.aol.cyclops.lambda.monads.*; import java.util.stream.*;
[ "com.aol.cyclops", "java.util" ]
com.aol.cyclops; java.util;
2,140,391
@Override public void start(Stage stage) throws IOException { primaryStage = stage; Parent root = FXMLLoader.load(getClass().getResource("/FXML/gui.fxml")); Scene scene = new Scene(root); primaryStage.setTitle("Composer"); primaryStage.setScene(scene); primaryStage.show(); }
void function(Stage stage) throws IOException { primaryStage = stage; Parent root = FXMLLoader.load(getClass().getResource(STR)); Scene scene = new Scene(root); primaryStage.setTitle(STR); primaryStage.setScene(scene); primaryStage.show(); }
/** * Metoda nacitajici gui z fxml souboru * @param stage reference na scenu * @throws IOException pokud se nepovede nacist fxml soubor */
Metoda nacitajici gui z fxml souboru
start
{ "repo_name": "vastja/Composer", "path": "src/gui/Main.java", "license": "mit", "size": 1212 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,123,628