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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Test void testPreviousClearBit() { assertThat(ImmutableBitSet.of().previousClearBit(10), equalTo(10)); assertThat(ImmutableBitSet.of().previousClearBit(0), equalTo(0)); assertThat(ImmutableBitSet.of().previousClearBit(-1), equalTo(-1)); try { final int actual = ImmutableBitSet.of().previousClearBit(-2); fail("expected exception, got " + actual); } catch (IndexOutOfBoundsException e) { // ok } assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(4), equalTo(2)); assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(3), equalTo(2)); assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(2), equalTo(2)); assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(1), equalTo(-1)); assertThat(ImmutableBitSet.of(1, 3, 4).previousClearBit(1), equalTo(0)); }
@Test void testPreviousClearBit() { assertThat(ImmutableBitSet.of().previousClearBit(10), equalTo(10)); assertThat(ImmutableBitSet.of().previousClearBit(0), equalTo(0)); assertThat(ImmutableBitSet.of().previousClearBit(-1), equalTo(-1)); try { final int actual = ImmutableBitSet.of().previousClearBit(-2); fail(STR + actual); } catch (IndexOutOfBoundsException e) { } assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(4), equalTo(2)); assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(3), equalTo(2)); assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(2), equalTo(2)); assertThat(ImmutableBitSet.of(0, 1, 3, 4).previousClearBit(1), equalTo(-1)); assertThat(ImmutableBitSet.of(1, 3, 4).previousClearBit(1), equalTo(0)); }
/** * Tests the method * {@link org.apache.calcite.util.ImmutableBitSet#previousClearBit(int)}. */
Tests the method <code>org.apache.calcite.util.ImmutableBitSet#previousClearBit(int)</code>
testPreviousClearBit
{ "repo_name": "julianhyde/calcite", "path": "core/src/test/java/org/apache/calcite/util/ImmutableBitSetTest.java", "license": "apache-2.0", "size": 24286 }
[ "org.hamcrest.CoreMatchers", "org.hamcrest.MatcherAssert", "org.junit.jupiter.api.Assertions", "org.junit.jupiter.api.Test" ]
import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test;
import org.hamcrest.*; import org.junit.jupiter.api.*;
[ "org.hamcrest", "org.junit.jupiter" ]
org.hamcrest; org.junit.jupiter;
1,267,408
public Collection findWithBalance(Integer userId) { UserDTO user = new UserDAS().find(userId); Criteria criteria = getSession().createCriteria(PaymentDTO.class); criteria.add(Restrictions.eq("baseUser", user)); criteria.add(Restrictions.ge("balance", Constants.BIGDECIMAL_ONE_CENT)); criteria.add(Restrictions.eq("isRefund", 0)); criteria.add(Restrictions.eq("isPreauth", 0)); criteria.add(Restrictions.eq("deleted", 0)); return criteria.list(); }
Collection function(Integer userId) { UserDTO user = new UserDAS().find(userId); Criteria criteria = getSession().createCriteria(PaymentDTO.class); criteria.add(Restrictions.eq(STR, user)); criteria.add(Restrictions.ge(STR, Constants.BIGDECIMAL_ONE_CENT)); criteria.add(Restrictions.eq(STR, 0)); criteria.add(Restrictions.eq(STR, 0)); criteria.add(Restrictions.eq(STR, 0)); return criteria.list(); }
/** * * query="SELECT OBJECT(p) FROM payment p WHERE p.userId = ?1 AND * p.balance >= 0.01 AND p.isRefund = 0 AND p.isPreauth = 0 AND p.deleted = * 0" * * @param userId * @return */
query="SELECT OBJECT(p) FROM payment p WHERE p.userId = ?1 AND p.balance >= 0.01 AND p.isRefund = 0 AND p.isPreauth = 0 AND p.deleted = 0"
findWithBalance
{ "repo_name": "liquidJbilling/LT-Jbilling-MsgQ-3.1", "path": "src/java/com/sapienter/jbilling/server/payment/db/PaymentDAS.java", "license": "agpl-3.0", "size": 12479 }
[ "com.sapienter.jbilling.common.Constants", "com.sapienter.jbilling.server.user.db.UserDAS", "com.sapienter.jbilling.server.user.db.UserDTO", "java.util.Collection", "org.hibernate.Criteria", "org.hibernate.criterion.Restrictions" ]
import com.sapienter.jbilling.common.Constants; import com.sapienter.jbilling.server.user.db.UserDAS; import com.sapienter.jbilling.server.user.db.UserDTO; import java.util.Collection; import org.hibernate.Criteria; import org.hibernate.criterion.Restrictions;
import com.sapienter.jbilling.common.*; import com.sapienter.jbilling.server.user.db.*; import java.util.*; import org.hibernate.*; import org.hibernate.criterion.*;
[ "com.sapienter.jbilling", "java.util", "org.hibernate", "org.hibernate.criterion" ]
com.sapienter.jbilling; java.util; org.hibernate; org.hibernate.criterion;
59,950
ExecutorService getExecutor();
ExecutorService getExecutor();
/** * Get the executor service used for the controller client. * * @return the executor service */
Get the executor service used for the controller client
getExecutor
{ "repo_name": "jamezp/wildfly-core", "path": "controller-client/src/main/java/org/jboss/as/controller/client/ModelControllerClientConfiguration.java", "license": "lgpl-2.1", "size": 19053 }
[ "java.util.concurrent.ExecutorService" ]
import java.util.concurrent.ExecutorService;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,909,233
static <R, C, V> Cell<R, C, V> cellOf(R rowKey, C columnKey, V value) { return Tables.immutableCell(checkNotNull(rowKey), checkNotNull(columnKey), checkNotNull(value)); } public static final class Builder<R, C, V> { private final List<Cell<R, C, V>> cells = Lists.newArrayList(); private Comparator<? super R> rowComparator; private Comparator<? super C> columnComparator; public Builder() {}
static <R, C, V> Cell<R, C, V> cellOf(R rowKey, C columnKey, V value) { return Tables.immutableCell(checkNotNull(rowKey), checkNotNull(columnKey), checkNotNull(value)); } public static final class Builder<R, C, V> { private final List<Cell<R, C, V>> cells = Lists.newArrayList(); private Comparator<? super R> rowComparator; private Comparator<? super C> columnComparator; public Builder() {}
/** * Verifies that {@code rowKey}, {@code columnKey} and {@code value} are * non-null, and returns a new entry with those values. */
Verifies that rowKey, columnKey and value are non-null, and returns a new entry with those values
cellOf
{ "repo_name": "10045125/guava", "path": "guava/src/com/google/common/collect/ImmutableTable.java", "license": "apache-2.0", "size": 12497 }
[ "com.google.common.base.Preconditions", "java.util.Comparator", "java.util.List" ]
import com.google.common.base.Preconditions; import java.util.Comparator; import java.util.List;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,563,122
@RequiresSession public List<HostVersionEntity> findByHost(String hostName) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get() .createNamedQuery("hostVersionByHostname", HostVersionEntity.class); query.setParameter("hostName", hostName); return daoUtils.selectList(query); }
List<HostVersionEntity> function(String hostName) { final TypedQuery<HostVersionEntity> query = entityManagerProvider.get() .createNamedQuery(STR, HostVersionEntity.class); query.setParameter(STR, hostName); return daoUtils.selectList(query); }
/** * Retrieve all of the host versions for the given host name across all clusters. * * @param hostName FQDN of host * @return Return all of the host versions that match the criteria. */
Retrieve all of the host versions for the given host name across all clusters
findByHost
{ "repo_name": "zouzhberk/ambaridemo", "path": "demo-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java", "license": "apache-2.0", "size": 8435 }
[ "java.util.List", "javax.persistence.TypedQuery", "org.apache.ambari.server.orm.entities.HostVersionEntity" ]
import java.util.List; import javax.persistence.TypedQuery; import org.apache.ambari.server.orm.entities.HostVersionEntity;
import java.util.*; import javax.persistence.*; import org.apache.ambari.server.orm.entities.*;
[ "java.util", "javax.persistence", "org.apache.ambari" ]
java.util; javax.persistence; org.apache.ambari;
2,507,030
public synchronized void releaseXMLReader(XMLReader reader) { // If the reader that's being released is the cached reader // for this thread, remove it from the m_isUse list. ReaderWrapper rw = m_readers.get(); if (rw.reader == reader && reader != null) { m_inUse.remove(reader); } }
synchronized void function(XMLReader reader) { ReaderWrapper rw = m_readers.get(); if (rw.reader == reader && reader != null) { m_inUse.remove(reader); } }
/** * Mark the cached XMLReader as available. If the reader was not * actually in the cache, do nothing. * * @param reader The XMLReader that's being released. */
Mark the cached XMLReader as available. If the reader was not actually in the cache, do nothing
releaseXMLReader
{ "repo_name": "JetBrains/jdk8u_jaxp", "path": "src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java", "license": "gpl-2.0", "size": 7599 }
[ "org.xml.sax.XMLReader" ]
import org.xml.sax.XMLReader;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
2,128,666
public static Vector3f rotateVector(Vector3f vector, float degree, Plane rotationPlane) { double tempDegree = Math.toRadians(degree); rotationPlane.transformToHesseNormalForm(); // Creating a Matrix for rotating the Vector Matrix3f rotationMatrix = new Matrix3f(); rotationMatrix.m00 = (float) (rotationPlane.getNormal().x * rotationPlane.getNormal().x * (1 - Math.cos(tempDegree)) + Math.cos(tempDegree)); rotationMatrix.m01 = (float) (rotationPlane.getNormal().y * rotationPlane.getNormal().x * (1 - Math.cos(tempDegree)) + rotationPlane.getNormal().z * Math.sin(tempDegree)); rotationMatrix.m02 = (float) (rotationPlane.getNormal().z * rotationPlane.getNormal().x * (1 - Math.cos(tempDegree)) - rotationPlane.getNormal().y * Math.sin(tempDegree)); rotationMatrix.m10 = (float) (rotationPlane.getNormal().x * rotationPlane.getNormal().y * (1 - Math.cos(tempDegree)) - rotationPlane.getNormal().z * Math.sin(tempDegree)); rotationMatrix.m11 = (float) (rotationPlane.getNormal().y * rotationPlane.getNormal().y * (1 - Math.cos(tempDegree)) + Math.cos(tempDegree)); rotationMatrix.m12 = (float) (rotationPlane.getNormal().z * rotationPlane.getNormal().y * (1 - Math.cos(tempDegree)) + rotationPlane.getNormal().x * Math.sin(tempDegree)); rotationMatrix.m20 = (float) (rotationPlane.getNormal().x * rotationPlane.getNormal().z * (1 - Math.cos(tempDegree)) + rotationPlane.getNormal().y * Math.sin(tempDegree)); rotationMatrix.m21 = (float) (rotationPlane.getNormal().y * rotationPlane.getNormal().z * (1 - Math.cos(tempDegree)) - rotationPlane.getNormal().x * Math.sin(tempDegree)); rotationMatrix.m22 = (float) (rotationPlane.getNormal().z * rotationPlane.getNormal().z * (1 - Math.cos(tempDegree)) + Math.cos(tempDegree)); Vector3f temp = new Vector3f(vector); // adopt rotatoinMatrix on vector Matrix3f.transform(rotationMatrix, temp, vector); return vector; }
static Vector3f function(Vector3f vector, float degree, Plane rotationPlane) { double tempDegree = Math.toRadians(degree); rotationPlane.transformToHesseNormalForm(); Matrix3f rotationMatrix = new Matrix3f(); rotationMatrix.m00 = (float) (rotationPlane.getNormal().x * rotationPlane.getNormal().x * (1 - Math.cos(tempDegree)) + Math.cos(tempDegree)); rotationMatrix.m01 = (float) (rotationPlane.getNormal().y * rotationPlane.getNormal().x * (1 - Math.cos(tempDegree)) + rotationPlane.getNormal().z * Math.sin(tempDegree)); rotationMatrix.m02 = (float) (rotationPlane.getNormal().z * rotationPlane.getNormal().x * (1 - Math.cos(tempDegree)) - rotationPlane.getNormal().y * Math.sin(tempDegree)); rotationMatrix.m10 = (float) (rotationPlane.getNormal().x * rotationPlane.getNormal().y * (1 - Math.cos(tempDegree)) - rotationPlane.getNormal().z * Math.sin(tempDegree)); rotationMatrix.m11 = (float) (rotationPlane.getNormal().y * rotationPlane.getNormal().y * (1 - Math.cos(tempDegree)) + Math.cos(tempDegree)); rotationMatrix.m12 = (float) (rotationPlane.getNormal().z * rotationPlane.getNormal().y * (1 - Math.cos(tempDegree)) + rotationPlane.getNormal().x * Math.sin(tempDegree)); rotationMatrix.m20 = (float) (rotationPlane.getNormal().x * rotationPlane.getNormal().z * (1 - Math.cos(tempDegree)) + rotationPlane.getNormal().y * Math.sin(tempDegree)); rotationMatrix.m21 = (float) (rotationPlane.getNormal().y * rotationPlane.getNormal().z * (1 - Math.cos(tempDegree)) - rotationPlane.getNormal().x * Math.sin(tempDegree)); rotationMatrix.m22 = (float) (rotationPlane.getNormal().z * rotationPlane.getNormal().z * (1 - Math.cos(tempDegree)) + Math.cos(tempDegree)); Vector3f temp = new Vector3f(vector); Matrix3f.transform(rotationMatrix, temp, vector); return vector; }
/** * A method for rotating a vector in a plane (around its normal vector) about degree degree * * @param vector * the vector which should be rotated * @param degree * the degree about which the vector should be rotated * @param rotationPlane * the plane within the vector should be rotated */
A method for rotating a vector in a plane (around its normal vector) about degree degree
rotateVector
{ "repo_name": "Dakror/Tube", "path": "src/de/dakror/tube/util/math/MathHelper.java", "license": "apache-2.0", "size": 7616 }
[ "org.lwjgl.util.vector.Matrix3f", "org.lwjgl.util.vector.Vector3f" ]
import org.lwjgl.util.vector.Matrix3f; import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.*;
[ "org.lwjgl.util" ]
org.lwjgl.util;
1,202,979
public void shutdown() { try { producer.close(); // session is not not ours to close // session.close(); } catch (JMSException e) { log.error(e.toString(), e); } }
void function() { try { producer.close(); } catch (JMSException e) { log.error(e.toString(), e); } }
/** * Shutdown before destroying the producer. * */
Shutdown before destroying the producer
shutdown
{ "repo_name": "zlamalp/perun", "path": "perun-dispatcher/src/main/java/cz/metacentrum/perun/dispatcher/jms/EngineMessageProducer.java", "license": "bsd-2-clause", "size": 3189 }
[ "javax.jms.JMSException" ]
import javax.jms.JMSException;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,644,990
Arrays.fill(position, 0); Arrays.fill(dimensions, CSSConstants.UNDEFINED); direction = CSSDirection.LTR; }
Arrays.fill(position, 0); Arrays.fill(dimensions, CSSConstants.UNDEFINED); direction = CSSDirection.LTR; }
/** * This should always get called before calling {@link LayoutEngine#layoutNode(CSSNode, float)} */
This should always get called before calling <code>LayoutEngine#layoutNode(CSSNode, float)</code>
resetResult
{ "repo_name": "mozillo/react-native", "path": "ReactAndroid/src/main/java/com/facebook/csslayout/CSSLayout.java", "license": "bsd-3-clause", "size": 2127 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
2,200,322
public static String getText(URL url, Map parameters, String charset) throws IOException { BufferedReader reader = newReader(url, parameters, charset); return IOGroovyMethods.getText(reader); }
static String function(URL url, Map parameters, String charset) throws IOException { BufferedReader reader = newReader(url, parameters, charset); return IOGroovyMethods.getText(reader); }
/** * Read the data from this URL and return it as a String. The connection * stream is closed before this method returns. * * @param url URL to read content from * @param parameters connection parameters * @param charset opens the stream with a specified charset * @return the text from that URL * @throws IOException if an IOException occurs. * @see java.net.URLConnection#getInputStream() * @since 1.8.1 */
Read the data from this URL and return it as a String. The connection stream is closed before this method returns
getText
{ "repo_name": "paulk-asert/groovy", "path": "src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java", "license": "apache-2.0", "size": 119457 }
[ "java.io.BufferedReader", "java.io.IOException", "java.util.Map" ]
import java.io.BufferedReader; import java.io.IOException; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,598,790
public MessageInfo getMessageInfo();
MessageInfo function();
/** * Returns fault-tolerance infos piggybacked on this message * @return a MessageInfo object that contains fault-tolerance infos OR null * if the attached message has been sent by a non fault-tolerant object */
Returns fault-tolerance infos piggybacked on this message
getMessageInfo
{ "repo_name": "PaulKh/scale-proactive", "path": "src/Core/org/objectweb/proactive/core/body/message/Message.java", "license": "agpl-3.0", "size": 4471 }
[ "org.objectweb.proactive.core.body.ft.message.MessageInfo" ]
import org.objectweb.proactive.core.body.ft.message.MessageInfo;
import org.objectweb.proactive.core.body.ft.message.*;
[ "org.objectweb.proactive" ]
org.objectweb.proactive;
1,399,401
private void step() { // immediately stop if the server is no longer active if (!active) { timer.cancel(); return; } // Create the form, attaching meta FormEncodingBuilder formBuilder = new FormEncodingBuilder() .add("name", name) .add("current_players", Integer.toString(currentPlayers)) .add("max_players", Integer.toString(maxPlayers)) .add("password", password); attachMeta(formBuilder); // Create request Request request = new Request.Builder() .url(GameserverConfig.getConfig().getServerUrl() + GameserverConfig.URL_UPDATE_SERVER + GameserverConfig.getConfig().getGameAPIKey() + "/" + id) .post(formBuilder.build()) .build(); GameserverConfig.getConfig().getClient().newCall(request).enqueue(this); // reschedule the timer //timer.schedule(timerTask, GameserverConfig.getConfig().getUpdateRate()); }
void function() { if (!active) { timer.cancel(); return; } FormEncodingBuilder formBuilder = new FormEncodingBuilder() .add("name", name) .add(STR, Integer.toString(currentPlayers)) .add(STR, Integer.toString(maxPlayers)) .add(STR, password); attachMeta(formBuilder); Request request = new Request.Builder() .url(GameserverConfig.getConfig().getServerUrl() + GameserverConfig.URL_UPDATE_SERVER + GameserverConfig.getConfig().getGameAPIKey() + "/" + id) .post(formBuilder.build()) .build(); GameserverConfig.getConfig().getClient().newCall(request).enqueue(this); }
/** * The inner loop of the timer task. It will stop itself when the server is no longer active. */
The inner loop of the timer task. It will stop itself when the server is no longer active
step
{ "repo_name": "NickToony/gameserver-service-java", "path": "src/main/java/com/nicktoony/gameserver/service/host/Host.java", "license": "mit", "size": 9204 }
[ "com.nicktoony.gameserver.service.GameserverConfig", "com.squareup.okhttp.FormEncodingBuilder", "com.squareup.okhttp.Request" ]
import com.nicktoony.gameserver.service.GameserverConfig; import com.squareup.okhttp.FormEncodingBuilder; import com.squareup.okhttp.Request;
import com.nicktoony.gameserver.service.*; import com.squareup.okhttp.*;
[ "com.nicktoony.gameserver", "com.squareup.okhttp" ]
com.nicktoony.gameserver; com.squareup.okhttp;
342,692
public static boolean writeToSequenceFile(Map<String, List<Integer>> itemFeaturesMap, Path outputPath) throws IOException { Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); fs.mkdirs(outputPath.getParent()); long totalRecords = itemFeaturesMap.size(); SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, outputPath, Text.class, VectorWritable.class); try { String msg = "Now writing vectorized data in sequence file format: "; System.out.print(msg); Text itemWritable = new Text(); VectorWritable featuresWritable = new VectorWritable(); int doneRecords = 0; int prevPercentDone = 1; for (Map.Entry<String, List<Integer>> itemFeature : itemFeaturesMap.entrySet()) { int numfeatures = itemFeature.getValue().size(); itemWritable.set(itemFeature.getKey()); Vector featureVector = new SequentialAccessSparseVector(numfeatures); int i = 0; for (Integer feature : itemFeature.getValue()) { featureVector.setQuick(i++, feature); } featuresWritable.set(featureVector); writer.append(itemWritable, featuresWritable); // Update the progress double percentDone = ++doneRecords * 100.0 / totalRecords; if (percentDone > prevPercentDone) { System.out.print('\r' + msg + percentDone + "% " + (percentDone >= 100 ? "Completed\n" : "")); prevPercentDone++; } } } finally { Closeables.closeQuietly(writer); } return true; }
static boolean function(Map<String, List<Integer>> itemFeaturesMap, Path outputPath) throws IOException { Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); fs.mkdirs(outputPath.getParent()); long totalRecords = itemFeaturesMap.size(); SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, outputPath, Text.class, VectorWritable.class); try { String msg = STR; System.out.print(msg); Text itemWritable = new Text(); VectorWritable featuresWritable = new VectorWritable(); int doneRecords = 0; int prevPercentDone = 1; for (Map.Entry<String, List<Integer>> itemFeature : itemFeaturesMap.entrySet()) { int numfeatures = itemFeature.getValue().size(); itemWritable.set(itemFeature.getKey()); Vector featureVector = new SequentialAccessSparseVector(numfeatures); int i = 0; for (Integer feature : itemFeature.getValue()) { featureVector.setQuick(i++, feature); } featuresWritable.set(featureVector); writer.append(itemWritable, featuresWritable); double percentDone = ++doneRecords * 100.0 / totalRecords; if (percentDone > prevPercentDone) { System.out.print('\r' + msg + percentDone + STR + (percentDone >= 100 ? STR : "")); prevPercentDone++; } } } finally { Closeables.closeQuietly(writer); } return true; }
/** * Converts each record in (item,features) map into Mahout vector format and * writes it into sequencefile for minhash clustering */
Converts each record in (item,features) map into Mahout vector format and writes it into sequencefile for minhash clustering
writeToSequenceFile
{ "repo_name": "BigData-Lab-Frankfurt/HiBench-DSE", "path": "common/mahout-distribution-0.7-hadoop1/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java", "license": "apache-2.0", "size": 8101 }
[ "com.google.common.io.Closeables", "java.io.IOException", "java.util.List", "java.util.Map", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.io.SequenceFile", "org.apache.hadoop.io.Text", "org.apache.mahout.math.SequentialAccessSparseVector", "org.apache.mahout.math.Vector", "org.apache.mahout.math.VectorWritable" ]
import com.google.common.io.Closeables; import java.io.IOException; import java.util.List; import java.util.Map; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.SequenceFile; import org.apache.hadoop.io.Text; import org.apache.mahout.math.SequentialAccessSparseVector; import org.apache.mahout.math.Vector; import org.apache.mahout.math.VectorWritable;
import com.google.common.io.*; import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.io.*; import org.apache.mahout.math.*;
[ "com.google.common", "java.io", "java.util", "org.apache.hadoop", "org.apache.mahout" ]
com.google.common; java.io; java.util; org.apache.hadoop; org.apache.mahout;
2,604,096
@WebMethod @WebResult(name = "rval", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102") @RequestWrapper(localName = "getCmsMetadataValuesByStatement", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102", className = "com.google.api.ads.admanager.jaxws.v202102.CmsMetadataServiceInterfacegetCmsMetadataValuesByStatement") @ResponseWrapper(localName = "getCmsMetadataValuesByStatementResponse", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102", className = "com.google.api.ads.admanager.jaxws.v202102.CmsMetadataServiceInterfacegetCmsMetadataValuesByStatementResponse") public CmsMetadataValuePage getCmsMetadataValuesByStatement( @WebParam(name = "statement", targetNamespace = "https://www.google.com/apis/ads/publisher/v202102") Statement statement) throws ApiException_Exception ;
@WebResult(name = "rval", targetNamespace = STRgetCmsMetadataValuesByStatementSTRhttps: @ResponseWrapper(localName = "getCmsMetadataValuesByStatementResponseSTRhttps: CmsMetadataValuePage function( @WebParam(name = "statementSTRhttps: Statement statement) throws ApiException_Exception ;
/** * * Returns a page of {@link CmsMetadataValue}s matching the specified {@link Statement}. The * following fields are supported for filtering: * * <table> * <tr> * <th scope = "col">PQL Property</th> <th scope="col">Object Property</th> * </tr> * <tr> * <td>{@code id}</td> * <td>{@link CmsMetadataValue#cmsMetadataValueId}</td> * </tr> * <tr> * <td>{@code cmsValue}</td> * <td>{@link CmsMetadataValue#valueName}</td> * </tr> * <tr> * <td>{@code cmsKey}</td> * <td>{@link CmsMetadataValue#key#name}</td> * </tr> * <tr> * <td>{@code cmsKeyId}</td> * <td>{@link CmsMetadataValue#key#id}</td> * </tr> * <tr> * <td>{@code keyValueMemberContent}</td> * <td>Content IDs tagged with a CMS metadata key-value</td> * </tr> * <tr> * <td>{@code status}</td> * <td>{@link CmsMetadataValue#status}</td> * </tr> * </table> * * * @param statement * @return * returns com.google.api.ads.admanager.jaxws.v202102.CmsMetadataValuePage * @throws ApiException_Exception */
Returns a page of <code>CmsMetadataValue</code>s matching the specified <code>Statement</code>. The following fields are supported for filtering: PQL Property Object Property id <code>CmsMetadataValue#cmsMetadataValueId</code> cmsValue <code>CmsMetadataValue#valueName</code> cmsKey <code>CmsMetadataValue#key#name</code> cmsKeyId <code>CmsMetadataValue#key#id</code> keyValueMemberContent Content IDs tagged with a CMS metadata key-value status <code>CmsMetadataValue#status</code>
getCmsMetadataValuesByStatement
{ "repo_name": "googleads/googleads-java-lib", "path": "modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/v202102/CmsMetadataServiceInterface.java", "license": "apache-2.0", "size": 8959 }
[ "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.ws.ResponseWrapper" ]
import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.ResponseWrapper;
import javax.jws.*; import javax.xml.ws.*;
[ "javax.jws", "javax.xml" ]
javax.jws; javax.xml;
2,194,143
boolean signInputs(ProposedTransaction propTx, KeyBag keyBag);
boolean signInputs(ProposedTransaction propTx, KeyBag keyBag);
/** * Signs given transaction's inputs. * Returns true if signer is compatible with given transaction (can do something meaningful with it). * Otherwise this method returns false */
Signs given transaction's inputs. Returns true if signer is compatible with given transaction (can do something meaningful with it). Otherwise this method returns false
signInputs
{ "repo_name": "ahmedbodi/anycoinj", "path": "core/src/main/java/com/matthewmitchell/peercoinj/signers/TransactionSigner.java", "license": "apache-2.0", "size": 3333 }
[ "com.matthewmitchell.peercoinj.wallet.KeyBag" ]
import com.matthewmitchell.peercoinj.wallet.KeyBag;
import com.matthewmitchell.peercoinj.wallet.*;
[ "com.matthewmitchell.peercoinj" ]
com.matthewmitchell.peercoinj;
555,590
private void convertToSVG(RendererContext context, BarcodeGenerator bargen, String msg, int orientation) throws BarcodeCanvasSetupException { DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); SVGCanvasProvider canvas = new SVGCanvasProvider(impl, true, orientation); bargen.generateBarcode(canvas, msg); Document svg = canvas.getDOM(); //Call the renderXML() method of the renderer to render the SVG if (DEBUG) { System.out.println(" --> SVG"); } context.getRenderer().renderXML(context, svg, SVGDOMImplementation.SVG_NAMESPACE_URI); }
void function(RendererContext context, BarcodeGenerator bargen, String msg, int orientation) throws BarcodeCanvasSetupException { DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); SVGCanvasProvider canvas = new SVGCanvasProvider(impl, true, orientation); bargen.generateBarcode(canvas, msg); Document svg = canvas.getDOM(); if (DEBUG) { System.out.println(STR); } context.getRenderer().renderXML(context, svg, SVGDOMImplementation.SVG_NAMESPACE_URI); }
/** * Converts the barcode XML to SVG. * @param context the renderer context * @param bargen the barcode generator * @param msg the barcode message * @throws BarcodeCanvasSetupException In case of an error while generating the barcode */
Converts the barcode XML to SVG
convertToSVG
{ "repo_name": "mbhk/barcode4j-modified", "path": "src/fop-trunk/java/org/krysalis/barcode4j/fop/BarcodeXMLHandler.java", "license": "apache-2.0", "size": 10101 }
[ "org.apache.batik.dom.svg.SVGDOMImplementation", "org.apache.fop.render.RendererContext", "org.krysalis.barcode4j.BarcodeGenerator", "org.krysalis.barcode4j.output.BarcodeCanvasSetupException", "org.krysalis.barcode4j.output.svg.SVGCanvasProvider", "org.w3c.dom.DOMImplementation", "org.w3c.dom.Document" ]
import org.apache.batik.dom.svg.SVGDOMImplementation; import org.apache.fop.render.RendererContext; import org.krysalis.barcode4j.BarcodeGenerator; import org.krysalis.barcode4j.output.BarcodeCanvasSetupException; import org.krysalis.barcode4j.output.svg.SVGCanvasProvider; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document;
import org.apache.batik.dom.svg.*; import org.apache.fop.render.*; import org.krysalis.barcode4j.*; import org.krysalis.barcode4j.output.*; import org.krysalis.barcode4j.output.svg.*; import org.w3c.dom.*;
[ "org.apache.batik", "org.apache.fop", "org.krysalis.barcode4j", "org.w3c.dom" ]
org.apache.batik; org.apache.fop; org.krysalis.barcode4j; org.w3c.dom;
1,171,068
@Test void withAssertions_setAllowExtractingPrivateFields_Test() { setAllowExtractingPrivateFields(false); // reset to default setAllowExtractingPrivateFields(true); }
void withAssertions_setAllowExtractingPrivateFields_Test() { setAllowExtractingPrivateFields(false); setAllowExtractingPrivateFields(true); }
/** * Test that the delegate method is called. */
Test that the delegate method is called
withAssertions_setAllowExtractingPrivateFields_Test
{ "repo_name": "hazendaz/assertj-core", "path": "src/test/java/org/assertj/core/api/WithAssertions_delegation_Test.java", "license": "apache-2.0", "size": 25178 }
[ "org.junit.jupiter.api.Test" ]
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.*;
[ "org.junit.jupiter" ]
org.junit.jupiter;
1,576,441
private void initInstrumentation(String realInstrumentationName) throws ReflectiveOperationException { Log.i(TAG, "Instantiating instrumentation " + realInstrumentationName); mRealInstrumentation = (Instrumentation) Reflect.newInstance( Class.forName(realInstrumentationName)); Instrumentation oldInstrumentation = (Instrumentation) Reflect.getField(mActivityThread, "mInstrumentation"); // Initialize the fields that are set by Instrumentation.init(). String[] initFields = {"mThread", "mMessageQueue", "mInstrContext", "mAppContext", "mWatcher", "mUiAutomationConnection"}; for (String fieldName : initFields) { Reflect.setField(mRealInstrumentation, fieldName, Reflect.getField(oldInstrumentation, fieldName)); } // But make sure the correct ComponentName is used. ComponentName newName = new ComponentName( oldInstrumentation.getComponentName().getPackageName(), realInstrumentationName); Reflect.setField(mRealInstrumentation, "mComponent", newName); }
void function(String realInstrumentationName) throws ReflectiveOperationException { Log.i(TAG, STR + realInstrumentationName); mRealInstrumentation = (Instrumentation) Reflect.newInstance( Class.forName(realInstrumentationName)); Instrumentation oldInstrumentation = (Instrumentation) Reflect.getField(mActivityThread, STR); String[] initFields = {STR, STR, STR, STR, STR, STR}; for (String fieldName : initFields) { Reflect.setField(mRealInstrumentation, fieldName, Reflect.getField(oldInstrumentation, fieldName)); } ComponentName newName = new ComponentName( oldInstrumentation.getComponentName().getPackageName(), realInstrumentationName); Reflect.setField(mRealInstrumentation, STR, newName); }
/** * Instantiates and initializes mRealInstrumentation (the real Instrumentation class). */
Instantiates and initializes mRealInstrumentation (the real Instrumentation class)
initInstrumentation
{ "repo_name": "Bysmyyr/chromium-crosswalk", "path": "build/android/incremental_install/java/org/chromium/incrementalinstall/BootstrapApplication.java", "license": "bsd-3-clause", "size": 10559 }
[ "android.app.Instrumentation", "android.content.ComponentName", "android.util.Log" ]
import android.app.Instrumentation; import android.content.ComponentName; import android.util.Log;
import android.app.*; import android.content.*; import android.util.*;
[ "android.app", "android.content", "android.util" ]
android.app; android.content; android.util;
1,732,546
public static Iterator<Entry<String, String>> iteratorAsString( Iterable<Entry<CharSequence, CharSequence>> headers) { return new StringIterator(headers.iterator()); } private static final class StringIterator implements Iterator<Entry<String, String>> { private final Iterator<Entry<CharSequence, CharSequence>> iter; public StringIterator(Iterator<Entry<CharSequence, CharSequence>> iter) { this.iter = iter; }
static Iterator<Entry<String, String>> function( Iterable<Entry<CharSequence, CharSequence>> headers) { return new StringIterator(headers.iterator()); } private static final class StringIterator implements Iterator<Entry<String, String>> { private final Iterator<Entry<CharSequence, CharSequence>> iter; public StringIterator(Iterator<Entry<CharSequence, CharSequence>> iter) { this.iter = iter; }
/** * {@link #iterator()} that converts each {@link Entry}'s key and value to a {@link String}. */
<code>#iterator()</code> that converts each <code>Entry</code>'s key and value to a <code>String</code>
iteratorAsString
{ "repo_name": "smayoorans/netty", "path": "codec/src/main/java/io/netty/handler/codec/HeadersUtils.java", "license": "apache-2.0", "size": 4080 }
[ "java.util.Iterator", "java.util.Map" ]
import java.util.Iterator; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
201,077
public String formatCookie(Cookie cookie) { LOG.trace("enter CookieSpecBase.formatCookie(Cookie)"); if (cookie == null) { throw new IllegalArgumentException("Cookie may not be null"); } StringBuffer buf = new StringBuffer(); buf.append(cookie.getName()); buf.append("="); String s = cookie.getValue(); if (s != null) { buf.append(s); } return buf.toString(); }
String function(Cookie cookie) { LOG.trace(STR); if (cookie == null) { throw new IllegalArgumentException(STR); } StringBuffer buf = new StringBuffer(); buf.append(cookie.getName()); buf.append("="); String s = cookie.getValue(); if (s != null) { buf.append(s); } return buf.toString(); }
/** * Return a string suitable for sending in a <tt>"Cookie"</tt> header * @param cookie a {@link Cookie} to be formatted as string * @return a string suitable for sending in a <tt>"Cookie"</tt> header. */
Return a string suitable for sending in a "Cookie" header
formatCookie
{ "repo_name": "magneticmoon/httpclient3-ntml", "path": "src/java/org/apache/commons/httpclient/cookie/CookieSpecBase.java", "license": "apache-2.0", "size": 24314 }
[ "org.apache.commons.httpclient.Cookie" ]
import org.apache.commons.httpclient.Cookie;
import org.apache.commons.httpclient.*;
[ "org.apache.commons" ]
org.apache.commons;
2,257,959
public void setZoneLetter(String value) { if ((null == value) || (value.length() > 1) || value.isEmpty() || !latBands.contains(value)) { Log.e(TAG, "Invalid Zone letter: " + value); throw new IllegalArgumentException("Invalid Zone letter " + value); } zoneLetterValue = value; }
void function(String value) { if ((null == value) (value.length() > 1) value.isEmpty() !latBands.contains(value)) { Log.e(TAG, STR + value); throw new IllegalArgumentException(STR + value); } zoneLetterValue = value; }
/** * This method set the zone letter for the coordinate. * @param value String value */
This method set the zone letter for the coordinate
setZoneLetter
{ "repo_name": "missioncommand/emp3-android", "path": "sdk/sdk-core/aar/src/main/java/mil/emp3/core/mapgridlines/coordinates/UTMCoordinate.java", "license": "apache-2.0", "size": 23979 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,636,022
void startCheckpoint() throws IOException { for(StorageDirectory sd : storageDirs) { moveCurrent(sd); } }
void startCheckpoint() throws IOException { for(StorageDirectory sd : storageDirs) { moveCurrent(sd); } }
/** * Prepare directories for a new checkpoint. * <p> * Rename <code>current</code> to <code>lastcheckpoint.tmp</code> * and recreate <code>current</code>. * @throws IOException */
Prepare directories for a new checkpoint. Rename <code>current</code> to <code>lastcheckpoint.tmp</code> and recreate <code>current</code>
startCheckpoint
{ "repo_name": "gndpig/hadoop", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java", "license": "apache-2.0", "size": 27475 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,567,708
public void testGetColumnsModify() throws Exception { // skip XML datatype as our cross check with // ResultSetMetaData will fail int totalTables = createTablesForTest(true); // First cross check all the columns in the database // with the ResultSetMetaData. testGetColumnsReadOnly(); Random rand = new Random(); String[] dbIDS = getSortedIdentifiers(); for (int i = 1; i < 20; i++) { int seenColumnCount = 0; // These are the pattern matching parameters String schemaPattern = getPattern(rand, dbIDS); String tableNamePattern = getPattern(rand, dbIDS); String columnNamePattern = getPattern(rand, dbIDS); ResultSet[] rs = getColumns(null, schemaPattern, tableNamePattern, columnNamePattern); for (int j=0 ; j<2 ; j++) { checkColumnsShape(rs[j], j); while (rs[j].next()) { String schema = rs[j].getString("TABLE_SCHEM"); String table = rs[j].getString("TABLE_NAME"); String column = rs[j].getString("COLUMN_NAME"); assertMatchesPattern(schemaPattern, schema); assertMatchesPattern(tableNamePattern, table); assertMatchesPattern(columnNamePattern, column); seenColumnCount++; } rs[j].close(); } // Re-run to check the correct data is returned // when filtering is enabled rs = getColumns(null, schemaPattern, tableNamePattern, columnNamePattern); for (int j=0 ; j<2 ; j++) { crossCheckGetColumnsAndResultSetMetaData(rs[j], true, j); } // Now re-execute fetching all schemas, columns etc. // and see we can the same result when we "filter" // in the application rs = getColumns(null,null, null, null); int appColumnCount = 0; for (int j=0 ; j<2 ; j++) { while (rs[j].next()) { String schema = rs[j].getString("TABLE_SCHEM"); String table = rs[j].getString("TABLE_NAME"); String column = rs[j].getString("COLUMN_NAME"); if (!doesMatch(schemaPattern, 0, schema, 0)) continue; if (!doesMatch(tableNamePattern, 0, table, 0)) continue; if (!doesMatch(columnNamePattern, 0, column, 0)) continue; appColumnCount++; } rs[j].close(); } assertEquals("Mismatched column count on getColumns() filtering", seenColumnCount, appColumnCount); } }
void function() throws Exception { int totalTables = createTablesForTest(true); testGetColumnsReadOnly(); Random rand = new Random(); String[] dbIDS = getSortedIdentifiers(); for (int i = 1; i < 20; i++) { int seenColumnCount = 0; String schemaPattern = getPattern(rand, dbIDS); String tableNamePattern = getPattern(rand, dbIDS); String columnNamePattern = getPattern(rand, dbIDS); ResultSet[] rs = getColumns(null, schemaPattern, tableNamePattern, columnNamePattern); for (int j=0 ; j<2 ; j++) { checkColumnsShape(rs[j], j); while (rs[j].next()) { String schema = rs[j].getString(STR); String table = rs[j].getString(STR); String column = rs[j].getString(STR); assertMatchesPattern(schemaPattern, schema); assertMatchesPattern(tableNamePattern, table); assertMatchesPattern(columnNamePattern, column); seenColumnCount++; } rs[j].close(); } rs = getColumns(null, schemaPattern, tableNamePattern, columnNamePattern); for (int j=0 ; j<2 ; j++) { crossCheckGetColumnsAndResultSetMetaData(rs[j], true, j); } rs = getColumns(null,null, null, null); int appColumnCount = 0; for (int j=0 ; j<2 ; j++) { while (rs[j].next()) { String schema = rs[j].getString(STR); String table = rs[j].getString(STR); String column = rs[j].getString(STR); if (!doesMatch(schemaPattern, 0, schema, 0)) continue; if (!doesMatch(tableNamePattern, 0, table, 0)) continue; if (!doesMatch(columnNamePattern, 0, column, 0)) continue; appColumnCount++; } rs[j].close(); } assertEquals(STR, seenColumnCount, appColumnCount); } }
/** * Test getColumns() with modifying the database. * * @throws SQLException */
Test getColumns() with modifying the database
testGetColumnsModify
{ "repo_name": "gemxd/gemfirexd-oss", "path": "gemfirexd/tools/src/testing/java/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java", "license": "apache-2.0", "size": 184366 }
[ "java.sql.ResultSet", "java.util.Random" ]
import java.sql.ResultSet; import java.util.Random;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
2,594,461
public DataSet parseTabular(char[] chars) { // Do first pass to get a description of the file. CharArrayReader reader = new CharArrayReader(chars); DataSetDescription description = doFirstTabularPass(reader); // Close the reader and re-open for a second pass to load the data. reader.close(); CharArrayReader reader2 = new CharArrayReader(chars); DataSet dataSet = doSecondTabularPass(description, reader2); this.logger.log("info", "\nData set loaded!"); this.logger.reset(); return dataSet; }
DataSet function(char[] chars) { CharArrayReader reader = new CharArrayReader(chars); DataSetDescription description = doFirstTabularPass(reader); reader.close(); CharArrayReader reader2 = new CharArrayReader(chars); DataSet dataSet = doSecondTabularPass(description, reader2); this.logger.log("info", STR); this.logger.reset(); return dataSet; }
/** * Parses the given character array for a tabular data set, returning a * RectangularDataSet if successful. Log messages are written to the * LogUtils log; to view them, add System.out to that. */
Parses the given character array for a tabular data set, returning a RectangularDataSet if successful. Log messages are written to the LogUtils log; to view them, add System.out to that
parseTabular
{ "repo_name": "lizziesilver/tetrad", "path": "tetrad-lib/src/main/java/edu/cmu/tetrad/data/DataReader.java", "license": "gpl-2.0", "size": 45035 }
[ "java.io.CharArrayReader" ]
import java.io.CharArrayReader;
import java.io.*;
[ "java.io" ]
java.io;
2,844,681
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner> beginSetVpnclientIpsecParameters( String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams);
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner> beginSetVpnclientIpsecParameters( String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams);
/** * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network * gateway in the specified resource group through Network resource provider. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkGatewayName The name of the virtual network gateway. * @param vpnclientIpsecParams An IPSec parameters for a virtual network gateway P2S connection. * @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 an IPSec parameters for a virtual network gateway P2S connection. */
The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider
beginSetVpnclientIpsecParameters
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VirtualNetworkGatewaysClient.java", "license": "mit", "size": 135947 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.network.fluent.models.VpnClientIPsecParametersInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.fluent.models.VpnClientIPsecParametersInner;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,644,764
void addCuttableBlock(Block block, int meta);
void addCuttableBlock(Block block, int meta);
/** * Allows the given block to be cut up. * Your block must have a reasonable implementation of getBlockTextureFromSideAndMetadata. * Part IDs will be assigned automatically based on the block ID and metadata value. */
Allows the given block to be cut up. Your block must have a reasonable implementation of getBlockTextureFromSideAndMetadata. Part IDs will be assigned automatically based on the block ID and metadata value
addCuttableBlock
{ "repo_name": "kremnev8/AdvancedSpaceStaion-mod", "path": "src/main/java/mods/immibis/microblocks/api/IMicroblockSystem.java", "license": "mit", "size": 1493 }
[ "net.minecraft.block.Block" ]
import net.minecraft.block.Block;
import net.minecraft.block.*;
[ "net.minecraft.block" ]
net.minecraft.block;
147,472
protected DocumentAttributeDateTime buildSearchableDateTimeAttribute(String attributeKey, Object value) { return DocumentAttributeFactory.createDateTimeAttribute(attributeKey, new DateTime(value)); }
DocumentAttributeDateTime function(String attributeKey, Object value) { return DocumentAttributeFactory.createDateTimeAttribute(attributeKey, new DateTime(value)); }
/** * Builds a date time SearchableAttributeValue for the given key and value * @param attributeKey the key for the searchable attribute * @param value the value that will be coerced to date/time data * @return the generated SearchableAttributeDateTimeValue */
Builds a date time SearchableAttributeValue for the given key and value
buildSearchableDateTimeAttribute
{ "repo_name": "sbower/kuali-rice-1", "path": "impl/src/main/java/org/kuali/rice/krad/workflow/service/impl/WorkflowAttributePropertyResolutionServiceImpl.java", "license": "apache-2.0", "size": 26400 }
[ "org.joda.time.DateTime", "org.kuali.rice.kew.api.document.attribute.DocumentAttributeDateTime", "org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory" ]
import org.joda.time.DateTime; import org.kuali.rice.kew.api.document.attribute.DocumentAttributeDateTime; import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory;
import org.joda.time.*; import org.kuali.rice.kew.api.document.attribute.*;
[ "org.joda.time", "org.kuali.rice" ]
org.joda.time; org.kuali.rice;
191,164
Stream<RegisteredMigrationStep> readFrom(long migrationNumber);
Stream<RegisteredMigrationStep> readFrom(long migrationNumber);
/** * Reads migration steps, in order of increasing migration number, from the specified migration number <strong>included</strong>. */
Reads migration steps, in order of increasing migration number, from the specified migration number included
readFrom
{ "repo_name": "lbndev/sonarqube", "path": "server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationSteps.java", "license": "lgpl-3.0", "size": 1413 }
[ "java.util.stream.Stream" ]
import java.util.stream.Stream;
import java.util.stream.*;
[ "java.util" ]
java.util;
2,902,885
public SearchRequestBuilder setSearchType(String searchType) throws ElasticSearchIllegalArgumentException { request.searchType(searchType); return this; }
SearchRequestBuilder function(String searchType) throws ElasticSearchIllegalArgumentException { request.searchType(searchType); return this; }
/** * The a string representation search type to execute, defaults to {@link SearchType#DEFAULT}. Can be * one of "dfs_query_then_fetch"/"dfsQueryThenFetch", "dfs_query_and_fetch"/"dfsQueryAndFetch", * "query_then_fetch"/"queryThenFetch", and "query_and_fetch"/"queryAndFetch". */
The a string representation search type to execute, defaults to <code>SearchType#DEFAULT</code>. Can be one of "dfs_query_then_fetch"/"dfsQueryThenFetch", "dfs_query_and_fetch"/"dfsQueryAndFetch", "query_then_fetch"/"queryThenFetch", and "query_and_fetch"/"queryAndFetch"
setSearchType
{ "repo_name": "jprante/elasticsearch-client", "path": "elasticsearch-client-search/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java", "license": "apache-2.0", "size": 26853 }
[ "org.elasticsearch.ElasticSearchIllegalArgumentException" ]
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.*;
[ "org.elasticsearch" ]
org.elasticsearch;
1,346,879
public void startActivityForResultSafely(Intent intent, int requestCode) { try { super.startActivityForResult(intent, requestCode); } catch (ActivityNotFoundException e) { Toast.makeText(getActivity(), R.string.activity_not_found, Toast.LENGTH_SHORT).show(); } catch (SecurityException e) { Toast.makeText(getActivity(), R.string.activity_not_found, Toast.LENGTH_SHORT).show(); } }
void function(Intent intent, int requestCode) { try { super.startActivityForResult(intent, requestCode); } catch (ActivityNotFoundException e) { Toast.makeText(getActivity(), R.string.activity_not_found, Toast.LENGTH_SHORT).show(); } catch (SecurityException e) { Toast.makeText(getActivity(), R.string.activity_not_found, Toast.LENGTH_SHORT).show(); } }
/** * Safely start a intent for result without worry activity not found * @param intent the intent try to launch */
Safely start a intent for result without worry activity not found
startActivityForResultSafely
{ "repo_name": "PacteraMobile/pacterapulse-android", "path": "app/src/main/java/au/com/pactera/pacterapulse/core/BaseFragment.java", "license": "apache-2.0", "size": 7828 }
[ "android.content.ActivityNotFoundException", "android.content.Intent", "android.widget.Toast" ]
import android.content.ActivityNotFoundException; import android.content.Intent; import android.widget.Toast;
import android.content.*; import android.widget.*;
[ "android.content", "android.widget" ]
android.content; android.widget;
1,757,680
public void dispatch(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws ServletException { try { response.setHeader("Content-Disposition", "filename=" + filename); byte[] buf = new byte[1024]; ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream())); Iterator it = files.iterator(); while (it.hasNext()) { FileMetaData file = (FileMetaData)it.next(); if (file.isDirectory()) { continue; } FileInputStream in = new FileInputStream(file.getFile()); out.putNextEntry(new ZipEntry(file.getAbsolutePath().substring(1))); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); in.close(); } out.close(); } catch (IOException ioe) { throw new ServletException(ioe); } }
void function(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws ServletException { try { response.setHeader(STR, STR + filename); byte[] buf = new byte[1024]; ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream())); Iterator it = files.iterator(); while (it.hasNext()) { FileMetaData file = (FileMetaData)it.next(); if (file.isDirectory()) { continue; } FileInputStream in = new FileInputStream(file.getFile()); out.putNextEntry(new ZipEntry(file.getAbsolutePath().substring(1))); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); in.close(); } out.close(); } catch (IOException ioe) { throw new ServletException(ioe); } }
/** * Dispatches this view. * * @param request the HttpServletRequest instance * @param response the HttpServletResponse instance * @param context */
Dispatches this view
dispatch
{ "repo_name": "arshadalisoomro/pebble", "path": "src/main/java/net/sourceforge/pebble/web/view/ZipView.java", "license": "bsd-3-clause", "size": 3702 }
[ "java.io.BufferedOutputStream", "java.io.FileInputStream", "java.io.IOException", "java.util.Iterator", "java.util.zip.ZipEntry", "java.util.zip.ZipOutputStream", "javax.servlet.ServletContext", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "net.sourceforge.pebble.domain.FileMetaData" ]
import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.Iterator; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sourceforge.pebble.domain.FileMetaData;
import java.io.*; import java.util.*; import java.util.zip.*; import javax.servlet.*; import javax.servlet.http.*; import net.sourceforge.pebble.domain.*;
[ "java.io", "java.util", "javax.servlet", "net.sourceforge.pebble" ]
java.io; java.util; javax.servlet; net.sourceforge.pebble;
258,884
@Override public synchronized Set<Long> getIds(RepositoryModel repository) { Repository db = repositoryManager.getRepository(repository.name); try { if (getTicketsBranch(db) == null) { return Collections.emptySet(); } Set<Long> ids = new TreeSet<Long>(); List<PathModel> paths = JGitUtils.getDocuments(db, Arrays.asList("json"), BRANCH); for (PathModel path : paths) { String name = path.name.substring(path.name.lastIndexOf('/') + 1); if (!JOURNAL.equals(name)) { continue; } String tid = path.path.split("/")[2]; long ticketId = Long.parseLong(tid); ids.add(ticketId); } return ids; } finally { if (db != null) { db.close(); } } }
synchronized Set<Long> function(RepositoryModel repository) { Repository db = repositoryManager.getRepository(repository.name); try { if (getTicketsBranch(db) == null) { return Collections.emptySet(); } Set<Long> ids = new TreeSet<Long>(); List<PathModel> paths = JGitUtils.getDocuments(db, Arrays.asList("json"), BRANCH); for (PathModel path : paths) { String name = path.name.substring(path.name.lastIndexOf('/') + 1); if (!JOURNAL.equals(name)) { continue; } String tid = path.path.split("/")[2]; long ticketId = Long.parseLong(tid); ids.add(ticketId); } return ids; } finally { if (db != null) { db.close(); } } }
/** * Returns the assigned ticket ids. * * @return the assigned ticket ids */
Returns the assigned ticket ids
getIds
{ "repo_name": "fuero/gitblit", "path": "src/main/java/com/gitblit/tickets/BranchTicketService.java", "license": "apache-2.0", "size": 24846 }
[ "com.gitblit.models.PathModel", "com.gitblit.models.RepositoryModel", "com.gitblit.utils.JGitUtils", "java.util.Arrays", "java.util.Collections", "java.util.List", "java.util.Set", "java.util.TreeSet", "org.eclipse.jgit.lib.Repository" ]
import com.gitblit.models.PathModel; import com.gitblit.models.RepositoryModel; import com.gitblit.utils.JGitUtils; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.TreeSet; import org.eclipse.jgit.lib.Repository;
import com.gitblit.models.*; import com.gitblit.utils.*; import java.util.*; import org.eclipse.jgit.lib.*;
[ "com.gitblit.models", "com.gitblit.utils", "java.util", "org.eclipse.jgit" ]
com.gitblit.models; com.gitblit.utils; java.util; org.eclipse.jgit;
2,027,452
super.updateUI(); // Make the tree's cell renderer use the table's cell selection // colors. final TreeCellRenderer tcr = getCellRenderer(); if (tcr instanceof DefaultTreeCellRenderer) { final DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tcr; // For 1.1 uncomment this, 1.2 has a bug that will cause an // exception to be thrown if the border selection color is // null. // renderer.setBorderSelectionColor(null); renderer.setTextSelectionColor(UIManager.getColor("Table.selectionForeground")); renderer.setBackgroundSelectionColor(UIManager.getColor("Table.selectionBackground")); } }
super.updateUI(); final TreeCellRenderer tcr = getCellRenderer(); if (tcr instanceof DefaultTreeCellRenderer) { final DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tcr; renderer.setTextSelectionColor(UIManager.getColor(STR)); renderer.setBackgroundSelectionColor(UIManager.getColor(STR)); } }
/** * UpdateUI is overridden to set the colors of the Tree's renderer * to match that of the table. */
UpdateUI is overridden to set the colors of the Tree's renderer to match that of the table
updateUI
{ "repo_name": "llocc/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTableCellRenderer.java", "license": "lgpl-2.1", "size": 4420 }
[ "javax.swing.UIManager", "javax.swing.tree.DefaultTreeCellRenderer", "javax.swing.tree.TreeCellRenderer" ]
import javax.swing.UIManager; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.*; import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
1,413,012
public void entityDeleted(BuguEntity entity);
void function(BuguEntity entity);
/** * Notified that an entity has been deleted. * @param entity the deleted object */
Notified that an entity has been deleted
entityDeleted
{ "repo_name": "xbwen/bugu-mongo", "path": "bugu-mongo-core/src/main/java/com/bugull/mongo/listener/EntityListener.java", "license": "apache-2.0", "size": 1374 }
[ "com.bugull.mongo.BuguEntity" ]
import com.bugull.mongo.BuguEntity;
import com.bugull.mongo.*;
[ "com.bugull.mongo" ]
com.bugull.mongo;
2,157,252
public InputStream getFetchResult() { return fetchResult; }
InputStream function() { return fetchResult; }
/** * After fetching the current resource, this returns the fetch result. * * @return The fetch result. */
After fetching the current resource, this returns the fetch result
getFetchResult
{ "repo_name": "cleberecht/singa", "path": "singa-core/src/main/java/bio/singa/core/parser/AbstractParser.java", "license": "gpl-3.0", "size": 1282 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,452,916
private void createWindowAWT() { GLProfile glprofile = GLProfile.getDefault(); GLCapabilities glcapabilities = new GLCapabilities( glprofile ); final GLCanvas glcanvas = new GLCanvas( glcapabilities ); glcanvas.addGLEventListener((GLEventListener)lEngine.getEventListener());
void function() { GLProfile glprofile = GLProfile.getDefault(); GLCapabilities glcapabilities = new GLCapabilities( glprofile ); final GLCanvas glcanvas = new GLCanvas( glcapabilities ); glcanvas.addGLEventListener((GLEventListener)lEngine.getEventListener());
/** * Creates an AWT window with GLCanvas for openGL rendering */
Creates an AWT window with GLCanvas for openGL rendering
createWindowAWT
{ "repo_name": "yzong/GroViE", "path": "grovie/src/de/grovie/sandbox/GvWindow.java", "license": "gpl-3.0", "size": 1309 }
[ "javax.media.opengl.GLCapabilities", "javax.media.opengl.GLEventListener", "javax.media.opengl.GLProfile", "javax.media.opengl.awt.GLCanvas" ]
import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.*; import javax.media.opengl.awt.*;
[ "javax.media" ]
javax.media;
1,089,127
public void setRootViewId(int id) { mRootView = (ViewGroup) inflater.inflate(id, null); mTrack = (ViewGroup) mRootView.findViewById(R.id.tracks); mArrowDown = (ImageView) mRootView.findViewById(R.id.arrow_down); mArrowUp = (ImageView) mRootView.findViewById(R.id.arrow_up); //This was previously defined on show() method, moved here to prevent force close that occured //when tapping fastly on a view to show quickaction dialog. //Thanx to zammbi (github.com/zammbi) mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); setContentView(mRootView); }
void function(int id) { mRootView = (ViewGroup) inflater.inflate(id, null); mTrack = (ViewGroup) mRootView.findViewById(R.id.tracks); mArrowDown = (ImageView) mRootView.findViewById(R.id.arrow_down); mArrowUp = (ImageView) mRootView.findViewById(R.id.arrow_up); mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); setContentView(mRootView); }
/** * Set root view. * * @param id Layout resource id */
Set root view
setRootViewId
{ "repo_name": "raviindianstar/Satta-Panchayat-Android-App", "path": "src/com/example/sattapanchayatiyakkam/MyQuickAction/QuickAction.java", "license": "gpl-3.0", "size": 9523 }
[ "android.view.ViewGroup", "android.widget.ImageView" ]
import android.view.ViewGroup; import android.widget.ImageView;
import android.view.*; import android.widget.*;
[ "android.view", "android.widget" ]
android.view; android.widget;
2,842,718
protected void handleComponentHover(ITextComponent component, int x, int y) { if (component != null && component.getStyle().getHoverEvent() != null) { HoverEvent hoverevent = component.getStyle().getHoverEvent(); if (hoverevent.getAction() == HoverEvent.Action.SHOW_ITEM) { ItemStack itemstack = ItemStack.EMPTY; try { NBTBase nbtbase = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); if (nbtbase instanceof NBTTagCompound) { itemstack = new ItemStack((NBTTagCompound)nbtbase); } } catch (NBTException var11) { ; } if (itemstack.isEmpty()) { this.drawCreativeTabHoveringText(TextFormatting.RED + "Invalid Item!", x, y); } else { this.renderToolTip(itemstack, x, y); } } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ENTITY) { if (this.mc.gameSettings.advancedItemTooltips) { try { NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); List<String> list1 = Lists.<String>newArrayList(); list1.add(nbttagcompound.getString("name")); if (nbttagcompound.hasKey("type", 8)) { String s = nbttagcompound.getString("type"); list1.add("Type: " + s); } list1.add(nbttagcompound.getString("id")); this.drawHoveringText(list1, x, y); } catch (NBTException var10) { this.drawCreativeTabHoveringText(TextFormatting.RED + "Invalid Entity!", x, y); } } } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_TEXT) { this.drawHoveringText(NEWLINE_SPLITTER.splitToList(hoverevent.getValue().getFormattedText()), x, y); } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT) { StatBase statbase = StatList.getOneShotStat(hoverevent.getValue().getUnformattedText()); if (statbase != null) { ITextComponent itextcomponent = statbase.getStatName(); ITextComponent itextcomponent1 = new TextComponentTranslation("stats.tooltip.type." + (statbase.isAchievement() ? "achievement" : "statistic"), new Object[0]); itextcomponent1.getStyle().setItalic(Boolean.valueOf(true)); String s1 = statbase instanceof Achievement ? ((Achievement)statbase).getDescription() : null; List<String> list = Lists.newArrayList(new String[] {itextcomponent.getFormattedText(), itextcomponent1.getFormattedText()}); if (s1 != null) { list.addAll(this.fontRendererObj.listFormattedStringToWidth(s1, 150)); } this.drawHoveringText(list, x, y); } else { this.drawCreativeTabHoveringText(TextFormatting.RED + "Invalid statistic/achievement!", x, y); } } GlStateManager.disableLighting(); } }
void function(ITextComponent component, int x, int y) { if (component != null && component.getStyle().getHoverEvent() != null) { HoverEvent hoverevent = component.getStyle().getHoverEvent(); if (hoverevent.getAction() == HoverEvent.Action.SHOW_ITEM) { ItemStack itemstack = ItemStack.EMPTY; try { NBTBase nbtbase = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); if (nbtbase instanceof NBTTagCompound) { itemstack = new ItemStack((NBTTagCompound)nbtbase); } } catch (NBTException var11) { ; } if (itemstack.isEmpty()) { this.drawCreativeTabHoveringText(TextFormatting.RED + STR, x, y); } else { this.renderToolTip(itemstack, x, y); } } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ENTITY) { if (this.mc.gameSettings.advancedItemTooltips) { try { NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); List<String> list1 = Lists.<String>newArrayList(); list1.add(nbttagcompound.getString("name")); if (nbttagcompound.hasKey("type", 8)) { String s = nbttagcompound.getString("type"); list1.add(STR + s); } list1.add(nbttagcompound.getString("id")); this.drawHoveringText(list1, x, y); } catch (NBTException var10) { this.drawCreativeTabHoveringText(TextFormatting.RED + STR, x, y); } } } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_TEXT) { this.drawHoveringText(NEWLINE_SPLITTER.splitToList(hoverevent.getValue().getFormattedText()), x, y); } else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT) { StatBase statbase = StatList.getOneShotStat(hoverevent.getValue().getUnformattedText()); if (statbase != null) { ITextComponent itextcomponent = statbase.getStatName(); ITextComponent itextcomponent1 = new TextComponentTranslation(STR + (statbase.isAchievement() ? STR : STR), new Object[0]); itextcomponent1.getStyle().setItalic(Boolean.valueOf(true)); String s1 = statbase instanceof Achievement ? ((Achievement)statbase).getDescription() : null; List<String> list = Lists.newArrayList(new String[] {itextcomponent.getFormattedText(), itextcomponent1.getFormattedText()}); if (s1 != null) { list.addAll(this.fontRendererObj.listFormattedStringToWidth(s1, 150)); } this.drawHoveringText(list, x, y); } else { this.drawCreativeTabHoveringText(TextFormatting.RED + STR, x, y); } } GlStateManager.disableLighting(); } }
/** * Draws the hover event specified by the given chat component */
Draws the hover event specified by the given chat component
handleComponentHover
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraft/client/gui/GuiScreen.java", "license": "lgpl-2.1", "size": 28237 }
[ "com.google.common.collect.Lists", "java.util.List", "net.minecraft.client.renderer.GlStateManager", "net.minecraft.item.ItemStack", "net.minecraft.nbt.JsonToNBT", "net.minecraft.nbt.NBTBase", "net.minecraft.nbt.NBTException", "net.minecraft.nbt.NBTTagCompound", "net.minecraft.stats.Achievement", "net.minecraft.stats.StatBase", "net.minecraft.stats.StatList", "net.minecraft.util.text.ITextComponent", "net.minecraft.util.text.TextComponentTranslation", "net.minecraft.util.text.TextFormatting", "net.minecraft.util.text.event.HoverEvent" ]
import com.google.common.collect.Lists; import java.util.List; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.nbt.JsonToNBT; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTException; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.stats.Achievement; import net.minecraft.stats.StatBase; import net.minecraft.stats.StatList; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.event.HoverEvent;
import com.google.common.collect.*; import java.util.*; import net.minecraft.client.renderer.*; import net.minecraft.item.*; import net.minecraft.nbt.*; import net.minecraft.stats.*; import net.minecraft.util.text.*; import net.minecraft.util.text.event.*;
[ "com.google.common", "java.util", "net.minecraft.client", "net.minecraft.item", "net.minecraft.nbt", "net.minecraft.stats", "net.minecraft.util" ]
com.google.common; java.util; net.minecraft.client; net.minecraft.item; net.minecraft.nbt; net.minecraft.stats; net.minecraft.util;
840,920
RestStatus status();
RestStatus status();
/** * Returns the REST status to make sure it is returned correctly */
Returns the REST status to make sure it is returned correctly
status
{ "repo_name": "nknize/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/xcontent/StatusToXContentObject.java", "license": "apache-2.0", "size": 1280 }
[ "org.elasticsearch.rest.RestStatus" ]
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.*;
[ "org.elasticsearch.rest" ]
org.elasticsearch.rest;
376,637
public static Object deserialize(byte[] data) { try { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is = new ObjectInputStream(in); return is.readObject(); } catch (Throwable e) { throw DataUtils.newIllegalArgumentException( "Could not deserialize {0}", Arrays.toString(data), e); } }
static Object function(byte[] data) { try { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is = new ObjectInputStream(in); return is.readObject(); } catch (Throwable e) { throw DataUtils.newIllegalArgumentException( STR, Arrays.toString(data), e); } }
/** * De-serialize the byte array to an object. * * @param data the byte array * @return the object */
De-serialize the byte array to an object
deserialize
{ "repo_name": "wizardofos/Protozoo", "path": "extra/h2/src/main/java/org/h2/mvstore/type/ObjectDataType.java", "license": "mit", "size": 50649 }
[ "java.io.ByteArrayInputStream", "java.io.ObjectInputStream", "java.util.Arrays", "org.h2.mvstore.DataUtils" ]
import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; import java.util.Arrays; import org.h2.mvstore.DataUtils;
import java.io.*; import java.util.*; import org.h2.mvstore.*;
[ "java.io", "java.util", "org.h2.mvstore" ]
java.io; java.util; org.h2.mvstore;
2,265,580
public IgfsSecondaryOutputStreamDescriptor appendDual(final IgfsSecondaryFileSystem fs, final IgfsPath path, final int bufSize) throws IgniteCheckedException { if (busyLock.enterBusy()) { try { assert fs != null; assert path != null; SynchronizationTask<IgfsSecondaryOutputStreamDescriptor> task = new SynchronizationTask<IgfsSecondaryOutputStreamDescriptor>() { private OutputStream out;
IgfsSecondaryOutputStreamDescriptor function(final IgfsSecondaryFileSystem fs, final IgfsPath path, final int bufSize) throws IgniteCheckedException { if (busyLock.enterBusy()) { try { assert fs != null; assert path != null; SynchronizationTask<IgfsSecondaryOutputStreamDescriptor> task = new SynchronizationTask<IgfsSecondaryOutputStreamDescriptor>() { private OutputStream out;
/** * Append to a file in DUAL mode. * * @param fs File system. * @param path Path. * @param bufSize Buffer size. * @return Output stream descriptor. * @throws IgniteCheckedException If output stream open for append has failed. */
Append to a file in DUAL mode
appendDual
{ "repo_name": "zzcclp/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java", "license": "apache-2.0", "size": 123208 }
[ "java.io.OutputStream", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.igfs.IgfsPath", "org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem" ]
import java.io.OutputStream; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
import java.io.*; import org.apache.ignite.*; import org.apache.ignite.igfs.*; import org.apache.ignite.igfs.secondary.*;
[ "java.io", "org.apache.ignite" ]
java.io; org.apache.ignite;
2,879,553
protected DirectEditRequest createDirectEditRequest() { DirectEditRequest req = new DirectEditRequest(); req.setCellEditor(getCellEditor()); req.setDirectEditFeature(getDirectEditFeature()); return req; }
DirectEditRequest function() { DirectEditRequest req = new DirectEditRequest(); req.setCellEditor(getCellEditor()); req.setDirectEditFeature(getDirectEditFeature()); return req; }
/** * Creates and returns the DirectEditRequest. * @return the direct edit request */
Creates and returns the DirectEditRequest
createDirectEditRequest
{ "repo_name": "mikesligo/visGrid", "path": "ie.tcd.gmf.visGrid.plugin/src/org/eclipse/gmf/runtime/lite/services/TreeDirectEditManager.java", "license": "gpl-3.0", "size": 10314 }
[ "org.eclipse.gef.requests.DirectEditRequest" ]
import org.eclipse.gef.requests.DirectEditRequest;
import org.eclipse.gef.requests.*;
[ "org.eclipse.gef" ]
org.eclipse.gef;
2,358,062
protected void handleMissingValueAfterConversion(String name, MethodParameter parameter, NativeWebRequest request) throws Exception { handleMissingValue(name, parameter, request); }
void function(String name, MethodParameter parameter, NativeWebRequest request) throws Exception { handleMissingValue(name, parameter, request); }
/** * Invoked when a named value is present but becomes {@code null} after conversion. * @param name the name for the value * @param parameter the method parameter * @param request the current request * @since 5.3.6 */
Invoked when a named value is present but becomes null after conversion
handleMissingValueAfterConversion
{ "repo_name": "spring-projects/spring-framework", "path": "spring-web/src/main/java/org/springframework/web/method/annotation/AbstractNamedValueMethodArgumentResolver.java", "license": "apache-2.0", "size": 11886 }
[ "org.springframework.core.MethodParameter", "org.springframework.web.context.request.NativeWebRequest" ]
import org.springframework.core.MethodParameter; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.core.*; import org.springframework.web.context.request.*;
[ "org.springframework.core", "org.springframework.web" ]
org.springframework.core; org.springframework.web;
1,571,956
protected final void flush(boolean triggerMerge, boolean flushDocStores, boolean flushDeletes) throws CorruptIndexException, IOException { // We can be called during close, when closing==true, so we must pass false to ensureOpen: ensureOpen(false); if (doFlush(flushDocStores, flushDeletes) && triggerMerge) maybeMerge(); }
final void function(boolean triggerMerge, boolean flushDocStores, boolean flushDeletes) throws CorruptIndexException, IOException { ensureOpen(false); if (doFlush(flushDocStores, flushDeletes) && triggerMerge) maybeMerge(); }
/** * Flush all in-memory buffered udpates (adds and deletes) * to the Directory. * @param triggerMerge if true, we may merge segments (if * deletes or docs were flushed) if necessary * @param flushDocStores if false we are allowed to keep * doc stores open to share with the next segment * @param flushDeletes whether pending deletes should also * be flushed */
Flush all in-memory buffered udpates (adds and deletes) to the Directory
flush
{ "repo_name": "nimisha-srinivasa/RTP", "path": "src/archive_lucene/archive_lucene/src/org/apache/lucene/index/IndexWriter.java", "license": "apache-2.0", "size": 171610 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,257,640
public void addFolder(TreeItem actualItem, TreeItem newItem) { int i = 0; boolean found = false; int count = actualItem.getChildCount(); GWTFolder folder; GWTFolder newFolder = (GWTFolder) newItem.getUserObject(); String folderPath = newFolder.getPath(); for (i = 0; i < count; i++) { folder = (GWTFolder) actualItem.getChild(i).getUserObject(); // If item is found actualizate values if ((folder).getPath().equals(folderPath)) { found = true; actualItem.getChild(i).setVisible(true); actualItem.getChild(i).setUserObject(newFolder); evaluesFolderIcon(actualItem.getChild(i)); } } if (!found) { evaluesFolderIcon(newItem); actualItem.addItem(newItem); } }
void function(TreeItem actualItem, TreeItem newItem) { int i = 0; boolean found = false; int count = actualItem.getChildCount(); GWTFolder folder; GWTFolder newFolder = (GWTFolder) newItem.getUserObject(); String folderPath = newFolder.getPath(); for (i = 0; i < count; i++) { folder = (GWTFolder) actualItem.getChild(i).getUserObject(); if ((folder).getPath().equals(folderPath)) { found = true; actualItem.getChild(i).setVisible(true); actualItem.getChild(i).setUserObject(newFolder); evaluesFolderIcon(actualItem.getChild(i)); } } if (!found) { evaluesFolderIcon(newItem); actualItem.addItem(newItem); } }
/** * Adds folders to actual item if not exists or refreshes it values * * @param actualItem The actual item active * @param newItem New item to be added, or refreshed */
Adds folders to actual item if not exists or refreshes it values
addFolder
{ "repo_name": "Beau-M/document-management-system", "path": "src/main/java/com/openkm/frontend/client/widget/wizard/FolderSelectTree.java", "license": "gpl-2.0", "size": 9053 }
[ "com.google.gwt.user.client.ui.TreeItem", "com.openkm.frontend.client.bean.GWTFolder" ]
import com.google.gwt.user.client.ui.TreeItem; import com.openkm.frontend.client.bean.GWTFolder;
import com.google.gwt.user.client.ui.*; import com.openkm.frontend.client.bean.*;
[ "com.google.gwt", "com.openkm.frontend" ]
com.google.gwt; com.openkm.frontend;
2,047,831
return new DataFlavor[] { ELEMENT_FLAVOR }; }
return new DataFlavor[] { ELEMENT_FLAVOR }; }
/** * Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be * ordered according to preference for providing the data (from most richly descriptive to least descriptive). * * @return an array of data flavors in which this data can be transferred */
Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive)
getTransferDataFlavors
{ "repo_name": "EgorZhuk/pentaho-reporting", "path": "libraries/libswing/src/main/java/org/pentaho/reporting/libraries/designtime/swing/GenericTransferable.java", "license": "lgpl-2.1", "size": 3258 }
[ "java.awt.datatransfer.DataFlavor" ]
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.*;
[ "java.awt" ]
java.awt;
1,395,129
public HttpRequest buildPutRequest(GenericUrl url, HttpContent content) throws IOException { return buildRequest(HttpMethods.PUT, url, content); }
HttpRequest function(GenericUrl url, HttpContent content) throws IOException { return buildRequest(HttpMethods.PUT, url, content); }
/** * Builds a {@code PUT} request for the given URL and content. * * @param url HTTP request URL or {@code null} for none * @param content HTTP request content or {@code null} for none * @return new HTTP request */
Builds a PUT request for the given URL and content
buildPutRequest
{ "repo_name": "googleapis/google-http-java-client", "path": "google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java", "license": "apache-2.0", "size": 5007 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,837,017
@ImmediateService public Map<String, String> getMappedInfo(final String mbeanNameAsString) throws RuntimeException { return mbeaninfoviewer.getMappedInfo(mbeanNameAsString); }
Map<String, String> function(final String mbeanNameAsString) throws RuntimeException { return mbeaninfoviewer.getMappedInfo(mbeanNameAsString); }
/** * Return the informations about the Scheduler MBean as a Map. * The first time this method is called it connects to the JMX connector server. * The default behavior will try to establish a connection using RMI protocol, if it fails * the RO (Remote Object) protocol is used. * * @param mbeanNameAsString the object name of the MBean * @return the informations about the MBean as a formatted string * * @throws RuntimeException if mbean cannot access or connect the service */
Return the informations about the Scheduler MBean as a Map. The first time this method is called it connects to the JMX connector server. The default behavior will try to establish a connection using RMI protocol, if it fails the RO (Remote Object) protocol is used
getMappedInfo
{ "repo_name": "paraita/scheduling", "path": "scheduler/scheduler-client/src/main/java/org/ow2/proactive/scheduler/common/util/SchedulerProxyUserInterface.java", "license": "agpl-3.0", "size": 28363 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,170,850
@Produces @Named public List<Book> getCatalog() { return catalog; }
List<Book> function() { return catalog; }
/** * Getter for books catalog. */
Getter for books catalog
getCatalog
{ "repo_name": "rfhl93/quickstart", "path": "xml-jaxp/src/main/java/org/jboss/as/quickstart/xml/upload/FileUploadBean.java", "license": "apache-2.0", "size": 2615 }
[ "java.util.List", "org.jboss.as.quickstart.xml.Book" ]
import java.util.List; import org.jboss.as.quickstart.xml.Book;
import java.util.*; import org.jboss.as.quickstart.xml.*;
[ "java.util", "org.jboss.as" ]
java.util; org.jboss.as;
1,340,977
private void shutdownExecutorService() { if (null != _executorService) { _executorService.shutdownNow(); _executorService = null; } } private class ThreadPoolThreadFactory implements ThreadFactory {
void function() { if (null != _executorService) { _executorService.shutdownNow(); _executorService = null; } } private class ThreadPoolThreadFactory implements ThreadFactory {
/** * Shuts down an existing ExecutorService. */
Shuts down an existing ExecutorService
shutdownExecutorService
{ "repo_name": "zjpetersen/slim-plugin", "path": "src/main/java/imagej/thread/ThreadPool.java", "license": "gpl-3.0", "size": 4470 }
[ "java.util.concurrent.ThreadFactory" ]
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,692,494
@NotNull @ObjectiveCName("addPreferredLanguage:") public ConfigurationBuilder addPreferredLanguage(String language) { if (!preferredLanguages.contains(language)) { preferredLanguages.add(language); } return this; }
@ObjectiveCName(STR) ConfigurationBuilder function(String language) { if (!preferredLanguages.contains(language)) { preferredLanguages.add(language); } return this; }
/** * Adding preferred language * * @param language language code * @return this */
Adding preferred language
addPreferredLanguage
{ "repo_name": "ufosky-server/actor-platform", "path": "actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/ConfigurationBuilder.java", "license": "agpl-3.0", "size": 13080 }
[ "com.google.j2objc.annotations.ObjectiveCName" ]
import com.google.j2objc.annotations.ObjectiveCName;
import com.google.j2objc.annotations.*;
[ "com.google.j2objc" ]
com.google.j2objc;
231,371
public String extractClassNameIfRequire(Node node, Node parent);
String function(Node node, Node parent);
/** * Convenience method for determining required dependencies amongst different * JS scripts. */
Convenience method for determining required dependencies amongst different JS scripts
extractClassNameIfRequire
{ "repo_name": "anomaly/closure-compiler", "path": "src/com/google/javascript/jscomp/CodingConvention.java", "license": "apache-2.0", "size": 17767 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,799,164
private ResourceResolverControl createControl(final ResourceProviderStorageProvider resourceProviderTracker, final Map<String, Object> authenticationInfo, final boolean isAdmin) throws LoginException { final ResourceResolverControl control = new ResourceResolverControl(isAdmin, authenticationInfo, resourceProviderTracker); this.context.getProviderManager().authenticateAll(resourceProviderTracker.getResourceProviderStorage().getAuthRequiredHandlers(), control); return control; }
ResourceResolverControl function(final ResourceProviderStorageProvider resourceProviderTracker, final Map<String, Object> authenticationInfo, final boolean isAdmin) throws LoginException { final ResourceResolverControl control = new ResourceResolverControl(isAdmin, authenticationInfo, resourceProviderTracker); this.context.getProviderManager().authenticateAll(resourceProviderTracker.getResourceProviderStorage().getAuthRequiredHandlers(), control); return control; }
/** * Create the resource resolver control * @param storage The provider storage * @param authenticationInfo Current auth info * @param isAdmin Is this admin? * @return A control * @throws LoginException If auth to the required providers fails. */
Create the resource resolver control
createControl
{ "repo_name": "mikibrv/sling", "path": "bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java", "license": "apache-2.0", "size": 55288 }
[ "java.util.Map", "org.apache.sling.api.resource.LoginException", "org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl", "org.apache.sling.resourceresolver.impl.providers.ResourceProviderStorageProvider" ]
import java.util.Map; import org.apache.sling.api.resource.LoginException; import org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl; import org.apache.sling.resourceresolver.impl.providers.ResourceProviderStorageProvider;
import java.util.*; import org.apache.sling.api.resource.*; import org.apache.sling.resourceresolver.impl.helper.*; import org.apache.sling.resourceresolver.impl.providers.*;
[ "java.util", "org.apache.sling" ]
java.util; org.apache.sling;
1,480,590
public void enqueue(Message msg, ConnectionType type) throws ClosedChannelException { connectionFor(msg, type).enqueue(msg); }
void function(Message msg, ConnectionType type) throws ClosedChannelException { connectionFor(msg, type).enqueue(msg); }
/** * Select the appropriate connection for the provided message and use it to send the message. */
Select the appropriate connection for the provided message and use it to send the message
enqueue
{ "repo_name": "driftx/cassandra", "path": "src/java/org/apache/cassandra/net/OutboundConnections.java", "license": "apache-2.0", "size": 12378 }
[ "java.nio.channels.ClosedChannelException" ]
import java.nio.channels.ClosedChannelException;
import java.nio.channels.*;
[ "java.nio" ]
java.nio;
2,710,946
@IgniteSpiConfiguration(optional = true) public TcpDiscoverySpi setReconnectCount(int reconCnt) { this.reconCnt = reconCnt; failureDetectionTimeoutEnabled(false); return this; }
@IgniteSpiConfiguration(optional = true) TcpDiscoverySpi function(int reconCnt) { this.reconCnt = reconCnt; failureDetectionTimeoutEnabled(false); return this; }
/** * Number of times node tries to (re)establish connection to another node. * <p> * Note that SPI implementation will increase {@link #ackTimeout} by factor 2 * on every retry. * <p> * If not specified, default is {@link #DFLT_RECONNECT_CNT}. * <p> * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored. * * @param reconCnt Number of retries during message sending. * @see #setAckTimeout(long) * @return {@code this} for chaining. */
Number of times node tries to (re)establish connection to another node. Note that SPI implementation will increase <code>#ackTimeout</code> by factor 2 on every retry. If not specified, default is <code>#DFLT_RECONNECT_CNT</code>. When this property is explicitly set <code>IgniteConfiguration#getFailureDetectionTimeout()</code> is ignored
setReconnectCount
{ "repo_name": "a1vanov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java", "license": "apache-2.0", "size": 76111 }
[ "org.apache.ignite.spi.IgniteSpiConfiguration" ]
import org.apache.ignite.spi.IgniteSpiConfiguration;
import org.apache.ignite.spi.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,527,254
List<QueueMessage> getNextMessages(String queueName, int count);
List<QueueMessage> getNextMessages(String queueName, int count);
/** * Get next available messages from the specified queue. * * @param queueName Name of queue * @param count Number of messages to get * @return List of next messages, empty if non-available */
Get next available messages from the specified queue
getNextMessages
{ "repo_name": "mdunker/usergrid", "path": "stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/core/QueueMessageManager.java", "license": "apache-2.0", "size": 3045 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,581,345
public ActionForward notesAndAttachments(ActionMapping mapping, ActionForm form , HttpServletRequest request, HttpServletResponse response) { AwardForm awardForm = (AwardForm) form; awardForm.getAwardCommentBean().setAwardCommentScreenDisplayTypesOnForm(); awardForm.getAwardCommentBean().setAwardCommentHistoryFlags(); return mapping.findForward(Constants.MAPPING_AWARD_NOTES_AND_ATTACHMENTS_PAGE); }
ActionForward function(ActionMapping mapping, ActionForm form , HttpServletRequest request, HttpServletResponse response) { AwardForm awardForm = (AwardForm) form; awardForm.getAwardCommentBean().setAwardCommentScreenDisplayTypesOnForm(); awardForm.getAwardCommentBean().setAwardCommentHistoryFlags(); return mapping.findForward(Constants.MAPPING_AWARD_NOTES_AND_ATTACHMENTS_PAGE); }
/** * * This method gets called upon navigation to Permissions tab. */
This method gets called upon navigation to Permissions tab
notesAndAttachments
{ "repo_name": "rashikpolus/MIT_KC", "path": "coeus-impl/src/main/java/org/kuali/kra/award/web/struts/action/AwardAction.java", "license": "agpl-3.0", "size": 109987 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.kuali.kra.award.AwardForm", "org.kuali.kra.infrastructure.Constants" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.kra.award.AwardForm; import org.kuali.kra.infrastructure.Constants;
import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kra.award.*; import org.kuali.kra.infrastructure.*;
[ "javax.servlet", "org.apache.struts", "org.kuali.kra" ]
javax.servlet; org.apache.struts; org.kuali.kra;
1,987,704
public static Map<Class, Object> getRegisteredClasses() { return registrations; }
static Map<Class, Object> function() { return registrations; }
/** * get registered classes * * @return class serializer * */
get registered classes
getRegisteredClasses
{ "repo_name": "alibaba/dubbo", "path": "dubbo-serialization/dubbo-serialization-api/src/main/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistry.java", "license": "apache-2.0", "size": 2126 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,228,611
ServerGetResponse get(String resourceGroupName, String serverName) throws IOException, ServiceException;
ServerGetResponse get(String resourceGroupName, String serverName) throws IOException, ServiceException;
/** * Returns information about an Azure SQL Database Server. * * @param resourceGroupName Required. The name of the Resource Group to * which the server belongs. * @param serverName Required. The name of the server to retrieve. * @throws IOException Signals that an I/O exception of some sort has * occurred. This class is the general class of exceptions produced by * failed or interrupted I/O operations. * @throws ServiceException Thrown if an unexpected response is found. * @return Represents the response to a Get Azure Sql Database Server * request. */
Returns information about an Azure SQL Database Server
get
{ "repo_name": "southworkscom/azure-sdk-for-java", "path": "resource-management/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServerOperations.java", "license": "apache-2.0", "size": 8942 }
[ "com.microsoft.azure.management.sql.models.ServerGetResponse", "com.microsoft.windowsazure.exception.ServiceException", "java.io.IOException" ]
import com.microsoft.azure.management.sql.models.ServerGetResponse; import com.microsoft.windowsazure.exception.ServiceException; import java.io.IOException;
import com.microsoft.azure.management.sql.models.*; import com.microsoft.windowsazure.exception.*; import java.io.*;
[ "com.microsoft.azure", "com.microsoft.windowsazure", "java.io" ]
com.microsoft.azure; com.microsoft.windowsazure; java.io;
1,652,690
@GET @GZIP @Path("jobs/{jobid}/result") @Produces(MediaType.APPLICATION_JSON) JobResultData jobResult(@HeaderParam("sessionid") String sessionId, @PathParam("jobid") String jobId) throws RestException;
@Path(STR) @Produces(MediaType.APPLICATION_JSON) JobResultData jobResult(@HeaderParam(STR) String sessionId, @PathParam("jobid") String jobId) throws RestException;
/** * Returns the job result associated to the job referenced by the id * <code>jobid</code> * * @param sessionId * a valid session id * @return the job result of the corresponding job */
Returns the job result associated to the job referenced by the id <code>jobid</code>
jobResult
{ "repo_name": "mbenguig/scheduling", "path": "rest/rest-api/src/main/java/org/ow2/proactive_grid_cloud_portal/common/SchedulerRestInterface.java", "license": "agpl-3.0", "size": 98025 }
[ "javax.ws.rs.HeaderParam", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobResultData", "org.ow2.proactive_grid_cloud_portal.scheduler.exception.RestException" ]
import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobResultData; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.RestException;
import javax.ws.rs.*; import javax.ws.rs.core.*; import org.ow2.proactive_grid_cloud_portal.scheduler.dto.*; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.*;
[ "javax.ws", "org.ow2.proactive_grid_cloud_portal" ]
javax.ws; org.ow2.proactive_grid_cloud_portal;
1,636,077
@SuppressWarnings("MissingGetterMatchingBuilder") // See getFailures @NonNull public Builder<KeyType, ValueType> setFailure( @NonNull KeyType key, @AppSearchResult.ResultCode int resultCode, @Nullable String errorMessage) { Preconditions.checkNotNull(key); resetIfBuilt(); return setResult(key, AppSearchResult.newFailedResult(resultCode, errorMessage)); }
@SuppressWarnings(STR) Builder<KeyType, ValueType> function( @NonNull KeyType key, @AppSearchResult.ResultCode int resultCode, @Nullable String errorMessage) { Preconditions.checkNotNull(key); resetIfBuilt(); return setResult(key, AppSearchResult.newFailedResult(resultCode, errorMessage)); }
/** * Associates the {@code key} with the provided failure code and error message. * * <p>Any previous mapping for a key, whether success or failure, is deleted. * * <p>This is a convenience function which is equivalent to * {@code setResult(key, AppSearchResult.newFailedResult(resultCode, errorMessage))}. * * @param key The key to associate the result with; usually corresponds to some * identifier from the input like an ID or name. * @param resultCode One of the constants documented in * {@link AppSearchResult#getResultCode}. * @param errorMessage An optional string describing the reason or nature of the failure. */
Associates the key with the provided failure code and error message. Any previous mapping for a key, whether success or failure, is deleted. This is a convenience function which is equivalent to setResult(key, AppSearchResult.newFailedResult(resultCode, errorMessage))
setFailure
{ "repo_name": "AndroidX/androidx", "path": "appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchBatchResult.java", "license": "apache-2.0", "size": 8830 }
[ "androidx.annotation.NonNull", "androidx.annotation.Nullable", "androidx.core.util.Preconditions" ]
import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.util.Preconditions;
import androidx.annotation.*; import androidx.core.util.*;
[ "androidx.annotation", "androidx.core" ]
androidx.annotation; androidx.core;
174,559
public Blob getPuzzleSerial() { return this.boxesSerial; }
Blob function() { return this.boxesSerial; }
/** * Get the value of boxesSerial * * @return the value of boxesSerial */
Get the value of boxesSerial
getPuzzleSerial
{ "repo_name": "kebernet/shortyz", "path": "web/src/main/java/com/totsp/crossword/web/server/model/PuzzleListing.java", "license": "gpl-3.0", "size": 3981 }
[ "com.google.appengine.api.datastore.Blob" ]
import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.*;
[ "com.google.appengine" ]
com.google.appengine;
836,934
static boolean essentiallyEqualsTo(RedisNodeDescription o1, RedisNodeDescription o2) { if (o2 == null) { return false; } if (o1.getRole() != o2.getRole()) { return false; } if (!o1.getUri().equals(o2.getUri())) { return false; } return true; }
static boolean essentiallyEqualsTo(RedisNodeDescription o1, RedisNodeDescription o2) { if (o2 == null) { return false; } if (o1.getRole() != o2.getRole()) { return false; } if (!o1.getUri().equals(o2.getUri())) { return false; } return true; }
/** * Check for {@code MASTER} or {@code SLAVE} roles and the URI. * * @param o1 the first object to be compared. * @param o2 the second object to be compared. * @return {@literal true} if {@code MASTER} or {@code SLAVE} flags changed or the URI changed. */
Check for MASTER or SLAVE roles and the URI
essentiallyEqualsTo
{ "repo_name": "taer/lettuce", "path": "src/main/java/com/lambdaworks/redis/masterslave/MasterSlaveUtils.java", "license": "apache-2.0", "size": 2656 }
[ "com.lambdaworks.redis.models.role.RedisNodeDescription" ]
import com.lambdaworks.redis.models.role.RedisNodeDescription;
import com.lambdaworks.redis.models.role.*;
[ "com.lambdaworks.redis" ]
com.lambdaworks.redis;
230,479
protected boolean handleDirtyConflict() { return MessageDialog.openQuestion (getSite().getShell(), getString("_UI_FileConflict_label"), getString("_WARN_FileConflict")); } public RobotEditor() { super(); initializeEditingDomain(); }
boolean function() { return MessageDialog.openQuestion (getSite().getShell(), getString(STR), getString(STR)); } public RobotEditor() { super(); initializeEditingDomain(); }
/** * Shows a dialog that asks if conflicting changes should be discarded. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Shows a dialog that asks if conflicting changes should be discarded.
handleDirtyConflict
{ "repo_name": "roboidstudio/embedded", "path": "org.roboid.robot.model.editor/src/org/roboid/robot/presentation/RobotEditor.java", "license": "lgpl-2.1", "size": 57235 }
[ "org.eclipse.jface.dialogs.MessageDialog" ]
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
1,047,016
void storeConsumerMetadata(MetadataIdentifier consumerMetadataIdentifier, Map<String, String> serviceParameterMap);
void storeConsumerMetadata(MetadataIdentifier consumerMetadataIdentifier, Map<String, String> serviceParameterMap);
/** * deprecated or need triage **/
deprecated or need triage
storeConsumerMetadata
{ "repo_name": "yuyijq/dubbo", "path": "dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/MetadataReport.java", "license": "apache-2.0", "size": 2918 }
[ "java.util.Map", "org.apache.dubbo.metadata.report.identifier.MetadataIdentifier" ]
import java.util.Map; import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import java.util.*; import org.apache.dubbo.metadata.report.identifier.*;
[ "java.util", "org.apache.dubbo" ]
java.util; org.apache.dubbo;
587,122
public static String trim(CharSequence s) { if (s == null) { return null; } // Just strip any sequence of whitespace or java space characters from the beginning and end Matcher m = sTrimPattern.matcher(s); return m.replaceAll("$1"); }
static String function(CharSequence s) { if (s == null) { return null; } Matcher m = sTrimPattern.matcher(s); return m.replaceAll("$1"); }
/** * Trims the string, removing all whitespace at the beginning and end of the string. * Non-breaking whitespaces are also removed. */
Trims the string, removing all whitespace at the beginning and end of the string. Non-breaking whitespaces are also removed
trim
{ "repo_name": "Hapsidra/Chavah", "path": "Chavah/src/main/java/com/android/chavah/Utilities.java", "license": "gpl-3.0", "size": 29255 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,960,560
public void setLabelClass(String labelClass) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setLabelClass", labelClass); ScriptSessions.addScript(script); }
void function(String labelClass) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + STR, labelClass); ScriptSessions.addScript(script); }
/** * Sets the labelClass field. * @param labelClass the new value for labelClass */
Sets the labelClass field
setLabelClass
{ "repo_name": "burris/dwr", "path": "ui/gi/generated/java/jsx3/chart/Axis.java", "license": "apache-2.0", "size": 26595 }
[ "org.directwebremoting.ScriptBuffer", "org.directwebremoting.ScriptSessions" ]
import org.directwebremoting.ScriptBuffer; import org.directwebremoting.ScriptSessions;
import org.directwebremoting.*;
[ "org.directwebremoting" ]
org.directwebremoting;
2,426,660
protected Size2D arrangeNF(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { // TODO: for now we are ignoring the height constraint return arrangeNN(container, g2); }
Size2D function(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { return arrangeNN(container, g2); }
/** * Arranges the blocks with no width constraint and a fixed height * constraint. This puts all blocks into a single row. * * @param container the container. * @param constraint the constraint. * @param g2 the graphics device. * * @return The size after the arrangement. */
Arranges the blocks with no width constraint and a fixed height constraint. This puts all blocks into a single row
arrangeNF
{ "repo_name": "opensim-org/opensim-gui", "path": "Gui/opensim/jfreechart/src/org/jfree/chart/block/FlowArrangement.java", "license": "apache-2.0", "size": 15930 }
[ "java.awt.Graphics2D", "org.jfree.ui.Size2D" ]
import java.awt.Graphics2D; import org.jfree.ui.Size2D;
import java.awt.*; import org.jfree.ui.*;
[ "java.awt", "org.jfree.ui" ]
java.awt; org.jfree.ui;
2,433,793
public synchronized void printResults() throws Exception { ClientStats stats = fullStatsContext.fetch().getStats(); // 1. Voting Board statistics, Voting results and performance statistics String display = "\n" + HORIZONTAL_RULE + " Voting Results\n" + HORIZONTAL_RULE + "\nA total of %d votes were received...\n" + " - %,9d Accepted\n" + " - %,9d Rejected (Invalid Contestant)\n" + " - %,9d Rejected (Maximum Vote Count Reached)\n" + " - %,9d Failed (Transaction Error)\n\n"; System.out.printf(display, stats.getInvocationsCompleted(), acceptedVotes.get(), badContestantVotes.get(), badVoteCountVotes.get(), failedVotes.get()); // 2. Voting results VoltTable result = client.callProcedure("Results").getResults()[0]; System.out.println("Contestant Name\t\tVotes Received"); while(result.advanceRow()) { System.out.printf("%s\t\t%,14d\n", result.getString(0), result.getLong(2)); } System.out.printf("\nThe Winner is: %s\n\n", result.fetchRow(0).getString(0)); // 3. Performance statistics System.out.print(HORIZONTAL_RULE); System.out.println(" Client Workload Statistics"); System.out.println(HORIZONTAL_RULE); System.out.printf("Average throughput: %,9d txns/sec\n", stats.getTxnThroughput()); System.out.printf("Average latency: %,9.2f ms\n", stats.getAverageLatency()); System.out.printf("95th percentile latency: %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.95)); System.out.printf("99th percentile latency: %,9.2f ms\n", stats.kPercentileLatencyAsDouble(.99)); System.out.print("\n" + HORIZONTAL_RULE); System.out.println(" System Server Statistics"); System.out.println(HORIZONTAL_RULE); if (config.autotune) { System.out.printf("Targeted Internal Avg Latency: %,9d ms\n", config.latencytarget); } System.out.printf("Reported Internal Avg Latency: %,9.2f ms\n", stats.getAverageInternalLatency()); // 4. Write stats to file if requested client.writeSummaryCSV(stats, config.statsfile); }
synchronized void function() throws Exception { ClientStats stats = fullStatsContext.fetch().getStats(); String display = "\n" + HORIZONTAL_RULE + STR + HORIZONTAL_RULE + STR + STR + STR + STR + STR; System.out.printf(display, stats.getInvocationsCompleted(), acceptedVotes.get(), badContestantVotes.get(), badVoteCountVotes.get(), failedVotes.get()); VoltTable result = client.callProcedure(STR).getResults()[0]; System.out.println(STR); while(result.advanceRow()) { System.out.printf(STR, result.getString(0), result.getLong(2)); } System.out.printf(STR, result.fetchRow(0).getString(0)); System.out.print(HORIZONTAL_RULE); System.out.println(STR); System.out.println(HORIZONTAL_RULE); System.out.printf(STR, stats.getTxnThroughput()); System.out.printf(STR, stats.getAverageLatency()); System.out.printf(STR, stats.kPercentileLatencyAsDouble(.95)); System.out.printf(STR, stats.kPercentileLatencyAsDouble(.99)); System.out.print("\n" + HORIZONTAL_RULE); System.out.println(STR); System.out.println(HORIZONTAL_RULE); if (config.autotune) { System.out.printf(STR, config.latencytarget); } System.out.printf(STR, stats.getAverageInternalLatency()); client.writeSummaryCSV(stats, config.statsfile); }
/** * Prints the results of the voting simulation and statistics * about performance. * * @throws Exception if anything unexpected happens. */
Prints the results of the voting simulation and statistics about performance
printResults
{ "repo_name": "zheguang/voltdb", "path": "tests/test_apps/voter-selfcheck/src/voter/AsyncBenchmark.java", "license": "agpl-3.0", "size": 17919 }
[ "org.voltdb.VoltTable", "org.voltdb.client.ClientStats" ]
import org.voltdb.VoltTable; import org.voltdb.client.ClientStats;
import org.voltdb.*; import org.voltdb.client.*;
[ "org.voltdb", "org.voltdb.client" ]
org.voltdb; org.voltdb.client;
662,650
public int collectStudiesReceivedBefore(long time, long maxMediaUsage, String prefix) throws FinderException { Collection c = instHome.findNotOnMediaAndStudyReceivedBefore( new Timestamp(time)); if ( c.size() < 1 ) return 0; Iterator iter = c.iterator(); InstanceLocal instance; InstanceCollector collector = new InstanceCollector(); while ( iter.hasNext() ) { instance = (InstanceLocal) iter.next(); collector.add( instance ); } int nrOfStudies = collector.getNumberOfStudies(); log.info( "Collected for storage: "+c.size()+" instances in "+nrOfStudies+" studies !"); splitTooLargeStudies( collector, maxMediaUsage, prefix );
int function(long time, long maxMediaUsage, String prefix) throws FinderException { Collection c = instHome.findNotOnMediaAndStudyReceivedBefore( new Timestamp(time)); if ( c.size() < 1 ) return 0; Iterator iter = c.iterator(); InstanceLocal instance; InstanceCollector collector = new InstanceCollector(); while ( iter.hasNext() ) { instance = (InstanceLocal) iter.next(); collector.add( instance ); } int nrOfStudies = collector.getNumberOfStudies(); log.info( STR+c.size()+STR+nrOfStudies+STR); splitTooLargeStudies( collector, maxMediaUsage, prefix );
/** * Collect studies to media for storage. * <p> * <DL> * <DD>1) Find all instances that are not assigned to a media and are older as <code>time</code></DD> * <DD>2) collect instances to studies.</DD> * <DD>3) collect studies for media</DD> * <DD>4) assign media to studies</DD> * </DL> * @param time Timestamp: instances must be received before this timestamp. * @param maxMediaUsage The number of bytes that can be used to store instances on a media. * @param prefix Prefix for the FileSet id. Used if a new media object is created. * * @ejb.interface-method */
Collect studies to media for storage. 1) Find all instances that are not assigned to a media and are older as <code>time</code> 2) collect instances to studies. 3) collect studies for media 4) assign media to studies
collectStudiesReceivedBefore
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4jboss-all/tags/DCM4JBOSS_2_5_3/dcm4jboss-ejb/src/java/org/dcm4chex/archive/ejb/session/MediaComposerBean.java", "license": "apache-2.0", "size": 23165 }
[ "java.sql.Timestamp", "java.util.Collection", "java.util.Iterator", "javax.ejb.FinderException", "org.dcm4chex.archive.ejb.interfaces.InstanceLocal", "org.dcm4chex.archive.ejb.util.InstanceCollector" ]
import java.sql.Timestamp; import java.util.Collection; import java.util.Iterator; import javax.ejb.FinderException; import org.dcm4chex.archive.ejb.interfaces.InstanceLocal; import org.dcm4chex.archive.ejb.util.InstanceCollector;
import java.sql.*; import java.util.*; import javax.ejb.*; import org.dcm4chex.archive.ejb.interfaces.*; import org.dcm4chex.archive.ejb.util.*;
[ "java.sql", "java.util", "javax.ejb", "org.dcm4chex.archive" ]
java.sql; java.util; javax.ejb; org.dcm4chex.archive;
1,474,148
// computational complexity: O(n) where n is the number of allocations boolean hasEnoughResource(ContinuousResource request) { double allocated = allocations.stream() .filter(x -> x.resource() instanceof ContinuousResource) .map(x -> (ContinuousResource) x.resource()) .mapToDouble(ContinuousResource::value) .sum(); double left = original.value() - allocated; return request.value() <= left; }
boolean hasEnoughResource(ContinuousResource request) { double allocated = allocations.stream() .filter(x -> x.resource() instanceof ContinuousResource) .map(x -> (ContinuousResource) x.resource()) .mapToDouble(ContinuousResource::value) .sum(); double left = original.value() - allocated; return request.value() <= left; }
/** * Checks if there is enough resource volume to allocated the requested resource * against the specified resource. * * @param request requested resource * @return true if there is enough resource volume. Otherwise, false. */
Checks if there is enough resource volume to allocated the requested resource against the specified resource
hasEnoughResource
{ "repo_name": "LorenzReinhart/ONOSnew", "path": "core/store/dist/src/main/java/org/onosproject/store/resource/impl/ContinuousResourceAllocation.java", "license": "apache-2.0", "size": 4273 }
[ "org.onosproject.net.resource.ContinuousResource" ]
import org.onosproject.net.resource.ContinuousResource;
import org.onosproject.net.resource.*;
[ "org.onosproject.net" ]
org.onosproject.net;
2,527,971
@RequestMapping(method = RequestMethod.POST, params = "action=removeByFName") public ModelAndView removeByFName( HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "fname") String fname) throws IOException { IUserInstance ui = userInstanceManager.getUserInstance(request); UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager(); IUserLayoutManager ulm = upm.getUserLayoutManager(); try { String elementId = ulm.getUserLayout().findNodeId(new PortletSubscribeIdResolver(fname)); if (elementId != null) { // Delete the requested element node. This code is the same for // all node types, so we can just have a generic action. if (!ulm.deleteNode(elementId)) { logger.info( "Failed to remove element ID {} from layout root folder ID {}, delete node returned false", elementId, ulm.getRootFolderId()); response.setStatus(HttpServletResponse.SC_FORBIDDEN); return new ModelAndView( "jsonView", Collections.singletonMap( "error", getMessage( "error.element.update", "Unable to update element", RequestContextUtils.getLocale(request)))); } } else { response.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } ulm.saveUserLayout(); return new ModelAndView("jsonView", Collections.emptyMap()); } catch (PortalException e) { return handlePersistError(request, response, e); } }
@RequestMapping(method = RequestMethod.POST, params = STR) ModelAndView function( HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "fname") String fname) throws IOException { IUserInstance ui = userInstanceManager.getUserInstance(request); UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager(); IUserLayoutManager ulm = upm.getUserLayoutManager(); try { String elementId = ulm.getUserLayout().findNodeId(new PortletSubscribeIdResolver(fname)); if (elementId != null) { if (!ulm.deleteNode(elementId)) { logger.info( STR, elementId, ulm.getRootFolderId()); response.setStatus(HttpServletResponse.SC_FORBIDDEN); return new ModelAndView( STR, Collections.singletonMap( "error", getMessage( STR, STR, RequestContextUtils.getLocale(request)))); } } else { response.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } ulm.saveUserLayout(); return new ModelAndView(STR, Collections.emptyMap()); } catch (PortalException e) { return handlePersistError(request, response, e); } }
/** * Remove the first element with the provided fname from the layout. * * @param request HttpServletRequest * @param response HttpServletResponse * @param fname fname of the portlet to remove from the layout * @return json response * @throws IOException if the person cannot be retrieved */
Remove the first element with the provided fname from the layout
removeByFName
{ "repo_name": "GIP-RECIA/esco-portail", "path": "uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java", "license": "apache-2.0", "size": 68482 }
[ "java.io.IOException", "java.util.Collections", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apereo.portal.PortalException", "org.apereo.portal.UserPreferencesManager", "org.apereo.portal.layout.IUserLayoutManager", "org.apereo.portal.layout.PortletSubscribeIdResolver", "org.apereo.portal.user.IUserInstance", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam", "org.springframework.web.servlet.ModelAndView", "org.springframework.web.servlet.support.RequestContextUtils" ]
import java.io.IOException; import java.util.Collections; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apereo.portal.PortalException; import org.apereo.portal.UserPreferencesManager; import org.apereo.portal.layout.IUserLayoutManager; import org.apereo.portal.layout.PortletSubscribeIdResolver; import org.apereo.portal.user.IUserInstance; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.support.RequestContextUtils;
import java.io.*; import java.util.*; import javax.servlet.http.*; import org.apereo.portal.*; import org.apereo.portal.layout.*; import org.apereo.portal.user.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*; import org.springframework.web.servlet.support.*;
[ "java.io", "java.util", "javax.servlet", "org.apereo.portal", "org.springframework.web" ]
java.io; java.util; javax.servlet; org.apereo.portal; org.springframework.web;
1,343,140
return PoolManagerImpl.getPMI().createFactory(); }
return PoolManagerImpl.getPMI().createFactory(); }
/** * Creates a new {@link PoolFactory pool factory}, * which is used to configure and create new {@link Pool}s. * @return the new pool factory */
Creates a new <code>PoolFactory pool factory</code>, which is used to configure and create new <code>Pool</code>s
createFactory
{ "repo_name": "ameybarve15/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/client/PoolManager.java", "license": "apache-2.0", "size": 3090 }
[ "com.gemstone.gemfire.internal.cache.PoolManagerImpl" ]
import com.gemstone.gemfire.internal.cache.PoolManagerImpl;
import com.gemstone.gemfire.internal.cache.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
1,674,319
private static BigDecimal arctanTaylor(BigDecimal x, int scale) { int sp1 = scale + 1; int i = 3; boolean addFlag = false; BigDecimal power = x; BigDecimal sum = x; BigDecimal term; // Convergence tolerance = 5*(10^-(scale+1)) BigDecimal tolerance = BigDecimal.valueOf(5) .movePointLeft(sp1); // Loop until the approximations converge // (two successive approximations are within the tolerance). do { // x^i power = power.multiply(x).multiply(x) .setScale(sp1, BigDecimal.ROUND_HALF_EVEN); // (x^i)/i term = power.divide(BigDecimal.valueOf(i), sp1, BigDecimal.ROUND_HALF_EVEN); // sum = sum +- (x^i)/i sum = addFlag ? sum.add(term) : sum.subtract(term); i += 2; addFlag = !addFlag; Thread.yield(); } while (term.compareTo(tolerance) > 0); return sum; }
static BigDecimal function(BigDecimal x, int scale) { int sp1 = scale + 1; int i = 3; boolean addFlag = false; BigDecimal power = x; BigDecimal sum = x; BigDecimal term; BigDecimal tolerance = BigDecimal.valueOf(5) .movePointLeft(sp1); do { power = power.multiply(x).multiply(x) .setScale(sp1, BigDecimal.ROUND_HALF_EVEN); term = power.divide(BigDecimal.valueOf(i), sp1, BigDecimal.ROUND_HALF_EVEN); sum = addFlag ? sum.add(term) : sum.subtract(term); i += 2; addFlag = !addFlag; Thread.yield(); } while (term.compareTo(tolerance) > 0); return sum; }
/** * Compute the arctangent of x to a given scale * by the Taylor series, |x| < 1 * @param x the value of x * @param scale the desired scale of the result * @return the result value */
Compute the arctangent of x to a given scale by the Taylor series, |x| < 1
arctanTaylor
{ "repo_name": "grosscol/CapeCOD", "path": "src/capecod/BigFunctions.java", "license": "gpl-3.0", "size": 11987 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
2,142,913
public DeploymentResult readDeploy(String resource, String moduleURI, String moduleArchive, Object userObject) throws IOException, ParseException, DeploymentException;
DeploymentResult function(String resource, String moduleURI, String moduleArchive, Object userObject) throws IOException, ParseException, DeploymentException;
/** * Shortcut method to read and deploy a single module from a classpath resource. * <p> * Uses default options for performing deployment dependency checking and deployment. * @param resource to read * @param moduleURI uri of module to assign or null if not applicable * @param moduleArchive archive name of module to assign or null if not applicable * @param userObject user object to assign to module, passed along unused as part of deployment information, or null if not applicable * @return deployment result object * @throws IOException when the file could not be read * @throws ParseException when parsing of the module failed * @throws DeploymentOrderException when any module dependencies are not satisfied * @throws DeploymentActionException when the deployment fails, contains a list of deployment failures */
Shortcut method to read and deploy a single module from a classpath resource. Uses default options for performing deployment dependency checking and deployment
readDeploy
{ "repo_name": "intelie/esper", "path": "esper/src/main/java/com/espertech/esper/client/deploy/EPDeploymentAdmin.java", "license": "gpl-2.0", "size": 12532 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
842,920
public void setMaxSpeed(DoF deg, float maxSpd, float accelTime, float decelerationTime) { maxSpeedPerSecondOfAccell[deg.ordinal()] = maxSpd / accelTime; maxAccellPeriod[deg.ordinal()] = accelTime; if (decelerationTime < 0.00001) { decelerationTime = 0.00001f; } decelerationFactor[deg.ordinal()] = accelTime / decelerationTime; } /** * Set the terrain following logic for camera. Camera position will not get * under the value returned by the heightProvider. Please add some extra * buffering here, so camera will not clip the actual terrain - for example * * <pre> * new HeightProvider() { * &#064;Override * public float getHeight(Vector2f coord) { * return terrain.getHeight(coord) + 10; * } * }
void function(DoF deg, float maxSpd, float accelTime, float decelerationTime) { maxSpeedPerSecondOfAccell[deg.ordinal()] = maxSpd / accelTime; maxAccellPeriod[deg.ordinal()] = accelTime; if (decelerationTime < 0.00001) { decelerationTime = 0.00001f; } decelerationFactor[deg.ordinal()] = accelTime / decelerationTime; } /** * Set the terrain following logic for camera. Camera position will not get * under the value returned by the heightProvider. Please add some extra * buffering here, so camera will not clip the actual terrain - for example * * <pre> * new HeightProvider() { * &#064;Override * public float getHeight(Vector2f coord) { * return terrain.getHeight(coord) + 10; * } * }
/** * Set the maximum speed for given direction of movement. For * SIDE/FWD/DISTANCE it is in units/second, for ROTATE/TILT it is in * radians/second. * * @param deg degree of freedom for which to set the maximum speed * @param maxSpd maximum speed of movement in that direction * @param accelTime amount of time which is need to accelerate to full speed * in seconds (has to be bigger than zero, values over half second feel very * sluggish). Defaults are 0.4 seconds * @param decelerationTime amount of time in seconds which is needed to * automatically decelerate (friction-like stopping) from maxSpd to full * stop. */
Set the maximum speed for given direction of movement. For SIDE/FWD/DISTANCE it is in units/second, for ROTATE/TILT it is in radians/second
setMaxSpeed
{ "repo_name": "MultiverseKing/HexGrid_JME", "path": "HexGridAPI/src/org/hexgridapi/core/camera/RTSCamera0.java", "license": "gpl-3.0", "size": 19697 }
[ "com.jme3.math.Vector2f" ]
import com.jme3.math.Vector2f;
import com.jme3.math.*;
[ "com.jme3.math" ]
com.jme3.math;
2,165,076
private Region createPredicateDirectly(final String varName, final int index) { return rmgr.createPredicate(varName + "@" + index); }
Region function(final String varName, final int index) { return rmgr.createPredicate(varName + "@" + index); }
/** This function returns a region for a variable. * This function does not track any statistics. */
This function returns a region for a variable
createPredicateDirectly
{ "repo_name": "nishanttotla/predator", "path": "cpachecker/src/org/sosy_lab/cpachecker/cpa/bdd/PredicateManager.java", "license": "gpl-3.0", "size": 7760 }
[ "org.sosy_lab.cpachecker.util.predicates.interfaces.Region" ]
import org.sosy_lab.cpachecker.util.predicates.interfaces.Region;
import org.sosy_lab.cpachecker.util.predicates.interfaces.*;
[ "org.sosy_lab.cpachecker" ]
org.sosy_lab.cpachecker;
2,777,024
@Override public long readLong() throws IOException { byte b1 = readAndCheckByte(); byte b2 = readAndCheckByte(); byte b3 = readAndCheckByte(); byte b4 = readAndCheckByte(); byte b5 = readAndCheckByte(); byte b6 = readAndCheckByte(); byte b7 = readAndCheckByte(); byte b8 = readAndCheckByte(); return Longs.fromBytes(b8, b7, b6, b5, b4, b3, b2, b1); }
long function() throws IOException { byte b1 = readAndCheckByte(); byte b2 = readAndCheckByte(); byte b3 = readAndCheckByte(); byte b4 = readAndCheckByte(); byte b5 = readAndCheckByte(); byte b6 = readAndCheckByte(); byte b7 = readAndCheckByte(); byte b8 = readAndCheckByte(); return Longs.fromBytes(b8, b7, b6, b5, b4, b3, b2, b1); }
/** * Reads a {@code long} as specified by {@link DataInputStream#readLong()}, * except using little-endian byte order. * * @return the next eight bytes of the input stream, interpreted as a * {@code long} in little-endian byte order * @throws IOException if an I/O error occurs */
Reads a long as specified by <code>DataInputStream#readLong()</code>, except using little-endian byte order
readLong
{ "repo_name": "kumarrus/voltdb", "path": "third_party/java/src/com/google_voltpatches/common/io/LittleEndianDataInputStream.java", "license": "agpl-3.0", "size": 6813 }
[ "com.google_voltpatches.common.primitives.Longs", "java.io.IOException" ]
import com.google_voltpatches.common.primitives.Longs; import java.io.IOException;
import com.google_voltpatches.common.primitives.*; import java.io.*;
[ "com.google_voltpatches.common", "java.io" ]
com.google_voltpatches.common; java.io;
261,109
public void setMatrix(AffineTransform transform) { COSArray matrix = new COSArray(); double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { matrix.add(new COSFloat((float)v)); } getCOSObject().setItem(COSName.MATRIX, matrix); }
void function(AffineTransform transform) { COSArray matrix = new COSArray(); double[] values = new double[6]; transform.getMatrix(values); for (double v : values) { matrix.add(new COSFloat((float)v)); } getCOSObject().setItem(COSName.MATRIX, matrix); }
/** * Sets the optional Matrix entry for the Pattern. * @param transform the transformation matrix */
Sets the optional Matrix entry for the Pattern
setMatrix
{ "repo_name": "veraPDF/veraPDF-pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/pattern/PDAbstractPattern.java", "license": "apache-2.0", "size": 6102 }
[ "java.awt.geom.AffineTransform", "org.apache.pdfbox.cos.COSArray", "org.apache.pdfbox.cos.COSFloat", "org.apache.pdfbox.cos.COSName" ]
import java.awt.geom.AffineTransform; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSFloat; import org.apache.pdfbox.cos.COSName;
import java.awt.geom.*; import org.apache.pdfbox.cos.*;
[ "java.awt", "org.apache.pdfbox" ]
java.awt; org.apache.pdfbox;
1,691,980
@Override public void exitSwitchBlockStatementGroup(@NotNull JavaParser.SwitchBlockStatementGroupContext ctx) { }
@Override public void exitSwitchBlockStatementGroup(@NotNull JavaParser.SwitchBlockStatementGroupContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterSwitchBlockStatementGroup
{ "repo_name": "martinaguero/deep", "path": "src/org/trimatek/deep/lexer/JavaBaseListener.java", "license": "apache-2.0", "size": 39286 }
[ "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,030,635
public static StringBuffer readStringBuffer(File file) throws IOException { return (new StringBuffer(readString(file))); }
static StringBuffer function(File file) throws IOException { return (new StringBuffer(readString(file))); }
/** * <p> * <jdl:section> * <jdl:text lang='it'>Legge il contenuto di un file file.</jdl:text> * <jdl:text lang='en'>Read the content of a file.</jdl:text> * </jdl:section> * </p> * * @param file <jdl:section> * <jdl:text lang='it'>Il file su cui scrivere.</jdl:text> * <jdl:text lang='en'>Data to write to the files.</jdl:text> * </jdl:section> * @return <jdl:section> * <jdl:text lang='it'>Il contenuto del file come un array di <code>java.lang.String</code>.</jdl:text> * <jdl:text lang='en'>The content of the file as a <code>java.lang.String</code> array.</jdl:text> * </jdl:section> * @throws IOException <jdl:section> * <jdl:text lang='it'>Se qualcosa va male durante l'elaborazione.</jdl:text> * <jdl:text lang='en'>If something goes wrong during elaboration.</jdl:text> * </jdl:section> */
Legge il contenuto di un file file. Read the content of a file.
readStringBuffer
{ "repo_name": "fugeritaetas/morozko-lib", "path": "java16-fugerit/org.fugerit.java.core/src/main/java/org/fugerit/java/core/io/FileIO.java", "license": "apache-2.0", "size": 31724 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
700,814
private void activateCells(List activeCellList, int rowIndex) { EffRow row = rowGroup[rowIndex]; for (int i = 0; i < columnCount; i++) { GridUnit gu = row.getGridUnit(i); if (!gu.isEmpty() && gu.isPrimary()) { assert (gu instanceof PrimaryGridUnit); activeCellList.add(new ActiveCell((PrimaryGridUnit) gu, row, rowIndex, previousRowsLength, getTableLM())); } } }
void function(List activeCellList, int rowIndex) { EffRow row = rowGroup[rowIndex]; for (int i = 0; i < columnCount; i++) { GridUnit gu = row.getGridUnit(i); if (!gu.isEmpty() && gu.isPrimary()) { assert (gu instanceof PrimaryGridUnit); activeCellList.add(new ActiveCell((PrimaryGridUnit) gu, row, rowIndex, previousRowsLength, getTableLM())); } } }
/** * Creates ActiveCell instances for cells starting on the row at the given index. * * @param activeCellList the list that will hold the active cells * @param rowIndex the index of the row from which cells must be activated */
Creates ActiveCell instances for cells starting on the row at the given index
activateCells
{ "repo_name": "StrategyObject/fop", "path": "src/java/org/apache/fop/layoutmgr/table/TableStepper.java", "license": "apache-2.0", "size": 19734 }
[ "java.util.List", "org.apache.fop.fo.flow.table.EffRow", "org.apache.fop.fo.flow.table.GridUnit", "org.apache.fop.fo.flow.table.PrimaryGridUnit" ]
import java.util.List; import org.apache.fop.fo.flow.table.EffRow; import org.apache.fop.fo.flow.table.GridUnit; import org.apache.fop.fo.flow.table.PrimaryGridUnit;
import java.util.*; import org.apache.fop.fo.flow.table.*;
[ "java.util", "org.apache.fop" ]
java.util; org.apache.fop;
2,504,266
public void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName) throws RepositoryException;
void function(NodeId srcNodeId, NodeId destParentNodeId, Name destName) throws RepositoryException;
/** * Move the node identified by the given <code>srcNodeId</code> to the * new parent identified by <code>destParentNodeId</code> and change its * name to <code>destName</code>. * * @param srcNodeId NodeId identifying the node to be moved. * @param destParentNodeId NodeId identifying the new parent. * @param destName The new name of the moved node. * @throws javax.jcr.ItemExistsException * @throws javax.jcr.PathNotFoundException * @throws javax.jcr.version.VersionException * @throws javax.jcr.nodetype.ConstraintViolationException * @throws javax.jcr.lock.LockException * @throws javax.jcr.AccessDeniedException * @throws javax.jcr.UnsupportedRepositoryOperationException * @throws javax.jcr.RepositoryException * @see javax.jcr.Session#move(String, String) */
Move the node identified by the given <code>srcNodeId</code> to the new parent identified by <code>destParentNodeId</code> and change its name to <code>destName</code>
move
{ "repo_name": "apache/jackrabbit", "path": "jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/Batch.java", "license": "apache-2.0", "size": 14018 }
[ "javax.jcr.RepositoryException" ]
import javax.jcr.RepositoryException;
import javax.jcr.*;
[ "javax.jcr" ]
javax.jcr;
865,375
public void setEnableSound(boolean enableSound) { Sequence sequence = sequencer.getSequence(); if(sequence == null) return; Track[] tracks = sequence.getTracks(); for (int i = 0; i < tracks.length; i++) { sequencer.setTrackMute(i, !enableSound); } }
void function(boolean enableSound) { Sequence sequence = sequencer.getSequence(); if(sequence == null) return; Track[] tracks = sequence.getTracks(); for (int i = 0; i < tracks.length; i++) { sequencer.setTrackMute(i, !enableSound); } }
/** * Mute or unmute the sound. Note that this will only have effect for the * current sequence which is playing! * * @see ca.rmen.nounours.Nounours#setEnableSoundImpl(boolean) */
Mute or unmute the sound. Note that this will only have effect for the current sequence which is playing
setEnableSound
{ "repo_name": "caarmen/libnounours", "path": "swingnours/src/main/java/ca/rmen/nounours/swing/SwingNounoursSoundHandler.java", "license": "lgpl-3.0", "size": 7067 }
[ "javax.sound.midi.Sequence", "javax.sound.midi.Track" ]
import javax.sound.midi.Sequence; import javax.sound.midi.Track;
import javax.sound.midi.*;
[ "javax.sound" ]
javax.sound;
2,215,222
public static void logPanelStateUserAction(PanelState toState, StateChangeReason reason) { switch (toState) { case CLOSED: if (reason == StateChangeReason.BACK_PRESS) { RecordUserAction.record("ContextualSearch.BackPressClose"); } else if (reason == StateChangeReason.CLOSE_BUTTON) { RecordUserAction.record("ContextualSearch.CloseButtonClose"); } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingClose"); } else if (reason == StateChangeReason.TAB_PROMOTION) { RecordUserAction.record("ContextualSearch.TabPromotionClose"); } else if (reason == StateChangeReason.BASE_PAGE_TAP) { RecordUserAction.record("ContextualSearch.BasePageTapClose"); } else if (reason == StateChangeReason.BASE_PAGE_SCROLL) { RecordUserAction.record("ContextualSearch.BasePageScrollClose"); } else if (reason == StateChangeReason.SEARCH_BAR_TAP) { RecordUserAction.record("ContextualSearch.SearchBarTapClose"); } else if (reason == StateChangeReason.SERP_NAVIGATION) { RecordUserAction.record("ContextualSearch.NavigationClose"); } else { RecordUserAction.record("ContextualSearch.UncommonClose"); } break; case PEEKED: if (reason == StateChangeReason.TEXT_SELECT_TAP) { RecordUserAction.record("ContextualSearch.TapPeek"); } else if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingPeek"); } else if (reason == StateChangeReason.TEXT_SELECT_LONG_PRESS) { RecordUserAction.record("ContextualSearch.LongpressPeek"); } break; case EXPANDED: if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingExpand"); } else if (reason == StateChangeReason.SEARCH_BAR_TAP) { RecordUserAction.record("ContextualSearch.SearchBarTapExpand"); } break; case MAXIMIZED: if (reason == StateChangeReason.SWIPE || reason == StateChangeReason.FLING) { RecordUserAction.record("ContextualSearch.SwipeOrFlingMaximize"); } else if (reason == StateChangeReason.SERP_NAVIGATION) { RecordUserAction.record("ContextualSearch.NavigationMaximize"); } break; default: break; } }
static void function(PanelState toState, StateChangeReason reason) { switch (toState) { case CLOSED: if (reason == StateChangeReason.BACK_PRESS) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.CLOSE_BUTTON) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.SWIPE reason == StateChangeReason.FLING) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.TAB_PROMOTION) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.BASE_PAGE_TAP) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.BASE_PAGE_SCROLL) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.SEARCH_BAR_TAP) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.SERP_NAVIGATION) { RecordUserAction.record(STR); } else { RecordUserAction.record(STR); } break; case PEEKED: if (reason == StateChangeReason.TEXT_SELECT_TAP) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.SWIPE reason == StateChangeReason.FLING) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.TEXT_SELECT_LONG_PRESS) { RecordUserAction.record(STR); } break; case EXPANDED: if (reason == StateChangeReason.SWIPE reason == StateChangeReason.FLING) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.SEARCH_BAR_TAP) { RecordUserAction.record(STR); } break; case MAXIMIZED: if (reason == StateChangeReason.SWIPE reason == StateChangeReason.FLING) { RecordUserAction.record(STR); } else if (reason == StateChangeReason.SERP_NAVIGATION) { RecordUserAction.record(STR); } break; default: break; } }
/** * Logs a user action for a change to the Panel state, which allows sequencing of actions. * @param toState The state to transition to. * @param reason The reason for the state transition. */
Logs a user action for a change to the Panel state, which allows sequencing of actions
logPanelStateUserAction
{ "repo_name": "mogoweb/365browser", "path": "app/src/main/java/org/chromium/chrome/browser/contextualsearch/ContextualSearchUma.java", "license": "apache-2.0", "size": 66156 }
[ "org.chromium.base.metrics.RecordUserAction", "org.chromium.chrome.browser.compositor.bottombar.OverlayPanel" ]
import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel;
import org.chromium.base.metrics.*; import org.chromium.chrome.browser.compositor.bottombar.*;
[ "org.chromium.base", "org.chromium.chrome" ]
org.chromium.base; org.chromium.chrome;
2,605,227
boolean balancer() throws IOException;
boolean balancer() throws IOException;
/** * Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the * reassignments. Can NOT run for various reasons. Check logs. * * @return True if balancer ran, false otherwise. */
Invoke the balancer. Will run the balancer and if regions to move, it will go ahead and do the reassignments. Can NOT run for various reasons. Check logs
balancer
{ "repo_name": "SeekerResource/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java", "license": "apache-2.0", "size": 60792 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,881,020
@PUT @Path("{connectionName}/connect") public Response connect(@PathParam("connectionName") String connectionName) { try { Application.getConnectionManager().connect(connectionName); } catch (ConnectionEstablishedException e) { LOGGER.warn(e.toString()); return Response.ok().entity("INFO: connection allready aktive | " + e.toString()).build(); } catch (ConnectionException e) { return responseError("connecting to " + connectionName, e.toString()); } return Response.ok("INFO: connecting successfully").build(); }
@Path(STR) Response function(@PathParam(STR) String connectionName) { try { Application.getConnectionManager().connect(connectionName); } catch (ConnectionEstablishedException e) { LOGGER.warn(e.toString()); return Response.ok().entity(STR + e.toString()).build(); } catch (ConnectionException e) { return responseError(STR + connectionName, e.toString()); } return Response.ok(STR).build(); }
/** * Conneced the dataservice with connection default to a MAP-Server. * * Example-URL: <tt>http://example.com:8000/default/connect</tt> * * **/
Conneced the dataservice with connection default to a MAP-Server
connect
{ "repo_name": "MReichenbach/visitmeta", "path": "dataservice/src/main/java/de/hshannover/f4/trust/visitmeta/dataservice/rest/ConnectionResource.java", "license": "apache-2.0", "size": 8681 }
[ "de.hshannover.f4.trust.visitmeta.dataservice.Application", "de.hshannover.f4.trust.visitmeta.exceptions.ifmap.ConnectionEstablishedException", "de.hshannover.f4.trust.visitmeta.exceptions.ifmap.ConnectionException", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.core.Response" ]
import de.hshannover.f4.trust.visitmeta.dataservice.Application; import de.hshannover.f4.trust.visitmeta.exceptions.ifmap.ConnectionEstablishedException; import de.hshannover.f4.trust.visitmeta.exceptions.ifmap.ConnectionException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response;
import de.hshannover.f4.trust.visitmeta.dataservice.*; import de.hshannover.f4.trust.visitmeta.exceptions.ifmap.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "de.hshannover.f4", "javax.ws" ]
de.hshannover.f4; javax.ws;
913,582
if (testing_phase != null) { return testing_phase; } Calendar cal = Calendar.getInstance(); int hour = cal.get(Calendar.HOUR_OF_DAY); // anything but precise, but who cares int diffToMidnight = Math.min(hour, 24 - hour); if (diffToMidnight > 3) { return DAY; } else if (diffToMidnight == 3) { if (hour < 12) { return SUNRISE; } else { return SUNSET; } } else if (diffToMidnight == 2) { if (hour < 12) { return DAWN; } else { return DUSK; } } else { return NIGHT; } }
if (testing_phase != null) { return testing_phase; } Calendar cal = Calendar.getInstance(); int hour = cal.get(Calendar.HOUR_OF_DAY); int diffToMidnight = Math.min(hour, 24 - hour); if (diffToMidnight > 3) { return DAY; } else if (diffToMidnight == 3) { if (hour < 12) { return SUNRISE; } else { return SUNSET; } } else if (diffToMidnight == 2) { if (hour < 12) { return DAWN; } else { return DUSK; } } else { return NIGHT; } }
/** * gets the current daylight phase * * @return DaylightPhase */
gets the current daylight phase
current
{ "repo_name": "AntumDeluge/arianne-stendhal", "path": "src/games/stendhal/server/core/rp/DaylightPhase.java", "license": "gpl-2.0", "size": 2964 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
1,705,091
public String sprintf(Object x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb=new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c=='\0') sb.append(cs.getLiteral()); else if (c=='%') sb.append("%"); else { if (x instanceof Byte) sb.append(cs.internalsprintf( ((Byte)x).byteValue())); else if (x instanceof Short) sb.append(cs.internalsprintf( ((Short)x).shortValue())); else if (x instanceof Integer) sb.append(cs.internalsprintf( ((Integer)x).intValue())); else if (x instanceof Long) sb.append(cs.internalsprintf( ((Long)x).longValue())); else if (x instanceof Float) sb.append(cs.internalsprintf( ((Float)x).floatValue())); else if (x instanceof Double) sb.append(cs.internalsprintf( ((Double)x).doubleValue())); else if (x instanceof Character) sb.append(cs.internalsprintf( ((Character)x).charValue())); else if (x instanceof String) sb.append(cs.internalsprintf( (String)x)); else sb.append(cs.internalsprintf(x)); } } return sb.toString(); } private class ConversionSpecification { ConversionSpecification() { } ConversionSpecification(String fmtArg) throws IllegalArgumentException { if (fmtArg==null) throw new NullPointerException(); if (fmtArg.length()==0) throw new IllegalArgumentException( "Control strings must have positive"+ " lengths."); if (fmtArg.charAt(0)=='%') { fmt = fmtArg; pos=1; setArgPosition(); setFlagCharacters(); setFieldWidth(); setPrecision(); setOptionalHL(); if (setConversionCharacter()) { if (pos==fmtArg.length()) { if(leadingZeros&&leftJustify) leadingZeros=false; if(precisionSet&&leadingZeros){ if(conversionCharacter=='d' ||conversionCharacter=='i' ||conversionCharacter=='o' ||conversionCharacter=='x') { leadingZeros=false; } } } else throw new IllegalArgumentException( "Malformed conversion specification="+ fmtArg); } else throw new IllegalArgumentException( "Malformed conversion specification="+ fmtArg); } else throw new IllegalArgumentException( "Control strings must begin with %."); }
String function(Object x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb=new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c=='\0') sb.append(cs.getLiteral()); else if (c=='%') sb.append("%"); else { if (x instanceof Byte) sb.append(cs.internalsprintf( ((Byte)x).byteValue())); else if (x instanceof Short) sb.append(cs.internalsprintf( ((Short)x).shortValue())); else if (x instanceof Integer) sb.append(cs.internalsprintf( ((Integer)x).intValue())); else if (x instanceof Long) sb.append(cs.internalsprintf( ((Long)x).longValue())); else if (x instanceof Float) sb.append(cs.internalsprintf( ((Float)x).floatValue())); else if (x instanceof Double) sb.append(cs.internalsprintf( ((Double)x).doubleValue())); else if (x instanceof Character) sb.append(cs.internalsprintf( ((Character)x).charValue())); else if (x instanceof String) sb.append(cs.internalsprintf( (String)x)); else sb.append(cs.internalsprintf(x)); } } return sb.toString(); } private class ConversionSpecification { ConversionSpecification() { } ConversionSpecification(String fmtArg) throws IllegalArgumentException { if (fmtArg==null) throw new NullPointerException(); if (fmtArg.length()==0) throw new IllegalArgumentException( STR+ STR); if (fmtArg.charAt(0)=='%') { fmt = fmtArg; pos=1; setArgPosition(); setFlagCharacters(); setFieldWidth(); setPrecision(); setOptionalHL(); if (setConversionCharacter()) { if (pos==fmtArg.length()) { if(leadingZeros&&leftJustify) leadingZeros=false; if(precisionSet&&leadingZeros){ if(conversionCharacter=='d' conversionCharacter=='i' conversionCharacter=='o' conversionCharacter=='x') { leadingZeros=false; } } } else throw new IllegalArgumentException( STR+ fmtArg); } else throw new IllegalArgumentException( STR+ fmtArg); } else throw new IllegalArgumentException( STR); }
/** * Format an Object. Convert wrapper types to * their primitive equivalents and call the * appropriate internal formatting method. Convert * Strings using an internal formatting method for * Strings. Otherwise use the default formatter * (use toString). * @param x the Object to format. * @return the formatted String. * @exception IllegalArgumentException if the * conversion character is inappropriate for * formatting an unwrapped value. */
Format an Object. Convert wrapper types to their primitive equivalents and call the appropriate internal formatting method. Convert Strings using an internal formatting method for Strings. Otherwise use the default formatter (use toString)
sprintf
{ "repo_name": "entityresolution/Entity_Resolution_Service_Intermediary_OSGi", "path": "src/main/java/com/wcohen/ss/PrintfFormat.java", "license": "apache-2.0", "size": 98188 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
1,203,682
public static Document getOwnerDocument(Node node) { if (node.getNodeType() == Node.DOCUMENT_NODE) { return (Document) node; } try { return node.getOwnerDocument(); } catch (NullPointerException npe) { throw new NullPointerException(I18n.translate("endorsed.jdk1.4.0") + " Original message was \"" + npe.getMessage() + "\""); } }
static Document function(Node node) { if (node.getNodeType() == Node.DOCUMENT_NODE) { return (Document) node; } try { return node.getOwnerDocument(); } catch (NullPointerException npe) { throw new NullPointerException(I18n.translate(STR) + STRSTR\""); } }
/** * This method returns the owner document of a particular node. * This method is necessary because it <I>always</I> returns a * {@link Document}. {@link Node#getOwnerDocument} returns <CODE>null</CODE> * if the {@link Node} is a {@link Document}. * * @param node * @return the owner document of the node */
This method returns the owner document of a particular node. This method is necessary because it always returns a <code>Document</code>. <code>Node#getOwnerDocument</code> returns <code>null</code> if the <code>Node</code> is a <code>Document</code>
getOwnerDocument
{ "repo_name": "lambdalab-mirror/jdk7u-jdk", "path": "src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java", "license": "gpl-2.0", "size": 28268 }
[ "org.w3c.dom.Document", "org.w3c.dom.Node" ]
import org.w3c.dom.Document; import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,536,763
public KubernetesClientBuilder messageConverter(KubernetesMessageConverter messageConverter) { endpoint.getEndpointConfiguration().setMessageConverter(messageConverter); return this; }
KubernetesClientBuilder function(KubernetesMessageConverter messageConverter) { endpoint.getEndpointConfiguration().setMessageConverter(messageConverter); return this; }
/** * Sets the message converter. * @param messageConverter * @return */
Sets the message converter
messageConverter
{ "repo_name": "gucce/citrus", "path": "modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/client/KubernetesClientBuilder.java", "license": "apache-2.0", "size": 3305 }
[ "com.consol.citrus.kubernetes.message.KubernetesMessageConverter" ]
import com.consol.citrus.kubernetes.message.KubernetesMessageConverter;
import com.consol.citrus.kubernetes.message.*;
[ "com.consol.citrus" ]
com.consol.citrus;
339,046
public ImmutableList<String> getCopts() { return copts; }
ImmutableList<String> function() { return copts; }
/** * Returns options passed to (Apple) clang when compiling Objective C. These options should be * applied after any default options but before options specified in the attributes of the rule. */
Returns options passed to (Apple) clang when compiling Objective C. These options should be applied after any default options but before options specified in the attributes of the rule
getCopts
{ "repo_name": "rohitsaboo/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java", "license": "apache-2.0", "size": 8836 }
[ "com.google.common.collect.ImmutableList" ]
import com.google.common.collect.ImmutableList;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
199,799
public static int forward(ByteBuffer buffer, int count) { int newPos = buffer.position() + count; buffer.position(newPos); return newPos; }
static int function(ByteBuffer buffer, int count) { int newPos = buffer.position() + count; buffer.position(newPos); return newPos; }
/** * Moves the position of the given buffer the given count from the current * position. * @return the new buffer position */
Moves the position of the given buffer the given count from the current position
forward
{ "repo_name": "jahlborn/jackcess", "path": "src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java", "license": "apache-2.0", "size": 22831 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
1,752,977
public void applyTo(Model model) { if (roms == null) return; for (Node n : model.findNode(n -> n instanceof ROMInterface)) { ROMInterface rom = (ROMInterface) n; DataField data = roms.get(rom.getLabel()); if (data != null) rom.setData(data); } }
void function(Model model) { if (roms == null) return; for (Node n : model.findNode(n -> n instanceof ROMInterface)) { ROMInterface rom = (ROMInterface) n; DataField data = roms.get(rom.getLabel()); if (data != null) rom.setData(data); } }
/** * Applies the available roms to the model * * @param model the mode to use */
Applies the available roms to the model
applyTo
{ "repo_name": "hneemann/Digital", "path": "src/main/java/de/neemann/digital/core/memory/rom/ROMManger.java", "license": "gpl-3.0", "size": 2045 }
[ "de.neemann.digital.core.Model", "de.neemann.digital.core.Node", "de.neemann.digital.core.memory.DataField" ]
import de.neemann.digital.core.Model; import de.neemann.digital.core.Node; import de.neemann.digital.core.memory.DataField;
import de.neemann.digital.core.*; import de.neemann.digital.core.memory.*;
[ "de.neemann.digital" ]
de.neemann.digital;
2,301,428
public void setExcludesfile(File excludesfile) { usedMatchingTask = true; super.setExcludesfile(excludesfile); }
void function(File excludesfile) { usedMatchingTask = true; super.setExcludesfile(excludesfile); }
/** * Sets the name of the file containing the includes patterns. * * @param excludesfile A string containing the filename to fetch * the include patterns from. */
Sets the name of the file containing the includes patterns
setExcludesfile
{ "repo_name": "BIORIMP/biorimp", "path": "BIO-RIMP/test_data/code/antapache/src/main/org/apache/tools/ant/taskdefs/Delete.java", "license": "gpl-2.0", "size": 28942 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,466,106
public static ims.therapies.vo.SportsActivitySessionVo insert(DomainObjectMap map, ims.therapies.vo.SportsActivitySessionVo valueObject, ims.therapies.treatment.domain.objects.SportsActivitySession domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_SportsActivitySession(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); // If this is a recordedInError record, and the domainObject // value isIncludeRecord has not been set, then we return null and // not the value object if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; // If this is not a recordedInError record, and the domainObject // value isIncludeRecord has been set, then we return null and // not the value object if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; // AuthoringDateTime java.util.Date AuthoringDateTime = domainObject.getAuthoringDateTime(); if ( null != AuthoringDateTime ) { valueObject.setAuthoringDateTime(new ims.framework.utils.DateTime(AuthoringDateTime) ); } // AuthoringCP valueObject.setAuthoringCP(ims.core.vo.domain.HcpAssembler.create(map, domainObject.getAuthoringCP()) ); // SportsActivity valueObject.setSportsActivity(ims.therapies.vo.domain.SportsActivityVoAssembler.createSportsActivityVoCollectionFromSportsActivity(map, domainObject.getSportsActivity()) ); // ClinicalContact if (domainObject.getClinicalContact() != null) { if(domainObject.getClinicalContact() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the id already. { HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1)); } else { valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(domainObject.getClinicalContact().getId(), domainObject.getClinicalContact().getVersion())); } } return valueObject; }
static ims.therapies.vo.SportsActivitySessionVo function(DomainObjectMap map, ims.therapies.vo.SportsActivitySessionVo valueObject, ims.therapies.treatment.domain.objects.SportsActivitySession domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_SportsActivitySession(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; if ((valueObject.getIsRIE() == null valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; java.util.Date AuthoringDateTime = domainObject.getAuthoringDateTime(); if ( null != AuthoringDateTime ) { valueObject.setAuthoringDateTime(new ims.framework.utils.DateTime(AuthoringDateTime) ); } valueObject.setAuthoringCP(ims.core.vo.domain.HcpAssembler.create(map, domainObject.getAuthoringCP()) ); valueObject.setSportsActivity(ims.therapies.vo.domain.SportsActivityVoAssembler.createSportsActivityVoCollectionFromSportsActivity(map, domainObject.getSportsActivity()) ); if (domainObject.getClinicalContact() != null) { if(domainObject.getClinicalContact() instanceof HibernateProxy) { HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1)); } else { valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(domainObject.getClinicalContact().getId(), domainObject.getClinicalContact().getVersion())); } } return valueObject; }
/** * Update the ValueObject with the Domain Object. * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.therapies.treatment.domain.objects.SportsActivitySession */
Update the ValueObject with the Domain Object
insert
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/therapies/vo/domain/SportsActivitySessionVoAssembler.java", "license": "agpl-3.0", "size": 19101 }
[ "org.hibernate.proxy.HibernateProxy" ]
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.*;
[ "org.hibernate.proxy" ]
org.hibernate.proxy;
1,884,715
public synchronized XmlrpcdConfiguration getConfiguration() { return m_config; }
synchronized XmlrpcdConfiguration function() { return m_config; }
/** * Return the xmlrpcd configuration object. * * @return a {@link org.opennms.netmgt.config.xmlrpcd.XmlrpcdConfiguration} object. */
Return the xmlrpcd configuration object
getConfiguration
{ "repo_name": "roskens/opennms-pre-github", "path": "opennms-config/src/main/java/org/opennms/netmgt/config/XmlrpcdConfigFactory.java", "license": "agpl-3.0", "size": 15190 }
[ "org.opennms.netmgt.config.xmlrpcd.XmlrpcdConfiguration" ]
import org.opennms.netmgt.config.xmlrpcd.XmlrpcdConfiguration;
import org.opennms.netmgt.config.xmlrpcd.*;
[ "org.opennms.netmgt" ]
org.opennms.netmgt;
1,062,192
public void startElement (QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (DEBUG_EVENTS) { System.out.println ("==>startElement ("+element.rawname+")"); } if (!fDeferNodeExpansion) { if (fFilterReject) { ++fRejectedElementDepth; return; } Element el = createElementNode (element); int attrCount = attributes.getLength (); boolean seenSchemaDefault = false; for (int i = 0; i < attrCount; i++) { attributes.getName (i, fAttrQName); Attr attr = createAttrNode (fAttrQName); String attrValue = attributes.getValue (i); AttributePSVI attrPSVI =(AttributePSVI) attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI); if (fStorePSVI && attrPSVI != null){ ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } attr.setValue (attrValue); boolean specified = attributes.isSpecified(i); // Take special care of schema defaulted attributes. Calling the // non-namespace aware setAttributeNode() method could overwrite // another attribute with the same local name. if (!specified && (seenSchemaDefault || (fAttrQName.uri != null && fAttrQName.uri != NamespaceContext.XMLNS_URI && fAttrQName.prefix == null))) { el.setAttributeNodeNS(attr); seenSchemaDefault = true; } else { el.setAttributeNode(attr); } // NOTE: The specified value MUST be set after you set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. -Ac if (fDocumentImpl != null) { AttrImpl attrImpl = (AttrImpl) attr; Object type = null; boolean id = false; // REVISIT: currently it is possible that someone turns off // namespaces and turns on xml schema validation // To avoid classcast exception in AttrImpl check for namespaces // however the correct solution should probably disallow setting // namespaces to false when schema processing is turned on. if (attrPSVI != null && fNamespaceAware) { // XML Schema type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { id = ((XSSimpleType) type).isIDType (); attrImpl.setType (type); } } else { id = ((XSSimpleType) type).isIDType (); attrImpl.setType (type); } } else { // DTD boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED)); // For DOM Level 3 TypeInfo, the type name must // be null if this attribute has not been declared // in the DTD. if (isDeclared) { type = attributes.getType (i); id = "ID".equals (type); } attrImpl.setType (type); } if (id) { ((ElementImpl) el).setIdAttributeNode (attr, true); } attrImpl.setSpecified (specified); // REVISIT: Handle entities in attribute value. } } setCharacterData (false); if (augs != null) { ElementPSVI elementPSVI = (ElementPSVI)augs.getItem (Constants.ELEMENT_PSVI); if (elementPSVI != null && fNamespaceAware) { XSTypeDefinition type = elementPSVI.getMemberTypeDefinition (); if (type == null) { type = elementPSVI.getTypeDefinition (); } ((ElementNSImpl)el).setType (type); } } // filter nodes if (fDOMFilter != null && !fInEntityRef) { if (fRoot == null) { // fill value of the root element fRoot = el; } else { short code = fDOMFilter.startElement(el); switch (code) { case LSParserFilter.FILTER_INTERRUPT : { throw Abort.INSTANCE; } case LSParserFilter.FILTER_REJECT : { fFilterReject = true; fRejectedElementDepth = 0; return; } case LSParserFilter.FILTER_SKIP : { // make sure that if any char data is available // the fFirstChunk is true, so that if the next event // is characters(), and the last node is text, we will copy // the value already in the text node to fStringBuffer // (not to lose it). fFirstChunk = true; fSkippedElemStack.push(Boolean.TRUE); return; } default : { if (!fSkippedElemStack.isEmpty()) { fSkippedElemStack.push(Boolean.FALSE); } } } } } fCurrentNode.appendChild (el); fCurrentNode = el; } else { int el = fDeferredDocumentImpl.createDeferredElement (fNamespaceAware ? element.uri : null, element.rawname); Object type = null; int attrCount = attributes.getLength (); // Need to loop in reverse order so that the attributes // are processed in document order when the DOM is expanded. for (int i = attrCount - 1; i >= 0; --i) { // set type information AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI); boolean id = false; // REVISIT: currently it is possible that someone turns off // namespaces and turns on xml schema validation // To avoid classcast exception in AttrImpl check for namespaces // however the correct solution should probably disallow setting // namespaces to false when schema processing is turned on. if (attrPSVI != null && fNamespaceAware) { // XML Schema type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null){ id = ((XSSimpleType) type).isIDType (); } } else { id = ((XSSimpleType) type).isIDType (); } } else { // DTD boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED)); // For DOM Level 3 TypeInfo, the type name must // be null if this attribute has not been declared // in the DTD. if (isDeclared) { type = attributes.getType (i); id = "ID".equals (type); } } // create attribute fDeferredDocumentImpl.setDeferredAttribute ( el, attributes.getQName (i), attributes.getURI (i), attributes.getValue (i), attributes.isSpecified (i), id, type); } fDeferredDocumentImpl.appendChild (fCurrentNodeIndex, el); fCurrentNodeIndex = el; } } // startElement(QName,XMLAttributes)
void function (QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (DEBUG_EVENTS) { System.out.println (STR+element.rawname+")"); } if (!fDeferNodeExpansion) { if (fFilterReject) { ++fRejectedElementDepth; return; } Element el = createElementNode (element); int attrCount = attributes.getLength (); boolean seenSchemaDefault = false; for (int i = 0; i < attrCount; i++) { attributes.getName (i, fAttrQName); Attr attr = createAttrNode (fAttrQName); String attrValue = attributes.getValue (i); AttributePSVI attrPSVI =(AttributePSVI) attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI); if (fStorePSVI && attrPSVI != null){ ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } attr.setValue (attrValue); boolean specified = attributes.isSpecified(i); if (!specified && (seenSchemaDefault (fAttrQName.uri != null && fAttrQName.uri != NamespaceContext.XMLNS_URI && fAttrQName.prefix == null))) { el.setAttributeNodeNS(attr); seenSchemaDefault = true; } else { el.setAttributeNode(attr); } if (fDocumentImpl != null) { AttrImpl attrImpl = (AttrImpl) attr; Object type = null; boolean id = false; if (attrPSVI != null && fNamespaceAware) { type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { id = ((XSSimpleType) type).isIDType (); attrImpl.setType (type); } } else { id = ((XSSimpleType) type).isIDType (); attrImpl.setType (type); } } else { boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED)); if (isDeclared) { type = attributes.getType (i); id = "ID".equals (type); } attrImpl.setType (type); } if (id) { ((ElementImpl) el).setIdAttributeNode (attr, true); } attrImpl.setSpecified (specified); } } setCharacterData (false); if (augs != null) { ElementPSVI elementPSVI = (ElementPSVI)augs.getItem (Constants.ELEMENT_PSVI); if (elementPSVI != null && fNamespaceAware) { XSTypeDefinition type = elementPSVI.getMemberTypeDefinition (); if (type == null) { type = elementPSVI.getTypeDefinition (); } ((ElementNSImpl)el).setType (type); } } if (fDOMFilter != null && !fInEntityRef) { if (fRoot == null) { fRoot = el; } else { short code = fDOMFilter.startElement(el); switch (code) { case LSParserFilter.FILTER_INTERRUPT : { throw Abort.INSTANCE; } case LSParserFilter.FILTER_REJECT : { fFilterReject = true; fRejectedElementDepth = 0; return; } case LSParserFilter.FILTER_SKIP : { fFirstChunk = true; fSkippedElemStack.push(Boolean.TRUE); return; } default : { if (!fSkippedElemStack.isEmpty()) { fSkippedElemStack.push(Boolean.FALSE); } } } } } fCurrentNode.appendChild (el); fCurrentNode = el; } else { int el = fDeferredDocumentImpl.createDeferredElement (fNamespaceAware ? element.uri : null, element.rawname); Object type = null; int attrCount = attributes.getLength (); for (int i = attrCount - 1; i >= 0; --i) { AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI); boolean id = false; if (attrPSVI != null && fNamespaceAware) { type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null){ id = ((XSSimpleType) type).isIDType (); } } else { id = ((XSSimpleType) type).isIDType (); } } else { boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED)); if (isDeclared) { type = attributes.getType (i); id = "ID".equals (type); } } fDeferredDocumentImpl.setDeferredAttribute ( el, attributes.getQName (i), attributes.getURI (i), attributes.getValue (i), attributes.isSpecified (i), id, type); } fDeferredDocumentImpl.appendChild (fCurrentNodeIndex, el); fCurrentNodeIndex = el; } }
/** * The start of an element. If the document specifies the start element * by using an empty tag, then the startElement method will immediately * be followed by the endElement method, with no intervening methods. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */
The start of an element. If the document specifies the start element by using an empty tag, then the startElement method will immediately be followed by the endElement method, with no intervening methods
startElement
{ "repo_name": "md-5/jdk10", "path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java", "license": "gpl-2.0", "size": 107189 }
[ "com.sun.org.apache.xerces.internal.dom.AttrImpl", "com.sun.org.apache.xerces.internal.dom.ElementImpl", "com.sun.org.apache.xerces.internal.dom.ElementNSImpl", "com.sun.org.apache.xerces.internal.dom.PSVIAttrNSImpl", "com.sun.org.apache.xerces.internal.impl.Constants", "com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType", "com.sun.org.apache.xerces.internal.xni.Augmentations", "com.sun.org.apache.xerces.internal.xni.NamespaceContext", "com.sun.org.apache.xerces.internal.xni.QName", "com.sun.org.apache.xerces.internal.xni.XMLAttributes", "com.sun.org.apache.xerces.internal.xni.XNIException", "com.sun.org.apache.xerces.internal.xs.AttributePSVI", "com.sun.org.apache.xerces.internal.xs.ElementPSVI", "com.sun.org.apache.xerces.internal.xs.XSTypeDefinition", "org.w3c.dom.Attr", "org.w3c.dom.Element", "org.w3c.dom.ls.LSParserFilter" ]
import com.sun.org.apache.xerces.internal.dom.AttrImpl; import com.sun.org.apache.xerces.internal.dom.ElementImpl; import com.sun.org.apache.xerces.internal.dom.ElementNSImpl; import com.sun.org.apache.xerces.internal.dom.PSVIAttrNSImpl; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.QName; import com.sun.org.apache.xerces.internal.xni.XMLAttributes; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xs.AttributePSVI; import com.sun.org.apache.xerces.internal.xs.ElementPSVI; import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.ls.LSParserFilter;
import com.sun.org.apache.xerces.internal.dom.*; import com.sun.org.apache.xerces.internal.impl.*; import com.sun.org.apache.xerces.internal.impl.dv.*; import com.sun.org.apache.xerces.internal.xni.*; import com.sun.org.apache.xerces.internal.xs.*; import org.w3c.dom.*; import org.w3c.dom.ls.*;
[ "com.sun.org", "org.w3c.dom" ]
com.sun.org; org.w3c.dom;
2,274,309
public void validateKeyAndValue(Object key, Object val) throws IgniteCheckedException;
void function(Object key, Object val) throws IgniteCheckedException;
/** * Performs validation of given key and value against configured constraints. * Throws runtime exception if validation fails. * * @param key Key. * @param val Value. * @throws IgniteCheckedException, If failure happens. */
Performs validation of given key and value against configured constraints. Throws runtime exception if validation fails
validateKeyAndValue
{ "repo_name": "WilliamDo/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java", "license": "apache-2.0", "size": 4721 }
[ "org.apache.ignite.IgniteCheckedException" ]
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,120,560
private Operation getOperation(int eventType) { Operation op = null; switch (eventType) { case MessageType.LOCAL_CREATE: op = Operation.CREATE; break; case MessageType.LOCAL_UPDATE: op = Operation.UPDATE; break; case MessageType.LOCAL_DESTROY: op = Operation.DESTROY; break; case MessageType.LOCAL_INVALIDATE: op = Operation.INVALIDATE; break; case MessageType.CLEAR_REGION: op = Operation.REGION_CLEAR; break; case MessageType.INVALIDATE_REGION: op = Operation.REGION_INVALIDATE; break; } return op; }
Operation function(int eventType) { Operation op = null; switch (eventType) { case MessageType.LOCAL_CREATE: op = Operation.CREATE; break; case MessageType.LOCAL_UPDATE: op = Operation.UPDATE; break; case MessageType.LOCAL_DESTROY: op = Operation.DESTROY; break; case MessageType.LOCAL_INVALIDATE: op = Operation.INVALIDATE; break; case MessageType.CLEAR_REGION: op = Operation.REGION_CLEAR; break; case MessageType.INVALIDATE_REGION: op = Operation.REGION_INVALIDATE; break; } return op; }
/** * Returns the Operation for the given EnumListenerEvent type. */
Returns the Operation for the given EnumListenerEvent type
getOperation
{ "repo_name": "pdxrunner/geode", "path": "geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java", "license": "apache-2.0", "size": 59842 }
[ "org.apache.geode.cache.Operation", "org.apache.geode.internal.cache.tier.MessageType" ]
import org.apache.geode.cache.Operation; import org.apache.geode.internal.cache.tier.MessageType;
import org.apache.geode.cache.*; import org.apache.geode.internal.cache.tier.*;
[ "org.apache.geode" ]
org.apache.geode;
2,776,863