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
private void sendMessage(BeanMessageID type, Buffer payload) { Buffer buffer = new Buffer(); buffer.writeByte((type.getRawValue() >> 8) & 0xff); buffer.writeByte(type.getRawValue() & 0xff); if (payload != null) { try { buffer.writeAll(payload); } catch (IOException e) { throw new RuntimeException(e); } } GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray()); gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer()); }
void function(BeanMessageID type, Buffer payload) { Buffer buffer = new Buffer(); buffer.writeByte((type.getRawValue() >> 8) & 0xff); buffer.writeByte(type.getRawValue() & 0xff); if (payload != null) { try { buffer.writeAll(payload); } catch (IOException e) { throw new RuntimeException(e); } } GattSerialMessage serialMessage = GattSerialMessage.fromPayload(buffer.readByteArray()); gattClient.getSerialProfile().sendMessage(serialMessage.getBuffer()); }
/** * Send a message to Bean with a payload. * @param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} for the message * @param payload The message payload to send */
Send a message to Bean with a payload
sendMessage
{ "repo_name": "hongbinz/Bean-Android-SDK", "path": "sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java", "license": "mit", "size": 37834 }
[ "com.punchthrough.bean.sdk.internal.BeanMessageID", "com.punchthrough.bean.sdk.internal.serial.GattSerialMessage", "java.io.IOException" ]
import com.punchthrough.bean.sdk.internal.BeanMessageID; import com.punchthrough.bean.sdk.internal.serial.GattSerialMessage; import java.io.IOException;
import com.punchthrough.bean.sdk.internal.*; import com.punchthrough.bean.sdk.internal.serial.*; import java.io.*;
[ "com.punchthrough.bean", "java.io" ]
com.punchthrough.bean; java.io;
945,959
@Override public ResourceLocator getResourceLocator() { return UmlClassMetaModelEditPlugin.INSTANCE; }
ResourceLocator function() { return UmlClassMetaModelEditPlugin.INSTANCE; }
/** * Return the resource locator for this item provider's resources. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Return the resource locator for this item provider's resources.
getResourceLocator
{ "repo_name": "KuehneThomas/model-to-model-transformation-generator", "path": "src/MetaModels.UmlClass.edit/src/umlClassMetaModel/provider/UmlPackageItemProvider.java", "license": "mit", "size": 6441 }
[ "org.eclipse.emf.common.util.ResourceLocator" ]
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
927,682
public static FileDialogFragment newInstance(Messenger messenger, String title, String message, File defaultFile, String checkboxText) { FileDialogFragment frag = new FileDialogFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_MESSENGER, messenger); args.putString(ARG_TITLE, title); args.putString(ARG_MESSAGE, message); args.putString(ARG_DEFAULT_FILE, defaultFile.getAbsolutePath()); args.putString(ARG_CHECKBOX_TEXT, checkboxText); frag.setArguments(args); return frag; }
static FileDialogFragment function(Messenger messenger, String title, String message, File defaultFile, String checkboxText) { FileDialogFragment frag = new FileDialogFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_MESSENGER, messenger); args.putString(ARG_TITLE, title); args.putString(ARG_MESSAGE, message); args.putString(ARG_DEFAULT_FILE, defaultFile.getAbsolutePath()); args.putString(ARG_CHECKBOX_TEXT, checkboxText); frag.setArguments(args); return frag; }
/** * Creates new instance of this file dialog fragment */
Creates new instance of this file dialog fragment
newInstance
{ "repo_name": "siddharths2710/open-keychain", "path": "OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/FileDialogFragment.java", "license": "gpl-3.0", "size": 8374 }
[ "android.os.Bundle", "android.os.Messenger", "java.io.File" ]
import android.os.Bundle; import android.os.Messenger; import java.io.File;
import android.os.*; import java.io.*;
[ "android.os", "java.io" ]
android.os; java.io;
1,042,234
public void testProject043() throws Exception { final File baseDir = doTestProject( "project-043", new String[] { "ejb-sample-one-1.0.jar" } ); final File expectedApplicationXml = new File( baseDir, "target/custom-descriptor-dir/application.xml" ); assertTrue( "Application.xml file not found", expectedApplicationXml.exists() ); assertFalse( "Application.xml file should not be empty", expectedApplicationXml.length() == 0 ); }
void function() throws Exception { final File baseDir = doTestProject( STR, new String[] { STR } ); final File expectedApplicationXml = new File( baseDir, STR ); assertTrue( STR, expectedApplicationXml.exists() ); assertFalse( STR, expectedApplicationXml.length() == 0 ); }
/** * Builds an EAR with a custom descriptor location (generatedDescriptorLocation setting). */
Builds an EAR with a custom descriptor location (generatedDescriptorLocation setting)
testProject043
{ "repo_name": "kidaa/maven-plugins", "path": "maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java", "license": "apache-2.0", "size": 29927 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
395,074
@ServiceThreadOnly boolean isInDeviceList(int logicalAddress, int physicalAddress) { assertRunOnServiceThread(); HdmiDeviceInfo device = getCecDeviceInfo(logicalAddress); if (device == null) { return false; } return device.getPhysicalAddress() == physicalAddress; }
boolean isInDeviceList(int logicalAddress, int physicalAddress) { assertRunOnServiceThread(); HdmiDeviceInfo device = getCecDeviceInfo(logicalAddress); if (device == null) { return false; } return device.getPhysicalAddress() == physicalAddress; }
/** * Whether a device of the specified physical address and logical address exists * in a device info list. However, both are minimal condition and it could * be different device from the original one. * * @param logicalAddress logical address of a device to be searched * @param physicalAddress physical address of a device to be searched * @return true if exist; otherwise false */
Whether a device of the specified physical address and logical address exists in a device info list. However, both are minimal condition and it could be different device from the original one
isInDeviceList
{ "repo_name": "xorware/android_frameworks_base", "path": "services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java", "license": "apache-2.0", "size": 74896 }
[ "android.hardware.hdmi.HdmiDeviceInfo" ]
import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.*;
[ "android.hardware" ]
android.hardware;
2,241,973
private Drawable loadTintedCategoryDrawable(Category category, int categoryImageResource) { final Drawable categoryIcon = ContextCompat .getDrawable(mActivity, categoryImageResource).mutate(); return wrapAndTint(categoryIcon, category.getTheme().getPrimaryColor()); }
Drawable function(Category category, int categoryImageResource) { final Drawable categoryIcon = ContextCompat .getDrawable(mActivity, categoryImageResource).mutate(); return wrapAndTint(categoryIcon, category.getTheme().getPrimaryColor()); }
/** * Loads and tints a drawable. * * @param category The category providing the tint color * @param categoryImageResource The image resource to tint * @return The tinted resource */
Loads and tints a drawable
loadTintedCategoryDrawable
{ "repo_name": "hufeiya/CoolSignIn", "path": "AndroidClient/app/src/main/java/com/hufeiya/SignIn/adapter/CategoryAdapter.java", "license": "apache-2.0", "size": 7180 }
[ "android.graphics.drawable.Drawable", "android.support.v4.content.ContextCompat", "com.hufeiya.SignIn" ]
import android.graphics.drawable.Drawable; import android.support.v4.content.ContextCompat; import com.hufeiya.SignIn;
import android.graphics.drawable.*; import android.support.v4.content.*; import com.hufeiya.*;
[ "android.graphics", "android.support", "com.hufeiya" ]
android.graphics; android.support; com.hufeiya;
1,614,167
private IgniteInternalFuture<Long> updateAsync(GridNearTxQueryAbstractEnlistFuture fut) { try { fut.init();
IgniteInternalFuture<Long> function(GridNearTxQueryAbstractEnlistFuture fut) { try { fut.init();
/** * Executes update query operation in Mvcc mode. * * @param fut Enlist future. * @return Operation future. */
Executes update query operation in Mvcc mode
updateAsync
{ "repo_name": "ptupitsyn/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java", "license": "apache-2.0", "size": 175126 }
[ "org.apache.ignite.internal.IgniteInternalFuture" ]
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,227,307
Collection<EnumConstantDeclaration> getEnumConstants();
Collection<EnumConstantDeclaration> getEnumConstants();
/** * Returns the enum constants defined for this enum. * * @return the enum constants defined for this enum, * or an empty collection if there are none */
Returns the enum constants defined for this enum
getEnumConstants
{ "repo_name": "Niky4000/UsefulUtils", "path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.apt.core/src/com/sun/mirror/declaration/EnumDeclaration.java", "license": "gpl-3.0", "size": 2192 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,475,678
@Override() public java.lang.Class getJavaClass( ) { return org.chocolate_milk.model.SalesOrPurchase.class; }
@Override() java.lang.Class function( ) { return org.chocolate_milk.model.SalesOrPurchase.class; }
/** * Method getJavaClass. * * @return the Java class represented by this descriptor. */
Method getJavaClass
getJavaClass
{ "repo_name": "galleon1/chocolate-milk", "path": "src/org/chocolate_milk/model/descriptors/SalesOrPurchaseDescriptor.java", "license": "lgpl-3.0", "size": 9353 }
[ "org.chocolate_milk.model.SalesOrPurchase" ]
import org.chocolate_milk.model.SalesOrPurchase;
import org.chocolate_milk.model.*;
[ "org.chocolate_milk.model" ]
org.chocolate_milk.model;
1,035,272
INameMapping mapping = new IdentityMapping("pip"); CoordinationManager.registerTestMapping(mapping); // avoid full startup SingleObservation base = new SingleObservation(); DelegatingStatisticsObservation obs = new DelegatingStatisticsObservation( new DelegatingTimeFramedObservation(base, 1000)); Assert.assertEquals(0, obs.getValue(), 1); Assert.assertEquals(0, obs.getAverageValue(), 1); Assert.assertEquals(0, obs.getMinimumValue(), 1); Assert.assertEquals(0, obs.getMaximumValue(), 1); long start = System.currentTimeMillis(); base.setValue(500, null); // 500 over 1 s -> 500 double v1 = obs.getValue(); sleep(1000); base.setValue(500, null); // 500 over 1 s -> 500 double v2 = obs.getValue(); Assert.assertEquals(500, v2, 25); // time diffs base.setValue(1000, null); // reset to 1000 over 1 s -> 1000 sleep(1000); long diff = System.currentTimeMillis() - start; double exp = 1000 / (diff / 1000); double v3 = obs.getValue(); Assert.assertEquals(exp, v3, 5); // time diffs Assert.assertEquals((v1 + v2 + v3) / 4, obs.getAverageValue(), 1); // every read counts! Assert.assertEquals(0, obs.getMinimumValue(), 1); Assert.assertEquals(Math.max(Math.max(v1, v2), v3), obs.getMaximumValue(), 5); CoordinationManager.unregisterNameMapping(mapping); }
INameMapping mapping = new IdentityMapping("pip"); CoordinationManager.registerTestMapping(mapping); SingleObservation base = new SingleObservation(); DelegatingStatisticsObservation obs = new DelegatingStatisticsObservation( new DelegatingTimeFramedObservation(base, 1000)); Assert.assertEquals(0, obs.getValue(), 1); Assert.assertEquals(0, obs.getAverageValue(), 1); Assert.assertEquals(0, obs.getMinimumValue(), 1); Assert.assertEquals(0, obs.getMaximumValue(), 1); long start = System.currentTimeMillis(); base.setValue(500, null); double v1 = obs.getValue(); sleep(1000); base.setValue(500, null); double v2 = obs.getValue(); Assert.assertEquals(500, v2, 25); base.setValue(1000, null); sleep(1000); long diff = System.currentTimeMillis() - start; double exp = 1000 / (diff / 1000); double v3 = obs.getValue(); Assert.assertEquals(exp, v3, 5); Assert.assertEquals((v1 + v2 + v3) / 4, obs.getAverageValue(), 1); Assert.assertEquals(0, obs.getMinimumValue(), 1); Assert.assertEquals(Math.max(Math.max(v1, v2), v3), obs.getMaximumValue(), 5); CoordinationManager.unregisterNameMapping(mapping); }
/** * Test the combination of time-framed absolute observation and statistics observation. */
Test the combination of time-framed absolute observation and statistics observation
timeFramedAbsoluteStatistics
{ "repo_name": "QualiMaster/Infrastructure", "path": "MonitoringLayer/src/tests/eu/qualimaster/monitoring/ObservationTests.java", "license": "apache-2.0", "size": 5066 }
[ "eu.qualimaster.coordination.CoordinationManager", "eu.qualimaster.coordination.INameMapping", "eu.qualimaster.coordination.IdentityMapping", "eu.qualimaster.monitoring.observations.DelegatingStatisticsObservation", "eu.qualimaster.monitoring.observations.DelegatingTimeFramedObservation", "eu.qualimaster.monitoring.observations.SingleObservation", "org.junit.Assert" ]
import eu.qualimaster.coordination.CoordinationManager; import eu.qualimaster.coordination.INameMapping; import eu.qualimaster.coordination.IdentityMapping; import eu.qualimaster.monitoring.observations.DelegatingStatisticsObservation; import eu.qualimaster.monitoring.observations.DelegatingTimeFramedObservation; import eu.qualimaster.monitoring.observations.SingleObservation; import org.junit.Assert;
import eu.qualimaster.coordination.*; import eu.qualimaster.monitoring.observations.*; import org.junit.*;
[ "eu.qualimaster.coordination", "eu.qualimaster.monitoring", "org.junit" ]
eu.qualimaster.coordination; eu.qualimaster.monitoring; org.junit;
1,646,041
public void setPriceActual (BigDecimal PriceActual) { set_Value (COLUMNNAME_PriceActual, PriceActual); }
void function (BigDecimal PriceActual) { set_Value (COLUMNNAME_PriceActual, PriceActual); }
/** Set Unit Price. @param PriceActual Actual Price */
Set Unit Price
setPriceActual
{ "repo_name": "geneos/adempiere", "path": "base/src/org/compiere/model/X_M_RequisitionLine.java", "license": "gpl-2.0", "size": 11043 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
1,097,118
static <T> UnmodifiableListIterator<T> forArray( final T[] array, final int offset, int length, int index) { checkArgument(length >= 0); int end = offset + length; // Technically we should give a slightly more descriptive error on overflow Preconditions.checkPositionIndexes(offset, end, array.length); Preconditions.checkPositionIndex(index, length); if (length == 0) { return emptyListIterator(); }
static <T> UnmodifiableListIterator<T> forArray( final T[] array, final int offset, int length, int index) { checkArgument(length >= 0); int end = offset + length; Preconditions.checkPositionIndexes(offset, end, array.length); Preconditions.checkPositionIndex(index, length); if (length == 0) { return emptyListIterator(); }
/** * Returns a list iterator containing the elements in the specified range of * {@code array} in order, starting at the specified index. * * <p>The {@code Iterable} equivalent of this method is {@code * Arrays.asList(array).subList(offset, offset + length).listIterator(index)}. */
Returns a list iterator containing the elements in the specified range of array in order, starting at the specified index. The Iterable equivalent of this method is Arrays.asList(array).subList(offset, offset + length).listIterator(index)
forArray
{ "repo_name": "UBERMALLOW/external_guava", "path": "guava/src/com/google/common/collect/Iterators.java", "license": "apache-2.0", "size": 45571 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
9,122
@SuppressWarnings("rawtypes") @Override public boolean containsValue(final Object value) { // JG - God, I hope nobody ever actually uses this method // NTF - Actually I have some good use cases for it! WHEEEEEE!! for (String key : this.keySet()) { if (hasItem(key) && value instanceof CharSequence) { Item item = getFirstItem(key, true); if (item instanceof RichTextItem) { String text = ((RichTextItem) item).getText(); if (text.contains((CharSequence) value)) { return true; } else { continue; } } } Object itemVal = this.get(key); if (itemVal instanceof List) { if (((List) itemVal).contains(value)) { return true; } else { continue; } } if ((value == null && itemVal == null) || (value != null && value.equals(itemVal))) { return true; } } return false; }
@SuppressWarnings(STR) boolean function(final Object value) { for (String key : this.keySet()) { if (hasItem(key) && value instanceof CharSequence) { Item item = getFirstItem(key, true); if (item instanceof RichTextItem) { String text = ((RichTextItem) item).getText(); if (text.contains((CharSequence) value)) { return true; } else { continue; } } } Object itemVal = this.get(key); if (itemVal instanceof List) { if (((List) itemVal).contains(value)) { return true; } else { continue; } } if ((value == null && itemVal == null) (value != null && value.equals(itemVal))) { return true; } } return false; }
/** * Checks if the document contains the given value in any of its items. * * @param value * Value to search for * @return true if any of the items contains the value */
Checks if the document contains the given value in any of its items
containsValue
{ "repo_name": "OpenNTF/org.openntf.domino", "path": "domino/core/src/main/java/org/openntf/domino/impl/Document.java", "license": "apache-2.0", "size": 132271 }
[ "java.util.List", "org.openntf.domino.Item", "org.openntf.domino.RichTextItem" ]
import java.util.List; import org.openntf.domino.Item; import org.openntf.domino.RichTextItem;
import java.util.*; import org.openntf.domino.*;
[ "java.util", "org.openntf.domino" ]
java.util; org.openntf.domino;
320,177
public List getResourceInfos() { return m_resourceInfos; }
List function() { return m_resourceInfos; }
/** * Determines which processed resources are part of the deployment package. * * @return A list of <code>ResourceInfoImpl</code> objects describing the processed resources of the deployment package. */
Determines which processed resources are part of the deployment package
getResourceInfos
{ "repo_name": "akquinet/osgi-deployment-admin", "path": "deployment-admin-impl/src/main/java/de/akquinet/gomobile/deploymentadmin/DeploymentPackageManifest.java", "license": "apache-2.0", "size": 5568 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
812,614
public void add(FullKey key, long offset) { if (entries.isEmpty() && offset == -1) { throw new IllegalArgumentException(); } entries.add(new Entry(key, offset)); }
void function(FullKey key, long offset) { if (entries.isEmpty() && offset == -1) { throw new IllegalArgumentException(); } entries.add(new Entry(key, offset)); }
/** * add an entry to the table of children. * * @param key * the key of the child. * @param offset * the offset of the child. */
add an entry to the table of children
add
{ "repo_name": "sarah-happy/happy-archive", "path": "archive/src/main/java/org/yi/happy/archive/restore/RestoreWork.java", "license": "apache-2.0", "size": 3356 }
[ "org.yi.happy.archive.key.FullKey" ]
import org.yi.happy.archive.key.FullKey;
import org.yi.happy.archive.key.*;
[ "org.yi.happy" ]
org.yi.happy;
1,657,218
public void delete(Avatar avatar) { if (avatar != null) { this.repository.remove(avatar); this.deleteImage(avatar); } }
void function(Avatar avatar) { if (avatar != null) { this.repository.remove(avatar); this.deleteImage(avatar); } }
/** * remove Avatar and del its image * * @param avatar */
remove Avatar and del its image
delete
{ "repo_name": "ippxie/jforum3", "path": "src/main/java/net/jforum/services/AvatarService.java", "license": "lgpl-2.1", "size": 7609 }
[ "net.jforum.entities.Avatar" ]
import net.jforum.entities.Avatar;
import net.jforum.entities.*;
[ "net.jforum.entities" ]
net.jforum.entities;
1,442,126
@Test public void testGetLayerPriceCompositions() { Set expResult = new HashSet(); assertEquals(expResult, instance.getLayerPriceCompositions()); }
void function() { Set expResult = new HashSet(); assertEquals(expResult, instance.getLayerPriceCompositions()); }
/** * Test of getLayerPriceCompositions method, of class Transaction. */
Test of getLayerPriceCompositions method, of class Transaction
testGetLayerPriceCompositions
{ "repo_name": "B3Partners/kaartenbalie", "path": "src/test/java/nl/b3p/kaartenbalie/core/server/accounting/entity/TransactionTest.java", "license": "lgpl-3.0", "size": 11635 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,729,732
public ItemStack decrStackSize(int index, int count) { this.addLoot((EntityPlayer)null); return ItemStackHelper.func_188382_a(this.minecartContainerItems, index, count); }
ItemStack function(int index, int count) { this.addLoot((EntityPlayer)null); return ItemStackHelper.func_188382_a(this.minecartContainerItems, index, count); }
/** * Removes up to a specified number of items from an inventory slot and returns them in a new stack. */
Removes up to a specified number of items from an inventory slot and returns them in a new stack
decrStackSize
{ "repo_name": "aebert1/BigTransport", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/item/EntityMinecartContainer.java", "license": "gpl-3.0", "size": 10744 }
[ "net.minecraft.entity.player.EntityPlayer", "net.minecraft.inventory.ItemStackHelper", "net.minecraft.item.ItemStack" ]
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.*; import net.minecraft.inventory.*; import net.minecraft.item.*;
[ "net.minecraft.entity", "net.minecraft.inventory", "net.minecraft.item" ]
net.minecraft.entity; net.minecraft.inventory; net.minecraft.item;
374,094
CompletableFuture<FunctionStats.FunctionInstanceStats.FunctionInstanceStatsData> getFunctionStatsAsync( String tenant, String namespace, String function, int id);
CompletableFuture<FunctionStats.FunctionInstanceStats.FunctionInstanceStatsData> getFunctionStatsAsync( String tenant, String namespace, String function, int id);
/** * Gets the current stats of a function instance asynchronously. * * @param tenant * Tenant name * @param namespace * Namespace name * @param function * Function name * @param id * Function instance-id * @return */
Gets the current stats of a function instance asynchronously
getFunctionStatsAsync
{ "repo_name": "yahoo/pulsar", "path": "pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Functions.java", "license": "apache-2.0", "size": 27657 }
[ "java.util.concurrent.CompletableFuture", "org.apache.pulsar.common.policies.data.FunctionStats" ]
import java.util.concurrent.CompletableFuture; import org.apache.pulsar.common.policies.data.FunctionStats;
import java.util.concurrent.*; import org.apache.pulsar.common.policies.data.*;
[ "java.util", "org.apache.pulsar" ]
java.util; org.apache.pulsar;
2,575,724
private void printTableSummary(SortedMap<String, TableInfo> tablesInfo) { StringBuilder sb = new StringBuilder(); errors.print("Summary:"); for (TableInfo tInfo : tablesInfo.values()) { if (errors.tableHasErrors(tInfo)) { errors.print("Table " + tInfo.getName() + " is inconsistent."); } else { errors.print(" " + tInfo.getName() + " is okay."); } errors.print(" Number of regions: " + tInfo.getNumRegions()); sb.setLength(0); // clear out existing buffer, if any. sb.append(" Deployed on: "); for (ServerName server : tInfo.deployedOn) { sb.append(" " + server.toString()); } errors.print(sb.toString()); } }
void function(SortedMap<String, TableInfo> tablesInfo) { StringBuilder sb = new StringBuilder(); errors.print(STR); for (TableInfo tInfo : tablesInfo.values()) { if (errors.tableHasErrors(tInfo)) { errors.print(STR + tInfo.getName() + STR); } else { errors.print(" " + tInfo.getName() + STR); } errors.print(STR + tInfo.getNumRegions()); sb.setLength(0); sb.append(STR); for (ServerName server : tInfo.deployedOn) { sb.append(" " + server.toString()); } errors.print(sb.toString()); } }
/** * Prints summary of all tables found on the system. */
Prints summary of all tables found on the system
printTableSummary
{ "repo_name": "gdweijin/hindex", "path": "src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java", "license": "apache-2.0", "size": 137333 }
[ "java.util.SortedMap", "org.apache.hadoop.hbase.ServerName" ]
import java.util.SortedMap; import org.apache.hadoop.hbase.ServerName;
import java.util.*; import org.apache.hadoop.hbase.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,544,904
public EnumSet<Caps> getCaps();
EnumSet<Caps> function();
/** * Get the capabilities of the renderer. * @return The capabilities of the renderer. */
Get the capabilities of the renderer
getCaps
{ "repo_name": "phr00t/jmonkeyengine", "path": "jme3-core/src/main/java/com/jme3/renderer/Renderer.java", "license": "bsd-3-clause", "size": 14223 }
[ "java.util.EnumSet" ]
import java.util.EnumSet;
import java.util.*;
[ "java.util" ]
java.util;
216,415
public List<IVersionLoader> getLoaders() { return this.loaders; }
List<IVersionLoader> function() { return this.loaders; }
/** * returns the loaders for instances * * @return data loaders */
returns the loaders for instances
getLoaders
{ "repo_name": "sherbold/CrossPare", "path": "CrossPare/src/main/java/de/ugoe/cs/cpdp/ExperimentConfiguration.java", "license": "apache-2.0", "size": 30579 }
[ "de.ugoe.cs.cpdp.loader.IVersionLoader", "java.util.List" ]
import de.ugoe.cs.cpdp.loader.IVersionLoader; import java.util.List;
import de.ugoe.cs.cpdp.loader.*; import java.util.*;
[ "de.ugoe.cs", "java.util" ]
de.ugoe.cs; java.util;
2,185,125
public StreamError getStreamError() { return streamError; }
StreamError function() { return streamError; }
/** * Returns the StreamError asscociated with this exception, or <tt>null</tt> if there * isn't one. The underlying TCP connection is closed by the server after sending the * stream error to the client. * * @return the StreamError asscociated with this exception. */
Returns the StreamError asscociated with this exception, or null if there isn't one. The underlying TCP connection is closed by the server after sending the stream error to the client
getStreamError
{ "repo_name": "luchuangbin/test1", "path": "src/org/jivesoftware/smack/XMPPException.java", "license": "apache-2.0", "size": 6825 }
[ "org.jivesoftware.smack.packet.StreamError" ]
import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.packet.*;
[ "org.jivesoftware.smack" ]
org.jivesoftware.smack;
1,292,309
public LabelsResponse get() throws IOException { PostmenUrl url = getUrl(); LabelsResponse labelsResponse = get(getHandler(), url, LabelsResponse.class); return labelsResponse; }
LabelsResponse function() throws IOException { PostmenUrl url = getUrl(); LabelsResponse labelsResponse = get(getHandler(), url, LabelsResponse.class); return labelsResponse; }
/** * Get a list of labels you have * @return Label Response Object * @throws IOException Signals that an I/O exception of some sort has occurred */
Get a list of labels you have
get
{ "repo_name": "heinrich10/java", "path": "src/main/java/com/postmen/javasdk/service/LabelService.java", "license": "mit", "size": 5253 }
[ "com.postmen.javasdk.model.LabelsResponse", "com.postmen.javasdk.util.PostmenUrl", "java.io.IOException" ]
import com.postmen.javasdk.model.LabelsResponse; import com.postmen.javasdk.util.PostmenUrl; import java.io.IOException;
import com.postmen.javasdk.model.*; import com.postmen.javasdk.util.*; import java.io.*;
[ "com.postmen.javasdk", "java.io" ]
com.postmen.javasdk; java.io;
2,268,048
public void setSpec(XMLElement element) { spec = element; }
void function(XMLElement element) { spec = element; }
/** * Sets the specifaction to the given XML element. * * @param element */
Sets the specifaction to the given XML element
setSpec
{ "repo_name": "RomRaider/original.mirror", "path": "installer/IzPack/src/lib/com/izforge/izpack/util/SpecHelper.java", "license": "gpl-2.0", "size": 11132 }
[ "net.n3.nanoxml.XMLElement" ]
import net.n3.nanoxml.XMLElement;
import net.n3.nanoxml.*;
[ "net.n3.nanoxml" ]
net.n3.nanoxml;
1,601,621
public List<Object> getAny() { return Collections.unmodifiableList(this.any); }
List<Object> function() { return Collections.unmodifiableList(this.any); }
/** * Gets the value of the any property. Read-Only list */
Gets the value of the any property. Read-Only list
getAny
{ "repo_name": "dylanplecki/keycloak", "path": "saml/saml-core/src/main/java/org/keycloak/dom/saml/common/CommonStatusDetailType.java", "license": "apache-2.0", "size": 1881 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,923,603
@Test public void testToResponse() { SearchExceptionMapper mapper = new SearchExceptionMapper(); SearchException e = new SearchException("test"); Response r = mapper.toResponse(e); ErrorResponse er = (ErrorResponse) r.getEntity(); assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus()); assertEquals(Status.INTERNAL_SERVER_ERROR, er.getHttpStatus()); assertEquals("Internal Server Error", er.getErrorDescription()); }
void function() { SearchExceptionMapper mapper = new SearchExceptionMapper(); SearchException e = new SearchException("test"); Response r = mapper.toResponse(e); ErrorResponse er = (ErrorResponse) r.getEntity(); assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus()); assertEquals(Status.INTERNAL_SERVER_ERROR, er.getHttpStatus()); assertEquals(STR, er.getErrorDescription()); }
/** * Assert that an usual search exceptions map to a 500. */
Assert that an usual search exceptions map to a 500
testToResponse
{ "repo_name": "kangaroo-server/kangaroo", "path": "kangaroo-common/src/test/java/net/krotscheck/kangaroo/common/hibernate/mapper/SearchExceptionMapperTest.java", "license": "apache-2.0", "size": 2692 }
[ "javax.ws.rs.core.Response", "net.krotscheck.kangaroo.common.exception.ErrorResponseBuilder", "org.hibernate.search.exception.SearchException", "org.junit.Assert" ]
import javax.ws.rs.core.Response; import net.krotscheck.kangaroo.common.exception.ErrorResponseBuilder; import org.hibernate.search.exception.SearchException; import org.junit.Assert;
import javax.ws.rs.core.*; import net.krotscheck.kangaroo.common.exception.*; import org.hibernate.search.exception.*; import org.junit.*;
[ "javax.ws", "net.krotscheck.kangaroo", "org.hibernate.search", "org.junit" ]
javax.ws; net.krotscheck.kangaroo; org.hibernate.search; org.junit;
102,984
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<BalanceInner> getByBillingAccountAsync(String billingAccountId) { return getByBillingAccountWithResponseAsync(billingAccountId) .flatMap( (Response<BalanceInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<BalanceInner> function(String billingAccountId) { return getByBillingAccountWithResponseAsync(billingAccountId) .flatMap( (Response<BalanceInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
/** * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or * later. * * @param billingAccountId BillingAccount ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the balances for a scope by billingAccountId. */
Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later
getByBillingAccountAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/BalancesClientImpl.java", "license": "mit", "size": 16549 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.resourcemanager.consumption.fluent.models.BalanceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.consumption.fluent.models.BalanceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.consumption.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,289,099
public IntegerProperty translateYProperty() { return translateY; } // public final DoubleProperty rotateProperty() { // return rotate; // } // // public final DoubleProperty scaleXProperty() { // return scaleX; // } // // public final DoubleProperty scaleYProperty() { // return scaleY; // } // // public final DoubleProperty transformCenterXProperty() { // return transformCenterX; // } // // public final DoubleProperty transformCenterYProperty() { // return transformCenterY; // }
IntegerProperty function() { return translateY; }
/** * Returns the translateY property, which can be used to translate this component throught the y axis. * * @return The translateY property instance. */
Returns the translateY property, which can be used to translate this component throught the y axis
translateYProperty
{ "repo_name": "EagerLogic/Cubee", "path": "src/Cubee/src/main/java/com/eagerlogic/cubee/client/components/AComponent.java", "license": "apache-2.0", "size": 63202 }
[ "com.eagerlogic.cubee.client.properties.IntegerProperty" ]
import com.eagerlogic.cubee.client.properties.IntegerProperty;
import com.eagerlogic.cubee.client.properties.*;
[ "com.eagerlogic.cubee" ]
com.eagerlogic.cubee;
2,150,235
private void assertGlobalXactCount(int expectedCount ) throws SQLException { Connection conn = openDefaultConnection(); Statement s = conn.createStatement(); ResultSet rs = s.executeQuery( "SELECT COUNT(*) FROM syscs_diag.transaction_table WHERE GLOBAL_XID IS NOT NULL"); rs.next(); int count = rs.getInt(1); if (TestConfiguration.getCurrent().isVerbose()) { System.out.println("assertGlobalXactCount(" + expectedCount + "): Full Transaction Table ..."); Utilities.showResultSet(s.executeQuery( "SELECT * FROM syscs_diag.transaction_table")); } assertTrue("Expected " + expectedCount + "global transactions but saw " + count, expectedCount == count); }
void function(int expectedCount ) throws SQLException { Connection conn = openDefaultConnection(); Statement s = conn.createStatement(); ResultSet rs = s.executeQuery( STR); rs.next(); int count = rs.getInt(1); if (TestConfiguration.getCurrent().isVerbose()) { System.out.println(STR + expectedCount + STR); Utilities.showResultSet(s.executeQuery( STR)); } assertTrue(STR + expectedCount + STR + count, expectedCount == count); }
/** * Verify the expected number of global transactions. * Run test with -Dderby.tests.debug to see the full transaction table on the * console * * @param expectedCount expected number of global transaction * @throws SQLException on error */
Verify the expected number of global transactions. Run test with -Dderby.tests.debug to see the full transaction table on the console
assertGlobalXactCount
{ "repo_name": "kavin256/Derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java", "license": "apache-2.0", "size": 54819 }
[ "java.sql.Connection", "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Statement", "org.apache.derbyTesting.junit.TestConfiguration", "org.apache.derbyTesting.junit.Utilities" ]
import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.apache.derbyTesting.junit.TestConfiguration; import org.apache.derbyTesting.junit.Utilities;
import java.sql.*; import org.apache.*;
[ "java.sql", "org.apache" ]
java.sql; org.apache;
790,438
public void setFontAlign(FontAlign align){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); if(align == null) { if(pr.isSetFontAlgn()) pr.unsetFontAlgn(); } else { pr.setFontAlgn(STTextFontAlignType.Enum.forInt(align.ordinal() + 1)); } }
void function(FontAlign align){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); if(align == null) { if(pr.isSetFontAlgn()) pr.unsetFontAlgn(); } else { pr.setFontAlgn(STTextFontAlignType.Enum.forInt(align.ordinal() + 1)); } }
/** * Specifies the font alignment that is to be applied to the paragraph. * Possible values for this include auto, top, center, baseline and bottom. * see {@link org.apache.poi.sl.usermodel.TextParagraph.FontAlign}. * * @param align font align */
Specifies the font alignment that is to be applied to the paragraph. Possible values for this include auto, top, center, baseline and bottom. see <code>org.apache.poi.sl.usermodel.TextParagraph.FontAlign</code>
setFontAlign
{ "repo_name": "lvweiwolf/poi-3.16", "path": "src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java", "license": "apache-2.0", "size": 38988 }
[ "org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties", "org.openxmlformats.schemas.drawingml.x2006.main.STTextFontAlignType" ]
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; import org.openxmlformats.schemas.drawingml.x2006.main.STTextFontAlignType;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
[ "org.openxmlformats.schemas" ]
org.openxmlformats.schemas;
437,643
@Test public void test100AddHrAccountHerman() throws Exception { final String TEST_NAME = "test100AddHrAccountHerman"; displayTestTitle(TEST_NAME); Task task = taskManager.createTaskInstance(TestOrgSync.class.getName() + "." + TEST_NAME); DummyAccount newAccount = new DummyAccount(ACCOUNT_HERMAN_USERNAME); newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_HERMAN_FIST_NAME); newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_HERMAN_LAST_NAME); newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_MONKEY_ISLAND); // WHEN dummyResourceHr.addAccount(newAccount); waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject<UserType> user = findUserByUsername(ACCOUNT_HERMAN_USERNAME); assertNotNull("No herman user", user); display("User", user); assertUserHerman(user); assertAccount(user, RESOURCE_DUMMY_HR_OID); dumpOrgTree(); PrismObject<OrgType> org = getAndAssertReplicatedOrg(ORGPATH_MONKEY_ISLAND); orgMonkeyIslandOid = org.getOid(); assertAssignedOrg(user, org.getOid()); assertHasOrg(user, org.getOid()); assertHasOrg(org, ORG_TOP_OID); assertSubOrgs(org, 0); assertSubOrgs(ORG_TOP_OID, 1); assertBasicRoleAndResources(user); assertAssignments(user, 2); }
void function() throws Exception { final String TEST_NAME = STR; displayTestTitle(TEST_NAME); Task task = taskManager.createTaskInstance(TestOrgSync.class.getName() + "." + TEST_NAME); DummyAccount newAccount = new DummyAccount(ACCOUNT_HERMAN_USERNAME); newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_FIRST_NAME, ACCOUNT_HERMAN_FIST_NAME); newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_LAST_NAME, ACCOUNT_HERMAN_LAST_NAME); newAccount.addAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_ORGPATH, ORGPATH_MONKEY_ISLAND); dummyResourceHr.addAccount(newAccount); waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); PrismObject<UserType> user = findUserByUsername(ACCOUNT_HERMAN_USERNAME); assertNotNull(STR, user); display("User", user); assertUserHerman(user); assertAccount(user, RESOURCE_DUMMY_HR_OID); dumpOrgTree(); PrismObject<OrgType> org = getAndAssertReplicatedOrg(ORGPATH_MONKEY_ISLAND); orgMonkeyIslandOid = org.getOid(); assertAssignedOrg(user, org.getOid()); assertHasOrg(user, org.getOid()); assertHasOrg(org, ORG_TOP_OID); assertSubOrgs(org, 0); assertSubOrgs(ORG_TOP_OID, 1); assertBasicRoleAndResources(user); assertAssignments(user, 2); }
/** * First account on Monkey Island. The Monkey Island org should be created. */
First account on Monkey Island. The Monkey Island org should be created
test100AddHrAccountHerman
{ "repo_name": "bshp/midPoint", "path": "testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestOrgSync.java", "license": "apache-2.0", "size": 57829 }
[ "com.evolveum.icf.dummy.resource.DummyAccount", "com.evolveum.midpoint.prism.PrismObject", "com.evolveum.midpoint.task.api.Task", "com.evolveum.midpoint.test.IntegrationTestTools", "com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType", "com.evolveum.midpoint.xml.ns._public.common.common_3.UserType", "org.testng.AssertJUnit" ]
import com.evolveum.icf.dummy.resource.DummyAccount; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.IntegrationTestTools; import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import org.testng.AssertJUnit;
import com.evolveum.icf.dummy.resource.*; import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.task.api.*; import com.evolveum.midpoint.test.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.testng.*;
[ "com.evolveum.icf", "com.evolveum.midpoint", "org.testng" ]
com.evolveum.icf; com.evolveum.midpoint; org.testng;
2,426,064
@Public @Stable @AtMostOnce public FinishApplicationMasterResponse finishApplicationMaster( FinishApplicationMasterRequest request) throws YarnException, IOException;
FinishApplicationMasterResponse function( FinishApplicationMasterRequest request) throws YarnException, IOException;
/** * <p>The interface used by an <code>ApplicationMaster</code> to notify the * <code>ResourceManager</code> about its completion (success or failed).</p> * * <p>The <code>ApplicationMaster</code> has to provide details such as * final state, diagnostics (in case of failures) etc. as specified in * {@link FinishApplicationMasterRequest}.</p> * * <p>The <code>ResourceManager</code> responds with * {@link FinishApplicationMasterResponse}.</p> * * @param request completion request * @return completion response * @throws YarnException * @throws IOException * @see FinishApplicationMasterRequest * @see FinishApplicationMasterResponse */
The interface used by an <code>ApplicationMaster</code> to notify the <code>ResourceManager</code> about its completion (success or failed). The <code>ApplicationMaster</code> has to provide details such as final state, diagnostics (in case of failures) etc. as specified in <code>FinishApplicationMasterRequest</code>. The <code>ResourceManager</code> responds with <code>FinishApplicationMasterResponse</code>
finishApplicationMaster
{ "repo_name": "dennishuo/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationMasterProtocol.java", "license": "apache-2.0", "size": 6942 }
[ "java.io.IOException", "org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest", "org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse", "org.apache.hadoop.yarn.exceptions.YarnException" ]
import java.io.IOException; import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest; import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; import org.apache.hadoop.yarn.exceptions.YarnException;
import java.io.*; import org.apache.hadoop.yarn.api.protocolrecords.*; import org.apache.hadoop.yarn.exceptions.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
679,463
@Override public CmsModule clone() { // create a copy of the module CmsModule result = new CmsModule( m_name, m_niceName, m_group, m_actionClass, m_importScript, m_site, m_hasImportSite, m_exportMode, m_description, m_version, m_authorName, m_authorEmail, m_dateCreated, m_userInstalled, m_dateInstalled, m_dependencies, m_exportPoints, m_resources, m_excluderesources, m_parameters); // and set its frozen state to false result.m_frozen = false; if (getExplorerTypes() != null) { List<CmsExplorerTypeSettings> settings = new ArrayList<CmsExplorerTypeSettings>(); for (CmsExplorerTypeSettings setting : getExplorerTypes()) { settings.add((CmsExplorerTypeSettings)setting.clone()); } result.setExplorerTypes(settings); } if (getResourceTypes() != null) { // TODO: The resource types must be cloned also, otherwise modification will effect the origin also result.setResourceTypes(new ArrayList<I_CmsResourceType>(getResourceTypes())); } if (getDependencies() != null) { List<CmsModuleDependency> deps = new ArrayList<CmsModuleDependency>(); for (CmsModuleDependency dep : getDependencies()) { deps.add((CmsModuleDependency)dep.clone()); } result.setDependencies(new ArrayList<CmsModuleDependency>(getDependencies())); } if (getExportPoints() != null) { List<CmsExportPoint> exps = new ArrayList<CmsExportPoint>(); for (CmsExportPoint exp : getExportPoints()) { exps.add((CmsExportPoint)exp.clone()); } result.setExportPoints(exps); } result.setAutoIncrement(m_autoIncrement); result.setCheckpointTime(m_checkpointTime); result.setCreateClassesFolder(m_createClassesFolder); result.setCreateElementsFolder(m_createElementsFolder); result.setCreateLibFolder(m_createLibFolder); result.setCreateModuleFolder(m_createModuleFolder); result.setCreateResourcesFolder(m_createResourcesFolder); result.setCreateSchemasFolder(m_createSchemasFolder); result.setCreateTemplateFolder(m_createTemplateFolder); result.setCreateFormattersFolder(m_createFormattersFolder); result.setResources(new ArrayList<String>(m_resources)); result.setExcludeResources(new ArrayList<String>(m_excluderesources)); return result; }
CmsModule function() { CmsModule result = new CmsModule( m_name, m_niceName, m_group, m_actionClass, m_importScript, m_site, m_hasImportSite, m_exportMode, m_description, m_version, m_authorName, m_authorEmail, m_dateCreated, m_userInstalled, m_dateInstalled, m_dependencies, m_exportPoints, m_resources, m_excluderesources, m_parameters); result.m_frozen = false; if (getExplorerTypes() != null) { List<CmsExplorerTypeSettings> settings = new ArrayList<CmsExplorerTypeSettings>(); for (CmsExplorerTypeSettings setting : getExplorerTypes()) { settings.add((CmsExplorerTypeSettings)setting.clone()); } result.setExplorerTypes(settings); } if (getResourceTypes() != null) { result.setResourceTypes(new ArrayList<I_CmsResourceType>(getResourceTypes())); } if (getDependencies() != null) { List<CmsModuleDependency> deps = new ArrayList<CmsModuleDependency>(); for (CmsModuleDependency dep : getDependencies()) { deps.add((CmsModuleDependency)dep.clone()); } result.setDependencies(new ArrayList<CmsModuleDependency>(getDependencies())); } if (getExportPoints() != null) { List<CmsExportPoint> exps = new ArrayList<CmsExportPoint>(); for (CmsExportPoint exp : getExportPoints()) { exps.add((CmsExportPoint)exp.clone()); } result.setExportPoints(exps); } result.setAutoIncrement(m_autoIncrement); result.setCheckpointTime(m_checkpointTime); result.setCreateClassesFolder(m_createClassesFolder); result.setCreateElementsFolder(m_createElementsFolder); result.setCreateLibFolder(m_createLibFolder); result.setCreateModuleFolder(m_createModuleFolder); result.setCreateResourcesFolder(m_createResourcesFolder); result.setCreateSchemasFolder(m_createSchemasFolder); result.setCreateTemplateFolder(m_createTemplateFolder); result.setCreateFormattersFolder(m_createFormattersFolder); result.setResources(new ArrayList<String>(m_resources)); result.setExcludeResources(new ArrayList<String>(m_excluderesources)); return result; }
/** * Clones a CmsModule which is not set to frozen.<p> * This clones module can be used to be update the module information. * * @see java.lang.Object#clone() */
Clones a CmsModule which is not set to frozen. This clones module can be used to be update the module information
clone
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/module/CmsModule.java", "license": "lgpl-2.1", "size": 55528 }
[ "java.util.ArrayList", "java.util.List", "org.opencms.db.CmsExportPoint", "org.opencms.workplace.explorer.CmsExplorerTypeSettings" ]
import java.util.ArrayList; import java.util.List; import org.opencms.db.CmsExportPoint; import org.opencms.workplace.explorer.CmsExplorerTypeSettings;
import java.util.*; import org.opencms.db.*; import org.opencms.workplace.explorer.*;
[ "java.util", "org.opencms.db", "org.opencms.workplace" ]
java.util; org.opencms.db; org.opencms.workplace;
456,577
public static String getDayName(Context context, String dateStr) { SimpleDateFormat dbDateFormat = new SimpleDateFormat(Utility.DATE_FORMAT,Locale.ENGLISH); try { Date inputDate = dbDateFormat.parse(dateStr); Date todayDate = new Date(); // If the date is today, return the localized version of "Today" instead of the actual // day name. if (WeatherContract.getDbDateString(todayDate).equals(dateStr)) { return context.getString(R.string.today); } else { // If the date is set for tomorrow, the format is "Tomorrow". Calendar cal = Calendar.getInstance(); cal.setTime(todayDate); cal.add(Calendar.DATE, 1); Date tomorrowDate = cal.getTime(); if (WeatherContract.getDbDateString(tomorrowDate).equals( dateStr)) { return context.getString(R.string.tomorrow); } else { // Otherwise, the format is just the day of the week (e.g "Wednesday". SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE",Locale.ENGLISH); return dayFormat.format(inputDate); } } } catch (ParseException e) { Log.e(Utility.class.getSimpleName(), "Date invalid exception ! ", e); // Couldn't process the date correctly. return dateStr; } }
static String function(Context context, String dateStr) { SimpleDateFormat dbDateFormat = new SimpleDateFormat(Utility.DATE_FORMAT,Locale.ENGLISH); try { Date inputDate = dbDateFormat.parse(dateStr); Date todayDate = new Date(); if (WeatherContract.getDbDateString(todayDate).equals(dateStr)) { return context.getString(R.string.today); } else { Calendar cal = Calendar.getInstance(); cal.setTime(todayDate); cal.add(Calendar.DATE, 1); Date tomorrowDate = cal.getTime(); if (WeatherContract.getDbDateString(tomorrowDate).equals( dateStr)) { return context.getString(R.string.tomorrow); } else { SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE",Locale.ENGLISH); return dayFormat.format(inputDate); } } } catch (ParseException e) { Log.e(Utility.class.getSimpleName(), STR, e); return dateStr; } }
/** * Given a day, returns just the name to use for that day. * E.g "today", "tomorrow", "wednesday". * * @param context Context to use for resource localization * @param dateStr The db formatted date string, expected to be of the form specified * in Utility.DATE_FORMAT * @return */
Given a day, returns just the name to use for that day. E.g "today", "tomorrow", "wednesday"
getDayName
{ "repo_name": "abbashosseini/Android-weather", "path": "app/src/main/java/com/hosseini/abbas/havakhabar/app/Other/Utility.java", "license": "apache-2.0", "size": 13991 }
[ "android.content.Context", "android.util.Log", "com.hosseini.abbas.havakhabar.app.data.WeatherContract", "java.text.ParseException", "java.text.SimpleDateFormat", "java.util.Calendar", "java.util.Date", "java.util.Locale" ]
import android.content.Context; import android.util.Log; import com.hosseini.abbas.havakhabar.app.data.WeatherContract; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale;
import android.content.*; import android.util.*; import com.hosseini.abbas.havakhabar.app.data.*; import java.text.*; import java.util.*;
[ "android.content", "android.util", "com.hosseini.abbas", "java.text", "java.util" ]
android.content; android.util; com.hosseini.abbas; java.text; java.util;
1,437,540
public static ArrayList<User> createDummyUsers() { ArrayList<User> users = new ArrayList<>(); users.add(new User("Evan Spiegel", "e.spiegel@snapchat.com", "CEO", "http://static5.businessinsider.com/image/539b5f6eeab8ea0266b8bbce-480/snapchat-evan-spiegel.jpg", true)); users.add(new User("Travis Cordell", "travis@uber.com", "Entrepreneur", "https://s3.amazonaws.com/chicago_ideas_production/portraits/medium/61.jpg?1326134159", true)); users.add(new User("Emma Watson", "emma@hogwarts.com", "Actor/Director", "http://static.dnaindia.com/sites/default/files/2015/02/23/313017-emma-watson-2.jpg", true)); users.add(new User("Mark Zuckerberg", "mark@facebook.com", "CEO", "https://pbs.twimg.com/profile_images/1146014416/mark-zuckerberg.jpg", true)); users.add(new User("Tom Anderson", "friend@myspace.com", "Rich has-been", "http://www.techyville.com/wp-content/uploads/2012/12/tom-myspace.jpg", true)); users.add(new User("Sean Parker", "sean@napster.com", "Not so rich because of lawsuits has-been", "http://static.trustedreviews.com/94/000025f9d/143d_orh350w620/Napster-Logo.jpg", true)); return users; }
static ArrayList<User> function() { ArrayList<User> users = new ArrayList<>(); users.add(new User(STR, STR, "CEO", STRTravis CordellSTRtravis@uber.comSTREntrepreneurSTRhttps: users.add(new User("Emma WatsonSTRemma@hogwarts.comSTRActor/Director", STRMark ZuckerbergSTRmark@facebook.comSTRCEOSTRhttps: users.add(new User("Tom AndersonSTRfriend@myspace.comSTRRich has-been", STRSean ParkerSTRsean@napster.comSTRNot so rich because of lawsuits has-beenSTRhttp: return users; }
/** * Creates dummy User objects * * @return list with dummy users */
Creates dummy User objects
createDummyUsers
{ "repo_name": "JoaquimLey/by-invitation-only-android", "path": "app/src/main/java/com/joaquimley/byinvitationonly/BioApp.java", "license": "gpl-2.0", "size": 13785 }
[ "com.joaquimley.byinvitationonly.model.User", "java.util.ArrayList" ]
import com.joaquimley.byinvitationonly.model.User; import java.util.ArrayList;
import com.joaquimley.byinvitationonly.model.*; import java.util.*;
[ "com.joaquimley.byinvitationonly", "java.util" ]
com.joaquimley.byinvitationonly; java.util;
840,636
public Object receive() throws IOException, ClassNotFoundException { Object v = null; synchronized (in) { v = in.readObject(); } return v; }
Object function() throws IOException, ClassNotFoundException { Object v = null; synchronized (in) { v = in.readObject(); } return v; }
/** * Receives an object */
Receives an object
receive
{ "repo_name": "breandan/java-algebra-system", "path": "src/edu/jas/util/SocketChannel.java", "license": "gpl-2.0", "size": 2148 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,385,733
private void connect(Session session, boolean withReadOnlyData) { // Open new cache: if ((dataSource.length() == 0) || isConnected) { // nothing to do return; } PersistentStore store = database.persistentStoreCollection.getStore(this); this.store = store; TextCache cache = null; TextFileReader reader = null; try { cache = (TextCache) database.logger.openTextFilePersistence(this, dataSource, withReadOnlyData, isReversed); store.setCache(cache); reader = cache.getTextFileReader(); // read and insert all the rows from the source file Row row = null; long nextpos = 0; if (cache.isIgnoreFirstLine()) { nextpos += reader.readHeaderLine(); cache.setHeaderInitialise(reader.getHeaderLine()); } while (true) { RowInputInterface rowIn = reader.readObject(nextpos); if (rowIn == null) { break; } row = (Row) store.get(rowIn); if (row == null) { break; } Object[] data = row.getData(); nextpos = (int) row.getPos() + row.getStorageSize(); systemUpdateIdentityValue(data); enforceRowConstraints(session, data); store.indexRow(session, row); } } catch (Throwable t) { int linenumber = reader == null ? 0 : reader.getLineNumber(); clearAllData(session); if (cache != null) { database.logger.closeTextCache(this); store.release(); } // everything is in order here. // At this point table should either have a valid (old) data // source and cache or have an empty source and null cache. throw Error.error(t, ErrorCode.TEXT_FILE, 0, new Object[] { new Integer(linenumber), t.toString() }); } isConnected = true; isReadOnly = withReadOnlyData; }
void function(Session session, boolean withReadOnlyData) { if ((dataSource.length() == 0) isConnected) { return; } PersistentStore store = database.persistentStoreCollection.getStore(this); this.store = store; TextCache cache = null; TextFileReader reader = null; try { cache = (TextCache) database.logger.openTextFilePersistence(this, dataSource, withReadOnlyData, isReversed); store.setCache(cache); reader = cache.getTextFileReader(); Row row = null; long nextpos = 0; if (cache.isIgnoreFirstLine()) { nextpos += reader.readHeaderLine(); cache.setHeaderInitialise(reader.getHeaderLine()); } while (true) { RowInputInterface rowIn = reader.readObject(nextpos); if (rowIn == null) { break; } row = (Row) store.get(rowIn); if (row == null) { break; } Object[] data = row.getData(); nextpos = (int) row.getPos() + row.getStorageSize(); systemUpdateIdentityValue(data); enforceRowConstraints(session, data); store.indexRow(session, row); } } catch (Throwable t) { int linenumber = reader == null ? 0 : reader.getLineNumber(); clearAllData(session); if (cache != null) { database.logger.closeTextCache(this); store.release(); } throw Error.error(t, ErrorCode.TEXT_FILE, 0, new Object[] { new Integer(linenumber), t.toString() }); } isConnected = true; isReadOnly = withReadOnlyData; }
/** * connects to the data source */
connects to the data source
connect
{ "repo_name": "ferquies/2dam", "path": "AD/Tema 2/hsqldb-2.3.1/hsqldb/src/org/hsqldb/TextTable.java", "license": "gpl-3.0", "size": 10947 }
[ "org.hsqldb.error.Error", "org.hsqldb.error.ErrorCode", "org.hsqldb.persist.PersistentStore", "org.hsqldb.persist.TextCache", "org.hsqldb.persist.TextFileReader", "org.hsqldb.rowio.RowInputInterface" ]
import org.hsqldb.error.Error; import org.hsqldb.error.ErrorCode; import org.hsqldb.persist.PersistentStore; import org.hsqldb.persist.TextCache; import org.hsqldb.persist.TextFileReader; import org.hsqldb.rowio.RowInputInterface;
import org.hsqldb.error.*; import org.hsqldb.persist.*; import org.hsqldb.rowio.*;
[ "org.hsqldb.error", "org.hsqldb.persist", "org.hsqldb.rowio" ]
org.hsqldb.error; org.hsqldb.persist; org.hsqldb.rowio;
55,584
CompletableFuture<Objective> populateBridging(DeviceId deviceId, PortNumber port, MacAddress mac, VlanId vlanId) { ForwardingObjective.Builder fob = bridgingFwdObjBuilder(deviceId, mac, vlanId, port, false); if (fob == null) { log.warn("Fail to build fwd obj for host {}/{}. Abort.", mac, vlanId); return CompletableFuture.completedFuture(null); } CompletableFuture<Objective> future = new CompletableFuture<>(); ObjectiveContext context = new DefaultObjectiveContext( (objective) -> { log.debug("Brigding rule for {}/{} populated", mac, vlanId); future.complete(objective); }, (objective, error) -> { log.warn("Failed to populate bridging rule for {}/{}: {}", mac, vlanId, error); future.complete(null); }); srManager.flowObjectiveService.forward(deviceId, fob.add(context)); return future; }
CompletableFuture<Objective> populateBridging(DeviceId deviceId, PortNumber port, MacAddress mac, VlanId vlanId) { ForwardingObjective.Builder fob = bridgingFwdObjBuilder(deviceId, mac, vlanId, port, false); if (fob == null) { log.warn(STR, mac, vlanId); return CompletableFuture.completedFuture(null); } CompletableFuture<Objective> future = new CompletableFuture<>(); ObjectiveContext context = new DefaultObjectiveContext( (objective) -> { log.debug(STR, mac, vlanId); future.complete(objective); }, (objective, error) -> { log.warn(STR, mac, vlanId, error); future.complete(null); }); srManager.flowObjectiveService.forward(deviceId, fob.add(context)); return future; }
/** * Populate a bridging rule on given deviceId that matches given mac, given vlan and * output to given port. * * @param deviceId device ID * @param port port * @param mac mac address * @param vlanId VLAN ID * @return future that carries the flow objective if succeeded, null if otherwise */
Populate a bridging rule on given deviceId that matches given mac, given vlan and output to given port
populateBridging
{ "repo_name": "oplinkoms/onos", "path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java", "license": "apache-2.0", "size": 90615 }
[ "java.util.concurrent.CompletableFuture", "org.onlab.packet.MacAddress", "org.onlab.packet.VlanId", "org.onosproject.net.DeviceId", "org.onosproject.net.PortNumber", "org.onosproject.net.flowobjective.DefaultObjectiveContext", "org.onosproject.net.flowobjective.ForwardingObjective", "org.onosproject.net.flowobjective.Objective", "org.onosproject.net.flowobjective.ObjectiveContext" ]
import java.util.concurrent.CompletableFuture; import org.onlab.packet.MacAddress; import org.onlab.packet.VlanId; import org.onosproject.net.DeviceId; import org.onosproject.net.PortNumber; import org.onosproject.net.flowobjective.DefaultObjectiveContext; import org.onosproject.net.flowobjective.ForwardingObjective; import org.onosproject.net.flowobjective.Objective; import org.onosproject.net.flowobjective.ObjectiveContext;
import java.util.concurrent.*; import org.onlab.packet.*; import org.onosproject.net.*; import org.onosproject.net.flowobjective.*;
[ "java.util", "org.onlab.packet", "org.onosproject.net" ]
java.util; org.onlab.packet; org.onosproject.net;
2,001,889
@org.junit.Test public void action() throws Exception { RMTHelper helper = RMTHelper.getDefaultInstance(); final ResourceManager r = helper.getResourceManager(); // The username and thr password must be the same a used to connect to the RM final String adminLogin = RMTHelper.defaultUserName; final String adminPassword = RMTHelper.defaultUserPassword; // All accounting values are checked through JMX final RMAuthentication auth = (RMAuthentication) helper.getRMAuth(); final PublicKey pubKey = auth.getPublicKey(); final Credentials adminCreds = Credentials.createCredentials(new CredData(adminLogin, adminPassword), pubKey); final JMXServiceURL jmxRmiServiceURL = new JMXServiceURL(auth .getJMXConnectorURL(JMXTransportProtocol.RMI)); final HashMap<String, Object> env = new HashMap<String, Object>(1); env.put(JMXConnector.CREDENTIALS, new Object[] { adminLogin, adminCreds }); // Connect to the JMX RMI Connector Server final ObjectName myAccountMBeanName = new ObjectName(RMJMXHelper.MYACCOUNT_MBEAN_NAME); final ObjectName managementMBeanName = new ObjectName(RMJMXHelper.MANAGEMENT_MBEAN_NAME); final JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxRmiServiceURL, env); final MBeanServerConnection conn = jmxConnector.getMBeanServerConnection(); // Ensure that no refreshes was done and all account values are correctly initialized AttributeList atts = conn.getAttributes(myAccountMBeanName, new String[] { "UsedNodeTime", "ProvidedNodeTime", "ProvidedNodesCount" }); long usedNodeTime = (Long) ((Attribute) atts.get(0)).getValue(); long providedNodeTime = (Long) ((Attribute) atts.get(1)).getValue(); int providedNodesCount = (Integer) ((Attribute) atts.get(2)).getValue(); // ADD, GET, RELEASE, REMOVE // 1) ADD final long beforeAddTime = System.currentTimeMillis(); Node node = helper.createNode("test").getNode(); final String nodeURL = node.getNodeInformation().getURL(); r.addNode(nodeURL).getBooleanValue(); // We eat the configuring to free event helper.waitForAnyNodeEvent(RMEventType.NODE_ADDED); helper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED); // 2) GET final long beforeGetTime = System.currentTimeMillis(); node = r.getAtMostNodes(1, null).get(0); // Sleep a certain amount of time that will be the minimum amount of the GET->RELEASE duration Thread.sleep(GR_DURATION); // 3) RELEASE r.releaseNode(node).getBooleanValue(); final long getReleaseMaxDuration = System.currentTimeMillis() - beforeGetTime; // 4) REMOVE r.removeNode(nodeURL, true).getBooleanValue(); final long addRemoveMaxDuration = System.currentTimeMillis() - beforeAddTime; // Refresh the account manager conn.invoke(managementMBeanName, "clearAccoutingCache", null, null); // Check account values validity atts = conn.getAttributes(myAccountMBeanName, new String[] { "UsedNodeTime", "ProvidedNodeTime", "ProvidedNodesCount" }); usedNodeTime = (Long) ((Attribute) atts.get(0)).getValue() - usedNodeTime; providedNodeTime = (Long) ((Attribute) atts.get(1)).getValue() - providedNodeTime; providedNodesCount = (Integer) ((Attribute) atts.get(2)).getValue() - providedNodesCount; Assert.assertTrue("Invalid value of the usedNodeTime attribute", (usedNodeTime >= GR_DURATION) && (usedNodeTime <= getReleaseMaxDuration)); Assert.assertTrue("Invalid value of the providedNodeTime attribute", (providedNodeTime >= usedNodeTime) && (providedNodeTime <= addRemoveMaxDuration)); if (!FunctionalTest.consecutiveMode) { // in consecutive mode if user already provided this node before this value does not change Assert.assertEquals("Invalid value of the providedNodesCount attribute", 1, providedNodesCount); } }
@org.junit.Test void function() throws Exception { RMTHelper helper = RMTHelper.getDefaultInstance(); final ResourceManager r = helper.getResourceManager(); final String adminLogin = RMTHelper.defaultUserName; final String adminPassword = RMTHelper.defaultUserPassword; final RMAuthentication auth = (RMAuthentication) helper.getRMAuth(); final PublicKey pubKey = auth.getPublicKey(); final Credentials adminCreds = Credentials.createCredentials(new CredData(adminLogin, adminPassword), pubKey); final JMXServiceURL jmxRmiServiceURL = new JMXServiceURL(auth .getJMXConnectorURL(JMXTransportProtocol.RMI)); final HashMap<String, Object> env = new HashMap<String, Object>(1); env.put(JMXConnector.CREDENTIALS, new Object[] { adminLogin, adminCreds }); final ObjectName myAccountMBeanName = new ObjectName(RMJMXHelper.MYACCOUNT_MBEAN_NAME); final ObjectName managementMBeanName = new ObjectName(RMJMXHelper.MANAGEMENT_MBEAN_NAME); final JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxRmiServiceURL, env); final MBeanServerConnection conn = jmxConnector.getMBeanServerConnection(); AttributeList atts = conn.getAttributes(myAccountMBeanName, new String[] { STR, STR, STR }); long usedNodeTime = (Long) ((Attribute) atts.get(0)).getValue(); long providedNodeTime = (Long) ((Attribute) atts.get(1)).getValue(); int providedNodesCount = (Integer) ((Attribute) atts.get(2)).getValue(); final long beforeAddTime = System.currentTimeMillis(); Node node = helper.createNode("test").getNode(); final String nodeURL = node.getNodeInformation().getURL(); r.addNode(nodeURL).getBooleanValue(); helper.waitForAnyNodeEvent(RMEventType.NODE_ADDED); helper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED); final long beforeGetTime = System.currentTimeMillis(); node = r.getAtMostNodes(1, null).get(0); Thread.sleep(GR_DURATION); r.releaseNode(node).getBooleanValue(); final long getReleaseMaxDuration = System.currentTimeMillis() - beforeGetTime; r.removeNode(nodeURL, true).getBooleanValue(); final long addRemoveMaxDuration = System.currentTimeMillis() - beforeAddTime; conn.invoke(managementMBeanName, STR, null, null); atts = conn.getAttributes(myAccountMBeanName, new String[] { STR, STR, STR }); usedNodeTime = (Long) ((Attribute) atts.get(0)).getValue() - usedNodeTime; providedNodeTime = (Long) ((Attribute) atts.get(1)).getValue() - providedNodeTime; providedNodesCount = (Integer) ((Attribute) atts.get(2)).getValue() - providedNodesCount; Assert.assertTrue(STR, (usedNodeTime >= GR_DURATION) && (usedNodeTime <= getReleaseMaxDuration)); Assert.assertTrue(STR, (providedNodeTime >= usedNodeTime) && (providedNodeTime <= addRemoveMaxDuration)); if (!FunctionalTest.consecutiveMode) { Assert.assertEquals(STR, 1, providedNodesCount); } }
/** * Test function. * @throws Exception */
Test function
action
{ "repo_name": "acontes/scheduling", "path": "src/resource-manager/tests/functionaltests/jmx/account/AddGetReleaseRemoveTest.java", "license": "agpl-3.0", "size": 7764 }
[ "java.security.PublicKey", "java.util.HashMap", "javax.management.Attribute", "javax.management.AttributeList", "javax.management.MBeanServerConnection", "javax.management.ObjectName", "javax.management.remote.JMXConnector", "javax.management.remote.JMXConnectorFactory", "javax.management.remote.JMXServiceURL", "org.junit.Assert", "org.objectweb.proactive.core.node.Node", "org.ow2.proactive.authentication.crypto.CredData", "org.ow2.proactive.authentication.crypto.Credentials", "org.ow2.proactive.jmx.naming.JMXTransportProtocol", "org.ow2.proactive.resourcemanager.authentication.RMAuthentication", "org.ow2.proactive.resourcemanager.common.event.RMEventType", "org.ow2.proactive.resourcemanager.core.jmx.RMJMXHelper", "org.ow2.proactive.resourcemanager.frontend.ResourceManager", "org.ow2.tests.FunctionalTest" ]
import java.security.PublicKey; import java.util.HashMap; import javax.management.Attribute; import javax.management.AttributeList; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import org.junit.Assert; import org.objectweb.proactive.core.node.Node; import org.ow2.proactive.authentication.crypto.CredData; import org.ow2.proactive.authentication.crypto.Credentials; import org.ow2.proactive.jmx.naming.JMXTransportProtocol; import org.ow2.proactive.resourcemanager.authentication.RMAuthentication; import org.ow2.proactive.resourcemanager.common.event.RMEventType; import org.ow2.proactive.resourcemanager.core.jmx.RMJMXHelper; import org.ow2.proactive.resourcemanager.frontend.ResourceManager; import org.ow2.tests.FunctionalTest;
import java.security.*; import java.util.*; import javax.management.*; import javax.management.remote.*; import org.junit.*; import org.objectweb.proactive.core.node.*; import org.ow2.proactive.authentication.crypto.*; import org.ow2.proactive.jmx.naming.*; import org.ow2.proactive.resourcemanager.authentication.*; import org.ow2.proactive.resourcemanager.common.event.*; import org.ow2.proactive.resourcemanager.core.jmx.*; import org.ow2.proactive.resourcemanager.frontend.*; import org.ow2.tests.*;
[ "java.security", "java.util", "javax.management", "org.junit", "org.objectweb.proactive", "org.ow2.proactive", "org.ow2.tests" ]
java.security; java.util; javax.management; org.junit; org.objectweb.proactive; org.ow2.proactive; org.ow2.tests;
1,511,669
public static Response load(File fileResponse) throws JSONStructureException { try (BufferedReader br = new BufferedReader(new FileReader(fileResponse))) { String responseString = ""; String line; while ((line = br.readLine()) != null) { responseString += line; } br.close(); return load(responseString); } catch (Exception e) { throw new JSONStructureException(e); } }
static Response function(File fileResponse) throws JSONStructureException { try (BufferedReader br = new BufferedReader(new FileReader(fileResponse))) { String responseString = ""; String line; while ((line = br.readLine()) != null) { responseString += line; } br.close(); return load(responseString); } catch (Exception e) { throw new JSONStructureException(e); } }
/** * Read a file containing an JSON representation of a Response and parse it into a * {@link org.apache.openaz.xacml.api.Response} Object. This is used only for testing since Responses in * the normal environment are generated by the PDP code. * * @param fileResponse * @return * @throws JSONStructureException */
Read a file containing an JSON representation of a Response and parse it into a <code>org.apache.openaz.xacml.api.Response</code> Object. This is used only for testing since Responses in the normal environment are generated by the PDP code
load
{ "repo_name": "mefarazath/incubator-openaz", "path": "openaz-xacml/src/main/java/org/apache/openaz/xacml/std/json/JSONResponse.java", "license": "apache-2.0", "size": 96377 }
[ "java.io.BufferedReader", "java.io.File", "java.io.FileReader", "org.apache.openaz.xacml.api.Response" ]
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import org.apache.openaz.xacml.api.Response;
import java.io.*; import org.apache.openaz.xacml.api.*;
[ "java.io", "org.apache.openaz" ]
java.io; org.apache.openaz;
354,819
public static boolean isMatching(String input, String regex) { // Important to use the CANON_EQ flag to make sure that canonical characters // such as é is correctly matched regardless of single/double code point encoding return Pattern.compile(regex, Pattern.CANON_EQ).matcher(input).matches(); }
static boolean function(String input, String regex) { return Pattern.compile(regex, Pattern.CANON_EQ).matcher(input).matches(); }
/** * Checks whether the input string matches the regex. * @param input The string to be matched * @param regex The regex used for the matching */
Checks whether the input string matches the regex
isMatching
{ "repo_name": "Gorgony/teammates", "path": "src/main/java/teammates/common/util/StringHelper.java", "license": "gpl-2.0", "size": 20462 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,275,657
int updateByPrimaryKeyWithBLOBs(Milestone record);
int updateByPrimaryKeyWithBLOBs(Milestone record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_prj_milestone * * @mbggenerated Mon Sep 21 13:52:03 ICT 2015 */
This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_milestone
updateByPrimaryKeyWithBLOBs
{ "repo_name": "maduhu/mycollab", "path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/dao/MilestoneMapper.java", "license": "agpl-3.0", "size": 5589 }
[ "com.esofthead.mycollab.module.project.domain.Milestone" ]
import com.esofthead.mycollab.module.project.domain.Milestone;
import com.esofthead.mycollab.module.project.domain.*;
[ "com.esofthead.mycollab" ]
com.esofthead.mycollab;
2,871,862
public final MetaProperty<Double> unitNumber() { return _unitNumber; }
final MetaProperty<Double> function() { return _unitNumber; }
/** * The meta-property for the {@code unitNumber} property. * @return the meta-property, not null */
The meta-property for the unitNumber property
unitNumber
{ "repo_name": "McLeodMoores/starling", "path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/future/FutureSecurityBean.java", "license": "apache-2.0", "size": 24798 }
[ "org.joda.beans.MetaProperty" ]
import org.joda.beans.MetaProperty;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
1,611,869
public void filterMarkers (final Collection<? extends SNPMarker> maskMarkers, final boolean include, final ErrorMatrix backupMatrix);
void function (final Collection<? extends SNPMarker> maskMarkers, final boolean include, final ErrorMatrix backupMatrix);
/** * Convenience method for multiple calls to filterMarker * @param maskMarkers - Markers in question * @param include - true to include, false to exclude */
Convenience method for multiple calls to filterMarker
filterMarkers
{ "repo_name": "martingraham/viper", "path": "src/napier/pedigree/model/ErrorMatrix.java", "license": "gpl-3.0", "size": 4267 }
[ "java.util.Collection", "org.resspecies.inheritance.model.SNPMarker" ]
import java.util.Collection; import org.resspecies.inheritance.model.SNPMarker;
import java.util.*; import org.resspecies.inheritance.model.*;
[ "java.util", "org.resspecies.inheritance" ]
java.util; org.resspecies.inheritance;
1,834,613
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) { // 重新计时 inactivityTimer.onActivity(); lastResult = rawResult; // 把图片画到扫描框 viewfinderView.drawResultBitmap(barcode); beepManager.playBeepSoundAndVibrate(); String qrcode = ResultParser.parseResult(rawResult).toString() ; // Toast.makeText(this, // "识别结果:" + ResultParser.parseResult(rawResult).toString()+"\n" // + "编码格式为:"+rawResult.getBarcodeFormat().toString()+"\n" // + "Result=:"+rawResult.getClass().getName(), // Toast.LENGTH_LONG).show(); returnQrcode(qrcode); }
void function(Result rawResult, Bitmap barcode, float scaleFactor) { inactivityTimer.onActivity(); lastResult = rawResult; viewfinderView.drawResultBitmap(barcode); beepManager.playBeepSoundAndVibrate(); String qrcode = ResultParser.parseResult(rawResult).toString() ; returnQrcode(qrcode); }
/** * A valid barcode has been found, so give an indication of success and show * the results. * * @param rawResult * The contents of the barcode. * @param scaleFactor * amount by which thumbnail was scaled * @param barcode * A greyscale bitmap of the camera data which was decoded. */
A valid barcode has been found, so give an indication of success and show the results
handleDecode
{ "repo_name": "JNDX25219/ZhiHuiDianTi", "path": "app/src/main/java/com/example/administrator/zhihuidianti/activity/zxing/CaptureActivity.java", "license": "apache-2.0", "size": 15567 }
[ "android.graphics.Bitmap", "com.google.zxing.Result", "com.google.zxing.client.result.ResultParser" ]
import android.graphics.Bitmap; import com.google.zxing.Result; import com.google.zxing.client.result.ResultParser;
import android.graphics.*; import com.google.zxing.*; import com.google.zxing.client.result.*;
[ "android.graphics", "com.google.zxing" ]
android.graphics; com.google.zxing;
757,394
@Override public boolean onTouchEvent(MotionEvent event) { // Give everything to the gesture detector boolean retValue = mGestureDetector.onTouchEvent(event); int action = event.getAction(); if (action == MotionEvent.ACTION_UP) { // Helper method for lifted finger onUp(); } else if (action == MotionEvent.ACTION_CANCEL) { onCancel(); } return retValue; }
boolean function(MotionEvent event) { boolean retValue = mGestureDetector.onTouchEvent(event); int action = event.getAction(); if (action == MotionEvent.ACTION_UP) { onUp(); } else if (action == MotionEvent.ACTION_CANCEL) { onCancel(); } return retValue; }
/** * Implemented to handle touch screen motion events. */
Implemented to handle touch screen motion events
onTouchEvent
{ "repo_name": "Git-tl/appcan-plugin-timemachine-android", "path": "uexTimeMachine/src/org/zywx/wbpalmstar/plugin/uextimemachine/Carousel.java", "license": "lgpl-3.0", "size": 33535 }
[ "android.view.MotionEvent" ]
import android.view.MotionEvent;
import android.view.*;
[ "android.view" ]
android.view;
2,686,022
protected StructuredDocumentEvent checkForCrossStructuredDocumentRegionSyntax() { StructuredDocumentEvent result = super .checkForCrossStructuredDocumentRegionSyntax(); if (result == null) { result = checkForCriticalKey("{{"); //$NON-NLS-1$ if (result == null) result = checkForCriticalKey("}}"); //$NON-NLS-1$ } return result; }
StructuredDocumentEvent function() { StructuredDocumentEvent result = super .checkForCrossStructuredDocumentRegionSyntax(); if (result == null) { result = checkForCriticalKey("{{"); if (result == null) result = checkForCriticalKey("}}"); } return result; }
/** * This function was added in order to support asp tags in PHP (bug fix * #150363) */
This function was added in order to support asp tags in PHP (bug fix #150363)
checkForCrossStructuredDocumentRegionSyntax
{ "repo_name": "Nodeclipse/angularjs-eclipse", "path": "org.eclipse.angularjs.core/src/org/eclipse/angularjs/internal/core/documentModel/parser/AngularStructuredDocumentReParser.java", "license": "epl-1.0", "size": 3244 }
[ "org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent" ]
import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent;
import org.eclipse.wst.sse.core.internal.provisional.events.*;
[ "org.eclipse.wst" ]
org.eclipse.wst;
1,539,223
public static <T> T[][] cartesian(T[][] one, T[] two) { @SuppressWarnings("unchecked") T[][] out = (T[][]) Array.newInstance(two.getClass(), one.length * two.length); for (int i = 0; i < one.length; ++i) { for (int j = 0; j < two.length; ++j) { out[i * two.length + j] = ArrayUtils.concat(one[i], two[j]); } } return out; }
static <T> T[][] function(T[][] one, T[] two) { @SuppressWarnings(STR) T[][] out = (T[][]) Array.newInstance(two.getClass(), one.length * two.length); for (int i = 0; i < one.length; ++i) { for (int j = 0; j < two.length; ++j) { out[i * two.length + j] = ArrayUtils.concat(one[i], two[j]); } } return out; }
/***************************************************************************** * Returns a cartesian product. "one" contains sequences of T. The returned * arrays contains a copy of each sequence in "one" for each element in two: * that copy had the element of two appended. */
Returns a cartesian product. "one" contains sequences of T. The returned arrays contains a copy of each sequence in "one" for each element in two: that copy had the element of two appended
cartesian
{ "repo_name": "norswap/caxap", "path": "src/util/ArrayUtils.java", "license": "bsd-3-clause", "size": 5735 }
[ "java.lang.reflect.Array" ]
import java.lang.reflect.Array;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,298,284
public void testDescendingContainsAll() { NavigableSet q = populatedSet(SIZE); NavigableSet p = dset0(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); }
void function() { NavigableSet q = populatedSet(SIZE); NavigableSet p = dset0(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); }
/** * containsAll(c) is true when c contains a subset of elements */
containsAll(c) is true when c contains a subset of elements
testDescendingContainsAll
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "test/java/util/concurrent/tck/TreeSubSetTest.java", "license": "gpl-2.0", "size": 31842 }
[ "java.util.NavigableSet" ]
import java.util.NavigableSet;
import java.util.*;
[ "java.util" ]
java.util;
37,417
public void submitOrder(View view) { if (quantity != 0) { displayOrderMessage(); quantity = 0; displayQuantity(); } }
void function(View view) { if (quantity != 0) { displayOrderMessage(); quantity = 0; displayQuantity(); } }
/** * method called when order button is clicked * * @param view */
method called when order button is clicked
submitOrder
{ "repo_name": "kolboch/Android-Development", "path": "JustJava/app/src/main/java/dev/kb/justjava/MainActivity.java", "license": "gpl-3.0", "size": 4411 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,738,549
public boolean canTake(BuildableItem item) { Node node = getNode(); if (node == null) { return false; // this executor is about to die } if (node.canTake(item) != null) { return false; // this node is not able to take the task } for (QueueTaskDispatcher d : QueueTaskDispatcher.all()) { if (d.canTake(node, item) != null) { return false; } } return isAvailable(); }
boolean function(BuildableItem item) { Node node = getNode(); if (node == null) { return false; } if (node.canTake(item) != null) { return false; } for (QueueTaskDispatcher d : QueueTaskDispatcher.all()) { if (d.canTake(node, item) != null) { return false; } } return isAvailable(); }
/** * Verifies that the {@link Executor} represented by this object is * capable of executing the given task. */
Verifies that the <code>Executor</code> represented by this object is capable of executing the given task
canTake
{ "repo_name": "sap-production/hudson-3.x", "path": "hudson-core/src/main/java/hudson/model/Queue.java", "license": "apache-2.0", "size": 62240 }
[ "hudson.model.queue.QueueTaskDispatcher" ]
import hudson.model.queue.QueueTaskDispatcher;
import hudson.model.queue.*;
[ "hudson.model.queue" ]
hudson.model.queue;
1,448,089
public static void writeArrayOfByteArrays(byte[][] array, DataOutput out) throws IOException { InternalDataSerializer.checkOut(out); int length; if (array == null) { length = -1; } else { length = array.length; } InternalDataSerializer.writeArrayLength(length, out); if (logger.isTraceEnabled(LogMarker.SERIALIZER)) { logger.trace(LogMarker.SERIALIZER, "Writing byte[][] of length {}", length); } if (length >= 0) { for (int i = 0; i < length; i++) { writeByteArray(array[i], out); } } }
static void function(byte[][] array, DataOutput out) throws IOException { InternalDataSerializer.checkOut(out); int length; if (array == null) { length = -1; } else { length = array.length; } InternalDataSerializer.writeArrayLength(length, out); if (logger.isTraceEnabled(LogMarker.SERIALIZER)) { logger.trace(LogMarker.SERIALIZER, STR, length); } if (length >= 0) { for (int i = 0; i < length; i++) { writeByteArray(array[i], out); } } }
/** * Writes an array of <tt>byte[]</tt> to a <tt>DataOutput</tt>. * * @throws IOException * A problem occurs while writing to <tt>out</tt>. * */
Writes an array of byte[] to a DataOutput
writeArrayOfByteArrays
{ "repo_name": "sshcherbakov/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/DataSerializer.java", "license": "apache-2.0", "size": 109153 }
[ "com.gemstone.gemfire.internal.InternalDataSerializer", "com.gemstone.gemfire.internal.logging.log4j.LogMarker", "java.io.DataOutput", "java.io.IOException" ]
import com.gemstone.gemfire.internal.InternalDataSerializer; import com.gemstone.gemfire.internal.logging.log4j.LogMarker; import java.io.DataOutput; import java.io.IOException;
import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.internal.logging.log4j.*; import java.io.*;
[ "com.gemstone.gemfire", "java.io" ]
com.gemstone.gemfire; java.io;
2,384,477
public void setCraftsmanIds(List<String> craftsmanIds) { this.craftsmanIds = craftsmanIds; }
void function(List<String> craftsmanIds) { this.craftsmanIds = craftsmanIds; }
/** * <p>Setter for the field <code>craftsmanIds</code>.</p> * * @param craftsmanIds a {@link java.util.List} object. */
Setter for the field <code>craftsmanIds</code>
setCraftsmanIds
{ "repo_name": "NotFound403/WePay", "path": "src/main/java/cn/felord/wepay/ali/sdk/api/domain/KoubeiCraftsmanDataProviderBatchqueryModel.java", "license": "apache-2.0", "size": 5079 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
910,642
public ProductSearchResult findProductsByQuery(String query, ProductSearchCriteria searchCriteria) throws ServiceException;
ProductSearchResult function(String query, ProductSearchCriteria searchCriteria) throws ServiceException;
/** * Performs a search for products across all categories for the given query, taking into consideration * the ProductSearchCriteria * * @param query * @param searchCriteria * @return the result of the search * @throws ServiceException */
Performs a search for products across all categories for the given query, taking into consideration the ProductSearchCriteria
findProductsByQuery
{ "repo_name": "akdasari/SparkCore", "path": "spark-framework/src/main/java/org/sparkcommerce/core/search/service/SearchService.java", "license": "apache-2.0", "size": 4418 }
[ "org.sparkcommerce.common.exception.ServiceException", "org.sparkcommerce.core.search.domain.ProductSearchCriteria", "org.sparkcommerce.core.search.domain.ProductSearchResult" ]
import org.sparkcommerce.common.exception.ServiceException; import org.sparkcommerce.core.search.domain.ProductSearchCriteria; import org.sparkcommerce.core.search.domain.ProductSearchResult;
import org.sparkcommerce.common.exception.*; import org.sparkcommerce.core.search.domain.*;
[ "org.sparkcommerce.common", "org.sparkcommerce.core" ]
org.sparkcommerce.common; org.sparkcommerce.core;
678,975
public void tableDelete(String tableName) throws Exception { try { HBaseAdmin admin = getAdmin(); admin.disableTable(tableName); admin.deleteTable(tableName); System.out.println("delete table " + tableName + " ok."); } catch (MasterNotRunningException e) { e.printStackTrace(); } catch (ZooKeeperConnectionException e) { e.printStackTrace(); } }
void function(String tableName) throws Exception { try { HBaseAdmin admin = getAdmin(); admin.disableTable(tableName); admin.deleteTable(tableName); System.out.println(STR + tableName + STR); } catch (MasterNotRunningException e) { e.printStackTrace(); } catch (ZooKeeperConnectionException e) { e.printStackTrace(); } }
/** * Delete a table */
Delete a table
tableDelete
{ "repo_name": "jzy3d/bigpicture", "path": "src/main/java/org/jzy3d/io/hbase/HBaseIO.java", "license": "mit", "size": 9073 }
[ "org.apache.hadoop.hbase.MasterNotRunningException", "org.apache.hadoop.hbase.ZooKeeperConnectionException", "org.apache.hadoop.hbase.client.HBaseAdmin" ]
import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
210,380
@Deprecated public static final Map<String, String> CORE_ROLES() { return OpenmrsUtil.getCoreRoles(); }
static final Map<String, String> function() { return OpenmrsUtil.getCoreRoles(); }
/** * All roles returned by this method are inserted into the database if they do not exist * already. These roles are also forbidden to be deleted from the administration screens. * * @return roles that are core to the system */
All roles returned by this method are inserted into the database if they do not exist already. These roles are also forbidden to be deleted from the administration screens
CORE_ROLES
{ "repo_name": "Bhamni/openmrs-core", "path": "api/src/main/java/org/openmrs/util/OpenmrsConstants.java", "license": "mpl-2.0", "size": 81032 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,757,119
public void run() { // send connection successful state send(new StatusMessage("Connection succesfully established.", STATUS.CONNECT_SUCC)); try { Object msg = null; // readObject blocks until a new object is available while ((msg = inputStream.readObject()) != null) { handleIncomingMessage(msg); } } catch (SocketException e) { } catch (EOFException e) { } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { server.removeConnection(this); if (this.username != null) { server.broadcast(new StatusMessage(username + " has left.", STATUS.USER_LEFT)); } try { socket.close(); } catch (IOException ex) { ex.printStackTrace(); } } }
void function() { send(new StatusMessage(STR, STATUS.CONNECT_SUCC)); try { Object msg = null; while ((msg = inputStream.readObject()) != null) { handleIncomingMessage(msg); } } catch (SocketException e) { } catch (EOFException e) { } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { server.removeConnection(this); if (this.username != null) { server.broadcast(new StatusMessage(username + STR, STATUS.USER_LEFT)); } try { socket.close(); } catch (IOException ex) { ex.printStackTrace(); } } }
/** * waits for incoming messages from the socket */
waits for incoming messages from the socket
run
{ "repo_name": "SergiyKolesnikov/fuji", "path": "examples/Chat_casestudies/chat-sebastian-dorok/features/Base/server/Connection.java", "license": "lgpl-3.0", "size": 2710 }
[ "java.io.EOFException", "java.io.IOException", "java.net.SocketException" ]
import java.io.EOFException; import java.io.IOException; import java.net.SocketException;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
2,361,540
@Override public void setShort(String name, short value) throws JMSException { initializeWriting(); put(name, Short.valueOf(value)); }
void function(String name, short value) throws JMSException { initializeWriting(); put(name, Short.valueOf(value)); }
/** * Sets a <CODE>short</CODE> value with the specified name into the Map. * * @param name * the name of the <CODE>short</CODE> * @param value * the <CODE>short</CODE> value to set in the Map * @throws JMSException * if the JMS provider fails to write the message due to some * internal error. * @throws IllegalArgumentException * if the name is null or if the name is an empty string. * @throws MessageNotWriteableException * if the message is in read-only mode. */
Sets a <code>short</code> value with the specified name into the Map
setShort
{ "repo_name": "fusesource/hawtjms", "path": "hawtjms-core/src/main/java/io/hawtjms/jms/message/JmsMapMessage.java", "license": "apache-2.0", "size": 28259 }
[ "javax.jms.JMSException" ]
import javax.jms.JMSException;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
1,730,712
void start(String processBusinessKey, String processDefinitionId, Variables variables, Map<String, Object> arguments) throws ExecutionException;
void start(String processBusinessKey, String processDefinitionId, Variables variables, Map<String, Object> arguments) throws ExecutionException;
/** * Starts a new process instance with the given ID. * @param processBusinessKey an external process instance ID, must be unique per {@link Engine}. * @param processDefinitionId the id of the process definition, can't be null. * @param variables initial variables * @param arguments extra arguments, can be null. * @throws ExecutionException */
Starts a new process instance with the given ID
start
{ "repo_name": "takari/bpm", "path": "bpm-engine-api/src/main/java/io/takari/bpm/api/Engine.java", "license": "apache-2.0", "size": 3113 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,604,864
@ApiModelProperty(example = "null", value = "") public String getStudentTeacherRatio() { return studentTeacherRatio; }
@ApiModelProperty(example = "null", value = "") String function() { return studentTeacherRatio; }
/** * Get studentTeacherRatio * @return studentTeacherRatio **/
Get studentTeacherRatio
getStudentTeacherRatio
{ "repo_name": "PitneyBowes/LocationIntelligenceSDK-Java", "path": "src/main/java/pb/locationintelligence/model/School.java", "license": "apache-2.0", "size": 22521 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,241,216
protected void updatePopupTrigger(MouseEvent event) { Point old = getPopupTriggerLocation(); // note: getPoint creates a new Point on each call, safe to use as-is popupTriggerLocation = event != null ? event.getPoint() : null; firePropertyChange("popupTriggerLocation", old, getPopupTriggerLocation()); }
void function(MouseEvent event) { Point old = getPopupTriggerLocation(); popupTriggerLocation = event != null ? event.getPoint() : null; firePropertyChange(STR, old, getPopupTriggerLocation()); }
/** * Handles internal bookkeeping related to popupLocation, called from * getPopupLocation.<p> * * This implementation stores the mouse location as popupTriggerLocation. * * @param event the event that triggered the showing of the * componentPopup, might be null if triggered by keyboard */
Handles internal bookkeeping related to popupLocation, called from getPopupLocation. This implementation stores the mouse location as popupTriggerLocation
updatePopupTrigger
{ "repo_name": "tmyroadctfig/swingx", "path": "swingx-core/src/main/java/org/jdesktop/swingx/JXList.java", "license": "lgpl-2.1", "size": 57047 }
[ "java.awt.Point", "java.awt.event.MouseEvent" ]
import java.awt.Point; import java.awt.event.MouseEvent;
import java.awt.*; import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,728,590
Update disallowKeyPermissions(List<KeyPermissions> permissions);
Update disallowKeyPermissions(List<KeyPermissions> permissions);
/** * Revoke a list of permissions for the AD identity to access keys. * * @param permissions the list of permissions to revoke * @return the next stage of access policy update */
Revoke a list of permissions for the AD identity to access keys
disallowKeyPermissions
{ "repo_name": "anudeepsharma/azure-sdk-for-java", "path": "azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicy.java", "license": "mit", "size": 17656 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,700,740
protected PrivateKey getSigningPrivateKey(final SamlRegisteredService registeredService) throws Exception { val samlIdp = casProperties.getAuthn().getSamlIdp(); val signingKey = samlIdPMetadataLocator.resolveSigningKey(Optional.of(registeredService)); val privateKeyFactoryBean = new PrivateKeyFactoryBean(); privateKeyFactoryBean.setLocation(signingKey); if (StringUtils.isBlank(registeredService.getSigningKeyAlgorithm())) { privateKeyFactoryBean.setAlgorithm(samlIdp.getMetadata().getPrivateKeyAlgName()); } else { privateKeyFactoryBean.setAlgorithm(registeredService.getSigningKeyAlgorithm()); } privateKeyFactoryBean.setSingleton(false); LOGGER.debug("Locating signature signing key for [{}] using algorithm [{}}", registeredService, privateKeyFactoryBean.getAlgorithm()); return privateKeyFactoryBean.getObject(); }
PrivateKey function(final SamlRegisteredService registeredService) throws Exception { val samlIdp = casProperties.getAuthn().getSamlIdp(); val signingKey = samlIdPMetadataLocator.resolveSigningKey(Optional.of(registeredService)); val privateKeyFactoryBean = new PrivateKeyFactoryBean(); privateKeyFactoryBean.setLocation(signingKey); if (StringUtils.isBlank(registeredService.getSigningKeyAlgorithm())) { privateKeyFactoryBean.setAlgorithm(samlIdp.getMetadata().getPrivateKeyAlgName()); } else { privateKeyFactoryBean.setAlgorithm(registeredService.getSigningKeyAlgorithm()); } privateKeyFactoryBean.setSingleton(false); LOGGER.debug(STR, registeredService, privateKeyFactoryBean.getAlgorithm()); return privateKeyFactoryBean.getObject(); }
/** * Gets signing private key. * * @param registeredService the registered service * @return the signing private key * @throws Exception the exception */
Gets signing private key
getSigningPrivateKey
{ "repo_name": "leleuj/cas", "path": "support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/SamlIdPObjectSigner.java", "license": "apache-2.0", "size": 21708 }
[ "java.security.PrivateKey", "java.util.Optional", "org.apache.commons.lang3.StringUtils", "org.apereo.cas.support.saml.services.SamlRegisteredService", "org.apereo.cas.util.crypto.PrivateKeyFactoryBean" ]
import java.security.PrivateKey; import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.apereo.cas.support.saml.services.SamlRegisteredService; import org.apereo.cas.util.crypto.PrivateKeyFactoryBean;
import java.security.*; import java.util.*; import org.apache.commons.lang3.*; import org.apereo.cas.support.saml.services.*; import org.apereo.cas.util.crypto.*;
[ "java.security", "java.util", "org.apache.commons", "org.apereo.cas" ]
java.security; java.util; org.apache.commons; org.apereo.cas;
713,513
public void post() throws ClientException { this.send(HttpMethod.POST, body); }
void function() throws ClientException { this.send(HttpMethod.POST, body); }
/** * Creates the ChatSendActivityNotification * * @throws ClientException an exception occurs if there was an error while the request was sent */
Creates the ChatSendActivityNotification
post
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/ChatSendActivityNotificationRequest.java", "license": "mit", "size": 2219 }
[ "com.microsoft.graph.core.ClientException", "com.microsoft.graph.http.HttpMethod" ]
import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod;
import com.microsoft.graph.core.*; import com.microsoft.graph.http.*;
[ "com.microsoft.graph" ]
com.microsoft.graph;
2,705,602
public Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector) { Assertions.checkState(!buildCalled); this.analyticsCollector = analyticsCollector; return this; }
Builder function(AnalyticsCollector analyticsCollector) { Assertions.checkState(!buildCalled); this.analyticsCollector = analyticsCollector; return this; }
/** * Sets the {@link AnalyticsCollector} that will collect and forward all player events. * * @param analyticsCollector An {@link AnalyticsCollector}. * @return This builder. * @throws IllegalStateException If {@link #build()} has already been called. */
Sets the <code>AnalyticsCollector</code> that will collect and forward all player events
setAnalyticsCollector
{ "repo_name": "amzn/exoplayer-amazon-port", "path": "library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java", "license": "apache-2.0", "size": 30514 }
[ "com.google.android.exoplayer2.analytics.AnalyticsCollector", "com.google.android.exoplayer2.util.Assertions" ]
import com.google.android.exoplayer2.analytics.AnalyticsCollector; import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.analytics.*; import com.google.android.exoplayer2.util.*;
[ "com.google.android" ]
com.google.android;
1,996,933
public void thawRotation() { if (!checkCallingPermission(android.Manifest.permission.SET_ORIENTATION, "thawRotation()")) { throw new SecurityException("Requires SET_ORIENTATION permission"); } if (DEBUG_ORIENTATION) Slog.v(TAG, "thawRotation: mRotation=" + mRotation); mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_FREE, 777); // rot not used updateRotationUnchecked(false, false); }
void function() { if (!checkCallingPermission(android.Manifest.permission.SET_ORIENTATION, STR)) { throw new SecurityException(STR); } if (DEBUG_ORIENTATION) Slog.v(TAG, STR + mRotation); mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_FREE, 777); updateRotationUnchecked(false, false); }
/** * Thaw rotation changes. (Disable "rotation lock".) * Persists across reboots. */
Thaw rotation changes. (Disable "rotation lock".) Persists across reboots
thawRotation
{ "repo_name": "haikuowuya/android_system_code", "path": "src/com/android/server/wm/WindowManagerService.java", "license": "apache-2.0", "size": 483318 }
[ "android.util.Slog", "android.view.WindowManagerPolicy" ]
import android.util.Slog; import android.view.WindowManagerPolicy;
import android.util.*; import android.view.*;
[ "android.util", "android.view" ]
android.util; android.view;
1,595,560
long calcMillis(EdgeIteratorState edgeState, boolean reverse, int prevOrNextEdgeId);
long calcMillis(EdgeIteratorState edgeState, boolean reverse, int prevOrNextEdgeId);
/** * This method calculates the time taken (in milli seconds) for the specified edgeState and * optionally include the turn costs (in seconds) of the previous (or next) edgeId via * prevOrNextEdgeId. Typically used for post-processing and on only a few thousand edges. */
This method calculates the time taken (in milli seconds) for the specified edgeState and optionally include the turn costs (in seconds) of the previous (or next) edgeId via prevOrNextEdgeId. Typically used for post-processing and on only a few thousand edges
calcMillis
{ "repo_name": "komoot/graphhopper", "path": "core/src/main/java/com/graphhopper/routing/weighting/Weighting.java", "license": "apache-2.0", "size": 3119 }
[ "com.graphhopper.util.EdgeIteratorState" ]
import com.graphhopper.util.EdgeIteratorState;
import com.graphhopper.util.*;
[ "com.graphhopper.util" ]
com.graphhopper.util;
1,758,364
JobQuery duedateHigherThen(Date date);
JobQuery duedateHigherThen(Date date);
/** Only select jobs where the duedate is higher then the given date. * @deprecated */
Only select jobs where the duedate is higher then the given date
duedateHigherThen
{ "repo_name": "motorina0/flowable-engine", "path": "modules/flowable5-engine/src/main/java/org/activiti/engine/runtime/JobQuery.java", "license": "apache-2.0", "size": 4069 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,471,007
@Test public void testOrSplitterWithoutIndex() { //populate: TestClass t1a = new TestClass(); t1a.setInt(200); //test1 t1a.setShort((short) 11); TestClass t1b = new TestClass(); t1b.setInt(201);//test1 t1b.setShort((short) 32000); pm.makePersistent(t1a); pm.makePersistent(t1b); pm.currentTransaction().commit(); pm.currentTransaction().begin(); //Equivalent to: // 123 <= _int < 12345 && _short==32000 || 123 <= _int < 12345 && _short==11 //Ideally: Split if short is indexed. Do not split (or at least merge afterwards) //if _short is not indexed. If _short and _int are both indexed, it depends on the //selectiveness of the _int and _short ranges. String qf = "_int < 12345 && (_short == 32000 || _short == 11) && _int >= 123"; //no indexing checkAdvices(qf, 0); checkResults(qf, 2); //single indexing outside OR ZooJdoHelper.schema(pm).getClass(TestClass.class).createIndex("_int", true); checkAdvices(qf, 1); checkResults(qf, 2); //double indexing inside OR ZooJdoHelper.schema(pm).getClass(TestClass.class).createIndex("_short", true); //THis uses the in-index... checkAdvices(qf, 1); checkResults(qf, 2); //single indexing inside OR ZooJdoHelper.schema(pm).getClass(TestClass.class).removeIndex("_int"); checkAdvices(qf, 2); checkResults(qf, 2); }
void function() { TestClass t1a = new TestClass(); t1a.setInt(200); t1a.setShort((short) 11); TestClass t1b = new TestClass(); t1b.setInt(201); t1b.setShort((short) 32000); pm.makePersistent(t1a); pm.makePersistent(t1b); pm.currentTransaction().commit(); pm.currentTransaction().begin(); String qf = STR; checkAdvices(qf, 0); checkResults(qf, 2); ZooJdoHelper.schema(pm).getClass(TestClass.class).createIndex("_int", true); checkAdvices(qf, 1); checkResults(qf, 2); ZooJdoHelper.schema(pm).getClass(TestClass.class).createIndex(STR, true); checkAdvices(qf, 1); checkResults(qf, 2); ZooJdoHelper.schema(pm).getClass(TestClass.class).removeIndex("_int"); checkAdvices(qf, 2); checkResults(qf, 2); }
/** * Test the OR splitting. A query is split up at every OR, but only if both sub-queries * use index attributes. * Without index there should be only one resulting query. * With index there should be two resulting queries. */
Test the OR splitting. A query is split up at every OR, but only if both sub-queries use index attributes. Without index there should be only one resulting query. With index there should be two resulting queries
testOrSplitterWithoutIndex
{ "repo_name": "tzaeschke/zoodb", "path": "tst/org/zoodb/jdo/internal/query/TestQueryOptimizerPv4.java", "license": "gpl-3.0", "size": 11642 }
[ "org.zoodb.jdo.ZooJdoHelper", "org.zoodb.test.jdo.TestClass" ]
import org.zoodb.jdo.ZooJdoHelper; import org.zoodb.test.jdo.TestClass;
import org.zoodb.jdo.*; import org.zoodb.test.jdo.*;
[ "org.zoodb.jdo", "org.zoodb.test" ]
org.zoodb.jdo; org.zoodb.test;
1,547,138
private boolean setDefine(CompilerOptions options, String key, Object value) { boolean success = false; if (value instanceof String) { final boolean isTrue = "true".equals(value); final boolean isFalse = "false".equals(value); if (isTrue || isFalse) { options.setDefineToBooleanLiteral(key, isTrue); } else { try { double dblTemp = Double.parseDouble((String) value); options.setDefineToDoubleLiteral(key, dblTemp); } catch (NumberFormatException nfe) { // Not a number, assume string options.setDefineToStringLiteral(key, (String) value); } } success = true; } else if (value instanceof Boolean) { options.setDefineToBooleanLiteral(key, (Boolean) value); success = true; } else if (value instanceof Integer) { options.setDefineToNumberLiteral(key, (Integer) value); success = true; } else if (value instanceof Double) { options.setDefineToDoubleLiteral(key, (Double) value); success = true; } return success; }
boolean function(CompilerOptions options, String key, Object value) { boolean success = false; if (value instanceof String) { final boolean isTrue = "true".equals(value); final boolean isFalse = "false".equals(value); if (isTrue isFalse) { options.setDefineToBooleanLiteral(key, isTrue); } else { try { double dblTemp = Double.parseDouble((String) value); options.setDefineToDoubleLiteral(key, dblTemp); } catch (NumberFormatException nfe) { options.setDefineToStringLiteral(key, (String) value); } } success = true; } else if (value instanceof Boolean) { options.setDefineToBooleanLiteral(key, (Boolean) value); success = true; } else if (value instanceof Integer) { options.setDefineToNumberLiteral(key, (Integer) value); success = true; } else if (value instanceof Double) { options.setDefineToDoubleLiteral(key, (Double) value); success = true; } return success; }
/** * Maps Ant-style values (e.g., from Properties) into expected * Closure {@code @define} literals * * @return True if the {@code @define} replacement succeeded, false if * the variable's value could not be mapped properly. */
Maps Ant-style values (e.g., from Properties) into expected Closure @define literals
setDefine
{ "repo_name": "anomaly/closure-compiler", "path": "src/com/google/javascript/jscomp/ant/CompileTask.java", "license": "apache-2.0", "size": 23931 }
[ "com.google.javascript.jscomp.CompilerOptions" ]
import com.google.javascript.jscomp.CompilerOptions;
import com.google.javascript.jscomp.*;
[ "com.google.javascript" ]
com.google.javascript;
2,107,038
private void addEntry(FatLfnDirectoryEntry lfnEntry, FatDirectoryEntry entry) { entries.add(lfnEntry); lfnMap.put(lfnEntry.getName().toLowerCase(Locale.getDefault()), lfnEntry); shortNameMap.put(entry.getShortName(), entry); }
void function(FatLfnDirectoryEntry lfnEntry, FatDirectoryEntry entry) { entries.add(lfnEntry); lfnMap.put(lfnEntry.getName().toLowerCase(Locale.getDefault()), lfnEntry); shortNameMap.put(entry.getShortName(), entry); }
/** * Adds the long file name entry to {@link #lfnMap} and {@link #entries} and * the actual entry to {@link #shortNameMap}. * <p> * This method does not write the changes to the disk. If you want to do so * call {@link #write()} after adding an entry. * * @param lfnEntry * The long filename entry to add. * @param entry * The corresponding short name entry. * @see #removeEntry(FatLfnDirectoryEntry) */
Adds the long file name entry to <code>#lfnMap</code> and <code>#entries</code> and the actual entry to <code>#shortNameMap</code>. This method does not write the changes to the disk. If you want to do so call <code>#write()</code> after adding an entry
addEntry
{ "repo_name": "jmue/libaums", "path": "libaums/src/main/java/com/github/mjdev/libaums/fs/fat32/FatDirectory.java", "license": "apache-2.0", "size": 19834 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
641,260
@Override public ArrayList<String> getDumpInfo() { ArrayList<String> tmpDumpList; int i; tmpDumpList = new ArrayList<>(); tmpDumpList.add("============ BEGIN RECORD ============"); for ( i = 0 ; i < OutputColumns.length ; i++) { tmpDumpList.add(" FIELD <" + i + "> Value <" + OutputColumns[i] + ">"); } return tmpDumpList; }
ArrayList<String> function() { ArrayList<String> tmpDumpList; int i; tmpDumpList = new ArrayList<>(); tmpDumpList.add(STR); for ( i = 0 ; i < OutputColumns.length ; i++) { tmpDumpList.add(STR + i + STR + OutputColumns[i] + ">"); } return tmpDumpList; }
/** * Basic dumping strategy, usually to be overwritten in an implementation * of this class * * @return The dump information */
Basic dumping strategy, usually to be overwritten in an implementation of this class
getDumpInfo
{ "repo_name": "petebarnett/OpenRate", "path": "src/main/java/OpenRate/record/DBRecord.java", "license": "gpl-2.0", "size": 15128 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,348,708
public void sleepThread(int secondsToSleep) { try { Thread.sleep(secondsToSleep * 1000); } catch (InterruptedException e) { throw new CloudRuntimeException(e); } }
void function(int secondsToSleep) { try { Thread.sleep(secondsToSleep * 1000); } catch (InterruptedException e) { throw new CloudRuntimeException(e); } }
/** * The thread executing this method sleeps a given amount of seconds. * * @param secondsToSleep */
The thread executing this method sleeps a given amount of seconds
sleepThread
{ "repo_name": "GabrielBrascher/autonomiccs-platform", "path": "autonomic-plugin-common/src/main/java/br/com/autonomiccs/autonomic/plugin/common/utils/ThreadUtils.java", "license": "apache-2.0", "size": 1639 }
[ "com.cloud.utils.exception.CloudRuntimeException" ]
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.exception.*;
[ "com.cloud.utils" ]
com.cloud.utils;
1,250,451
private WorkItemCommitRequest.Builder setMessagesMetadata( PaneInfo pane, byte[] windowBytes, WorkItemCommitRequest.Builder builder) throws Exception { if (windowBytes != null) { builder.getOutputMessagesBuilder(0) .getBundlesBuilder(0) .getMessagesBuilder(0) .setMetadata(addPaneTag(pane, windowBytes)); } return builder; }
WorkItemCommitRequest.Builder function( PaneInfo pane, byte[] windowBytes, WorkItemCommitRequest.Builder builder) throws Exception { if (windowBytes != null) { builder.getOutputMessagesBuilder(0) .getBundlesBuilder(0) .getMessagesBuilder(0) .setMetadata(addPaneTag(pane, windowBytes)); } return builder; }
/** * Sets the metadata of the first contained message in this WorkItemCommitRequest * (it should only have one message). */
Sets the metadata of the first contained message in this WorkItemCommitRequest (it should only have one message)
setMessagesMetadata
{ "repo_name": "prabeesh/DataflowJavaSDK", "path": "sdk/src/test/java/com/google/cloud/dataflow/sdk/runners/worker/StreamingDataflowWorkerTest.java", "license": "apache-2.0", "size": 42516 }
[ "com.google.cloud.dataflow.sdk.runners.worker.windmill.Windmill", "com.google.cloud.dataflow.sdk.transforms.windowing.PaneInfo" ]
import com.google.cloud.dataflow.sdk.runners.worker.windmill.Windmill; import com.google.cloud.dataflow.sdk.transforms.windowing.PaneInfo;
import com.google.cloud.dataflow.sdk.runners.worker.windmill.*; import com.google.cloud.dataflow.sdk.transforms.windowing.*;
[ "com.google.cloud" ]
com.google.cloud;
2,861,139
private void accept() throws IgniteCheckedException { try { while (!closed && selector.isOpen() && !Thread.currentThread().isInterrupted()) { // Wake up every 2 seconds to check if closed. if (selector.select(2000) > 0) // Walk through the ready keys collection and process date requests. processSelectedKeys(selector.selectedKeys()); } } // Ignore this exception as thread interruption is equal to 'close' call. catch (ClosedByInterruptException e) { if (log.isDebugEnabled()) log.debug("Closing selector due to thread interruption [srvr=" + this + ", err=" + e.getMessage() + ']'); } catch (ClosedSelectorException e) { throw new IgniteCheckedException("Selector got closed while active: " + this, e); } catch (IOException e) { throw new IgniteCheckedException("Failed to accept connection: " + this, e); } finally { closeSelector(); } }
void function() throws IgniteCheckedException { try { while (!closed && selector.isOpen() && !Thread.currentThread().isInterrupted()) { if (selector.select(2000) > 0) processSelectedKeys(selector.selectedKeys()); } } catch (ClosedByInterruptException e) { if (log.isDebugEnabled()) log.debug(STR + this + STR + e.getMessage() + ']'); } catch (ClosedSelectorException e) { throw new IgniteCheckedException(STR + this, e); } catch (IOException e) { throw new IgniteCheckedException(STR + this, e); } finally { closeSelector(); } }
/** * Accepts connections and schedules them for processing by one of read workers. * * @throws IgniteCheckedException If failed. */
Accepts connections and schedules them for processing by one of read workers
accept
{ "repo_name": "apacheignite/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java", "license": "apache-2.0", "size": 79747 }
[ "java.io.IOException", "java.nio.channels.ClosedByInterruptException", "java.nio.channels.ClosedSelectorException", "org.apache.ignite.IgniteCheckedException" ]
import java.io.IOException; import java.nio.channels.ClosedByInterruptException; import java.nio.channels.ClosedSelectorException; import org.apache.ignite.IgniteCheckedException;
import java.io.*; import java.nio.channels.*; import org.apache.ignite.*;
[ "java.io", "java.nio", "org.apache.ignite" ]
java.io; java.nio; org.apache.ignite;
854,842
public boolean addMessage(Context context, String messageId, String message, double trust, double priority, String pseudonym, long timestamp,boolean enforceLimit, long timebound, Location location, String parent, boolean isRead, int minContactsHop, int hop, String exchange, String bigparent){ SQLiteDatabase db = getWritableDatabase(); if(db != null && message != null){ if (enforceLimit) { trust = streamlineTrust(trust); } else { checkTrust(trust); } if(SecurityManager.getCurrentProfile(context).getFeedSize() > 0) { Cursor cursor = db.rawQuery("SELECT " + COL_ROWID + " FROM " + TABLE + " WHERE " + COL_DELETED + "=" + FALSE + " ORDER BY " + COL_ROWID + " ASC;", null); int overflow = cursor.getCount() - SecurityManager.getCurrentProfile(context).getFeedSize(); cursor.close(); if (overflow >= 0) { db.execSQL("UPDATE " + TABLE + " SET " + COL_DELETED + "=" + TRUE + " WHERE " + COL_ROWID + " IN (SELECT " + COL_ROWID + " FROM " + TABLE + " WHERE " + COL_DELETED + "=" + FALSE + " ORDER BY " + COL_ROWID + " ASC LIMIT " + (1 + overflow) + ");"); } } //update inserted message in case a better big parent can be found locally Cursor cursr = db.rawQuery("SELECT "+COL_BIGPARENT+" FROM "+TABLE+" WHERE "+COL_MESSAGE_ID+"='"+bigparent+"' limit 1;",null); if(cursr.getCount() > 0){ cursr.moveToFirst(); String tempBigparent = cursr.getString(cursr.getColumnIndex(COL_BIGPARENT)); if(tempBigparent != null) bigparent = tempBigparent; } cursr.close(); // update descendants with this message's big parent if(bigparent != null) db.execSQL("UPDATE "+TABLE+" SET "+COL_BIGPARENT+"='"+bigparent+"' WHERE "+COL_PARENT+"='"+messageId+"';"); if(message.length() > MAX_MESSAGE_SIZE) message = message.substring(0, MAX_MESSAGE_SIZE); Calendar tempCal = Calendar.getInstance(); tempCal.setTimeInMillis(timestamp); Calendar reducedTimestamp = Utils.reduceCalendarMin(tempCal); if(containsOrRemoved(message)) { db.execSQL("UPDATE "+TABLE+" SET " +COL_TRUST+"="+trust+"," +COL_DELETED+"="+FALSE+"," + COL_LIKES +"="+priority+"," +COL_PSEUDONYM+"='"+pseudonym+"'," +COL_BIGPARENT+"='"+bigparent+"'," +COL_PARENT+"='"+parent+"'," + COL_READ +"="+(isRead ? TRUE : FALSE)+"," + ((location != null) ? (COL_LATLONG+"='"+location.getLatitude()+" "+location.getLongitude()+"',") : "") +COL_TIMESTAMP+"="+reducedTimestamp.getTimeInMillis()+"," + ((exchange != null) ? (COL_EXCHANGE+"="+exchange+",") : "") +COL_EXPIRE+"="+timebound +" WHERE " + COL_MESSAGE + "='" + message + "';"); log.debug( "Message was already in store and was simply updated."); } else { ContentValues content = new ContentValues(); content.put(COL_MESSAGE_ID, messageId); content.put(COL_MESSAGE, message); content.put(COL_TRUST, trust); content.put(COL_LIKES, priority); if(location != null) content.put(COL_LATLONG, location.getLatitude()+" "+location.getLongitude()); content.put(COL_PSEUDONYM, pseudonym); content.put(COL_EXPIRE, timebound); content.put(COL_TIMESTAMP, reducedTimestamp.getTimeInMillis()); content.put(COL_BIGPARENT, bigparent); content.put(COL_PARENT, parent); content.put(COL_READ, isRead ? TRUE : FALSE); if(exchange != null) content.put(COL_EXCHANGE, exchange); content.put(COL_MIN_CONTACTS_FOR_HOP, minContactsHop); content.put(COL_HOP, hop); db.insert(TABLE, null, content); log.debug( "Message added to store."); } return true; } log.debug( "Message not added to store, either message or database is null. ["+message+"]"); return false; }
boolean function(Context context, String messageId, String message, double trust, double priority, String pseudonym, long timestamp,boolean enforceLimit, long timebound, Location location, String parent, boolean isRead, int minContactsHop, int hop, String exchange, String bigparent){ SQLiteDatabase db = getWritableDatabase(); if(db != null && message != null){ if (enforceLimit) { trust = streamlineTrust(trust); } else { checkTrust(trust); } if(SecurityManager.getCurrentProfile(context).getFeedSize() > 0) { Cursor cursor = db.rawQuery(STR + COL_ROWID + STR + TABLE + STR + COL_DELETED + "=" + FALSE + STR + COL_ROWID + STR, null); int overflow = cursor.getCount() - SecurityManager.getCurrentProfile(context).getFeedSize(); cursor.close(); if (overflow >= 0) { db.execSQL(STR + TABLE + STR + COL_DELETED + "=" + TRUE + STR + COL_ROWID + STR + COL_ROWID + STR + TABLE + STR + COL_DELETED + "=" + FALSE + STR + COL_ROWID + STR + (1 + overflow) + ");"); } } Cursor cursr = db.rawQuery(STR+COL_BIGPARENT+STR+TABLE+STR+COL_MESSAGE_ID+"='"+bigparent+STR,null); if(cursr.getCount() > 0){ cursr.moveToFirst(); String tempBigparent = cursr.getString(cursr.getColumnIndex(COL_BIGPARENT)); if(tempBigparent != null) bigparent = tempBigparent; } cursr.close(); if(bigparent != null) db.execSQL(STR+TABLE+STR+COL_BIGPARENT+"='"+bigparent+STR+COL_PARENT+"='"+messageId+"';"); if(message.length() > MAX_MESSAGE_SIZE) message = message.substring(0, MAX_MESSAGE_SIZE); Calendar tempCal = Calendar.getInstance(); tempCal.setTimeInMillis(timestamp); Calendar reducedTimestamp = Utils.reduceCalendarMin(tempCal); if(containsOrRemoved(message)) { db.execSQL(STR+TABLE+STR +COL_TRUST+"="+trust+"," +COL_DELETED+"="+FALSE+"," + COL_LIKES +"="+priority+"," +COL_PSEUDONYM+"='"+pseudonym+"'," +COL_BIGPARENT+"='"+bigparent+"'," +COL_PARENT+"='"+parent+"'," + COL_READ +"="+(isRead ? TRUE : FALSE)+"," + ((location != null) ? (COL_LATLONG+"='"+location.getLatitude()+" "+location.getLongitude()+"',") : STR=STR,STR=STR,STRSTR="+timebound +STR + COL_MESSAGE + "='STR';STRMessage was already in store and was simply updated.STR STRMessage added to store.STRMessage not added to store, either message or database is null. [STR]"); return false; }
/** * Adds the given message with the given priority. * * @param message The message to add. * @param trust The trust to associate with the message. The trust must * be [0,1]. * @param priority The priority to associate with the message. * @param pseudonym The senders pseudonym. * @param enforceLimit whether or not the trust should be streamlined to the limits * if set to false and value is outside of limit, an exception is thrown * @return Returns true if the message was added. If message already exists, update its values */
Adds the given message with the given priority
addMessage
{ "repo_name": "casific/murmur", "path": "app/src/main/java/org/denovogroup/murmur/backend/MessageStore.java", "license": "apache-2.0", "size": 50068 }
[ "android.content.Context", "android.database.Cursor", "android.database.sqlite.SQLiteDatabase", "android.location.Location", "java.util.Calendar" ]
import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.location.Location; import java.util.Calendar;
import android.content.*; import android.database.*; import android.database.sqlite.*; import android.location.*; import java.util.*;
[ "android.content", "android.database", "android.location", "java.util" ]
android.content; android.database; android.location; java.util;
1,176,718
@Generated @Selector("scheduleSegment:startingFrame:frameCount:atTime:completionHandler:") public native void scheduleSegmentStartingFrameFrameCountAtTimeCompletionHandler(AVAudioFile file, long startFrame, int numberFrames, AVAudioTime when, @ObjCBlock(name = "call_scheduleSegmentStartingFrameFrameCountAtTimeCompletionHandler") Block_scheduleSegmentStartingFrameFrameCountAtTimeCompletionHandler completionHandler);
@Selector(STR) native void function(AVAudioFile file, long startFrame, int numberFrames, AVAudioTime when, @ObjCBlock(name = STR) Block_scheduleSegmentStartingFrameFrameCountAtTimeCompletionHandler completionHandler);
/** * scheduleSegment:startingFrame:frameCount:atTime:completionHandler: * <p> * Schedule playing a segment of an audio file. * <p> * It is possible for the completionHandler to be called before rendering begins * or before the segment is played completely. * * @param file the file to play * @param startFrame the starting frame position in the stream * @param numberFrames the number of frames to play * @param when the time at which to play the region. see the discussion of timestamps, above. * @param completionHandler called after the segment has been consumed by the player or the player is stopped. may be nil. */
scheduleSegment:startingFrame:frameCount:atTime:completionHandler: Schedule playing a segment of an audio file. It is possible for the completionHandler to be called before rendering begins or before the segment is played completely
scheduleSegmentStartingFrameFrameCountAtTimeCompletionHandler
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/avfaudio/AVAudioPlayerNode.java", "license": "apache-2.0", "size": 24641 }
[ "org.moe.natj.objc.ann.ObjCBlock", "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.ObjCBlock; import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
1,438,793
public Map<String, List<String>> getAllUsers() throws Exception { final Map<String, List<String>> users = new HashMap<String, List<String>>(); final ResultSet userResults = session.execute("SELECT * FROM " + USERCOLLECTION); for (final Row row : userResults) { final String user = row.getString(USERNAMECOLUMN); if (!users.containsKey(user)) { users.put(user, new ArrayList<String>()); } } final ResultSet roleResults = session.execute("SELECT * FROM " + ROLECOLLECTION); for (final Row row : roleResults) { final String user = row.getString(USERNAMECOLUMN); if (!users.containsKey(user)) { users.put(user, new ArrayList<String>()); } users.get(user).add(row.getString(ROLECOLUMN)); } return users; }
Map<String, List<String>> function() throws Exception { final Map<String, List<String>> users = new HashMap<String, List<String>>(); final ResultSet userResults = session.execute(STR + USERCOLLECTION); for (final Row row : userResults) { final String user = row.getString(USERNAMECOLUMN); if (!users.containsKey(user)) { users.put(user, new ArrayList<String>()); } } final ResultSet roleResults = session.execute(STR + ROLECOLLECTION); for (final Row row : roleResults) { final String user = row.getString(USERNAMECOLUMN); if (!users.containsKey(user)) { users.put(user, new ArrayList<String>()); } users.get(user).add(row.getString(ROLECOLUMN)); } return users; }
/** * get all user with the corresponding roles * * @param db * instance of the database that contains the identifier * collection * @return Map of <username, list of roles> * @throws Exception * if there's a problem with Cassandra */
get all user with the corresponding roles
getAllUsers
{ "repo_name": "gusai-francelabs/datafari", "path": "src/com/francelabs/datafari/service/db/UserDataService.java", "license": "apache-2.0", "size": 7483 }
[ "com.datastax.driver.core.ResultSet", "com.datastax.driver.core.Row", "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map" ]
import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
import com.datastax.driver.core.*; import java.util.*;
[ "com.datastax.driver", "java.util" ]
com.datastax.driver; java.util;
390,857
public List<UcenterMenuModel> submenus(){ return UcenterMenuModel.dao.find("select * from t_ucenter_menu where ucenter_menu_parent_id=? order by ucenter_menu_sn", get("id")); }
List<UcenterMenuModel> function(){ return UcenterMenuModel.dao.find(STR, get("id")); }
/** * get submenus * @return */
get submenus
submenus
{ "repo_name": "LxShine/jfinalQ", "path": "src/com/uikoo9/manage/ucenter/model/UcenterMenuModel.java", "license": "mit", "size": 2087 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,505,794
public void testMethodDouble() throws RemoteException { double expected = 567.547D; double actual = binding.methodDouble(87502.002D); assertEquals("The expected and actual values did not match.", expected, actual, DOUBLE_DELTA); } // testMethodDouble
void function() throws RemoteException { double expected = 567.547D; double actual = binding.methodDouble(87502.002D); assertEquals(STR, expected, actual, DOUBLE_DELTA); }
/** * Test to insure that a primitive double matches the expected * values on both the client and server. */
Test to insure that a primitive double matches the expected values on both the client and server
testMethodDouble
{ "repo_name": "hugosato/apache-axis", "path": "test/wsdl/roundtrip/RoundtripTestServiceTestCase.java", "license": "apache-2.0", "size": 41792 }
[ "java.rmi.RemoteException" ]
import java.rmi.RemoteException;
import java.rmi.*;
[ "java.rmi" ]
java.rmi;
187,629
public static void toggleRestrictSearchToVisibleNodes(final ZyGraph graph) { Preconditions.checkNotNull(graph, "IE01759: Graph argument can not be null"); graph.getSettings().getSearchSettings().setSearchVisibleNodesOnly( !graph.getSettings().getSearchSettings().getSearchVisibleNodesOnly()); }
static void function(final ZyGraph graph) { Preconditions.checkNotNull(graph, STR); graph.getSettings().getSearchSettings().setSearchVisibleNodesOnly( !graph.getSettings().getSearchSettings().getSearchVisibleNodesOnly()); }
/** * Toggles the state of Restrict Search to Visible Nodes. * * @param graph The graph where the search state is toggled. */
Toggles the state of Restrict Search to Visible Nodes
toggleRestrictSearchToVisibleNodes
{ "repo_name": "dgrif/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/Gui/GraphWindows/Implementations/CGraphSearcher.java", "license": "apache-2.0", "size": 2775 }
[ "com.google.common.base.Preconditions", "com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph" ]
import com.google.common.base.Preconditions; import com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph;
import com.google.common.base.*; import com.google.security.zynamics.binnavi.yfileswrap.zygraph.*;
[ "com.google.common", "com.google.security" ]
com.google.common; com.google.security;
2,535,828
@Test public void testSerialNumber() { FieldLayout layout = new FieldLayout("H:4:4 - N:6:6 - N:3:3"); checkLayout(layout, field(Type.HEX, 4, 4), "-", field(NUMERIC, 6, 6), "-", field(NUMERIC, 3, 3)); checkValid("ABCD-123-456", layout, "ABCD", "123", "456"); }
void function() { FieldLayout layout = new FieldLayout(STR); checkLayout(layout, field(Type.HEX, 4, 4), "-", field(NUMERIC, 6, 6), "-", field(NUMERIC, 3, 3)); checkValid(STR, layout, "ABCD", "123", "456"); }
/** * Tests a serial number layout. */
Tests a serial number layout
testSerialNumber
{ "repo_name": "mtjandra/izpack", "path": "izpack-panel/src/test/java/com/izforge/izpack/panels/userinput/field/rule/FieldLayoutTest.java", "license": "apache-2.0", "size": 8276 }
[ "com.izforge.izpack.panels.userinput.field.rule.FieldSpec" ]
import com.izforge.izpack.panels.userinput.field.rule.FieldSpec;
import com.izforge.izpack.panels.userinput.field.rule.*;
[ "com.izforge.izpack" ]
com.izforge.izpack;
721,779
private void validateSortSize() { String sortSizeStr = carbonProperties .getProperty(CarbonCommonConstants.SORT_SIZE, CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); try { int sortSize = Integer.parseInt(sortSizeStr); if (sortSize < CarbonCommonConstants.SORT_SIZE_MIN_VAL) { LOGGER.info("The batch size value \"" + sortSizeStr + "\" is invalid. Using the default value \"" + CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); carbonProperties.setProperty(CarbonCommonConstants.SORT_SIZE, CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); } } catch (NumberFormatException e) { LOGGER.info("The batch size value \"" + sortSizeStr + "\" is invalid. Using the default value \"" + CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); carbonProperties.setProperty(CarbonCommonConstants.SORT_SIZE, CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); } }
void function() { String sortSizeStr = carbonProperties .getProperty(CarbonCommonConstants.SORT_SIZE, CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); try { int sortSize = Integer.parseInt(sortSizeStr); if (sortSize < CarbonCommonConstants.SORT_SIZE_MIN_VAL) { LOGGER.info(STRSTR\STR" + CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); carbonProperties.setProperty(CarbonCommonConstants.SORT_SIZE, CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); } } catch (NumberFormatException e) { LOGGER.info(STRSTR\STR" + CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); carbonProperties.setProperty(CarbonCommonConstants.SORT_SIZE, CarbonCommonConstants.SORT_SIZE_DEFAULT_VAL); } }
/** * This method validates the sort size */
This method validates the sort size
validateSortSize
{ "repo_name": "Zhangshunyu/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java", "license": "apache-2.0", "size": 16913 }
[ "org.apache.carbondata.core.constants.CarbonCommonConstants" ]
import org.apache.carbondata.core.constants.CarbonCommonConstants;
import org.apache.carbondata.core.constants.*;
[ "org.apache.carbondata" ]
org.apache.carbondata;
1,562,013
EClass getSurgeriesSection();
EClass getSurgeriesSection();
/** * Returns the meta object for class '{@link org.openhealthtools.mdht.uml.cda.hitsp.SurgeriesSection <em>Surgeries Section</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Surgeries Section</em>'. * @see org.openhealthtools.mdht.uml.cda.hitsp.SurgeriesSection * @generated */
Returns the meta object for class '<code>org.openhealthtools.mdht.uml.cda.hitsp.SurgeriesSection Surgeries Section</code>'.
getSurgeriesSection
{ "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,893
public static TextureData newInstance(Color color) { byte red = (byte) color.r(); byte green = (byte) color.g(); byte blue = (byte) color.b(); byte alpha = (byte) color.a(); ByteBuffer data = ByteBuffer.allocateDirect(4 * TEXTURE_WIDTH * TEXTURE_HEIGHT); for (int height = 0; height < TEXTURE_HEIGHT; height++) { for (int width = 0; width < TEXTURE_WIDTH; width++) { data.put(red).put(green).put(blue).put(alpha); } } // The buffer must be reset back to the initial position before passing it onward. data.rewind(); return new TextureData(TEXTURE_WIDTH, TEXTURE_HEIGHT, new ByteBuffer[]{data}, WrapMode.REPEAT, FilterMode.NEAREST); }
static TextureData function(Color color) { byte red = (byte) color.r(); byte green = (byte) color.g(); byte blue = (byte) color.b(); byte alpha = (byte) color.a(); ByteBuffer data = ByteBuffer.allocateDirect(4 * TEXTURE_WIDTH * TEXTURE_HEIGHT); for (int height = 0; height < TEXTURE_HEIGHT; height++) { for (int width = 0; width < TEXTURE_WIDTH; width++) { data.put(red).put(green).put(blue).put(alpha); } } data.rewind(); return new TextureData(TEXTURE_WIDTH, TEXTURE_HEIGHT, new ByteBuffer[]{data}, WrapMode.REPEAT, FilterMode.NEAREST); }
/** * Create TextureData for a Texture all of a single color. * @param color to use for creating TextureData * @return TextureData created using specified color */
Create TextureData for a Texture all of a single color
newInstance
{ "repo_name": "Vizaxo/Terasology", "path": "engine/src/main/java/org/terasology/rendering/assets/texture/TextureDataFactory.java", "license": "apache-2.0", "size": 3184 }
[ "java.nio.ByteBuffer", "org.terasology.rendering.assets.texture.Texture", "org.terasology.rendering.nui.Color" ]
import java.nio.ByteBuffer; import org.terasology.rendering.assets.texture.Texture; import org.terasology.rendering.nui.Color;
import java.nio.*; import org.terasology.rendering.assets.texture.*; import org.terasology.rendering.nui.*;
[ "java.nio", "org.terasology.rendering" ]
java.nio; org.terasology.rendering;
1,651,546
@Test public void testSetter() throws Exception { TxContext ctx = mock(TxContext.class); SalPort ingress = new SalPort(1L, 3L); int src0 = 1; int dst0 = 80; int src1 = 52984; int dst1 = 9999; int src2 = 413; int dst2 = 60345; Map<Class<? extends FlowFilterAction>, FlowFilterAction> fltActions = new LinkedHashMap<>(); fltActions.put(VTNSetPortSrcAction.class, new VTNSetPortSrcAction(src2)); fltActions.put(VTNSetPortDstAction.class, new VTNSetPortDstAction(dst2)); for (int flags = TCP_SRC; flags <= TCP_ALL; flags++) { TCP pkt = createTCP(src0, dst0); TCP original = copy(pkt, new TCP()); TcpPacket tcp = new TcpPacket(pkt); int src = src0; int dst = dst0; Ethernet ether = createEthernet(pkt); PacketContext pctx = new PacketContext(ctx, ether, ingress); for (FlowFilterAction act: fltActions.values()) { pctx.addFilterAction(act); } TcpPacket tcp1 = (TcpPacket)tcp.clone(); TCP pkt2 = copy(original, new TCP()); if ((flags & TCP_SRC) != 0) { // Modify source port number. tcp1.setSourcePort(src1); pkt2.setSourcePort((short)src1); src = src1; } if ((flags & TCP_DST) != 0) { // Modify destination port number. tcp1.setDestinationPort(dst1); pkt2.setDestinationPort((short)dst1); dst = dst1; } assertEquals(src, tcp1.getSourcePort()); assertEquals(dst, tcp1.getDestinationPort()); // The packet should not be modified until commit() is called. assertSame(pkt, tcp1.getPacket()); assertEquals(original, pkt); assertEquals(true, tcp1.commit(pctx)); TCP newPkt = tcp1.getPacket(); assertNotSame(pkt, newPkt); assertEquals((short)src, newPkt.getSourcePort()); assertEquals((short)dst, newPkt.getDestinationPort()); assertEquals(pkt2, newPkt); assertEquals((short)src0, pkt.getSourcePort()); assertEquals((short)dst0, pkt.getDestinationPort()); assertEquals(original, pkt); assertTrue(pctx.hasMatchField(FlowMatchType.DL_TYPE)); assertTrue(pctx.hasMatchField(FlowMatchType.IP_PROTO)); List<FlowFilterAction> filterActions = new ArrayList<>(pctx.getFilterActions()); assertEquals(new ArrayList<FlowFilterAction>(fltActions.values()), filterActions); // Actions for unchanged field will be removed if corresponding // match type is configured in PacketContext. List<FlowFilterAction> actions = new ArrayList<>(); if ((flags & TCP_SRC) != 0) { actions.add(fltActions.get(VTNSetPortSrcAction.class)); } if ((flags & TCP_DST) != 0) { actions.add(fltActions.get(VTNSetPortDstAction.class)); } pctx = new PacketContext(ctx, ether, ingress); for (FlowMatchType mt: FlowMatchType.values()) { pctx.addMatchField(mt); } for (FlowFilterAction act: fltActions.values()) { pctx.addFilterAction(act); } assertEquals(true, tcp1.commit(pctx)); assertSame(newPkt, tcp1.getPacket()); filterActions = new ArrayList<>(pctx.getFilterActions()); assertEquals(actions, filterActions); // The original packet should not be affected. assertEquals(src0, tcp.getSourcePort()); assertEquals(dst0, tcp.getDestinationPort()); assertSame(pkt, tcp.getPacket()); assertEquals(original, pkt); // Set values in the original packet. tcp1.setSourcePort(src0); tcp1.setDestinationPort(dst0); assertEquals(false, tcp1.commit(pctx)); assertEquals(src0, tcp1.getSourcePort()); assertEquals(dst0, tcp1.getDestinationPort()); // Ensure that a set of modified values is deeply cloned. TcpPacket tcp2 = (TcpPacket)tcp1.clone(); assertNotSame(tcp1, tcp2); assertEquals(src0, tcp1.getSourcePort()); assertEquals(dst0, tcp1.getDestinationPort()); assertEquals(src0, tcp2.getSourcePort()); assertEquals(dst0, tcp2.getDestinationPort()); tcp2.setSourcePort(src1); tcp2.setDestinationPort(dst1); assertEquals(src0, tcp1.getSourcePort()); assertEquals(dst0, tcp1.getDestinationPort()); assertEquals(src1, tcp2.getSourcePort()); assertEquals(dst1, tcp2.getDestinationPort()); } verifyZeroInteractions(ctx); }
void function() throws Exception { TxContext ctx = mock(TxContext.class); SalPort ingress = new SalPort(1L, 3L); int src0 = 1; int dst0 = 80; int src1 = 52984; int dst1 = 9999; int src2 = 413; int dst2 = 60345; Map<Class<? extends FlowFilterAction>, FlowFilterAction> fltActions = new LinkedHashMap<>(); fltActions.put(VTNSetPortSrcAction.class, new VTNSetPortSrcAction(src2)); fltActions.put(VTNSetPortDstAction.class, new VTNSetPortDstAction(dst2)); for (int flags = TCP_SRC; flags <= TCP_ALL; flags++) { TCP pkt = createTCP(src0, dst0); TCP original = copy(pkt, new TCP()); TcpPacket tcp = new TcpPacket(pkt); int src = src0; int dst = dst0; Ethernet ether = createEthernet(pkt); PacketContext pctx = new PacketContext(ctx, ether, ingress); for (FlowFilterAction act: fltActions.values()) { pctx.addFilterAction(act); } TcpPacket tcp1 = (TcpPacket)tcp.clone(); TCP pkt2 = copy(original, new TCP()); if ((flags & TCP_SRC) != 0) { tcp1.setSourcePort(src1); pkt2.setSourcePort((short)src1); src = src1; } if ((flags & TCP_DST) != 0) { tcp1.setDestinationPort(dst1); pkt2.setDestinationPort((short)dst1); dst = dst1; } assertEquals(src, tcp1.getSourcePort()); assertEquals(dst, tcp1.getDestinationPort()); assertSame(pkt, tcp1.getPacket()); assertEquals(original, pkt); assertEquals(true, tcp1.commit(pctx)); TCP newPkt = tcp1.getPacket(); assertNotSame(pkt, newPkt); assertEquals((short)src, newPkt.getSourcePort()); assertEquals((short)dst, newPkt.getDestinationPort()); assertEquals(pkt2, newPkt); assertEquals((short)src0, pkt.getSourcePort()); assertEquals((short)dst0, pkt.getDestinationPort()); assertEquals(original, pkt); assertTrue(pctx.hasMatchField(FlowMatchType.DL_TYPE)); assertTrue(pctx.hasMatchField(FlowMatchType.IP_PROTO)); List<FlowFilterAction> filterActions = new ArrayList<>(pctx.getFilterActions()); assertEquals(new ArrayList<FlowFilterAction>(fltActions.values()), filterActions); List<FlowFilterAction> actions = new ArrayList<>(); if ((flags & TCP_SRC) != 0) { actions.add(fltActions.get(VTNSetPortSrcAction.class)); } if ((flags & TCP_DST) != 0) { actions.add(fltActions.get(VTNSetPortDstAction.class)); } pctx = new PacketContext(ctx, ether, ingress); for (FlowMatchType mt: FlowMatchType.values()) { pctx.addMatchField(mt); } for (FlowFilterAction act: fltActions.values()) { pctx.addFilterAction(act); } assertEquals(true, tcp1.commit(pctx)); assertSame(newPkt, tcp1.getPacket()); filterActions = new ArrayList<>(pctx.getFilterActions()); assertEquals(actions, filterActions); assertEquals(src0, tcp.getSourcePort()); assertEquals(dst0, tcp.getDestinationPort()); assertSame(pkt, tcp.getPacket()); assertEquals(original, pkt); tcp1.setSourcePort(src0); tcp1.setDestinationPort(dst0); assertEquals(false, tcp1.commit(pctx)); assertEquals(src0, tcp1.getSourcePort()); assertEquals(dst0, tcp1.getDestinationPort()); TcpPacket tcp2 = (TcpPacket)tcp1.clone(); assertNotSame(tcp1, tcp2); assertEquals(src0, tcp1.getSourcePort()); assertEquals(dst0, tcp1.getDestinationPort()); assertEquals(src0, tcp2.getSourcePort()); assertEquals(dst0, tcp2.getDestinationPort()); tcp2.setSourcePort(src1); tcp2.setDestinationPort(dst1); assertEquals(src0, tcp1.getSourcePort()); assertEquals(dst0, tcp1.getDestinationPort()); assertEquals(src1, tcp2.getSourcePort()); assertEquals(dst1, tcp2.getDestinationPort()); } verifyZeroInteractions(ctx); }
/** * Test case for setter methods and {@link TcpPacket#clone()}. * * @throws Exception An error occurred. */
Test case for setter methods and <code>TcpPacket#clone()</code>
testSetter
{ "repo_name": "opendaylight/vtn", "path": "manager/implementation/src/test/java/org/opendaylight/vtn/manager/internal/packet/cache/TcpPacketTest.java", "license": "epl-1.0", "size": 21035 }
[ "java.util.ArrayList", "java.util.LinkedHashMap", "java.util.List", "java.util.Map", "org.mockito.Mockito", "org.opendaylight.vtn.manager.internal.TxContext", "org.opendaylight.vtn.manager.internal.util.flow.action.FlowFilterAction", "org.opendaylight.vtn.manager.internal.util.flow.action.VTNSetPortDstAction", "org.opendaylight.vtn.manager.internal.util.flow.action.VTNSetPortSrcAction", "org.opendaylight.vtn.manager.internal.util.flow.match.FlowMatchType", "org.opendaylight.vtn.manager.internal.util.inventory.SalPort", "org.opendaylight.vtn.manager.internal.vnode.PacketContext", "org.opendaylight.vtn.manager.packet.Ethernet" ]
import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.mockito.Mockito; import org.opendaylight.vtn.manager.internal.TxContext; import org.opendaylight.vtn.manager.internal.util.flow.action.FlowFilterAction; import org.opendaylight.vtn.manager.internal.util.flow.action.VTNSetPortDstAction; import org.opendaylight.vtn.manager.internal.util.flow.action.VTNSetPortSrcAction; import org.opendaylight.vtn.manager.internal.util.flow.match.FlowMatchType; import org.opendaylight.vtn.manager.internal.util.inventory.SalPort; import org.opendaylight.vtn.manager.internal.vnode.PacketContext; import org.opendaylight.vtn.manager.packet.Ethernet;
import java.util.*; import org.mockito.*; import org.opendaylight.vtn.manager.internal.*; import org.opendaylight.vtn.manager.internal.util.flow.action.*; import org.opendaylight.vtn.manager.internal.util.flow.match.*; import org.opendaylight.vtn.manager.internal.util.inventory.*; import org.opendaylight.vtn.manager.internal.vnode.*; import org.opendaylight.vtn.manager.packet.*;
[ "java.util", "org.mockito", "org.opendaylight.vtn" ]
java.util; org.mockito; org.opendaylight.vtn;
85,215
@Test public void testVarReplacement() throws ConverterException { ArrayList<ProcessingStep> pss = new ArrayList<>(); ArrayList<Parameter> params = new ArrayList<>(); ProcessingStep ps = new ProcessingStep(); ps.setName("toShape"); ps.setParameters(new ArrayList<Parameter>()); pss.add(ps); DownloadStep dls = new DownloadStep( "", params, "", "", "", pss); ProcessingStepConverter psc = new ProcessingStepConverter(); psc.convert(dls, null, null); for (Job job: psc.getJobs()) { if (job instanceof ExternalProcessJob) { ExternalProcessJob epj = (ExternalProcessJob)job; List<String> cmds = epj.commandList(); String cmd = StringUtils.join(cmds, " "); assertEquals( cmd, "ogr2ogr -f ESRI Shapefile shp *.{gml,kml,shp}"); return; } } fail("No external processing job found"); }
void function() throws ConverterException { ArrayList<ProcessingStep> pss = new ArrayList<>(); ArrayList<Parameter> params = new ArrayList<>(); ProcessingStep ps = new ProcessingStep(); ps.setName(STR); ps.setParameters(new ArrayList<Parameter>()); pss.add(ps); DownloadStep dls = new DownloadStep( STRSTRSTRSTR STRogr2ogr -f ESRI Shapefile shp *.{gml,kml,shp}STRNo external processing job found"); }
/** * The test. * * @throws ConverterException If something went wrong. * */
The test
testVarReplacement
{ "repo_name": "gdi-by/downloadclient", "path": "src/test/java/de/bayern/gdi/Issue85Test.java", "license": "apache-2.0", "size": 2765 }
[ "de.bayern.gdi.model.DownloadStep", "de.bayern.gdi.model.Parameter", "de.bayern.gdi.model.ProcessingStep", "de.bayern.gdi.processor.ConverterException", "java.util.ArrayList" ]
import de.bayern.gdi.model.DownloadStep; import de.bayern.gdi.model.Parameter; import de.bayern.gdi.model.ProcessingStep; import de.bayern.gdi.processor.ConverterException; import java.util.ArrayList;
import de.bayern.gdi.model.*; import de.bayern.gdi.processor.*; import java.util.*;
[ "de.bayern.gdi", "java.util" ]
de.bayern.gdi; java.util;
2,543,967
@Override public void enterYang_version_stmt(YangParser.Yang_version_stmtContext ctx) { String version = ValidationUtil.getName(ctx); String rootParentName = ValidationUtil.getRootParentName(ctx); if (!version.equals(BasicValidations.SUPPORTED_YANG_VERSION)) { ValidationUtil .ex(ValidationUtil .f("(In (sub)module:%s) Unsupported yang version:%s, supported version:%s", rootParentName, version, BasicValidations.SUPPORTED_YANG_VERSION)); } }
void function(YangParser.Yang_version_stmtContext ctx) { String version = ValidationUtil.getName(ctx); String rootParentName = ValidationUtil.getRootParentName(ctx); if (!version.equals(BasicValidations.SUPPORTED_YANG_VERSION)) { ValidationUtil .ex(ValidationUtil .f(STR, rootParentName, version, BasicValidations.SUPPORTED_YANG_VERSION)); } }
/** * Constraints: * <ol> * <li>Yang-version is specified as 1</li> * </ol> */
Constraints: Yang-version is specified as 1
enterYang_version_stmt
{ "repo_name": "lbchen/odl-mod", "path": "opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/validator/YangModelBasicValidationListener.java", "license": "epl-1.0", "size": 20476 }
[ "org.opendaylight.controller.antlrv4.code.gen.YangParser" ]
import org.opendaylight.controller.antlrv4.code.gen.YangParser;
import org.opendaylight.controller.antlrv4.code.gen.*;
[ "org.opendaylight.controller" ]
org.opendaylight.controller;
2,507,422
@Test public void testNonLiteralStringCompare() throws Throwable { for (String mode : new String[]{ "PREFIX", "CONTAINS", "SPARSE"}) { for (boolean forceFlush : new boolean[]{ false, true }) { try { createTable("CREATE TABLE %s (pk int primary key, v text);"); createIndex(String.format("CREATE CUSTOM INDEX ON %%s (v) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'is_literal': 'false', 'mode': '%s'};", mode)); execute("INSERT INTO %s (pk, v) VALUES (?, ?);", 0, "a"); execute("INSERT INTO %s (pk, v) VALUES (?, ?);", 1, "abc"); execute("INSERT INTO %s (pk, v) VALUES (?, ?);", 2, "ac"); flush(forceFlush); Session session = sessionNet(); SimpleStatement stmt = new SimpleStatement("SELECT * FROM " + KEYSPACE + '.' + currentTable() + " WHERE v = 'ab'"); stmt.setFetchSize(5); List<Row> rs = session.execute(stmt).all(); Assert.assertEquals(0, rs.size()); try { sessionNet(); stmt = new SimpleStatement("SELECT * FROM " + KEYSPACE + '.' + currentTable() + " WHERE v > 'ab'"); stmt.setFetchSize(5); rs = session.execute(stmt).all(); Assert.assertFalse("CONTAINS mode on non-literal string type should not support RANGE operators", "CONTAINS".equals(mode)); Assert.assertEquals(2, rs.size()); Assert.assertEquals(1, rs.get(0).getInt("pk")); } catch (InvalidQueryException ex) { if (!"CONTAINS".equals(mode)) throw ex; } } catch (Throwable th) { throw new AssertionError(String.format("Failure with mode:%s and flush:%s ", mode, forceFlush), th); } } } }
void function() throws Throwable { for (String mode : new String[]{ STR, STR, STR}) { for (boolean forceFlush : new boolean[]{ false, true }) { try { createTable(STR); createIndex(String.format(STR, mode)); execute(STR, 0, "a"); execute(STR, 1, "abc"); execute(STR, 2, "ac"); flush(forceFlush); Session session = sessionNet(); SimpleStatement stmt = new SimpleStatement(STR + KEYSPACE + '.' + currentTable() + STR); stmt.setFetchSize(5); List<Row> rs = session.execute(stmt).all(); Assert.assertEquals(0, rs.size()); try { sessionNet(); stmt = new SimpleStatement(STR + KEYSPACE + '.' + currentTable() + STR); stmt.setFetchSize(5); rs = session.execute(stmt).all(); Assert.assertFalse(STR, STR.equals(mode)); Assert.assertEquals(2, rs.size()); Assert.assertEquals(1, rs.get(0).getInt("pk")); } catch (InvalidQueryException ex) { if (!STR.equals(mode)) throw ex; } } catch (Throwable th) { throw new AssertionError(String.format(STR, mode, forceFlush), th); } } } }
/** * Tests query condition '>' on string columns with is_literal=false. */
Tests query condition '>' on string columns with is_literal=false
testNonLiteralStringCompare
{ "repo_name": "instaclustr/cassandra", "path": "test/unit/org/apache/cassandra/index/sasi/SASICQLTest.java", "license": "apache-2.0", "size": 15156 }
[ "com.datastax.driver.core.Row", "com.datastax.driver.core.Session", "com.datastax.driver.core.SimpleStatement", "com.datastax.driver.core.exceptions.InvalidQueryException", "java.util.List", "org.junit.Assert" ]
import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.exceptions.InvalidQueryException; import java.util.List; import org.junit.Assert;
import com.datastax.driver.core.*; import com.datastax.driver.core.exceptions.*; import java.util.*; import org.junit.*;
[ "com.datastax.driver", "java.util", "org.junit" ]
com.datastax.driver; java.util; org.junit;
1,710,272
@Override public boolean addAll(final java.util.Collection<? extends TableOperation> c) { int size = this.size(); for (final TableOperation operation : c) { Utility.assertNotNull("operation", operation); this.checkSingleQueryPerBatch(operation, size); if (operation.getEntity() == null) { // Query operation this.lockToPartitionKey(((QueryTableOperation) operation).getPartitionKey()); } else { this.lockToPartitionKey(operation.getEntity().getPartitionKey()); } size++; } return super.addAll(c); }
boolean function(final java.util.Collection<? extends TableOperation> c) { int size = this.size(); for (final TableOperation operation : c) { Utility.assertNotNull(STR, operation); this.checkSingleQueryPerBatch(operation, size); if (operation.getEntity() == null) { this.lockToPartitionKey(((QueryTableOperation) operation).getPartitionKey()); } else { this.lockToPartitionKey(operation.getEntity().getPartitionKey()); } size++; } return super.addAll(c); }
/** * Adds the collection of table operations to the batch operation <code>ArrayList</code>. * * @param c * A <code>java.util.Collection</code> of {@link TableOperation} objects to add to the batch operation. * @return * <code>true</code> if the operations were added successfully. */
Adds the collection of table operations to the batch operation <code>ArrayList</code>
addAll
{ "repo_name": "horizon-institute/runspotrun-android-client", "path": "src/com/microsoft/azure/storage/table/TableBatchOperation.java", "license": "agpl-3.0", "size": 26054 }
[ "com.microsoft.azure.storage.core.Utility" ]
import com.microsoft.azure.storage.core.Utility;
import com.microsoft.azure.storage.core.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,194,375
private OAuthConsumerAppDTO getAuthAppDetails(String consumerKey) throws RemoteException, OAuthAdminServiceException, XPathExpressionException { OAuthAdminServiceStub stub = new OAuthAdminServiceStub(getKeyManagerURLHttps() + "services/OAuthAdminService"); ServiceClient client = stub._getServiceClient(); Options client_options = client.getOptions(); HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator(); authenticator.setUsername(user.getUserName()); authenticator.setPassword(user.getPassword()); authenticator.setPreemptiveAuthentication(true); client_options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, authenticator); client.setOptions(client_options); return stub.getOAuthApplicationData(consumerKey); }
OAuthConsumerAppDTO function(String consumerKey) throws RemoteException, OAuthAdminServiceException, XPathExpressionException { OAuthAdminServiceStub stub = new OAuthAdminServiceStub(getKeyManagerURLHttps() + STR); ServiceClient client = stub._getServiceClient(); Options client_options = client.getOptions(); HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator(); authenticator.setUsername(user.getUserName()); authenticator.setPassword(user.getPassword()); authenticator.setPreemptiveAuthentication(true); client_options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, authenticator); client.setOptions(client_options); return stub.getOAuthApplicationData(consumerKey); }
/** * Invoke OAuthAdminService admin service for get the Auth application details * * @param consumerKey Auth application consumer key * @return return OAuthConsumerAppDTO * @throws RemoteException occur if connection error occurred * @throws OAuthAdminServiceException occur if OAuthAdminService invocation error occurred * @throws XPathExpressionException occurred if xpath evaluation occurred */
Invoke OAuthAdminService admin service for get the Auth application details
getAuthAppDetails
{ "repo_name": "irhamiqbal/product-apim", "path": "modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/application/APIMANAGER3706ApplicationUpdateTestCase.java", "license": "apache-2.0", "size": 9078 }
[ "java.rmi.RemoteException", "javax.xml.xpath.XPathExpressionException", "org.apache.axis2.client.Options", "org.apache.axis2.client.ServiceClient", "org.apache.axis2.transport.http.HttpTransportProperties", "org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceException", "org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceStub", "org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO" ]
import java.rmi.RemoteException; import javax.xml.xpath.XPathExpressionException; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.transport.http.HttpTransportProperties; import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceException; import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceStub; import org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO;
import java.rmi.*; import javax.xml.xpath.*; import org.apache.axis2.client.*; import org.apache.axis2.transport.http.*; import org.wso2.carbon.identity.oauth.stub.*; import org.wso2.carbon.identity.oauth.stub.dto.*;
[ "java.rmi", "javax.xml", "org.apache.axis2", "org.wso2.carbon" ]
java.rmi; javax.xml; org.apache.axis2; org.wso2.carbon;
2,520,432
@VisibleForTesting void setBackOff(BackOff backOff) { this.backOff = backOff; }
void setBackOff(BackOff backOff) { this.backOff = backOff; }
/** * Sets the backoff for determining sleep duration between retries. * * @param backOff May be null to force the next usage to auto-initialize with default settings. */
Sets the backoff for determining sleep duration between retries
setBackOff
{ "repo_name": "peltekster/bigdata-interop-leanplum", "path": "gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java", "license": "apache-2.0", "size": 22939 }
[ "com.google.api.client.util.BackOff" ]
import com.google.api.client.util.BackOff;
import com.google.api.client.util.*;
[ "com.google.api" ]
com.google.api;
1,792,595
private static void closeConnection(IDatabaseConnection connection) { if(connection!=null) { Connection realConnection; try { realConnection = connection.getConnection(); if(realConnection!=null) { DBTools.close(realConnection, null, null); } } catch (SQLException ex) { log.warn("An error occurred closing connection.",ex); } } }
static void function(IDatabaseConnection connection) { if(connection!=null) { Connection realConnection; try { realConnection = connection.getConnection(); if(realConnection!=null) { DBTools.close(realConnection, null, null); } } catch (SQLException ex) { log.warn(STR,ex); } } }
/** * This method is used to close a DatabaseConnection. * * @param connection the connection to be closed. */
This method is used to close a DatabaseConnection
closeConnection
{ "repo_name": "accesstest3/cfunambol", "path": "common/push-listener/core/src/test/java/com/funambol/pushlistener/util/DBUnitHelper.java", "license": "agpl-3.0", "size": 10941 }
[ "com.funambol.framework.tools.DBTools", "java.sql.Connection", "java.sql.SQLException", "org.dbunit.database.IDatabaseConnection" ]
import com.funambol.framework.tools.DBTools; import java.sql.Connection; import java.sql.SQLException; import org.dbunit.database.IDatabaseConnection;
import com.funambol.framework.tools.*; import java.sql.*; import org.dbunit.database.*;
[ "com.funambol.framework", "java.sql", "org.dbunit.database" ]
com.funambol.framework; java.sql; org.dbunit.database;
1,273,698
public void setProperty(String propertyName, String value, String priority) throws DOMException;
void function(String propertyName, String value, String priority) throws DOMException;
/** * Used to set a property value and priority within this declaration * block. <code>setProperty</code> permits to modify a property or add a * new one in the declaration block. Any call to this method may modify * the order of properties in the <code>item</code> method. * @param propertyName The name of the CSS property. See the CSS * property index. * @param value The new value of the property. * @param priority The new priority of the property (e.g. * <code>"important"</code>) or the empty string if none. * @exception DOMException * SYNTAX_ERR: Raised if the specified value has a syntax error and is * unparsable. * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is * readonly or the property is readonly. */
Used to set a property value and priority within this declaration block. <code>setProperty</code> permits to modify a property or add a new one in the declaration block. Any call to this method may modify the order of properties in the <code>item</code> method
setProperty
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jaxp/drop_included/jaxp_src/src/org/w3c/dom/css/CSSStyleDeclaration.java", "license": "gpl-2.0", "size": 8851 }
[ "org.w3c.dom.DOMException" ]
import org.w3c.dom.DOMException;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
35,030
public long getMemStoreFlushSize() { byte [] value = getValue(MEMSTORE_FLUSHSIZE_KEY); if (value != null) { return Long.parseLong(Bytes.toString(value)); } return -1; }
long function() { byte [] value = getValue(MEMSTORE_FLUSHSIZE_KEY); if (value != null) { return Long.parseLong(Bytes.toString(value)); } return -1; }
/** * Returns the size of the memstore after which a flush to filesystem is triggered. * * @return memory cache flush size for each hregion, -1 if not set. * * @see #setMemStoreFlushSize(long) */
Returns the size of the memstore after which a flush to filesystem is triggered
getMemStoreFlushSize
{ "repo_name": "ibmsoe/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java", "license": "apache-2.0", "size": 57499 }
[ "org.apache.hadoop.hbase.util.Bytes" ]
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,731,867
public gov.nih.nci.mageom.domain.bioassay.DerivedBioAssay[] getBioAssays() { return bioAssays; }
gov.nih.nci.mageom.domain.bioassay.DerivedBioAssay[] function() { return bioAssays; }
/** * Get the bioAssays value for this DerivedBioAssays * * @return the value of bioAssays * */
Get the bioAssays value for this DerivedBioAssays
getBioAssays
{ "repo_name": "NCIP/bioconductor", "path": "services/caAffy/caGrid/caAffy/src/org/bioconductor/packages/caAffy/DerivedBioAssays.java", "license": "bsd-3-clause", "size": 3113 }
[ "gov.nih.nci.mageom.domain.bioassay.DerivedBioAssay" ]
import gov.nih.nci.mageom.domain.bioassay.DerivedBioAssay;
import gov.nih.nci.mageom.domain.bioassay.*;
[ "gov.nih.nci" ]
gov.nih.nci;
2,905,864
private long findLastModifiedWhileOlder(File file, long lastModified) { if (file.isDirectory()) { File children[] = file.listFiles(); for (File child : children) { if (child.lastModified() > lastModified) return child.lastModified(); long lm = findLastModifiedWhileOlder(child, lastModified); if (lm > lastModified) return lm; } } return file.lastModified(); }
long function(File file, long lastModified) { if (file.isDirectory()) { File children[] = file.listFiles(); for (File child : children) { if (child.lastModified() > lastModified) return child.lastModified(); long lm = findLastModifiedWhileOlder(child, lastModified); if (lm > lastModified) return lm; } } return file.lastModified(); }
/** * Check if a file or directory is older than the given time. * * @param file * @param lastModified */
Check if a file or directory is older than the given time
findLastModifiedWhileOlder
{ "repo_name": "mcculls/bnd", "path": "biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java", "license": "apache-2.0", "size": 50886 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,316,417
void printTree(Node<E> node) { for (Node<E> value : node.getChildren()) { String forPrint = value.getSubUnitId(); if (value.getParent() != root) { Node<E> currentParent = value.getParent(); LinkedList<String> list = new LinkedList<>(); StringBuilder stringBuilder = new StringBuilder(); while (currentParent != root) { String id = currentParent.getSubUnitId(); list.add(id); currentParent = currentParent.getParent(); } while (list.size() != 0) { stringBuilder.append(list.removeLast()); stringBuilder.append("\\"); } stringBuilder.append(forPrint); System.out.println(stringBuilder); } else { System.out.println(forPrint); } if (value.getChildren() != null) { printTree(value); } } }
void printTree(Node<E> node) { for (Node<E> value : node.getChildren()) { String forPrint = value.getSubUnitId(); if (value.getParent() != root) { Node<E> currentParent = value.getParent(); LinkedList<String> list = new LinkedList<>(); StringBuilder stringBuilder = new StringBuilder(); while (currentParent != root) { String id = currentParent.getSubUnitId(); list.add(id); currentParent = currentParent.getParent(); } while (list.size() != 0) { stringBuilder.append(list.removeLast()); stringBuilder.append("\\"); } stringBuilder.append(forPrint); System.out.println(stringBuilder); } else { System.out.println(forPrint); } if (value.getChildren() != null) { printTree(value); } } }
/** * Printing tree. * @param node .. */
Printing tree
printTree
{ "repo_name": "Piterski72/Java-a-to-z", "path": "chapter_005_Lite/TestTask005_Lite/src/main/java/ru/nivanov/subUnitReference/SubUnitTree.java", "license": "apache-2.0", "size": 3081 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
1,680,386
@Override protected void performDefaults() { ActivationService.getInstance().clearActivation(); }
void function() { ActivationService.getInstance().clearActivation(); }
/** * For loading the defaults here. */
For loading the defaults here
performDefaults
{ "repo_name": "ShoukriKattan/ForgedUI-Eclipse", "path": "com.forgedui.editor/src/com/forgedui/editor/preference/LicensePreferencePage.java", "license": "mit", "size": 5140 }
[ "com.forgedui.editor.common.ActivationService" ]
import com.forgedui.editor.common.ActivationService;
import com.forgedui.editor.common.*;
[ "com.forgedui.editor" ]
com.forgedui.editor;
1,898,684