method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public Invoice calculateInvoice(Customer customer, List<Parking> parkings, YearMonth ym);
Invoice function(Customer customer, List<Parking> parkings, YearMonth ym);
/** * Calculates the invoice. * (Uses the current system time whenever the calculation logic requires current time.) * * @param customer The customer to generate the invoice for. * @param parkings A list of parkings. * It is assumed that they are all for the year and month provided in the `ym` parameter. * @param ym The year and month for which to generate the invoice. * @return The generated invoice. */
Calculates the invoice. (Uses the current system time whenever the calculation logic requires current time.)
calculateInvoice
{ "repo_name": "Pisi-Deff/TestTaskInvoiceSystem", "path": "src/main/java/ee/eerikmagi/testtasks/arvato/invoice_system/logic/IPaymentLogic.java", "license": "mit", "size": 1770 }
[ "ee.eerikmagi.testtasks.arvato.invoice_system.model.Customer", "ee.eerikmagi.testtasks.arvato.invoice_system.model.Invoice", "ee.eerikmagi.testtasks.arvato.invoice_system.model.Parking", "java.time.YearMonth", "java.util.List" ]
import ee.eerikmagi.testtasks.arvato.invoice_system.model.Customer; import ee.eerikmagi.testtasks.arvato.invoice_system.model.Invoice; import ee.eerikmagi.testtasks.arvato.invoice_system.model.Parking; import java.time.YearMonth; import java.util.List;
import ee.eerikmagi.testtasks.arvato.invoice_system.model.*; import java.time.*; import java.util.*;
[ "ee.eerikmagi.testtasks", "java.time", "java.util" ]
ee.eerikmagi.testtasks; java.time; java.util;
885,294
public GridCheckpointManager checkpoint();
GridCheckpointManager function();
/** * Gets checkpoint manager. * * @return Checkpoint manager. */
Gets checkpoint manager
checkpoint
{ "repo_name": "ptupitsyn/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java", "license": "apache-2.0", "size": 20940 }
[ "org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager" ]
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager;
import org.apache.ignite.internal.managers.checkpoint.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,045,643
public static ims.emergency.configuration.domain.objects.TrackingCubicleRoomBed extractTrackingCubicleRoomBed(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.TrackingCubicleRoomBedVo valueObject) { return extractTrackingCubicleRoomBed(domainFactory, valueObject, new HashMap()); }
static ims.emergency.configuration.domain.objects.TrackingCubicleRoomBed function(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.TrackingCubicleRoomBedVo valueObject) { return extractTrackingCubicleRoomBed(domainFactory, valueObject, new HashMap()); }
/** * Create the domain object from the value object. * @param domainFactory - used to create existing (persistent) domain objects. * @param valueObject - extract the domain object fields from this. */
Create the domain object from the value object
extractTrackingCubicleRoomBed
{ "repo_name": "openhealthcare/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/emergency/vo/domain/TrackingCubicleRoomBedVoAssembler.java", "license": "agpl-3.0", "size": 17381 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,802,254
public Component add(Component component, GridBagConstraints constraint) { layout.setConstraints(component, constraint); return super.add(component); } /** * Adds a component at a specific position, setting the grid bag layout to the given constraints. * @param component The component to add. * @param index Index where to add component. Must be greater or equal 0 and smaller than {@link #getComponentCount()}
Component function(Component component, GridBagConstraints constraint) { layout.setConstraints(component, constraint); return super.add(component); } /** * Adds a component at a specific position, setting the grid bag layout to the given constraints. * @param component The component to add. * @param index Index where to add component. Must be greater or equal 0 and smaller than {@link #getComponentCount()}
/** * Adds a component, setting the grid bag layout to the given constraints. * @param component The component to add. * @param constraint The constraints to set the layout to before adding. * @return the added component. */
Adds a component, setting the grid bag layout to the given constraints
add
{ "repo_name": "langmo/youscope", "path": "core/api/src/main/java/org/youscope/uielements/DynamicPanel.java", "license": "gpl-2.0", "size": 7089 }
[ "java.awt.Component", "java.awt.GridBagConstraints" ]
import java.awt.Component; import java.awt.GridBagConstraints;
import java.awt.*;
[ "java.awt" ]
java.awt;
514,114
@Test public void testChangeTypeIdOfBinaryFieldCaseNotFoundActualTypeId() throws Exception { BinaryMarshaller marsh = createMarshaller(); TimeValue timeVal = new TimeValue(11111L); BinaryObjectImpl timeValBinObj = toBinary(timeVal, marsh); BinaryFieldEx timeBinField = (BinaryFieldEx)timeValBinObj.type().field("time"); int beforeTypeId = timeValBinObj.typeId(); String fieldType = binaryContext(marsh).metadata(timeValBinObj.typeId()).fieldTypeName(timeBinField.name()); Field startField = U.findField(timeValBinObj.getClass(), "start"); int start = (int)startField.get(timeValBinObj); Field arrField = U.findField(timeValBinObj.getClass(), "arr"); byte[] arr = (byte[])arrField.get(timeValBinObj); arr[start + TYPE_ID_POS] += 1; String expMsg = exceptionMessageOfDifferentTypeIdBinaryField( beforeTypeId, timeVal.getClass().getName(), timeValBinObj.typeId(), null, U.field(timeBinField, "fieldId"), timeBinField.name(), fieldType ); assertThrows(log, () -> timeBinField.value(timeValBinObj), BinaryObjectException.class, expMsg); }
void function() throws Exception { BinaryMarshaller marsh = createMarshaller(); TimeValue timeVal = new TimeValue(11111L); BinaryObjectImpl timeValBinObj = toBinary(timeVal, marsh); BinaryFieldEx timeBinField = (BinaryFieldEx)timeValBinObj.type().field("time"); int beforeTypeId = timeValBinObj.typeId(); String fieldType = binaryContext(marsh).metadata(timeValBinObj.typeId()).fieldTypeName(timeBinField.name()); Field startField = U.findField(timeValBinObj.getClass(), "start"); int start = (int)startField.get(timeValBinObj); Field arrField = U.findField(timeValBinObj.getClass(), "arr"); byte[] arr = (byte[])arrField.get(timeValBinObj); arr[start + TYPE_ID_POS] += 1; String expMsg = exceptionMessageOfDifferentTypeIdBinaryField( beforeTypeId, timeVal.getClass().getName(), timeValBinObj.typeId(), null, U.field(timeBinField, STR), timeBinField.name(), fieldType ); assertThrows(log, () -> timeBinField.value(timeValBinObj), BinaryObjectException.class, expMsg); }
/** * Check that when changing typeId of BinaryObject, when trying to get the * field value BinaryObjectException will be thrown with the corresponding * text. * * @throws Exception If failed. */
Check that when changing typeId of BinaryObject, when trying to get the field value BinaryObjectException will be thrown with the corresponding text
testChangeTypeIdOfBinaryFieldCaseNotFoundActualTypeId
{ "repo_name": "samaitra/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryFieldExtractionSelfTest.java", "license": "apache-2.0", "size": 12178 }
[ "java.lang.reflect.Field", "org.apache.ignite.binary.BinaryObjectException", "org.apache.ignite.internal.util.typedef.internal.U", "org.apache.ignite.testframework.GridTestUtils" ]
import java.lang.reflect.Field; import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils;
import java.lang.reflect.*; import org.apache.ignite.binary.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.testframework.*;
[ "java.lang", "org.apache.ignite" ]
java.lang; org.apache.ignite;
2,510,346
@Override public StringValue readLine(Env env) throws IOException { StringValue sb = env.createStringBuilder(); int ch; while ((ch = read()) >= 0) { sb.append((char) ch); if (ch == '\n') return sb; // XXX: issues with mac } if (sb.length() > 0) return sb; else return null; } /** * Read a maximum of <i>length</i> bytes from the file and write * them to the outputStream. * * @param os the {@link OutputStream}
StringValue function(Env env) throws IOException { StringValue sb = env.createStringBuilder(); int ch; while ((ch = read()) >= 0) { sb.append((char) ch); if (ch == '\n') return sb; } if (sb.length() > 0) return sb; else return null; } /** * Read a maximum of <i>length</i> bytes from the file and write * them to the outputStream. * * @param os the {@link OutputStream}
/** * Reads a line from a file, returning null. */
Reads a line from a file, returning null
readLine
{ "repo_name": "dwango/quercus", "path": "src/main/java/com/caucho/quercus/lib/file/FileValue.java", "license": "gpl-2.0", "size": 2743 }
[ "com.caucho.quercus.env.Env", "com.caucho.quercus.env.StringValue", "java.io.IOException", "java.io.OutputStream" ]
import com.caucho.quercus.env.Env; import com.caucho.quercus.env.StringValue; import java.io.IOException; import java.io.OutputStream;
import com.caucho.quercus.env.*; import java.io.*;
[ "com.caucho.quercus", "java.io" ]
com.caucho.quercus; java.io;
1,515,811
private boolean checkMacro(Node node) { List<ASTDirective> directiveParents = node.getParentsOfType(ASTDirective.class); for (ASTDirective directiveParent : directiveParents) { if (MACRO_NAME.equals(directiveParent.getDirectiveName())) { return true; } } return false; }
boolean function(Node node) { List<ASTDirective> directiveParents = node.getParentsOfType(ASTDirective.class); for (ASTDirective directiveParent : directiveParents) { if (MACRO_NAME.equals(directiveParent.getDirectiveName())) { return true; } } return false; }
/** * Check if reference is inside macro. * * @param node node * @return true/false */
Check if reference is inside macro
checkMacro
{ "repo_name": "kerie/p3c", "path": "p3c-pmd/src/main/java/com/alibaba/p3c/pmd/lang/vm/rule/other/UseQuietReferenceNotationRule.java", "license": "apache-2.0", "size": 3849 }
[ "java.util.List", "net.sourceforge.pmd.lang.ast.Node", "net.sourceforge.pmd.lang.vm.ast.ASTDirective" ]
import java.util.List; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.vm.ast.ASTDirective;
import java.util.*; import net.sourceforge.pmd.lang.ast.*; import net.sourceforge.pmd.lang.vm.ast.*;
[ "java.util", "net.sourceforge.pmd" ]
java.util; net.sourceforge.pmd;
1,884,162
public ClusterFixtureBuilder configClientProperty(String key, Object value) { if (clientProps == null) { clientProps = new Properties(); } clientProps.put(key, value.toString()); return this; }
ClusterFixtureBuilder function(String key, Object value) { if (clientProps == null) { clientProps = new Properties(); } clientProps.put(key, value.toString()); return this; }
/** * Add an additional property for the client connection URL. Convert all the values into * String type. * @param key config property name * @param value property value * @return this builder */
Add an additional property for the client connection URL. Convert all the values into String type
configClientProperty
{ "repo_name": "johnnywale/drill", "path": "exec/java-exec/src/test/java/org/apache/drill/test/ClusterFixtureBuilder.java", "license": "apache-2.0", "size": 9642 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
1,501,916
private void enableKiller(Alarm alarm) { final String autoSnooze = PreferenceManager.getDefaultSharedPreferences(this) .getString(SettingsActivity.KEY_AUTO_SILENCE, DEFAULT_ALARM_TIMEOUT); int autoSnoozeMinutes = Integer.parseInt(autoSnooze); if (autoSnoozeMinutes != -1) { mHandler.sendMessageDelayed(mHandler.obtainMessage(KILLER, alarm), autoSnoozeMinutes * DateUtils.MINUTE_IN_MILLIS); } }
void function(Alarm alarm) { final String autoSnooze = PreferenceManager.getDefaultSharedPreferences(this) .getString(SettingsActivity.KEY_AUTO_SILENCE, DEFAULT_ALARM_TIMEOUT); int autoSnoozeMinutes = Integer.parseInt(autoSnooze); if (autoSnoozeMinutes != -1) { mHandler.sendMessageDelayed(mHandler.obtainMessage(KILLER, alarm), autoSnoozeMinutes * DateUtils.MINUTE_IN_MILLIS); } }
/** * Kills alarm audio after ALARM_TIMEOUT_SECONDS, so the alarm * won't run all day. * * This just cancels the audio, but leaves the notification * popped, so the user will know that the alarm tripped. */
Kills alarm audio after ALARM_TIMEOUT_SECONDS, so the alarm won't run all day. This just cancels the audio, but leaves the notification popped, so the user will know that the alarm tripped
enableKiller
{ "repo_name": "bpbwan/myCode", "path": "DeskClock/src/com/android/deskclock/AlarmKlaxon.java", "license": "gpl-2.0", "size": 10958 }
[ "android.preference.PreferenceManager", "android.text.format.DateUtils" ]
import android.preference.PreferenceManager; import android.text.format.DateUtils;
import android.preference.*; import android.text.format.*;
[ "android.preference", "android.text" ]
android.preference; android.text;
2,000,879
protected JsonObject loadConfiguration() { return ConfigLoader.loadConfiguration(); }
JsonObject function() { return ConfigLoader.loadConfiguration(); }
/** * Load the configuration * @return JsonObject with the configuration */
Load the configuration
loadConfiguration
{ "repo_name": "Neofonie/vertx3-deployer", "path": "src/main/java/de/neofonie/deployer/DeployerVerticle.java", "license": "mit", "size": 7771 }
[ "io.vertx.core.json.JsonObject" ]
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.*;
[ "io.vertx.core" ]
io.vertx.core;
2,866,835
public Map<String, String> getTags() { return this.tags; }
Map<String, String> function() { return this.tags; }
/** * Get the tags associated with the secret. * * @return the value of the tags. */
Get the tags associated with the secret
getTags
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/SecretProperties.java", "license": "mit", "size": 9877 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,632,107
public void run() { List<SsaInsn> useList = ssaMeth.getUseListForRegister(regV); for (SsaInsn insn : useList) { nextFunction = NextFunction.DONE; if (insn instanceof PhiInsn) { // If s is a phi-function with V as it's ith argument. PhiInsn phi = (PhiInsn) insn; for (SsaBasicBlock pred : phi.predBlocksForReg(regV, ssaMeth)) { blockN = pred; nextFunction = NextFunction.LIVE_OUT_AT_BLOCK; handleTailRecursion(); } } else { blockN = insn.getBlock(); statementIndex = blockN.getInsns().indexOf(insn); if (statementIndex < 0) { throw new RuntimeException( "insn not found in it's own block"); } nextFunction = NextFunction.LIVE_IN_AT_STATEMENT; handleTailRecursion(); } } int nextLiveOutBlock; while ((nextLiveOutBlock = liveOutBlocks.nextSetBit(0)) >= 0) { blockN = ssaMeth.getBlocks().get(nextLiveOutBlock); liveOutBlocks.clear(nextLiveOutBlock); nextFunction = NextFunction.LIVE_OUT_AT_BLOCK; handleTailRecursion(); } }
void function() { List<SsaInsn> useList = ssaMeth.getUseListForRegister(regV); for (SsaInsn insn : useList) { nextFunction = NextFunction.DONE; if (insn instanceof PhiInsn) { PhiInsn phi = (PhiInsn) insn; for (SsaBasicBlock pred : phi.predBlocksForReg(regV, ssaMeth)) { blockN = pred; nextFunction = NextFunction.LIVE_OUT_AT_BLOCK; handleTailRecursion(); } } else { blockN = insn.getBlock(); statementIndex = blockN.getInsns().indexOf(insn); if (statementIndex < 0) { throw new RuntimeException( STR); } nextFunction = NextFunction.LIVE_IN_AT_STATEMENT; handleTailRecursion(); } } int nextLiveOutBlock; while ((nextLiveOutBlock = liveOutBlocks.nextSetBit(0)) >= 0) { blockN = ssaMeth.getBlocks().get(nextLiveOutBlock); liveOutBlocks.clear(nextLiveOutBlock); nextFunction = NextFunction.LIVE_OUT_AT_BLOCK; handleTailRecursion(); } }
/** * From Appel algorithm 19.17. */
From Appel algorithm 19.17
run
{ "repo_name": "geekboxzone/lollipop_external_dexmaker", "path": "src/dx/java/com/android/dx/ssa/back/LivenessAnalyzer.java", "license": "apache-2.0", "size": 8691 }
[ "com.android.dx.ssa.PhiInsn", "com.android.dx.ssa.SsaBasicBlock", "com.android.dx.ssa.SsaInsn", "java.util.List" ]
import com.android.dx.ssa.PhiInsn; import com.android.dx.ssa.SsaBasicBlock; import com.android.dx.ssa.SsaInsn; import java.util.List;
import com.android.dx.ssa.*; import java.util.*;
[ "com.android.dx", "java.util" ]
com.android.dx; java.util;
1,658,457
@Test public void testEquals_2() throws Exception { ExternalScript fixture = new ExternalScript(); fixture.setScript(""); fixture.setProductName(""); fixture.setName(""); Object obj = new ExternalScript(); boolean result = fixture.equals(obj); assertEquals(true, result); }
void function() throws Exception { ExternalScript fixture = new ExternalScript(); fixture.setScript(STRSTR"); Object obj = new ExternalScript(); boolean result = fixture.equals(obj); assertEquals(true, result); }
/** * Run the boolean equals(Object) method test. * * @throws Exception * * @generatedBy CodePro at 12/15/14 1:34 PM */
Run the boolean equals(Object) method test
testEquals_2
{ "repo_name": "intuit/Tank", "path": "data_model/src/test/java/com/intuit/tank/project/ExternalScriptTest.java", "license": "epl-1.0", "size": 7314 }
[ "com.intuit.tank.project.ExternalScript", "org.junit.jupiter.api.Assertions" ]
import com.intuit.tank.project.ExternalScript; import org.junit.jupiter.api.Assertions;
import com.intuit.tank.project.*; import org.junit.jupiter.api.*;
[ "com.intuit.tank", "org.junit.jupiter" ]
com.intuit.tank; org.junit.jupiter;
393,337
public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) { return !this.isIgnited() || !BlockRailBase.isRailBlock(blockStateIn) && !BlockRailBase.isRailBlock(worldIn, pos.up()) ? super.getExplosionResistance(explosionIn, worldIn, pos, blockStateIn) : 0.0F; }
float function(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) { return !this.isIgnited() !BlockRailBase.isRailBlock(blockStateIn) && !BlockRailBase.isRailBlock(worldIn, pos.up()) ? super.getExplosionResistance(explosionIn, worldIn, pos, blockStateIn) : 0.0F; }
/** * Explosion resistance of a block relative to this entity */
Explosion resistance of a block relative to this entity
getExplosionResistance
{ "repo_name": "scribblemaniac/AwakenDreamsClient", "path": "mcp/src/minecraft/net/minecraft/entity/item/EntityMinecartTNT.java", "license": "gpl-3.0", "size": 6587 }
[ "net.minecraft.block.BlockRailBase", "net.minecraft.block.state.IBlockState", "net.minecraft.util.math.BlockPos", "net.minecraft.world.Explosion", "net.minecraft.world.World" ]
import net.minecraft.block.BlockRailBase; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.World;
import net.minecraft.block.*; import net.minecraft.block.state.*; import net.minecraft.util.math.*; import net.minecraft.world.*;
[ "net.minecraft.block", "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.block; net.minecraft.util; net.minecraft.world;
1,848,018
public double getStdErrorOfEstimate(int index) { if (parameters == null) { return Double.NaN; } if (index < 0 || index >= this.parameters.length) { throw new OutOfRangeException(index, 0, this.parameters.length - 1); } double var = this.getVcvElement(index, index); if (!Double.isNaN(var) && var > Double.MIN_VALUE) { return FastMath.sqrt(var); } return Double.NaN; }
double function(int index) { if (parameters == null) { return Double.NaN; } if (index < 0 index >= this.parameters.length) { throw new OutOfRangeException(index, 0, this.parameters.length - 1); } double var = this.getVcvElement(index, index); if (!Double.isNaN(var) && var > Double.MIN_VALUE) { return FastMath.sqrt(var); } return Double.NaN; }
/** * Returns the <a href="http://www.xycoon.com/standerrorb(1).htm">standard * error of the parameter estimate at index</a>, * usually denoted s(b<sub>index</sub>). * * @param index Index. * @return the standard errors associated with parameters estimated at index. * @throws OutOfRangeException if {@code index} is not in the interval * {@code [0, number of parameters)}. */
Returns the standard error of the parameter estimate at index, usually denoted s(bindex)
getStdErrorOfEstimate
{ "repo_name": "SpoonLabs/astor", "path": "examples/math_32/src/main/java/org/apache/commons/math3/stat/regression/RegressionResults.java", "license": "gpl-2.0", "size": 15844 }
[ "org.apache.commons.math3.exception.OutOfRangeException", "org.apache.commons.math3.util.FastMath" ]
import org.apache.commons.math3.exception.OutOfRangeException; import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.exception.*; import org.apache.commons.math3.util.*;
[ "org.apache.commons" ]
org.apache.commons;
855,934
public Set getAttributeNames() { return attributes.keySet(); }
Set function() { return attributes.keySet(); }
/** * Gets the attribute names for this clickstream. */
Gets the attribute names for this clickstream
getAttributeNames
{ "repo_name": "zhiqinghuang/core", "path": "src/com/dotmarketing/beans/Clickstream.java", "license": "gpl-3.0", "size": 7987 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,975,363
@Nested @Optional public Property<JavaLauncher> getJavaLauncher() { return javaLauncher; }
Property<JavaLauncher> function() { return javaLauncher; }
/** * Configures the java executable to be used to run the tests. * * @since 6.7 */
Configures the java executable to be used to run the tests
getJavaLauncher
{ "repo_name": "gradle/gradle", "path": "subprojects/language-java/src/main/java/org/gradle/api/tasks/JavaExec.java", "license": "apache-2.0", "size": 19118 }
[ "org.gradle.api.provider.Property", "org.gradle.jvm.toolchain.JavaLauncher" ]
import org.gradle.api.provider.Property; import org.gradle.jvm.toolchain.JavaLauncher;
import org.gradle.api.provider.*; import org.gradle.jvm.toolchain.*;
[ "org.gradle.api", "org.gradle.jvm" ]
org.gradle.api; org.gradle.jvm;
692,872
protected void setRecipientFromEndpointConfiguration(MimeMessage mimeMessage, MailEndpoint endpoint, Exchange exchange) throws MessagingException, IOException { Map<Message.RecipientType, String> recipients = endpoint.getConfiguration().getRecipients(); if (recipients.containsKey(Message.RecipientType.TO)) { appendRecipientToMimeMessage(mimeMessage, endpoint.getConfiguration(), exchange, Message.RecipientType.TO.toString(), recipients.get(Message.RecipientType.TO)); } if (recipients.containsKey(Message.RecipientType.CC)) { appendRecipientToMimeMessage(mimeMessage, endpoint.getConfiguration(), exchange, Message.RecipientType.CC.toString(), recipients.get(Message.RecipientType.CC)); } if (recipients.containsKey(Message.RecipientType.BCC)) { appendRecipientToMimeMessage(mimeMessage, endpoint.getConfiguration(), exchange, Message.RecipientType.BCC.toString(), recipients.get(Message.RecipientType.BCC)); } } /** * Appends the Mail attachments from the Camel {@link MailMessage}
void function(MimeMessage mimeMessage, MailEndpoint endpoint, Exchange exchange) throws MessagingException, IOException { Map<Message.RecipientType, String> recipients = endpoint.getConfiguration().getRecipients(); if (recipients.containsKey(Message.RecipientType.TO)) { appendRecipientToMimeMessage(mimeMessage, endpoint.getConfiguration(), exchange, Message.RecipientType.TO.toString(), recipients.get(Message.RecipientType.TO)); } if (recipients.containsKey(Message.RecipientType.CC)) { appendRecipientToMimeMessage(mimeMessage, endpoint.getConfiguration(), exchange, Message.RecipientType.CC.toString(), recipients.get(Message.RecipientType.CC)); } if (recipients.containsKey(Message.RecipientType.BCC)) { appendRecipientToMimeMessage(mimeMessage, endpoint.getConfiguration(), exchange, Message.RecipientType.BCC.toString(), recipients.get(Message.RecipientType.BCC)); } } /** * Appends the Mail attachments from the Camel {@link MailMessage}
/** * Appends the Mail headers from the endpoint configuration. */
Appends the Mail headers from the endpoint configuration
setRecipientFromEndpointConfiguration
{ "repo_name": "jarst/camel", "path": "components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java", "license": "apache-2.0", "size": 34797 }
[ "java.io.IOException", "java.util.Map", "javax.mail.Message", "javax.mail.MessagingException", "javax.mail.internet.MimeMessage", "org.apache.camel.Exchange" ]
import java.io.IOException; import java.util.Map; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import org.apache.camel.Exchange;
import java.io.*; import java.util.*; import javax.mail.*; import javax.mail.internet.*; import org.apache.camel.*;
[ "java.io", "java.util", "javax.mail", "org.apache.camel" ]
java.io; java.util; javax.mail; org.apache.camel;
795,445
public static Option build(String name, Object value) { return new Option(name, Text.builder(name).color(TextColors.GOLD).onClick(TextActions.runCommand(name)) .onHover(TextActions.showText(Text.of(TextColors.AQUA, "Click to select " + name + "!"))) .build(), value); }
static Option function(String name, Object value) { return new Option(name, Text.builder(name).color(TextColors.GOLD).onClick(TextActions.runCommand(name)) .onHover(TextActions.showText(Text.of(TextColors.AQUA, STR + name + "!"))) .build(), value); }
/** * Create an option with a default Text object around a key value entry. */
Create an option with a default Text object around a key value entry
build
{ "repo_name": "Wundero/Ray", "path": "src/main/java/me/Wundero/Ray/conversation/Option.java", "license": "mit", "size": 2484 }
[ "org.spongepowered.api.text.Text", "org.spongepowered.api.text.action.TextActions", "org.spongepowered.api.text.format.TextColors" ]
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.action.TextActions; import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.*; import org.spongepowered.api.text.action.*; import org.spongepowered.api.text.format.*;
[ "org.spongepowered.api" ]
org.spongepowered.api;
2,774,690
public void setIn(BufferedReader in, boolean autoClose, boolean isInteractive) { ioManager.setIn(in, autoClose, isInteractive); this.in = in; }
void function(BufferedReader in, boolean autoClose, boolean isInteractive) { ioManager.setIn(in, autoClose, isInteractive); this.in = in; }
/** * Changes the input stream. * * @param in The new input stream. * @param autoClose If true, then the input stream will automatically be closed when it is no longer used by * the session. * @param isInteractive If true, then the input stream is assumed to be interactive and a prompt will be * displayed for input. */
Changes the input stream
setIn
{ "repo_name": "scgray/jsqsh", "path": "jsqsh-core/src/main/java/org/sqsh/Session.java", "license": "apache-2.0", "size": 57202 }
[ "java.io.BufferedReader" ]
import java.io.BufferedReader;
import java.io.*;
[ "java.io" ]
java.io;
1,629,785
static void executeWithErrorCheck(String command) throws SkypeException { try { String response = Connector.getInstance().execute(command); checkError(response); } catch (ConnectorException e) { convertToSkypeException(e); } }
static void executeWithErrorCheck(String command) throws SkypeException { try { String response = Connector.getInstance().execute(command); checkError(response); } catch (ConnectorException e) { convertToSkypeException(e); } }
/** * Send a SKYPE message and check the reply for ERROR. * @param command the command to send to the Skype client. * @throws SkypeException when connection to Skype client has gone bad or reply contains ERROR. */
Send a SKYPE message and check the reply for ERROR
executeWithErrorCheck
{ "repo_name": "AManuev/Skype4OSGi", "path": "src/main/java/com/skype/Utils.java", "license": "apache-2.0", "size": 11881 }
[ "com.skype.connector.Connector", "com.skype.connector.ConnectorException" ]
import com.skype.connector.Connector; import com.skype.connector.ConnectorException;
import com.skype.connector.*;
[ "com.skype.connector" ]
com.skype.connector;
1,933,566
List<Arc> getOutputArcs (Node node, String...arcNames);
List<Arc> getOutputArcs (Node node, String...arcNames);
/** * Returns a list of arcs which have the given node as a starting point * and which have the given name. The list may be empty but will never * be null. * * @param node A node belonging to this graph * @return A list of arcs */
Returns a list of arcs which have the given node as a starting point and which have the given name. The list may be empty but will never be null
getOutputArcs
{ "repo_name": "plorenz/sarasvati", "path": "sarasvati-core/src/main/java/com/googlecode/sarasvati/Graph.java", "license": "lgpl-3.0", "size": 3944 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,096,133
public JmtCell getVertexAt(int x, int y) { CellView[] cellViews = getGraphLayoutCache().getAllViews(); for (CellView cellView : cellViews) { if (cellView.getCell() instanceof JmtCell) { if (cellView.getBounds().contains(x, y)) { return (JmtCell) cellView.getCell(); } } } return null; // Object cell = null; // Object oldCell = null; // do { // cell = getNextCellForLocation(oldCell, x, y); // if (oldCell == cell) // return null; // else // oldCell = cell; // } while (!((cell instanceof JmtCell) || cell == null)); }
JmtCell function(int x, int y) { CellView[] cellViews = getGraphLayoutCache().getAllViews(); for (CellView cellView : cellViews) { if (cellView.getCell() instanceof JmtCell) { if (cellView.getBounds().contains(x, y)) { return (JmtCell) cellView.getCell(); } } } return null; }
/** Gets the first vertex at this position. * * @param x horizontal coordinate * @param y vertical coordinate * @return first vertex */
Gets the first vertex at this position
getVertexAt
{ "repo_name": "chpatrick/jmt", "path": "src/jmt/gui/jmodel/JGraphMod/JmtJGraph.java", "license": "gpl-2.0", "size": 7858 }
[ "org.jgraph.graph.CellView" ]
import org.jgraph.graph.CellView;
import org.jgraph.graph.*;
[ "org.jgraph.graph" ]
org.jgraph.graph;
689,131
@Override public void write(byte[] data, int offset, int length) throws IOException { if(contentFormatType == null) { for (int i = offset; i < offset + length; i++) { this.write(data[i]); } } else { out.write(data, offset, length); } }
void function(byte[] data, int offset, int length) throws IOException { if(contentFormatType == null) { for (int i = offset; i < offset + length; i++) { this.write(data[i]); } } else { out.write(data, offset, length); } }
/** * override write method */
override write method
write
{ "repo_name": "jahnje/delcyon-capo", "path": "java/com/delcyon/capo/datastream/stream_attribute_filter/ContentFormatTypeFilterOutputStream.java", "license": "gpl-3.0", "size": 3463 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,951,974
@SuppressWarnings("unchecked cast") public static void HydraTask_createIndexes() { GsRandom rand = TestConfig.tab().getRandGen(); int nbrOfColumns; String createStmt, fullTableName; List<TableDefinition> tableList = (List<TableDefinition>) BackupAndRestoreBB.getBB().getSharedMap().get(KEY_TABLES); for (TableDefinition table : tableList) { fullTableName = table.getFullTableName(); nbrOfColumns = table.getNumColumns(); // Get a Random Column to use as the Index. Don't get the first column (PK), or a CLOB column // # 0 1 2 3 4 // 5 pk clob date vc int // 5 pk clob clob clob clob int startingColNbr = 0; boolean validColumnType = false; do { startingColNbr++; // If we've gone through all of the columns then leave if (startingColNbr == nbrOfColumns) { break; } // Make sure that the column type is not CLOB validColumnType = !table.getColumnType(startingColNbr).equalsIgnoreCase(DATA_TYPE_CLOB); } while (!validColumnType); if (validColumnType) { int randColNbr = rand.nextInt(startingColNbr, nbrOfColumns - 1); String randColName = table.getColumnName(randColNbr); String indexName = "idx" + fullTableName.substring(fullTableName.length() - 3, fullTableName.length()) + "_" + (randColNbr + 1); // Check the 1st bit of the randColNbr, if it is on, then let's use Ascending Order otherwise use Descending String order = (randColNbr & 1) == 1 ? "ASC" : "DESC"; createStmt = "CREATE INDEX " + indexName + " ON " + fullTableName + " (" + randColName + " " + order + ")"; logWriter.info("BackupRestoreBigDataTest.HydraTask_createIndexes-About to execute sql statement: " + createStmt); executeSqlStatement(createStmt, true); } else { logWriter.info("BackupRestoreBigDataTest.HydraTask_createIndexes-An index could not be created for table '" + fullTableName + "' because all columns are CLOBS."); } } }
@SuppressWarnings(STR) static void function() { GsRandom rand = TestConfig.tab().getRandGen(); int nbrOfColumns; String createStmt, fullTableName; List<TableDefinition> tableList = (List<TableDefinition>) BackupAndRestoreBB.getBB().getSharedMap().get(KEY_TABLES); for (TableDefinition table : tableList) { fullTableName = table.getFullTableName(); nbrOfColumns = table.getNumColumns(); int startingColNbr = 0; boolean validColumnType = false; do { startingColNbr++; if (startingColNbr == nbrOfColumns) { break; } validColumnType = !table.getColumnType(startingColNbr).equalsIgnoreCase(DATA_TYPE_CLOB); } while (!validColumnType); if (validColumnType) { int randColNbr = rand.nextInt(startingColNbr, nbrOfColumns - 1); String randColName = table.getColumnName(randColNbr); String indexName = "idx" + fullTableName.substring(fullTableName.length() - 3, fullTableName.length()) + "_" + (randColNbr + 1); String order = (randColNbr & 1) == 1 ? "ASC" : "DESC"; createStmt = STR + indexName + STR + fullTableName + STR + randColName + " " + order + ")"; logWriter.info(STR + createStmt); executeSqlStatement(createStmt, true); } else { logWriter.info(STR + fullTableName + STR); } } }
/** * Hydra task to create Indexes. Intentions are to pick a random column from each table to use as an Index. Code ensures * that the chosen column is not the PK or a Clob. */
Hydra task to create Indexes. Intentions are to pick a random column from each table to use as an Index. Code ensures that the chosen column is not the PK or a Clob
HydraTask_createIndexes
{ "repo_name": "papicella/snappy-store", "path": "tests/sql/src/main/java/sql/backupAndRestore/BackupRestoreBigDataTest.java", "license": "apache-2.0", "size": 98891 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,558,565
public static String splitIndex(String str, String separator, int index) { if (index < 0) { return null; } String[] values = StringUtils.splitByWholeSeparatorPreserveAllTokens(str, separator); if (index >= values.length) { return null; } else { return values[index]; } }
static String function(String str, String separator, int index) { if (index < 0) { return null; } String[] values = StringUtils.splitByWholeSeparatorPreserveAllTokens(str, separator); if (index >= values.length) { return null; } else { return values[index]; } }
/** * Split target string with custom separator and pick the index-th(start with 0) result. * * @param str target string. * @param separator custom separator. * @param index index of the result which you want. * @return the string at the index of split results. */
Split target string with custom separator and pick the index-th(start with 0) result
splitIndex
{ "repo_name": "bowenli86/flink", "path": "flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java", "license": "apache-2.0", "size": 30260 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
2,613,262
@NonNull public Builder setIntent(@NonNull Intent intent) { mIntent = Preconditions.checkNotNull(intent, "intent"); return this; }
Builder function(@NonNull Intent intent) { mIntent = Preconditions.checkNotNull(intent, STR); return this; }
/** * Sets the intent of a shortcut. This is a mandatory field. The extras must only contain * persistable information. (See {@link PersistableBundle}). */
Sets the intent of a shortcut. This is a mandatory field. The extras must only contain persistable information. (See <code>PersistableBundle</code>)
setIntent
{ "repo_name": "daiqiquan/framework-base", "path": "core/java/android/content/pm/ShortcutInfo.java", "license": "apache-2.0", "size": 26053 }
[ "android.annotation.NonNull", "android.content.Intent", "com.android.internal.util.Preconditions" ]
import android.annotation.NonNull; import android.content.Intent; import com.android.internal.util.Preconditions;
import android.annotation.*; import android.content.*; import com.android.internal.util.*;
[ "android.annotation", "android.content", "com.android.internal" ]
android.annotation; android.content; com.android.internal;
122,540
public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.put(key, value); return this; }
Builder function(String key, Object value) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.put(key, value); return this; }
/** * Add a key/value pair to `extraParams` map. A map is initialized for the first * `put/putAll` call, and subsequent calls add additional key/value pairs to the original * map. See {@link * PaymentIntentConfirmParams.PaymentMethodData.BillingDetails.Address#extraParams} for * the field documentation. */
Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>PaymentIntentConfirmParams.PaymentMethodData.BillingDetails.Address#extraParams</code> for the field documentation
putExtraParam
{ "repo_name": "stripe/stripe-java", "path": "src/main/java/com/stripe/param/PaymentIntentConfirmParams.java", "license": "mit", "size": 315067 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,063,018
public static int toInt(java.sql.Time v) { return (int) (toLong(v) % DateTimeUtils.MILLIS_PER_DAY); }
static int function(java.sql.Time v) { return (int) (toLong(v) % DateTimeUtils.MILLIS_PER_DAY); }
/** Converts the Java type used for UDF parameters of SQL TIME type * ({@link java.sql.Time}) to internal representation (int). * * <p>Converse of {@link #internalToTime(int)}. */
Converts the Java type used for UDF parameters of SQL TIME type (<code>java.sql.Time</code>) to internal representation (int)
toInt
{ "repo_name": "dindin5258/calcite", "path": "core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java", "license": "apache-2.0", "size": 85060 }
[ "org.apache.calcite.avatica.util.DateTimeUtils" ]
import org.apache.calcite.avatica.util.DateTimeUtils;
import org.apache.calcite.avatica.util.*;
[ "org.apache.calcite" ]
org.apache.calcite;
1,904,405
protected SecureChannelCredential getSecureChannelCredential(CardFilePath file, int accessMode) { SecureChannelCredential secureChannelCredential = null; // if ((credentialDomain != null) && (file.startsWith(credentialDomain))) { if (credentialDomain != null) { IsoCredentialStore ics = (IsoCredentialStore)credentialBag.getCredentialStore(null, IsoCredentialStore.class); if (ics != null) { secureChannelCredential = ics.getSecureChannelCredential(file, accessMode); } } return(secureChannelCredential); }
SecureChannelCredential function(CardFilePath file, int accessMode) { SecureChannelCredential secureChannelCredential = null; if (credentialDomain != null) { IsoCredentialStore ics = (IsoCredentialStore)credentialBag.getCredentialStore(null, IsoCredentialStore.class); if (ics != null) { secureChannelCredential = ics.getSecureChannelCredential(file, accessMode); } } return(secureChannelCredential); }
/** * Obtain a secure channel credential, if any is defined for the given file and access mode * * @param file File for which a secure channel credential should be obtained * * @param accessMode Desired mode of access (READ, UPDATE or APPEND) * * @return null or SecureChannelCredential object */
Obtain a secure channel credential, if any is defined for the given file and access mode
getSecureChannelCredential
{ "repo_name": "zeroDenial/CNSReader", "path": "ocf/de/cardcontact/opencard/service/isocard/IsoCardService.java", "license": "gpl-2.0", "size": 34760 }
[ "de.cardcontact.opencard.security.IsoCredentialStore", "de.cardcontact.opencard.security.SecureChannelCredential" ]
import de.cardcontact.opencard.security.IsoCredentialStore; import de.cardcontact.opencard.security.SecureChannelCredential;
import de.cardcontact.opencard.security.*;
[ "de.cardcontact.opencard" ]
de.cardcontact.opencard;
1,733,864
@Test public void testBasicSchema() throws Exception { String tablePath = buildTable("basic", basicFileContents); try { enableSchemaSupport(); String schemaSql = "create schema (intcol int not null, datecol date not null, " + "`dub` double not null, `extra` bigint not null default '20') " + "for table " + tablePath; run(schemaSql); String sql = "SELECT `intcol`, `datecol`, `str`, `dub`, `extra`, `missing` FROM " + tablePath; RowSet actual = client.queryBuilder().sql(sql).rowSet(); TupleMetadata expectedSchema = new SchemaBuilder() .add("intcol", MinorType.INT) // Has a schema .add("datecol", MinorType.DATE) // Has a schema .add("str", MinorType.VARCHAR) // No schema, retains type .add("dub", MinorType.FLOAT8) // Has a schema .add("extra", MinorType.BIGINT) // No data, has default value .add("missing", MinorType.VARCHAR) // No data, no schema, default type .buildSchema(); RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema) .addRow(10, new LocalDate(2019, 3, 20), "it works!", 1234.5D, 20L, "") .build(); RowSetUtilities.verify(expected, actual); } finally { resetSchemaSupport(); } }
void function() throws Exception { String tablePath = buildTable("basic", basicFileContents); try { enableSchemaSupport(); String schemaSql = STR + STR + STR + tablePath; run(schemaSql); String sql = STR + tablePath; RowSet actual = client.queryBuilder().sql(sql).rowSet(); TupleMetadata expectedSchema = new SchemaBuilder() .add(STR, MinorType.INT) .add(STR, MinorType.DATE) .add("str", MinorType.VARCHAR) .add("dub", MinorType.FLOAT8) .add("extra", MinorType.BIGINT) .add(STR, MinorType.VARCHAR) .buildSchema(); RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema) .addRow(10, new LocalDate(2019, 3, 20), STR, 1234.5D, 20L, "") .build(); RowSetUtilities.verify(expected, actual); } finally { resetSchemaSupport(); } }
/** * Test the simplest possible case: a table with one file: * <ul> * <li>Column in projection, table, and schema</li> * <li>Column in projection and table but not in schema.</li> * <li>Column in projection and schema, but not in table.</li> * <li>Column in projection, but not in schema or table.</li> * </ul> */
Test the simplest possible case: a table with one file: Column in projection, table, and schema Column in projection and table but not in schema. Column in projection and schema, but not in table. Column in projection, but not in schema or table.
testBasicSchema
{ "repo_name": "Agirish/drill", "path": "exec/java-exec/src/test/java/org/apache/drill/exec/store/easy/text/compliant/TestCsvWithSchema.java", "license": "apache-2.0", "size": 43937 }
[ "org.apache.drill.common.types.TypeProtos", "org.apache.drill.exec.physical.rowSet.RowSet", "org.apache.drill.exec.physical.rowSet.RowSetBuilder", "org.apache.drill.exec.record.metadata.SchemaBuilder", "org.apache.drill.exec.record.metadata.TupleMetadata", "org.apache.drill.test.rowSet.RowSetUtilities", ...
import org.apache.drill.common.types.TypeProtos; import org.apache.drill.exec.physical.rowSet.RowSet; import org.apache.drill.exec.physical.rowSet.RowSetBuilder; import org.apache.drill.exec.record.metadata.SchemaBuilder; import org.apache.drill.exec.record.metadata.TupleMetadata; import org.apache.drill.test.rowSet.RowSetUtilities; import org.joda.time.LocalDate;
import org.apache.drill.common.types.*; import org.apache.drill.exec.physical.*; import org.apache.drill.exec.record.metadata.*; import org.apache.drill.test.*; import org.joda.time.*;
[ "org.apache.drill", "org.joda.time" ]
org.apache.drill; org.joda.time;
1,727,262
public LoadBalanceDefinition custom(String ref) { CustomLoadBalancerDefinition balancer = new CustomLoadBalancerDefinition(); balancer.setRef(ref); setLoadBalancerType(balancer); return this; }
LoadBalanceDefinition function(String ref) { CustomLoadBalancerDefinition balancer = new CustomLoadBalancerDefinition(); balancer.setRef(ref); setLoadBalancerType(balancer); return this; }
/** * Uses the custom load balancer * * @param ref reference to lookup a custom load balancer from the {@link org.apache.camel.spi.Registry} to be used. * @return the builder */
Uses the custom load balancer
custom
{ "repo_name": "RohanHart/camel", "path": "camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java", "license": "apache-2.0", "size": 14313 }
[ "org.apache.camel.model.loadbalancer.CustomLoadBalancerDefinition" ]
import org.apache.camel.model.loadbalancer.CustomLoadBalancerDefinition;
import org.apache.camel.model.loadbalancer.*;
[ "org.apache.camel" ]
org.apache.camel;
1,308,118
public synchronized CmsScheduledJobInfo unscheduleJob(CmsObject cms, String jobId) throws CmsRoleViolationException { if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) { // simple unit tests will have runlevel 1 and no CmsObject OpenCms.getRoleManager().checkRole(cms, CmsRole.WORKPLACE_MANAGER); } CmsScheduledJobInfo jobInfo = null; if (m_jobs.size() > 0) { // try to remove the job from the OpenCms list of jobs for (int i = (m_jobs.size() - 1); i >= 0; i--) { CmsScheduledJobInfo job = m_jobs.get(i); if (jobId.equals(job.getId())) { m_jobs.remove(i); if (jobInfo != null) { LOG.error(Messages.get().getBundle().key(Messages.LOG_MULTIPLE_JOBS_FOUND_1, jobId)); } jobInfo = job; } } } if ((jobInfo != null) && jobInfo.isActive()) { // job currently active, remove it from the Quartz scheduler try { // try to remove the job from Quartz m_scheduler.unscheduleJob(jobId, Scheduler.DEFAULT_GROUP); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNSCHEDULED_JOB_1, jobId)); } } catch (SchedulerException e) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNSCHEDULING_ERROR_1, jobId)); } } } return jobInfo; }
synchronized CmsScheduledJobInfo function(CmsObject cms, String jobId) throws CmsRoleViolationException { if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) { OpenCms.getRoleManager().checkRole(cms, CmsRole.WORKPLACE_MANAGER); } CmsScheduledJobInfo jobInfo = null; if (m_jobs.size() > 0) { for (int i = (m_jobs.size() - 1); i >= 0; i--) { CmsScheduledJobInfo job = m_jobs.get(i); if (jobId.equals(job.getId())) { m_jobs.remove(i); if (jobInfo != null) { LOG.error(Messages.get().getBundle().key(Messages.LOG_MULTIPLE_JOBS_FOUND_1, jobId)); } jobInfo = job; } } } if ((jobInfo != null) && jobInfo.isActive()) { try { m_scheduler.unscheduleJob(jobId, Scheduler.DEFAULT_GROUP); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNSCHEDULED_JOB_1, jobId)); } } catch (SchedulerException e) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNSCHEDULING_ERROR_1, jobId)); } } } return jobInfo; }
/** * Removes a currently scheduled job from the scheduler.<p> * * @param cms an OpenCms context object that must have been initialized with "Admin" permissions * @param jobId the id of the job to unschedule, obtained with <code>{@link CmsScheduledJobInfo#getId()}</code> * * @return the <code>{@link CmsScheduledJobInfo}</code> of the sucessfully unscheduled job, * or <code>null</code> if the job could not be unscheduled * * @throws CmsRoleViolationException if the user has insufficient role permissions */
Removes a currently scheduled job from the scheduler
unscheduleJob
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/scheduler/CmsScheduleManager.java", "license": "lgpl-2.1", "size": 23375 }
[ "org.opencms.file.CmsObject", "org.opencms.main.OpenCms", "org.opencms.security.CmsRole", "org.opencms.security.CmsRoleViolationException", "org.quartz.Scheduler", "org.quartz.SchedulerException" ]
import org.opencms.file.CmsObject; import org.opencms.main.OpenCms; import org.opencms.security.CmsRole; import org.opencms.security.CmsRoleViolationException; import org.quartz.Scheduler; import org.quartz.SchedulerException;
import org.opencms.file.*; import org.opencms.main.*; import org.opencms.security.*; import org.quartz.*;
[ "org.opencms.file", "org.opencms.main", "org.opencms.security", "org.quartz" ]
org.opencms.file; org.opencms.main; org.opencms.security; org.quartz;
1,669,490
public void setForeignKeyDeleteAction(ForeignKeyDeleteAction foreignKeyDeleteAction) { DatabaseUtil.checkForNullParam(foreignKeyDeleteAction, "foreignKeyDeleteAction"); this.foreignKeyDeleteAction = foreignKeyDeleteAction; }
void function(ForeignKeyDeleteAction foreignKeyDeleteAction) { DatabaseUtil.checkForNullParam(foreignKeyDeleteAction, STR); this.foreignKeyDeleteAction = foreignKeyDeleteAction; }
/** * Javadoc for this public method is generated via * the doc templates in the doc_src directory. */
Javadoc for this public method is generated via the doc templates in the doc_src directory
setForeignKeyDeleteAction
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/je-3.2.44/src/com/sleepycat/je/SecondaryConfig.java", "license": "gpl-2.0", "size": 7780 }
[ "com.sleepycat.je.utilint.DatabaseUtil" ]
import com.sleepycat.je.utilint.DatabaseUtil;
import com.sleepycat.je.utilint.*;
[ "com.sleepycat.je" ]
com.sleepycat.je;
950,897
@SuppressWarnings("unchecked") static public Serializable stringToObject(String string){ byte[] bytes = Base64.decode(string, 0); Serializable object = null; try { ObjectInputStream objectInputStream = new ObjectInputStream( new ByteArrayInputStream(bytes) ); object = (Serializable)objectInputStream.readObject(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (ClassCastException e) { e.printStackTrace(); } return object; }
@SuppressWarnings(STR) static Serializable function(String string){ byte[] bytes = Base64.decode(string, 0); Serializable object = null; try { ObjectInputStream objectInputStream = new ObjectInputStream( new ByteArrayInputStream(bytes) ); object = (Serializable)objectInputStream.readObject(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (ClassCastException e) { e.printStackTrace(); } return object; }
/** * Created by Elisha Sterngold on stackoverflow.com */
Created by Elisha Sterngold on stackoverflow.com
stringToObject
{ "repo_name": "Immabed/RankMaster", "path": "app/src/main/java/com/immabed/rankmaster/RankTableIO.java", "license": "gpl-3.0", "size": 4817 }
[ "android.util.Base64", "java.io.ByteArrayInputStream", "java.io.IOException", "java.io.ObjectInputStream", "java.io.Serializable" ]
import android.util.Base64; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable;
import android.util.*; import java.io.*;
[ "android.util", "java.io" ]
android.util; java.io;
1,980,651
ContentWriter getWriter(String url);
ContentWriter getWriter(String url);
/** * Retrieve a ContentWriter to write content to a cache file. Upon closing the stream * a listener will add the new content file to the in-memory lookup table. * * @param url url * @return ContentWriter */
Retrieve a ContentWriter to write content to a cache file. Upon closing the stream a listener will add the new content file to the in-memory lookup table
getWriter
{ "repo_name": "daniel-he/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/content/caching/ContentCache.java", "license": "lgpl-3.0", "size": 3682 }
[ "org.alfresco.service.cmr.repository.ContentWriter" ]
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.*;
[ "org.alfresco.service" ]
org.alfresco.service;
917,386
private Message createReadyForRequestMessage(final Message message, final PeerAddress receiver) { Message readyForRequestMessage = createMessage(receiver, RPC.Commands.RCON.getNr(), Message.Type.REQUEST_3); if (!message.intList().isEmpty()) { // forward the message id to indentify the cached message afterwards readyForRequestMessage.intValue(message.intAt(0)); } // keep the new connection open readyForRequestMessage.keepAlive(true); return readyForRequestMessage; }
Message function(final Message message, final PeerAddress receiver) { Message readyForRequestMessage = createMessage(receiver, RPC.Commands.RCON.getNr(), Message.Type.REQUEST_3); if (!message.intList().isEmpty()) { readyForRequestMessage.intValue(message.intAt(0)); } readyForRequestMessage.keepAlive(true); return readyForRequestMessage; }
/** * This method creates a message to indicate that the connection is ready for requests. * It is sent from the unreachable peer to the reachable peer. * * @param message * @param receiver * @return setupMessage */
This method creates a message to indicate that the connection is ready for requests. It is sent from the unreachable peer to the reachable peer
createReadyForRequestMessage
{ "repo_name": "thirdy/TomP2P", "path": "nat/src/main/java/net/tomp2p/relay/RconRPC.java", "license": "apache-2.0", "size": 13228 }
[ "net.tomp2p.message.Message", "net.tomp2p.peers.PeerAddress" ]
import net.tomp2p.message.Message; import net.tomp2p.peers.PeerAddress;
import net.tomp2p.message.*; import net.tomp2p.peers.*;
[ "net.tomp2p.message", "net.tomp2p.peers" ]
net.tomp2p.message; net.tomp2p.peers;
1,115,605
public void setFileCollection(Collection<File> fileCollection){ this.fileCollection = fileCollection; }
void function(Collection<File> fileCollection){ this.fileCollection = fileCollection; }
/** * Sets the value of fileCollection attribue **/
Sets the value of fileCollection attribue
setFileCollection
{ "repo_name": "NCIP/camod", "path": "software/camod/src/gov/nih/nci/camod/bean/Keyword.java", "license": "bsd-3-clause", "size": 2149 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
343,998
public static MozuClient<com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee> createOrderHandlingFeeClient(com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.settings.shipping.SiteShippingHandlingFeeUrl.createOrderHandlingFeeUrl(responseFields); String verb = "POST"; Class<?> clz = com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee.class; MozuClient<com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee> mozuClient = (MozuClient<com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(orderHandlingFee); return mozuClient; }
static MozuClient<com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee> function(com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.settings.shipping.SiteShippingHandlingFeeUrl.createOrderHandlingFeeUrl(responseFields); String verb = "POST"; Class<?> clz = com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee.class; MozuClient<com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee> mozuClient = (MozuClient<com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(orderHandlingFee); return mozuClient; }
/** * * <p><pre><code> * MozuClient<com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee> mozuClient=CreateOrderHandlingFeeClient( orderHandlingFee, responseFields); * client.setBaseAddress(url); * client.executeRequest(); * SiteShippingHandlingFee siteShippingHandlingFee = client.Result(); * </code></pre></p> * @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 orderHandlingFee Properties of the handling fee to apply to order shipments for the site. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee> * @see com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee * @see com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee */
<code><code> MozuClient mozuClient=CreateOrderHandlingFeeClient( orderHandlingFee, responseFields); client.setBaseAddress(url); client.executeRequest(); SiteShippingHandlingFee siteShippingHandlingFee = client.Result(); </code></code>
createOrderHandlingFeeClient
{ "repo_name": "Mozu/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/settings/shipping/SiteShippingHandlingFeeClient.java", "license": "mit", "size": 8763 }
[ "com.mozu.api.MozuClient", "com.mozu.api.MozuClientFactory", "com.mozu.api.MozuUrl" ]
import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
2,844,508
EClass getHealthcareProvider();
EClass getHealthcareProvider();
/** * Returns the meta object for class '{@link org.openhealthtools.mdht.uml.cda.hitsp.HealthcareProvider <em>Healthcare Provider</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Healthcare Provider</em>'. * @see org.openhealthtools.mdht.uml.cda.hitsp.HealthcareProvider * @generated */
Returns the meta object for class '<code>org.openhealthtools.mdht.uml.cda.hitsp.HealthcareProvider Healthcare Provider</code>'.
getHealthcareProvider
{ "repo_name": "drbgfc/mdht", "path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.hitsp/src/org/openhealthtools/mdht/uml/cda/hitsp/HITSPPackage.java", "license": "epl-1.0", "size": 366422 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
271,916
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder; }
SpringApplicationBuilder function(SpringApplicationBuilder builder) { return builder; }
/** * Configure the application. Normally all you would need to do it add sources (e.g. * config classes) because other settings have sensible defaults. You might choose * (for instance) to add default command line arguments, or set an active Spring * profile. * @param builder a builder for the application context * @return the application builder * @see SpringApplicationBuilder */
Configure the application. Normally all you would need to do it add sources (e.g. config classes) because other settings have sensible defaults. You might choose (for instance) to add default command line arguments, or set an active Spring profile
configure
{ "repo_name": "izestrea/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/context/web/SpringBootServletInitializer.java", "license": "apache-2.0", "size": 6354 }
[ "org.springframework.boot.builder.SpringApplicationBuilder" ]
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.builder.*;
[ "org.springframework.boot" ]
org.springframework.boot;
305,910
@Override public boolean isOpaque() { Color back = getBackground(); Component p = getParent(); if (p != null) { p = p.getParent(); } boolean colorMatch = (back != null) && (p != null) && back.equals(p.getBackground()) && p.isOpaque(); return !colorMatch && super.isOpaque(); } @Override public void validate() {}
boolean function() { Color back = getBackground(); Component p = getParent(); if (p != null) { p = p.getParent(); } boolean colorMatch = (back != null) && (p != null) && back.equals(p.getBackground()) && p.isOpaque(); return !colorMatch && super.isOpaque(); } public void validate() {}
/** * Overridden for performance reasons. * See the <a href="#override">Implementation Note</a> * for more information. */
Overridden for performance reasons. See the Implementation Note for more information
isOpaque
{ "repo_name": "pdeboer/wikilanguage", "path": "lib/jung2/jung-visualization/src/main/java/edu/uci/ics/jung/visualization/annotations/AnnotationRenderer.java", "license": "mit", "size": 5584 }
[ "java.awt.Color", "java.awt.Component" ]
import java.awt.Color; import java.awt.Component;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,551,496
void fastProducer(ConnectionContext context,ProducerInfo producerInfo,ActiveMQDestination destination);
void fastProducer(ConnectionContext context,ProducerInfo producerInfo,ActiveMQDestination destination);
/** * Called to notify a producer is too fast * @param context * @param producerInfo * @param destination */
Called to notify a producer is too fast
fastProducer
{ "repo_name": "chirino/activemq", "path": "activemq-broker/src/main/java/org/apache/activemq/broker/Broker.java", "license": "apache-2.0", "size": 11639 }
[ "org.apache.activemq.command.ActiveMQDestination", "org.apache.activemq.command.ProducerInfo" ]
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ProducerInfo;
import org.apache.activemq.command.*;
[ "org.apache.activemq" ]
org.apache.activemq;
1,192,252
public void updateRegistry(int tick) { float p = 0f; float q = 0f; for(Appliance appliance : getAppliances()) { p += appliance.getPower(tick, "p"); q += appliance.getPower(tick, "q"); } currentPowerP = p; currentPowerQ = q; }
void function(int tick) { float p = 0f; float q = 0f; for(Appliance appliance : getAppliances()) { p += appliance.getPower(tick, "p"); q += appliance.getPower(tick, "q"); } currentPowerP = p; currentPowerQ = q; }
/** * Update registry. * * @param tick the tick */
Update registry
updateRegistry
{ "repo_name": "cassandra-project/cassandra-stand-alone", "path": "src/eu/cassandra/sim/entities/installations/Installation.java", "license": "apache-2.0", "size": 10941 }
[ "eu.cassandra.sim.entities.appliances.Appliance" ]
import eu.cassandra.sim.entities.appliances.Appliance;
import eu.cassandra.sim.entities.appliances.*;
[ "eu.cassandra.sim" ]
eu.cassandra.sim;
1,323,519
public void testUpdateRowWithTriggerChangingRS() throws SQLException { createTable1WithTrigger(); Statement stmt = createStatement( ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); // Look at the current contents of table2WithTriggers String[][] original = {{"1", "1"}, {"2", "2"}, {"3", "3"}, {"4", "4"}}; JDBC.assertFullResultSet( stmt.executeQuery("select * from table2WithTriggers"), original, true); ResultSet rs = stmt.executeQuery( "SELECT * FROM table2WithTriggers where c1>1 FOR UPDATE"); assertTrue("FAIL - row not found", rs.next()); assertEquals("FAIL - wrong value for column c1", 2, rs.getInt(1)); // this update row will fire the update trigger which will update all // the rows in the table to have c1=1 and hence no more rows will // qualify for the resultset rs.updateLong(2,2); rs.updateRow(); try { assertFalse("FAIL - row not found", rs.next()); rs.updateRow(); fail("FAIL - there should have be no more rows in the resultset " + "at this point because update trigger made all the rows " + "not qualify for the resultset"); } catch (SQLException e) { String sqlState = usingEmbedded() ? "24000" : "XJ121"; assertSQLState(sqlState, e); } rs.close(); // Verify that update trigger got fired by verifying that all column // c1s have value 1 in table2WithTriggers rs = stmt.executeQuery("SELECT * FROM table2WithTriggers"); String[][] expected = {{"1", "1"}, {"1", "2"}, {"1", "3"}, {"1", "4"}}; JDBC.assertFullResultSet(rs, expected, true); stmt.close(); }
void function() throws SQLException { createTable1WithTrigger(); Statement stmt = createStatement( ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); String[][] original = {{"1", "1"}, {"2", "2"}, {"3", "3"}, {"4", "4"}}; JDBC.assertFullResultSet( stmt.executeQuery(STR), original, true); ResultSet rs = stmt.executeQuery( STR); assertTrue(STR, rs.next()); assertEquals(STR, 2, rs.getInt(1)); rs.updateLong(2,2); rs.updateRow(); try { assertFalse(STR, rs.next()); rs.updateRow(); fail(STR + STR + STR); } catch (SQLException e) { String sqlState = usingEmbedded() ? "24000" : "XJ121"; assertSQLState(sqlState, e); } rs.close(); rs = stmt.executeQuery(STR); String[][] expected = {{"1", "1"}, {"1", "2"}, {"1", "3"}, {"1", "4"}}; JDBC.assertFullResultSet(rs, expected, true); stmt.close(); }
/** * Positive test - Another test case for update trigger */
Positive test - Another test case for update trigger
testUpdateRowWithTriggerChangingRS
{ "repo_name": "trejkaz/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdatableResultSetTest.java", "license": "apache-2.0", "size": 214498 }
[ "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Statement", "org.apache.derbyTesting.junit.JDBC" ]
import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.apache.derbyTesting.junit.JDBC;
import java.sql.*; import org.apache.*;
[ "java.sql", "org.apache" ]
java.sql; org.apache;
1,812,779
public ArrayList<String> updateFile(){ try { PrintStream input = new PrintStream(file); for(String a:body){ input.println(a); } input.close(); } catch (Exception e) { System.out.println("Error Updating File..."); e.printStackTrace(); } return body; }
ArrayList<String> function(){ try { PrintStream input = new PrintStream(file); for(String a:body){ input.println(a); } input.close(); } catch (Exception e) { System.out.println(STR); e.printStackTrace(); } return body; }
/** * Sets the text in memory, to the file on the hard disk. * @return An ArrayList<String> of all the text in the file, line by line, in increasing order from 0; */
Sets the text in memory, to the file on the hard disk
updateFile
{ "repo_name": "bgsteiner/living-building", "path": "src/com/gmail/mooman219/build/config/FileIO.java", "license": "gpl-3.0", "size": 11642 }
[ "java.io.PrintStream", "java.util.ArrayList" ]
import java.io.PrintStream; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,518,411
private static boolean checkRootMethod2() { String[] paths = { "/system/app/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su", "/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su", "/system/bin/failsafe/su", "/data/local/su", "/su/bin/su"}; for (String path : paths) { try { if (new File(path).exists()) { return true; } } catch (Exception e){} } return false; }
static boolean function() { String[] paths = { STR, STR, STR, STR, STR, STR, STR, STR, STR, STR}; for (String path : paths) { try { if (new File(path).exists()) { return true; } } catch (Exception e){} } return false; }
/** * Check if a device is rooted * @return */
Check if a device is rooted
checkRootMethod2
{ "repo_name": "PGMacDesign/PGMacUtilities", "path": "library/src/main/java/com/pgmacdesign/pgmactips/utilities/SystemUtilities.java", "license": "apache-2.0", "size": 12958 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,917,771
public List<String> getClusterPoliciesNamesByPolicyUnitId(Guid policyUnitId) { List<String> list = new ArrayList<>(); final PolicyUnitImpl policyUnitImpl = policyUnits.get(policyUnitId); if (policyUnitImpl == null) { log.warn("Trying to find usages of non-existing policy unit '{}'", policyUnitId); return null; } PolicyUnit policyUnit = policyUnitImpl.getPolicyUnit(); if (policyUnit != null) { for (ClusterPolicy clusterPolicy : policyMap.values()) { switch (policyUnit.getPolicyUnitType()) { case FILTER: Collection<Guid> filters = clusterPolicy.getFilters(); if (filters != null && filters.contains(policyUnitId)) { list.add(clusterPolicy.getName()); } break; case WEIGHT: Collection<Pair<Guid, Integer>> functions = clusterPolicy.getFunctions(); if (functions == null) { break; } for (Pair<Guid, Integer> pair : functions) { if (pair.getFirst().equals(policyUnitId)) { list.add(clusterPolicy.getName()); break; } } break; case LOAD_BALANCING: if (policyUnitId.equals(clusterPolicy.getBalance())) { list.add(clusterPolicy.getName()); } break; default: break; } } } return list; }
List<String> function(Guid policyUnitId) { List<String> list = new ArrayList<>(); final PolicyUnitImpl policyUnitImpl = policyUnits.get(policyUnitId); if (policyUnitImpl == null) { log.warn(STR, policyUnitId); return null; } PolicyUnit policyUnit = policyUnitImpl.getPolicyUnit(); if (policyUnit != null) { for (ClusterPolicy clusterPolicy : policyMap.values()) { switch (policyUnit.getPolicyUnitType()) { case FILTER: Collection<Guid> filters = clusterPolicy.getFilters(); if (filters != null && filters.contains(policyUnitId)) { list.add(clusterPolicy.getName()); } break; case WEIGHT: Collection<Pair<Guid, Integer>> functions = clusterPolicy.getFunctions(); if (functions == null) { break; } for (Pair<Guid, Integer> pair : functions) { if (pair.getFirst().equals(policyUnitId)) { list.add(clusterPolicy.getName()); break; } } break; case LOAD_BALANCING: if (policyUnitId.equals(clusterPolicy.getBalance())) { list.add(clusterPolicy.getName()); } break; default: break; } } } return list; }
/** * returns all cluster policies names containing the specific policy unit. * @return List of cluster policy names that use the referenced policyUnitId * or null if the policy unit is not available. */
returns all cluster policies names containing the specific policy unit
getClusterPoliciesNamesByPolicyUnitId
{ "repo_name": "OpenUniversity/ovirt-engine", "path": "backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java", "license": "apache-2.0", "size": 43213 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.List", "org.ovirt.engine.core.common.scheduling.ClusterPolicy", "org.ovirt.engine.core.common.scheduling.PolicyUnit", "org.ovirt.engine.core.common.utils.Pair", "org.ovirt.engine.core.compat.Guid" ]
import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.ovirt.engine.core.common.scheduling.ClusterPolicy; import org.ovirt.engine.core.common.scheduling.PolicyUnit; import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.compat.Guid;
import java.util.*; import org.ovirt.engine.core.common.scheduling.*; import org.ovirt.engine.core.common.utils.*; import org.ovirt.engine.core.compat.*;
[ "java.util", "org.ovirt.engine" ]
java.util; org.ovirt.engine;
1,179,748
private Book findNext() { while (it.hasNext()) { Book book = it.next(); if (filter == null || filter.test(book)) { return book; } } return null; } private Book next; private Iterator<Book> it; private BookFilter filter;
Book function() { while (it.hasNext()) { Book book = it.next(); if (filter == null filter.test(book)) { return book; } } return null; } private Book next; private Iterator<Book> it; private BookFilter filter;
/** * Find the next (if there is one) */
Find the next (if there is one)
findNext
{ "repo_name": "truhanen/JSana", "path": "JSana/src_others/org/crosswire/jsword/book/BookFilterIterator.java", "license": "gpl-2.0", "size": 2839 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
232,040
GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 1; JPanel allVPPanel = new JPanel(new GridBagLayout()); ConnectionInformation information = ConnectionModelConverter.getConnection(connectionModel); final ObservableList<ValueProviderModel> valueProviders = connectionModel.valueProvidersProperty(); for (ValueProvider valueProvider : valueProviders) { if (allVPPanel.getComponentCount() > 0) { final Insets insets = gbc.insets; gbc.insets = new Insets(0, 16, 0, 0); allVPPanel.add(new JSeparator(), gbc); gbc.insets = insets; } allVPPanel.add(createVPPanel(valueProvider, information), gbc); } gbc.weighty = 1; allVPPanel.add(new JPanel(), gbc); JPanel toTheLeft = new JPanel(); toTheLeft.setLayout(new BorderLayout()); toTheLeft.add(allVPPanel, BorderLayout.CENTER); final ExtendedJScrollPane scrollPane = new ExtendedJScrollPane(toTheLeft); scrollPane.setBorder(null); return scrollPane; } /** * Create a panel to see the configuration for the given {@link ValueProvider}
GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 1; JPanel allVPPanel = new JPanel(new GridBagLayout()); ConnectionInformation information = ConnectionModelConverter.getConnection(connectionModel); final ObservableList<ValueProviderModel> valueProviders = connectionModel.valueProvidersProperty(); for (ValueProvider valueProvider : valueProviders) { if (allVPPanel.getComponentCount() > 0) { final Insets insets = gbc.insets; gbc.insets = new Insets(0, 16, 0, 0); allVPPanel.add(new JSeparator(), gbc); gbc.insets = insets; } allVPPanel.add(createVPPanel(valueProvider, information), gbc); } gbc.weighty = 1; allVPPanel.add(new JPanel(), gbc); JPanel toTheLeft = new JPanel(); toTheLeft.setLayout(new BorderLayout()); toTheLeft.add(allVPPanel, BorderLayout.CENTER); final ExtendedJScrollPane scrollPane = new ExtendedJScrollPane(toTheLeft); scrollPane.setBorder(null); return scrollPane; } /** * Create a panel to see the configuration for the given {@link ValueProvider}
/** * Create a panel that contains all the {@link ValueProvider ValueProviders} and their configuration, depending on * the connectionModel they are editable * * @return a scrollable panel */
Create a panel that contains all the <code>ValueProvider ValueProviders</code> and their configuration, depending on the connectionModel they are editable
createConfigurationPanel
{ "repo_name": "rapidminer/rapidminer-studio", "path": "src/main/java/com/rapidminer/connection/gui/components/ConnectionSourcesPanel.java", "license": "agpl-3.0", "size": 9404 }
[ "com.rapidminer.connection.ConnectionInformation", "com.rapidminer.connection.gui.model.ConnectionModelConverter", "com.rapidminer.connection.gui.model.ValueProviderModel", "com.rapidminer.connection.valueprovider.ValueProvider", "com.rapidminer.gui.tools.ExtendedJScrollPane", "java.awt.BorderLayout", "...
import com.rapidminer.connection.ConnectionInformation; import com.rapidminer.connection.gui.model.ConnectionModelConverter; import com.rapidminer.connection.gui.model.ValueProviderModel; import com.rapidminer.connection.valueprovider.ValueProvider; import com.rapidminer.gui.tools.ExtendedJScrollPane; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JPanel; import javax.swing.JSeparator;
import com.rapidminer.connection.*; import com.rapidminer.connection.gui.model.*; import com.rapidminer.connection.valueprovider.*; import com.rapidminer.gui.tools.*; import java.awt.*; import javax.swing.*;
[ "com.rapidminer.connection", "com.rapidminer.gui", "java.awt", "javax.swing" ]
com.rapidminer.connection; com.rapidminer.gui; java.awt; javax.swing;
1,130,199
public static Bitmap drawableToBitmap(Drawable d) { return d == null ? null : ((BitmapDrawable) d).getBitmap(); }
static Bitmap function(Drawable d) { return d == null ? null : ((BitmapDrawable) d).getBitmap(); }
/** * convert Drawable to Bitmap * * @param d * @return */
convert Drawable to Bitmap
drawableToBitmap
{ "repo_name": "suzhugen/androidOddosonLibrary", "path": "src/com/oddoson/android/common/image/ImageUtils.java", "license": "apache-2.0", "size": 7989 }
[ "android.graphics.Bitmap", "android.graphics.drawable.BitmapDrawable", "android.graphics.drawable.Drawable" ]
import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable;
import android.graphics.*; import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
1,377,393
public TrmProperty getProperty(Long propertyId) throws Exception;
TrmProperty function(Long propertyId) throws Exception;
/** * Returns the property with specified id * * @param propertyId * Id of the property saved in 'properties' table in DB * @return Property with specified id * @throws Exception */
Returns the property with specified id
getProperty
{ "repo_name": "ishubin/oculus-frontend", "path": "src/main/java/net/mindengine/oculus/frontend/service/trm/TrmDAO.java", "license": "gpl-3.0", "size": 7179 }
[ "net.mindengine.oculus.frontend.domain.trm.TrmProperty" ]
import net.mindengine.oculus.frontend.domain.trm.TrmProperty;
import net.mindengine.oculus.frontend.domain.trm.*;
[ "net.mindengine.oculus" ]
net.mindengine.oculus;
2,010,033
@Test public void whenCacheIsFull_thenPutOnSameKeyShouldUpdateValue_withUpdateOnDataAdapter() { final int size = DEFAULT_RECORD_COUNT / 2; setEvictionConfig(nearCacheConfig, NONE, ENTRY_COUNT, size); nearCacheConfig.setInvalidateOnChange(true); final NearCacheTestContext<Integer, String, NK, NV> context = createContext(); populateMap(context); populateNearCache(context); assertEquals(size, context.nearCache.size()); assertEquals("value-1", context.nearCacheAdapter.get(1)); context.dataAdapter.put(1, "newValue");
void function() { final int size = DEFAULT_RECORD_COUNT / 2; setEvictionConfig(nearCacheConfig, NONE, ENTRY_COUNT, size); nearCacheConfig.setInvalidateOnChange(true); final NearCacheTestContext<Integer, String, NK, NV> context = createContext(); populateMap(context); populateNearCache(context); assertEquals(size, context.nearCache.size()); assertEquals(STR, context.nearCacheAdapter.get(1)); context.dataAdapter.put(1, STR);
/** * Checks that the Near Cache updates value for keys which are already in the Near Cache, * even if the Near Cache is full an the eviction is disabled (via {@link com.hazelcast.config.EvictionPolicy#NONE}. * * This variant uses the {@link NearCacheTestContext#dataAdapter}, so we need to configure Near Cache invalidation. */
Checks that the Near Cache updates value for keys which are already in the Near Cache, even if the Near Cache is full an the eviction is disabled (via <code>com.hazelcast.config.EvictionPolicy#NONE</code>. This variant uses the <code>NearCacheTestContext#dataAdapter</code>, so we need to configure Near Cache invalidation
whenCacheIsFull_thenPutOnSameKeyShouldUpdateValue_withUpdateOnDataAdapter
{ "repo_name": "lmjacksoniii/hazelcast", "path": "hazelcast/src/test/java/com/hazelcast/internal/nearcache/AbstractBasicNearCacheTest.java", "license": "apache-2.0", "size": 17815 }
[ "com.hazelcast.internal.nearcache.NearCacheTestUtils", "org.junit.Assert" ]
import com.hazelcast.internal.nearcache.NearCacheTestUtils; import org.junit.Assert;
import com.hazelcast.internal.nearcache.*; import org.junit.*;
[ "com.hazelcast.internal", "org.junit" ]
com.hazelcast.internal; org.junit;
1,779,135
public void shutDownConnections() throws YarnException { for (String uamId : this.unmanagedAppMasterMap.keySet()) { shutDownConnections(uamId); } }
void function() throws YarnException { for (String uamId : this.unmanagedAppMasterMap.keySet()) { shutDownConnections(uamId); } }
/** * Shutdown all UAM clients without killing them in YarnRM. * * @throws YarnException if fails */
Shutdown all UAM clients without killing them in YarnRM
shutDownConnections
{ "repo_name": "nandakumar131/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/uam/UnmanagedAMPoolManager.java", "license": "apache-2.0", "size": 16911 }
[ "org.apache.hadoop.yarn.exceptions.YarnException" ]
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
144,753
public VirtualNetworkTapInner updateTags(String resourceGroupName, String tapName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, tapName, tags).toBlocking().last().body(); }
VirtualNetworkTapInner function(String resourceGroupName, String tapName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, tapName, tags).toBlocking().last().body(); }
/** * Updates an VirtualNetworkTap tags. * * @param resourceGroupName The name of the resource group. * @param tapName The name of the tap. * @param tags Resource tags. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the VirtualNetworkTapInner object if successful. */
Updates an VirtualNetworkTap tags
updateTags
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/VirtualNetworkTapsInner.java", "license": "mit", "size": 72534 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
373,399
static private ScanCostReport estimateCost(final ILocalBTreeView view, final long rangeCount, final byte[] fromKey, final byte[] toKey) { double cost = 0d; final AbstractBTree[] sources = view.getSources(); for (AbstractBTree source : sources) { final IBTreeStatistics stats = source.getStatistics(); // fast range count on that source. final long sourceRangeCount = source.rangeCount(fromKey, toKey); if (source instanceof IndexSegment) { // Cost for an index segment based on multi-block IO. final IndexSegment seg = (IndexSegment) source; final long extentLeaves = seg.getStore().getCheckpoint().extentLeaves; final long leafCount = stats.getLeafCount(); // Note: bytesPerLeaf is never more than an int32 value! final int bytesPerLeaf = (int) Math .ceil(((double) extentLeaves) / leafCount); cost += new IndexSegmentCostModel(diskCostModel).rangeScan( (int) sourceRangeCount, stats.getBranchingFactor(), bytesPerLeaf, DirectBufferPool.INSTANCE .getBufferCapacity()); } else { // Cost for a B+Tree based on random seek per node/leaf. cost += new BTreeCostModel(diskCostModel).rangeScan( sourceRangeCount, stats.getBranchingFactor(), stats .getHeight(), stats.getUtilization() .getLeafUtilization()); } } // @todo pass details per source back in the cost report. return new ScanCostReport(rangeCount, cost); }
static ScanCostReport function(final ILocalBTreeView view, final long rangeCount, final byte[] fromKey, final byte[] toKey) { double cost = 0d; final AbstractBTree[] sources = view.getSources(); for (AbstractBTree source : sources) { final IBTreeStatistics stats = source.getStatistics(); final long sourceRangeCount = source.rangeCount(fromKey, toKey); if (source instanceof IndexSegment) { final IndexSegment seg = (IndexSegment) source; final long extentLeaves = seg.getStore().getCheckpoint().extentLeaves; final long leafCount = stats.getLeafCount(); final int bytesPerLeaf = (int) Math .ceil(((double) extentLeaves) / leafCount); cost += new IndexSegmentCostModel(diskCostModel).rangeScan( (int) sourceRangeCount, stats.getBranchingFactor(), bytesPerLeaf, DirectBufferPool.INSTANCE .getBufferCapacity()); } else { cost += new BTreeCostModel(diskCostModel).rangeScan( sourceRangeCount, stats.getBranchingFactor(), stats .getHeight(), stats.getUtilization() .getLeafUtilization()); } } return new ScanCostReport(rangeCount, cost); }
/** * Return the estimated cost of a key-range scan for a local B+Tree view. * This handles both {@link IsolatedFusedView} (transactions) and * {@link FusedView} (shards). * * @param view * The view. * * @return The estimated cost. */
Return the estimated cost of a key-range scan for a local B+Tree view. This handles both <code>IsolatedFusedView</code> (transactions) and <code>FusedView</code> (shards)
estimateCost
{ "repo_name": "blazegraph/database", "path": "bigdata-core/bigdata/src/java/com/bigdata/relation/accesspath/AccessPath.java", "license": "gpl-2.0", "size": 60814 }
[ "com.bigdata.bop.cost.BTreeCostModel", "com.bigdata.bop.cost.IndexSegmentCostModel", "com.bigdata.bop.cost.ScanCostReport", "com.bigdata.btree.AbstractBTree", "com.bigdata.btree.IBTreeStatistics", "com.bigdata.btree.ILocalBTreeView", "com.bigdata.btree.IndexSegment", "com.bigdata.io.DirectBufferPool" ...
import com.bigdata.bop.cost.BTreeCostModel; import com.bigdata.bop.cost.IndexSegmentCostModel; import com.bigdata.bop.cost.ScanCostReport; import com.bigdata.btree.AbstractBTree; import com.bigdata.btree.IBTreeStatistics; import com.bigdata.btree.ILocalBTreeView; import com.bigdata.btree.IndexSegment; import com.bigdata.io.DirectBufferPool;
import com.bigdata.bop.cost.*; import com.bigdata.btree.*; import com.bigdata.io.*;
[ "com.bigdata.bop", "com.bigdata.btree", "com.bigdata.io" ]
com.bigdata.bop; com.bigdata.btree; com.bigdata.io;
2,194,903
private UserRow userDetail2UserRow(UserDetail user) { UserRow ur = new UserRow(); ur.id = idAsInt(user.getId()); ur.specificId = user.getSpecificId(); ur.domainId = idAsInt(user.getDomainId()); ur.login = user.getLogin(); ur.firstName = user.getFirstName(); ur.lastName = user.getLastName(); ur.eMail = user.geteMail(); ur.accessLevel = user.getAccessLevel().code(); ur.loginQuestion = user.getLoginQuestion(); ur.loginAnswer = user.getLoginAnswer(); ur.creationDate = user.getCreationDate(); ur.saveDate = user.getSaveDate(); ur.version = user.getVersion(); ur.tosAcceptanceDate = user.getTosAcceptanceDate(); ur.lastLoginDate = user.getLastLoginDate(); ur.nbSuccessfulLoginAttempts = user.getNbSuccessfulLoginAttempts(); ur.lastLoginCredentialUpdateDate = user.getLastLoginCredentialUpdateDate(); ur.expirationDate = user.getExpirationDate(); ur.state = user.getState().name(); ur.stateSaveDate = user.getStateSaveDate(); ur.notifManualReceiverLimit = user.getNotifManualReceiverLimit(); return ur; }
UserRow function(UserDetail user) { UserRow ur = new UserRow(); ur.id = idAsInt(user.getId()); ur.specificId = user.getSpecificId(); ur.domainId = idAsInt(user.getDomainId()); ur.login = user.getLogin(); ur.firstName = user.getFirstName(); ur.lastName = user.getLastName(); ur.eMail = user.geteMail(); ur.accessLevel = user.getAccessLevel().code(); ur.loginQuestion = user.getLoginQuestion(); ur.loginAnswer = user.getLoginAnswer(); ur.creationDate = user.getCreationDate(); ur.saveDate = user.getSaveDate(); ur.version = user.getVersion(); ur.tosAcceptanceDate = user.getTosAcceptanceDate(); ur.lastLoginDate = user.getLastLoginDate(); ur.nbSuccessfulLoginAttempts = user.getNbSuccessfulLoginAttempts(); ur.lastLoginCredentialUpdateDate = user.getLastLoginCredentialUpdateDate(); ur.expirationDate = user.getExpirationDate(); ur.state = user.getState().name(); ur.stateSaveDate = user.getStateSaveDate(); ur.notifManualReceiverLimit = user.getNotifManualReceiverLimit(); return ur; }
/** * Convert UserDetail to UserRow */
Convert UserDetail to UserRow
userDetail2UserRow
{ "repo_name": "ebonnet/Silverpeas-Core", "path": "core-library/src/main/java/org/silverpeas/core/admin/user/UserManager.java", "license": "agpl-3.0", "size": 32426 }
[ "org.silverpeas.core.admin.persistence.UserRow", "org.silverpeas.core.admin.user.model.UserDetail" ]
import org.silverpeas.core.admin.persistence.UserRow; import org.silverpeas.core.admin.user.model.UserDetail;
import org.silverpeas.core.admin.persistence.*; import org.silverpeas.core.admin.user.model.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
304,561
public void setProgramWorkflowDAO(ProgramWorkflowDAO dao); // ************************** // PROGRAM // **************************
void function(ProgramWorkflowDAO dao);
/** * Setter for the ProgramWorkflow DataAccessObject (DAO). The DAO is used for saving and * retrieving from the database * * @param dao - The DAO for this service */
Setter for the ProgramWorkflow DataAccessObject (DAO). The DAO is used for saving and retrieving from the database
setProgramWorkflowDAO
{ "repo_name": "shiangree/openmrs-core", "path": "api/src/main/java/org/openmrs/api/ProgramWorkflowService.java", "license": "mpl-2.0", "size": 43017 }
[ "org.openmrs.api.db.ProgramWorkflowDAO" ]
import org.openmrs.api.db.ProgramWorkflowDAO;
import org.openmrs.api.db.*;
[ "org.openmrs.api" ]
org.openmrs.api;
1,991,628
public List<AiMeshAnim> getMeshChannels() { throw new UnsupportedOperationException("not implemented yet"); } private final String m_name; private final double m_duration; private final double m_ticksPerSecond; private final List<AiNodeAnim> m_nodeAnims = new ArrayList<AiNodeAnim>();
List<AiMeshAnim> function() { throw new UnsupportedOperationException(STR); } private final String m_name; private final double m_duration; private final double m_ticksPerSecond; private final List<AiNodeAnim> m_nodeAnims = new ArrayList<AiNodeAnim>();
/** * Returns the list of mesh animation channels.<p> * * Each channel affects a single mesh. * * @return the list of mesh animation channels */
Returns the list of mesh animation channels. Each channel affects a single mesh
getMeshChannels
{ "repo_name": "danke-sra/GearVRf", "path": "GVRf/Framework/src/org/gearvrf/jassimp2/AiAnimation.java", "license": "apache-2.0", "size": 5204 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,814,421
Set<String> propertyNames();
Set<String> propertyNames();
/** * Returns all the names this endpoint supports. */
Returns all the names this endpoint supports
propertyNames
{ "repo_name": "alvinkwekel/camel", "path": "core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java", "license": "apache-2.0", "size": 2013 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
608,896
private void generateEdgeReport(StringBuilder builder, Name referencedDecl, DiGraphEdge<Name, Reference> edge) { String srcDeclName = referencedDecl.getQualifiedName(); builder.append("<li><A HREF=\"#" + srcDeclName + "\">"); builder.append(srcDeclName); builder.append("</a> "); Node def = edge.getValue().getSite(); int lineNumber = def.getLineno(); int columnNumber = def.getCharno(); String sourceFile = getSourceFile(def); generateSourceReferenceLink(builder, sourceFile, lineNumber, columnNumber); JSType defType = edge.getValue().getSite().getJSType(); generateType(builder, defType); }
void function(StringBuilder builder, Name referencedDecl, DiGraphEdge<Name, Reference> edge) { String srcDeclName = referencedDecl.getQualifiedName(); builder.append(STR#STR\">"); builder.append(srcDeclName); builder.append(STR); Node def = edge.getValue().getSite(); int lineNumber = def.getLineno(); int columnNumber = def.getCharno(); String sourceFile = getSourceFile(def); generateSourceReferenceLink(builder, sourceFile, lineNumber, columnNumber); JSType defType = edge.getValue().getSite().getJSType(); generateType(builder, defType); }
/** * Generate a description of a specific edge between two nodes. * For each edge, name the element being linked, the location of the * reference in the source file, and the type of the reference. * * @param builder contents of the report to be generated * @param referencedDecl name of the declaration being referenced * @param edge the graph edge being described */
Generate a description of a specific edge between two nodes. For each edge, name the element being linked, the location of the reference in the source file, and the type of the reference
generateEdgeReport
{ "repo_name": "antz29/closure-compiler", "path": "src/com/google/javascript/jscomp/NameReferenceGraphReport.java", "license": "apache-2.0", "size": 10697 }
[ "com.google.javascript.jscomp.NameReferenceGraph", "com.google.javascript.jscomp.graph.DiGraph", "com.google.javascript.rhino.Node", "com.google.javascript.rhino.jstype.JSType" ]
import com.google.javascript.jscomp.NameReferenceGraph; import com.google.javascript.jscomp.graph.DiGraph; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.jstype.JSType;
import com.google.javascript.jscomp.*; import com.google.javascript.jscomp.graph.*; import com.google.javascript.rhino.*; import com.google.javascript.rhino.jstype.*;
[ "com.google.javascript" ]
com.google.javascript;
1,147,308
public static void rotate(Vector2 v, float angle, boolean precise) { if (precise) { v.rotate(angle); } else { float cos = cos(angle); float sin = sin(angle); float newX = v.x * cos - v.y * sin; float newY = v.x * sin + v.y * cos; v.x = newX; v.y = newY; } }
static void function(Vector2 v, float angle, boolean precise) { if (precise) { v.rotate(angle); } else { float cos = cos(angle); float sin = sin(angle); float newX = v.x * cos - v.y * sin; float newY = v.x * sin + v.y * cos; v.x = newX; v.y = newY; } }
/** * rotates a vector to an angle. if not precise, works faster, but the actual angle might slightly differ from the given one */
rotates a vector to an angle. if not precise, works faster, but the actual angle might slightly differ from the given one
rotate
{ "repo_name": "Sigma-One/DestinationSol", "path": "engine/src/main/java/org/destinationsol/common/SolMath.java", "license": "apache-2.0", "size": 14666 }
[ "com.badlogic.gdx.math.Vector2" ]
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
938,684
private Element createElement(Document doc, String tagName, String elementText, Attribute... attribs) { Element el = doc.createElementNS(Schemas.SCHEMA_LATEST.namespace, tagName); for (Attribute a : attribs) { el.setAttribute(a.getName(), a.getValue()); } if (elementText != null) { Text text = doc.createTextNode(elementText); el.appendChild(text); } return el; }
Element function(Document doc, String tagName, String elementText, Attribute... attribs) { Element el = doc.createElementNS(Schemas.SCHEMA_LATEST.namespace, tagName); for (Attribute a : attribs) { el.setAttribute(a.getName(), a.getValue()); } if (elementText != null) { Text text = doc.createTextNode(elementText); el.appendChild(text); } return el; }
/** * Creates an element and set the value of its attributes * */
Creates an element and set the value of its attributes
createElement
{ "repo_name": "youribonnaffe/scheduling", "path": "scheduler/scheduler-api/src/main/java/org/ow2/proactive/scheduler/common/job/factories/Job2XMLTransformer.java", "license": "agpl-3.0", "size": 37936 }
[ "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Text" ]
import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,035,149
public String getAttributeName(long id) throws SnmpStatusException { switch((int)id) { case 2: return "JvmRTClassPathItem"; case 1: return "JvmRTClassPathIndex"; default: break; } throw new SnmpStatusException(SnmpStatusException.noSuchObject); } protected JvmRTClassPathEntryMBean node; protected SnmpStandardObjectServer objectserver = null;
String function(long id) throws SnmpStatusException { switch((int)id) { case 2: return STR; case 1: return STR; default: break; } throw new SnmpStatusException(SnmpStatusException.noSuchObject); } protected JvmRTClassPathEntryMBean node; protected SnmpStandardObjectServer objectserver = null;
/** * Return the name of the attribute corresponding to the SNMP variable identified by "id". */
Return the name of the attribute corresponding to the SNMP variable identified by "id"
getAttributeName
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmRTClassPathEntryMeta.java", "license": "gpl-2.0", "size": 7751 }
[ "com.sun.jmx.snmp.SnmpStatusException", "com.sun.jmx.snmp.agent.SnmpStandardObjectServer" ]
import com.sun.jmx.snmp.SnmpStatusException; import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.*; import com.sun.jmx.snmp.agent.*;
[ "com.sun.jmx" ]
com.sun.jmx;
2,156,478
@RequestMapping(value = { CMC.D_ADD_OBJECTS_TO_PLUGIN_FILES_GET }, method = RequestMethod.GET) public String addObjectsToPluginGet(@PathVariable Long pluginId, Model model) { Plugin plugin = new Plugin().getModelObject(Plugin.class, pluginId); // Create new form bean with default values. DevAddObjectsToPluginFormBean devAddObjectsToPluginFormBean = new DevAddObjectsToPluginFormBean(plugin); model.addAttribute("plugin", plugin); model.addAttribute("devAddObjectsToPluginFormBean", devAddObjectsToPluginFormBean); model.addAttribute("pluginObjectAssociations", new PluginObjectAssociation().getAllForPlugin(pluginId)); return "/developing/addObjectsToPlugin.jsp"; }
@RequestMapping(value = { CMC.D_ADD_OBJECTS_TO_PLUGIN_FILES_GET }, method = RequestMethod.GET) String function(@PathVariable Long pluginId, Model model) { Plugin plugin = new Plugin().getModelObject(Plugin.class, pluginId); DevAddObjectsToPluginFormBean devAddObjectsToPluginFormBean = new DevAddObjectsToPluginFormBean(plugin); model.addAttribute(STR, plugin); model.addAttribute(STR, devAddObjectsToPluginFormBean); model.addAttribute(STR, new PluginObjectAssociation().getAllForPlugin(pluginId)); return STR; }
/** * This REST method takes the developer to the page to define the plugin, so * they can view and make edits (if necessary) to the plugin definition. * * @param pluginId Id of the plugin to add objects to * @param model Model to hold objects for the view. * @return path to jsp file */
This REST method takes the developer to the page to define the plugin, so they can view and make edits (if necessary) to the plugin definition
addObjectsToPluginGet
{ "repo_name": "skipcole/SeaChangePlatform", "path": "src/main/java/com/seachangesimulations/platform/controllers/DeveloperController.java", "license": "mit", "size": 13459 }
[ "com.seachangesimulations.platform.domain.Plugin", "com.seachangesimulations.platform.mvc.formbeans.developer.DevAddObjectsToPluginFormBean", "com.seachangesimulations.platform.pluginobjects.PluginObjectAssociation", "org.springframework.ui.Model", "org.springframework.web.bind.annotation.PathVariable", "...
import com.seachangesimulations.platform.domain.Plugin; import com.seachangesimulations.platform.mvc.formbeans.developer.DevAddObjectsToPluginFormBean; import com.seachangesimulations.platform.pluginobjects.PluginObjectAssociation; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import com.seachangesimulations.platform.domain.*; import com.seachangesimulations.platform.mvc.formbeans.developer.*; import com.seachangesimulations.platform.pluginobjects.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*;
[ "com.seachangesimulations.platform", "org.springframework.ui", "org.springframework.web" ]
com.seachangesimulations.platform; org.springframework.ui; org.springframework.web;
1,360,514
@Test public void testSelectDistinctWithDeletions() throws Throwable { createTable("CREATE TABLE %s (k int PRIMARY KEY, c int, v int)"); for (int i = 0; i < 10; i++) execute("INSERT INTO %s (k, c, v) VALUES (?, ?, ?)", i, i, i); Object[][] rows = getRows(execute("SELECT DISTINCT k FROM %s")); Assert.assertEquals(10, rows.length); Object key_to_delete = rows[3][0]; execute("DELETE FROM %s WHERE k=?", key_to_delete); rows = getRows(execute("SELECT DISTINCT k FROM %s")); Assert.assertEquals(9, rows.length); rows = getRows(execute("SELECT DISTINCT k FROM %s LIMIT 5")); Assert.assertEquals(5, rows.length); rows = getRows(execute("SELECT DISTINCT k FROM %s")); Assert.assertEquals(9, rows.length); }
void function() throws Throwable { createTable(STR); for (int i = 0; i < 10; i++) execute(STR, i, i, i); Object[][] rows = getRows(execute(STR)); Assert.assertEquals(10, rows.length); Object key_to_delete = rows[3][0]; execute(STR, key_to_delete); rows = getRows(execute(STR)); Assert.assertEquals(9, rows.length); rows = getRows(execute(STR)); Assert.assertEquals(5, rows.length); rows = getRows(execute(STR)); Assert.assertEquals(9, rows.length); }
/** * Migrated from cql_tests.py:TestCQL.select_distinct_with_deletions_test() */
Migrated from cql_tests.py:TestCQL.select_distinct_with_deletions_test()
testSelectDistinctWithDeletions
{ "repo_name": "mourao666/cassandra-sim", "path": "test/unit/org/apache/cassandra/cql3/validation/operations/SelectTest.java", "license": "apache-2.0", "size": 57348 }
[ "junit.framework.Assert", "org.junit.Assert" ]
import junit.framework.Assert; import org.junit.Assert;
import junit.framework.*; import org.junit.*;
[ "junit.framework", "org.junit" ]
junit.framework; org.junit;
475,249
protected void indentifySurvivors(){ if( population == null ) return; for( int i = 0; i < descendants.size(); ++i ){ Chromosome desc = descendants.get( i ); boolean identified = false; for( Chromosome ch : population ){ if( desc.getSize() != ch.getSize() ) continue; //not a likely case, however not disclosed boolean same = true; for( int j = 0; j < ch.getSize(); ++j ){ if( !desc.geneAt( j ).getValue().equals( ch.geneAt( j ).getValue() ) ){ same = false; break; } } if( same ){ desc.setFitness( ch.getFitness() ); identified = true; break; } } if( !identified ) desc.setFitness( Double.NaN ); //set new solution's fitness to NaN } }
void function(){ if( population == null ) return; for( int i = 0; i < descendants.size(); ++i ){ Chromosome desc = descendants.get( i ); boolean identified = false; for( Chromosome ch : population ){ if( desc.getSize() != ch.getSize() ) continue; boolean same = true; for( int j = 0; j < ch.getSize(); ++j ){ if( !desc.geneAt( j ).getValue().equals( ch.geneAt( j ).getValue() ) ){ same = false; break; } } if( same ){ desc.setFitness( ch.getFitness() ); identified = true; break; } } if( !identified ) desc.setFitness( Double.NaN ); } }
/** * Identifies the chromosomes that are unaltered in the next population, * and sets their fintess to the stored fitness value. */
Identifies the chromosomes that are unaltered in the next population, and sets their fintess to the stored fitness value
indentifySurvivors
{ "repo_name": "lgulyas/MEME", "path": "Plugins/intellisweepPlugin/ai/aitia/meme/paramsweep/intellisweepPlugin/DummyGAPlugin.java", "license": "gpl-3.0", "size": 73117 }
[ "ai.aitia.meme.paramsweep.intellisweepPlugin.utils.ga.Chromosome" ]
import ai.aitia.meme.paramsweep.intellisweepPlugin.utils.ga.Chromosome;
import ai.aitia.meme.paramsweep.*;
[ "ai.aitia.meme" ]
ai.aitia.meme;
1,924,411
public boolean isFriend(String login) { User friend = userService.getUserByLogin(login); return isFriend(friend); }
boolean function(String login) { User friend = userService.getUserByLogin(login); return isFriend(friend); }
/** * Add a friend to the list of friends of the current user */
Add a friend to the list of friends of the current user
isFriend
{ "repo_name": "StexX/KiWi-OSE", "path": "extensions/dashboard/src/kiwi/dashboard/action/ContactsAction.java", "license": "bsd-3-clause", "size": 6337 }
[ "kiwi.model.user.User" ]
import kiwi.model.user.User;
import kiwi.model.user.*;
[ "kiwi.model.user" ]
kiwi.model.user;
448,305
//----------------------------------------------------------------------- public BusinessDayConvention getBusinessDayConvention() { return _businessDayConvention; }
BusinessDayConvention function() { return _businessDayConvention; }
/** * Gets the business day convention. * @return the value of the property */
Gets the business day convention
getBusinessDayConvention
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/convention/BondConvention.java", "license": "apache-2.0", "size": 15650 }
[ "com.opengamma.financial.convention.businessday.BusinessDayConvention" ]
import com.opengamma.financial.convention.businessday.BusinessDayConvention;
import com.opengamma.financial.convention.businessday.*;
[ "com.opengamma.financial" ]
com.opengamma.financial;
1,455,637
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { LookupForm lookupForm = (LookupForm) form; String methodToCall = findMethodToCall(form, request); if (methodToCall.equalsIgnoreCase("search")) { GlobalVariables.getUserSession().removeObjectsByPrefix(KRADConstants.SEARCH_METHOD); } Lookupable kualiLookupable = lookupForm.getLookupable(); if (kualiLookupable == null) { LOG.error("Lookupable is null."); throw new RuntimeException("Lookupable is null."); } Collection displayList = new ArrayList(); ArrayList<ResultRow> resultTable = new ArrayList<ResultRow>(); // validate search parameters kualiLookupable.validateSearchParameters(lookupForm.getFields()); boolean bounded = true; displayList = kualiLookupable.performLookup(lookupForm, resultTable, bounded); if (kualiLookupable.isSearchUsingOnlyPrimaryKeyValues()) { lookupForm.setSearchUsingOnlyPrimaryKeyValues(true); lookupForm.setPrimaryKeyFieldLabels(kualiLookupable.getPrimaryKeyFieldLabels()); } else { lookupForm.setSearchUsingOnlyPrimaryKeyValues(false); lookupForm.setPrimaryKeyFieldLabels(KRADConstants.EMPTY_STRING); } if ( displayList instanceof CollectionIncomplete ){ request.setAttribute("reqSearchResultsActualSize", ((CollectionIncomplete) displayList).getActualSizeIfTruncated()); } else { request.setAttribute("reqSearchResultsActualSize", displayList.size() ); } int resultsLimit = LookupUtils.getSearchResultsLimit(Class.forName(lookupForm.getBusinessObjectClassName())); request.setAttribute("reqSearchResultsLimitedSize", resultsLimit); // Determine if at least one table entry has an action available. If any non-breaking space (&nbsp; or '\u00A0') characters // exist in the URL's value, they will be converted to regular whitespace ('\u0020'). boolean hasActionUrls = false; for (Iterator<ResultRow> iterator = resultTable.iterator(); !hasActionUrls && iterator.hasNext();) { if (StringUtils.isNotBlank(HtmlUtils.htmlUnescape(iterator.next().getActionUrls()).replace('\u00A0', '\u0020'))) { hasActionUrls = true; } } lookupForm.setActionUrlsExist(hasActionUrls); request.setAttribute("reqSearchResults", resultTable); if (request.getParameter(KRADConstants.SEARCH_LIST_REQUEST_KEY) != null) { GlobalVariables.getUserSession().removeObject(request.getParameter(KRADConstants.SEARCH_LIST_REQUEST_KEY)); } request.setAttribute(KRADConstants.SEARCH_LIST_REQUEST_KEY, GlobalVariables.getUserSession().addObjectWithGeneratedKey(resultTable, KRADConstants.SEARCH_LIST_KEY_PREFIX)); request.getParameter(KRADConstants.REFRESH_CALLER); return mapping.findForward(RiceConstants.MAPPING_BASIC); }
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { LookupForm lookupForm = (LookupForm) form; String methodToCall = findMethodToCall(form, request); if (methodToCall.equalsIgnoreCase(STR)) { GlobalVariables.getUserSession().removeObjectsByPrefix(KRADConstants.SEARCH_METHOD); } Lookupable kualiLookupable = lookupForm.getLookupable(); if (kualiLookupable == null) { LOG.error(STR); throw new RuntimeException(STR); } Collection displayList = new ArrayList(); ArrayList<ResultRow> resultTable = new ArrayList<ResultRow>(); kualiLookupable.validateSearchParameters(lookupForm.getFields()); boolean bounded = true; displayList = kualiLookupable.performLookup(lookupForm, resultTable, bounded); if (kualiLookupable.isSearchUsingOnlyPrimaryKeyValues()) { lookupForm.setSearchUsingOnlyPrimaryKeyValues(true); lookupForm.setPrimaryKeyFieldLabels(kualiLookupable.getPrimaryKeyFieldLabels()); } else { lookupForm.setSearchUsingOnlyPrimaryKeyValues(false); lookupForm.setPrimaryKeyFieldLabels(KRADConstants.EMPTY_STRING); } if ( displayList instanceof CollectionIncomplete ){ request.setAttribute(STR, ((CollectionIncomplete) displayList).getActualSizeIfTruncated()); } else { request.setAttribute(STR, displayList.size() ); } int resultsLimit = LookupUtils.getSearchResultsLimit(Class.forName(lookupForm.getBusinessObjectClassName())); request.setAttribute(STR, resultsLimit); boolean hasActionUrls = false; for (Iterator<ResultRow> iterator = resultTable.iterator(); !hasActionUrls && iterator.hasNext();) { if (StringUtils.isNotBlank(HtmlUtils.htmlUnescape(iterator.next().getActionUrls()).replace('\u00A0', '\u0020'))) { hasActionUrls = true; } } lookupForm.setActionUrlsExist(hasActionUrls); request.setAttribute(STR, resultTable); if (request.getParameter(KRADConstants.SEARCH_LIST_REQUEST_KEY) != null) { GlobalVariables.getUserSession().removeObject(request.getParameter(KRADConstants.SEARCH_LIST_REQUEST_KEY)); } request.setAttribute(KRADConstants.SEARCH_LIST_REQUEST_KEY, GlobalVariables.getUserSession().addObjectWithGeneratedKey(resultTable, KRADConstants.SEARCH_LIST_KEY_PREFIX)); request.getParameter(KRADConstants.REFRESH_CALLER); return mapping.findForward(RiceConstants.MAPPING_BASIC); }
/** * search - sets the values of the data entered on the form on the jsp into a map and then searches for the results. */
search - sets the values of the data entered on the form on the jsp into a map and then searches for the results
search
{ "repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua", "path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/web/struts/action/KualiLookupAction.java", "license": "apache-2.0", "size": 17712 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Iterator", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.commons.lang.StringUtils", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.Ac...
import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.rice.core.api.util.RiceConstants; import org.kuali.rice.kns.lookup.LookupUtils; import org.kuali.rice.kns.lookup.Lookupable; import org.kuali.rice.kns.web.struts.form.LookupForm; import org.kuali.rice.kns.web.ui.ResultRow; import org.kuali.rice.krad.lookup.CollectionIncomplete; import org.kuali.rice.krad.util.GlobalVariables; import org.kuali.rice.krad.util.KRADConstants; import org.springframework.web.util.HtmlUtils;
import java.util.*; import javax.servlet.http.*; import org.apache.commons.lang.*; import org.apache.struts.action.*; import org.kuali.rice.core.api.util.*; import org.kuali.rice.kns.lookup.*; import org.kuali.rice.kns.web.struts.form.*; import org.kuali.rice.kns.web.ui.*; import org.kuali.rice.krad.lookup.*; import org.kuali.rice.krad.util.*; import org.springframework.web.util.*;
[ "java.util", "javax.servlet", "org.apache.commons", "org.apache.struts", "org.kuali.rice", "org.springframework.web" ]
java.util; javax.servlet; org.apache.commons; org.apache.struts; org.kuali.rice; org.springframework.web;
1,711,910
public static Class getMapKeyFieldType(Field mapField) { return getGenericFieldType(mapField, Map.class, 0, 1); }
static Class function(Field mapField) { return getGenericFieldType(mapField, Map.class, 0, 1); }
/** * Determine the generic key type of the given Map field. * @param mapField the map field to introspect * @return the generic type, or <code>null</code> if none */
Determine the generic key type of the given Map field
getMapKeyFieldType
{ "repo_name": "cbeams-archive/spring-framework-2.5.x", "path": "src/org/springframework/core/GenericCollectionTypeResolver.java", "license": "apache-2.0", "size": 17219 }
[ "java.lang.reflect.Field", "java.util.Map" ]
import java.lang.reflect.Field; import java.util.Map;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,937,957
public static List<Tree> makeTrees() { return makeTrees(new File("C://Tree1.txt")); } /** * @param string * a string representation of a DCPSE tree * @return the Stanford {@link Tree}
static List<Tree> function() { return makeTrees(new File("C: } /** * @param string * a string representation of a DCPSE tree * @return the Stanford {@link Tree}
/** * For testing: use the default file * * @return the {@link List} of Stanford {@link Tree}s */
For testing: use the default file
makeTrees
{ "repo_name": "Propheis/diasim", "path": "src/qmul/util/parse/CreateTreeFromClarkCurranCcgGrs.java", "license": "gpl-3.0", "size": 11528 }
[ "edu.stanford.nlp.trees.Tree", "java.io.File", "java.util.List" ]
import edu.stanford.nlp.trees.Tree; import java.io.File; import java.util.List;
import edu.stanford.nlp.trees.*; import java.io.*; import java.util.*;
[ "edu.stanford.nlp", "java.io", "java.util" ]
edu.stanford.nlp; java.io; java.util;
2,668,257
public static CloseableModalWindowWrapperController getAndActivatePopupArtefactController(final AbstractArtefact artefact, final UserRequest ureq, final WindowControl wControl, final String title) { EPArtefactViewController artefactCtlr; artefactCtlr = new EPArtefactViewController(ureq, wControl, artefact, true); final CloseableModalWindowWrapperController artefactBox = new CloseableModalWindowWrapperController(ureq, wControl, title, artefactCtlr.getInitialComponent(), "artefactBox" + artefact.getKey()); artefactBox.setInitialWindowSize(600, 500); artefactBox.activate(); return artefactBox; }
static CloseableModalWindowWrapperController function(final AbstractArtefact artefact, final UserRequest ureq, final WindowControl wControl, final String title) { EPArtefactViewController artefactCtlr; artefactCtlr = new EPArtefactViewController(ureq, wControl, artefact, true); final CloseableModalWindowWrapperController artefactBox = new CloseableModalWindowWrapperController(ureq, wControl, title, artefactCtlr.getInitialComponent(), STR + artefact.getKey()); artefactBox.setInitialWindowSize(600, 500); artefactBox.activate(); return artefactBox; }
/** * opens an artefact in an overlay window with all available details in read-only mode * * @param artefact * @param ureq * @param wControl * @param title of the popup * @return a controller to listenTo */
opens an artefact in an overlay window with all available details in read-only mode
getAndActivatePopupArtefactController
{ "repo_name": "RLDevOps/Demo", "path": "src/main/java/org/olat/portfolio/EPUIFactory.java", "license": "apache-2.0", "size": 8082 }
[ "org.olat.core.gui.UserRequest", "org.olat.core.gui.control.WindowControl", "org.olat.core.gui.control.generic.closablewrapper.CloseableModalWindowWrapperController", "org.olat.portfolio.model.artefacts.AbstractArtefact", "org.olat.portfolio.ui.artefacts.view.EPArtefactViewController" ]
import org.olat.core.gui.UserRequest; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalWindowWrapperController; import org.olat.portfolio.model.artefacts.AbstractArtefact; import org.olat.portfolio.ui.artefacts.view.EPArtefactViewController;
import org.olat.core.gui.*; import org.olat.core.gui.control.*; import org.olat.core.gui.control.generic.closablewrapper.*; import org.olat.portfolio.model.artefacts.*; import org.olat.portfolio.ui.artefacts.view.*;
[ "org.olat.core", "org.olat.portfolio" ]
org.olat.core; org.olat.portfolio;
2,560,656
private CacheConfiguration<?, ?> addCache(boolean encrypted) throws IgniteCheckedException { CacheConfiguration<?, ?> cacheCfg = new CacheConfiguration<>(dfltCacheCfg).setName(CACHE2). setEncryptionEnabled(encrypted); grid(0).createCache(cacheCfg); Function<Integer, Object> valBuilder = valueBuilder(); IgniteDataStreamer<Integer, Object> streamer = grid(0).dataStreamer(CACHE2); for (int i = 0; i < CACHE_KEYS_RANGE; i++) streamer.addData(i, valBuilder.apply(i)); streamer.flush(); forceCheckpoint(); return cacheCfg; }
CacheConfiguration<?, ?> function(boolean encrypted) throws IgniteCheckedException { CacheConfiguration<?, ?> cacheCfg = new CacheConfiguration<>(dfltCacheCfg).setName(CACHE2). setEncryptionEnabled(encrypted); grid(0).createCache(cacheCfg); Function<Integer, Object> valBuilder = valueBuilder(); IgniteDataStreamer<Integer, Object> streamer = grid(0).dataStreamer(CACHE2); for (int i = 0; i < CACHE_KEYS_RANGE; i++) streamer.addData(i, valBuilder.apply(i)); streamer.flush(); forceCheckpoint(); return cacheCfg; }
/** * Adds cache to the grid. Fills it and waits for PME. * * @param encrypted If {@code true}, created encrypted cache. * @return CacheConfiguration of the created cache. */
Adds cache to the grid. Fills it and waits for PME
addCache
{ "repo_name": "apache/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/EncryptedSnapshotTest.java", "license": "apache-2.0", "size": 18211 }
[ "java.util.function.Function", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.IgniteDataStreamer", "org.apache.ignite.configuration.CacheConfiguration" ]
import java.util.function.Function; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteDataStreamer; import org.apache.ignite.configuration.CacheConfiguration;
import java.util.function.*; import org.apache.ignite.*; import org.apache.ignite.configuration.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,486,781
public static String[] split( String str, char escapeChar, char separator) { if (str==null) { return null; } ArrayList<String> strList = new ArrayList<String>(); StringBuilder split = new StringBuilder(); int index = 0; while ((index = findNext(str, separator, escapeChar, index, split)) >= 0) { ++index; // move over the separator for next search strList.add(split.toString()); split.setLength(0); // reset the buffer } strList.add(split.toString()); // remove trailing empty split(s) int last = strList.size(); // last split while (--last>=0 && "".equals(strList.get(last))) { strList.remove(last); } return strList.toArray(new String[strList.size()]); }
static String[] function( String str, char escapeChar, char separator) { if (str==null) { return null; } ArrayList<String> strList = new ArrayList<String>(); StringBuilder split = new StringBuilder(); int index = 0; while ((index = findNext(str, separator, escapeChar, index, split)) >= 0) { ++index; strList.add(split.toString()); split.setLength(0); } strList.add(split.toString()); int last = strList.size(); while (--last>=0 && "".equals(strList.get(last))) { strList.remove(last); } return strList.toArray(new String[strList.size()]); }
/** * Split a string using the given separator * @param str a string that may have escaped separator * @param escapeChar a char that be used to escape the separator * @param separator a separator char * @return an array of strings */
Split a string using the given separator
split
{ "repo_name": "toddlipcon/hadoop", "path": "src/core/org/apache/hadoop/util/StringUtils.java", "license": "apache-2.0", "size": 21468 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,610,768
public static String[] createRandomStringArray(int length) { String[] a = createAscendingStringArray(length); Collections.shuffle(Arrays.asList(a)); return a; }
static String[] function(int length) { String[] a = createAscendingStringArray(length); Collections.shuffle(Arrays.asList(a)); return a; }
/** * Creates an array of the given length, fills it with random * strings, and returns it. * Throws an IllegalArgumentException if length < 0. */
Creates an array of the given length, fills it with random strings, and returns it. Throws an IllegalArgumentException if length < 0
createRandomStringArray
{ "repo_name": "Amblamps/School-Projects", "path": "CSE373_DataStructures_and_Aglorithms/Assignment7_Sort_Detective/src/ArrayMethods.java", "license": "mit", "size": 5323 }
[ "java.util.Arrays", "java.util.Collections" ]
import java.util.Arrays; import java.util.Collections;
import java.util.*;
[ "java.util" ]
java.util;
2,175,494
public WindowedValue<V> getWindowedValue() { return windowedValue; }
WindowedValue<V> function() { return windowedValue; }
/** * Returns the {@code WindowedValue} associated with this element. */
Returns the WindowedValue associated with this element
getWindowedValue
{ "repo_name": "dhananjaypatkar/DataflowJavaSDK", "path": "sdk/src/main/java/com/google/cloud/dataflow/sdk/runners/DirectPipelineRunner.java", "license": "apache-2.0", "size": 35586 }
[ "com.google.cloud.dataflow.sdk.util.WindowedValue" ]
import com.google.cloud.dataflow.sdk.util.WindowedValue;
import com.google.cloud.dataflow.sdk.util.*;
[ "com.google.cloud" ]
com.google.cloud;
728,440
@Override @MethodContract( post = @Expression("result ? other.vetoedValue == vetoedValue") ) public boolean like(ApplicationException other) { return super.like(other) && eqn(((SetterPropertyException)other).getVetoedValue(), getVetoedValue()); }
@MethodContract( post = @Expression(STR) ) boolean function(ApplicationException other) { return super.like(other) && eqn(((SetterPropertyException)other).getVetoedValue(), getVetoedValue()); }
/** * Compare {@code other} to this: is other of the the exact same * type and does other have the exact same properties, including * {@link #getVetoedValue()}. * * @since VI */
Compare other to this: is other of the the exact same type and does other have the exact same properties, including <code>#getVetoedValue()</code>
like
{ "repo_name": "jandppw/ppwcode-recovered-from-google-code", "path": "java/vernacular/semantics/trunk/src/main/java/org/ppwcode/vernacular/semantics_VI/exception/SetterPropertyException.java", "license": "apache-2.0", "size": 9567 }
[ "org.ppwcode.vernacular.exception_III.ApplicationException", "org.toryt.annotations_I.Expression", "org.toryt.annotations_I.MethodContract" ]
import org.ppwcode.vernacular.exception_III.ApplicationException; import org.toryt.annotations_I.Expression; import org.toryt.annotations_I.MethodContract;
import org.ppwcode.vernacular.*; import org.toryt.*;
[ "org.ppwcode.vernacular", "org.toryt" ]
org.ppwcode.vernacular; org.toryt;
137,510
public static MozuUrl deletePackageFileUrl(Integer applicationVersionId, String filepath, Integer packageId) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/applications/applicationVersions/{applicationVersionId}/packages/{packageId}/files?filePath={filepath}"); formatter.formatUrl("applicationVersionId", applicationVersionId); formatter.formatUrl("filepath", filepath); formatter.formatUrl("packageId", packageId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
static MozuUrl function(Integer applicationVersionId, String filepath, Integer packageId) { UrlFormatter formatter = new UrlFormatter(STR); formatter.formatUrl(STR, applicationVersionId); formatter.formatUrl(STR, filepath); formatter.formatUrl(STR, packageId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
/** * Get Resource Url for DeletePackageFile * @param applicationVersionId Unique identifier of the application version. * @param filepath The file path and name of the file location to delete from the package. * @param packageId Unique identifier of the package. * @return String Resource Url */
Get Resource Url for DeletePackageFile
deletePackageFileUrl
{ "repo_name": "carsonreinke/mozu-java-sdk", "path": "src/main/java/com/mozu/api/urls/platform/developer/ApplicationVersionUrl.java", "license": "mit", "size": 9434 }
[ "com.mozu.api.MozuUrl", "com.mozu.api.utils.UrlFormatter" ]
import com.mozu.api.MozuUrl; import com.mozu.api.utils.UrlFormatter;
import com.mozu.api.*; import com.mozu.api.utils.*;
[ "com.mozu.api" ]
com.mozu.api;
770,375
EReference getRelationship_Sources();
EReference getRelationship_Sources();
/** * Returns the meta object for the reference list '{@link org.eclipse.bpmn2.Relationship#getSources <em>Sources</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference list '<em>Sources</em>'. * @see org.eclipse.bpmn2.Relationship#getSources() * @see #getRelationship() * @generated */
Returns the meta object for the reference list '<code>org.eclipse.bpmn2.Relationship#getSources Sources</code>'.
getRelationship_Sources
{ "repo_name": "Rikkola/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 929298 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,124,444
public BorderStyle getTargetBorder() { return getState(false).targetBorder; }
BorderStyle function() { return getState(false).targetBorder; }
/** * Returns the target window border. * * @return the target window border. */
Returns the target window border
getTargetBorder
{ "repo_name": "jdahlstrom/vaadin.react", "path": "server/src/main/java/com/vaadin/ui/Link.java", "license": "apache-2.0", "size": 6845 }
[ "com.vaadin.shared.ui.BorderStyle" ]
import com.vaadin.shared.ui.BorderStyle;
import com.vaadin.shared.ui.*;
[ "com.vaadin.shared" ]
com.vaadin.shared;
1,382,300
public void setIterator(Iterator<String> contactsIter) { mContactsIter = contactsIter; }
void function(Iterator<String> contactsIter) { mContactsIter = contactsIter; }
/** * Set the iterator. */
Set the iterator
setIterator
{ "repo_name": "ammiller22/programming_cloud_services_for_android", "path": "ex/ContactsContentProvider/src/vandy/mooc/presenter/ContactsOpsImplAsync/CommandArgs.java", "license": "apache-2.0", "size": 1955 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,380,288
static <E extends Throwable> DoubleToIntFunctionWithThrowable<E> asDoubleToIntFunctionWithThrowable(final DoubleToIntFunction doubletointfunction) { return doubletointfunction::applyAsInt; }
static <E extends Throwable> DoubleToIntFunctionWithThrowable<E> asDoubleToIntFunctionWithThrowable(final DoubleToIntFunction doubletointfunction) { return doubletointfunction::applyAsInt; }
/** * Utility method to convert DoubleToIntFunctionWithThrowable * @param doubletointfunction The interface instance * @param <E> The type this interface is allowed to throw * @return the cast interface */
Utility method to convert DoubleToIntFunctionWithThrowable
asDoubleToIntFunctionWithThrowable
{ "repo_name": "tisoft/throwable-interfaces", "path": "src/main/java/org/slieb/throwables/DoubleToIntFunctionWithThrowable.java", "license": "mit", "size": 6407 }
[ "java.lang.Throwable", "java.util.function.DoubleToIntFunction" ]
import java.lang.Throwable; import java.util.function.DoubleToIntFunction;
import java.lang.*; import java.util.function.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
603,262
private void handleFileStat(LocatedFileStatus stat) throws IOException { if (stat.isFile()) { // file curFile = stat; } else if (recursive) { // directory itors.push(curItor); curItor = listLocatedStatus(stat.getPath()); } }
void function(LocatedFileStatus stat) throws IOException { if (stat.isFile()) { curFile = stat; } else if (recursive) { itors.push(curItor); curItor = listLocatedStatus(stat.getPath()); } }
/** * Process the input stat. * If it is a file, return the file stat. * If it is a directory, traverse the directory if recursive is true; * ignore it if recursive is false. * @param stat input status * @throws IOException if any IO error occurs */
Process the input stat. If it is a file, return the file stat. If it is a directory, traverse the directory if recursive is true; ignore it if recursive is false
handleFileStat
{ "repo_name": "jonathangizmo/HadoopDistJ", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java", "license": "mit", "size": 110020 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,934,253
public static Date setMonth(Date d, int month) { if (month < 1 || month > 12) throw new IllegalArgumentException("Valid range of month is 1-12"); Calendar c = getCalendar(); c.setTime(d); c.set(Calendar.MONTH, month - 1); return (c.getTime()); }
static Date function(Date d, int month) { if (month < 1 month > 12) throw new IllegalArgumentException(STR); Calendar c = getCalendar(); c.setTime(d); c.set(Calendar.MONTH, month - 1); return (c.getTime()); }
/** * month ranges from 1 to 12 */
month ranges from 1 to 12
setMonth
{ "repo_name": "Bryllyant/kona-commons", "path": "src/main/java/com/bryllyant/kona/util/KDateUtil.java", "license": "apache-2.0", "size": 19539 }
[ "java.util.Calendar", "java.util.Date" ]
import java.util.Calendar; import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,152,116
private InfoValues parseInfoValues(final JsonNode fileContent) throws APIRestGeneratorException { InfoValues infoValues = null ; final JsonNode infoNode = fileContent.get(ConstantsInputParser.SW_MAIN_SCH_INFO) ; if (infoNode == null || infoNode.isMissingNode()) { ParserUtil.generateExceptionRequiredField(ConstantsInput.ROOT_JSON_NODE_NAME, ConstantsInputParser.SW_MAIN_SCH_INFO) ; } final String title = ParserUtil.getNodeValueField(ConstantsInputParser.SW_MAIN_SCH_INFO, infoNode, ConstantsInputParser.SW_INFO_SUBSC_TITLE, true) ; final String description = ParserUtil.getNodeValueField(ConstantsInputParser.SW_MAIN_SCH_INFO, infoNode, ConstantsInputParser.SW_INFO_SUBSC_DESC, true) ; final String version = ParserUtil.getNodeValueField(ConstantsInputParser.SW_MAIN_SCH_INFO, infoNode, ConstantsInputParser.SW_INFO_SUBSC_VERSI, true) ; // Validate the title (it will be the project name) this.validateTitle(title) ; // New instance of InfoValues infoValues = new InfoValues(title, description, version) ; // Parse the Contact Objects this.parseInfoContactObjects(infoNode, infoValues) ; return infoValues ; }
InfoValues function(final JsonNode fileContent) throws APIRestGeneratorException { InfoValues infoValues = null ; final JsonNode infoNode = fileContent.get(ConstantsInputParser.SW_MAIN_SCH_INFO) ; if (infoNode == null infoNode.isMissingNode()) { ParserUtil.generateExceptionRequiredField(ConstantsInput.ROOT_JSON_NODE_NAME, ConstantsInputParser.SW_MAIN_SCH_INFO) ; } final String title = ParserUtil.getNodeValueField(ConstantsInputParser.SW_MAIN_SCH_INFO, infoNode, ConstantsInputParser.SW_INFO_SUBSC_TITLE, true) ; final String description = ParserUtil.getNodeValueField(ConstantsInputParser.SW_MAIN_SCH_INFO, infoNode, ConstantsInputParser.SW_INFO_SUBSC_DESC, true) ; final String version = ParserUtil.getNodeValueField(ConstantsInputParser.SW_MAIN_SCH_INFO, infoNode, ConstantsInputParser.SW_INFO_SUBSC_VERSI, true) ; this.validateTitle(title) ; infoValues = new InfoValues(title, description, version) ; this.parseInfoContactObjects(infoNode, infoValues) ; return infoValues ; }
/** * Parse the info values * @param fileContent with the file content * @return the info values * @throws APIRestGeneratorException with an occurred exception */
Parse the info values
parseInfoValues
{ "repo_name": "BBVA-CIB/APIRestGenerator", "path": "parser.swagger/src/main/java/com/bbva/kltt/apirest/parser/swagger/Parser.java", "license": "apache-2.0", "size": 13734 }
[ "com.bbva.kltt.apirest.core.parsed_info.InfoValues", "com.bbva.kltt.apirest.core.util.APIRestGeneratorException", "com.bbva.kltt.apirest.core.util.ConstantsInput", "com.bbva.kltt.apirest.core.util.parser.ParserUtil", "com.bbva.kltt.apirest.parser.swagger.util.ConstantsInputParser", "com.fasterxml.jackson....
import com.bbva.kltt.apirest.core.parsed_info.InfoValues; import com.bbva.kltt.apirest.core.util.APIRestGeneratorException; import com.bbva.kltt.apirest.core.util.ConstantsInput; import com.bbva.kltt.apirest.core.util.parser.ParserUtil; import com.bbva.kltt.apirest.parser.swagger.util.ConstantsInputParser; import com.fasterxml.jackson.databind.JsonNode;
import com.bbva.kltt.apirest.core.parsed_info.*; import com.bbva.kltt.apirest.core.util.*; import com.bbva.kltt.apirest.core.util.parser.*; import com.bbva.kltt.apirest.parser.swagger.util.*; import com.fasterxml.jackson.databind.*;
[ "com.bbva.kltt", "com.fasterxml.jackson" ]
com.bbva.kltt; com.fasterxml.jackson;
734,358
private Object resolveProvidedArgument(MethodParameter parameter, Object... providedArgs) { if (providedArgs == null) { return null; } for (Object providedArg : providedArgs) { if (parameter.getParameterType().isInstance(providedArg)) { return providedArg; } } return null; }
Object function(MethodParameter parameter, Object... providedArgs) { if (providedArgs == null) { return null; } for (Object providedArg : providedArgs) { if (parameter.getParameterType().isInstance(providedArg)) { return providedArg; } } return null; }
/** * Attempt to resolve a method parameter from the list of provided argument values. */
Attempt to resolve a method parameter from the list of provided argument values
resolveProvidedArgument
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.web/org/springframework/web/method/support/InvocableHandlerMethod.java", "license": "mit", "size": 10790 }
[ "org.springframework.core.MethodParameter" ]
import org.springframework.core.MethodParameter;
import org.springframework.core.*;
[ "org.springframework.core" ]
org.springframework.core;
2,140,446
private ObjectType getObjectType(final Object obj) { return getObjectType(obj.getClass()); }
ObjectType function(final Object obj) { return getObjectType(obj.getClass()); }
/** * Return the type of an attribute value. */
Return the type of an attribute value
getObjectType
{ "repo_name": "cytoscape/cytoscape-impl", "path": "io-impl/impl/src/main/java/org/cytoscape/io/internal/write/xgmml/GenericXGMMLWriter.java", "license": "lgpl-2.1", "size": 39709 }
[ "org.cytoscape.io.internal.util.xgmml.ObjectType" ]
import org.cytoscape.io.internal.util.xgmml.ObjectType;
import org.cytoscape.io.internal.util.xgmml.*;
[ "org.cytoscape.io" ]
org.cytoscape.io;
1,937,752
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpServerUpgradeHandler.UpgradeEvent) { // Write an HTTP/2 response to the upgrade request Http2Headers headers = new DefaultHttp2Headers().status(OK.codeAsText()) .set(new AsciiString(UPGRADE_RESPONSE_HEADER), new AsciiString("true")); encoder().writeHeaders(ctx, 1, headers, 0, true, ctx.newPromise()); } super.userEventTriggered(ctx, evt); }
void function(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpServerUpgradeHandler.UpgradeEvent) { Http2Headers headers = new DefaultHttp2Headers().status(OK.codeAsText()) .set(new AsciiString(UPGRADE_RESPONSE_HEADER), new AsciiString("true")); encoder().writeHeaders(ctx, 1, headers, 0, true, ctx.newPromise()); } super.userEventTriggered(ctx, evt); }
/** * Handles the cleartext HTTP upgrade event. If an upgrade occurred, sends a simple response via HTTP/2 * on stream 1 (the stream specifically reserved for cleartext HTTP upgrade). */
Handles the cleartext HTTP upgrade event. If an upgrade occurred, sends a simple response via HTTP/2 on stream 1 (the stream specifically reserved for cleartext HTTP upgrade)
userEventTriggered
{ "repo_name": "kaustubh-walokar/grpc-poll-service", "path": "lib/netty/example/src/main/java/io/netty/example/http2/server/HelloWorldHttp2Handler.java", "license": "bsd-3-clause", "size": 5794 }
[ "io.netty.channel.ChannelHandlerContext", "io.netty.handler.codec.AsciiString", "io.netty.handler.codec.http.HttpResponseStatus", "io.netty.handler.codec.http.HttpServerUpgradeHandler", "io.netty.handler.codec.http2.DefaultHttp2Headers", "io.netty.handler.codec.http2.Http2Headers" ]
import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.AsciiString; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpServerUpgradeHandler; import io.netty.handler.codec.http2.DefaultHttp2Headers; import io.netty.handler.codec.http2.Http2Headers;
import io.netty.channel.*; import io.netty.handler.codec.*; import io.netty.handler.codec.http.*; import io.netty.handler.codec.http2.*;
[ "io.netty.channel", "io.netty.handler" ]
io.netty.channel; io.netty.handler;
2,779,843
@Override public String toReplacerPattern(boolean escapeUnprintable) { StringBuffer rule = new StringBuffer(); StringBuffer quoteBuf = new StringBuffer(); int cursor = cursorPos; // Handle a cursor preceding the output if (hasCursor && cursor < 0) { while (cursor++ < 0) { Utility.appendToRule(rule, '@', true, escapeUnprintable, quoteBuf); } // Fall through and append '|' below } for (int i=0; i<output.length(); ++i) { if (hasCursor && i == cursor) { Utility.appendToRule(rule, '|', true, escapeUnprintable, quoteBuf); } char c = output.charAt(i); // Ok to use 16-bits here UnicodeReplacer r = data.lookupReplacer(c); if (r == null) { Utility.appendToRule(rule, c, false, escapeUnprintable, quoteBuf); } else { StringBuffer buf = new StringBuffer(" "); buf.append(r.toReplacerPattern(escapeUnprintable)); buf.append(' '); Utility.appendToRule(rule, buf.toString(), true, escapeUnprintable, quoteBuf); } } // Handle a cursor after the output. Use > rather than >= because // if cursor == output.length() it is at the end of the output, // which is the default position, so we need not emit it. if (hasCursor && cursor > output.length()) { cursor -= output.length(); while (cursor-- > 0) { Utility.appendToRule(rule, '@', true, escapeUnprintable, quoteBuf); } Utility.appendToRule(rule, '|', true, escapeUnprintable, quoteBuf); } // Flush quoteBuf out to result Utility.appendToRule(rule, -1, true, escapeUnprintable, quoteBuf); return rule.toString(); }
String function(boolean escapeUnprintable) { StringBuffer rule = new StringBuffer(); StringBuffer quoteBuf = new StringBuffer(); int cursor = cursorPos; if (hasCursor && cursor < 0) { while (cursor++ < 0) { Utility.appendToRule(rule, '@', true, escapeUnprintable, quoteBuf); } } for (int i=0; i<output.length(); ++i) { if (hasCursor && i == cursor) { Utility.appendToRule(rule, ' ', true, escapeUnprintable, quoteBuf); } char c = output.charAt(i); UnicodeReplacer r = data.lookupReplacer(c); if (r == null) { Utility.appendToRule(rule, c, false, escapeUnprintable, quoteBuf); } else { StringBuffer buf = new StringBuffer(" "); buf.append(r.toReplacerPattern(escapeUnprintable)); buf.append(' '); Utility.appendToRule(rule, buf.toString(), true, escapeUnprintable, quoteBuf); } } if (hasCursor && cursor > output.length()) { cursor -= output.length(); while (cursor-- > 0) { Utility.appendToRule(rule, '@', true, escapeUnprintable, quoteBuf); } Utility.appendToRule(rule, ' ', true, escapeUnprintable, quoteBuf); } Utility.appendToRule(rule, -1, true, escapeUnprintable, quoteBuf); return rule.toString(); }
/** * UnicodeReplacer API */
UnicodeReplacer API
toReplacerPattern
{ "repo_name": "abhijitvalluri/fitnotifications", "path": "icu4j/src/main/java/com/ibm/icu/text/StringReplacer.java", "license": "apache-2.0", "size": 13380 }
[ "com.ibm.icu.impl.Utility" ]
import com.ibm.icu.impl.Utility;
import com.ibm.icu.impl.*;
[ "com.ibm.icu" ]
com.ibm.icu;
909,443
public static DecimalStyle ofDefaultLocale() { // for desugar: use legacy Locale.getDefault() which may ignore formatting-specific user // preferences available through Locale.getDefault(Locale.Category) // TODO(b/73370883): Use Locale.getDefault(FORMAT) if available return of(Locale.getDefault()); }
static DecimalStyle function() { return of(Locale.getDefault()); }
/** * Obtains the DecimalStyle for the default * {@link java.util.Locale.Category#FORMAT FORMAT} locale. * <p> * This method provides access to locale sensitive decimal style symbols. * <p> * This is equivalent to calling * {@link #of(Locale) * of(Locale.getDefault(Locale.Category.FORMAT))}. * * @see java.util.Locale.Category#FORMAT * @return the decimal style, not null */
Obtains the DecimalStyle for the default <code>java.util.Locale.Category#FORMAT FORMAT</code> locale. This method provides access to locale sensitive decimal style symbols. This is equivalent to calling <code>#of(Locale) of(Locale.getDefault(Locale.Category.FORMAT))</code>
ofDefaultLocale
{ "repo_name": "google/desugar_jdk_libs", "path": "jdk11/src/java.base/share/classes/java/time/format/DecimalStyle.java", "license": "gpl-2.0", "size": 14709 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,703,447
public void testCycles3() { DiGraph<String, String> g = LinkedDirectedGraph.create(); g.createDirectedGraphNode("a"); g.createDirectedGraphNode("b"); g.createDirectedGraphNode("c"); g.createDirectedGraphNode("d"); g.connect("a", "-", "b"); g.connect("b", "-", "c"); g.connect("c", "-", "b"); g.connect("b", "-", "d"); g.connect("c", "-", "d"); assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE)); assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE)); }
void function() { DiGraph<String, String> g = LinkedDirectedGraph.create(); g.createDirectedGraphNode("a"); g.createDirectedGraphNode("b"); g.createDirectedGraphNode("c"); g.createDirectedGraphNode("d"); g.connect("a", "-", "b"); g.connect("b", "-", "c"); g.connect("c", "-", "b"); g.connect("b", "-", "d"); g.connect("c", "-", "d"); assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE)); assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE)); }
/** * Tests another graph with cycles. The topology of this graph was inspired * by a control flow graph that was being incorrectly analyzed by an early * version of CheckPathsBetweenNodes. */
Tests another graph with cycles. The topology of this graph was inspired by a control flow graph that was being incorrectly analyzed by an early version of CheckPathsBetweenNodes
testCycles3
{ "repo_name": "robbert/closure-compiler-copy", "path": "test/com/google/javascript/jscomp/CheckPathsBetweenNodesTest.java", "license": "apache-2.0", "size": 11503 }
[ "com.google.common.base.Predicates", "com.google.javascript.jscomp.graph.DiGraph", "com.google.javascript.jscomp.graph.LinkedDirectedGraph" ]
import com.google.common.base.Predicates; import com.google.javascript.jscomp.graph.DiGraph; import com.google.javascript.jscomp.graph.LinkedDirectedGraph;
import com.google.common.base.*; import com.google.javascript.jscomp.graph.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
1,610,494
@Override public String toString() { return ToStringBuilder.reflectionToString(this); }
String function() { return ToStringBuilder.reflectionToString(this); }
/** * Default toString implementation * * @return This object as String. */
Default toString implementation
toString
{ "repo_name": "cucina/opencucina", "path": "nosql/security/src/main/java/org/cucina/security/model/Permission.java", "license": "apache-2.0", "size": 1389 }
[ "org.apache.commons.lang3.builder.ToStringBuilder" ]
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.*;
[ "org.apache.commons" ]
org.apache.commons;
2,160,694
@Override public ActionForward deleteAllTargetAccountingLines(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { SalaryExpenseTransferForm financialDocumentForm = (SalaryExpenseTransferForm) form; financialDocumentForm.getSalaryExpenseTransferDocument().setNextTargetLineNumber(KFSConstants.ONE.intValue()); return super.deleteAllTargetAccountingLines(mapping, form, request, response); }
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { SalaryExpenseTransferForm financialDocumentForm = (SalaryExpenseTransferForm) form; financialDocumentForm.getSalaryExpenseTransferDocument().setNextTargetLineNumber(KFSConstants.ONE.intValue()); return super.deleteAllTargetAccountingLines(mapping, form, request, response); }
/** * Delete all target accounting lines * * @param mapping * @param form * @param request * @param response * @return ActionMapping * @throws Exception */
Delete all target accounting lines
deleteAllTargetAccountingLines
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/ld/document/web/struts/SalaryExpenseTransferAction.java", "license": "apache-2.0", "size": 13697 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.kuali.kfs.sys.KFSConstants" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.kfs.sys.KFSConstants;
import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kfs.sys.*;
[ "javax.servlet", "org.apache.struts", "org.kuali.kfs" ]
javax.servlet; org.apache.struts; org.kuali.kfs;
197,982
@Deprecated public List<OrderInfo> getByTimeRange(Date start, Date end) { List<Reference> apiList = listByTimeRange(start, end); return getByRefs(apiList); }
List<OrderInfo> function(Date start, Date end) { List<Reference> apiList = listByTimeRange(start, end); return getByRefs(apiList); }
/** * Retrieves all orders for a specific time range. * <p> * API Call: GET /api/orders/all * * @return All orders for a specific time range. */
Retrieves all orders for a specific time range. API Call: GET /api/orders/all
getByTimeRange
{ "repo_name": "emcvipr/controller-client-java", "path": "client/src/main/java/com/emc/vipr/client/catalog/Orders.java", "license": "apache-2.0", "size": 4195 }
[ "com.emc.vipr.model.catalog.OrderInfo", "com.emc.vipr.model.catalog.Reference", "java.util.Date", "java.util.List" ]
import com.emc.vipr.model.catalog.OrderInfo; import com.emc.vipr.model.catalog.Reference; import java.util.Date; import java.util.List;
import com.emc.vipr.model.catalog.*; import java.util.*;
[ "com.emc.vipr", "java.util" ]
com.emc.vipr; java.util;
512,457
private Map<String, String> constructRootRelativePathsMap() { Map<String, String> rootRelativePathsMap = Maps.newLinkedHashMap(); for (String mapString : config.manifestMaps) { int colonIndex = mapString.indexOf(':'); Preconditions.checkState(colonIndex > 0); String execPath = mapString.substring(0, colonIndex); String rootRelativePath = mapString.substring(colonIndex + 1); Preconditions.checkState(rootRelativePath.indexOf(':') == -1); rootRelativePathsMap.put(execPath, rootRelativePath); } return rootRelativePathsMap; } static class CommandLineConfig { private boolean printTree = false;
Map<String, String> function() { Map<String, String> rootRelativePathsMap = Maps.newLinkedHashMap(); for (String mapString : config.manifestMaps) { int colonIndex = mapString.indexOf(':'); Preconditions.checkState(colonIndex > 0); String execPath = mapString.substring(0, colonIndex); String rootRelativePath = mapString.substring(colonIndex + 1); Preconditions.checkState(rootRelativePath.indexOf(':') == -1); rootRelativePathsMap.put(execPath, rootRelativePath); } return rootRelativePathsMap; } static class CommandLineConfig { private boolean printTree = false;
/** * Construct and return the input root path map. The key is the exec path of * each input file, and the value is the corresponding root relative path. */
Construct and return the input root path map. The key is the exec path of each input file, and the value is the corresponding root relative path
constructRootRelativePathsMap
{ "repo_name": "ksheedlo/closure-compiler", "path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java", "license": "apache-2.0", "size": 64695 }
[ "com.google.common.base.Preconditions", "com.google.common.collect.Maps", "java.util.Map" ]
import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import java.util.Map;
import com.google.common.base.*; import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,758,280
public BaseRegistry getBaseRegistry() { return baseRegistry; }
BaseRegistry function() { return baseRegistry; }
/** * Retrieve the base registry. * * @return The base registry. */
Retrieve the base registry
getBaseRegistry
{ "repo_name": "iritgo/iritgo-aktario", "path": "aktario-framework/src/main/java/de/iritgo/aktario/core/Engine.java", "license": "apache-2.0", "size": 14622 }
[ "de.iritgo.aktario.core.base.BaseRegistry" ]
import de.iritgo.aktario.core.base.BaseRegistry;
import de.iritgo.aktario.core.base.*;
[ "de.iritgo.aktario" ]
de.iritgo.aktario;
62,496
public Builder putExtraParam(String key, Object value) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.put(key, value); return this; }
Builder function(String key, Object value) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.put(key, value); return this; }
/** * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` * call, and subsequent calls add additional key/value pairs to the original map. See {@link * ConfigurationUpdateParams#extraParams} for the field documentation. */
Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>ConfigurationUpdateParams#extraParams</code> for the field documentation
putExtraParam
{ "repo_name": "stripe/stripe-java", "path": "src/main/java/com/stripe/param/billingportal/ConfigurationUpdateParams.java", "license": "mit", "size": 58333 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,659,609
@Test public void countBookedByIdEventMovie_Test() { int bookings=this.bookingDAO.countBookedByIdEventMovie( 5L ); Assert.assertEquals( 6, bookings ); }
@Test void function() { int bookings=this.bookingDAO.countBookedByIdEventMovie( 5L ); Assert.assertEquals( 6, bookings ); }
/** * {@link Description} Caso de prueba para el flujo basico de consultar bookings por IdEventMovie * y en estado booked * */
<code>Description</code> Caso de prueba para el flujo basico de consultar bookings por IdEventMovie y en estado booked
countBookedByIdEventMovie_Test
{ "repo_name": "sidlors/digital-booking", "path": "digital-booking-persistence/src/test/java/mx/com/cinepolis/digital/booking/persistence/dao/impl/BookingDAOTest.java", "license": "epl-1.0", "size": 69802 }
[ "org.junit.Assert", "org.junit.Test" ]
import org.junit.Assert; import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,559,171
@Override IndexOrdinalsFieldData localGlobalDirect(DirectoryReader indexReader) throws Exception;
IndexOrdinalsFieldData localGlobalDirect(DirectoryReader indexReader) throws Exception;
/** * Load a global view of the ordinals for the given {@link IndexReader}. */
Load a global view of the ordinals for the given <code>IndexReader</code>
localGlobalDirect
{ "repo_name": "mohit/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/fielddata/IndexOrdinalsFieldData.java", "license": "apache-2.0", "size": 1807 }
[ "org.apache.lucene.index.DirectoryReader" ]
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.*;
[ "org.apache.lucene" ]
org.apache.lucene;
330,822