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
public static Writable filterLine(URL self, String charset, @ClosureParams(value = SimpleType.class, options = "java.lang.String") Closure predicate) throws IOException { return IOGroovyMethods.filterLine(newReader(self, charset), predicate); }
static Writable function(URL self, String charset, @ClosureParams(value = SimpleType.class, options = STR) Closure predicate) throws IOException { return IOGroovyMethods.filterLine(newReader(self, charset), predicate); }
/** * Filter lines from a URL using a closure predicate. The closure * will be passed each line as a String, and it should return * <code>true</code> if the line should be passed to the writer. * * @param self the URL * @param charset opens the URL with a specified charset * @param predicate a closure which returns boolean and takes a line * @return a writable which writes out the filtered lines * @throws IOException if an IO exception occurs * @see IOGroovyMethods#filterLine(java.io.Reader, groovy.lang.Closure) * @since 1.6.8 */
Filter lines from a URL using a closure predicate. The closure will be passed each line as a String, and it should return <code>true</code> if the line should be passed to the writer
filterLine
{ "repo_name": "paulk-asert/groovy", "path": "src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java", "license": "apache-2.0", "size": 119457 }
[ "groovy.lang.Closure", "groovy.lang.Writable", "groovy.transform.stc.ClosureParams", "groovy.transform.stc.SimpleType", "java.io.IOException" ]
import groovy.lang.Closure; import groovy.lang.Writable; import groovy.transform.stc.ClosureParams; import groovy.transform.stc.SimpleType; import java.io.IOException;
import groovy.lang.*; import groovy.transform.stc.*; import java.io.*;
[ "groovy.lang", "groovy.transform.stc", "java.io" ]
groovy.lang; groovy.transform.stc; java.io;
1,598,862
public Position getLabelPlacement() { return this.labelPlacement; }
Position function() { return this.labelPlacement; }
/** * Indicates where the label is placed in relation to the field (valid options are * LEFT, RIGHT, BOTTOM, and TOP * * @return Position position of label */
Indicates where the label is placed in relation to the field (valid options are LEFT, RIGHT, BOTTOM, and TOP
getLabelPlacement
{ "repo_name": "ua-eas/ua-rice-2.1.9", "path": "krad/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/field/FieldBase.java", "license": "apache-2.0", "size": 8594 }
[ "org.kuali.rice.krad.uif.UifConstants" ]
import org.kuali.rice.krad.uif.UifConstants;
import org.kuali.rice.krad.uif.*;
[ "org.kuali.rice" ]
org.kuali.rice;
1,229,541
public static <T extends CalculusFieldElement<T>> FieldComplex<T> getMinusI(final Field<T> field) { return new FieldComplex<>(field.getZero(), field.getOne().negate()); }
static <T extends CalculusFieldElement<T>> FieldComplex<T> function(final Field<T> field) { return new FieldComplex<>(field.getZero(), field.getOne().negate()); }
/** Get the square root of -1. * @param field field the complex components belong to * @return number representing "0.0 _ 1.0i" * @param <T> the type of the field elements */
Get the square root of -1
getMinusI
{ "repo_name": "sdinot/hipparchus", "path": "hipparchus-core/src/main/java/org/hipparchus/complex/FieldComplex.java", "license": "apache-2.0", "size": 72354 }
[ "org.hipparchus.CalculusFieldElement", "org.hipparchus.Field" ]
import org.hipparchus.CalculusFieldElement; import org.hipparchus.Field;
import org.hipparchus.*;
[ "org.hipparchus" ]
org.hipparchus;
722,635
public final native void updateRow(org.urish.gwtit.titanium.ui.TableViewRow row, JavaScriptObject properties) ;
final native void function(org.urish.gwtit.titanium.ui.TableViewRow row, JavaScriptObject properties) ;
/** * Update an existing row, optionally with animation * * @param row * row data to update * @param properties * animation properties */
Update an existing row, optionally with animation
updateRow
{ "repo_name": "urish/gwt-titanium", "path": "src/main/java/org/urish/gwtit/titanium/ui/TableView.java", "license": "apache-2.0", "size": 15109 }
[ "com.google.gwt.core.client.JavaScriptObject" ]
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.*;
[ "com.google.gwt" ]
com.google.gwt;
189,119
public EntityBeanType<EnterpriseBeansType<T>> createEntity() { return new EntityBeanTypeImpl<EnterpriseBeansType<T>>(this, "entity", childNode); }
EntityBeanType<EnterpriseBeansType<T>> function() { return new EntityBeanTypeImpl<EnterpriseBeansType<T>>(this, STR, childNode); }
/** * Creates a new <code>entity</code> element * @return the new created instance of <code>EntityBeanType<EnterpriseBeansType<T>></code> */
Creates a new <code>entity</code> element
createEntity
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar30/EnterpriseBeansTypeImpl.java", "license": "epl-1.0", "size": 9620 }
[ "org.jboss.shrinkwrap.descriptor.api.ejbjar30.EnterpriseBeansType", "org.jboss.shrinkwrap.descriptor.api.ejbjar30.EntityBeanType" ]
import org.jboss.shrinkwrap.descriptor.api.ejbjar30.EnterpriseBeansType; import org.jboss.shrinkwrap.descriptor.api.ejbjar30.EntityBeanType;
import org.jboss.shrinkwrap.descriptor.api.ejbjar30.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
2,353,749
private void writeFully(final InputStream content, final OutputStream output) throws IOException { // @checkstyle MagicNumber (1 line) final byte[] buffer = new byte[8192]; for (int bytes = content.read(buffer); bytes != -1; bytes = content.read(buffer)) { output.write(buffer, 0, bytes); } }
void function(final InputStream content, final OutputStream output) throws IOException { final byte[] buffer = new byte[8192]; for (int bytes = content.read(buffer); bytes != -1; bytes = content.read(buffer)) { output.write(buffer, 0, bytes); } }
/** * Fully write the input stream contents to the output stream. * @param content The content to write * @param output The output stream to write to * @throws IOException If an IO Exception occurs */
Fully write the input stream contents to the output stream
writeFully
{ "repo_name": "YamStranger/jcabi-http", "path": "src/main/java/com/jcabi/http/request/JdkRequest.java", "license": "bsd-3-clause", "size": 9830 }
[ "java.io.IOException", "java.io.InputStream", "java.io.OutputStream" ]
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,292,962
@Override public void setBlob( int parameterIndex, Blob x ) throws SQLException { realPreparedStatement.setBlob( parameterIndex, x ); }
void function( int parameterIndex, Blob x ) throws SQLException { realPreparedStatement.setBlob( parameterIndex, x ); }
/** * Sets the designated parameter to the given <code>java.sql.Blob</code> object. * The driver converts this to an SQL <code>BLOB</code> value when it * sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value * @throws SQLException if parameterIndex does not correspond to a parameter * marker in the SQL statement; if a database access error occurs or * this method is called on a closed <code>PreparedStatement</code> * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method * @since 1.2 */
Sets the designated parameter to the given <code>java.sql.Blob</code> object. The driver converts this to an SQL <code>BLOB</code> value when it sends it to the database
setBlob
{ "repo_name": "mattyb149/pentaho-orientdb-jdbc", "path": "src/main/java/org/pentaho/community/di/database/orientdb/delegate/DelegatePreparedStatement.java", "license": "apache-2.0", "size": 127180 }
[ "java.sql.Blob", "java.sql.SQLException" ]
import java.sql.Blob; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
704,486
@Test public void testRetryInformationIsAddedToResultOnFailedConnect() throws Exception { com.alpha.pineapple.model.configuration.Resource resource; resource = createMock(com.alpha.pineapple.model.configuration.Resource.class); Credential credential = createMock(Credential.class); Session session = createMock(Session.class); session.connect(resource, credential); expectLastCall().andThrow(new SessionConnectException(randomDescription)).times(1); expectLastCall().times(1); replay(session); // create proxy Session proxiedObject = sessionRetryProxyFactory.decorateWithProxy(session, result); // test Map<String, String> messages = result.getMessages(); assertFalse(messages.containsKey(MSG_SESSION)); assertNotNull(proxiedObject); // connect proxiedObject.connect(resource, credential); // test messages = result.getMessages(); assertTrue(messages.containsKey(MSG_SESSION)); String message = messages.get(MSG_SESSION); // count occurrences of message srl.session_connect_error assertEquals(1, StringUtils.countMatches(message, "Failed to connect to session due to the error")); verify(session); }
void function() throws Exception { com.alpha.pineapple.model.configuration.Resource resource; resource = createMock(com.alpha.pineapple.model.configuration.Resource.class); Credential credential = createMock(Credential.class); Session session = createMock(Session.class); session.connect(resource, credential); expectLastCall().andThrow(new SessionConnectException(randomDescription)).times(1); expectLastCall().times(1); replay(session); Session proxiedObject = sessionRetryProxyFactory.decorateWithProxy(session, result); Map<String, String> messages = result.getMessages(); assertFalse(messages.containsKey(MSG_SESSION)); assertNotNull(proxiedObject); proxiedObject.connect(resource, credential); messages = result.getMessages(); assertTrue(messages.containsKey(MSG_SESSION)); String message = messages.get(MSG_SESSION); assertEquals(1, StringUtils.countMatches(message, STR)); verify(session); }
/** * Test that information about a retry is registered on failed connect. * * @throws Exception * if test fails. */
Test that information about a retry is registered on failed connect
testRetryInformationIsAddedToResultOnFailedConnect
{ "repo_name": "athrane/pineapple", "path": "modules/pineapple-core/src/test/java/com/alpha/pineapple/plugin/session/retry/SessionRetryProxyFactoryIntegrationTest.java", "license": "gpl-3.0", "size": 25444 }
[ "com.alpha.pineapple.model.configuration.Credential", "com.alpha.pineapple.session.Session", "com.alpha.pineapple.session.SessionConnectException", "java.util.Map", "javax.annotation.Resource", "org.apache.commons.lang3.StringUtils", "org.easymock.EasyMock", "org.junit.Assert" ]
import com.alpha.pineapple.model.configuration.Credential; import com.alpha.pineapple.session.Session; import com.alpha.pineapple.session.SessionConnectException; import java.util.Map; import javax.annotation.Resource; import org.apache.commons.lang3.StringUtils; import org.easymock.EasyMock; import org.junit.Assert;
import com.alpha.pineapple.model.configuration.*; import com.alpha.pineapple.session.*; import java.util.*; import javax.annotation.*; import org.apache.commons.lang3.*; import org.easymock.*; import org.junit.*;
[ "com.alpha.pineapple", "java.util", "javax.annotation", "org.apache.commons", "org.easymock", "org.junit" ]
com.alpha.pineapple; java.util; javax.annotation; org.apache.commons; org.easymock; org.junit;
935,428
private static Map<String, String> parseVariables(String[] args, int startAt) { Map<String, String> variables = new LinkedHashMap<String, String>(); for (int j = startAt; j < args.length; j++) { String[] tokens = args[j].split("="); assert tokens.length == 2 : "Bad format " + args[j]; variables.put(tokens[0], tokens[1]); } return variables; }
static Map<String, String> function(String[] args, int startAt) { Map<String, String> variables = new LinkedHashMap<String, String>(); for (int j = startAt; j < args.length; j++) { String[] tokens = args[j].split("="); assert tokens.length == 2 : STR + args[j]; variables.put(tokens[0], tokens[1]); } return variables; }
/** * Parse variables from input arguments. * * @param args * all input arguments * @param startAt * start index of variables * @return a map with variables */
Parse variables from input arguments
parseVariables
{ "repo_name": "flyroom/PeerfactSimKOM_Clone", "path": "src/org/peerfact/impl/util/batchrunner/BatchRunner.java", "license": "gpl-2.0", "size": 7925 }
[ "java.util.LinkedHashMap", "java.util.Map" ]
import java.util.LinkedHashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,313,314
public void setDimension2(Dimension val) { if (val == null) { throw new ExplanationException("You have to set dimensions related to this data"); } this.dimension2 = val; }
void function(Dimension val) { if (val == null) { throw new ExplanationException(STR); } this.dimension2 = val; }
/** * Sets the second dimension related to this data. * * @param val Dimension object related to this data * * @throws org.goodoldai.jeff.explanation.ExplanationException * if the entered object is null */
Sets the second dimension related to this data
setDimension2
{ "repo_name": "bojantomic/jeff", "path": "src/main/java/org/goodoldai/jeff/explanation/data/TwoDimData.java", "license": "lgpl-3.0", "size": 5221 }
[ "org.goodoldai.jeff.explanation.ExplanationException" ]
import org.goodoldai.jeff.explanation.ExplanationException;
import org.goodoldai.jeff.explanation.*;
[ "org.goodoldai.jeff" ]
org.goodoldai.jeff;
1,782,075
private List filterModeratedMessages(List messages, DiscussionTopic topic, DiscussionForum forum, String userId, String siteId) { List viewableMsgs = new ArrayList(); if (messages != null && messages.size() > 0) { boolean hasModeratePerm = getUiPermissionsManager().isModeratePostings(topic, forum, userId, siteId); if (hasModeratePerm) return messages; Iterator msgIter = messages.iterator(); while (msgIter.hasNext()) { Message msg = (Message) msgIter.next(); if (msg.getApproved() != null && msg.getApproved()) viewableMsgs.add(msg); } } return viewableMsgs; }
List function(List messages, DiscussionTopic topic, DiscussionForum forum, String userId, String siteId) { List viewableMsgs = new ArrayList(); if (messages != null && messages.size() > 0) { boolean hasModeratePerm = getUiPermissionsManager().isModeratePostings(topic, forum, userId, siteId); if (hasModeratePerm) return messages; Iterator msgIter = messages.iterator(); while (msgIter.hasNext()) { Message msg = (Message) msgIter.next(); if (msg.getApproved() != null && msg.getApproved()) viewableMsgs.add(msg); } } return viewableMsgs; }
/** * Given a list of messages, will return all messages that meet at * least one of the following criteria: * 1) message is approved * */
Given a list of messages, will return all messages that meet at least one of the following criteria: 1) message is approved
filterModeratedMessages
{ "repo_name": "ouit0408/sakai", "path": "msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/entity/ForumMessageEntityProviderImpl.java", "license": "apache-2.0", "size": 25884 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.sakaiproject.api.app.messageforums.DiscussionForum", "org.sakaiproject.api.app.messageforums.DiscussionTopic", "org.sakaiproject.api.app.messageforums.Message" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.sakaiproject.api.app.messageforums.DiscussionForum; import org.sakaiproject.api.app.messageforums.DiscussionTopic; import org.sakaiproject.api.app.messageforums.Message;
import java.util.*; import org.sakaiproject.api.app.messageforums.*;
[ "java.util", "org.sakaiproject.api" ]
java.util; org.sakaiproject.api;
524,442
private double calcMaxHeight(final int[] iReverseOrder, final int iNode) { // find maximum height between two species. Only upper right part is populated final double[][] fMaxHeight = new double[nrOfSpecies][nrOfSpecies]; for (int i = 0; i < nrOfSpecies; i++) { Arrays.fill(fMaxHeight[i], Double.POSITIVE_INFINITY); } // calculate for every species tree the maximum allowable merge point for (int i = 0; i < nrOfGeneTrees; i++) { final Tree tree = geneTreesInput.get().get(i); findMaximaInGeneTree(tree.getRoot(), new boolean[nrOfSpecies], m_taxonMap.get(i), fMaxHeight); } // find species on the left of selected node final boolean[] bLowerSpecies = new boolean[nrOfSpecies]; final Node[] nodes = treeInput.get().getNodesAsArray(); for (int i = 0; i < iNode; i++) { final Node node = nodes[iReverseOrder[i]]; if (node.isLeaf()) { bLowerSpecies[node.getNr()] = true; } } // find species on the right of selected node final boolean[] bUpperSpecies = new boolean[nrOfSpecies]; for (int i = iNode + 1; i < nodes.length; i++) { final Node node = nodes[iReverseOrder[i]]; if (node.isLeaf()) { bUpperSpecies[node.getNr()] = true; } } // find max double fMax = Double.POSITIVE_INFINITY; for (int i = 0; i < nrOfSpecies; i++) { if (bLowerSpecies[i]) { for (int j = 0; j < nrOfSpecies; j++) { if (j != i && bUpperSpecies[j]) { final int x = Math.min(i, j); final int y = Math.max(i, j); fMax = Math.min(fMax, fMaxHeight[x][y]); } } } } return fMax; } // calcMaxHeight
double function(final int[] iReverseOrder, final int iNode) { final double[][] fMaxHeight = new double[nrOfSpecies][nrOfSpecies]; for (int i = 0; i < nrOfSpecies; i++) { Arrays.fill(fMaxHeight[i], Double.POSITIVE_INFINITY); } for (int i = 0; i < nrOfGeneTrees; i++) { final Tree tree = geneTreesInput.get().get(i); findMaximaInGeneTree(tree.getRoot(), new boolean[nrOfSpecies], m_taxonMap.get(i), fMaxHeight); } final boolean[] bLowerSpecies = new boolean[nrOfSpecies]; final Node[] nodes = treeInput.get().getNodesAsArray(); for (int i = 0; i < iNode; i++) { final Node node = nodes[iReverseOrder[i]]; if (node.isLeaf()) { bLowerSpecies[node.getNr()] = true; } } final boolean[] bUpperSpecies = new boolean[nrOfSpecies]; for (int i = iNode + 1; i < nodes.length; i++) { final Node node = nodes[iReverseOrder[i]]; if (node.isLeaf()) { bUpperSpecies[node.getNr()] = true; } } double fMax = Double.POSITIVE_INFINITY; for (int i = 0; i < nrOfSpecies; i++) { if (bLowerSpecies[i]) { for (int j = 0; j < nrOfSpecies; j++) { if (j != i && bUpperSpecies[j]) { final int x = Math.min(i, j); final int y = Math.max(i, j); fMax = Math.min(fMax, fMaxHeight[x][y]); } } } } return fMax; }
/** * calculate maximum height that node iNode can become restricted * by nodes on the left and right */
calculate maximum height that node iNode can become restricted by nodes on the left and right
calcMaxHeight
{ "repo_name": "rbouckaert/YABBY", "path": "src/yabby/yabby/evolution/operators/NodeReheight.java", "license": "lgpl-3.0", "size": 11532 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
668,581
@Nullable public static ComponentName findProvider( @NonNull Context applicationContext, @NonNull String providerPackageName, @NonNull String action) { List<ComponentName> providers = findProviders(applicationContext, action); for (ComponentName provider : providers) { if (providerPackageName.equals(provider.getPackageName())) { return provider; } } return null; }
static ComponentName function( @NonNull Context applicationContext, @NonNull String providerPackageName, @NonNull String action) { List<ComponentName> providers = findProviders(applicationContext, action); for (ComponentName provider : providers) { if (providerPackageName.equals(provider.getPackageName())) { return provider; } } return null; }
/** * Resolves a {@link ComponentName} for the activity defined in the specified provider, for * the specified action. */
Resolves a <code>ComponentName</code> for the activity defined in the specified provider, for the specified action
findProvider
{ "repo_name": "agilebits/OpenYOLO-Android", "path": "api/java/org/openyolo/api/internal/ProviderResolver.java", "license": "apache-2.0", "size": 3564 }
[ "android.content.ComponentName", "android.content.Context", "android.support.annotation.NonNull", "java.util.List" ]
import android.content.ComponentName; import android.content.Context; import android.support.annotation.NonNull; import java.util.List;
import android.content.*; import android.support.annotation.*; import java.util.*;
[ "android.content", "android.support", "java.util" ]
android.content; android.support; java.util;
2,823,490
public void setSystemVariable(HmInterface hmInterface, String name, Object value) throws HomematicClientException;
void function(HmInterface hmInterface, String name, Object value) throws HomematicClientException;
/** * Set the value of a system variable. */
Set the value of a system variable
setSystemVariable
{ "repo_name": "ssalonen/openhab", "path": "bundles/binding/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/client/interfaces/RpcClient.java", "license": "epl-1.0", "size": 2913 }
[ "org.openhab.binding.homematic.internal.communicator.client.HomematicClientException", "org.openhab.binding.homematic.internal.model.HmInterface" ]
import org.openhab.binding.homematic.internal.communicator.client.HomematicClientException; import org.openhab.binding.homematic.internal.model.HmInterface;
import org.openhab.binding.homematic.internal.communicator.client.*; import org.openhab.binding.homematic.internal.model.*;
[ "org.openhab.binding" ]
org.openhab.binding;
460,469
private static void loadSkillList() { vSkillsListByIndex = new Hashtable<Integer, Skills>(); vSkillsListByCommandCRC = new Hashtable<Integer, Skills>(); Statement s = null; ResultSet result = null; try { String query = "SELECT skill_id, skill_name, skill_money_required, skill_points_required, skill_xp_type, skill_xp_cost, skill_xp_cap, skill_species_required, skill_mods, skill_certifications, skill_is_profession, skill_god_only from `skills`;"; s = conn.createStatement(); if (s.execute(query)) { result = s.getResultSet(); while (result.next()) { Skills aSkill = new Skills(); int skillID = result.getInt(1); aSkill.setSkillID(skillID); String sName = result.getString(2); System.out.println("Load skill " + sName + " at index " + skillID); aSkill.setName(sName); // String[] sRequiredSkills = // result.getString(2).split(","); aSkill.setCreditsCost(result.getInt(3)); aSkill.setPointsCost(result.getInt(4)); String sXPType = result.getString(5); aSkill.setExperienceType(getExperienceIDFromName(sXPType)); aSkill.setExperienceCost(result.getInt(6)); aSkill.setExperienceCap(result.getInt(7)); // Any skill with only 1 "_" is a root skill, and it's // novice skill is 1 greater than itself. // If the skill name contains noviceSkill, then it is itself // a novice skill. // In any other case, the "novice" skill ID is less than the // current skill ID. int iNumberUnderscores = 0; int iCurrentIndex = -1; do { iCurrentIndex = sName.indexOf("_", iCurrentIndex + 1); if (iCurrentIndex > -1) { iNumberUnderscores++; } // System.out.println("Found an underscore."); } while (iCurrentIndex > -1); if (iNumberUnderscores == 1) { System.out.println("Root skill " + sName); aSkill.setNoviceSkillID(skillID + 1); } else if (iNumberUnderscores == 2) { if (sName.contains("master")) { System.out .println("Master skill found: Novice skill index is " + (skillID - 1)); aSkill.setNoviceSkillID(skillID - 1); } else { System.out .println("This is a Novice skill -- Novice skill index = current index: " + skillID); aSkill.setNoviceSkillID(skillID); } } else { boolean bFound = false; for (int i = skillID - 1; i >= 0 && !bFound; i--) { Skills noviceSkill = vSkillsListByIndex.get(i); if (noviceSkill != null) { String sNoviceName = noviceSkill.getName(); if (sNoviceName != null) { if (sNoviceName.contains("novice")) { System.out.println("Skill " + sName + " found novice skill at ID " + i); aSkill.setNoviceSkillID(i); bFound = true; } } } } if (!bFound) { System.out .println("No novice skill found for skill name " + sName); } } // System.out.println("Skill " + aSkill.getName() + " caps " // + sXPType + " experience at " + // aSkill.getExperienceCap()); int[] iSpeciesRequirementsForRace = new int[Constants.SpeciesNames.length]; int iNumSpeciesSet = 0; String sRace = result.getString(8); if (sRace != null && !sRace.equals(" ")) { String[] sRaceNames = sRace.split(","); if (sRaceNames != null) { // System.out.println("Species requirements for " + // aSkill.getName() + " follow..."); for (int i = 0; i < Constants.SpeciesNames.length; i++) { for (int j = 0; j < sRaceNames.length; j++) { if (Constants.SpeciesNames[i] .equalsIgnoreCase(sRaceNames[j])) { iSpeciesRequirementsForRace[iNumSpeciesSet] = i; iNumSpeciesSet++; // System.out.println(Constants.SpeciesNames[i]); } } } } iSpeciesRequirementsForRace = Arrays.copyOfRange( iSpeciesRequirementsForRace, 0, iNumSpeciesSet); } String sUnparsedSkillMods = result.getString(9); if (sUnparsedSkillMods != null && sUnparsedSkillMods.equals(" ") == false) { String[] sSplitSkillMods = sUnparsedSkillMods .split(","); for (int i = 0; i < sSplitSkillMods.length; i++) { SkillMods mod = new SkillMods(); String[] sParsedSkillMod = sSplitSkillMods[i] .split("="); mod.setName(sParsedSkillMod[0]); mod.setSkillModModdedValue(Integer .parseInt(sParsedSkillMod[1])); mod.setSkillModStartingValue(0); // mod.bUnknownValue = false; // System.out.println("Loaded skill mod " + // mod.sName + " with value increase of " + // mod.iSkillModModdedValue + " for skill " + // aSkill.getName()); aSkill.addSkillMod(mod); } } String sUnparsedSkillCommands = result.getString(10); if (!(sUnparsedSkillCommands == null || sUnparsedSkillCommands .equals(" "))) { String[] sSplitSkillCommands = sUnparsedSkillCommands .split(","); for (int i = 0; i < sSplitSkillCommands.length; i++) { // System.out.println("Skill " + aSkill.getName() + // " adding certification " + // sSplitSkillCommands[i]); aSkill.addCertification(sSplitSkillCommands[i]); String thisCert = sSplitSkillCommands[i]; if (!(thisCert.startsWith("private") || thisCert .startsWith("cert"))) { int iCommandCRC = PacketUtils.SWGCrc(thisCert .toLowerCase()); // System.out.println("Calculated CRC of 0x"+Integer.toHexString(iCommandCRC) // + " for skill certification name " + // thisCert.toLowerCase()); // System.out.println("protected final static int " // + thisCert + " = 0x" + // Integer.toHexString(iCommandCRC) + ";"); Skills oldSkill = vSkillsListByCommandCRC .get(iCommandCRC); if (aSkill.getName().startsWith("jedi") == false && oldSkill == null) { vSkillsListByCommandCRC.put(iCommandCRC, aSkill); } } } } aSkill.setIsProfessionSkill(result.getBoolean(11)); aSkill.setSpeciesSpecific(iSpeciesRequirementsForRace); aSkill.setIsGodModeSkill(result.getBoolean(12)); vSkillsListByIndex.put(aSkill.getSkillID(), aSkill); } result.close(); result = null; s.close(); s = conn.createStatement(); query = "Select skill_id, skill_requirements from `skills`"; if (s.execute(query)) { result = s.getResultSet(); while (result.next()) { int id = result.getInt(1); // This skill ID has these // requirements. Skills aSkill = vSkillsListByIndex.get(id); // Here's // the // skill. String[] sRequiredSkills = result.getString(2).split( ","); // Here's the PARSED requirements. // aSkill .setRequisiteSkillString(result.getString(2)); // System.out.println("Skill adding requirements: " + // aSkill.getName()); for (int i = 0; i < sRequiredSkills.length; i++) { Iterator<Skills> itr = vSkillsListByIndex.values() .iterator(); while (itr.hasNext()) { Skills comparatorSkill = itr.next(); if (comparatorSkill.getName().equals( sRequiredSkills[i])) { aSkill.addRequiredSkillID(comparatorSkill .getSkillID()); } } } } } result.close(); s.close(); result = null; s = null; Runtime.getRuntime().gc(); } } catch (Exception e) { System.out.println("Error loading skills list: " + e.toString()); e.printStackTrace(); } finally { try { if (result != null) { result.close(); result = null; } if (s != null) { s.close(); s = null; } } catch (Exception e) { // Oh well! } } }
static void function() { vSkillsListByIndex = new Hashtable<Integer, Skills>(); vSkillsListByCommandCRC = new Hashtable<Integer, Skills>(); Statement s = null; ResultSet result = null; try { String query = STR; s = conn.createStatement(); if (s.execute(query)) { result = s.getResultSet(); while (result.next()) { Skills aSkill = new Skills(); int skillID = result.getInt(1); aSkill.setSkillID(skillID); String sName = result.getString(2); System.out.println(STR + sName + STR + skillID); aSkill.setName(sName); aSkill.setCreditsCost(result.getInt(3)); aSkill.setPointsCost(result.getInt(4)); String sXPType = result.getString(5); aSkill.setExperienceType(getExperienceIDFromName(sXPType)); aSkill.setExperienceCost(result.getInt(6)); aSkill.setExperienceCap(result.getInt(7)); int iNumberUnderscores = 0; int iCurrentIndex = -1; do { iCurrentIndex = sName.indexOf("_", iCurrentIndex + 1); if (iCurrentIndex > -1) { iNumberUnderscores++; } } while (iCurrentIndex > -1); if (iNumberUnderscores == 1) { System.out.println(STR + sName); aSkill.setNoviceSkillID(skillID + 1); } else if (iNumberUnderscores == 2) { if (sName.contains(STR)) { System.out .println(STR + (skillID - 1)); aSkill.setNoviceSkillID(skillID - 1); } else { System.out .println(STR + skillID); aSkill.setNoviceSkillID(skillID); } } else { boolean bFound = false; for (int i = skillID - 1; i >= 0 && !bFound; i--) { Skills noviceSkill = vSkillsListByIndex.get(i); if (noviceSkill != null) { String sNoviceName = noviceSkill.getName(); if (sNoviceName != null) { if (sNoviceName.contains(STR)) { System.out.println(STR + sName + STR + i); aSkill.setNoviceSkillID(i); bFound = true; } } } } if (!bFound) { System.out .println(STR + sName); } } int[] iSpeciesRequirementsForRace = new int[Constants.SpeciesNames.length]; int iNumSpeciesSet = 0; String sRace = result.getString(8); if (sRace != null && !sRace.equals(" ")) { String[] sRaceNames = sRace.split(","); if (sRaceNames != null) { for (int i = 0; i < Constants.SpeciesNames.length; i++) { for (int j = 0; j < sRaceNames.length; j++) { if (Constants.SpeciesNames[i] .equalsIgnoreCase(sRaceNames[j])) { iSpeciesRequirementsForRace[iNumSpeciesSet] = i; iNumSpeciesSet++; } } } } iSpeciesRequirementsForRace = Arrays.copyOfRange( iSpeciesRequirementsForRace, 0, iNumSpeciesSet); } String sUnparsedSkillMods = result.getString(9); if (sUnparsedSkillMods != null && sUnparsedSkillMods.equals(" ") == false) { String[] sSplitSkillMods = sUnparsedSkillMods .split(","); for (int i = 0; i < sSplitSkillMods.length; i++) { SkillMods mod = new SkillMods(); String[] sParsedSkillMod = sSplitSkillMods[i] .split("="); mod.setName(sParsedSkillMod[0]); mod.setSkillModModdedValue(Integer .parseInt(sParsedSkillMod[1])); mod.setSkillModStartingValue(0); aSkill.addSkillMod(mod); } } String sUnparsedSkillCommands = result.getString(10); if (!(sUnparsedSkillCommands == null sUnparsedSkillCommands .equals(" "))) { String[] sSplitSkillCommands = sUnparsedSkillCommands .split(","); for (int i = 0; i < sSplitSkillCommands.length; i++) { aSkill.addCertification(sSplitSkillCommands[i]); String thisCert = sSplitSkillCommands[i]; if (!(thisCert.startsWith(STR) thisCert .startsWith("cert"))) { int iCommandCRC = PacketUtils.SWGCrc(thisCert .toLowerCase()); Skills oldSkill = vSkillsListByCommandCRC .get(iCommandCRC); if (aSkill.getName().startsWith("jedi") == false && oldSkill == null) { vSkillsListByCommandCRC.put(iCommandCRC, aSkill); } } } } aSkill.setIsProfessionSkill(result.getBoolean(11)); aSkill.setSpeciesSpecific(iSpeciesRequirementsForRace); aSkill.setIsGodModeSkill(result.getBoolean(12)); vSkillsListByIndex.put(aSkill.getSkillID(), aSkill); } result.close(); result = null; s.close(); s = conn.createStatement(); query = STR; if (s.execute(query)) { result = s.getResultSet(); while (result.next()) { int id = result.getInt(1); Skills aSkill = vSkillsListByIndex.get(id); String[] sRequiredSkills = result.getString(2).split( ","); for (int i = 0; i < sRequiredSkills.length; i++) { Iterator<Skills> itr = vSkillsListByIndex.values() .iterator(); while (itr.hasNext()) { Skills comparatorSkill = itr.next(); if (comparatorSkill.getName().equals( sRequiredSkills[i])) { aSkill.addRequiredSkillID(comparatorSkill .getSkillID()); } } } } } result.close(); s.close(); result = null; s = null; Runtime.getRuntime().gc(); } } catch (Exception e) { System.out.println(STR + e.toString()); e.printStackTrace(); } finally { try { if (result != null) { result.close(); result = null; } if (s != null) { s.close(); s = null; } } catch (Exception e) { } } }
/** * Loads the list of skills from the database. This includes the skill ID, * name, cost, skill points required, experience quantity and type required, * etc. etc. */
Loads the list of skills from the database. This includes the skill ID, name, cost, skill points required, experience quantity and type required, etc. etc
loadSkillList
{ "repo_name": "oswin06082/SwgAnh1.0a", "path": "SWGCombined/src/DatabaseInterface.java", "license": "gpl-3.0", "size": 320465 }
[ "java.sql.ResultSet", "java.sql.Statement", "java.util.Arrays", "java.util.Hashtable", "java.util.Iterator" ]
import java.sql.ResultSet; import java.sql.Statement; import java.util.Arrays; import java.util.Hashtable; import java.util.Iterator;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
1,705,955
VSnapshot getSelectedSnapshot() { int numSnapshots = uiSnapshots.size(); if (numSnapshots == 0) { return null; } // find the snapshot that matches the clicked column VSnapshot snapshot; int i = showReadbacks ? 4 : 3; if (numSnapshots == 1 || clickedColumn <= i) { snapshot = uiSnapshots.get(0); } else { int subColumns = getColumns().get(i).getColumns().size(); if (2 + subColumns < clickedColumn) { // clicked on one of the live columns - in this case select the right most snapshot snapshot = uiSnapshots.get(numSnapshots - 1); } else { int clickedSubColumn = clickedColumn - i; if (showStoredReadbacks) { snapshot = uiSnapshots.get(clickedSubColumn / 2); } else { snapshot = uiSnapshots.get(clickedSubColumn); } } } return snapshot; }
VSnapshot getSelectedSnapshot() { int numSnapshots = uiSnapshots.size(); if (numSnapshots == 0) { return null; } VSnapshot snapshot; int i = showReadbacks ? 4 : 3; if (numSnapshots == 1 clickedColumn <= i) { snapshot = uiSnapshots.get(0); } else { int subColumns = getColumns().get(i).getColumns().size(); if (2 + subColumns < clickedColumn) { snapshot = uiSnapshots.get(numSnapshots - 1); } else { int clickedSubColumn = clickedColumn - i; if (showStoredReadbacks) { snapshot = uiSnapshots.get(clickedSubColumn / 2); } else { snapshot = uiSnapshots.get(clickedSubColumn); } } } return snapshot; }
/** * Returns the snapshot that is currently selected in the UI. Selected snapshot is the snapshot which was last * clicked. * * @return the selected snapshot */
Returns the snapshot that is currently selected in the UI. Selected snapshot is the snapshot which was last clicked
getSelectedSnapshot
{ "repo_name": "frib-high-level-controls/save-set-restore", "path": "plugins/org.csstudio.saverestore.ui/src/org/csstudio/saverestore/ui/Table.java", "license": "mit", "size": 42385 }
[ "org.csstudio.saverestore.data.VSnapshot" ]
import org.csstudio.saverestore.data.VSnapshot;
import org.csstudio.saverestore.data.*;
[ "org.csstudio.saverestore" ]
org.csstudio.saverestore;
303,726
public final Property<Double> compoundingPeriodsPerYear() { return metaBean().compoundingPeriodsPerYear().createProperty(this); }
final Property<Double> function() { return metaBean().compoundingPeriodsPerYear().createProperty(this); }
/** * Gets the the {@code compoundingPeriodsPerYear} property. * @return the property, not null */
Gets the the compoundingPeriodsPerYear property
compoundingPeriodsPerYear
{ "repo_name": "McLeodMoores/starling", "path": "projects/financial-types/src/main/java/com/opengamma/financial/security/deposit/PeriodicZeroDepositSecurity.java", "license": "apache-2.0", "size": 17740 }
[ "org.joda.beans.Property" ]
import org.joda.beans.Property;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
852,775
public Timestamp getDateNextRun () { return (Timestamp)get_Value(COLUMNNAME_DateNextRun); }
Timestamp function () { return (Timestamp)get_Value(COLUMNNAME_DateNextRun); }
/** Get Date next run. @return Date the process will run next */
Get Date next run
getDateNextRun
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/X_M_PerpetualInv.java", "license": "gpl-2.0", "size": 9098 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
825,527
Certificate getServerCertificate() { return mRemoteConnection.getServerCertificate(); }
Certificate getServerCertificate() { return mRemoteConnection.getServerCertificate(); }
/** * Gets the server certificate used in the TLS connection. * * @return The server certificate used in the TLS connection. */
Gets the server certificate used in the TLS connection
getServerCertificate
{ "repo_name": "PDXostc/rvi_core_android", "path": "src/main/java/org/genivi/rvi/RemoteConnectionManager.java", "license": "mpl-2.0", "size": 7005 }
[ "java.security.cert.Certificate" ]
import java.security.cert.Certificate;
import java.security.cert.*;
[ "java.security" ]
java.security;
1,095,128
public ChatChannel createNewChannel(String context, String title, boolean placementDefaultChannel, boolean checkAuthz, String placement) throws PermissionException;
ChatChannel function(String context, String title, boolean placementDefaultChannel, boolean checkAuthz, String placement) throws PermissionException;
/** * Creates a new ChatChannel but doesn't put it in the database. To persist the channel, call updateChannel(). * @param context Id of what the channel is linked to * @param title String the title of the channel * @param placementDefaultChannel boolean to set this as the default channel in the context * @param checkAuthz boolean indicating if we should check for authorization before creating the channel * @param placement String id of the tool placement * @return ChatChannel the new un-saved channel */
Creates a new ChatChannel but doesn't put it in the database. To persist the channel, call updateChannel()
createNewChannel
{ "repo_name": "harfalm/Sakai-10.1", "path": "chat/chat-api/api/src/java/org/sakaiproject/chat2/model/ChatManager.java", "license": "apache-2.0", "size": 9820 }
[ "org.sakaiproject.exception.PermissionException" ]
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.exception.*;
[ "org.sakaiproject.exception" ]
org.sakaiproject.exception;
1,418,062
@SuppressWarnings({ "boxing", "deprecation" }) protected void addImageToDocument(P p, Element e, Long cx, Long cy, BinaryPartAbstractImage imagePart) throws Exception { Long x = cx; Long y = cy; R run = Context.getWmlObjectFactory().createR(); p.getContent().add(run); Drawing drawing = Context.getWmlObjectFactory().createDrawing(); run.getContent().add(drawing); if (x == null && y == null) { if (maxWidth > 0) { long excessWidth = getTblCellMargins(); if (excessWidth > 0) { LOGGER.debug("table style margins subtracted (twips): " + excessWidth); } Inline inline = imagePart.createImageInline(null, e.getAttribute(ALT), 0, 1, false, maxWidth - (int) excessWidth); drawing.getAnchorOrInline().add(inline); } else { Inline inline = imagePart.createImageInline(null, e.getAttribute(ALT), 0, 1, false); drawing.getAnchorOrInline().add(inline); } } else { if (x == null) { x = imagePart.getImageInfo().getSize().getWidthPx() * (y / imagePart.getImageInfo().getSize().getHeightPx()); } if (y == null) { y = imagePart.getImageInfo().getSize().getHeightPx() * (x / imagePart.getImageInfo().getSize().getWidthPx()); } Inline inline = imagePart.createImageInline(null, e.getAttribute(ALT), 0, 1, x, y, false); drawing.getAnchorOrInline().add(inline); } }
@SuppressWarnings({ STR, STR }) void function(P p, Element e, Long cx, Long cy, BinaryPartAbstractImage imagePart) throws Exception { Long x = cx; Long y = cy; R run = Context.getWmlObjectFactory().createR(); p.getContent().add(run); Drawing drawing = Context.getWmlObjectFactory().createDrawing(); run.getContent().add(drawing); if (x == null && y == null) { if (maxWidth > 0) { long excessWidth = getTblCellMargins(); if (excessWidth > 0) { LOGGER.debug(STR + excessWidth); } Inline inline = imagePart.createImageInline(null, e.getAttribute(ALT), 0, 1, false, maxWidth - (int) excessWidth); drawing.getAnchorOrInline().add(inline); } else { Inline inline = imagePart.createImageInline(null, e.getAttribute(ALT), 0, 1, false); drawing.getAnchorOrInline().add(inline); } } else { if (x == null) { x = imagePart.getImageInfo().getSize().getWidthPx() * (y / imagePart.getImageInfo().getSize().getHeightPx()); } if (y == null) { y = imagePart.getImageInfo().getSize().getHeightPx() * (x / imagePart.getImageInfo().getSize().getWidthPx()); } Inline inline = imagePart.createImageInline(null, e.getAttribute(ALT), 0, 1, x, y, false); drawing.getAnchorOrInline().add(inline); } }
/** * Adds the image to document. * * @param p * the paragraph * @param e * the image element from DOM * @param cx * width of image itself (ie excluding CSS margin, padding) in EMU * @param cy * height of image itself (ie excluding CSS margin, padding) in EMU * @param imagePart * the image part * @throws Exception * the exception */
Adds the image to document
addImageToDocument
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sirma-platform/platform/seip-parent/platform/domain-model/instance-export/src/main/java/org/docx4j/convert/in/xhtml/XHTMLImageHandlerImpl.java", "license": "lgpl-3.0", "size": 15419 }
[ "org.docx4j.dml.wordprocessingDrawing.Inline", "org.docx4j.jaxb.Context", "org.docx4j.openpackaging.parts.WordprocessingML", "org.docx4j.wml.Drawing", "org.w3c.dom.Element" ]
import org.docx4j.dml.wordprocessingDrawing.Inline; import org.docx4j.jaxb.Context; import org.docx4j.openpackaging.parts.WordprocessingML; import org.docx4j.wml.Drawing; import org.w3c.dom.Element;
import org.docx4j.dml.*; import org.docx4j.jaxb.*; import org.docx4j.openpackaging.parts.*; import org.docx4j.wml.*; import org.w3c.dom.*;
[ "org.docx4j.dml", "org.docx4j.jaxb", "org.docx4j.openpackaging", "org.docx4j.wml", "org.w3c.dom" ]
org.docx4j.dml; org.docx4j.jaxb; org.docx4j.openpackaging; org.docx4j.wml; org.w3c.dom;
471,394
public static List<Region> getRegions() { return regions; }
static List<Region> function() { return regions; }
/** * Gets the collection of regions. */
Gets the collection of regions
getRegions
{ "repo_name": "Vult-R/Astraeus-Java-Framework", "path": "src/main/java/com/astraeus/game/world/Region.java", "license": "gpl-3.0", "size": 4473 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
247,943
public static long lastModified(Path p) { try { return Files.getLastModifiedTime(p).toMillis(); } catch (IOException e) { return 0; } }
static long function(Path p) { try { return Files.getLastModifiedTime(p).toMillis(); } catch (IOException e) { return 0; } }
/** * Get the last modified time of a path. * <p> * Equivalent to {@code File#lastModified()}, returning 0 on errors, including * file not found. Callers that prefer exceptions can use {@link * Files#getLastModifiedTime(Path, java.nio.file.LinkOption...)}. * * @param p path. * @return last modified time, in milliseconds since epoch. */
Get the last modified time of a path. Equivalent to File#lastModified(), returning 0 on errors, including file not found. Callers that prefer exceptions can use <code>Files#getLastModifiedTime(Path, java.nio.file.LinkOption...)</code>
lastModified
{ "repo_name": "netroby/gerrit", "path": "gerrit-common/src/main/java/com/google/gerrit/common/FileUtil.java", "license": "apache-2.0", "size": 3014 }
[ "java.io.IOException", "java.nio.file.Files", "java.nio.file.Path" ]
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path;
import java.io.*; import java.nio.file.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
2,217,090
@Override public int compare(String file0, String file1) { Matcher m0 = pattern.matcher(file0); Matcher m1 = pattern.matcher(file1); if (!m0.matches()) { Log.w(TAG, "could not parse upgrade script file: " + file0); throw new SQLiteAssetHelper.SQLiteAssetException("Invalid upgrade script file"); } if (!m1.matches()) { Log.w(TAG, "could not parse upgrade script file: " + file1); throw new SQLiteAssetHelper.SQLiteAssetException("Invalid upgrade script file"); } int v0_from = Integer.valueOf(m0.group(1)); int v1_from = Integer.valueOf(m1.group(1)); int v0_to = Integer.valueOf(m0.group(2)); int v1_to = Integer.valueOf(m1.group(2)); if (v0_from == v1_from) { // 'from' versions match for both; check 'to' version next if (v0_to == v1_to) { return 0; } return v0_to < v1_to ? -1 : 1; } return v0_from < v1_from ? -1 : 1; }
int function(String file0, String file1) { Matcher m0 = pattern.matcher(file0); Matcher m1 = pattern.matcher(file1); if (!m0.matches()) { Log.w(TAG, STR + file0); throw new SQLiteAssetHelper.SQLiteAssetException(STR); } if (!m1.matches()) { Log.w(TAG, STR + file1); throw new SQLiteAssetHelper.SQLiteAssetException(STR); } int v0_from = Integer.valueOf(m0.group(1)); int v1_from = Integer.valueOf(m1.group(1)); int v0_to = Integer.valueOf(m0.group(2)); int v1_to = Integer.valueOf(m1.group(2)); if (v0_from == v1_from) { if (v0_to == v1_to) { return 0; } return v0_to < v1_to ? -1 : 1; } return v0_from < v1_from ? -1 : 1; }
/** * Compares the two specified upgrade script strings to determine their * relative ordering considering their two version numbers. Assumes all * database names used are the same, as this function only compares the * two version numbers. * * @param file0 * an upgrade script file name * @param file1 * a second upgrade script file name to compare with file0 * @return an integer < 0 if file0 should be applied before file1, 0 if * they are equal (though that shouldn't happen), and > 0 if * file0 should be applied after file1. * * @exception SQLiteAssetException * thrown if the strings are not in the correct upgrade * script format of: * <code>databasename_fromVersionInteger_toVersionInteger</code> */
Compares the two specified upgrade script strings to determine their relative ordering considering their two version numbers. Assumes all database names used are the same, as this function only compares the two version numbers
compare
{ "repo_name": "nailuoluo/GridSales", "path": "GriddingSale/app/src/main/java/com/liuy314/griddingsale/utl/VersionComparator.java", "license": "gpl-2.0", "size": 2389 }
[ "android.util.Log", "java.util.regex.Matcher" ]
import android.util.Log; import java.util.regex.Matcher;
import android.util.*; import java.util.regex.*;
[ "android.util", "java.util" ]
android.util; java.util;
1,903,540
public static void setFolderOpenIcon(Image folderIcon) { openFolder = folderIcon; }
static void function(Image folderIcon) { openFolder = folderIcon; }
/** * Sets the icon for a tree folder in its expanded state * * @param folderIcon the icon for a folder within the tree */
Sets the icon for a tree folder in its expanded state
setFolderOpenIcon
{ "repo_name": "skyHALud/codenameone", "path": "CodenameOne/src/com/codename1/ui/tree/Tree.java", "license": "gpl-2.0", "size": 18876 }
[ "com.codename1.ui.Image" ]
import com.codename1.ui.Image;
import com.codename1.ui.*;
[ "com.codename1.ui" ]
com.codename1.ui;
928,993
List<T> res = new ArrayList<>(collection); Collections.sort(res); return Collections.unmodifiableList(res); }
List<T> res = new ArrayList<>(collection); Collections.sort(res); return Collections.unmodifiableList(res); }
/** * Get a sorted list representation of a collection. * @param collection The collection to sort * @param <T> The class of objects in the collection * @return An unmodifiable sorted list with the contents of the collection */
Get a sorted list representation of a collection
sorted
{ "repo_name": "lemonJun/TakinMQ", "path": "takinmq-kclient/src/main/java/org/apache/kafka/common/utils/Utils.java", "license": "apache-2.0", "size": 29556 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,314,121
public Date getLastSyncedTimestamp() { return this.lastSyncedTimestamp; }
Date function() { return this.lastSyncedTimestamp; }
/** * get last synced timestamp * * @return last synced timestamp */
get last synced timestamp
getLastSyncedTimestamp
{ "repo_name": "fanyunfeng/jfdfslib", "path": "src/main/java/jfdfs/core/StructStorageStat.java", "license": "gpl-2.0", "size": 36725 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,699,232
@FIXVersion(introduced="4.0") @TagNumRef(tagNum=TagNum.TransactTime) public Date getTransactTime() { return transactTime; }
@FIXVersion(introduced="4.0") @TagNumRef(tagNum=TagNum.TransactTime) Date function() { return transactTime; }
/** * Message field getter. * @return field value */
Message field getter
getTransactTime
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/AllocationInstructionMsg.java", "license": "gpl-3.0", "size": 122626 }
[ "java.util.Date", "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.TagNum" ]
import java.util.Date; import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum;
import java.util.*; import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "java.util", "net.hades.fix" ]
java.util; net.hades.fix;
1,939,865
public CountDownLatch getGiftCardBalanceAsync(com.mozu.api.contracts.paymentservice.request.GetGiftCardBalanceRequest balanceRequest, String cardId, String responseFields, AsyncCallback<com.mozu.api.contracts.paymentservice.response.SyncResponse> callback) throws Exception { MozuClient<com.mozu.api.contracts.paymentservice.response.SyncResponse> client = com.mozu.api.clients.commerce.payments.PublicCardClient.getGiftCardBalanceClient( balanceRequest, cardId, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); }
CountDownLatch function(com.mozu.api.contracts.paymentservice.request.GetGiftCardBalanceRequest balanceRequest, String cardId, String responseFields, AsyncCallback<com.mozu.api.contracts.paymentservice.response.SyncResponse> callback) throws Exception { MozuClient<com.mozu.api.contracts.paymentservice.response.SyncResponse> client = com.mozu.api.clients.commerce.payments.PublicCardClient.getGiftCardBalanceClient( balanceRequest, cardId, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); }
/** * * <p><pre><code> * PublicCard publiccard = new PublicCard(); * CountDownLatch latch = publiccard.getGiftCardBalance( balanceRequest, cardId, responseFields, callback ); * latch.await() * </code></pre></p> * @param cardId Unique identifier of the card associated with the customer account billing contact. * @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. * @param callback callback handler for asynchronous operations * @param balanceRequest * @return com.mozu.api.contracts.paymentservice.response.SyncResponse * @see com.mozu.api.contracts.paymentservice.response.SyncResponse * @see com.mozu.api.contracts.paymentservice.request.GetGiftCardBalanceRequest */
<code><code> PublicCard publiccard = new PublicCard(); CountDownLatch latch = publiccard.getGiftCardBalance( balanceRequest, cardId, responseFields, callback ); latch.await() * </code></code>
getGiftCardBalanceAsync
{ "repo_name": "Mozu/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/payments/PublicCardResource.java", "license": "mit", "size": 19371 }
[ "com.mozu.api.AsyncCallback", "com.mozu.api.MozuClient", "java.util.concurrent.CountDownLatch" ]
import com.mozu.api.AsyncCallback; import com.mozu.api.MozuClient; import java.util.concurrent.CountDownLatch;
import com.mozu.api.*; import java.util.concurrent.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
2,474,976
public String getStoredProceduresLink() { return String.format("%s/%s", StringUtils.stripEnd(super.selfLink(), "/"), super.getString(Constants.Properties.STORED_PROCEDURES_LINK)); }
String function() { return String.format("%s/%s", StringUtils.stripEnd(super.selfLink(), "/"), super.getString(Constants.Properties.STORED_PROCEDURES_LINK)); }
/** * Gets the self-link for stored procedures in a collection. * * @return the stored procedures link. */
Gets the self-link for stored procedures in a collection
getStoredProceduresLink
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DocumentCollection.java", "license": "mit", "size": 10539 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
2,261,096
public Node getCurrentNode() { return m_currentNode; }
Node function() { return m_currentNode; }
/** * Get the node currently being processed. * * @return the current node being processed */
Get the node currently being processed
getCurrentNode
{ "repo_name": "michelegonella/zen-project", "path": "zen-base/src/main/java/com/nominanuda/xml/DOMBuilder.java", "license": "apache-2.0", "size": 23208 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,064,345
public ColumnInformation getColumnInformation( final double cx ) { //Gather information on columns final RenderingInformation renderingInformation = getRenderingInformation(); if ( renderingInformation == null ) { return new ColumnInformation(); } final GridData model = view.getModel(); final List<GridColumn<?>> columns = model.getColumns(); final RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns(); final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns(); final double floatingX = floatingBlockInformation.getX(); final double floatingWidth = floatingBlockInformation.getWidth(); //Check floating columns double offsetX = floatingX; GridColumn<?> column = null; for ( GridColumn<?> gridColumn : floatingColumns ) { if ( gridColumn.isVisible() ) { final double columnWidth = gridColumn.getWidth(); if ( cx > offsetX && cx < offsetX + columnWidth ) { column = gridColumn; break; } offsetX = offsetX + columnWidth; } } if ( column != null ) { return new ColumnInformation( column, columns.indexOf( column ), offsetX ); } //Check all other columns offsetX = bodyBlockInformation.getX(); for ( GridColumn<?> gridColumn : bodyColumns ) { if ( gridColumn.isVisible() ) { final double columnWidth = gridColumn.getWidth(); if ( offsetX + columnWidth > floatingX + floatingWidth ) { if ( cx > offsetX && cx < offsetX + columnWidth ) { column = gridColumn; break; } } offsetX = offsetX + columnWidth; } } if ( column == null ) { return new ColumnInformation(); } return new ColumnInformation( column, columns.indexOf( column ), offsetX ); }
ColumnInformation function( final double cx ) { final RenderingInformation renderingInformation = getRenderingInformation(); if ( renderingInformation == null ) { return new ColumnInformation(); } final GridData model = view.getModel(); final List<GridColumn<?>> columns = model.getColumns(); final RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation(); final RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation(); final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns(); final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns(); final double floatingX = floatingBlockInformation.getX(); final double floatingWidth = floatingBlockInformation.getWidth(); double offsetX = floatingX; GridColumn<?> column = null; for ( GridColumn<?> gridColumn : floatingColumns ) { if ( gridColumn.isVisible() ) { final double columnWidth = gridColumn.getWidth(); if ( cx > offsetX && cx < offsetX + columnWidth ) { column = gridColumn; break; } offsetX = offsetX + columnWidth; } } if ( column != null ) { return new ColumnInformation( column, columns.indexOf( column ), offsetX ); } offsetX = bodyBlockInformation.getX(); for ( GridColumn<?> gridColumn : bodyColumns ) { if ( gridColumn.isVisible() ) { final double columnWidth = gridColumn.getWidth(); if ( offsetX + columnWidth > floatingX + floatingWidth ) { if ( cx > offsetX && cx < offsetX + columnWidth ) { column = gridColumn; break; } } offsetX = offsetX + columnWidth; } } if ( column == null ) { return new ColumnInformation(); } return new ColumnInformation( column, columns.indexOf( column ), offsetX ); }
/** * Get information about a column corresponding to a grid-relative x-coordinate. This method never returns null. * It returns a ColumnInformation object representing the column corresponding to the grid-relative x-coordinate; * or an empty ColumnInformation object if no corresponding column was found. * @param cx An x-coordinate relative to the GridWidget. * @return A non-null ColumnInformation object. */
Get information about a column corresponding to a grid-relative x-coordinate. This method never returns null. It returns a ColumnInformation object representing the column corresponding to the grid-relative x-coordinate; or an empty ColumnInformation object if no corresponding column was found
getColumnInformation
{ "repo_name": "kiereleaseuser/uberfire", "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRendererHelper.java", "license": "apache-2.0", "size": 23442 }
[ "java.util.List", "org.uberfire.ext.wires.core.grids.client.model.GridColumn", "org.uberfire.ext.wires.core.grids.client.model.GridData" ]
import java.util.List; import org.uberfire.ext.wires.core.grids.client.model.GridColumn; import org.uberfire.ext.wires.core.grids.client.model.GridData;
import java.util.*; import org.uberfire.ext.wires.core.grids.client.model.*;
[ "java.util", "org.uberfire.ext" ]
java.util; org.uberfire.ext;
918,271
@Override public String getApiWrapperModuleName() { List<String> names = Splitter.on(".").splitToList(packageName); return names.get(0); }
String function() { List<String> names = Splitter.on(".").splitToList(packageName); return names.get(0); }
/** * NodeJS uses a special format for ApiWrapperModuleName. * * <p>The name for the module for this vkit module. This assumes that the package_name in the API * config will be in the format of 'apiname.version', and extracts the 'apiname'. */
NodeJS uses a special format for ApiWrapperModuleName. The name for the module for this vkit module. This assumes that the package_name in the API config will be in the format of 'apiname.version', and extracts the 'apiname'
getApiWrapperModuleName
{ "repo_name": "googleapis/discovery-artifact-manager", "path": "toolkit/src/main/java/com/google/api/codegen/transformer/nodejs/NodeJSSurfaceNamer.java", "license": "apache-2.0", "size": 20089 }
[ "com.google.common.base.Splitter", "java.util.List" ]
import com.google.common.base.Splitter; import java.util.List;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,847,809
private Optional<Integer> getNatPoolVrid() { return _currentVirtualServer.getPorts().values().stream() .map(VirtualServerPort::getSourceNat) .filter(Objects::nonNull) .map( name -> { NatPool pool = _c.getNatPools().get(name); assert pool != null; // sanity check, undefined refs are not allowed return pool; }) .map(pool -> Optional.ofNullable(pool.getVrid()).orElse(DEFAULT_VRID)) .findAny(); }
Optional<Integer> function() { return _currentVirtualServer.getPorts().values().stream() .map(VirtualServerPort::getSourceNat) .filter(Objects::nonNull) .map( name -> { NatPool pool = _c.getNatPools().get(name); assert pool != null; return pool; }) .map(pool -> Optional.ofNullable(pool.getVrid()).orElse(DEFAULT_VRID)) .findAny(); }
/** * Return the vrid for the NAT pool(s) associated with the current virtual-server. Returns {@link * Optional#empty()} if there are no NAT pools assigned for the current virtual-server. */
Return the vrid for the NAT pool(s) associated with the current virtual-server. Returns <code>Optional#empty()</code> if there are no NAT pools assigned for the current virtual-server
getNatPoolVrid
{ "repo_name": "arifogel/batfish", "path": "projects/batfish/src/main/java/org/batfish/vendor/a10/grammar/A10ConfigurationBuilder.java", "license": "apache-2.0", "size": 107744 }
[ "java.util.Objects", "java.util.Optional", "org.batfish.vendor.a10.representation.NatPool", "org.batfish.vendor.a10.representation.VirtualServerPort" ]
import java.util.Objects; import java.util.Optional; import org.batfish.vendor.a10.representation.NatPool; import org.batfish.vendor.a10.representation.VirtualServerPort;
import java.util.*; import org.batfish.vendor.a10.representation.*;
[ "java.util", "org.batfish.vendor" ]
java.util; org.batfish.vendor;
1,016,344
public List<String> showDialogAndGetMultipleFiles() { configureFileChooser(); return DefaultTaskExecutor.runInJavaFXThread(() -> { List<File> files = fileChooser.showOpenMultipleDialog(null); if (files == null) { return Collections.emptyList(); } else { return files.stream().map(File::toString).collect(Collectors.toList()); } }); }
List<String> function() { configureFileChooser(); return DefaultTaskExecutor.runInJavaFXThread(() -> { List<File> files = fileChooser.showOpenMultipleDialog(null); if (files == null) { return Collections.emptyList(); } else { return files.stream().map(File::toString).collect(Collectors.toList()); } }); }
/** * Shows an {@link JFileChooser#OPEN_DIALOG} and allows to select multiple files * @return List containing the paths of all files or an empty list if dialog is canceled */
Shows an <code>JFileChooser#OPEN_DIALOG</code> and allows to select multiple files
showDialogAndGetMultipleFiles
{ "repo_name": "bartsch-dev/jabref", "path": "src/main/java/org/jabref/gui/FileDialog.java", "license": "mit", "size": 7107 }
[ "java.io.File", "java.util.Collections", "java.util.List", "java.util.stream.Collectors", "org.jabref.gui.util.DefaultTaskExecutor" ]
import java.io.File; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import org.jabref.gui.util.DefaultTaskExecutor;
import java.io.*; import java.util.*; import java.util.stream.*; import org.jabref.gui.util.*;
[ "java.io", "java.util", "org.jabref.gui" ]
java.io; java.util; org.jabref.gui;
2,531,381
public void addDataSet(final DigitalObject dataSet) { if (dataSets == null) { dataSets = new HashSet<>(); } if (dataSet != null) { dataSets.add(dataSet); dataSet.setInvestigation(this); } else { throw new IllegalArgumentException("Argument dataSet must not be null."); } }
void function(final DigitalObject dataSet) { if (dataSets == null) { dataSets = new HashSet<>(); } if (dataSet != null) { dataSets.add(dataSet); dataSet.setInvestigation(this); } else { throw new IllegalArgumentException(STR); } }
/** * Add a data set to the set of dataSets. * * @param dataSet the dataSet to add */
Add a data set to the set of dataSets
addDataSet
{ "repo_name": "kit-data-manager/base", "path": "MetaDataManagement/MDM-BaseMetaData/src/main/java/edu/kit/dama/mdm/base/Investigation.java", "license": "apache-2.0", "size": 23621 }
[ "java.util.HashSet" ]
import java.util.HashSet;
import java.util.*;
[ "java.util" ]
java.util;
2,829,889
public Accessible getAccessibleSelection(int i) { if (i > 0 && i < getAccessibleSelectionCount()) return new AccessibleJTreeNode(tree, tp.pathByAddingChild(selectionList.get(i)), acc); return null; }
Accessible function(int i) { if (i > 0 && i < getAccessibleSelectionCount()) return new AccessibleJTreeNode(tree, tp.pathByAddingChild(selectionList.get(i)), acc); return null; }
/** * Returns an Accessible representing the specified selected item * in the object. * * @return the accessible representing a certain selected item. */
Returns an Accessible representing the specified selected item in the object
getAccessibleSelection
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/JTree.java", "license": "bsd-3-clause", "size": 80712 }
[ "javax.accessibility.Accessible" ]
import javax.accessibility.Accessible;
import javax.accessibility.*;
[ "javax.accessibility" ]
javax.accessibility;
1,667,649
@Test public void testRegionOpenFailsDueToIOException() throws Exception { HRegionInfo REGIONINFO = new HRegionInfo(TableName.valueOf("t"), HConstants.EMPTY_START_ROW, HConstants.EMPTY_START_ROW); HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0); TableDescriptors htd = Mockito.mock(TableDescriptors.class); Object orizinalState = Whitebox.getInternalState(regionServer,"tableDescriptors"); Whitebox.setInternalState(regionServer, "tableDescriptors", htd); Mockito.doThrow(new IOException()).when(htd).get((TableName) Mockito.any()); try { ProtobufUtil.openRegion(regionServer, regionServer.getServerName(), REGIONINFO); fail("It should throw IOException "); } catch (IOException e) { } Whitebox.setInternalState(regionServer, "tableDescriptors", orizinalState); assertFalse("Region should not be in RIT", regionServer.getRegionsInTransitionInRS().containsKey(REGIONINFO.getEncodedNameAsBytes())); }
void function() throws Exception { HRegionInfo REGIONINFO = new HRegionInfo(TableName.valueOf("t"), HConstants.EMPTY_START_ROW, HConstants.EMPTY_START_ROW); HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0); TableDescriptors htd = Mockito.mock(TableDescriptors.class); Object orizinalState = Whitebox.getInternalState(regionServer,STR); Whitebox.setInternalState(regionServer, STR, htd); Mockito.doThrow(new IOException()).when(htd).get((TableName) Mockito.any()); try { ProtobufUtil.openRegion(regionServer, regionServer.getServerName(), REGIONINFO); fail(STR); } catch (IOException e) { } Whitebox.setInternalState(regionServer, STR, orizinalState); assertFalse(STR, regionServer.getRegionsInTransitionInRS().containsKey(REGIONINFO.getEncodedNameAsBytes())); }
/** * If region open fails with IOException in openRegion() while doing tableDescriptors.get() * the region should not add into regionsInTransitionInRS map * @throws Exception */
If region open fails with IOException in openRegion() while doing tableDescriptors.get() the region should not add into regionsInTransitionInRS map
testRegionOpenFailsDueToIOException
{ "repo_name": "throughsky/lywebank", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java", "license": "apache-2.0", "size": 10901 }
[ "java.io.IOException", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.HRegionInfo", "org.apache.hadoop.hbase.TableDescriptors", "org.apache.hadoop.hbase.TableName", "org.apache.hadoop.hbase.protobuf.ProtobufUtil", "org.apache.hadoop.hbase.regionserver.HRegionServer", "org.junit.Assert", "org.mockito.Mockito", "org.mockito.internal.util.reflection.Whitebox" ]
import java.io.IOException; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.TableDescriptors; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.junit.Assert; import org.mockito.Mockito; import org.mockito.internal.util.reflection.Whitebox;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.protobuf.*; import org.apache.hadoop.hbase.regionserver.*; import org.junit.*; import org.mockito.*; import org.mockito.internal.util.reflection.*;
[ "java.io", "org.apache.hadoop", "org.junit", "org.mockito", "org.mockito.internal" ]
java.io; org.apache.hadoop; org.junit; org.mockito; org.mockito.internal;
2,331,176
private void checkIfOutputValid() { String output = new String(mOutputStream.toByteArray(), StandardCharsets.UTF_8); // Skip checking startTime which relies on system time zone String startTime = CommonUtils.convertMsToDate(1131242343122L); List<String> expectedOutput = Arrays.asList("Alluxio cluster summary: ", " Master Address: testAddress", " Web Port: 1231", " Rpc Port: 8462", " Started: " + startTime, " Uptime: 143 day(s), 15 hour(s), 53 minute(s), and 32 second(s)", " Version: testVersion", " Safe Mode: false", " Zookeeper Enabled: true", " Zookeeper Addresses: ", " [zookeeper_hostname1]:2181", " [zookeeper_hostname2]:2181", " [zookeeper_hostname3]:2181", " Live Workers: 12", " Lost Workers: 4", " Total Capacity: 1309.92KB", " Tier: MEM Size: 1309.92KB", " Tier: DOM Size: 230.96KB", " Tier: RAM Size: 22.57KB", " Used Capacity: 60.97KB", " Tier: MEM Size: 60.97KB", " Tier: DOM Size: 72.50KB", " Tier: RAM Size: 6.10KB", " Free Capacity: 1248.94KB"); List<String> testOutput = Arrays.asList(output.split("\n")); Assert.assertThat(testOutput, IsIterableContainingInOrder.contains(expectedOutput.toArray())); }
void function() { String output = new String(mOutputStream.toByteArray(), StandardCharsets.UTF_8); String startTime = CommonUtils.convertMsToDate(1131242343122L); List<String> expectedOutput = Arrays.asList(STR, STR, STR, STR, STR + startTime, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR); List<String> testOutput = Arrays.asList(output.split("\n")); Assert.assertThat(testOutput, IsIterableContainingInOrder.contains(expectedOutput.toArray())); }
/** * Checks if the output is expected. */
Checks if the output is expected
checkIfOutputValid
{ "repo_name": "Reidddddd/alluxio", "path": "shell/src/test/java/alluxio/cli/fsadmin/report/SummaryCommandTest.java", "license": "apache-2.0", "size": 5084 }
[ "java.nio.charset.StandardCharsets", "java.util.Arrays", "java.util.List", "org.hamcrest.collection.IsIterableContainingInOrder", "org.junit.Assert" ]
import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; import org.hamcrest.collection.IsIterableContainingInOrder; import org.junit.Assert;
import java.nio.charset.*; import java.util.*; import org.hamcrest.collection.*; import org.junit.*;
[ "java.nio", "java.util", "org.hamcrest.collection", "org.junit" ]
java.nio; java.util; org.hamcrest.collection; org.junit;
89,056
protected List<Integer> getFreePes() { return freePes; }
List<Integer> function() { return freePes; }
/** * Gets the free pes. * * @return the free pes */
Gets the free pes
getFreePes
{ "repo_name": "swethapts/cloudsim", "path": "sources/org/cloudbus/cloudsim/VmAllocationPolicySimpleSteady.java", "license": "lgpl-3.0", "size": 5805 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,820,146
public String getUrlAttributes( ) { StringBuilder sbUrlAttributes = new StringBuilder( ); sbUrlAttributes.append( PARAMETER_SEARCH_IS_SEARCH + CONSTANT_EQUAL ).append( Boolean.TRUE ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_USER_LEVEL + CONSTANT_EQUAL ).append( _nUserLevel ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_STATUS + CONSTANT_EQUAL ).append( _nStatus ); try { sbUrlAttributes.append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_ACCESS_CODE + CONSTANT_EQUAL ) .append( URLEncoder.encode( _strAccessCode, AppPropertiesService.getProperty( PROPERTY_ENCODING_URL ) ) ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_LAST_NAME + CONSTANT_EQUAL ) .append( URLEncoder.encode( _strLastName, AppPropertiesService.getProperty( PROPERTY_ENCODING_URL ) ) ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_EMAIL + CONSTANT_EQUAL ) .append( URLEncoder.encode( _strEmail, AppPropertiesService.getProperty( PROPERTY_ENCODING_URL ) ) ); } catch( UnsupportedEncodingException e ) { AppLogService.error( e.getMessage( ), e ); } return sbUrlAttributes.toString( ); }
String function( ) { StringBuilder sbUrlAttributes = new StringBuilder( ); sbUrlAttributes.append( PARAMETER_SEARCH_IS_SEARCH + CONSTANT_EQUAL ).append( Boolean.TRUE ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_USER_LEVEL + CONSTANT_EQUAL ).append( _nUserLevel ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_STATUS + CONSTANT_EQUAL ).append( _nStatus ); try { sbUrlAttributes.append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_ACCESS_CODE + CONSTANT_EQUAL ) .append( URLEncoder.encode( _strAccessCode, AppPropertiesService.getProperty( PROPERTY_ENCODING_URL ) ) ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_LAST_NAME + CONSTANT_EQUAL ) .append( URLEncoder.encode( _strLastName, AppPropertiesService.getProperty( PROPERTY_ENCODING_URL ) ) ) .append( CONSTANT_AMPERSAND + PARAMETER_SEARCH_EMAIL + CONSTANT_EQUAL ) .append( URLEncoder.encode( _strEmail, AppPropertiesService.getProperty( PROPERTY_ENCODING_URL ) ) ); } catch( UnsupportedEncodingException e ) { AppLogService.error( e.getMessage( ), e ); } return sbUrlAttributes.toString( ); }
/** * Build url attributes * * @return the url attributes */
Build url attributes
getUrlAttributes
{ "repo_name": "rzara/lutece-core", "path": "src/java/fr/paris/lutece/portal/business/user/AdminUserFilter.java", "license": "bsd-3-clause", "size": 9194 }
[ "fr.paris.lutece.portal.service.util.AppLogService", "fr.paris.lutece.portal.service.util.AppPropertiesService", "java.io.UnsupportedEncodingException", "java.net.URLEncoder" ]
import fr.paris.lutece.portal.service.util.AppLogService; import fr.paris.lutece.portal.service.util.AppPropertiesService; import java.io.UnsupportedEncodingException; import java.net.URLEncoder;
import fr.paris.lutece.portal.service.util.*; import java.io.*; import java.net.*;
[ "fr.paris.lutece", "java.io", "java.net" ]
fr.paris.lutece; java.io; java.net;
1,938,463
protected boolean acceptUnknownVisitor(StateObjectVisitor visitor) { try { try { acceptUnknownVisitor(visitor, visitor.getClass(), getClass()); } catch (NoSuchMethodException e) { // Try with Expression has the parameter type acceptUnknownVisitor(visitor, visitor.getClass(), StateObject.class); } return true; } catch (NoSuchMethodException e) { // Ignore, just do nothing return false; } catch (IllegalAccessException e) { // Ignore, just do nothing return false; } catch (InvocationTargetException e) { Throwable cause = e.getCause(); RuntimeException actual; if (cause instanceof RuntimeException) { actual = (RuntimeException) cause; } else { actual = new RuntimeException(cause); } throw actual; } }
boolean function(StateObjectVisitor visitor) { try { try { acceptUnknownVisitor(visitor, visitor.getClass(), getClass()); } catch (NoSuchMethodException e) { acceptUnknownVisitor(visitor, visitor.getClass(), StateObject.class); } return true; } catch (NoSuchMethodException e) { return false; } catch (IllegalAccessException e) { return false; } catch (InvocationTargetException e) { Throwable cause = e.getCause(); RuntimeException actual; if (cause instanceof RuntimeException) { actual = (RuntimeException) cause; } else { actual = new RuntimeException(cause); } throw actual; } }
/** * The given {@link StateObjectVisitor} needs to visit this class but it is defined by a * third-party provider. This method will programmatically invoke the <b>visit</b> method defined * on the given visitor which signature should be. * * <div><code>{public|protected|private} void visit(ThirdPartyStateObject stateObject)</code></div> * <p> * or * * <div><code>{public|protected|private} void visit(StateObject stateObject)</code><p></div> * * @param visitor The {@link StateObjectVisitor} to visit this {@link StateObject} programmatically * @return <code>true</code> if the call was successfully executed; <code>false</code> otherwise * @since 2.4 */
The given <code>StateObjectVisitor</code> needs to visit this class but it is defined by a third-party provider. This method will programmatically invoke the visit method defined on the given visitor which signature should be. <code>{public|protected|private} void visit(ThirdPartyStateObject stateObject)</code> or <code>{public|protected|private} void visit(StateObject stateObject)</code>
acceptUnknownVisitor
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/tools/model/query/AbstractStateObject.java", "license": "epl-1.0", "size": 22504 }
[ "java.lang.reflect.InvocationTargetException" ]
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,158,165
List<Map<String, Object>> items = Lists.newArrayList(); if (isServerMode) { reader.beginArray(); while (reader.hasNext()) { JsonObject json = gson.fromJson(reader, JsonObject.class); items.add((Map<String, Object>) toRawTypes(json)); } reader.endArray(); } else { while (reader.peek() != JsonToken.END_DOCUMENT) { JsonObject json = gson.fromJson(reader, JsonObject.class); items.add((Map<String, Object>) toRawTypes(json)); } } return items; }
List<Map<String, Object>> items = Lists.newArrayList(); if (isServerMode) { reader.beginArray(); while (reader.hasNext()) { JsonObject json = gson.fromJson(reader, JsonObject.class); items.add((Map<String, Object>) toRawTypes(json)); } reader.endArray(); } else { while (reader.peek() != JsonToken.END_DOCUMENT) { JsonObject json = gson.fromJson(reader, JsonObject.class); items.add((Map<String, Object>) toRawTypes(json)); } } return items; }
/** * Access the next set of rules from the build file processor. Note that for non-server * invocations, this will collect all of the rules into one enormous list. * * @return The parsed JSON, represented as Java collections. Ideally, we would use Gson's object * model directly to avoid the overhead of converting between object models. That would * require updating all code that depends on this method, which may be a lot of work. Also, * bear in mind that using the Java collections decouples clients of this method from the JSON * parser that we use. */
Access the next set of rules from the build file processor. Note that for non-server invocations, this will collect all of the rules into one enormous list
nextRules
{ "repo_name": "thinkernel/buck", "path": "src/com/facebook/buck/json/BuildFileToJsonParser.java", "license": "apache-2.0", "size": 6317 }
[ "com.google.common.collect.Lists", "com.google.gson.JsonObject", "com.google.gson.stream.JsonToken", "java.util.List", "java.util.Map" ]
import com.google.common.collect.Lists; import com.google.gson.JsonObject; import com.google.gson.stream.JsonToken; import java.util.List; import java.util.Map;
import com.google.common.collect.*; import com.google.gson.*; import com.google.gson.stream.*; import java.util.*;
[ "com.google.common", "com.google.gson", "java.util" ]
com.google.common; com.google.gson; java.util;
1,932,494
public int remove(String statusId) { SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String instance = Helper.getLiveInstance(context); return db.delete(Sqlite.TABLE_TIMELINE_CACHE, Sqlite.COL_STATUS_ID + " = \""+ statusId +"\" AND " + Sqlite.COL_INSTANCE + " = \"" + instance + "\" AND " + Sqlite.COL_USER_ID + " = \"" + userId + "\"", null); }
int function(String statusId) { SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String instance = Helper.getLiveInstance(context); return db.delete(Sqlite.TABLE_TIMELINE_CACHE, Sqlite.COL_STATUS_ID + STRSTR\STR + Sqlite.COL_INSTANCE + STRSTR\STR + Sqlite.COL_USER_ID + STRSTR\"", null); }
/*** * Remove stored status * @return int */
Remove stored status
remove
{ "repo_name": "stom79/mastalab", "path": "app/src/main/java/app/fedilab/android/sqlite/TimelineCacheDAO.java", "license": "gpl-3.0", "size": 7705 }
[ "android.content.Context", "android.content.SharedPreferences", "app.fedilab.android.helper.Helper" ]
import android.content.Context; import android.content.SharedPreferences; import app.fedilab.android.helper.Helper;
import android.content.*; import app.fedilab.android.helper.*;
[ "android.content", "app.fedilab.android" ]
android.content; app.fedilab.android;
87,761
private boolean checkValues() { boolean sameValues = false; switch (type) { case TRANSLATION: case SCALE: case COLOR: sameValues = fromXYZ[0] == toXYZ[0] && fromXYZ[1] == toXYZ[1] && fromXYZ[2] == toXYZ[2]; break; case ROTATION: case ALPHA: case BRIGHTNESS: sameValues = fromA == toA; break; case PARALLEL: case CHAINED: if (ArrayUtils.isEmpty(transforms)) { MalisisCore.log.error("No transforms specified for {}. Ignoring transformation.", name); return false; } return true; } if (sameValues) MalisisCore.log.error("From and To are the same for {}. Ignoring transformation.", name); return !sameValues; } /** * Gets a new {@link Transformation} from this {@link Transform}
boolean function() { boolean sameValues = false; switch (type) { case TRANSLATION: case SCALE: case COLOR: sameValues = fromXYZ[0] == toXYZ[0] && fromXYZ[1] == toXYZ[1] && fromXYZ[2] == toXYZ[2]; break; case ROTATION: case ALPHA: case BRIGHTNESS: sameValues = fromA == toA; break; case PARALLEL: case CHAINED: if (ArrayUtils.isEmpty(transforms)) { MalisisCore.log.error(STR, name); return false; } return true; } if (sameValues) MalisisCore.log.error(STR, name); return !sameValues; } /** * Gets a new {@link Transformation} from this {@link Transform}
/** * Check if supplied values are valid. * * @return true, if values are valid */
Check if supplied values are valid
checkValues
{ "repo_name": "Ordinastie/MalisisCore", "path": "src/main/java/net/malisis/core/renderer/model/loader/AnimationImporter.java", "license": "mit", "size": 15203 }
[ "net.malisis.core.MalisisCore", "net.malisis.core.renderer.animation.transformation.Transformation", "org.apache.commons.lang3.ArrayUtils" ]
import net.malisis.core.MalisisCore; import net.malisis.core.renderer.animation.transformation.Transformation; import org.apache.commons.lang3.ArrayUtils;
import net.malisis.core.*; import net.malisis.core.renderer.animation.transformation.*; import org.apache.commons.lang3.*;
[ "net.malisis.core", "org.apache.commons" ]
net.malisis.core; org.apache.commons;
340,425
protected void resetFaceInternalLabels() { final Iterator<HE_Face> fItr = fItr(); while (fItr.hasNext()) { fItr.next().setInternalLabel(-1); } }
void function() { final Iterator<HE_Face> fItr = fItr(); while (fItr.hasNext()) { fItr.next().setInternalLabel(-1); } }
/** * Reset face labels to -1. * * */
Reset face labels to -1
resetFaceInternalLabels
{ "repo_name": "DweebsUnited/CodeMonkey", "path": "java/CodeMonkey/HEMesh/wblut/hemesh/HE_Mesh.java", "license": "bsd-3-clause", "size": 143263 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,375,457
@Override public Bitmap getBitmap() { mAdapterThreadChecker.assertOnValidThread(); TraceEvent.begin("ViewResourceAdapter:getBitmap"); super.getBitmap(); if (mLastGetBitmapTimestamp > 0) { RecordHistogram.recordLongTimesHistogram("ViewResourceAdapter.GetBitmapInterval", SystemClock.elapsedRealtime() - mLastGetBitmapTimestamp); } if (mUseHardwareBitmapDraw) { captureWithHardwareDraw(); } else if (validateBitmap()) { captureWithSoftwareDraw(); } else { assert mBitmap.getWidth() == 1 && mBitmap.getHeight() == 1; mBitmap.setPixel(0, 0, Color.TRANSPARENT); } mDirtyRect.setEmpty(); mLastGetBitmapTimestamp = SystemClock.elapsedRealtime(); TraceEvent.end("ViewResourceAdapter:getBitmap"); return mBitmap; }
Bitmap function() { mAdapterThreadChecker.assertOnValidThread(); TraceEvent.begin(STR); super.getBitmap(); if (mLastGetBitmapTimestamp > 0) { RecordHistogram.recordLongTimesHistogram(STR, SystemClock.elapsedRealtime() - mLastGetBitmapTimestamp); } if (mUseHardwareBitmapDraw) { captureWithHardwareDraw(); } else if (validateBitmap()) { captureWithSoftwareDraw(); } else { assert mBitmap.getWidth() == 1 && mBitmap.getHeight() == 1; mBitmap.setPixel(0, 0, Color.TRANSPARENT); } mDirtyRect.setEmpty(); mLastGetBitmapTimestamp = SystemClock.elapsedRealtime(); TraceEvent.end(STR); return mBitmap; }
/** * If this resource is dirty ({@link #isDirty()} returned {@code true}), it will recapture a * {@link Bitmap} of the {@link View}. * @see DynamicResource#getBitmap() * @return A {@link Bitmap} representing the {@link View}. */
If this resource is dirty (<code>#isDirty()</code> returned true), it will recapture a <code>Bitmap</code> of the <code>View</code>
getBitmap
{ "repo_name": "nwjs/chromium.src", "path": "ui/android/java/src/org/chromium/ui/resources/dynamics/ViewResourceAdapter.java", "license": "bsd-3-clause", "size": 23205 }
[ "android.graphics.Bitmap", "android.graphics.Color", "android.os.SystemClock", "org.chromium.base.TraceEvent", "org.chromium.base.metrics.RecordHistogram" ]
import android.graphics.Bitmap; import android.graphics.Color; import android.os.SystemClock; import org.chromium.base.TraceEvent; import org.chromium.base.metrics.RecordHistogram;
import android.graphics.*; import android.os.*; import org.chromium.base.*; import org.chromium.base.metrics.*;
[ "android.graphics", "android.os", "org.chromium.base" ]
android.graphics; android.os; org.chromium.base;
2,498,289
public static void setMutexFlagsforTargetingGoal(Goal goal) { goal.setMutexFlags(EnumSet.of(TARGET)); }
static void function(Goal goal) { goal.setMutexFlags(EnumSet.of(TARGET)); }
/** * Set mutex flags for targeting goal. * * @param goal AI goal to set flags for. */
Set mutex flags for targeting goal
setMutexFlagsforTargetingGoal
{ "repo_name": "athrane/bassebombecraft", "path": "src/main/java/bassebombecraft/entity/ai/AiUtils.java", "license": "gpl-3.0", "size": 14630 }
[ "java.util.EnumSet", "net.minecraft.entity.ai.goal.Goal" ]
import java.util.EnumSet; import net.minecraft.entity.ai.goal.Goal;
import java.util.*; import net.minecraft.entity.ai.goal.*;
[ "java.util", "net.minecraft.entity" ]
java.util; net.minecraft.entity;
978,840
@Test public void testAddNeighbouringRouter() throws Exception { ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(), Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2, new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(), new OspfInterfaceImpl()), topologyForDeviceAndLink); ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111")); ospfInterface.addNeighbouringRouter(ospfNbr); assertThat(ospfInterface, is(notNullValue())); }
void function() throws Exception { ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(), Ip4Address.valueOf(STR), Ip4Address.valueOf(STR), 2, new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(), new OspfInterfaceImpl()), topologyForDeviceAndLink); ospfNbr.setNeighborId(Ip4Address.valueOf(STR)); ospfInterface.addNeighbouringRouter(ospfNbr); assertThat(ospfInterface, is(notNullValue())); }
/** * Tests addNeighbouringRouter() method. */
Tests addNeighbouringRouter() method
testAddNeighbouringRouter
{ "repo_name": "Phaneendra-Huawei/demo", "path": "protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfInterfaceImplTest.java", "license": "apache-2.0", "size": 16164 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.onlab.packet.Ip4Address", "org.onosproject.ospf.controller.impl.Controller", "org.onosproject.ospf.controller.impl.OspfInterfaceChannelHandler", "org.onosproject.ospf.controller.impl.OspfNbrImpl" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.onlab.packet.Ip4Address; import org.onosproject.ospf.controller.impl.Controller; import org.onosproject.ospf.controller.impl.OspfInterfaceChannelHandler; import org.onosproject.ospf.controller.impl.OspfNbrImpl;
import org.hamcrest.*; import org.onlab.packet.*; import org.onosproject.ospf.controller.impl.*;
[ "org.hamcrest", "org.onlab.packet", "org.onosproject.ospf" ]
org.hamcrest; org.onlab.packet; org.onosproject.ospf;
1,480,738
@RequestProcessing(value = "/statistic", method = HTTPRequestMethod.GET) @Before(adviceClass = {StopwatchStartAdvice.class, AnonymousViewCheck.class}) @After(adviceClass = StopwatchEndAdvice.class) public void showStatistic(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response) throws Exception { final AbstractFreeMarkerRenderer renderer = new SkinRenderer(); context.setRenderer(renderer); renderer.setTemplateName("statistic.ftl"); final Map<String, Object> dataModel = renderer.getDataModel(); dataModel.put("monthDays", monthDays); dataModel.put("userCnts", userCnts); dataModel.put("articleCnts", articleCnts); dataModel.put("commentCnts", commentCnts); dataModel.put("months", months); dataModel.put("historyUserCnts", historyUserCnts); dataModel.put("historyArticleCnts", historyArticleCnts); dataModel.put("historyCommentCnts", historyCommentCnts); filler.fillHeaderAndFooter(request, response, dataModel); final int avatarViewMode = (int) request.getAttribute(UserExt.USER_AVATAR_VIEW_MODE); filler.fillRandomArticles(avatarViewMode, dataModel); filler.fillSideHotArticles(avatarViewMode, dataModel); filler.fillSideTags(dataModel); filler.fillLatestCmts(dataModel); dataModel.put(Common.ONLINE_VISITOR_CNT, optionQueryService.getOnlineVisitorCount()); dataModel.put(Common.ONLINE_MEMBER_CNT, optionQueryService.getOnlineMemberCount()); final JSONObject statistic = optionQueryService.getStatistic(); dataModel.put(Option.CATEGORY_C_STATISTIC, statistic); }
@RequestProcessing(value = STR, method = HTTPRequestMethod.GET) @Before(adviceClass = {StopwatchStartAdvice.class, AnonymousViewCheck.class}) @After(adviceClass = StopwatchEndAdvice.class) void function(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response) throws Exception { final AbstractFreeMarkerRenderer renderer = new SkinRenderer(); context.setRenderer(renderer); renderer.setTemplateName(STR); final Map<String, Object> dataModel = renderer.getDataModel(); dataModel.put(STR, monthDays); dataModel.put(STR, userCnts); dataModel.put(STR, articleCnts); dataModel.put(STR, commentCnts); dataModel.put(STR, months); dataModel.put(STR, historyUserCnts); dataModel.put(STR, historyArticleCnts); dataModel.put(STR, historyCommentCnts); filler.fillHeaderAndFooter(request, response, dataModel); final int avatarViewMode = (int) request.getAttribute(UserExt.USER_AVATAR_VIEW_MODE); filler.fillRandomArticles(avatarViewMode, dataModel); filler.fillSideHotArticles(avatarViewMode, dataModel); filler.fillSideTags(dataModel); filler.fillLatestCmts(dataModel); dataModel.put(Common.ONLINE_VISITOR_CNT, optionQueryService.getOnlineVisitorCount()); dataModel.put(Common.ONLINE_MEMBER_CNT, optionQueryService.getOnlineMemberCount()); final JSONObject statistic = optionQueryService.getStatistic(); dataModel.put(Option.CATEGORY_C_STATISTIC, statistic); }
/** * Shows data statistic. * * @param context the specified context * @param request the specified request * @param response the specified response * @throws Exception exception */
Shows data statistic
showStatistic
{ "repo_name": "qiangber/symphony", "path": "src/main/java/org/b3log/symphony/processor/StatisticProcessor.java", "license": "apache-2.0", "size": 8081 }
[ "java.util.Map", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.b3log.latke.servlet.HTTPRequestContext", "org.b3log.latke.servlet.HTTPRequestMethod", "org.b3log.latke.servlet.annotation.After", "org.b3log.latke.servlet.annotation.Before", "org.b3log.latke.servlet.annotation.RequestProcessing", "org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer", "org.b3log.symphony.model.Common", "org.b3log.symphony.model.Option", "org.b3log.symphony.model.UserExt", "org.b3log.symphony.processor.advice.AnonymousViewCheck", "org.b3log.symphony.processor.advice.stopwatch.StopwatchEndAdvice", "org.b3log.symphony.processor.advice.stopwatch.StopwatchStartAdvice", "org.json.JSONObject" ]
import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.b3log.latke.servlet.HTTPRequestContext; import org.b3log.latke.servlet.HTTPRequestMethod; import org.b3log.latke.servlet.annotation.After; import org.b3log.latke.servlet.annotation.Before; import org.b3log.latke.servlet.annotation.RequestProcessing; import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer; import org.b3log.symphony.model.Common; import org.b3log.symphony.model.Option; import org.b3log.symphony.model.UserExt; import org.b3log.symphony.processor.advice.AnonymousViewCheck; import org.b3log.symphony.processor.advice.stopwatch.StopwatchEndAdvice; import org.b3log.symphony.processor.advice.stopwatch.StopwatchStartAdvice; import org.json.JSONObject;
import java.util.*; import javax.servlet.http.*; import org.b3log.latke.servlet.*; import org.b3log.latke.servlet.annotation.*; import org.b3log.latke.servlet.renderer.freemarker.*; import org.b3log.symphony.model.*; import org.b3log.symphony.processor.advice.*; import org.b3log.symphony.processor.advice.stopwatch.*; import org.json.*;
[ "java.util", "javax.servlet", "org.b3log.latke", "org.b3log.symphony", "org.json" ]
java.util; javax.servlet; org.b3log.latke; org.b3log.symphony; org.json;
1,135,090
public static Attribute.Compound createCompoundFromAnnotationMirror( ProcessingEnvironment env, AnnotationMirror am) { // Create a new Attribute to match the AnnotationMirror. List<Pair<Symbol.MethodSymbol, Attribute>> values = List.nil(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet()) { Attribute attribute = attributeFromAnnotationValue(env, entry.getKey(), entry.getValue()); values = values.append(new Pair<>((Symbol.MethodSymbol) entry.getKey(), attribute)); } return new Attribute.Compound((Type.ClassType) am.getAnnotationType(), values); }
static Attribute.Compound function( ProcessingEnvironment env, AnnotationMirror am) { List<Pair<Symbol.MethodSymbol, Attribute>> values = List.nil(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet()) { Attribute attribute = attributeFromAnnotationValue(env, entry.getKey(), entry.getValue()); values = values.append(new Pair<>((Symbol.MethodSymbol) entry.getKey(), attribute)); } return new Attribute.Compound((Type.ClassType) am.getAnnotationType(), values); }
/** * Returns a newly created Attribute.Compound corresponding to an argument AnnotationMirror. * * @param am an AnnotationMirror, which may be part of an AST or an internally created subclass * @return a new Attribute.Compound corresponding to the AnnotationMirror */
Returns a newly created Attribute.Compound corresponding to an argument AnnotationMirror
createCompoundFromAnnotationMirror
{ "repo_name": "CharlesZ-Chen/checker-framework", "path": "javacutil/src/org/checkerframework/javacutil/TypeAnnotationUtils.java", "license": "gpl-2.0", "size": 16080 }
[ "com.sun.tools.javac.code.Attribute", "com.sun.tools.javac.code.Symbol", "com.sun.tools.javac.code.Type", "com.sun.tools.javac.util.List", "com.sun.tools.javac.util.Pair", "java.util.Map", "javax.annotation.processing.ProcessingEnvironment", "javax.lang.model.element.AnnotationMirror", "javax.lang.model.element.AnnotationValue", "javax.lang.model.element.ExecutableElement" ]
import com.sun.tools.javac.code.Attribute; import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.Pair; import java.util.Map; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.ExecutableElement;
import com.sun.tools.javac.code.*; import com.sun.tools.javac.util.*; import java.util.*; import javax.annotation.processing.*; import javax.lang.model.element.*;
[ "com.sun.tools", "java.util", "javax.annotation", "javax.lang" ]
com.sun.tools; java.util; javax.annotation; javax.lang;
2,056,893
public static void start() { start = U.currentTimeMillis(); }
static void function() { start = U.currentTimeMillis(); }
/** * Sets starting time after which {@link #timing(String)} measurements can be done. */
Sets starting time after which <code>#timing(String)</code> measurements can be done
start
{ "repo_name": "ascherbakoff/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/GridDebug.java", "license": "apache-2.0", "size": 12004 }
[ "org.apache.ignite.internal.util.typedef.internal.U" ]
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.typedef.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
380,036
URL getUrl() throws IOException;
URL getUrl() throws IOException;
/** * Returns a URL. * * @throws IOException if the URL cannot be created */
Returns a URL
getUrl
{ "repo_name": "genman/rhq-plugins", "path": "http/src/main/java/com/apple/iad/rhq/http/UrlSource.java", "license": "lgpl-2.1", "size": 344 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
208,782
public static java.util.List extractTemplateAssociationsList(ims.domain.ILightweightDomainFactory domainFactory, ims.correspondence.vo.TemplateAssociationsVoCollection voCollection) { return extractTemplateAssociationsList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.correspondence.vo.TemplateAssociationsVoCollection voCollection) { return extractTemplateAssociationsList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.correspondence.configuration.domain.objects.TemplateAssociations list from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.correspondence.configuration.domain.objects.TemplateAssociations list from the value object collection
extractTemplateAssociationsList
{ "repo_name": "open-health-hub/openmaxims-linux", "path": "openmaxims_workspace/ValueObjects/src/ims/correspondence/vo/domain/TemplateAssociationsVoAssembler.java", "license": "agpl-3.0", "size": 22226 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
760,003
protected void firstTurn(GameEntry gameEntry){ // phase changes aren't recorded as entries phases.setPhase( PhaseType.FIRST_TURNS ); phases.beginGame(); // sets turn counter to 1 // do first discard and first turn (phases.getTurn() should == 1 right now) for ( Player player: players.turnOrder() ){ gameEntry.getFirstDiscard().add( firstDiscard( player ) ); // add entry for discard of first turn gameEntry.getTurn().add( runTurn( player ) ); // sets in entry the "ordinary" events of first turn } }
void function(GameEntry gameEntry){ phases.setPhase( PhaseType.FIRST_TURNS ); phases.beginGame(); for ( Player player: players.turnOrder() ){ gameEntry.getFirstDiscard().add( firstDiscard( player ) ); gameEntry.getTurn().add( runTurn( player ) ); } }
/** * Executes the first turn of the game, and adds entries as side-effect to <code>gameEntry</code>. */
Executes the first turn of the game, and adds entries as side-effect to <code>gameEntry</code>
firstTurn
{ "repo_name": "underplex/tickay", "path": "src/main/java/com/underplex/tickay/game/Game.java", "license": "gpl-2.0", "size": 8999 }
[ "com.underplex.tickay.jaxb.GameEntry", "com.underplex.tickay.player.Player" ]
import com.underplex.tickay.jaxb.GameEntry; import com.underplex.tickay.player.Player;
import com.underplex.tickay.jaxb.*; import com.underplex.tickay.player.*;
[ "com.underplex.tickay" ]
com.underplex.tickay;
1,097,938
protected static void writeXmlHeader(final PrintWriter out) throws IOException { //noinspection HardCodedStringLiteral out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); crlf(out); }
static void function(final PrintWriter out) throws IOException { out.print(STR1.0\STRUTF-8\"?>"); crlf(out); }
/** * Write XML header * @param out a writer * @throws IOException in case of IO problem */
Write XML header
writeXmlHeader
{ "repo_name": "ernestp/consulo", "path": "platform/compiler-api/src/com/intellij/compiler/ant/Generator.java", "license": "apache-2.0", "size": 1673 }
[ "java.io.IOException", "java.io.PrintWriter" ]
import java.io.IOException; import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
1,679,179
public static java.util.List extractWaitingTimesAdjustmentsandReasonsList(ims.domain.ILightweightDomainFactory domainFactory, ims.oncology.vo.WaitingTimesAdjustmentsAndReasonsVoCollection voCollection) { return extractWaitingTimesAdjustmentsandReasonsList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.oncology.vo.WaitingTimesAdjustmentsAndReasonsVoCollection voCollection) { return extractWaitingTimesAdjustmentsandReasonsList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.oncology.domain.objects.WaitingTimesAdjustmentsandReasons list from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.oncology.domain.objects.WaitingTimesAdjustmentsandReasons list from the value object collection
extractWaitingTimesAdjustmentsandReasonsList
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/oncology/vo/domain/WaitingTimesAdjustmentsAndReasonsVoAssembler.java", "license": "agpl-3.0", "size": 31776 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
546,184
//----------------------------------------------------------------------- private LocalDate[] getDates() { return _dates; }
LocalDate[] function() { return _dates; }
/** * Gets the knot dates on the curve. * @return the value of the property */
Gets the knot dates on the curve
getDates
{ "repo_name": "McLeodMoores/starling", "path": "projects/analytics/src/main/java/com/opengamma/analytics/financial/credit/isdastandardmodel/ISDACompliantDateCurve.java", "license": "apache-2.0", "size": 13766 }
[ "org.threeten.bp.LocalDate" ]
import org.threeten.bp.LocalDate;
import org.threeten.bp.*;
[ "org.threeten.bp" ]
org.threeten.bp;
537,547
if (Debug.debugging("cachelayer")) { Debug.output("Reading cached graphics"); } if (omgraphics == null) { omgraphics = new OMGraphicList(); } if (cacheURL != null) { omgraphics.readGraphics(cacheURL); } }
if (Debug.debugging(STR)) { Debug.output(STR); } if (omgraphics == null) { omgraphics = new OMGraphicList(); } if (cacheURL != null) { omgraphics.readGraphics(cacheURL); } }
/** * Read a cache of OMGraphics */
Read a cache of OMGraphics
readGraphics
{ "repo_name": "d2fn/passage", "path": "src/main/java/com/bbn/openmap/layer/CacheLayer.java", "license": "mit", "size": 12009 }
[ "com.bbn.openmap.omGraphics.OMGraphicList", "com.bbn.openmap.util.Debug" ]
import com.bbn.openmap.omGraphics.OMGraphicList; import com.bbn.openmap.util.Debug;
import com.bbn.openmap.*; import com.bbn.openmap.util.*;
[ "com.bbn.openmap" ]
com.bbn.openmap;
2,049,917
public static long getTime(Calendar c, int hour, int minute, int second) { c.clear(Calendar.MILLISECOND); c.set(1970, 0, 1, hour, minute, second); return c.getTimeInMillis(); }
static long function(Calendar c, int hour, int minute, int second) { c.clear(Calendar.MILLISECOND); c.set(1970, 0, 1, hour, minute, second); return c.getTimeInMillis(); }
/** * Get a timestamp for the given hour, minute, and second. The date will * be assumed to be January 1, 1970. * @param c a Calendar to use to help compute the result. The state of the * Calendar will be overwritten. * @param hour the hour, on a 24 hour clock * @param minute the minute value * @param second the seconds value * @return the timestamp for the given date */
Get a timestamp for the given hour, minute, and second. The date will be assumed to be January 1, 1970
getTime
{ "repo_name": "giacomovagni/Prefuse", "path": "src/prefuse/util/TimeLib.java", "license": "bsd-3-clause", "size": 10673 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
1,201,569
public void testCustomLevelSerialization() throws Exception { CustomLevel custom = new CustomLevel(); Object obj = SerializationTestHelper.serializeClone(custom); assertTrue(obj instanceof CustomLevel); CustomLevel clone = (CustomLevel) obj; assertEquals(Level.INFO.level, clone.level); assertEquals(Level.INFO.levelStr, clone.levelStr); assertEquals(Level.INFO.syslogEquivalent, clone.syslogEquivalent); } private static class CustomLevel extends Level { public CustomLevel() { super( Level.INFO.level, Level.INFO.levelStr, Level.INFO.syslogEquivalent); } }
void function() throws Exception { CustomLevel custom = new CustomLevel(); Object obj = SerializationTestHelper.serializeClone(custom); assertTrue(obj instanceof CustomLevel); CustomLevel clone = (CustomLevel) obj; assertEquals(Level.INFO.level, clone.level); assertEquals(Level.INFO.levelStr, clone.levelStr); assertEquals(Level.INFO.syslogEquivalent, clone.syslogEquivalent); } private static class CustomLevel extends Level { public CustomLevel() { super( Level.INFO.level, Level.INFO.levelStr, Level.INFO.syslogEquivalent); } }
/** * Tests that a custom level can be serialized and deserialized * and is not resolved to a stock level. * * @throws Exception if exception during test. */
Tests that a custom level can be serialized and deserialized and is not resolved to a stock level
testCustomLevelSerialization
{ "repo_name": "alipayhuber/hack-log4j", "path": "tests/src/java/org/apache/log4j/LevelTest.java", "license": "apache-2.0", "size": 6786 }
[ "org.apache.log4j.util.SerializationTestHelper" ]
import org.apache.log4j.util.SerializationTestHelper;
import org.apache.log4j.util.*;
[ "org.apache.log4j" ]
org.apache.log4j;
719,303
private void removeItemsFromDatabase(Connection connection) throws SQLException { String sql = "DELETE FROM " + DML.Table_Features + " where " + DML.Col_docId + " = '" + docId + "'"; PreparedStatement ps = connection.prepareStatement(sql); ps.execute(); }
void function(Connection connection) throws SQLException { String sql = STR + DML.Table_Features + STR + DML.Col_docId + STR + docId + "'"; PreparedStatement ps = connection.prepareStatement(sql); ps.execute(); }
/** * Old data should be removed for docId * @param connection * @throws SQLException */
Old data should be removed for docId
removeItemsFromDatabase
{ "repo_name": "rajkshah14/Web-Search-Engine", "path": "src/main/java/searchengine/features/indexer/Indexer.java", "license": "mit", "size": 9205 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
840,293
@Override @ApiOperation(value = "update configuration with given id ", notes = "Returns an updated Configuration object.") @ApiResponses(value = { @ApiResponse(code = 200, message = "configuration was successfully updated"), @ApiResponse(code = 404, message = "could not find a configuration for the given id"), @ApiResponse(code = 500, message = "internal processing error (see body for details)") }) @PUT @Path("/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateObject(@ApiParam(value = "configuration (as JSON)", required = true) final String jsonObjectString, @ApiParam(value = "configuration identifier", required = true) @PathParam("id") final String uuid) throws DMPControllerException { return super.updateObject(jsonObjectString, uuid); }
@ApiOperation(value = STR, notes = STR) @ApiResponses(value = { @ApiResponse(code = 200, message = STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 500, message = STR) }) @Path("/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response function(@ApiParam(value = STR, required = true) final String jsonObjectString, @ApiParam(value = STR, required = true) @PathParam("id") final String uuid) throws DMPControllerException { return super.updateObject(jsonObjectString, uuid); }
/** * This endpoint consumes a configuration as JSON representation and updates this configuration in the database. * * @param jsonObjectString a JSON representation of one configuration * @param uuid a configuration identifier * @return the updated configuration as JSON representation * @throws DMPControllerException */
This endpoint consumes a configuration as JSON representation and updates this configuration in the database
updateObject
{ "repo_name": "dswarm/dswarm", "path": "controller/src/main/java/org/dswarm/controller/resources/resource/ConfigurationsResource.java", "license": "apache-2.0", "size": 8283 }
[ "com.wordnik.swagger.annotations.ApiOperation", "com.wordnik.swagger.annotations.ApiParam", "com.wordnik.swagger.annotations.ApiResponse", "com.wordnik.swagger.annotations.ApiResponses", "javax.ws.rs.Consumes", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.dswarm.controller.DMPControllerException" ]
import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.dswarm.controller.DMPControllerException;
import com.wordnik.swagger.annotations.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.dswarm.controller.*;
[ "com.wordnik.swagger", "javax.ws", "org.dswarm.controller" ]
com.wordnik.swagger; javax.ws; org.dswarm.controller;
2,734,971
public double getBalance(String world, String currencyName) { double balance = Double.MIN_NORMAL; if (!Common.getInstance().getWorldGroupManager().worldGroupExist(world)) { world = Common.getInstance().getWorldGroupManager().getWorldGroupName(world); } Currency currency = Common.getInstance().getCurrencyManager().getCurrency(currencyName); if (currency != null) { if (!hasInfiniteMoney()) { balance = Common.getInstance().getStorageHandler().getStorageEngine().getBalance(this, currency, world); } else { balance = Double.MAX_VALUE; } } return format(balance); } /** * Adds a certain amount of money in the account * * @param amount The amount of money to add * @param world The World / World group we want to add money in * @param currencyName The currency we want to add money in * @return The new balance. If the account has infinite money. Double.MAX_VALUE is returned. * @deprecated use {@link #deposit(double, String, String, com.greatmancode.craftconomy3.Cause, String)}
double function(String world, String currencyName) { double balance = Double.MIN_NORMAL; if (!Common.getInstance().getWorldGroupManager().worldGroupExist(world)) { world = Common.getInstance().getWorldGroupManager().getWorldGroupName(world); } Currency currency = Common.getInstance().getCurrencyManager().getCurrency(currencyName); if (currency != null) { if (!hasInfiniteMoney()) { balance = Common.getInstance().getStorageHandler().getStorageEngine().getBalance(this, currency, world); } else { balance = Double.MAX_VALUE; } } return format(balance); } /** * Adds a certain amount of money in the account * * @param amount The amount of money to add * @param world The World / World group we want to add money in * @param currencyName The currency we want to add money in * @return The new balance. If the account has infinite money. Double.MAX_VALUE is returned. * @deprecated use {@link #deposit(double, String, String, com.greatmancode.craftconomy3.Cause, String)}
/** * Get's the player balance. Sends double.MIN_NORMAL in case of a error * * @param world The world / world group to search in * @param currencyName The currency Name * @return The balance. If the account has infinite money. Double.MAX_VALUE is returned. */
Get's the player balance. Sends double.MIN_NORMAL in case of a error
getBalance
{ "repo_name": "kpqi5858/craftconomy3", "path": "src/main/java/com/greatmancode/craftconomy3/account/Account.java", "license": "lgpl-3.0", "size": 14741 }
[ "com.greatmancode.craftconomy3.Cause", "com.greatmancode.craftconomy3.Common", "com.greatmancode.craftconomy3.currency.Currency" ]
import com.greatmancode.craftconomy3.Cause; import com.greatmancode.craftconomy3.Common; import com.greatmancode.craftconomy3.currency.Currency;
import com.greatmancode.craftconomy3.*; import com.greatmancode.craftconomy3.currency.*;
[ "com.greatmancode.craftconomy3" ]
com.greatmancode.craftconomy3;
2,643,771
public Cancellable getIndexTemplateAsync(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options, ActionListener<GetIndexTemplatesResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest, IndicesRequestConverters::getTemplates, options, GetIndexTemplatesResponse::fromXContent, listener, emptySet()); }
Cancellable function(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options, ActionListener<GetIndexTemplatesResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest, IndicesRequestConverters::getTemplates, options, GetIndexTemplatesResponse::fromXContent, listener, emptySet()); }
/** * Asynchronously gets index templates using the Index Templates API * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API * on elastic.co</a> * @param getIndexTemplatesRequest the request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion * @return cancellable that may be used to cancel the request */
Asynchronously gets index templates using the Index Templates API See Index Templates API on elastic.co
getIndexTemplateAsync
{ "repo_name": "ern/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java", "license": "apache-2.0", "size": 87672 }
[ "java.util.Collections", "org.elasticsearch.action.ActionListener", "org.elasticsearch.client.indices.GetIndexTemplatesRequest", "org.elasticsearch.client.indices.GetIndexTemplatesResponse" ]
import java.util.Collections; import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.indices.GetIndexTemplatesRequest; import org.elasticsearch.client.indices.GetIndexTemplatesResponse;
import java.util.*; import org.elasticsearch.action.*; import org.elasticsearch.client.indices.*;
[ "java.util", "org.elasticsearch.action", "org.elasticsearch.client" ]
java.util; org.elasticsearch.action; org.elasticsearch.client;
2,742,431
T constant(SourceSection source, Object value);
T constant(SourceSection source, Object value);
/** * Creates a constant, the value is expected to be one of FastR's scalar types (byte, int, * double, RComplex, String, RNull). */
Creates a constant, the value is expected to be one of FastR's scalar types (byte, int, double, RComplex, String, RNull)
constant
{ "repo_name": "akunft/fastr", "path": "com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java", "license": "gpl-2.0", "size": 8421 }
[ "com.oracle.truffle.api.source.SourceSection" ]
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.source.*;
[ "com.oracle.truffle" ]
com.oracle.truffle;
61,989
public List generateInstances(TimeRange prototype, TimeRange range, TimeZone timeZone) { // these calendars are used if local time zone and the time zone where the first event was created (timeZone) are different GregorianCalendar firstEventCalendarDate = null; GregorianCalendar nextFirstEventCalendarDate = null; // %%% Note: base the breakdonw on the "timeZone" parameter to support multiple timeZone displays -ggolden TimeBreakdown startBreakdown = prototype.firstTime().breakdownLocal(); GregorianCalendar startCalendarDate = TimeService.getCalendar(TimeService.getLocalTimeZone(),0,0,0,0,0,0,0); startCalendarDate.set( startBreakdown.getYear(), startBreakdown.getMonth() - 1, startBreakdown.getDay(), startBreakdown.getHour(), startBreakdown.getMin(), startBreakdown.getSec()); // if local time zone and first event time zone are different // a new calendar is generated to calculate the re-occurring events // if not, the local time zone calendar is used boolean differentTimeZone = false; if (TimeService.getLocalTimeZone().getID().equals(timeZone.getID())) { differentTimeZone = false; } else { differentTimeZone = true; } if (differentTimeZone) { firstEventCalendarDate = TimeService.getCalendar(timeZone,0,0,0,0,0,0,0); firstEventCalendarDate.setTimeInMillis(startCalendarDate.getTimeInMillis()); nextFirstEventCalendarDate = (GregorianCalendar) firstEventCalendarDate.clone(); } List rv = new Vector(); GregorianCalendar nextCalendarDate = (GregorianCalendar) startCalendarDate.clone(); int currentCount = 1; do { if (differentTimeZone) { // next time is calculated according to the first event time zone, not the local one nextCalendarDate.setTimeInMillis(nextFirstEventCalendarDate.getTimeInMillis()); } Time nextTime = TimeService.newTime(nextCalendarDate); // is this past count? if ((getCount() > 0) && (currentCount > getCount())) break; // is this past until? if ((getUntil() != null) && isAfter(nextTime, getUntil()) ) break; TimeRange nextTimeRange = TimeService.newTimeRange(nextTime.getTime(), prototype.duration()); // // Is this out of the range? // if (isOverlap(range, nextTimeRange)) { TimeRange eventTimeRange = null; // Single time cases require special handling. if ( prototype.isSingleTime() ) { eventTimeRange = TimeService.newTimeRange(nextTimeRange.firstTime()); } else { eventTimeRange = TimeService.newTimeRange(nextTimeRange.firstTime(), nextTimeRange.lastTime(), true, false); } // use this one rv.add(new RecurrenceInstance(eventTimeRange, currentCount)); } // if next starts after the range, stop generating else if (isAfter(nextTime, range.lastTime())) break; // advance interval years. if (differentTimeZone) { nextFirstEventCalendarDate = (GregorianCalendar) firstEventCalendarDate.clone(); nextFirstEventCalendarDate.add(getRecurrenceType(), getInterval()*currentCount); } else { nextCalendarDate = (GregorianCalendar) startCalendarDate.clone(); nextCalendarDate.add(getRecurrenceType(), getInterval()*currentCount); } currentCount++; } while (true); return rv; }
List function(TimeRange prototype, TimeRange range, TimeZone timeZone) { GregorianCalendar firstEventCalendarDate = null; GregorianCalendar nextFirstEventCalendarDate = null; TimeBreakdown startBreakdown = prototype.firstTime().breakdownLocal(); GregorianCalendar startCalendarDate = TimeService.getCalendar(TimeService.getLocalTimeZone(),0,0,0,0,0,0,0); startCalendarDate.set( startBreakdown.getYear(), startBreakdown.getMonth() - 1, startBreakdown.getDay(), startBreakdown.getHour(), startBreakdown.getMin(), startBreakdown.getSec()); boolean differentTimeZone = false; if (TimeService.getLocalTimeZone().getID().equals(timeZone.getID())) { differentTimeZone = false; } else { differentTimeZone = true; } if (differentTimeZone) { firstEventCalendarDate = TimeService.getCalendar(timeZone,0,0,0,0,0,0,0); firstEventCalendarDate.setTimeInMillis(startCalendarDate.getTimeInMillis()); nextFirstEventCalendarDate = (GregorianCalendar) firstEventCalendarDate.clone(); } List rv = new Vector(); GregorianCalendar nextCalendarDate = (GregorianCalendar) startCalendarDate.clone(); int currentCount = 1; do { if (differentTimeZone) { nextCalendarDate.setTimeInMillis(nextFirstEventCalendarDate.getTimeInMillis()); } Time nextTime = TimeService.newTime(nextCalendarDate); if ((getCount() > 0) && (currentCount > getCount())) break; if ((getUntil() != null) && isAfter(nextTime, getUntil()) ) break; TimeRange nextTimeRange = TimeService.newTimeRange(nextTime.getTime(), prototype.duration()); { TimeRange eventTimeRange = null; if ( prototype.isSingleTime() ) { eventTimeRange = TimeService.newTimeRange(nextTimeRange.firstTime()); } else { eventTimeRange = TimeService.newTimeRange(nextTimeRange.firstTime(), nextTimeRange.lastTime(), true, false); } rv.add(new RecurrenceInstance(eventTimeRange, currentCount)); } else if (isAfter(nextTime, range.lastTime())) break; if (differentTimeZone) { nextFirstEventCalendarDate = (GregorianCalendar) firstEventCalendarDate.clone(); nextFirstEventCalendarDate.add(getRecurrenceType(), getInterval()*currentCount); } else { nextCalendarDate = (GregorianCalendar) startCalendarDate.clone(); nextCalendarDate.add(getRecurrenceType(), getInterval()*currentCount); } currentCount++; } while (true); return rv; }
/** * Return a List of all RecurrenceInstance objects generated by this rule within the given time range, based on the * prototype first range, in time order. * @param prototype The prototype first TimeRange. * @param range A time range to limit the generated ranges. * @param timeZone The time zone to use for displaying times. * %%% Note: this is currently not implemented, and always uses the "local" zone. * @return a List of RecurrenceInstance generated by this rule in this range. */
Return a List of all RecurrenceInstance objects generated by this rule within the given time range, based on the prototype first range, in time order
generateInstances
{ "repo_name": "OpenCollabZA/sakai", "path": "calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/RecurrenceRuleBase.java", "license": "apache-2.0", "size": 10617 }
[ "java.util.GregorianCalendar", "java.util.List", "java.util.TimeZone", "java.util.Vector", "org.sakaiproject.time.api.Time", "org.sakaiproject.time.api.TimeBreakdown", "org.sakaiproject.time.api.TimeRange", "org.sakaiproject.time.cover.TimeService" ]
import java.util.GregorianCalendar; import java.util.List; import java.util.TimeZone; import java.util.Vector; import org.sakaiproject.time.api.Time; import org.sakaiproject.time.api.TimeBreakdown; import org.sakaiproject.time.api.TimeRange; import org.sakaiproject.time.cover.TimeService;
import java.util.*; import org.sakaiproject.time.api.*; import org.sakaiproject.time.cover.*;
[ "java.util", "org.sakaiproject.time" ]
java.util; org.sakaiproject.time;
788,588
@ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<AppResourceInner>, AppResourceInner> beginUpdate( String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { return beginUpdateAsync(resourceGroupName, serviceName, appName, appResource).getSyncPoller(); }
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<AppResourceInner>, AppResourceInner> function( String resourceGroupName, String serviceName, String appName, AppResourceInner appResource) { return beginUpdateAsync(resourceGroupName, serviceName, appName, appResource).getSyncPoller(); }
/** * Operation to update an exiting App. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value * from the Azure Resource Manager API or the portal. * @param serviceName The name of the Service resource. * @param appName The name of the App resource. * @param appResource Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return app resource payload. */
Operation to update an exiting App
beginUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/implementation/AppsClientImpl.java", "license": "mit", "size": 93809 }
[ "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.appplatform.fluent.models.AppResourceInner" ]
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.appplatform.fluent.models.AppResourceInner;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.appplatform.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,149,969
private SysSystemDto createLdapSystem(String systemName) { SysSystemDto system = new SysSystemDto(); system.setName(systemName == null ? "ldap-test-system" + "_" + System.currentTimeMillis() : systemName); system.setConnectorKey(new SysConnectorKeyDto(getLdapConnectorKey())); system.setReadonly(true); system.setQueue(true); system = systemService.save(system); // Configured connector form values IdmFormDefinitionDto formDefinition = systemService.getConnectorFormDefinition(system); List<IdmFormAttributeDto> attributes = formService.getAttributes(formDefinition); ImmutableMap<String, String> connectorConfig = new ImmutableMap.Builder<String, String>() .put("host", ldapConnectionInfo.getConnectedIPAddress()) .put("port", String.valueOf(ldapConnectionInfo.getConnectedPort())) .put("principal", ldapAdminLogin) .put("credentials", ldapPassword) .put("baseContexts", ldapBaseOU) .put("baseContextsToSynchronize", ldapBaseOU) .put("passwordAttribute", "userPassword") .put("uidAttribute", "uid") .put("dnAttribute", "") .build(); List<IdmFormValueDto> values = new ArrayList<>(); for (IdmFormAttributeDto attribute : attributes) { String code = attribute.getCode(); if(!connectorConfig.containsKey(code)) { continue; } if ("useVlvControls".equals(code)) { IdmFormValueDto formVal = new IdmFormValueDto(attribute); formVal.setBooleanValue(true); values.add(formVal); } else if ("ssl".equals(code)) { IdmFormValueDto formVal = new IdmFormValueDto(attribute); formVal.setBooleanValue(false); values.add(formVal); } else { IdmFormValueDto formVal = new IdmFormValueDto(attribute); formVal.setValue(connectorConfig.get(code)); values.add(formVal); } } formService.saveValues(system, formDefinition, values); return system; }
SysSystemDto function(String systemName) { SysSystemDto system = new SysSystemDto(); system.setName(systemName == null ? STR + "_" + System.currentTimeMillis() : systemName); system.setConnectorKey(new SysConnectorKeyDto(getLdapConnectorKey())); system.setReadonly(true); system.setQueue(true); system = systemService.save(system); IdmFormDefinitionDto formDefinition = systemService.getConnectorFormDefinition(system); List<IdmFormAttributeDto> attributes = formService.getAttributes(formDefinition); ImmutableMap<String, String> connectorConfig = new ImmutableMap.Builder<String, String>() .put("host", ldapConnectionInfo.getConnectedIPAddress()) .put("port", String.valueOf(ldapConnectionInfo.getConnectedPort())) .put(STR, ldapAdminLogin) .put(STR, ldapPassword) .put(STR, ldapBaseOU) .put(STR, ldapBaseOU) .put(STR, STR) .put(STR, "uid") .put(STR, STRuseVlvControlsSTRssl".equals(code)) { IdmFormValueDto formVal = new IdmFormValueDto(attribute); formVal.setBooleanValue(false); values.add(formVal); } else { IdmFormValueDto formVal = new IdmFormValueDto(attribute); formVal.setValue(connectorConfig.get(code)); values.add(formVal); } } formService.saveValues(system, formDefinition, values); return system; }
/** * Create Ldap system * @param systemName * @return */
Create Ldap system
createLdapSystem
{ "repo_name": "bcvsolutions/CzechIdMng", "path": "Realization/backend/acc/src/test/java/eu/bcvsolutions/idm/acc/integration/ComplexHrProcessIntegrationTest.java", "license": "mit", "size": 78405 }
[ "com.google.common.collect.ImmutableMap", "eu.bcvsolutions.idm.acc.dto.SysConnectorKeyDto", "eu.bcvsolutions.idm.acc.dto.SysSystemDto", "eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto", "eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto", "eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto", "java.util.List" ]
import com.google.common.collect.ImmutableMap; import eu.bcvsolutions.idm.acc.dto.SysConnectorKeyDto; import eu.bcvsolutions.idm.acc.dto.SysSystemDto; import eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto; import eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto; import eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto; import java.util.List;
import com.google.common.collect.*; import eu.bcvsolutions.idm.acc.dto.*; import eu.bcvsolutions.idm.core.eav.api.dto.*; import java.util.*;
[ "com.google.common", "eu.bcvsolutions.idm", "java.util" ]
com.google.common; eu.bcvsolutions.idm; java.util;
259,060
public void clickLongOnText(String text, int match, int time) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "clickLongOnText(\""+text+"\", "+match+", "+time+")"); } clicker.clickOnText(text, true, match, true, time); }
void function(String text, int match, int time) { if(config.commandLogging){ Log.d(config.commandLoggingTag, STRSTR\STR+match+STR+time+")"); } clicker.clickOnText(text, true, match, true, time); }
/** * Long clicks a View or WebElement displaying the specified text. * * @param text the text to click. The parameter will be interpreted as a regular expression * @param match if multiple objects match the text, this determines which one to click * @param time the amount of time to long click */
Long clicks a View or WebElement displaying the specified text
clickLongOnText
{ "repo_name": "darker50/robotium", "path": "robotium-solo/src/main/java/com/robotium/solo/Solo.java", "license": "apache-2.0", "size": 124742 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,972,469
@SuppressWarnings({"unchecked"}) public DenseMatrix64F copy() { return new DenseMatrix64F(this); } /** * Prints the value of this matrix to the screen. For more options see * {@link UtilEjml}
@SuppressWarnings({STR}) DenseMatrix64F function() { return new DenseMatrix64F(this); } /** * Prints the value of this matrix to the screen. For more options see * {@link UtilEjml}
/** * Creates and returns a matrix which is idential to this one. * * @return A new identical matrix. */
Creates and returns a matrix which is idential to this one
copy
{ "repo_name": "benralexander/efficient-java-matrix-library", "path": "src/org/ejml/data/DenseMatrix64F.java", "license": "apache-2.0", "size": 13826 }
[ "org.ejml.UtilEjml" ]
import org.ejml.UtilEjml;
import org.ejml.*;
[ "org.ejml" ]
org.ejml;
30,025
public DataNode setZone_heightScalar(double zone_height);
DataNode function(double zone_height);
/** * <p> * <b>Type:</b> NX_FLOAT * <b>Units:</b> NX_LENGTH * </p> * * @param zone_height the zone_height */
Type: NX_FLOAT Units: NX_LENGTH
setZone_heightScalar
{ "repo_name": "colinpalmer/dawnsci", "path": "org.eclipse.dawnsci.nexus/autogen/org/eclipse/dawnsci/nexus/NXfresnel_zone_plate.java", "license": "epl-1.0", "size": 14652 }
[ "org.eclipse.dawnsci.analysis.api.tree.DataNode" ]
import org.eclipse.dawnsci.analysis.api.tree.DataNode;
import org.eclipse.dawnsci.analysis.api.tree.*;
[ "org.eclipse.dawnsci" ]
org.eclipse.dawnsci;
1,533,626
private static boolean isSupportedLocale(Locale p_Locale) { Locale l_Locale; int l_LocaleID; boolean l_LocaleIsSupported = false; for (l_LocaleID = 0; l_LocaleID < m_SupportedLocales.size(); l_LocaleID++) { l_Locale = m_SupportedLocales.get(l_LocaleID); if (p_Locale.equals(l_Locale)) l_LocaleIsSupported = true; } return l_LocaleIsSupported; } // --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
static boolean function(Locale p_Locale) { Locale l_Locale; int l_LocaleID; boolean l_LocaleIsSupported = false; for (l_LocaleID = 0; l_LocaleID < m_SupportedLocales.size(); l_LocaleID++) { l_Locale = m_SupportedLocales.get(l_LocaleID); if (p_Locale.equals(l_Locale)) l_LocaleIsSupported = true; } return l_LocaleIsSupported; }
/** * checks whether the specified Locale is one of the supported Locales * * @return <CODE>true</CODE> if specified Locale is part of the supported * Locales, <CODE>false</CODE> otherwise */
checks whether the specified Locale is one of the supported Locales
isSupportedLocale
{ "repo_name": "lazyzero/kkMulticopterFlashTool", "path": "src/lu/tudor/santec/i18n/Translatrix.java", "license": "gpl-3.0", "size": 19545 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
234,254
public CustomDomain customDomain() { return this.customDomain; }
CustomDomain function() { return this.customDomain; }
/** * Get gets the custom domain the user assigned to this storage account. * * @return the customDomain value */
Get gets the custom domain the user assigned to this storage account
customDomain
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageAccountInner.java", "license": "mit", "size": 16912 }
[ "com.microsoft.azure.management.storage.v2019_06_01.CustomDomain" ]
import com.microsoft.azure.management.storage.v2019_06_01.CustomDomain;
import com.microsoft.azure.management.storage.v2019_06_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,117,092
public boolean hasBucketResponsibilities() { // if (!ownedBuckets.isEmpty()) { return true; } // if (!outboundBuckets.isEmpty()) { return true; } // if (!inboundBuckets.isEmpty()) { return true; } // if (outboundReplicas != null) { for (final IntObjectHashMap<BucketTransfer> outboundReplica : outboundReplicas) { if (outboundReplica != null && !outboundReplica.isEmpty()) { return true; } } } // if (!inboundReplicas.isEmpty()) { return true; } return false; }
boolean function() { return true; } return true; } return true; } for (final IntObjectHashMap<BucketTransfer> outboundReplica : outboundReplicas) { if (outboundReplica != null && !outboundReplica.isEmpty()) { return true; } } } return true; } return false; }
/** * Returns <code>true</code> if owns a bucket, receives buckets or sends buckets out. Returns <code>false</code> if * does not have any bucket obligations. * * @return <code>true</code> if owns a bucket, receives buckets or sends buckets out. Returns <code>false</code> if * does not have any bucket obligations. */
Returns <code>true</code> if owns a bucket, receives buckets or sends buckets out. Returns <code>false</code> if does not have any bucket obligations
hasBucketResponsibilities
{ "repo_name": "cacheonix/cacheonix-core", "path": "src/org/cacheonix/impl/cache/distributed/partitioned/BucketOwner.java", "license": "lgpl-2.1", "size": 22195 }
[ "org.cacheonix.impl.util.array.IntObjectHashMap" ]
import org.cacheonix.impl.util.array.IntObjectHashMap;
import org.cacheonix.impl.util.array.*;
[ "org.cacheonix.impl" ]
org.cacheonix.impl;
439,546
synchronized void addTrackerTaskFailure(String trackerName, TaskTracker taskTracker, String lastFailureReason) { if (flakyTaskTrackers < (clusterSize * CLUSTER_BLACKLIST_PERCENT)) { String trackerHostName = convertTrackerNameToHostName(trackerName); List<String> trackerFailures = trackerToFailuresMap.get(trackerHostName); if (trackerFailures == null) { trackerFailures = new LinkedList<String>(); trackerToFailuresMap.put(trackerHostName, trackerFailures); } trackerFailures.add(lastFailureReason); // Check if this tasktracker has turned 'flaky' if (trackerFailures.size() == maxTaskFailuresPerTracker) { ++flakyTaskTrackers; // Cancel reservations if appropriate if (taskTracker != null) { if (trackersReservedForMaps.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.MAP, this); } if (trackersReservedForReduces.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.REDUCE, this); } } LOG.info("TaskTracker at '" + trackerHostName + "' turned 'flaky'"); } } }
synchronized void addTrackerTaskFailure(String trackerName, TaskTracker taskTracker, String lastFailureReason) { if (flakyTaskTrackers < (clusterSize * CLUSTER_BLACKLIST_PERCENT)) { String trackerHostName = convertTrackerNameToHostName(trackerName); List<String> trackerFailures = trackerToFailuresMap.get(trackerHostName); if (trackerFailures == null) { trackerFailures = new LinkedList<String>(); trackerToFailuresMap.put(trackerHostName, trackerFailures); } trackerFailures.add(lastFailureReason); if (trackerFailures.size() == maxTaskFailuresPerTracker) { ++flakyTaskTrackers; if (taskTracker != null) { if (trackersReservedForMaps.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.MAP, this); } if (trackersReservedForReduces.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.REDUCE, this); } } LOG.info(STR + trackerHostName + STR); } } }
/** * Note that a task has failed on a given tracker and add the tracker * to the blacklist iff too many trackers in the cluster i.e. * (clusterSize * CLUSTER_BLACKLIST_PERCENT) haven't turned 'flaky' already. * * @param taskTracker task-tracker on which a task failed */
Note that a task has failed on a given tracker and add the tracker to the blacklist iff too many trackers in the cluster i.e. (clusterSize * CLUSTER_BLACKLIST_PERCENT) haven't turned 'flaky' already
addTrackerTaskFailure
{ "repo_name": "rhli/hadoop-EAR", "path": "src/mapred/org/apache/hadoop/mapred/JobInProgress.java", "license": "apache-2.0", "size": 140508 }
[ "java.util.LinkedList", "java.util.List", "org.apache.hadoop.mapreduce.TaskType", "org.apache.hadoop.mapreduce.server.jobtracker.TaskTracker" ]
import java.util.LinkedList; import java.util.List; import org.apache.hadoop.mapreduce.TaskType; import org.apache.hadoop.mapreduce.server.jobtracker.TaskTracker;
import java.util.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.server.jobtracker.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
305,156
public static int[] getLoopColsRowsForSubregion( GridCoverage2D gridCoverage, Envelope2D subregion ) throws Exception { GridGeometry2D gridGeometry = gridCoverage.getGridGeometry(); GridEnvelope2D subRegionGrid = gridGeometry.worldToGrid(subregion); int minCol = subRegionGrid.x; int maxCol = subRegionGrid.x + subRegionGrid.width; int minRow = subRegionGrid.y; int maxRow = subRegionGrid.y + subRegionGrid.height; return new int[]{minCol, maxCol, minRow, maxRow}; }
static int[] function( GridCoverage2D gridCoverage, Envelope2D subregion ) throws Exception { GridGeometry2D gridGeometry = gridCoverage.getGridGeometry(); GridEnvelope2D subRegionGrid = gridGeometry.worldToGrid(subregion); int minCol = subRegionGrid.x; int maxCol = subRegionGrid.x + subRegionGrid.width; int minRow = subRegionGrid.y; int maxRow = subRegionGrid.y + subRegionGrid.height; return new int[]{minCol, maxCol, minRow, maxRow}; }
/** * Get the cols and rows ranges to use to loop the original gridcoverage. * * @param gridCoverage the coverage. * @param subregion the sub region of the coverage to get the cols and rows to loop on. * @return the array of looping values in the form [minCol, maxCol, minRow, maxRow]. * @throws Exception */
Get the cols and rows ranges to use to loop the original gridcoverage
getLoopColsRowsForSubregion
{ "repo_name": "moovida/jgrasstools", "path": "gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java", "license": "gpl-3.0", "size": 82747 }
[ "org.geotools.coverage.grid.GridCoverage2D", "org.geotools.coverage.grid.GridEnvelope2D", "org.geotools.coverage.grid.GridGeometry2D", "org.geotools.geometry.Envelope2D" ]
import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.geometry.Envelope2D;
import org.geotools.coverage.grid.*; import org.geotools.geometry.*;
[ "org.geotools.coverage", "org.geotools.geometry" ]
org.geotools.coverage; org.geotools.geometry;
1,924,359
public List<ExpanderException> getErrors();
List<ExpanderException> function();
/** * Returns the list of errors from the last expansion made * @return A list of <code>ExpanderException</code> */
Returns the list of errors from the last expansion made
getErrors
{ "repo_name": "amckee23/drools", "path": "drools-compiler/src/main/java/org/drools/compiler/lang/Expander.java", "license": "apache-2.0", "size": 2747 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,614,145
int insert(BAIHistoryDay record);
int insert(BAIHistoryDay record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table nfjd502.dbo.BAIHistoryDay * * @mbggenerated Thu Mar 02 11:23:21 CST 2017 */
This method was generated by MyBatis Generator. This method corresponds to the database table nfjd502.dbo.BAIHistoryDay
insert
{ "repo_name": "xtwxy/cassandra-tests", "path": "mstar-server-dao/src/main/java/com/wincom/mstar/dao/mapper/BAIHistoryDayMapper.java", "license": "apache-2.0", "size": 2815 }
[ "com.wincom.mstar.domain.BAIHistoryDay" ]
import com.wincom.mstar.domain.BAIHistoryDay;
import com.wincom.mstar.domain.*;
[ "com.wincom.mstar" ]
com.wincom.mstar;
2,664,589
DataBuffer createInt(long offset, float[] data);
DataBuffer createInt(long offset, float[] data);
/** * Creates an int data buffer * * @param data the data to create the buffer from * @return the new buffer */
Creates an int data buffer
createInt
{ "repo_name": "smarthi/nd4j", "path": "nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/factory/DataBufferFactory.java", "license": "apache-2.0", "size": 19689 }
[ "org.nd4j.linalg.api.buffer.DataBuffer" ]
import org.nd4j.linalg.api.buffer.DataBuffer;
import org.nd4j.linalg.api.buffer.*;
[ "org.nd4j.linalg" ]
org.nd4j.linalg;
1,103,286
JAXBContext getJAXBContext(); // Bridge getBridge(TypeReference type); // boolean isKnownFault(QName name, Method method); // boolean isCheckedException(Method m, Class ex);
JAXBContext getJAXBContext();
/** * JAXBContext that will be used to marshall/unmarshall the java classes found in the SEI. * * @return the <code>{@link JAXBRIContext}</code> * @deprecated Why do you need this? */
JAXBContext that will be used to marshall/unmarshall the java classes found in the SEI
getJAXBContext
{ "repo_name": "FauxFaux/jdk9-jaxws", "path": "src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/SEIModel.java", "license": "gpl-2.0", "size": 6282 }
[ "javax.xml.bind.JAXBContext" ]
import javax.xml.bind.JAXBContext;
import javax.xml.bind.*;
[ "javax.xml" ]
javax.xml;
2,094,442
@Test (timeout=180000) public void testSidelineOverlapRegion() throws Exception { TableName table = TableName.valueOf("testSidelineOverlapRegion"); try { setupTable(table); assertEquals(ROWKEYS.length, countRows()); // Mess it up by creating an overlap MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); HMaster master = cluster.getMaster(); HRegionInfo hriOverlap1 = createRegion(tbl.getTableDescriptor(), Bytes.toBytes("A"), Bytes.toBytes("AB")); master.assignRegion(hriOverlap1); master.getAssignmentManager().waitForAssignment(hriOverlap1); HRegionInfo hriOverlap2 = createRegion(tbl.getTableDescriptor(), Bytes.toBytes("AB"), Bytes.toBytes("B")); master.assignRegion(hriOverlap2); master.getAssignmentManager().waitForAssignment(hriOverlap2); HBaseFsck hbck = doFsck(conf, false); assertErrors(hbck, new ERROR_CODE[] {ERROR_CODE.DUPE_STARTKEYS, ERROR_CODE.DUPE_STARTKEYS, ERROR_CODE.OVERLAP_IN_REGION_CHAIN}); assertEquals(3, hbck.getOverlapGroups(table).size()); assertEquals(ROWKEYS.length, countRows()); // mess around the overlapped regions, to trigger NotServingRegionException Multimap<byte[], HbckInfo> overlapGroups = hbck.getOverlapGroups(table); ServerName serverName = null; byte[] regionName = null; for (HbckInfo hbi: overlapGroups.values()) { if ("A".equals(Bytes.toString(hbi.getStartKey())) && "B".equals(Bytes.toString(hbi.getEndKey()))) { regionName = hbi.getRegionName(); // get an RS not serving the region to force bad assignment info in to META. int k = cluster.getServerWith(regionName); for (int i = 0; i < 3; i++) { if (i != k) { HRegionServer rs = cluster.getRegionServer(i); serverName = rs.getServerName(); break; } } HBaseFsckRepair.closeRegionSilentlyAndWait((HConnection) connection, cluster.getRegionServer(k).getServerName(), hbi.getHdfsHRI()); admin.offline(regionName); break; } } assertNotNull(regionName); assertNotNull(serverName); try (Table meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService)) { Put put = new Put(regionName); put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER, Bytes.toBytes(serverName.getHostAndPort())); meta.put(put); } // fix the problem. HBaseFsck fsck = new HBaseFsck(conf, hbfsckExecutorService); fsck.connect(); HBaseFsck.setDisplayFullReport(); // i.e. -details fsck.setTimeLag(0); fsck.setFixAssignments(true); fsck.setFixMeta(true); fsck.setFixHdfsHoles(true); fsck.setFixHdfsOverlaps(true); fsck.setFixHdfsOrphans(true); fsck.setFixVersionFile(true); fsck.setSidelineBigOverlaps(true); fsck.setMaxMerge(2); fsck.onlineHbck(); fsck.close(); // verify that overlaps are fixed, and there are less rows // since one region is sidelined. HBaseFsck hbck2 = doFsck(conf,false); assertNoErrors(hbck2); assertEquals(0, hbck2.getOverlapGroups(table).size()); assertTrue(ROWKEYS.length > countRows()); } finally { cleanupTable(table); } }
@Test (timeout=180000) void function() throws Exception { TableName table = TableName.valueOf(STR); try { setupTable(table); assertEquals(ROWKEYS.length, countRows()); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); HMaster master = cluster.getMaster(); HRegionInfo hriOverlap1 = createRegion(tbl.getTableDescriptor(), Bytes.toBytes("A"), Bytes.toBytes("AB")); master.assignRegion(hriOverlap1); master.getAssignmentManager().waitForAssignment(hriOverlap1); HRegionInfo hriOverlap2 = createRegion(tbl.getTableDescriptor(), Bytes.toBytes("AB"), Bytes.toBytes("B")); master.assignRegion(hriOverlap2); master.getAssignmentManager().waitForAssignment(hriOverlap2); HBaseFsck hbck = doFsck(conf, false); assertErrors(hbck, new ERROR_CODE[] {ERROR_CODE.DUPE_STARTKEYS, ERROR_CODE.DUPE_STARTKEYS, ERROR_CODE.OVERLAP_IN_REGION_CHAIN}); assertEquals(3, hbck.getOverlapGroups(table).size()); assertEquals(ROWKEYS.length, countRows()); Multimap<byte[], HbckInfo> overlapGroups = hbck.getOverlapGroups(table); ServerName serverName = null; byte[] regionName = null; for (HbckInfo hbi: overlapGroups.values()) { if ("A".equals(Bytes.toString(hbi.getStartKey())) && "B".equals(Bytes.toString(hbi.getEndKey()))) { regionName = hbi.getRegionName(); int k = cluster.getServerWith(regionName); for (int i = 0; i < 3; i++) { if (i != k) { HRegionServer rs = cluster.getRegionServer(i); serverName = rs.getServerName(); break; } } HBaseFsckRepair.closeRegionSilentlyAndWait((HConnection) connection, cluster.getRegionServer(k).getServerName(), hbi.getHdfsHRI()); admin.offline(regionName); break; } } assertNotNull(regionName); assertNotNull(serverName); try (Table meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService)) { Put put = new Put(regionName); put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER, Bytes.toBytes(serverName.getHostAndPort())); meta.put(put); } HBaseFsck fsck = new HBaseFsck(conf, hbfsckExecutorService); fsck.connect(); HBaseFsck.setDisplayFullReport(); fsck.setTimeLag(0); fsck.setFixAssignments(true); fsck.setFixMeta(true); fsck.setFixHdfsHoles(true); fsck.setFixHdfsOverlaps(true); fsck.setFixHdfsOrphans(true); fsck.setFixVersionFile(true); fsck.setSidelineBigOverlaps(true); fsck.setMaxMerge(2); fsck.onlineHbck(); fsck.close(); HBaseFsck hbck2 = doFsck(conf,false); assertNoErrors(hbck2); assertEquals(0, hbck2.getOverlapGroups(table).size()); assertTrue(ROWKEYS.length > countRows()); } finally { cleanupTable(table); } }
/** * This creates and fixes a bad table where an overlap group of * 3 regions. Set HBaseFsck.maxMerge to 2 to trigger sideline overlapped * region. Mess around the meta data so that closeRegion/offlineRegion * throws exceptions. */
This creates and fixes a bad table where an overlap group of 3 regions. Set HBaseFsck.maxMerge to 2 to trigger sideline overlapped region. Mess around the meta data so that closeRegion/offlineRegion throws exceptions
testSidelineOverlapRegion
{ "repo_name": "lshmouse/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java", "license": "apache-2.0", "size": 104525 }
[ "com.google.common.collect.Multimap", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.HRegionInfo", "org.apache.hadoop.hbase.MiniHBaseCluster", "org.apache.hadoop.hbase.ServerName", "org.apache.hadoop.hbase.TableName", "org.apache.hadoop.hbase.client.HConnection", "org.apache.hadoop.hbase.client.Put", "org.apache.hadoop.hbase.client.Table", "org.apache.hadoop.hbase.master.HMaster", "org.apache.hadoop.hbase.regionserver.HRegionServer", "org.apache.hadoop.hbase.util.HBaseFsck", "org.apache.hadoop.hbase.util.hbck.HbckTestingUtil", "org.junit.Assert", "org.junit.Test" ]
import com.google.common.collect.Multimap; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HConnection; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.util.HBaseFsck; import org.apache.hadoop.hbase.util.hbck.HbckTestingUtil; import org.junit.Assert; import org.junit.Test;
import com.google.common.collect.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.master.*; import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.hbase.util.hbck.*; import org.junit.*;
[ "com.google.common", "org.apache.hadoop", "org.junit" ]
com.google.common; org.apache.hadoop; org.junit;
314,004
@Test public void textMessage() { InternalLogger.log(severityLevel, "Hello World!"); assertThat(systemStream.consumeErrorOutput()) .containsOnlyOnce(outputLevel) .containsOnlyOnce("Hello World!") .endsWith(System.lineSeparator()) .hasLineCount(1); }
void function() { InternalLogger.log(severityLevel, STR); assertThat(systemStream.consumeErrorOutput()) .containsOnlyOnce(outputLevel) .containsOnlyOnce(STR) .endsWith(System.lineSeparator()) .hasLineCount(1); }
/** * Verifies that plain text messages will be output correctly. */
Verifies that plain text messages will be output correctly
textMessage
{ "repo_name": "pmwmedia/tinylog", "path": "tinylog-api/src/test/java/org/tinylog/provider/InternalLoggerTest.java", "license": "apache-2.0", "size": 4336 }
[ "org.assertj.core.api.Assertions" ]
import org.assertj.core.api.Assertions;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
2,130,262
@Column(name = "external_handler_process_id", precision = 19) public Long getExternalHandlerProcessId();
@Column(name = STR, precision = 19) Long function();
/** * Getter for <code>cattle.external_handler_external_handler_process_map.external_handler_process_id</code>. */
Getter for <code>cattle.external_handler_external_handler_process_map.external_handler_process_id</code>
getExternalHandlerProcessId
{ "repo_name": "vincent99/cattle", "path": "code/iaas/model/src/main/java/io/cattle/platform/core/model/ExternalHandlerExternalHandlerProcessMap.java", "license": "apache-2.0", "size": 6476 }
[ "javax.persistence.Column" ]
import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
1,384,261
public IJPQLQueryBuilder getJPQLQueryBuilder() { return jpqlQueryBuilder; }
IJPQLQueryBuilder function() { return jpqlQueryBuilder; }
/** * Returns the builder that creates the {@link StateObject} representation of the JPQL query. * * @return The builder of the {@link StateObject} to be manipulated */
Returns the builder that creates the <code>StateObject</code> representation of the JPQL query
getJPQLQueryBuilder
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/tools/RefactoringTool.java", "license": "epl-1.0", "size": 30073 }
[ "org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder" ]
import org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder;
import org.eclipse.persistence.jpa.jpql.tools.model.*;
[ "org.eclipse.persistence" ]
org.eclipse.persistence;
1,048,290
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "mschoettle/ecse429-fall15-project", "path": "ca.mcgill.sel.ram.edit/src/ca/mcgill/sel/ram/provider/RDoubleItemProvider.java", "license": "gpl-2.0", "size": 2803 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
271,401
public PolynomialFunctionNewtonForm interpolate(double x[], double y[]) throws DuplicateSampleAbscissaException { PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y); final double[] c = new double[x.length-1]; System.arraycopy(x, 0, c, 0, c.length); final double[] a = computeDividedDifference(x, y); return new PolynomialFunctionNewtonForm(a, c); }
PolynomialFunctionNewtonForm function(double x[], double y[]) throws DuplicateSampleAbscissaException { PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y); final double[] c = new double[x.length-1]; System.arraycopy(x, 0, c, 0, c.length); final double[] a = computeDividedDifference(x, y); return new PolynomialFunctionNewtonForm(a, c); }
/** * Computes an interpolating function for the data set. * * @param x the interpolating points array * @param y the interpolating values array * @return a function which interpolates the data set * @throws DuplicateSampleAbscissaException if arguments are invalid */
Computes an interpolating function for the data set
interpolate
{ "repo_name": "haisamido/SFDaaS", "path": "src/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java", "license": "lgpl-3.0", "size": 4672 }
[ "org.apache.commons.math.DuplicateSampleAbscissaException", "org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm", "org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm" ]
import org.apache.commons.math.DuplicateSampleAbscissaException; import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm; import org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm;
import org.apache.commons.math.*; import org.apache.commons.math.analysis.polynomials.*;
[ "org.apache.commons" ]
org.apache.commons;
2,033,931
public Map<String, Properties> getDatabaseProperties() { if (m_databaseProperties == null) { readDatabaseConfig(); } return m_databaseProperties; }
Map<String, Properties> function() { if (m_databaseProperties == null) { readDatabaseConfig(); } return m_databaseProperties; }
/** * Returns a map with the database properties of *all* available database configurations keyed * by their database keys (e.g. "mysql", "generic" or "oracle").<p> * * @return a map with the database properties of *all* available database configurations */
Returns a map with the database properties of *all* available database configurations keyed by their database keys (e.g. "mysql", "generic" or "oracle")
getDatabaseProperties
{ "repo_name": "sbonoc/opencms-core", "path": "src-setup/org/opencms/setup/CmsSetupBean.java", "license": "lgpl-2.1", "size": 115614 }
[ "java.util.Map", "java.util.Properties" ]
import java.util.Map; import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
654,463
@ApiModelProperty(example = "A calculator Application that supports basic operations", value = "Application desciprtion ") public String getDescription() { return description; }
@ApiModelProperty(example = STR, value = STR) String function() { return description; }
/** * Application desciprtion * @return description **/
Application desciprtion
getDescription
{ "repo_name": "ChamNDeSilva/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.analytics/src/gen/java/org/wso2/carbon/apimgt/rest/api/analytics/dto/SubscriptionInfoDTO.java", "license": "apache-2.0", "size": 6211 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,459,474
String user = request.getRemoteUser(); if(user == null) { throw new UnauthorizedException("Request did not contain valid authorization"); } ObjectNode result = objectMapper.createObjectNode(); result.put("login", user); return result; }
String user = request.getRemoteUser(); if(user == null) { throw new UnauthorizedException(STR); } ObjectNode result = objectMapper.createObjectNode(); result.put("login", user); return result; }
/** * GET /rest/authenticate -> check if the user is authenticated, and return its full name. */
GET /rest/authenticate -> check if the user is authenticated, and return its full name
isAuthenticated
{ "repo_name": "roberthafner/flowable-engine", "path": "modules/flowable-ui-idm/flowable-ui-idm-rest/src/main/java/org/activiti/app/rest/idm/AccountResource.java", "license": "apache-2.0", "size": 2796 }
[ "com.fasterxml.jackson.databind.node.ObjectNode", "org.activiti.app.service.exception.UnauthorizedException" ]
import com.fasterxml.jackson.databind.node.ObjectNode; import org.activiti.app.service.exception.UnauthorizedException;
import com.fasterxml.jackson.databind.node.*; import org.activiti.app.service.exception.*;
[ "com.fasterxml.jackson", "org.activiti.app" ]
com.fasterxml.jackson; org.activiti.app;
1,267,287
public ApplicationInsightsClientImplBuilder configuration(Configuration configuration) { this.configuration = configuration; return this; } private HttpLogOptions httpLogOptions;
ApplicationInsightsClientImplBuilder function(Configuration configuration) { this.configuration = configuration; return this; } private HttpLogOptions httpLogOptions;
/** * Sets The configuration store that is used during construction of the service client. * * @param configuration the configuration value. * @return the ApplicationInsightsClientImplBuilder. */
Sets The configuration store that is used during construction of the service client
configuration
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/monitor/opentelemetry-exporters-azuremonitor/src/main/java/com/azure/opentelemetry/exporters/azuremonitor/implementation/ApplicationInsightsClientImplBuilder.java", "license": "mit", "size": 7357 }
[ "com.azure.core.http.policy.HttpLogOptions", "com.azure.core.util.Configuration" ]
import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.util.Configuration;
import com.azure.core.http.policy.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
39,331
CompletableFuture<Long> put(K key, long newValue);
CompletableFuture<Long> put(K key, long newValue);
/** * Associates ewValue with key in this map, and returns the value previously * associated with key, or zero if there was no such value. * * @param key key with which the specified value is to be associated * @param newValue the value to put * @return previous value or zero */
Associates ewValue with key in this map, and returns the value previously associated with key, or zero if there was no such value
put
{ "repo_name": "sdnwiselab/onos", "path": "core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounterMap.java", "license": "apache-2.0", "size": 6455 }
[ "java.util.concurrent.CompletableFuture" ]
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
784,798
public static <L, R> LeftBoundProcedure<R> bind(BinaryProcedure<? super L, ? super R> procedure, L arg) { return null == procedure ? null : new LeftBoundProcedure<R>(procedure, arg); }
static <L, R> LeftBoundProcedure<R> function(BinaryProcedure<? super L, ? super R> procedure, L arg) { return null == procedure ? null : new LeftBoundProcedure<R>(procedure, arg); }
/** * Get a Procedure from <code>procedure</code>. * @param <L> left type * @param <R> right type * @param procedure to adapt * @param arg left side argument * @return LeftBoundProcedure<R> */
Get a Procedure from <code>procedure</code>
bind
{ "repo_name": "apache/commons-functor", "path": "core/src/main/java/org/apache/commons/functor/adapter/LeftBoundProcedure.java", "license": "apache-2.0", "size": 3476 }
[ "org.apache.commons.functor.BinaryProcedure" ]
import org.apache.commons.functor.BinaryProcedure;
import org.apache.commons.functor.*;
[ "org.apache.commons" ]
org.apache.commons;
954,797
public Guid getGuid(String key) { return get(key).asGuid(); }
Guid function(String key) { return get(key).asGuid(); }
/** * Returns the value to which the specified key is mapped in decoded structure. Fails if decoded structure does not * contain a mapping for the specified key or if the value is actually not a GUID. * * @param key The key whose associated value is to be returned. * @return A GUID. */
Returns the value to which the specified key is mapped in decoded structure. Fails if decoded structure does not contain a mapping for the specified key or if the value is actually not a GUID
getGuid
{ "repo_name": "elasticlib/elasticlib", "path": "elasticlib-common/src/main/java/org/elasticlib/common/bson/BsonReader.java", "license": "apache-2.0", "size": 6725 }
[ "org.elasticlib.common.hash.Guid" ]
import org.elasticlib.common.hash.Guid;
import org.elasticlib.common.hash.*;
[ "org.elasticlib.common" ]
org.elasticlib.common;
1,415,120
@Test public void testConstructurId() { fixture = new Base(1L); assertNotNull(fixture); assertEquals(fixture.getId().longValue(), 1L); }
void function() { fixture = new Base(1L); assertNotNull(fixture); assertEquals(fixture.getId().longValue(), 1L); }
/** * Test constructur id. */
Test constructur id
testConstructurId
{ "repo_name": "psachdev6375/devcapsule", "path": "services/src/test/java/com/puneet/devcapsule/domain/BaseTest.java", "license": "gpl-3.0", "size": 2117 }
[ "com.puneet.devcapsule.domain.Base", "org.junit.Assert" ]
import com.puneet.devcapsule.domain.Base; import org.junit.Assert;
import com.puneet.devcapsule.domain.*; import org.junit.*;
[ "com.puneet.devcapsule", "org.junit" ]
com.puneet.devcapsule; org.junit;
1,458,236
private void removeAllNodes(String nodeSourceName, String collectionName, Function<NodeSource, Void> function) { NodeSource nodeSource = this.deployedNodeSources.get(nodeSourceName); if (nodeSource != null) { function.apply(nodeSource); } else { logger.warn("Trying to remove " + collectionName + " from a node source that is no longer known: " + nodeSourceName); } }
void function(String nodeSourceName, String collectionName, Function<NodeSource, Void> function) { NodeSource nodeSource = this.deployedNodeSources.get(nodeSourceName); if (nodeSource != null) { function.apply(nodeSource); } else { logger.warn(STR + collectionName + STR + nodeSourceName); } }
/** * Wraps the access to the node source to perform a defensive check preventing NPE. * * @param nodeSourceName the name of the node source to retrieve. * @param collectionName the name of the collection to iterate in the node source. * @param function a function that extracts the collection to iterate from the node source. */
Wraps the access to the node source to perform a defensive check preventing NPE
removeAllNodes
{ "repo_name": "paraita/scheduling", "path": "rm/rm-server/src/main/java/org/ow2/proactive/resourcemanager/core/RMCore.java", "license": "agpl-3.0", "size": 126360 }
[ "com.google.common.base.Function", "org.ow2.proactive.resourcemanager.nodesource.NodeSource" ]
import com.google.common.base.Function; import org.ow2.proactive.resourcemanager.nodesource.NodeSource;
import com.google.common.base.*; import org.ow2.proactive.resourcemanager.nodesource.*;
[ "com.google.common", "org.ow2.proactive" ]
com.google.common; org.ow2.proactive;
2,724,322
@Deployment public void testNonInterruptingSignalWithSubProcess() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("nonInterruptingSignalWithSubProcess"); List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); Task currentTask = tasks.get(0); assertEquals("Approve", currentTask.getName()); runtimeService.signalEventReceived("alert"); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(2, tasks.size()); for (Task task : tasks) { if (!task.getName().equals("Approve") && !task.getName().equals("Review")) { fail("Expected: <Approve> or <Review> but was <" + task.getName() + ">."); } } taskService.complete(taskService.createTaskQuery().taskName("Approve").singleResult().getId()); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); currentTask = tasks.get(0); assertEquals("Review", currentTask.getName()); taskService.complete(taskService.createTaskQuery().taskName("Review").singleResult().getId()); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); }
void function() { ProcessInstance pi = runtimeService.startProcessInstanceByKey(STR); List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); Task currentTask = tasks.get(0); assertEquals(STR, currentTask.getName()); runtimeService.signalEventReceived("alert"); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(2, tasks.size()); for (Task task : tasks) { if (!task.getName().equals(STR) && !task.getName().equals(STR)) { fail(STR + task.getName() + ">."); } } taskService.complete(taskService.createTaskQuery().taskName(STR).singleResult().getId()); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); currentTask = tasks.get(0); assertEquals(STR, currentTask.getName()); taskService.complete(taskService.createTaskQuery().taskName(STR).singleResult().getId()); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); }
/** * TestCase to reproduce Issue ACT-1344 */
TestCase to reproduce Issue ACT-1344
testNonInterruptingSignalWithSubProcess
{ "repo_name": "nagyistoce/camunda-bpm-platform", "path": "engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventTest.java", "license": "apache-2.0", "size": 20643 }
[ "java.util.List", "org.camunda.bpm.engine.runtime.ProcessInstance", "org.camunda.bpm.engine.task.Task" ]
import java.util.List; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task;
import java.util.*; import org.camunda.bpm.engine.runtime.*; import org.camunda.bpm.engine.task.*;
[ "java.util", "org.camunda.bpm" ]
java.util; org.camunda.bpm;
2,531,042
@ServiceMethod(returns = ReturnType.SINGLE) ServiceResourceInner createOrUpdate(String resourceGroupName, String serviceName, ServiceResourceInner resource);
@ServiceMethod(returns = ReturnType.SINGLE) ServiceResourceInner createOrUpdate(String resourceGroupName, String serviceName, ServiceResourceInner resource);
/** * Create a new Service or update an exiting Service. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value * from the Azure Resource Manager API or the portal. * @param serviceName The name of the Service resource. * @param resource Service resource. * @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 service resource. */
Create a new Service or update an exiting Service
createOrUpdate
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/fluent/ServicesClient.java", "license": "mit", "size": 43565 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.appplatform.fluent.models.ServiceResourceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.appplatform.fluent.models.ServiceResourceInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.appplatform.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,167,001
private boolean isCssLiteralNode(CssValueNode valueNode) { return (valueNode instanceof CssLiteralNode); }
boolean function(CssValueNode valueNode) { return (valueNode instanceof CssLiteralNode); }
/** * Return if the node is CssLiteralNode. */
Return if the node is CssLiteralNode
isCssLiteralNode
{ "repo_name": "smennetrier/closure-stylesheets", "path": "src/com/google/common/css/compiler/passes/BiDiFlipper.java", "license": "apache-2.0", "size": 24267 }
[ "com.google.common.css.compiler.ast.CssLiteralNode", "com.google.common.css.compiler.ast.CssValueNode" ]
import com.google.common.css.compiler.ast.CssLiteralNode; import com.google.common.css.compiler.ast.CssValueNode;
import com.google.common.css.compiler.ast.*;
[ "com.google.common" ]
com.google.common;
2,268,873
public String getMessageUndo(CardArrayAdapter cardArrayAdapter, String[] itemIds, int[] itemPositions);
String function(CardArrayAdapter cardArrayAdapter, String[] itemIds, int[] itemPositions);
/** * UndoMessage. * Implement this method to customize the undo message dynamically. * </p> * You can't find the cards with these positions in your arrayAdapter because the cards are removed. * You have to/can use your id itemIds, to identify your cards. * * @param cardArrayAdapter array Adapter * @param itemIds ids of items * @param itemPositions position of removed items * @return */
UndoMessage. Implement this method to customize the undo message dynamically. You can't find the cards with these positions in your arrayAdapter because the cards are removed. You have to/can use your id itemIds, to identify your cards
getMessageUndo
{ "repo_name": "christoandrew/Gula", "path": "library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/UndoBarController.java", "license": "mit", "size": 17299 }
[ "it.gmariotti.cardslib.library.internal.CardArrayAdapter" ]
import it.gmariotti.cardslib.library.internal.CardArrayAdapter;
import it.gmariotti.cardslib.library.internal.*;
[ "it.gmariotti.cardslib" ]
it.gmariotti.cardslib;
1,227,806