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 GWTTaskInstance getPooledTaskInstance() { return taskInstancePooled; }
GWTTaskInstance function() { return taskInstancePooled; }
/** * The users gets the pooled task instance */
The users gets the pooled task instance
getPooledTaskInstance
{ "repo_name": "papamas/DMS-KANGREG-XI-MANADO", "path": "src/main/java/com/openkm/frontend/client/widget/dashboard/workflow/WorkflowWidget.java", "license": "gpl-3.0", "size": 12715 }
[ "com.openkm.frontend.client.bean.GWTTaskInstance" ]
import com.openkm.frontend.client.bean.GWTTaskInstance;
import com.openkm.frontend.client.bean.*;
[ "com.openkm.frontend" ]
com.openkm.frontend;
2,299,154
protected Element createCell(TableCellElement td) { DivElement cell = DivElement.as(DOM.createDiv()); double width = WidgetUtil .getRequiredWidthBoundingClientRectDouble(td); double height = WidgetUtil .getRequiredHeightBoundingClientRectDouble(td); setBounds(cell, td.getOffsetLeft(), td.getOffsetTop(), width, height); return cell; }
Element function(TableCellElement td) { DivElement cell = DivElement.as(DOM.createDiv()); double width = WidgetUtil .getRequiredWidthBoundingClientRectDouble(td); double height = WidgetUtil .getRequiredHeightBoundingClientRectDouble(td); setBounds(cell, td.getOffsetLeft(), td.getOffsetTop(), width, height); return cell; }
/** * Creates an editor cell corresponding to the given table cell. The * returned element is empty and has the same dimensions and position as * the table cell. * * @param td * the table cell used as a reference * @return an editor cell corresponding to the given cell */
Creates an editor cell corresponding to the given table cell. The returned element is empty and has the same dimensions and position as the table cell
createCell
{ "repo_name": "synes/vaadin", "path": "client/src/com/vaadin/client/widgets/Grid.java", "license": "apache-2.0", "size": 301824 }
[ "com.google.gwt.dom.client.DivElement", "com.google.gwt.dom.client.Element", "com.google.gwt.dom.client.TableCellElement", "com.google.gwt.user.client.DOM", "com.vaadin.client.WidgetUtil" ]
import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.TableCellElement; import com.google.gwt.user.client.DOM; import com.vaadin.client.WidgetUtil;
import com.google.gwt.dom.client.*; import com.google.gwt.user.client.*; import com.vaadin.client.*;
[ "com.google.gwt", "com.vaadin.client" ]
com.google.gwt; com.vaadin.client;
329,679
public void setHistoricoNotaPersistence( HistoricoNotaPersistence historicoNotaPersistence) { this.historicoNotaPersistence = historicoNotaPersistence; }
void function( HistoricoNotaPersistence historicoNotaPersistence) { this.historicoNotaPersistence = historicoNotaPersistence; }
/** * Sets the historico nota persistence. * * @param historicoNotaPersistence the historico nota persistence */
Sets the historico nota persistence
setHistoricoNotaPersistence
{ "repo_name": "RMarinDTI/CloubityRepo", "path": "Servicio-portlet/docroot/WEB-INF/src/es/davinciti/liferay/service/base/CalendarioServiceBaseImpl.java", "license": "unlicense", "size": 52918 }
[ "es.davinciti.liferay.service.persistence.HistoricoNotaPersistence" ]
import es.davinciti.liferay.service.persistence.HistoricoNotaPersistence;
import es.davinciti.liferay.service.persistence.*;
[ "es.davinciti.liferay" ]
es.davinciti.liferay;
2,400,125
protected void scanString(StringBuffer string) throws IOException { char delimiter = this.readChar(); if ((delimiter != '\'') && (delimiter != '"')) { throw this.expectedInput("' or \""); } for (;;) { char ch = this.readChar(); if (ch == delimiter) { return; } else if (ch == '&') { this.resolveEntity(string); } else { string.append(ch); } } }
void function(StringBuffer string) throws IOException { char delimiter = this.readChar(); if ((delimiter != '\'') && (delimiter != 'STR' or \""); } for (;;) { char ch = this.readChar(); if (ch == delimiter) { return; } else if (ch == '&') { this.resolveEntity(string); } else { string.append(ch); } } }
/** * This method scans a delimited string from the current reader. * The scanned string without delimiters is appended to * <code>string</code>. * * </dl><dl><dt><b>Preconditions:</b></dt><dd> * <ul><li><code>string != null</code> * <li>the next char read is the string delimiter * </ul></dd></dl> */
This method scans a delimited string from the current reader. The scanned string without delimiters is appended to <code>string</code>. Preconditions: <code>string != null</code> the next char read is the string delimiter
scanString
{ "repo_name": "TheProjecter/sharedmind", "path": "freemind/main/XMLElement.java", "license": "gpl-2.0", "size": 102420 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,861,059
@Override public float lengthNorm(FieldInvertState state) { final int numTerms; if (discountOverlaps) numTerms = state.getLength() - state.getNumOverlap(); else numTerms = state.getLength(); return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms))); }
float function(FieldInvertState state) { final int numTerms; if (discountOverlaps) numTerms = state.getLength() - state.getNumOverlap(); else numTerms = state.getLength(); return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms))); }
/** Implemented as * <code>state.getBoost()*lengthNorm(numTerms)</code>, where * <code>numTerms</code> is {@link FieldInvertState#getLength()} if {@link * #setDiscountOverlaps} is false, else it's {@link * FieldInvertState#getLength()} - {@link * FieldInvertState#getNumOverlap()}. * * @lucene.experimental */
Implemented as <code>state.getBoost()*lengthNorm(numTerms)</code>, where <code>numTerms</code> is <code>FieldInvertState#getLength()</code> if <code>#setDiscountOverlaps</code> is false, else it's <code>FieldInvertState#getLength()</code> - <code>FieldInvertState#getNumOverlap()</code>
lengthNorm
{ "repo_name": "smartan/lucene", "path": "src/main/java/org/apache/lucene/search/similarities/DefaultSimilarity.java", "license": "apache-2.0", "size": 5992 }
[ "org.apache.lucene.index.FieldInvertState" ]
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.*;
[ "org.apache.lucene" ]
org.apache.lucene;
1,001,449
@Test public void testTranspose() { Dataset ds = DatasetFactory.createRange(DoubleDataset.class, 6); ds.setShape(2,3); Dataset ta = DatasetUtils.transpose(ds, 1, 0); double[][] xa = { { 0., 1., 2. }, { 3., 4., 5. } }; assertEquals(2, ta.getShape().length); assertEquals(3, ta.getShape()[0]); assertEquals(2, ta.getShape()[1]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { assertEquals(xa[i][j], ta.getDouble(j, i), 1e-6); } } ds.set(-2, 1, 2); assertEquals(-2., ds.getDouble(1, 2), 1e-6); assertEquals(5., ta.getDouble(2, 1), 1e-6); ta = ds.getTransposedView(); // test view has changed assertEquals(-2., ta.getDouble(2, 1), 1e-6); // 3D ds = DatasetFactory.createRange(DoubleDataset.class, 24); ds.setShape(2, 3, 4); double[][][] xb = { {{ 0., 1., 2., 3.}, {4., 5., 6., 7.}, {8., 9., 10., 11. }}, {{12., 13., 14., 15.}, {16., 17., 18., 19.}, {20., 21., 22., 23.}} }; Dataset tb; try { tb = DatasetUtils.transpose(ds, 0); } catch (IllegalArgumentException e) { // this is correct. } catch (Exception e) { fail("wrong exception type passed from incorrect arguments being passed to the constructor"); } try { tb = DatasetUtils.transpose(ds, 0, -1, 0); } catch (IllegalArgumentException e) { // this is correct. } catch (Exception e) { fail("wrong exception type passed from incorrect arguments being passed to the constructor"); } try { tb = DatasetUtils.transpose(ds, 0, 1, 1); } catch (IllegalArgumentException e) { // this is correct. } catch (Exception e) { fail("wrong exception type passed from incorrect arguments being passed to the constructor"); } tb = DatasetUtils.transpose(ds, 0, 1, 2); assertEquals(3, tb.getShape().length); assertEquals(2, tb.getShape()[0]); assertEquals(3, tb.getShape()[1]); assertEquals(4, tb.getShape()[2]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { assertEquals(xb[i][j][k], tb.getDouble(i, j, k), 1e-6); } } } tb = DatasetUtils.transpose(ds, 1, 0, 2); assertEquals(3, tb.getShape().length); assertEquals(3, tb.getShape()[0]); assertEquals(2, tb.getShape()[1]); assertEquals(4, tb.getShape()[2]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { assertEquals(xb[i][j][k], tb.getDouble(j, i, k), 1e-6); } } } tb = DatasetUtils.transpose(ds, 2, 0, 1); assertEquals(3, tb.getShape().length); assertEquals(4, tb.getShape()[0]); assertEquals(2, tb.getShape()[1]); assertEquals(3, tb.getShape()[2]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { assertEquals(xb[i][j][k], tb.getDouble(k, i, j), 1e-6); } } } }
void function() { Dataset ds = DatasetFactory.createRange(DoubleDataset.class, 6); ds.setShape(2,3); Dataset ta = DatasetUtils.transpose(ds, 1, 0); double[][] xa = { { 0., 1., 2. }, { 3., 4., 5. } }; assertEquals(2, ta.getShape().length); assertEquals(3, ta.getShape()[0]); assertEquals(2, ta.getShape()[1]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { assertEquals(xa[i][j], ta.getDouble(j, i), 1e-6); } } ds.set(-2, 1, 2); assertEquals(-2., ds.getDouble(1, 2), 1e-6); assertEquals(5., ta.getDouble(2, 1), 1e-6); ta = ds.getTransposedView(); assertEquals(-2., ta.getDouble(2, 1), 1e-6); ds = DatasetFactory.createRange(DoubleDataset.class, 24); ds.setShape(2, 3, 4); double[][][] xb = { {{ 0., 1., 2., 3.}, {4., 5., 6., 7.}, {8., 9., 10., 11. }}, {{12., 13., 14., 15.}, {16., 17., 18., 19.}, {20., 21., 22., 23.}} }; Dataset tb; try { tb = DatasetUtils.transpose(ds, 0); } catch (IllegalArgumentException e) { } catch (Exception e) { fail(STR); } try { tb = DatasetUtils.transpose(ds, 0, -1, 0); } catch (IllegalArgumentException e) { } catch (Exception e) { fail(STR); } try { tb = DatasetUtils.transpose(ds, 0, 1, 1); } catch (IllegalArgumentException e) { } catch (Exception e) { fail(STR); } tb = DatasetUtils.transpose(ds, 0, 1, 2); assertEquals(3, tb.getShape().length); assertEquals(2, tb.getShape()[0]); assertEquals(3, tb.getShape()[1]); assertEquals(4, tb.getShape()[2]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { assertEquals(xb[i][j][k], tb.getDouble(i, j, k), 1e-6); } } } tb = DatasetUtils.transpose(ds, 1, 0, 2); assertEquals(3, tb.getShape().length); assertEquals(3, tb.getShape()[0]); assertEquals(2, tb.getShape()[1]); assertEquals(4, tb.getShape()[2]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { assertEquals(xb[i][j][k], tb.getDouble(j, i, k), 1e-6); } } } tb = DatasetUtils.transpose(ds, 2, 0, 1); assertEquals(3, tb.getShape().length); assertEquals(4, tb.getShape()[0]); assertEquals(2, tb.getShape()[1]); assertEquals(3, tb.getShape()[2]); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 4; k++) { assertEquals(xb[i][j][k], tb.getDouble(k, i, j), 1e-6); } } } }
/** * Tests for transpose method */
Tests for transpose method
testTranspose
{ "repo_name": "yannick-mayeur/january", "path": "org.eclipse.january.test/src/org/eclipse/january/dataset/AbstractDatasetTest.java", "license": "epl-1.0", "size": 77118 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
672,953
@PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE, value = {'/' + OidcConstants.BASE_OIDC_URL + '/' + OidcConstants.INTROSPECTION_URL}) @Override public ResponseEntity<OAuth20IntrospectionAccessTokenResponse> handlePostRequest(final HttpServletRequest request, final HttpServletResponse response) { return super.handlePostRequest(request, response); }
@PostMapping(consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE, value = {'/' + OidcConstants.BASE_OIDC_URL + '/' + OidcConstants.INTROSPECTION_URL}) ResponseEntity<OAuth20IntrospectionAccessTokenResponse> function(final HttpServletRequest request, final HttpServletResponse response) { return super.handlePostRequest(request, response); }
/** * Handle post request. * * @param request the request * @param response the response * @return the response entity */
Handle post request
handlePostRequest
{ "repo_name": "rrenomeron/cas", "path": "support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/web/controllers/introspection/OidcIntrospectionEndpointController.java", "license": "apache-2.0", "size": 2901 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apereo.cas.oidc.OidcConstants", "org.apereo.cas.support.oauth.web.response.introspection.OAuth20IntrospectionAccessTokenResponse", "org.springframework.http.MediaType", "org.springframework.http.ResponseEntity", "org.springframework.web.bind.annotation.PostMapping" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apereo.cas.oidc.OidcConstants; import org.apereo.cas.support.oauth.web.response.introspection.OAuth20IntrospectionAccessTokenResponse; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping;
import javax.servlet.http.*; import org.apereo.cas.oidc.*; import org.apereo.cas.support.oauth.web.response.introspection.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "javax.servlet", "org.apereo.cas", "org.springframework.http", "org.springframework.web" ]
javax.servlet; org.apereo.cas; org.springframework.http; org.springframework.web;
2,893,951
public void save(List<Repository> repositories);
void function(List<Repository> repositories);
/** * The saving mechanism will be triggered after every * {@link RepositoryManager#addRepository(Repository)} call. The implementation should save the * delivered {@link Repository} entries. * * @param repositories * the {@link Repository} entries which should be saved */
The saving mechanism will be triggered after every <code>RepositoryManager#addRepository(Repository)</code> call. The implementation should save the delivered <code>Repository</code> entries
save
{ "repo_name": "transwarpio/rapidminer", "path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/repository/RepositoryProvider.java", "license": "gpl-3.0", "size": 1929 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,683,978
public void waitForTask() { while (true) { try { QueueingConsumer.Delivery delivery = this.consumer .nextDelivery(); BasicProperties props = delivery.getProperties(); BasicProperties replyProps = new BasicProperties.Builder() .correlationId(props.getCorrelationId()).build(); String message = new String(delivery.getBody()); String response = this.doTask(message); this.channel.basicPublish("", props.getReplyTo(), replyProps, response.getBytes()); this.channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } catch (Exception e) { e.printStackTrace(); } } }
void function() { while (true) { try { QueueingConsumer.Delivery delivery = this.consumer .nextDelivery(); BasicProperties props = delivery.getProperties(); BasicProperties replyProps = new BasicProperties.Builder() .correlationId(props.getCorrelationId()).build(); String message = new String(delivery.getBody()); String response = this.doTask(message); this.channel.basicPublish("", props.getReplyTo(), replyProps, response.getBytes()); this.channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } catch (Exception e) { e.printStackTrace(); } } }
/** * Wait for a task to come in. * * @return void */
Wait for a task to come in
waitForTask
{ "repo_name": "suw/cms-integration-prototype", "path": "src/edu/integration/core/AMQPWorker.java", "license": "gpl-3.0", "size": 2683 }
[ "com.rabbitmq.client.AMQP", "com.rabbitmq.client.QueueingConsumer" ]
import com.rabbitmq.client.AMQP; import com.rabbitmq.client.QueueingConsumer;
import com.rabbitmq.client.*;
[ "com.rabbitmq.client" ]
com.rabbitmq.client;
83,213
public static ControllerContainer turnToControllerContainer(final Node node, final NodeFactory nodeFactory, final NodeMerger nodeMerger) { return turnsTo(node, ControllerContainer.class, nodeFactory, nodeMerger); }
static ControllerContainer function(final Node node, final NodeFactory nodeFactory, final NodeMerger nodeMerger) { return turnsTo(node, ControllerContainer.class, nodeFactory, nodeMerger); }
/** * Transforms the given node to an {@link ControllerContainer}. If the node * already implements the {@link ControllerContainer} interface, this method * simply cast it. Otherwise this method use the given node factory and node * merger to create a copy of the given node that implements the * {@link ControllerContainer} interface. * * @param node the node to transform. * @param nodeFactory the {@link NodeFactory} to use. * @param nodeMerger the {@link NodeMerger} to use. * @return either the given node casted as {@link ControllerContainer}, or a * copy of the given node that implements {@link ControllerContainer}. */
Transforms the given node to an <code>ControllerContainer</code>. If the node already implements the <code>ControllerContainer</code> interface, this method simply cast it. Otherwise this method use the given node factory and node merger to create a copy of the given node that implements the <code>ControllerContainer</code> interface
turnToControllerContainer
{ "repo_name": "MIND-Tools/mind-compiler", "path": "adl-frontend/src/main/java/org/ow2/mind/adl/membrane/ast/MembraneASTHelper.java", "license": "gpl-3.0", "size": 7046 }
[ "org.objectweb.fractal.adl.Node", "org.objectweb.fractal.adl.NodeFactory", "org.objectweb.fractal.adl.merger.NodeMerger", "org.ow2.mind.CommonASTHelper" ]
import org.objectweb.fractal.adl.Node; import org.objectweb.fractal.adl.NodeFactory; import org.objectweb.fractal.adl.merger.NodeMerger; import org.ow2.mind.CommonASTHelper;
import org.objectweb.fractal.adl.*; import org.objectweb.fractal.adl.merger.*; import org.ow2.mind.*;
[ "org.objectweb.fractal", "org.ow2.mind" ]
org.objectweb.fractal; org.ow2.mind;
1,741,073
@Override @Transactional public List<IProject> getProjectListByAccessibility(EProjectAccessibility accessibility) throws QuadrigaStorageException { List<ProjectDTO> projectDTOList = projectDao .getAllProjectsDTOByAccessibility(accessibility.name()); List<IProject> projectList = new ArrayList<IProject>(); if (projectDTOList != null) { for (ProjectDTO projectDTO : projectDTOList) { projectList.add(projectShallowMapper .getProjectDetails(projectDTO)); } } return projectList; }
List<IProject> function(EProjectAccessibility accessibility) throws QuadrigaStorageException { List<ProjectDTO> projectDTOList = projectDao .getAllProjectsDTOByAccessibility(accessibility.name()); List<IProject> projectList = new ArrayList<IProject>(); if (projectDTOList != null) { for (ProjectDTO projectDTO : projectDTOList) { projectList.add(projectShallowMapper .getProjectDetails(projectDTO)); } } return projectList; }
/** * This method retrieves the list of projects associated with the * accessibility of the project. It uses the Project shallow mapper to give * a {@link List} of {@link IProject} of domain type {@link ProjectProxy}. * * @param accessibility * - accessibility of the project. * @return List<IProject> - list of projects associated with the * accessibility of the project. * @throws QuadrigaStorageException */
This method retrieves the list of projects associated with the accessibility of the project. It uses the Project shallow mapper to give a <code>List</code> of <code>IProject</code> of domain type <code>ProjectProxy</code>
getProjectListByAccessibility
{ "repo_name": "diging/quadriga", "path": "Quadriga/src/main/java/edu/asu/spring/quadriga/service/workbench/impl/RetrieveProjectManager.java", "license": "gpl-2.0", "size": 16898 }
[ "edu.asu.spring.quadriga.domain.enums.EProjectAccessibility", "edu.asu.spring.quadriga.domain.workbench.IProject", "edu.asu.spring.quadriga.dto.ProjectDTO", "edu.asu.spring.quadriga.exceptions.QuadrigaStorageException", "java.util.ArrayList", "java.util.List" ]
import edu.asu.spring.quadriga.domain.enums.EProjectAccessibility; import edu.asu.spring.quadriga.domain.workbench.IProject; import edu.asu.spring.quadriga.dto.ProjectDTO; import edu.asu.spring.quadriga.exceptions.QuadrigaStorageException; import java.util.ArrayList; import java.util.List;
import edu.asu.spring.quadriga.domain.enums.*; import edu.asu.spring.quadriga.domain.workbench.*; import edu.asu.spring.quadriga.dto.*; import edu.asu.spring.quadriga.exceptions.*; import java.util.*;
[ "edu.asu.spring", "java.util" ]
edu.asu.spring; java.util;
1,635,737
protected void cleanUp() { if (getSource().getDeleteFileOnCompletion()) { for (File file : getSource().getAnnotationFiles()) { file.delete(); } } }
void function() { if (getSource().getDeleteFileOnCompletion()) { for (File file : getSource().getAnnotationFiles()) { file.delete(); } } }
/** * Clean up at the end. */
Clean up at the end
cleanUp
{ "repo_name": "NCIP/caintegrator", "path": "caintegrator-war/src/gov/nih/nci/caintegrator/application/arraydata/AbstractPlatformLoader.java", "license": "bsd-3-clause", "size": 6510 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,634,426
public static InetAddress toInetAddress(String host) { if (host == null || host.length() == 0) { return null; } try { if (host.indexOf("/") > -1) { return InetAddress.getByName(host.substring(host.indexOf("/") + 1)); } else { return InetAddress.getByName(host); } } catch (java.net.UnknownHostException e) { logStackTrace(e); Assert.assertTrue(false, "Failed to get InetAddress: " + host); return null; // will never happen since the Assert will fail } }
static InetAddress function(String host) { if (host == null host.length() == 0) { return null; } try { if (host.indexOf("/") > -1) { return InetAddress.getByName(host.substring(host.indexOf("/") + 1)); } else { return InetAddress.getByName(host); } } catch (java.net.UnknownHostException e) { logStackTrace(e); Assert.assertTrue(false, STR + host); return null; } }
/** * Converts the string host to an instance of InetAddress. Returns null if the string is empty. * Fails Assertion if the conversion would result in <code>java.lang.UnknownHostException</code>. * <p> * Any leading slashes on host will be ignored. * * @param host string version the InetAddress * @return the host converted to InetAddress instance */
Converts the string host to an instance of InetAddress. Returns null if the string is empty. Fails Assertion if the conversion would result in <code>java.lang.UnknownHostException</code>. Any leading slashes on host will be ignored
toInetAddress
{ "repo_name": "deepakddixit/incubator-geode", "path": "geode-core/src/main/java/org/apache/geode/admin/internal/InetAddressUtil.java", "license": "apache-2.0", "size": 6758 }
[ "java.net.InetAddress", "org.apache.geode.internal.Assert" ]
import java.net.InetAddress; import org.apache.geode.internal.Assert;
import java.net.*; import org.apache.geode.internal.*;
[ "java.net", "org.apache.geode" ]
java.net; org.apache.geode;
1,082,346
public Vector3D getU() { return u; }
Vector3D function() { return u; }
/** Get the unit vector along the major axis. * @return unit vector along the major axis */
Get the unit vector along the major axis
getU
{ "repo_name": "ProjectPersephone/Orekit", "path": "src/main/java/org/orekit/bodies/Ellipse.java", "license": "apache-2.0", "size": 13682 }
[ "org.apache.commons.math3.geometry.euclidean.threed.Vector3D" ]
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.geometry.euclidean.threed.*;
[ "org.apache.commons" ]
org.apache.commons;
45,518
@Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageAck info = (MessageAck) o; info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setConsumerId((org.apache.activemq.openwire.commands.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setAckType(dataIn.readByte()); info.setFirstMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setLastMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setMessageCount(dataIn.readInt()); }
void function(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageAck info = (MessageAck) o; info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setTransactionId((org.apache.activemq.openwire.commands.TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setConsumerId((org.apache.activemq.openwire.commands.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setAckType(dataIn.readByte()); info.setFirstMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setLastMessageId((org.apache.activemq.openwire.commands.MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setMessageCount(dataIn.readInt()); }
/** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */
Un-marshal an object instance from the data input stream
looseUnmarshal
{ "repo_name": "apache/activemq-openwire", "path": "openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v1/MessageAckMarshaller.java", "license": "apache-2.0", "size": 6657 }
[ "java.io.DataInput", "java.io.IOException", "org.apache.activemq.openwire.codec.OpenWireFormat", "org.apache.activemq.openwire.commands.MessageAck", "org.apache.activemq.openwire.commands.OpenWireDestination" ]
import java.io.DataInput; import java.io.IOException; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.MessageAck; import org.apache.activemq.openwire.commands.OpenWireDestination;
import java.io.*; import org.apache.activemq.openwire.codec.*; import org.apache.activemq.openwire.commands.*;
[ "java.io", "org.apache.activemq" ]
java.io; org.apache.activemq;
954,855
if (nodeId.equals(NodeIdProtoOuterClass.NodeIdProto.getDefaultInstance())) { return null; } return NodeId.nodeId(nodeId.getNodeId()); } /** * Translates {@link NodeId} to gRPC NodeId message. * * @param nodeId {@link NodeId}
if (nodeId.equals(NodeIdProtoOuterClass.NodeIdProto.getDefaultInstance())) { return null; } return NodeId.nodeId(nodeId.getNodeId()); } /** * Translates {@link NodeId} to gRPC NodeId message. * * @param nodeId {@link NodeId}
/** * Translates gRPC NodeId to {@link NodeId}. * * @param nodeId gRPC message * @return {@link NodeId} */
Translates gRPC NodeId to <code>NodeId</code>
translate
{ "repo_name": "osinstom/onos", "path": "incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/cluster/NodeIdProtoTranslator.java", "license": "apache-2.0", "size": 1901 }
[ "org.onosproject.cluster.NodeId", "org.onosproject.grpc.net.cluster.models.NodeIdProtoOuterClass" ]
import org.onosproject.cluster.NodeId; import org.onosproject.grpc.net.cluster.models.NodeIdProtoOuterClass;
import org.onosproject.cluster.*; import org.onosproject.grpc.net.cluster.models.*;
[ "org.onosproject.cluster", "org.onosproject.grpc" ]
org.onosproject.cluster; org.onosproject.grpc;
1,802,235
private CacheAddResult Local_Add(Object key, CacheEntry cacheEntry, Address src, String taskId, boolean notify, OperationContext operationContext) throws OperationFailedException { CacheAddResult retVal = CacheAddResult.Failure; CacheEntry clone = null; if (taskId != null && cacheEntry.getHasQueryInfo()) { clone = (CacheEntry) cacheEntry.clone(); } else { clone = cacheEntry; } if (_internalCache != null) { Object[] keys = null; try { retVal = _internalCache.Add(key, cacheEntry, notify, operationContext); } catch (Exception e) { throw new OperationFailedException(e); } } if (retVal == CacheAddResult.Success && taskId != null) { AddWriteBehindTask(src, key, clone, taskId, OpCode.Add, operationContext); } return retVal; }
CacheAddResult function(Object key, CacheEntry cacheEntry, Address src, String taskId, boolean notify, OperationContext operationContext) throws OperationFailedException { CacheAddResult retVal = CacheAddResult.Failure; CacheEntry clone = null; if (taskId != null && cacheEntry.getHasQueryInfo()) { clone = (CacheEntry) cacheEntry.clone(); } else { clone = cacheEntry; } if (_internalCache != null) { Object[] keys = null; try { retVal = _internalCache.Add(key, cacheEntry, notify, operationContext); } catch (Exception e) { throw new OperationFailedException(e); } } if (retVal == CacheAddResult.Success && taskId != null) { AddWriteBehindTask(src, key, clone, taskId, OpCode.Add, operationContext); } return retVal; }
/** * Add the object to the local cache. * * @param key key of the entry. * @return cache entry. * * Does an Add locally, however the generated notification is discarded, * since it is specially handled in <see cref="Add"/>. * */
Add the object to the local cache
Local_Add
{ "repo_name": "joseananio/TayzGrid", "path": "src/tgcache/src/com/alachisoft/tayzgrid/caching/topologies/clustered/ReplicatedServerCache.java", "license": "apache-2.0", "size": 207161 }
[ "com.alachisoft.tayzgrid.caching.CacheEntry", "com.alachisoft.tayzgrid.caching.OpCode", "com.alachisoft.tayzgrid.caching.OperationContext", "com.alachisoft.tayzgrid.caching.topologies.CacheAddResult", "com.alachisoft.tayzgrid.common.net.Address", "com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException" ]
import com.alachisoft.tayzgrid.caching.CacheEntry; import com.alachisoft.tayzgrid.caching.OpCode; import com.alachisoft.tayzgrid.caching.OperationContext; import com.alachisoft.tayzgrid.caching.topologies.CacheAddResult; import com.alachisoft.tayzgrid.common.net.Address; import com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException;
import com.alachisoft.tayzgrid.caching.*; import com.alachisoft.tayzgrid.caching.topologies.*; import com.alachisoft.tayzgrid.common.net.*; import com.alachisoft.tayzgrid.runtime.exceptions.*;
[ "com.alachisoft.tayzgrid" ]
com.alachisoft.tayzgrid;
2,830,460
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<LongTermRetentionBackupInner> listByResourceGroupServer( String resourceGroupName, String locationName, String longTermRetentionServerName, Boolean onlyLatestPerDatabase, LongTermRetentionDatabaseState databaseState, Context context);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<LongTermRetentionBackupInner> listByResourceGroupServer( String resourceGroupName, String locationName, String longTermRetentionServerName, Boolean onlyLatestPerDatabase, LongTermRetentionDatabaseState databaseState, Context context);
/** * Lists the long term retention backups for a given server. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value * from the Azure Resource Manager API or the portal. * @param locationName The location of the database. * @param longTermRetentionServerName The name of the server. * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of long term retention backups. */
Lists the long term retention backups for a given server
listByResourceGroupServer
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/fluent/LongTermRetentionBackupsClient.java", "license": "mit", "size": 48333 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.core.util.Context", "com.azure.resourcemanager.sql.fluent.models.LongTermRetentionBackupInner", "com.azure.resourcemanager.sql.models.LongTermRetentionDatabaseState" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.sql.fluent.models.LongTermRetentionBackupInner; import com.azure.resourcemanager.sql.models.LongTermRetentionDatabaseState;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.sql.fluent.models.*; import com.azure.resourcemanager.sql.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,793,054
@Nullable private ScrapEntity.Status getUnderwaterStatus() { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); double d0 = axisalignedbb.maxY + 0.001D; int i = MathHelper.floor(axisalignedbb.minX); int j = MathHelper.ceil(axisalignedbb.maxX); int k = MathHelper.floor(axisalignedbb.maxY); int l = MathHelper.ceil(d0); int i1 = MathHelper.floor(axisalignedbb.minZ); int j1 = MathHelper.ceil(axisalignedbb.maxZ); boolean flag = false; BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); try { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { blockpos$pooledmutableblockpos.setPos(k1, l1, i2); IBlockState iblockstate = this.world.getBlockState(blockpos$pooledmutableblockpos); if (iblockstate.getMaterial() == Material.WATER && d0 < (double) getLiquidHeight(iblockstate, this.world, blockpos$pooledmutableblockpos)) { if (((Integer) iblockstate.getValue(BlockLiquid.LEVEL)).intValue() != 0) { ScrapEntity.Status ScrapEntity$status = ScrapEntity.Status.UNDER_FLOWING_WATER; return ScrapEntity$status; } flag = true; } } } } } finally { blockpos$pooledmutableblockpos.release(); } return flag ? ScrapEntity.Status.UNDER_WATER : null; }
ScrapEntity.Status function() { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); double d0 = axisalignedbb.maxY + 0.001D; int i = MathHelper.floor(axisalignedbb.minX); int j = MathHelper.ceil(axisalignedbb.maxX); int k = MathHelper.floor(axisalignedbb.maxY); int l = MathHelper.ceil(d0); int i1 = MathHelper.floor(axisalignedbb.minZ); int j1 = MathHelper.ceil(axisalignedbb.maxZ); boolean flag = false; BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); try { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { blockpos$pooledmutableblockpos.setPos(k1, l1, i2); IBlockState iblockstate = this.world.getBlockState(blockpos$pooledmutableblockpos); if (iblockstate.getMaterial() == Material.WATER && d0 < (double) getLiquidHeight(iblockstate, this.world, blockpos$pooledmutableblockpos)) { if (((Integer) iblockstate.getValue(BlockLiquid.LEVEL)).intValue() != 0) { ScrapEntity.Status ScrapEntity$status = ScrapEntity.Status.UNDER_FLOWING_WATER; return ScrapEntity$status; } flag = true; } } } } } finally { blockpos$pooledmutableblockpos.release(); } return flag ? ScrapEntity.Status.UNDER_WATER : null; }
/** * Decides whether the Scrap is currently underwater. */
Decides whether the Scrap is currently underwater
getUnderwaterStatus
{ "repo_name": "EPIICTHUNDERCAT/Raft-Mod", "path": "src/main/java/com/epiicthundercat/raft/entity/ScrapEntity.java", "license": "gpl-3.0", "size": 25458 }
[ "net.minecraft.block.BlockLiquid", "net.minecraft.block.material.Material", "net.minecraft.block.state.IBlockState", "net.minecraft.util.math.AxisAlignedBB", "net.minecraft.util.math.BlockPos", "net.minecraft.util.math.MathHelper" ]
import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper;
import net.minecraft.block.*; import net.minecraft.block.material.*; import net.minecraft.block.state.*; import net.minecraft.util.math.*;
[ "net.minecraft.block", "net.minecraft.util" ]
net.minecraft.block; net.minecraft.util;
1,044,384
public void removeSequence(Session session, Sequence sequence) { remove(sequences, sequence); }
void function(Session session, Sequence sequence) { remove(sequences, sequence); }
/** * Remove a sequence from the table. Sequences are used as identity columns. * * @param session the session * @param sequence the sequence to remove */
Remove a sequence from the table. Sequences are used as identity columns
removeSequence
{ "repo_name": "titus08/frostwire-desktop", "path": "lib/jars-src/h2-1.3.164/org/h2/table/Table.java", "license": "gpl-3.0", "size": 32549 }
[ "org.h2.engine.Session", "org.h2.schema.Sequence" ]
import org.h2.engine.Session; import org.h2.schema.Sequence;
import org.h2.engine.*; import org.h2.schema.*;
[ "org.h2.engine", "org.h2.schema" ]
org.h2.engine; org.h2.schema;
491,794
@Override @SimpleProperty // the bitmap routines will crash if the width is set to 0 public void Width(int width) { if ((width > 0) || (width==LENGTH_FILL_PARENT) || (width==LENGTH_PREFERRED) || (width <= LENGTH_PERCENT_TAG)) { super.Width(width); } else { container.$form().dispatchErrorOccurredEvent(this, "Width", ErrorMessages.ERROR_CANVAS_WIDTH_ERROR); } }
void function(int width) { if ((width > 0) (width==LENGTH_FILL_PARENT) (width==LENGTH_PREFERRED) (width <= LENGTH_PERCENT_TAG)) { super.Width(width); } else { container.$form().dispatchErrorOccurredEvent(this, "Width", ErrorMessages.ERROR_CANVAS_WIDTH_ERROR); } }
/** * Set the canvas width * * The width can only be set to >0 or -1 (automatic) or -2 (fill parent) * or to a value less then or equal to LENGTH_PERCENT_TAG (which is later * converted to pixels. * * @param width */
Set the canvas width The width can only be set to >0 or -1 (automatic) or -2 (fill parent) or to a value less then or equal to LENGTH_PERCENT_TAG (which is later converted to pixels
Width
{ "repo_name": "warren922/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/Canvas.java", "license": "apache-2.0", "size": 56953 }
[ "com.google.appinventor.components.runtime.util.ErrorMessages" ]
import com.google.appinventor.components.runtime.util.ErrorMessages;
import com.google.appinventor.components.runtime.util.*;
[ "com.google.appinventor" ]
com.google.appinventor;
1,443,460
public ManagementFragmentMocker mockFragments(Integer... ids) { try { for (Integer id : ids) { if (!fragmentMocker.isMocked(id)) { Fragment fragment = readFragmentFromJSONFile(String.format("management/fragments/%d.json", id)); mockFragment(fragment); } else { fragmentMocker.setStatus(id, MockedResourceStatus.OK); } } } catch (JsonProcessingException e) { fail(e.getMessage()); } return this; }
ManagementFragmentMocker function(Integer... ids) { try { for (Integer id : ids) { if (!fragmentMocker.isMocked(id)) { Fragment fragment = readFragmentFromJSONFile(String.format(STR, id)); mockFragment(fragment); } else { fragmentMocker.setStatus(id, MockedResourceStatus.OK); } } } catch (JsonProcessingException e) { fail(e.getMessage()); } return this; }
/** * Mocks management fragments * * @param ids fragment ids * @return mocker */
Mocks management fragments
mockFragments
{ "repo_name": "Metatavu/kunta-api-server", "path": "src/test/java/fi/metatavu/kuntaapi/test/ManagementFragmentMocker.java", "license": "agpl-3.0", "size": 2896 }
[ "com.fasterxml.jackson.core.JsonProcessingException", "fi.metatavu.management.client.model.Fragment", "org.junit.Assert" ]
import com.fasterxml.jackson.core.JsonProcessingException; import fi.metatavu.management.client.model.Fragment; import org.junit.Assert;
import com.fasterxml.jackson.core.*; import fi.metatavu.management.client.model.*; import org.junit.*;
[ "com.fasterxml.jackson", "fi.metatavu.management", "org.junit" ]
com.fasterxml.jackson; fi.metatavu.management; org.junit;
1,729,660
public ServiceFuture<Void> createSecretAsync(String accountName, String databaseName, String secretName, DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters parameters, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(createSecretWithServiceResponseAsync(accountName, databaseName, secretName, parameters), serviceCallback); }
ServiceFuture<Void> function(String accountName, String databaseName, String secretName, DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters parameters, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(createSecretWithServiceResponseAsync(accountName, databaseName, secretName, parameters), serviceCallback); }
/** * Creates the specified secret for use with external data sources in the specified database. This is deprecated and will be removed in the next release. Please use CreateCredential instead. * * @param accountName The Azure Data Lake Analytics account upon which to execute catalog operations. * @param databaseName The name of the database in which to create the secret. * @param secretName The name of the secret. * @param parameters The parameters required to create the secret (name and password) * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceFuture} object */
Creates the specified secret for use with external data sources in the specified database. This is deprecated and will be removed in the next release. Please use CreateCredential instead
createSecretAsync
{ "repo_name": "anudeepsharma/azure-sdk-for-java", "path": "azure-mgmt-datalake-analytics/src/main/java/com/microsoft/azure/management/datalake/analytics/implementation/CatalogsImpl.java", "license": "mit", "size": 474209 }
[ "com.microsoft.azure.management.datalake.analytics.models.DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters", "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.azure.management.datalake.analytics.models.DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.azure.management.datalake.analytics.models.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
1,914,501
public static void saveProject(File destFolder, Project project) throws IOException { try (FileWriter fWriter = new FileWriter(new File(destFolder, project.getName() + ".ivml"))) { IVMLWriter iWriter = new IVMLWriter(fWriter); project.accept(iWriter); } catch (IOException ioe) { throw ioe; } }
static void function(File destFolder, Project project) throws IOException { try (FileWriter fWriter = new FileWriter(new File(destFolder, project.getName() + ".ivml"))) { IVMLWriter iWriter = new IVMLWriter(fWriter); project.accept(iWriter); } catch (IOException ioe) { throw ioe; } }
/** * Saves the given project to the specified folder. * @param destFolder The folder where the project shall be saved to. * @param project The project to be saved. * @throws IOException if the file exists but is a directory rather than * a regular file, does not exist but cannot be created, * or cannot be opened for any other reason */
Saves the given project to the specified folder
saveProject
{ "repo_name": "SSEHUB/EASyProducer", "path": "Tools/QM_ModelCleanupTool/src/de/uni_hildesheim/sse/easy/ant/modelcopy/ProjectUtilities.java", "license": "apache-2.0", "size": 3407 }
[ "java.io.File", "java.io.FileWriter", "java.io.IOException", "net.ssehub.easy.varModel.model.Project", "net.ssehub.easy.varModel.persistency.IVMLWriter" ]
import java.io.File; import java.io.FileWriter; import java.io.IOException; import net.ssehub.easy.varModel.model.Project; import net.ssehub.easy.varModel.persistency.IVMLWriter;
import java.io.*; import net.ssehub.easy.*;
[ "java.io", "net.ssehub.easy" ]
java.io; net.ssehub.easy;
877,187
private boolean touchSSLSenderConfigFile() { boolean success = false; File file = new File(senderProfilePath); if (file.exists()) { success = file.setLastModified(System.currentTimeMillis()); if (success) { log.info("The Transport Sender will be re-initialized in few minutes."); } else { if (log.isDebugEnabled()) { log.debug("Error when modifying the sslprofiles.xml file"); } log.error("Could not modify the file '" + PROFILE_CONFIG + "'"); } } else { if (log.isDebugEnabled()) { log.debug("sslprofiles.xml file not found."); } log.error("Could not find the file '" + PROFILE_CONFIG + "'"); } return success; }
boolean function() { boolean success = false; File file = new File(senderProfilePath); if (file.exists()) { success = file.setLastModified(System.currentTimeMillis()); if (success) { log.info(STR); } else { if (log.isDebugEnabled()) { log.debug(STR); } log.error(STR + PROFILE_CONFIG + "'"); } } else { if (log.isDebugEnabled()) { log.debug(STR); } log.error(STR + PROFILE_CONFIG + "'"); } return success; }
/** * Modify the sslProfiles.xml file after modifying the certificate. * * @return : True if the file modification is success. */
Modify the sslProfiles.xml file after modifying the certificate
touchSSLSenderConfigFile
{ "repo_name": "Rajith90/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/certificatemgt/CertificateManagerImpl.java", "license": "apache-2.0", "size": 24904 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,164,116
public void toPNML(FileChannel fc){ item.toPNML(fc); }
void function(FileChannel fc){ item.toPNML(fc); }
/** * Writes the PNML XML tree of this object into file channel. */
Writes the PNML XML tree of this object into file channel
toPNML
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/integers/hlapi/PositiveHLAPI.java", "license": "epl-1.0", "size": 18340 }
[ "java.nio.channels.FileChannel" ]
import java.nio.channels.FileChannel;
import java.nio.channels.*;
[ "java.nio" ]
java.nio;
2,484,998
public static String toString(ToXContent toXContent, boolean pretty, boolean human) { try { XContentBuilder builder = createBuilder(pretty, human); if (toXContent.isFragment()) { builder.startObject(); } toXContent.toXContent(builder, ToXContent.EMPTY_PARAMS); if (toXContent.isFragment()) { builder.endObject(); } return toString(builder); } catch (IOException e) { try { XContentBuilder builder = createBuilder(pretty, human); builder.startObject(); builder.field("error", "error building toString out of XContent: " + e.getMessage()); builder.field("stack_trace", ExceptionsHelper.stackTrace(e)); builder.endObject(); return toString(builder); } catch (IOException e2) { throw new ElasticsearchException("cannot generate error message for deserialization", e); } } }
static String function(ToXContent toXContent, boolean pretty, boolean human) { try { XContentBuilder builder = createBuilder(pretty, human); if (toXContent.isFragment()) { builder.startObject(); } toXContent.toXContent(builder, ToXContent.EMPTY_PARAMS); if (toXContent.isFragment()) { builder.endObject(); } return toString(builder); } catch (IOException e) { try { XContentBuilder builder = createBuilder(pretty, human); builder.startObject(); builder.field("error", STR + e.getMessage()); builder.field(STR, ExceptionsHelper.stackTrace(e)); builder.endObject(); return toString(builder); } catch (IOException e2) { throw new ElasticsearchException(STR, e); } } }
/** * Return a {@link String} that is the json representation of the provided {@link ToXContent}. * Wraps the output into an anonymous object if needed. Allows to control whether the outputted * json needs to be pretty printed and human readable. * */
Return a <code>String</code> that is the json representation of the provided <code>ToXContent</code>. Wraps the output into an anonymous object if needed. Allows to control whether the outputted json needs to be pretty printed and human readable
toString
{ "repo_name": "EvilMcJerkface/crate", "path": "server/src/main/java/org/elasticsearch/common/Strings.java", "license": "apache-2.0", "size": 27051 }
[ "java.io.IOException", "org.elasticsearch.ElasticsearchException", "org.elasticsearch.ExceptionsHelper", "org.elasticsearch.common.xcontent.ToXContent", "org.elasticsearch.common.xcontent.XContentBuilder" ]
import java.io.IOException; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.*; import org.elasticsearch.*; import org.elasticsearch.common.xcontent.*;
[ "java.io", "org.elasticsearch", "org.elasticsearch.common" ]
java.io; org.elasticsearch; org.elasticsearch.common;
1,678,062
public static Blog createRandomBlog(boolean allCanRead, boolean allCanWrite, String[] tags, User... members) { return createRandomBlog(allCanRead, allCanWrite, tags, null, members); }
static Blog function(boolean allCanRead, boolean allCanWrite, String[] tags, User... members) { return createRandomBlog(allCanRead, allCanWrite, tags, null, members); }
/** * Create a new topic with random title and alias. * * Warning: The topic creator is kept in the security context. * * @param allCanRead * whether all users should have read access to the blog * @param allCanWrite * whether all users should have write access to the blog * @param tags * List of tags for this blog. * @param members * List of members (write and read access). The first member will be the manager of * the blog. * @return A new blog. */
Create a new topic with random title and alias. Warning: The topic creator is kept in the security context
createRandomBlog
{ "repo_name": "Communote/communote-server", "path": "communote/tests/all-versions/integration/src/main/java/com/communote/server/test/util/TestUtils.java", "license": "apache-2.0", "size": 37663 }
[ "com.communote.server.model.blog.Blog", "com.communote.server.model.user.User" ]
import com.communote.server.model.blog.Blog; import com.communote.server.model.user.User;
import com.communote.server.model.blog.*; import com.communote.server.model.user.*;
[ "com.communote.server" ]
com.communote.server;
2,048,834
public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); }
void function(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); }
/** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This implements <code>org.eclipse.jface.viewers.ISelectionProvider</code>.
addSelectionChangedListener
{ "repo_name": "andydunkel/RCP-Demo-Application", "path": "com.da.editor.model.editor/src/demomodel/presentation/DemomodelEditor.java", "license": "epl-1.0", "size": 53957 }
[ "org.eclipse.jface.viewers.ISelectionChangedListener" ]
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
576,087
public static void closeResultSet(ResultSet rs) { if (null != rs) { try { rs.close(); } catch (SQLException ignore) { } } }
static void function(ResultSet rs) { if (null != rs) { try { rs.close(); } catch (SQLException ignore) { } } }
/** * Cleanup helper method that closes the given <code>ResultSet</code> * while ignoring any errors. */
Cleanup helper method that closes the given <code>ResultSet</code> while ignoring any errors
closeResultSet
{ "repo_name": "AsuraTeam/asura", "path": "asura-quartz/src/main/java/org/quartz/impl/jdbcjobstore/Util.java", "license": "apache-2.0", "size": 5553 }
[ "java.sql.ResultSet", "java.sql.SQLException" ]
import java.sql.ResultSet; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,917,884
public boolean isSpinnerTextSelected(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "isSpinnerTextSelected(\""+text+"\")"); } return checker.isSpinnerTextSelected(text); }
boolean function(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, STRSTR\")"); } return checker.isSpinnerTextSelected(text); }
/** * Checks if the specified text is selected in any Spinner located in the current screen. * * @param text the text that is expected to be selected, specified as a regular expression * @return {@code true} if the specified text is selected in any {@link Spinner} and false if it is not */
Checks if the specified text is selected in any Spinner located in the current screen
isSpinnerTextSelected
{ "repo_name": "darker50/robotium", "path": "robotium-solo/src/main/java/com/robotium/solo/Solo.java", "license": "apache-2.0", "size": 124742 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,972,549
protected synchronized void setupClusterConnection() throws IOException { if (clusterConnection == null) { clusterConnection = createClusterConnection(); metaTableLocator = new MetaTableLocator(); } }
synchronized void function() throws IOException { if (clusterConnection == null) { clusterConnection = createClusterConnection(); metaTableLocator = new MetaTableLocator(); } }
/** * Setup our cluster connection if not already initialized. * @throws IOException */
Setup our cluster connection if not already initialized
setupClusterConnection
{ "repo_name": "gustavoanatoly/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java", "license": "apache-2.0", "size": 143925 }
[ "java.io.IOException", "org.apache.hadoop.hbase.zookeeper.MetaTableLocator" ]
import java.io.IOException; import org.apache.hadoop.hbase.zookeeper.MetaTableLocator;
import java.io.*; import org.apache.hadoop.hbase.zookeeper.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,849,519
private int getHeuristicValue (int node) { return (int) distances.getDistanceBetween(sourceCity.intValue(), node); //return HEURISTICCONSTANT * (instance.getDimension() - level); } public AStar(File instancePath, Integer sourceCity) throws IOException { instance = new TSPInstance(instancePath); distances = instance.getDistanceTable(); this.sourceCity = sourceCity; }
int function (int node) { return (int) distances.getDistanceBetween(sourceCity.intValue(), node); } public AStar(File instancePath, Integer sourceCity) throws IOException { instance = new TSPInstance(instancePath); distances = instance.getDistanceTable(); this.sourceCity = sourceCity; }
/** * Gets the heuristic value for a given depth * The level 0 has the maximum value. */
Gets the heuristic value for a given depth The level 0 has the maximum value
getHeuristicValue
{ "repo_name": "priscylla/tsp-ia", "path": "src/br/ia/tsp/algorithms/star/AStar.java", "license": "mit", "size": 3966 }
[ "java.io.File", "java.io.IOException", "org.moeaframework.problem.tsplib.TSPInstance" ]
import java.io.File; import java.io.IOException; import org.moeaframework.problem.tsplib.TSPInstance;
import java.io.*; import org.moeaframework.problem.tsplib.*;
[ "java.io", "org.moeaframework.problem" ]
java.io; org.moeaframework.problem;
1,134,477
@Override public void exitShift_expression(@NotNull FunctionParser.Shift_expressionContext ctx) { }
@Override public void exitShift_expression(@NotNull FunctionParser.Shift_expressionContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterShift_expression
{ "repo_name": "octopus-platform/joern", "path": "projects/extensions/joern-fuzzyc/src/main/java/antlr/FunctionBaseListener.java", "license": "lgpl-3.0", "size": 42232 }
[ "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;
647,315
ImmutableList<SchemaOrgType> getCourseList();
ImmutableList<SchemaOrgType> getCourseList();
/** * Returns the value list of property course. Empty list is returned if the property not set in * current object. */
Returns the value list of property course. Empty list is returned if the property not set in current object
getCourseList
{ "repo_name": "google/schemaorg-java", "path": "src/main/java/com/google/schemaorg/core/ExerciseAction.java", "license": "apache-2.0", "size": 15102 }
[ "com.google.common.collect.ImmutableList", "com.google.schemaorg.SchemaOrgType" ]
import com.google.common.collect.ImmutableList; import com.google.schemaorg.SchemaOrgType;
import com.google.common.collect.*; import com.google.schemaorg.*;
[ "com.google.common", "com.google.schemaorg" ]
com.google.common; com.google.schemaorg;
157,660
public static List<String> getProjectsDirs() { List<String> ret = new ArrayList<>(); String projectDir = System.getProperty("netbeans.dirs"); if (projectDir == null) { return ret; } String[] split = projectDir.split(";"); if (split == null || split.length == 0) { return ret; } ret.addAll(Arrays.asList(split)); return ret; }
static List<String> function() { List<String> ret = new ArrayList<>(); String projectDir = System.getProperty(STR); if (projectDir == null) { return ret; } String[] split = projectDir.split(";"); if (split == null split.length == 0) { return ret; } ret.addAll(Arrays.asList(split)); return ret; }
/** * Get RCP project dirs * * @return */
Get RCP project dirs
getProjectsDirs
{ "repo_name": "narfindustries/autopsy", "path": "Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java", "license": "apache-2.0", "size": 22779 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.List" ]
import java.util.ArrayList; import java.util.Arrays; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,378,005
@Override public void invoke(Request request, Response response) throws IOException, ServletException { // Perform the request getNext().invoke(request, response); if (request.isComet() && !response.isClosed()) { // Start tracking this connection, since this is a // begin event, and Comet mode is on HttpSession session = request.getSession(true); // Track the connection for webapp reload cometRequests.add(request); // Track the connection for session expiration synchronized (session) { ConnectionList list = (ConnectionList) session.getAttribute( cometRequestsAttribute); Request[] requests = null; if (list != null) { requests = list.get(); } if (requests == null) { requests = new Request[1]; requests[0] = request; session.setAttribute(cometRequestsAttribute, new ConnectionList(requests)); } else { Request[] newRequests = new Request[requests.length + 1]; for (int i = 0; i < requests.length; i++) { newRequests[i] = requests[i]; } newRequests[requests.length] = request; session.setAttribute(cometRequestsAttribute, new ConnectionList(newRequests)); } } } }
void function(Request request, Response response) throws IOException, ServletException { getNext().invoke(request, response); if (request.isComet() && !response.isClosed()) { HttpSession session = request.getSession(true); cometRequests.add(request); synchronized (session) { ConnectionList list = (ConnectionList) session.getAttribute( cometRequestsAttribute); Request[] requests = null; if (list != null) { requests = list.get(); } if (requests == null) { requests = new Request[1]; requests[0] = request; session.setAttribute(cometRequestsAttribute, new ConnectionList(requests)); } else { Request[] newRequests = new Request[requests.length + 1]; for (int i = 0; i < requests.length; i++) { newRequests[i] = requests[i]; } newRequests[requests.length] = request; session.setAttribute(cometRequestsAttribute, new ConnectionList(newRequests)); } } } }
/** * Register requests for tracking, whenever needed. * * @param request The servlet request to be processed * @param response The servlet response to be created * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */
Register requests for tracking, whenever needed
invoke
{ "repo_name": "plumer/codana", "path": "tomcat_files/8.0.22/CometConnectionManagerValve.java", "license": "mit", "size": 13127 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpSession", "org.apache.catalina.connector.Request", "org.apache.catalina.connector.Response" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpSession; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.catalina.connector.*;
[ "java.io", "javax.servlet", "org.apache.catalina" ]
java.io; javax.servlet; org.apache.catalina;
2,454,406
@SuppressWarnings("unchecked") // valid by construction public static <T> Dispatcher<T> getDispatcher(Class<T> baseType, Class<? extends Annotation> marker, Class<?> provider) { try { return (Dispatcher<T>) CACHE.get(Key.create(baseType, marker, provider)); } catch (Exception e) { throw Throwables.propagate(e); } } private Dispatcher(Class<BaseType> baseType, Class<? extends Annotation> marker, Class<?> provider) { this.baseType = baseType; this.dispatchTable = CacheBuilder.newBuilder().build(new IncrementalTableLoader()); initialize(marker, provider); }
@SuppressWarnings(STR) static <T> Dispatcher<T> function(Class<T> baseType, Class<? extends Annotation> marker, Class<?> provider) { try { return (Dispatcher<T>) CACHE.get(Key.create(baseType, marker, provider)); } catch (Exception e) { throw Throwables.propagate(e); } } private Dispatcher(Class<BaseType> baseType, Class<? extends Annotation> marker, Class<?> provider) { this.baseType = baseType; this.dispatchTable = CacheBuilder.newBuilder().build(new IncrementalTableLoader()); initialize(marker, provider); }
/** * Creates a dispatcher which dispatches over methods which are annotated with * {@code marker} and have an instance of {@code BaseType} as their only parameter. * This method will reuse an existing dispatcher from a cache or construct a new one. */
Creates a dispatcher which dispatches over methods which are annotated with marker and have an instance of BaseType as their only parameter. This method will reuse an existing dispatcher from a cache or construct a new one
getDispatcher
{ "repo_name": "googleapis/api-compiler", "path": "src/main/java/com/google/api/tools/framework/util/Dispatcher.java", "license": "apache-2.0", "size": 6532 }
[ "com.google.common.base.Throwables", "com.google.common.cache.CacheBuilder", "java.lang.annotation.Annotation" ]
import com.google.common.base.Throwables; import com.google.common.cache.CacheBuilder; import java.lang.annotation.Annotation;
import com.google.common.base.*; import com.google.common.cache.*; import java.lang.annotation.*;
[ "com.google.common", "java.lang" ]
com.google.common; java.lang;
2,769,482
private static void help() { try { IOUtils.copy(CliUtil.getLocalizedTextResourceReader(RootManagerTool.class, "RootManagerToolHelp.txt"), System.out); } catch (IOException ioe) { throw new RuntimeException(ioe); } }
static void function() { try { IOUtils.copy(CliUtil.getLocalizedTextResourceReader(RootManagerTool.class, STR), System.out); } catch (IOException ioe) { throw new RuntimeException(ioe); } }
/** * Displays help information. */
Displays help information
help
{ "repo_name": "azyva/dragom-cli-tools", "path": "dragom-cli-tools/src/main/java/org/azyva/dragom/tool/RootManagerTool.java", "license": "agpl-3.0", "size": 32021 }
[ "java.io.IOException", "org.apache.commons.io.IOUtils", "org.azyva.dragom.cliutil.CliUtil" ]
import java.io.IOException; import org.apache.commons.io.IOUtils; import org.azyva.dragom.cliutil.CliUtil;
import java.io.*; import org.apache.commons.io.*; import org.azyva.dragom.cliutil.*;
[ "java.io", "org.apache.commons", "org.azyva.dragom" ]
java.io; org.apache.commons; org.azyva.dragom;
1,849,015
RestResult result = RestResultFactory.getJsonRestResult(); SynchronisationConnection connection = synchronisationConnectionRepository.findByEntityAddress(entityAddress); if (connection != null) { result.setCode(HttpResponseCodes.SC_OK); result.setBody(createJsonText(new SynchronisationConnectionDto(connection.getId(), connection.getEntityAddress(), connection.isCustomer(), DateTimeUtil.printDateTime(connection.getLastModificationTime(),JSON_DATE_TIME_FORMAT)))); } else { result.setCode(HttpResponseCodes.SC_NOT_FOUND); result.getErrors().add("SynchronisationConnection " + entityAddress + " not found."); } return result; }
RestResult result = RestResultFactory.getJsonRestResult(); SynchronisationConnection connection = synchronisationConnectionRepository.findByEntityAddress(entityAddress); if (connection != null) { result.setCode(HttpResponseCodes.SC_OK); result.setBody(createJsonText(new SynchronisationConnectionDto(connection.getId(), connection.getEntityAddress(), connection.isCustomer(), DateTimeUtil.printDateTime(connection.getLastModificationTime(),JSON_DATE_TIME_FORMAT)))); } else { result.setCode(HttpResponseCodes.SC_NOT_FOUND); result.getErrors().add(STR + entityAddress + STR); } return result; }
/** * Try and retrieve a {@link SynchronisationConnection} with the given entityAddress, returning it in a {@Link RestResult}. * * @param entityAddress a {@link String} containing a entit addressof the {@link SynchronisationConnection} to be retrieved. * @return a {@Link RestResult} */
Try and retrieve a <code>SynchronisationConnection</code> with the given entityAddress, returning it in a RestResult
findSynchronisationConnection
{ "repo_name": "USEF-Foundation/ri.usef.energy", "path": "usef-build/usef-workflow/usef-agr/src/main/java/energy/usef/agr/service/business/AggregatorTopologyBusinessService.java", "license": "apache-2.0", "size": 18044 }
[ "energy.usef.agr.dto.SynchronisationConnectionDto", "energy.usef.agr.model.SynchronisationConnection", "energy.usef.core.rest.RestResult", "energy.usef.core.rest.RestResultFactory", "energy.usef.core.util.DateTimeUtil", "org.jboss.resteasy.util.HttpResponseCodes" ]
import energy.usef.agr.dto.SynchronisationConnectionDto; import energy.usef.agr.model.SynchronisationConnection; import energy.usef.core.rest.RestResult; import energy.usef.core.rest.RestResultFactory; import energy.usef.core.util.DateTimeUtil; import org.jboss.resteasy.util.HttpResponseCodes;
import energy.usef.agr.dto.*; import energy.usef.agr.model.*; import energy.usef.core.rest.*; import energy.usef.core.util.*; import org.jboss.resteasy.util.*;
[ "energy.usef.agr", "energy.usef.core", "org.jboss.resteasy" ]
energy.usef.agr; energy.usef.core; org.jboss.resteasy;
2,314,548
public double getStandardDeviation() { double stdDev = Double.NaN; if (getN() > 0) { if (getN() > 1) { stdDev = FastMath.sqrt(getVariance()); } else { stdDev = 0.0; } } return stdDev; }
double function() { double stdDev = Double.NaN; if (getN() > 0) { if (getN() > 1) { stdDev = FastMath.sqrt(getVariance()); } else { stdDev = 0.0; } } return stdDev; }
/** * Returns the standard deviation of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the standard deviation */
Returns the standard deviation of the values that have been added. Double.NaN is returned if no values have been added.
getStandardDeviation
{ "repo_name": "apetro/uPortal", "path": "uportal-war/src/main/java/org/apereo/portal/events/aggr/stat/JpaStatisticalSummary.java", "license": "apache-2.0", "size": 11871 }
[ "org.apache.commons.math3.util.FastMath" ]
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.*;
[ "org.apache.commons" ]
org.apache.commons;
1,501,448
@Test public void testGetSubmittedEntity() { BillingInformationForm form = new BillingInformationForm(); CRUDFormTestHelper.setNotes(form); form.setStatus(BillingInformationStatus.DEFAULT.name()); form.setTypeId(1L); BillingInformation entity = form.getSubmittedEntity(); assertNotNull("No submitted Entity", entity); CRUDFormTestHelper.assertNotes(entity); assertEquals("Wrong status in the entity", BillingInformationStatus.DEFAULT, entity.getStatus()); CRUDFormAssert.assertEntity(Type.class, entity.getType(), 1L); }
void function() { BillingInformationForm form = new BillingInformationForm(); CRUDFormTestHelper.setNotes(form); form.setStatus(BillingInformationStatus.DEFAULT.name()); form.setTypeId(1L); BillingInformation entity = form.getSubmittedEntity(); assertNotNull(STR, entity); CRUDFormTestHelper.assertNotes(entity); assertEquals(STR, BillingInformationStatus.DEFAULT, entity.getStatus()); CRUDFormAssert.assertEntity(Type.class, entity.getType(), 1L); }
/** * Test the controller getSubmittedEntity method. */
Test the controller getSubmittedEntity method
testGetSubmittedEntity
{ "repo_name": "NCIP/calims", "path": "calims2-webapp/test/unit/java/gov/nih/nci/calims2/ui/administration/customerservice/billinginformation/BillingInformationFormTest.java", "license": "bsd-3-clause", "size": 1438 }
[ "gov.nih.nci.calims2.domain.administration.customerservice.BillingInformation", "gov.nih.nci.calims2.domain.administration.customerservice.enumeration.BillingInformationStatus", "gov.nih.nci.calims2.domain.common.Type", "gov.nih.nci.calims2.ui.generic.crud.CRUDFormAssert", "gov.nih.nci.calims2.ui.generic.crud.CRUDFormTestHelper", "org.junit.Assert" ]
import gov.nih.nci.calims2.domain.administration.customerservice.BillingInformation; import gov.nih.nci.calims2.domain.administration.customerservice.enumeration.BillingInformationStatus; import gov.nih.nci.calims2.domain.common.Type; import gov.nih.nci.calims2.ui.generic.crud.CRUDFormAssert; import gov.nih.nci.calims2.ui.generic.crud.CRUDFormTestHelper; import org.junit.Assert;
import gov.nih.nci.calims2.domain.administration.customerservice.*; import gov.nih.nci.calims2.domain.administration.customerservice.enumeration.*; import gov.nih.nci.calims2.domain.common.*; import gov.nih.nci.calims2.ui.generic.crud.*; import org.junit.*;
[ "gov.nih.nci", "org.junit" ]
gov.nih.nci; org.junit;
204,964
boolean setFailure(HttpResponse response, Throwable cause);
boolean setFailure(HttpResponse response, Throwable cause);
/** * Same as {@link #setFailure(Throwable)}, except it also records the state of the received response. * <p/> * This variant is useful to distinguish between errors executing the request itself or errors ocurred during * response parsing. * * @param response The {@link HttpResponse} received before the error. * @param cause The cause of the failure. * * @return {@code true} if and only if successfully marked this future as a failure. Otherwise {@code false} because * this future is already marked as either a success or a failure. */
Same as <code>#setFailure(Throwable)</code>, except it also records the state of the received response. This variant is useful to distinguish between errors executing the request itself or errors ocurred during response parsing
setFailure
{ "repo_name": "jasondevj/hotpotato", "path": "src/main/java/com/biasedbit/hotpotato/request/HttpRequestFuture.java", "license": "apache-2.0", "size": 12208 }
[ "org.jboss.netty.handler.codec.http.HttpResponse" ]
import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.*;
[ "org.jboss.netty" ]
org.jboss.netty;
179,824
public static void init(Context context) { if (cameraManager == null) { cameraManager = new CameraManager(context); } }
static void function(Context context) { if (cameraManager == null) { cameraManager = new CameraManager(context); } }
/** * Initializes this static object with the Context of the calling Activity. * * @param context The Activity which wants to use the camera. */
Initializes this static object with the Context of the calling Activity
init
{ "repo_name": "newpasung/coordinator", "path": "app/src/main/java/com/scut/gof/coordinator/qcode/zxing/camera/CameraManager.java", "license": "apache-2.0", "size": 13515 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
74,635
protected void processAnnotation(PDAnnotation annotation, PDAppearanceStream appearance) throws IOException { PDResources parent = pushResources(appearance); Stack<PDGraphicsState> savedStack = saveGraphicsStack(); PDRectangle bbox = appearance.getBBox(); PDRectangle rect = annotation.getRectangle(); Matrix matrix = appearance.getMatrix(); // zero-sized rectangles are not valid if (rect != null && rect.getWidth() > 0 && rect.getHeight() > 0 && bbox != null) { // transformed appearance box fixme: may be an arbitrary shape Rectangle2D transformedBox = bbox.transform(matrix).getBounds2D(); // compute a matrix which scales and translates the transformed appearance box to align // with the edges of the annotation's rectangle Matrix a = Matrix.getTranslateInstance(rect.getLowerLeftX(), rect.getLowerLeftY()); a.concatenate(Matrix.getScaleInstance((float) (rect.getWidth() / transformedBox.getWidth()), (float) (rect.getHeight() / transformedBox.getHeight()))); a.concatenate(Matrix.getTranslateInstance((float) -transformedBox.getX(), (float) -transformedBox.getY())); // Matrix shall be concatenated with A to form a matrix AA that maps from the appearance's // coordinate system to the annotation's rectangle in default user space // // HOWEVER only the opposite order works for rotated pages with // filled fields / annotations that have a matrix in the appearance stream, see PDFBOX-3083 Matrix aa = Matrix.concatenate(a, matrix); // make matrix AA the CTM getGraphicsState().setCurrentTransformationMatrix(aa); // clip to bounding box clipToRect(bbox); // needed for patterns in appearance streams, e.g. PDFBOX-2182 initialMatrix = aa.clone(); processStreamOperators(appearance); } restoreGraphicsStack(savedStack); popResources(parent); }
void function(PDAnnotation annotation, PDAppearanceStream appearance) throws IOException { PDResources parent = pushResources(appearance); Stack<PDGraphicsState> savedStack = saveGraphicsStack(); PDRectangle bbox = appearance.getBBox(); PDRectangle rect = annotation.getRectangle(); Matrix matrix = appearance.getMatrix(); if (rect != null && rect.getWidth() > 0 && rect.getHeight() > 0 && bbox != null) { Rectangle2D transformedBox = bbox.transform(matrix).getBounds2D(); Matrix a = Matrix.getTranslateInstance(rect.getLowerLeftX(), rect.getLowerLeftY()); a.concatenate(Matrix.getScaleInstance((float) (rect.getWidth() / transformedBox.getWidth()), (float) (rect.getHeight() / transformedBox.getHeight()))); a.concatenate(Matrix.getTranslateInstance((float) -transformedBox.getX(), (float) -transformedBox.getY())); Matrix aa = Matrix.concatenate(a, matrix); getGraphicsState().setCurrentTransformationMatrix(aa); clipToRect(bbox); initialMatrix = aa.clone(); processStreamOperators(appearance); } restoreGraphicsStack(savedStack); popResources(parent); }
/** * Process the given annotation with the specified appearance stream. * * @param annotation The annotation containing the appearance stream to process. * @param appearance The appearance stream to process. * @throws IOException If there is an error reading or parsing the appearance content stream. */
Process the given annotation with the specified appearance stream
processAnnotation
{ "repo_name": "gavanx/pdflearn", "path": "pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java", "license": "apache-2.0", "size": 32281 }
[ "java.awt.geom.Rectangle2D", "java.io.IOException", "java.util.Stack", "org.apache.pdfbox.pdmodel.PDResources", "org.apache.pdfbox.pdmodel.common.PDRectangle", "org.apache.pdfbox.pdmodel.graphics.state.PDGraphicsState", "org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation", "org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream", "org.apache.pdfbox.util.Matrix" ]
import java.awt.geom.Rectangle2D; import java.io.IOException; import java.util.Stack; import org.apache.pdfbox.pdmodel.PDResources; import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.graphics.state.PDGraphicsState; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream; import org.apache.pdfbox.util.Matrix;
import java.awt.geom.*; import java.io.*; import java.util.*; import org.apache.pdfbox.pdmodel.*; import org.apache.pdfbox.pdmodel.common.*; import org.apache.pdfbox.pdmodel.graphics.state.*; import org.apache.pdfbox.pdmodel.interactive.annotation.*; import org.apache.pdfbox.util.*;
[ "java.awt", "java.io", "java.util", "org.apache.pdfbox" ]
java.awt; java.io; java.util; org.apache.pdfbox;
1,436,924
@Override public T visitAnnotation(@NotNull ScalaParser.AnnotationContext ctx) { return visitChildren(ctx); }
@Override public T visitAnnotation(@NotNull ScalaParser.AnnotationContext ctx) { return visitChildren(ctx); }
/** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */
The default implementation returns the result of calling <code>#visitChildren</code> on ctx
visitCaseClauses
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/ScalaBaseVisitor.java", "license": "gpl-3.0", "size": 26845 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,020,797
private void ensureAccount(@Nullable Account intendedAccount) { if (intendedAccount == null) { return; } InvalidationPreferences invPrefs = new InvalidationPreferences(this); if (!intendedAccount.equals(invPrefs.getSavedSyncedAccount())) { if (sIsClientStarted) { stopClient(); } setAccount(intendedAccount); } }
void function(@Nullable Account intendedAccount) { if (intendedAccount == null) { return; } InvalidationPreferences invPrefs = new InvalidationPreferences(this); if (!intendedAccount.equals(invPrefs.getSavedSyncedAccount())) { if (sIsClientStarted) { stopClient(); } setAccount(intendedAccount); } }
/** * If {@code intendedAccount} is non-{@null} and differs from the account stored in preferences, * then stops the existing client (if any) and updates the stored account. */
If intendedAccount is non- and differs from the account stored in preferences, then stops the existing client (if any) and updates the stored account
ensureAccount
{ "repo_name": "CapOM/ChromiumGStreamerBackend", "path": "components/invalidation/impl/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java", "license": "bsd-3-clause", "size": 20842 }
[ "android.accounts.Account", "javax.annotation.Nullable", "org.chromium.sync.notifier.InvalidationPreferences" ]
import android.accounts.Account; import javax.annotation.Nullable; import org.chromium.sync.notifier.InvalidationPreferences;
import android.accounts.*; import javax.annotation.*; import org.chromium.sync.notifier.*;
[ "android.accounts", "javax.annotation", "org.chromium.sync" ]
android.accounts; javax.annotation; org.chromium.sync;
1,710,036
public static <T> List<T> getVector(final Object o, final Class<T> clazz) { final List<T> list = new Vector<>(); list(list, o, clazz); return list; }
static <T> List<T> function(final Object o, final Class<T> clazz) { final List<T> list = new Vector<>(); list(list, o, clazz); return list; }
/** * Cast an object into a typed {@link Vector}. * * @param o * The input object * @param clazz * The output class * @return The casted object * @param <T> * The type of the output */
Cast an object into a typed <code>Vector</code>
getVector
{ "repo_name": "Gilandel/utils-commons", "path": "src/main/java/fr/landel/utils/commons/CastUtils.java", "license": "apache-2.0", "size": 25658 }
[ "java.util.List", "java.util.Vector" ]
import java.util.List; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
807,730
public static DecomposableMatchBuilder1<Double, Double> caseDouble(MatchesAny d) { List<Matcher<Object>> matchers = new ArrayList<>(); matchers.add(any()); return new DecomposableMatchBuilder1<>( matchers, 0, new PrimitiveFieldExtractor<>(Double.class)); }
static DecomposableMatchBuilder1<Double, Double> function(MatchesAny d) { List<Matcher<Object>> matchers = new ArrayList<>(); matchers.add(any()); return new DecomposableMatchBuilder1<>( matchers, 0, new PrimitiveFieldExtractor<>(Double.class)); }
/** * Matches a double. * * <p>If matched, the double value is extracted. */
Matches a double. If matched, the double value is extracted
caseDouble
{ "repo_name": "johnlcox/motif", "path": "motif/src/main/java/com/leacox/motif/cases/PrimitiveCases.java", "license": "apache-2.0", "size": 7222 }
[ "com.leacox.motif.MatchesAny", "com.leacox.motif.extract.DecomposableMatchBuilder1", "com.leacox.motif.extract.matchers.Matcher", "java.util.ArrayList", "java.util.List" ]
import com.leacox.motif.MatchesAny; import com.leacox.motif.extract.DecomposableMatchBuilder1; import com.leacox.motif.extract.matchers.Matcher; import java.util.ArrayList; import java.util.List;
import com.leacox.motif.*; import com.leacox.motif.extract.*; import com.leacox.motif.extract.matchers.*; import java.util.*;
[ "com.leacox.motif", "java.util" ]
com.leacox.motif; java.util;
810,465
@InterfaceAudience.Private public Attachment getAttachmentForSequence(long sequence, String filename) throws CouchbaseLiteException { assert(sequence > 0); assert(filename != null); Cursor cursor = null; String[] args = { Long.toString(sequence), filename }; try { cursor = database.rawQuery("SELECT key, type FROM attachments WHERE sequence=? AND filename=?", args); if(!cursor.moveToNext()) { throw new CouchbaseLiteException(Status.NOT_FOUND); } byte[] keyData = cursor.getBlob(0); //TODO add checks on key here? (ios version) BlobKey key = new BlobKey(keyData); InputStream contentStream = attachments.blobStreamForKey(key); if(contentStream == null) { Log.e(Database.TAG, "Failed to load attachment"); throw new CouchbaseLiteException(Status.INTERNAL_SERVER_ERROR); } else { Attachment result = new Attachment(contentStream, cursor.getString(1)); result.setGZipped(attachments.isGZipped(key)); return result; } } catch (SQLException e) { throw new CouchbaseLiteException(Status.INTERNAL_SERVER_ERROR); } finally { if(cursor != null) { cursor.close(); } } }
@InterfaceAudience.Private Attachment function(long sequence, String filename) throws CouchbaseLiteException { assert(sequence > 0); assert(filename != null); Cursor cursor = null; String[] args = { Long.toString(sequence), filename }; try { cursor = database.rawQuery(STR, args); if(!cursor.moveToNext()) { throw new CouchbaseLiteException(Status.NOT_FOUND); } byte[] keyData = cursor.getBlob(0); BlobKey key = new BlobKey(keyData); InputStream contentStream = attachments.blobStreamForKey(key); if(contentStream == null) { Log.e(Database.TAG, STR); throw new CouchbaseLiteException(Status.INTERNAL_SERVER_ERROR); } else { Attachment result = new Attachment(contentStream, cursor.getString(1)); result.setGZipped(attachments.isGZipped(key)); return result; } } catch (SQLException e) { throw new CouchbaseLiteException(Status.INTERNAL_SERVER_ERROR); } finally { if(cursor != null) { cursor.close(); } } }
/** * Returns the content and MIME type of an attachment * @exclude */
Returns the content and MIME type of an attachment
getAttachmentForSequence
{ "repo_name": "netsense-sas/couchbase-lite-java-core", "path": "src/main/java/com/couchbase/lite/Database.java", "license": "apache-2.0", "size": 203426 }
[ "com.couchbase.lite.internal.InterfaceAudience", "com.couchbase.lite.storage.Cursor", "com.couchbase.lite.storage.SQLException", "com.couchbase.lite.util.Log", "java.io.InputStream" ]
import com.couchbase.lite.internal.InterfaceAudience; import com.couchbase.lite.storage.Cursor; import com.couchbase.lite.storage.SQLException; import com.couchbase.lite.util.Log; import java.io.InputStream;
import com.couchbase.lite.internal.*; import com.couchbase.lite.storage.*; import com.couchbase.lite.util.*; import java.io.*;
[ "com.couchbase.lite", "java.io" ]
com.couchbase.lite; java.io;
507,531
private Properties fetchInfo(final String[] attrIDs, final String username, final String password) throws NamingException { // set initial context logger.debug("setting InitialDirContext..."); final Properties props; DirContext ctx = null; try { if (piercePrivacy) { // TODO: Pool here ctx = (DirContext)ldapConnections.borrowObject(); //ctx = new InitialDirContext(env); } else { ctx = new InitialDirContext(getEnv(username, password)); } logger.info("fetchInfo for user: " + username); props = new Properties(); // specify attributes to match final Attributes matchAttrs = new BasicAttributes(true); matchAttrs.put(new BasicAttribute("uid", username)); final NamingEnumeration answer = ctx.search("ou=people", matchAttrs, attrIDs); // cycle through results while (answer.hasMore()) { final SearchResult sr = (SearchResult)answer.next(); logger.debug("Search results for: " + sr.getName()); // print out all attributes final Attributes attributes = sr.getAttributes(); final NamingEnumeration ne = attributes.getAll(); // cycle through attributes of this search result while (ne.hasMore()) { final Attribute at = (Attribute)ne.next(); props.setProperty(at.getID(), at.get().toString()); logger.debug("attr. ID: " + at.getID() + ", value: " + at.get()); } logger.info("LDAP Lookup for " + username + " containes: " + props); ne.close(); } answer.close(); } catch (Exception e) { try { ldapConnections.invalidateObject(ctx); } catch (Exception e1) { e1.printStackTrace(); } throw new RuntimeException(e); // TODO: Remove me? } finally { if (piercePrivacy) { try { ldapConnections.returnObject(ctx); } catch (Exception e) { throw new RuntimeException(e); } } else { if (ctx != null) { ctx.close(); } } } return props; } private class LdapConnectionFactory extends BasePoolableObjectFactory { private final Hashtable env; final Attributes matchAttrs; public LdapConnectionFactory(Hashtable env) { this.env = env; matchAttrs = new BasicAttributes(true); matchAttrs.put(new BasicAttribute("uid", "alberta")); }
Properties function(final String[] attrIDs, final String username, final String password) throws NamingException { logger.debug(STR); final Properties props; DirContext ctx = null; try { if (piercePrivacy) { ctx = (DirContext)ldapConnections.borrowObject(); } else { ctx = new InitialDirContext(getEnv(username, password)); } logger.info(STR + username); props = new Properties(); final Attributes matchAttrs = new BasicAttributes(true); matchAttrs.put(new BasicAttribute("uid", username)); final NamingEnumeration answer = ctx.search(STR, matchAttrs, attrIDs); while (answer.hasMore()) { final SearchResult sr = (SearchResult)answer.next(); logger.debug(STR + sr.getName()); final Attributes attributes = sr.getAttributes(); final NamingEnumeration ne = attributes.getAll(); while (ne.hasMore()) { final Attribute at = (Attribute)ne.next(); props.setProperty(at.getID(), at.get().toString()); logger.debug(STR + at.getID() + STR + at.get()); } logger.info(STR + username + STR + props); ne.close(); } answer.close(); } catch (Exception e) { try { ldapConnections.invalidateObject(ctx); } catch (Exception e1) { e1.printStackTrace(); } throw new RuntimeException(e); } finally { if (piercePrivacy) { try { ldapConnections.returnObject(ctx); } catch (Exception e) { throw new RuntimeException(e); } } else { if (ctx != null) { ctx.close(); } } } return props; } private class LdapConnectionFactory extends BasePoolableObjectFactory { private final Hashtable env; final Attributes matchAttrs; public LdapConnectionFactory(Hashtable env) { this.env = env; matchAttrs = new BasicAttributes(true); matchAttrs.put(new BasicAttribute("uid", STR)); }
/** * Returns a user's information. If piercePrivacy is false, the method will bind * to LDAP as this user. If piercePrivacy is true, it will bind as the configured * privacy-piercing user, and the password parameter is ignored. * * @param attrIDs attribute(s) to return * @param username the mail id of the user * @param password the LDAP password of the user. Ignored if piercePrivacy is true. * @return a Properties of the found values */
Returns a user's information. If piercePrivacy is false, the method will bind to LDAP as this user. If piercePrivacy is true, it will bind as the configured privacy-piercing user, and the password parameter is ignored
fetchInfo
{ "repo_name": "ankon/gatormail", "path": "src/main/java/edu/ufl/osg/webmail/data/UserInfoDAO_LDAP.java", "license": "gpl-2.0", "size": 13680 }
[ "java.util.Hashtable", "java.util.Properties", "javax.naming.NamingEnumeration", "javax.naming.NamingException", "javax.naming.directory.Attribute", "javax.naming.directory.Attributes", "javax.naming.directory.BasicAttribute", "javax.naming.directory.BasicAttributes", "javax.naming.directory.DirContext", "javax.naming.directory.InitialDirContext", "javax.naming.directory.SearchResult", "org.apache.commons.pool.BasePoolableObjectFactory" ]
import java.util.Hashtable; import java.util.Properties; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.BasicAttribute; import javax.naming.directory.BasicAttributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchResult; import org.apache.commons.pool.BasePoolableObjectFactory;
import java.util.*; import javax.naming.*; import javax.naming.directory.*; import org.apache.commons.pool.*;
[ "java.util", "javax.naming", "org.apache.commons" ]
java.util; javax.naming; org.apache.commons;
81,055
@SuppressWarnings("unchecked") public static <T> T[] changeArrayType(Object[] array, Class<T> newClass) { ArrayList<T> newArray = new ArrayList<T>(); for (int i = 0; i < array.length; i++) { // Only add those objects that can be cast to the new class if (newClass.isInstance(array[i])) { newArray.add(newClass.cast(array[i])); } } return newArray.toArray((T[]) Array.newInstance(newClass, 0)); }
@SuppressWarnings(STR) static <T> T[] function(Object[] array, Class<T> newClass) { ArrayList<T> newArray = new ArrayList<T>(); for (int i = 0; i < array.length; i++) { if (newClass.isInstance(array[i])) { newArray.add(newClass.cast(array[i])); } } return newArray.toArray((T[]) Array.newInstance(newClass, 0)); }
/** * Change the type of array of Objects to an array of objects of type * newClass. * */
Change the type of array of Objects to an array of objects of type newClass
changeArrayType
{ "repo_name": "berlinguyinca/mzmine-fork", "path": "src/main/java/net/sf/mzmine/util/CollectionUtils.java", "license": "gpl-2.0", "size": 4049 }
[ "java.lang.reflect.Array", "java.util.ArrayList" ]
import java.lang.reflect.Array; import java.util.ArrayList;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,743,564
public static synchronized void dumpTraceMemory() { LogRepositoryWriter writer = getBinaryHandler().getTraceWriter(); if (writer instanceof LogRepositoryWriterCBuffImpl) { ((LogRepositoryWriterCBuffImpl) writer).dumpItems(); } }
static synchronized void function() { LogRepositoryWriter writer = getBinaryHandler().getTraceWriter(); if (writer instanceof LogRepositoryWriterCBuffImpl) { ((LogRepositoryWriterCBuffImpl) writer).dumpItems(); } }
/** * Dumps trace records stored in the memory buffer to disk. This action * happens only if trace destination was set to memory. */
Dumps trace records stored in the memory buffer to disk. This action happens only if trace destination was set to memory
dumpTraceMemory
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/handlers/LogRepositoryComponent.java", "license": "epl-1.0", "size": 27479 }
[ "com.ibm.ws.logging.hpel.LogRepositoryWriter", "com.ibm.ws.logging.hpel.impl.LogRepositoryWriterCBuffImpl" ]
import com.ibm.ws.logging.hpel.LogRepositoryWriter; import com.ibm.ws.logging.hpel.impl.LogRepositoryWriterCBuffImpl;
import com.ibm.ws.logging.hpel.*; import com.ibm.ws.logging.hpel.impl.*;
[ "com.ibm.ws" ]
com.ibm.ws;
2,613,395
@Test public void testEscapeNodeExample03() throws Exception { assertEquals(JID.escapeNode("at&t guy"), "at\\26t\\20guy"); }
void function() throws Exception { assertEquals(JID.escapeNode(STR), STR); }
/** * Verifies correct behavior of 'JID node escaping' by escaping the node of * the third JID presented in table 3 of XEP-0106 and comparing the result * with the expected value presented in that table. */
Verifies correct behavior of 'JID node escaping' by escaping the node of the third JID presented in table 3 of XEP-0106 and comparing the result with the expected value presented in that table
testEscapeNodeExample03
{ "repo_name": "xose/tinder", "path": "src/test/java/org/xmpp/packet/JIDNodeEscapingTest.java", "license": "apache-2.0", "size": 12879 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,356,818
public String visit(SearchToken n, String query) { // choice.which is the order of f0 -> i.e. choice 1 is quoted, choice 2 // is wildcard etc. StringBuilder returnString = new StringBuilder(); String token = n.f0.choice.toString(); FindReplace replacment; if (useFindReplaceRegEx) { for (FindReplaceRegEx fr : findReplaceRegEx) { if ((fr.getField() == null) || fields.contains(fr.getField())) { Matcher m = fr.getPattern().matcher(token.trim()); if (m.matches()) { token = m.replaceFirst(fr.getReplacement()); if (fr.isOperatorReplace()) { isDefaultOpOn = false; } } } } } if ((replacment = findReplace.get(token.toLowerCase())) != null) { if ((replacment.getField() == null) || fields.contains(replacment.getField())) { if (replacment.isCaseSensitive()) { if (token.equals(replacment.getFind())) { token = replacment.getReplacement(); if (replacment.isOperatorReplace()) { isDefaultOpOn = false; } } } else { token = replacment.getReplacement(); if (replacment.isOperatorReplace()) { isDefaultOpOn = false; } } } } if (buildSuggestedSearch) { if (isDefaultOpOn == false) { suggestedSearchPart.append(" " + token + " "); } else { suggestedSearch.addSlot(token); suggestedSearch.addPart(suggestedSearchPart.toString()); suggestedSearchPart.setLength(0); } } NodeChoice choice = (NodeChoice) n.f0; if (choice.which == 3) { Matcher m = QsolToQueryVisitor.RANGE_EXTRACTOR.matcher(choice.choice .toString()); StringBuilder sb = new StringBuilder(); if (m.matches()) { if (m.group(1) != null && m.group(1).equals("[")) { sb.append(m.group(1)); } String term1 = m.group(2); String op = m.group(3); String term2 = m.group(4); sb.append(checkZeroPad(term1)); sb.append(" "); sb.append(op); sb.append(" "); sb.append(checkZeroPad(term2)); if (m.group(1) != null && m.group(5).equals("]")) { sb.append(m.group(5)); } return sb.toString(); } else { throw new RuntimeException( "Range did not match in QsolToQueryVisitor but did with JavaCC parser"); } } token = checkZeroPad(token); returnString.append(token); return returnString.toString(); }
String function(SearchToken n, String query) { StringBuilder returnString = new StringBuilder(); String token = n.f0.choice.toString(); FindReplace replacment; if (useFindReplaceRegEx) { for (FindReplaceRegEx fr : findReplaceRegEx) { if ((fr.getField() == null) fields.contains(fr.getField())) { Matcher m = fr.getPattern().matcher(token.trim()); if (m.matches()) { token = m.replaceFirst(fr.getReplacement()); if (fr.isOperatorReplace()) { isDefaultOpOn = false; } } } } } if ((replacment = findReplace.get(token.toLowerCase())) != null) { if ((replacment.getField() == null) fields.contains(replacment.getField())) { if (replacment.isCaseSensitive()) { if (token.equals(replacment.getFind())) { token = replacment.getReplacement(); if (replacment.isOperatorReplace()) { isDefaultOpOn = false; } } } else { token = replacment.getReplacement(); if (replacment.isOperatorReplace()) { isDefaultOpOn = false; } } } } if (buildSuggestedSearch) { if (isDefaultOpOn == false) { suggestedSearchPart.append(" " + token + " "); } else { suggestedSearch.addSlot(token); suggestedSearch.addPart(suggestedSearchPart.toString()); suggestedSearchPart.setLength(0); } } NodeChoice choice = (NodeChoice) n.f0; if (choice.which == 3) { Matcher m = QsolToQueryVisitor.RANGE_EXTRACTOR.matcher(choice.choice .toString()); StringBuilder sb = new StringBuilder(); if (m.matches()) { if (m.group(1) != null && m.group(1).equals("[")) { sb.append(m.group(1)); } String term1 = m.group(2); String op = m.group(3); String term2 = m.group(4); sb.append(checkZeroPad(term1)); sb.append(" "); sb.append(op); sb.append(" "); sb.append(checkZeroPad(term2)); if (m.group(1) != null && m.group(5).equals("]")) { sb.append(m.group(5)); } return sb.toString(); } else { throw new RuntimeException( STR); } } token = checkZeroPad(token); returnString.append(token); return returnString.toString(); }
/** * f0 -> ( <QUOTED> | <WILDCARD> | <FUZZY> | <SEARCHTOKEN> )+ */
f0 -> ( | | | )+
visit
{ "repo_name": "markrmiller/qsol", "path": "src/java/com/mhs/qsol/PreProcessVisitor.java", "license": "apache-2.0", "size": 15457 }
[ "com.mhs.qsol.syntaxtree.NodeChoice", "com.mhs.qsol.syntaxtree.SearchToken", "java.util.regex.Matcher" ]
import com.mhs.qsol.syntaxtree.NodeChoice; import com.mhs.qsol.syntaxtree.SearchToken; import java.util.regex.Matcher;
import com.mhs.qsol.syntaxtree.*; import java.util.regex.*;
[ "com.mhs.qsol", "java.util" ]
com.mhs.qsol; java.util;
1,600,041
protected Module removeModuleFromList( String moduleIdSeq, List modules) { ListIterator iterate = modules.listIterator(); while (iterate.hasNext()) { Module module = (Module) iterate.next(); if (module.getModuleIdseq().equals(moduleIdSeq)) { iterate.remove(); return module; } } return null; }
Module function( String moduleIdSeq, List modules) { ListIterator iterate = modules.listIterator(); while (iterate.hasNext()) { Module module = (Module) iterate.next(); if (module.getModuleIdseq().equals(moduleIdSeq)) { iterate.remove(); return module; } } return null; }
/** * Removes the module given by "moduleIdSeq" from the module list * * @param moduleIdSeq * @param modules * * @return the removed module */
Removes the module given by "moduleIdSeq" from the module list
removeModuleFromList
{ "repo_name": "NCIP/cadsr-formbuilder", "path": "software/formbuilder/src/java/gov/nih/nci/ncicb/cadsr/formbuilder/struts/actions/FormEditAction.java", "license": "bsd-3-clause", "size": 52713 }
[ "gov.nih.nci.ncicb.cadsr.common.resource.Module", "java.util.List", "java.util.ListIterator" ]
import gov.nih.nci.ncicb.cadsr.common.resource.Module; import java.util.List; import java.util.ListIterator;
import gov.nih.nci.ncicb.cadsr.common.resource.*; import java.util.*;
[ "gov.nih.nci", "java.util" ]
gov.nih.nci; java.util;
2,058,061
public void addToolTipSeries(List toolTips) { this.toolTipSeries.add(toolTips); }
void function(List toolTips) { this.toolTipSeries.add(toolTips); }
/** * Adds a list of tooltips for a series. * * @param toolTips the list of tool tips. */
Adds a list of tooltips for a series
addToolTipSeries
{ "repo_name": "Mr-Steve/LTSpice_Library_Manager", "path": "libs/jfreechart-1.0.16/source/org/jfree/chart/labels/CustomXYToolTipGenerator.java", "license": "gpl-2.0", "size": 6252 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,221,837
List<T> list(EntityManager entityManager);
List<T> list(EntityManager entityManager);
/** * * Execute and return your query data * * @param entityManager * a {@link javax.persistence.EntityManager} object. * @return a {@link java.util.List} object. */
Execute and return your query data
list
{ "repo_name": "xjodoin/torpedoquery", "path": "src/main/java/org/torpedoquery/jpa/Query.java", "license": "apache-2.0", "size": 3652 }
[ "java.util.List", "javax.persistence.EntityManager" ]
import java.util.List; import javax.persistence.EntityManager;
import java.util.*; import javax.persistence.*;
[ "java.util", "javax.persistence" ]
java.util; javax.persistence;
779,567
public IJobHandler loadNewInstance(String codeSource) throws Exception{ if (codeSource!=null && codeSource.trim().length()>0) { Class<?> clazz = getCodeSourceClass(codeSource); if (clazz != null) { Object instance = clazz.newInstance(); if (instance!=null) { if (instance instanceof IJobHandler) { this.injectService(instance); return (IJobHandler) instance; } else { throw new IllegalArgumentException(">>>>>>>>>>> xxl-glue, loadNewInstance error, " + "cannot convert from instance["+ instance.getClass() +"] to IJobHandler"); } } } } throw new IllegalArgumentException(">>>>>>>>>>> xxl-glue, loadNewInstance error, instance is null"); }
IJobHandler function(String codeSource) throws Exception{ if (codeSource!=null && codeSource.trim().length()>0) { Class<?> clazz = getCodeSourceClass(codeSource); if (clazz != null) { Object instance = clazz.newInstance(); if (instance!=null) { if (instance instanceof IJobHandler) { this.injectService(instance); return (IJobHandler) instance; } else { throw new IllegalArgumentException(STR + STR+ instance.getClass() +STR); } } } } throw new IllegalArgumentException(STR); }
/** * load new instance, prototype * * @param codeSource * @return * @throws Exception */
load new instance, prototype
loadNewInstance
{ "repo_name": "xuxueli/xxl-job", "path": "xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java", "license": "gpl-3.0", "size": 2468 }
[ "com.xxl.job.core.handler.IJobHandler" ]
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.*;
[ "com.xxl.job" ]
com.xxl.job;
578,482
private static void applyDataTransformationsOnOutgoingItem(SyncItem item, DataTransformerManager dataTransformerManager, Sync4jPrincipal principal) throws Sync4jException { TransformationInfo info = new TransformationInfo(); info.setCredentials (principal.getEncodedCredentials()); info.setUsername (principal.getUsername() ); info.setUserPassword(principal.getUser().getPassword()); dataTransformerManager.transformOutgoingItem(info, item); }
static void function(SyncItem item, DataTransformerManager dataTransformerManager, Sync4jPrincipal principal) throws Sync4jException { TransformationInfo info = new TransformationInfo(); info.setCredentials (principal.getEncodedCredentials()); info.setUsername (principal.getUsername() ); info.setUserPassword(principal.getUser().getPassword()); dataTransformerManager.transformOutgoingItem(info, item); }
/** * Applies the required data transformation on the go out items * * @param item the syncitem to transform * @param dataTransformerManager * @param principal * @throws com.funambol.framework.core.Sync4jException */
Applies the required data transformation on the go out items
applyDataTransformationsOnOutgoingItem
{ "repo_name": "accesstest3/cfunambol", "path": "ds/ds-server/src/main/java/com/funambol/server/engine/SyncItemHelper.java", "license": "agpl-3.0", "size": 11704 }
[ "com.funambol.framework.core.Sync4jException", "com.funambol.framework.engine.SyncItem", "com.funambol.framework.engine.transformer.DataTransformerManager", "com.funambol.framework.engine.transformer.TransformationInfo", "com.funambol.framework.security.Sync4jPrincipal" ]
import com.funambol.framework.core.Sync4jException; import com.funambol.framework.engine.SyncItem; import com.funambol.framework.engine.transformer.DataTransformerManager; import com.funambol.framework.engine.transformer.TransformationInfo; import com.funambol.framework.security.Sync4jPrincipal;
import com.funambol.framework.core.*; import com.funambol.framework.engine.*; import com.funambol.framework.engine.transformer.*; import com.funambol.framework.security.*;
[ "com.funambol.framework" ]
com.funambol.framework;
1,156,374
public synchronized Pair<String, Integer> getControllerLeader() { if (!_cachedControllerLeaderInvalid) { return _controllerLeaderHostPort; } BaseDataAccessor<ZNRecord> dataAccessor = _helixManager.getHelixDataAccessor().getBaseDataAccessor(); Stat stat = new Stat(); try { ZNRecord znRecord = dataAccessor.get("/" + _clusterName + "/CONTROLLER/LEADER", stat, AccessOption.THROW_EXCEPTION_IFNOTEXIST); String leader = znRecord.getId(); int index = leader.lastIndexOf('_'); String leaderHost = leader.substring(0, index); int leaderPort = Integer.valueOf(leader.substring(index + 1)); _controllerLeaderHostPort = new Pair<>(leaderHost, leaderPort); _cachedControllerLeaderInvalid = false; return _controllerLeaderHostPort; } catch (Exception e) { LOGGER.warn("Could not locate controller leader, exception", e); _cachedControllerLeaderInvalid = true; return null; } }
synchronized Pair<String, Integer> function() { if (!_cachedControllerLeaderInvalid) { return _controllerLeaderHostPort; } BaseDataAccessor<ZNRecord> dataAccessor = _helixManager.getHelixDataAccessor().getBaseDataAccessor(); Stat stat = new Stat(); try { ZNRecord znRecord = dataAccessor.get("/" + _clusterName + STR, stat, AccessOption.THROW_EXCEPTION_IFNOTEXIST); String leader = znRecord.getId(); int index = leader.lastIndexOf('_'); String leaderHost = leader.substring(0, index); int leaderPort = Integer.valueOf(leader.substring(index + 1)); _controllerLeaderHostPort = new Pair<>(leaderHost, leaderPort); _cachedControllerLeaderInvalid = false; return _controllerLeaderHostPort; } catch (Exception e) { LOGGER.warn(STR, e); _cachedControllerLeaderInvalid = true; return null; } }
/** * Locate the controller leader so that we can send LLC segment completion requests to it. * Checks the {@link ControllerLeaderLocator::_cachedControllerLeaderInvalid} flag and fetches the leader from helix if cached value is invalid * * @return The host:port string of the current controller leader. */
Locate the controller leader so that we can send LLC segment completion requests to it. Checks the <code>ControllerLeaderLocator::_cachedControllerLeaderInvalid</code> flag and fetches the leader from helix if cached value is invalid
getControllerLeader
{ "repo_name": "apucher/pinot", "path": "pinot-core/src/main/java/com/linkedin/pinot/server/realtime/ControllerLeaderLocator.java", "license": "apache-2.0", "size": 6156 }
[ "com.linkedin.pinot.core.query.utils.Pair", "org.apache.helix.AccessOption", "org.apache.helix.BaseDataAccessor", "org.apache.helix.ZNRecord", "org.apache.zookeeper.data.Stat" ]
import com.linkedin.pinot.core.query.utils.Pair; import org.apache.helix.AccessOption; import org.apache.helix.BaseDataAccessor; import org.apache.helix.ZNRecord; import org.apache.zookeeper.data.Stat;
import com.linkedin.pinot.core.query.utils.*; import org.apache.helix.*; import org.apache.zookeeper.data.*;
[ "com.linkedin.pinot", "org.apache.helix", "org.apache.zookeeper" ]
com.linkedin.pinot; org.apache.helix; org.apache.zookeeper;
844,259
JK.setTestContext(); System.setProperty("jk.db.config.file", "/test/h2-jk-db2.properties"); dataAccess = JKDataSourceFactory.getDataAccessService(); }
JK.setTestContext(); System.setProperty(STR, STR); dataAccess = JKDataSourceFactory.getDataAccessService(); }
/** * Sets the up before class. * * @throws Exception the exception */
Sets the up before class
setUpBeforeClass
{ "repo_name": "kiswanij/jk-db", "path": "src/test/java/com/jk/db/util/test/AbstractDBTest.java", "license": "mit", "size": 1970 }
[ "com.jk.db.datasource.JKDataSourceFactory", "com.jk.util.JK" ]
import com.jk.db.datasource.JKDataSourceFactory; import com.jk.util.JK;
import com.jk.db.datasource.*; import com.jk.util.*;
[ "com.jk.db", "com.jk.util" ]
com.jk.db; com.jk.util;
1,419,226
@Override public void updateData(final Object data) { final FactoryData factoryData = (FactoryData) data; setRolloverStrategy(factoryData.getRolloverStrategy()); setPatternProcessor(new PatternProcessor(factoryData.getPattern(), getPatternProcessor())); setTriggeringPolicy(factoryData.getTriggeringPolicy()); } private static class RollingFileManagerFactory implements ManagerFactory<RollingFileManager, FactoryData> {
void function(final Object data) { final FactoryData factoryData = (FactoryData) data; setRolloverStrategy(factoryData.getRolloverStrategy()); setPatternProcessor(new PatternProcessor(factoryData.getPattern(), getPatternProcessor())); setTriggeringPolicy(factoryData.getTriggeringPolicy()); } private static class RollingFileManagerFactory implements ManagerFactory<RollingFileManager, FactoryData> {
/** * Updates the RollingFileManager's data during a reconfiguration. This method should be considered private. * It is not thread safe and calling it outside of a reconfiguration may lead to errors. This method may be * made protected in a future release. * @param data The data to update. */
Updates the RollingFileManager's data during a reconfiguration. This method should be considered private. It is not thread safe and calling it outside of a reconfiguration may lead to errors. This method may be made protected in a future release
updateData
{ "repo_name": "apache/logging-log4j2", "path": "log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java", "license": "apache-2.0", "size": 33859 }
[ "org.apache.logging.log4j.core.appender.ManagerFactory" ]
import org.apache.logging.log4j.core.appender.ManagerFactory;
import org.apache.logging.log4j.core.appender.*;
[ "org.apache.logging" ]
org.apache.logging;
2,658,981
private void onContinueAsClicked() { if (!mModel.get(SigninFirstRunProperties.IS_SIGNIN_SUPPORTED)) { mDelegate.acceptTermsOfService(); return; } if (mSelectedAccountName == null) { mDelegate.addAccount(); return; } if (mModel.get(SigninFirstRunProperties.IS_SELECTED_ACCOUNT_SUPERVISED)) { mDelegate.acceptTermsOfService(); return; } assert mModel.get(SigninFirstRunProperties.ARE_NATIVE_AND_POLICY_LOADED) : "The continue button shouldn't be visible before the native is not initialized!"; mDelegate.recordFreProgressHistogram( TextUtils.equals(mDefaultAccountName, mSelectedAccountName) ? MobileFreProgress.WELCOME_SIGNIN_WITH_DEFAULT_ACCOUNT : MobileFreProgress.WELCOME_SIGNIN_WITH_NON_DEFAULT_ACCOUNT); if (IdentityServicesProvider.get() .getIdentityManager(Profile.getLastUsedRegularProfile()) .hasPrimaryAccount(ConsentLevel.SIGNIN)) { mDelegate.acceptTermsOfService(); return; }
void function() { if (!mModel.get(SigninFirstRunProperties.IS_SIGNIN_SUPPORTED)) { mDelegate.acceptTermsOfService(); return; } if (mSelectedAccountName == null) { mDelegate.addAccount(); return; } if (mModel.get(SigninFirstRunProperties.IS_SELECTED_ACCOUNT_SUPERVISED)) { mDelegate.acceptTermsOfService(); return; } assert mModel.get(SigninFirstRunProperties.ARE_NATIVE_AND_POLICY_LOADED) : STR; mDelegate.recordFreProgressHistogram( TextUtils.equals(mDefaultAccountName, mSelectedAccountName) ? MobileFreProgress.WELCOME_SIGNIN_WITH_DEFAULT_ACCOUNT : MobileFreProgress.WELCOME_SIGNIN_WITH_NON_DEFAULT_ACCOUNT); if (IdentityServicesProvider.get() .getIdentityManager(Profile.getLastUsedRegularProfile()) .hasPrimaryAccount(ConsentLevel.SIGNIN)) { mDelegate.acceptTermsOfService(); return; }
/** * Callback for the PropertyKey {@link SigninFirstRunProperties#ON_CONTINUE_AS_CLICKED}. */
Callback for the PropertyKey <code>SigninFirstRunProperties#ON_CONTINUE_AS_CLICKED</code>
onContinueAsClicked
{ "repo_name": "nwjs/chromium.src", "path": "chrome/browser/ui/android/signin/java/src/org/chromium/chrome/browser/ui/signin/fre/SigninFirstRunMediator.java", "license": "bsd-3-clause", "size": 11419 }
[ "android.text.TextUtils", "org.chromium.chrome.browser.firstrun.MobileFreProgress", "org.chromium.chrome.browser.profiles.Profile", "org.chromium.chrome.browser.signin.services.IdentityServicesProvider", "org.chromium.components.signin.identitymanager.ConsentLevel" ]
import android.text.TextUtils; import org.chromium.chrome.browser.firstrun.MobileFreProgress; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.components.signin.identitymanager.ConsentLevel;
import android.text.*; import org.chromium.chrome.browser.firstrun.*; import org.chromium.chrome.browser.profiles.*; import org.chromium.chrome.browser.signin.services.*; import org.chromium.components.signin.identitymanager.*;
[ "android.text", "org.chromium.chrome", "org.chromium.components" ]
android.text; org.chromium.chrome; org.chromium.components;
100,061
public void updateThisDevice(WifiP2pDevice device) { this.device = device; TextView view = (TextView) mContentView.findViewById(R.id.my_name); view.setText(device.deviceName); view = (TextView) mContentView.findViewById(R.id.my_status); view.setText(getDeviceStatus(device.status)); }
void function(WifiP2pDevice device) { this.device = device; TextView view = (TextView) mContentView.findViewById(R.id.my_name); view.setText(device.deviceName); view = (TextView) mContentView.findViewById(R.id.my_status); view.setText(getDeviceStatus(device.status)); }
/** * Update UI for this device. * * @param device WifiP2pDevice object */
Update UI for this device
updateThisDevice
{ "repo_name": "stephansigg/ad-hoc-pairing", "path": "WiFiDirectActivity/src/com/example/android/wifidirect/DeviceListFragment.java", "license": "gpl-2.0", "size": 6712 }
[ "android.net.wifi.p2p.WifiP2pDevice", "android.widget.TextView" ]
import android.net.wifi.p2p.WifiP2pDevice; import android.widget.TextView;
import android.net.wifi.p2p.*; import android.widget.*;
[ "android.net", "android.widget" ]
android.net; android.widget;
1,034,746
private Criteria buildMRIClinicalEvalCrit(ClinicalDataQuery clinicalQuery) { MRIClinicalEvalCriteria crit = clinicalQuery.getMriCriteria(); Criteria c = new Criteria(); if (crit != null) { c.addEqualTo(NeuroEvaluation.MRI_CT_SCORE, Integer.parseInt(crit.getMRIClinicalEvalDE().getValueObject())); return c; } else { return null; } }
Criteria function(ClinicalDataQuery clinicalQuery) { MRIClinicalEvalCriteria crit = clinicalQuery.getMriCriteria(); Criteria c = new Criteria(); if (crit != null) { c.addEqualTo(NeuroEvaluation.MRI_CT_SCORE, Integer.parseInt(crit.getMRIClinicalEvalDE().getValueObject())); return c; } else { return null; } }
/** * * private method used to add the MRI scores to OJB criteria */
private method used to add the MRI scores to OJB criteria
buildMRIClinicalEvalCrit
{ "repo_name": "NCIP/rembrandt", "path": "src/gov/nih/nci/rembrandt/queryservice/queryprocessing/clinical/ClinicalQueryHandler.java", "license": "bsd-3-clause", "size": 105681 }
[ "gov.nih.nci.caintegrator.dto.critieria.MRIClinicalEvalCriteria", "gov.nih.nci.rembrandt.dbbean.NeuroEvaluation", "gov.nih.nci.rembrandt.dto.query.ClinicalDataQuery", "org.apache.ojb.broker.query.Criteria" ]
import gov.nih.nci.caintegrator.dto.critieria.MRIClinicalEvalCriteria; import gov.nih.nci.rembrandt.dbbean.NeuroEvaluation; import gov.nih.nci.rembrandt.dto.query.ClinicalDataQuery; import org.apache.ojb.broker.query.Criteria;
import gov.nih.nci.caintegrator.dto.critieria.*; import gov.nih.nci.rembrandt.dbbean.*; import gov.nih.nci.rembrandt.dto.query.*; import org.apache.ojb.broker.query.*;
[ "gov.nih.nci", "org.apache.ojb" ]
gov.nih.nci; org.apache.ojb;
2,224,313
public void testParseExceptionFromMacroInvoke () throws Exception { VelocityEngine ve = new VelocityEngine(); ve.init(); VelocityContext context = new VelocityContext(); Writer writer = new StringWriter(); try { ve.evaluate(context,writer,"testMacroInvoke", "#macro( foo $a) $a #end #foo(woogie)"); fail("Should have thown a ParseErrorException"); } catch (ParseErrorException e) { assertEquals("testMacroInvoke",e.getTemplateName()); assertEquals(1,e.getLineNumber()); assertEquals(31,e.getColumnNumber()); } finally { if (writer != null) { writer.close(); } } }
void function () throws Exception { VelocityEngine ve = new VelocityEngine(); ve.init(); VelocityContext context = new VelocityContext(); Writer writer = new StringWriter(); try { ve.evaluate(context,writer,STR, STR); fail(STR); } catch (ParseErrorException e) { assertEquals(STR,e.getTemplateName()); assertEquals(1,e.getLineNumber()); assertEquals(31,e.getColumnNumber()); } finally { if (writer != null) { writer.close(); } } }
/** * Tests that parseException has useful info when thrown in VelocityEngine.evaluate() * and the problem comes from a macro invocation * @throws Exception */
Tests that parseException has useful info when thrown in VelocityEngine.evaluate() and the problem comes from a macro invocation
testParseExceptionFromMacroInvoke
{ "repo_name": "gogamoga/velocity-engine-1.6.4", "path": "src/test/org/apache/velocity/test/ParseExceptionTestCase.java", "license": "apache-2.0", "size": 8683 }
[ "java.io.StringWriter", "java.io.Writer", "org.apache.velocity.VelocityContext", "org.apache.velocity.app.VelocityEngine", "org.apache.velocity.exception.ParseErrorException" ]
import java.io.StringWriter; import java.io.Writer; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.exception.ParseErrorException;
import java.io.*; import org.apache.velocity.*; import org.apache.velocity.app.*; import org.apache.velocity.exception.*;
[ "java.io", "org.apache.velocity" ]
java.io; org.apache.velocity;
195,900
public void setUsername(String username) { JodaBeanUtils.notNull(username, "username"); this._username = username; }
void function(String username) { JodaBeanUtils.notNull(username, STR); this._username = username; }
/** * Sets the database user name. * @param username the new value of the property, not null */
Sets the database user name
setUsername
{ "repo_name": "McLeodMoores/starling", "path": "projects/component/src/main/java/com/opengamma/component/factory/infrastructure/DataSourceComponentFactory.java", "license": "apache-2.0", "size": 25505 }
[ "org.joda.beans.JodaBeanUtils" ]
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
843,811
//------------------------------------------------------------------------- @Test(expectedExceptions = UnsupportedOperationException.class) public void testSetValue() { final DoublesPair pair = DoublesPair.of(2.1d, -0.3d); pair.setValue(Double.valueOf(1.2d)); }
@Test(expectedExceptions = UnsupportedOperationException.class) void function() { final DoublesPair pair = DoublesPair.of(2.1d, -0.3d); pair.setValue(Double.valueOf(1.2d)); }
/** * Sets that the set method cannot be used. */
Sets that the set method cannot be used
testSetValue
{ "repo_name": "McLeodMoores/starling", "path": "projects/util/src/test/java/com/opengamma/util/tuple/DoublesPairTest.java", "license": "apache-2.0", "size": 10517 }
[ "org.testng.annotations.Test" ]
import org.testng.annotations.Test;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
1,049,097
public void testGenerateOpeningDatasample() throws HibernateException { checkIfDataSamplesHaveNotBeenAlreadyGenerated(todayMidnight, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST); saveDataSamples(); replay(); dataSampler.generateOpeningDataSamples(iteration); verify(); }
void function() throws HibernateException { checkIfDataSamplesHaveNotBeenAlreadyGenerated(todayMidnight, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST); saveDataSamples(); replay(); dataSampler.generateOpeningDataSamples(iteration); verify(); }
/** Test generate opening datasample. * * @throws HibernateException * the hibernate exception */
Test generate opening datasample
testGenerateOpeningDatasample
{ "repo_name": "alarulrajan/CodeFest", "path": "test/com/technoetic/xplanner/charts/TestDataSamplerImpl.java", "license": "gpl-2.0", "size": 10663 }
[ "java.util.Collections", "org.hibernate.HibernateException" ]
import java.util.Collections; import org.hibernate.HibernateException;
import java.util.*; import org.hibernate.*;
[ "java.util", "org.hibernate" ]
java.util; org.hibernate;
1,209,186
protected void chooseRemainingReplicas (int numOfReplicas, HashMap<Node, Node> excludedNodes, long blocksize, int maxReplicasPerRack, List<DatanodeDescriptor> results) throws NotEnoughReplicasException { readLock(); try { if (numOfReplicas <= 0) { return; } DatanodeDescriptor[] bestmatch = findBest(results); if (bestmatch[0] != null) { // there is a first replica: 1,X,X excludedNodes.put(bestmatch[0], bestmatch[0]); if (bestmatch[1] == null) { // there is no second replica: 1,0,0 chooseFirstInRemoteRack(bestmatch[0], excludedNodes, blocksize, maxReplicasPerRack, results); // pick up second numOfReplicas--; // now search for the rest recursively chooseRemainingReplicas(numOfReplicas, excludedNodes, blocksize, maxReplicasPerRack, results); return; } else if (bestmatch[2] == null) { // no third replica: 1,1,0 // find the third one excludedNodes.put(bestmatch[1], bestmatch[1]); RackRingInfo rack0 = racksMap.get(bestmatch[0].getNetworkLocation()); RackRingInfo rack1 = racksMap.get(bestmatch[1].getNetworkLocation()); int posR0 = rack0.findNode(bestmatch[0]); int firstMachine = posR0 * rack1.rackNodes.size() / rack0.rackNodes.size(); if (!chooseMachine(bestmatch[1].getNetworkLocation(), firstMachine, machineWindow, excludedNodes, blocksize, maxReplicasPerRack, results)) { // if doen't get it in the rack, try at a different one LOG.info("Couldn't find 3rd Datanode on the same rack as 2nd. " + "Resorting to a different rack in the same node group."); chooseFirstInRemoteRack(bestmatch[0], excludedNodes, blocksize, maxReplicasPerRack, results); } numOfReplicas--; } } else if (bestmatch[1] != null && bestmatch[2] != null) { // 0,1,1 RackRingInfo rackInfo = racksMap.get(bestmatch[1].getNetworkLocation()); Integer posN1 = rackInfo.findNode(bestmatch[1]); Integer posN2 = rackInfo.findNode(bestmatch[2]); if (posN1 != null && posN2 != null) { int rackSize = rackInfo.rackNodes.size(); int diff = (posN2 - posN1 + rackSize) % rackSize; if (diff >= machineWindow) { Integer tmp = posN1; posN1 = posN2; posN2 = tmp; diff = rackSize - diff; } int newMachineWindow = machineWindow - diff; assert (newMachineWindow > 0); if (rackSize - diff < machineWindow) { newMachineWindow = rackSize; } final int firstRack = (rackInfo.index - rackWindow + racks.size()) % racks.size(); int machineIdx = (posN1 - newMachineWindow + 1 + rackSize) % rackSize; if (chooseRemoteRack(rackInfo.index, firstRack, rackWindow, machineIdx, newMachineWindow, excludedNodes, blocksize, maxReplicasPerRack, results, true)) { numOfReplicas--; } } } // get the rest randomly if (numOfReplicas > 0) { int replicas = results.size(); if (replicas < 3) { LOG.info("Picking up random replicas from default policy after " + results.size() + " replicas have been chosen"); } super.chooseRandom(numOfReplicas, NodeBase.ROOT, excludedNodes, blocksize, maxReplicasPerRack, results); } } finally { readUnlock(); } }
void function (int numOfReplicas, HashMap<Node, Node> excludedNodes, long blocksize, int maxReplicasPerRack, List<DatanodeDescriptor> results) throws NotEnoughReplicasException { readLock(); try { if (numOfReplicas <= 0) { return; } DatanodeDescriptor[] bestmatch = findBest(results); if (bestmatch[0] != null) { excludedNodes.put(bestmatch[0], bestmatch[0]); if (bestmatch[1] == null) { chooseFirstInRemoteRack(bestmatch[0], excludedNodes, blocksize, maxReplicasPerRack, results); numOfReplicas--; chooseRemainingReplicas(numOfReplicas, excludedNodes, blocksize, maxReplicasPerRack, results); return; } else if (bestmatch[2] == null) { excludedNodes.put(bestmatch[1], bestmatch[1]); RackRingInfo rack0 = racksMap.get(bestmatch[0].getNetworkLocation()); RackRingInfo rack1 = racksMap.get(bestmatch[1].getNetworkLocation()); int posR0 = rack0.findNode(bestmatch[0]); int firstMachine = posR0 * rack1.rackNodes.size() / rack0.rackNodes.size(); if (!chooseMachine(bestmatch[1].getNetworkLocation(), firstMachine, machineWindow, excludedNodes, blocksize, maxReplicasPerRack, results)) { LOG.info(STR + STR); chooseFirstInRemoteRack(bestmatch[0], excludedNodes, blocksize, maxReplicasPerRack, results); } numOfReplicas--; } } else if (bestmatch[1] != null && bestmatch[2] != null) { RackRingInfo rackInfo = racksMap.get(bestmatch[1].getNetworkLocation()); Integer posN1 = rackInfo.findNode(bestmatch[1]); Integer posN2 = rackInfo.findNode(bestmatch[2]); if (posN1 != null && posN2 != null) { int rackSize = rackInfo.rackNodes.size(); int diff = (posN2 - posN1 + rackSize) % rackSize; if (diff >= machineWindow) { Integer tmp = posN1; posN1 = posN2; posN2 = tmp; diff = rackSize - diff; } int newMachineWindow = machineWindow - diff; assert (newMachineWindow > 0); if (rackSize - diff < machineWindow) { newMachineWindow = rackSize; } final int firstRack = (rackInfo.index - rackWindow + racks.size()) % racks.size(); int machineIdx = (posN1 - newMachineWindow + 1 + rackSize) % rackSize; if (chooseRemoteRack(rackInfo.index, firstRack, rackWindow, machineIdx, newMachineWindow, excludedNodes, blocksize, maxReplicasPerRack, results, true)) { numOfReplicas--; } } } if (numOfReplicas > 0) { int replicas = results.size(); if (replicas < 3) { LOG.info(STR + results.size() + STR); } super.chooseRandom(numOfReplicas, NodeBase.ROOT, excludedNodes, blocksize, maxReplicasPerRack, results); } } finally { readUnlock(); } }
/** * Chooses the third replica, after 2 have been allocated * @param excludedNodes Nodes that we should not consider * @param blocksize size of blocks * @param maxReplicasPerRack maximum number of replicas per rack * @param results array containing results * @throws NotEnoughReplicasException */
Chooses the third replica, after 2 have been allocated
chooseRemainingReplicas
{ "repo_name": "iVCE/RDFS", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyConfigurable.java", "license": "apache-2.0", "size": 28185 }
[ "java.util.HashMap", "java.util.List", "org.apache.hadoop.net.Node", "org.apache.hadoop.net.NodeBase" ]
import java.util.HashMap; import java.util.List; import org.apache.hadoop.net.Node; import org.apache.hadoop.net.NodeBase;
import java.util.*; import org.apache.hadoop.net.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
131,440
public ConnectionInformationMetaData getMetaData() { try { return getMetaDataOrThrow(); } catch (RepositoryException e) { return new ConnectionInformationMetaData(); } } /** * Get the meta data of the connection if it is properly specified. Otherwise returns {@code null} for * not or wrongly connected inputs, as well as for an unset or unused {@link #getParameterKey()} parameter. * Will throw repository related exceptions in case of misconfigured parameters. * * @return the properly specified meta data or {@code null}
ConnectionInformationMetaData function() { try { return getMetaDataOrThrow(); } catch (RepositoryException e) { return new ConnectionInformationMetaData(); } } /** * Get the meta data of the connection if it is properly specified. Otherwise returns {@code null} for * not or wrongly connected inputs, as well as for an unset or unused {@link #getParameterKey()} parameter. * Will throw repository related exceptions in case of misconfigured parameters. * * @return the properly specified meta data or {@code null}
/** * Get the meta data of the connection if it is properly specified. Otherwise just returns a generic {@link ConnectionInformationMetaData}. * Will try to either get matching meta data from the input port or from the parameter specified repository location. */
Get the meta data of the connection if it is properly specified. Otherwise just returns a generic <code>ConnectionInformationMetaData</code>. Will try to either get matching meta data from the input port or from the parameter specified repository location
getMetaData
{ "repo_name": "rapidminer/rapidminer-studio", "path": "src/main/java/com/rapidminer/connection/util/ConnectionInformationSelector.java", "license": "agpl-3.0", "size": 21255 }
[ "com.rapidminer.operator.ports.metadata.ConnectionInformationMetaData", "com.rapidminer.repository.RepositoryException" ]
import com.rapidminer.operator.ports.metadata.ConnectionInformationMetaData; import com.rapidminer.repository.RepositoryException;
import com.rapidminer.operator.ports.metadata.*; import com.rapidminer.repository.*;
[ "com.rapidminer.operator", "com.rapidminer.repository" ]
com.rapidminer.operator; com.rapidminer.repository;
2,604,786
public void setProperties(HashMap<String, String> properties) { this.properties = properties; }
void function(HashMap<String, String> properties) { this.properties = properties; }
/** * Set the properties * * @param properties the properties to set */
Set the properties
setProperties
{ "repo_name": "cbaenziger/oozie", "path": "core/src/main/java/org/apache/oozie/action/hadoop/CredentialsProperties.java", "license": "apache-2.0", "size": 2201 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
906,926
void writeInlineScriptAttributes(Appendable out) throws IOException;
void writeInlineScriptAttributes(Appendable out) throws IOException;
/** * Append any security attributes to the current script block. for example applying nonces * @param out the appendable that has started the current script block * @throws IOException */
Append any security attributes to the current script block. for example applying nonces
writeInlineScriptAttributes
{ "repo_name": "forcedotcom/aura", "path": "aura/src/main/java/org/auraframework/service/CSPInliningService.java", "license": "apache-2.0", "size": 2523 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
834,589
public @Nullable Double getDistinctRowCount(RelNode rel, RelMetadataQuery mq, ImmutableBitSet groupKey, @Nullable RexNode predicate) { // REVIEW zfong 4/19/06 - Broadbase code does not take into // consideration selectivity of predicates passed in. Also, they // assume the rows are unique even if the table is not boolean uniq = RelMdUtil.areColumnsDefinitelyUnique(mq, rel, groupKey); if (uniq) { return NumberUtil.multiply(mq.getRowCount(rel), mq.getSelectivity(rel, predicate)); } return null; }
@Nullable Double function(RelNode rel, RelMetadataQuery mq, ImmutableBitSet groupKey, @Nullable RexNode predicate) { boolean uniq = RelMdUtil.areColumnsDefinitelyUnique(mq, rel, groupKey); if (uniq) { return NumberUtil.multiply(mq.getRowCount(rel), mq.getSelectivity(rel, predicate)); } return null; }
/** Catch-all implementation for * {@link BuiltInMetadata.DistinctRowCount#getDistinctRowCount(ImmutableBitSet, RexNode)}, * invoked using reflection. * * @see org.apache.calcite.rel.metadata.RelMetadataQuery#getDistinctRowCount(RelNode, ImmutableBitSet, RexNode) */
Catch-all implementation for <code>BuiltInMetadata.DistinctRowCount#getDistinctRowCount(ImmutableBitSet, RexNode)</code>, invoked using reflection
getDistinctRowCount
{ "repo_name": "apache/calcite", "path": "core/src/main/java/org/apache/calcite/rel/metadata/RelMdDistinctRowCount.java", "license": "apache-2.0", "size": 12002 }
[ "org.apache.calcite.rel.RelNode", "org.apache.calcite.rex.RexNode", "org.apache.calcite.util.ImmutableBitSet", "org.apache.calcite.util.NumberUtil", "org.checkerframework.checker.nullness.qual.Nullable" ]
import org.apache.calcite.rel.RelNode; import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.ImmutableBitSet; import org.apache.calcite.util.NumberUtil; import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.calcite.rel.*; import org.apache.calcite.rex.*; import org.apache.calcite.util.*; import org.checkerframework.checker.nullness.qual.*;
[ "org.apache.calcite", "org.checkerframework.checker" ]
org.apache.calcite; org.checkerframework.checker;
2,013,554
private static int stateBlockSize(Player player, Npc npc, boolean forceAccept) { NpcUpdateContext ctx = npc.getUpdateContext(); if (!forceAccept) if (!ctx.isUpdateRequired() || !npc.getPosition().isViewableFrom(player.getPosition()) || npc.isVisible()) return 0; return 2 + (ctx.isGraphicsUpdateRequired() ? 4 : 0) + (ctx.isAnimationUpdateRequired() ? 3 : 0) + (ctx.isForcedChatUpdateRequired() ? npc.getForceChatText().length() + 1 : 0) + (ctx.isInteractingNpcUpdateRequired() ? 2 : 0) + (ctx.isFaceCoordinatesUpdateRequired() ? 4 : 0) + (ctx.isPrimaryHitUpdateRequired() ? 4 : 0) + (ctx.isSecondaryHitUpdateRequired() ? 4 : 0) + (ctx.isNpcDefinitionUpdateRequired() ? 2 : 0); }
static int function(Player player, Npc npc, boolean forceAccept) { NpcUpdateContext ctx = npc.getUpdateContext(); if (!forceAccept) if (!ctx.isUpdateRequired() !npc.getPosition().isViewableFrom(player.getPosition()) npc.isVisible()) return 0; return 2 + (ctx.isGraphicsUpdateRequired() ? 4 : 0) + (ctx.isAnimationUpdateRequired() ? 3 : 0) + (ctx.isForcedChatUpdateRequired() ? npc.getForceChatText().length() + 1 : 0) + (ctx.isInteractingNpcUpdateRequired() ? 2 : 0) + (ctx.isFaceCoordinatesUpdateRequired() ? 4 : 0) + (ctx.isPrimaryHitUpdateRequired() ? 4 : 0) + (ctx.isSecondaryHitUpdateRequired() ? 4 : 0) + (ctx.isNpcDefinitionUpdateRequired() ? 2 : 0); }
/** * The size in bytes of the state block for the given npc, with respect to the given player. */
The size in bytes of the state block for the given npc, with respect to the given player
stateBlockSize
{ "repo_name": "PureCS/runesource", "path": "src/main/java/com/rs/entity/npc/NpcUpdating.java", "license": "gpl-3.0", "size": 11485 }
[ "com.rs.entity.player.Player" ]
import com.rs.entity.player.Player;
import com.rs.entity.player.*;
[ "com.rs.entity" ]
com.rs.entity;
2,619,687
protected void setUpEditorInputMaps() { //when the ancestor of a focussed component, the symbol menu is probably showing, so don't //do anything. Let the symbol menu carry out its own actions. InputMap inMap = editor.getInputMap(MultiColumnTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ActionMap aMap = editor.getActionMap(); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "null"); aMap.put("null", new NullAction()); editor.setInputMap(MultiColumnTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inMap); editor.setActionMap(aMap); inMap = editor.getInputMap(MultiColumnTable.WHEN_FOCUSED); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "selectNextColumnCellCreateNew");//"notify-field-accept"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "caret-backward"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "caret-forward"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); aMap.put("selectNextColumnCellCreateNew", new selectNextColumnCell()); aMap.put("cancel", new CancelAction()); editor.setInputMap(MultiColumnTable.WHEN_FOCUSED, inMap); editor.setActionMap(aMap); }
void function() { InputMap inMap = editor.getInputMap(MultiColumnTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ActionMap aMap = editor.getActionMap(); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "null"); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "null"); aMap.put("null", new NullAction()); editor.setInputMap(MultiColumnTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inMap); editor.setActionMap(aMap); inMap = editor.getInputMap(MultiColumnTable.WHEN_FOCUSED); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), STR); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), STR); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), STR); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), STR); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), STR); inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), STR); aMap.put(STR, new selectNextColumnCell()); aMap.put(STR, new CancelAction()); editor.setInputMap(MultiColumnTable.WHEN_FOCUSED, inMap); editor.setActionMap(aMap); }
/** * Sets up the cell editor's action and input maps. */
Sets up the cell editor's action and input maps
setUpEditorInputMaps
{ "repo_name": "edesiocs/ingatan", "path": "src/org/ingatan/component/answerfield/AnsFieldTable.java", "license": "gpl-3.0", "size": 34376 }
[ "java.awt.event.KeyEvent", "javax.swing.ActionMap", "javax.swing.InputMap", "javax.swing.KeyStroke" ]
import java.awt.event.KeyEvent; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.KeyStroke;
import java.awt.event.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
618,342
void sendToBroker(String brokerId, InternalMessage message);
void sendToBroker(String brokerId, InternalMessage message);
/** * Send internal message to broker * * @param brokerId Broker Id * @param message Internal Message */
Send internal message to broker
sendToBroker
{ "repo_name": "12315jack/j1st-mqtt", "path": "j1st-mqtt-api/src/main/java/com/github/j1stiot/mqtt/api/comm/BrokerCommunicator.java", "license": "apache-2.0", "size": 1064 }
[ "com.github.j1stiot.mqtt.api.internal.InternalMessage" ]
import com.github.j1stiot.mqtt.api.internal.InternalMessage;
import com.github.j1stiot.mqtt.api.internal.*;
[ "com.github.j1stiot" ]
com.github.j1stiot;
1,904,653
void updateReplicationFactor(Collection<UpdatedReplicationInfo> blocks) { BlockManager bm = getBlockManager(); for (UpdatedReplicationInfo e : blocks) { BlockInfo b = e.block(); bm.setReplication(b.getReplication(), e.targetReplication(), b); } }
void updateReplicationFactor(Collection<UpdatedReplicationInfo> blocks) { BlockManager bm = getBlockManager(); for (UpdatedReplicationInfo e : blocks) { BlockInfo b = e.block(); bm.setReplication(b.getReplication(), e.targetReplication(), b); } }
/** * Tell the block manager to update the replication factors when delete * happens. Deleting a file or a snapshot might decrease the replication * factor of the blocks as the blocks are always replicated to the highest * replication factor among all snapshots. */
Tell the block manager to update the replication factors when delete happens. Deleting a file or a snapshot might decrease the replication factor of the blocks as the blocks are always replicated to the highest replication factor among all snapshots
updateReplicationFactor
{ "repo_name": "GeLiXin/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java", "license": "apache-2.0", "size": 72241 }
[ "java.util.Collection", "org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo", "org.apache.hadoop.hdfs.server.blockmanagement.BlockManager", "org.apache.hadoop.hdfs.server.namenode.INode" ]
import java.util.Collection; import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo; import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager; import org.apache.hadoop.hdfs.server.namenode.INode;
import java.util.*; import org.apache.hadoop.hdfs.server.blockmanagement.*; import org.apache.hadoop.hdfs.server.namenode.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
373,933
static String opToStrNoFail(int operator) { String res = opToStr(operator); if (res == null) { throw new Error("Unknown op " + operator + ": " + Token.name(operator)); } return res; }
static String opToStrNoFail(int operator) { String res = opToStr(operator); if (res == null) { throw new Error(STR + operator + STR + Token.name(operator)); } return res; }
/** * Converts an operator's token value (see {@link Token}) to a string * representation or fails. * * @param operator the operator's token value to convert * @return the string representation * @throws Error if the token value is not an operator */
Converts an operator's token value (see <code>Token</code>) to a string representation or fails
opToStrNoFail
{ "repo_name": "superkonduktr/closure-compiler", "path": "src/com/google/javascript/jscomp/NodeUtil.java", "license": "apache-2.0", "size": 130358 }
[ "com.google.javascript.rhino.Token" ]
import com.google.javascript.rhino.Token;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,057,819
protected void loadState(ObjectInputStream oin, int number) throws IOException, ClassNotFoundException { Object[] values = new Object[number]; for (int i = 0; i < number; i++) { values[i] = oin.readObject(); } this.values = values; }
void function(ObjectInputStream oin, int number) throws IOException, ClassNotFoundException { Object[] values = new Object[number]; for (int i = 0; i < number; i++) { values[i] = oin.readObject(); } this.values = values; }
/***************************************************************************** * IO handling ****************************************************************************/
IO handling
loadState
{ "repo_name": "Iolaum/MrSmith", "path": "AdX/src/main/java/se/sics/isl/db/file/ObjectField.java", "license": "gpl-2.0", "size": 4653 }
[ "java.io.IOException", "java.io.ObjectInputStream" ]
import java.io.IOException; import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,659,796
public static void deepFindAuthenticationExecutions(RealmModel realm, AuthenticationFlowModel flow, List<AuthenticationExecutionModel> result) { realm.getAuthenticationExecutionsStream(flow.getId()).forEachOrdered(execution -> { if (execution.isAuthenticatorFlow()) { AuthenticationFlowModel subFlow = realm.getAuthenticationFlowById(execution.getFlowId()); deepFindAuthenticationExecutions(realm, subFlow, result); } else { result.add(execution); } }); }
static void function(RealmModel realm, AuthenticationFlowModel flow, List<AuthenticationExecutionModel> result) { realm.getAuthenticationExecutionsStream(flow.getId()).forEachOrdered(execution -> { if (execution.isAuthenticatorFlow()) { AuthenticationFlowModel subFlow = realm.getAuthenticationFlowById(execution.getFlowId()); deepFindAuthenticationExecutions(realm, subFlow, result); } else { result.add(execution); } }); }
/** * Recursively find all AuthenticationExecutionModel from specified flow or all it's subflows * * @param realm * @param flow * @param result input should be empty list. At the end will be all executions added to this list */
Recursively find all AuthenticationExecutionModel from specified flow or all it's subflows
deepFindAuthenticationExecutions
{ "repo_name": "thomasdarimont/keycloak", "path": "server-spi-private/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java", "license": "apache-2.0", "size": 29040 }
[ "java.util.List", "org.keycloak.models.AuthenticationExecutionModel", "org.keycloak.models.AuthenticationFlowModel", "org.keycloak.models.RealmModel" ]
import java.util.List; import org.keycloak.models.AuthenticationExecutionModel; import org.keycloak.models.AuthenticationFlowModel; import org.keycloak.models.RealmModel;
import java.util.*; import org.keycloak.models.*;
[ "java.util", "org.keycloak.models" ]
java.util; org.keycloak.models;
2,758,892
static boolean isControlStructureCodeBlock(Node parent, Node n) { switch (parent.getType()) { case Token.FOR: case Token.WHILE: case Token.LABEL: case Token.WITH: return parent.getLastChild() == n; case Token.DO: return parent.getFirstChild() == n; case Token.IF: return parent.getFirstChild() != n; case Token.TRY: return parent.getFirstChild() == n || parent.getLastChild() == n; case Token.CATCH: return parent.getLastChild() == n; case Token.SWITCH: case Token.CASE: return parent.getFirstChild() != n; case Token.DEFAULT: return true; default: Preconditions.checkState(isControlStructure(parent)); return false; } }
static boolean isControlStructureCodeBlock(Node parent, Node n) { switch (parent.getType()) { case Token.FOR: case Token.WHILE: case Token.LABEL: case Token.WITH: return parent.getLastChild() == n; case Token.DO: return parent.getFirstChild() == n; case Token.IF: return parent.getFirstChild() != n; case Token.TRY: return parent.getFirstChild() == n parent.getLastChild() == n; case Token.CATCH: return parent.getLastChild() == n; case Token.SWITCH: case Token.CASE: return parent.getFirstChild() != n; case Token.DEFAULT: return true; default: Preconditions.checkState(isControlStructure(parent)); return false; } }
/** * Determines whether the given node is code node for FOR, DO, * WHILE, WITH, or IF node. */
Determines whether the given node is code node for FOR, DO, WHILE, WITH, or IF node
isControlStructureCodeBlock
{ "repo_name": "007slm/kissy", "path": "tools/module-compiler/src/com/google/javascript/jscomp/NodeUtil.java", "license": "mit", "size": 77263 }
[ "com.google.common.base.Preconditions", "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token" ]
import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token;
import com.google.common.base.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
2,186,533
@Override public final ServletContext getServletContext() { return (getServletConfig() != null ? getServletConfig().getServletContext() : null); }
final ServletContext function() { return (getServletConfig() != null ? getServletConfig().getServletContext() : null); }
/** * Overridden method that simply returns {@code null} when no * ServletConfig set yet. * @see #getServletConfig() */
Overridden method that simply returns null when no ServletConfig set yet
getServletContext
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.webmvc/org/springframework/web/servlet/HttpServletBean.java", "license": "mit", "size": 9272 }
[ "javax.servlet.ServletContext" ]
import javax.servlet.ServletContext;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,649,382
public OSMetrics fetchOSMetrics() { OSMetrics metrics = null; try { long maxFileDescriptorCount = 0; long openFileDescriptorCount = 0; long processCpuTime = 0; long committedVirtualMemorySize = 0; long totalPhysicalMemorySize = 0; long freePhysicalMemorySize = 0; long totalSwapSpaceSize = 0; long freeSwapSpaceSize = 0; String name = osBean.getName(); String version = osBean.getVersion(); String arch = osBean.getArch(); int availableProcessors = osBean.getAvailableProcessors(); double systemLoadAverage = osBean.getSystemLoadAverage(); openFileDescriptorCount = getVMStatistic( StatsKey.VM_STATS_OPEN_FDS).longValue(); processCpuTime = getVMStatistic(StatsKey.VM_PROCESS_CPU_TIME) .longValue(); try { maxFileDescriptorCount = (Long) mbeanServer.getAttribute(osObjectName, "MaxFileDescriptorCount"); } catch (Exception e) { maxFileDescriptorCount = -1; } try { committedVirtualMemorySize = (Long) mbeanServer.getAttribute( osObjectName, "CommittedVirtualMemorySize"); } catch (Exception e) { committedVirtualMemorySize = -1; } //If Linux System type exists if (PureJavaMode.osStatsAreAvailable() && HostStatHelper.isLinux() && systemStat != null) { try { totalPhysicalMemorySize = systemStat.get( StatsKey.LINUX_SYSTEM_PHYSICAL_MEMORY).longValue(); } catch (Exception e) { totalPhysicalMemorySize = -1; } try { freePhysicalMemorySize = systemStat.get( StatsKey.LINUX_SYSTEM_FREE_MEMORY).longValue(); } catch (Exception e) { freePhysicalMemorySize = -1; } try { totalSwapSpaceSize = systemStat.get( StatsKey.LINUX_SYSTEM_TOTAL_SWAP_SIZE).longValue(); } catch (Exception e) { totalSwapSpaceSize = -1; } try { freeSwapSpaceSize = systemStat.get( StatsKey.LINUX_SYSTEM_FREE_SWAP_SIZE).longValue(); } catch (Exception e) { freeSwapSpaceSize = -1; } } else { totalPhysicalMemorySize = -1; freePhysicalMemorySize = -1; totalSwapSpaceSize = -1; freeSwapSpaceSize = -1; } metrics = new OSMetrics(maxFileDescriptorCount, openFileDescriptorCount, processCpuTime, committedVirtualMemorySize, totalPhysicalMemorySize, freePhysicalMemorySize, totalSwapSpaceSize, freeSwapSpaceSize, name, version, arch, availableProcessors, systemLoadAverage); } catch (Exception ex) { if(logger.isTraceEnabled()){ logger.trace(ex.getMessage(), ex); } } return metrics; }
OSMetrics function() { OSMetrics metrics = null; try { long maxFileDescriptorCount = 0; long openFileDescriptorCount = 0; long processCpuTime = 0; long committedVirtualMemorySize = 0; long totalPhysicalMemorySize = 0; long freePhysicalMemorySize = 0; long totalSwapSpaceSize = 0; long freeSwapSpaceSize = 0; String name = osBean.getName(); String version = osBean.getVersion(); String arch = osBean.getArch(); int availableProcessors = osBean.getAvailableProcessors(); double systemLoadAverage = osBean.getSystemLoadAverage(); openFileDescriptorCount = getVMStatistic( StatsKey.VM_STATS_OPEN_FDS).longValue(); processCpuTime = getVMStatistic(StatsKey.VM_PROCESS_CPU_TIME) .longValue(); try { maxFileDescriptorCount = (Long) mbeanServer.getAttribute(osObjectName, STR); } catch (Exception e) { maxFileDescriptorCount = -1; } try { committedVirtualMemorySize = (Long) mbeanServer.getAttribute( osObjectName, STR); } catch (Exception e) { committedVirtualMemorySize = -1; } if (PureJavaMode.osStatsAreAvailable() && HostStatHelper.isLinux() && systemStat != null) { try { totalPhysicalMemorySize = systemStat.get( StatsKey.LINUX_SYSTEM_PHYSICAL_MEMORY).longValue(); } catch (Exception e) { totalPhysicalMemorySize = -1; } try { freePhysicalMemorySize = systemStat.get( StatsKey.LINUX_SYSTEM_FREE_MEMORY).longValue(); } catch (Exception e) { freePhysicalMemorySize = -1; } try { totalSwapSpaceSize = systemStat.get( StatsKey.LINUX_SYSTEM_TOTAL_SWAP_SIZE).longValue(); } catch (Exception e) { totalSwapSpaceSize = -1; } try { freeSwapSpaceSize = systemStat.get( StatsKey.LINUX_SYSTEM_FREE_SWAP_SIZE).longValue(); } catch (Exception e) { freeSwapSpaceSize = -1; } } else { totalPhysicalMemorySize = -1; freePhysicalMemorySize = -1; totalSwapSpaceSize = -1; freeSwapSpaceSize = -1; } metrics = new OSMetrics(maxFileDescriptorCount, openFileDescriptorCount, processCpuTime, committedVirtualMemorySize, totalPhysicalMemorySize, freePhysicalMemorySize, totalSwapSpaceSize, freeSwapSpaceSize, name, version, arch, availableProcessors, systemLoadAverage); } catch (Exception ex) { if(logger.isTraceEnabled()){ logger.trace(ex.getMessage(), ex); } } return metrics; }
/** * All OS metrics are not present in * java.lang.management.OperatingSystemMXBean It has to be cast to * com.sun.management.OperatingSystemMXBean. To avoid the cast using dynamic * call so that Java platform will take care of the details in a native * manner; * * @return Some basic OS metrics at the particular instance */
All OS metrics are not present in java.lang.management.OperatingSystemMXBean It has to be cast to com.sun.management.OperatingSystemMXBean. To avoid the cast using dynamic call so that Java platform will take care of the details in a native manner
fetchOSMetrics
{ "repo_name": "robertgeiger/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/beans/MemberMBeanBridge.java", "license": "apache-2.0", "size": 59320 }
[ "com.gemstone.gemfire.internal.HostStatHelper", "com.gemstone.gemfire.internal.PureJavaMode", "com.gemstone.gemfire.management.OSMetrics", "com.gemstone.gemfire.management.internal.beans.stats.StatsKey" ]
import com.gemstone.gemfire.internal.HostStatHelper; import com.gemstone.gemfire.internal.PureJavaMode; import com.gemstone.gemfire.management.OSMetrics; import com.gemstone.gemfire.management.internal.beans.stats.StatsKey;
import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.management.*; import com.gemstone.gemfire.management.internal.beans.stats.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
709,373
boolean removeViewIfHidden(View view) { final int index = mCallback.indexOfChild(view); if (index == -1) { if (mHiddenViews.remove(view) && DEBUG) { throw new IllegalStateException("view is in hidden list but not in view group"); } return true; } if (mBucket.get(index)) { mBucket.remove(index); mCallback.removeViewAt(index); if (!mHiddenViews.remove(view) && DEBUG) { throw new IllegalStateException( "removed a hidden view but it is not in hidden views list"); } return true; } return false; } static class Bucket { final static int BITS_PER_WORD = Long.SIZE; final static long LAST_BIT = 1L << (Long.SIZE - 1); long mData = 0; Bucket next;
boolean removeViewIfHidden(View view) { final int index = mCallback.indexOfChild(view); if (index == -1) { if (mHiddenViews.remove(view) && DEBUG) { throw new IllegalStateException(STR); } return true; } if (mBucket.get(index)) { mBucket.remove(index); mCallback.removeViewAt(index); if (!mHiddenViews.remove(view) && DEBUG) { throw new IllegalStateException( STR); } return true; } return false; } static class Bucket { final static int BITS_PER_WORD = Long.SIZE; final static long LAST_BIT = 1L << (Long.SIZE - 1); long mData = 0; Bucket next;
/** * Removes a view from the ViewGroup if it is hidden. * * @param view The view to remove. * @return True if the View is found and it is hidden. False otherwise. */
Removes a view from the ViewGroup if it is hidden
removeViewIfHidden
{ "repo_name": "kingargyle/adt-leanback-support", "path": "recyclerview-v7/src/main/java/android/support/v7/widget/ChildHelper.java", "license": "apache-2.0", "size": 15118 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,505,338
private static void throwIgniteCheckedException(IgniteLogger log, boolean fail, String msg) throws IgniteCheckedException { if (fail) throw new IgniteCheckedException(msg + " Fix cache configuration or set system property -D" + IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true."); else { assert log != null; U.warn(log, msg); } }
static void function(IgniteLogger log, boolean fail, String msg) throws IgniteCheckedException { if (fail) throw new IgniteCheckedException(msg + STR + IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + STR); else { assert log != null; U.warn(log, msg); } }
/** * If -DIGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK=true then output message to log else throw IgniteCheckedException. * * @param log Logger used to log warning message (used only if fail flag is not set). * @param fail If true throws IgniteCheckedException in case of attribute values mismatch, otherwise logs warning. * @param msg Message to output. * @throws IgniteCheckedException */
If -DIGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK=true then output message to log else throw IgniteCheckedException
throwIgniteCheckedException
{ "repo_name": "andrey-kuznetsov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java", "license": "apache-2.0", "size": 75590 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.IgniteLogger", "org.apache.ignite.internal.util.typedef.internal.U" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
807,654
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Redirection if HTTP verbs not used : String action = request.getParameter("action"); DAOFactory daoFactory = (DAOFactory)request.getServletContext() .getAttribute("SQLPLUS_CLIENT"); BookDAO bookDao = daoFactory.getBookDAO(); if (action != null && !action.equals("get")) { if (action.equals("post")) { doPost(request, response); try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher("./WEB-INF/pages/book_get_all.jsp") .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } } else if (action.equals("delete")) { doDelete(request, response); try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher("./WEB-INF/pages/book_get_all.jsp") .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } return; } else if (action.equals("put")) { doPut(request, response); try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher("./WEB-INF/pages/book_get_all.jsp") .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } return; } else { // renvoi vers une page d'erreur controleurErreur.jsp } } // GET : String view = request.getParameter("view"); if(view != null){ if(view.equals("update")){ try { // TODO : test the user input valididty : Book book = bookDao.readBook(Integer.parseInt((String)request.getParameter("id"))); request.setAttribute("book", book); request.getRequestDispatcher("./WEB-INF/pages/book_update.jsp") .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } } else if(view.equals("delete")){ try { Book book = bookDao.readBook(Integer.parseInt((String)request.getParameter("id"))); request.setAttribute("book", book); request.getRequestDispatcher("./WEB-INF/pages/book_delete.jsp") .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } } else if(view.equals("create")){ request.getRequestDispatcher("./WEB-INF/pages/book_add.jsp") .forward(request, response); return; } else { // error } } // By default GET all: try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher("./WEB-INF/pages/book_get_all.jsp") .forward(request, response); } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter(STR); DAOFactory daoFactory = (DAOFactory)request.getServletContext() .getAttribute(STR); BookDAO bookDao = daoFactory.getBookDAO(); if (action != null && !action.equals("get")) { if (action.equals("post")) { doPost(request, response); try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher(STR) .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } } else if (action.equals(STR)) { doDelete(request, response); try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher(STR) .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } return; } else if (action.equals("put")) { doPut(request, response); try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher(STR) .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } return; } else { } } String view = request.getParameter("view"); if(view != null){ if(view.equals(STR)){ try { Book book = bookDao.readBook(Integer.parseInt((String)request.getParameter("id"))); request.setAttribute("book", book); request.getRequestDispatcher(STR) .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } } else if(view.equals(STR)){ try { Book book = bookDao.readBook(Integer.parseInt((String)request.getParameter("id"))); request.setAttribute("book", book); request.getRequestDispatcher(STR) .forward(request, response); return; } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } } else if(view.equals(STR)){ request.getRequestDispatcher(STR) .forward(request, response); return; } else { } } try { List<Book> books = bookDao.readAllBook(); request.setAttribute("books", books); request.getRequestDispatcher(STR) .forward(request, response); } catch (DAOException ex) { Logger.getLogger(BookServlet.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>GET</code> method
doGet
{ "repo_name": "didjoman/JavaEE_school_training", "path": "src/main/java/fr/ensimag/biblio/controllers/BookServlet.java", "license": "gpl-3.0", "size": 8328 }
[ "fr.ensimag.biblio.dao.BookDAO", "fr.ensimag.biblio.dao.DAOException", "fr.ensimag.biblio.dao.DAOFactory", "fr.ensimag.biblio.models.Book", "java.io.IOException", "java.util.List", "java.util.logging.Level", "java.util.logging.Logger", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import fr.ensimag.biblio.dao.BookDAO; import fr.ensimag.biblio.dao.DAOException; import fr.ensimag.biblio.dao.DAOFactory; import fr.ensimag.biblio.models.Book; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import fr.ensimag.biblio.dao.*; import fr.ensimag.biblio.models.*; import java.io.*; import java.util.*; import java.util.logging.*; import javax.servlet.*; import javax.servlet.http.*;
[ "fr.ensimag.biblio", "java.io", "java.util", "javax.servlet" ]
fr.ensimag.biblio; java.io; java.util; javax.servlet;
359,751
public Map<String, String> getProperties() { return this.properties; }
Map<String, String> function() { return this.properties; }
/** * Get the properties property: Application properties are user-defined strings that can be added to the message. * These fields are optional. * * @return the properties value. */
Get the properties property: Application properties are user-defined strings that can be added to the message. These fields are optional
getProperties
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/eventgrid/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/systemevents/DeviceTelemetryEventProperties.java", "license": "mit", "size": 3010 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,444,823
private BreakpointStatus getBreakpointStatus(final int row) { final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, row); final BreakpointManager manager = breakpoint.first().getBreakpointManager(); final int breakpointIndex = breakpoint.second(); return manager.getBreakpointStatus(BreakpointType.REGULAR, breakpointIndex); }
BreakpointStatus function(final int row) { final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, row); final BreakpointManager manager = breakpoint.first().getBreakpointManager(); final int breakpointIndex = breakpoint.second(); return manager.getBreakpointStatus(BreakpointType.REGULAR, breakpointIndex); }
/** * Determines the breakpoint status of the breakpoint shown in a given row. * * @param row The row where the breakpoint is shown. * * @return The breakpoint status of the breakpoint shown in the given row. */
Determines the breakpoint status of the breakpoint shown in a given row
getBreakpointStatus
{ "repo_name": "AmesianX/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/Gui/Debug/BreakpointTable/CBreakpointTableModel.java", "license": "apache-2.0", "size": 10847 }
[ "com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger", "com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager", "com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.BreakpointStatus", "com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.BreakpointType", "com.google.security.zynamics.zylib.general.Pair" ]
import com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger; import com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager; import com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.BreakpointStatus; import com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.BreakpointType; import com.google.security.zynamics.zylib.general.Pair;
import com.google.security.zynamics.binnavi.debug.debugger.interfaces.*; import com.google.security.zynamics.binnavi.debug.models.breakpoints.*; import com.google.security.zynamics.binnavi.debug.models.breakpoints.enums.*; import com.google.security.zynamics.zylib.general.*;
[ "com.google.security" ]
com.google.security;
209,985
public static FudgeMsg uriSearchBulkData( final Set<ExternalIdBundle> identifierSet, final String dataSource, final String dataProvider, final String dataField, final LocalDate start, final boolean includeStart, final LocalDate end, final boolean includeEnd) { final FudgeSerializer serializationContext = new FudgeSerializer(OpenGammaFudgeContext.getInstance()); final MutableFudgeMsg msg = serializationContext.newMessage(); serializationContext.addToMessage(msg, "id", null, identifierSet); serializationContext.addToMessage(msg, "dataSource", null, dataSource); serializationContext.addToMessage(msg, "dataProvider", null, dataProvider); serializationContext.addToMessage(msg, "dataField", null, dataField); serializationContext.addToMessage(msg, "start", null, start); serializationContext.addToMessage(msg, "includeStart", null, includeStart); serializationContext.addToMessage(msg, "end", null, end); serializationContext.addToMessage(msg, "includeEnd", null, includeEnd); return msg; }
static FudgeMsg function( final Set<ExternalIdBundle> identifierSet, final String dataSource, final String dataProvider, final String dataField, final LocalDate start, final boolean includeStart, final LocalDate end, final boolean includeEnd) { final FudgeSerializer serializationContext = new FudgeSerializer(OpenGammaFudgeContext.getInstance()); final MutableFudgeMsg msg = serializationContext.newMessage(); serializationContext.addToMessage(msg, "id", null, identifierSet); serializationContext.addToMessage(msg, STR, null, dataSource); serializationContext.addToMessage(msg, STR, null, dataProvider); serializationContext.addToMessage(msg, STR, null, dataField); serializationContext.addToMessage(msg, "start", null, start); serializationContext.addToMessage(msg, STR, null, includeStart); serializationContext.addToMessage(msg, "end", null, end); serializationContext.addToMessage(msg, STR, null, includeEnd); return msg; }
/** * Creates a Fudge message that wraps the fields for use in a bulk query. * * @param identifierSet * the set of identifiers * @param dataSource * the data source * @param dataProvider * the data provider * @param dataField * the data field * @param start * the start date * @param includeStart * true to include the start date in the time series * @param end * the end date * @param includeEnd * true to include the end date in the time series * @return a Fudge message */
Creates a Fudge message that wraps the fields for use in a bulk query
uriSearchBulkData
{ "repo_name": "McLeodMoores/starling", "path": "projects/core-rest-client/src/main/java/com/opengamma/core/historicaltimeseries/impl/DataHistoricalTimeSeriesSourceUris.java", "license": "apache-2.0", "size": 17307 }
[ "com.opengamma.id.ExternalIdBundle", "com.opengamma.util.fudgemsg.OpenGammaFudgeContext", "java.util.Set", "org.fudgemsg.FudgeMsg", "org.fudgemsg.MutableFudgeMsg", "org.fudgemsg.mapping.FudgeSerializer", "org.threeten.bp.LocalDate" ]
import com.opengamma.id.ExternalIdBundle; import com.opengamma.util.fudgemsg.OpenGammaFudgeContext; import java.util.Set; import org.fudgemsg.FudgeMsg; import org.fudgemsg.MutableFudgeMsg; import org.fudgemsg.mapping.FudgeSerializer; import org.threeten.bp.LocalDate;
import com.opengamma.id.*; import com.opengamma.util.fudgemsg.*; import java.util.*; import org.fudgemsg.*; import org.fudgemsg.mapping.*; import org.threeten.bp.*;
[ "com.opengamma.id", "com.opengamma.util", "java.util", "org.fudgemsg", "org.fudgemsg.mapping", "org.threeten.bp" ]
com.opengamma.id; com.opengamma.util; java.util; org.fudgemsg; org.fudgemsg.mapping; org.threeten.bp;
963,398
@Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addStatePropertyDescriptor(object); } return itemPropertyDescriptors; }
List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addStatePropertyDescriptor(object); } return itemPropertyDescriptors; }
/** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the property descriptors for the adapted class.
getPropertyDescriptors
{ "repo_name": "nasa/OpenSPIFe", "path": "gov.nasa.ensemble.core.plan.resources/src/gov/nasa/ensemble/core/plan/resources/member/provider/StateResourceItemProvider.java", "license": "apache-2.0", "size": 6193 }
[ "java.util.List", "org.eclipse.emf.edit.provider.IItemPropertyDescriptor" ]
import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import java.util.*; import org.eclipse.emf.edit.provider.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
2,309,017
public Map getExtraVariables() { return extraVariables; }
Map function() { return extraVariables; }
/** * Get the extra variables defined with this output handler. * * @return a <tt>Map</tt> of variables. The map is keyed by variable * name, and each entry is a variable value. The <tt>Map</tt> * will be empty, but never null, if there are no extra variables * for this output handler. */
Get the extra variables defined with this output handler
getExtraVariables
{ "repo_name": "bmc/curn", "path": "src/main/java/org/clapper/curn/ConfiguredOutputHandler.java", "license": "bsd-3-clause", "size": 7671 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
877,971
protected void showSplashScreen() { mSplashDialog = new Dialog(this, R.style.splash); mSplashDialog.setContentView(R.layout.splash); mSplashDialog.setCancelable(false); mSplashDialog.show();
void function() { mSplashDialog = new Dialog(this, R.style.splash); mSplashDialog.setContentView(R.layout.splash); mSplashDialog.setCancelable(false); mSplashDialog.show();
/** * Shows the splash screen over the full Activity */
Shows the splash screen over the full Activity
showSplashScreen
{ "repo_name": "maxfierke/sandwichroulette", "path": "src/com/maxfierke/sandwichroulette/SandwichRoulette.java", "license": "gpl-3.0", "size": 18126 }
[ "android.app.Dialog" ]
import android.app.Dialog;
import android.app.*;
[ "android.app" ]
android.app;
2,527,414
public void writePacketData(DataOutput par1DataOutput) throws IOException { par1DataOutput.writeInt(this.field_111006_b); par1DataOutput.writeInt(this.vehicleEntityId); par1DataOutput.writeByte(this.field_111007_a); }
void function(DataOutput par1DataOutput) throws IOException { par1DataOutput.writeInt(this.field_111006_b); par1DataOutput.writeInt(this.vehicleEntityId); par1DataOutput.writeByte(this.field_111007_a); }
/** * Abstract. Writes the raw packet data to the data stream. */
Abstract. Writes the raw packet data to the data stream
writePacketData
{ "repo_name": "Neil5043/Minetweak", "path": "src/main/java/net/minecraft/src/Packet39AttachEntity.java", "license": "lgpl-3.0", "size": 2097 }
[ "java.io.DataOutput", "java.io.IOException" ]
import java.io.DataOutput; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
979,865
@Test public void testT1RV4D4_T1LV9D3() { test_id = getTestId("T1RV4D4", "T1LV9D3", "223"); String src = selectTRVD("T1RV4D4"); String dest = selectTLVD("T1LV9D3"); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ReturnFailure2, checkResult_ReturnFailure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } }
void function() { test_id = getTestId(STR, STR, "223"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ReturnFailure2, checkResult_ReturnFailure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } }
/** * Perform the test for the given matrix column (T1RV4D4) and row (T1LV9D3). * */
Perform the test for the given matrix column (T1RV4D4) and row (T1LV9D3)
testT1RV4D4_T1LV9D3
{ "repo_name": "rmulvey/bptest", "path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_8_Generics.java", "license": "apache-2.0", "size": 153074 }
[ "org.xtuml.bp.ui.graphics.editor.GraphicalEditor" ]
import org.xtuml.bp.ui.graphics.editor.GraphicalEditor;
import org.xtuml.bp.ui.graphics.editor.*;
[ "org.xtuml.bp" ]
org.xtuml.bp;
2,761,135
EClass getSpecial_Expense_DS();
EClass getSpecial_Expense_DS();
/** * Returns the meta object for class '{@link TaxationWithRoot.Special_Expense_DS <em>Special Expense DS</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Special Expense DS</em>'. * @see TaxationWithRoot.Special_Expense_DS * @generated */
Returns the meta object for class '<code>TaxationWithRoot.Special_Expense_DS Special Expense DS</code>'.
getSpecial_Expense_DS
{ "repo_name": "viatra/VIATRA-Generator", "path": "Tests/MODELS2020-CaseStudies/case.study.pledge.model/src/TaxationWithRoot/TaxationPackage.java", "license": "epl-1.0", "size": 295635 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,233,178
public UpdateTemplatePermissionsOptions isFeatured(boolean isFeatured) { this.queryParameters.replaceValues("isfeatured", ImmutableSet.of(isFeatured + "")); return this; }
UpdateTemplatePermissionsOptions function(boolean isFeatured) { this.queryParameters.replaceValues(STR, ImmutableSet.of(isFeatured + "")); return this; }
/** * true for featured template/iso, false otherwise */
true for featured template/iso, false otherwise
isFeatured
{ "repo_name": "yanzhijun/jclouds-aliyun", "path": "apis/cloudstack/src/main/java/org/jclouds/cloudstack/options/UpdateTemplatePermissionsOptions.java", "license": "apache-2.0", "size": 4404 }
[ "com.google.common.collect.ImmutableSet" ]
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
558,105
byte getSunlight(Vector3f pos);
byte getSunlight(Vector3f pos);
/** * Returns the sunlight value at the given position. * * @param pos The position * @return The block value at the given position */
Returns the sunlight value at the given position
getSunlight
{ "repo_name": "leelib/Terasology", "path": "engine/src/main/java/org/terasology/world/WorldProvider.java", "license": "apache-2.0", "size": 3107 }
[ "org.terasology.math.geom.Vector3f" ]
import org.terasology.math.geom.Vector3f;
import org.terasology.math.geom.*;
[ "org.terasology.math" ]
org.terasology.math;
934,936
@AndroidOnly("RI doesn't throw the specified IAE") public void test_addHandshakeCompletedListener() throws IOException { SSLSocket ssl = getSSLSocket(); HandshakeCompletedListener ls = new HandshakeCL(); try { ssl.addHandshakeCompletedListener(null); fail(); } catch (IllegalArgumentException expected) { } ssl.addHandshakeCompletedListener(ls); ssl.close(); }
@AndroidOnly(STR) void function() throws IOException { SSLSocket ssl = getSSLSocket(); HandshakeCompletedListener ls = new HandshakeCL(); try { ssl.addHandshakeCompletedListener(null); fail(); } catch (IllegalArgumentException expected) { } ssl.addHandshakeCompletedListener(ls); ssl.close(); }
/** * javax.net.ssl.SSLSocket#addHandshakeCompletedListener(HandshakeCompletedListener listener) */
javax.net.ssl.SSLSocket#addHandshakeCompletedListener(HandshakeCompletedListener listener)
test_addHandshakeCompletedListener
{ "repo_name": "rex-xxx/mt6572_x201", "path": "libcore/luni/src/test/java/tests/api/javax/net/ssl/SSLSocketTest.java", "license": "gpl-2.0", "size": 24839 }
[ "java.io.IOException", "javax.net.ssl.HandshakeCompletedListener", "javax.net.ssl.SSLSocket" ]
import java.io.IOException; import javax.net.ssl.HandshakeCompletedListener; import javax.net.ssl.SSLSocket;
import java.io.*; import javax.net.ssl.*;
[ "java.io", "javax.net" ]
java.io; javax.net;
2,781,968