method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Override public synchronized void updateObject(int columnIndex, Object x) throws SQLException { if (!this.onInsertRow) { if (!this.doingUpdates) { this.doingUpdates = true; syncUpdate(); } this.updater.setObject(columnIndex, x); } else { this.inserter.setObject(columnIndex, x); this.thisRow.setColumnValue(columnIndex - 1, this.inserter.getBytesRepresentation(columnIndex - 1)); } }
synchronized void function(int columnIndex, Object x) throws SQLException { if (!this.onInsertRow) { if (!this.doingUpdates) { this.doingUpdates = true; syncUpdate(); } this.updater.setObject(columnIndex, x); } else { this.inserter.setObject(columnIndex, x); this.thisRow.setColumnValue(columnIndex - 1, this.inserter.getBytesRepresentation(columnIndex - 1)); } }
/** * JDBC 2.0 Update a column with an Object value. The updateXXX() methods * are used to update column values in the current row, or the insert row. * The updateXXX() methods do not update the underlying database, instead * the updateRow() or insertRow() methods are called to update the database. * * @param columnIndex * the first column is 1, the second is 2, ... * @param x * the new column value * * @exception SQLException * if a database-access error occurs */
JDBC 2.0 Update a column with an Object value. The updateXXX() methods are used to update column values in the current row, or the insert row. The updateXXX() methods do not update the underlying database, instead the updateRow() or insertRow() methods are called to update the database
updateObject
{ "repo_name": "slockhart/sql-app", "path": "mysql-connector-java-5.1.34/src/com/mysql/jdbc/UpdatableResultSet.java", "license": "gpl-2.0", "size": 93047 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,284,261
void processHeldItemChange(CPacketHeldItemChange packetIn);
void processHeldItemChange(CPacketHeldItemChange packetIn);
/** * Updates which quickbar slot is selected */
Updates which quickbar slot is selected
processHeldItemChange
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/network/play/INetHandlerPlayServer.java", "license": "gpl-3.0", "size": 6322 }
[ "net.minecraft.network.play.client.CPacketHeldItemChange" ]
import net.minecraft.network.play.client.CPacketHeldItemChange;
import net.minecraft.network.play.client.*;
[ "net.minecraft.network" ]
net.minecraft.network;
1,137,831
public boolean getValueU8AsBoolean() { try { final Element fsApiResult = (Element) xmlDoc.getElementsByTagName("fsapiResponse").item(0); final Element valueNode = (Element) fsApiResult.getElementsByTagName("value").item(0); final Element u8Node = (Element) valueNode.getElementsByTagName("u8").item(0); final String value = getCharacterDataFromElement(u8Node); logger.trace("value is: {}", value); return "1".equals(value); } catch (Exception e) { logger.error("getting Value.U8 failed with {}: {}", e.getClass().getName(), e.getMessage()); return false; } }
boolean function() { try { final Element fsApiResult = (Element) xmlDoc.getElementsByTagName(STR).item(0); final Element valueNode = (Element) fsApiResult.getElementsByTagName("value").item(0); final Element u8Node = (Element) valueNode.getElementsByTagName("u8").item(0); final String value = getCharacterDataFromElement(u8Node); logger.trace(STR, value); return "1".equals(value); } catch (Exception e) { logger.error(STR, e.getClass().getName(), e.getMessage()); return false; } }
/** * read the <value><u8> field as boolean * * @return value.u8 field as bool */
read the <value><u8> field as boolean
getValueU8AsBoolean
{ "repo_name": "Snickermicker/smarthome", "path": "extensions/binding/org.eclipse.smarthome.binding.fsinternetradio/src/main/java/org/eclipse/smarthome/binding/fsinternetradio/internal/radio/FrontierSiliconRadioApiResult.java", "license": "epl-1.0", "size": 8096 }
[ "org.w3c.dom.Element" ]
import org.w3c.dom.Element;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,850,401
private void removeBroadcastRules(String user) { List<String> poolAddresses = SDNUtils.getPoolAddresses(storageSourceService, user); for(String sourceAddress : poolAddresses) { IPredicate[] predicates = { new OperatorPredicate(COLUMN_R_SRC, Operator.EQ, sourceAddress), new OperatorPredicate(COLUMN_R_DST, Operator.EQ, BROADCAST_ADDR)}; CompoundPredicate predicate = new CompoundPredicate(CompoundPredicate.Operator.AND, false, predicates); IResultSet resultSet = storageSourceService.executeQuery(TABLE_RULES, new String[] {COLUMN_R_NAME}, predicate, null); Map<String, Object> row = resultSet.iterator().next().getRow(); // there is only one rule for each source address with destination broadcast String rule = (String)row.get(COLUMN_R_NAME); storageSourceService.deleteRow(SDNProject.TABLE_RULES, rule); staticFlowEntryPusherService.deleteFlow(rule); log.info("Deleted rule {}", rule); } }
void function(String user) { List<String> poolAddresses = SDNUtils.getPoolAddresses(storageSourceService, user); for(String sourceAddress : poolAddresses) { IPredicate[] predicates = { new OperatorPredicate(COLUMN_R_SRC, Operator.EQ, sourceAddress), new OperatorPredicate(COLUMN_R_DST, Operator.EQ, BROADCAST_ADDR)}; CompoundPredicate predicate = new CompoundPredicate(CompoundPredicate.Operator.AND, false, predicates); IResultSet resultSet = storageSourceService.executeQuery(TABLE_RULES, new String[] {COLUMN_R_NAME}, predicate, null); Map<String, Object> row = resultSet.iterator().next().getRow(); String rule = (String)row.get(COLUMN_R_NAME); storageSourceService.deleteRow(SDNProject.TABLE_RULES, rule); staticFlowEntryPusherService.deleteFlow(rule); log.info(STR, rule); } }
/** * removes all the broadcast rules relative to the pool of the specified user * @param user is the owner of the pool * */
removes all the broadcast rules relative to the pool of the specified user
removeBroadcastRules
{ "repo_name": "m1k3lin0/SDNProject", "path": "src/main/java/net/floodlightcontroller/sdnproject/SDNProject.java", "license": "apache-2.0", "size": 23496 }
[ "java.util.List", "java.util.Map", "net.floodlightcontroller.storage.CompoundPredicate", "net.floodlightcontroller.storage.IPredicate", "net.floodlightcontroller.storage.IResultSet", "net.floodlightcontroller.storage.OperatorPredicate" ]
import java.util.List; import java.util.Map; import net.floodlightcontroller.storage.CompoundPredicate; import net.floodlightcontroller.storage.IPredicate; import net.floodlightcontroller.storage.IResultSet; import net.floodlightcontroller.storage.OperatorPredicate;
import java.util.*; import net.floodlightcontroller.storage.*;
[ "java.util", "net.floodlightcontroller.storage" ]
java.util; net.floodlightcontroller.storage;
2,914,708
public ItemStack toItemStack() { return toItemStack(1); }
ItemStack function() { return toItemStack(1); }
/** * Create an ItemStack with one item from this STB item, serializing any item-specific data into the ItemStack. * * @return the new ItemStack */
Create an ItemStack with one item from this STB item, serializing any item-specific data into the ItemStack
toItemStack
{ "repo_name": "desht/sensibletoolbox", "path": "src/main/java/me/desht/sensibletoolbox/api/items/BaseSTBItem.java", "license": "gpl-3.0", "size": 18547 }
[ "org.bukkit.inventory.ItemStack" ]
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.*;
[ "org.bukkit.inventory" ]
org.bukkit.inventory;
1,774,047
public boolean exists(Value keyValue) { Key subKey = makeSubKey(keyValue); return client.exists(this.policy, subKey); }
boolean function(Value keyValue) { Key subKey = makeSubKey(keyValue); return client.exists(this.policy, subKey); }
/** * Does key value exist? * <p> * * @param keyValue key value to lookup * @return true if value exists */
Does key value exist?
exists
{ "repo_name": "aerospike/aerospike-helper", "path": "java/src/main/java/com/aerospike/helper/collections/LargeList.java", "license": "apache-2.0", "size": 16889 }
[ "com.aerospike.client.Key", "com.aerospike.client.Value" ]
import com.aerospike.client.Key; import com.aerospike.client.Value;
import com.aerospike.client.*;
[ "com.aerospike.client" ]
com.aerospike.client;
860,346
default void execute() throws UpgradeException { execute(StringUtils.EMPTY); }
default void execute() throws UpgradeException { execute(StringUtils.EMPTY); }
/** * Executes each {@link UpgradeOperation} for the global repository. * @throws UpgradeException if any of the operations fails */
Executes each <code>UpgradeOperation</code> for the global repository
execute
{ "repo_name": "jdrossl/studio2", "path": "src/main/java/org/craftercms/studio/api/v2/upgrade/UpgradePipeline.java", "license": "gpl-3.0", "size": 1674 }
[ "org.apache.commons.lang3.StringUtils", "org.craftercms.studio.api.v2.exception.UpgradeException" ]
import org.apache.commons.lang3.StringUtils; import org.craftercms.studio.api.v2.exception.UpgradeException;
import org.apache.commons.lang3.*; import org.craftercms.studio.api.v2.exception.*;
[ "org.apache.commons", "org.craftercms.studio" ]
org.apache.commons; org.craftercms.studio;
2,276,470
@NotNull public static String normalisePath(@NotNull String path) { return path.replaceAll("\\\\", "/"); }
static String function(@NotNull String path) { return path.replaceAll("\\\\", "/"); }
/** * Normalise the path to use a UNIX-style syntax. * * @param path the path to normalise * @return the normalised path */
Normalise the path to use a UNIX-style syntax
normalisePath
{ "repo_name": "zielu/IntelliJadPlus", "path": "plugin-lib/src/java/net/stevechaloner/idea/util/paths/Path.java", "license": "apache-2.0", "size": 1463 }
[ "org.jetbrains.annotations.NotNull" ]
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
1,532,429
public AbstractCharIntMap copy() { return (AbstractCharIntMap) clone(); } /** * Compares the specified object with this map for equality. Returns <tt>true</tt> if the given object is also a map * and the two maps represent the same mappings. More formally, two maps <tt>m1</tt> and <tt>m2</tt> represent the * same mappings iff * <pre> * m1.forEachPair( * new CharIntProcedure() { * public boolean apply(char key, int value) { * return m2.containsKey(key) && m2.get(key) == value; * } * } * ) * && * m2.forEachPair( * new CharIntProcedure() { * public boolean apply(char key, int value) { * return m1.containsKey(key) && m1.get(key) == value; * } * }
AbstractCharIntMap function() { return (AbstractCharIntMap) clone(); } /** * Compares the specified object with this map for equality. Returns <tt>true</tt> if the given object is also a map * and the two maps represent the same mappings. More formally, two maps <tt>m1</tt> and <tt>m2</tt> represent the * same mappings iff * <pre> * m1.forEachPair( * new CharIntProcedure() { * public boolean apply(char key, int value) { * return m2.containsKey(key) && m2.get(key) == value; * } * } * ) * && * m2.forEachPair( * new CharIntProcedure() { * public boolean apply(char key, int value) { * return m1.containsKey(key) && m1.get(key) == value; * } * }
/** * Returns a deep copy of the receiver; uses <code>clone()</code> and casts the result. * * @return a deep copy of the receiver. */
Returns a deep copy of the receiver; uses <code>clone()</code> and casts the result
copy
{ "repo_name": "genericDataCompany/hsandbox", "path": "common/mahout-distribution-0.7-hadoop1/math/target/generated-sources/org/apache/mahout/math/map/AbstractCharIntMap.java", "license": "apache-2.0", "size": 16607 }
[ "org.apache.mahout.math.function.CharIntProcedure" ]
import org.apache.mahout.math.function.CharIntProcedure;
import org.apache.mahout.math.function.*;
[ "org.apache.mahout" ]
org.apache.mahout;
2,102,718
public TClusterNode copy(boolean deepcopy, Connection con) throws TorqueException { return copyInto(new TClusterNode(), deepcopy, con); }
TClusterNode function(boolean deepcopy, Connection con) throws TorqueException { return copyInto(new TClusterNode(), deepcopy, con); }
/** * Makes a copy of this object using connection. * It creates a new object filling in the simple attributes. * If the parameter deepcopy is true, it then fills all the * association collections and sets the related objects to * isNew=true. * * @param deepcopy whether to copy the associated objects. * @param con the database connection to read associated objects. */
Makes a copy of this object using connection. It creates a new object filling in the simple attributes. If the parameter deepcopy is true, it then fills all the association collections and sets the related objects to isNew=true
copy
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTClusterNode.java", "license": "gpl-3.0", "size": 50284 }
[ "java.sql.Connection", "org.apache.torque.TorqueException" ]
import java.sql.Connection; import org.apache.torque.TorqueException;
import java.sql.*; import org.apache.torque.*;
[ "java.sql", "org.apache.torque" ]
java.sql; org.apache.torque;
2,797,772
public void addAlias(PValue alias, PInput source) { aliasCollections.put(alias, source); }
void function(PValue alias, PInput source) { aliasCollections.put(alias, source); }
/** * Set the given output as alias for another input, * i.e. there won't be a stream representation in the target DAG. * @param alias * @param source */
Set the given output as alias for another input, i.e. there won't be a stream representation in the target DAG
addAlias
{ "repo_name": "amitsela/beam", "path": "runners/apex/src/main/java/org/apache/beam/runners/apex/translation/TranslationContext.java", "license": "apache-2.0", "size": 7606 }
[ "org.apache.beam.sdk.values.PInput", "org.apache.beam.sdk.values.PValue" ]
import org.apache.beam.sdk.values.PInput; import org.apache.beam.sdk.values.PValue;
import org.apache.beam.sdk.values.*;
[ "org.apache.beam" ]
org.apache.beam;
1,217,330
public int lastInsertedId (Connection conn, Statement istmt, String table, String column) throws SQLException;
int function (Connection conn, Statement istmt, String table, String column) throws SQLException;
/** * Attempts as dialect-agnostic an interface as possible to the ability of certain databases to * auto-generated numerical values for i.e. key columns; there is MySQL's AUTO_INCREMENT and * PostgreSQL's DEFAULT nextval(sequence), for example. * * @param istmt the insert statement that generated the keys. May be null if the ORM doesn't * have the statement handy. * @return the requested inserted id. * @throws SQLException if we are unable to obtain the last inserted id. */
Attempts as dialect-agnostic an interface as possible to the ability of certain databases to auto-generated numerical values for i.e. key columns; there is MySQL's AUTO_INCREMENT and PostgreSQL's DEFAULT nextval(sequence), for example
lastInsertedId
{ "repo_name": "threerings/depot", "path": "src/main/java/com/samskivert/depot/impl/jdbc/DatabaseLiaison.java", "license": "bsd-3-clause", "size": 9587 }
[ "java.sql.Connection", "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
683,504
public static void putValuesForXPathInList(Document document, String xPathQuery, List<String> matchStrings, boolean fragment, int matchNumber) throws TransformerException { String val = null; XObject xObject = XPathAPI.eval(document, xPathQuery, getPrefixResolver(document)); final int objectType = xObject.getType(); if (objectType == XObject.CLASS_NODESET) { NodeList matches = xObject.nodelist(); int length = matches.getLength(); int indexToMatch = matchNumber; if(matchNumber == 0 && length>0) { indexToMatch = JMeterUtils.getRandomInt(length)+1; } for (int i = 0 ; i < length; i++) { Node match = matches.item(i); if(indexToMatch >= 0 && indexToMatch != (i+1)) { continue; } if ( match instanceof Element ){ if (fragment){ val = getNodeContent(match); } else { val = getValueForNode(match); } } else { val = match.getNodeValue(); } matchStrings.add(val); } } else if (objectType == XObject.CLASS_NULL || objectType == XObject.CLASS_UNKNOWN || objectType == XObject.CLASS_UNRESOLVEDVARIABLE) { if (log.isWarnEnabled()) { log.warn("Unexpected object type: {} returned for: {}", xObject.getTypeString(), xPathQuery); } } else { val = xObject.toString(); matchStrings.add(val); } } /** * * @param document XML Document * @return {@link PrefixResolver}
static void function(Document document, String xPathQuery, List<String> matchStrings, boolean fragment, int matchNumber) throws TransformerException { String val = null; XObject xObject = XPathAPI.eval(document, xPathQuery, getPrefixResolver(document)); final int objectType = xObject.getType(); if (objectType == XObject.CLASS_NODESET) { NodeList matches = xObject.nodelist(); int length = matches.getLength(); int indexToMatch = matchNumber; if(matchNumber == 0 && length>0) { indexToMatch = JMeterUtils.getRandomInt(length)+1; } for (int i = 0 ; i < length; i++) { Node match = matches.item(i); if(indexToMatch >= 0 && indexToMatch != (i+1)) { continue; } if ( match instanceof Element ){ if (fragment){ val = getNodeContent(match); } else { val = getValueForNode(match); } } else { val = match.getNodeValue(); } matchStrings.add(val); } } else if (objectType == XObject.CLASS_NULL objectType == XObject.CLASS_UNKNOWN objectType == XObject.CLASS_UNRESOLVEDVARIABLE) { if (log.isWarnEnabled()) { log.warn(STR, xObject.getTypeString(), xPathQuery); } } else { val = xObject.toString(); matchStrings.add(val); } } /** * * @param document XML Document * @return {@link PrefixResolver}
/** * Put in matchStrings results of evaluation * @param document XML document * @param xPathQuery XPath Query * @param matchStrings List of strings that will be filled * @param fragment return fragment * @param matchNumber match number * @throws TransformerException when the internally used xpath engine fails */
Put in matchStrings results of evaluation
putValuesForXPathInList
{ "repo_name": "max3163/jmeter", "path": "src/core/org/apache/jmeter/util/XPathUtil.java", "license": "apache-2.0", "size": 20023 }
[ "java.util.List", "javax.xml.transform.TransformerException", "org.apache.xml.utils.PrefixResolver", "org.apache.xpath.XPathAPI", "org.apache.xpath.objects.XObject", "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import java.util.List; import javax.xml.transform.TransformerException; import org.apache.xml.utils.PrefixResolver; import org.apache.xpath.XPathAPI; import org.apache.xpath.objects.XObject; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import java.util.*; import javax.xml.transform.*; import org.apache.xml.utils.*; import org.apache.xpath.*; import org.apache.xpath.objects.*; import org.w3c.dom.*;
[ "java.util", "javax.xml", "org.apache.xml", "org.apache.xpath", "org.w3c.dom" ]
java.util; javax.xml; org.apache.xml; org.apache.xpath; org.w3c.dom;
951,533
protected String getCapptainActivityName() { return CapptainAgentUtils.buildCapptainActivityName(getClass()); }
String function() { return CapptainAgentUtils.buildCapptainActivityName(getClass()); }
/** * Override this to specify the name reported by your activity. The default implementation returns * the simple name of the class and removes the "Activity" suffix if any (e.g. * "com.mycompany.MainActivity" -> "Main"). * @return the activity name reported by the Capptain service. */
Override this to specify the name reported by your activity. The default implementation returns the simple name of the class and removes the "Activity" suffix if any (e.g. "com.mycompany.MainActivity" -> "Main")
getCapptainActivityName
{ "repo_name": "ogoguel/azure-mobile-engagement-capptain-cordova", "path": "src/android/capptain-sdk-android/src/com/ubikod/capptain/android/sdk/activity/CapptainPreferenceActivity.java", "license": "mit", "size": 2543 }
[ "com.ubikod.capptain.android.sdk.CapptainAgentUtils" ]
import com.ubikod.capptain.android.sdk.CapptainAgentUtils;
import com.ubikod.capptain.android.sdk.*;
[ "com.ubikod.capptain" ]
com.ubikod.capptain;
171,354
public Explosion newExplosion(@Nullable Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; explosion.doExplosionA(); explosion.doExplosionB(false); if (!isSmoking) { explosion.clearAffectedBlockPositions(); } for (EntityPlayer entityplayer : this.playerEntities) { if (entityplayer.getDistanceSq(x, y, z) < 4096.0D) { ((EntityPlayerMP)entityplayer).connection.sendPacket(new SPacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(), (Vec3d)explosion.getPlayerKnockbackMap().get(entityplayer))); } } return explosion; }
Explosion function(@Nullable Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; explosion.doExplosionA(); explosion.doExplosionB(false); if (!isSmoking) { explosion.clearAffectedBlockPositions(); } for (EntityPlayer entityplayer : this.playerEntities) { if (entityplayer.getDistanceSq(x, y, z) < 4096.0D) { ((EntityPlayerMP)entityplayer).connection.sendPacket(new SPacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(), (Vec3d)explosion.getPlayerKnockbackMap().get(entityplayer))); } } return explosion; }
/** * returns a new explosion. Does initiation (at time of writing Explosion is not finished) */
returns a new explosion. Does initiation (at time of writing Explosion is not finished)
newExplosion
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraft/world/WorldServer.java", "license": "lgpl-2.1", "size": 54853 }
[ "javax.annotation.Nullable", "net.minecraft.entity.Entity", "net.minecraft.entity.player.EntityPlayer", "net.minecraft.entity.player.EntityPlayerMP", "net.minecraft.network.play.server.SPacketExplosion", "net.minecraft.util.math.Vec3d" ]
import javax.annotation.Nullable; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.play.server.SPacketExplosion; import net.minecraft.util.math.Vec3d;
import javax.annotation.*; import net.minecraft.entity.*; import net.minecraft.entity.player.*; import net.minecraft.network.play.server.*; import net.minecraft.util.math.*;
[ "javax.annotation", "net.minecraft.entity", "net.minecraft.network", "net.minecraft.util" ]
javax.annotation; net.minecraft.entity; net.minecraft.network; net.minecraft.util;
1,035,229
@Deprecated public void generateJavaFiles(List<ApiImplementor> implementors) throws IOException { generateAPIFiles(implementors); }
void function(List<ApiImplementor> implementors) throws IOException { generateAPIFiles(implementors); }
/** * Generates the API client files of the given API implementors. * * @param implementors the implementors * @throws IOException if an error occurred while generating the APIs. * @deprecated (2.6.0) Use {@link #generateAPIFiles(List)} instead. */
Generates the API client files of the given API implementors
generateJavaFiles
{ "repo_name": "zapbot/zaproxy", "path": "src/org/zaproxy/zap/extension/api/JavaAPIGenerator.java", "license": "apache-2.0", "size": 10101 }
[ "java.io.IOException", "java.util.List" ]
import java.io.IOException; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,918,094
private NodeRef getLatestVersionRecord(NodeRef nodeRef) { NodeRef versionRecord = null; // wire record up to previous record VersionHistory versionHistory = getVersionHistory(nodeRef); if (versionHistory != null) { Collection<Version> previousVersions = versionHistory.getAllVersions(); for (Version previousVersion : previousVersions) { // look for the associated record final NodeRef previousRecord = (NodeRef)previousVersion.getVersionProperties().get(PROP_VERSION_RECORD); if (previousRecord != null) { versionRecord = previousRecord; break; } } } return versionRecord; }
NodeRef function(NodeRef nodeRef) { NodeRef versionRecord = null; VersionHistory versionHistory = getVersionHistory(nodeRef); if (versionHistory != null) { Collection<Version> previousVersions = versionHistory.getAllVersions(); for (Version previousVersion : previousVersions) { final NodeRef previousRecord = (NodeRef)previousVersion.getVersionProperties().get(PROP_VERSION_RECORD); if (previousRecord != null) { versionRecord = previousRecord; break; } } } return versionRecord; }
/** * Helper to get the latest version record for a given document (ie non-record) * * @param nodeRef node reference * @return NodeRef latest version record, null otherwise */
Helper to get the latest version record for a given document (ie non-record)
getLatestVersionRecord
{ "repo_name": "dnacreative/records-management", "path": "rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java", "license": "lgpl-3.0", "size": 33420 }
[ "java.util.Collection", "org.alfresco.service.cmr.repository.NodeRef", "org.alfresco.service.cmr.version.Version", "org.alfresco.service.cmr.version.VersionHistory" ]
import java.util.Collection; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.version.Version; import org.alfresco.service.cmr.version.VersionHistory;
import java.util.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.cmr.version.*;
[ "java.util", "org.alfresco.service" ]
java.util; org.alfresco.service;
2,643,761
public byte[] decrypt(byte[] bytes) { byte[] resp = null; try { resp = crypt(bytes, Cipher.DECRYPT_MODE); } catch (Exception e) { return null; } return resp; }
byte[] function(byte[] bytes) { byte[] resp = null; try { resp = crypt(bytes, Cipher.DECRYPT_MODE); } catch (Exception e) { return null; } return resp; }
/** * Decrypt the byte array with the secret key. * @param bytes The array of bytes to decrypt. */
Decrypt the byte array with the secret key
decrypt
{ "repo_name": "zamentur/ofbiz_ynh", "path": "sources/framework/base/src/org/ofbiz/base/crypto/BlowFishCrypt.java", "license": "apache-2.0", "size": 5233 }
[ "javax.crypto.Cipher" ]
import javax.crypto.Cipher;
import javax.crypto.*;
[ "javax.crypto" ]
javax.crypto;
2,614,105
private void initLocalizations(String[][] localizations) { if (localizations != null) { publicRuleSetNames = localizations[0].clone(); Map<String, String[]> m = new HashMap<String, String[]>(); for (int i = 1; i < localizations.length; ++i) { String[] data = localizations[i]; String loc = data[0]; String[] names = new String[data.length-1]; if (names.length != publicRuleSetNames.length) { throw new IllegalArgumentException("public name length: " + publicRuleSetNames.length + " != localized names[" + i + "] length: " + names.length); } System.arraycopy(data, 1, names, 0, names.length); m.put(loc, names); } if (!m.isEmpty()) { ruleSetDisplayNames = m; } } }
void function(String[][] localizations) { if (localizations != null) { publicRuleSetNames = localizations[0].clone(); Map<String, String[]> m = new HashMap<String, String[]>(); for (int i = 1; i < localizations.length; ++i) { String[] data = localizations[i]; String loc = data[0]; String[] names = new String[data.length-1]; if (names.length != publicRuleSetNames.length) { throw new IllegalArgumentException(STR + publicRuleSetNames.length + STR + i + STR + names.length); } System.arraycopy(data, 1, names, 0, names.length); m.put(loc, names); } if (!m.isEmpty()) { ruleSetDisplayNames = m; } } }
/** * Take the localizations array and create a Map from the locale strings to * the localization arrays. */
Take the localizations array and create a Map from the locale strings to the localization arrays
initLocalizations
{ "repo_name": "google/j2objc", "path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java", "license": "apache-2.0", "size": 90893 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
7,027
protected void dispatch(Object event, EventHandler wrapper) { try { wrapper.handleEvent(event); } catch (InvocationTargetException e) { throwRuntimeException( "Could not dispatch event: " + event.getClass() + " to handler " + wrapper, e); } }
void function(Object event, EventHandler wrapper) { try { wrapper.handleEvent(event); } catch (InvocationTargetException e) { throwRuntimeException( STR + event.getClass() + STR + wrapper, e); } }
/** * Dispatches {@code event} to the handler in {@code wrapper}. This method is an appropriate override point for * subclasses that wish to make event delivery asynchronous. * * @param event event to dispatch. * @param wrapper wrapper that will call the handler. */
Dispatches event to the handler in wrapper. This method is an appropriate override point for subclasses that wish to make event delivery asynchronous
dispatch
{ "repo_name": "adennie/otto", "path": "library/src/main/java/com/squareup/otto/Bus.java", "license": "apache-2.0", "size": 17531 }
[ "java.lang.reflect.InvocationTargetException" ]
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,509,922
public static OptionalShouldContain shouldContain(OptionalDouble optional, double expectedValue) { return optional.isPresent() ? new OptionalShouldContain(EXPECTING_TO_CONTAIN, optional, expectedValue) : shouldContain(expectedValue); }
static OptionalShouldContain function(OptionalDouble optional, double expectedValue) { return optional.isPresent() ? new OptionalShouldContain(EXPECTING_TO_CONTAIN, optional, expectedValue) : shouldContain(expectedValue); }
/** * Indicates that the provided {@link java.util.OptionalDouble} does not contain the provided argument. * * @param optional the {@link java.util.OptionalDouble} which contains a value. * @param expectedValue the value we expect to be in the provided {@link java.util.OptionalDouble}. * @return a error message factory */
Indicates that the provided <code>java.util.OptionalDouble</code> does not contain the provided argument
shouldContain
{ "repo_name": "xasx/assertj-core", "path": "src/main/java/org/assertj/core/error/OptionalShouldContain.java", "license": "apache-2.0", "size": 5193 }
[ "java.util.OptionalDouble" ]
import java.util.OptionalDouble;
import java.util.*;
[ "java.util" ]
java.util;
716,797
public static InetAddress getSubnetPrefix(InetAddress ip, int maskLen) { int bytes = maskLen / 8; int bits = maskLen % 8; byte modifiedByte; byte[] sn = ip.getAddress(); if (bits > 0) { modifiedByte = (byte) (sn[bytes] >> (8 - bits)); sn[bytes] = (byte) (modifiedByte << (8 - bits)); bytes++; } for (; bytes < sn.length; bytes++) { sn[bytes] = (byte) (0); } try { return InetAddress.getByAddress(sn); } catch (UnknownHostException e) { return null; } }
static InetAddress function(InetAddress ip, int maskLen) { int bytes = maskLen / 8; int bits = maskLen % 8; byte modifiedByte; byte[] sn = ip.getAddress(); if (bits > 0) { modifiedByte = (byte) (sn[bytes] >> (8 - bits)); sn[bytes] = (byte) (modifiedByte << (8 - bits)); bytes++; } for (; bytes < sn.length; bytes++) { sn[bytes] = (byte) (0); } try { return InetAddress.getByAddress(sn); } catch (UnknownHostException e) { return null; } }
/** * Given an IP address and a prefix network mask length, it returns the * equivalent subnet prefix IP address Example: for ip = "172.28.30.254" and * maskLen = 25 it will return "172.28.30.128" * * @param ip * the IP address in InetAddress form * @param maskLen * the length of the prefix network mask * @return the subnet prefix IP address in InetAddress form */
Given an IP address and a prefix network mask length, it returns the equivalent subnet prefix IP address Example: for ip = "172.28.30.254" and maskLen = 25 it will return "172.28.30.128"
getSubnetPrefix
{ "repo_name": "xiaohanz/softcontroller", "path": "opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java", "license": "epl-1.0", "size": 16254 }
[ "java.net.InetAddress", "java.net.UnknownHostException" ]
import java.net.InetAddress; import java.net.UnknownHostException;
import java.net.*;
[ "java.net" ]
java.net;
121,089
@Override public void push(final Image<?, ?> image) throws ImageError { if (!(image instanceof Gray8Image)) { throw new ImageError(ImageError.PACKAGE.ALGORITHM, AlgorithmErrorCodes.IMAGE_NOT_GRAY8IMAGE, image.toString(), null, null); } if ((image.getWidth() < nWidth) || (image.getHeight() < nHeight)) { throw new ImageError(ImageError.PACKAGE.ALGORITHM, AlgorithmErrorCodes.IMAGE_TOO_SMALL, image.toString(), new Integer(nWidth).toString(), new Integer(nHeight).toString()); } imageInput = (Gray8Image<?>) image; // we want to find the largest integer l such that // (l-1) * w + w < iw // where l = computed limit on index // w = subimage width or height // iw = image width or height // or l = iw / w (truncated) // Java division truncates nHorizLimit = (image.getWidth() - nWidth) / nXOffset; nVertLimit = (image.getHeight() - nHeight) / nYOffset; nHorizIndex = 0; nVertIndex = 0; }
void function(final Image<?, ?> image) throws ImageError { if (!(image instanceof Gray8Image)) { throw new ImageError(ImageError.PACKAGE.ALGORITHM, AlgorithmErrorCodes.IMAGE_NOT_GRAY8IMAGE, image.toString(), null, null); } if ((image.getWidth() < nWidth) (image.getHeight() < nHeight)) { throw new ImageError(ImageError.PACKAGE.ALGORITHM, AlgorithmErrorCodes.IMAGE_TOO_SMALL, image.toString(), new Integer(nWidth).toString(), new Integer(nHeight).toString()); } imageInput = (Gray8Image<?>) image; nHorizLimit = (image.getWidth() - nWidth) / nXOffset; nVertLimit = (image.getHeight() - nHeight) / nYOffset; nHorizIndex = 0; nVertIndex = 0; }
/** * Reinitializes the subimage generator and prepares it to generate the * first Gray8OffsetImage for the new input. * * @param image * The new input image (which must be of type Gray8Image). * @throws ImageError * if image is not of type Gray8Image, or is too small (less * than the size of the subimages we're supposed to be * generating). */
Reinitializes the subimage generator and prepares it to generate the first Gray8OffsetImage for the new input
push
{ "repo_name": "daleasberry/ojil-core", "path": "src/main/java/com/github/ojil/algorithm/Gray8SubImageGenerator.java", "license": "lgpl-3.0", "size": 6984 }
[ "com.github.ojil.core.Gray8Image", "com.github.ojil.core.Image", "com.github.ojil.core.ImageError" ]
import com.github.ojil.core.Gray8Image; import com.github.ojil.core.Image; import com.github.ojil.core.ImageError;
import com.github.ojil.core.*;
[ "com.github.ojil" ]
com.github.ojil;
1,436,697
private void extractArchive(ArchiveInputStream input, File destination, Engine engine) throws ArchiveExtractionException { ArchiveEntry entry; try { while ((entry = input.getNextEntry()) != null) { if (entry.isDirectory()) { final File d = new File(destination, entry.getName()); if (!d.exists()) { if (!d.mkdirs()) { final String msg = String.format("Unable to create directory '%s'.", d.getAbsolutePath()); throw new AnalysisException(msg); } } } else { final File file = new File(destination, entry.getName()); if (engine.accept(file)) { LOGGER.debug("Extracting '{}'", file.getPath()); BufferedOutputStream bos = null; FileOutputStream fos = null; try { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs()) { final String msg = String.format("Unable to build directory '%s'.", parent.getAbsolutePath()); throw new AnalysisException(msg); } } fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos, BUFFER_SIZE); int count; final byte[] data = new byte[BUFFER_SIZE]; while ((count = input.read(data, 0, BUFFER_SIZE)) != -1) { bos.write(data, 0, count); } bos.flush(); } catch (FileNotFoundException ex) { LOGGER.debug("", ex); final String msg = String.format("Unable to find file '%s'.", file.getName()); throw new AnalysisException(msg, ex); } catch (IOException ex) { LOGGER.debug("", ex); final String msg = String.format("IO Exception while parsing file '%s'.", file.getName()); throw new AnalysisException(msg, ex); } finally { if (bos != null) { try { bos.close(); } catch (IOException ex) { LOGGER.trace("", ex); } } if (fos != null) { try { fos.close(); } catch (IOException ex) { LOGGER.trace("", ex); } } } } } } } catch (IOException ex) { throw new ArchiveExtractionException(ex); } catch (Throwable ex) { throw new ArchiveExtractionException(ex); } finally { if (input != null) { try { input.close(); } catch (IOException ex) { LOGGER.trace("", ex); } } } }
void function(ArchiveInputStream input, File destination, Engine engine) throws ArchiveExtractionException { ArchiveEntry entry; try { while ((entry = input.getNextEntry()) != null) { if (entry.isDirectory()) { final File d = new File(destination, entry.getName()); if (!d.exists()) { if (!d.mkdirs()) { final String msg = String.format(STR, d.getAbsolutePath()); throw new AnalysisException(msg); } } } else { final File file = new File(destination, entry.getName()); if (engine.accept(file)) { LOGGER.debug(STR, file.getPath()); BufferedOutputStream bos = null; FileOutputStream fos = null; try { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs()) { final String msg = String.format(STR, parent.getAbsolutePath()); throw new AnalysisException(msg); } } fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos, BUFFER_SIZE); int count; final byte[] data = new byte[BUFFER_SIZE]; while ((count = input.read(data, 0, BUFFER_SIZE)) != -1) { bos.write(data, 0, count); } bos.flush(); } catch (FileNotFoundException ex) { LOGGER.debug(STRUnable to find file '%s'.", file.getName()); throw new AnalysisException(msg, ex); } catch (IOException ex) { LOGGER.debug(STRIO Exception while parsing file '%s'.STRSTRSTR", ex); } } } }
/** * Extracts files from an archive. * * @param input the archive to extract files from * @param destination the location to write the files too * @param engine the dependency-check engine * @throws ArchiveExtractionException thrown if there is an exception extracting files from the archive */
Extracts files from an archive
extractArchive
{ "repo_name": "dwvisser/DependencyCheck", "path": "dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java", "license": "apache-2.0", "size": 21176 }
[ "java.io.BufferedOutputStream", "java.io.File", "java.io.FileNotFoundException", "java.io.FileOutputStream", "java.io.IOException", "org.apache.commons.compress.archivers.ArchiveEntry", "org.apache.commons.compress.archivers.ArchiveInputStream", "org.owasp.dependencycheck.Engine", "org.owasp.dependencycheck.analyzer.exception.AnalysisException", "org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException" ]
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveInputStream; import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.analyzer.exception.AnalysisException; import org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException;
import java.io.*; import org.apache.commons.compress.archivers.*; import org.owasp.dependencycheck.*; import org.owasp.dependencycheck.analyzer.exception.*;
[ "java.io", "org.apache.commons", "org.owasp.dependencycheck" ]
java.io; org.apache.commons; org.owasp.dependencycheck;
945,226
public boolean load(OpenJPAStateManager sm, NdbOpenJPAStoreManager store, BitSet fields, JDBCFetchConfiguration fetch, Object context) throws SQLException { if (logger.isDetailEnabled()) { StringBuilder buffer = new StringBuilder("load for "); buffer.append(typeName); buffer.append(" for fields "); buffer.append(NdbOpenJPAUtility.printBitSet(sm, fields)); logger.detail(buffer.toString()); } boolean loadedAny = false; List<NdbOpenJPADomainFieldHandlerImpl> requestedFields = new ArrayList<NdbOpenJPADomainFieldHandlerImpl>(); for (int i=fields.nextSetBit(0); i>=0; i=fields.nextSetBit(i+1)) { if (!sm.getLoaded().get(i)) { // this field is not loaded NdbOpenJPADomainFieldHandlerImpl fieldHandler = fieldHandlers[i]; if (logger.isDebugEnabled()) logger.debug( "loading field " + fieldHandler.getName() + " for column " + fieldHandler.getColumnName()); if (fieldHandler.isRelation()) { // if relation, load each field individually with its own query fieldHandler.load(sm, store, fetch); loadedAny = true; } else { // if not relation, get a list of all fields to load with one lookup requestedFields.add(fieldHandler); } } } if (requestedFields.size() != 0) { // load fields via primary key lookup NdbOpenJPAResult result = store.lookup(sm, this, requestedFields); for (NdbOpenJPADomainFieldHandlerImpl fieldHandler: fieldHandlers) { loadedAny = true; fieldHandler.load(sm, store, fetch, result); } } return loadedAny; }
boolean function(OpenJPAStateManager sm, NdbOpenJPAStoreManager store, BitSet fields, JDBCFetchConfiguration fetch, Object context) throws SQLException { if (logger.isDetailEnabled()) { StringBuilder buffer = new StringBuilder(STR); buffer.append(typeName); buffer.append(STR); buffer.append(NdbOpenJPAUtility.printBitSet(sm, fields)); logger.detail(buffer.toString()); } boolean loadedAny = false; List<NdbOpenJPADomainFieldHandlerImpl> requestedFields = new ArrayList<NdbOpenJPADomainFieldHandlerImpl>(); for (int i=fields.nextSetBit(0); i>=0; i=fields.nextSetBit(i+1)) { if (!sm.getLoaded().get(i)) { NdbOpenJPADomainFieldHandlerImpl fieldHandler = fieldHandlers[i]; if (logger.isDebugEnabled()) logger.debug( STR + fieldHandler.getName() + STR + fieldHandler.getColumnName()); if (fieldHandler.isRelation()) { fieldHandler.load(sm, store, fetch); loadedAny = true; } else { requestedFields.add(fieldHandler); } } } if (requestedFields.size() != 0) { NdbOpenJPAResult result = store.lookup(sm, this, requestedFields); for (NdbOpenJPADomainFieldHandlerImpl fieldHandler: fieldHandlers) { loadedAny = true; fieldHandler.load(sm, store, fetch, result); } } return loadedAny; }
/** Load the fields for the persistent instance owned by the sm. * @param sm the StateManager * @param store the StoreManager * @param fields the fields to load * @param fetch the FetchConfiguration * @return true if any field was loaded */
Load the fields for the persistent instance owned by the sm
load
{ "repo_name": "greenlion/mysql-server", "path": "storage/ndb/clusterj/clusterj-openjpa/src/main/java/com/mysql/clusterj/openjpa/NdbOpenJPADomainTypeHandlerImpl.java", "license": "gpl-2.0", "size": 30756 }
[ "java.sql.SQLException", "java.util.ArrayList", "java.util.BitSet", "java.util.List", "org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration", "org.apache.openjpa.kernel.OpenJPAStateManager" ]
import java.sql.SQLException; import java.util.ArrayList; import java.util.BitSet; import java.util.List; import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration; import org.apache.openjpa.kernel.OpenJPAStateManager;
import java.sql.*; import java.util.*; import org.apache.openjpa.jdbc.kernel.*; import org.apache.openjpa.kernel.*;
[ "java.sql", "java.util", "org.apache.openjpa" ]
java.sql; java.util; org.apache.openjpa;
2,510,228
private void flushAggregatorsToWorker(WorkerInfo worker) { byte[] aggregatorData = sendAggregatorCache.removeAggregators(worker.getTaskId()); nettyClient.sendWritableRequest( worker.getTaskId(), new SendAggregatorsToOwnerRequest(aggregatorData, service.getMasterInfo().getTaskId())); }
void function(WorkerInfo worker) { byte[] aggregatorData = sendAggregatorCache.removeAggregators(worker.getTaskId()); nettyClient.sendWritableRequest( worker.getTaskId(), new SendAggregatorsToOwnerRequest(aggregatorData, service.getMasterInfo().getTaskId())); }
/** * Send aggregators from cache to worker. * * @param worker Worker which we want to send aggregators to */
Send aggregators from cache to worker
flushAggregatorsToWorker
{ "repo_name": "dcrankshaw/giraph", "path": "giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyMasterClient.java", "license": "apache-2.0", "size": 4366 }
[ "org.apache.giraph.comm.requests.SendAggregatorsToOwnerRequest", "org.apache.giraph.worker.WorkerInfo" ]
import org.apache.giraph.comm.requests.SendAggregatorsToOwnerRequest; import org.apache.giraph.worker.WorkerInfo;
import org.apache.giraph.comm.requests.*; import org.apache.giraph.worker.*;
[ "org.apache.giraph" ]
org.apache.giraph;
2,533,058
public static void disconnectVpnConnectionsFromVirtualNetworkGateway( com.azure.resourcemanager.AzureResourceManager azure) { azure .networks() .manager() .serviceClient() .getVirtualNetworkGateways() .disconnectVirtualNetworkGatewayVpnConnections( "vpn-gateway-test", "vpngateway", new P2SVpnConnectionRequest().withVpnConnectionIds(Arrays.asList("vpnconnId1", "vpnconnId2")), Context.NONE); }
static void function( com.azure.resourcemanager.AzureResourceManager azure) { azure .networks() .manager() .serviceClient() .getVirtualNetworkGateways() .disconnectVirtualNetworkGatewayVpnConnections( STR, STR, new P2SVpnConnectionRequest().withVpnConnectionIds(Arrays.asList(STR, STR)), Context.NONE); }
/** * Sample code: Disconnect VpnConnections from Virtual Network Gateway. * * @param azure The entry point for accessing resource management APIs in Azure. */
Sample code: Disconnect VpnConnections from Virtual Network Gateway
disconnectVpnConnectionsFromVirtualNetworkGateway
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsSamples.java", "license": "mit", "size": 1441 }
[ "com.azure.core.util.Context", "com.azure.resourcemanager.network.models.P2SVpnConnectionRequest", "java.util.Arrays" ]
import com.azure.core.util.Context; import com.azure.resourcemanager.network.models.P2SVpnConnectionRequest; import java.util.Arrays;
import com.azure.core.util.*; import com.azure.resourcemanager.network.models.*; import java.util.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.util" ]
com.azure.core; com.azure.resourcemanager; java.util;
2,737,683
protected List<String> readFinalOutputFile(Path finalPath, Configuration conf, String encoding) throws IOException { FileSystem fs = finalPath.getFileSystem(conf); return readFromStream(new InputStreamReader(fs.open(finalPath), encoding)); }
List<String> function(Path finalPath, Configuration conf, String encoding) throws IOException { FileSystem fs = finalPath.getFileSystem(conf); return readFromStream(new InputStreamReader(fs.open(finalPath), encoding)); }
/** * Read final output file. * * @param finalPath the final path * @param conf the conf * @param encoding the encoding * @return the list * @throws IOException Signals that an I/O exception has occurred. */
Read final output file
readFinalOutputFile
{ "repo_name": "guptapuneet/lens", "path": "lens-query-lib/src/test/java/org/apache/lens/lib/query/TestAbstractFileFormatter.java", "license": "apache-2.0", "size": 16030 }
[ "java.io.IOException", "java.io.InputStreamReader", "java.util.List", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path" ]
import java.io.IOException; import java.io.InputStreamReader; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;
import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
988,488
public void testPublicCloneable() { XYBubbleRenderer r1 = new XYBubbleRenderer(); assertTrue(r1 instanceof PublicCloneable); }
void function() { XYBubbleRenderer r1 = new XYBubbleRenderer(); assertTrue(r1 instanceof PublicCloneable); }
/** * Verify that this class implements {@link PublicCloneable}. */
Verify that this class implements <code>PublicCloneable</code>
testPublicCloneable
{ "repo_name": "JSansalone/JFreeChart", "path": "tests/org/jfree/chart/renderer/xy/junit/XYBubbleRendererTests.java", "license": "lgpl-2.1", "size": 6847 }
[ "org.jfree.chart.renderer.xy.XYBubbleRenderer", "org.jfree.util.PublicCloneable" ]
import org.jfree.chart.renderer.xy.XYBubbleRenderer; import org.jfree.util.PublicCloneable;
import org.jfree.chart.renderer.xy.*; import org.jfree.util.*;
[ "org.jfree.chart", "org.jfree.util" ]
org.jfree.chart; org.jfree.util;
1,764,021
@Override public boolean allocateHostForVm(Vm vm) { int requiredPes = vm.getNumberOfPes(); boolean result = false; int tries = 0; List<Integer> freePesTmp = new ArrayList<Integer>(); for (Integer freePes : getFreePes()) { freePesTmp.add(freePes); } if (!getVmTable().containsKey(vm.getUid())) { // if this vm was not created do {// we still trying until we find a host or until we try all of them int moreFree = Integer.MIN_VALUE; int idx = -1; // we want the host with less pes in use for (int i = 0; i < freePesTmp.size(); i++) { if (freePesTmp.get(i) > moreFree) { moreFree = freePesTmp.get(i); idx = i; } } Host host = getHostList().get(idx); result = host.vmCreate(vm); if (result) { // if vm were succesfully created in the host getVmTable().put(vm.getUid(), host); getUsedPes().put(vm.getUid(), requiredPes); getFreePes().set(idx, getFreePes().get(idx) - requiredPes); result = true; break; } else { freePesTmp.set(idx, Integer.MIN_VALUE); } tries++; } while (!result && tries < getFreePes().size()); } return result; }
boolean function(Vm vm) { int requiredPes = vm.getNumberOfPes(); boolean result = false; int tries = 0; List<Integer> freePesTmp = new ArrayList<Integer>(); for (Integer freePes : getFreePes()) { freePesTmp.add(freePes); } if (!getVmTable().containsKey(vm.getUid())) { do { int moreFree = Integer.MIN_VALUE; int idx = -1; for (int i = 0; i < freePesTmp.size(); i++) { if (freePesTmp.get(i) > moreFree) { moreFree = freePesTmp.get(i); idx = i; } } Host host = getHostList().get(idx); result = host.vmCreate(vm); if (result) { getVmTable().put(vm.getUid(), host); getUsedPes().put(vm.getUid(), requiredPes); getFreePes().set(idx, getFreePes().get(idx) - requiredPes); result = true; break; } else { freePesTmp.set(idx, Integer.MIN_VALUE); } tries++; } while (!result && tries < getFreePes().size()); } return result; }
/** * Allocates a host for a given VM. * * @param vm VM specification * @return $true if the host could be allocated; $false otherwise * @pre $none * @post $none */
Allocates a host for a given VM
allocateHostForVm
{ "repo_name": "ovidiumarcu/dynamiccloudsim", "path": "src/org/cloudbus/cloudsim/VmAllocationPolicySimple.java", "license": "lgpl-3.0", "size": 5556 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,714,663
@Test public void testPathValues() throws SetUpException { Setting<File> s1 = new Setting<>("s1", PATH, false, null, ""); Setting<File> s2 = new Setting<>("s2", PATH, true, "some/path/tofile", ""); Setting<File> s3 = new Setting<>("s3", PATH, true, "some/path/tofile", ""); Properties props = new Properties(); props.setProperty("s2", "other/path/todir/"); Configuration config = new Configuration(props); config.registerSetting(s1); config.registerSetting(s2); config.registerSetting(s3); assertThat(config.getValue(s1), nullValue()); assertThat(config.getValue(s2), is(new File("other/path/todir/"))); assertThat(config.getValue(s3), is(new File("some/path/tofile"))); }
void function() throws SetUpException { Setting<File> s1 = new Setting<>("s1", PATH, false, null, STRs2STRsome/path/tofileSTRSTRs3STRsome/path/tofileSTRSTRs2STRother/path/todir/STRother/path/todir/STRsome/path/tofile"))); }
/** * Tests that path values are handled correctly. * * @throws SetUpException unwanted. */
Tests that path values are handled correctly
testPathValues
{ "repo_name": "KernelHaven/KernelHaven", "path": "test/net/ssehub/kernel_haven/config/ConfigurationTest.java", "license": "apache-2.0", "size": 31348 }
[ "java.io.File", "net.ssehub.kernel_haven.SetUpException" ]
import java.io.File; import net.ssehub.kernel_haven.SetUpException;
import java.io.*; import net.ssehub.kernel_haven.*;
[ "java.io", "net.ssehub.kernel_haven" ]
java.io; net.ssehub.kernel_haven;
951,710
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeLater(new Runnable() {
/** * Launch the application. */
Launch the application
main
{ "repo_name": "martingh15/TPJava", "path": "TPJavaNotebook/src/ui/Menu.java", "license": "mpl-2.0", "size": 5815 }
[ "java.awt.EventQueue" ]
import java.awt.EventQueue;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,889,417
public List<String> getAssertionConsumerServiceLocations(final String binding) { return getAssertionConsumerServices() .stream() .filter(acs -> acs.getBinding().equalsIgnoreCase(binding)) .map(acs -> StringUtils.defaultIfBlank(acs.getResponseLocation(), acs.getLocation())) .collect(Collectors.toList()); }
List<String> function(final String binding) { return getAssertionConsumerServices() .stream() .filter(acs -> acs.getBinding().equalsIgnoreCase(binding)) .map(acs -> StringUtils.defaultIfBlank(acs.getResponseLocation(), acs.getLocation())) .collect(Collectors.toList()); }
/** * Get locations of all assertion consumer services for the given binding. * * @param binding the binding * @return the assertion consumer service */
Get locations of all assertion consumer services for the given binding
getAssertionConsumerServiceLocations
{ "repo_name": "fogbeam/cas_mirror", "path": "support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java", "license": "apache-2.0", "size": 13726 }
[ "java.util.List", "java.util.stream.Collectors", "org.apache.commons.lang3.StringUtils" ]
import java.util.List; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.stream.*; import org.apache.commons.lang3.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
597,693
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_add: Intent intent = new Intent(mContext, OSMActivity.class); startActivity(intent); break; } return super.onOptionsItemSelected(item); }
boolean function(MenuItem item) { switch (item.getItemId()) { case R.id.menu_add: Intent intent = new Intent(mContext, OSMActivity.class); startActivity(intent); break; } return super.onOptionsItemSelected(item); }
/** * Handle the clicked options in this fragment. */
Handle the clicked options in this fragment
onOptionsItemSelected
{ "repo_name": "rgmf/libresportgps", "path": "app/src/main/java/es/rgmf/libresportgps/fragment/SegmentListFragment.java", "license": "gpl-3.0", "size": 9922 }
[ "android.content.Intent", "android.view.MenuItem", "es.rgmf.libresportgps.OSMActivity" ]
import android.content.Intent; import android.view.MenuItem; import es.rgmf.libresportgps.OSMActivity;
import android.content.*; import android.view.*; import es.rgmf.libresportgps.*;
[ "android.content", "android.view", "es.rgmf.libresportgps" ]
android.content; android.view; es.rgmf.libresportgps;
1,688,998
@Test public final void testCreateInterfaceAlreadyOpenExceptionMessageAndCauseNull() { // Setup the resources for the test. String message = "This is the message"; Throwable cause = null; // Call the method under test. InterfaceAlreadyOpenException e = new InterfaceAlreadyOpenException(message, cause); // Verify the result. assertThat("Created 'InterfaceAlreadyOpenException' does not have the expected message", e.getMessage(), is(equalTo(message))); assertThat("Created 'InterfaceAlreadyOpenException' does not have the expected cause", e.getCause(), is(equalTo(cause))); }
final void function() { String message = STR; Throwable cause = null; InterfaceAlreadyOpenException e = new InterfaceAlreadyOpenException(message, cause); assertThat(STR, e.getMessage(), is(equalTo(message))); assertThat(STR, e.getCause(), is(equalTo(cause))); }
/** * Test method for {@link com.digi.xbee.api.exceptions.InterfaceAlreadyOpenException#InterfaceAlreadyOpenException(String, Throwable)}. */
Test method for <code>com.digi.xbee.api.exceptions.InterfaceAlreadyOpenException#InterfaceAlreadyOpenException(String, Throwable)</code>
testCreateInterfaceAlreadyOpenExceptionMessageAndCauseNull
{ "repo_name": "GUBotDev/XBeeJavaLibrary", "path": "library/src/test/java/com/digi/xbee/api/exceptions/InterfaceAlreadyOpenExceptionTest.java", "license": "mpl-2.0", "size": 6486 }
[ "org.hamcrest.core.Is", "org.junit.Assert" ]
import org.hamcrest.core.Is; import org.junit.Assert;
import org.hamcrest.core.*; import org.junit.*;
[ "org.hamcrest.core", "org.junit" ]
org.hamcrest.core; org.junit;
1,491,480
MultiFactorAuthenticationSupportingWebApplicationService computeHighestRankingAuthenticationMethod( MultiFactorAuthenticationTransactionContext mfaTransaction);
MultiFactorAuthenticationSupportingWebApplicationService computeHighestRankingAuthenticationMethod( MultiFactorAuthenticationTransactionContext mfaTransaction);
/** * Calculates the highest ranking possible authentication method from the list of the requested ones. * * @param mfaTransaction mfa transaction encapsulating possible requested authentication methods * * @return mfa service representing the highest possible ranking authentication method or null * if implementations are unable to perform such calculation */
Calculates the highest ranking possible authentication method from the list of the requested ones
computeHighestRankingAuthenticationMethod
{ "repo_name": "bzfoster/cas-mfa", "path": "cas-mfa-java/src/main/java/net/unicon/cas/mfa/authentication/RequestedAuthenticationMethodRankingStrategy.java", "license": "apache-2.0", "size": 1779 }
[ "net.unicon.cas.mfa.web.support.MultiFactorAuthenticationSupportingWebApplicationService" ]
import net.unicon.cas.mfa.web.support.MultiFactorAuthenticationSupportingWebApplicationService;
import net.unicon.cas.mfa.web.support.*;
[ "net.unicon.cas" ]
net.unicon.cas;
488,823
return (value != null) ? new GO_LocalName(value) : null; }
return (value != null) ? new GO_LocalName(value) : null; }
/** * Does the link between an {@link AbstractName} and the adapter associated. * JAXB calls automatically this method at marshalling-time. * * @param value The implementing class for this metadata value. * @return An wrapper which contains the metadata value. */
Does the link between an <code>AbstractName</code> and the adapter associated. JAXB calls automatically this method at marshalling-time
marshal
{ "repo_name": "desruisseaux/sis", "path": "core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LocalName.java", "license": "apache-2.0", "size": 2523 }
[ "org.opengis.util.LocalName" ]
import org.opengis.util.LocalName;
import org.opengis.util.*;
[ "org.opengis.util" ]
org.opengis.util;
2,273,417
public final void setYScaleID(String scaleId) { // checks if scale id is valid ScaleId.checkIfValid(scaleId); // stores it setValue(Property.Y_SCALE_ID, scaleId); }
final void function(String scaleId) { ScaleId.checkIfValid(scaleId); setValue(Property.Y_SCALE_ID, scaleId); }
/** * Sets the ID of the Y scale to bind onto. * * @param scaleId the ID of the Y scale to bind onto */
Sets the ID of the Y scale to bind onto
setYScaleID
{ "repo_name": "pepstock-org/Charba", "path": "src/org/pepstock/charba/client/annotation/AbstractAnnotation.java", "license": "apache-2.0", "size": 41191 }
[ "org.pepstock.charba.client.options.ScaleId" ]
import org.pepstock.charba.client.options.ScaleId;
import org.pepstock.charba.client.options.*;
[ "org.pepstock.charba" ]
org.pepstock.charba;
1,030,159
@Override public boolean doPreUpdateCredential(String userName, Object newCredential, Object oldCredential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable(this.getClass().getName())) { return true; } if (log.isDebugEnabled()) { log.debug("Pre update credential is called in IdentityMgtEventListener"); } IdentityMgtConfig config = IdentityMgtConfig.getInstance(); if (!config.isListenerEnable()) { return true; } try { // Enforcing the password policies. if (newCredential != null && (newCredential instanceof String && (newCredential.toString().trim() .length() > 0))) { policyRegistry.enforcePasswordPolicies(newCredential.toString(), userName); } } catch (PolicyViolationException pe) { throw new UserStoreException(pe.getMessage(), pe); } return true; }
boolean function(String userName, Object newCredential, Object oldCredential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable(this.getClass().getName())) { return true; } if (log.isDebugEnabled()) { log.debug(STR); } IdentityMgtConfig config = IdentityMgtConfig.getInstance(); if (!config.isListenerEnable()) { return true; } try { if (newCredential != null && (newCredential instanceof String && (newCredential.toString().trim() .length() > 0))) { policyRegistry.enforcePasswordPolicies(newCredential.toString(), userName); } } catch (PolicyViolationException pe) { throw new UserStoreException(pe.getMessage(), pe); } return true; }
/** * This method is used to check pre conditions when changing the user * password. * */
This method is used to check pre conditions when changing the user password
doPreUpdateCredential
{ "repo_name": "jacklotusho/carbon-identity", "path": "components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/IdentityMgtEventListener.java", "license": "apache-2.0", "size": 45251 }
[ "org.wso2.carbon.identity.mgt.policy.PolicyViolationException", "org.wso2.carbon.user.core.UserStoreException", "org.wso2.carbon.user.core.UserStoreManager" ]
import org.wso2.carbon.identity.mgt.policy.PolicyViolationException; import org.wso2.carbon.user.core.UserStoreException; import org.wso2.carbon.user.core.UserStoreManager;
import org.wso2.carbon.identity.mgt.policy.*; import org.wso2.carbon.user.core.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,021,170
public java.util.List<fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI> getInput_arbitrarydeclarations_AnySortHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI>(); for (Sort elemnt : getInput()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.arbitrarydeclarations.impl.AnySortImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI( (fr.lip6.move.pnml.hlpn.arbitrarydeclarations.AnySort)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI>(); for (Sort elemnt : getInput()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.arbitrarydeclarations.impl.AnySortImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.arbitrarydeclarations.hlapi.AnySortHLAPI( (fr.lip6.move.pnml.hlpn.arbitrarydeclarations.AnySort)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of AnySortHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of AnySortHLAPI kind. WARNING : this method can creates a lot of new object in memory
getInput_arbitrarydeclarations_AnySortHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/booleans/hlapi/AndHLAPI.java", "license": "epl-1.0", "size": 108259 }
[ "fr.lip6.move.pnml.hlpn.terms.Sort", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Sort; 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,465,033
public void setUniqueId(UniqueId uniqueId) { this._uniqueId = uniqueId; }
void function(UniqueId uniqueId) { this._uniqueId = uniqueId; }
/** * Sets the unique id. * @param uniqueId the new value of the property */
Sets the unique id
setUniqueId
{ "repo_name": "McLeodMoores/starling", "path": "projects/financial/src/main/java/com/opengamma/financial/analytics/surface/SurfaceSpecification.java", "license": "apache-2.0", "size": 15288 }
[ "com.opengamma.id.UniqueId" ]
import com.opengamma.id.UniqueId;
import com.opengamma.id.*;
[ "com.opengamma.id" ]
com.opengamma.id;
2,211,529
ProductEto findProduct(Long id); /** * Gets a {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product} with a specific revision using its * entity identifier and a revision. * * @param id is the {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product#getId() product ID}. * @param revision is the revision of the {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product * Product}
ProductEto findProduct(Long id); /** * Gets a {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product} with a specific revision using its * entity identifier and a revision. * * @param id is the {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product#getId() product ID}. * @param revision is the revision of the {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product * Product}
/** * Gets a {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product} using its entity identifier. * * @param id is the {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product#getId() product ID}. * @return the requested {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product} or {@code null} if * no such {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product} exists. */
Gets a <code>io.oasp.gastronomy.restaurant.offermanagement.common.api.Product</code> using its entity identifier
findProduct
{ "repo_name": "elyamad/oasp4j", "path": "samples/core/src/main/java/io/oasp/gastronomy/restaurant/offermanagement/logic/api/Offermanagement.java", "license": "apache-2.0", "size": 9403 }
[ "io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.ProductEto" ]
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.ProductEto;
import io.oasp.gastronomy.restaurant.offermanagement.logic.api.to.*;
[ "io.oasp.gastronomy" ]
io.oasp.gastronomy;
2,168,771
public static void releasePool(long poolPtr) { // Clean predefined memory chunks. long mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_1); if (mem != 0) GridUnsafe.freeMemory(mem); mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_2); if (mem != 0) GridUnsafe.freeMemory(mem); mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_3); if (mem != 0) GridUnsafe.freeMemory(mem); // Clean pool chunk. GridUnsafe.freeMemory(poolPtr); }
static void function(long poolPtr) { long mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_1); if (mem != 0) GridUnsafe.freeMemory(mem); mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_2); if (mem != 0) GridUnsafe.freeMemory(mem); mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_3); if (mem != 0) GridUnsafe.freeMemory(mem); GridUnsafe.freeMemory(poolPtr); }
/** * Release pool memory. * * @param poolPtr Pool pointer. */
Release pool memory
releasePool
{ "repo_name": "afinka77/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/memory/PlatformMemoryUtils.java", "license": "apache-2.0", "size": 12090 }
[ "org.apache.ignite.internal.util.GridUnsafe" ]
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,244,602
protected void doFlush() { long[] values = unFlushed.getSnapshot().getValues(); for (Histogram histogram : histogramMap.values()) { for (long val : values) { histogram.update(val); } } for (long val : values) { for (AsmMetric metric : this.assocMetrics) { metric.updateDirectly(val); } } this.unFlushed = newHistogram(); }
void function() { long[] values = unFlushed.getSnapshot().getValues(); for (Histogram histogram : histogramMap.values()) { for (long val : values) { histogram.update(val); } } for (long val : values) { for (AsmMetric metric : this.assocMetrics) { metric.updateDirectly(val); } } this.unFlushed = newHistogram(); }
/** * flush temp histogram data to all windows & assoc metrics. */
flush temp histogram data to all windows & assoc metrics
doFlush
{ "repo_name": "luohongjunnn/jstorm", "path": "jstorm-core/src/main/java/com/alibaba/jstorm/common/metric/AsmHistogram.java", "license": "apache-2.0", "size": 3192 }
[ "com.codahale.metrics.Histogram" ]
import com.codahale.metrics.Histogram;
import com.codahale.metrics.*;
[ "com.codahale.metrics" ]
com.codahale.metrics;
1,773,348
@Nullable public static String javaScriptUnescape (@Nullable final String sInput) { if (StringHelper.hasNoText (sInput)) return sInput; final char [] aInput = sInput.toCharArray (); if (!ArrayHelper.contains (aInput, MASK_CHAR)) return sInput; // Result is at last as long as the input as e.g. "\x3a" is squeezed to ":" // so 1 char instead of 4 final char [] ret = new char [aInput.length]; int nRetIndex = 0; char cPrevChar = '\u0000'; for (int i = 0; i < aInput.length; i++) { final char cCurrent = aInput[i]; if (cPrevChar == MASK_CHAR) { switch (cCurrent) { case '"': case '\'': case '\\': case '/': ret[nRetIndex++] = cCurrent; break; case 't': ret[nRetIndex++] = '\t'; break; case 'n': ret[nRetIndex++] = '\n'; break; case 'f': ret[nRetIndex++] = '\f'; break; case 'x': if (i + 2 >= aInput.length) { LOGGER.warn ("Failed to unescape '" + sInput + "' - EOF in hex values"); return sInput; } i++; final char cHex1 = aInput[i]; i++; final char cHex2 = aInput[i]; final int nHexByte = StringHelper.getHexByte (cHex1, cHex2); if (nHexByte < 0) { LOGGER.warn ("Failed to unescape '" + sInput + "' - invalid hex values"); return sInput; } ret[nRetIndex++] = (char) nHexByte; break; default: ret[nRetIndex++] = MASK_CHAR; ret[nRetIndex++] = cCurrent; break; } cPrevChar = 0; } else { if (cCurrent != MASK_CHAR) ret[nRetIndex++] = cCurrent; cPrevChar = cCurrent; } } // Last char is a mask char? append! if (cPrevChar == MASK_CHAR) ret[nRetIndex++] = MASK_CHAR; return new String (ret, 0, nRetIndex); }
static String function (@Nullable final String sInput) { if (StringHelper.hasNoText (sInput)) return sInput; final char [] aInput = sInput.toCharArray (); if (!ArrayHelper.contains (aInput, MASK_CHAR)) return sInput; final char [] ret = new char [aInput.length]; int nRetIndex = 0; char cPrevChar = '\u0000'; for (int i = 0; i < aInput.length; i++) { final char cCurrent = aInput[i]; if (cPrevChar == MASK_CHAR) { switch (cCurrent) { case 'STRFailed to unescape 'STR' - EOF in hex valuesSTRFailed to unescape 'STR' - invalid hex values"); return sInput; } ret[nRetIndex++] = (char) nHexByte; break; default: ret[nRetIndex++] = MASK_CHAR; ret[nRetIndex++] = cCurrent; break; } cPrevChar = 0; } else { if (cCurrent != MASK_CHAR) ret[nRetIndex++] = cCurrent; cPrevChar = cCurrent; } } if (cPrevChar == MASK_CHAR) ret[nRetIndex++] = MASK_CHAR; return new String (ret, 0, nRetIndex); }
/** * Unescape a previously escaped string.<br> * Important: this is not a 100% reversion of * {@link #javaScriptEscape(String)} since the escaping method drops any '\r' * character and it will therefore not be unescaped! * * @param sInput * The string to be unescaped. May be <code>null</code>. * @return The unescaped string. * @see #javaScriptEscape(String) */
Unescape a previously escaped string. Important: this is not a 100% reversion of <code>#javaScriptEscape(String)</code> since the escaping method drops any '\r' character and it will therefore not be unescaped
javaScriptUnescape
{ "repo_name": "phax/ph-oton", "path": "ph-oton-html/src/main/java/com/helger/html/js/JSMarshaller.java", "license": "apache-2.0", "size": 12508 }
[ "com.helger.commons.collection.ArrayHelper", "com.helger.commons.string.StringHelper", "javax.annotation.Nullable" ]
import com.helger.commons.collection.ArrayHelper; import com.helger.commons.string.StringHelper; import javax.annotation.Nullable;
import com.helger.commons.collection.*; import com.helger.commons.string.*; import javax.annotation.*;
[ "com.helger.commons", "javax.annotation" ]
com.helger.commons; javax.annotation;
771,819
private ParseNode parseNewInstance(Entry inEntry) throws ConfigurationException, IOException { int lineno = st.lineno(); String typeName = token("type name"); int t = st.nextToken(); if (t == '[') { token(']'); token('{'); return new ArrayConstructor( typeName, parseArgs(inEntry, '}'), lineno); } else if (t != '(') { syntax("'(' or '['"); } return new ConstructorCall( typeName, parseArgs(inEntry, ')'), lineno); }
ParseNode function(Entry inEntry) throws ConfigurationException, IOException { int lineno = st.lineno(); String typeName = token(STR); int t = st.nextToken(); if (t == '[') { token(']'); token('{'); return new ArrayConstructor( typeName, parseArgs(inEntry, '}'), lineno); } else if (t != '(') { syntax(STR); } return new ConstructorCall( typeName, parseArgs(inEntry, ')'), lineno); }
/** * Parses a NewExpr except for the leading "new", and returns the * constructed object. */
Parses a NewExpr except for the leading "new", and returns the constructed object
parseNewInstance
{ "repo_name": "cdegroot/river", "path": "src/net/jini/config/ConfigurationFile.java", "license": "apache-2.0", "size": 103654 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,734,219
public static <T> T[] append(final T[] array, final T element) throws NullArgumentException{ ArgumentChecks.ensureNonNull("array", array); final T[] copy = Arrays.copyOf(array, array.length + 1); copy[array.length] = element; return copy; } /** * Removes the duplicated elements in the given array. This method should be invoked only for small arrays, * typically less than 10 distinct elements. For larger arrays, use {@link java.util.LinkedHashSet} instead. * * <p>This method compares all pair of elements using the {@link Objects#equals(Object, Object)} * method - so null elements are allowed. If duplicated values are found, then only the first * occurrence is retained; the second occurrence is removed in-place. After all elements have * been compared, this method returns the number of remaining elements in the array. The free * space at the end of the array is padded with {@code null} values.</p> * * <p>Callers can obtain an array of appropriate length using the following idiom. * Note that this idiom will create a new array only if necessary:</p> * * {@preformat java * T[] array = ...; * array = resize(array, removeDuplicated(array)); * }
static <T> T[] function(final T[] array, final T element) throws NullArgumentException{ ArgumentChecks.ensureNonNull("array", array); final T[] copy = Arrays.copyOf(array, array.length + 1); copy[array.length] = element; return copy; } /** * Removes the duplicated elements in the given array. This method should be invoked only for small arrays, * typically less than 10 distinct elements. For larger arrays, use {@link java.util.LinkedHashSet} instead. * * <p>This method compares all pair of elements using the {@link Objects#equals(Object, Object)} * method - so null elements are allowed. If duplicated values are found, then only the first * occurrence is retained; the second occurrence is removed in-place. After all elements have * been compared, this method returns the number of remaining elements in the array. The free * space at the end of the array is padded with {@code null} values.</p> * * <p>Callers can obtain an array of appropriate length using the following idiom. * Note that this idiom will create a new array only if necessary:</p> * * {@preformat java * T[] array = ...; * array = resize(array, removeDuplicated(array)); * }
/** * Returns a copy of the given array with a single element appended at the end. * This method should be invoked only on rare occasions. * If many elements are to be added, use {@link java.util.ArrayList} instead. * * @param <T> the type of elements in the array. * @param array the array to copy with a new element. The original array will not be modified. * @param element the element to add (can be null). * @return a copy of the given array with the given element appended at the end. * @throws NullArgumentException if the given array is null. * * @see #concatenate(Object[][]) */
Returns a copy of the given array with a single element appended at the end. This method should be invoked only on rare occasions. If many elements are to be added, use <code>java.util.ArrayList</code> instead
append
{ "repo_name": "apache/sis", "path": "core/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java", "license": "apache-2.0", "size": 111582 }
[ "java.util.Arrays", "java.util.Objects" ]
import java.util.Arrays; import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
2,799,090
@Test public void testHBase737 () throws IOException { final byte [] FAM1 = Bytes.toBytes("fam1"); final byte [] FAM2 = Bytes.toBytes("fam2"); // Open table HTable table = TEST_UTIL.createTable(Bytes.toBytes("testHBase737"), new byte [][] {FAM1, FAM2}); // Insert some values Put put = new Put(ROW); put.add(FAM1, Bytes.toBytes("letters"), Bytes.toBytes("abcdefg")); table.put(put); try { Thread.sleep(1000); } catch (InterruptedException i) { //ignore } put = new Put(ROW); put.add(FAM1, Bytes.toBytes("numbers"), Bytes.toBytes("123456")); table.put(put); try { Thread.sleep(1000); } catch (InterruptedException i) { //ignore } put = new Put(ROW); put.add(FAM2, Bytes.toBytes("letters"), Bytes.toBytes("hijklmnop")); table.put(put); long times[] = new long[3]; // First scan the memstore Scan scan = new Scan(); scan.addFamily(FAM1); scan.addFamily(FAM2); ResultScanner s = table.getScanner(scan); try { int index = 0; Result r = null; while ((r = s.next()) != null) { for(KeyValue key : r.sorted()) { times[index++] = key.getTimestamp(); } } } finally { s.close(); } for (int i = 0; i < times.length - 1; i++) { for (int j = i + 1; j < times.length; j++) { assertTrue(times[j] > times[i]); } } // Flush data to disk and try again TEST_UTIL.flush(); // Reset times for(int i=0;i<times.length;i++) { times[i] = 0; } try { Thread.sleep(1000); } catch (InterruptedException i) { //ignore } scan = new Scan(); scan.addFamily(FAM1); scan.addFamily(FAM2); s = table.getScanner(scan); try { int index = 0; Result r = null; while ((r = s.next()) != null) { for(KeyValue key : r.sorted()) { times[index++] = key.getTimestamp(); } } } finally { s.close(); } for (int i = 0; i < times.length - 1; i++) { for (int j = i + 1; j < times.length; j++) { assertTrue(times[j] > times[i]); } } }
void function () throws IOException { final byte [] FAM1 = Bytes.toBytes("fam1"); final byte [] FAM2 = Bytes.toBytes("fam2"); HTable table = TEST_UTIL.createTable(Bytes.toBytes(STR), new byte [][] {FAM1, FAM2}); Put put = new Put(ROW); put.add(FAM1, Bytes.toBytes(STR), Bytes.toBytes(STR)); table.put(put); try { Thread.sleep(1000); } catch (InterruptedException i) { } put = new Put(ROW); put.add(FAM1, Bytes.toBytes(STR), Bytes.toBytes(STR)); table.put(put); try { Thread.sleep(1000); } catch (InterruptedException i) { } put = new Put(ROW); put.add(FAM2, Bytes.toBytes(STR), Bytes.toBytes(STR)); table.put(put); long times[] = new long[3]; Scan scan = new Scan(); scan.addFamily(FAM1); scan.addFamily(FAM2); ResultScanner s = table.getScanner(scan); try { int index = 0; Result r = null; while ((r = s.next()) != null) { for(KeyValue key : r.sorted()) { times[index++] = key.getTimestamp(); } } } finally { s.close(); } for (int i = 0; i < times.length - 1; i++) { for (int j = i + 1; j < times.length; j++) { assertTrue(times[j] > times[i]); } } TEST_UTIL.flush(); for(int i=0;i<times.length;i++) { times[i] = 0; } try { Thread.sleep(1000); } catch (InterruptedException i) { } scan = new Scan(); scan.addFamily(FAM1); scan.addFamily(FAM2); s = table.getScanner(scan); try { int index = 0; Result r = null; while ((r = s.next()) != null) { for(KeyValue key : r.sorted()) { times[index++] = key.getTimestamp(); } } } finally { s.close(); } for (int i = 0; i < times.length - 1; i++) { for (int j = i + 1; j < times.length; j++) { assertTrue(times[j] > times[i]); } } }
/** * test for HBASE-737 * @throws IOException */
test for HBASE-737
testHBase737
{ "repo_name": "Shmuma/hbase", "path": "src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java", "license": "apache-2.0", "size": 145872 }
[ "java.io.IOException", "org.apache.hadoop.hbase.KeyValue", "org.apache.hadoop.hbase.util.Bytes", "org.junit.Assert" ]
import java.io.IOException; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
1,647,962
public ConstructorArgumentValues getConstructorArgumentValues() { return this.constructorArgumentValues; }
ConstructorArgumentValues function() { return this.constructorArgumentValues; }
/** * Return constructor argument values for this bean (never <code>null</code>). */
Return constructor argument values for this bean (never <code>null</code>)
getConstructorArgumentValues
{ "repo_name": "mattxia/spring-2.5-analysis", "path": "src/org/springframework/beans/factory/support/AbstractBeanDefinition.java", "license": "apache-2.0", "size": 30350 }
[ "org.springframework.beans.factory.config.ConstructorArgumentValues" ]
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.*;
[ "org.springframework.beans" ]
org.springframework.beans;
2,190,242
List<String> sources = new ArrayList<>(); for (int i = 0; i < this._sections.size(); i++) { for (int j = 0; j < this._sections.get(i).consumer.sources().size(); j++) { sources.add(this._sections.get(i).consumer.sources().get(j)); } } return sources; }
List<String> sources = new ArrayList<>(); for (int i = 0; i < this._sections.size(); i++) { for (int j = 0; j < this._sections.get(i).consumer.sources().size(); j++) { sources.add(this._sections.get(i).consumer.sources().get(j)); } } return sources; }
/** * The list of original sources. */
The list of original sources
sources
{ "repo_name": "nlalevee/jsourcemap", "path": "jsourcemap/src/java/org/hibnet/jsourcemap/IndexedSourceMapConsumer.java", "license": "apache-2.0", "size": 12239 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,952,206
@SuppressWarnings("WeakerAccess") public static void getDailyForecast(double latitude, double longitude, @NonNull final ForecastListener listener) { getDailyForecast(latitude, longitude, NO_LIMIT, listener); }
@SuppressWarnings(STR) static void function(double latitude, double longitude, @NonNull final ForecastListener listener) { getDailyForecast(latitude, longitude, NO_LIMIT, listener); }
/** * Get daily weather forecast for given geo point. This will return maximum 16 days forecast if * available. * * @param latitude latitude of the point * @param longitude latitude of the point * @param listener {@link ForecastListener} to listen the response */
Get daily weather forecast for given geo point. This will return maximum 16 days forecast if available
getDailyForecast
{ "repo_name": "kevalpatel2106/Open-Weather-API-Wrapper", "path": "open-weather-wrapper/src/main/java/com/openweatherweapper/OpenWeatherApi.java", "license": "apache-2.0", "size": 29543 }
[ "android.support.annotation.NonNull", "com.openweatherweapper.interfaces.ForecastListener" ]
import android.support.annotation.NonNull; import com.openweatherweapper.interfaces.ForecastListener;
import android.support.annotation.*; import com.openweatherweapper.interfaces.*;
[ "android.support", "com.openweatherweapper.interfaces" ]
android.support; com.openweatherweapper.interfaces;
1,437,054
void removeChannel(@Nonnull String channel, @Nullable String reason);
void removeChannel(@Nonnull String channel, @Nullable String reason);
/** * Removes a channel from the client, leaving as necessary. * * @param channel channel to leave * @param reason part reason or null to not send a reason * @throws IllegalArgumentException if channel is null */
Removes a channel from the client, leaving as necessary
removeChannel
{ "repo_name": "ammaraskar/KittehIRCClientLib", "path": "src/main/java/org/kitteh/irc/client/library/Client.java", "license": "mit", "size": 10050 }
[ "javax.annotation.Nonnull", "javax.annotation.Nullable" ]
import javax.annotation.Nonnull; import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,037,059
public void shareImage(PostData postData);
void function(PostData postData);
/** * Request to share the given image. * * @param postData * The PostData of the image. */
Request to share the given image
shareImage
{ "repo_name": "antew/RedditInPictures", "path": "src/main/java/com/antew/redditinpictures/library/adapter/ImageListCursorAdapter.java", "license": "apache-2.0", "size": 13607 }
[ "com.antew.redditinpictures.library.model.reddit.PostData" ]
import com.antew.redditinpictures.library.model.reddit.PostData;
import com.antew.redditinpictures.library.model.reddit.*;
[ "com.antew.redditinpictures" ]
com.antew.redditinpictures;
2,190,267
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object
collectNewChildDescriptors
{ "repo_name": "parraman/micobs", "path": "common/es.uah.aut.srg.micobs/src/es/uah/aut/srg/micobs/common/provider/MCommonPackageItemItemProvider.java", "license": "epl-1.0", "size": 5706 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
123,396
private List<Settings> bootstrapMasterNodeWithSpecifiedIndex(List<Settings> allNodesSettings) { assert Thread.holdsLock(this); if (bootstrapMasterNodeIndex == -1) { // fast-path return allNodesSettings; } int currentNodeId = numMasterNodes() - 1; List<Settings> newSettings = new ArrayList<>(); for (Settings settings : allNodesSettings) { if (DiscoveryNode.isMasterNode(settings) == false) { newSettings.add(settings); } else { currentNodeId++; if (currentNodeId != bootstrapMasterNodeIndex) { newSettings.add(settings); } else { List<String> nodeNames = new ArrayList<>(); for (Settings nodeSettings : getDataOrMasterNodeInstances(Settings.class)) { if (DiscoveryNode.isMasterNode(nodeSettings)) { nodeNames.add(Node.NODE_NAME_SETTING.get(nodeSettings)); } } for (Settings nodeSettings : allNodesSettings) { if (DiscoveryNode.isMasterNode(nodeSettings)) { nodeNames.add(Node.NODE_NAME_SETTING.get(nodeSettings)); } } newSettings.add( Settings.builder() .put(settings) .putList(ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING.getKey(), nodeNames) .build() ); setBootstrapMasterNodeIndex(-1); } } } return newSettings; }
List<Settings> function(List<Settings> allNodesSettings) { assert Thread.holdsLock(this); if (bootstrapMasterNodeIndex == -1) { return allNodesSettings; } int currentNodeId = numMasterNodes() - 1; List<Settings> newSettings = new ArrayList<>(); for (Settings settings : allNodesSettings) { if (DiscoveryNode.isMasterNode(settings) == false) { newSettings.add(settings); } else { currentNodeId++; if (currentNodeId != bootstrapMasterNodeIndex) { newSettings.add(settings); } else { List<String> nodeNames = new ArrayList<>(); for (Settings nodeSettings : getDataOrMasterNodeInstances(Settings.class)) { if (DiscoveryNode.isMasterNode(nodeSettings)) { nodeNames.add(Node.NODE_NAME_SETTING.get(nodeSettings)); } } for (Settings nodeSettings : allNodesSettings) { if (DiscoveryNode.isMasterNode(nodeSettings)) { nodeNames.add(Node.NODE_NAME_SETTING.get(nodeSettings)); } } newSettings.add( Settings.builder() .put(settings) .putList(ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING.getKey(), nodeNames) .build() ); setBootstrapMasterNodeIndex(-1); } } } return newSettings; }
/** * Performs cluster bootstrap when node with index {@link #bootstrapMasterNodeIndex} is started * with the names of all existing and new master-eligible nodes. * Indexing starts from 0. * If {@link #bootstrapMasterNodeIndex} is -1 (default), this method does nothing. */
Performs cluster bootstrap when node with index <code>#bootstrapMasterNodeIndex</code> is started with the names of all existing and new master-eligible nodes. Indexing starts from 0. If <code>#bootstrapMasterNodeIndex</code> is -1 (default), this method does nothing
bootstrapMasterNodeWithSpecifiedIndex
{ "repo_name": "jmluy/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java", "license": "apache-2.0", "size": 110894 }
[ "java.util.ArrayList", "java.util.List", "org.elasticsearch.cluster.coordination.ClusterBootstrapService", "org.elasticsearch.cluster.node.DiscoveryNode", "org.elasticsearch.common.settings.Settings", "org.elasticsearch.node.Node" ]
import java.util.ArrayList; import java.util.List; import org.elasticsearch.cluster.coordination.ClusterBootstrapService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node;
import java.util.*; import org.elasticsearch.cluster.coordination.*; import org.elasticsearch.cluster.node.*; import org.elasticsearch.common.settings.*; import org.elasticsearch.node.*;
[ "java.util", "org.elasticsearch.cluster", "org.elasticsearch.common", "org.elasticsearch.node" ]
java.util; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.node;
2,763,990
private void setUpAdditionalNumbers(Composite localParent) { // Set up the extra button(s). cExtraButton = new Composite(localParent, SWT.NONE); cExtraButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1)); cExtraButton.setLayout(new StackLayout()); setUpSpecialButtons(cExtraButton); // Set up the spaces for extra labels and text. cExtraLabel1 = new Composite(localParent, SWT.NONE); cExtraLabel1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); cExtraLabel1.setLayout(new StackLayout()); setUpExtraLabel1(cExtraLabel1); cExtraText1 = new Composite(localParent, SWT.NONE); cExtraText1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); cExtraText1.setLayout(new StackLayout()); setUpExtraText1(cExtraText1); cExtraLabel2 = new Composite(localParent, SWT.NONE); cExtraLabel2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); cExtraLabel2.setLayout(new StackLayout()); setUpExtraLabel2(cExtraLabel2); cExtraText2 = new Composite(localParent, SWT.NONE); cExtraText2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); cExtraText2.setLayout(new StackLayout()); setUpExtraText2(cExtraText2); // Set up the specific extra controls for the SETUP attack (otherwise invisible). lEncryptedP = new Label(localParent, SWT.None); lEncryptedP.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); lEncryptedP.setText(Messages.RSAKeyView_EncryptedP); tEncryptedP = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); tEncryptedP.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tEncryptedP.setMargins(4, 0, 4, 0); lNPrime = new Label(localParent, SWT.None); lNPrime.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); lNPrime.setText(Messages.RSAKeyView_N_Prime); tNPrime = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); tNPrime.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tNPrime.setMargins(4, 0, 4, 0); }
void function(Composite localParent) { cExtraButton = new Composite(localParent, SWT.NONE); cExtraButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1)); cExtraButton.setLayout(new StackLayout()); setUpSpecialButtons(cExtraButton); cExtraLabel1 = new Composite(localParent, SWT.NONE); cExtraLabel1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); cExtraLabel1.setLayout(new StackLayout()); setUpExtraLabel1(cExtraLabel1); cExtraText1 = new Composite(localParent, SWT.NONE); cExtraText1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); cExtraText1.setLayout(new StackLayout()); setUpExtraText1(cExtraText1); cExtraLabel2 = new Composite(localParent, SWT.NONE); cExtraLabel2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); cExtraLabel2.setLayout(new StackLayout()); setUpExtraLabel2(cExtraLabel2); cExtraText2 = new Composite(localParent, SWT.NONE); cExtraText2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); cExtraText2.setLayout(new StackLayout()); setUpExtraText2(cExtraText2); lEncryptedP = new Label(localParent, SWT.None); lEncryptedP.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); lEncryptedP.setText(Messages.RSAKeyView_EncryptedP); tEncryptedP = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tEncryptedP.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tEncryptedP.setMargins(4, 0, 4, 0); lNPrime = new Label(localParent, SWT.None); lNPrime.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); lNPrime.setText(Messages.RSAKeyView_N_Prime); tNPrime = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tNPrime.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tNPrime.setMargins(4, 0, 4, 0); }
/** * Sets up the additional cryptosystem buttons and numbers. * * @param localParent The parent control of the additional numbers group (the keygen group). */
Sets up the additional cryptosystem buttons and numbers
setUpAdditionalNumbers
{ "repo_name": "kevinott/crypto", "path": "org.jcryptool.visual.kleptography/src/org/jcryptool/visual/kleptography/ui/RSAKeyView.java", "license": "epl-1.0", "size": 103013 }
[ "org.eclipse.swt.custom.StackLayout", "org.eclipse.swt.custom.StyledText", "org.eclipse.swt.layout.GridData", "org.eclipse.swt.widgets.Composite", "org.eclipse.swt.widgets.Label" ]
import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.custom.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
2,863,654
@ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<DimensionInner> listAsync( String scope, String filter, String expand, String skiptoken, Integer top, Context context) { return new PagedFlux<>(() -> listSinglePageAsync(scope, filter, expand, skiptoken, top, context)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<DimensionInner> function( String scope, String filter, String expand, String skiptoken, Integer top, Context context) { return new PagedFlux<>(() -> listSinglePageAsync(scope, filter, expand, skiptoken, top, context)); }
/** * Lists the dimensions by the defined scope. * * @param scope The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for * subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup * scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department * scope, * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' * for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for * Management Group scope, * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for * billingProfile scope, * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' * for invoiceSection scope, and * 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for * partners. * @param filter May be used to filter dimensions by properties/category, properties/usageStart, * properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. * @param expand May be used to expand the properties/data within a dimension category. By default, data is not * included when listing dimensions. * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that * specifies a starting point to use for subsequent calls. * @param top May be used to limit the number of results to the most recent N dimension data. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of listing dimensions. */
Lists the dimensions by the defined scope
listAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/implementation/DimensionsClientImpl.java", "license": "mit", "size": 40541 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.core.util.Context", "com.azure.resourcemanager.costmanagement.fluent.models.DimensionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.core.util.Context; import com.azure.resourcemanager.costmanagement.fluent.models.DimensionInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.costmanagement.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,754,385
LoggingManager getLogging(); /** * <p>Configures an object via a closure, with the closure's delegate set to the supplied object. This way you don't * have to specify the context of a configuration statement multiple times. <p> Instead of:</p> * <pre> * MyType myType = new MyType() * myType.doThis() * myType.doThat() * </pre> * <p> you can do: * <pre> * MyType myType = configure(new MyType()) { * doThis() * doThat() * } * </pre> * * <p>The object being configured is also passed to the closure as a parameter, so you can access it explicitly if * required:</p> * <pre> * configure(someObj) { obj -&gt; obj.doThis() }
LoggingManager getLogging(); /** * <p>Configures an object via a closure, with the closure's delegate set to the supplied object. This way you don't * have to specify the context of a configuration statement multiple times. <p> Instead of:</p> * <pre> * MyType myType = new MyType() * myType.doThis() * myType.doThat() * </pre> * <p> you can do: * <pre> * MyType myType = configure(new MyType()) { * doThis() * doThat() * } * </pre> * * <p>The object being configured is also passed to the closure as a parameter, so you can access it explicitly if * required:</p> * <pre> * configure(someObj) { obj -&gt; obj.doThis() }
/** * Returns the {@link org.gradle.api.logging.LoggingManager} which can be used to receive logging and to control the * standard output/error capture for this project's build script. By default, System.out is redirected to the Gradle * logging system at the QUIET log level, and System.err is redirected at the ERROR log level. * * @return the LoggingManager. Never returns null. */
Returns the <code>org.gradle.api.logging.LoggingManager</code> which can be used to receive logging and to control the standard output/error capture for this project's build script. By default, System.out is redirected to the Gradle logging system at the QUIET log level, and System.err is redirected at the ERROR log level
getLogging
{ "repo_name": "lsmaira/gradle", "path": "subprojects/core-api/src/main/java/org/gradle/api/Project.java", "license": "apache-2.0", "size": 72230 }
[ "org.gradle.api.logging.LoggingManager" ]
import org.gradle.api.logging.LoggingManager;
import org.gradle.api.logging.*;
[ "org.gradle.api" ]
org.gradle.api;
2,646,081
public void setEntityItemStack(ItemStack stack) { this.getDataWatcher().updateObject(10, stack); this.getDataWatcher().setObjectWatched(10); }
void function(ItemStack stack) { this.getDataWatcher().updateObject(10, stack); this.getDataWatcher().setObjectWatched(10); }
/** * Sets the ItemStack for this entity */
Sets the ItemStack for this entity
setEntityItemStack
{ "repo_name": "trixmot/mod1", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/item/EntityItem.java", "license": "lgpl-2.1", "size": 18005 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
305,481
protected SelectQuery getTestedInstance() { return m__Query; }
SelectQuery function() { return m__Query; }
/** * Retrieves the tested instance. * @return such query. */
Retrieves the tested instance
getTestedInstance
{ "repo_name": "rydnr/queryj-sql", "path": "src/test/java/org/acmsl/queryj/sql/SelectQueryTest.java", "license": "gpl-3.0", "size": 5637 }
[ "org.acmsl.queryj.sql.SelectQuery" ]
import org.acmsl.queryj.sql.SelectQuery;
import org.acmsl.queryj.sql.*;
[ "org.acmsl.queryj" ]
org.acmsl.queryj;
1,299,583
public void setLogLevel(Level level);
void function(Level level);
/** * Sets the new log level. Will be considered by the {@link LogViewer} so only entries with a * level equal or higher than the specified one are displayed. * * @param level */
Sets the new log level. Will be considered by the <code>LogViewer</code> so only entries with a level equal or higher than the specified one are displayed
setLogLevel
{ "repo_name": "brtonnies/rapidminer-studio", "path": "src/main/java/com/rapidminer/gui/tools/logging/LogModel.java", "license": "agpl-3.0", "size": 4755 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
1,314,672
void storePage(SerializedPage page) { if (size > 0) { synchronized (cache) { for (Iterator<SoftReference<SerializedPage>> i = cache.iterator(); i.hasNext();) { SoftReference<SerializedPage> r = i.next(); SerializedPage entry = r.get(); if (entry != null && entry.equals(page)) { i.remove(); break; } } cache.add(new SoftReference<SerializedPage>(page)); if (cache.size() > size) { cache.remove(0); } } } } }
void storePage(SerializedPage page) { if (size > 0) { synchronized (cache) { for (Iterator<SoftReference<SerializedPage>> i = cache.iterator(); i.hasNext();) { SoftReference<SerializedPage> r = i.next(); SerializedPage entry = r.get(); if (entry != null && entry.equals(page)) { i.remove(); break; } } cache.add(new SoftReference<SerializedPage>(page)); if (cache.size() > size) { cache.remove(0); } } } } }
/** * Store the serialized page in cache * * @param page * the data to serialize (page id, session id, bytes) */
Store the serialized page in cache
storePage
{ "repo_name": "mafulafunk/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageStore.java", "license": "apache-2.0", "size": 13782 }
[ "java.lang.ref.SoftReference", "java.util.Iterator" ]
import java.lang.ref.SoftReference; import java.util.Iterator;
import java.lang.ref.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
822,377
protected void buildCNode(INode in) throws ContextClassifierException { StringBuilder path = new StringBuilder(); INodeData nd = in.getNodeData(); String formula = toCNF(in, nd.getcLabFormula()); if (formula != null && !formula.isEmpty() && !formula.equals(" ")) { if (formula.contains(" ")) { formula = "(" + formula + ")"; } path.append(formula); } if (in.hasParent()) { formula = in.getParent().getNodeData().getcNodeFormula(); if (formula != null && !formula.isEmpty() && !formula.equals(" ")) { if (2 < path.length()) { path.append(" & ").append(formula); } else { path.append(formula); } } } nd.setcNodeFormula(path.toString()); }
void function(INode in) throws ContextClassifierException { StringBuilder path = new StringBuilder(); INodeData nd = in.getNodeData(); String formula = toCNF(in, nd.getcLabFormula()); if (formula != null && !formula.isEmpty() && !formula.equals(" ")) { if (formula.contains(" ")) { formula = "(" + formula + ")"; } path.append(formula); } if (in.hasParent()) { formula = in.getParent().getNodeData().getcNodeFormula(); if (formula != null && !formula.isEmpty() && !formula.equals(" ")) { if (2 < path.length()) { path.append(STR).append(formula); } else { path.append(formula); } } } nd.setcNodeFormula(path.toString()); }
/** * Constructs c@node formula for the concept. * * @param in node to process * @throws ContextClassifierException ContextClassifierException */
Constructs c@node formula for the concept
buildCNode
{ "repo_name": "opendatatrentino/s-match", "path": "src/main/java/it/unitn/disi/smatch/classifiers/CNFContextClassifier.java", "license": "lgpl-2.1", "size": 3666 }
[ "it.unitn.disi.smatch.data.trees.INode", "it.unitn.disi.smatch.data.trees.INodeData" ]
import it.unitn.disi.smatch.data.trees.INode; import it.unitn.disi.smatch.data.trees.INodeData;
import it.unitn.disi.smatch.data.trees.*;
[ "it.unitn.disi" ]
it.unitn.disi;
2,059,617
protected void applyToTitle(Title title) { if (title instanceof TextTitle) { TextTitle tt = (TextTitle) title; tt.setFont(this.largeFont); tt.setPaint(this.subtitlePaint); } else if (title instanceof LegendTitle) { LegendTitle lt = (LegendTitle) title; if (lt.getBackgroundPaint() != null) { lt.setBackgroundPaint(this.legendBackgroundPaint); } lt.setItemFont(this.regularFont); lt.setItemPaint(this.legendItemPaint); if (lt.getWrapper() != null) { applyToBlockContainer(lt.getWrapper()); } } else if (title instanceof PaintScaleLegend) { PaintScaleLegend psl = (PaintScaleLegend) title; psl.setBackgroundPaint(this.legendBackgroundPaint); ValueAxis axis = psl.getAxis(); if (axis != null) { applyToValueAxis(axis); } } else if (title instanceof CompositeTitle) { CompositeTitle ct = (CompositeTitle) title; BlockContainer bc = ct.getContainer(); List blocks = bc.getBlocks(); Iterator iterator = blocks.iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); if (b instanceof Title) { applyToTitle((Title) b); } } } }
void function(Title title) { if (title instanceof TextTitle) { TextTitle tt = (TextTitle) title; tt.setFont(this.largeFont); tt.setPaint(this.subtitlePaint); } else if (title instanceof LegendTitle) { LegendTitle lt = (LegendTitle) title; if (lt.getBackgroundPaint() != null) { lt.setBackgroundPaint(this.legendBackgroundPaint); } lt.setItemFont(this.regularFont); lt.setItemPaint(this.legendItemPaint); if (lt.getWrapper() != null) { applyToBlockContainer(lt.getWrapper()); } } else if (title instanceof PaintScaleLegend) { PaintScaleLegend psl = (PaintScaleLegend) title; psl.setBackgroundPaint(this.legendBackgroundPaint); ValueAxis axis = psl.getAxis(); if (axis != null) { applyToValueAxis(axis); } } else if (title instanceof CompositeTitle) { CompositeTitle ct = (CompositeTitle) title; BlockContainer bc = ct.getContainer(); List blocks = bc.getBlocks(); Iterator iterator = blocks.iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); if (b instanceof Title) { applyToTitle((Title) b); } } } }
/** * Applies the attributes of this theme to the specified title. * * @param title the title. */
Applies the attributes of this theme to the specified title
applyToTitle
{ "repo_name": "Mr-Steve/LTSpice_Library_Manager", "path": "libs/jfreechart-1.0.16/source/org/jfree/chart/StandardChartTheme.java", "license": "gpl-2.0", "size": 60415 }
[ "java.util.Iterator", "java.util.List", "org.jfree.chart.axis.ValueAxis", "org.jfree.chart.block.Block", "org.jfree.chart.block.BlockContainer", "org.jfree.chart.title.CompositeTitle", "org.jfree.chart.title.LegendTitle", "org.jfree.chart.title.PaintScaleLegend", "org.jfree.chart.title.TextTitle", "org.jfree.chart.title.Title" ]
import java.util.Iterator; import java.util.List; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.block.Block; import org.jfree.chart.block.BlockContainer; import org.jfree.chart.title.CompositeTitle; import org.jfree.chart.title.LegendTitle; import org.jfree.chart.title.PaintScaleLegend; import org.jfree.chart.title.TextTitle; import org.jfree.chart.title.Title;
import java.util.*; import org.jfree.chart.axis.*; import org.jfree.chart.block.*; import org.jfree.chart.title.*;
[ "java.util", "org.jfree.chart" ]
java.util; org.jfree.chart;
2,332,872
public String getApiVersion() { return this.apiVersion; } private final HttpPipeline httpPipeline;
String function() { return this.apiVersion; } private final HttpPipeline httpPipeline;
/** * Gets Api Version. * * @return the apiVersion value. */
Gets Api Version
getApiVersion
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/SearchIndexClientImpl.java", "license": "mit", "size": 4227 }
[ "com.azure.core.http.HttpPipeline" ]
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.*;
[ "com.azure.core" ]
com.azure.core;
448,743
public void addInstanceMethod(final DetailAST ident) { instanceMethods.add(ident); }
void function(final DetailAST ident) { instanceMethods.add(ident); }
/** * Adds instance method's name. * @param ident an ident of instance method of the class. */
Adds instance method's name
addInstanceMethod
{ "repo_name": "nikhilgupta23/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java", "license": "lgpl-2.1", "size": 50485 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
1,112,355
public DateTime startTime() { return this.startTime; }
DateTime function() { return this.startTime; }
/** * Get start time of the downtime. * * @return the startTime value */
Get start time of the downtime
startTime
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/appservice/v2019_08_01/AbnormalTimePeriod.java", "license": "mit", "size": 2922 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
2,142,508
public boolean pressBack() { Tracer.trace(); waitForIdle(); return mUiAutomationBridge.getInteractionController().sendKeyAndWaitForEvent( KeyEvent.KEYCODE_BACK, 0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED, KEY_PRESS_EVENT_TIMEOUT); }
boolean function() { Tracer.trace(); waitForIdle(); return mUiAutomationBridge.getInteractionController().sendKeyAndWaitForEvent( KeyEvent.KEYCODE_BACK, 0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED, KEY_PRESS_EVENT_TIMEOUT); }
/** * Simulates a short press on the BACK button. * @return true if successful, else return false * @since API Level 16 */
Simulates a short press on the BACK button
pressBack
{ "repo_name": "rex-xxx/mt6572_x201", "path": "frameworks/testing/uiautomator/library/src/com/android/uiautomator/core/UiDevice.java", "license": "gpl-2.0", "size": 29468 }
[ "android.view.KeyEvent", "android.view.accessibility.AccessibilityEvent" ]
import android.view.KeyEvent; import android.view.accessibility.AccessibilityEvent;
import android.view.*; import android.view.accessibility.*;
[ "android.view" ]
android.view;
2,263,512
public LinkedBlockingDeque<PooledObject<S>> getIdleObjects() { return idleObjects; }
LinkedBlockingDeque<PooledObject<S>> function() { return idleObjects; }
/** * Gets the idle objects for the current key. * * @return The idle objects */
Gets the idle objects for the current key
getIdleObjects
{ "repo_name": "apache/commons-pool", "path": "src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java", "license": "apache-2.0", "size": 67849 }
[ "org.apache.commons.pool2.PooledObject" ]
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.*;
[ "org.apache.commons" ]
org.apache.commons;
707,766
@Override public void write(byte[] data, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(data[i]); } }// write(byte[])
void function(byte[] data, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(data[i]); } }
/** * Writes an array of bytes to the raw output stream. * Bytes resembling a frame token will be duplicated. * * * @param data the <tt>byte[]</tt> to be written. * @param off the offset into the data to start writing from. * @param len the number of bytes to be written from off. * * @throws java.io.IOException if an I/O error occurs. */
Writes an array of bytes to the raw output stream. Bytes resembling a frame token will be duplicated.
write
{ "repo_name": "jowiho/openhab", "path": "bundles/binding/org.openhab.binding.modbus/src/main/java/net/wimpi/modbus/io/BINOutputStream.java", "license": "epl-1.0", "size": 3328 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,768,567
@SuppressWarnings("unchecked") public <K, V> void assertMapInstanceBinding(Module module, Class<K> keyType, Class<V> valueType, Map<K, V> expected) throws Exception { // this method is insane because java type erasure makes it incredibly difficult... Map<K, Key> keys = new HashMap<>(); Map<Key, V> values = new HashMap<>(); List<Element> elements = Elements.getElements(module); for (Element element : elements) { if (element instanceof InstanceBinding) { InstanceBinding binding = (InstanceBinding) element; if (binding.getKey().getRawType().equals(valueType)) { values.put(binding.getKey(), (V) binding.getInstance()); } else if (binding.getInstance() instanceof Map.Entry) { Map.Entry entry = (Map.Entry) binding.getInstance(); Object key = entry.getKey(); Object providerValue = entry.getValue(); if (key.getClass().equals(keyType) && providerValue instanceof ProviderLookup.ProviderImpl) { ProviderLookup.ProviderImpl provider = (ProviderLookup.ProviderImpl) providerValue; keys.put((K) key, provider.getKey()); } } } } for (Map.Entry<K, V> entry : expected.entrySet()) { Key valueKey = keys.get(entry.getKey()); assertNotNull("Could not find binding for key [" + entry.getKey() + "], found these keys:\n" + keys.keySet(), valueKey); V value = values.get(valueKey); assertNotNull("Could not find value for instance key [" + valueKey + "], found these bindings:\n" + elements); assertEquals(entry.getValue(), value); } }
@SuppressWarnings(STR) <K, V> void function(Module module, Class<K> keyType, Class<V> valueType, Map<K, V> expected) throws Exception { Map<K, Key> keys = new HashMap<>(); Map<Key, V> values = new HashMap<>(); List<Element> elements = Elements.getElements(module); for (Element element : elements) { if (element instanceof InstanceBinding) { InstanceBinding binding = (InstanceBinding) element; if (binding.getKey().getRawType().equals(valueType)) { values.put(binding.getKey(), (V) binding.getInstance()); } else if (binding.getInstance() instanceof Map.Entry) { Map.Entry entry = (Map.Entry) binding.getInstance(); Object key = entry.getKey(); Object providerValue = entry.getValue(); if (key.getClass().equals(keyType) && providerValue instanceof ProviderLookup.ProviderImpl) { ProviderLookup.ProviderImpl provider = (ProviderLookup.ProviderImpl) providerValue; keys.put((K) key, provider.getKey()); } } } } for (Map.Entry<K, V> entry : expected.entrySet()) { Key valueKey = keys.get(entry.getKey()); assertNotNull(STR + entry.getKey() + STR + keys.keySet(), valueKey); V value = values.get(valueKey); assertNotNull(STR + valueKey + STR + elements); assertEquals(entry.getValue(), value); } }
/** * Configures the module, and ensures a map exists between the "keyType" and "valueType", * and that all of the "expected" values are bound. */
Configures the module, and ensures a map exists between the "keyType" and "valueType", and that all of the "expected" values are bound
assertMapInstanceBinding
{ "repo_name": "jimczi/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/common/inject/ModuleTestCase.java", "license": "apache-2.0", "size": 12291 }
[ "java.util.HashMap", "java.util.List", "java.util.Map", "org.elasticsearch.common.inject.spi.Element", "org.elasticsearch.common.inject.spi.Elements", "org.elasticsearch.common.inject.spi.InstanceBinding", "org.elasticsearch.common.inject.spi.ProviderLookup" ]
import java.util.HashMap; import java.util.List; import java.util.Map; import org.elasticsearch.common.inject.spi.Element; import org.elasticsearch.common.inject.spi.Elements; import org.elasticsearch.common.inject.spi.InstanceBinding; import org.elasticsearch.common.inject.spi.ProviderLookup;
import java.util.*; import org.elasticsearch.common.inject.spi.*;
[ "java.util", "org.elasticsearch.common" ]
java.util; org.elasticsearch.common;
352,670
@ApiModelProperty(value = "") public Long getTotalElements() { return totalElements; }
@ApiModelProperty(value = "") Long function() { return totalElements; }
/** * Get totalElements * @return totalElements **/
Get totalElements
getTotalElements
{ "repo_name": "knetikmedia/knetikcloud-java-client", "path": "src/main/java/com/knetikcloud/model/PageResourceFulfillmentType.java", "license": "apache-2.0", "size": 7512 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,028,195
ICpFile getFile();
ICpFile getFile();
/** * Returns actual ICpFile file corresponding to this info * @return actual ICpFile represented by the info */
Returns actual ICpFile file corresponding to this info
getFile
{ "repo_name": "borayildiz/cmsis-pack-eclipse", "path": "com.arm.cmsis.pack/src/com/arm/cmsis/pack/info/ICpFileInfo.java", "license": "apache-2.0", "size": 1368 }
[ "com.arm.cmsis.pack.data.ICpFile" ]
import com.arm.cmsis.pack.data.ICpFile;
import com.arm.cmsis.pack.data.*;
[ "com.arm.cmsis" ]
com.arm.cmsis;
1,241,014
public MapConfig setAsyncBackupCount(int asyncBackupCount) { this.asyncBackupCount = checkAsyncBackupCount(backupCount, asyncBackupCount); return this; }
MapConfig function(int asyncBackupCount) { this.asyncBackupCount = checkAsyncBackupCount(backupCount, asyncBackupCount); return this; }
/** * Sets the number of asynchronous backups. 0 means no backups. * * @param asyncBackupCount the number of asynchronous synchronous backups to set * @return the updated CacheConfig * @throws IllegalArgumentException if asyncBackupCount smaller than 0, * or larger than the maximum number of backup * or the sum of the backups and async backups is larger than the maximum number of backups * @see #setBackupCount(int) * @see #getAsyncBackupCount() */
Sets the number of asynchronous backups. 0 means no backups
setAsyncBackupCount
{ "repo_name": "dsukhoroslov/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/config/MapConfig.java", "license": "apache-2.0", "size": 42957 }
[ "com.hazelcast.util.Preconditions" ]
import com.hazelcast.util.Preconditions;
import com.hazelcast.util.*;
[ "com.hazelcast.util" ]
com.hazelcast.util;
2,603,709
private static String u2n(String s) { return File.separatorChar == '\\' ? s.replace('/', '\\') : s; }
static String function(String s) { return File.separatorChar == '\\' ? s.replace('/', '\\') : s; }
/** Converts a path from Unix to native. On Windows, converts * forward-slashes to back-slashes; on Linux, does nothing. */
Converts a path from Unix to native. On Windows, converts
u2n
{ "repo_name": "sreev/incubator-calcite", "path": "core/src/test/java/org/apache/calcite/test/QuidemTest.java", "license": "apache-2.0", "size": 11520 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,241,012
@Override public String getLocalName(){ if (localName == null) { coyoteRequest.action (ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest); localName = coyoteRequest.localName().toString(); } return localName; }
String function(){ if (localName == null) { coyoteRequest.action (ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest); localName = coyoteRequest.localName().toString(); } return localName; }
/** * Returns the host name of the Internet Protocol (IP) interface on * which the request was received. */
Returns the host name of the Internet Protocol (IP) interface on which the request was received
getLocalName
{ "repo_name": "wenzhucjy/tomcat_source", "path": "tomcat-7.0.63-sourcecode/target/classes/org/apache/catalina/connector/Request.java", "license": "apache-2.0", "size": 101883 }
[ "org.apache.coyote.ActionCode" ]
import org.apache.coyote.ActionCode;
import org.apache.coyote.*;
[ "org.apache.coyote" ]
org.apache.coyote;
1,895,521
EClass getStatechart();
EClass getStatechart();
/** * Returns the meta object for class '{@link org.yakindu.sct.model.sgraph.Statechart <em>Statechart</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Statechart</em>'. * @see org.yakindu.sct.model.sgraph.Statechart * @generated */
Returns the meta object for class '<code>org.yakindu.sct.model.sgraph.Statechart Statechart</code>'.
getStatechart
{ "repo_name": "Yakindu/statecharts", "path": "plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/SGraphPackage.java", "license": "epl-1.0", "size": 72772 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,162,646
Entity get( UUID id ) throws Exception;
Entity get( UUID id ) throws Exception;
/** * Gets an entity associated with this Application by unique id. * * @param id the unique identifier for the entity associated with this Application * @return the entity associated with this Application * @throws Exception if anything goes wrong accessing the entity */
Gets an entity associated with this Application by unique id
get
{ "repo_name": "pgorla/usergrid", "path": "core/src/test/java/org/usergrid/Application.java", "license": "apache-2.0", "size": 3725 }
[ "org.usergrid.persistence.Entity" ]
import org.usergrid.persistence.Entity;
import org.usergrid.persistence.*;
[ "org.usergrid.persistence" ]
org.usergrid.persistence;
627,191
EClass getPSDE();
EClass getPSDE();
/** * Returns the meta object for class '{@link gluemodel.substationStandard.LNNodes.LNGroupP.PSDE <em>PSDE</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>PSDE</em>'. * @see gluemodel.substationStandard.LNNodes.LNGroupP.PSDE * @generated */
Returns the meta object for class '<code>gluemodel.substationStandard.LNNodes.LNGroupP.PSDE PSDE</code>'.
getPSDE
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/substationStandard/LNNodes/LNGroupP/LNGroupPPackage.java", "license": "mit", "size": 291175 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
555,127
public static <E> List<Class<? extends E>> filterSkipped(InvocationContext context, List<Class<? extends E>> components) { Method request = context.getRequest(); if(!request.isAnnotationPresent(Skip.class)) { return components; } List<Class<?>> skippedComponents = Arrays.asList(request.getAnnotation(Skip.class).value()); List<Class<? extends E>> filteredComponents = new ArrayList<Class<? extends E>>(); for (Class<? extends E> component : components) { if(!skippedComponents.contains(component)) { filteredComponents.add(component); } } return filteredComponents; }
static <E> List<Class<? extends E>> function(InvocationContext context, List<Class<? extends E>> components) { Method request = context.getRequest(); if(!request.isAnnotationPresent(Skip.class)) { return components; } List<Class<?>> skippedComponents = Arrays.asList(request.getAnnotation(Skip.class).value()); List<Class<? extends E>> filteredComponents = new ArrayList<Class<? extends E>>(); for (Class<? extends E> component : components) { if(!skippedComponents.contains(component)) { filteredComponents.add(component); } } return filteredComponents; }
/** * <p>Accepts a list of components which are presumably attached to a request and removes those which * are skipped from execution by consulting an available <code>@Skip</code> annotation on the request.</p> * * <p>See {@link Skip}.</p> * * @param context * the {@link InvocationContext} used to discover request metadata * <br><br> * @param components * the {@link Class}es of the components to be filtered * <br><br> * @return the filtered components list which excludes those which are skipped for the given request * * @since 1.2.4 */
Accepts a list of components which are presumably attached to a request and removes those which are skipped from execution by consulting an available <code>@Skip</code> annotation on the request. See <code>Skip</code>
filterSkipped
{ "repo_name": "sahan/RoboZombie", "path": "robozombie/src/main/java/com/lonepulse/robozombie/util/Components.java", "license": "apache-2.0", "size": 3410 }
[ "com.lonepulse.robozombie.annotation.Skip", "com.lonepulse.robozombie.proxy.InvocationContext", "java.lang.reflect.Method", "java.util.ArrayList", "java.util.Arrays", "java.util.List" ]
import com.lonepulse.robozombie.annotation.Skip; import com.lonepulse.robozombie.proxy.InvocationContext; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List;
import com.lonepulse.robozombie.annotation.*; import com.lonepulse.robozombie.proxy.*; import java.lang.reflect.*; import java.util.*;
[ "com.lonepulse.robozombie", "java.lang", "java.util" ]
com.lonepulse.robozombie; java.lang; java.util;
1,302,558
public void testBTreeForwardScan_fetchRows_resumeAfterWait_unique() throws Exception { setAutoCommit(false); // Populate a table with a unique index Statement s = createStatement(); s.executeUpdate("create table t (x int, constraint c primary key(x))"); PreparedStatement ins = prepareStatement("insert into t values ?"); for (int i = 0; i < 300; i++) { ins.setInt(1, i); ins.executeUpdate(); } commit(); // Hold a lock in a different thread to stop the index scan obstruct("delete from t where x = 100", 2000); // Give the other thread time to obtain the lock Thread.sleep(1000); // Perform an index scan. Will be blocked for a while when fetching // the row where x=100, but should be able to resume the scan. ResultSet rs = s.executeQuery( "select * from t --DERBY-PROPERTIES constraint=C"); for (int i = 0; i < 300; i++) { assertTrue(rs.next()); assertEquals(i, rs.getInt(1)); } assertFalse(rs.next()); rs.close(); }
void function() throws Exception { setAutoCommit(false); Statement s = createStatement(); s.executeUpdate(STR); PreparedStatement ins = prepareStatement(STR); for (int i = 0; i < 300; i++) { ins.setInt(1, i); ins.executeUpdate(); } commit(); obstruct(STR, 2000); Thread.sleep(1000); ResultSet rs = s.executeQuery( STR); for (int i = 0; i < 300; i++) { assertTrue(rs.next()); assertEquals(i, rs.getInt(1)); } assertFalse(rs.next()); rs.close(); }
/** * Test that BTreeForwardScan.fetchRows() can reposition after releasing * latches because it had to wait for a lock. This tests the third call * to reposition() in fetchRows(), which is only called if the index is * unique. */
Test that BTreeForwardScan.fetchRows() can reposition after releasing latches because it had to wait for a lock. This tests the third call to reposition() in fetchRows(), which is only called if the index is unique
testBTreeForwardScan_fetchRows_resumeAfterWait_unique
{ "repo_name": "trejkaz/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/store/IndexSplitDeadlockTest.java", "license": "apache-2.0", "size": 34932 }
[ "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.Statement" ]
import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
6,997
protected void closeWriter() throws IOException { try { if (writer != null) { writer.close(); writer = null; } } finally { try { if (writerFile != null) { try { FileUtils.moveFile(writerFile, readerFile); } finally { writerFile = null; } } } finally { releaseLock(); } } }
void function() throws IOException { try { if (writer != null) { writer.close(); writer = null; } } finally { try { if (writerFile != null) { try { FileUtils.moveFile(writerFile, readerFile); } finally { writerFile = null; } } } finally { releaseLock(); } } }
/** * This method should never exit without releasing the lock. */
This method should never exit without releasing the lock
closeWriter
{ "repo_name": "knabar/openmicroscopy", "path": "components/romio/src/ome/io/bioformats/BfPyramidPixelBuffer.java", "license": "gpl-2.0", "size": 41159 }
[ "java.io.IOException", "org.apache.commons.io.FileUtils" ]
import java.io.IOException; import org.apache.commons.io.FileUtils;
import java.io.*; import org.apache.commons.io.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
2,741,747
public void onTxRollback() { rollbackTime.value(U.currentTimeMillis()); txRollbacks.increment(); }
void function() { rollbackTime.value(U.currentTimeMillis()); txRollbacks.increment(); }
/** * Transaction rollback callback. */
Transaction rollback callback
onTxRollback
{ "repo_name": "samaitra/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TransactionMetricsAdapter.java", "license": "apache-2.0", "size": 16281 }
[ "org.apache.ignite.internal.util.typedef.internal.U" ]
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.typedef.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,419,004
public PreparedStatement prepareAutoCloseStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { final Connection conn = getConnection(); final PreparedStatement pstmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); if (s_stmtLogger.isTraceEnabled()) { s_stmtLogger.trace("Preparing: " + sql); } closePreviousStatement(); _stmt = pstmt; return pstmt; }
PreparedStatement function(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { final Connection conn = getConnection(); final PreparedStatement pstmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); if (s_stmtLogger.isTraceEnabled()) { s_stmtLogger.trace(STR + sql); } closePreviousStatement(); _stmt = pstmt; return pstmt; }
/** * Prepares an auto close statement. The statement is closed automatically if it is * retrieved with this method. * * @param sql sql String * @return PreparedStatement * @throws SQLException if problem with JDBC layer. * * @see java.sql.Connection */
Prepares an auto close statement. The statement is closed automatically if it is retrieved with this method
prepareAutoCloseStatement
{ "repo_name": "resmo/cloudstack", "path": "framework/db/src/com/cloud/utils/db/TransactionLegacy.java", "license": "apache-2.0", "size": 48007 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
117,480
public EditableProperties getProperties() { return properties; }
EditableProperties function() { return properties; }
/** * Returns the properties set for the component. * * @return properties */
Returns the properties set for the component
getProperties
{ "repo_name": "ewpatton/appinventor-sources", "path": "appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java", "license": "apache-2.0", "size": 41403 }
[ "com.google.appinventor.client.widgets.properties.EditableProperties" ]
import com.google.appinventor.client.widgets.properties.EditableProperties;
import com.google.appinventor.client.widgets.properties.*;
[ "com.google.appinventor" ]
com.google.appinventor;
2,422,406
Collection<Map.Entry<K, V>> entries();
Collection<Map.Entry<K, V>> entries();
/** * Returns a view collection of all key-value pairs contained in this * multimap, as {@link Map.Entry} instances. * * <p>Changes to the returned collection or the entries it contains will * update the underlying multimap, and vice versa. However, <i>adding</i> to * the returned collection is not possible. * * @return collection of entries */
Returns a view collection of all key-value pairs contained in this multimap, as <code>Map.Entry</code> instances. Changes to the returned collection or the entries it contains will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible
entries
{ "repo_name": "jackygurui/redisson", "path": "redisson/src/main/java/org/redisson/api/RMultimap.java", "license": "apache-2.0", "size": 8037 }
[ "java.util.Collection", "java.util.Map" ]
import java.util.Collection; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,849,344
protected List<Attribute> check(Grammar g) { // Initialize the analyzer. analyzer.register(this); analyzer.init(g); phase = 1; // Initialize the top-level module and the list of global // attributes. Module root = g.modules.get(0); List<Attribute> attributes = new ArrayList<Attribute>(); // Make sure that any stateful attributes agree in their class // names. Additionally, collect any stateful, set, or flag // attributes in the global list of attributes. String stateName = null; boolean stateError = false; for (Module m2 : g.modules) { // Process stateful attribute. if (m2.hasAttribute(Constants.ATT_STATEFUL.getName())) { Attribute state = Attribute.get(Constants.ATT_STATEFUL.getName(), m2.attributes); Object value = state.getValue(); if ((null != value) && (value instanceof String) && (! ((String)value).startsWith("\""))) { if (null == stateName) { attributes.add(state); stateName = (String)state.getValue(); } if (! stateName.equals(state.getValue())) { stateError = true; } } } // Process set and flag attributes. if (m2.hasAttribute(Constants.NAME_STRING_SET) || m2.hasAttribute(Constants.NAME_FLAG)) { for (Attribute att : m2.attributes) { String name = att.getName(); if ((Constants.NAME_STRING_SET.equals(name) || Constants.NAME_FLAG.equals(name)) && (! attributes.contains(att))) { attributes.add(att); } } } } // Now, do the actual well-formedness checking. Set<ModuleName> visited = new HashSet<ModuleName>(); boolean hasTopLevel = false; for (Module m2 : g.modules) { analyzer.process(m2); hasState = false; isMofunctor = (null != m2.modification); if (null != m2.attributes) { final int length = m2.attributes.size(); for (int i=0; i<length; i++) { Attribute att = m2.attributes.get(i); String name = att.getName(); Object value = att.getValue(); if ((! Constants.ATT_WITH_LOCATION.equals(att)) && (! Constants.ATT_CONSTANT.equals(att)) && (! Constants.ATT_RAW_TYPES.equals(att)) && (! Constants.ATT_VERBOSE.equals(att)) && (! Constants.ATT_NO_WARNINGS.equals(att)) && (! Constants.ATT_IGNORING_CASE.equals(att)) && (! Constants.ATT_STATEFUL.getName().equals(name)) && (! Constants.NAME_PARSER.equals(name)) && (! Constants.NAME_MAIN.equals(name)) && (! Constants.NAME_PRINTER.equals(name)) && (! Constants.NAME_VISIBILITY.equals(name)) && (! Constants.NAME_STRING_SET.equals(name)) && (! Constants.NAME_FLAG.equals(name)) && (! Constants.NAME_FACTORY.equals(name)) && (! Constants.ATT_FLATTEN.equals(att)) && (! Constants.ATT_GENERIC_AS_VOID.equals(att)) && (! Constants.ATT_PARSE_TREE.equals(att)) && (! Constants.ATT_PROFILE.equals(att)) && (! Constants.ATT_DUMP.equals(att))) { runtime.error("unrecognized grammar-wide attribute '"+att+"'", att); } else { for (int j=0; j<i; j++) { Attribute att2 = m2.attributes.get(j); if (name.equals(Constants.NAME_STRING_SET) || name.equals(Constants.NAME_FLAG)) { if (att.equals(att2)) { runtime.error("duplicate attribute '"+att+"'", att); break; } else if ((null != value) && value.equals(att2.getValue())) { runtime.error("duplicate field name '" + att + "'", att); } } else if (name.equals(att2.getName())) { runtime.error("duplicate attribute '" + name + "'", att); break; } } } if (Constants.ATT_STATEFUL.getName().equals(name)) { if (null == value) { runtime.error("stateful attribute without class name", att); } else if (! (value instanceof String)) { runtime.error("stateful attribute with invalid value", att); } else if (((String)value).startsWith("\"")) { runtime.error("stateful attribute with invalid value", att); } else if (stateError) { runtime.error("inconsistent state class across modules", att); } hasState = true; } else if (Constants.NAME_PARSER.equals(name)) { if (null == value) { runtime.error("parser attribute without class name", att); } else if (! (value instanceof String)) { runtime.error("parser attribute with invalid value", att); } else if (((String)value).startsWith("\"")) { runtime.error("parser attribute with invalid value", att); } } else if (Constants.NAME_MAIN.equals(name)) { if (runtime.test("optionLGPL")) { runtime.error("main attribute incompatible with LGPL", att); } else if (null == value) { runtime.error("main attribute without nonterminal value", att); } else if (! (value instanceof String)) { runtime.error("main attribute with invalid value", att); } else if (((String)value).startsWith("\"")) { runtime.error("main attribute with invalid value", att); } else { NonTerminal nt = new NonTerminal((String)value); Production p = null; boolean err = false; try { p = analyzer.lookup(nt); } catch (IllegalArgumentException x) { runtime.error("main attribute with ambiguous nonterminal '" + nt + "'", att); err = true; } if (! err) { if (null == p) { runtime.error("main attribute with undefined nonterminal '" + nt + "'", att); } else if (! analyzer.isDefined(p, m2)) { runtime.error("main attribute with another module's " + "nonterminal '" + nt + "'", att); } else if (! p.hasAttribute(Constants.ATT_PUBLIC)) { runtime.error("main attribute with non-public nonterminal '" + nt + "'", att); } } } } else if (Constants.NAME_PRINTER.equals(name)) { if (runtime.test("optionLGPL")) { runtime.error("printer attribute incompatible with LGPL", att); } else if (null == value) { runtime.error("printer attribute without class name", att); } else if (! (value instanceof String)) { runtime.error("printer attribute with invalid value", att); } else if (((String)value).startsWith("\"")) { runtime.error("printer attribute with invalid value", att); } if (! m2.hasAttribute(Constants.NAME_MAIN)) { runtime.error("printer attribute without main attribute", att); } } else if (Constants.NAME_VISIBILITY.equals(name)) { if (null == value) { runtime.error("visibility attribute without value", att); } else if ((! Constants.ATT_PUBLIC.getValue().equals(value)) && (! Constants.ATT_PACKAGE_PRIVATE.getValue(). equals(value))) { runtime.error("visibility attribute with invalid value", att); } } else if (Constants.NAME_STRING_SET.equals(name)) { if (null == value) { runtime.error("string set attribute without set value", att); } else if (! (value instanceof String)) { runtime.error("string set attribute with invalid value", att); } else if (((String)value).startsWith("\"")) { runtime.error("string set attribute with invalid value", att); } } else if (Constants.NAME_FLAG.equals(name)) { if (null == value) { runtime.error("flag attribute without flag value", att); } else if (! (value instanceof String)) { runtime.error("flag attribute with invalid value", att); } else if (((String)value).startsWith("\"")) { runtime.error("flag attribute with invalid value", att); } } else if (Constants.NAME_FACTORY.equals(name)) { if (null == value) { runtime.error("factory attribute without class name", att); } else if (! (value instanceof String)) { runtime.error("factory attribute with invalid value", att); } else if (((String)value).startsWith("\"")) { runtime.error("factory attribute with invalud value", att); } } else if (Constants.ATT_GENERIC_AS_VOID.equals(att)) { if (m2.hasAttribute(Constants.ATT_PARSE_TREE)) { runtime.error("genericAsVoid attribute incompatible with " + "withParseTree attribute", att); } } else if (Constants.ATT_DUMP.equals(att)) { if (runtime.test("optionLGPL")) { runtime.error("dump attribute incompatible with LGPL", att); } } else if (Constants.ATT_RAW_TYPES.equals(att)) { runtime.warning("the rawTypes attribute has been deprecated", att); runtime.errConsole().loc(att). pln(": warning: and will be removed in a future release").flush(); } } } // If this module does not have a stateful attribute, check the // the current module's direct imports as well as any modified // modules and their direct imports. if (! hasState) { hasState = analyzer.hasAttribute(m2, Constants.ATT_STATEFUL.getName(), visited); visited.clear(); } // Check the productions. for (Production p : m2.productions) { // Initialize the per-production state. sequenceNames.clear(); // Process the production. analyzer.process(p); // Check for duplicate definitions. try { if ((! p.isPartial()) && (p != analyzer.lookup(p.name))) { runtime.error("duplicate definition for nonterminal '" + p.name + "'", p); } } catch (IllegalArgumentException x) { runtime.error("duplicate definition for nonterminal '" + p.name + "'", p); } // Process top-level productions. Only public productions // from the top-level module are recognized as top-level for // the entire grammar. if (p.hasAttribute(Constants.ATT_PUBLIC)) { if (analyzer.isDefined(p, root)) { hasTopLevel = true; } else { p.attributes.remove(Constants.ATT_PUBLIC); } } } } // Check for top-level nonterminals. if (! hasTopLevel) { runtime.error("no public nonterminal", g.modules.get(0).productions.get(0)); } // Done. return attributes; }
List<Attribute> function(Grammar g) { analyzer.register(this); analyzer.init(g); phase = 1; Module root = g.modules.get(0); List<Attribute> attributes = new ArrayList<Attribute>(); String stateName = null; boolean stateError = false; for (Module m2 : g.modules) { if (m2.hasAttribute(Constants.ATT_STATEFUL.getName())) { Attribute state = Attribute.get(Constants.ATT_STATEFUL.getName(), m2.attributes); Object value = state.getValue(); if ((null != value) && (value instanceof String) && (! ((String)value).startsWith("\"STRunrecognized grammar-wide attribute '"+att+"'STRduplicate attribute '"+att+"'STRduplicate field name 'STR'STRduplicate attribute 'STR'STRstateful attribute without class nameSTRstateful attribute with invalid valueSTR\STRstateful attribute with invalid valueSTRinconsistent state class across modulesSTRparser attribute without class nameSTRparser attribute with invalid valueSTR\STRparser attribute with invalid valueSTRoptionLGPLSTRmain attribute incompatible with LGPLSTRmain attribute without nonterminal valueSTRmain attribute with invalid valueSTR\STRmain attribute with invalid valueSTRmain attribute with ambiguous nonterminal 'STR'STRmain attribute with undefined nonterminal 'STR'STRmain attribute with another module's STRnonterminal 'STR'STRmain attribute with non-public nonterminal 'STR'STRoptionLGPLSTRprinter attribute incompatible with LGPLSTRprinter attribute without class nameSTRprinter attribute with invalid valueSTR\STRprinter attribute with invalid valueSTRprinter attribute without main attributeSTRvisibility attribute without valueSTRvisibility attribute with invalid valueSTRstring set attribute without set valueSTRstring set attribute with invalid valueSTR\STRstring set attribute with invalid valueSTRflag attribute without flag valueSTRflag attribute with invalid valueSTR\STRflag attribute with invalid valueSTRfactory attribute without class nameSTRfactory attribute with invalid valueSTR\STRfactory attribute with invalud valueSTRgenericAsVoid attribute incompatible with STRwithParseTree attributeSTRoptionLGPLSTRdump attribute incompatible with LGPLSTRthe rawTypes attribute has been deprecatedSTR: warning: and will be removed in a future releaseSTRduplicate definition for nonterminal 'STR'STRduplicate definition for nonterminal 'STR'STRno public nonterminal", g.modules.get(0).productions.get(0)); } return attributes; }
/** * Perform basic checking for the specified grammar. This method * does all correctness checking besides checking the contents of * partial productions and checking for left-recursive definitions. * Note that this method initializes the analyzer with the specified * grammar. * * @param g The grammar. * @return The list of global attributes, if any. */
Perform basic checking for the specified grammar. This method does all correctness checking besides checking the contents of partial productions and checking for left-recursive definitions. Note that this method initializes the analyzer with the specified grammar
check
{ "repo_name": "wandoulabs/xtc-rats", "path": "xtc-core/src/main/java/xtc/parser/Resolver.java", "license": "lgpl-2.1", "size": 79365 }
[ "java.util.ArrayList", "java.util.List", "xtc.tree.Attribute" ]
import java.util.ArrayList; import java.util.List; import xtc.tree.Attribute;
import java.util.*; import xtc.tree.*;
[ "java.util", "xtc.tree" ]
java.util; xtc.tree;
800,461
public synchronized void export(File file, String format, Dimension size) throws IllegalArgumentException { String extension = MonitorUtilities.getExtension(file); if (format == FORMAT_RASTER) { if (extension == null) extension = "png"; try { ImageIO.write(snapShot((int) size.getWidth(), (int) size.getHeight()), extension, file); } catch (IOException e) { e.printStackTrace(); } } else if (format == FORMAT_VECTOR) { setVisible(false); setSize(size); try { FileOutputStream outStream = new FileOutputStream(file); AbstractPSDocumentGraphics2D g2d = null; if (extension == "eps") g2d = new EPSDocumentGraphics2D(true); else g2d = new PSDocumentGraphics2D(true); g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext()); g2d.setupDocument(outStream, (int) size.getWidth(), (int) size.getHeight()); paint(g2d); outStream.close(); } catch (IOException e) { e.printStackTrace(); } setVisible(true); } else throw new IllegalArgumentException("Unknown format."); }
synchronized void function(File file, String format, Dimension size) throws IllegalArgumentException { String extension = MonitorUtilities.getExtension(file); if (format == FORMAT_RASTER) { if (extension == null) extension = "png"; try { ImageIO.write(snapShot((int) size.getWidth(), (int) size.getHeight()), extension, file); } catch (IOException e) { e.printStackTrace(); } } else if (format == FORMAT_VECTOR) { setVisible(false); setSize(size); try { FileOutputStream outStream = new FileOutputStream(file); AbstractPSDocumentGraphics2D g2d = null; if (extension == "eps") g2d = new EPSDocumentGraphics2D(true); else g2d = new PSDocumentGraphics2D(true); g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext()); g2d.setupDocument(outStream, (int) size.getWidth(), (int) size.getHeight()); paint(g2d); outStream.close(); } catch (IOException e) { e.printStackTrace(); } setVisible(true); } else throw new IllegalArgumentException(STR); }
/** * Exports a <code>Chart</code>. * * @param file the file in which the <code>Chart</code> is exported. * @param format the format among FORMAT_RASTER, FORMAT_VECTOR. * @param size the size in which the graph should be printed. * @throws IllegalArgumentException if the format is unknown. * * @see #FORMAT_RASTER * @see #FORMAT_VECTOR */
Exports a <code>Chart</code>
export
{ "repo_name": "sfrancis1970/EpochX", "path": "monitor/src/main/java/org/epochx/monitor/chart/Chart.java", "license": "gpl-3.0", "size": 8127 }
[ "java.awt.Dimension", "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "javax.imageio.ImageIO", "org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D", "org.apache.xmlgraphics.java2d.ps.EPSDocumentGraphics2D", "org.apache.xmlgraphics.java2d.ps.PSDocumentGraphics2D", "org.epochx.monitor.MonitorUtilities" ]
import java.awt.Dimension; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import javax.imageio.ImageIO; import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D; import org.apache.xmlgraphics.java2d.ps.EPSDocumentGraphics2D; import org.apache.xmlgraphics.java2d.ps.PSDocumentGraphics2D; import org.epochx.monitor.MonitorUtilities;
import java.awt.*; import java.io.*; import javax.imageio.*; import org.apache.xmlgraphics.java2d.ps.*; import org.epochx.monitor.*;
[ "java.awt", "java.io", "javax.imageio", "org.apache.xmlgraphics", "org.epochx.monitor" ]
java.awt; java.io; javax.imageio; org.apache.xmlgraphics; org.epochx.monitor;
583,072
private ApprovalAttribute getApprovalAttribute( Entry<ApprovalCategory.Id, ApprovalCategoryValue.Id> approval) { ApprovalAttribute a = new ApprovalAttribute(); a.type = approval.getKey().get(); LabelType lt = labelTypes.byId(approval.getKey().get()); if (lt != null) { a.description = lt.getName(); } a.value = Short.toString(approval.getValue().get()); return a; }
ApprovalAttribute function( Entry<ApprovalCategory.Id, ApprovalCategoryValue.Id> approval) { ApprovalAttribute a = new ApprovalAttribute(); a.type = approval.getKey().get(); LabelType lt = labelTypes.byId(approval.getKey().get()); if (lt != null) { a.description = lt.getName(); } a.value = Short.toString(approval.getValue().get()); return a; }
/** * Create an ApprovalAttribute for the given approval suitable for serialization to JSON. * @param approval * @return object suitable for serialization to JSON */
Create an ApprovalAttribute for the given approval suitable for serialization to JSON
getApprovalAttribute
{ "repo_name": "teamblueridge/gerrit", "path": "gerrit-server/src/main/java/com/google/gerrit/common/ChangeHookRunner.java", "license": "apache-2.0", "size": 31612 }
[ "com.google.gerrit.common.data.LabelType", "com.google.gerrit.reviewdb.client.ApprovalCategory", "com.google.gerrit.reviewdb.client.ApprovalCategoryValue", "com.google.gerrit.server.events.ApprovalAttribute", "java.util.Map" ]
import com.google.gerrit.common.data.LabelType; import com.google.gerrit.reviewdb.client.ApprovalCategory; import com.google.gerrit.reviewdb.client.ApprovalCategoryValue; import com.google.gerrit.server.events.ApprovalAttribute; import java.util.Map;
import com.google.gerrit.common.data.*; import com.google.gerrit.reviewdb.client.*; import com.google.gerrit.server.events.*; import java.util.*;
[ "com.google.gerrit", "java.util" ]
com.google.gerrit; java.util;
519,129
public void resetPixelArray() { // send vendor request for device to reset array int status = 0; // don't use global status in this function if (gUsbIo == null) { throw new RuntimeException("device must be opened before sending this vendor request"); } // make vendor request structure and populate it USBIO_CLASS_OR_VENDOR_REQUEST VendorRequest = new USBIO_CLASS_OR_VENDOR_REQUEST(); VendorRequest.Flags = UsbIoInterface.USBIO_SHORT_TRANSFER_OK; VendorRequest.Type = UsbIoInterface.RequestTypeVendor; VendorRequest.Recipient = UsbIoInterface.RecipientDevice; VendorRequest.RequestTypeReservedBits = 0; VendorRequest.Request = VENDOR_REQUEST_DO_ARRAY_RESET; VendorRequest.Index = 0; VendorRequest.Value = 0; USBIO_DATA_BUFFER dataBuffer = new USBIO_DATA_BUFFER(1); dataBuffer.setNumberOfBytesToTransfer(1); // dataBuffer.Buffer()[0]=1; status = gUsbIo.classOrVendorOutRequest(dataBuffer, VendorRequest); if (status != USBIO_ERR_SUCCESS) { log.warning("CypressFX2.resetPixelArray: couldn't send vendor request to reset array"); } } protected boolean arrayResetEnabled = false;
void function() { int status = 0; if (gUsbIo == null) { throw new RuntimeException(STR); } USBIO_CLASS_OR_VENDOR_REQUEST VendorRequest = new USBIO_CLASS_OR_VENDOR_REQUEST(); VendorRequest.Flags = UsbIoInterface.USBIO_SHORT_TRANSFER_OK; VendorRequest.Type = UsbIoInterface.RequestTypeVendor; VendorRequest.Recipient = UsbIoInterface.RecipientDevice; VendorRequest.RequestTypeReservedBits = 0; VendorRequest.Request = VENDOR_REQUEST_DO_ARRAY_RESET; VendorRequest.Index = 0; VendorRequest.Value = 0; USBIO_DATA_BUFFER dataBuffer = new USBIO_DATA_BUFFER(1); dataBuffer.setNumberOfBytesToTransfer(1); status = gUsbIo.classOrVendorOutRequest(dataBuffer, VendorRequest); if (status != USBIO_ERR_SUCCESS) { log.warning(STR); } } protected boolean arrayResetEnabled = false;
/** * Reset the entire pixel array. Some interfaces may not support this * functionality; they may not implement this vendor request. No exceptions * are thrown but a warning mesasge is printed. */
Reset the entire pixel array. Some interfaces may not support this functionality; they may not implement this vendor request. No exceptions are thrown but a warning mesasge is printed
resetPixelArray
{ "repo_name": "viktorbahr/jaer", "path": "src/net/sf/jaer/hardwareinterface/usb/cypressfx2/CypressFX2.java", "license": "lgpl-2.1", "size": 142778 }
[ "de.thesycon.usbio.UsbIoInterface" ]
import de.thesycon.usbio.UsbIoInterface;
import de.thesycon.usbio.*;
[ "de.thesycon.usbio" ]
de.thesycon.usbio;
135,815
private static List<Widget> getActiveWidgets(final MXSession session, final Room room, final Set<String> widgetTypes, final Set<String> excludedTypes) { // Get all im.vector.modular.widgets state events in the room List<Event> widgetEvents = room.getState().getStateEvents(new HashSet<>(Arrays.asList(WIDGET_EVENT_TYPE))); // Widget id -> widget Map<String, Widget> widgets = new HashMap<>(); // Order widgetEvents with the last event first // There can be several im.vector.modular.widgets state events for a same widget but // only the last one must be considered.
static List<Widget> function(final MXSession session, final Room room, final Set<String> widgetTypes, final Set<String> excludedTypes) { List<Event> widgetEvents = room.getState().getStateEvents(new HashSet<>(Arrays.asList(WIDGET_EVENT_TYPE))); Map<String, Widget> widgets = new HashMap<>();
/** * List all active widgets in a room. * * @param session the session. * @param room the room to check. * @param widgetTypes the widget types * @param excludedTypes the excluded widget types * @return the active widgets list */
List all active widgets in a room
getActiveWidgets
{ "repo_name": "vector-im/vector-android", "path": "vector/src/main/java/im/vector/widgets/WidgetsManager.java", "license": "apache-2.0", "size": 22677 }
[ "java.util.Arrays", "java.util.HashMap", "java.util.HashSet", "java.util.List", "java.util.Map", "java.util.Set", "org.matrix.androidsdk.MXSession", "org.matrix.androidsdk.data.Room", "org.matrix.androidsdk.rest.model.Event" ]
import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.matrix.androidsdk.MXSession; import org.matrix.androidsdk.data.Room; import org.matrix.androidsdk.rest.model.Event;
import java.util.*; import org.matrix.androidsdk.*; import org.matrix.androidsdk.data.*; import org.matrix.androidsdk.rest.model.*;
[ "java.util", "org.matrix.androidsdk" ]
java.util; org.matrix.androidsdk;
2,583,529
public boolean isWrapperFor(Class iface) throws SQLException { return true; }
boolean function(Class iface) throws SQLException { return true; }
/** * Place holder for abstract method * isWrapperFor(java.lang.Class) in java.sql.Wrapper * required by jdk 1.6 * * @param iface - a Class defining an interface. * @throws SQLException * @return boolean */
Place holder for abstract method isWrapperFor(java.lang.Class) in java.sql.Wrapper required by jdk 1.6
isWrapperFor
{ "repo_name": "ameybarve15/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/datasource/GemFireBasicDataSource.java", "license": "apache-2.0", "size": 4717 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
84,958
@Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(EditPatientActivity.this); pDialog.setMessage("Saving patient ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); }
void function() { super.onPreExecute(); pDialog = new ProgressDialog(EditPatientActivity.this); pDialog.setMessage(STR); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); }
/** * Before starting background thread Show Progress Dialog * */
Before starting background thread Show Progress Dialog
onPreExecute
{ "repo_name": "Tvli/AgonyAunt", "path": "app/src/main/java/com/example/agonyaunt/EditPatientActivity.java", "license": "apache-2.0", "size": 13740 }
[ "android.app.ProgressDialog" ]
import android.app.ProgressDialog;
import android.app.*;
[ "android.app" ]
android.app;
622,452
private void append(final String text, final int indent) { String appendText; if (indent > 0) { char[] c = new char[indent]; Arrays.fill(c, ' '); String pad = String.valueOf(c); appendText = pad + text.replaceAll("\\n", "\n" + pad); } else { appendText = text; } textArea.append(appendText); textArea.setCaretPosition(textArea.getDocument().getLength()); }
void function(final String text, final int indent) { String appendText; if (indent > 0) { char[] c = new char[indent]; Arrays.fill(c, ' '); String pad = String.valueOf(c); appendText = pad + text.replaceAll("\\n", "\n" + pad); } else { appendText = text; } textArea.append(appendText); textArea.setCaretPosition(textArea.getDocument().getLength()); }
/** * Appends the given text to that displayed. No additional newlines are added after the * text. * * @param text the text to append * @param indent indent width as number of spaces */
Appends the given text to that displayed. No additional newlines are added after the text
append
{ "repo_name": "geotools/geotools", "path": "modules/unsupported/swing/src/main/java/org/geotools/swing/dialog/JTextReporter.java", "license": "lgpl-2.1", "size": 26671 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
2,021,970
EClass getLookupEnvironment();
EClass getLookupEnvironment();
/** * Returns the meta object for class '{@link org.xtext.example.plsql.astm.lookup.LookupEnvironment <em>Environment</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Environment</em>'. * @see org.xtext.example.plsql.astm.lookup.LookupEnvironment * @generated */
Returns the meta object for class '<code>org.xtext.example.plsql.astm.lookup.LookupEnvironment Environment</code>'.
getLookupEnvironment
{ "repo_name": "adolfosbh/cs2as", "path": "org.xtext.example.plsql/emf-gen/org/xtext/example/plsql/astm/lookup/LookupPackage.java", "license": "epl-1.0", "size": 11138 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,158,763
protected ResourceLocation getEntityTexture(EntityAreaEffectCloud entity) { return null; }
ResourceLocation function(EntityAreaEffectCloud entity) { return null; }
/** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */
Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture
getEntityTexture
{ "repo_name": "danielyc/test-1.9.4", "path": "build/tmp/recompileMc/sources/net/minecraft/client/renderer/entity/RenderAreaEffectCloud.java", "license": "gpl-3.0", "size": 947 }
[ "net.minecraft.entity.EntityAreaEffectCloud", "net.minecraft.util.ResourceLocation" ]
import net.minecraft.entity.EntityAreaEffectCloud; import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.*; import net.minecraft.util.*;
[ "net.minecraft.entity", "net.minecraft.util" ]
net.minecraft.entity; net.minecraft.util;
34,662
public int registerCustomItemName(Plugin plugin, String key);
int function(Plugin plugin, String key);
/** * Registers the id for a custom item. The key should be unique. * <p/> * The returned id should be used for accessing the item and is persistent between server restarts and reloads * @param key Key of the new item * @return the unique id or null on error */
Registers the id for a custom item. The key should be unique. The returned id should be used for accessing the item and is persistent between server restarts and reloads
registerCustomItemName
{ "repo_name": "Spoutcraft/SpoutcraftPlugin", "path": "src/main/java/org/getspout/spoutapi/inventory/MaterialManager.java", "license": "lgpl-3.0", "size": 4682 }
[ "org.bukkit.plugin.Plugin" ]
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.*;
[ "org.bukkit.plugin" ]
org.bukkit.plugin;
2,891,526
public WSFile getProjectSegment(int index, int major, int minor) throws IhcExecption { return controllerService.getProjectSegment(index, major, minor); }
WSFile function(int index, int major, int minor) throws IhcExecption { return controllerService.getProjectSegment(index, major, minor); }
/** * Query project segments data. * * @return segments data. */
Query project segments data
getProjectSegment
{ "repo_name": "paulianttila/openhab2", "path": "bundles/org.openhab.binding.ihc/src/main/java/org/openhab/binding/ihc/internal/ws/IhcClient.java", "license": "epl-1.0", "size": 21653 }
[ "org.openhab.binding.ihc.internal.ws.datatypes.WSFile", "org.openhab.binding.ihc.internal.ws.exeptions.IhcExecption" ]
import org.openhab.binding.ihc.internal.ws.datatypes.WSFile; import org.openhab.binding.ihc.internal.ws.exeptions.IhcExecption;
import org.openhab.binding.ihc.internal.ws.datatypes.*; import org.openhab.binding.ihc.internal.ws.exeptions.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,651,863
void load(String command) throws CacheException { String name = parseName(command); if (name != null) { Properties env = new Properties(); env.setProperty("cache-xml-file", name); if (cache != null) { cache.close(); } this.cache = new CacheFactory(env).create(); currRegion = cache.getRegion("root"); } }
void load(String command) throws CacheException { String name = parseName(command); if (name != null) { Properties env = new Properties(); env.setProperty(STR, name); if (cache != null) { cache.close(); } this.cache = new CacheFactory(env).create(); currRegion = cache.getRegion("root"); } }
/** * Specifies the <code>cache.xml</code> file to use when creating * the <code>Cache</code>. If the <code>Cache</code> has already * been open, then the existing one is closed. * * @see CacheFactory#create */
Specifies the <code>cache.xml</code> file to use when creating the <code>Cache</code>. If the <code>Cache</code> has already been open, then the existing one is closed
load
{ "repo_name": "papicella/snappy-store", "path": "gemfire-examples/src/dist/java/cacheRunner/CacheRunner.java", "license": "apache-2.0", "size": 58690 }
[ "com.gemstone.gemfire.cache.CacheException", "com.gemstone.gemfire.cache.CacheFactory", "java.util.Properties" ]
import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.cache.CacheFactory; import java.util.Properties;
import com.gemstone.gemfire.cache.*; import java.util.*;
[ "com.gemstone.gemfire", "java.util" ]
com.gemstone.gemfire; java.util;
1,936,498
private static FeatureProperty[] getFeatureProperties(final Feature feature, final int n) { final PropertyType[] ftp = feature.getFeatureType().getProperties(); final FeatureProperty[] fp = new FeatureProperty[ftp.length + 1]; final FeatureProperty[] fp_ = feature.getProperties(); fp[0] = org.deegree.model.feature.FeatureFactory.createFeatureProperty(new QualifiedName("unique_gid"), n); for (int i = 0; i < ftp.length; i++) { fp[i + 1] = org.deegree.model.feature.FeatureFactory.createFeatureProperty( ftp[i].getName(), fp_[i].getValue()); } return fp; }
static FeatureProperty[] function(final Feature feature, final int n) { final PropertyType[] ftp = feature.getFeatureType().getProperties(); final FeatureProperty[] fp = new FeatureProperty[ftp.length + 1]; final FeatureProperty[] fp_ = feature.getProperties(); fp[0] = org.deegree.model.feature.FeatureFactory.createFeatureProperty(new QualifiedName(STR), n); for (int i = 0; i < ftp.length; i++) { fp[i + 1] = org.deegree.model.feature.FeatureFactory.createFeatureProperty( ftp[i].getName(), fp_[i].getValue()); } return fp; }
/** * DOCUMENT ME! * * @param feature DOCUMENT ME! * @param n DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
getFeatureProperties
{ "repo_name": "cismet/cismap-commons", "path": "src/main/java/de/cismet/cismap/commons/tools/DBaseFileHelper.java", "license": "lgpl-3.0", "size": 4216 }
[ "org.deegree.datatypes.QualifiedName", "org.deegree.model.feature.Feature", "org.deegree.model.feature.FeatureProperty", "org.deegree.model.feature.schema.PropertyType" ]
import org.deegree.datatypes.QualifiedName; import org.deegree.model.feature.Feature; import org.deegree.model.feature.FeatureProperty; import org.deegree.model.feature.schema.PropertyType;
import org.deegree.datatypes.*; import org.deegree.model.feature.*; import org.deegree.model.feature.schema.*;
[ "org.deegree.datatypes", "org.deegree.model" ]
org.deegree.datatypes; org.deegree.model;
691,676