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
protected void scanHeader(final JScan scan) { if (getScannerMethod() != null) { getScannerMethod().scan(scan); } else if (isDirect()) { nativeScan(scan); } else { final JPacket packet = scan.scan_packet(); final int offset = scan.scan_offset(); setAllLengths(scan, packet, offset); } if (scan.scan_length() == 0) { return; } if (scan.scan_next_id() == JProtocol.PAYLOAD_ID) { scan.record_header(); final JPacket packet = scan.scan_packet(); final int offset = scan.scan_offset(); scan.scan_offset(offset); final int next = scanAllBindings(packet, offset + scan.scan_length() + scan.scan_gap()); scan.scan_next_id(next); } }
void function(final JScan scan) { if (getScannerMethod() != null) { getScannerMethod().scan(scan); } else if (isDirect()) { nativeScan(scan); } else { final JPacket packet = scan.scan_packet(); final int offset = scan.scan_offset(); setAllLengths(scan, packet, offset); } if (scan.scan_length() == 0) { return; } if (scan.scan_next_id() == JProtocol.PAYLOAD_ID) { scan.record_header(); final JPacket packet = scan.scan_packet(); final int offset = scan.scan_offset(); scan.scan_offset(offset); final int next = scanAllBindings(packet, offset + scan.scan_length() + scan.scan_gap()); scan.scan_next_id(next); } }
/** * The main method that this header scanner is called on by the packet * scanner, typically from native user space. * * @param scan * scan state structure that is used to pass around state both in * java and native user space */
The main method that this header scanner is called on by the packet scanner, typically from native user space
scanHeader
{ "repo_name": "universsky/diddler", "path": "src/org/jnetpcap/packet/JHeaderScanner.java", "license": "lgpl-3.0", "size": 15496 }
[ "org.jnetpcap.protocol.JProtocol" ]
import org.jnetpcap.protocol.JProtocol;
import org.jnetpcap.protocol.*;
[ "org.jnetpcap.protocol" ]
org.jnetpcap.protocol;
916,513
public interface ContainerServicesClient extends InnerSupportsGet<ContainerServiceInner>, InnerSupportsListing<ContainerServiceInner>, InnerSupportsDelete<Void> { @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ContainerServiceInner> listAsync();
interface ContainerServicesClient extends InnerSupportsGet<ContainerServiceInner>, InnerSupportsListing<ContainerServiceInner>, InnerSupportsDelete<Void> { @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ContainerServiceInner> function();
/** * Gets a list of container services in the specified subscription. The operation returns properties of each * container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of container services in the specified subscription. */
Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents
listAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/ContainerServicesClient.java", "license": "mit", "size": 24733 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.resourcemanager.compute.fluent.models.ContainerServiceInner", "com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete", "com.azure.resourcemanager.reso...
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.compute.fluent.models.ContainerServiceInner; import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete; import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsGet; import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsListing;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.compute.fluent.models.*; import com.azure.resourcemanager.resources.fluentcore.collection.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
328,724
public Object forceFlush() throws IOException;
Object function() throws IOException;
/** * Triggers an immediate memtable flush. */
Triggers an immediate memtable flush
forceFlush
{ "repo_name": "ucare-uchicago/cass-fate-system", "path": "src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java", "license": "apache-2.0", "size": 4555 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,366,566
public static void load() throws SMException { dictionary = new HashMap(); try { SMLog.write( "Loading config file..." ); File fl = new File( configname ); if ( !fl.exists() ) { SMLog.write( "Config does not exist, creating..." ); if ( !fl.createNewFile() ) throw new SMException( "Failed to create config file" ); return; } fileReader = new FileInputStream( fl ); reader = new BufferedReader( new InputStreamReader( fileReader, "US-ASCII" ) ); String line = ""; int linenumber = 0; // This is an incredibly simple config reader // The syntax is this: // [key] = [value] while ( ( line = reader.readLine() ) != null ) { try { linenumber++; if ( line.startsWith( "#" ) ) continue; if ( line.trim().isEmpty() ) continue; String[] split = line.split( "=" ); if ( split.length != 2 ) throw new SMException( "Config mismatch [" + linenumber + "]" ); // key is always a string String key = split[ 0 ].trim(); // value is tbd Object value; String tmp = split[ 1 ].trim(); // parse as string, boolean, or int if ( tmp.charAt( 0 ) == '\"' && tmp.charAt( tmp.length() - 1 ) == '\"' ) value = tmp.substring( 1, tmp.length() - 1 ); else if ( tmp.toLowerCase().equals( "true" ) ) value = true; else if ( tmp.toLowerCase().equals( "false" ) ) value = false; else { try { if ( tmp.contains( "." ) ) value = new Float( tmp ); else value = new Integer( tmp ); } catch ( NumberFormatException ex ) { throw new SMException( "Invalid type (must be string, boolean, integer, or float) [" + linenumber + "]" ); } } if ( dictionary.containsKey( key ) ) throw new SMException( "Duplicate config keys [" + linenumber + "]" ); dictionary.put( key, value ); } catch ( SMException ex ) { // nothing to do // simple config mistakes will not break our program } } } catch ( IOException ex ) { throw new SMRuntimeException( ex.getMessage() ); } SMLog.write( "Config loaded." ); }
static void function() throws SMException { dictionary = new HashMap(); try { SMLog.write( STR ); File fl = new File( configname ); if ( !fl.exists() ) { SMLog.write( STR ); if ( !fl.createNewFile() ) throw new SMException( STR ); return; } fileReader = new FileInputStream( fl ); reader = new BufferedReader( new InputStreamReader( fileReader, STR ) ); String line = STR#STR=STRConfig mismatch [STR]STR' && tmp.charAt( tmp.length() - 1 ) == '\STRtrueSTRfalseSTR.STRInvalid type (must be string, boolean, integer, or float) [STR]STRDuplicate config keys [STR]STRConfig loaded." ); }
/** * Loads the config. * @throws SMException */
Loads the config
load
{ "repo_name": "thecheeseman/zombies_servermanager", "path": "src/servermanager/SMConfig.java", "license": "gpl-3.0", "size": 7054 }
[ "java.io.BufferedReader", "java.io.File", "java.io.FileInputStream", "java.io.InputStreamReader", "java.util.HashMap" ]
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.HashMap;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,088,054
private void addTrueTypeFont(File ttfFile) throws IOException { try { if (ttfFile.getPath().endsWith(".otf")) { OTFParser parser = new OTFParser(false, true); OpenTypeFont otf = parser.parse(ttfFile); addTrueTypeFontImpl(otf, ttfFile); } else { TTFParser parser = new TTFParser(false, true); TrueTypeFont ttf = parser.parse(ttfFile); addTrueTypeFontImpl(ttf, ttfFile); } } catch (NullPointerException e) // TTF parser is buggy { LOG.error("Could not load font file: " + ttfFile, e); } catch (IOException e) { LOG.error("Could not load font file: " + ttfFile, e); } }
void function(File ttfFile) throws IOException { try { if (ttfFile.getPath().endsWith(".otf")) { OTFParser parser = new OTFParser(false, true); OpenTypeFont otf = parser.parse(ttfFile); addTrueTypeFontImpl(otf, ttfFile); } else { TTFParser parser = new TTFParser(false, true); TrueTypeFont ttf = parser.parse(ttfFile); addTrueTypeFontImpl(ttf, ttfFile); } } catch (NullPointerException e) { LOG.error(STR + ttfFile, e); } catch (IOException e) { LOG.error(STR + ttfFile, e); } }
/** * Adds an OTF or TTF font to the file cache. To reduce memory, the parsed font is not cached. */
Adds an OTF or TTF font to the file cache. To reduce memory, the parsed font is not cached
addTrueTypeFont
{ "repo_name": "gavanx/pdflearn", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java", "license": "apache-2.0", "size": 21873 }
[ "java.io.File", "java.io.IOException", "org.apache.fontbox.ttf.OTFParser", "org.apache.fontbox.ttf.OpenTypeFont", "org.apache.fontbox.ttf.TTFParser", "org.apache.fontbox.ttf.TrueTypeFont" ]
import java.io.File; import java.io.IOException; import org.apache.fontbox.ttf.OTFParser; import org.apache.fontbox.ttf.OpenTypeFont; import org.apache.fontbox.ttf.TTFParser; import org.apache.fontbox.ttf.TrueTypeFont;
import java.io.*; import org.apache.fontbox.ttf.*;
[ "java.io", "org.apache.fontbox" ]
java.io; org.apache.fontbox;
223,819
public static SAXTransformerFactory newTransformerFactory( QName name ) { Factory<SAXTransformerFactory> factory = getTransformerFactoryFactory( name ); if( factory == null ) { throw new RuntimeException("There is no Factory<SAXTransformerFactory> named '"+name+"."); } return factory.newInstance(); }
static SAXTransformerFactory function( QName name ) { Factory<SAXTransformerFactory> factory = getTransformerFactoryFactory( name ); if( factory == null ) { throw new RuntimeException(STR+name+"."); } return factory.newInstance(); }
/** * Creates a new SAXTransformerFactory based on the Factory registered with the specified name. * @param name the name of the Factory<SAXTransformerFactory> to use. * @return the new SAXTransformerFactory that was created. * @throws RuntimeException if there is not a factory with the specified name. */
Creates a new SAXTransformerFactory based on the Factory registered with the specified name
newTransformerFactory
{ "repo_name": "ctrimble/xchain", "path": "core/src/main/java/org/xchain/framework/lifecycle/XmlFactoryLifecycle.java", "license": "apache-2.0", "size": 16254 }
[ "javax.xml.namespace.QName", "javax.xml.transform.sax.SAXTransformerFactory" ]
import javax.xml.namespace.QName; import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.namespace.*; import javax.xml.transform.sax.*;
[ "javax.xml" ]
javax.xml;
2,148,139
try { Object res = bean; for (int i = 0; i < this.getters.length; i++) { if ((res = this.getters[i].invoke(res)) == null) return null; } return res; } catch (final ReflectiveOperationException e) { throw new RuntimeException("Error getting bean property value.", e); } } } private static final ConcurrentMap<String, Getter> GETTERS_CACHE = new ConcurrentHashMap<>(); private BeanUtils() {}
try { Object res = bean; for (int i = 0; i < this.getters.length; i++) { if ((res = this.getters[i].invoke(res)) == null) return null; } return res; } catch (final ReflectiveOperationException e) { throw new RuntimeException(STR, e); } } } private static final ConcurrentMap<String, Getter> GETTERS_CACHE = new ConcurrentHashMap<>(); private BeanUtils() {}
/** * Get bean property value. * * @param bean The bean. * * @return The property value, or {@code null} if the property or any * nested bean in its path is {@code null}. */
Get bean property value
getValue
{ "repo_name": "boylesoftware/thyme", "path": "src/main/java/com/boylesoftware/web/util/BeanUtils.java", "license": "apache-2.0", "size": 4468 }
[ "java.util.concurrent.ConcurrentHashMap", "java.util.concurrent.ConcurrentMap" ]
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,339,820
public static FurnaceRecipes instance() { return smeltingBase; } private FurnaceRecipes() { this.addSmeltingRecipeForBlock(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F); this.addSmeltingRecipeForBlock(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F); this.addSmeltingRecipeForBlock(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F); this.addSmeltingRecipeForBlock(Blocks.sand, new ItemStack(Blocks.glass), 0.1F); this.addSmelting(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F); this.addSmelting(Items.beef, new ItemStack(Items.cooked_beef), 0.35F); this.addSmelting(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F); this.addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F); this.addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F); this.addSmeltingRecipeForBlock(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F); this.addSmeltingRecipe(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.DEFAULT_META), new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CRACKED_META), 0.1F); this.addSmelting(Items.clay_ball, new ItemStack(Items.brick), 0.3F); this.addSmeltingRecipeForBlock(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F); this.addSmeltingRecipeForBlock(Blocks.cactus, new ItemStack(Items.dye, 1, EnumDyeColor.GREEN.getDyeDamage()), 0.2F); this.addSmeltingRecipeForBlock(Blocks.log, new ItemStack(Items.coal, 1, 1), 0.15F); this.addSmeltingRecipeForBlock(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F); this.addSmeltingRecipeForBlock(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F); this.addSmelting(Items.potato, new ItemStack(Items.baked_potato), 0.35F); this.addSmeltingRecipeForBlock(Blocks.netherrack, new ItemStack(Items.netherbrick), 0.1F); this.addSmeltingRecipe(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F); ItemFishFood.FishType[] afishtype = ItemFishFood.FishType.values(); int i = afishtype.length; for (int j = 0; j < i; ++j) { ItemFishFood.FishType fishtype = afishtype[j]; if (fishtype.canCook()) { this.addSmeltingRecipe(new ItemStack(Items.fish, 1, fishtype.getMetadata()), new ItemStack(Items.cooked_fish, 1, fishtype.getMetadata()), 0.35F); } } this.addSmeltingRecipeForBlock(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F); this.addSmeltingRecipeForBlock(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F); this.addSmeltingRecipeForBlock(Blocks.lapis_ore, new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), 0.2F); this.addSmeltingRecipeForBlock(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F); }
static FurnaceRecipes function() { return smeltingBase; } private FurnaceRecipes() { this.addSmeltingRecipeForBlock(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F); this.addSmeltingRecipeForBlock(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F); this.addSmeltingRecipeForBlock(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F); this.addSmeltingRecipeForBlock(Blocks.sand, new ItemStack(Blocks.glass), 0.1F); this.addSmelting(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F); this.addSmelting(Items.beef, new ItemStack(Items.cooked_beef), 0.35F); this.addSmelting(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F); this.addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F); this.addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F); this.addSmeltingRecipeForBlock(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F); this.addSmeltingRecipe(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.DEFAULT_META), new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CRACKED_META), 0.1F); this.addSmelting(Items.clay_ball, new ItemStack(Items.brick), 0.3F); this.addSmeltingRecipeForBlock(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F); this.addSmeltingRecipeForBlock(Blocks.cactus, new ItemStack(Items.dye, 1, EnumDyeColor.GREEN.getDyeDamage()), 0.2F); this.addSmeltingRecipeForBlock(Blocks.log, new ItemStack(Items.coal, 1, 1), 0.15F); this.addSmeltingRecipeForBlock(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F); this.addSmeltingRecipeForBlock(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F); this.addSmelting(Items.potato, new ItemStack(Items.baked_potato), 0.35F); this.addSmeltingRecipeForBlock(Blocks.netherrack, new ItemStack(Items.netherbrick), 0.1F); this.addSmeltingRecipe(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F); ItemFishFood.FishType[] afishtype = ItemFishFood.FishType.values(); int i = afishtype.length; for (int j = 0; j < i; ++j) { ItemFishFood.FishType fishtype = afishtype[j]; if (fishtype.canCook()) { this.addSmeltingRecipe(new ItemStack(Items.fish, 1, fishtype.getMetadata()), new ItemStack(Items.cooked_fish, 1, fishtype.getMetadata()), 0.35F); } } this.addSmeltingRecipeForBlock(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F); this.addSmeltingRecipeForBlock(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F); this.addSmeltingRecipeForBlock(Blocks.lapis_ore, new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), 0.2F); this.addSmeltingRecipeForBlock(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F); }
/** * Returns an instance of FurnaceRecipes. */
Returns an instance of FurnaceRecipes
instance
{ "repo_name": "kelthalorn/ConquestCraft", "path": "build/tmp/recompSrc/net/minecraft/item/crafting/FurnaceRecipes.java", "license": "lgpl-2.1", "size": 6846 }
[ "net.minecraft.block.BlockStoneBrick", "net.minecraft.init.Blocks", "net.minecraft.init.Items", "net.minecraft.item.EnumDyeColor", "net.minecraft.item.ItemFishFood", "net.minecraft.item.ItemStack" ]
import net.minecraft.block.BlockStoneBrick; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemFishFood; import net.minecraft.item.ItemStack;
import net.minecraft.block.*; import net.minecraft.init.*; import net.minecraft.item.*;
[ "net.minecraft.block", "net.minecraft.init", "net.minecraft.item" ]
net.minecraft.block; net.minecraft.init; net.minecraft.item;
2,534,231
@Override public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException exception) throws IOException, ServletException { onAuthenticationFailure(request, response, exception); } //////////////////////////////////////////////////////////////////////////////////////// // authentication responses ////////////////////////////////////////////////////////////////////////////////////////
void function(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException exception) throws IOException, ServletException { onAuthenticationFailure(request, response, exception); }
/** * {@inheritDoc} Aborts a request in case it is not authenticated. It don't sends the www-authenticate header though as this would show a login box in the * browser.. */
Aborts a request in case it is not authenticated. It don't sends the www-authenticate header though as this would show a login box in the browser.
commence
{ "repo_name": "mojo2012/spot-framework", "path": "spot-spring-web-support/src/main/java/io/spotnext/spring/web/security/RestAuthenticationHandler.java", "license": "apache-2.0", "size": 6754 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.springframework.security.core.AuthenticationException" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.core.AuthenticationException;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.springframework.security.core.*;
[ "java.io", "javax.servlet", "org.springframework.security" ]
java.io; javax.servlet; org.springframework.security;
1,763,591
public static void main(String[] s) { JFrame frame = new JFrame("JDateChooser"); JDateChooser dateChooser = new JDateChooser(); // JDateChooser dateChooser = new JDateChooser(null, new Date(), null, // null); // dateChooser.setLocale(new Locale("de")); // dateChooser.setDateFormatString("dd. MMMM yyyy"); // dateChooser.setPreferredSize(new Dimension(130, 20)); // dateChooser.setFont(new Font("Verdana", Font.PLAIN, 10)); // dateChooser.setDateFormatString("yyyy-MM-dd HH:mm"); // URL iconURL = dateChooser.getClass().getResource( // "/com/toedter/calendar/images/JMonthChooserColor32.gif"); // ImageIcon icon = new ImageIcon(iconURL); // dateChooser.setIcon(icon); frame.getContentPane().add(dateChooser); frame.pack(); frame.setVisible(true); dateChooser.requestFocusInWindow(); }
static void function(String[] s) { JFrame frame = new JFrame(STR); JDateChooser dateChooser = new JDateChooser(); frame.getContentPane().add(dateChooser); frame.pack(); frame.setVisible(true); dateChooser.requestFocusInWindow(); }
/** * Creates a JFrame with a JDateChooser inside and can be used for testing. * * @param s * The command line arguments */
Creates a JFrame with a JDateChooser inside and can be used for testing
main
{ "repo_name": "empeeoh/JCalendar", "path": "src/com/toedter/calendar/JDateChooser.java", "license": "lgpl-2.1", "size": 16642 }
[ "javax.swing.JFrame" ]
import javax.swing.JFrame;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
1,754,899
public static String digestToHex(String algorithm, String msg) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest digest = MessageDigest.getInstance(algorithm); byte[] digestMessage = digest.digest(msg.getBytes("UTF-8")); return Fn.bytesToHex(digestMessage); }
static String function(String algorithm, String msg) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest digest = MessageDigest.getInstance(algorithm); byte[] digestMessage = digest.digest(msg.getBytes("UTF-8")); return Fn.bytesToHex(digestMessage); }
/** * Devuelve una firma dependiendo del algoritmo solicitado en formato String hexadecimal * @param algorithm md5, sha1, sha256, sha384, sha512 * @param msg mensaje * @return firma en formato String hexadecimal * @throws NoSuchAlgorithmException * @throws UnsupportedEncodingException */
Devuelve una firma dependiendo del algoritmo solicitado en formato String hexadecimal
digestToHex
{ "repo_name": "jencisopy/JavaBeanStack", "path": "commons/src/main/java/org/javabeanstack/crypto/DigestUtil.java", "license": "lgpl-3.0", "size": 11798 }
[ "java.io.UnsupportedEncodingException", "java.security.MessageDigest", "java.security.NoSuchAlgorithmException", "org.javabeanstack.util.Fn" ]
import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.javabeanstack.util.Fn;
import java.io.*; import java.security.*; import org.javabeanstack.util.*;
[ "java.io", "java.security", "org.javabeanstack.util" ]
java.io; java.security; org.javabeanstack.util;
1,035,246
@Override public void deleteTurnsHistory(TurnsHistory turnsHistory) { getSessionFactory().getCurrentSession().delete(turnsHistory); }
void function(TurnsHistory turnsHistory) { getSessionFactory().getCurrentSession().delete(turnsHistory); }
/** * Delete TurnsHistory * * @param TurnsHistory * turnsHistory */
Delete TurnsHistory
deleteTurnsHistory
{ "repo_name": "machadolucas/watchout", "path": "src/main/java/com/riskvis/db/dao/impl/TurnsHistoryDAO.java", "license": "apache-2.0", "size": 3139 }
[ "com.riskvis.entity.TurnsHistory" ]
import com.riskvis.entity.TurnsHistory;
import com.riskvis.entity.*;
[ "com.riskvis.entity" ]
com.riskvis.entity;
1,009,052
public final void smoothScrollBy(int dx, int dy) { if (getChildCount() == 0) { // Nothing to do. return; } long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll; if (duration > ANIMATED_SCROLL_GAP) { final int width = getWidth() - mPaddingRight - mPaddingLeft; final int right = getChildAt(0).getWidth(); final int maxX = Math.max(0, right - width); final int scrollX = mScrollX; dx = Math.max(0, Math.min(scrollX + dx, maxX)) - scrollX; mScroller.startScroll(scrollX, mScrollY, dx, 0); postInvalidateOnAnimation(); } else { if (!mScroller.isFinished()) { mScroller.abortAnimation(); } scrollBy(dx, dy); } mLastScroll = AnimationUtils.currentAnimationTimeMillis(); }
final void function(int dx, int dy) { if (getChildCount() == 0) { return; } long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll; if (duration > ANIMATED_SCROLL_GAP) { final int width = getWidth() - mPaddingRight - mPaddingLeft; final int right = getChildAt(0).getWidth(); final int maxX = Math.max(0, right - width); final int scrollX = mScrollX; dx = Math.max(0, Math.min(scrollX + dx, maxX)) - scrollX; mScroller.startScroll(scrollX, mScrollY, dx, 0); postInvalidateOnAnimation(); } else { if (!mScroller.isFinished()) { mScroller.abortAnimation(); } scrollBy(dx, dy); } mLastScroll = AnimationUtils.currentAnimationTimeMillis(); }
/** * Like {@link View#scrollBy}, but scroll smoothly instead of immediately. * * @param dx the number of pixels to scroll by on the X axis * @param dy the number of pixels to scroll by on the Y axis */
Like <code>View#scrollBy</code>, but scroll smoothly instead of immediately
smoothScrollBy
{ "repo_name": "JSDemos/android-sdk-20", "path": "src/android/widget/HorizontalScrollView.java", "license": "apache-2.0", "size": 63837 }
[ "android.view.animation.AnimationUtils" ]
import android.view.animation.AnimationUtils;
import android.view.animation.*;
[ "android.view" ]
android.view;
1,391,820
public static SingleLogoutContext createInstance( String profileHandlerURL, InitialLogoutRequestContext initialRequest, Session idpSession) { return new SingleLogoutContext( profileHandlerURL, initialRequest.getPeerEntityId(), initialRequest.getLocalEntityId(), initialRequest.getInboundSAMLMessageId(), initialRequest.getRelayState(), initialRequest.getProfileConfiguration(), idpSession); }
static SingleLogoutContext function( String profileHandlerURL, InitialLogoutRequestContext initialRequest, Session idpSession) { return new SingleLogoutContext( profileHandlerURL, initialRequest.getPeerEntityId(), initialRequest.getLocalEntityId(), initialRequest.getInboundSAMLMessageId(), initialRequest.getRelayState(), initialRequest.getProfileConfiguration(), idpSession); }
/** * Create a new instance of SingleLogoutContext. * * @param profileHandlerURL URL of the SLO profile handler * @param initialRequest initial logout request * @param idpSession IdP session for the principal * @return */
Create a new instance of SingleLogoutContext
createInstance
{ "repo_name": "jagheterfredrik/java-idp", "path": "src/main/java/edu/internet2/middleware/shibboleth/idp/slo/SingleLogoutContext.java", "license": "apache-2.0", "size": 17444 }
[ "edu.internet2.middleware.shibboleth.idp.profile.saml2.SLOProfileHandler", "edu.internet2.middleware.shibboleth.idp.session.Session" ]
import edu.internet2.middleware.shibboleth.idp.profile.saml2.SLOProfileHandler; import edu.internet2.middleware.shibboleth.idp.session.Session;
import edu.internet2.middleware.shibboleth.idp.profile.saml2.*; import edu.internet2.middleware.shibboleth.idp.session.*;
[ "edu.internet2.middleware" ]
edu.internet2.middleware;
2,536,566
protected Size2D arrangeRR(Graphics2D g2, Range widthRange, Range heightRange) { RectangleEdge position = getPosition(); if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) { float maxWidth = (float) widthRange.getUpperBound(); // determine the space required for the axis AxisSpace space = this.axis.reserveSpace(g2, null, new Rectangle2D.Double(0, 0, maxWidth, 100), RectangleEdge.BOTTOM, null); return new Size2D(maxWidth, this.stripWidth + this.axisOffset + space.getTop() + space.getBottom()); } else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) { float maxHeight = (float) heightRange.getUpperBound(); AxisSpace space = this.axis.reserveSpace(g2, null, new Rectangle2D.Double(0, 0, 100, maxHeight), RectangleEdge.RIGHT, null); return new Size2D(this.stripWidth + this.axisOffset + space.getLeft() + space.getRight(), maxHeight); } else { throw new RuntimeException("Unrecognised position."); } }
Size2D function(Graphics2D g2, Range widthRange, Range heightRange) { RectangleEdge position = getPosition(); if (position == RectangleEdge.TOP position == RectangleEdge.BOTTOM) { float maxWidth = (float) widthRange.getUpperBound(); AxisSpace space = this.axis.reserveSpace(g2, null, new Rectangle2D.Double(0, 0, maxWidth, 100), RectangleEdge.BOTTOM, null); return new Size2D(maxWidth, this.stripWidth + this.axisOffset + space.getTop() + space.getBottom()); } else if (position == RectangleEdge.LEFT position == RectangleEdge.RIGHT) { float maxHeight = (float) heightRange.getUpperBound(); AxisSpace space = this.axis.reserveSpace(g2, null, new Rectangle2D.Double(0, 0, 100, maxHeight), RectangleEdge.RIGHT, null); return new Size2D(this.stripWidth + this.axisOffset + space.getLeft() + space.getRight(), maxHeight); } else { throw new RuntimeException(STR); } }
/** * Returns the content size for the title. This will reflect the fact that * a text title positioned on the left or right of a chart will be rotated * 90 degrees. * * @param g2 the graphics device. * @param widthRange the width range. * @param heightRange the height range. * * @return The content size. */
Returns the content size for the title. This will reflect the fact that a text title positioned on the left or right of a chart will be rotated 90 degrees
arrangeRR
{ "repo_name": "Epsilon2/Memetic-Algorithm-for-TSP", "path": "jfreechart-1.0.16/source/org/jfree/chart/title/PaintScaleLegend.java", "license": "mit", "size": 25390 }
[ "java.awt.Graphics2D", "java.awt.geom.Rectangle2D", "org.jfree.chart.axis.AxisSpace", "org.jfree.data.Range", "org.jfree.ui.RectangleEdge", "org.jfree.ui.Size2D" ]
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.axis.AxisSpace; import org.jfree.data.Range; import org.jfree.ui.RectangleEdge; import org.jfree.ui.Size2D;
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.axis.*; import org.jfree.data.*; import org.jfree.ui.*;
[ "java.awt", "org.jfree.chart", "org.jfree.data", "org.jfree.ui" ]
java.awt; org.jfree.chart; org.jfree.data; org.jfree.ui;
2,838,029
public static void checkNeedForCastCast(BlockScope scope, CastExpression enclosingCast) { if (scope.compilerOptions().getSeverity(CompilerOptions.UnnecessaryTypeCheck) == ProblemSeverities.Ignore) return; CastExpression nestedCast = (CastExpression) enclosingCast.expression; if ((nestedCast.bits & ASTNode.UnnecessaryCast) == 0) return; // check if could cast directly to enclosing cast type, without intermediate type cast CastExpression alternateCast = new CastExpression(null, enclosingCast.type); alternateCast.resolvedType = enclosingCast.resolvedType; if (!alternateCast.checkCastTypesCompatibility(scope, enclosingCast.resolvedType, nestedCast.expression.resolvedType, null )) return; scope.problemReporter().unnecessaryCast(nestedCast); }
static void function(BlockScope scope, CastExpression enclosingCast) { if (scope.compilerOptions().getSeverity(CompilerOptions.UnnecessaryTypeCheck) == ProblemSeverities.Ignore) return; CastExpression nestedCast = (CastExpression) enclosingCast.expression; if ((nestedCast.bits & ASTNode.UnnecessaryCast) == 0) return; CastExpression alternateCast = new CastExpression(null, enclosingCast.type); alternateCast.resolvedType = enclosingCast.resolvedType; if (!alternateCast.checkCastTypesCompatibility(scope, enclosingCast.resolvedType, nestedCast.expression.resolvedType, null )) return; scope.problemReporter().unnecessaryCast(nestedCast); }
/** * Complain if cast expression is cast, but not actually needed, int i = (int)(Integer) 12; * Note that this (int) cast is however needed: Integer i = 0; char c = (char)((int) i); */
Complain if cast expression is cast, but not actually needed, int i = (int)(Integer) 12; Note that this (int) cast is however needed: Integer i = 0; char c = (char)((int) i)
checkNeedForCastCast
{ "repo_name": "Niky4000/UsefulUtils", "path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java", "license": "gpl-3.0", "size": 31707 }
[ "org.eclipse.jdt.internal.compiler.impl.CompilerOptions", "org.eclipse.jdt.internal.compiler.lookup.BlockScope", "org.eclipse.jdt.internal.compiler.problem.ProblemSeverities" ]
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.lookup.*; import org.eclipse.jdt.internal.compiler.problem.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
2,797,813
Submission getSubmission(long id) throws PersistenceException;
Submission getSubmission(long id) throws PersistenceException;
/** * <p> * Gets the submission with given id in persistence layer. * </p> * * @param id * the id of the submission * @return the submission with given id in persistence layer * @throws PersistenceException * wrapping a persistence implementation specific exception */
Gets the submission with given id in persistence layer.
getSubmission
{ "repo_name": "lei-cao/zoj", "path": "judge_server/src/main/cn/edu/zju/acm/onlinejudge/persistence/SubmissionPersistence.java", "license": "gpl-3.0", "size": 5462 }
[ "cn.edu.zju.acm.onlinejudge.bean.Submission" ]
import cn.edu.zju.acm.onlinejudge.bean.Submission;
import cn.edu.zju.acm.onlinejudge.bean.*;
[ "cn.edu.zju" ]
cn.edu.zju;
2,082,830
private boolean isOverridingMethod(DetailAST aAST) { if ((aAST.getType() != TokenTypes.METHOD_DEF) || ScopeUtils.inInterfaceOrAnnotationBlock(aAST)) { return false; } final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); final String name = nameAST.getText(); if (!getMethodName().equals(name)) { return false; } final DetailAST params = aAST.findFirstToken(TokenTypes.PARAMETERS); return (params.getChildCount() == 0); }
boolean function(DetailAST aAST) { if ((aAST.getType() != TokenTypes.METHOD_DEF) ScopeUtils.inInterfaceOrAnnotationBlock(aAST)) { return false; } final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); final String name = nameAST.getText(); if (!getMethodName().equals(name)) { return false; } final DetailAST params = aAST.findFirstToken(TokenTypes.PARAMETERS); return (params.getChildCount() == 0); }
/** * Determines whether an AST is a method definition for this check, * with 0 parameters. * @param aAST the method definition AST. * @return true if the method of aAST is a method for this check. */
Determines whether an AST is a method definition for this check, with 0 parameters
isOverridingMethod
{ "repo_name": "pbaranchikov/checkstyle", "path": "src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java", "license": "lgpl-2.1", "size": 7025 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "com.puppycrawl.tools.checkstyle.api.ScopeUtils", "com.puppycrawl.tools.checkstyle.api.TokenTypes" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
1,443,139
@Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return null; }
AxisAlignedBB function(World par1World, int par2, int par3, int par4) { return null; }
/** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */
Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been cleared to be reused)
getCollisionBoundingBoxFromPool
{ "repo_name": "cbaakman/Tropicraft", "path": "src/main/java/net/tropicraft/block/BlockPurchasePlate.java", "license": "mpl-2.0", "size": 7042 }
[ "net.minecraft.util.AxisAlignedBB", "net.minecraft.world.World" ]
import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World;
import net.minecraft.util.*; import net.minecraft.world.*;
[ "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.util; net.minecraft.world;
1,333,623
@XmlAttribute @Metadata(label = "advanced", javaType = "org.apache.camel.ShutdownRunningTask", defaultValue = "CompleteCurrentTaskOnly", enums = "CompleteCurrentTaskOnly,CompleteAllTasks") public void setShutdownRunningTask(String shutdownRunningTask) { this.shutdownRunningTask = shutdownRunningTask; }
@Metadata(label = STR, javaType = STR, defaultValue = STR, enums = STR) void function(String shutdownRunningTask) { this.shutdownRunningTask = shutdownRunningTask; }
/** * To control how to shutdown the route. */
To control how to shutdown the route
setShutdownRunningTask
{ "repo_name": "apache/camel", "path": "core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinition.java", "license": "apache-2.0", "size": 35893 }
[ "org.apache.camel.spi.Metadata" ]
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
2,663,288
public LibrarySet[] getActiveSystemLibrarySets(LinkerDef[] defaultProviders, int index) { if (isReference()) { return getRef().getActiveUserLibrarySets(defaultProviders, index); } Project p = getProject(); Vector<LibrarySet> libsets = new Vector<LibrarySet>(); for (int i = index; i < defaultProviders.length; i++) { defaultProviders[i].addActiveSystemLibrarySets(p, libsets); } addActiveSystemLibrarySets(p, libsets); return libsets.toArray(new LibrarySet[0]); }
LibrarySet[] function(LinkerDef[] defaultProviders, int index) { if (isReference()) { return getRef().getActiveUserLibrarySets(defaultProviders, index); } Project p = getProject(); Vector<LibrarySet> libsets = new Vector<LibrarySet>(); for (int i = index; i < defaultProviders.length; i++) { defaultProviders[i].addActiveSystemLibrarySets(p, libsets); } addActiveSystemLibrarySets(p, libsets); return libsets.toArray(new LibrarySet[0]); }
/** * Returns an array of active library sets for this linker definition. * * @param defaultProviders an array of LinkerDef * @param index int * @return an array of LibrarySet */
Returns an array of active library sets for this linker definition
getActiveSystemLibrarySets
{ "repo_name": "dougm/ant-contrib-cpptasks", "path": "src/main/java/net/sf/antcontrib/cpptasks/LinkerDef.java", "license": "apache-2.0", "size": 15897 }
[ "java.util.Vector", "net.sf.antcontrib.cpptasks.types.LibrarySet", "org.apache.tools.ant.Project" ]
import java.util.Vector; import net.sf.antcontrib.cpptasks.types.LibrarySet; import org.apache.tools.ant.Project;
import java.util.*; import net.sf.antcontrib.cpptasks.types.*; import org.apache.tools.ant.*;
[ "java.util", "net.sf.antcontrib", "org.apache.tools" ]
java.util; net.sf.antcontrib; org.apache.tools;
2,627,663
HttpPipeline getHttpPipeline();
HttpPipeline getHttpPipeline();
/** * Gets The HTTP pipeline to send requests through. * * @return the httpPipeline value. */
Gets The HTTP pipeline to send requests through
getHttpPipeline
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/fluent/CognitiveServicesManagementClient.java", "license": "mit", "size": 3026 }
[ "com.azure.core.http.HttpPipeline" ]
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.*;
[ "com.azure.core" ]
com.azure.core;
1,930,787
public int readEnum() throws IOException { return readRawVarint32(); }
int function() throws IOException { return readRawVarint32(); }
/** * Read an enum field value from the stream. Caller is responsible for converting the numeric value to an actual * enum. */
Read an enum field value from the stream. Caller is responsible for converting the numeric value to an actual enum
readEnum
{ "repo_name": "sschepens/pulsar", "path": "pulsar-common/src/main/java/org/apache/pulsar/common/util/protobuf/ByteBufCodedInputStream.java", "license": "apache-2.0", "size": 13215 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,660,363
@Override public void setEditorInfo(EditorInfo attribute) { mozcView.setEmojiEnabled( EmojiUtil.isUnicodeEmojiAvailable(Build.VERSION.SDK_INT), EmojiUtil.isCarrierEmojiAllowed(attribute)); mozcView.setPasswordField(MozcUtil.isPasswordField(attribute)); mozcView.setEditorInfo(attribute); voiceInputAllowed = MozcUtil.isVoiceInputAllowed(attribute); japaneseSoftwareKeyboardModel.setInputType(attribute.inputType); setJapaneseKeyboard( japaneseSoftwareKeyboardModel.getKeyboardSpecification(), Collections.<TouchEvent>emptyList()); }
void function(EditorInfo attribute) { mozcView.setEmojiEnabled( EmojiUtil.isUnicodeEmojiAvailable(Build.VERSION.SDK_INT), EmojiUtil.isCarrierEmojiAllowed(attribute)); mozcView.setPasswordField(MozcUtil.isPasswordField(attribute)); mozcView.setEditorInfo(attribute); voiceInputAllowed = MozcUtil.isVoiceInputAllowed(attribute); japaneseSoftwareKeyboardModel.setInputType(attribute.inputType); setJapaneseKeyboard( japaneseSoftwareKeyboardModel.getKeyboardSpecification(), Collections.<TouchEvent>emptyList()); }
/** * Set {@code EditorInfo} instance to the current view. */
Set EditorInfo instance to the current view
setEditorInfo
{ "repo_name": "kishikawakatsumi/Mozc-for-iOS", "path": "src/android/src/com/google/android/inputmethod/japanese/ViewManager.java", "license": "apache-2.0", "size": 30493 }
[ "android.os.Build", "android.view.inputmethod.EditorInfo", "java.util.Collections", "org.mozc.android.inputmethod.japanese.emoji.EmojiUtil", "org.mozc.android.inputmethod.japanese.protobuf.ProtoCommands" ]
import android.os.Build; import android.view.inputmethod.EditorInfo; import java.util.Collections; import org.mozc.android.inputmethod.japanese.emoji.EmojiUtil; import org.mozc.android.inputmethod.japanese.protobuf.ProtoCommands;
import android.os.*; import android.view.inputmethod.*; import java.util.*; import org.mozc.android.inputmethod.japanese.emoji.*; import org.mozc.android.inputmethod.japanese.protobuf.*;
[ "android.os", "android.view", "java.util", "org.mozc.android" ]
android.os; android.view; java.util; org.mozc.android;
1,276,455
public int read(byte[] b, int off, int len) throws IOException { ensureOpen(); if (off < 0 || len < 0 || off > b.length - len) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } if (entry == null) { return -1; } switch (entry.method) { case DEFLATED: len = super.read(b, off, len); if (len == -1) { readEnd(entry); entryEOF = true; entry = null; } else { crc.update(b, off, len); } return len; case STORED: if (remaining <= 0) { entryEOF = true; entry = null; return -1; } if (len > remaining) { len = (int) remaining; } len = in.read(b, off, len); if (len == -1) { throw new ZipException("unexpected EOF"); } crc.update(b, off, len); remaining -= len; if (remaining == 0 && entry.crc != crc.getValue()) { throw new ZipException("invalid entry CRC (expected 0x" + Long.toHexString(entry.crc) + " but got 0x" + Long.toHexString(crc.getValue()) + ")"); } return len; default: throw new ZipException("invalid compression method"); } }
int function(byte[] b, int off, int len) throws IOException { ensureOpen(); if (off < 0 len < 0 off > b.length - len) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } if (entry == null) { return -1; } switch (entry.method) { case DEFLATED: len = super.read(b, off, len); if (len == -1) { readEnd(entry); entryEOF = true; entry = null; } else { crc.update(b, off, len); } return len; case STORED: if (remaining <= 0) { entryEOF = true; entry = null; return -1; } if (len > remaining) { len = (int) remaining; } len = in.read(b, off, len); if (len == -1) { throw new ZipException(STR); } crc.update(b, off, len); remaining -= len; if (remaining == 0 && entry.crc != crc.getValue()) { throw new ZipException(STR + Long.toHexString(entry.crc) + STR + Long.toHexString(crc.getValue()) + ")"); } return len; default: throw new ZipException(STR); } }
/** * Reads from the current ZIP entry into an array of bytes. If * <code>len</code> is not zero, the method blocks until some input is * available; otherwise, no bytes are read and <code>0</code> is returned. * * @param b * the buffer into which the data is read * @param off * the start offset in the destination array <code>b</code> * @param len * the maximum number of bytes read * @return the actual number of bytes read, or -1 if the end of the entry is * reached * @exception NullPointerException * If <code>b</code> is <code>null</code>. * @exception IndexOutOfBoundsException * If <code>off</code> is negative, <code>len</code> is * negative, or <code>len</code> is greater than * <code>b.length - off</code> * @exception ZipException * if a ZIP file error has occurred * @exception IOException * if an I/O error has occurred */
Reads from the current ZIP entry into an array of bytes. If <code>len</code> is not zero, the method blocks until some input is available; otherwise, no bytes are read and <code>0</code> is returned
read
{ "repo_name": "3203317/ppp", "path": "framework-core2/src/main/java/cn/newcapec/framework/core/utils/zipUtils/CZipInputStream.java", "license": "mit", "size": 13868 }
[ "java.io.IOException", "java.util.zip.ZipException" ]
import java.io.IOException; import java.util.zip.ZipException;
import java.io.*; import java.util.zip.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,272,629
CellScannerPosition seekForwardToOrBefore(Cell key);
CellScannerPosition seekForwardToOrBefore(Cell key);
/** * Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no * exact match. * <p/> * @param key * @return AT if exact match<br/> * AFTER if on first cell after key<br/> * AFTER_LAST if key was after the last cell in this scanner's scope */
Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match.
seekForwardToOrBefore
{ "repo_name": "alipayhuber/hack-hbase", "path": "hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/scanner/CellSearcher.java", "license": "apache-2.0", "size": 4232 }
[ "org.apache.hadoop.hbase.Cell" ]
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,903,131
public void setConformance(String value) throws BadFieldValueException { if (value.equals("A") || value.equals("B") || value.equals("U")) { TextType conf = createTextType(CONFORMANCE, value); addProperty(conf); } else { throw new BadFieldValueException( "The property given not seems to be a PDF/A conformance level (must be A, B or U)"); } }
void function(String value) throws BadFieldValueException { if (value.equals("A") value.equals("B") value.equals("U")) { TextType conf = createTextType(CONFORMANCE, value); addProperty(conf); } else { throw new BadFieldValueException( STR); } }
/** * Set the PDF/A conformance level * * @param value * The conformance level value to set * @throws BadFieldValueException * If Conformance Value not 'A', 'B' or 'U' (PDF/A-2 and PDF/A-3) */
Set the PDF/A conformance level
setConformance
{ "repo_name": "kalaspuffar/pdfbox", "path": "xmpbox/src/main/java/org/apache/xmpbox/schema/PDFAIdentificationSchema.java", "license": "apache-2.0", "size": 8364 }
[ "org.apache.xmpbox.type.BadFieldValueException", "org.apache.xmpbox.type.TextType" ]
import org.apache.xmpbox.type.BadFieldValueException; import org.apache.xmpbox.type.TextType;
import org.apache.xmpbox.type.*;
[ "org.apache.xmpbox" ]
org.apache.xmpbox;
2,826,167
public static Intent pickContactWithPhone() { Intent intent; if (isSupportsContactsV2()) { intent = pickContact(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); } else { // pre Eclair, use old contacts API intent = pickContact(Contacts.Phones.CONTENT_TYPE); } return intent; }
static Intent function() { Intent intent; if (isSupportsContactsV2()) { intent = pickContact(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); } else { intent = pickContact(Contacts.Phones.CONTENT_TYPE); } return intent; }
/** * Pick contact only from contacts with telephone numbers */
Pick contact only from contacts with telephone numbers
pickContactWithPhone
{ "repo_name": "ifunny/android-intents", "path": "library/src/main/java/com/dmitriy/tarasov/android/intents/IntentUtils.java", "license": "apache-2.0", "size": 22465 }
[ "android.content.Intent", "android.provider.Contacts", "android.provider.ContactsContract" ]
import android.content.Intent; import android.provider.Contacts; import android.provider.ContactsContract;
import android.content.*; import android.provider.*;
[ "android.content", "android.provider" ]
android.content; android.provider;
144,188
static Generator getSpanGenerator(final List eT, final int rowLength) { return new Generator() { final List<int[]> l = new LinkedList<int[]>(); List<Object> aET = new LinkedList<Object>(); int y = ((Integer) ((List) eT.get(0)).get(0)).intValue(), x0 = rowLength * this.y;
static Generator getSpanGenerator(final List eT, final int rowLength) { return new Generator() { final List<int[]> l = new LinkedList<int[]>(); List<Object> aET = new LinkedList<Object>(); int y = ((Integer) ((List) eT.get(0)).get(0)).intValue(), x0 = rowLength * this.y;
/** * Creates a generator which iterates through the spans of a given polygon. * A span is a pair of (inclusive) z coordinates which are contained in a * row of the interior of the polygon. A z coordinate is a linearisation of * a pair of x, y coordinates. * * @param eT * edge table to iterate through (is modified) * @return */
Creates a generator which iterates through the spans of a given polygon. A span is a pair of (inclusive) z coordinates which are contained in a row of the interior of the polygon. A z coordinate is a linearisation of a pair of x, y coordinates
getSpanGenerator
{ "repo_name": "benedictpaten/pecan", "path": "bp/pecan/PolygonFillerTest.java", "license": "mit", "size": 97178 }
[ "java.util.LinkedList", "java.util.List" ]
import java.util.LinkedList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
203,708
public Builder setBandwidthMeter(BandwidthMeter bandwidthMeter) { Assertions.checkState(!buildCalled); this.bandwidthMeter = bandwidthMeter; return this; }
Builder function(BandwidthMeter bandwidthMeter) { Assertions.checkState(!buildCalled); this.bandwidthMeter = bandwidthMeter; return this; }
/** * Sets the {@link BandwidthMeter} that will be used by the player. * * @param bandwidthMeter A {@link BandwidthMeter}. * @return This builder. * @throws IllegalStateException If {@link #build()} has already been called. */
Sets the <code>BandwidthMeter</code> that will be used by the player
setBandwidthMeter
{ "repo_name": "superbderrick/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java", "license": "apache-2.0", "size": 60373 }
[ "com.google.android.exoplayer2.upstream.BandwidthMeter", "com.google.android.exoplayer2.util.Assertions" ]
import com.google.android.exoplayer2.upstream.BandwidthMeter; import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.upstream.*; import com.google.android.exoplayer2.util.*;
[ "com.google.android" ]
com.google.android;
33,728
public DataBuffer createDataBuffer() { int size = scanlineStride * height; if (dataBitOffset > 0) size += (dataBitOffset - 1) / elemBits + 1; return Buffers.createBuffer(getDataType(), size); }
DataBuffer function() { int size = scanlineStride * height; if (dataBitOffset > 0) size += (dataBitOffset - 1) / elemBits + 1; return Buffers.createBuffer(getDataType(), size); }
/** * Creates a DataBuffer for holding pixel data in the format and * layout described by this SampleModel. The returned buffer will * consist of one single bank. * * @return A new data buffer. */
Creates a DataBuffer for holding pixel data in the format and layout described by this SampleModel. The returned buffer will consist of one single bank
createDataBuffer
{ "repo_name": "taciano-perez/JamVM-PH", "path": "src/classpath/java/awt/image/MultiPixelPackedSampleModel.java", "license": "gpl-2.0", "size": 19488 }
[ "gnu.java.awt.Buffers" ]
import gnu.java.awt.Buffers;
import gnu.java.awt.*;
[ "gnu.java.awt" ]
gnu.java.awt;
2,063,441
public String getVmdkPath(String path) { if (!StringUtils.isNotBlank(path)) { return null; } final String search = "]"; int startIndex = path.indexOf(search); if (startIndex == -1) { return null; } path = path.substring(startIndex + search.length()); final String search2 = VMDK_EXTENSION; int endIndex = path.indexOf(search2); if (endIndex == -1) { return null; } return path.substring(0, endIndex).trim(); }
String function(String path) { if (!StringUtils.isNotBlank(path)) { return null; } final String search = "]"; int startIndex = path.indexOf(search); if (startIndex == -1) { return null; } path = path.substring(startIndex + search.length()); final String search2 = VMDK_EXTENSION; int endIndex = path.indexOf(search2); if (endIndex == -1) { return null; } return path.substring(0, endIndex).trim(); }
/** * Only call this for managed storage. * Ex. "[-iqn.2010-01.com.solidfire:4nhe.vol-1.27-0] i-2-18-VM/ROOT-18.vmdk" should return "i-2-18-VM/ROOT-18" */
Only call this for managed storage. Ex. "[-iqn.2010-01.com.solidfire:4nhe.vol-1.27-0] i-2-18-VM/ROOT-18.vmdk" should return "i-2-18-VM/ROOT-18"
getVmdkPath
{ "repo_name": "GabrielBrascher/cloudstack", "path": "plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java", "license": "apache-2.0", "size": 379324 }
[ "org.apache.commons.lang.StringUtils" ]
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
2,134,710
@ExceptionHandler(SupportInfoException.class) public ModelAndView handleError(HttpServletRequest req, Exception exception) throws Exception { // Rethrow annotated exceptions or they will be processed here instead. if (AnnotationUtils.findAnnotation(exception.getClass(), ResponseStatus.class) != null) throw exception; logger.error("Request: " + req.getRequestURI() + " raised " + exception); ModelAndView mav = new ModelAndView(); mav.addObject("exception", exception); mav.addObject("url", req.getRequestURL()); mav.addObject("timestamp", new Date().toString()); mav.addObject("status", 500); mav.setViewName("support"); return mav; }
@ExceptionHandler(SupportInfoException.class) ModelAndView function(HttpServletRequest req, Exception exception) throws Exception { if (AnnotationUtils.findAnnotation(exception.getClass(), ResponseStatus.class) != null) throw exception; logger.error(STR + req.getRequestURI() + STR + exception); ModelAndView mav = new ModelAndView(); mav.addObject(STR, exception); mav.addObject("url", req.getRequestURL()); mav.addObject(STR, new Date().toString()); mav.addObject(STR, 500); mav.setViewName(STR); return mav; }
/** * Demonstrates how to take total control - setup a model, add useful * information and return the "support" view name. This method explicitly * creates and returns * * @param req * Current HTTP request. * @param exception * The exception thrown - always {@link SupportInfoException}. * @return The model and view used by the DispatcherServlet to generate * output. * @throws Exception */
Demonstrates how to take total control - setup a model, add useful information and return the "support" view name. This method explicitly creates and returns
handleError
{ "repo_name": "lihongjie/spring-tutorial", "path": "mvc-exceptions/src/main/java/demo1/web/ExceptionHandlingController.java", "license": "apache-2.0", "size": 7937 }
[ "java.util.Date", "javax.servlet.http.HttpServletRequest", "org.springframework.core.annotation.AnnotationUtils", "org.springframework.web.bind.annotation.ExceptionHandler", "org.springframework.web.bind.annotation.ResponseStatus", "org.springframework.web.servlet.ModelAndView" ]
import java.util.Date; import javax.servlet.http.HttpServletRequest; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.ModelAndView;
import java.util.*; import javax.servlet.http.*; import org.springframework.core.annotation.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*;
[ "java.util", "javax.servlet", "org.springframework.core", "org.springframework.web" ]
java.util; javax.servlet; org.springframework.core; org.springframework.web;
2,757,662
public Calendar getRemoteTimestamp() { return copy(remoteTimestamp); }
Calendar function() { return copy(remoteTimestamp); }
/** * Returns the cache last modified timestamp which have been actually built. * @return the remote timestamp, {@code null} if not defined */
Returns the cache last modified timestamp which have been actually built
getRemoteTimestamp
{ "repo_name": "asakusafw/asakusafw-legacy", "path": "thundergate-project/asakusa-thundergate/src/main/java/com/asakusafw/bulkloader/cache/LocalCacheInfo.java", "license": "apache-2.0", "size": 4023 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
1,221,711
public void zoomToPoint( float scale, PointF imagePoint, PointF viewPoint, @LimitFlag int limitFlags, long durationMs, @Nullable Runnable onAnimationComplete) { FLog.v(TAG, "zoomToPoint: duration %d ms", durationMs); calculateZoomToPointTransform( mNewTransform, scale, imagePoint, viewPoint, limitFlags); setTransform(mNewTransform, durationMs, onAnimationComplete); }
void function( float scale, PointF imagePoint, PointF viewPoint, @LimitFlag int limitFlags, long durationMs, @Nullable Runnable onAnimationComplete) { FLog.v(TAG, STR, durationMs); calculateZoomToPointTransform( mNewTransform, scale, imagePoint, viewPoint, limitFlags); setTransform(mNewTransform, durationMs, onAnimationComplete); }
/** * Zooms to the desired scale and positions the image so that the given image point corresponds * to the given view point. * * <p>If this method is called while an animation or gesture is already in progress, * the current animation or gesture will be stopped first. * * @param scale desired scale, will be limited to {min, max} scale factor * @param imagePoint 2D point in image's relative coordinate system (i.e. 0 <= x, y <= 1) * @param viewPoint 2D point in view's absolute coordinate system * @param limitFlags whether to limit translation and/or scale. * @param durationMs length of animation of the zoom, or 0 if no animation desired * @param onAnimationComplete code to run when the animation completes. Ignored if durationMs=0 */
Zooms to the desired scale and positions the image so that the given image point corresponds to the given view point. If this method is called while an animation or gesture is already in progress, the current animation or gesture will be stopped first
zoomToPoint
{ "repo_name": "mikandi/fresco", "path": "samples/zoomable/src/main/java/com/facebook/samples/zoomable/AnimatedZoomableController.java", "license": "bsd-3-clause", "size": 7970 }
[ "android.graphics.PointF", "com.facebook.common.logging.FLog", "javax.annotation.Nullable" ]
import android.graphics.PointF; import com.facebook.common.logging.FLog; import javax.annotation.Nullable;
import android.graphics.*; import com.facebook.common.logging.*; import javax.annotation.*;
[ "android.graphics", "com.facebook.common", "javax.annotation" ]
android.graphics; com.facebook.common; javax.annotation;
1,579,342
void iterationDone(Model model, int iteration, int epoch); /** * Called once at the start of each epoch, when using methods such as {@link org.deeplearning4j.nn.multilayer.MultiLayerNetwork#fit(DataSetIterator)}, * {@link org.deeplearning4j.nn.graph.ComputationGraph#fit(DataSetIterator)} or {@link org.deeplearning4j.nn.graph.ComputationGraph#fit(MultiDataSetIterator)}
void iterationDone(Model model, int iteration, int epoch); /** * Called once at the start of each epoch, when using methods such as {@link org.deeplearning4j.nn.multilayer.MultiLayerNetwork#fit(DataSetIterator)}, * {@link org.deeplearning4j.nn.graph.ComputationGraph#fit(DataSetIterator)} or {@link org.deeplearning4j.nn.graph.ComputationGraph#fit(MultiDataSetIterator)}
/** * Event listener for each iteration. Called once, after each parameter update has ocurred while training the network * @param iteration the iteration * @param model the model iterating */
Event listener for each iteration. Called once, after each parameter update has ocurred while training the network
iterationDone
{ "repo_name": "deeplearning4j/deeplearning4j", "path": "deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/api/TrainingListener.java", "license": "apache-2.0", "size": 4138 }
[ "org.deeplearning4j.nn.api.Model", "org.nd4j.linalg.dataset.api.iterator.DataSetIterator", "org.nd4j.linalg.dataset.api.iterator.MultiDataSetIterator" ]
import org.deeplearning4j.nn.api.Model; import org.nd4j.linalg.dataset.api.iterator.DataSetIterator; import org.nd4j.linalg.dataset.api.iterator.MultiDataSetIterator;
import org.deeplearning4j.nn.api.*; import org.nd4j.linalg.dataset.api.iterator.*;
[ "org.deeplearning4j.nn", "org.nd4j.linalg" ]
org.deeplearning4j.nn; org.nd4j.linalg;
422,368
public Iterator<StorageAccount> iterator() { return this.getStorageAccounts().iterator(); }
Iterator<StorageAccount> function() { return this.getStorageAccounts().iterator(); }
/** * Gets the sequence of StorageAccounts. * */
Gets the sequence of StorageAccounts
iterator
{ "repo_name": "southworkscom/azure-sdk-for-java", "path": "resource-management/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/models/StorageAccountListResponse.java", "license": "apache-2.0", "size": 2188 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,264,404
@Test public void testSystemExecution() { TypeRegistry registry = getRegistry(); TypeDescriptor<?> stringType = TypeRegistry.stringType(); try { StrategyCallExpression ex; VariableDeclaration varName = new VariableDeclaration("callName", TypeRegistry.stringType()); String varNameValue; if (System.getProperty("os.name").toLowerCase().contains("windows")) { varNameValue = "cmd"; ex = new StrategyCallExpression(varName, new ConstantExpression(stringType, "/c", registry), new ConstantExpression(stringType, "dir", registry), new ConstantExpression(stringType, ".", registry)); } else { varNameValue = "ls"; ex = new StrategyCallExpression(varName, new ConstantExpression(stringType, "-l", registry), new ConstantExpression(stringType, ".", registry)); } TypeDescriptor<?> result = ex.inferType(); Assert.assertTrue("result is not of correct type", result == TypeRegistry.voidType()); BuildlangExecution exec = createExecutionInstance(); exec.getRuntimeEnvironment().switchContext(new Script("test")); exec.getRuntimeEnvironment().addValue(varName, varNameValue); ex.accept(exec); // no result expected but also no exception } catch (VilException e) { Assert.fail("unexpected exception:" + e.getMessage()); } }
void function() { TypeRegistry registry = getRegistry(); TypeDescriptor<?> stringType = TypeRegistry.stringType(); try { StrategyCallExpression ex; VariableDeclaration varName = new VariableDeclaration(STR, TypeRegistry.stringType()); String varNameValue; if (System.getProperty(STR).toLowerCase().contains(STR)) { varNameValue = "cmd"; ex = new StrategyCallExpression(varName, new ConstantExpression(stringType, "/c", registry), new ConstantExpression(stringType, "dir", registry), new ConstantExpression(stringType, ".", registry)); } else { varNameValue = "ls"; ex = new StrategyCallExpression(varName, new ConstantExpression(stringType, "-l", registry), new ConstantExpression(stringType, ".", registry)); } TypeDescriptor<?> result = ex.inferType(); Assert.assertTrue(STR, result == TypeRegistry.voidType()); BuildlangExecution exec = createExecutionInstance(); exec.getRuntimeEnvironment().switchContext(new Script("test")); exec.getRuntimeEnvironment().addValue(varName, varNameValue); ex.accept(exec); } catch (VilException e) { Assert.fail(STR + e.getMessage()); } }
/** * Tests a system exec call. */
Tests a system exec call
testSystemExecution
{ "repo_name": "SSEHUB/EASyProducer", "path": "Plugins/Instantiation/de.uni-hildesheim.sse.easy.instantiatorCore.tests/src/net/ssehub/easy/instantiation/core/model/buildlangModel/StrategyCallExpressionTest.java", "license": "apache-2.0", "size": 4825 }
[ "net.ssehub.easy.instantiation.core.model.common.VilException", "net.ssehub.easy.instantiation.core.model.expressions.ConstantExpression", "net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor", "net.ssehub.easy.instantiation.core.model.vilTypes.TypeRegistry", "org.junit.Assert" ]
import net.ssehub.easy.instantiation.core.model.common.VilException; import net.ssehub.easy.instantiation.core.model.expressions.ConstantExpression; import net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor; import net.ssehub.easy.instantiation.core.model.vilTypes.TypeRegistry; import org.junit.Assert;
import net.ssehub.easy.instantiation.core.model.*; import net.ssehub.easy.instantiation.core.model.common.*; import net.ssehub.easy.instantiation.core.model.expressions.*; import org.junit.*;
[ "net.ssehub.easy", "org.junit" ]
net.ssehub.easy; org.junit;
2,149,908
public static Event createAddInterfaceEvent(String source, String nodeLabel, String ipaddr, String hostName, long txNo) { EventBuilder bldr = new EventBuilder(EventConstants.ADD_INTERFACE_EVENT_UEI, source); bldr.setInterface(addr(ipaddr)); bldr.setHost(hostName); bldr.addParam(EventConstants.PARM_NODE_LABEL, nodeLabel); bldr.addParam(EventConstants.PARM_TRANSACTION_NO, txNo); return bldr.getEvent(); }
static Event function(String source, String nodeLabel, String ipaddr, String hostName, long txNo) { EventBuilder bldr = new EventBuilder(EventConstants.ADD_INTERFACE_EVENT_UEI, source); bldr.setInterface(addr(ipaddr)); bldr.setHost(hostName); bldr.addParam(EventConstants.PARM_NODE_LABEL, nodeLabel); bldr.addParam(EventConstants.PARM_TRANSACTION_NO, txNo); return bldr.getEvent(); }
/** * This method is responsible for generating an addInterface event and * sending it to eventd.. * * @param source * the source of the event * @param nodeLabel * the node label of the node where the interface resides. * @param ipaddr * IP address of the interface to be added. * @param hostName * the Host server name. * @param txNo * the exteranl transaction number * @return a {@link org.opennms.netmgt.xml.event.Event} object. */
This method is responsible for generating an addInterface event and sending it to eventd.
createAddInterfaceEvent
{ "repo_name": "tharindum/opennms_dashboard", "path": "opennms-services/src/main/java/org/opennms/netmgt/capsd/EventUtils.java", "license": "gpl-2.0", "size": 34880 }
[ "org.opennms.netmgt.EventConstants", "org.opennms.netmgt.model.events.EventBuilder", "org.opennms.netmgt.xml.event.Event" ]
import org.opennms.netmgt.EventConstants; import org.opennms.netmgt.model.events.EventBuilder; import org.opennms.netmgt.xml.event.Event;
import org.opennms.netmgt.*; import org.opennms.netmgt.model.events.*; import org.opennms.netmgt.xml.event.*;
[ "org.opennms.netmgt" ]
org.opennms.netmgt;
1,722,110
@Test public void should_handle_subgraph_graphson() { Assumptions.assumeThat(isGraphBinary()).isFalse(); GraphResultSet rs = session() .execute( newInstance( graphTraversalSource() .E() .hasLabel("knows") .subgraph("subGraph") .cap("subGraph"))); List<GraphNode> results = rs.all(); assertThat(results.size()).isEqualTo(1); Graph graph = results.get(0).as(Graph.class); assertThat(graph.edges()).toIterable().hasSize(2); assertThat(graph.vertices()).toIterable().hasSize(3); }
void function() { Assumptions.assumeThat(isGraphBinary()).isFalse(); GraphResultSet rs = session() .execute( newInstance( graphTraversalSource() .E() .hasLabel("knows") .subgraph(STR) .cap(STR))); List<GraphNode> results = rs.all(); assertThat(results.size()).isEqualTo(1); Graph graph = results.get(0).as(Graph.class); assertThat(graph.edges()).toIterable().hasSize(2); assertThat(graph.vertices()).toIterable().hasSize(3); }
/** * Ensures that a traversal that returns a sub graph can be retrieved. * * <p>The subgraph is all members in a knows relationship, thus is all people who marko knows and * the edges that connect them. */
Ensures that a traversal that returns a sub graph can be retrieved. The subgraph is all members in a knows relationship, thus is all people who marko knows and the edges that connect them
should_handle_subgraph_graphson
{ "repo_name": "datastax/java-driver", "path": "integration-tests/src/test/java/com/datastax/dse/driver/api/core/graph/statement/GraphTraversalITBase.java", "license": "apache-2.0", "size": 24135 }
[ "com.datastax.dse.driver.api.core.graph.FluentGraphStatement", "com.datastax.dse.driver.api.core.graph.GraphNode", "com.datastax.dse.driver.api.core.graph.GraphResultSet", "com.datastax.dse.driver.api.core.graph.TinkerGraphAssertions", "java.util.List", "org.apache.tinkerpop.gremlin.structure.Graph", "o...
import com.datastax.dse.driver.api.core.graph.FluentGraphStatement; import com.datastax.dse.driver.api.core.graph.GraphNode; import com.datastax.dse.driver.api.core.graph.GraphResultSet; import com.datastax.dse.driver.api.core.graph.TinkerGraphAssertions; import java.util.List; import org.apache.tinkerpop.gremlin.structure.Graph; import org.assertj.core.api.Assumptions;
import com.datastax.dse.driver.api.core.graph.*; import java.util.*; import org.apache.tinkerpop.gremlin.structure.*; import org.assertj.core.api.*;
[ "com.datastax.dse", "java.util", "org.apache.tinkerpop", "org.assertj.core" ]
com.datastax.dse; java.util; org.apache.tinkerpop; org.assertj.core;
1,935,452
private ReplicaInPipeline append(String bpid, ReplicaInfo replicaInfo, long newGS, long estimateBlockLen) throws IOException { try (AutoCloseableLock lock = datasetLock.acquire()) { // If the block is cached, start uncaching it. if (replicaInfo.getState() != ReplicaState.FINALIZED) { throw new IOException("Only a Finalized replica can be appended to; " + "Replica with blk id " + replicaInfo.getBlockId() + " has state " + replicaInfo.getState()); } // If the block is cached, start uncaching it. cacheManager.uncacheBlock(bpid, replicaInfo.getBlockId()); // If there are any hardlinks to the block, break them. This ensures // we are not appending to a file that is part of a previous/ directory. replicaInfo.breakHardLinksIfNeeded(); FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume(); ReplicaInPipeline rip = v.append(bpid, replicaInfo, newGS, estimateBlockLen); if (rip.getReplicaInfo().getState() != ReplicaState.RBW) { throw new IOException("Append on block " + replicaInfo.getBlockId() + " returned a replica of state " + rip.getReplicaInfo().getState() + "; expected RBW"); } // Replace finalized replica by a RBW replica in replicas map volumeMap.add(bpid, rip.getReplicaInfo()); return rip; } } @SuppressWarnings("serial") private static class MustStopExistingWriter extends Exception { private final ReplicaInPipeline rip; MustStopExistingWriter(ReplicaInPipeline rip) { this.rip = rip; }
ReplicaInPipeline function(String bpid, ReplicaInfo replicaInfo, long newGS, long estimateBlockLen) throws IOException { try (AutoCloseableLock lock = datasetLock.acquire()) { if (replicaInfo.getState() != ReplicaState.FINALIZED) { throw new IOException(STR + STR + replicaInfo.getBlockId() + STR + replicaInfo.getState()); } cacheManager.uncacheBlock(bpid, replicaInfo.getBlockId()); replicaInfo.breakHardLinksIfNeeded(); FsVolumeImpl v = (FsVolumeImpl)replicaInfo.getVolume(); ReplicaInPipeline rip = v.append(bpid, replicaInfo, newGS, estimateBlockLen); if (rip.getReplicaInfo().getState() != ReplicaState.RBW) { throw new IOException(STR + replicaInfo.getBlockId() + STR + rip.getReplicaInfo().getState() + STR); } volumeMap.add(bpid, rip.getReplicaInfo()); return rip; } } @SuppressWarnings(STR) private static class MustStopExistingWriter extends Exception { private final ReplicaInPipeline rip; MustStopExistingWriter(ReplicaInPipeline rip) { this.rip = rip; }
/** Append to a finalized replica * Change a finalized replica to be a RBW replica and * bump its generation stamp to be the newGS * * @param bpid block pool Id * @param replicaInfo a finalized replica * @param newGS new generation stamp * @param estimateBlockLen estimate block length * @return a RBW replica * @throws IOException if moving the replica from finalized directory * to rbw directory fails */
Append to a finalized replica Change a finalized replica to be a RBW replica and bump its generation stamp to be the newGS
append
{ "repo_name": "lukmajercak/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java", "license": "apache-2.0", "size": 125283 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.server.common.HdfsServerConstants", "org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline", "org.apache.hadoop.hdfs.server.datanode.ReplicaInfo", "org.apache.hadoop.util.AutoCloseableLock" ]
import java.io.IOException; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; import org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline; import org.apache.hadoop.hdfs.server.datanode.ReplicaInfo; import org.apache.hadoop.util.AutoCloseableLock;
import java.io.*; import org.apache.hadoop.hdfs.server.common.*; import org.apache.hadoop.hdfs.server.datanode.*; import org.apache.hadoop.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,454,655
public boolean paint( final ViewerState state ) { if ( display.getWidth() <= 0 || display.getHeight() <= 0 ) return false; final boolean resized = checkResize(); // the BufferedImage that is rendered to (to paint to the canvas) final BufferedImage bufferedImage; // the projector that paints to the screenImage. final VolatileProjector p; final boolean clearQueue; final boolean createProjector; synchronized ( this ) { // Rendering may be cancelled unless we are rendering at coarsest // screen scale and coarsest mipmap level. renderingMayBeCancelled = ( requestedScreenScaleIndex < maxScreenScaleIndex ); clearQueue = newFrameRequest; if ( clearQueue ) cache.prepareNextFrame(); createProjector = newFrameRequest || resized || ( requestedScreenScaleIndex != currentScreenScaleIndex ); newFrameRequest = false; if ( createProjector ) { final int renderId = renderIdQueue.peek(); currentScreenScaleIndex = requestedScreenScaleIndex; bufferedImage = bufferedImages[ currentScreenScaleIndex ][ renderId ]; final ARGBScreenImage screenImage = screenImages[ currentScreenScaleIndex ][ renderId ]; synchronized ( state ) { final int numVisibleSources = state.getVisibleSourceIndices().size(); checkRenewRenderImages( numVisibleSources ); checkRenewMaskArrays( numVisibleSources ); p = createProjector( state, currentScreenScaleIndex, screenImage ); } projector = p; } else { bufferedImage = null; p = projector; } requestedScreenScaleIndex = 0; } // try rendering final boolean success = p.map( createProjector ); final long rendertime = p.getLastFrameRenderNanoTime(); synchronized ( this ) { // if rendering was not cancelled... if ( success ) { if ( createProjector ) { final BufferedImage bi = display.setBufferedImageAndTransform( bufferedImage, currentProjectorTransform ); if ( doubleBuffered ) { renderIdQueue.pop(); final Integer id = bufferedImageToRenderId.get( bi ); if ( id != null ) renderIdQueue.add( id ); } if ( currentScreenScaleIndex == maxScreenScaleIndex ) { if ( rendertime > targetRenderNanos && maxScreenScaleIndex < screenScales.length - 1 ) maxScreenScaleIndex++; else if ( rendertime < targetRenderNanos / 3 && maxScreenScaleIndex > 0 ) maxScreenScaleIndex--; } else if ( currentScreenScaleIndex == maxScreenScaleIndex - 1 ) { if ( rendertime < targetRenderNanos && maxScreenScaleIndex > 0 ) maxScreenScaleIndex--; } // System.out.println( String.format( "rendering:%4d ms", rendertime / 1000000 ) ); // System.out.println( "scale = " + currentScreenScaleIndex ); // System.out.println( "maxScreenScaleIndex = " + maxScreenScaleIndex + " (" + screenImages[ maxScreenScaleIndex ][ 0 ].dimension( 0 ) + " x " + screenImages[ maxScreenScaleIndex ][ 0 ].dimension( 1 ) + ")" ); } if ( currentScreenScaleIndex > 0 ) requestRepaint( currentScreenScaleIndex - 1 ); else if ( !p.isValid() ) { try { Thread.sleep( 1 ); } catch ( final InterruptedException e ) {} requestRepaint( currentScreenScaleIndex ); } } } return success; }
boolean function( final ViewerState state ) { if ( display.getWidth() <= 0 display.getHeight() <= 0 ) return false; final boolean resized = checkResize(); final BufferedImage bufferedImage; final VolatileProjector p; final boolean clearQueue; final boolean createProjector; synchronized ( this ) { renderingMayBeCancelled = ( requestedScreenScaleIndex < maxScreenScaleIndex ); clearQueue = newFrameRequest; if ( clearQueue ) cache.prepareNextFrame(); createProjector = newFrameRequest resized ( requestedScreenScaleIndex != currentScreenScaleIndex ); newFrameRequest = false; if ( createProjector ) { final int renderId = renderIdQueue.peek(); currentScreenScaleIndex = requestedScreenScaleIndex; bufferedImage = bufferedImages[ currentScreenScaleIndex ][ renderId ]; final ARGBScreenImage screenImage = screenImages[ currentScreenScaleIndex ][ renderId ]; synchronized ( state ) { final int numVisibleSources = state.getVisibleSourceIndices().size(); checkRenewRenderImages( numVisibleSources ); checkRenewMaskArrays( numVisibleSources ); p = createProjector( state, currentScreenScaleIndex, screenImage ); } projector = p; } else { bufferedImage = null; p = projector; } requestedScreenScaleIndex = 0; } final boolean success = p.map( createProjector ); final long rendertime = p.getLastFrameRenderNanoTime(); synchronized ( this ) { if ( success ) { if ( createProjector ) { final BufferedImage bi = display.setBufferedImageAndTransform( bufferedImage, currentProjectorTransform ); if ( doubleBuffered ) { renderIdQueue.pop(); final Integer id = bufferedImageToRenderId.get( bi ); if ( id != null ) renderIdQueue.add( id ); } if ( currentScreenScaleIndex == maxScreenScaleIndex ) { if ( rendertime > targetRenderNanos && maxScreenScaleIndex < screenScales.length - 1 ) maxScreenScaleIndex++; else if ( rendertime < targetRenderNanos / 3 && maxScreenScaleIndex > 0 ) maxScreenScaleIndex--; } else if ( currentScreenScaleIndex == maxScreenScaleIndex - 1 ) { if ( rendertime < targetRenderNanos && maxScreenScaleIndex > 0 ) maxScreenScaleIndex--; } } if ( currentScreenScaleIndex > 0 ) requestRepaint( currentScreenScaleIndex - 1 ); else if ( !p.isValid() ) { try { Thread.sleep( 1 ); } catch ( final InterruptedException e ) {} requestRepaint( currentScreenScaleIndex ); } } } return success; }
/** * Render image at the {@link #requestedScreenScaleIndex requested screen * scale}. */
Render image at the <code>#requestedScreenScaleIndex requested screen scale</code>
paint
{ "repo_name": "mheyde/bigdataviewer-core", "path": "src/main/java/bdv/viewer/render/MultiResolutionRenderer.java", "license": "gpl-3.0", "size": 28652 }
[ "java.awt.image.BufferedImage", "net.imglib2.display.screenimage.awt.ARGBScreenImage" ]
import java.awt.image.BufferedImage; import net.imglib2.display.screenimage.awt.ARGBScreenImage;
import java.awt.image.*; import net.imglib2.display.screenimage.awt.*;
[ "java.awt", "net.imglib2.display" ]
java.awt; net.imglib2.display;
42,804
@Override public Set<Annotation> getInterceptorBindings() { return _qualifiers; }
Set<Annotation> function() { return _qualifiers; }
/** * Returns the bean's binding types */
Returns the bean's binding types
getInterceptorBindings
{ "repo_name": "dlitz/resin", "path": "modules/kernel/src/com/caucho/config/inject/InterceptorRuntimeBean.java", "license": "gpl-2.0", "size": 11455 }
[ "java.lang.annotation.Annotation", "java.util.Set" ]
import java.lang.annotation.Annotation; import java.util.Set;
import java.lang.annotation.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,218,468
public static XXHashFactory fastestJavaInstance() { if (Utils.isUnalignedAccessAllowed()) { try { return unsafeInstance(); } catch (Throwable t) { return safeInstance(); } } else { return safeInstance(); } }
static XXHashFactory function() { if (Utils.isUnalignedAccessAllowed()) { try { return unsafeInstance(); } catch (Throwable t) { return safeInstance(); } } else { return safeInstance(); } }
/** * Return the fastest available {@link XXHashFactory} instance which does not * rely on JNI bindings. It first tries to load the * {@link #unsafeInstance() unsafe instance}, and then the * {@link #safeInstance() safe Java instance} if the JVM doesn't have a * working {@link sun.misc.Unsafe}. */
Return the fastest available <code>XXHashFactory</code> instance which does not rely on JNI bindings. It first tries to load the <code>#unsafeInstance() unsafe instance</code>, and then the <code>#safeInstance() safe Java instance</code> if the JVM doesn't have a working <code>sun.misc.Unsafe</code>
fastestJavaInstance
{ "repo_name": "pranjalpatil/lz4-java", "path": "src/java/net/jpountz/xxhash/XXHashFactory.java", "license": "apache-2.0", "size": 8196 }
[ "net.jpountz.util.Utils" ]
import net.jpountz.util.Utils;
import net.jpountz.util.*;
[ "net.jpountz.util" ]
net.jpountz.util;
818,895
public List<Map<String, String>> getIPElementByProgramID(int programID);
List<Map<String, String>> function(int programID);
/** * This method return a all the IP elements which belongs to the program * indicated by parameter. * * @param programID, identifier of the program * @return a list of maps with the information of all IP elements returned. */
This method return a all the IP elements which belongs to the program indicated by parameter
getIPElementByProgramID
{ "repo_name": "CCAFS/ccafs-ap", "path": "impactPathways/src/main/java/org/cgiar/ccafs/ap/data/dao/IPElementDAO.java", "license": "gpl-3.0", "size": 6969 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
299,774
public final void removeSource(Object source) { try { Iterator<Class<?>> i = interfaces.keySet().iterator(); while (i.hasNext()) { Object elInterface = i.next(); EventListenerInterfaceData elInterfaceData = interfaces.get(elInterface); boolean present = elInterfaceData.removeSource(source); if (present && elInterfaceData.getSourceSet().isEmpty()) { elInterfaceData.destroy(); i.remove(); } } } catch (Exception exc) { exc.printStackTrace(); } }
final void function(Object source) { try { Iterator<Class<?>> i = interfaces.keySet().iterator(); while (i.hasNext()) { Object elInterface = i.next(); EventListenerInterfaceData elInterfaceData = interfaces.get(elInterface); boolean present = elInterfaceData.removeSource(source); if (present && elInterfaceData.getSourceSet().isEmpty()) { elInterfaceData.destroy(); i.remove(); } } } catch (Exception exc) { exc.printStackTrace(); } }
/** * Remove a event source from all interfaces. * * @param source * the events source */
Remove a event source from all interfaces
removeSource
{ "repo_name": "green-vulcano/gv-engine", "path": "gvengine/gvbase/src/main/java/it/greenvulcano/event/internal/EventListenerData.java", "license": "lgpl-3.0", "size": 11763 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
921,784
public void setUserDN(String newUserDN) { setProperty(new StringProperty(USERDN, newUserDN)); }
void function(String newUserDN) { setProperty(new StringProperty(USERDN, newUserDN)); }
/*************************************************************************** * Sets the username attribute of the LDAP object * * @param newUserDN * distinguished name of the user **************************************************************************/
Sets the username attribute of the LDAP object
setUserDN
{ "repo_name": "ubikfsabbe/jmeter", "path": "src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java", "license": "apache-2.0", "size": 42800 }
[ "org.apache.jmeter.testelement.property.StringProperty" ]
import org.apache.jmeter.testelement.property.StringProperty;
import org.apache.jmeter.testelement.property.*;
[ "org.apache.jmeter" ]
org.apache.jmeter;
2,648,340
@Override public String[] getEntityNames() { if ( sessionFactory == null ) { return ArrayHelper.toStringArray( entityStatistics.keySet() ); } else { return ArrayHelper.toStringArray( sessionFactory.getAllClassMetadata().keySet() ); } }
String[] function() { if ( sessionFactory == null ) { return ArrayHelper.toStringArray( entityStatistics.keySet() ); } else { return ArrayHelper.toStringArray( sessionFactory.getAllClassMetadata().keySet() ); } }
/** * Get the names of all entities */
Get the names of all entities
getEntityNames
{ "repo_name": "1fechner/FeatureExtractor", "path": "sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-core/src/main/java/org/hibernate/stat/internal/ConcurrentStatisticsImpl.java", "license": "lgpl-2.1", "size": 28563 }
[ "org.hibernate.internal.util.collections.ArrayHelper" ]
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.collections.*;
[ "org.hibernate.internal" ]
org.hibernate.internal;
2,381,004
@Test public void testGetRowOffset() throws Exception { byte [] TABLE = Bytes.toBytes("testGetRowOffset"); byte [][] FAMILIES = HTestConst.makeNAscii(FAMILY, 3); byte [][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, 20); HTable ht = TEST_UTIL.createTable(TABLE, FAMILIES); Get get; Put put; Result result; boolean toLog = true; List<KeyValue> kvListExp; // Insert one CF for row kvListExp = new ArrayList<KeyValue>(); put = new Put(ROW); for (int i=0; i < 10; i++) { KeyValue kv = new KeyValue(ROW, FAMILIES[0], QUALIFIERS[i], 1, VALUE); put.add(kv); // skipping first two kvs if (i < 2) continue; kvListExp.add(kv); } ht.put(put); //setting offset to 2 get = new Get(ROW); get.setRowOffsetPerColumnFamily(2); result = ht.get(get); verifyResult(result, kvListExp, toLog, "Testing basic setRowOffset"); //setting offset to 20 get = new Get(ROW); get.setRowOffsetPerColumnFamily(20); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); verifyResult(result, kvListExp, toLog, "Testing offset > #kvs"); //offset + maxResultPerCF get = new Get(ROW); get.setRowOffsetPerColumnFamily(4); get.setMaxResultsPerColumnFamily(5); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); for (int i=4; i < 9; i++) { kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[i], 1, VALUE)); } verifyResult(result, kvListExp, toLog, "Testing offset + setMaxResultsPerCF"); // Filters: ColumnRangeFilter get = new Get(ROW); get.setRowOffsetPerColumnFamily(1); get.setFilter(new ColumnRangeFilter(QUALIFIERS[2], true, QUALIFIERS[5], true)); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[3], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[4], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[5], 1, VALUE)); verifyResult(result, kvListExp, toLog, "Testing offset with CRF"); // Insert into two more CFs for row // 10 columns for CF2, 10 columns for CF1 for(int j=2; j > 0; j--) { put = new Put(ROW); for (int i=0; i < 10; i++) { KeyValue kv = new KeyValue(ROW, FAMILIES[j], QUALIFIERS[i], 1, VALUE); put.add(kv); } ht.put(put); } get = new Get(ROW); get.setRowOffsetPerColumnFamily(4); get.setMaxResultsPerColumnFamily(2); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); //Exp: CF1:q4, q5, CF2: q4, q5 kvListExp.add(new KeyValue(ROW, FAMILIES[1], QUALIFIERS[4], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[1], QUALIFIERS[5], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[2], QUALIFIERS[4], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[2], QUALIFIERS[5], 1, VALUE)); verifyResult(result, kvListExp, toLog, "Testing offset + multiple CFs + maxResults"); }
void function() throws Exception { byte [] TABLE = Bytes.toBytes(STR); byte [][] FAMILIES = HTestConst.makeNAscii(FAMILY, 3); byte [][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, 20); HTable ht = TEST_UTIL.createTable(TABLE, FAMILIES); Get get; Put put; Result result; boolean toLog = true; List<KeyValue> kvListExp; kvListExp = new ArrayList<KeyValue>(); put = new Put(ROW); for (int i=0; i < 10; i++) { KeyValue kv = new KeyValue(ROW, FAMILIES[0], QUALIFIERS[i], 1, VALUE); put.add(kv); if (i < 2) continue; kvListExp.add(kv); } ht.put(put); get = new Get(ROW); get.setRowOffsetPerColumnFamily(2); result = ht.get(get); verifyResult(result, kvListExp, toLog, STR); get = new Get(ROW); get.setRowOffsetPerColumnFamily(20); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); verifyResult(result, kvListExp, toLog, STR); get = new Get(ROW); get.setRowOffsetPerColumnFamily(4); get.setMaxResultsPerColumnFamily(5); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); for (int i=4; i < 9; i++) { kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[i], 1, VALUE)); } verifyResult(result, kvListExp, toLog, STR); get = new Get(ROW); get.setRowOffsetPerColumnFamily(1); get.setFilter(new ColumnRangeFilter(QUALIFIERS[2], true, QUALIFIERS[5], true)); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[3], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[4], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[0], QUALIFIERS[5], 1, VALUE)); verifyResult(result, kvListExp, toLog, STR); for(int j=2; j > 0; j--) { put = new Put(ROW); for (int i=0; i < 10; i++) { KeyValue kv = new KeyValue(ROW, FAMILIES[j], QUALIFIERS[i], 1, VALUE); put.add(kv); } ht.put(put); } get = new Get(ROW); get.setRowOffsetPerColumnFamily(4); get.setMaxResultsPerColumnFamily(2); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); result = ht.get(get); kvListExp = new ArrayList<KeyValue>(); kvListExp.add(new KeyValue(ROW, FAMILIES[1], QUALIFIERS[4], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[1], QUALIFIERS[5], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[2], QUALIFIERS[4], 1, VALUE)); kvListExp.add(new KeyValue(ROW, FAMILIES[2], QUALIFIERS[5], 1, VALUE)); verifyResult(result, kvListExp, toLog, STR); }
/** * Test from client side for get with rowOffset * * @throws Exception */
Test from client side for get with rowOffset
testGetRowOffset
{ "repo_name": "daidong/DominoHBase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java", "license": "apache-2.0", "size": 14812 }
[ "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hbase.HTestConst", "org.apache.hadoop.hbase.KeyValue", "org.apache.hadoop.hbase.filter.ColumnRangeFilter", "org.apache.hadoop.hbase.util.Bytes" ]
import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hbase.HTestConst; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.filter.ColumnRangeFilter; import org.apache.hadoop.hbase.util.Bytes;
import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.filter.*; import org.apache.hadoop.hbase.util.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,440,749
@Override public void copyTo(OutputStream stream) throws IOException { stream.write(array(), arrayOffset(), this.length); }
void function(OutputStream stream) throws IOException { stream.write(array(), arrayOffset(), this.length); }
/** * Writes the entire contents of this ByteArraySegment to the given OutputStream. Only copies the contents of the * ByteArraySegment, and writes no other data (such as the length of the Segment or any other info). * * @param stream The OutputStream to write to. * @throws IOException If the OutputStream threw one. */
Writes the entire contents of this ByteArraySegment to the given OutputStream. Only copies the contents of the ByteArraySegment, and writes no other data (such as the length of the Segment or any other info)
copyTo
{ "repo_name": "pravega/pravega", "path": "common/src/main/java/io/pravega/common/util/ByteArraySegment.java", "license": "apache-2.0", "size": 11296 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
872,788
public static java.sql.Date dateFromTimestamp(java.sql.Timestamp timestamp) { return sqlDateFromUtilDate(timestamp); }
static java.sql.Date function(java.sql.Timestamp timestamp) { return sqlDateFromUtilDate(timestamp); }
/** * Answer a Date from a timestamp * * This implementation is based on the java.sql.Date class, not java.util.Date. * @param timestampObject - timestamp representation of date * @return - date representation of timestampObject */
Answer a Date from a timestamp This implementation is based on the java.sql.Date class, not java.util.Date
dateFromTimestamp
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/helper/Helper.java", "license": "epl-1.0", "size": 92748 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,286,224
final void deliverNewIntentLocked(int callingUid, Intent intent) { boolean sent = false; // We want to immediately deliver the intent to the activity if // it is currently the top resumed activity... however, if the // device is sleeping, then all activities are stopped, so in that // case we will deliver it if this is the current top activity on its // stack. if ((state == ActivityState.RESUMED || (service.mSleeping && stack.topRunningActivityLocked(null) == this)) && app != null && app.thread != null) { try { ArrayList<Intent> ar = new ArrayList<Intent>(); intent = new Intent(intent); ar.add(intent); service.grantUriPermissionFromIntentLocked(callingUid, packageName, intent, getUriPermissionsLocked()); app.thread.scheduleNewIntent(ar, appToken); sent = true; } catch (RemoteException e) { Slog.w(ActivityManagerService.TAG, "Exception thrown sending new intent to " + this, e); } catch (NullPointerException e) { Slog.w(ActivityManagerService.TAG, "Exception thrown sending new intent to " + this, e); } } if (!sent) { addNewIntentLocked(new Intent(intent)); } }
final void deliverNewIntentLocked(int callingUid, Intent intent) { boolean sent = false; if ((state == ActivityState.RESUMED (service.mSleeping && stack.topRunningActivityLocked(null) == this)) && app != null && app.thread != null) { try { ArrayList<Intent> ar = new ArrayList<Intent>(); intent = new Intent(intent); ar.add(intent); service.grantUriPermissionFromIntentLocked(callingUid, packageName, intent, getUriPermissionsLocked()); app.thread.scheduleNewIntent(ar, appToken); sent = true; } catch (RemoteException e) { Slog.w(ActivityManagerService.TAG, STR + this, e); } catch (NullPointerException e) { Slog.w(ActivityManagerService.TAG, STR + this, e); } } if (!sent) { addNewIntentLocked(new Intent(intent)); } }
/** * Deliver a new Intent to an existing activity, so that its onNewIntent() * method will be called at the proper time. */
Deliver a new Intent to an existing activity, so that its onNewIntent() method will be called at the proper time
deliverNewIntentLocked
{ "repo_name": "rex-xxx/mt6572_x201", "path": "frameworks/base/services/java/com/android/server/am/ActivityRecord.java", "license": "gpl-2.0", "size": 46128 }
[ "android.content.Intent", "android.os.RemoteException", "android.util.Slog", "com.android.server.am.ActivityStack", "java.util.ArrayList" ]
import android.content.Intent; import android.os.RemoteException; import android.util.Slog; import com.android.server.am.ActivityStack; import java.util.ArrayList;
import android.content.*; import android.os.*; import android.util.*; import com.android.server.am.*; import java.util.*;
[ "android.content", "android.os", "android.util", "com.android.server", "java.util" ]
android.content; android.os; android.util; com.android.server; java.util;
1,681,987
@Override public void exitBool(@NotNull QL4Parser.BoolContext ctx) { }
@Override public void exitBool(@NotNull QL4Parser.BoolContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterBool
{ "repo_name": "software-engineering-amsterdam/poly-ql", "path": "skatt/QL/gen/QL4/QL4BaseListener.java", "license": "apache-2.0", "size": 10344 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,696,669
@Override protected void updateVariantGenList(ProgramVariant variant, ModificationInstance operation) { operation.getOperationApplied().updateProgramVariant(operation, variant); }
void function(ProgramVariant variant, ModificationInstance operation) { operation.getOperationApplied().updateProgramVariant(operation, variant); }
/** * This method updates modification point of a variant according to a created * GenOperationInstance * * @param variant * variant to modify the modification point information * @param operationofGen * operator to apply in the variant. */
This method updates modification point of a variant according to a created GenOperationInstance
updateVariantGenList
{ "repo_name": "justinwm/astor", "path": "src/main/java/fr/inria/astor/approaches/jgenprog/JGenProg.java", "license": "gpl-2.0", "size": 11887 }
[ "fr.inria.astor.core.entities.ModificationInstance", "fr.inria.astor.core.entities.ProgramVariant" ]
import fr.inria.astor.core.entities.ModificationInstance; import fr.inria.astor.core.entities.ProgramVariant;
import fr.inria.astor.core.entities.*;
[ "fr.inria.astor" ]
fr.inria.astor;
966,949
SwingWorkerRegistry getLoadingRegistry(); WabitSwingSession createServerSession(SPServerInfo serverInfo);
SwingWorkerRegistry getLoadingRegistry(); WabitSwingSession createServerSession(SPServerInfo serverInfo);
/** * Creates a new server-based session for the given server. The new session * will belong to this context. */
Creates a new server-based session for the given server. The new session will belong to this context
createServerSession
{ "repo_name": "iyerdude/wabit", "path": "src/main/java/ca/sqlpower/wabit/swingui/WabitSwingSessionContext.java", "license": "gpl-3.0", "size": 3755 }
[ "ca.sqlpower.enterprise.client.SPServerInfo", "ca.sqlpower.swingui.SwingWorkerRegistry" ]
import ca.sqlpower.enterprise.client.SPServerInfo; import ca.sqlpower.swingui.SwingWorkerRegistry;
import ca.sqlpower.enterprise.client.*; import ca.sqlpower.swingui.*;
[ "ca.sqlpower.enterprise", "ca.sqlpower.swingui" ]
ca.sqlpower.enterprise; ca.sqlpower.swingui;
1,835,924
protected void addAddressFieldsValues() { if (this.currentdata.getAddressList() != null && this.currentdata.getAddressList().getAddress() != null && this.currentdata.getAddressList().getAddress().size() > 0) { this.addresses = this.currentdata.getAddressList().getAddress().toArray( new Address[this.currentdata.getAddressList().getAddress().size()]); if (this.addresses != null) { SystemDictionary.webguiLog("DEBUG", "Addresses LENGTH: " + this.addresses.length); for (int i = 0; i < this.addresses.length; i++) { if (this.addresses[i] != null) { this.insertAddressRow(this.addresses[i]); } } } } }
void function() { if (this.currentdata.getAddressList() != null && this.currentdata.getAddressList().getAddress() != null && this.currentdata.getAddressList().getAddress().size() > 0) { this.addresses = this.currentdata.getAddressList().getAddress().toArray( new Address[this.currentdata.getAddressList().getAddress().size()]); if (this.addresses != null) { SystemDictionary.webguiLog("DEBUG", STR + this.addresses.length); for (int i = 0; i < this.addresses.length; i++) { if (this.addresses[i] != null) { this.insertAddressRow(this.addresses[i]); } } } } }
/** * This method adds all the addresses related with one profile on the main * grid. They are not in a form way, they are being processed to show them * in a plain text way */
This method adds all the addresses related with one profile on the main grid. They are not in a form way, they are being processed to show them in a plain text way
addAddressFieldsValues
{ "repo_name": "SeaCloudsEU/SoftCare-Case-Study", "path": "softcare-gui/src/eu/ehealth/controllers/AladdinFormControllerWindow.java", "license": "apache-2.0", "size": 39568 }
[ "eu.ehealth.SystemDictionary", "eu.ehealth.ws_client.xsd.Address" ]
import eu.ehealth.SystemDictionary; import eu.ehealth.ws_client.xsd.Address;
import eu.ehealth.*; import eu.ehealth.ws_client.xsd.*;
[ "eu.ehealth", "eu.ehealth.ws_client" ]
eu.ehealth; eu.ehealth.ws_client;
2,686,575
@Test public void testSetGetClientHost() { Assert.assertNull(this.job.getClientHost()); final String clientHost = "http://localhost:7001"; this.job.setClientHost(clientHost); Assert.assertEquals(clientHost, this.job.getClientHost()); }
void function() { Assert.assertNull(this.job.getClientHost()); final String clientHost = "http: this.job.setClientHost(clientHost); Assert.assertEquals(clientHost, this.job.getClientHost()); }
/** * Test the setter and getter for the client host. */
Test the setter and getter for the client host
testSetGetClientHost
{ "repo_name": "chen0031/genie", "path": "genie-common/src/test/java/com/netflix/genie/common/model/TestJob.java", "license": "apache-2.0", "size": 32284 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
220,893
public static void createKey(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { int [] ret; if (hkey == HKEY_LOCAL_MACHINE) { ret = createKey(systemRoot, hkey, key); regCloseKey.invoke(systemRoot, new Object[] { new Integer(ret[0]) }); } else if (hkey == HKEY_CURRENT_USER) { ret = createKey(userRoot, hkey, key); regCloseKey.invoke(userRoot, new Object[] { new Integer(ret[0]) }); } else { throw new IllegalArgumentException("hkey=" + hkey); } if (ret[1] != REG_SUCCESS) { throw new IllegalArgumentException("rc=" + ret[1] + " key=" + key); } }
static void function(int hkey, String key) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { int [] ret; if (hkey == HKEY_LOCAL_MACHINE) { ret = createKey(systemRoot, hkey, key); regCloseKey.invoke(systemRoot, new Object[] { new Integer(ret[0]) }); } else if (hkey == HKEY_CURRENT_USER) { ret = createKey(userRoot, hkey, key); regCloseKey.invoke(userRoot, new Object[] { new Integer(ret[0]) }); } else { throw new IllegalArgumentException("hkey=" + hkey); } if (ret[1] != REG_SUCCESS) { throw new IllegalArgumentException("rc=" + ret[1] + STR + key); } }
/** * Create a key * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */
Create a key
createKey
{ "repo_name": "dbuxo/CommandHelper", "path": "src/main/java/com/laytonsmith/PureUtilities/Common/WinRegistry.java", "license": "mit", "size": 13542 }
[ "java.lang.reflect.InvocationTargetException" ]
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,649,823
public static URL searchMovieByIdUrl(IMDbSearchByIdParameters pars) throws MalformedURLException { return new URL(IMDbConstants.BASE_URL + pair(IMDbConstants.ID, pars.getMovieID()) + param(pair(IMDbConstants.PLOT, pars.getPlot().getValue())) + param(pair(IMDbConstants.EPISODE, (pars.isEpisode()) ? "1" : "0")) + param(pair(IMDbConstants.AKA, pars.getAka().getValue())) + param(pair(IMDbConstants.RELEASE, pars.getRelease().getValue()))); } //endregion //region Search by title
static URL function(IMDbSearchByIdParameters pars) throws MalformedURLException { return new URL(IMDbConstants.BASE_URL + pair(IMDbConstants.ID, pars.getMovieID()) + param(pair(IMDbConstants.PLOT, pars.getPlot().getValue())) + param(pair(IMDbConstants.EPISODE, (pars.isEpisode()) ? "1" : "0")) + param(pair(IMDbConstants.AKA, pars.getAka().getValue())) + param(pair(IMDbConstants.RELEASE, pars.getRelease().getValue()))); }
/** * Returns the URL that searches for movie by id. * * @param pars The list of parameters * @return The query URL * @throws MalformedURLException Throws if the URL has an invalid form */
Returns the URL that searches for movie by id
searchMovieByIdUrl
{ "repo_name": "makgyver/MKimdb", "path": "src/mk/imdb/core/IMDbURLCreator.java", "license": "gpl-3.0", "size": 3505 }
[ "java.net.MalformedURLException" ]
import java.net.MalformedURLException;
import java.net.*;
[ "java.net" ]
java.net;
868,192
String getAttributeText(QName attrName);
String getAttributeText(QName attrName);
/** * When at a START or STARTDOC, returns the attribute text for the given * attribute. When not at a START or STARTDOC or the attribute does not * exist, returns null. * * @param attrName The name of the attribute whose value is requested. * @return The attribute's value if it has one; otherwise, null. */
When at a START or STARTDOC, returns the attribute text for the given attribute. When not at a START or STARTDOC or the attribute does not exist, returns null
getAttributeText
{ "repo_name": "apache/xmlbeans", "path": "src/main/java/org/apache/xmlbeans/XmlCursor.java", "license": "apache-2.0", "size": 71317 }
[ "javax.xml.namespace.QName" ]
import javax.xml.namespace.QName;
import javax.xml.namespace.*;
[ "javax.xml" ]
javax.xml;
2,217,654
public void initializeNamespaces(List namespaceResolvers) { if (!isDataType()) { NamespaceResolver nr = new NamespaceResolver(); // copy namespaces between resolvers for well known and SDO namespaces if (namespaceResolvers != null) { for (int i = 0; i < namespaceResolvers.size(); i++) { NamespaceResolver nextNR = (NamespaceResolver)namespaceResolvers.get(i); if (nextNR != null) { for (int j = 0, size = nextNR.getNamespaces().size(); j < size; j++) { Namespace nextNamespace = (Namespace)nextNR.getNamespaces().get(j); if ((!nextNamespace.getPrefix().equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)) && (!nextNamespace.getNamespaceURI().equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOJAVA_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOXML_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDO_URL))) { String newPrefix = ((SDOTypeHelper)aHelperContext.getTypeHelper()).addNamespace(nextNamespace.getPrefix(), nextNamespace.getNamespaceURI()); nr.put(newPrefix, nextNamespace.getNamespaceURI()); } } } } } xmlDescriptor.setNamespaceResolver(nr); if (getURI() != null) { String prefix = ((SDOTypeHelper)aHelperContext.getTypeHelper()).getPrefix(getURI()); xmlDescriptor.getNamespaceResolver().put(prefix, getURI()); } xmlDescriptor.getNamespaceResolver().put(XMLConstants.SCHEMA_INSTANCE_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); } }
void function(List namespaceResolvers) { if (!isDataType()) { NamespaceResolver nr = new NamespaceResolver(); if (namespaceResolvers != null) { for (int i = 0; i < namespaceResolvers.size(); i++) { NamespaceResolver nextNR = (NamespaceResolver)namespaceResolvers.get(i); if (nextNR != null) { for (int j = 0, size = nextNR.getNamespaces().size(); j < size; j++) { Namespace nextNamespace = (Namespace)nextNR.getNamespaces().get(j); if ((!nextNamespace.getPrefix().equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)) && (!nextNamespace.getNamespaceURI().equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOJAVA_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOXML_URL)) && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDO_URL))) { String newPrefix = ((SDOTypeHelper)aHelperContext.getTypeHelper()).addNamespace(nextNamespace.getPrefix(), nextNamespace.getNamespaceURI()); nr.put(newPrefix, nextNamespace.getNamespaceURI()); } } } } } xmlDescriptor.setNamespaceResolver(nr); if (getURI() != null) { String prefix = ((SDOTypeHelper)aHelperContext.getTypeHelper()).getPrefix(getURI()); xmlDescriptor.getNamespaceResolver().put(prefix, getURI()); } xmlDescriptor.getNamespaceResolver().put(XMLConstants.SCHEMA_INSTANCE_PREFIX, javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); } }
/** * INTERNAL: * Get the XMLDescriptor associated with this Type or generate a new one. */
Get the XMLDescriptor associated with this Type or generate a new one
initializeNamespaces
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "sdo/org.eclipse.persistence.sdo/src/org/eclipse/persistence/sdo/SDOType.java", "license": "epl-1.0", "size": 43448 }
[ "java.util.List", "org.eclipse.persistence.internal.oxm.Namespace", "org.eclipse.persistence.oxm.NamespaceResolver", "org.eclipse.persistence.oxm.XMLConstants", "org.eclipse.persistence.sdo.helper.SDOTypeHelper" ]
import java.util.List; import org.eclipse.persistence.internal.oxm.Namespace; import org.eclipse.persistence.oxm.NamespaceResolver; import org.eclipse.persistence.oxm.XMLConstants; import org.eclipse.persistence.sdo.helper.SDOTypeHelper;
import java.util.*; import org.eclipse.persistence.internal.oxm.*; import org.eclipse.persistence.oxm.*; import org.eclipse.persistence.sdo.helper.*;
[ "java.util", "org.eclipse.persistence" ]
java.util; org.eclipse.persistence;
679,319
public void setAwardBeginningDate(Date awardBeginningDate) { this.awardBeginningDate = awardBeginningDate; }
void function(Date awardBeginningDate) { this.awardBeginningDate = awardBeginningDate; }
/** * Sets the awardBeginningDate attribute value. * * @param awardBeginningDate The awardBeginningDate to set. */
Sets the awardBeginningDate attribute value
setAwardBeginningDate
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/businessobject/ContractsGrantsLetterOfCreditReviewDetail.java", "license": "agpl-3.0", "size": 14511 }
[ "java.sql.Date" ]
import java.sql.Date;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,136,197
private JSONObject _request(Method m, String url, String json, List<String> hostsArray, int connectTimeout, int readTimeout) throws AlgoliaException { try { return _getJSONObject(_requestRaw(m, url, json, hostsArray, connectTimeout, readTimeout)); } catch (JSONException e) { throw new AlgoliaException("JSON decode error:" + e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AlgoliaException("UTF-8 decode error:" + e.getMessage()); } }
JSONObject function(Method m, String url, String json, List<String> hostsArray, int connectTimeout, int readTimeout) throws AlgoliaException { try { return _getJSONObject(_requestRaw(m, url, json, hostsArray, connectTimeout, readTimeout)); } catch (JSONException e) { throw new AlgoliaException(STR + e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(STR + e.getMessage()); } }
/** * Send the query according to parameters and returns its result as a JSONObject * * @param m HTTP Method to use * @param url endpoint URL * @param json optional JSON Object to send * @param hostsArray array of hosts to try successively * @param connectTimeout maximum wait time to open connection * @param readTimeout maximum time to read data on socket * @return a JSONObject containing the resulting data or error * @throws AlgoliaException if the request data is not valid json */
Send the query according to parameters and returns its result as a JSONObject
_request
{ "repo_name": "algoliareadmebot/algoliasearch-client-android", "path": "algoliasearch/src/main/java/com/algolia/search/saas/AbstractClient.java", "license": "mit", "size": 29162 }
[ "java.io.UnsupportedEncodingException", "java.util.List", "org.json.JSONException", "org.json.JSONObject" ]
import java.io.UnsupportedEncodingException; import java.util.List; import org.json.JSONException; import org.json.JSONObject;
import java.io.*; import java.util.*; import org.json.*;
[ "java.io", "java.util", "org.json" ]
java.io; java.util; org.json;
897,394
public static String getInstallPath() { File coreFolder = InstalledFileLocator.getDefault().locate("core", PlatformUtil.class.getPackage().getName(), false); //NON-NLS File rootPath = coreFolder.getParentFile().getParentFile(); return rootPath.getAbsolutePath(); }
static String function() { File coreFolder = InstalledFileLocator.getDefault().locate("core", PlatformUtil.class.getPackage().getName(), false); File rootPath = coreFolder.getParentFile().getParentFile(); return rootPath.getAbsolutePath(); }
/** * Get root path where the application is installed * * @return absolute path string to the install root dir */
Get root path where the application is installed
getInstallPath
{ "repo_name": "esaunders/autopsy", "path": "Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java", "license": "apache-2.0", "size": 24555 }
[ "java.io.File", "org.openide.modules.InstalledFileLocator" ]
import java.io.File; import org.openide.modules.InstalledFileLocator;
import java.io.*; import org.openide.modules.*;
[ "java.io", "org.openide.modules" ]
java.io; org.openide.modules;
681,215
Object executeWithServerAffinity(ServerLocation loc, Op op) { final int initialRetryCount = getAffinityRetryCount(); try { try { return executeOnServer(loc, op, true, false); } catch (ServerConnectivityException e) { if (logger.isDebugEnabled()) { logger.debug("caught exception while executing with affinity:{}", e.getMessage(), e); } if (!serverAffinityFailover || e instanceof ServerOperationException) { throw e; } int retryCount = getAffinityRetryCount(); if ((retryAttempts != -1 && retryCount >= retryAttempts) || retryCount > TX_RETRY_ATTEMPT) { // prevent stack overflow throw e; } setAffinityRetryCount(retryCount + 1); } affinityServerLocation.set(null); if (logger.isDebugEnabled()) { logger.debug("reset server affinity: attempting txFailover"); } // send TXFailoverOp, so that new server can // do bootstrapping, then re-execute original op AbstractOp absOp = (AbstractOp) op; absOp.getMessage().setIsRetry(); int transactionId = absOp.getMessage().getTransactionId(); // for CommitOp we do not have transactionId in AbstractOp // so set it explicitly for TXFailoverOp TXFailoverOp.execute(pool, transactionId); if (op instanceof ExecuteRegionFunctionOpImpl) { op = new ExecuteRegionFunctionOpImpl((ExecuteRegionFunctionOpImpl) op, (byte) 1, new HashSet<>()); ((ExecuteRegionFunctionOpImpl) op).getMessage().setTransactionId(transactionId); } else if (op instanceof ExecuteFunctionOpImpl) { op = new ExecuteFunctionOpImpl((ExecuteFunctionOpImpl) op, (byte) 1); ((ExecuteFunctionOpImpl) op).getMessage().setTransactionId(transactionId); } return pool.execute(op); } finally { if (initialRetryCount == 0) { setAffinityRetryCount(0); } } }
Object executeWithServerAffinity(ServerLocation loc, Op op) { final int initialRetryCount = getAffinityRetryCount(); try { try { return executeOnServer(loc, op, true, false); } catch (ServerConnectivityException e) { if (logger.isDebugEnabled()) { logger.debug(STR, e.getMessage(), e); } if (!serverAffinityFailover e instanceof ServerOperationException) { throw e; } int retryCount = getAffinityRetryCount(); if ((retryAttempts != -1 && retryCount >= retryAttempts) retryCount > TX_RETRY_ATTEMPT) { throw e; } setAffinityRetryCount(retryCount + 1); } affinityServerLocation.set(null); if (logger.isDebugEnabled()) { logger.debug(STR); } AbstractOp absOp = (AbstractOp) op; absOp.getMessage().setIsRetry(); int transactionId = absOp.getMessage().getTransactionId(); TXFailoverOp.execute(pool, transactionId); if (op instanceof ExecuteRegionFunctionOpImpl) { op = new ExecuteRegionFunctionOpImpl((ExecuteRegionFunctionOpImpl) op, (byte) 1, new HashSet<>()); ((ExecuteRegionFunctionOpImpl) op).getMessage().setTransactionId(transactionId); } else if (op instanceof ExecuteFunctionOpImpl) { op = new ExecuteFunctionOpImpl((ExecuteFunctionOpImpl) op, (byte) 1); ((ExecuteFunctionOpImpl) op).getMessage().setTransactionId(transactionId); } return pool.execute(op); } finally { if (initialRetryCount == 0) { setAffinityRetryCount(0); } } }
/** * execute the given op on the given server. If the server cannot be reached, sends a * TXFailoverOp, then retries the given op * * @param loc the server to execute the op on * @param op the op to execute * @return the result of execution */
execute the given op on the given server. If the server cannot be reached, sends a TXFailoverOp, then retries the given op
executeWithServerAffinity
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/cache/client/internal/OpExecutorImpl.java", "license": "apache-2.0", "size": 29602 }
[ "java.util.HashSet", "org.apache.geode.cache.client.ServerConnectivityException", "org.apache.geode.cache.client.ServerOperationException", "org.apache.geode.cache.client.internal.ExecuteFunctionOp", "org.apache.geode.cache.client.internal.ExecuteRegionFunctionOp", "org.apache.geode.distributed.internal.S...
import java.util.HashSet; import org.apache.geode.cache.client.ServerConnectivityException; import org.apache.geode.cache.client.ServerOperationException; import org.apache.geode.cache.client.internal.ExecuteFunctionOp; import org.apache.geode.cache.client.internal.ExecuteRegionFunctionOp; import org.apache.geode.distributed.internal.ServerLocation;
import java.util.*; import org.apache.geode.cache.client.*; import org.apache.geode.cache.client.internal.*; import org.apache.geode.distributed.internal.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
2,067,261
public java.util.List<fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI> getSubterm_integers_NumberConstantHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.integers.impl.NumberConstantImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI( (fr.lip6.move.pnml.hlpn.integers.NumberConstant)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.integers.impl.NumberConstantImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.integers.hlapi.NumberConstantHLAPI( (fr.lip6.move.pnml.hlpn.integers.NumberConstant)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of NumberConstantHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of NumberConstantHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_integers_NumberConstantHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/SubstringHLAPI.java", "license": "epl-1.0", "size": 111893 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,719,565
public void setPosition(CmsPositionBean position, CmsPositionBean buttonsPosition, Element containerElement) { m_position = position; Element parent = CmsDomUtil.getPositioningParent(getElement()); Style style = getElement().getStyle(); style.setRight( parent.getOffsetWidth() - ((buttonsPosition.getLeft() + buttonsPosition.getWidth()) - parent.getAbsoluteLeft()), Unit.PX); int top = buttonsPosition.getTop() - parent.getAbsoluteTop(); if (top < 0) { top = 0; } style.setTop(top, Unit.PX); }
void function(CmsPositionBean position, CmsPositionBean buttonsPosition, Element containerElement) { m_position = position; Element parent = CmsDomUtil.getPositioningParent(getElement()); Style style = getElement().getStyle(); style.setRight( parent.getOffsetWidth() - ((buttonsPosition.getLeft() + buttonsPosition.getWidth()) - parent.getAbsoluteLeft()), Unit.PX); int top = buttonsPosition.getTop() - parent.getAbsoluteTop(); if (top < 0) { top = 0; } style.setTop(top, Unit.PX); }
/** * Sets the position. Make sure the widget is attached to the DOM.<p> * * @param position the absolute position * @param buttonsPosition the corrected position for the buttons * * @param containerElement the parent container element */
Sets the position. Make sure the widget is attached to the DOM
setPosition
{ "repo_name": "sbonoc/opencms-core", "path": "src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditButtons.java", "license": "lgpl-2.1", "size": 8053 }
[ "com.google.gwt.dom.client.Element", "com.google.gwt.dom.client.Style", "org.opencms.gwt.client.util.CmsDomUtil", "org.opencms.gwt.client.util.CmsPositionBean" ]
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style; import org.opencms.gwt.client.util.CmsDomUtil; import org.opencms.gwt.client.util.CmsPositionBean;
import com.google.gwt.dom.client.*; import org.opencms.gwt.client.util.*;
[ "com.google.gwt", "org.opencms.gwt" ]
com.google.gwt; org.opencms.gwt;
2,643,682
public int delete(Contents contents) { return delete(contents.getTableName()); }
int function(Contents contents) { return delete(contents.getTableName()); }
/** * Delete by contents * * @param contents * contents * @return deleted count */
Delete by contents
delete
{ "repo_name": "ngageoint/geopackage-core-java", "path": "src/main/java/mil/nga/geopackage/extension/coverage/GriddedTileDao.java", "license": "mit", "size": 3718 }
[ "mil.nga.geopackage.contents.Contents" ]
import mil.nga.geopackage.contents.Contents;
import mil.nga.geopackage.contents.*;
[ "mil.nga.geopackage" ]
mil.nga.geopackage;
506,506
@Override public void filter(final Filter filter) throws NoTestsRemainException { int count = 0; FrameworkMethod[] children = getFilteredChildren(); for (final FrameworkMethod method : children) { if (filter.shouldRun(describeChild(method))) { try { filter.apply(method); } catch (NoTestsRemainException e) { continue; } children[count++] = method; } } if (count == 0) { throw new NoTestsRemainException(); } filteredChildren = ArraysExt.resize(children, count); }
void function(final Filter filter) throws NoTestsRemainException { int count = 0; FrameworkMethod[] children = getFilteredChildren(); for (final FrameworkMethod method : children) { if (filter.shouldRun(describeChild(method))) { try { filter.apply(method); } catch (NoTestsRemainException e) { continue; } children[count++] = method; } } if (count == 0) { throw new NoTestsRemainException(); } filteredChildren = ArraysExt.resize(children, count); }
/** * Removes tests that don't pass the parameter {@code filter}. * * @param filter the filter to apply. * @throws NoTestsRemainException if all tests are filtered out. */
Removes tests that don't pass the parameter filter
filter
{ "repo_name": "Geomatys/sis", "path": "core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java", "license": "apache-2.0", "size": 16421 }
[ "org.apache.sis.util.ArraysExt", "org.junit.runner.manipulation.Filter", "org.junit.runner.manipulation.NoTestsRemainException", "org.junit.runners.model.FrameworkMethod" ]
import org.apache.sis.util.ArraysExt; import org.junit.runner.manipulation.Filter; import org.junit.runner.manipulation.NoTestsRemainException; import org.junit.runners.model.FrameworkMethod;
import org.apache.sis.util.*; import org.junit.runner.manipulation.*; import org.junit.runners.model.*;
[ "org.apache.sis", "org.junit.runner", "org.junit.runners" ]
org.apache.sis; org.junit.runner; org.junit.runners;
2,099,686
public static void main(String[] args) { FrameRunner.run(EditorWindow.class); }
static void function(String[] args) { FrameRunner.run(EditorWindow.class); }
/** * Launch the application. */
Launch the application
main
{ "repo_name": "codebucketdev/DynQuiz", "path": "src/de/codebucket/dynquiz/frames/EditorWindow.java", "license": "gpl-3.0", "size": 21643 }
[ "de.codebucket.dynquiz.FrameRunner" ]
import de.codebucket.dynquiz.FrameRunner;
import de.codebucket.dynquiz.*;
[ "de.codebucket.dynquiz" ]
de.codebucket.dynquiz;
441,467
void scheduleDrainBuffers() { if (drainStatus() >= PROCESSING_TO_IDLE) { return; } if (evictionLock.tryLock()) { try { int drainStatus = drainStatus(); if (drainStatus >= PROCESSING_TO_IDLE) { return; } setDrainStatusRelease(PROCESSING_TO_IDLE); executor.execute(drainBuffersTask); } catch (Throwable t) { logger.log(Level.WARNING, "Exception thrown when submitting maintenance task", t); maintenance( null); } finally { evictionLock.unlock(); } } }
void scheduleDrainBuffers() { if (drainStatus() >= PROCESSING_TO_IDLE) { return; } if (evictionLock.tryLock()) { try { int drainStatus = drainStatus(); if (drainStatus >= PROCESSING_TO_IDLE) { return; } setDrainStatusRelease(PROCESSING_TO_IDLE); executor.execute(drainBuffersTask); } catch (Throwable t) { logger.log(Level.WARNING, STR, t); maintenance( null); } finally { evictionLock.unlock(); } } }
/** * Attempts to schedule an asynchronous task to apply the pending operations to the page * replacement policy. If the executor rejects the task then it is run directly. */
Attempts to schedule an asynchronous task to apply the pending operations to the page replacement policy. If the executor rejects the task then it is run directly
scheduleDrainBuffers
{ "repo_name": "ben-manes/caffeine", "path": "caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java", "license": "apache-2.0", "size": 148971 }
[ "java.lang.System" ]
import java.lang.System;
import java.lang.*;
[ "java.lang" ]
java.lang;
2,473,554
private JPanel buildCommentAreaPanel(String comment, int mnemonic) { JPanel panel = new JPanel(); panel.setOpaque(false); double size[][] = {{TableLayout.FILL}, {20, TableLayout.FILL}}; TableLayout layout = new TableLayout(size); panel.setLayout(layout); JScrollPane areaScrollPane = new JScrollPane(commentArea); areaScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); JLabel label = new JLabel(comment); label.setOpaque(false); label.setDisplayedMnemonic(mnemonic); panel.add(label, "0, 0, LEFT, CENTER"); panel.add(areaScrollPane, "0, 1"); return panel; }
JPanel function(String comment, int mnemonic) { JPanel panel = new JPanel(); panel.setOpaque(false); double size[][] = {{TableLayout.FILL}, {20, TableLayout.FILL}}; TableLayout layout = new TableLayout(size); panel.setLayout(layout); JScrollPane areaScrollPane = new JScrollPane(commentArea); areaScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); JLabel label = new JLabel(comment); label.setOpaque(false); label.setDisplayedMnemonic(mnemonic); panel.add(label, STR); panel.add(areaScrollPane, STR); return panel; }
/** * Builds and lays out the panel hosting the <code>comment</code> details. * * @param comment The comment's text. * @param mnemonic The key-code that indicates a mnemonic key. * @return See above. */
Builds and lays out the panel hosting the <code>comment</code> details
buildCommentAreaPanel
{ "repo_name": "ximenesuk/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/MessengerDialog.java", "license": "gpl-2.0", "size": 26055 }
[ "info.clearthought.layout.TableLayout", "javax.swing.JLabel", "javax.swing.JPanel", "javax.swing.JScrollPane" ]
import info.clearthought.layout.TableLayout; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane;
import info.clearthought.layout.*; import javax.swing.*;
[ "info.clearthought.layout", "javax.swing" ]
info.clearthought.layout; javax.swing;
1,756,608
if (!commandHelpInitialized && action != null) { StringBuilder stringBuilder = new StringBuilder(); String commandIdsAsString = action.getCommandIdentifiersAsString(); stringBuilder.append(action.getBriefHelp()); stringBuilder.append("\n"); try { stringBuilder.append( ResourceUtils.getMessage(COMMAND_HELP_KEY, commandIdsAsString)); } catch (MissingResourceException e) { LOGGER.log(Level.SEVERE, "Resource not found: \"" + COMMAND_HELP_KEY + "\"", e); stringBuilder.append("\n") .append("Plays the current song in the playlist:"); stringBuilder.append("\n\t").append(commandIdsAsString); stringBuilder.append("\n").append( "You can specify the song to play by giving the song index in playlist as follow:"); stringBuilder.append("\n\t").append(commandIdsAsString) .append(" [integer] "); stringBuilder.append("\n").append( "You can also specify the song to play by giving its path as follow:"); stringBuilder.append("\n\t").append(commandIdsAsString) .append(" [path] "); } commandHelp = stringBuilder.toString(); commandHelpInitialized = true; } return commandHelp; }
if (!commandHelpInitialized && action != null) { StringBuilder stringBuilder = new StringBuilder(); String commandIdsAsString = action.getCommandIdentifiersAsString(); stringBuilder.append(action.getBriefHelp()); stringBuilder.append("\n"); try { stringBuilder.append( ResourceUtils.getMessage(COMMAND_HELP_KEY, commandIdsAsString)); } catch (MissingResourceException e) { LOGGER.log(Level.SEVERE, STRSTR\STR\nSTRPlays the current song in the playlist:STR\n\tSTR\nSTRYou can specify the song to play by giving the song index in playlist as follow:STR\n\tSTR [integer] STR\nSTRYou can also specify the song to play by giving its path as follow:STR\n\tSTR [path] "); } commandHelp = stringBuilder.toString(); commandHelpInitialized = true; } return commandHelp; }
/** * Construct the static command help. * * @param action the action reference * * @return the static command help. */
Construct the static command help
getHelp
{ "repo_name": "madmath03/MidiPlayer", "path": "src/main/java/midiplayer/frame/action/PlayAction.java", "license": "mit", "size": 10657 }
[ "java.util.MissingResourceException", "java.util.logging.Level" ]
import java.util.MissingResourceException; import java.util.logging.Level;
import java.util.*; import java.util.logging.*;
[ "java.util" ]
java.util;
1,967,945
public Item findItemByUid(String uid);
Item function(String uid);
/** * Find an item with the specified uid. The return type will be one of * ContentItem, CollectionItem, CalendarCollectionItem, CalendarItem. * * @param uid * uid of item to find * @return item represented by uid */
Find an item with the specified uid. The return type will be one of ContentItem, CollectionItem, CalendarCollectionItem, CalendarItem
findItemByUid
{ "repo_name": "1and1/cosmo", "path": "cosmo-api/src/main/java/org/unitedinternet/cosmo/service/ContentService.java", "license": "apache-2.0", "size": 14578 }
[ "org.unitedinternet.cosmo.model.Item" ]
import org.unitedinternet.cosmo.model.Item;
import org.unitedinternet.cosmo.model.*;
[ "org.unitedinternet.cosmo" ]
org.unitedinternet.cosmo;
1,761,201
@AsPercept(name = "holding", multiplePercepts = true, filter = Filter.Type.ALWAYS) public List<Long> getHolding() { Stack<Block> holding = this.ourRobot.getHolding(); List<Long> holds = new ArrayList<>(holding.size()); for (Block b : holding) { holds.add(b.getId()); } return holds; }
@AsPercept(name = STR, multiplePercepts = true, filter = Filter.Type.ALWAYS) List<Long> function() { Stack<Block> holding = this.ourRobot.getHolding(); List<Long> holds = new ArrayList<>(holding.size()); for (Block b : holding) { holds.add(b.getId()); } return holds; }
/** * Percept if the robot is holding something. Send if it becomes true, and send * negated if it becomes false again. * * @return holding block */
Percept if the robot is holding something. Send if it becomes true, and send negated if it becomes false again
getHolding
{ "repo_name": "eishub/BW4T", "path": "bw4t-server/src/main/java/nl/tudelft/bw4t/server/eis/RobotEntity.java", "license": "gpl-3.0", "size": 28063 }
[ "java.util.ArrayList", "java.util.List", "java.util.Stack", "nl.tudelft.bw4t.server.model.blocks.Block" ]
import java.util.ArrayList; import java.util.List; import java.util.Stack; import nl.tudelft.bw4t.server.model.blocks.Block;
import java.util.*; import nl.tudelft.bw4t.server.model.blocks.*;
[ "java.util", "nl.tudelft.bw4t" ]
java.util; nl.tudelft.bw4t;
795,976
public Observable<ServiceResponse<Void>> beginDeleteWithServiceResponseAsync(String resourceGroupName, String crossConnectionName, String peeringName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (crossConnectionName == null) { throw new IllegalArgumentException("Parameter crossConnectionName is required and cannot be null."); } if (peeringName == null) { throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<Void>> function(String resourceGroupName, String crossConnectionName, String peeringName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (crossConnectionName == null) { throw new IllegalArgumentException(STR); } if (peeringName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * Deletes the specified peering from the ExpressRouteCrossConnection. * * @param resourceGroupName The name of the resource group. * @param crossConnectionName The name of the ExpressRouteCrossConnection. * @param peeringName The name of the peering. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */
Deletes the specified peering from the ExpressRouteCrossConnection
beginDeleteWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java", "license": "mit", "size": 49218 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
739,248
public void onServiceConnected(ComponentName className, IBinder service) { if (LOG) { Log.v(TAG, "Connected to Media Scanner"); } synchronized (this) { mService = IMediaScannerService.Stub.asInterface(service); if (mService != null && mClient != null) { mClient.onMediaScannerConnected(); } } }
void function(ComponentName className, IBinder service) { if (LOG) { Log.v(TAG, STR); } synchronized (this) { mService = IMediaScannerService.Stub.asInterface(service); if (mService != null && mClient != null) { mClient.onMediaScannerConnected(); } } }
/** * Part of the ServiceConnection interface. Do not call. */
Part of the ServiceConnection interface. Do not call
onServiceConnected
{ "repo_name": "rex-xxx/mt6572_x201", "path": "frameworks/base/media/java/android/media/MediaScannerConnection.java", "license": "gpl-2.0", "size": 9781 }
[ "android.content.ComponentName", "android.media.IMediaScannerService", "android.os.IBinder", "android.util.Log" ]
import android.content.ComponentName; import android.media.IMediaScannerService; import android.os.IBinder; import android.util.Log;
import android.content.*; import android.media.*; import android.os.*; import android.util.*;
[ "android.content", "android.media", "android.os", "android.util" ]
android.content; android.media; android.os; android.util;
482,805
public T getOriginal() { return original; } } static class StreamCapture { private final File out; private OutputStream outstream; private final File err; private OutputStream errstream; private final boolean printToOriginalOutputs; private int useCount; private boolean closed; StreamCapture(File out, File err, boolean printToOriginalOutputs) throws IOException { this.out = out; this.err = err; this.printToOriginalOutputs = printToOriginalOutputs; }
T function() { return original; } } static class StreamCapture { private final File out; private OutputStream outstream; private final File err; private OutputStream errstream; private final boolean printToOriginalOutputs; private int useCount; private boolean closed; StreamCapture(File out, File err, boolean printToOriginalOutputs) throws IOException { this.out = out; this.err = err; this.printToOriginalOutputs = printToOriginalOutputs; }
/** * Returns the original stream this swappable stream was created with. */
Returns the original stream this swappable stream was created with
getOriginal
{ "repo_name": "sameerparekh/pants", "path": "src/java/org/pantsbuild/tools/junit/impl/ConsoleRunnerImpl.java", "license": "apache-2.0", "size": 25558 }
[ "java.io.File", "java.io.IOException", "java.io.OutputStream" ]
import java.io.File; import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
705,674
private int recoverCandidates(final int clusterId, final long startTime) { int myClusterId = nodeStore.getClusterId(); boolean lockAcquired = missingLastRevUtil.acquireRecoveryLock(clusterId, myClusterId); //TODO What if recovery is being performed for current clusterNode by some other node //should we halt the startup if(!lockAcquired){ log.info("Last revision recovery already being performed by some other node. " + "Would not attempt recovery"); return 0; } Iterable<NodeDocument> suspects = missingLastRevUtil.getCandidates(startTime); log.info("Performing Last Revision Recovery for clusterNodeId {}", clusterId); try { return recover(suspects.iterator(), clusterId); } finally { Utils.closeIfCloseable(suspects); // Relinquish the lock on the recovery for the cluster on the // clusterInfo // TODO: in case recover throws a RuntimeException (or Error..) then // the recovery might have failed, yet the instance is marked // as 'recovered' (by setting the state to NONE). // is this really fine here? or should we not retry - or at least // log the throwable? missingLastRevUtil.releaseRecoveryLock(clusterId); nodeStore.signalClusterStateChange(); } } /** * Determines the last committed modification to the given document by * a {@code clusterId}. * * @param doc a document. * @param clusterId clusterId for which the last committed modification is * looked up. * @return the commit revision of the last modification by {@code clusterId}
int function(final int clusterId, final long startTime) { int myClusterId = nodeStore.getClusterId(); boolean lockAcquired = missingLastRevUtil.acquireRecoveryLock(clusterId, myClusterId); if(!lockAcquired){ log.info(STR + STR); return 0; } Iterable<NodeDocument> suspects = missingLastRevUtil.getCandidates(startTime); log.info(STR, clusterId); try { return recover(suspects.iterator(), clusterId); } finally { Utils.closeIfCloseable(suspects); missingLastRevUtil.releaseRecoveryLock(clusterId); nodeStore.signalClusterStateChange(); } } /** * Determines the last committed modification to the given document by * a {@code clusterId}. * * @param doc a document. * @param clusterId clusterId for which the last committed modification is * looked up. * @return the commit revision of the last modification by {@code clusterId}
/** * Retrieves possible candidates which have been modified after the given * {@code startTime} and recovers the missing updates. * * @param clusterId the cluster id * @param startTime the start time * @return the number of restored nodes */
Retrieves possible candidates which have been modified after the given startTime and recovers the missing updates
recoverCandidates
{ "repo_name": "afilimonov/jackrabbit-oak", "path": "oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java", "license": "apache-2.0", "size": 17477 }
[ "org.apache.jackrabbit.oak.plugins.document.util.Utils" ]
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.apache.jackrabbit.oak.plugins.document.util.*;
[ "org.apache.jackrabbit" ]
org.apache.jackrabbit;
1,368,760
protected boolean isSecurityCodeEmpty(HoldingHistoryValueAdjustmentDocument document) { if (StringUtils.isEmpty(document.getSecurityId())) { GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(EndowConstants.HistoryHoldingValueAdjustmentValuationCodes.HISTORY_VALUE_ADJUSTMENT_DETAILS_ERRORS + EndowPropertyConstants.HISTORY_VALUE_ADJUSTMENT_SECURITY_ID, EndowKeyConstants.HoldingHistoryValueAdjustmentConstants.ERROR_HISTORY_VALUE_ADJUSTMENT_SECURITY_ID_REQUIRED); return true; } return false; }
boolean function(HoldingHistoryValueAdjustmentDocument document) { if (StringUtils.isEmpty(document.getSecurityId())) { GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(EndowConstants.HistoryHoldingValueAdjustmentValuationCodes.HISTORY_VALUE_ADJUSTMENT_DETAILS_ERRORS + EndowPropertyConstants.HISTORY_VALUE_ADJUSTMENT_SECURITY_ID, EndowKeyConstants.HoldingHistoryValueAdjustmentConstants.ERROR_HISTORY_VALUE_ADJUSTMENT_SECURITY_ID_REQUIRED); return true; } return false; }
/** * Validates the Security code to make sure the value is not empty. * * @param tranSecurity * @return true if security code is empty, else false. */
Validates the Security code to make sure the value is not empty
isSecurityCodeEmpty
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/document/validation/impl/HoldingHistoryValueAdjustmentDocumentRules.java", "license": "apache-2.0", "size": 13222 }
[ "org.apache.commons.lang.StringUtils", "org.kuali.kfs.module.endow.EndowConstants", "org.kuali.kfs.module.endow.EndowKeyConstants", "org.kuali.kfs.module.endow.EndowPropertyConstants", "org.kuali.kfs.module.endow.document.HoldingHistoryValueAdjustmentDocument", "org.kuali.rice.krad.util.GlobalVariables" ]
import org.apache.commons.lang.StringUtils; import org.kuali.kfs.module.endow.EndowConstants; import org.kuali.kfs.module.endow.EndowKeyConstants; import org.kuali.kfs.module.endow.EndowPropertyConstants; import org.kuali.kfs.module.endow.document.HoldingHistoryValueAdjustmentDocument; import org.kuali.rice.krad.util.GlobalVariables;
import org.apache.commons.lang.*; import org.kuali.kfs.module.endow.*; import org.kuali.kfs.module.endow.document.*; import org.kuali.rice.krad.util.*;
[ "org.apache.commons", "org.kuali.kfs", "org.kuali.rice" ]
org.apache.commons; org.kuali.kfs; org.kuali.rice;
17,591
private PathElement resolve(NamePath path) { String first = path.getFirstPart(); for (SourceFolder sourceFolder : sourceFolders) { if (sourceFolder.getChild(first) != null) { return this.resolve(path, sourceFolder); } } return null; }
PathElement function(NamePath path) { String first = path.getFirstPart(); for (SourceFolder sourceFolder : sourceFolders) { if (sourceFolder.getChild(first) != null) { return this.resolve(path, sourceFolder); } } return null; }
/** * Resolve the absolute import of path, searching the whole workspace. * * @param path * @return */
Resolve the absolute import of path, searching the whole workspace
resolve
{ "repo_name": "retoo/pystructure", "path": "src/ch/hsr/ifs/pystructure/typeinference/visitors/ImportResolver.java", "license": "lgpl-2.1", "size": 2868 }
[ "ch.hsr.ifs.pystructure.typeinference.model.base.NamePath", "ch.hsr.ifs.pystructure.typeinference.model.definitions.PathElement" ]
import ch.hsr.ifs.pystructure.typeinference.model.base.NamePath; import ch.hsr.ifs.pystructure.typeinference.model.definitions.PathElement;
import ch.hsr.ifs.pystructure.typeinference.model.base.*; import ch.hsr.ifs.pystructure.typeinference.model.definitions.*;
[ "ch.hsr.ifs" ]
ch.hsr.ifs;
2,057,285
public static String nodeToString(Node node) { StringWriter sw = new StringWriter(); if (node instanceof Attr) { Attr attr = (Attr) node; return attr.getValue(); } try { Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); t.setOutputProperty(OutputKeys.INDENT, "yes"); t.transform(new DOMSource(node), new StreamResult(sw)); } catch (TransformerException te) { LOG.warning("Transformer Exception: " + te.getMessage()); } return sw.toString(); }
static String function(Node node) { StringWriter sw = new StringWriter(); if (node instanceof Attr) { Attr attr = (Attr) node; return attr.getValue(); } try { Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); t.setOutputProperty(OutputKeys.INDENT, "yes"); t.transform(new DOMSource(node), new StreamResult(sw)); } catch (TransformerException te) { LOG.warning(STR + te.getMessage()); } return sw.toString(); }
/** * Converts the given {@link Node} to a {@link String}. */
Converts the given <code>Node</code> to a <code>String</code>
nodeToString
{ "repo_name": "sgilda/windup", "path": "utils/src/main/java/org/jboss/windup/util/xml/XmlUtil.java", "license": "epl-1.0", "size": 6952 }
[ "java.io.StringWriter", "javax.xml.transform.OutputKeys", "javax.xml.transform.Transformer", "javax.xml.transform.TransformerException", "javax.xml.transform.TransformerFactory", "javax.xml.transform.dom.DOMSource", "javax.xml.transform.stream.StreamResult", "org.w3c.dom.Attr", "org.w3c.dom.Node" ]
import java.io.StringWriter; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Attr; import org.w3c.dom.Node;
import java.io.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; import org.w3c.dom.*;
[ "java.io", "javax.xml", "org.w3c.dom" ]
java.io; javax.xml; org.w3c.dom;
1,096,811
public CRange getRange() { return this.rowRange; }
CRange function() { return this.rowRange; }
/** * Get the range of rows returned by this get. * * @return The row range returned by this get. */
Get the range of rows returned by this get
getRange
{ "repo_name": "booz-allen-hamilton/culvert", "path": "culvert-main/src/main/java/com/bah/culvert/transactions/Get.java", "license": "apache-2.0", "size": 4594 }
[ "com.bah.culvert.data.CRange" ]
import com.bah.culvert.data.CRange;
import com.bah.culvert.data.*;
[ "com.bah.culvert" ]
com.bah.culvert;
1,422,752
public void shutDown() throws IOException, InterruptedException { System.out.println("Shutting down the Mini Avatar Cluster"); shutDownAvatarNodes(); // this doesn't work, so just leave the datanodes running, // they won't interfere with the next run // shutDownDataNodes(); }
void function() throws IOException, InterruptedException { System.out.println(STR); shutDownAvatarNodes(); }
/** * Shut down the cluster */
Shut down the cluster
shutDown
{ "repo_name": "leonhong/hadoop-20-warehouse", "path": "src/contrib/highavailability/src/test/org/apache/hadoop/hdfs/MiniAvatarCluster.java", "license": "apache-2.0", "size": 25421 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
471,709
public File getFile(String par1Str) { return new File(this.getDataDirectory(), par1Str); }
File function(String par1Str) { return new File(this.getDataDirectory(), par1Str); }
/** * Returns a File object from the specified string. */
Returns a File object from the specified string
getFile
{ "repo_name": "HATB0T/RuneCraftery", "path": "forge/mcp/src/minecraft/net/minecraft/server/MinecraftServer.java", "license": "lgpl-3.0", "size": 46129 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,106,895
private void refill() throws IOException { offset += usableLength; int leftover = length - usableLength; System.arraycopy(buffer, usableLength, buffer, 0, leftover); int requested = buffer.length - leftover; int returned = read(input, buffer, leftover, requested); length = returned + leftover; if (returned < requested) { usableLength = length; } else { usableLength = findSafeEnd(); if (usableLength < 0) { usableLength = length; } } breaker.setText(buffer, 0, Math.max(0, usableLength)); }
void function() throws IOException { offset += usableLength; int leftover = length - usableLength; System.arraycopy(buffer, usableLength, buffer, 0, leftover); int requested = buffer.length - leftover; int returned = read(input, buffer, leftover, requested); length = returned + leftover; if (returned < requested) { usableLength = length; } else { usableLength = findSafeEnd(); if (usableLength < 0) { usableLength = length; } } breaker.setText(buffer, 0, Math.max(0, usableLength)); }
/** * Refill the buffer, accumulating the offset and setting usableLength to the * last unambiguous break position * * @throws IOException If there is a low-level I/O error. */
Refill the buffer, accumulating the offset and setting usableLength to the last unambiguous break position
refill
{ "repo_name": "jprante/elasticsearch-icu", "path": "src/main/java/org/xbib/elasticsearch/index/analysis/icu/segmentation/IcuTokenizer.java", "license": "apache-2.0", "size": 7527 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,839,087
public Shape getSeriesShape(int series); /** * Sets the shape used for a series and sends a {@link RendererChangeEvent}
Shape function(int series); /** * Sets the shape used for a series and sends a {@link RendererChangeEvent}
/** * Returns a shape used to represent the items in a series. * * @param series the series (zero-based index). * * @return The shape (possibly <code>null</code>). * * @see #setSeriesShape(int, Shape) */
Returns a shape used to represent the items in a series
getSeriesShape
{ "repo_name": "apetresc/JFreeChart", "path": "src/main/java/org/jfree/chart/renderer/category/CategoryItemRenderer.java", "license": "lgpl-2.1", "size": 67879 }
[ "java.awt.Shape", "org.jfree.chart.event.RendererChangeEvent" ]
import java.awt.Shape; import org.jfree.chart.event.RendererChangeEvent;
import java.awt.*; import org.jfree.chart.event.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
1,641,954
public void testInvalidXml() throws Exception { Node root = new Node(); root.setComment("foo\u0013bar"); assertEquals("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<Go>\n" + "<GoGame>\n" + "<Information>\n" + "<BoardSize>19</BoardSize>\n" + "</Information>\n" + "<Nodes>\n" + "<Node>\n" + "<Comment>\n" + "<P>foobar</P>\n" + "</Comment>\n" + "</Node>\n" + "</Nodes>\n" + "</GoGame>\n" + "</Go>\n", getText(19, root)); }
void function() throws Exception { Node root = new Node(); root.setComment(STR); assertEquals(STR1.0\STRutf-8\"?>\n" + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR, getText(19, root)); }
/** Test that invalid XML characters in comment are not written. This happened when an SGF file was loaded that had the control character Unicode 0x13 in its comment, and then saved again as XML. Not all UTF-8 characters are valid in XML, see http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char. */
Test that invalid XML characters in comment are not written
testInvalidXml
{ "repo_name": "noe/sgf.importer", "path": "test/junit/src/net/sf/gogui/xml/XmlWriterTest.java", "license": "gpl-2.0", "size": 8573 }
[ "net.sf.gogui.game.Node" ]
import net.sf.gogui.game.Node;
import net.sf.gogui.game.*;
[ "net.sf.gogui" ]
net.sf.gogui;
2,582,189
public DurationWrapper withField(Period field) { this.field = field; return this; }
DurationWrapper function(Period field) { this.field = field; return this; }
/** * Set the field value. * * @param field the field value to set * @return the DurationWrapper object itself. */
Set the field value
withField
{ "repo_name": "lmazuel/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodycomplex/models/DurationWrapper.java", "license": "mit", "size": 1015 }
[ "org.joda.time.Period" ]
import org.joda.time.Period;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
511,118
public static ClusterId getClusterId(FileSystem fs, Path rootdir) throws IOException { Path idPath = new Path(rootdir, HConstants.CLUSTER_ID_FILE_NAME); ClusterId clusterId = null; FileStatus status = fs.exists(idPath)? fs.getFileStatus(idPath): null; if (status != null) { int len = Ints.checkedCast(status.getLen()); byte [] content = new byte[len]; FSDataInputStream in = fs.open(idPath); try { in.readFully(content); } catch (EOFException eof) { LOG.warn("Cluster ID file " + idPath.toString() + " was empty"); } finally{ in.close(); } try { clusterId = ClusterId.parseFrom(content); } catch (DeserializationException e) { throw new IOException("content=" + Bytes.toString(content), e); } // If not pb'd, make it so. if (!ProtobufUtil.isPBMagicPrefix(content)) { String cid = null; in = fs.open(idPath); try { cid = in.readUTF(); clusterId = new ClusterId(cid); } catch (EOFException eof) { LOG.warn("Cluster ID file " + idPath.toString() + " was empty"); } finally { in.close(); } rewriteAsPb(fs, rootdir, idPath, clusterId); } return clusterId; } else { LOG.warn("Cluster ID file does not exist at " + idPath.toString()); } return clusterId; }
static ClusterId function(FileSystem fs, Path rootdir) throws IOException { Path idPath = new Path(rootdir, HConstants.CLUSTER_ID_FILE_NAME); ClusterId clusterId = null; FileStatus status = fs.exists(idPath)? fs.getFileStatus(idPath): null; if (status != null) { int len = Ints.checkedCast(status.getLen()); byte [] content = new byte[len]; FSDataInputStream in = fs.open(idPath); try { in.readFully(content); } catch (EOFException eof) { LOG.warn(STR + idPath.toString() + STR); } finally{ in.close(); } try { clusterId = ClusterId.parseFrom(content); } catch (DeserializationException e) { throw new IOException(STR + Bytes.toString(content), e); } if (!ProtobufUtil.isPBMagicPrefix(content)) { String cid = null; in = fs.open(idPath); try { cid = in.readUTF(); clusterId = new ClusterId(cid); } catch (EOFException eof) { LOG.warn(STR + idPath.toString() + STR); } finally { in.close(); } rewriteAsPb(fs, rootdir, idPath, clusterId); } return clusterId; } else { LOG.warn(STR + idPath.toString()); } return clusterId; }
/** * Returns the value of the unique cluster ID stored for this HBase instance. * @param fs the root directory FileSystem * @param rootdir the path to the HBase root directory * @return the unique cluster identifier * @throws IOException if reading the cluster ID file fails */
Returns the value of the unique cluster ID stored for this HBase instance
getClusterId
{ "repo_name": "ChinmaySKulkarni/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java", "license": "apache-2.0", "size": 70795 }
[ "java.io.EOFException", "java.io.IOException", "org.apache.hadoop.fs.FSDataInputStream", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.ClusterId", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.exceptions.D...
import java.io.EOFException; import java.io.IOException; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.ClusterId; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.exceptions.DeserializationException; import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; import org.apache.hbase.thirdparty.com.google.common.primitives.Ints;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.exceptions.*; import org.apache.hadoop.hbase.shaded.protobuf.*; import org.apache.hbase.thirdparty.com.google.common.primitives.*;
[ "java.io", "org.apache.hadoop", "org.apache.hbase" ]
java.io; org.apache.hadoop; org.apache.hbase;
1,080,243
public void setCheckingPaths(TreePath[] paths) { getCheckingModel().setCheckingPaths(paths); }
void function(TreePath[] paths) { getCheckingModel().setCheckingPaths(paths); }
/** * Set paths that are in the checking. */
Set paths that are in the checking
setCheckingPaths
{ "repo_name": "lorebiga/CheckboxTree", "path": "src/test/java/eu/floraresearch/lablib/gui/checkboxtree/MultipleToggleCheckboxTree.java", "license": "gpl-2.0", "size": 12250 }
[ "javax.swing.tree.TreePath" ]
import javax.swing.tree.TreePath;
import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
301,711
public java.util.List<fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI> getSubterm_finiteIntRanges_GreaterThanOrEqualHLAPI(){ java.util.List<fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.finiteIntRanges.impl.GreaterThanOrEqualImpl.class)){ retour.add(new fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI( (fr.lip6.move.pnml.symmetricnet.finiteIntRanges.GreaterThanOrEqual)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI> function(){ java.util.List<fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.finiteIntRanges.impl.GreaterThanOrEqualImpl.class)){ retour.add(new fr.lip6.move.pnml.symmetricnet.finiteIntRanges.hlapi.GreaterThanOrEqualHLAPI( (fr.lip6.move.pnml.symmetricnet.finiteIntRanges.GreaterThanOrEqual)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of GreaterThanOrEqualHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of GreaterThanOrEqualHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_finiteIntRanges_GreaterThanOrEqualHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/integers/hlapi/GreaterThanHLAPI.java", "license": "epl-1.0", "size": 89946 }
[ "fr.lip6.move.pnml.symmetricnet.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.symmetricnet.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.symmetricnet.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
61,882
private boolean newTrigger(EntityRef entity) { LocationComponent location = entity.getComponent(LocationComponent.class); TriggerComponent trigger = entity.getComponent(TriggerComponent.class); ConvexShape shape = getShapeFor(entity); if (shape != null && location != null && trigger != null) { float scale = location.getWorldScale(); shape.setLocalScaling(new Vector3f(scale, scale, scale)); List<CollisionGroup> detectGroups = Lists.newArrayList(trigger.detectGroups); PairCachingGhostObject triggerObj = createCollider( VecMath.to(location.getWorldPosition()), shape, StandardCollisionGroup.SENSOR.getFlag(), combineGroups(detectGroups), CollisionFlags.NO_CONTACT_RESPONSE); triggerObj.setUserPointer(entity); PairCachingGhostObject oldTrigger = entityTriggers.put(entity, triggerObj); if (oldTrigger != null) { logger.warn("Creating a trigger for an entity that already has a trigger. " + "Multiple trigger pre entity are not supported. Removing old one. Entity: {}", entity); removeCollider(oldTrigger); return false; } else { return true; } } else { logger.warn("Trying to create trigger for entity without ShapeComponent or without LocationComponent or without TriggerComponent. Entity: {}", entity); return false; } }
boolean function(EntityRef entity) { LocationComponent location = entity.getComponent(LocationComponent.class); TriggerComponent trigger = entity.getComponent(TriggerComponent.class); ConvexShape shape = getShapeFor(entity); if (shape != null && location != null && trigger != null) { float scale = location.getWorldScale(); shape.setLocalScaling(new Vector3f(scale, scale, scale)); List<CollisionGroup> detectGroups = Lists.newArrayList(trigger.detectGroups); PairCachingGhostObject triggerObj = createCollider( VecMath.to(location.getWorldPosition()), shape, StandardCollisionGroup.SENSOR.getFlag(), combineGroups(detectGroups), CollisionFlags.NO_CONTACT_RESPONSE); triggerObj.setUserPointer(entity); PairCachingGhostObject oldTrigger = entityTriggers.put(entity, triggerObj); if (oldTrigger != null) { logger.warn(STR + STR, entity); removeCollider(oldTrigger); return false; } else { return true; } } else { logger.warn(STR, entity); return false; } }
/** * Creates a new trigger. * * @param entity the entity to create a trigger for. */
Creates a new trigger
newTrigger
{ "repo_name": "samuto/Terasology", "path": "engine/src/main/java/org/terasology/physics/bullet/BulletPhysics.java", "license": "apache-2.0", "size": 40354 }
[ "com.bulletphysics.collision.dispatch.CollisionFlags", "com.bulletphysics.collision.dispatch.PairCachingGhostObject", "com.bulletphysics.collision.shapes.ConvexShape", "com.google.common.collect.Lists", "java.util.List", "javax.vecmath.Vector3f", "org.terasology.entitySystem.entity.EntityRef", "org.te...
import com.bulletphysics.collision.dispatch.CollisionFlags; import com.bulletphysics.collision.dispatch.PairCachingGhostObject; import com.bulletphysics.collision.shapes.ConvexShape; import com.google.common.collect.Lists; import java.util.List; import javax.vecmath.Vector3f; import org.terasology.entitySystem.entity.EntityRef; import org.terasology.logic.location.LocationComponent; import org.terasology.math.VecMath; import org.terasology.physics.CollisionGroup; import org.terasology.physics.StandardCollisionGroup; import org.terasology.physics.components.TriggerComponent;
import com.bulletphysics.collision.dispatch.*; import com.bulletphysics.collision.shapes.*; import com.google.common.collect.*; import java.util.*; import javax.vecmath.*; import org.terasology.*; import org.terasology.logic.location.*; import org.terasology.math.*; import org.terasology.physics.*; import org.terasology.physics.components.*;
[ "com.bulletphysics.collision", "com.google.common", "java.util", "javax.vecmath", "org.terasology", "org.terasology.logic", "org.terasology.math", "org.terasology.physics" ]
com.bulletphysics.collision; com.google.common; java.util; javax.vecmath; org.terasology; org.terasology.logic; org.terasology.math; org.terasology.physics;
117,854
protected void setOutputStream(OutputStream outputStream) { this.outputStream = outputStream; }
void function(OutputStream outputStream) { this.outputStream = outputStream; }
/** * sets a stream to which the output from the cvs executable should be sent * * @param outputStream stream to which the stdout from cvs should go */
sets a stream to which the output from the cvs executable should be sent
setOutputStream
{ "repo_name": "eclipse/hudson.plugins.cvs", "path": "src/main/java/hudson/org/apache/tools/ant/taskdefs/AbstractCvsTask.java", "license": "apache-2.0", "size": 25502 }
[ "java.io.OutputStream" ]
import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,257,303
public Set<String> getSensitiveAttributes() { return getAttributesByType(AttributeType.ATTR_TYPE_SE); }
Set<String> function() { return getAttributesByType(AttributeType.ATTR_TYPE_SE); }
/** * Returns the sensitive attributes. * * @return */
Returns the sensitive attributes
getSensitiveAttributes
{ "repo_name": "fstahnke/arx", "path": "src/main/org/deidentifier/arx/DataDefinition.java", "license": "apache-2.0", "size": 19798 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,586,872
@Test public void testSocketConnectFailure() throws IOException { final MongoClientConfiguration config = new MongoClientConfiguration(); final SocketFactory mockFactory = createMock(SocketFactory.class); final Socket mockSocket = createMock(Socket.class); final SocketException thrown = new SocketException("Injected."); expect(mockFactory.createSocket()).andReturn(mockSocket); mockSocket.connect(ourServer.getInetSocketAddress(), config.getConnectTimeout()); expectLastCall().andThrow(thrown); mockSocket.close(); expectLastCall().andThrow(new IOException("Injected but just logged.")); replay(mockFactory, mockSocket); config.setSocketFactory(mockFactory); final Cluster cluster = new Cluster(config, ClusterType.STAND_ALONE); final Server server = cluster.add(ourServer.getInetSocketAddress()); try { connect(server, config); fail("Should have thrown an SocketException"); } catch (final SocketException good) { assertThat(good, sameInstance(thrown)); } verify(mockFactory, mockSocket); }
void function() throws IOException { final MongoClientConfiguration config = new MongoClientConfiguration(); final SocketFactory mockFactory = createMock(SocketFactory.class); final Socket mockSocket = createMock(Socket.class); final SocketException thrown = new SocketException(STR); expect(mockFactory.createSocket()).andReturn(mockSocket); mockSocket.connect(ourServer.getInetSocketAddress(), config.getConnectTimeout()); expectLastCall().andThrow(thrown); mockSocket.close(); expectLastCall().andThrow(new IOException(STR)); replay(mockFactory, mockSocket); config.setSocketFactory(mockFactory); final Cluster cluster = new Cluster(config, ClusterType.STAND_ALONE); final Server server = cluster.add(ourServer.getInetSocketAddress()); try { connect(server, config); fail(STR); } catch (final SocketException good) { assertThat(good, sameInstance(thrown)); } verify(mockFactory, mockSocket); }
/** * Test method for {@link TransportConnection#TransportConnection} . * * @throws IOException * On a failure connecting to the Mock MongoDB server. */
Test method for <code>TransportConnection#TransportConnection</code>
testSocketConnectFailure
{ "repo_name": "allanbank/mongodb-async-driver", "path": "src/test/java/com/allanbank/mongodb/client/connection/socket/AbstractTransportConnectionTestCases.java", "license": "apache-2.0", "size": 125000 }
[ "com.allanbank.mongodb.MongoClientConfiguration", "com.allanbank.mongodb.client.ClusterType", "com.allanbank.mongodb.client.state.Cluster", "com.allanbank.mongodb.client.state.Server", "java.io.IOException", "java.net.Socket", "java.net.SocketException", "javax.net.SocketFactory", "org.easymock.Easy...
import com.allanbank.mongodb.MongoClientConfiguration; import com.allanbank.mongodb.client.ClusterType; import com.allanbank.mongodb.client.state.Cluster; import com.allanbank.mongodb.client.state.Server; import java.io.IOException; import java.net.Socket; import java.net.SocketException; import javax.net.SocketFactory; import org.easymock.EasyMock; import org.hamcrest.Matchers; import org.junit.Assert;
import com.allanbank.mongodb.*; import com.allanbank.mongodb.client.*; import com.allanbank.mongodb.client.state.*; import java.io.*; import java.net.*; import javax.net.*; import org.easymock.*; import org.hamcrest.*; import org.junit.*;
[ "com.allanbank.mongodb", "java.io", "java.net", "javax.net", "org.easymock", "org.hamcrest", "org.junit" ]
com.allanbank.mongodb; java.io; java.net; javax.net; org.easymock; org.hamcrest; org.junit;
2,402,726
@Test public void testPeriodicAggregateLastSeconds() throws Exception { // Uses Condition.getResult assumeTrue(!isStreamingAnalyticsRun()); final Topology t = newTopology(); TStream<String> source = t.periodicSource(new PeriodicStrings(), 100, TimeUnit.MILLISECONDS); TStream<JSONObject> aggregate = source.last(3, TimeUnit.SECONDS).aggregate( new AggregateStrings(), 1, TimeUnit.SECONDS); TStream<String> strings = JSONStreams.serialize(aggregate); Tester tester = t.getTester(); Condition<List<String>> contents = tester.stringContents(strings); // 10 tuples per second, aggregate every second, so 15 seconds is around 15 tuples. Condition<Long> ending = tester.atLeastTupleCount(strings, 15); complete(tester, ending, 30, TimeUnit.SECONDS); assertTrue(ending.valid()); long startTs = 0; for (String output : contents.getResult()) { JSONObject agg = JSONObject.parse(output); JSONArray items = (JSONArray) agg.get("items"); long ts = (Long) agg.get("ts"); // Should see around 30 tuples per window, once we // pass the first three seconds. assertTrue("Number of tuples in window:" + items.size(), items.size() <= 45); if (agg.containsKey("delta")) { long delta = (Long) agg.get("delta"); assertTrue(delta >= 0); assertTrue("timeBetweenAggs: " + delta, delta > 800 && delta < 1200); if (startTs == 0) { startTs = ts; } else { long diff = ts - startTs; if (diff > 3000) assertTrue( "Number of tuples in window:" + items.size(), items.size() >= 25); } } } }
void function() throws Exception { assumeTrue(!isStreamingAnalyticsRun()); final Topology t = newTopology(); TStream<String> source = t.periodicSource(new PeriodicStrings(), 100, TimeUnit.MILLISECONDS); TStream<JSONObject> aggregate = source.last(3, TimeUnit.SECONDS).aggregate( new AggregateStrings(), 1, TimeUnit.SECONDS); TStream<String> strings = JSONStreams.serialize(aggregate); Tester tester = t.getTester(); Condition<List<String>> contents = tester.stringContents(strings); Condition<Long> ending = tester.atLeastTupleCount(strings, 15); complete(tester, ending, 30, TimeUnit.SECONDS); assertTrue(ending.valid()); long startTs = 0; for (String output : contents.getResult()) { JSONObject agg = JSONObject.parse(output); JSONArray items = (JSONArray) agg.get("items"); long ts = (Long) agg.get("ts"); assertTrue(STR + items.size(), items.size() <= 45); if (agg.containsKey("delta")) { long delta = (Long) agg.get("delta"); assertTrue(delta >= 0); assertTrue(STR + delta, delta > 800 && delta < 1200); if (startTs == 0) { startTs = ts; } else { long diff = ts - startTs; if (diff > 3000) assertTrue( STR + items.size(), items.size() >= 25); } } } }
/** * Test a periodic aggregation. */
Test a periodic aggregation
testPeriodicAggregateLastSeconds
{ "repo_name": "wmarshall484/streamsx.topology", "path": "test/java/src/com/ibm/streamsx/topology/test/api/WindowTest.java", "license": "apache-2.0", "size": 13374 }
[ "com.ibm.json.java.JSONArray", "com.ibm.json.java.JSONObject", "com.ibm.streamsx.topology.TStream", "com.ibm.streamsx.topology.Topology", "com.ibm.streamsx.topology.json.JSONStreams", "com.ibm.streamsx.topology.tester.Condition", "com.ibm.streamsx.topology.tester.Tester", "java.util.List", "java.uti...
import com.ibm.json.java.JSONArray; import com.ibm.json.java.JSONObject; import com.ibm.streamsx.topology.TStream; import com.ibm.streamsx.topology.Topology; import com.ibm.streamsx.topology.json.JSONStreams; import com.ibm.streamsx.topology.tester.Condition; import com.ibm.streamsx.topology.tester.Tester; import java.util.List; import java.util.concurrent.TimeUnit; import org.junit.Assert; import org.junit.Assume;
import com.ibm.json.java.*; import com.ibm.streamsx.topology.*; import com.ibm.streamsx.topology.json.*; import com.ibm.streamsx.topology.tester.*; import java.util.*; import java.util.concurrent.*; import org.junit.*;
[ "com.ibm.json", "com.ibm.streamsx", "java.util", "org.junit" ]
com.ibm.json; com.ibm.streamsx; java.util; org.junit;
2,905,154
public static Iterable<IMetaAssociation> getMetaAssociations() { return component.core().getMetaAssociations(); }
static Iterable<IMetaAssociation> function() { return component.core().getMetaAssociations(); }
/** * Get all IMetaAssociations. * @return returns all IMetaAssociations. */
Get all IMetaAssociations
getMetaAssociations
{ "repo_name": "mrgroen/qzIndustryPrinting", "path": "test/javasource/com/mendix/core/Core.java", "license": "apache-2.0", "size": 71337 }
[ "com.mendix.systemwideinterfaces.core.meta.IMetaAssociation" ]
import com.mendix.systemwideinterfaces.core.meta.IMetaAssociation;
import com.mendix.systemwideinterfaces.core.meta.*;
[ "com.mendix.systemwideinterfaces" ]
com.mendix.systemwideinterfaces;
1,871,663
public static void renderOxygenTankIndicatorRight(int oxygenInTank1, int oxygenInTank2) { final ScaledResolution scaledresolution = new ScaledResolution(GCCoreOverlayOxygenTankIndicator.minecraft.gameSettings, GCCoreOverlayOxygenTankIndicator.minecraft.displayWidth, GCCoreOverlayOxygenTankIndicator.minecraft.displayHeight); final int i = scaledresolution.getScaledWidth(); scaledresolution.getScaledHeight(); GCCoreOverlayOxygenTankIndicator.minecraft.entityRenderer.setupOverlayRendering(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_ALPHA_TEST); FMLClientHandler.instance().getClient().renderEngine.bindTexture(GCCoreOverlayOxygenTankIndicator.guiTexture); final Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(i - 29, 33.5 + 23.5, -90D, 85 * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 10, 33.5 + 23.5, -90D, (85 + 19) * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 10, 33.5 - 23.5, -90D, (85 + 19) * 0.00390625F, 0 * 0.00390625F); tessellator.addVertexWithUV(i - 29, 33.5 - 23.5, -90D, 85 * 0.00390625F, 0 * 0.00390625F); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(i - 49, 33.5 + 23.5, -90D, 85 * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 30, 33.5 + 23.5, -90D, (85 + 19) * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 30, 33.5 - 23.5, -90D, (85 + 19) * 0.00390625F, 0 * 0.00390625F); tessellator.addVertexWithUV(i - 49, 33.5 - 23.5, -90D, 85 * 0.00390625F, 0 * 0.00390625F); tessellator.draw(); GL11.glDepthMask(true); if (oxygenInTank1 > 0 || oxygenInTank1 <= 0) { final Tessellator tessellator2 = Tessellator.instance; tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 48, 34.5 - 23.5 + oxygenInTank1 / 2, 0, 105 * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5 + oxygenInTank1 / 2, 0, (105 + 17) * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5, 0, (105 + 17) * 0.00390625F, 1 * 0.00390625F); tessellator.addVertexWithUV(i - 48, 34.5 - 23.5, 0, 105 * 0.00390625F, 1 * 0.00390625F); tessellator2.draw(); tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 49, 34.5 - 23.5 + oxygenInTank1 / 2, 0, 66 * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5 + oxygenInTank1 / 2, 0, (66 + 17) * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5 + oxygenInTank1 / 2 - 1, 0, (66 + 17) * 0.00390625F, (oxygenInTank1 / 2 - 1) * 0.00390625F); tessellator.addVertexWithUV(i - 49, 34.5 - 23.5 + oxygenInTank1 / 2 - 1, 0, 66 * 0.00390625F, (oxygenInTank1 / 2 - 1) * 0.00390625F); tessellator2.draw(); } if (oxygenInTank2 > 0 || oxygenInTank2 <= 0) { final Tessellator tessellator2 = Tessellator.instance; tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 28, 34.5 - 23.5 + oxygenInTank2 / 2, 0, 105 * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5 + oxygenInTank2 / 2, 0, (105 + 17) * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5, 0, (105 + 17) * 0.00390625F, 1 * 0.00390625F); tessellator.addVertexWithUV(i - 28, 34.5 - 23.5, 0, 105 * 0.00390625F, 1 * 0.00390625F); tessellator2.draw(); tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 29, 34.5 - 23.5 + oxygenInTank2 / 2, 0, 66 * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5 + oxygenInTank2 / 2, 0, (66 + 17) * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5 + oxygenInTank2 / 2 - 1, 0, (66 + 17) * 0.00390625F, (oxygenInTank2 / 2 - 1) * 0.00390625F); tessellator.addVertexWithUV(i - 29, 34.5 - 23.5 + oxygenInTank2 / 2 - 1, 0, 66 * 0.00390625F, (oxygenInTank2 / 2 - 1) * 0.00390625F); tessellator2.draw(); } }
static void function(int oxygenInTank1, int oxygenInTank2) { final ScaledResolution scaledresolution = new ScaledResolution(GCCoreOverlayOxygenTankIndicator.minecraft.gameSettings, GCCoreOverlayOxygenTankIndicator.minecraft.displayWidth, GCCoreOverlayOxygenTankIndicator.minecraft.displayHeight); final int i = scaledresolution.getScaledWidth(); scaledresolution.getScaledHeight(); GCCoreOverlayOxygenTankIndicator.minecraft.entityRenderer.setupOverlayRendering(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_ALPHA_TEST); FMLClientHandler.instance().getClient().renderEngine.bindTexture(GCCoreOverlayOxygenTankIndicator.guiTexture); final Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(i - 29, 33.5 + 23.5, -90D, 85 * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 10, 33.5 + 23.5, -90D, (85 + 19) * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 10, 33.5 - 23.5, -90D, (85 + 19) * 0.00390625F, 0 * 0.00390625F); tessellator.addVertexWithUV(i - 29, 33.5 - 23.5, -90D, 85 * 0.00390625F, 0 * 0.00390625F); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(i - 49, 33.5 + 23.5, -90D, 85 * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 30, 33.5 + 23.5, -90D, (85 + 19) * 0.00390625F, 47 * 0.00390625F); tessellator.addVertexWithUV(i - 30, 33.5 - 23.5, -90D, (85 + 19) * 0.00390625F, 0 * 0.00390625F); tessellator.addVertexWithUV(i - 49, 33.5 - 23.5, -90D, 85 * 0.00390625F, 0 * 0.00390625F); tessellator.draw(); GL11.glDepthMask(true); if (oxygenInTank1 > 0 oxygenInTank1 <= 0) { final Tessellator tessellator2 = Tessellator.instance; tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 48, 34.5 - 23.5 + oxygenInTank1 / 2, 0, 105 * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5 + oxygenInTank1 / 2, 0, (105 + 17) * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5, 0, (105 + 17) * 0.00390625F, 1 * 0.00390625F); tessellator.addVertexWithUV(i - 48, 34.5 - 23.5, 0, 105 * 0.00390625F, 1 * 0.00390625F); tessellator2.draw(); tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 49, 34.5 - 23.5 + oxygenInTank1 / 2, 0, 66 * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5 + oxygenInTank1 / 2, 0, (66 + 17) * 0.00390625F, oxygenInTank1 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 31, 34.5 - 23.5 + oxygenInTank1 / 2 - 1, 0, (66 + 17) * 0.00390625F, (oxygenInTank1 / 2 - 1) * 0.00390625F); tessellator.addVertexWithUV(i - 49, 34.5 - 23.5 + oxygenInTank1 / 2 - 1, 0, 66 * 0.00390625F, (oxygenInTank1 / 2 - 1) * 0.00390625F); tessellator2.draw(); } if (oxygenInTank2 > 0 oxygenInTank2 <= 0) { final Tessellator tessellator2 = Tessellator.instance; tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 28, 34.5 - 23.5 + oxygenInTank2 / 2, 0, 105 * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5 + oxygenInTank2 / 2, 0, (105 + 17) * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5, 0, (105 + 17) * 0.00390625F, 1 * 0.00390625F); tessellator.addVertexWithUV(i - 28, 34.5 - 23.5, 0, 105 * 0.00390625F, 1 * 0.00390625F); tessellator2.draw(); tessellator2.startDrawingQuads(); tessellator.addVertexWithUV(i - 29, 34.5 - 23.5 + oxygenInTank2 / 2, 0, 66 * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5 + oxygenInTank2 / 2, 0, (66 + 17) * 0.00390625F, oxygenInTank2 / 2 * 0.00390625F); tessellator.addVertexWithUV(i - 11, 34.5 - 23.5 + oxygenInTank2 / 2 - 1, 0, (66 + 17) * 0.00390625F, (oxygenInTank2 / 2 - 1) * 0.00390625F); tessellator.addVertexWithUV(i - 29, 34.5 - 23.5 + oxygenInTank2 / 2 - 1, 0, 66 * 0.00390625F, (oxygenInTank2 / 2 - 1) * 0.00390625F); tessellator2.draw(); } }
/** * Render the GUI that displays oxygen level in tanks */
Render the GUI that displays oxygen level in tanks
renderOxygenTankIndicatorRight
{ "repo_name": "hunator/Galacticraft", "path": "common/micdoodle8/mods/galacticraft/core/client/gui/GCCoreOverlayOxygenTankIndicator.java", "license": "lgpl-3.0", "size": 10852 }
[ "net.minecraft.client.gui.ScaledResolution", "net.minecraft.client.renderer.Tessellator" ]
import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.gui.*; import net.minecraft.client.renderer.*;
[ "net.minecraft.client" ]
net.minecraft.client;
1,915,092
public void initFloatingMenu(){ SubActionButton.Builder itemBuilder = new SubActionButton.Builder(getActivity()); ImageView itemIcon = new ImageView(getActivity()); ImageView itemIcon2 = new ImageView(getActivity()); itemIcon.setImageDrawable(getResources().getDrawable(R.drawable.small_circle_red)); TextView itemText = new TextView(getActivity()); itemText.setText("T.L."); itemIcon.setImageDrawable(getResources().getDrawable(R.drawable.small_circle_orange)); SubActionButton button1 = itemBuilder.setContentView(itemIcon).build(); SubActionButton button2 = itemBuilder.setContentView(itemIcon2).build(); SubActionButton button3 = itemBuilder.setContentView(itemText).build();
void function(){ SubActionButton.Builder itemBuilder = new SubActionButton.Builder(getActivity()); ImageView itemIcon = new ImageView(getActivity()); ImageView itemIcon2 = new ImageView(getActivity()); itemIcon.setImageDrawable(getResources().getDrawable(R.drawable.small_circle_red)); TextView itemText = new TextView(getActivity()); itemText.setText("T.L."); itemIcon.setImageDrawable(getResources().getDrawable(R.drawable.small_circle_orange)); SubActionButton button1 = itemBuilder.setContentView(itemIcon).build(); SubActionButton button2 = itemBuilder.setContentView(itemIcon2).build(); SubActionButton button3 = itemBuilder.setContentView(itemText).build();
/** * init the menu to the time lapse mode */
init the menu to the time lapse mode
initFloatingMenu
{ "repo_name": "mathildegui/pick-share", "path": "app/src/main/java/com/mathilde/customcam/camera/CameraActivity.java", "license": "apache-2.0", "size": 21563 }
[ "android.widget.ImageView", "android.widget.TextView", "com.oguzdev.circularfloatingactionmenu.library.SubActionButton" ]
import android.widget.ImageView; import android.widget.TextView; import com.oguzdev.circularfloatingactionmenu.library.SubActionButton;
import android.widget.*; import com.oguzdev.circularfloatingactionmenu.library.*;
[ "android.widget", "com.oguzdev.circularfloatingactionmenu" ]
android.widget; com.oguzdev.circularfloatingactionmenu;
2,110,994