method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void setComments(ArrayList<String> comments) {
this.comments = comments;
} | void function(ArrayList<String> comments) { this.comments = comments; } | /**
* Setter for the comments on this dish.
*
* @param comments The comments on this dish.
*/ | Setter for the comments on this dish | setComments | {
"repo_name": "wouwouwou/mod_6",
"path": "src/main/java/model/Dish.java",
"license": "gpl-2.0",
"size": 4671
} | [
"java.util.ArrayList"
]
| import java.util.ArrayList; | import java.util.*; | [
"java.util"
]
| java.util; | 1,811,097 |
@Override
public boolean containsSession(AxolotlAddress address) {
return mXmppConnectionService.databaseBackend.containsSession(account, address);
} | boolean function(AxolotlAddress address) { return mXmppConnectionService.databaseBackend.containsSession(account, address); } | /**
* Determine whether there is a committed {@link SessionRecord} for a recipientId + deviceId tuple.
*
* @param address the address of the remote client.
* @return true if a {@link SessionRecord} exists, false otherwise.
*/ | Determine whether there is a committed <code>SessionRecord</code> for a recipientId + deviceId tuple | containsSession | {
"repo_name": "chinnuabhi/Conversations",
"path": "src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java",
"license": "gpl-3.0",
"size": 15561
} | [
"org.whispersystems.libaxolotl.AxolotlAddress"
]
| import org.whispersystems.libaxolotl.AxolotlAddress; | import org.whispersystems.libaxolotl.*; | [
"org.whispersystems.libaxolotl"
]
| org.whispersystems.libaxolotl; | 46,339 |
//-----------------------------------------------------------------------
private static Writer initWriter(File file, Object encoding, boolean append) throws IOException {
if (file == null) {
throw new NullPointerException("File is missing");
}
if (encoding == null) {
throw new NullPointerException("Encoding is missing");
}
boolean fileExistedAlready = file.exists();
OutputStream stream = null;
Writer writer = null;
try {
stream = new FileOutputStream(file, append);
if (encoding instanceof Charset) {
writer = new OutputStreamWriter(stream, (Charset)encoding);
} else if (encoding instanceof CharsetEncoder) {
writer = new OutputStreamWriter(stream, (CharsetEncoder)encoding);
} else {
writer = new OutputStreamWriter(stream, (String)encoding);
}
} catch (IOException ex) {
IOUtils.closeQuietly(writer);
IOUtils.closeQuietly(stream);
if (fileExistedAlready == false) {
FileUtils.deleteQuietly(file);
}
throw ex;
} catch (RuntimeException ex) {
IOUtils.closeQuietly(writer);
IOUtils.closeQuietly(stream);
if (fileExistedAlready == false) {
FileUtils.deleteQuietly(file);
}
throw ex;
}
return writer;
} | static Writer function(File file, Object encoding, boolean append) throws IOException { if (file == null) { throw new NullPointerException(STR); } if (encoding == null) { throw new NullPointerException(STR); } boolean fileExistedAlready = file.exists(); OutputStream stream = null; Writer writer = null; try { stream = new FileOutputStream(file, append); if (encoding instanceof Charset) { writer = new OutputStreamWriter(stream, (Charset)encoding); } else if (encoding instanceof CharsetEncoder) { writer = new OutputStreamWriter(stream, (CharsetEncoder)encoding); } else { writer = new OutputStreamWriter(stream, (String)encoding); } } catch (IOException ex) { IOUtils.closeQuietly(writer); IOUtils.closeQuietly(stream); if (fileExistedAlready == false) { FileUtils.deleteQuietly(file); } throw ex; } catch (RuntimeException ex) { IOUtils.closeQuietly(writer); IOUtils.closeQuietly(stream); if (fileExistedAlready == false) { FileUtils.deleteQuietly(file); } throw ex; } return writer; } | /**
* Initialise the wrapped file writer.
* Ensure that a cleanup occurs if the writer creation fails.
*
* @param file the file to be accessed
* @param encoding the encoding to use - may be Charset, CharsetEncoder or String
* @param append true to append
* @return the initialised writer
* @throws NullPointerException if the file or encoding is null
* @throws IOException if an error occurs
*/ | Initialise the wrapped file writer. Ensure that a cleanup occurs if the writer creation fails | initWriter | {
"repo_name": "sebastiansemmle/acio",
"path": "src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java",
"license": "apache-2.0",
"size": 12110
} | [
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.OutputStream",
"java.io.OutputStreamWriter",
"java.io.Writer",
"java.nio.charset.Charset",
"java.nio.charset.CharsetEncoder",
"org.apache.commons.io.FileUtils",
"org.apache.commons.io.IOUtils"
]
| import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; | import java.io.*; import java.nio.charset.*; import org.apache.commons.io.*; | [
"java.io",
"java.nio",
"org.apache.commons"
]
| java.io; java.nio; org.apache.commons; | 2,610,327 |
@GenerateBridge(callSuperMethod = true)
public static Uni<Void> persistOrUpdate(Iterable<?> entities) {
return INSTANCE.persistOrUpdate(entities);
} | @GenerateBridge(callSuperMethod = true) static Uni<Void> function(Iterable<?> entities) { return INSTANCE.persistOrUpdate(entities); } | /**
* Persist all given entities or update them if they already exist.
*
* @param entities the entities to update
* @see #persistOrUpdate()
* @see #persistOrUpdate(Stream)
* @see #persistOrUpdate(Object,Object...)
*/ | Persist all given entities or update them if they already exist | persistOrUpdate | {
"repo_name": "quarkusio/quarkus",
"path": "extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/reactive/ReactivePanacheMongoEntityBase.java",
"license": "apache-2.0",
"size": 36909
} | [
"io.quarkus.mongodb.panache.reactive.runtime.JavaReactiveMongoOperations",
"io.quarkus.panache.common.impl.GenerateBridge",
"io.smallrye.mutiny.Uni"
]
| import io.quarkus.mongodb.panache.reactive.runtime.JavaReactiveMongoOperations; import io.quarkus.panache.common.impl.GenerateBridge; import io.smallrye.mutiny.Uni; | import io.quarkus.mongodb.panache.reactive.runtime.*; import io.quarkus.panache.common.impl.*; import io.smallrye.mutiny.*; | [
"io.quarkus.mongodb",
"io.quarkus.panache",
"io.smallrye.mutiny"
]
| io.quarkus.mongodb; io.quarkus.panache; io.smallrye.mutiny; | 1,825,226 |
@Test
public void testEquals()
throws Exception
{
File tempFile = createTempFile( "pomTest" );
FileModelSource instance = new FileModelSource( tempFile );
assertFalse( instance.equals( null ) );
assertFalse( instance.equals( new Object() ) );
assertTrue( instance.equals( instance ) );
assertTrue( instance.equals( new FileModelSource( tempFile ) ) );
} | void function() throws Exception { File tempFile = createTempFile( STR ); FileModelSource instance = new FileModelSource( tempFile ); assertFalse( instance.equals( null ) ); assertFalse( instance.equals( new Object() ) ); assertTrue( instance.equals( instance ) ); assertTrue( instance.equals( new FileModelSource( tempFile ) ) ); } | /**
* Test of equals method, of class FileModelSource.
*/ | Test of equals method, of class FileModelSource | testEquals | {
"repo_name": "cstamas/maven",
"path": "maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java",
"license": "apache-2.0",
"size": 2531
} | [
"java.io.File",
"org.junit.jupiter.api.Assertions"
]
| import java.io.File; import org.junit.jupiter.api.Assertions; | import java.io.*; import org.junit.jupiter.api.*; | [
"java.io",
"org.junit.jupiter"
]
| java.io; org.junit.jupiter; | 1,390,589 |
public ImageIcon getIcon() {
return icon;
} | ImageIcon function() { return icon; } | /**
* Returns the selected <code>icon</code>.
*
* @return The selected <code>icon</code>
*/ | Returns the selected <code>icon</code> | getIcon | {
"repo_name": "hendyyou/FST",
"path": "src/tico/imageGallery/components/TIGSelectNewImage.java",
"license": "gpl-3.0",
"size": 9235
} | [
"javax.swing.ImageIcon"
]
| import javax.swing.ImageIcon; | import javax.swing.*; | [
"javax.swing"
]
| javax.swing; | 1,966,582 |
@NonNull
default List<Integer> allIndicesOf(@NonNull String name) {
Loggers.ACCESSIBLE_BY_NAME.warn(
"{} should override allIndicesOf(String), the default implementation is a "
+ "workaround for backward compatibility, it only returns the first occurrence",
getClass().getName());
return Collections.singletonList(firstIndexOf(name));
} | default List<Integer> allIndicesOf(@NonNull String name) { Loggers.ACCESSIBLE_BY_NAME.warn( STR + STR, getClass().getName()); return Collections.singletonList(firstIndexOf(name)); } | /**
* Returns all the indices where a given identifier appears.
*
* @throws IllegalArgumentException if the name is invalid.
* @apiNote the default implementation only exists for backward compatibility. It wraps the result
* of {@link #firstIndexOf(String)} in a singleton list, which is not entirely correct, as it
* will only return the first occurrence. Therefore it also logs a warning.
* <p>Implementors should always override this method (all built-in driver implementations
* do).
*/ | Returns all the indices where a given identifier appears | allIndicesOf | {
"repo_name": "datastax/java-driver",
"path": "core/src/main/java/com/datastax/oss/driver/api/core/data/AccessibleByName.java",
"license": "apache-2.0",
"size": 3472
} | [
"com.datastax.oss.driver.internal.core.util.Loggers",
"edu.umd.cs.findbugs.annotations.NonNull",
"java.util.Collections",
"java.util.List"
]
| import com.datastax.oss.driver.internal.core.util.Loggers; import edu.umd.cs.findbugs.annotations.NonNull; import java.util.Collections; import java.util.List; | import com.datastax.oss.driver.internal.core.util.*; import edu.umd.cs.findbugs.annotations.*; import java.util.*; | [
"com.datastax.oss",
"edu.umd.cs",
"java.util"
]
| com.datastax.oss; edu.umd.cs; java.util; | 2,526,045 |
public JesadidoNode parse(final InputStream source, final Nonterminal startSymbol) {
try (TokenStream tokenStream = new TokenStream(source, this.tokenCreator)) {
return this.parse(tokenStream, startSymbol);
} catch (IOException exception) {
LOGGER.log(Level.WARNING, "An I/O-exception after the parsing.", exception);
return this.syntaxTreeFactory.createTrouble(exception.getMessage());
}
} | JesadidoNode function(final InputStream source, final Nonterminal startSymbol) { try (TokenStream tokenStream = new TokenStream(source, this.tokenCreator)) { return this.parse(tokenStream, startSymbol); } catch (IOException exception) { LOGGER.log(Level.WARNING, STR, exception); return this.syntaxTreeFactory.createTrouble(exception.getMessage()); } } | /**
* Parses the given source under the given start-symbol.
* @param source The source.
* @param startSymbol The start-symbol.
* @return The root-node of the accepted syntax-tree.
*/ | Parses the given source under the given start-symbol | parse | {
"repo_name": "stefan-baur/jesadido-poc",
"path": "src/main/java/org/jesadido/poc/core/syntax/Grammar.java",
"license": "lgpl-3.0",
"size": 9422
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.logging.Level",
"org.jesadido.poc.core.syntax.tokens.TokenStream",
"org.jesadido.poc.core.syntax.tree.JesadidoNode"
]
| import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; import org.jesadido.poc.core.syntax.tokens.TokenStream; import org.jesadido.poc.core.syntax.tree.JesadidoNode; | import java.io.*; import java.util.logging.*; import org.jesadido.poc.core.syntax.tokens.*; import org.jesadido.poc.core.syntax.tree.*; | [
"java.io",
"java.util",
"org.jesadido.poc"
]
| java.io; java.util; org.jesadido.poc; | 1,218,819 |
public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
{
if (par1EnumCreatureType == EnumCreatureType.monster && genNetherBridge.func_40483_a(par2, par3, par4))
{
return genNetherBridge.getSpawnList();
}
BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(par2, par4);
if (biomegenbase == null)
{
return null;
}
else
{
return biomegenbase.getSpawnableList(par1EnumCreatureType);
}
} | List function(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) { if (par1EnumCreatureType == EnumCreatureType.monster && genNetherBridge.func_40483_a(par2, par3, par4)) { return genNetherBridge.getSpawnList(); } BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(par2, par4); if (biomegenbase == null) { return null; } else { return biomegenbase.getSpawnableList(par1EnumCreatureType); } } | /**
* Returns a list of creatures of the specified type that can spawn at the given location.
*/ | Returns a list of creatures of the specified type that can spawn at the given location | getPossibleCreatures | {
"repo_name": "sethten/MoDesserts",
"path": "mcp50/src/minecraft/net/minecraft/src/ChunkProviderHell.java",
"license": "gpl-3.0",
"size": 18621
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 1,353,265 |
public void setFilter (SiteTreeFilter filter) {
this.filter = filter;
SiteNode root = (SiteNode) getRoot();
setFilter(filter, root);
// Never filter the root node
root.setFiltered(false);
}
| void function (SiteTreeFilter filter) { this.filter = filter; SiteNode root = (SiteNode) getRoot(); setFilter(filter, root); root.setFiltered(false); } | /**
* Set the filter for the sites tree
* @param filter
*/ | Set the filter for the sites tree | setFilter | {
"repo_name": "JordanGS/zaproxy",
"path": "src/org/parosproxy/paros/model/SiteMap.java",
"license": "apache-2.0",
"size": 29887
} | [
"org.zaproxy.zap.view.SiteTreeFilter"
]
| import org.zaproxy.zap.view.SiteTreeFilter; | import org.zaproxy.zap.view.*; | [
"org.zaproxy.zap"
]
| org.zaproxy.zap; | 1,681,404 |
protected void sendEndOfHeader(OutputStream out) throws IOException {
out.write(CRLF_BYTES);
out.write(CRLF_BYTES);
} | void function(OutputStream out) throws IOException { out.write(CRLF_BYTES); out.write(CRLF_BYTES); } | /**
* Write the end of the header to the output stream
*
* @param out The output stream
* @throws IOException If an IO problem occurs.
*/ | Write the end of the header to the output stream | sendEndOfHeader | {
"repo_name": "jprante/elasticsearch-client",
"path": "elasticsearch-client-http-netty/src/main/java/com/ning/http/multipart/Part.java",
"license": "apache-2.0",
"size": 13829
} | [
"java.io.IOException",
"java.io.OutputStream"
]
| import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
]
| java.io; | 2,340,430 |
public HttpWebRequest prepareHttpWebRequest()
throws ServiceLocalException, URISyntaxException {
try {
setUrl(this.adjustServiceUriFromCredentials(this.getUrl()));
} catch (Exception e) {
LOG.error(e);
}
return this.prepareHttpWebRequestForUrl(getUrl(), this
.getAcceptGzipEncoding(), true);
} | HttpWebRequest function() throws ServiceLocalException, URISyntaxException { try { setUrl(this.adjustServiceUriFromCredentials(this.getUrl())); } catch (Exception e) { LOG.error(e); } return this.prepareHttpWebRequestForUrl(getUrl(), this .getAcceptGzipEncoding(), true); } | /**
* Prepare http web request.
*
* @return the http web request
* @throws ServiceLocalException the service local exception
* @throws java.net.URISyntaxException the uRI syntax exception
*/ | Prepare http web request | prepareHttpWebRequest | {
"repo_name": "candrews/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/core/ExchangeService.java",
"license": "mit",
"size": 161711
} | [
"java.net.URISyntaxException"
]
| import java.net.URISyntaxException; | import java.net.*; | [
"java.net"
]
| java.net; | 1,374,001 |
public Duration getDuration() {
int hours = Integer.parseInt(durHSpinner.getValue().toString());
int mins = Integer.parseInt(durMSpinner.getValue().toString());
try {
return DatatypeFactory.newInstance().newDurationDayTime(true, 0, hours, mins, 0);
} catch (DatatypeConfigurationException e) {
return null;
}
}
public static enum ButtonClicked {
OK, ABORT;
};
private ButtonClicked buttonClicked = null;
public AddResiAttToFLPopupWindow(Window parent) {
super(parent);
if (parent instanceof FindingsListFrame) {
this.protocol = ((FindingsListFrame) parent).getCurrentProt();
}
setLayout(new BorderLayout());
// setUndecorated(true);
setResizable(false);
setTitle(translate("RevAger"));
setModal(true);
JPanel panelBase = GUITools.newPopupBasePanel();
JTextArea textTitle = GUITools
.newPopupTitleArea(translate("Please select the attendee you would like to add to the current meeting:"));
attendeeBx = new JComboBox();
createAttendeeBx();
panelBase.add(textTitle, BorderLayout.NORTH);
JLabel durLbl = new JLabel(translate("Preparation time:"));
durHSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 99, 1));
durMSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 59, 1));
boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC;
GUITools.formatSpinner(durHSpinner, hideBorder);
GUITools.formatSpinner(durMSpinner, hideBorder);
if ((Integer) durHSpinner.getValue() == 0) {
((NumberEditor) durHSpinner.getEditor()).getTextField().setText("00");
}
if ((Integer) durMSpinner.getValue() == 0) {
((NumberEditor) durMSpinner.getEditor()).getTextField().setText("00");
}
JPanel spinnerPanel = new JPanel(gbl);
spinnerPanel.setBackground(null);
JLabel hoursLbl = new JLabel(translate("Hour(s)"));
JLabel minLbl = new JLabel(translate("Minute(s)"));
GUITools.addComponent(spinnerPanel, gbl, durHSpinner, 1, 0, 1, 1, 0.0, 0, 5, 0, 0, 0,
GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
GUITools.addComponent(spinnerPanel, gbl, hoursLbl, 2, 0, 1, 1, 1.0, 0, 5, 5, 0, 0,
GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
GUITools.addComponent(spinnerPanel, gbl, durMSpinner, 3, 0, 1, 1, 0.0, 0, 5, 5, 0, 0,
GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
GUITools.addComponent(spinnerPanel, gbl, minLbl, 4, 0, 1, 1, 1.0, 0, 5, 5, 0, 0, GridBagConstraints.HORIZONTAL,
GridBagConstraints.WEST);
inputPanel.setBackground(Color.WHITE);
GUITools.addComponent(inputPanel, gbl, attendeeBx, 0, 0, 1, 1, 1.0, 0, 5, 10, 20, 10,
GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
GUITools.addComponent(inputPanel, gbl, durLbl, 0, 1, 1, 1, 1.0, 0, 5, 10, 0, 10, GridBagConstraints.NONE,
GridBagConstraints.NORTHWEST);
GUITools.addComponent(inputPanel, gbl, spinnerPanel, 0, 2, 1, 1, 1.0, 0, 5, 10, 20, 10,
GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
panelBase.add(inputPanel, BorderLayout.CENTER);
Dimension popupSize;
popupSize = new Dimension(260, 230);
JButton buttonAbort = GUITools.newImageButton();
buttonAbort.setIcon(Data.getInstance().getIcon("buttonCancel_24x24_0.png"));
buttonAbort.setRolloverIcon(Data.getInstance().getIcon("buttonCancel_24x24.png"));
buttonAbort.setToolTipText(translate("Abort"));
buttonAbort.addActionListener(new AddResiAttToProtPopupWindowAction(this, ButtonClicked.ABORT));
JButton buttonConfirm = GUITools.newImageButton();
buttonConfirm.setIcon(Data.getInstance().getIcon("buttonOk_24x24_0.png"));
buttonConfirm.setRolloverIcon(Data.getInstance().getIcon("buttonOk_24x24.png"));
buttonConfirm.setToolTipText(translate("Confirm"));
buttonConfirm.addActionListener(new AddResiAttToProtPopupWindowAction(this, ButtonClicked.OK));
JPanel panelButtons = new JPanel(new BorderLayout());
panelButtons.setBackground(UI.POPUP_BACKGROUND);
panelButtons.setBorder(BorderFactory.createLineBorder(panelButtons.getBackground(), 3));
panelButtons.add(buttonAbort, BorderLayout.WEST);
panelButtons.add(buttonConfirm, BorderLayout.EAST);
panelBase.add(panelButtons, BorderLayout.SOUTH);
add(panelBase, BorderLayout.CENTER);
setMinimumSize(popupSize);
setSize(popupSize);
setPreferredSize(popupSize);
pack();
setAlwaysOnTop(true);
toFront();
GUITools.setLocationToCursorPos(this);
}
| Duration function() { int hours = Integer.parseInt(durHSpinner.getValue().toString()); int mins = Integer.parseInt(durMSpinner.getValue().toString()); try { return DatatypeFactory.newInstance().newDurationDayTime(true, 0, hours, mins, 0); } catch (DatatypeConfigurationException e) { return null; } } public static enum ButtonClicked { OK, ABORT; }; private ButtonClicked buttonClicked = null; public AddResiAttToFLPopupWindow(Window parent) { super(parent); if (parent instanceof FindingsListFrame) { this.protocol = ((FindingsListFrame) parent).getCurrentProt(); } setLayout(new BorderLayout()); setResizable(false); setTitle(translate(STR)); setModal(true); JPanel panelBase = GUITools.newPopupBasePanel(); JTextArea textTitle = GUITools .newPopupTitleArea(translate(STR)); attendeeBx = new JComboBox(); createAttendeeBx(); panelBase.add(textTitle, BorderLayout.NORTH); JLabel durLbl = new JLabel(translate(STR)); durHSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 99, 1)); durMSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 59, 1)); boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC; GUITools.formatSpinner(durHSpinner, hideBorder); GUITools.formatSpinner(durMSpinner, hideBorder); if ((Integer) durHSpinner.getValue() == 0) { ((NumberEditor) durHSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) durMSpinner.getValue() == 0) { ((NumberEditor) durMSpinner.getEditor()).getTextField().setText("00"); } JPanel spinnerPanel = new JPanel(gbl); spinnerPanel.setBackground(null); JLabel hoursLbl = new JLabel(translate(STR)); JLabel minLbl = new JLabel(translate(STR)); GUITools.addComponent(spinnerPanel, gbl, durHSpinner, 1, 0, 1, 1, 0.0, 0, 5, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(spinnerPanel, gbl, hoursLbl, 2, 0, 1, 1, 1.0, 0, 5, 5, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(spinnerPanel, gbl, durMSpinner, 3, 0, 1, 1, 0.0, 0, 5, 5, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(spinnerPanel, gbl, minLbl, 4, 0, 1, 1, 1.0, 0, 5, 5, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); inputPanel.setBackground(Color.WHITE); GUITools.addComponent(inputPanel, gbl, attendeeBx, 0, 0, 1, 1, 1.0, 0, 5, 10, 20, 10, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST); GUITools.addComponent(inputPanel, gbl, durLbl, 0, 1, 1, 1, 1.0, 0, 5, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); GUITools.addComponent(inputPanel, gbl, spinnerPanel, 0, 2, 1, 1, 1.0, 0, 5, 10, 20, 10, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST); panelBase.add(inputPanel, BorderLayout.CENTER); Dimension popupSize; popupSize = new Dimension(260, 230); JButton buttonAbort = GUITools.newImageButton(); buttonAbort.setIcon(Data.getInstance().getIcon(STR)); buttonAbort.setRolloverIcon(Data.getInstance().getIcon(STR)); buttonAbort.setToolTipText(translate("Abort")); buttonAbort.addActionListener(new AddResiAttToProtPopupWindowAction(this, ButtonClicked.ABORT)); JButton buttonConfirm = GUITools.newImageButton(); buttonConfirm.setIcon(Data.getInstance().getIcon(STR)); buttonConfirm.setRolloverIcon(Data.getInstance().getIcon(STR)); buttonConfirm.setToolTipText(translate(STR)); buttonConfirm.addActionListener(new AddResiAttToProtPopupWindowAction(this, ButtonClicked.OK)); JPanel panelButtons = new JPanel(new BorderLayout()); panelButtons.setBackground(UI.POPUP_BACKGROUND); panelButtons.setBorder(BorderFactory.createLineBorder(panelButtons.getBackground(), 3)); panelButtons.add(buttonAbort, BorderLayout.WEST); panelButtons.add(buttonConfirm, BorderLayout.EAST); panelBase.add(panelButtons, BorderLayout.SOUTH); add(panelBase, BorderLayout.CENTER); setMinimumSize(popupSize); setSize(popupSize); setPreferredSize(popupSize); pack(); setAlwaysOnTop(true); toFront(); GUITools.setLocationToCursorPos(this); } | /**
* Gets the duration.
*
* @return the duration
*/ | Gets the duration | getDuration | {
"repo_name": "googol42/revager",
"path": "src/org/revager/gui/findings_list/AddResiAttToFLPopupWindow.java",
"license": "gpl-3.0",
"size": 8701
} | [
"java.awt.BorderLayout",
"java.awt.Color",
"java.awt.Dimension",
"java.awt.GridBagConstraints",
"java.awt.Window",
"javax.swing.BorderFactory",
"javax.swing.JButton",
"javax.swing.JComboBox",
"javax.swing.JLabel",
"javax.swing.JPanel",
"javax.swing.JSpinner",
"javax.swing.JTextArea",
"javax.swing.SpinnerNumberModel",
"javax.xml.datatype.DatatypeConfigurationException",
"javax.xml.datatype.DatatypeFactory",
"javax.xml.datatype.Duration",
"org.revager.app.model.Data",
"org.revager.gui.UI",
"org.revager.gui.actions.popup.AddResiAttToProtPopupWindowAction",
"org.revager.tools.GUITools"
]
| import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.Window; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.JTextArea; import javax.swing.SpinnerNumberModel; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import org.revager.app.model.Data; import org.revager.gui.UI; import org.revager.gui.actions.popup.AddResiAttToProtPopupWindowAction; import org.revager.tools.GUITools; | import java.awt.*; import javax.swing.*; import javax.xml.datatype.*; import org.revager.app.model.*; import org.revager.gui.*; import org.revager.gui.actions.popup.*; import org.revager.tools.*; | [
"java.awt",
"javax.swing",
"javax.xml",
"org.revager.app",
"org.revager.gui",
"org.revager.tools"
]
| java.awt; javax.swing; javax.xml; org.revager.app; org.revager.gui; org.revager.tools; | 2,831,632 |
protected String[] getRuntimeVMArguments()
{
IPath installPath = getServer().getRuntime().getLocation();
// If installPath is relative, convert to canonical path and hope for
// the best
if (!installPath.isAbsolute())
{
try
{
String installLoc = (new File(installPath.toOSString())).getCanonicalPath();
installPath = new Path(installLoc);
}
catch (IOException e)
{
// Ignore if there is a problem
}
}
IPath configPath = getRuntimeBaseDirectory();
IPath deployPath;
// If serving modules without publishing, use workspace path as the
// deploy path
if (getJettyServer().isServeModulesWithoutPublish())
{
deployPath = ResourcesPlugin.getWorkspace().getRoot().getLocation();
}
// Else normal publishing for modules
else
{
deployPath = getServerDeployDirectory();
// If deployPath is relative, convert to canonical path and hope for
// the best
if (!deployPath.isAbsolute())
{
try
{
String deployLoc = (new File(deployPath.toOSString())).getCanonicalPath();
deployPath = new Path(deployLoc);
}
catch (IOException e)
{
// Ignore if there is a problem
}
}
}
int mainPort = 8080;
int adminPort = 8082;
try {
IJettyConfiguration config = getJettyConfiguration();
mainPort = config.getMainPort().getPort();
adminPort = config.getAdminPort().getPort();
} catch (CoreException ex) {
// ignore exception and use the defaults;
}
return getJettyVersionHandler().getRuntimeVMArguments(installPath,configPath,deployPath,mainPort, adminPort, getJettyServer().isTestEnvironment());
}
| String[] function() { IPath installPath = getServer().getRuntime().getLocation(); if (!installPath.isAbsolute()) { try { String installLoc = (new File(installPath.toOSString())).getCanonicalPath(); installPath = new Path(installLoc); } catch (IOException e) { } } IPath configPath = getRuntimeBaseDirectory(); IPath deployPath; if (getJettyServer().isServeModulesWithoutPublish()) { deployPath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); } else { deployPath = getServerDeployDirectory(); if (!deployPath.isAbsolute()) { try { String deployLoc = (new File(deployPath.toOSString())).getCanonicalPath(); deployPath = new Path(deployLoc); } catch (IOException e) { } } } int mainPort = 8080; int adminPort = 8082; try { IJettyConfiguration config = getJettyConfiguration(); mainPort = config.getMainPort().getPort(); adminPort = config.getAdminPort().getPort(); } catch (CoreException ex) { } return getJettyVersionHandler().getRuntimeVMArguments(installPath,configPath,deployPath,mainPort, adminPort, getJettyServer().isTestEnvironment()); } | /**
* Return the runtime (VM) arguments.
*
* @return an array of runtime arguments
*/ | Return the runtime (VM) arguments | getRuntimeVMArguments | {
"repo_name": "bengalaviz/JettyWTPPlugin",
"path": "org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerBehaviour.java",
"license": "epl-1.0",
"size": 49353
} | [
"java.io.File",
"java.io.IOException",
"org.eclipse.core.resources.ResourcesPlugin",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.IPath",
"org.eclipse.core.runtime.Path",
"org.eclipse.jst.server.jetty.core.IJettyConfiguration"
]
| import java.io.File; import java.io.IOException; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jst.server.jetty.core.IJettyConfiguration; | import java.io.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jst.server.jetty.core.*; | [
"java.io",
"org.eclipse.core",
"org.eclipse.jst"
]
| java.io; org.eclipse.core; org.eclipse.jst; | 560,503 |
public String toString(int indentFactor) throws JSONException {
StringWriter w = new StringWriter();
synchronized (w.getBuffer()) {
return this.write(w, indentFactor, 0).toString();
}
} | String function(int indentFactor) throws JSONException { StringWriter w = new StringWriter(); synchronized (w.getBuffer()) { return this.write(w, indentFactor, 0).toString(); } } | /**
* Make a prettyprinted JSON text of this JSONObject.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @return a printable, displayable, portable, transmittable representation
* of the object, beginning with <code>{</code> <small>(left
* brace)</small> and ending with <code>}</code> <small>(right
* brace)</small>.
* @throws JSONException
* If the object contains an invalid number.
*/ | Make a prettyprinted JSON text of this JSONObject. Warning: This method assumes that the data structure is acyclical | toString | {
"repo_name": "mail929/Auto-Web-Dev",
"path": "src/org/json/JSONObject.java",
"license": "mit",
"size": 47323
} | [
"java.io.StringWriter"
]
| import java.io.StringWriter; | import java.io.*; | [
"java.io"
]
| java.io; | 132,618 |
public void init(FilterConfig config)
throws ServletException
{
String time = config.getInitParameter("cache-time");
if (time != null) {
try {
_cacheTime = Period.toPeriod(time);
} catch (Exception e) {
throw new ServletException(e);
}
}
} | void function(FilterConfig config) throws ServletException { String time = config.getInitParameter(STR); if (time != null) { try { _cacheTime = Period.toPeriod(time); } catch (Exception e) { throw new ServletException(e); } } } | /**
* Filter init reads the filter configuration
*/ | Filter init reads the filter configuration | init | {
"repo_name": "bertrama/resin",
"path": "modules/resin/src/com/caucho/filters/AnonymousExpiresFilter.java",
"license": "gpl-2.0",
"size": 4010
} | [
"com.caucho.config.types.Period",
"javax.servlet.FilterConfig",
"javax.servlet.ServletException"
]
| import com.caucho.config.types.Period; import javax.servlet.FilterConfig; import javax.servlet.ServletException; | import com.caucho.config.types.*; import javax.servlet.*; | [
"com.caucho.config",
"javax.servlet"
]
| com.caucho.config; javax.servlet; | 920,879 |
private Hop simplifyDistributiveBinaryOperation( Hop parent, Hop hi, int pos )
{
if( hi instanceof BinaryOp )
{
BinaryOp bop = (BinaryOp)hi;
Hop left = bop.getInput().get(0);
Hop right = bop.getInput().get(1);
//(X+Y*X) -> (1+Y)*X, (Y*X+X) -> (Y+1)*X
//(X-Y*X) -> (1-Y)*X, (Y*X-X) -> (Y-1)*X
boolean applied = false;
if( left.getDataType()==DataType.MATRIX && right.getDataType()==DataType.MATRIX
&& HopRewriteUtils.isValidOp(bop.getOp(), LOOKUP_VALID_DISTRIBUTIVE_BINARY) )
{
Hop X = null; Hop Y = null;
if( left instanceof BinaryOp && ((BinaryOp)left).getOp()==OpOp2.MULT ) //(Y*X-X) -> (Y-1)*X
{
Hop leftC1 = left.getInput().get(0);
Hop leftC2 = left.getInput().get(1);
//System.out.println("aOp2:"+((BinaryOp)left).getOp()+": "+leftC1.getName()+" "+leftC2.getName());
if( leftC1.getDataType()==DataType.MATRIX && leftC2.getDataType()==DataType.MATRIX &&
(right == leftC1 || right == leftC2) && leftC1 !=leftC2 ){ //any mult order
X = right;
Y = ( right == leftC1 ) ? leftC2 : leftC1;
}
if( X != null ){ //rewrite 'binary +/-'
HopRewriteUtils.removeChildReference(parent, hi);
LiteralOp literal = new LiteralOp(1);
BinaryOp plus = new BinaryOp(right.getName(), right.getDataType(), right.getValueType(), bop.getOp(), Y, literal);
HopRewriteUtils.refreshOutputParameters(plus, right);
BinaryOp mult = new BinaryOp(left.getName(), left.getDataType(), left.getValueType(), OpOp2.MULT, plus, X);
HopRewriteUtils.refreshOutputParameters(mult, left);
HopRewriteUtils.addChildReference(parent, mult, pos);
hi = mult;
applied = true;
LOG.debug("Applied simplifyDistributiveBinaryOperation1");
}
}
if( !applied && right instanceof BinaryOp && ((BinaryOp)right).getOp()==OpOp2.MULT ) //(X-Y*X) -> (1-Y)*X
{
Hop rightC1 = right.getInput().get(0);
Hop rightC2 = right.getInput().get(1);
if( rightC1.getDataType()==DataType.MATRIX && rightC2.getDataType()==DataType.MATRIX &&
(left == rightC1 || left == rightC2) && rightC1 !=rightC2 ){ //any mult order
X = left;
Y = ( left == rightC1 ) ? rightC2 : rightC1;
}
if( X != null ){ //rewrite '+/- binary'
HopRewriteUtils.removeChildReference(parent, hi);
LiteralOp literal = new LiteralOp(1);
BinaryOp plus = new BinaryOp(left.getName(), left.getDataType(), left.getValueType(), bop.getOp(), literal, Y);
HopRewriteUtils.refreshOutputParameters(plus, left);
BinaryOp mult = new BinaryOp(right.getName(), right.getDataType(), right.getValueType(), OpOp2.MULT, plus, X);
HopRewriteUtils.refreshOutputParameters(mult, right);
HopRewriteUtils.addChildReference(parent, mult, pos);
hi = mult;
LOG.debug("Applied simplifyDistributiveBinaryOperation2");
}
}
}
}
return hi;
}
| Hop function( Hop parent, Hop hi, int pos ) { if( hi instanceof BinaryOp ) { BinaryOp bop = (BinaryOp)hi; Hop left = bop.getInput().get(0); Hop right = bop.getInput().get(1); boolean applied = false; if( left.getDataType()==DataType.MATRIX && right.getDataType()==DataType.MATRIX && HopRewriteUtils.isValidOp(bop.getOp(), LOOKUP_VALID_DISTRIBUTIVE_BINARY) ) { Hop X = null; Hop Y = null; if( left instanceof BinaryOp && ((BinaryOp)left).getOp()==OpOp2.MULT ) { Hop leftC1 = left.getInput().get(0); Hop leftC2 = left.getInput().get(1); if( leftC1.getDataType()==DataType.MATRIX && leftC2.getDataType()==DataType.MATRIX && (right == leftC1 right == leftC2) && leftC1 !=leftC2 ){ X = right; Y = ( right == leftC1 ) ? leftC2 : leftC1; } if( X != null ){ HopRewriteUtils.removeChildReference(parent, hi); LiteralOp literal = new LiteralOp(1); BinaryOp plus = new BinaryOp(right.getName(), right.getDataType(), right.getValueType(), bop.getOp(), Y, literal); HopRewriteUtils.refreshOutputParameters(plus, right); BinaryOp mult = new BinaryOp(left.getName(), left.getDataType(), left.getValueType(), OpOp2.MULT, plus, X); HopRewriteUtils.refreshOutputParameters(mult, left); HopRewriteUtils.addChildReference(parent, mult, pos); hi = mult; applied = true; LOG.debug(STR); } } if( !applied && right instanceof BinaryOp && ((BinaryOp)right).getOp()==OpOp2.MULT ) { Hop rightC1 = right.getInput().get(0); Hop rightC2 = right.getInput().get(1); if( rightC1.getDataType()==DataType.MATRIX && rightC2.getDataType()==DataType.MATRIX && (left == rightC1 left == rightC2) && rightC1 !=rightC2 ){ X = left; Y = ( left == rightC1 ) ? rightC2 : rightC1; } if( X != null ){ HopRewriteUtils.removeChildReference(parent, hi); LiteralOp literal = new LiteralOp(1); BinaryOp plus = new BinaryOp(left.getName(), left.getDataType(), left.getValueType(), bop.getOp(), literal, Y); HopRewriteUtils.refreshOutputParameters(plus, left); BinaryOp mult = new BinaryOp(right.getName(), right.getDataType(), right.getValueType(), OpOp2.MULT, plus, X); HopRewriteUtils.refreshOutputParameters(mult, right); HopRewriteUtils.addChildReference(parent, mult, pos); hi = mult; LOG.debug(STR); } } } } return hi; } | /**
* (X-Y*X) -> (1-Y)*X, (Y*X-X) -> (Y-1)*X
* (X+Y*X) -> (1+Y)*X, (Y*X+X) -> (Y+1)*X
*
*
* @param parent parent high-level operator
* @param hi high-level operator
* @param pos position
* @return high-level operator
*/ | (X-Y*X) -> (1-Y)*X, (Y*X-X) -> (Y-1)*X (X+Y*X) -> (1+Y)*X, (Y*X+X) -> (Y+1)*X | simplifyDistributiveBinaryOperation | {
"repo_name": "asurve/arvind-sysml",
"path": "src/main/java/org/apache/sysml/hops/rewrite/RewriteAlgebraicSimplificationStatic.java",
"license": "apache-2.0",
"size": 72742
} | [
"org.apache.sysml.hops.BinaryOp",
"org.apache.sysml.hops.Hop",
"org.apache.sysml.hops.LiteralOp",
"org.apache.sysml.parser.Expression"
]
| import org.apache.sysml.hops.BinaryOp; import org.apache.sysml.hops.Hop; import org.apache.sysml.hops.LiteralOp; import org.apache.sysml.parser.Expression; | import org.apache.sysml.hops.*; import org.apache.sysml.parser.*; | [
"org.apache.sysml"
]
| org.apache.sysml; | 790,535 |
public static boolean tableParamsAreValid(Map<String, String> params) {
return params.get(KEY_TABLE_NAME) != null && params.get(KEY_TABLE_NAME).length() > 0
&& params.get(KEY_MASTER_ADDRESSES) != null
&& params.get(KEY_MASTER_ADDRESSES).length() > 0
&& params.get(KEY_KEY_COLUMNS) != null
&& params.get(KEY_KEY_COLUMNS).length() > 0;
}
public int getNumNodes() { return -1; } | static boolean function(Map<String, String> params) { return params.get(KEY_TABLE_NAME) != null && params.get(KEY_TABLE_NAME).length() > 0 && params.get(KEY_MASTER_ADDRESSES) != null && params.get(KEY_MASTER_ADDRESSES).length() > 0 && params.get(KEY_KEY_COLUMNS) != null && params.get(KEY_KEY_COLUMNS).length() > 0; } public int getNumNodes() { return -1; } | /**
* Returns true if all required parameters are present in the given table properties
* map.
* TODO(kudu-merge) Return a more specific error string.
*/ | Returns true if all required parameters are present in the given table properties map. TODO(kudu-merge) Return a more specific error string | tableParamsAreValid | {
"repo_name": "kapilrastogi/Impala",
"path": "fe/src/main/java/com/cloudera/impala/catalog/KuduTable.java",
"license": "apache-2.0",
"size": 11231
} | [
"java.util.Map"
]
| import java.util.Map; | import java.util.*; | [
"java.util"
]
| java.util; | 1,096,598 |
public void setLivingAnimations(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_)
{
EntityOcelot var5 = (EntityOcelot)p_78086_1_;
this.ocelotBody.rotationPointY = 12.0F;
this.ocelotBody.rotationPointZ = -10.0F;
this.ocelotHead.rotationPointY = 15.0F;
this.ocelotHead.rotationPointZ = -9.0F;
this.ocelotTail.rotationPointY = 15.0F;
this.ocelotTail.rotationPointZ = 8.0F;
this.ocelotTail2.rotationPointY = 20.0F;
this.ocelotTail2.rotationPointZ = 14.0F;
this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 13.8F;
this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -5.0F;
this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 18.0F;
this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 5.0F;
this.ocelotTail.rotateAngleX = 0.9F;
if (var5.isSneaking())
{
++this.ocelotBody.rotationPointY;
this.ocelotHead.rotationPointY += 2.0F;
++this.ocelotTail.rotationPointY;
this.ocelotTail2.rotationPointY += -4.0F;
this.ocelotTail2.rotationPointZ += 2.0F;
this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F);
this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F);
this.field_78163_i = 0;
}
else if (var5.isSprinting())
{
this.ocelotTail2.rotationPointY = this.ocelotTail.rotationPointY;
this.ocelotTail2.rotationPointZ += 2.0F;
this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F);
this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F);
this.field_78163_i = 2;
}
else if (var5.isSitting())
{
this.ocelotBody.rotateAngleX = ((float)Math.PI / 4F);
this.ocelotBody.rotationPointY += -4.0F;
this.ocelotBody.rotationPointZ += 5.0F;
this.ocelotHead.rotationPointY += -3.3F;
++this.ocelotHead.rotationPointZ;
this.ocelotTail.rotationPointY += 8.0F;
this.ocelotTail.rotationPointZ += -2.0F;
this.ocelotTail2.rotationPointY += 2.0F;
this.ocelotTail2.rotationPointZ += -0.8F;
this.ocelotTail.rotateAngleX = 1.7278761F;
this.ocelotTail2.rotateAngleX = 2.670354F;
this.ocelotFrontLeftLeg.rotateAngleX = this.ocelotFrontRightLeg.rotateAngleX = -0.15707964F;
this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 15.8F;
this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -7.0F;
this.ocelotBackLeftLeg.rotateAngleX = this.ocelotBackRightLeg.rotateAngleX = -((float)Math.PI / 2F);
this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 21.0F;
this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 1.0F;
this.field_78163_i = 3;
}
else
{
this.field_78163_i = 1;
}
} | void function(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_) { EntityOcelot var5 = (EntityOcelot)p_78086_1_; this.ocelotBody.rotationPointY = 12.0F; this.ocelotBody.rotationPointZ = -10.0F; this.ocelotHead.rotationPointY = 15.0F; this.ocelotHead.rotationPointZ = -9.0F; this.ocelotTail.rotationPointY = 15.0F; this.ocelotTail.rotationPointZ = 8.0F; this.ocelotTail2.rotationPointY = 20.0F; this.ocelotTail2.rotationPointZ = 14.0F; this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 13.8F; this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -5.0F; this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 18.0F; this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 5.0F; this.ocelotTail.rotateAngleX = 0.9F; if (var5.isSneaking()) { ++this.ocelotBody.rotationPointY; this.ocelotHead.rotationPointY += 2.0F; ++this.ocelotTail.rotationPointY; this.ocelotTail2.rotationPointY += -4.0F; this.ocelotTail2.rotationPointZ += 2.0F; this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F); this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F); this.field_78163_i = 0; } else if (var5.isSprinting()) { this.ocelotTail2.rotationPointY = this.ocelotTail.rotationPointY; this.ocelotTail2.rotationPointZ += 2.0F; this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F); this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F); this.field_78163_i = 2; } else if (var5.isSitting()) { this.ocelotBody.rotateAngleX = ((float)Math.PI / 4F); this.ocelotBody.rotationPointY += -4.0F; this.ocelotBody.rotationPointZ += 5.0F; this.ocelotHead.rotationPointY += -3.3F; ++this.ocelotHead.rotationPointZ; this.ocelotTail.rotationPointY += 8.0F; this.ocelotTail.rotationPointZ += -2.0F; this.ocelotTail2.rotationPointY += 2.0F; this.ocelotTail2.rotationPointZ += -0.8F; this.ocelotTail.rotateAngleX = 1.7278761F; this.ocelotTail2.rotateAngleX = 2.670354F; this.ocelotFrontLeftLeg.rotateAngleX = this.ocelotFrontRightLeg.rotateAngleX = -0.15707964F; this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 15.8F; this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -7.0F; this.ocelotBackLeftLeg.rotateAngleX = this.ocelotBackRightLeg.rotateAngleX = -((float)Math.PI / 2F); this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 21.0F; this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 1.0F; this.field_78163_i = 3; } else { this.field_78163_i = 1; } } | /**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/ | Used for easily adding entity-dependent animations. The second and third float params here are the same second and third as in the setRotationAngles method | setLivingAnimations | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/client/model/ModelOcelot.java",
"license": "mit",
"size": 10646
} | [
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.entity.passive.EntityOcelot"
]
| import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityOcelot; | import net.minecraft.entity.*; import net.minecraft.entity.passive.*; | [
"net.minecraft.entity"
]
| net.minecraft.entity; | 887,658 |
public ActionForward execute (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
// Initialise
super.init(request);
if (errors.size() > 0)
return mapping.findForward (IJogreWeb.FORWARD_ERROR);
// populate form
populateForm (mapping, request, form);
return mapping.findForward (IJogreWeb.FORWARD_PROFILE);
}
| ActionForward function (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { super.init(request); if (errors.size() > 0) return mapping.findForward (IJogreWeb.FORWARD_ERROR); populateForm (mapping, request, form); return mapping.findForward (IJogreWeb.FORWARD_PROFILE); } | /**
* Execute method.
*
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/ | Execute method | execute | {
"repo_name": "lsilvestre/Jogre",
"path": "webapp/src/org/jogre/webapp/actions/ProfileAction.java",
"license": "gpl-2.0",
"size": 3741
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping",
"org.jogre.webapp.IJogreWeb"
]
| import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.jogre.webapp.IJogreWeb; | import javax.servlet.http.*; import org.apache.struts.action.*; import org.jogre.webapp.*; | [
"javax.servlet",
"org.apache.struts",
"org.jogre.webapp"
]
| javax.servlet; org.apache.struts; org.jogre.webapp; | 1,569,412 |
public static ClientInterceptor newAttachHeadersInterceptor(Metadata extraHeaders) {
return new HeaderAttachingClientInterceptor(extraHeaders);
}
private static final class HeaderAttachingClientInterceptor implements ClientInterceptor {
private final Metadata extraHeaders;
// Non private to avoid synthetic class
HeaderAttachingClientInterceptor(Metadata extraHeaders) {
this.extraHeaders = checkNotNull(extraHeaders, extraHeaders);
} | static ClientInterceptor function(Metadata extraHeaders) { return new HeaderAttachingClientInterceptor(extraHeaders); } private static final class HeaderAttachingClientInterceptor implements ClientInterceptor { private final Metadata extraHeaders; HeaderAttachingClientInterceptor(Metadata extraHeaders) { this.extraHeaders = checkNotNull(extraHeaders, extraHeaders); } | /**
* Returns a client interceptor that attaches a set of headers to requests.
*
* @param extraHeaders the headers to be passed by each call that is processed by the returned
* interceptor
*/ | Returns a client interceptor that attaches a set of headers to requests | newAttachHeadersInterceptor | {
"repo_name": "rmichela/grpc-java",
"path": "stub/src/main/java/io/grpc/stub/MetadataUtils.java",
"license": "apache-2.0",
"size": 6519
} | [
"com.google.common.base.Preconditions",
"io.grpc.ClientInterceptor",
"io.grpc.Metadata"
]
| import com.google.common.base.Preconditions; import io.grpc.ClientInterceptor; import io.grpc.Metadata; | import com.google.common.base.*; import io.grpc.*; | [
"com.google.common",
"io.grpc"
]
| com.google.common; io.grpc; | 828,394 |
private void _prefixmatch() throws IOException {
if (debug) {
checkState(reader.curChar == '^');
}
builder.type = Type.PREFIXMATCH;
builder.append("^=");
reader.next();
if (debug) {
checkState(reader.curChar == '=');
}
} | void function() throws IOException { if (debug) { checkState(reader.curChar == '^'); } builder.type = Type.PREFIXMATCH; builder.append("^="); reader.next(); if (debug) { checkState(reader.curChar == '='); } } | /**
* PREFIXMATCH ^=
*/ | PREFIXMATCH ^= | _prefixmatch | {
"repo_name": "tectronics/epubcheck",
"path": "src/main/java/org/idpf/epubcheck/util/css/CssScanner.java",
"license": "mit",
"size": 31370
} | [
"com.google.common.base.Preconditions",
"java.io.IOException",
"org.idpf.epubcheck.util.css.CssToken"
]
| import com.google.common.base.Preconditions; import java.io.IOException; import org.idpf.epubcheck.util.css.CssToken; | import com.google.common.base.*; import java.io.*; import org.idpf.epubcheck.util.css.*; | [
"com.google.common",
"java.io",
"org.idpf.epubcheck"
]
| com.google.common; java.io; org.idpf.epubcheck; | 2,833,221 |
private void checkDataType(IgniteClient client, Ignite ignite, Object obj) {
IgniteCache<Object, Object> thickCache = ignite.cache(Config.DEFAULT_CACHE_NAME);
ClientCache<Object, Object> thinCache = client.cache(Config.DEFAULT_CACHE_NAME);
Integer key = 1;
thinCache.put(key, obj);
assertTrue(thinCache.containsKey(key));
Object cachedObj = thinCache.get(key);
assertEqualsArraysAware(obj, cachedObj);
assertEqualsArraysAware(obj, thickCache.get(key));
assertEquals(client.binary().typeId(obj.getClass().getName()), ignite.binary().typeId(obj.getClass().getName()));
if (!obj.getClass().isArray()) { // TODO IGNITE-12578
// Server-side comparison with the original object.
assertTrue(thinCache.replace(key, obj, obj));
// Server-side comparison with the restored object.
assertTrue(thinCache.remove(key, cachedObj));
}
} | void function(IgniteClient client, Ignite ignite, Object obj) { IgniteCache<Object, Object> thickCache = ignite.cache(Config.DEFAULT_CACHE_NAME); ClientCache<Object, Object> thinCache = client.cache(Config.DEFAULT_CACHE_NAME); Integer key = 1; thinCache.put(key, obj); assertTrue(thinCache.containsKey(key)); Object cachedObj = thinCache.get(key); assertEqualsArraysAware(obj, cachedObj); assertEqualsArraysAware(obj, thickCache.get(key)); assertEquals(client.binary().typeId(obj.getClass().getName()), ignite.binary().typeId(obj.getClass().getName())); if (!obj.getClass().isArray()) { assertTrue(thinCache.replace(key, obj, obj)); assertTrue(thinCache.remove(key, cachedObj)); } } | /**
* Check that we get the same value from the cache as we put before.
*
* @param client Thin client.
* @param ignite Ignite node.
* @param obj Value of data type to check.
*/ | Check that we get the same value from the cache as we put before | checkDataType | {
"repo_name": "nizhikov/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/client/FunctionalTest.java",
"license": "apache-2.0",
"size": 49664
} | [
"org.apache.ignite.Ignite",
"org.apache.ignite.IgniteCache",
"org.junit.Assert"
]
| import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.junit.Assert; | import org.apache.ignite.*; import org.junit.*; | [
"org.apache.ignite",
"org.junit"
]
| org.apache.ignite; org.junit; | 2,509,764 |
public static boolean useStartEndLib(
CppConfiguration config,
CcToolchainProvider toolchain,
FeatureConfiguration featureConfiguration) {
return config.startEndLibIsRequested() && toolchain.supportsStartEndLib(featureConfiguration);
} | static boolean function( CppConfiguration config, CcToolchainProvider toolchain, FeatureConfiguration featureConfiguration) { return config.startEndLibIsRequested() && toolchain.supportsStartEndLib(featureConfiguration); } | /**
* Returns true if the build implied by the given config and toolchain uses --start-lib/--end-lib
* ld options.
*/ | Returns true if the build implied by the given config and toolchain uses --start-lib/--end-lib ld options | useStartEndLib | {
"repo_name": "bazelbuild/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java",
"license": "apache-2.0",
"size": 42484
} | [
"com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures"
]
| import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures; | import com.google.devtools.build.lib.rules.cpp.*; | [
"com.google.devtools"
]
| com.google.devtools; | 1,614,706 |
protected void processSecureBytes(Connection cnx, Message message) throws Exception {
if (cnx.getServer().getRequiresCredentials()) {
if (!message.isSecureMode()) {
// This can be seen during shutdown
if (logger.isTraceEnabled(LogMarker.BRIDGE_SERVER_VERBOSE)) {
logger.trace(LogMarker.BRIDGE_SERVER_VERBOSE,
"Response message from {} for {} has no secure part.", cnx, this);
}
return;
}
byte[] partBytes = message.getSecureBytes();
if (partBytes == null) {
if (logger.isDebugEnabled()) {
logger.debug("Response message for {} has no bytes in secure part.", this);
}
return;
}
byte[] bytes = ((ConnectionImpl) cnx).decryptBytes(partBytes);
try (ByteArrayDataInput dis = new ByteArrayDataInput(bytes)) {
cnx.setConnectionID(dis.readLong());
}
}
}
/**
* @return true if this operation needs to be authenticated first
*
* New implementations of AbstractOp should override this method to return false if the
* implementation should be excluded from client authentication. e.g. PingOp#needsUserId()
* <P/>
* Also, such an operation's <code>MessageType</code> must be added in the 'if' condition
* in
* {@link ServerConnection#updateAndGetSecurityPart()} | void function(Connection cnx, Message message) throws Exception { if (cnx.getServer().getRequiresCredentials()) { if (!message.isSecureMode()) { if (logger.isTraceEnabled(LogMarker.BRIDGE_SERVER_VERBOSE)) { logger.trace(LogMarker.BRIDGE_SERVER_VERBOSE, STR, cnx, this); } return; } byte[] partBytes = message.getSecureBytes(); if (partBytes == null) { if (logger.isDebugEnabled()) { logger.debug(STR, this); } return; } byte[] bytes = ((ConnectionImpl) cnx).decryptBytes(partBytes); try (ByteArrayDataInput dis = new ByteArrayDataInput(bytes)) { cnx.setConnectionID(dis.readLong()); } } } /** * @return true if this operation needs to be authenticated first * * New implementations of AbstractOp should override this method to return false if the * implementation should be excluded from client authentication. e.g. PingOp#needsUserId() * <P/> * Also, such an operation's <code>MessageType</code> must be added in the 'if' condition * in * {@link ServerConnection#updateAndGetSecurityPart()} | /**
* Process the security information in a response from the server. If the server sends a security
* "part" we must process it so all subclasses should allow this method to be invoked.
*
* @see ServerConnection#updateAndGetSecurityPart()
*/ | Process the security information in a response from the server. If the server sends a security "part" we must process it so all subclasses should allow this method to be invoked | processSecureBytes | {
"repo_name": "jdeppe-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java",
"license": "apache-2.0",
"size": 15334
} | [
"org.apache.geode.internal.cache.tier.MessageType",
"org.apache.geode.internal.cache.tier.sockets.Message",
"org.apache.geode.internal.cache.tier.sockets.ServerConnection",
"org.apache.geode.internal.logging.log4j.LogMarker",
"org.apache.geode.internal.serialization.ByteArrayDataInput"
]
| import org.apache.geode.internal.cache.tier.MessageType; import org.apache.geode.internal.cache.tier.sockets.Message; import org.apache.geode.internal.cache.tier.sockets.ServerConnection; import org.apache.geode.internal.logging.log4j.LogMarker; import org.apache.geode.internal.serialization.ByteArrayDataInput; | import org.apache.geode.internal.cache.tier.*; import org.apache.geode.internal.cache.tier.sockets.*; import org.apache.geode.internal.logging.log4j.*; import org.apache.geode.internal.serialization.*; | [
"org.apache.geode"
]
| org.apache.geode; | 1,605,291 |
private void saveRenderingSettings(String permissions, int role,
boolean preload) throws Exception {
EventContext ctx = newUserAndGroup(permissions);
// Import the image
File f = File.createTempFile("saveRenderingSettings", "." + OME_FORMAT);
XMLMockObjects xml = new XMLMockObjects();
XMLWriter writer = new XMLWriter();
writer.writeFile(f, xml.createImage(), true);
List<Pixels> pixels = null;
try {
pixels = importFile(f, OME_FORMAT);
} catch (Throwable e) {
throw new Exception("cannot import image", e);
}
long userId = ctx.userId;
long originalOwnerId = -1;
boolean saveAs = false;
if (preload) {
originalOwnerId = ctx.userId;
saveAs = true;
assertRendering(pixels, userId, originalOwnerId, false); // View as owner
}
disconnect();
// login as another user.
EventContext ctx2 = newUserInGroup(ctx);
userId = ctx2.userId;
switch (role) {
case ADMIN:
logRootIntoGroup(ctx2);
userId = iAdmin.getEventContext().userId;
break;
case GROUP_OWNER:
makeGroupOwner();
}
assertRendering(pixels, userId, originalOwnerId, saveAs);
} | void function(String permissions, int role, boolean preload) throws Exception { EventContext ctx = newUserAndGroup(permissions); File f = File.createTempFile(STR, "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); XMLWriter writer = new XMLWriter(); writer.writeFile(f, xml.createImage(), true); List<Pixels> pixels = null; try { pixels = importFile(f, OME_FORMAT); } catch (Throwable e) { throw new Exception(STR, e); } long userId = ctx.userId; long originalOwnerId = -1; boolean saveAs = false; if (preload) { originalOwnerId = ctx.userId; saveAs = true; assertRendering(pixels, userId, originalOwnerId, false); } disconnect(); EventContext ctx2 = newUserInGroup(ctx); userId = ctx2.userId; switch (role) { case ADMIN: logRootIntoGroup(ctx2); userId = iAdmin.getEventContext().userId; break; case GROUP_OWNER: makeGroupOwner(); } assertRendering(pixels, userId, originalOwnerId, saveAs); } | /**
* Inner method which allows to optionally call the rendering method as the
* owner. If this is not called, then there will be no rendering def at all
* when the secondary uses attempts access.
*/ | Inner method which allows to optionally call the rendering method as the owner. If this is not called, then there will be no rendering def at all when the secondary uses attempts access | saveRenderingSettings | {
"repo_name": "dpwrussell/openmicroscopy",
"path": "components/tools/OmeroJava/test/integration/RenderingEngineTest.java",
"license": "gpl-2.0",
"size": 131845
} | [
"java.io.File",
"java.util.List"
]
| import java.io.File; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
]
| java.io; java.util; | 2,807,618 |
public static FunctorMap fromFile(File f) throws FileNotFoundException, IOException, ClassNotFoundException {
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
ByteArrayList bal = new ByteArrayList();
byte[] buff = new byte[1024];
int numread;
while (bis.available() > 0) {
numread = bis.read(buff);
for (int i = 0; i < numread; i++) {
bal.add(buff[i]);
}
}
return fromByteArray(bal.byteArray());
} | static FunctorMap function(File f) throws FileNotFoundException, IOException, ClassNotFoundException { FileInputStream fis = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fis); ByteArrayList bal = new ByteArrayList(); byte[] buff = new byte[1024]; int numread; while (bis.available() > 0) { numread = bis.read(buff); for (int i = 0; i < numread; i++) { bal.add(buff[i]); } } return fromByteArray(bal.byteArray()); } | /**
* Restore a functor map from a frozen file
*
* @param f the file
* @return the functor map
* @throws FileNotFoundException
* @throws IOException
* @throws ClassNotFoundException
*/ | Restore a functor map from a frozen file | fromFile | {
"repo_name": "jwoehr/Ubloid",
"path": "AndroidStudioProject/ubloid/app/src/main/java/ublu/util/Generics.java",
"license": "bsd-2-clause",
"size": 40962
} | [
"java.io.BufferedInputStream",
"java.io.File",
"java.io.FileInputStream",
"java.io.FileNotFoundException",
"java.io.IOException"
]
| import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; | import java.io.*; | [
"java.io"
]
| java.io; | 1,788,551 |
public T itemClicked(AdapterView.OnItemClickListener listener) {
if (view instanceof AdapterView) {
AdapterView<?> alv = (AdapterView<?>) view;
alv.setOnItemClickListener(listener);
}
return self();
} | T function(AdapterView.OnItemClickListener listener) { if (view instanceof AdapterView) { AdapterView<?> alv = (AdapterView<?>) view; alv.setOnItemClickListener(listener); } return self(); } | /**
* Register a callback method for when an item is clicked in the ListView.
*
* @param listener The callback method.
* @return self
*/ | Register a callback method for when an item is clicked in the ListView | itemClicked | {
"repo_name": "tsdl2013/COCOQuery",
"path": "query/src/main/java/com/cocosw/query/AbstractViewQuery.java",
"license": "apache-2.0",
"size": 31255
} | [
"android.widget.AdapterView"
]
| import android.widget.AdapterView; | import android.widget.*; | [
"android.widget"
]
| android.widget; | 103,288 |
public List<TextContentUpdateDiff> generateChanges( String
curXMLContent, String prevXMLContent ); | List<TextContentUpdateDiff> function( String curXMLContent, String prevXMLContent ); | /**
* generates the diff of two xhtml strings
* @param curXMLContent
* @param prevXMLContent
* @return
*/ | generates the diff of two xhtml strings | generateChanges | {
"repo_name": "fregaham/KiWi",
"path": "src/action/kiwi/api/revision/UpdateTextContentService.java",
"license": "bsd-3-clause",
"size": 3419
} | [
"java.util.List",
"kiwi.model.revision.TextContentUpdateDiff"
]
| import java.util.List; import kiwi.model.revision.TextContentUpdateDiff; | import java.util.*; import kiwi.model.revision.*; | [
"java.util",
"kiwi.model.revision"
]
| java.util; kiwi.model.revision; | 1,107,112 |
@Override
@Transactional
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
Token token = getPersistentToken(cookieTokens);
persistentTokenService.delete(token);
} catch (InvalidCookieException ice) {
LOGGER.info("Invalid cookie, no persistent token could be deleted");
} catch (RememberMeAuthenticationException rmae) {
LOGGER.debug("No persistent token found, so no token could be deleted");
}
}
super.logout(request, response, authentication);
} | void function(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { String rememberMeCookie = extractRememberMeCookie(request); if (rememberMeCookie != null && rememberMeCookie.length() != 0) { try { String[] cookieTokens = decodeCookie(rememberMeCookie); Token token = getPersistentToken(cookieTokens); persistentTokenService.delete(token); } catch (InvalidCookieException ice) { LOGGER.info(STR); } catch (RememberMeAuthenticationException rmae) { LOGGER.debug(STR); } } super.logout(request, response, authentication); } | /**
* When logout occurs, only invalidate the current token, and not all user sessions.
* <p/>
* The standard Spring Security implementations are too basic: they invalidate all tokens for the current user, so when he logs out from one browser, all his other sessions are destroyed.
*/ | When logout occurs, only invalidate the current token, and not all user sessions. The standard Spring Security implementations are too basic: they invalidate all tokens for the current user, so when he logs out from one browser, all his other sessions are destroyed | logout | {
"repo_name": "lsmall/flowable-engine",
"path": "modules/flowable-ui-idm/flowable-ui-idm-conf/src/main/java/org/flowable/ui/idm/security/CustomPersistentRememberMeServices.java",
"license": "apache-2.0",
"size": 11134
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.flowable.idm.api.Token",
"org.springframework.security.core.Authentication",
"org.springframework.security.web.authentication.rememberme.InvalidCookieException",
"org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException"
]
| import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.flowable.idm.api.Token; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.rememberme.InvalidCookieException; import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationException; | import javax.servlet.http.*; import org.flowable.idm.api.*; import org.springframework.security.core.*; import org.springframework.security.web.authentication.rememberme.*; | [
"javax.servlet",
"org.flowable.idm",
"org.springframework.security"
]
| javax.servlet; org.flowable.idm; org.springframework.security; | 1,439,306 |
public int getNumberOfServers() throws IOException{
int numServers = 0;
Pattern line = Pattern.compile(".*UP.*", Pattern.CASE_INSENSITIVE);
Pattern loginError = Pattern.compile(".*error.*", Pattern.CASE_INSENSITIVE);
Process proc = Runtime.getRuntime().exec("rascontrol -t");
Scanner scn = new Scanner(proc.getInputStream());
boolean loginSuccessful;
String messages = "";
if (scn.hasNextLine() && !(loginError.matcher(scn.nextLine()).find()))
loginSuccessful = true;
else {
loginSuccessful = false;
messages += "Could not log in to rascontrol. Please consider setting the envoiernmental variable RASLOGIN properly. Trying with user: rasadmin and password: rasadmin.\n\n";
}
scn.close();
if (loginSuccessful)
proc = Runtime.getRuntime().exec("rascontrol -x list srv");
else
proc = Runtime.getRuntime().exec("rascontrol -x list srv", ENV);
scn = new Scanner(proc.getInputStream());
while(scn.hasNextLine()){
String tmp = scn.nextLine();
if(line.matcher(tmp).find())
numServers++;
}
scn.close();
if (numServers <= 0) {
messages += "Failed to obtain the number of available rasdaman servers. \n\n";
System.out.println(messages);
throw new IOException();
} else {
messages += "The number of available Rasdaman servers obtained is "+numServers+
" if this number is incorrect please check the RASLOGIN envoirnmental variable.\n\n";
System.out.println(messages);
return numServers;
}
} | int function() throws IOException{ int numServers = 0; Pattern line = Pattern.compile(STR, Pattern.CASE_INSENSITIVE); Pattern loginError = Pattern.compile(STR, Pattern.CASE_INSENSITIVE); Process proc = Runtime.getRuntime().exec(STR); Scanner scn = new Scanner(proc.getInputStream()); boolean loginSuccessful; String messages = STRCould not log in to rascontrol. Please consider setting the envoiernmental variable RASLOGIN properly. Trying with user: rasadmin and password: rasadmin.\n\nSTRrascontrol -x list srvSTRrascontrol -x list srvSTRFailed to obtain the number of available rasdaman servers. \n\nSTRThe number of available Rasdaman servers obtained is STR if this number is incorrect please check the RASLOGIN envoirnmental variable.\n\n"; System.out.println(messages); return numServers; } } | /**
* Obtain the number of available Rasdaman servers through rascontrol.
*
* @return The number of servers (if found)
* @throws IOException If number of servers cannot be obtained
*/ | Obtain the number of available Rasdaman servers through rascontrol | getNumberOfServers | {
"repo_name": "miracee/rasdaman",
"path": "java/src/tests/SimultaneousConnectionsTestUtil.java",
"license": "gpl-3.0",
"size": 3103
} | [
"java.io.IOException",
"java.util.Scanner",
"java.util.regex.Pattern"
]
| import java.io.IOException; import java.util.Scanner; import java.util.regex.Pattern; | import java.io.*; import java.util.*; import java.util.regex.*; | [
"java.io",
"java.util"
]
| java.io; java.util; | 855,391 |
boolean accept( SearchOperationContext operation, Entry result ) throws LdapException;
| boolean accept( SearchOperationContext operation, Entry result ) throws LdapException; | /**
* Filters the contents of search entries on the way out the door to
* client callers. These filters can and do produce side-effects on the
* entry results if need be. These entries, their attributes and values
* should be cloned when alterations are made to avoid altering cached
* entries.
*
* @param operation The SeachOperationContext instance
* @param result the result to accept or reject possibly modifying it
* @return true if the entry is to be returned, false if it is rejected
* @throws LdapException if there are failures during evaluation
*/ | Filters the contents of search entries on the way out the door to client callers. These filters can and do produce side-effects on the entry results if need be. These entries, their attributes and values should be cloned when alterations are made to avoid altering cached entries | accept | {
"repo_name": "apache/directory-server",
"path": "core-api/src/main/java/org/apache/directory/server/core/api/filtering/EntryFilter.java",
"license": "apache-2.0",
"size": 2443
} | [
"org.apache.directory.api.ldap.model.entry.Entry",
"org.apache.directory.api.ldap.model.exception.LdapException",
"org.apache.directory.server.core.api.interceptor.context.SearchOperationContext"
]
| import org.apache.directory.api.ldap.model.entry.Entry; import org.apache.directory.api.ldap.model.exception.LdapException; import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext; | import org.apache.directory.api.ldap.model.entry.*; import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.server.core.api.interceptor.context.*; | [
"org.apache.directory"
]
| org.apache.directory; | 1,678,688 |
@Test
public void testPRLocalQueryingWithIndexes() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
setCacheInVMs(vm0);
// Creating PR's on the participating VM's
// Creating DataStore node on the VM0.
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(name, redundancy,
Portfolio.class));
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex1",
"r1.ID", "/" + name + " r1", null));
// Creating Colocated Region DataStore node on the VM0.
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRColocatedCreate(coloName,
redundancy, name));
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRIndexCreate(coloName, "IdIndex2",
"r2.id", "/" + coloName + " r2", null));
// Creating local region on vm0 to compare the results of query.
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForLocalRegionCreation(localName,
Portfolio.class));
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForLocalRegionCreation(coloLocalName,
NewPortfolio.class));
// Generating portfolio object array to be populated across the PR's & Local Regions
Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(localName, portfolio, cnt,
cntDest));
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(coloLocalName, newPortfolio,
cnt, cntDest));
// Putting the data into the PR's created
vm0.invoke(
prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(coloName, newPortfolio, cnt,
cntDest));
// querying the VM for data and comparing the result with query result of local region.
vm0.invoke(
prQueryDUnitHelper.getCacheSerializableRunnableForPRColocatedDataSetQueryAndCompareResults(
name, coloName, localName, coloLocalName));
} | void function() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); setCacheInVMs(vm0); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(name, redundancy, Portfolio.class)); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRIndexCreate(name, STR, "r1.ID", "/" + name + STR, null)); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRColocatedCreate(coloName, redundancy, name)); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRIndexCreate(coloName, STR, "r2.id", "/" + coloName + STR, null)); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForLocalRegionCreation(localName, Portfolio.class)); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForLocalRegionCreation(coloLocalName, NewPortfolio.class)); Portfolio[] portfolio = createPortfoliosAndPositions(cntDest); NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(localName, portfolio, cnt, cntDest)); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(coloLocalName, newPortfolio, cnt, cntDest)); vm0.invoke( prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest)); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(coloName, newPortfolio, cnt, cntDest)); vm0.invoke( prQueryDUnitHelper.getCacheSerializableRunnableForPRColocatedDataSetQueryAndCompareResults( name, coloName, localName, coloLocalName)); } | /**
* 1. Creates two PR Data Stores with redundantCopies = 1.
*
* <p>
* 2. Populates the region with test data.
*
* <p>
* 3. Fires a LOCAL query on one data store VM and verifies the result.
*/ | 1. Creates two PR Data Stores with redundantCopies = 1. 2. Populates the region with test data. 3. Fires a LOCAL query on one data store VM and verifies the result | testPRLocalQueryingWithIndexes | {
"repo_name": "deepakddixit/incubator-geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java",
"license": "apache-2.0",
"size": 44177
} | [
"org.apache.geode.cache.query.Utils",
"org.apache.geode.cache.query.data.Portfolio",
"org.apache.geode.test.dunit.Host"
]
| import org.apache.geode.cache.query.Utils; import org.apache.geode.cache.query.data.Portfolio; import org.apache.geode.test.dunit.Host; | import org.apache.geode.cache.query.*; import org.apache.geode.cache.query.data.*; import org.apache.geode.test.dunit.*; | [
"org.apache.geode"
]
| org.apache.geode; | 2,236,009 |
@ApiMethod(name = "getDeviceInfo")
public DeviceInfo getDeviceInfo(@Named("id") String id) {
EntityManager mgr = getEntityManager();
DeviceInfo deviceinfo = null;
try {
deviceinfo = mgr.find(DeviceInfo.class, id);
} finally {
mgr.close();
}
return deviceinfo;
} | @ApiMethod(name = STR) DeviceInfo function(@Named("id") String id) { EntityManager mgr = getEntityManager(); DeviceInfo deviceinfo = null; try { deviceinfo = mgr.find(DeviceInfo.class, id); } finally { mgr.close(); } return deviceinfo; } | /**
* This method gets the entity having primary key id. It uses HTTP GET method.
*
* @param id the primary key of the java bean.
* @return The entity with primary key id.
*/ | This method gets the entity having primary key id. It uses HTTP GET method | getDeviceInfo | {
"repo_name": "rajeev781/solutions-mobile-shopping-assistant-backend-java",
"path": "MobileAssistant-Tutorial/MobileAssistant-AppEngine/src/com/google/samplesolutions/mobileassistant/DeviceInfoEndpoint.java",
"license": "apache-2.0",
"size": 5147
} | [
"com.google.api.server.spi.config.ApiMethod",
"javax.inject.Named",
"javax.persistence.EntityManager"
]
| import com.google.api.server.spi.config.ApiMethod; import javax.inject.Named; import javax.persistence.EntityManager; | import com.google.api.server.spi.config.*; import javax.inject.*; import javax.persistence.*; | [
"com.google.api",
"javax.inject",
"javax.persistence"
]
| com.google.api; javax.inject; javax.persistence; | 625,881 |
public RexLiteral makeTimestampLiteral(
Calendar timestamp,
int precision) {
assert timestamp != null;
return makeLiteral(
timestamp,
typeFactory.createSqlType(SqlTypeName.TIMESTAMP, precision),
SqlTypeName.TIMESTAMP);
} | RexLiteral function( Calendar timestamp, int precision) { assert timestamp != null; return makeLiteral( timestamp, typeFactory.createSqlType(SqlTypeName.TIMESTAMP, precision), SqlTypeName.TIMESTAMP); } | /**
* Creates a Timestamp literal.
*/ | Creates a Timestamp literal | makeTimestampLiteral | {
"repo_name": "wanglan/calcite",
"path": "core/src/main/java/org/apache/calcite/rex/RexBuilder.java",
"license": "apache-2.0",
"size": 45773
} | [
"java.util.Calendar",
"org.apache.calcite.sql.type.SqlTypeName"
]
| import java.util.Calendar; import org.apache.calcite.sql.type.SqlTypeName; | import java.util.*; import org.apache.calcite.sql.type.*; | [
"java.util",
"org.apache.calcite"
]
| java.util; org.apache.calcite; | 2,034,314 |
public static void main(String[] args) throws ParseException, IOException {
Client client = new Client(
new DumpProcessingController("wikidatawiki"), args);
client.performActions();
} | static void function(String[] args) throws ParseException, IOException { Client client = new Client( new DumpProcessingController(STR), args); client.performActions(); } | /**
* Launches the client with the specified parameters.
*
* @param args
* command line parameters
* @throws ParseException
* @throws IOException
*/ | Launches the client with the specified parameters | main | {
"repo_name": "zazi/Wikidata-Toolkit",
"path": "wdtk-client/src/main/java/org/wikidata/wdtk/client/Client.java",
"license": "apache-2.0",
"size": 8439
} | [
"java.io.IOException",
"org.apache.commons.cli.ParseException",
"org.wikidata.wdtk.dumpfiles.DumpProcessingController"
]
| import java.io.IOException; import org.apache.commons.cli.ParseException; import org.wikidata.wdtk.dumpfiles.DumpProcessingController; | import java.io.*; import org.apache.commons.cli.*; import org.wikidata.wdtk.dumpfiles.*; | [
"java.io",
"org.apache.commons",
"org.wikidata.wdtk"
]
| java.io; org.apache.commons; org.wikidata.wdtk; | 2,649,785 |
public static Map<String, String> asMap(Properties properties) {
Map<String, String> map = Generics.newHashMap();
for (Entry<Object, Object> entry : properties.entrySet()) {
map.put((String)entry.getKey(), (String)entry.getValue());
}
return map;
} | static Map<String, String> function(Properties properties) { Map<String, String> map = Generics.newHashMap(); for (Entry<Object, Object> entry : properties.entrySet()) { map.put((String)entry.getKey(), (String)entry.getValue()); } return map; } | /**
* Tired of Properties not behaving like {@code Map<String,String>}s? This method will solve that problem for you.
*/ | Tired of Properties not behaving like Maps? This method will solve that problem for you | asMap | {
"repo_name": "intfloat/CoreNLP",
"path": "src/edu/stanford/nlp/util/PropertiesUtils.java",
"license": "gpl-2.0",
"size": 14219
} | [
"java.util.Map",
"java.util.Properties"
]
| import java.util.Map; import java.util.Properties; | import java.util.*; | [
"java.util"
]
| java.util; | 2,182,591 |
public static Optional<HealthCheck.Result> invoke(CamelContext camelContext, String id, Map<String, Object> options) {
final HealthCheckRegistry registry = HealthCheckRegistry.get(camelContext);
if (registry != null) {
return registry.getCheck(id).map(check -> check.call(options));
} else {
LOG.debug("No health check source found");
}
return Optional.empty();
} | static Optional<HealthCheck.Result> function(CamelContext camelContext, String id, Map<String, Object> options) { final HealthCheckRegistry registry = HealthCheckRegistry.get(camelContext); if (registry != null) { return registry.getCheck(id).map(check -> check.call(options)); } else { LOG.debug(STR); } return Optional.empty(); } | /**
* Invoke a check by id.
*
* @param camelContext the camel context.
* @param id the check id.
* @param options the check options.
* @return an optional {@link HealthCheck.Result}.
*/ | Invoke a check by id | invoke | {
"repo_name": "pax95/camel",
"path": "core/camel-api/src/main/java/org/apache/camel/health/HealthCheckHelper.java",
"license": "apache-2.0",
"size": 6440
} | [
"java.util.Map",
"java.util.Optional",
"org.apache.camel.CamelContext"
]
| import java.util.Map; import java.util.Optional; import org.apache.camel.CamelContext; | import java.util.*; import org.apache.camel.*; | [
"java.util",
"org.apache.camel"
]
| java.util; org.apache.camel; | 671,259 |
public ArangoDBQueryBuilder documentsById(
List<String> ids,
String loopVariable,
Map<String, Object> bindVars) {
queryBuilder.append("LET docs = FLATTEN(RETURN Document(@ids))\n");
queryBuilder.append(String.format("FOR %s IN docs\n", loopVariable));
queryBuilder.append(String.format(" FILTER NOT IS_NULL(%s)\n", loopVariable)); // Not needed?
bindVars.put("ids", ids);
logger.debug("documentsById", queryBuilder.toString());
return this;
}
| ArangoDBQueryBuilder function( List<String> ids, String loopVariable, Map<String, Object> bindVars) { queryBuilder.append(STR); queryBuilder.append(String.format(STR, loopVariable)); queryBuilder.append(String.format(STR, loopVariable)); bindVars.put("ids", ids); logger.debug(STR, queryBuilder.toString()); return this; } | /**
* Append a Document and FILTER statements to the query builder. Use this to find a single or
* group of elements in the graph. This segment should be used in conjunction with the
* {@link #with(List, Map)} segment.
*
* @param ids the id(s) to look for
* @param loopVariable the loop variable name
* @param bindVars the map of bind parameters
* @return a reference to this object.
*/ | Append a Document and FILTER statements to the query builder. Use this to find a single or group of elements in the graph. This segment should be used in conjunction with the <code>#with(List, Map)</code> segment | documentsById | {
"repo_name": "arangodb/blueprints-arangodb-graph",
"path": "src/main/java/com/arangodb/tinkerpop/gremlin/client/ArangoDBQueryBuilder.java",
"license": "apache-2.0",
"size": 15588
} | [
"java.util.List",
"java.util.Map"
]
| import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
]
| java.util; | 213,824 |
@Test public void gzipWithRedirectAndConnectionReuse() throws Exception {
server.enqueue(new MockResponse()
.setResponseCode(HttpURLConnection.HTTP_MOVED_TEMP)
.addHeader("Location: /foo")
.addHeader("Content-Encoding: gzip")
.setBody(gzip("Moved! Moved! Moved!")));
server.enqueue(new MockResponse().setBody("This is the new page!"));
HttpURLConnection connection = urlFactory.open(server.url("/").url());
assertContent("This is the new page!", connection);
RecordedRequest requestA = server.takeRequest();
assertEquals(0, requestA.getSequenceNumber());
RecordedRequest requestB = server.takeRequest();
assertEquals(1, requestB.getSequenceNumber());
} | @Test void function() throws Exception { server.enqueue(new MockResponse() .setResponseCode(HttpURLConnection.HTTP_MOVED_TEMP) .addHeader(STR) .addHeader(STR) .setBody(gzip(STR))); server.enqueue(new MockResponse().setBody(STR)); HttpURLConnection connection = urlFactory.open(server.url("/").url()); assertContent(STR, connection); RecordedRequest requestA = server.takeRequest(); assertEquals(0, requestA.getSequenceNumber()); RecordedRequest requestB = server.takeRequest(); assertEquals(1, requestB.getSequenceNumber()); } | /**
* We had a bug where we weren't closing Gzip streams on redirects.
* https://github.com/square/okhttp/issues/441
*/ | We had a bug where we weren't closing Gzip streams on redirects. HREF | gzipWithRedirectAndConnectionReuse | {
"repo_name": "weiwenqiang/GitHub",
"path": "expert/okhttp/okhttp-tests/src/test/java/okhttp3/URLConnectionTest.java",
"license": "apache-2.0",
"size": 151984
} | [
"java.net.HttpURLConnection",
"org.junit.Assert",
"org.junit.Test"
]
| import java.net.HttpURLConnection; import org.junit.Assert; import org.junit.Test; | import java.net.*; import org.junit.*; | [
"java.net",
"org.junit"
]
| java.net; org.junit; | 1,803,909 |
public boolean isRepeat() {
return getStyle().getBooleanStyleProperty( BandStyleKeys.REPEAT_HEADER );
} | boolean function() { return getStyle().getBooleanStyleProperty( BandStyleKeys.REPEAT_HEADER ); } | /**
* Checks whether this group header should be repeated on new pages.
*
* @return true, if the header will be repeated, false otherwise
*/ | Checks whether this group header should be repeated on new pages | isRepeat | {
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/DetailsHeader.java",
"license": "lgpl-2.1",
"size": 4193
} | [
"org.pentaho.reporting.engine.classic.core.style.BandStyleKeys"
]
| import org.pentaho.reporting.engine.classic.core.style.BandStyleKeys; | import org.pentaho.reporting.engine.classic.core.style.*; | [
"org.pentaho.reporting"
]
| org.pentaho.reporting; | 1,866,581 |
public MulticastDefinition multicast(AggregationStrategy aggregationStrategy) {
MulticastDefinition answer = new MulticastDefinition();
addOutput(answer);
answer.setAggregationStrategy(aggregationStrategy);
return answer;
}
| MulticastDefinition function(AggregationStrategy aggregationStrategy) { MulticastDefinition answer = new MulticastDefinition(); addOutput(answer); answer.setAggregationStrategy(aggregationStrategy); return answer; } | /**
* <a href="http://camel.apache.org/multicast.html">Multicast EIP:</a>
* Multicasts messages to all its child outputs; so that each processor and
* destination gets a copy of the original message to avoid the processors
* interfering with each other.
*
* @param aggregationStrategy the strategy used to aggregate responses for every part
* @return the builder
*/ | Multicasts messages to all its child outputs; so that each processor and destination gets a copy of the original message to avoid the processors interfering with each other | multicast | {
"repo_name": "everttigchelaar/camel-svn",
"path": "camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java",
"license": "apache-2.0",
"size": 120346
} | [
"org.apache.camel.processor.aggregate.AggregationStrategy"
]
| import org.apache.camel.processor.aggregate.AggregationStrategy; | import org.apache.camel.processor.aggregate.*; | [
"org.apache.camel"
]
| org.apache.camel; | 711,504 |
public void loadAndReplaceMimetypes(InputStream is) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.startsWith("#") || line.length() == 0) {
// Ignore comments and empty lines.
} else {
StringTokenizer st = new StringTokenizer(line, " \t");
if (st.countTokens() > 1) {
String mimetype = st.nextToken();
while (st.hasMoreTokens()) {
String extension = st.nextToken();
extensionToMimetypeMap.put(extension, mimetype);
if (log.isDebugEnabled()) {
log.debug("Setting mime type for extension '" + extension + "' to '" + mimetype + "'");
}
}
} else {
if (log.isDebugEnabled()) {
log.debug("Ignoring mimetype with no associated file extensions: '" + line + "'");
}
}
}
}
} | void function(InputStream is) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); if (line.startsWith("#") line.length() == 0) { } else { StringTokenizer st = new StringTokenizer(line, STR); if (st.countTokens() > 1) { String mimetype = st.nextToken(); while (st.hasMoreTokens()) { String extension = st.nextToken(); extensionToMimetypeMap.put(extension, mimetype); if (log.isDebugEnabled()) { log.debug(STR + extension + STR + mimetype + "'"); } } } else { if (log.isDebugEnabled()) { log.debug(STR + line + "'"); } } } } } | /**
* Reads and stores the mime type setting corresponding to a file extension, by reading
* text from an InputStream. If a mime type setting already exists when this method is run,
* the mime type value is replaced with the newer one.
*
* @param is
*
* @throws IOException
*/ | Reads and stores the mime type setting corresponding to a file extension, by reading text from an InputStream. If a mime type setting already exists when this method is run, the mime type value is replaced with the newer one | loadAndReplaceMimetypes | {
"repo_name": "SaiNadh001/aws-sdk-for-java",
"path": "src/main/java/com/amazonaws/services/s3/internal/Mimetypes.java",
"license": "apache-2.0",
"size": 8145
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.util.StringTokenizer"
]
| import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
]
| java.io; java.util; | 1,921,307 |
public ApplicationGatewayBackendHealthServer withIpConfiguration(NetworkInterfaceIPConfigurationInner ipConfiguration) {
this.ipConfiguration = ipConfiguration;
return this;
} | ApplicationGatewayBackendHealthServer function(NetworkInterfaceIPConfigurationInner ipConfiguration) { this.ipConfiguration = ipConfiguration; return this; } | /**
* Set reference of IP configuration of backend server.
*
* @param ipConfiguration the ipConfiguration value to set
* @return the ApplicationGatewayBackendHealthServer object itself.
*/ | Set reference of IP configuration of backend server | withIpConfiguration | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/ApplicationGatewayBackendHealthServer.java",
"license": "mit",
"size": 2959
} | [
"com.microsoft.azure.management.network.v2018_07_01.implementation.NetworkInterfaceIPConfigurationInner"
]
| import com.microsoft.azure.management.network.v2018_07_01.implementation.NetworkInterfaceIPConfigurationInner; | import com.microsoft.azure.management.network.v2018_07_01.implementation.*; | [
"com.microsoft.azure"
]
| com.microsoft.azure; | 2,323,996 |
public synchronized boolean isRigQueued(Long id, org.hibernate.Session db)
{
Rig rig = new RigDao(db).get(id);
if (this.rigQueues.containsKey(rig.getId()) && this.rigQueues.get(rig.getId()).size() > 0)
{
return true;
}
if (this.typeQueues.containsKey(rig.getRigType().getId()) &&
this.typeQueues.get(rig.getRigType().getId()).size() > 0)
{
return true;
}
for (MatchingCapabilities match : rig.matchingCapabilities())
{
RequestCapabilities caps = match.getRequestCapabilities();
if (this.capabilityQueues.containsKey(caps.getId()) &&
this.capabilityQueues.get(caps.getId()).size() > 0)
{
return true;
}
}
return false;
}
/**
* Attempts to assigned the specified rig to a queued session. If there is
* queued session for the rig, a queued session for its rig type or a
* queued session for a request capabilities matching its rig capabilities,
* the highest precedence request given by the {@link QueueSessionComparator} | synchronized boolean function(Long id, org.hibernate.Session db) { Rig rig = new RigDao(db).get(id); if (this.rigQueues.containsKey(rig.getId()) && this.rigQueues.get(rig.getId()).size() > 0) { return true; } if (this.typeQueues.containsKey(rig.getRigType().getId()) && this.typeQueues.get(rig.getRigType().getId()).size() > 0) { return true; } for (MatchingCapabilities match : rig.matchingCapabilities()) { RequestCapabilities caps = match.getRequestCapabilities(); if (this.capabilityQueues.containsKey(caps.getId()) && this.capabilityQueues.get(caps.getId()).size() > 0) { return true; } } return false; } /** * Attempts to assigned the specified rig to a queued session. If there is * queued session for the rig, a queued session for its rig type or a * queued session for a request capabilities matching its rig capabilities, * the highest precedence request given by the {@link QueueSessionComparator} | /**
* Returns true if the rig, the rig's type or a matching request capabilites is queued.
* That is, if a session is queued that a rig may be assigned to, <code>true</code>
* is returned.
*
* @param id identifier of rig
* @return true if the rig is queued for
*/ | Returns true if the rig, the rig's type or a matching request capabilites is queued. That is, if a session is queued that a rig may be assigned to, <code>true</code> is returned | isRigQueued | {
"repo_name": "sahara-labs/scheduling-server",
"path": "Queuer/src/au/edu/uts/eng/remotelabs/schedserver/queuer/impl/Queue.java",
"license": "bsd-3-clause",
"size": 23774
} | [
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.RigDao",
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.MatchingCapabilities",
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.RequestCapabilities",
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Rig",
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Session"
]
| import au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.RigDao; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.MatchingCapabilities; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.RequestCapabilities; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Rig; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Session; | import au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.*; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.*; | [
"au.edu.uts"
]
| au.edu.uts; | 2,204,045 |
public static void deleteTaggedValue(Method m, String nameOfTVToDelete) {
Collection<MethodTag> cTV = m.GetTaggedValues();
cTV.Refresh();
for (short i = 0; i < cTV.GetCount(); i++) {
MethodTag tv = cTV.GetAt(i);
if (tv.GetName().equalsIgnoreCase(nameOfTVToDelete)) {
cTV.Delete(i);
}
}
cTV.Refresh();
}
| static void function(Method m, String nameOfTVToDelete) { Collection<MethodTag> cTV = m.GetTaggedValues(); cTV.Refresh(); for (short i = 0; i < cTV.GetCount(); i++) { MethodTag tv = cTV.GetAt(i); if (tv.GetName().equalsIgnoreCase(nameOfTVToDelete)) { cTV.Delete(i); } } cTV.Refresh(); } | /**
* Deletes all tagged values whose name equals (ignoring case) the given
* name in the given method.
*
* @param m tbd
* @param nameOfTVToDelete tbd
*/ | Deletes all tagged values whose name equals (ignoring case) the given name in the given method | deleteTaggedValue | {
"repo_name": "ShapeChange/ShapeChange",
"path": "src/main/java/de/interactive_instruments/ShapeChange/Util/ea/EAMethodUtil.java",
"license": "gpl-3.0",
"size": 8289
} | [
"org.sparx.Collection",
"org.sparx.Method",
"org.sparx.MethodTag"
]
| import org.sparx.Collection; import org.sparx.Method; import org.sparx.MethodTag; | import org.sparx.*; | [
"org.sparx"
]
| org.sparx; | 1,336,828 |
if ( _instance == null ) {
_instance = new Cached_ProjectTblSubPartsForProjectLists();
}
return _instance;
}
private Cached_ProjectTblSubPartsForProjectLists() {
if ( log.isDebugEnabled() ) {
debugLogLevelEnabled = true;
log.debug( "debug log level enabled" );
}
cacheHolderInternal = new CacheHolderInternal( this );
// Register this class with the centralized Cached Data Registry, to support centralized cache clearing
CachedDataCentralRegistry.getInstance().register( this );
}
private CacheHolderInternal cacheHolderInternal;
| if ( _instance == null ) { _instance = new Cached_ProjectTblSubPartsForProjectLists(); } return _instance; } private Cached_ProjectTblSubPartsForProjectLists() { if ( log.isDebugEnabled() ) { debugLogLevelEnabled = true; log.debug( STR ); } cacheHolderInternal = new CacheHolderInternal( this ); CachedDataCentralRegistry.getInstance().register( this ); } private CacheHolderInternal cacheHolderInternal; | /**
* Static get singleton instance
* @return
* @throws Exception
*/ | Static get singleton instance | getInstance | {
"repo_name": "yeastrc/proxl-web-app",
"path": "proxl_web_app/src/main/java/org/yeastrc/xlink/www/searcher_via_cached_data/cached_data_holders/Cached_ProjectTblSubPartsForProjectLists.java",
"license": "apache-2.0",
"size": 9636
} | [
"org.yeastrc.xlink.www.cached_data_mgmt.CachedDataCentralRegistry",
"org.yeastrc.xlink.www.objects.ProjectTblSubPartsForProjectLists"
]
| import org.yeastrc.xlink.www.cached_data_mgmt.CachedDataCentralRegistry; import org.yeastrc.xlink.www.objects.ProjectTblSubPartsForProjectLists; | import org.yeastrc.xlink.www.cached_data_mgmt.*; import org.yeastrc.xlink.www.objects.*; | [
"org.yeastrc.xlink"
]
| org.yeastrc.xlink; | 1,904,512 |
public Object getAsObject(final FacesContext context,
final UIComponent component,
final String value) throws ConverterException {
if ((value == null) || (value.length() == 0)) {
return null;
}
else {
try {
return new EnterpriseNumber(value);
}
catch (PropertyException e) {
LOG.debug("Enterprise number " + value + "could not be created", e);
throw new ConverterException("Enterprise number " + value + "could not be created");
}
}
}
public static final String EMPTY = ""; | Object function(final FacesContext context, final UIComponent component, final String value) throws ConverterException { if ((value == null) (value.length() == 0)) { return null; } else { try { return new EnterpriseNumber(value); } catch (PropertyException e) { LOG.debug(STR + value + STR, e); throw new ConverterException(STR + value + STR); } } } public static final String EMPTY = ""; | /**
* Convert the specified string value, which is associated with the
* specified UIComponent, into a model data object that is appropriate for
* being stored during the Apply Request Values phase of the request
* processing lifecycle.
*
* @result value == null || value.length == 0
* ==> result == null;
* @result result == a new Enterprise number created using the given string;
* @throws ConverterException
* The Enterprise number could not be created from the given string.
* @todo formal comment
*/ | Convert the specified string value, which is associated with the specified UIComponent, into a model data object that is appropriate for being stored during the Apply Request Values phase of the request processing lifecycle | getAsObject | {
"repo_name": "jandppw/ppwcode-recovered-from-google-code",
"path": "java/value/dev/d20080924-1907/src/main/java/org/ppwcode/value_III/legacy/EnterpriseNumberConverter.java",
"license": "apache-2.0",
"size": 4479
} | [
"javax.faces.component.UIComponent",
"javax.faces.context.FacesContext",
"javax.faces.convert.ConverterException",
"org.ppwcode.vernacular.value_III.PropertyException"
]
| import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.ConverterException; import org.ppwcode.vernacular.value_III.PropertyException; | import javax.faces.component.*; import javax.faces.context.*; import javax.faces.convert.*; import org.ppwcode.vernacular.*; | [
"javax.faces",
"org.ppwcode.vernacular"
]
| javax.faces; org.ppwcode.vernacular; | 1,239,309 |
private static void loadModules(String startClassName) throws IOException {
BufferedReader apks = new BufferedReader(new FileReader(BASE_DIR + "conf/modules.list"));
String apk;
log(">>>load modules");
while ((apk = apks.readLine()) != null) {
log("load modules: "+apk);
loadModule(apk, startClassName);
}
log("<<<load modules");
apks.close();
} | static void function(String startClassName) throws IOException { BufferedReader apks = new BufferedReader(new FileReader(BASE_DIR + STR)); String apk; log(STR); while ((apk = apks.readLine()) != null) { log(STR+apk); loadModule(apk, startClassName); } log(STR); apks.close(); } | /**
* Try to load all modules defined in <code>BASE_DIR/conf/modules.list</code>
*/ | Try to load all modules defined in <code>BASE_DIR/conf/modules.list</code> | loadModules | {
"repo_name": "nkafei/xposed-art",
"path": "xposed_bridge/src/de/robv/android/xposed/XposedBridge.java",
"license": "apache-2.0",
"size": 26446
} | [
"java.io.BufferedReader",
"java.io.FileReader",
"java.io.IOException"
]
| import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; | import java.io.*; | [
"java.io"
]
| java.io; | 1,981,945 |
public synchronized void setBitmap(Bitmap bitmap) {
if (DRAW_TEXTURE) {
// Bitmap original size.
int w = bitmap.getWidth();
int h = bitmap.getHeight();
// Bitmap size expanded to next power of two. This is done due to
// the requirement on many devices, texture width and height should
// be power of two.
int newW = getNextHighestPO2(w);
int newH = getNextHighestPO2(h);
//Recycle the previous bitmap if it still exists.
if(mBitmap != null){
mBitmap.recycle();
mBitmap = null;
}
// TODO: Is there another way to create a bigger Bitmap and copy
// original Bitmap to it more efficiently? Immutable bitmap anyone?
mBitmap = Bitmap.createBitmap(newW, newH, bitmap.getConfig());
Canvas c = new Canvas(mBitmap);
c.drawBitmap(bitmap, 0, 0, null);
//Recycle the now unused bitmap
bitmap.recycle();
bitmap = null;
// Calculate final texture coordinates.
float texX = (float) w / newW;
float texY = (float) h / newH;
mTextureRect.set(0f, 0f, texX, texY);
if (mFlipTexture) {
setTexCoords(texX, 0f, 0f, texY);
} else {
setTexCoords(0f, 0f, texX, texY);
}
}
} | synchronized void function(Bitmap bitmap) { if (DRAW_TEXTURE) { int w = bitmap.getWidth(); int h = bitmap.getHeight(); int newW = getNextHighestPO2(w); int newH = getNextHighestPO2(h); if(mBitmap != null){ mBitmap.recycle(); mBitmap = null; } mBitmap = Bitmap.createBitmap(newW, newH, bitmap.getConfig()); Canvas c = new Canvas(mBitmap); c.drawBitmap(bitmap, 0, 0, null); bitmap.recycle(); bitmap = null; float texX = (float) w / newW; float texY = (float) h / newH; mTextureRect.set(0f, 0f, texX, texY); if (mFlipTexture) { setTexCoords(texX, 0f, 0f, texY); } else { setTexCoords(0f, 0f, texX, texY); } } } | /**
* Sets new texture for this mesh.
*/ | Sets new texture for this mesh | setBitmap | {
"repo_name": "cesine/AndroidMorphologicalAwareness",
"path": "src/ca/ilanguage/oprime/morphologicalawareness/ui/CurlMesh.java",
"license": "apache-2.0",
"size": 31642
} | [
"android.graphics.Bitmap",
"android.graphics.Canvas"
]
| import android.graphics.Bitmap; import android.graphics.Canvas; | import android.graphics.*; | [
"android.graphics"
]
| android.graphics; | 2,478,353 |
public InternalCodingDt setSystem(String theUri) {
mySystem = new UriDt(theUri);
return this;
} | InternalCodingDt function(String theUri) { mySystem = new UriDt(theUri); return this; } | /**
* Sets the value for <b>system</b> (Identity of the terminology system)
*
* <p>
* <b>Definition:</b> The identification of the code system that defines the meaning of the symbol in the code.
* </p>
*/ | Sets the value for system (Identity of the terminology system) Definition: The identification of the code system that defines the meaning of the symbol in the code. | setSystem | {
"repo_name": "bjornna/hapi-fhir",
"path": "hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/InternalCodingDt.java",
"license": "apache-2.0",
"size": 10856
} | [
"ca.uhn.fhir.model.primitive.UriDt"
]
| import ca.uhn.fhir.model.primitive.UriDt; | import ca.uhn.fhir.model.primitive.*; | [
"ca.uhn.fhir"
]
| ca.uhn.fhir; | 1,539,683 |
@Override
public void disableBroker() throws PulsarServerException {
if (StringUtils.isNotEmpty(brokerZnodePath)) {
try {
brokerDataLock.release().join();
} catch (CompletionException e) {
if (e.getCause() instanceof NotFoundException) {
throw new PulsarServerException.NotFoundException(MetadataStoreException.unwrap(e));
} else {
throw new PulsarServerException(MetadataStoreException.unwrap(e));
}
}
}
} | void function() throws PulsarServerException { if (StringUtils.isNotEmpty(brokerZnodePath)) { try { brokerDataLock.release().join(); } catch (CompletionException e) { if (e.getCause() instanceof NotFoundException) { throw new PulsarServerException.NotFoundException(MetadataStoreException.unwrap(e)); } else { throw new PulsarServerException(MetadataStoreException.unwrap(e)); } } } } | /**
* As any broker, disable the broker this manager is running on.
*
* @throws PulsarServerException
* If there's a failure when disabling broker on metadata store.
*/ | As any broker, disable the broker this manager is running on | disableBroker | {
"repo_name": "massakam/pulsar",
"path": "pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java",
"license": "apache-2.0",
"size": 53534
} | [
"java.util.concurrent.CompletionException",
"org.apache.commons.lang3.StringUtils",
"org.apache.pulsar.broker.PulsarServerException",
"org.apache.pulsar.metadata.api.MetadataStoreException"
]
| import java.util.concurrent.CompletionException; import org.apache.commons.lang3.StringUtils; import org.apache.pulsar.broker.PulsarServerException; import org.apache.pulsar.metadata.api.MetadataStoreException; | import java.util.concurrent.*; import org.apache.commons.lang3.*; import org.apache.pulsar.broker.*; import org.apache.pulsar.metadata.api.*; | [
"java.util",
"org.apache.commons",
"org.apache.pulsar"
]
| java.util; org.apache.commons; org.apache.pulsar; | 2,102,190 |
protected Object convertToString(final Object value) {
if (value instanceof Date) {
DateFormat df = new SimpleDateFormat(DateUtil.getDatePattern());
if (value instanceof Timestamp) {
df = new SimpleDateFormat(DateUtil.getDateTimePattern());
}
try {
return df.format(value);
} catch (final Exception e) {
throw new ConversionException("Error converting Date to String", e);
}
} else {
return value.toString();
}
} | Object function(final Object value) { if (value instanceof Date) { DateFormat df = new SimpleDateFormat(DateUtil.getDatePattern()); if (value instanceof Timestamp) { df = new SimpleDateFormat(DateUtil.getDateTimePattern()); } try { return df.format(value); } catch (final Exception e) { throw new ConversionException(STR, e); } } else { return value.toString(); } } | /**
* Convert a java.util.Date or a java.sql.Timestamp to a String. Or does a toString
* @param value value to convert
* @return Converted value for property population
*/ | Convert a java.util.Date or a java.sql.Timestamp to a String. Or does a toString | convertToString | {
"repo_name": "mraible/appfuse-noxml",
"path": "src/main/java/com/raibledesigns/util/DateConverter.java",
"license": "apache-2.0",
"size": 3247
} | [
"java.sql.Timestamp",
"java.text.DateFormat",
"java.text.SimpleDateFormat",
"java.util.Date",
"org.apache.commons.beanutils.ConversionException"
]
| import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.commons.beanutils.ConversionException; | import java.sql.*; import java.text.*; import java.util.*; import org.apache.commons.beanutils.*; | [
"java.sql",
"java.text",
"java.util",
"org.apache.commons"
]
| java.sql; java.text; java.util; org.apache.commons; | 315,654 |
public void onInterpretButtonPressed(View view) {
onRespeakButton(view, "interpret");
}
| void function(View view) { onRespeakButton(view, STR); } | /**
* Callback for an interpret quickaction button
* @param view The interpret quickaction button
*/ | Callback for an interpret quickaction button | onInterpretButtonPressed | {
"repo_name": "aikuma/aikuma",
"path": "Aikuma/src/org/lp20/aikuma/ui/ListenActivity.java",
"license": "agpl-3.0",
"size": 23021
} | [
"android.view.View"
]
| import android.view.View; | import android.view.*; | [
"android.view"
]
| android.view; | 164,644 |
@NotNull
public static GCWatcher fromClearedRef(@NotNull Ref<?> ref) {
GCWatcher result = tracking(ref.get());
ref.set(null);
return result;
} | static GCWatcher function(@NotNull Ref<?> ref) { GCWatcher result = tracking(ref.get()); ref.set(null); return result; } | /**
* Create a GCWatcher from whatever is in the ref, then clear the ref.
*/ | Create a GCWatcher from whatever is in the ref, then clear the ref | fromClearedRef | {
"repo_name": "dahlstrom-g/intellij-community",
"path": "platform/util/src/com/intellij/util/ref/GCWatcher.java",
"license": "apache-2.0",
"size": 3833
} | [
"com.intellij.openapi.util.Ref",
"org.jetbrains.annotations.NotNull"
]
| import com.intellij.openapi.util.Ref; import org.jetbrains.annotations.NotNull; | import com.intellij.openapi.util.*; import org.jetbrains.annotations.*; | [
"com.intellij.openapi",
"org.jetbrains.annotations"
]
| com.intellij.openapi; org.jetbrains.annotations; | 1,979,323 |
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
m_adaptee.keyPressed(e);
}
} // VTreePanel_keyAdapter
private static final long serialVersionUID = -6798614427038652192L;
private static final String PREFIX_DOCUMENT_SEARCH = "/";
protected boolean m_lookAndFeelChanged = false;
private VTreeTransferHandler handler = new VTreeTransferHandler();
public VTreePanel(int WindowNo, boolean hasBar, boolean editable)
{
super();
toolbar = new ArrayList<JToolBar>();
log.config("Bar=" + hasBar + ", Editable=" + editable);
m_WindowNo = WindowNo;
m_hasBar = hasBar;
m_editable = editable;
// static init
jbInit();
if (!hasBar)
{
barScrollPane.setPreferredSize(new Dimension(0,0));
barScrollPane.setMaximumSize(new Dimension(0,0));
barScrollPane.setMinimumSize(new Dimension(0,0));
//Begin - [FR 1953769]
bar.setBackground(AdempierePLAF.getFormBackground());
//End - [FR 1953769]
centerSplitPane.setDividerLocation(0);
centerSplitPane.setDividerSize(0);
popMenuTree.remove(mBarAdd);
}
| void function(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) m_adaptee.keyPressed(e); } } private static final long serialVersionUID = -6798614427038652192L; private static final String PREFIX_DOCUMENT_SEARCH = "/"; protected boolean m_lookAndFeelChanged = false; private VTreeTransferHandler handler = new VTreeTransferHandler(); public VTreePanel(int WindowNo, boolean hasBar, boolean editable) { super(); toolbar = new ArrayList<JToolBar>(); log.config("Bar=" + hasBar + STR + editable); m_WindowNo = WindowNo; m_hasBar = hasBar; m_editable = editable; jbInit(); if (!hasBar) { barScrollPane.setPreferredSize(new Dimension(0,0)); barScrollPane.setMaximumSize(new Dimension(0,0)); barScrollPane.setMinimumSize(new Dimension(0,0)); bar.setBackground(AdempierePLAF.getFormBackground()); centerSplitPane.setDividerLocation(0); centerSplitPane.setDividerSize(0); popMenuTree.remove(mBarAdd); } | /**
* Key Pressed
* @param e
*/ | Key Pressed | keyPressed | {
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/client/src/org/compiere/grid/tree/VTreePanel.java",
"license": "gpl-2.0",
"size": 31170
} | [
"java.awt.Dimension",
"java.awt.event.KeyEvent",
"java.util.ArrayList",
"javax.swing.JToolBar",
"org.adempiere.plaf.AdempierePLAF"
]
| import java.awt.Dimension; import java.awt.event.KeyEvent; import java.util.ArrayList; import javax.swing.JToolBar; import org.adempiere.plaf.AdempierePLAF; | import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import org.adempiere.plaf.*; | [
"java.awt",
"java.util",
"javax.swing",
"org.adempiere.plaf"
]
| java.awt; java.util; javax.swing; org.adempiere.plaf; | 1,646,211 |
@Test
public void testNameDirLocking() throws IOException {
Configuration conf = new HdfsConfiguration();
MiniDFSCluster cluster = null;
// Start a NN, and verify that lock() fails in all of the configured
// directories
StorageDirectory savedSd = null;
try {
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
NNStorage storage = cluster.getNameNode().getFSImage().getStorage();
for (StorageDirectory sd : storage.dirIterable(null)) {
assertLockFails(sd);
savedSd = sd;
}
} finally {
cleanup(cluster);
cluster = null;
}
assertNotNull(savedSd);
// Lock one of the saved directories, then start the NN, and make sure it
// fails to start
assertClusterStartFailsWhenDirLocked(conf, savedSd);
} | void function() throws IOException { Configuration conf = new HdfsConfiguration(); MiniDFSCluster cluster = null; StorageDirectory savedSd = null; try { cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build(); NNStorage storage = cluster.getNameNode().getFSImage().getStorage(); for (StorageDirectory sd : storage.dirIterable(null)) { assertLockFails(sd); savedSd = sd; } } finally { cleanup(cluster); cluster = null; } assertNotNull(savedSd); assertClusterStartFailsWhenDirLocked(conf, savedSd); } | /**
* Test that the NN locks its storage and edits directories, and won't start up
* if the directories are already locked
**/ | Test that the NN locks its storage and edits directories, and won't start up if the directories are already locked | testNameDirLocking | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java",
"license": "apache-2.0",
"size": 88361
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hdfs.HdfsConfiguration",
"org.apache.hadoop.hdfs.MiniDFSCluster",
"org.apache.hadoop.hdfs.server.common.Storage",
"org.junit.Assert"
]
| import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.server.common.Storage; import org.junit.Assert; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.server.common.*; import org.junit.*; | [
"java.io",
"org.apache.hadoop",
"org.junit"
]
| java.io; org.apache.hadoop; org.junit; | 56,962 |
PageObjectFactory getPageObjectFactory(); | PageObjectFactory getPageObjectFactory(); | /**
* Returns the {@link PageObjectFactory page object factory} used by this
* browser instance.
* <p>
* This factory is usually set while building the instance using a
* {@link BrowserBuilder browser builder}.
*
* @return the page object factory
*/ | Returns the <code>PageObjectFactory page object factory</code> used by this browser instance. This factory is usually set while building the instance using a <code>BrowserBuilder browser builder</code> | getPageObjectFactory | {
"repo_name": "testIT-WebTester/webtester-core",
"path": "webtester-core/src/main/java/info/novatec/testit/webtester/api/browser/Browser.java",
"license": "apache-2.0",
"size": 18372
} | [
"info.novatec.testit.webtester.api.pageobjects.PageObjectFactory"
]
| import info.novatec.testit.webtester.api.pageobjects.PageObjectFactory; | import info.novatec.testit.webtester.api.pageobjects.*; | [
"info.novatec.testit"
]
| info.novatec.testit; | 1,609,517 |
@Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
public MailPostsEntity physicalInsert(MailPostsEntity entity) {
String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/MailPostsDao/MailPostsDao_insert.sql");
executeUpdate(sql,
entity.getMessageId(),
entity.getPostKind(),
entity.getId(),
entity.getSender(),
entity.getInsertUser(),
entity.getInsertDatetime(),
entity.getUpdateUser(),
entity.getUpdateDatetime(),
entity.getDeleteFlag());
return entity;
} | @Aspect(advice = org.support.project.ormapping.transaction.Transaction.class) MailPostsEntity function(MailPostsEntity entity) { String sql = SQLManager.getInstance().getSql(STR); executeUpdate(sql, entity.getMessageId(), entity.getPostKind(), entity.getId(), entity.getSender(), entity.getInsertUser(), entity.getInsertDatetime(), entity.getUpdateUser(), entity.getUpdateDatetime(), entity.getDeleteFlag()); return entity; } | /**
* Physical Insert.
* if key column have sequence, key value create by database.
* @param entity entity
* @return saved entity
*/ | Physical Insert. if key column have sequence, key value create by database | physicalInsert | {
"repo_name": "support-project/knowledge",
"path": "src/main/java/org/support/project/knowledge/dao/gen/GenMailPostsDao.java",
"license": "apache-2.0",
"size": 16288
} | [
"org.support.project.aop.Aspect",
"org.support.project.knowledge.entity.MailPostsEntity",
"org.support.project.ormapping.common.SQLManager"
]
| import org.support.project.aop.Aspect; import org.support.project.knowledge.entity.MailPostsEntity; import org.support.project.ormapping.common.SQLManager; | import org.support.project.aop.*; import org.support.project.knowledge.entity.*; import org.support.project.ormapping.common.*; | [
"org.support.project"
]
| org.support.project; | 657,385 |
public void setIntValue(int newIntValue) throws RemoteException; | void function(int newIntValue) throws RemoteException; | /**
* Set accessor for persistent attribute: intValue
*/ | Set accessor for persistent attribute: intValue | setIntValue | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.legacy_fat/test-applications/EJB2XSFRemoteSpecEJB.jar/src/com/ibm/ejb2x/base/spec/sfr/ejb/SFRa.java",
"license": "epl-1.0",
"size": 10102
} | [
"java.rmi.RemoteException"
]
| import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
]
| java.rmi; | 2,204,121 |
public AccountHeaderBuilder withAccountHeader(@LayoutRes int resLayout) {
if (mActivity == null) {
throw new RuntimeException("please pass an activity first to use this call");
}
if (resLayout != -1) {
this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(resLayout, null, false);
} else {
if (mCompactStyle) {
this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(R.layout.material_drawer_compact_header, null, false);
} else {
this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(R.layout.material_drawer_header, null, false);
}
}
return this;
}
// the profiles to display
protected ArrayList<IProfile> mProfiles; | AccountHeaderBuilder function(@LayoutRes int resLayout) { if (mActivity == null) { throw new RuntimeException(STR); } if (resLayout != -1) { this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(resLayout, null, false); } else { if (mCompactStyle) { this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(R.layout.material_drawer_compact_header, null, false); } else { this.mAccountHeaderContainer = mActivity.getLayoutInflater().inflate(R.layout.material_drawer_header, null, false); } } return this; } protected ArrayList<IProfile> mProfiles; | /**
* You can pass a custom layout for the drawer lib. see the drawer.xml in layouts of this lib on GitHub
*
* @param resLayout
* @return
*/ | You can pass a custom layout for the drawer lib. see the drawer.xml in layouts of this lib on GitHub | withAccountHeader | {
"repo_name": "hanhailong/MaterialDrawer",
"path": "library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java",
"license": "apache-2.0",
"size": 46050
} | [
"android.support.annotation.LayoutRes",
"com.mikepenz.materialdrawer.model.interfaces.IProfile",
"java.util.ArrayList"
]
| import android.support.annotation.LayoutRes; import com.mikepenz.materialdrawer.model.interfaces.IProfile; import java.util.ArrayList; | import android.support.annotation.*; import com.mikepenz.materialdrawer.model.interfaces.*; import java.util.*; | [
"android.support",
"com.mikepenz.materialdrawer",
"java.util"
]
| android.support; com.mikepenz.materialdrawer; java.util; | 2,904,310 |
private boolean isTemplateRelevant(NetworkTemplate template) {
final TelephonyManager tele = TelephonyManager.from(mContext);
switch (template.getMatchRule()) {
case MATCH_MOBILE_3G_LOWER:
case MATCH_MOBILE_4G:
case MATCH_MOBILE_ALL:
// mobile templates are relevant when SIM is ready and
// subscriberId matches.
if (tele.getSimState() == SIM_STATE_READY) {
return Objects.equal(tele.getSubscriberId(), template.getSubscriberId());
} else {
return false;
}
}
return true;
} | boolean function(NetworkTemplate template) { final TelephonyManager tele = TelephonyManager.from(mContext); switch (template.getMatchRule()) { case MATCH_MOBILE_3G_LOWER: case MATCH_MOBILE_4G: case MATCH_MOBILE_ALL: if (tele.getSimState() == SIM_STATE_READY) { return Objects.equal(tele.getSubscriberId(), template.getSubscriberId()); } else { return false; } } return true; } | /**
* Test if given {@link NetworkTemplate} is relevant to user based on
* current device state, such as when
* {@link TelephonyManager#getSubscriberId()} matches. This is regardless of
* data connection status.
*/ | Test if given <code>NetworkTemplate</code> is relevant to user based on current device state, such as when <code>TelephonyManager#getSubscriberId()</code> matches. This is regardless of data connection status | isTemplateRelevant | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/android/server/net/NetworkPolicyManagerService.java",
"license": "apache-2.0",
"size": 86977
} | [
"android.net.NetworkTemplate",
"android.telephony.TelephonyManager",
"com.android.internal.util.Objects"
]
| import android.net.NetworkTemplate; import android.telephony.TelephonyManager; import com.android.internal.util.Objects; | import android.net.*; import android.telephony.*; import com.android.internal.util.*; | [
"android.net",
"android.telephony",
"com.android.internal"
]
| android.net; android.telephony; com.android.internal; | 2,254,611 |
public static List<PossiblePoints> predictPossiblePoints(double[][] kscores, int[][] KscoresC, double[][] Kpre) throws IOException{
double[][] A = new double[kscores[0].length][kscores[1].length];
for (int i=0; i< kscores[0].length - 5; i++){
for (int j=0; j < kscores[1].length - 5 ; j++){
A[i][j] = kscores[i][j] + kscores[i + 4][j + 4] - kscores[i + 4][j] - kscores[i][j + 4];
}
}
List<Integer> rows = new ArrayList<Integer>(Arrays.asList(0 ,1 , 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3));
List<Integer> cols = new ArrayList<Integer>(Arrays.asList(0 ,0 , 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3));
ArrayList<PossiblePoints> listPossiblePoints = new ArrayList<>();
double temp_kscores;
double temp_fit;
double temp_meanfit;
for (int i = 0; i < rows.size(); i++) {
int r = rows.get(i);
int c= cols.get(i);
temp_kscores = kscores[r][c] / 2f;
if (A[r][c] > 0){
if (KscoresC[r][c] == 1){
temp_fit = Kpre[r][c] - Kpre[r + 4][c + 4];;
temp_meanfit = (temp_fit + temp_kscores) / 2 ;
PossiblePoints temp = new PossiblePoints(r, c , r + 4, c + 4, temp_kscores, temp_fit, temp_meanfit);
listPossiblePoints.add(temp);
}else{
temp_fit = Kpre[r + 4][c + 4] - Kpre[r][c];
temp_meanfit = (temp_fit + temp_kscores) / 2 ;
PossiblePoints temp = new PossiblePoints(r + 4, c + 4, r, c , temp_kscores, temp_fit, temp_meanfit);
listPossiblePoints.add(temp);
}
}else{
if (KscoresC[r][c + 4] == 1){
temp_fit = Kpre[r][c + 4] - Kpre[r + 4][c];
temp_meanfit = (temp_fit + temp_kscores) / 2 ;
PossiblePoints temp = new PossiblePoints(r, c + 4, r + 4, c, temp_kscores, temp_fit, temp_meanfit);
listPossiblePoints.add(temp);
}else{
temp_fit = Kpre[r + 4][c] - Kpre[r][c + 4];
temp_meanfit = (temp_fit + temp_kscores) / 2 ;
PossiblePoints temp = new PossiblePoints(r + 4, c , r, c + 4, temp_kscores, temp_fit, temp_meanfit);
listPossiblePoints.add(temp);
}
}
}
return listPossiblePoints;
}
| static List<PossiblePoints> function(double[][] kscores, int[][] KscoresC, double[][] Kpre) throws IOException{ double[][] A = new double[kscores[0].length][kscores[1].length]; for (int i=0; i< kscores[0].length - 5; i++){ for (int j=0; j < kscores[1].length - 5 ; j++){ A[i][j] = kscores[i][j] + kscores[i + 4][j + 4] - kscores[i + 4][j] - kscores[i][j + 4]; } } List<Integer> rows = new ArrayList<Integer>(Arrays.asList(0 ,1 , 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3)); List<Integer> cols = new ArrayList<Integer>(Arrays.asList(0 ,0 , 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3)); ArrayList<PossiblePoints> listPossiblePoints = new ArrayList<>(); double temp_kscores; double temp_fit; double temp_meanfit; for (int i = 0; i < rows.size(); i++) { int r = rows.get(i); int c= cols.get(i); temp_kscores = kscores[r][c] / 2f; if (A[r][c] > 0){ if (KscoresC[r][c] == 1){ temp_fit = Kpre[r][c] - Kpre[r + 4][c + 4];; temp_meanfit = (temp_fit + temp_kscores) / 2 ; PossiblePoints temp = new PossiblePoints(r, c , r + 4, c + 4, temp_kscores, temp_fit, temp_meanfit); listPossiblePoints.add(temp); }else{ temp_fit = Kpre[r + 4][c + 4] - Kpre[r][c]; temp_meanfit = (temp_fit + temp_kscores) / 2 ; PossiblePoints temp = new PossiblePoints(r + 4, c + 4, r, c , temp_kscores, temp_fit, temp_meanfit); listPossiblePoints.add(temp); } }else{ if (KscoresC[r][c + 4] == 1){ temp_fit = Kpre[r][c + 4] - Kpre[r + 4][c]; temp_meanfit = (temp_fit + temp_kscores) / 2 ; PossiblePoints temp = new PossiblePoints(r, c + 4, r + 4, c, temp_kscores, temp_fit, temp_meanfit); listPossiblePoints.add(temp); }else{ temp_fit = Kpre[r + 4][c] - Kpre[r][c + 4]; temp_meanfit = (temp_fit + temp_kscores) / 2 ; PossiblePoints temp = new PossiblePoints(r + 4, c , r, c + 4, temp_kscores, temp_fit, temp_meanfit); listPossiblePoints.add(temp); } } } return listPossiblePoints; } | /**
* Predict Possible Points
*
*/ | Predict Possible Points | predictPossiblePoints | {
"repo_name": "MKLab-ITI/image-forensics",
"path": "java_service/src/main/java/gr/iti/mklab/reveal/forensics/maps/grids/GridsCalculate.java",
"license": "apache-2.0",
"size": 29252
} | [
"gr.iti.mklab.reveal.forensics.maps.grids.GridsExtractor",
"java.io.IOException",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List"
]
| import gr.iti.mklab.reveal.forensics.maps.grids.GridsExtractor; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; | import gr.iti.mklab.reveal.forensics.maps.grids.*; import java.io.*; import java.util.*; | [
"gr.iti.mklab",
"java.io",
"java.util"
]
| gr.iti.mklab; java.io; java.util; | 138,607 |
@Generated
@Selector("advertiser:didReceiveInvitationFromPeer:withContext:invitationHandler:")
void advertiserDidReceiveInvitationFromPeerWithContextInvitationHandler(MCNearbyServiceAdvertiser advertiser,
MCPeerID peerID, NSData context,
@ObjCBlock(name = "call_advertiserDidReceiveInvitationFromPeerWithContextInvitationHandler") Block_advertiserDidReceiveInvitationFromPeerWithContextInvitationHandler invitationHandler); | @Selector(STR) void advertiserDidReceiveInvitationFromPeerWithContextInvitationHandler(MCNearbyServiceAdvertiser advertiser, MCPeerID peerID, NSData context, @ObjCBlock(name = STR) Block_advertiserDidReceiveInvitationFromPeerWithContextInvitationHandler invitationHandler); | /**
* Incoming invitation request. Call the invitationHandler block with YES
* and a valid session to connect the inviting peer to the session.
*/ | Incoming invitation request. Call the invitationHandler block with YES and a valid session to connect the inviting peer to the session | advertiserDidReceiveInvitationFromPeerWithContextInvitationHandler | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/multipeerconnectivity/protocol/MCNearbyServiceAdvertiserDelegate.java",
"license": "apache-2.0",
"size": 2596
} | [
"org.moe.natj.objc.ann.ObjCBlock",
"org.moe.natj.objc.ann.Selector"
]
| import org.moe.natj.objc.ann.ObjCBlock; import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
]
| org.moe.natj; | 2,836,647 |
public DiscoverInfo discoverInfo()
throws XMPPException
{
DiscoverInfo info = new DiscoverInfo();
info.setTo(to);
info.setNode(getId());
return (DiscoverInfo)SyncPacketSend.getReply(con, info);
}
/**
* Get the subscriptions currently associated with this node.
*
* @return List of {@link Subscription}
| DiscoverInfo function() throws XMPPException { DiscoverInfo info = new DiscoverInfo(); info.setTo(to); info.setNode(getId()); return (DiscoverInfo)SyncPacketSend.getReply(con, info); } /** * Get the subscriptions currently associated with this node. * * @return List of {@link Subscription} | /**
* Discover node information in standard {@link DiscoverInfo} format.
*
* @return The discovery information about the node.
*
* @throws XMPPException
*/ | Discover node information in standard <code>DiscoverInfo</code> format | discoverInfo | {
"repo_name": "ErkiDerLoony/xpeter",
"path": "lib/smack-3.2.1-source/org/jivesoftware/smackx/pubsub/Node.java",
"license": "gpl-3.0",
"size": 17002
} | [
"java.util.List",
"org.jivesoftware.smack.XMPPException",
"org.jivesoftware.smackx.packet.DiscoverInfo",
"org.jivesoftware.smackx.pubsub.packet.SyncPacketSend"
]
| import java.util.List; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smackx.packet.DiscoverInfo; import org.jivesoftware.smackx.pubsub.packet.SyncPacketSend; | import java.util.*; import org.jivesoftware.smack.*; import org.jivesoftware.smackx.packet.*; import org.jivesoftware.smackx.pubsub.packet.*; | [
"java.util",
"org.jivesoftware.smack",
"org.jivesoftware.smackx"
]
| java.util; org.jivesoftware.smack; org.jivesoftware.smackx; | 944,478 |
public Variable findVariableByName(String name) {
Predicate<Variable> predicate = new VariableNamePredicate(name);
Variable variable =
Algorithm.linearSearch(continuousMap.keySet(), predicate);
return variable == null ? Algorithm.linearSearch(
discreteMap.keySet(), predicate) : variable;
} | Variable function(String name) { Predicate<Variable> predicate = new VariableNamePredicate(name); Variable variable = Algorithm.linearSearch(continuousMap.keySet(), predicate); return variable == null ? Algorithm.linearSearch( discreteMap.keySet(), predicate) : variable; } | /**
* Finds a variable by name. It supports only singular variable (continuous
* or discrete).
*
* @param name
* name of the variable
* @return variable with the given name, or {@code null} if not found
*/ | Finds a variable by name. It supports only singular variable (continuous or discrete) | findVariableByName | {
"repo_name": "fernandoj92/mvca-parkinson",
"path": "pltm-analysis/src/main/java/org/latlab/model/MixedVariableMap.java",
"license": "apache-2.0",
"size": 7728
} | [
"org.latlab.util.Algorithm",
"org.latlab.util.Predicate",
"org.latlab.util.Variable"
]
| import org.latlab.util.Algorithm; import org.latlab.util.Predicate; import org.latlab.util.Variable; | import org.latlab.util.*; | [
"org.latlab.util"
]
| org.latlab.util; | 1,840,473 |
public static Test suite() {
return new TestSuite(RaiseErrorTest.class);
} | static Test function() { return new TestSuite(RaiseErrorTest.class); } | /**
*
* Returns a test suite.
*
* @return the test suite
*/ | Returns a test suite | suite | {
"repo_name": "automenta/adams-core",
"path": "src/test/java/adams/flow/control/RaiseErrorTest.java",
"license": "gpl-3.0",
"size": 8091
} | [
"junit.framework.Test",
"junit.framework.TestSuite"
]
| import junit.framework.Test; import junit.framework.TestSuite; | import junit.framework.*; | [
"junit.framework"
]
| junit.framework; | 2,891,377 |
// ZAP: Added accessor to the panels
protected Collection<AbstractParamPanel> getPanels() {
return this.getJSplitPane().getPanels();
} | Collection<AbstractParamPanel> function() { return this.getJSplitPane().getPanels(); } | /**
* Gets the panels shown on this dialog.
*
* @return the panels
*/ | Gets the panels shown on this dialog | getPanels | {
"repo_name": "zapbot/zaproxy",
"path": "src/org/parosproxy/paros/view/AbstractParamDialog.java",
"license": "apache-2.0",
"size": 15338
} | [
"java.util.Collection"
]
| import java.util.Collection; | import java.util.*; | [
"java.util"
]
| java.util; | 2,125,779 |
public static void rdt_send(byte[] buffer, int byteSize, int seqNum) throws IOException {
byte[] sendSeqNum = new byte[4];
byte[] temp;
int headerSize =8;
int i, j, k;
// Creating the Client Header
temp = new BigInteger(Integer.toString(seqNum), 10).toByteArray();
// System.out.println("Sequence number to send:: " +seqNum);
byte[] client_field = new BigInteger("0101010101010101", 2).toByteArray();
int checksum = (int) computeCRC(buffer);
byte[] checksumData = new byte[2];
byte[] tempChecksum = new BigInteger(Integer.toString(checksum), 10).toByteArray();
if (tempChecksum.length < 2) {
Integer padBits = 2 - tempChecksum.length;
for (i = 0; i < padBits; i++) {
checksumData[i] = 0;
}
for (j = padBits, k = 0; j < 2 && k < tempChecksum.length; j++, k++) {
checksumData[j] = tempChecksum[k];
}
} else {
checksumData = new BigInteger(Integer.toString(checksum), 10).toByteArray();
}
//Padding the Sequence Number
System.out.println("Length of Sequece Byte:: " + temp.length);
if (temp.length < 4) {
for (i = 0; i < 4 - temp.length; i++) {
sendSeqNum[i] = 0;
}
for (j = 4 - temp.length, k=0; j < 4; j++) {
sendSeqNum[j] = temp[k];
k++;
}
}
//Building the Final Packet
byte[] finalPacketToSend = new byte[headerSize + byteSize];
for (i = 0; i < 4; i++) {
finalPacketToSend[i] = sendSeqNum[i];
}
byte[] sn = new byte[getMss()];
System.arraycopy(finalPacketToSend, 0, sn, 0, 4);
int s = java.nio.ByteBuffer.wrap(sn).getInt();
// System.out.println("Seq Num sent: " + s);
for (i = 4,k=0; i < 6; i++) {
finalPacketToSend[i] = checksumData[k];
k++;
}
for (i = 6,k=0;i < 8; i++) {
finalPacketToSend[i] = client_field[k];
k++;
}
for (i = 8, k = 0; i < finalPacketToSend.length && k < buffer.length; i++, k++) {
finalPacketToSend[i] = buffer[k];
}
//Sending Data packet with Header to Server
DatagramPacket serverPacket = new DatagramPacket(finalPacketToSend, finalPacketToSend.length, InetAddress.getByName(serverIP), serverPort);
sendToServerSocket.send(serverPacket);
}
| static void function(byte[] buffer, int byteSize, int seqNum) throws IOException { byte[] sendSeqNum = new byte[4]; byte[] temp; int headerSize =8; int i, j, k; temp = new BigInteger(Integer.toString(seqNum), 10).toByteArray(); byte[] client_field = new BigInteger(STR, 2).toByteArray(); int checksum = (int) computeCRC(buffer); byte[] checksumData = new byte[2]; byte[] tempChecksum = new BigInteger(Integer.toString(checksum), 10).toByteArray(); if (tempChecksum.length < 2) { Integer padBits = 2 - tempChecksum.length; for (i = 0; i < padBits; i++) { checksumData[i] = 0; } for (j = padBits, k = 0; j < 2 && k < tempChecksum.length; j++, k++) { checksumData[j] = tempChecksum[k]; } } else { checksumData = new BigInteger(Integer.toString(checksum), 10).toByteArray(); } System.out.println(STR + temp.length); if (temp.length < 4) { for (i = 0; i < 4 - temp.length; i++) { sendSeqNum[i] = 0; } for (j = 4 - temp.length, k=0; j < 4; j++) { sendSeqNum[j] = temp[k]; k++; } } byte[] finalPacketToSend = new byte[headerSize + byteSize]; for (i = 0; i < 4; i++) { finalPacketToSend[i] = sendSeqNum[i]; } byte[] sn = new byte[getMss()]; System.arraycopy(finalPacketToSend, 0, sn, 0, 4); int s = java.nio.ByteBuffer.wrap(sn).getInt(); for (i = 4,k=0; i < 6; i++) { finalPacketToSend[i] = checksumData[k]; k++; } for (i = 6,k=0;i < 8; i++) { finalPacketToSend[i] = client_field[k]; k++; } for (i = 8, k = 0; i < finalPacketToSend.length && k < buffer.length; i++, k++) { finalPacketToSend[i] = buffer[k]; } DatagramPacket serverPacket = new DatagramPacket(finalPacketToSend, finalPacketToSend.length, InetAddress.getByName(serverIP), serverPort); sendToServerSocket.send(serverPacket); } | /**
* This method sends the transmission message to the server
*
* @param buffer
* @param byteSize
* @param seqNum
* @throws IOException
*/ | This method sends the transmission message to the server | rdt_send | {
"repo_name": "shubham90/SimpleFTP",
"path": "src/Client/Client.java",
"license": "mit",
"size": 13803
} | [
"java.io.IOException",
"java.math.BigInteger",
"java.net.DatagramPacket",
"java.net.InetAddress"
]
| import java.io.IOException; import java.math.BigInteger; import java.net.DatagramPacket; import java.net.InetAddress; | import java.io.*; import java.math.*; import java.net.*; | [
"java.io",
"java.math",
"java.net"
]
| java.io; java.math; java.net; | 2,416,611 |
@Transient @Accessor
public String getNodeName() {
return getName();
} | @Transient String function() { return getName(); } | /**
* Simple implementation for LayoutNode interface. Simply calls getName().
*/ | Simple implementation for LayoutNode interface. Simply calls getName() | getNodeName | {
"repo_name": "amitkr/power-architect",
"path": "src/main/java/ca/sqlpower/architect/swingui/ContainerPane.java",
"license": "gpl-3.0",
"size": 21896
} | [
"ca.sqlpower.object.annotation.Transient"
]
| import ca.sqlpower.object.annotation.Transient; | import ca.sqlpower.object.annotation.*; | [
"ca.sqlpower.object"
]
| ca.sqlpower.object; | 1,360,077 |
private boolean doesLatLongMatch(String oid, double latitude,
double longitude, double accuracy) throws BimExchangeException {
String query = "SELECT latitude, longitude FROM project WHERE poid='"
+ oid + "'";
List<String> result = executeSelect(query,
BimExConstants.BIMEX_DB_SCHEMA, "latitude", "longitude");
if (LOG.isDebugEnabled()) {
LOG.debug("Searching for matching project with the given longitude and latitude...");
}
try {
String val_1 = result.get(0).split(",")[0];
String val_2 = result.get(0).split(",")[1];
if ((val_1.equals("null")) || (val_2.equals("null"))
|| (val_1.isEmpty()) || (val_2.isEmpty())) {
return false;
}
double lat = Double.valueOf(val_1);
double longt = Double.valueOf(val_2);
if ((Math.abs((latitude - lat)) <= accuracy)
&& (Math.abs((longitude - longt)) <= accuracy)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Found a matching project for the given location, poid: "
+ oid);
}
return true;
}
} catch (NumberFormatException e) {
LOG.error("Error in latitude or longitude found");
throw new BimExchangeException(
"Error found in comparing geo locations\n" + e);
}
return false;
} | boolean function(String oid, double latitude, double longitude, double accuracy) throws BimExchangeException { String query = STR + oid + "'"; List<String> result = executeSelect(query, BimExConstants.BIMEX_DB_SCHEMA, STR, STR); if (LOG.isDebugEnabled()) { LOG.debug(STR); } try { String val_1 = result.get(0).split(",")[0]; String val_2 = result.get(0).split(",")[1]; if ((val_1.equals("null")) (val_2.equals("null")) (val_1.isEmpty()) (val_2.isEmpty())) { return false; } double lat = Double.valueOf(val_1); double longt = Double.valueOf(val_2); if ((Math.abs((latitude - lat)) <= accuracy) && (Math.abs((longitude - longt)) <= accuracy)) { if (LOG.isDebugEnabled()) { LOG.debug(STR + oid); } return true; } } catch (NumberFormatException e) { LOG.error(STR); throw new BimExchangeException( STR + e); } return false; } | /**
* Checking whether the project is a matching with the latitude, longitude
* and accuracy parameters.
*
* @param oid
* id of the project.
* @param accuracy
* accuracy.
* @param accuracy2
* @param longitude
* @return true if matching.
* @throws BimExchangeException
*/ | Checking whether the project is a matching with the latitude, longitude and accuracy parameters | doesLatLongMatch | {
"repo_name": "bbrangeo/OpenSourceBIMaaS",
"path": "dev/esb/core/src/main/java/com/bimaas/connect/FilterProjectsByLatLongMediator.java",
"license": "apache-2.0",
"size": 9250
} | [
"com.bimaas.connect.constants.BimExConstants",
"com.bimaas.connect.exception.BimExchangeException",
"java.util.List"
]
| import com.bimaas.connect.constants.BimExConstants; import com.bimaas.connect.exception.BimExchangeException; import java.util.List; | import com.bimaas.connect.constants.*; import com.bimaas.connect.exception.*; import java.util.*; | [
"com.bimaas.connect",
"java.util"
]
| com.bimaas.connect; java.util; | 2,852,252 |
public Attr createAttributeNS(String namespaceURI, String qualifiedName,
String localpart)
throws DOMException {
return new AttrNSImpl(this, namespaceURI, qualifiedName, localpart);
} | Attr function(String namespaceURI, String qualifiedName, String localpart) throws DOMException { return new AttrNSImpl(this, namespaceURI, qualifiedName, localpart); } | /**
* NON-DOM: a factory method used by the Xerces DOM parser
* to create an element.
*
* @param namespaceURI The namespace URI of the attribute to
* create. When it is null or an empty string,
* this method behaves like createAttribute.
* @param qualifiedName The qualified name of the attribute to
* instantiate.
* @param localpart The local name of the attribute to instantiate.
*
* @return Attr A new Attr object.
* @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified
* name contains an invalid character.
*/ | to create an element | createAttributeNS | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/xerces/src/org/apache/xerces/dom/CoreDocumentImpl.java",
"license": "gpl-2.0",
"size": 97493
} | [
"org.w3c.dom.Attr",
"org.w3c.dom.DOMException"
]
| import org.w3c.dom.Attr; import org.w3c.dom.DOMException; | import org.w3c.dom.*; | [
"org.w3c.dom"
]
| org.w3c.dom; | 504,713 |
public static Date getDate(String yyyy_MM_dd) throws ParseException {
return DATE_FORMAT.parse(yyyy_MM_dd);
}
| static Date function(String yyyy_MM_dd) throws ParseException { return DATE_FORMAT.parse(yyyy_MM_dd); } | /**
* Get date from String in format 2013-09-16
* @param yyyy_MM_dd - String with date
* @return Date
* @throws ParseException
*/ | Get date from String in format 2013-09-16 | getDate | {
"repo_name": "MikolaSenyk/civs",
"path": "core/src/main/java/ua/poltava/senyk/civs/utils/DatetimeFormat.java",
"license": "gpl-3.0",
"size": 4047
} | [
"java.text.ParseException",
"java.util.Date"
]
| import java.text.ParseException; import java.util.Date; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
]
| java.text; java.util; | 861,719 |
//-----------------------------------------------------------------------
public ZoneOffsetTransition createTransition(int year) {
LocalDate date;
if (dom < 0) {
date = LocalDate.of(year, month, month.length(IsoChronology.INSTANCE.isLeapYear(year)) + 1 + dom);
if (dow != null) {
date = date.with(previousOrSame(dow));
}
} else {
date = LocalDate.of(year, month, dom);
if (dow != null) {
date = date.with(nextOrSame(dow));
}
}
if (timeEndOfDay) {
date = date.plusDays(1);
}
LocalDateTime localDT = LocalDateTime.of(date, time);
LocalDateTime transition = timeDefinition.createDateTime(localDT, standardOffset, offsetBefore);
return new ZoneOffsetTransition(transition, offsetBefore, offsetAfter);
} | ZoneOffsetTransition function(int year) { LocalDate date; if (dom < 0) { date = LocalDate.of(year, month, month.length(IsoChronology.INSTANCE.isLeapYear(year)) + 1 + dom); if (dow != null) { date = date.with(previousOrSame(dow)); } } else { date = LocalDate.of(year, month, dom); if (dow != null) { date = date.with(nextOrSame(dow)); } } if (timeEndOfDay) { date = date.plusDays(1); } LocalDateTime localDT = LocalDateTime.of(date, time); LocalDateTime transition = timeDefinition.createDateTime(localDT, standardOffset, offsetBefore); return new ZoneOffsetTransition(transition, offsetBefore, offsetAfter); } | /**
* Creates a transition instance for the specified year.
* <p>
* Calculations are performed using the ISO-8601 chronology.
*
* @param year the year to create a transition for, not null
* @return the transition instance, not null
*/ | Creates a transition instance for the specified year. Calculations are performed using the ISO-8601 chronology | createTransition | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/java/time/zone/ZoneOffsetTransitionRule.java",
"license": "mit",
"size": 26333
} | [
"java.time.LocalDate",
"java.time.LocalDateTime",
"java.time.chrono.IsoChronology"
]
| import java.time.LocalDate; import java.time.LocalDateTime; import java.time.chrono.IsoChronology; | import java.time.*; import java.time.chrono.*; | [
"java.time"
]
| java.time; | 809,048 |
public java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI> getSubterm_partitions_PartitionElementOfHLAPI() {
java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI> retour = new ArrayList<fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI>();
for (Term elemnt : getSubterm()) {
if (elemnt.getClass().equals(fr.lip6.move.pnml.pthlpng.partitions.impl.PartitionElementOfImpl.class)) {
retour.add(new fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI(
(fr.lip6.move.pnml.pthlpng.partitions.PartitionElementOf) elemnt));
}
}
return retour;
} | java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI> function() { java.util.List<fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI> retour = new ArrayList<fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI>(); for (Term elemnt : getSubterm()) { if (elemnt.getClass().equals(fr.lip6.move.pnml.pthlpng.partitions.impl.PartitionElementOfImpl.class)) { retour.add(new fr.lip6.move.pnml.pthlpng.partitions.hlapi.PartitionElementOfHLAPI( (fr.lip6.move.pnml.pthlpng.partitions.PartitionElementOf) elemnt)); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of
* PartitionElementOfHLAPI kind. WARNING : this method can creates a lot of new
* object in memory.
*/ | This accessor return a list of encapsulated subelement, only of PartitionElementOfHLAPI kind. WARNING : this method can creates a lot of new object in memory | getSubterm_partitions_PartitionElementOfHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/integers/hlapi/GreaterThanOrEqualHLAPI.java",
"license": "epl-1.0",
"size": 70100
} | [
"fr.lip6.move.pnml.pthlpng.terms.Term",
"java.util.ArrayList",
"java.util.List"
]
| import fr.lip6.move.pnml.pthlpng.terms.Term; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.pthlpng.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
]
| fr.lip6.move; java.util; | 128,326 |
public void testGetPrevNoDupWithEmptyTree()
throws Throwable {
initEnv();
OperationStatus status;
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setSortedDuplicates(true);
dbConfig.setAllowCreate(true);
Database myDb = env.openDatabase(null, "foo", dbConfig);
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
key.setData(TestUtils.getTestArray(1));
data.setData(TestUtils.getTestArray(1));
myDb.put(null, key, data);
data.setData(TestUtils.getTestArray(2));
myDb.put(null, key, data);
key.setData(TestUtils.getTestArray(2));
data.setData(TestUtils.getTestArray(1));
myDb.put(null, key, data);
data.setData(TestUtils.getTestArray(2));
myDb.put(null, key, data);
Cursor cursor = myDb.openCursor(null, null);
while ((status = cursor.getNext(key, data, null)) ==
OperationStatus.SUCCESS) {
cursor.delete();
}
env.compress();
status = cursor.getPrevNoDup(key, data, null);
assertEquals(OperationStatus.NOTFOUND, status);
cursor.close();
myDb.close();
close(env);
env = null;
} | void function() throws Throwable { initEnv(); OperationStatus status; DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setSortedDuplicates(true); dbConfig.setAllowCreate(true); Database myDb = env.openDatabase(null, "foo", dbConfig); DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); key.setData(TestUtils.getTestArray(1)); data.setData(TestUtils.getTestArray(1)); myDb.put(null, key, data); data.setData(TestUtils.getTestArray(2)); myDb.put(null, key, data); key.setData(TestUtils.getTestArray(2)); data.setData(TestUtils.getTestArray(1)); myDb.put(null, key, data); data.setData(TestUtils.getTestArray(2)); myDb.put(null, key, data); Cursor cursor = myDb.openCursor(null, null); while ((status = cursor.getNext(key, data, null)) == OperationStatus.SUCCESS) { cursor.delete(); } env.compress(); status = cursor.getPrevNoDup(key, data, null); assertEquals(OperationStatus.NOTFOUND, status); cursor.close(); myDb.close(); close(env); env = null; } | /**
* Tests a bug fix to CursorImpl.fetchCurrent [#11700] that caused
* ArrayIndexOutOfBoundsException.
*/ | Tests a bug fix to CursorImpl.fetchCurrent [#11700] that caused ArrayIndexOutOfBoundsException | testGetPrevNoDupWithEmptyTree | {
"repo_name": "bjorndm/prebake",
"path": "code/third_party/bdb/test/com/sleepycat/je/CursorEdgeTest.java",
"license": "apache-2.0",
"size": 26272
} | [
"com.sleepycat.je.util.TestUtils"
]
| import com.sleepycat.je.util.TestUtils; | import com.sleepycat.je.util.*; | [
"com.sleepycat.je"
]
| com.sleepycat.je; | 2,589,341 |
@Override
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
public String getQuery() {
return query;
} | @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO) String function() { return query; } | /**
* Gets the query.
*
* @return the query
*/ | Gets the query | getQuery | {
"repo_name": "IHTSDO/OTF-Mapping-Service",
"path": "jpa-model/src/main/java/org/ihtsdo/otf/mapping/reports/ReportJpa.java",
"license": "apache-2.0",
"size": 14658
} | [
"org.hibernate.search.annotations.Analyze",
"org.hibernate.search.annotations.Field",
"org.hibernate.search.annotations.Index",
"org.hibernate.search.annotations.Store"
]
| import org.hibernate.search.annotations.Analyze; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Index; import org.hibernate.search.annotations.Store; | import org.hibernate.search.annotations.*; | [
"org.hibernate.search"
]
| org.hibernate.search; | 1,725,140 |
public void deleteLink(String linkId) throws SQLException {
linkCategoryDAO.deleteByLink(parseInt(linkId));
JdbcSqlQuery.createDeleteFor(LINK_TABLE)
.where(LINK_ID_CLAUSE, parseInt(linkId))
.execute();
} | void function(String linkId) throws SQLException { linkCategoryDAO.deleteByLink(parseInt(linkId)); JdbcSqlQuery.createDeleteFor(LINK_TABLE) .where(LINK_ID_CLAUSE, parseInt(linkId)) .execute(); } | /**
* Remove a link
* @param linkId the link identifier to remove
* @throws SQLException on SQL problem
*/ | Remove a link | deleteLink | {
"repo_name": "SilverDav/Silverpeas-Core",
"path": "core-services/mylinks/src/main/java/org/silverpeas/core/mylinks/dao/LinkDAO.java",
"license": "agpl-3.0",
"size": 9897
} | [
"java.lang.Integer",
"java.sql.SQLException",
"org.silverpeas.core.persistence.jdbc.sql.JdbcSqlQuery"
]
| import java.lang.Integer; import java.sql.SQLException; import org.silverpeas.core.persistence.jdbc.sql.JdbcSqlQuery; | import java.lang.*; import java.sql.*; import org.silverpeas.core.persistence.jdbc.sql.*; | [
"java.lang",
"java.sql",
"org.silverpeas.core"
]
| java.lang; java.sql; org.silverpeas.core; | 2,612,568 |
public void setDependencies(Var to, List<Var> fromVars) {
Var toCanon = getCanonicalAlias(to.asArg());
for (Var fromVar: fromVars) {
Var fromCanon = getCanonicalAlias(fromVar.asArg());
track.setDependency(toCanon, fromCanon);
}
} | void function(Var to, List<Var> fromVars) { Var toCanon = getCanonicalAlias(to.asArg()); for (Var fromVar: fromVars) { Var fromCanon = getCanonicalAlias(fromVar.asArg()); track.setDependency(toCanon, fromCanon); } } | /**
* Add in closedness dependency: if to is closed, implies
* from is closed
* @param to
* @param fromVars
* TODO: this information can be propagated up the IR tree, since if
* A -> B in a wait statement, this implies that in any parent
* blocks, that if B is set, then A is set (assuming no
* contradictions)
*/ | Add in closedness dependency: if to is closed, implies from is closed | setDependencies | {
"repo_name": "basheersubei/swift-t",
"path": "stc/code/src/exm/stc/ic/opt/valuenumber/Congruences.java",
"license": "apache-2.0",
"size": 40775
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 361,217 |
public View getFocusableViewAfter(int referenceChildPosition, int layoutDir) {
View candidate = null;
if (layoutDir == LAYOUT_START) {
final int limit = mViews.size();
for (int i = 0; i < limit; i++) {
final View view = mViews.get(i);
if (view.isFocusable() &&
(getPosition(view) > referenceChildPosition == mReverseLayout) ) {
candidate = view;
} else {
break;
}
}
} else {
for (int i = mViews.size() - 1; i >= 0; i--) {
final View view = mViews.get(i);
if (view.isFocusable() &&
(getPosition(view) > referenceChildPosition == !mReverseLayout)) {
candidate = view;
} else {
break;
}
}
}
return candidate;
}
}
static class LazySpanLookup {
private static final int MIN_SIZE = 10;
int[] mData;
List<FullSpanItem> mFullSpanItems; | View function(int referenceChildPosition, int layoutDir) { View candidate = null; if (layoutDir == LAYOUT_START) { final int limit = mViews.size(); for (int i = 0; i < limit; i++) { final View view = mViews.get(i); if (view.isFocusable() && (getPosition(view) > referenceChildPosition == mReverseLayout) ) { candidate = view; } else { break; } } } else { for (int i = mViews.size() - 1; i >= 0; i--) { final View view = mViews.get(i); if (view.isFocusable() && (getPosition(view) > referenceChildPosition == !mReverseLayout)) { candidate = view; } else { break; } } } return candidate; } } static class LazySpanLookup { private static final int MIN_SIZE = 10; int[] mData; List<FullSpanItem> mFullSpanItems; | /**
* Depending on the layout direction, returns the View that is after the given position.
*/ | Depending on the layout direction, returns the View that is after the given position | getFocusableViewAfter | {
"repo_name": "AylaGene/testRepo_Public",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/support/widget/StaggeredGridLayoutManager.java",
"license": "gpl-2.0",
"size": 117836
} | [
"android.view.View",
"java.util.List"
]
| import android.view.View; import java.util.List; | import android.view.*; import java.util.*; | [
"android.view",
"java.util"
]
| android.view; java.util; | 1,066,961 |
public static ParsedAndroidData from(UnvalidatedAndroidDirectories primary)
throws IOException, MergingException {
final ParsedAndroidDataBuildingPathWalker pathWalker =
ParsedAndroidDataBuildingPathWalker.create(Builder.newBuilder());
primary.walk(pathWalker);
return pathWalker.createParsedAndroidData();
} | static ParsedAndroidData function(UnvalidatedAndroidDirectories primary) throws IOException, MergingException { final ParsedAndroidDataBuildingPathWalker pathWalker = ParsedAndroidDataBuildingPathWalker.create(Builder.newBuilder()); primary.walk(pathWalker); return pathWalker.createParsedAndroidData(); } | /**
* Creates an ParsedAndroidData from an UnvalidatedAndroidData.
*
* <p>The adding process parses out all the provided symbol into DataResources and DataAssets
* objects.
*
* @param primary The primary data to parse into DataResources and DataAssets.
* @throws IOException when there are issues with reading files.
* @throws MergingException when there is invalid resource information.
*/ | Creates an ParsedAndroidData from an UnvalidatedAndroidData. The adding process parses out all the provided symbol into DataResources and DataAssets objects | from | {
"repo_name": "dslomov/bazel",
"path": "src/tools/android/java/com/google/devtools/build/android/ParsedAndroidData.java",
"license": "apache-2.0",
"size": 23519
} | [
"com.google.devtools.build.android.AndroidResourceMerger",
"java.io.IOException"
]
| import com.google.devtools.build.android.AndroidResourceMerger; import java.io.IOException; | import com.google.devtools.build.android.*; import java.io.*; | [
"com.google.devtools",
"java.io"
]
| com.google.devtools; java.io; | 1,006,344 |
private void startGame() throws LWJGLException, IOException
{
this.gameSettings = new GameSettings(this, this.mcDataDir);
this.defaultResourcePacks.add(this.mcDefaultResourcePack);
// Begin Awaken Dreams code
this.defaultResourcePacks.add(this.adDefaultResourcePack);
// End Awaken Dreams code
this.startTimerHackThread();
if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0)
{
this.displayWidth = this.gameSettings.overrideWidth;
this.displayHeight = this.gameSettings.overrideHeight;
}
LOGGER.info("LWJGL Version: {}", new Object[] {Sys.getVersion()});
this.setWindowIcon();
this.setInitialDisplayMode();
this.createDisplay();
OpenGlHelper.initializeTextures();
this.framebufferMc = new Framebuffer(this.displayWidth, this.displayHeight, true);
this.framebufferMc.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F);
this.registerMetadataSerializers();
this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, new File(this.mcDataDir, "server-resource-packs"), this.mcDefaultResourcePack, this.adDefaultResourcePack, this.metadataSerializer_, this.gameSettings);
this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_);
this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language);
this.mcResourceManager.registerReloadListener(this.mcLanguageManager);
this.refreshResources();
this.renderEngine = new TextureManager(this.mcResourceManager);
this.mcResourceManager.registerReloadListener(this.renderEngine);
this.drawSplashScreen(this.renderEngine);
this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService);
this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.dataFixer);
this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings);
this.mcResourceManager.registerReloadListener(this.mcSoundHandler);
this.mcMusicTicker = new MusicTicker(this);
this.fontRendererObj = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.renderEngine, false);
if (this.gameSettings.language != null)
{
this.fontRendererObj.setUnicodeFlag(this.isUnicode());
this.fontRendererObj.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional());
} | void function() throws LWJGLException, IOException { this.gameSettings = new GameSettings(this, this.mcDataDir); this.defaultResourcePacks.add(this.mcDefaultResourcePack); this.defaultResourcePacks.add(this.adDefaultResourcePack); this.startTimerHackThread(); if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) { this.displayWidth = this.gameSettings.overrideWidth; this.displayHeight = this.gameSettings.overrideHeight; } LOGGER.info(STR, new Object[] {Sys.getVersion()}); this.setWindowIcon(); this.setInitialDisplayMode(); this.createDisplay(); OpenGlHelper.initializeTextures(); this.framebufferMc = new Framebuffer(this.displayWidth, this.displayHeight, true); this.framebufferMc.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); this.registerMetadataSerializers(); this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, new File(this.mcDataDir, STR), this.mcDefaultResourcePack, this.adDefaultResourcePack, this.metadataSerializer_, this.gameSettings); this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); this.mcResourceManager.registerReloadListener(this.mcLanguageManager); this.refreshResources(); this.renderEngine = new TextureManager(this.mcResourceManager); this.mcResourceManager.registerReloadListener(this.renderEngine); this.drawSplashScreen(this.renderEngine); this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.dataFixer); this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings); this.mcResourceManager.registerReloadListener(this.mcSoundHandler); this.mcMusicTicker = new MusicTicker(this); this.fontRendererObj = new FontRenderer(this.gameSettings, new ResourceLocation(STR), this.renderEngine, false); if (this.gameSettings.language != null) { this.fontRendererObj.setUnicodeFlag(this.isUnicode()); this.fontRendererObj.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional()); } | /**
* Starts the game: initializes the canvas, the title, the settings, etcetera.
*/ | Starts the game: initializes the canvas, the title, the settings, etcetera | startGame | {
"repo_name": "TheValarProject/AwakenDreamsClient",
"path": "mcp/src/minecraft/net/minecraft/client/Minecraft.java",
"license": "gpl-3.0",
"size": 135919
} | [
"java.io.File",
"java.io.IOException",
"net.minecraft.client.audio.MusicTicker",
"net.minecraft.client.audio.SoundHandler",
"net.minecraft.client.gui.FontRenderer",
"net.minecraft.client.renderer.OpenGlHelper",
"net.minecraft.client.renderer.texture.TextureManager",
"net.minecraft.client.resources.LanguageManager",
"net.minecraft.client.resources.ResourcePackRepository",
"net.minecraft.client.resources.SimpleReloadableResourceManager",
"net.minecraft.client.resources.SkinManager",
"net.minecraft.client.settings.GameSettings",
"net.minecraft.client.shader.Framebuffer",
"net.minecraft.util.ResourceLocation",
"net.minecraft.world.chunk.storage.AnvilSaveConverter",
"org.lwjgl.LWJGLException",
"org.lwjgl.Sys"
]
| import java.io.File; import java.io.IOException; import net.minecraft.client.audio.MusicTicker; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.LanguageManager; import net.minecraft.client.resources.ResourcePackRepository; import net.minecraft.client.resources.SimpleReloadableResourceManager; import net.minecraft.client.resources.SkinManager; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.shader.Framebuffer; import net.minecraft.util.ResourceLocation; import net.minecraft.world.chunk.storage.AnvilSaveConverter; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; | import java.io.*; import net.minecraft.client.audio.*; import net.minecraft.client.gui.*; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.texture.*; import net.minecraft.client.resources.*; import net.minecraft.client.settings.*; import net.minecraft.client.shader.*; import net.minecraft.util.*; import net.minecraft.world.chunk.storage.*; import org.lwjgl.*; | [
"java.io",
"net.minecraft.client",
"net.minecraft.util",
"net.minecraft.world",
"org.lwjgl"
]
| java.io; net.minecraft.client; net.minecraft.util; net.minecraft.world; org.lwjgl; | 823,055 |
protected StateValues checkExpressionReward(Model model, ExpressionReward expr) throws PrismException
{
Expression rb; // Reward bound (expression)
double r = 0; // Reward bound (actual value)
RelOp relOp; // Relational operator
StateValues rews = null;
Rewards rewards = null;
// Get info from R operator
RewardStruct rewStruct = expr.getRewardStructByIndexObject(modulesFile, constantValues);
relOp = expr.getRelOp();
rb = expr.getReward();
if (rb != null) {
r = rb.evaluateDouble(constantValues);
if (r < 0)
throw new PrismException("Invalid reward bound " + r + " in R[] formula");
}
// Build rewards
mainLog.println("Building reward structure...");
rewards = constructRewards(model, rewStruct);
// Compute rewards
MinMax minMax = (relOp.isLowerBound() || relOp.isMin()) ? MinMax.min() : MinMax.max();
rews = checkRewardFormula(model, rewards, expr.getExpression(), minMax);
// Print out rewards
if (getVerbosity() > 5) {
mainLog.print("\nRewards (non-zero only) for all states:\n");
rews.print(mainLog);
}
// For =? properties, just return values
if (rb == null) {
return rews;
}
// Otherwise, compare against bound to get set of satisfying states
else {
BitSet sol = rews.getBitSetFromInterval(relOp, r);
rews.clear();
return StateValues.createFromBitSet(sol, model);
}
} | StateValues function(Model model, ExpressionReward expr) throws PrismException { Expression rb; double r = 0; RelOp relOp; StateValues rews = null; Rewards rewards = null; RewardStruct rewStruct = expr.getRewardStructByIndexObject(modulesFile, constantValues); relOp = expr.getRelOp(); rb = expr.getReward(); if (rb != null) { r = rb.evaluateDouble(constantValues); if (r < 0) throw new PrismException(STR + r + STR); } mainLog.println(STR); rewards = constructRewards(model, rewStruct); MinMax minMax = (relOp.isLowerBound() relOp.isMin()) ? MinMax.min() : MinMax.max(); rews = checkRewardFormula(model, rewards, expr.getExpression(), minMax); if (getVerbosity() > 5) { mainLog.print(STR); rews.print(mainLog); } if (rb == null) { return rews; } else { BitSet sol = rews.getBitSetFromInterval(relOp, r); rews.clear(); return StateValues.createFromBitSet(sol, model); } } | /**
* Model check an R operator expression and return the values for all states.
*/ | Model check an R operator expression and return the values for all states | checkExpressionReward | {
"repo_name": "bharathk005/prism-4.2.1-src-teaser-patch",
"path": "src/explicit/ProbModelChecker.java",
"license": "gpl-2.0",
"size": 29173
} | [
"java.util.BitSet"
]
| import java.util.BitSet; | import java.util.*; | [
"java.util"
]
| java.util; | 720,094 |
if (s == null) {
return null;
}
String result = null;
try {
result = URLDecoder.decode(s, "UTF-8");
}
// This exception should never occur.
catch (UnsupportedEncodingException e) {
result = s;
}
return result;
} | if (s == null) { return null; } String result = null; try { result = URLDecoder.decode(s, "UTF-8"); } catch (UnsupportedEncodingException e) { result = s; } return result; } | /**
* Decodes the passed UTF-8 String using an algorithm that's compatible with
* JavaScript's <code>decodeURIComponent</code> function. Returns
* <code>null</code> if the String is <code>null</code>.
*
* @param s
* The UTF-8 encoded String to be decoded
* @return the decoded String
*/ | Decodes the passed UTF-8 String using an algorithm that's compatible with JavaScript's <code>decodeURIComponent</code> function. Returns <code>null</code> if the String is <code>null</code> | decodeURIComponent | {
"repo_name": "NationStates/NationStatesPlusPlus",
"path": "Assembly/app/net/nationstatesplusplus/assembly/util/EncodingUtil.java",
"license": "mit",
"size": 1866
} | [
"java.io.UnsupportedEncodingException",
"java.net.URLDecoder"
]
| import java.io.UnsupportedEncodingException; import java.net.URLDecoder; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
]
| java.io; java.net; | 491,443 |
public boolean checkRegionChain(TableIntegrityErrorHandler handler) throws IOException {
// When table is disabled no need to check for the region chain. Some of the regions
// accidently if deployed, this below code might report some issues like missing start
// or end regions or region hole in chain and may try to fix which is unwanted.
if (disabledTables.contains(this.tableName.getBytes())) {
return true;
}
int originalErrorsCount = errors.getErrorList().size();
Multimap<byte[], HbckInfo> regions = sc.calcCoverage();
SortedSet<byte[]> splits = sc.getSplits();
byte[] prevKey = null;
byte[] problemKey = null;
for (byte[] key : splits) {
Collection<HbckInfo> ranges = regions.get(key);
if (prevKey == null && !Bytes.equals(key, HConstants.EMPTY_BYTE_ARRAY)) {
for (HbckInfo rng : ranges) {
handler.handleRegionStartKeyNotEmpty(rng);
}
}
// check for degenerate ranges
for (HbckInfo rng : ranges) {
// special endkey case converts '' to null
byte[] endKey = rng.getEndKey();
endKey = (endKey.length == 0) ? null : endKey;
if (Bytes.equals(rng.getStartKey(),endKey)) {
handler.handleDegenerateRegion(rng);
}
}
if (ranges.size() == 1) {
// this split key is ok -- no overlap, not a hole.
if (problemKey != null) {
LOG.warn("reached end of problem group: " + Bytes.toStringBinary(key));
}
problemKey = null; // fell through, no more problem.
} else if (ranges.size() > 1) {
// set the new problem key group name, if already have problem key, just
// keep using it.
if (problemKey == null) {
// only for overlap regions.
LOG.warn("Naming new problem group: " + Bytes.toStringBinary(key));
problemKey = key;
}
overlapGroups.putAll(problemKey, ranges);
// record errors
ArrayList<HbckInfo> subRange = new ArrayList<HbckInfo>(ranges);
// this dumb and n^2 but this shouldn't happen often
for (HbckInfo r1 : ranges) {
subRange.remove(r1);
for (HbckInfo r2 : subRange) {
if (Bytes.compareTo(r1.getStartKey(), r2.getStartKey())==0) {
handler.handleDuplicateStartKeys(r1,r2);
} else {
// overlap
handler.handleOverlapInRegionChain(r1, r2);
}
}
}
} else if (ranges.size() == 0) {
if (problemKey != null) {
LOG.warn("reached end of problem group: " + Bytes.toStringBinary(key));
}
problemKey = null;
byte[] holeStopKey = sc.getSplits().higher(key);
// if higher key is null we reached the top.
if (holeStopKey != null) {
// hole
handler.handleHoleInRegionChain(key, holeStopKey);
}
}
prevKey = key;
}
// When the last region of a table is proper and having an empty end key, 'prevKey'
// will be null.
if (prevKey != null) {
handler.handleRegionEndKeyNotEmpty(prevKey);
}
for (Collection<HbckInfo> overlap : overlapGroups.asMap().values()) {
handler.handleOverlapGroup(overlap);
}
if (details) {
// do full region split map dump
errors.print("---- Table '" + this.tableName
+ "': region split map");
dump(splits, regions);
errors.print("---- Table '" + this.tableName
+ "': overlap groups");
dumpOverlapProblems(overlapGroups);
errors.print("There are " + overlapGroups.keySet().size()
+ " overlap groups with " + overlapGroups.size()
+ " overlapping regions");
}
if (!sidelinedRegions.isEmpty()) {
LOG.warn("Sidelined big overlapped regions, please bulk load them!");
errors.print("---- Table '" + this.tableName
+ "': sidelined big overlapped regions");
dumpSidelinedRegions(sidelinedRegions);
}
return errors.getErrorList().size() == originalErrorsCount;
} | boolean function(TableIntegrityErrorHandler handler) throws IOException { if (disabledTables.contains(this.tableName.getBytes())) { return true; } int originalErrorsCount = errors.getErrorList().size(); Multimap<byte[], HbckInfo> regions = sc.calcCoverage(); SortedSet<byte[]> splits = sc.getSplits(); byte[] prevKey = null; byte[] problemKey = null; for (byte[] key : splits) { Collection<HbckInfo> ranges = regions.get(key); if (prevKey == null && !Bytes.equals(key, HConstants.EMPTY_BYTE_ARRAY)) { for (HbckInfo rng : ranges) { handler.handleRegionStartKeyNotEmpty(rng); } } for (HbckInfo rng : ranges) { byte[] endKey = rng.getEndKey(); endKey = (endKey.length == 0) ? null : endKey; if (Bytes.equals(rng.getStartKey(),endKey)) { handler.handleDegenerateRegion(rng); } } if (ranges.size() == 1) { if (problemKey != null) { LOG.warn(STR + Bytes.toStringBinary(key)); } problemKey = null; } else if (ranges.size() > 1) { if (problemKey == null) { LOG.warn(STR + Bytes.toStringBinary(key)); problemKey = key; } overlapGroups.putAll(problemKey, ranges); ArrayList<HbckInfo> subRange = new ArrayList<HbckInfo>(ranges); for (HbckInfo r1 : ranges) { subRange.remove(r1); for (HbckInfo r2 : subRange) { if (Bytes.compareTo(r1.getStartKey(), r2.getStartKey())==0) { handler.handleDuplicateStartKeys(r1,r2); } else { handler.handleOverlapInRegionChain(r1, r2); } } } } else if (ranges.size() == 0) { if (problemKey != null) { LOG.warn(STR + Bytes.toStringBinary(key)); } problemKey = null; byte[] holeStopKey = sc.getSplits().higher(key); if (holeStopKey != null) { handler.handleHoleInRegionChain(key, holeStopKey); } } prevKey = key; } if (prevKey != null) { handler.handleRegionEndKeyNotEmpty(prevKey); } for (Collection<HbckInfo> overlap : overlapGroups.asMap().values()) { handler.handleOverlapGroup(overlap); } if (details) { errors.print(STR + this.tableName + STR); dump(splits, regions); errors.print(STR + this.tableName + STR); dumpOverlapProblems(overlapGroups); errors.print(STR + overlapGroups.keySet().size() + STR + overlapGroups.size() + STR); } if (!sidelinedRegions.isEmpty()) { LOG.warn(STR); errors.print(STR + this.tableName + STR); dumpSidelinedRegions(sidelinedRegions); } return errors.getErrorList().size() == originalErrorsCount; } | /**
* Check the region chain (from META) of this table. We are looking for
* holes, overlaps, and cycles.
* @return false if there are errors
* @throws IOException
*/ | Check the region chain (from META) of this table. We are looking for holes, overlaps, and cycles | checkRegionChain | {
"repo_name": "gdweijin/hindex",
"path": "src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java",
"license": "apache-2.0",
"size": 137333
} | [
"com.google.common.collect.Multimap",
"java.io.IOException",
"java.util.ArrayList",
"java.util.Collection",
"java.util.SortedSet",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.util.hbck.TableIntegrityErrorHandler"
]
| import com.google.common.collect.Multimap; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.SortedSet; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.util.hbck.TableIntegrityErrorHandler; | import com.google.common.collect.*; import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.hbck.*; | [
"com.google.common",
"java.io",
"java.util",
"org.apache.hadoop"
]
| com.google.common; java.io; java.util; org.apache.hadoop; | 2,544,900 |
public ParquetWriter<T> build() throws IOException {
if (file != null) {
return new ParquetWriter<>(file,
mode, getWriteSupport(conf), codecName, rowGroupSize, enableValidation, conf,
maxPaddingSize, encodingPropsBuilder.build());
} else {
return new ParquetWriter<>(HadoopOutputFile.fromPath(path, conf),
mode, getWriteSupport(conf), codecName,
rowGroupSize, enableValidation, conf, maxPaddingSize,
encodingPropsBuilder.build());
}
}
} | ParquetWriter<T> function() throws IOException { if (file != null) { return new ParquetWriter<>(file, mode, getWriteSupport(conf), codecName, rowGroupSize, enableValidation, conf, maxPaddingSize, encodingPropsBuilder.build()); } else { return new ParquetWriter<>(HadoopOutputFile.fromPath(path, conf), mode, getWriteSupport(conf), codecName, rowGroupSize, enableValidation, conf, maxPaddingSize, encodingPropsBuilder.build()); } } } | /**
* Build a {@link ParquetWriter} with the accumulated configuration.
*
* @return a configured {@code ParquetWriter} instance.
* @throws IOException if there is an error while creating the writer
*/ | Build a <code>ParquetWriter</code> with the accumulated configuration | build | {
"repo_name": "HyukjinKwon/parquet-mr-1",
"path": "parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetWriter.java",
"license": "apache-2.0",
"size": 19477
} | [
"java.io.IOException",
"org.apache.parquet.hadoop.util.HadoopOutputFile"
]
| import java.io.IOException; import org.apache.parquet.hadoop.util.HadoopOutputFile; | import java.io.*; import org.apache.parquet.hadoop.util.*; | [
"java.io",
"org.apache.parquet"
]
| java.io; org.apache.parquet; | 380,704 |
protected static URL getFirmwareURL() {
try {
String url = Base.preferences.get("replicatorg.updates.url",
DEFAULT_UPDATES_URL);
return new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
} | static URL function() { try { String url = Base.preferences.get(STR, DEFAULT_UPDATES_URL); return new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); return null; } } | /**
* Get the URL of the source for dowloading
*/ | Get the URL of the source for dowloading | getFirmwareURL | {
"repo_name": "natetrue/ReplicatorG",
"path": "src/replicatorg/uploader/FirmwareUploader.java",
"license": "gpl-2.0",
"size": 7273
} | [
"java.net.MalformedURLException"
]
| import java.net.MalformedURLException; | import java.net.*; | [
"java.net"
]
| java.net; | 2,789,098 |
public List<String> getQuestion()
{
return Questions;
} | List<String> function() { return Questions; } | /**
* Getter - Question
* @return Question
*/ | Getter - Question | getQuestion | {
"repo_name": "JamesMarino/CSCI213",
"path": "Assignments/Assignment 1/Solutions/src/au/edu/uow/QuestionLibrary/MultipleChoiceQuestion.java",
"license": "mit",
"size": 1800
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 1,831,458 |
public Stream<T> stream ()
{
this.log.trace ("stream:");
Preconditions.checkState (this.manager.isOpen (), "DataStore is Closed");
Preconditions.checkState (this.query.getParameters ()
.stream ()
.allMatch (p -> this.query.isBound (p)), "Query Parameters must not be null");
return this.query.getResultList ()
.stream ()
.map (e -> this.setDomainModel (e));
} | Stream<T> function () { this.log.trace (STR); Preconditions.checkState (this.manager.isOpen (), STR); Preconditions.checkState (this.query.getParameters () .stream () .allMatch (p -> this.query.isBound (p)), STR); return this.query.getResultList () .stream () .map (e -> this.setDomainModel (e)); } | /**
* Get a <code>Stream</code> of <code>Element</code> instances from the
* <code>DataStore</code> which match the <code>Query</code>.
*
* @return A <code>Stream</code> containing the
* <code>Element</code> instances with match
* the <code>Query</code>
* @throws IllegalStateException if the <code>DataStore</code> is closed
* @throws IllegalStateException if any <code>Property</code> instance
* associated with the <code>Query</code> has
* a null value
*/ | Get a <code>Stream</code> of <code>Element</code> instances from the <code>DataStore</code> which match the <code>Query</code> | stream | {
"repo_name": "jestark/LMSDataHarvester",
"path": "src/main/java/ca/uoguelph/socs/icc/edm/domain/datastore/jpa/JPANamedQuery.java",
"license": "gpl-3.0",
"size": 10522
} | [
"com.google.common.base.Preconditions",
"java.util.stream.Stream"
]
| import com.google.common.base.Preconditions; import java.util.stream.Stream; | import com.google.common.base.*; import java.util.stream.*; | [
"com.google.common",
"java.util"
]
| com.google.common; java.util; | 1,542,696 |
@Metadata(defaultValue = "20000", label = "producer",
description = "The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds)."
+ " The default is 20 seconds. You can include the header \"CamelJmsRequestTimeout\" to override this endpoint configured"
+ " timeout value, and thus have per message individual timeout values."
+ " See also the requestTimeoutCheckerInterval option.")
public void setRequestTimeout(long requestTimeout) {
getConfiguration().setRequestTimeout(requestTimeout);
} | @Metadata(defaultValue = "20000", label = STR, description = STR + STRCamelJmsRequestTimeout\STR + STR + STR) void function(long requestTimeout) { getConfiguration().setRequestTimeout(requestTimeout); } | /**
* The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds).
* The default is 20 seconds. You can include the header "CamelJmsRequestTimeout" to override this endpoint configured
* timeout value, and thus have per message individual timeout values.
* See also the requestTimeoutCheckerInterval option.
*/ | The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). The default is 20 seconds. You can include the header "CamelJmsRequestTimeout" to override this endpoint configured timeout value, and thus have per message individual timeout values. See also the requestTimeoutCheckerInterval option | setRequestTimeout | {
"repo_name": "CodeSmell/camel",
"path": "components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java",
"license": "apache-2.0",
"size": 83917
} | [
"org.apache.camel.spi.Metadata"
]
| import org.apache.camel.spi.Metadata; | import org.apache.camel.spi.*; | [
"org.apache.camel"
]
| org.apache.camel; | 2,435,285 |
public void decGauge(String gaugeName, long delta) {
MutableGaugeLong gaugeInt = metricsRegistry.getLongGauge(gaugeName, 0l);
gaugeInt.decr(delta);
} | void function(String gaugeName, long delta) { MutableGaugeLong gaugeInt = metricsRegistry.getLongGauge(gaugeName, 0l); gaugeInt.decr(delta); } | /**
* Decrease the value of a named gauge.
*
* @param gaugeName The name of the gauge.
* @param delta the ammount to subtract from a gauge value.
*/ | Decrease the value of a named gauge | decGauge | {
"repo_name": "Jackygq1982/hbase_src",
"path": "hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/metrics/BaseSourceImpl.java",
"license": "apache-2.0",
"size": 5447
} | [
"org.apache.hadoop.metrics2.lib.MutableGaugeLong"
]
| import org.apache.hadoop.metrics2.lib.MutableGaugeLong; | import org.apache.hadoop.metrics2.lib.*; | [
"org.apache.hadoop"
]
| org.apache.hadoop; | 2,594,116 |
T visitClassName_Healer(@NotNull SofaLangParser.ClassName_HealerContext ctx); | T visitClassName_Healer(@NotNull SofaLangParser.ClassName_HealerContext ctx); | /**
* Visit a parse tree produced by {@link SofaLangParser#className_Healer}.
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>SofaLangParser#className_Healer</code> | visitClassName_Healer | {
"repo_name": "mockillo/sofa",
"path": "sofa/src/com/tehforce/sofa/parser/SofaLangVisitor.java",
"license": "mit",
"size": 10535
} | [
"org.antlr.v4.runtime.misc.NotNull"
]
| import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
]
| org.antlr.v4; | 2,875,725 |
public static int getDisplayHeight() {
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
return screen.height;
}
| static int function() { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); return screen.height; } | /**
* Returns the height of the current display (desktop) in pxels. In fullscreen
* mode, this value corresponds to the height of the <code>MinuetoWindow</code>.
*
* @return <code>int</code> denoting the height of the current display.
**/ | Returns the height of the current display (desktop) in pxels. In fullscreen mode, this value corresponds to the height of the <code>MinuetoWindow</code> | getDisplayHeight | {
"repo_name": "Mikeware/minueto",
"path": "src/core/org/minueto/MinuetoTool.java",
"license": "lgpl-2.1",
"size": 2815
} | [
"java.awt.Dimension",
"java.awt.Toolkit"
]
| import java.awt.Dimension; import java.awt.Toolkit; | import java.awt.*; | [
"java.awt"
]
| java.awt; | 1,640,669 |
protected void eliminate(Matrix matrix, Consumer<Householder> listener, int j) {
double[] column = new double[matrix.getRowCount()];
this.getColumn(matrix, j, j, column);
Householder hh = new Householder(column, j);
double norm = hh.normalize();
if(norm == 0.0){
return;
}
hh.applyLeft(matrix, j + 1);
matrix.set(j, j, norm);
listener.accept(hh);
}
| void function(Matrix matrix, Consumer<Householder> listener, int j) { double[] column = new double[matrix.getRowCount()]; this.getColumn(matrix, j, j, column); Householder hh = new Householder(column, j); double norm = hh.normalize(); if(norm == 0.0){ return; } hh.applyLeft(matrix, j + 1); matrix.set(j, j, norm); listener.accept(hh); } | /**
* Eliminate all sub-diagonal entries of a column
* in a matrix A by Householder reflection.
* @param matrix Matrix A
* @param listener Householder reflection listener
* @param j Column index of column to be eliminated
*/ | Eliminate all sub-diagonal entries of a column in a matrix A by Householder reflection | eliminate | {
"repo_name": "ykechan/jacobi",
"path": "src/main/java/jacobi/core/decomp/qr/QRDecomp.java",
"license": "mit",
"size": 5357
} | [
"java.util.function.Consumer"
]
| import java.util.function.Consumer; | import java.util.function.*; | [
"java.util"
]
| java.util; | 1,114,828 |
public boolean isTraversable(Position from, Direction direction, int size) {
switch (direction) {
case NORTH:
return isTraversableNorth(from.getHeight(), from.getX(), from.getY(), size);
case SOUTH:
return isTraversableSouth(from.getHeight(), from.getX(), from.getY(), size);
case EAST:
return isTraversableEast(from.getHeight(), from.getX(), from.getY(), size);
case WEST:
return isTraversableWest(from.getHeight(), from.getX(), from.getY(), size);
case NORTH_EAST:
return isTraversableNorthEast(from.getHeight(), from.getX(), from.getY(), size);
case NORTH_WEST:
return isTraversableNorthWest(from.getHeight(), from.getX(), from.getY(), size);
case SOUTH_EAST:
return isTraversableSouthEast(from.getHeight(), from.getX(), from.getY(), size);
case SOUTH_WEST:
return isTraversableSouthWest(from.getHeight(), from.getX(), from.getY(), size);
case NONE:
return true;
default:
throw new IllegalArgumentException("direction: " + direction + " is not valid");
}
} | boolean function(Position from, Direction direction, int size) { switch (direction) { case NORTH: return isTraversableNorth(from.getHeight(), from.getX(), from.getY(), size); case SOUTH: return isTraversableSouth(from.getHeight(), from.getX(), from.getY(), size); case EAST: return isTraversableEast(from.getHeight(), from.getX(), from.getY(), size); case WEST: return isTraversableWest(from.getHeight(), from.getX(), from.getY(), size); case NORTH_EAST: return isTraversableNorthEast(from.getHeight(), from.getX(), from.getY(), size); case NORTH_WEST: return isTraversableNorthWest(from.getHeight(), from.getX(), from.getY(), size); case SOUTH_EAST: return isTraversableSouthEast(from.getHeight(), from.getX(), from.getY(), size); case SOUTH_WEST: return isTraversableSouthWest(from.getHeight(), from.getX(), from.getY(), size); case NONE: return true; default: throw new IllegalArgumentException(STR + direction + STR); } } | /**
* Tests whether or not a specified position is traversable in the specified
* direction.
*
* @param from The position.
* @param direction The direction to traverse.
* @param size The size of the entity attempting to traverse.
* @return <code>true</code> if the direction is traversable otherwise
* <code>false</code>.
*/ | Tests whether or not a specified position is traversable in the specified direction | isTraversable | {
"repo_name": "atomicint/aj8",
"path": "server/src/main/java/org/apollo/game/model/pf/TraversalMap.java",
"license": "isc",
"size": 32236
} | [
"org.apollo.game.model.Direction",
"org.apollo.game.model.Position"
]
| import org.apollo.game.model.Direction; import org.apollo.game.model.Position; | import org.apollo.game.model.*; | [
"org.apollo.game"
]
| org.apollo.game; | 1,667,835 |
@Override
public double evalDouble(ELContext env)
throws ELException
{
if (_test.evalBoolean(env))
return _trueExpr.evalDouble(env);
else
return _falseExpr.evalDouble(env);
} | double function(ELContext env) throws ELException { if (_test.evalBoolean(env)) return _trueExpr.evalDouble(env); else return _falseExpr.evalDouble(env); } | /**
* Evaluate the expression as a double
*
* @param env the variable environment
*
* @return the result as an double
*/ | Evaluate the expression as a double | evalDouble | {
"repo_name": "dwango/quercus",
"path": "src/main/java/com/caucho/el/ConditionalExpr.java",
"license": "gpl-2.0",
"size": 4573
} | [
"javax.el.ELContext",
"javax.el.ELException"
]
| import javax.el.ELContext; import javax.el.ELException; | import javax.el.*; | [
"javax.el"
]
| javax.el; | 515,694 |
@ProcessElement
public void processElement(ProcessContext context) {
String resourceId = context.element();
try {
context.output(fetchResource(this.client, resourceId));
} catch (Exception e) {
failedMessageGets.inc();
LOG.warn(
String.format(
"Error fetching Fhir message with ID %s writing to Dead Letter "
+ "Queue. Cause: %s Stack Trace: %s",
resourceId, e.getMessage(), Throwables.getStackTraceAsString(e)));
context.output(FhirIO.Read.DEAD_LETTER, HealthcareIOError.of(resourceId, e));
}
} | void function(ProcessContext context) { String resourceId = context.element(); try { context.output(fetchResource(this.client, resourceId)); } catch (Exception e) { failedMessageGets.inc(); LOG.warn( String.format( STR + STR, resourceId, e.getMessage(), Throwables.getStackTraceAsString(e))); context.output(FhirIO.Read.DEAD_LETTER, HealthcareIOError.of(resourceId, e)); } } | /**
* Process element.
*
* @param context the context
*/ | Process element | processElement | {
"repo_name": "iemejia/incubator-beam",
"path": "sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java",
"license": "apache-2.0",
"size": 45554
} | [
"org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Throwables"
]
| import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Throwables; | import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.*; | [
"org.apache.beam"
]
| org.apache.beam; | 2,481,416 |
public DataNode setAttenuator_transmission(IDataset attenuator_transmission); | DataNode function(IDataset attenuator_transmission); | /**
* The nominal amount of the beam that gets through
* (transmitted intensity)/(incident intensity)
* <p>
* <b>Type:</b> NX_FLOAT
* <b>Units:</b> NX_DIMENSIONLESS
* </p>
*
* @param attenuator_transmission the attenuator_transmission
*/ | The nominal amount of the beam that gets through (transmitted intensity)/(incident intensity) Type: NX_FLOAT Units: NX_DIMENSIONLESS | setAttenuator_transmission | {
"repo_name": "jamesmudd/dawnsci",
"path": "org.eclipse.dawnsci.nexus/autogen/org/eclipse/dawnsci/nexus/NXattenuator.java",
"license": "epl-1.0",
"size": 8087
} | [
"org.eclipse.dawnsci.analysis.api.tree.DataNode",
"org.eclipse.january.dataset.IDataset"
]
| import org.eclipse.dawnsci.analysis.api.tree.DataNode; import org.eclipse.january.dataset.IDataset; | import org.eclipse.dawnsci.analysis.api.tree.*; import org.eclipse.january.dataset.*; | [
"org.eclipse.dawnsci",
"org.eclipse.january"
]
| org.eclipse.dawnsci; org.eclipse.january; | 689,064 |
public Set<PoolMember> getAllPoolMembers(String poolName); | Set<PoolMember> function(String poolName); | /**
* Return all pool members of the pool 'poolName'
* @param poolName Name of the pool
* @return Set of all the pool members if pool with the name present in the configuration
* null else
*
*/ | Return all pool members of the pool 'poolName' | getAllPoolMembers | {
"repo_name": "Milstein/controllerODP",
"path": "opendaylight/samples/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/IConfigManager.java",
"license": "epl-1.0",
"size": 5786
} | [
"java.util.Set",
"org.opendaylight.controller.samples.loadbalancer.entities.PoolMember"
]
| import java.util.Set; import org.opendaylight.controller.samples.loadbalancer.entities.PoolMember; | import java.util.*; import org.opendaylight.controller.samples.loadbalancer.entities.*; | [
"java.util",
"org.opendaylight.controller"
]
| java.util; org.opendaylight.controller; | 1,260,466 |
public void setNotifyForFields(NotifyForFieldsEnum notifyForFields) {
this.notifyForFields = notifyForFields;
} | void function(NotifyForFieldsEnum notifyForFields) { this.notifyForFields = notifyForFields; } | /**
* Notify for fields, options are ALL, REFERENCED, SELECT, WHERE
*/ | Notify for fields, options are ALL, REFERENCED, SELECT, WHERE | setNotifyForFields | {
"repo_name": "nikvaessen/camel",
"path": "components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpointConfig.java",
"license": "apache-2.0",
"size": 15381
} | [
"org.apache.camel.component.salesforce.internal.dto.NotifyForFieldsEnum"
]
| import org.apache.camel.component.salesforce.internal.dto.NotifyForFieldsEnum; | import org.apache.camel.component.salesforce.internal.dto.*; | [
"org.apache.camel"
]
| org.apache.camel; | 1,309,613 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.