method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@XmlTransient @OneToMany(mappedBy="map") @org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN }) public Set<OnmsMapElement> getMapElements() { return this.mapElements; }
@OneToMany(mappedBy="map") @org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN }) Set<OnmsMapElement> function() { return this.mapElements; }
/** * <p>Getter for the field <code>mapElements</code>.</p> * * @return a {@link java.util.Set} object. */
Getter for the field <code>mapElements</code>
getMapElements
{ "repo_name": "dzonekl/oss2nms", "path": "plugins/com.netxforge.oss2.model/src/com/netxforge/oss2/model/OnmsMap.java", "license": "gpl-3.0", "size": 14660 }
[ "java.util.Set", "javax.persistence.OneToMany" ]
import java.util.Set; import javax.persistence.OneToMany;
import java.util.*; import javax.persistence.*;
[ "java.util", "javax.persistence" ]
java.util; javax.persistence;
773,704
CommandLineConfig setExterns(List<String> externs) { this.externs.clear(); this.externs.addAll(externs); return this; } private final List<String> js = new ArrayList<>();
CommandLineConfig setExterns(List<String> externs) { this.externs.clear(); this.externs.addAll(externs); return this; } private final List<String> js = new ArrayList<>();
/** * The file containing JavaScript externs. You may specify multiple. */
The file containing JavaScript externs. You may specify multiple
setExterns
{ "repo_name": "fvigotti/closure-compiler", "path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java", "license": "apache-2.0", "size": 69434 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,271,300
List<BlobServerConnection> getCurrentActiveConnections() { synchronized (activeConnections) { return new ArrayList<>(activeConnections); } }
List<BlobServerConnection> getCurrentActiveConnections() { synchronized (activeConnections) { return new ArrayList<>(activeConnections); } }
/** * Returns all the current active connections in the BlobServer. * * @return the list of all the active in current BlobServer */
Returns all the current active connections in the BlobServer
getCurrentActiveConnections
{ "repo_name": "tillrohrmann/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobServer.java", "license": "apache-2.0", "size": 35012 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,652,429
static void configureBloomType(HTable table, Configuration conf) throws IOException { HTableDescriptor tableDescriptor = table.getTableDescriptor(); if (tableDescriptor == null) { // could happen with mock table instance return; } StringBuilder bloomTypeConfigValue = new StringBuilder(); Collection<HColumnDescriptor> families = tableDescriptor.getFamilies(); int i = 0; for (HColumnDescriptor familyDescriptor : families) { if (i++ > 0) { bloomTypeConfigValue.append('&'); } bloomTypeConfigValue.append(URLEncoder.encode(familyDescriptor.getNameAsString(), "UTF-8")); bloomTypeConfigValue.append('='); String bloomType = familyDescriptor.getBloomFilterType().toString(); if (bloomType == null) { bloomType = HColumnDescriptor.DEFAULT_BLOOMFILTER; } bloomTypeConfigValue.append(URLEncoder.encode(bloomType, "UTF-8")); } conf.set(BLOOM_TYPE_CONF_KEY, bloomTypeConfigValue.toString()); }
static void configureBloomType(HTable table, Configuration conf) throws IOException { HTableDescriptor tableDescriptor = table.getTableDescriptor(); if (tableDescriptor == null) { return; } StringBuilder bloomTypeConfigValue = new StringBuilder(); Collection<HColumnDescriptor> families = tableDescriptor.getFamilies(); int i = 0; for (HColumnDescriptor familyDescriptor : families) { if (i++ > 0) { bloomTypeConfigValue.append('&'); } bloomTypeConfigValue.append(URLEncoder.encode(familyDescriptor.getNameAsString(), "UTF-8")); bloomTypeConfigValue.append('='); String bloomType = familyDescriptor.getBloomFilterType().toString(); if (bloomType == null) { bloomType = HColumnDescriptor.DEFAULT_BLOOMFILTER; } bloomTypeConfigValue.append(URLEncoder.encode(bloomType, "UTF-8")); } conf.set(BLOOM_TYPE_CONF_KEY, bloomTypeConfigValue.toString()); }
/** * Serialize column family to bloom type map to configuration. * Invoked while configuring the MR job for incremental load. * * @throws IOException * on failure to read column family descriptors */
Serialize column family to bloom type map to configuration. Invoked while configuring the MR job for incremental load
configureBloomType
{ "repo_name": "cloud-software-foundation/c5", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java", "license": "apache-2.0", "size": 21289 }
[ "java.io.IOException", "java.net.URLEncoder", "java.util.Collection", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.HColumnDescriptor", "org.apache.hadoop.hbase.HTableDescriptor", "org.apache.hadoop.hbase.client.HTable" ]
import java.io.IOException; import java.net.URLEncoder; import java.util.Collection; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.HTable;
import java.io.*; import java.net.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "java.net", "java.util", "org.apache.hadoop" ]
java.io; java.net; java.util; org.apache.hadoop;
507,861
@Override public java.util.HashMap<IGeoMilSymbol.Modifier, String> getModifiers() { return this.getRenderable().getModifiers(); } /** * This method set a single modifier to the value provided. This method overrides the modifier value * with the value provided. If the sValue is null the modifier is removed from the list. * @param eModifier {@link IGeoMilSymbol.Modifier}
java.util.HashMap<IGeoMilSymbol.Modifier, String> function() { return this.getRenderable().getModifiers(); } /** * This method set a single modifier to the value provided. This method overrides the modifier value * with the value provided. If the sValue is null the modifier is removed from the list. * @param eModifier {@link IGeoMilSymbol.Modifier}
/** * This method retrieves the list of MilStd 2525 modifiers. * @return java.util.HashMap<IGeoMilSymbol.Modifier, String> */
This method retrieves the list of MilStd 2525 modifiers
getModifiers
{ "repo_name": "missioncommand/emp3-android", "path": "sdk/sdk-api/src/main/java/mil/emp3/api/MilStdSymbol.java", "license": "apache-2.0", "size": 66987 }
[ "org.cmapi.primitives.IGeoMilSymbol" ]
import org.cmapi.primitives.IGeoMilSymbol;
import org.cmapi.primitives.*;
[ "org.cmapi.primitives" ]
org.cmapi.primitives;
1,372,549
public Cancellable updateModelSnapshotAsync(UpdateModelSnapshotRequest request, RequestOptions options, ActionListener<UpdateModelSnapshotResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(request, MLRequestConverters::updateModelSnapshot, options, UpdateModelSnapshotResponse::fromXContent, listener, Collections.emptySet()); }
Cancellable function(UpdateModelSnapshotRequest request, RequestOptions options, ActionListener<UpdateModelSnapshotResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(request, MLRequestConverters::updateModelSnapshot, options, UpdateModelSnapshotResponse::fromXContent, listener, Collections.emptySet()); }
/** * Updates a snapshot for a Machine Learning Job, notifies listener once the requested snapshots are retrieved. * <p> * For additional info * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html"> * ML UPDATE model snapshots documentation</a> * * @param request The request * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener Listener to be notified upon request completion * @return cancellable that may be used to cancel the request */
Updates a snapshot for a Machine Learning Job, notifies listener once the requested snapshots are retrieved. For additional info see ML UPDATE model snapshots documentation
updateModelSnapshotAsync
{ "repo_name": "gingerwizard/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/MachineLearningClient.java", "license": "apache-2.0", "size": 133077 }
[ "java.util.Collections", "org.elasticsearch.action.ActionListener", "org.elasticsearch.client.ml.UpdateModelSnapshotRequest", "org.elasticsearch.client.ml.UpdateModelSnapshotResponse" ]
import java.util.Collections; import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.ml.UpdateModelSnapshotRequest; import org.elasticsearch.client.ml.UpdateModelSnapshotResponse;
import java.util.*; import org.elasticsearch.action.*; import org.elasticsearch.client.ml.*;
[ "java.util", "org.elasticsearch.action", "org.elasticsearch.client" ]
java.util; org.elasticsearch.action; org.elasticsearch.client;
1,222,097
Playlist getPlaylist(PlaylistRemote playlistRemote) throws JSONException, WSError;
Playlist getPlaylist(PlaylistRemote playlistRemote) throws JSONException, WSError;
/** * Gets playlist with album and track from the remote server * * @param playlistRemote * @return * @throws JSONException * @throws WSError */
Gets playlist with album and track from the remote server
getPlaylist
{ "repo_name": "lihao814386741/AndroidCourse", "path": "src/com/teleca/jamendo/api/JamendoGet2Api.java", "license": "apache-2.0", "size": 8315 }
[ "org.json.JSONException" ]
import org.json.JSONException;
import org.json.*;
[ "org.json" ]
org.json;
296,639
@Override public String getSmartDashboardType() { return "Ultrasonic"; } private ITable m_table;
String function() { return STR; } private ITable m_table;
/** * Live Window code, only does anything if live window is activated. */
Live Window code, only does anything if live window is activated
getSmartDashboardType
{ "repo_name": "333fred/allwpilib", "path": "wpilibj/src/athena/java/edu/wpi/first/wpilibj/Ultrasonic.java", "license": "bsd-3-clause", "size": 14274 }
[ "edu.wpi.first.wpilibj.tables.ITable" ]
import edu.wpi.first.wpilibj.tables.ITable;
import edu.wpi.first.wpilibj.tables.*;
[ "edu.wpi.first" ]
edu.wpi.first;
1,368,915
private void handleDisplayNameAsShortIdentifier(DocumentModel docModel, String schemaName) throws Exception { String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER); String displayName = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.DISPLAY_NAME); String shortDisplayName = ""; if (Tools.isEmpty(shortIdentifier)) { String generatedShortIdentifier = AuthorityIdentifierUtils.generateShortIdentifierFromDisplayName(displayName, shortDisplayName); docModel.setProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER, generatedShortIdentifier); } }
void function(DocumentModel docModel, String schemaName) throws Exception { String shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER); String displayName = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.DISPLAY_NAME); String shortDisplayName = ""; if (Tools.isEmpty(shortIdentifier)) { String generatedShortIdentifier = AuthorityIdentifierUtils.generateShortIdentifierFromDisplayName(displayName, shortDisplayName); docModel.setProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER, generatedShortIdentifier); } }
/** * If no short identifier was provided in the input payload, * generate a short identifier from the display name. */
If no short identifier was provided in the input payload, generate a short identifier from the display name
handleDisplayNameAsShortIdentifier
{ "repo_name": "cherryhill/collectionspace-services", "path": "services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java", "license": "apache-2.0", "size": 8713 }
[ "org.collectionspace.services.common.api.Tools", "org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema", "org.nuxeo.ecm.core.api.DocumentModel" ]
import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema; import org.nuxeo.ecm.core.api.DocumentModel;
import org.collectionspace.services.common.api.*; import org.collectionspace.services.common.vocabulary.*; import org.nuxeo.ecm.core.api.*;
[ "org.collectionspace.services", "org.nuxeo.ecm" ]
org.collectionspace.services; org.nuxeo.ecm;
1,441,170
protected void sequence_InsertContextItem(EObject context, InsertContextItem semanticObject) { if(errorAcceptor != null) { if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Name()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Name())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Context()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Context())); } INodesForEObjectProvider nodes = createNodeProvider(semanticObject); SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes); feeder.accept(grammarAccess.getInsertContextItemAccess().getNameValidIDParserRuleCall_1_0(), semanticObject.getName()); feeder.accept(grammarAccess.getInsertContextItemAccess().getContextValidIDParserRuleCall_3_0(), semanticObject.getContext()); feeder.finish(); }
void function(EObject context, InsertContextItem semanticObject) { if(errorAcceptor != null) { if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Name()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Name())); if(transientValues.isValueTransient(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Context()) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, MMDSLPackage.eINSTANCE.getInsertContextItem_Context())); } INodesForEObjectProvider nodes = createNodeProvider(semanticObject); SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes); feeder.accept(grammarAccess.getInsertContextItemAccess().getNameValidIDParserRuleCall_1_0(), semanticObject.getName()); feeder.accept(grammarAccess.getInsertContextItemAccess().getContextValidIDParserRuleCall_3_0(), semanticObject.getContext()); feeder.finish(); }
/** * Constraint: * (name=ValidID context=ValidID) */
Constraint: (name=ValidID context=ValidID)
sequence_InsertContextItem
{ "repo_name": "niksavis/mm-dsl", "path": "org.xtext.nv.dsl/src-gen/org/xtext/nv/dsl/serializer/MMDSLSemanticSequencer.java", "license": "epl-1.0", "size": 190481 }
[ "org.eclipse.emf.ecore.EObject", "org.eclipse.xtext.serializer.acceptor.SequenceFeeder", "org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider", "org.eclipse.xtext.serializer.sequencer.ITransientValueService", "org.xtext.nv.dsl.mMDSL.InsertContextItem", "org.xtext.nv.dsl.mMDSL.MMDSLPackage" ]
import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.serializer.acceptor.SequenceFeeder; import org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider; import org.eclipse.xtext.serializer.sequencer.ITransientValueService; import org.xtext.nv.dsl.mMDSL.InsertContextItem; import org.xtext.nv.dsl.mMDSL.MMDSLPackage;
import org.eclipse.emf.ecore.*; import org.eclipse.xtext.serializer.acceptor.*; import org.eclipse.xtext.serializer.sequencer.*; import org.xtext.nv.dsl.*;
[ "org.eclipse.emf", "org.eclipse.xtext", "org.xtext.nv" ]
org.eclipse.emf; org.eclipse.xtext; org.xtext.nv;
1,125,863
public static void eachByte(InputStream is, int bufferLen, Closure closure) throws IOException { byte[] buffer = new byte[ bufferLen ] ; int bytesRead = 0 ; try { while ( ( bytesRead = is.read( buffer, 0, bufferLen ) ) > 0 ) { closure.call( new Object[]{ buffer, bytesRead } ) ; } InputStream temp = is; is = null; temp.close(); } finally { closeWithWarning(is); } }
static void function(InputStream is, int bufferLen, Closure closure) throws IOException { byte[] buffer = new byte[ bufferLen ] ; int bytesRead = 0 ; try { while ( ( bytesRead = is.read( buffer, 0, bufferLen ) ) > 0 ) { closure.call( new Object[]{ buffer, bytesRead } ) ; } InputStream temp = is; is = null; temp.close(); } finally { closeWithWarning(is); } }
/** * Traverse through each the specified stream reading bytes into a buffer * and calling the 2 parameter closure with this buffer and the number of bytes. * * @param is stream to iterate over, closed after the method call. * @param bufferLen the length of the buffer to use. * @param closure a 2 parameter closure which is passed the byte[] and a number of bytes successfully read. * @throws IOException if an IOException occurs. * @since 1.8 */
Traverse through each the specified stream reading bytes into a buffer and calling the 2 parameter closure with this buffer and the number of bytes
eachByte
{ "repo_name": "mv2a/yajsw", "path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "apache-2.0", "size": 704164 }
[ "groovy.lang.Closure", "java.io.IOException", "java.io.InputStream" ]
import groovy.lang.Closure; import java.io.IOException; import java.io.InputStream;
import groovy.lang.*; import java.io.*;
[ "groovy.lang", "java.io" ]
groovy.lang; java.io;
1,565,888
@PluginMethod() public void schedule(PluginCall call) { List<LocalNotification> localNotifications = LocalNotification.buildNotificationList(call); if (localNotifications == null) { return; } JSONArray ids = manager.schedule(call, localNotifications); notificationStorage.appendNotificationIds(localNotifications); call.success(new JSObject().put("ids", ids)); }
@PluginMethod() void function(PluginCall call) { List<LocalNotification> localNotifications = LocalNotification.buildNotificationList(call); if (localNotifications == null) { return; } JSONArray ids = manager.schedule(call, localNotifications); notificationStorage.appendNotificationIds(localNotifications); call.success(new JSObject().put("ids", ids)); }
/** * Schedule a notification call from JavaScript * Creates local notification in system. */
Schedule a notification call from JavaScript Creates local notification in system
schedule
{ "repo_name": "DoFabien/OsmGo", "path": "android/capacitor/src/main/java/com/getcapacitor/plugin/LocalNotifications.java", "license": "mit", "size": 3245 }
[ "com.getcapacitor.JSObject", "com.getcapacitor.PluginCall", "com.getcapacitor.PluginMethod", "com.getcapacitor.plugin.notification.LocalNotification", "java.util.List", "org.json.JSONArray" ]
import com.getcapacitor.JSObject; import com.getcapacitor.PluginCall; import com.getcapacitor.PluginMethod; import com.getcapacitor.plugin.notification.LocalNotification; import java.util.List; import org.json.JSONArray;
import com.getcapacitor.*; import com.getcapacitor.plugin.notification.*; import java.util.*; import org.json.*;
[ "com.getcapacitor", "com.getcapacitor.plugin", "java.util", "org.json" ]
com.getcapacitor; com.getcapacitor.plugin; java.util; org.json;
1,322,268
public Optional<Instant> startInstant();
Optional<Instant> function();
/** * Returns the start time of the process. * * @return an {@code Optional<Instant>} of the start time of the process */
Returns the start time of the process
startInstant
{ "repo_name": "md-5/jdk10", "path": "src/java.base/share/classes/java/lang/ProcessHandle.java", "license": "gpl-2.0", "size": 19736 }
[ "java.time.Instant", "java.util.Optional" ]
import java.time.Instant; import java.util.Optional;
import java.time.*; import java.util.*;
[ "java.time", "java.util" ]
java.time; java.util;
1,314,997
boolean computeReplicationWorkForBlock(Block block, int priority) { int requiredReplication, numEffectiveReplicas; List<DatanodeDescriptor> containingNodes; DatanodeDescriptor srcNode; synchronized (this) { synchronized (neededReplications) { // block should belong to a file INodeFile fileINode = blocksMap.getINode(block); // abandoned block or block reopened for append if(fileINode == null || fileINode.isUnderConstruction()) { neededReplications.remove(block, priority); // remove from neededReplications replIndex--; return false; } requiredReplication = fileINode.getReplication(); // get a source data-node containingNodes = new ArrayList<DatanodeDescriptor>(); NumberReplicas numReplicas = new NumberReplicas(); srcNode = chooseSourceDatanode(block, containingNodes, numReplicas); if ((numReplicas.liveReplicas() + numReplicas.decommissionedReplicas()) <= 0) { missingBlocksInCurIter++; } if(srcNode == null) // block can not be replicated from any node return false; // do not schedule more if enough replicas is already pending numEffectiveReplicas = numReplicas.liveReplicas() + pendingReplications.getNumReplicas(block); if(numEffectiveReplicas >= requiredReplication) { neededReplications.remove(block, priority); // remove from neededReplications replIndex--; NameNode.stateChangeLog.info("BLOCK* " + "Removing block " + block + " from neededReplications as it has enough replicas."); return false; } } } // choose replication targets: NOT HOLDING THE GLOBAL LOCK DatanodeDescriptor targets[] = replicator.chooseTarget( requiredReplication - numEffectiveReplicas, srcNode, containingNodes, null, block.getNumBytes()); if(targets.length == 0) return false; synchronized (this) { synchronized (neededReplications) { // Recheck since global lock was released // block should belong to a file INodeFile fileINode = blocksMap.getINode(block); // abandoned block or block reopened for append if(fileINode == null || fileINode.isUnderConstruction()) { neededReplications.remove(block, priority); // remove from neededReplications replIndex--; return false; } requiredReplication = fileINode.getReplication(); // do not schedule more if enough replicas is already pending NumberReplicas numReplicas = countNodes(block); numEffectiveReplicas = numReplicas.liveReplicas() + pendingReplications.getNumReplicas(block); if(numEffectiveReplicas >= requiredReplication) { neededReplications.remove(block, priority); // remove from neededReplications replIndex--; NameNode.stateChangeLog.info("BLOCK* " + "Removing block " + block + " from neededReplications as it has enough replicas."); return false; } // Add block to the to be replicated list srcNode.addBlockToBeReplicated(block, targets); for (DatanodeDescriptor dn : targets) { dn.incBlocksScheduled(); } // Move the block-replication into a "pending" state. // The reason we use 'pending' is so we can retry // replications that fail after an appropriate amount of time. pendingReplications.add(block, targets.length); NameNode.stateChangeLog.debug( "BLOCK* block " + block + " is moved from neededReplications to pendingReplications"); // remove from neededReplications if(numEffectiveReplicas + targets.length >= requiredReplication) { neededReplications.remove(block, priority); // remove from neededReplications replIndex--; } if (NameNode.stateChangeLog.isInfoEnabled()) { StringBuffer targetList = new StringBuffer("datanode(s)"); for (int k = 0; k < targets.length; k++) { targetList.append(' '); targetList.append(targets[k].getName()); } NameNode.stateChangeLog.info( "BLOCK* ask " + srcNode.getName() + " to replicate " + block + " to " + targetList); NameNode.stateChangeLog.debug( "BLOCK* neededReplications = " + neededReplications.size() + " pendingReplications = " + pendingReplications.size()); } } } return true; }
boolean computeReplicationWorkForBlock(Block block, int priority) { int requiredReplication, numEffectiveReplicas; List<DatanodeDescriptor> containingNodes; DatanodeDescriptor srcNode; synchronized (this) { synchronized (neededReplications) { INodeFile fileINode = blocksMap.getINode(block); if(fileINode == null fileINode.isUnderConstruction()) { neededReplications.remove(block, priority); replIndex--; return false; } requiredReplication = fileINode.getReplication(); containingNodes = new ArrayList<DatanodeDescriptor>(); NumberReplicas numReplicas = new NumberReplicas(); srcNode = chooseSourceDatanode(block, containingNodes, numReplicas); if ((numReplicas.liveReplicas() + numReplicas.decommissionedReplicas()) <= 0) { missingBlocksInCurIter++; } if(srcNode == null) return false; numEffectiveReplicas = numReplicas.liveReplicas() + pendingReplications.getNumReplicas(block); if(numEffectiveReplicas >= requiredReplication) { neededReplications.remove(block, priority); replIndex--; NameNode.stateChangeLog.info(STR + STR + block + STR); return false; } } } DatanodeDescriptor targets[] = replicator.chooseTarget( requiredReplication - numEffectiveReplicas, srcNode, containingNodes, null, block.getNumBytes()); if(targets.length == 0) return false; synchronized (this) { synchronized (neededReplications) { INodeFile fileINode = blocksMap.getINode(block); if(fileINode == null fileINode.isUnderConstruction()) { neededReplications.remove(block, priority); replIndex--; return false; } requiredReplication = fileINode.getReplication(); NumberReplicas numReplicas = countNodes(block); numEffectiveReplicas = numReplicas.liveReplicas() + pendingReplications.getNumReplicas(block); if(numEffectiveReplicas >= requiredReplication) { neededReplications.remove(block, priority); replIndex--; NameNode.stateChangeLog.info(STR + STR + block + STR); return false; } srcNode.addBlockToBeReplicated(block, targets); for (DatanodeDescriptor dn : targets) { dn.incBlocksScheduled(); } pendingReplications.add(block, targets.length); NameNode.stateChangeLog.debug( STR + block + STR); if(numEffectiveReplicas + targets.length >= requiredReplication) { neededReplications.remove(block, priority); replIndex--; } if (NameNode.stateChangeLog.isInfoEnabled()) { StringBuffer targetList = new StringBuffer(STR); for (int k = 0; k < targets.length; k++) { targetList.append(' '); targetList.append(targets[k].getName()); } NameNode.stateChangeLog.info( STR + srcNode.getName() + STR + block + STR + targetList); NameNode.stateChangeLog.debug( STR + neededReplications.size() + STR + pendingReplications.size()); } } } return true; }
/** Replicate a block * * @param block block to be replicated * @param priority a hint of its priority in the neededReplication queue * @return if the block gets replicated or not */
Replicate a block
computeReplicationWorkForBlock
{ "repo_name": "zhaobj/MyHadoop", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 214078 }
[ "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hdfs.protocol.Block" ]
import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hdfs.protocol.Block;
import java.util.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
1,347,985
public static void awaitListSize(final List<?> list, final int listSize, final int timeoutInMs) throws InterruptedException { final int interPauseInMs = 10; int currentWaitingTimeInMs = 0; while ((list.size() != listSize)) { Thread.sleep(interPauseInMs); currentWaitingTimeInMs += interPauseInMs; if (currentWaitingTimeInMs >= timeoutInMs) { throw new AssertionError("Timeout exceeded."); } } }
static void function(final List<?> list, final int listSize, final int timeoutInMs) throws InterruptedException { final int interPauseInMs = 10; int currentWaitingTimeInMs = 0; while ((list.size() != listSize)) { Thread.sleep(interPauseInMs); currentWaitingTimeInMs += interPauseInMs; if (currentWaitingTimeInMs >= timeoutInMs) { throw new AssertionError(STR); } } }
/** * Waits for the given <code>list</code> to reach the given <code>listSize</code>.<br> * <i>(The implementation uses busy-waiting with an inter-pause time of 10 ms.)</i> * * @throws AssertionError * if the timeout has been reached or exceeded */
Waits for the given <code>list</code> to reach the given <code>listSize</code>. (The implementation uses busy-waiting with an inter-pause time of 10 ms.)
awaitListSize
{ "repo_name": "kieker-monitoring/kieker", "path": "kieker-monitoring/test/kieker/test/monitoring/util/NamedListWriter.java", "license": "apache-2.0", "size": 4409 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,580,949
public QName getElementName( Object content ) { JAXBIntrospector introspector = jaxb.createJAXBIntrospector(); return introspector.getElementName( content ); }
QName function( Object content ) { JAXBIntrospector introspector = jaxb.createJAXBIntrospector(); return introspector.getElementName( content ); }
/** * Returns the {@link QName} of the specified content tree, null if the QName cannot be determined. * This method returns a non-null value iff the specified content tree is annotated with the * {@link XmlRootElement} annotation, or it is an {@link JAXBElement} instance. * * @param content a content tree. * @return the {@link QName} of the specified content tree, null if the QName cannot be determined. */
Returns the <code>QName</code> of the specified content tree, null if the QName cannot be determined. This method returns a non-null value iff the specified content tree is annotated with the <code>XmlRootElement</code> annotation, or it is an <code>JAXBElement</code> instance
getElementName
{ "repo_name": "quartzdesk/quartzdesk-executor", "path": "quartzdesk-executor-domain/src/main/java/com/quartzdesk/executor/domain/jaxb/JaxbHelper.java", "license": "mit", "size": 16324 }
[ "javax.xml.bind.JAXBIntrospector", "javax.xml.namespace.QName" ]
import javax.xml.bind.JAXBIntrospector; import javax.xml.namespace.QName;
import javax.xml.bind.*; import javax.xml.namespace.*;
[ "javax.xml" ]
javax.xml;
379,041
public static void printUsage(final CmdLineParser parser) { System.out.println("reqcoco-runner [options...] arguments..."); parser.printUsage(System.out); System.out.println(); System.out.println(" Example: reqcoco-runner " + parser.printExample(filter -> !filter.option.help())); }
static void function(final CmdLineParser parser) { System.out.println(STR); parser.printUsage(System.out); System.out.println(); System.out.println(STR + parser.printExample(filter -> !filter.option.help())); }
/** * Prints the usage. * * @param parser - The command line parser. */
Prints the usage
printUsage
{ "repo_name": "paissad/reqcoco", "path": "reqcoco-runner/src/main/java/net/paissad/tools/reqcoco/runner/ReqRunnerOptions.java", "license": "lgpl-3.0", "size": 11435 }
[ "org.kohsuke.args4j.CmdLineParser" ]
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.*;
[ "org.kohsuke.args4j" ]
org.kohsuke.args4j;
48,846
private static void boundedTreeAdd(TreeSet<Lookup.LookupResult> results, Lookup.LookupResult result, int num) { if (results.size() >= num) { if (results.first().value < result.value) { results.pollFirst(); } else { return; } } results.add(result); }
static void function(TreeSet<Lookup.LookupResult> results, Lookup.LookupResult result, int num) { if (results.size() >= num) { if (results.first().value < result.value) { results.pollFirst(); } else { return; } } results.add(result); }
/** * Add an element to the tree respecting a size limit * * @param results the tree to add in * @param result the result we try to add * @param num size limit */
Add an element to the tree respecting a size limit
boundedTreeAdd
{ "repo_name": "q474818917/solr-5.2.0", "path": "lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java", "license": "apache-2.0", "size": 12787 }
[ "java.util.TreeSet", "org.apache.lucene.search.suggest.Lookup" ]
import java.util.TreeSet; import org.apache.lucene.search.suggest.Lookup;
import java.util.*; import org.apache.lucene.search.suggest.*;
[ "java.util", "org.apache.lucene" ]
java.util; org.apache.lucene;
1,662,166
@Override protected String getLivingSound() { return DefaultProps.mobKey + ":" + DefaultProps.entitySounds + "cyclops-say"; }
String function() { return DefaultProps.mobKey + ":" + DefaultProps.entitySounds + STR; }
/** * Returns the sound this mob makes while it's alive. */
Returns the sound this mob makes while it's alive
getLivingSound
{ "repo_name": "soultek101/projectzulu1.7.10", "path": "src/main/java/com/stek101/projectzulu/common/mobs/entity/EntityCyclops.java", "license": "lgpl-2.1", "size": 2918 }
[ "com.stek101.projectzulu.common.core.DefaultProps" ]
import com.stek101.projectzulu.common.core.DefaultProps;
import com.stek101.projectzulu.common.core.*;
[ "com.stek101.projectzulu" ]
com.stek101.projectzulu;
2,895,852
@Test public void inTheMiddle() { EventFilter filter = new GlobbingPathFilter("/foo/"+STAR_STAR+"/bar"); ImmutableTree t = tree; for(String name : elements("foo/a/b/c")) { t = t.getChild(name); assertFalse(filter.includeAdd(name, t.getNodeState())); filter = filter.create(name, t.getNodeState(), t.getNodeState()); assertNotNull(filter); } for(String name : elements("bar")) { t = t.getChild(name); assertTrue(filter.includeAdd(name, t.getNodeState())); filter = filter.create(name, t.getNodeState(), t.getNodeState()); assertNotNull(filter); } }
void function() { EventFilter filter = new GlobbingPathFilter("/foo/"+STAR_STAR+"/bar"); ImmutableTree t = tree; for(String name : elements(STR)) { t = t.getChild(name); assertFalse(filter.includeAdd(name, t.getNodeState())); filter = filter.create(name, t.getNodeState(), t.getNodeState()); assertNotNull(filter); } for(String name : elements("bar")) { t = t.getChild(name); assertTrue(filter.includeAdd(name, t.getNodeState())); filter = filter.create(name, t.getNodeState(), t.getNodeState()); assertNotNull(filter); } }
/** * match ** 'in the middle' */
match ** 'in the middle'
inTheMiddle
{ "repo_name": "mduerig/jackrabbit-oak", "path": "oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/observation/filter/GlobbingPathFilterTest.java", "license": "apache-2.0", "size": 11605 }
[ "org.apache.jackrabbit.oak.commons.PathUtils", "org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree", "org.junit.Assert" ]
import org.apache.jackrabbit.oak.commons.PathUtils; import org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree; import org.junit.Assert;
import org.apache.jackrabbit.oak.commons.*; import org.apache.jackrabbit.oak.plugins.tree.impl.*; import org.junit.*;
[ "org.apache.jackrabbit", "org.junit" ]
org.apache.jackrabbit; org.junit;
1,584,860
private ChannelFuture continueHeaders(ChannelHandlerContext ctx, ChannelPromise promise, int streamId, int padding, ByteBuf headerBlock, ByteBuf firstFrame) { // Create a composite buffer wrapping the first frame and any continuation frames. CompositeByteBuf out = ctx.alloc().compositeBuffer(); out.addComponent(firstFrame); int numBytes = firstFrame.readableBytes(); // Process any continuation frames there might be. while (headerBlock.isReadable()) { ByteBuf frame = createContinuationFrame(ctx, streamId, headerBlock, padding); out.addComponent(frame); numBytes += frame.readableBytes(); } out.writerIndex(numBytes); return ctx.write(out, promise); }
ChannelFuture function(ChannelHandlerContext ctx, ChannelPromise promise, int streamId, int padding, ByteBuf headerBlock, ByteBuf firstFrame) { CompositeByteBuf out = ctx.alloc().compositeBuffer(); out.addComponent(firstFrame); int numBytes = firstFrame.readableBytes(); while (headerBlock.isReadable()) { ByteBuf frame = createContinuationFrame(ctx, streamId, headerBlock, padding); out.addComponent(frame); numBytes += frame.readableBytes(); } out.writerIndex(numBytes); return ctx.write(out, promise); }
/** * Drains the header block and creates a composite buffer containing the first frame and a * number of CONTINUATION frames. */
Drains the header block and creates a composite buffer containing the first frame and a number of CONTINUATION frames
continueHeaders
{ "repo_name": "kamyu104/netty", "path": "codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriter.java", "license": "apache-2.0", "size": 20855 }
[ "io.netty.buffer.ByteBuf", "io.netty.buffer.CompositeByteBuf", "io.netty.channel.ChannelFuture", "io.netty.channel.ChannelHandlerContext", "io.netty.channel.ChannelPromise" ]
import io.netty.buffer.ByteBuf; import io.netty.buffer.CompositeByteBuf; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise;
import io.netty.buffer.*; import io.netty.channel.*;
[ "io.netty.buffer", "io.netty.channel" ]
io.netty.buffer; io.netty.channel;
386,482
@Deprecated public static String extendContribution(final String id, final String phase, final Object... data) { final List<Contribution> contributors = DomainCodeUtilities.getSelectedVariants(id); String rules = ""; boolean _equals = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_BI); if (_equals) { for (final Contribution c : contributors) { String _rules = rules; String _contributeToBusinessInterface = c.contributeToBusinessInterface(data); String _plus = (_contributeToBusinessInterface + "\n\n"); rules = (_rules + _plus); } } boolean _equals_1 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_BIMPL); if (_equals_1) { for (final Contribution c_1 : contributors) { String _rules_1 = rules; String _contributeToBusinessImpl = c_1.contributeToBusinessImpl(data); String _plus_1 = (_contributeToBusinessImpl + "\n\n"); rules = (_rules_1 + _plus_1); } } boolean _equals_2 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_WEB_IMPORT); if (_equals_2) { for (final Contribution c_2 : contributors) { String _rules_2 = rules; String _contributeToWebImport = c_2.contributeToWebImport(data); String _plus_2 = (_contributeToWebImport + "\n\n"); rules = (_rules_2 + _plus_2); } } boolean _equals_3 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_WEB_ATTRIBUTE); if (_equals_3) { for (final Contribution c_3 : contributors) { String _rules_3 = rules; String _contributeToWebAttribute = c_3.contributeToWebAttribute(data); String _plus_3 = (_contributeToWebAttribute + "\n\n"); rules = (_rules_3 + _plus_3); } } boolean _equals_4 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_WEB_IMPL); if (_equals_4) { for (final Contribution c_4 : contributors) { String _rules_4 = rules; String _contributeToWebImpl = c_4.contributeToWebImpl(data); String _plus_4 = (_contributeToWebImpl + "\n\n"); rules = (_rules_4 + _plus_4); } } boolean _equals_5 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_BUSINESS_ATTRIBUTE); if (_equals_5) { for (final Contribution c_5 : contributors) { String _rules_5 = rules; String _contributeToBusinessAtribute = c_5.contributeToBusinessAtribute(data); String _plus_5 = (_contributeToBusinessAtribute + "\n\n"); rules = (_rules_5 + _plus_5); } } boolean _equals_6 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_BUSINESS_IMPORT); if (_equals_6) { for (final Contribution c_6 : contributors) { String _rules_6 = rules; String _contributeToBusinessImport = c_6.contributeToBusinessImport(data); String _plus_6 = (_contributeToBusinessImport + "\n\n"); rules = (_rules_6 + _plus_6); } } boolean _equals_7 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_GENERATION); if (_equals_7) { for (final Contribution c_7 : contributors) { c_7.generate(data); } } return rules; }
static String function(final String id, final String phase, final Object... data) { final List<Contribution> contributors = DomainCodeUtilities.getSelectedVariants(id); String rules = STR\n\nSTR\n\nSTR\n\nSTR\n\nSTR\n\nSTR\n\nSTR\n\n"); rules = (_rules_6 + _plus_6); } } boolean _equals_7 = phase.equals(DomainCodeUtilities.CONTRIBUTE_TO_GENERATION); if (_equals_7) { for (final Contribution c_7 : contributors) { c_7.generate(data); } } return rules; }
/** * Jcifuentes: Marcado como obsoleto * @deprecated use {@link #contribute2Template} instead */
Jcifuentes: Marcado como obsoleto
extendContribution
{ "repo_name": "unicesi/QD-SPL", "path": "ToolSupport/co.edu.icesi.shift.generator/xtend-gen/co/shift/generators/domain/DomainCodeUtilities.java", "license": "lgpl-3.0", "size": 59354 }
[ "co.shift.contributors.Contribution", "java.util.List" ]
import co.shift.contributors.Contribution; import java.util.List;
import co.shift.contributors.*; import java.util.*;
[ "co.shift.contributors", "java.util" ]
co.shift.contributors; java.util;
1,534,884
void syrk(char Order, char Uplo, char Trans, IComplexNumber alpha, IComplexNDArray A, IComplexNumber beta, IComplexNDArray C);
void syrk(char Order, char Uplo, char Trans, IComplexNumber alpha, IComplexNDArray A, IComplexNumber beta, IComplexNDArray C);
/** * syrk performs a rank-n update of an n-by-n symmetric matrix c, that is, one of the following operations: c := alpha*a*a' + beta*c for trans = 'N'or'n' c := alpha*a'*a + beta*c for trans = 'T'or't','C'or'c', where c is an n-by-n symmetric matrix; a is an n-by-k matrix, if trans = 'N'or'n', a is a k-by-n matrix, if trans = 'T'or't','C'or'c'. * @param Order * @param Uplo * @param Trans * @param alpha * @param A * @param beta * @param C */
syrk performs a rank-n update of an n-by-n symmetric matrix c, that is, one of the following operations: a*a' + beta*c for trans = 'N'or'n' a'*a + beta*c for trans = 'T'or't','C'or'c'
syrk
{ "repo_name": "huitseeker/nd4j", "path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/Level3.java", "license": "apache-2.0", "size": 10740 }
[ "org.nd4j.linalg.api.complex.IComplexNDArray", "org.nd4j.linalg.api.complex.IComplexNumber" ]
import org.nd4j.linalg.api.complex.IComplexNDArray; import org.nd4j.linalg.api.complex.IComplexNumber;
import org.nd4j.linalg.api.complex.*;
[ "org.nd4j.linalg" ]
org.nd4j.linalg;
2,778,669
public List<DeviceFirmwareFile> getDeviceFirmwareFiles(final String organisationIdentification, final String deviceIdentification) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.GET_FIRMWARE); final Device device = this.writableDeviceRepository.findByDeviceIdentification(deviceIdentification); return this.writableDeviceFirmwareRepository.findByDeviceOrderByInstallationDateAsc(device); }
List<DeviceFirmwareFile> function(final String organisationIdentification, final String deviceIdentification) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.GET_FIRMWARE); final Device device = this.writableDeviceRepository.findByDeviceIdentification(deviceIdentification); return this.writableDeviceFirmwareRepository.findByDeviceOrderByInstallationDateAsc(device); }
/** * Returns a list of all {@link DeviceFirmwareFile}s in the Platform */
Returns a list of all <code>DeviceFirmwareFile</code>s in the Platform
getDeviceFirmwareFiles
{ "repo_name": "OSGP/Platform", "path": "osgp-adapter-ws-core/src/main/java/org/opensmartgridplatform/adapter/ws/core/application/services/FirmwareManagementService.java", "license": "apache-2.0", "size": 42056 }
[ "java.util.List", "org.opensmartgridplatform.domain.core.entities.Device", "org.opensmartgridplatform.domain.core.entities.DeviceFirmwareFile", "org.opensmartgridplatform.domain.core.entities.Organisation", "org.opensmartgridplatform.domain.core.valueobjects.PlatformFunction", "org.opensmartgridplatform.shared.exceptionhandling.FunctionalException" ]
import java.util.List; import org.opensmartgridplatform.domain.core.entities.Device; import org.opensmartgridplatform.domain.core.entities.DeviceFirmwareFile; import org.opensmartgridplatform.domain.core.entities.Organisation; import org.opensmartgridplatform.domain.core.valueobjects.PlatformFunction; import org.opensmartgridplatform.shared.exceptionhandling.FunctionalException;
import java.util.*; import org.opensmartgridplatform.domain.core.entities.*; import org.opensmartgridplatform.domain.core.valueobjects.*; import org.opensmartgridplatform.shared.exceptionhandling.*;
[ "java.util", "org.opensmartgridplatform.domain", "org.opensmartgridplatform.shared" ]
java.util; org.opensmartgridplatform.domain; org.opensmartgridplatform.shared;
464,253
public List<String> outputTypes() { return this.outputTypes; }
List<String> function() { return this.outputTypes; }
/** * Get gets or sets the runbook output types. * * @return the outputTypes value */
Get gets or sets the runbook output types
outputTypes
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/automation/mgmt-v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftInner.java", "license": "mit", "size": 4802 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
772,455
public static void rename(IBinding oldName, String newName) { oldName = getBindingDeclaration(oldName); String previousName = instance.renamings.get(oldName); if (previousName != null && !previousName.equals(newName)) { logger.fine(String.format("Changing previous rename: %s => %s, now: %s => %s", oldName.toString(), previousName, oldName, newName)); } instance.renamings.put(oldName, newName); }
static void function(IBinding oldName, String newName) { oldName = getBindingDeclaration(oldName); String previousName = instance.renamings.get(oldName); if (previousName != null && !previousName.equals(newName)) { logger.fine(String.format(STR, oldName.toString(), previousName, oldName, newName)); } instance.renamings.put(oldName, newName); }
/** * Adds a name to the renamings map, used by getName(). */
Adds a name to the renamings map, used by getName()
rename
{ "repo_name": "gank0326/j2objc", "path": "translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java", "license": "apache-2.0", "size": 27309 }
[ "org.eclipse.jdt.core.dom.IBinding" ]
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
2,718,222
public void addListener(INotifyChangedListener notifyChangedListener) { changeNotifier.addListener(notifyChangedListener); }
void function(INotifyChangedListener notifyChangedListener) { changeNotifier.addListener(notifyChangedListener); }
/** * This adds a listener. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a listener.
addListener
{ "repo_name": "maybeec/oomph-task-download", "path": "task-download.edit/src/com/github/maybeec/oomph/task/download/provider/downloadItemProviderAdapterFactory.java", "license": "epl-1.0", "size": 12854 }
[ "org.eclipse.emf.edit.provider.INotifyChangedListener" ]
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,690,101
public void send(Location location, float xDev, float yDev, float zDev, float speed, int amount) { send(location, xDev, yDev, zDev, speed, amount, location.getWorld().getPlayers().toArray(new Player[0])); }
void function(Location location, float xDev, float yDev, float zDev, float speed, int amount) { send(location, xDev, yDev, zDev, speed, amount, location.getWorld().getPlayers().toArray(new Player[0])); }
/** * Send a Particle once, with the specified options. Any players * within range of the particles will be able to see them. * * @param location The location that these particles should display at. * @param xDev A value representing how far the particle can vary * on the x-axis. * @param yDev A value representing how far the particle can vary * on the y-axis. * @param zDev A value representing how far the particle can vary * on the z-axis. * @param speed This value sometimes controls the speed, other times * it may change the color or some other attribute. * @param amount The number of particles to display. */
Send a Particle once, with the specified options. Any players within range of the particles will be able to see them
send
{ "repo_name": "ewized/CommonUtils", "path": "src/main/java/com/archeinteractive/dev/commonutils/effects/particle/ParticleEffect.java", "license": "gpl-3.0", "size": 13679 }
[ "org.bukkit.Location", "org.bukkit.entity.Player" ]
import org.bukkit.Location; import org.bukkit.entity.Player;
import org.bukkit.*; import org.bukkit.entity.*;
[ "org.bukkit", "org.bukkit.entity" ]
org.bukkit; org.bukkit.entity;
1,731,555
public void setCurrentUploadType(UploadType currentUploadType) { this.currentUploadType = currentUploadType; }
void function(UploadType currentUploadType) { this.currentUploadType = currentUploadType; }
/** * Set the current upload type. Used for testing purposes only * * @param currentUploadType */
Set the current upload type. Used for testing purposes only
setCurrentUploadType
{ "repo_name": "Sage-Bionetworks/SynapseWebClient", "path": "src/main/java/org/sagebionetworks/web/client/widget/entity/download/Uploader.java", "license": "apache-2.0", "size": 32073 }
[ "org.sagebionetworks.repo.model.file.UploadType" ]
import org.sagebionetworks.repo.model.file.UploadType;
import org.sagebionetworks.repo.model.file.*;
[ "org.sagebionetworks.repo" ]
org.sagebionetworks.repo;
513,010
public Date getUpdateTime() { return updateTime; }
Date function() { return updateTime; }
/** * This method was generated by MyBatis Generator. * This method returns the value of the database column user_info.update_time * * @return the value of user_info.update_time * * @mbg.generated Sat Oct 08 16:28:14 CST 2016 */
This method was generated by MyBatis Generator. This method returns the value of the database column user_info.update_time
getUpdateTime
{ "repo_name": "qtzfh/maven-springmvc-mysql-mongodb-Velocity", "path": "supplier-model/src/main/java/com/supplier/common/model/mysql/UserInfo.java", "license": "agpl-3.0", "size": 16331 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,464,154
public Integer partitionCountForTopic(String topic) { List<PartitionInfo> partitionInfos = this.partitionsByTopic.get(topic); return partitionInfos == null ? null : partitionInfos.size(); }
Integer function(String topic) { List<PartitionInfo> partitionInfos = this.partitionsByTopic.get(topic); return partitionInfos == null ? null : partitionInfos.size(); }
/** * Get the number of partitions for the given topic * @param topic The topic to get the number of partitions for * @return The number of partitions or null if there is no corresponding metadata */
Get the number of partitions for the given topic
partitionCountForTopic
{ "repo_name": "Mszak/kafka", "path": "clients/src/main/java/org/apache/kafka/common/Cluster.java", "license": "apache-2.0", "size": 8453 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,336,099
public IOException getIOException() { return ioException; }
IOException function() { return ioException; }
/** * Returns the IOException responsible for the failure of a copy operation. * @return The IOException responsible for the failure of a copy operation. */
Returns the IOException responsible for the failure of a copy operation
getIOException
{ "repo_name": "rwinston/netling", "path": "src/main/java/org/netling/io/CopyStreamException.java", "license": "apache-2.0", "size": 3273 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,133,283
public void onArrived(L2Npc npc) { if (_activeRoutes.containsKey(npc.getObjectId())) { // Notify quest EventDispatcher.getInstance().notifyEventAsync(new OnNpcMoveNodeArrived(npc), npc); final WalkInfo walk = _activeRoutes.get(npc.getObjectId()); // Opposite should not happen... but happens sometime if ((walk.getCurrentNodeId() >= 0) && (walk.getCurrentNodeId() < walk.getRoute().getNodesCount())) { final L2NpcWalkerNode node = walk.getRoute().getNodeList().get(walk.getCurrentNodeId()); if (npc.isInsideRadius(node, 10, false, false)) { npc.sendDebugMessage("Route '" + walk.getRoute().getName() + "', arrived to node " + walk.getCurrentNodeId()); npc.sendDebugMessage("Done in " + ((System.currentTimeMillis() - walk.getLastAction()) / 1000) + " s"); walk.calculateNextNode(npc); walk.setBlocked(true); // prevents to be ran from walk check task, if there is delay in this node. if (node.getNpcString() != null) { npc.broadcastSay(ChatType.NPC_GENERAL, node.getNpcString()); } else if (!node.getChatText().isEmpty()) { npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText()); } if (npc.isDebug()) { walk.setLastAction(System.currentTimeMillis()); } ThreadPoolManager.getInstance().scheduleGeneral(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L)); } } } }
void function(L2Npc npc) { if (_activeRoutes.containsKey(npc.getObjectId())) { EventDispatcher.getInstance().notifyEventAsync(new OnNpcMoveNodeArrived(npc), npc); final WalkInfo walk = _activeRoutes.get(npc.getObjectId()); if ((walk.getCurrentNodeId() >= 0) && (walk.getCurrentNodeId() < walk.getRoute().getNodesCount())) { final L2NpcWalkerNode node = walk.getRoute().getNodeList().get(walk.getCurrentNodeId()); if (npc.isInsideRadius(node, 10, false, false)) { npc.sendDebugMessage(STR + walk.getRoute().getName() + STR + walk.getCurrentNodeId()); npc.sendDebugMessage(STR + ((System.currentTimeMillis() - walk.getLastAction()) / 1000) + STR); walk.calculateNextNode(npc); walk.setBlocked(true); if (node.getNpcString() != null) { npc.broadcastSay(ChatType.NPC_GENERAL, node.getNpcString()); } else if (!node.getChatText().isEmpty()) { npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText()); } if (npc.isDebug()) { walk.setLastAction(System.currentTimeMillis()); } ThreadPoolManager.getInstance().scheduleGeneral(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L)); } } } }
/** * Manage "node arriving"-related tasks: schedule move to next node; send ON_NODE_ARRIVED event to Quest script * @param npc NPC to manage */
Manage "node arriving"-related tasks: schedule move to next node; send ON_NODE_ARRIVED event to Quest script
onArrived
{ "repo_name": "rubenswagner/L2J-Global", "path": "java/com/l2jglobal/gameserver/instancemanager/WalkingManager.java", "license": "gpl-3.0", "size": 15757 }
[ "com.l2jglobal.gameserver.ThreadPoolManager", "com.l2jglobal.gameserver.enums.ChatType", "com.l2jglobal.gameserver.model.L2NpcWalkerNode", "com.l2jglobal.gameserver.model.WalkInfo", "com.l2jglobal.gameserver.model.actor.L2Npc", "com.l2jglobal.gameserver.model.actor.tasks.npc.walker.ArrivedTask", "com.l2jglobal.gameserver.model.events.EventDispatcher", "com.l2jglobal.gameserver.model.events.impl.character.npc.OnNpcMoveNodeArrived" ]
import com.l2jglobal.gameserver.ThreadPoolManager; import com.l2jglobal.gameserver.enums.ChatType; import com.l2jglobal.gameserver.model.L2NpcWalkerNode; import com.l2jglobal.gameserver.model.WalkInfo; import com.l2jglobal.gameserver.model.actor.L2Npc; import com.l2jglobal.gameserver.model.actor.tasks.npc.walker.ArrivedTask; import com.l2jglobal.gameserver.model.events.EventDispatcher; import com.l2jglobal.gameserver.model.events.impl.character.npc.OnNpcMoveNodeArrived;
import com.l2jglobal.gameserver.*; import com.l2jglobal.gameserver.enums.*; import com.l2jglobal.gameserver.model.*; import com.l2jglobal.gameserver.model.actor.*; import com.l2jglobal.gameserver.model.actor.tasks.npc.walker.*; import com.l2jglobal.gameserver.model.events.*; import com.l2jglobal.gameserver.model.events.impl.character.npc.*;
[ "com.l2jglobal.gameserver" ]
com.l2jglobal.gameserver;
1,620,461
void init(HttpMessage msg, HostProcess parent);
void init(HttpMessage msg, HostProcess parent);
/** * Initialises the plugin with the given message and host process. * * @param msg the message to be scanned. * @param parent the parent host process. */
Initialises the plugin with the given message and host process
init
{ "repo_name": "zapbot/zaproxy", "path": "src/org/parosproxy/paros/core/scanner/Plugin.java", "license": "apache-2.0", "size": 12095 }
[ "org.parosproxy.paros.network.HttpMessage" ]
import org.parosproxy.paros.network.HttpMessage;
import org.parosproxy.paros.network.*;
[ "org.parosproxy.paros" ]
org.parosproxy.paros;
613,496
@Test public void testBlobVar() { byte[][] vals = { Bytes.toBytes(""), Bytes.toBytes("foo"), Bytes.toBytes("foobarbazbub"), { (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, }, { (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa }, { (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, }, { (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, }, { (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55 }, { (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, (byte) 0x55, }, Bytes.toBytes("1"), Bytes.toBytes("22"), Bytes.toBytes("333"), Bytes.toBytes("4444"), Bytes.toBytes("55555"), Bytes.toBytes("666666"), Bytes.toBytes("7777777"), Bytes.toBytes("88888888") }; for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) { for (byte[] val : vals) { // allocate a buffer 3-bytes larger than necessary to detect over/underflow int expectedLen = OrderedBytes.blobVarEncodedLength(val.length); byte[] a = new byte[expectedLen + 3]; PositionedByteRange buf1 = new SimplePositionedMutableByteRange(a, 1, expectedLen + 1); buf1.setPosition(1); // verify encode assertEquals("Surprising return value.", expectedLen, OrderedBytes.encodeBlobVar(buf1, val, ord)); assertEquals("Broken test: serialization did not consume entire buffer.", buf1.getLength(), buf1.getPosition()); assertEquals("Surprising serialized length.", expectedLen, buf1.getPosition() - 1); assertEquals("Buffer underflow.", 0, a[0]); assertEquals("Buffer underflow.", 0, a[1]); assertEquals("Buffer overflow.", 0, a[a.length - 1]); // verify skip buf1.setPosition(1); assertEquals("Surprising return value.", expectedLen, OrderedBytes.skip(buf1)); assertEquals("Did not skip enough bytes.", expectedLen, buf1.getPosition() - 1); // verify decode buf1.setPosition(1); assertArrayEquals("Deserialization failed.", val, OrderedBytes.decodeBlobVar(buf1)); assertEquals("Did not consume enough bytes.", expectedLen, buf1.getPosition() - 1); } } for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) { byte[][] encoded = new byte[vals.length][]; PositionedByteRange pbr = new SimplePositionedMutableByteRange(); for (int i = 0; i < vals.length; i++) { encoded[i] = new byte[OrderedBytes.blobVarEncodedLength(vals[i].length)]; OrderedBytes.encodeBlobVar(pbr.set(encoded[i]), vals[i], ord); } Arrays.sort(encoded, Bytes.BYTES_COMPARATOR); byte[][] sortedVals = Arrays.copyOf(vals, vals.length); if (ord == Order.ASCENDING) Arrays.sort(sortedVals, Bytes.BYTES_COMPARATOR); else Arrays.sort(sortedVals, Collections.reverseOrder(Bytes.BYTES_COMPARATOR)); for (int i = 0; i < sortedVals.length; i++) { pbr.set(encoded[i]); byte[] decoded = OrderedBytes.decodeBlobVar(pbr); assertArrayEquals( String.format( "Encoded representations do not preserve natural order: <%s>, <%s>, %s", Arrays.toString(sortedVals[i]), Arrays.toString(decoded), ord), sortedVals[i], decoded); } } }
void function() { byte[][] vals = { Bytes.toBytes(STRfooSTRfoobarbazbubSTR1STR22STR333STR4444STR55555STR666666STR7777777STR88888888STRSurprising return value.STRBroken test: serialization did not consume entire buffer.STRSurprising serialized length.STRBuffer underflow.STRBuffer underflow.STRBuffer overflow.STRSurprising return value.STRDid not skip enough bytes.STRDeserialization failed.STRDid not consume enough bytes.STREncoded representations do not preserve natural order: <%s>, <%s>, %s", Arrays.toString(sortedVals[i]), Arrays.toString(decoded), ord), sortedVals[i], decoded); } } }
/** * Test BlobVar encoding. */
Test BlobVar encoding
testBlobVar
{ "repo_name": "ultratendency/hbase", "path": "hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestOrderedBytes.java", "license": "apache-2.0", "size": 51263 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,305,617
ServiceCall<Void> put202Async(final ServiceCallback<Void> serviceCallback);
ServiceCall<Void> put202Async(final ServiceCallback<Void> serviceCallback);
/** * Put true Boolean value in request returns 202 (Accepted). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */
Put true Boolean value in request returns 202 (Accepted)
put202Async
{ "repo_name": "yugangw-msft/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/http/HttpSuccess.java", "license": "mit", "size": 30999 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,624,127
@PostMapping(path = "/account/reset_password/finish", produces = MediaType.TEXT_PLAIN_VALUE) @Timed public ResponseEntity<String> finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) { if (!checkPasswordLength(keyAndPassword.getNewPassword())) { return new ResponseEntity<>(CHECK_ERROR_MESSAGE, HttpStatus.BAD_REQUEST); } return userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey()) .map(user -> new ResponseEntity<String>(HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); }
@PostMapping(path = STR, produces = MediaType.TEXT_PLAIN_VALUE) ResponseEntity<String> function(@RequestBody KeyAndPasswordVM keyAndPassword) { if (!checkPasswordLength(keyAndPassword.getNewPassword())) { return new ResponseEntity<>(CHECK_ERROR_MESSAGE, HttpStatus.BAD_REQUEST); } return userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey()) .map(user -> new ResponseEntity<String>(HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); }
/** * POST /account/reset_password/finish : Finish to reset the password of the user * * @param keyAndPassword the generated key and the new password * @return the ResponseEntity with status 200 (OK) if the password has been reset, * or status 400 (Bad Request) or 500 (Internal Server Error) if the password could not be reset */
POST /account/reset_password/finish : Finish to reset the password of the user
finishPasswordReset
{ "repo_name": "kms77/Fayabank", "path": "src/main/java/fr/trouillet/faya/fayabank/web/rest/AccountResource.java", "license": "gpl-3.0", "size": 10953 }
[ "fr.trouillet.faya.fayabank.web.rest.vm.KeyAndPasswordVM", "org.springframework.http.HttpStatus", "org.springframework.http.MediaType", "org.springframework.http.ResponseEntity", "org.springframework.web.bind.annotation.PostMapping", "org.springframework.web.bind.annotation.RequestBody" ]
import fr.trouillet.faya.fayabank.web.rest.vm.KeyAndPasswordVM; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody;
import fr.trouillet.faya.fayabank.web.rest.vm.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "fr.trouillet.faya", "org.springframework.http", "org.springframework.web" ]
fr.trouillet.faya; org.springframework.http; org.springframework.web;
1,412,111
public BigDecimal getWindChillC() { return WeatherUndergroundJsonUtils.convertToBigDecimal(windchill_c); }
BigDecimal function() { return WeatherUndergroundJsonUtils.convertToBigDecimal(windchill_c); }
/** * Get the wind chill temperature in degrees Celsius * * Used to update the channel current#windChill * * @return the wind chill temperature in degrees Celsius or null if not defined */
Get the wind chill temperature in degrees Celsius Used to update the channel current#windChill
getWindChillC
{ "repo_name": "openhab/openhab2", "path": "bundles/org.openhab.binding.weatherunderground/src/main/java/org/openhab/binding/weatherunderground/internal/json/WeatherUndergroundJsonCurrent.java", "license": "epl-1.0", "size": 15780 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
356,693
if (configurationFile == null || !configurationFile.canRead()) { log.error("Unable to read configuration file {}", configurationFile); } try { if (configurationFile.isDirectory()) { File[] configurations = configurationFile.listFiles(); for (int i = 0; i < configurations.length; i++) { log.debug("Parsing configuration file {}", configurations[i].getAbsolutePath()); load(new FileInputStream(configurations[i])); } } else { // Given file is not a directory so try to load it directly log.debug("Parsing configuration file {}", configurationFile.getAbsolutePath()); load(new FileInputStream(configurationFile)); } } catch (FileNotFoundException e) { // ignore, we already have the files } }
if (configurationFile == null !configurationFile.canRead()) { log.error(STR, configurationFile); } try { if (configurationFile.isDirectory()) { File[] configurations = configurationFile.listFiles(); for (int i = 0; i < configurations.length; i++) { log.debug(STR, configurations[i].getAbsolutePath()); load(new FileInputStream(configurations[i])); } } else { log.debug(STR, configurationFile.getAbsolutePath()); load(new FileInputStream(configurationFile)); } } catch (FileNotFoundException e) { } }
/** * Loads the configurtion file(s) from the given file. If the file is a directory each file within the directory is * loaded. * * @param configurationFile the configuration file(s) to be loaded * * @throws ConfigurationException thrown if the configuration file(s) can not be be read or invalid */
Loads the configurtion file(s) from the given file. If the file is a directory each file within the directory is loaded
load
{ "repo_name": "duck1123/java-xmltooling", "path": "src/main/java/org/opensaml/xml/XMLConfigurator.java", "license": "apache-2.0", "size": 15748 }
[ "java.io.File", "java.io.FileInputStream", "java.io.FileNotFoundException" ]
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException;
import java.io.*;
[ "java.io" ]
java.io;
2,419,810
public int parseParameters(String[] args) { // check for action if (args.length < 1) { CliFrontendParser.printHelp(customCommandLines); System.out.println("Please specify an action."); return 1; } // get action String action = args[0]; // remove action from parameters final String[] params = Arrays.copyOfRange(args, 1, args.length); try { // do action switch (action) { case ACTION_RUN: run(params); return 0; case ACTION_RUN_APPLICATION: runApplication(params); return 0; case ACTION_LIST: list(params); return 0; case ACTION_INFO: info(params); return 0; case ACTION_CANCEL: cancel(params); return 0; case ACTION_STOP: stop(params); return 0; case ACTION_SAVEPOINT: savepoint(params); return 0; case "-h": case "--help": CliFrontendParser.printHelp(customCommandLines); return 0; case "-v": case "--version": String version = EnvironmentInformation.getVersion(); String commitID = EnvironmentInformation.getRevisionInformation().commitId; System.out.print("Version: " + version); System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID); return 0; default: System.out.printf("\"%s\" is not a valid action.\n", action); System.out.println(); System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\"."); System.out.println(); System.out.println("Specify the version option (-v or --version) to print Flink version."); System.out.println(); System.out.println("Specify the help option (-h or --help) to get help on the command."); return 1; } } catch (CliArgsException ce) { return handleArgException(ce); } catch (ProgramParametrizationException ppe) { return handleParametrizationException(ppe); } catch (ProgramMissingJobException pmje) { return handleMissingJobException(); } catch (Exception e) { return handleError(e); } }
int function(String[] args) { if (args.length < 1) { CliFrontendParser.printHelp(customCommandLines); System.out.println(STR); return 1; } String action = args[0]; final String[] params = Arrays.copyOfRange(args, 1, args.length); try { switch (action) { case ACTION_RUN: run(params); return 0; case ACTION_RUN_APPLICATION: runApplication(params); return 0; case ACTION_LIST: list(params); return 0; case ACTION_INFO: info(params); return 0; case ACTION_CANCEL: cancel(params); return 0; case ACTION_STOP: stop(params); return 0; case ACTION_SAVEPOINT: savepoint(params); return 0; case "-h": case STR: CliFrontendParser.printHelp(customCommandLines); return 0; case "-v": case STR: String version = EnvironmentInformation.getVersion(); String commitID = EnvironmentInformation.getRevisionInformation().commitId; System.out.print(STR + version); System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? STR, Commit ID: STR\"%s\" is not a valid action.\nSTRValid actions are \"run\", \"list\", \"info\", \STR, \"stop\", or \STR.STRSpecify the version option (-v or --version) to print Flink version.STRSpecify the help option (-h or --help) to get help on the command."); return 1; } } catch (CliArgsException ce) { return handleArgException(ce); } catch (ProgramParametrizationException ppe) { return handleParametrizationException(ppe); } catch (ProgramMissingJobException pmje) { return handleMissingJobException(); } catch (Exception e) { return handleError(e); } }
/** * Parses the command line arguments and starts the requested action. * * @param args command line arguments of the client. * @return The return code of the program */
Parses the command line arguments and starts the requested action
parseParameters
{ "repo_name": "tzulitai/flink", "path": "flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java", "license": "apache-2.0", "size": 39978 }
[ "java.util.Arrays", "org.apache.flink.client.program.ProgramMissingJobException", "org.apache.flink.client.program.ProgramParametrizationException", "org.apache.flink.runtime.util.EnvironmentInformation" ]
import java.util.Arrays; import org.apache.flink.client.program.ProgramMissingJobException; import org.apache.flink.client.program.ProgramParametrizationException; import org.apache.flink.runtime.util.EnvironmentInformation;
import java.util.*; import org.apache.flink.client.program.*; import org.apache.flink.runtime.util.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
1,133,371
public List<Peak> filterNoise(List<Peak> peaks, double threshold, double experimentalPrecursorMzRatio);
List<Peak> function(List<Peak> peaks, double threshold, double experimentalPrecursorMzRatio);
/** * Filters the peak list; all peaks that have an intensity lower than the * given threshold will be omitted. The experimental precursor m/z ratio is given * as a method argument to exclude this mz value from the filtered spectrum. * * @param peaks the list of peaks * @param threshold the threshold value * @param experimentalPrecursorMzRatio the experimental precursor m/z ratio value * @return the filtered peak list */
Filters the peak list; all peaks that have an intensity lower than the given threshold will be omitted. The experimental precursor m/z ratio is given as a method argument to exclude this mz value from the filtered spectrum
filterNoise
{ "repo_name": "compomics/pride-asa-pipeline", "path": "pride-asa-pipeline-model/src/main/java/com/compomics/pride_asa_pipeline/core/logic/spectrum/filter/NoiseFilter.java", "license": "apache-2.0", "size": 854 }
[ "com.compomics.pride_asa_pipeline.model.Peak", "java.util.List" ]
import com.compomics.pride_asa_pipeline.model.Peak; import java.util.List;
import com.compomics.pride_asa_pipeline.model.*; import java.util.*;
[ "com.compomics.pride_asa_pipeline", "java.util" ]
com.compomics.pride_asa_pipeline; java.util;
1,026,222
try { InputEventAdaptorFactory websocketEventAdaptorFactory = new WebsocketEventAdaptorFactory(); context.getBundleContext().registerService(InputEventAdaptorFactory.class.getName(), websocketEventAdaptorFactory, null); if (log.isDebugEnabled()) { log.debug("Successfully deployed the input websocket adaptor service"); } } catch (RuntimeException e) { log.error("Can not create the input websocket adaptor service ", e); } }
try { InputEventAdaptorFactory websocketEventAdaptorFactory = new WebsocketEventAdaptorFactory(); context.getBundleContext().registerService(InputEventAdaptorFactory.class.getName(), websocketEventAdaptorFactory, null); if (log.isDebugEnabled()) { log.debug(STR); } } catch (RuntimeException e) { log.error(STR, e); } }
/** * initialize the agent service here service here. * * @param context */
initialize the agent service here service here
activate
{ "repo_name": "malakasilva/carbon-event-processing", "path": "components/adaptors/event-input-adaptor/org.wso2.carbon.event.input.adaptor.websocket/src/main/java/org/wso2/carbon/event/input/adaptor/websocket/internal/ds/WebsocketEventAdaptorServiceDS.java", "license": "apache-2.0", "size": 1948 }
[ "org.wso2.carbon.event.input.adaptor.core.InputEventAdaptorFactory", "org.wso2.carbon.event.input.adaptor.websocket.WebsocketEventAdaptorFactory" ]
import org.wso2.carbon.event.input.adaptor.core.InputEventAdaptorFactory; import org.wso2.carbon.event.input.adaptor.websocket.WebsocketEventAdaptorFactory;
import org.wso2.carbon.event.input.adaptor.core.*; import org.wso2.carbon.event.input.adaptor.websocket.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
497,234
void pauseJobs(GroupMatcher<JobKey> matcher) throws SchedulerException;
void pauseJobs(GroupMatcher<JobKey> matcher) throws SchedulerException;
/** * Pause all of the <code>{@link org.quartz.JobDetail}s</code> in the * matching groups - by pausing all of their <code>Trigger</code>s. * * <p> * The Scheduler will "remember" the groups paused, and impose the * pause on any new jobs that are added to any of those groups * until it is resumed. * </p> * * @param matcher The matcher to evaluate against know groups * @throws SchedulerException On error * @see #resumeJobs(org.quartz.impl.matchers.GroupMatcher) */
Pause all of the <code><code>org.quartz.JobDetail</code>s</code> in the matching groups - by pausing all of their <code>Trigger</code>s. The Scheduler will "remember" the groups paused, and impose the pause on any new jobs that are added to any of those groups until it is resumed.
pauseJobs
{ "repo_name": "dumptruckman/Pail", "path": "lib/quartz-2.0.1/quartz/src/main/java/org/quartz/Scheduler.java", "license": "gpl-2.0", "size": 31082 }
[ "org.quartz.impl.matchers.GroupMatcher" ]
import org.quartz.impl.matchers.GroupMatcher;
import org.quartz.impl.matchers.*;
[ "org.quartz.impl" ]
org.quartz.impl;
191,287
public void mouseEntered(java.awt.event.MouseEvent evt) { clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.BOLD, 10)); clearLabel.setText(ControlsRes.getString("OSPControl.Click_to_clear_message")); //$NON-NLS-1$ }
void function(java.awt.event.MouseEvent evt) { clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.BOLD, 10)); clearLabel.setText(ControlsRes.getString(STR)); }
/** * Method mouseEntered * * @param evt */
Method mouseEntered
mouseEntered
{ "repo_name": "dobrown/tracker-mvn", "path": "src/main/java/org/opensourcephysics/controls/OSPControl.java", "license": "gpl-3.0", "size": 22919 }
[ "java.awt.Font" ]
import java.awt.Font;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,468,241
public boolean isInPlace(byte[] id) { ByteBuffer idBuffer = ByteBuffer.wrap(id); while (idBuffer.hasRemaining()) { if (idBuffer.get() != 0) { return false; } int len = DataUtils.readVarInt(idBuffer); idBuffer.position(idBuffer.position() + len); } return true; }
boolean function(byte[] id) { ByteBuffer idBuffer = ByteBuffer.wrap(id); while (idBuffer.hasRemaining()) { if (idBuffer.get() != 0) { return false; } int len = DataUtils.readVarInt(idBuffer); idBuffer.position(idBuffer.position() + len); } return true; }
/** * Check whether the id itself contains all the data. This operation does * not cause any reads in the map. * * @param id the id * @return if the id contains the data */
Check whether the id itself contains all the data. This operation does not cause any reads in the map
isInPlace
{ "repo_name": "vdr007/ThriftyPaxos", "path": "src/applications/h2/src/main/org/h2/mvstore/StreamStore.java", "license": "apache-2.0", "size": 17081 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
374,201
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<DatabaseInner>> listByServerNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<DatabaseInner>> function(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Get the next page of items. * * @param nextLink The nextLink parameter. * @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 a List of databases along with {@link PagedResponse} on successful completion of {@link Mono}. */
Get the next page of items
listByServerNextSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesClientImpl.java", "license": "mit", "size": 54454 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.mysqlflexibleserver.fluent.models.DatabaseInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.DatabaseInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
379,187
public static InetAddress getServerAddress() { if (valid && gameMode == Mode.CLIENT) { return serverAddress; } else { return null; } }
static InetAddress function() { if (valid && gameMode == Mode.CLIENT) { return serverAddress; } else { return null; } }
/** * Returns an InetAddress object representing the game server to which the * client should connect. If the configuration is not valid or the * application is not configured in client mode, this method returns null. * * @return The InetAddress object for the configured game server. */
Returns an InetAddress object representing the game server to which the client should connect. If the configuration is not valid or the application is not configured in client mode, this method returns null
getServerAddress
{ "repo_name": "rsanchez-wsu/sp15-ceg3120", "path": "src/edu/wright/cs/sp15/ceg3120/turntanks/Configuration.java", "license": "gpl-3.0", "size": 9787 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
2,099,065
void preGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> c, final byte [] row, final byte [] family, final Result result) throws IOException;
void preGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> c, final byte [] row, final byte [] family, final Result result) throws IOException;
/** * Called before a client makes a GetClosestRowBefore request. * <p> * Call CoprocessorEnvironment#bypass to skip default actions * <p> * Call CoprocessorEnvironment#complete to skip any subsequent chained * coprocessors * @param c the environment provided by the region server * @param row the row * @param family the family * @param result The result to return to the client if default processing * is bypassed. Can be modified. Will not be used if default processing * is not bypassed. * @throws IOException if an error occurred on the coprocessor */
Called before a client makes a GetClosestRowBefore request. Call CoprocessorEnvironment#bypass to skip default actions Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preGetClosestRowBefore
{ "repo_name": "justintung/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java", "license": "apache-2.0", "size": 56375 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.Result" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.Result;
import java.io.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,644,384
ITicketService getTicketService();
ITicketService getTicketService();
/** * Returns the ticket service. * * @return a ticket service * @since 1.4.0 */
Returns the ticket service
getTicketService
{ "repo_name": "firateren52/gitblit", "path": "src/main/java/com/gitblit/manager/IGitblit.java", "license": "apache-2.0", "size": 3397 }
[ "com.gitblit.tickets.ITicketService" ]
import com.gitblit.tickets.ITicketService;
import com.gitblit.tickets.*;
[ "com.gitblit.tickets" ]
com.gitblit.tickets;
1,517,902
@Nullable List<String> getSlots(@Nullable TypeEvalContext context);
List<String> getSlots(@Nullable TypeEvalContext context);
/** * Returns the aggregated list of names defined in __slots__ attributes of the class and its ancestors. * * @param context (will be used default if null) */
Returns the aggregated list of names defined in __slots__ attributes of the class and its ancestors
getSlots
{ "repo_name": "consulo/consulo-python", "path": "python-psi-api/src/main/java/com/jetbrains/python/psi/PyClass.java", "license": "apache-2.0", "size": 9952 }
[ "com.jetbrains.python.psi.types.TypeEvalContext", "java.util.List", "javax.annotation.Nullable" ]
import com.jetbrains.python.psi.types.TypeEvalContext; import java.util.List; import javax.annotation.Nullable;
import com.jetbrains.python.psi.types.*; import java.util.*; import javax.annotation.*;
[ "com.jetbrains.python", "java.util", "javax.annotation" ]
com.jetbrains.python; java.util; javax.annotation;
831,758
public List<CauseAction> getActions() { return actions; }
List<CauseAction> function() { return actions; }
/** * Get actions * @return actions **/
Get actions
getActions
{ "repo_name": "cliffano/swaggy-jenkins", "path": "clients/java/generated/src/main/java/com/cliffano/swaggyjenkins/model/QueueLeftItem.java", "license": "mit", "size": 10597 }
[ "com.cliffano.swaggyjenkins.model.CauseAction", "java.util.List" ]
import com.cliffano.swaggyjenkins.model.CauseAction; import java.util.List;
import com.cliffano.swaggyjenkins.model.*; import java.util.*;
[ "com.cliffano.swaggyjenkins", "java.util" ]
com.cliffano.swaggyjenkins; java.util;
231,745
public List<TextContentUpdateDiff> generateChanges( String curXMLContent, String prevXMLContent ) { // preparing the text means to add spaces between tags, // to delete line feeds and to put replacement character // for spaces inside of a tag curXMLContent = KiWiStringUtils.prepareHtmlText(curXMLContent); curXMLContent.trim(); prevXMLContent = KiWiStringUtils.prepareHtmlText(prevXMLContent); prevXMLContent.trim(); // create a list of strings of the words in the previous text List<String> origwords = new ArrayList<String>( Arrays.asList(prevXMLContent.split(" ")) ); // and remove all empty entries while(origwords.remove("")); // create a list of strings of the words in the current text List<String> modwords = new ArrayList<String>( Arrays.asList(curXMLContent.split(" ")) ); // and remove all empty entries while(modwords.remove("")); // return the differenced listed in a string return LCS.diff(origwords, modwords); }
List<TextContentUpdateDiff> function( String curXMLContent, String prevXMLContent ) { curXMLContent = KiWiStringUtils.prepareHtmlText(curXMLContent); curXMLContent.trim(); prevXMLContent = KiWiStringUtils.prepareHtmlText(prevXMLContent); prevXMLContent.trim(); List<String> origwords = new ArrayList<String>( Arrays.asList(prevXMLContent.split(" ")) ); while(origwords.remove(STR STR")); return LCS.diff(origwords, modwords); }
/** * generates the changes between original and modified text * @param curXMLContent * @param prevXMLContent * @return a list of diffs between original and modified text */
generates the changes between original and modified text
generateChanges
{ "repo_name": "fregaham/KiWi", "path": "src/action/kiwi/service/revision/UpdateTextContentServiceImpl.java", "license": "bsd-3-clause", "size": 30649 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.List", "kiwi.model.revision.TextContentUpdateDiff", "kiwi.util.KiWiStringUtils" ]
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import kiwi.model.revision.TextContentUpdateDiff; import kiwi.util.KiWiStringUtils;
import java.util.*; import kiwi.model.revision.*; import kiwi.util.*;
[ "java.util", "kiwi.model.revision", "kiwi.util" ]
java.util; kiwi.model.revision; kiwi.util;
1,496,255
private void actionImportData(final CommandLine line) { final List<String> requiredArgs = Arrays.asList(CLIParameter.FILE, CLIParameter.FORMAT, CLIParameter.TABLE); checkRequiredArgs(requiredArgs); final String filename = line.getOptionValue(CLIParameter.FILE); final String format = line.getOptionValue(CLIParameter.FORMAT); final String table = line.getOptionValue(CLIParameter.TABLE); final String paddingString = CLIHelper.getParameterOrDefault(line, CLIParameter.BOUNDING_BOX_PADDING, "0.0"); final double padding = MathUtil.tryParseDoubleOrExit(paddingString, () -> "Untable to parse: " + paddingString); System.out.format("Importing file: %s with padding %f%n", filename, padding); final TupleFileReader tupleFile = new TupleFileReader(filename, format, padding); tupleFile.addTupleListener(t -> { if(tupleFile.getProcessedLines() % 1000 == 0) { System.out.format("Read %d lines%n", tupleFile.getProcessedLines()); } try { final EmptyResultFuture result = bboxDbConnection.put(table, t); pendingFutures.put(result); } catch (BBoxDBException e) { logger.error("Got exception while inserting tuple", e); } }); try { tupleFile.processFile(); pendingFutures.waitForCompletion(); final long skippedLines = tupleFile.getSkippedLines(); final long processedLines = tupleFile.getProcessedLines(); System.out.format("Successfully imported %d lines (and skipped %d invalid lines) %n", processedLines - skippedLines, skippedLines); } catch (IOException e) { logger.error("Got IO Exception while reading data", e); System.exit(-1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } }
void function(final CommandLine line) { final List<String> requiredArgs = Arrays.asList(CLIParameter.FILE, CLIParameter.FORMAT, CLIParameter.TABLE); checkRequiredArgs(requiredArgs); final String filename = line.getOptionValue(CLIParameter.FILE); final String format = line.getOptionValue(CLIParameter.FORMAT); final String table = line.getOptionValue(CLIParameter.TABLE); final String paddingString = CLIHelper.getParameterOrDefault(line, CLIParameter.BOUNDING_BOX_PADDING, "0.0"); final double padding = MathUtil.tryParseDoubleOrExit(paddingString, () -> STR + paddingString); System.out.format(STR, filename, padding); final TupleFileReader tupleFile = new TupleFileReader(filename, format, padding); tupleFile.addTupleListener(t -> { if(tupleFile.getProcessedLines() % 1000 == 0) { System.out.format(STR, tupleFile.getProcessedLines()); } try { final EmptyResultFuture result = bboxDbConnection.put(table, t); pendingFutures.put(result); } catch (BBoxDBException e) { logger.error(STR, e); } }); try { tupleFile.processFile(); pendingFutures.waitForCompletion(); final long skippedLines = tupleFile.getSkippedLines(); final long processedLines = tupleFile.getProcessedLines(); System.out.format(STR, processedLines - skippedLines, skippedLines); } catch (IOException e) { logger.error(STR, e); System.exit(-1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } }
/** * Import data * @param line */
Import data
actionImportData
{ "repo_name": "jnidzwetzki/bboxdb", "path": "bboxdb-tools/src/main/java/org/bboxdb/tools/cli/CLI.java", "license": "apache-2.0", "size": 41886 }
[ "java.io.IOException", "java.util.Arrays", "java.util.List", "org.apache.commons.cli.CommandLine", "org.bboxdb.commons.MathUtil", "org.bboxdb.misc.BBoxDBException", "org.bboxdb.network.client.future.client.EmptyResultFuture", "org.bboxdb.tools.TupleFileReader" ]
import java.io.IOException; import java.util.Arrays; import java.util.List; import org.apache.commons.cli.CommandLine; import org.bboxdb.commons.MathUtil; import org.bboxdb.misc.BBoxDBException; import org.bboxdb.network.client.future.client.EmptyResultFuture; import org.bboxdb.tools.TupleFileReader;
import java.io.*; import java.util.*; import org.apache.commons.cli.*; import org.bboxdb.commons.*; import org.bboxdb.misc.*; import org.bboxdb.network.client.future.client.*; import org.bboxdb.tools.*;
[ "java.io", "java.util", "org.apache.commons", "org.bboxdb.commons", "org.bboxdb.misc", "org.bboxdb.network", "org.bboxdb.tools" ]
java.io; java.util; org.apache.commons; org.bboxdb.commons; org.bboxdb.misc; org.bboxdb.network; org.bboxdb.tools;
295,482
private void initializePolicyDir() throws ContainerExecutionException { String hadoopTempDir = configuration.get("hadoop.tmp.dir"); if (hadoopTempDir == null) { throw new ContainerExecutionException("hadoop.tmp.dir not set!"); } policyFileDir = Paths.get(hadoopTempDir, POLICY_FILE_DIR); //Delete any existing policy files if the directory has already been created if(Files.exists(policyFileDir)){ try (DirectoryStream<Path> stream = Files.newDirectoryStream(policyFileDir)){ for(Path policyFile : stream){ Files.delete(policyFile); } }catch(IOException e){ throw new ContainerExecutionException("Unable to initialize policy " + "directory: " + e); } } else { try { policyFileDir = Files.createDirectories( Paths.get(hadoopTempDir, POLICY_FILE_DIR), POLICY_ATTR); } catch (IOException e) { throw new ContainerExecutionException("Unable to create policy file " + "directory: " + e); } } } /** * Prior to environment from being written locally need to generate * policy file which limits container access to a small set of directories. * Additionally the container run command needs to be modified to include * flags to enable the java security manager with the generated policy. * <br> * The Java Sandbox will be circumvented if the user is a member of the * group specified in: * {@value YarnConfiguration#YARN_CONTAINER_SANDBOX_WHITELIST_GROUP} and if * they do not include the JVM flag: * {@value NMContainerPolicyUtils#SECURITY_FLAG}
void function() throws ContainerExecutionException { String hadoopTempDir = configuration.get(STR); if (hadoopTempDir == null) { throw new ContainerExecutionException(STR); } policyFileDir = Paths.get(hadoopTempDir, POLICY_FILE_DIR); if(Files.exists(policyFileDir)){ try (DirectoryStream<Path> stream = Files.newDirectoryStream(policyFileDir)){ for(Path policyFile : stream){ Files.delete(policyFile); } }catch(IOException e){ throw new ContainerExecutionException(STR + STR + e); } } else { try { policyFileDir = Files.createDirectories( Paths.get(hadoopTempDir, POLICY_FILE_DIR), POLICY_ATTR); } catch (IOException e) { throw new ContainerExecutionException(STR + STR + e); } } } /** * Prior to environment from being written locally need to generate * policy file which limits container access to a small set of directories. * Additionally the container run command needs to be modified to include * flags to enable the java security manager with the generated policy. * <br> * The Java Sandbox will be circumvented if the user is a member of the * group specified in: * {@value YarnConfiguration#YARN_CONTAINER_SANDBOX_WHITELIST_GROUP} and if * they do not include the JVM flag: * {@value NMContainerPolicyUtils#SECURITY_FLAG}
/** * Initialize the Java Security Policy directory. Either creates the * directory if it doesn't exist, or clears the contents of the directory if * already created. * @throws ContainerExecutionException If unable to resolve policy directory */
Initialize the Java Security Policy directory. Either creates the directory if it doesn't exist, or clears the contents of the directory if already created
initializePolicyDir
{ "repo_name": "GeLiXin/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/JavaSandboxLinuxContainerRuntime.java", "license": "apache-2.0", "size": 22198 }
[ "java.io.IOException", "java.nio.file.DirectoryStream", "java.nio.file.Files", "java.nio.file.Path", "java.nio.file.Paths", "org.apache.hadoop.yarn.conf.YarnConfiguration", "org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerExecutionException" ]
import java.io.IOException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerExecutionException;
import java.io.*; import java.nio.file.*; import org.apache.hadoop.yarn.conf.*; import org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.*;
[ "java.io", "java.nio", "org.apache.hadoop" ]
java.io; java.nio; org.apache.hadoop;
501,709
protected void handleMouseClick(@Nullable Slot slotIn, int slotId, int mouseButton, ClickType type) { this.clearSearch = true; boolean flag = type == ClickType.QUICK_MOVE; type = slotId == -999 && type == ClickType.PICKUP ? ClickType.THROW : type; if (slotIn == null && selectedTabIndex != CreativeTabs.INVENTORY.getTabIndex() && type != ClickType.QUICK_CRAFT) { InventoryPlayer inventoryplayer1 = this.mc.player.inventory; if (!inventoryplayer1.getItemStack().isEmpty()) { if (mouseButton == 0) { this.mc.player.dropItem(inventoryplayer1.getItemStack(), true); this.mc.playerController.sendPacketDropItem(inventoryplayer1.getItemStack()); inventoryplayer1.setItemStack(ItemStack.EMPTY); } if (mouseButton == 1) { ItemStack itemstack6 = inventoryplayer1.getItemStack().splitStack(1); this.mc.player.dropItem(itemstack6, true); this.mc.playerController.sendPacketDropItem(itemstack6); } } } else { if (slotIn != null && !slotIn.canTakeStack(this.mc.player)) { return; } if (slotIn == this.destroyItemSlot && flag) { for (int j = 0; j < this.mc.player.inventoryContainer.getInventory().size(); ++j) { this.mc.playerController.sendSlotPacket(ItemStack.EMPTY, j); } } else if (selectedTabIndex == CreativeTabs.INVENTORY.getTabIndex()) { if (slotIn == this.destroyItemSlot) { this.mc.player.inventory.setItemStack(ItemStack.EMPTY); } else if (type == ClickType.THROW && slotIn != null && slotIn.getHasStack()) { ItemStack itemstack = slotIn.decrStackSize(mouseButton == 0 ? 1 : slotIn.getStack().getMaxStackSize()); ItemStack itemstack1 = slotIn.getStack(); this.mc.player.dropItem(itemstack, true); this.mc.playerController.sendPacketDropItem(itemstack); this.mc.playerController.sendSlotPacket(itemstack1, ((GuiContainerCreative.CreativeSlot)slotIn).slot.slotNumber); } else if (type == ClickType.THROW && !this.mc.player.inventory.getItemStack().isEmpty()) { this.mc.player.dropItem(this.mc.player.inventory.getItemStack(), true); this.mc.playerController.sendPacketDropItem(this.mc.player.inventory.getItemStack()); this.mc.player.inventory.setItemStack(ItemStack.EMPTY); } else { this.mc.player.inventoryContainer.slotClick(slotIn == null ? slotId : ((GuiContainerCreative.CreativeSlot)slotIn).slot.slotNumber, mouseButton, type, this.mc.player); this.mc.player.inventoryContainer.detectAndSendChanges(); } } else if (type != ClickType.QUICK_CRAFT && slotIn.inventory == basicInventory) { InventoryPlayer inventoryplayer = this.mc.player.inventory; ItemStack itemstack5 = inventoryplayer.getItemStack(); ItemStack itemstack7 = slotIn.getStack(); if (type == ClickType.SWAP) { if (!itemstack7.isEmpty() && mouseButton >= 0 && mouseButton < 9) { ItemStack itemstack10 = itemstack7.copy(); itemstack10.setCount(itemstack10.getMaxStackSize()); this.mc.player.inventory.setInventorySlotContents(mouseButton, itemstack10); this.mc.player.inventoryContainer.detectAndSendChanges(); } return; } if (type == ClickType.CLONE) { if (inventoryplayer.getItemStack().isEmpty() && slotIn.getHasStack()) { ItemStack itemstack9 = slotIn.getStack().copy(); itemstack9.setCount(itemstack9.getMaxStackSize()); inventoryplayer.setItemStack(itemstack9); } return; } if (type == ClickType.THROW) { if (!itemstack7.isEmpty()) { ItemStack itemstack8 = itemstack7.copy(); itemstack8.setCount(mouseButton == 0 ? 1 : itemstack8.getMaxStackSize()); this.mc.player.dropItem(itemstack8, true); this.mc.playerController.sendPacketDropItem(itemstack8); } return; } if (!itemstack5.isEmpty() && !itemstack7.isEmpty() && itemstack5.isItemEqual(itemstack7) && ItemStack.areItemStackTagsEqual(itemstack5, itemstack7)) { if (mouseButton == 0) { if (flag) { itemstack5.setCount(itemstack5.getMaxStackSize()); } else if (itemstack5.getCount() < itemstack5.getMaxStackSize()) { itemstack5.grow(1); } } else { itemstack5.shrink(1); } } else if (!itemstack7.isEmpty() && itemstack5.isEmpty()) { inventoryplayer.setItemStack(itemstack7.copy()); itemstack5 = inventoryplayer.getItemStack(); if (flag) { itemstack5.setCount(itemstack5.getMaxStackSize()); } } else if (mouseButton == 0) { inventoryplayer.setItemStack(ItemStack.EMPTY); } else { inventoryplayer.getItemStack().shrink(1); } } else if (this.inventorySlots != null) { ItemStack itemstack3 = slotIn == null ? ItemStack.EMPTY : this.inventorySlots.getSlot(slotIn.slotNumber).getStack(); this.inventorySlots.slotClick(slotIn == null ? slotId : slotIn.slotNumber, mouseButton, type, this.mc.player); if (Container.getDragEvent(mouseButton) == 2) { for (int k = 0; k < 9; ++k) { this.mc.playerController.sendSlotPacket(this.inventorySlots.getSlot(45 + k).getStack(), 36 + k); } } else if (slotIn != null) { ItemStack itemstack4 = this.inventorySlots.getSlot(slotIn.slotNumber).getStack(); this.mc.playerController.sendSlotPacket(itemstack4, slotIn.slotNumber - this.inventorySlots.inventorySlots.size() + 9 + 36); int i = 45 + mouseButton; if (type == ClickType.SWAP) { this.mc.playerController.sendSlotPacket(itemstack3, i - this.inventorySlots.inventorySlots.size() + 9 + 36); } else if (type == ClickType.THROW && !itemstack3.isEmpty()) { ItemStack itemstack2 = itemstack3.copy(); itemstack2.setCount(mouseButton == 0 ? 1 : itemstack2.getMaxStackSize()); this.mc.player.dropItem(itemstack2, true); this.mc.playerController.sendPacketDropItem(itemstack2); } this.mc.player.inventoryContainer.detectAndSendChanges(); } } } }
void function(@Nullable Slot slotIn, int slotId, int mouseButton, ClickType type) { this.clearSearch = true; boolean flag = type == ClickType.QUICK_MOVE; type = slotId == -999 && type == ClickType.PICKUP ? ClickType.THROW : type; if (slotIn == null && selectedTabIndex != CreativeTabs.INVENTORY.getTabIndex() && type != ClickType.QUICK_CRAFT) { InventoryPlayer inventoryplayer1 = this.mc.player.inventory; if (!inventoryplayer1.getItemStack().isEmpty()) { if (mouseButton == 0) { this.mc.player.dropItem(inventoryplayer1.getItemStack(), true); this.mc.playerController.sendPacketDropItem(inventoryplayer1.getItemStack()); inventoryplayer1.setItemStack(ItemStack.EMPTY); } if (mouseButton == 1) { ItemStack itemstack6 = inventoryplayer1.getItemStack().splitStack(1); this.mc.player.dropItem(itemstack6, true); this.mc.playerController.sendPacketDropItem(itemstack6); } } } else { if (slotIn != null && !slotIn.canTakeStack(this.mc.player)) { return; } if (slotIn == this.destroyItemSlot && flag) { for (int j = 0; j < this.mc.player.inventoryContainer.getInventory().size(); ++j) { this.mc.playerController.sendSlotPacket(ItemStack.EMPTY, j); } } else if (selectedTabIndex == CreativeTabs.INVENTORY.getTabIndex()) { if (slotIn == this.destroyItemSlot) { this.mc.player.inventory.setItemStack(ItemStack.EMPTY); } else if (type == ClickType.THROW && slotIn != null && slotIn.getHasStack()) { ItemStack itemstack = slotIn.decrStackSize(mouseButton == 0 ? 1 : slotIn.getStack().getMaxStackSize()); ItemStack itemstack1 = slotIn.getStack(); this.mc.player.dropItem(itemstack, true); this.mc.playerController.sendPacketDropItem(itemstack); this.mc.playerController.sendSlotPacket(itemstack1, ((GuiContainerCreative.CreativeSlot)slotIn).slot.slotNumber); } else if (type == ClickType.THROW && !this.mc.player.inventory.getItemStack().isEmpty()) { this.mc.player.dropItem(this.mc.player.inventory.getItemStack(), true); this.mc.playerController.sendPacketDropItem(this.mc.player.inventory.getItemStack()); this.mc.player.inventory.setItemStack(ItemStack.EMPTY); } else { this.mc.player.inventoryContainer.slotClick(slotIn == null ? slotId : ((GuiContainerCreative.CreativeSlot)slotIn).slot.slotNumber, mouseButton, type, this.mc.player); this.mc.player.inventoryContainer.detectAndSendChanges(); } } else if (type != ClickType.QUICK_CRAFT && slotIn.inventory == basicInventory) { InventoryPlayer inventoryplayer = this.mc.player.inventory; ItemStack itemstack5 = inventoryplayer.getItemStack(); ItemStack itemstack7 = slotIn.getStack(); if (type == ClickType.SWAP) { if (!itemstack7.isEmpty() && mouseButton >= 0 && mouseButton < 9) { ItemStack itemstack10 = itemstack7.copy(); itemstack10.setCount(itemstack10.getMaxStackSize()); this.mc.player.inventory.setInventorySlotContents(mouseButton, itemstack10); this.mc.player.inventoryContainer.detectAndSendChanges(); } return; } if (type == ClickType.CLONE) { if (inventoryplayer.getItemStack().isEmpty() && slotIn.getHasStack()) { ItemStack itemstack9 = slotIn.getStack().copy(); itemstack9.setCount(itemstack9.getMaxStackSize()); inventoryplayer.setItemStack(itemstack9); } return; } if (type == ClickType.THROW) { if (!itemstack7.isEmpty()) { ItemStack itemstack8 = itemstack7.copy(); itemstack8.setCount(mouseButton == 0 ? 1 : itemstack8.getMaxStackSize()); this.mc.player.dropItem(itemstack8, true); this.mc.playerController.sendPacketDropItem(itemstack8); } return; } if (!itemstack5.isEmpty() && !itemstack7.isEmpty() && itemstack5.isItemEqual(itemstack7) && ItemStack.areItemStackTagsEqual(itemstack5, itemstack7)) { if (mouseButton == 0) { if (flag) { itemstack5.setCount(itemstack5.getMaxStackSize()); } else if (itemstack5.getCount() < itemstack5.getMaxStackSize()) { itemstack5.grow(1); } } else { itemstack5.shrink(1); } } else if (!itemstack7.isEmpty() && itemstack5.isEmpty()) { inventoryplayer.setItemStack(itemstack7.copy()); itemstack5 = inventoryplayer.getItemStack(); if (flag) { itemstack5.setCount(itemstack5.getMaxStackSize()); } } else if (mouseButton == 0) { inventoryplayer.setItemStack(ItemStack.EMPTY); } else { inventoryplayer.getItemStack().shrink(1); } } else if (this.inventorySlots != null) { ItemStack itemstack3 = slotIn == null ? ItemStack.EMPTY : this.inventorySlots.getSlot(slotIn.slotNumber).getStack(); this.inventorySlots.slotClick(slotIn == null ? slotId : slotIn.slotNumber, mouseButton, type, this.mc.player); if (Container.getDragEvent(mouseButton) == 2) { for (int k = 0; k < 9; ++k) { this.mc.playerController.sendSlotPacket(this.inventorySlots.getSlot(45 + k).getStack(), 36 + k); } } else if (slotIn != null) { ItemStack itemstack4 = this.inventorySlots.getSlot(slotIn.slotNumber).getStack(); this.mc.playerController.sendSlotPacket(itemstack4, slotIn.slotNumber - this.inventorySlots.inventorySlots.size() + 9 + 36); int i = 45 + mouseButton; if (type == ClickType.SWAP) { this.mc.playerController.sendSlotPacket(itemstack3, i - this.inventorySlots.inventorySlots.size() + 9 + 36); } else if (type == ClickType.THROW && !itemstack3.isEmpty()) { ItemStack itemstack2 = itemstack3.copy(); itemstack2.setCount(mouseButton == 0 ? 1 : itemstack2.getMaxStackSize()); this.mc.player.dropItem(itemstack2, true); this.mc.playerController.sendPacketDropItem(itemstack2); } this.mc.player.inventoryContainer.detectAndSendChanges(); } } } }
/** * Called when the mouse is clicked over a slot or outside the gui. */
Called when the mouse is clicked over a slot or outside the gui
handleMouseClick
{ "repo_name": "TheGreatAndPowerfulWeegee/wipunknown", "path": "build/tmp/recompileMc/sources/net/minecraft/client/gui/inventory/GuiContainerCreative.java", "license": "gpl-3.0", "size": 47873 }
[ "javax.annotation.Nullable", "net.minecraft.creativetab.CreativeTabs", "net.minecraft.entity.player.InventoryPlayer", "net.minecraft.inventory.ClickType", "net.minecraft.inventory.Container", "net.minecraft.inventory.Slot", "net.minecraft.item.ItemStack" ]
import javax.annotation.Nullable; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack;
import javax.annotation.*; import net.minecraft.creativetab.*; import net.minecraft.entity.player.*; import net.minecraft.inventory.*; import net.minecraft.item.*;
[ "javax.annotation", "net.minecraft.creativetab", "net.minecraft.entity", "net.minecraft.inventory", "net.minecraft.item" ]
javax.annotation; net.minecraft.creativetab; net.minecraft.entity; net.minecraft.inventory; net.minecraft.item;
983,400
public static Optional<AttributeExpType> getType(String typeId){ return Optional.fromNullable(TYPES_BY_ID.get(typeId)); }
static Optional<AttributeExpType> function(String typeId){ return Optional.fromNullable(TYPES_BY_ID.get(typeId)); }
/** * Gets type via type identifier or alias * * @param typeId a type identifier * @return {@link Optional} with resolved type */
Gets type via type identifier or alias
getType
{ "repo_name": "snmaher/xacml4j", "path": "xacml-core/src/main/java/org/xacml4j/v30/types/XacmlTypes.java", "license": "lgpl-3.0", "size": 10690 }
[ "com.google.common.base.Optional", "org.xacml4j.v30.AttributeExpType" ]
import com.google.common.base.Optional; import org.xacml4j.v30.AttributeExpType;
import com.google.common.base.*; import org.xacml4j.v30.*;
[ "com.google.common", "org.xacml4j.v30" ]
com.google.common; org.xacml4j.v30;
2,885,307
private void initialize() { GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.VERTICAL; gridBagConstraints1.gridy = 1; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.insets = new Insets(2, 2, 2, 2); gridBagConstraints1.gridx = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(2, 2, 2, 2); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.gridy = 2; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.insets = new Insets(2, 2, 2, 2); gridBagConstraints2.fill = GridBagConstraints.VERTICAL; gridBagConstraints2.gridy = 3; this.setLayout(new GridBagLayout()); this.add(getExecuteButton(), gridBagConstraints1); this.add(new JLabel("Node query:"), gridBagConstraints); this.add(getQueryField(), gridBagConstraints2); }
void function() { GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.VERTICAL; gridBagConstraints1.gridy = 1; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.insets = new Insets(2, 2, 2, 2); gridBagConstraints1.gridx = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(2, 2, 2, 2); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.gridy = 2; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.insets = new Insets(2, 2, 2, 2); gridBagConstraints2.fill = GridBagConstraints.VERTICAL; gridBagConstraints2.gridy = 3; this.setLayout(new GridBagLayout()); this.add(getExecuteButton(), gridBagConstraints1); this.add(new JLabel(STR), gridBagConstraints); this.add(getQueryField(), gridBagConstraints2); }
/** * This method initializes this */
This method initializes this
initialize
{ "repo_name": "dev-cuttlefish/cuttlefish", "path": "src-old/ch/ethz/sg/cuttlefish/gui/widgets/DBQueryPanel.java", "license": "gpl-2.0", "size": 3860 }
[ "java.awt.GridBagConstraints", "java.awt.GridBagLayout", "java.awt.Insets", "javax.swing.JLabel" ]
import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JLabel;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,620,175
public Meta appendChild(List<Node> children){ if(children != null){ for(Node child: children){ appendChild(child); } } return this; }
Meta function(List<Node> children){ if(children != null){ for(Node child: children){ appendChild(child); } } return this; }
/** * Appends a list of children in the order given in the list * @param children nodes to be appended * @return the node */
Appends a list of children in the order given in the list
appendChild
{ "repo_name": "uniteddiversity/mycollab", "path": "mycollab-core/src/main/java/com/hp/gagawa/java/elements/Meta.java", "license": "agpl-3.0", "size": 4631 }
[ "com.hp.gagawa.java.Node", "java.util.List" ]
import com.hp.gagawa.java.Node; import java.util.List;
import com.hp.gagawa.java.*; import java.util.*;
[ "com.hp.gagawa", "java.util" ]
com.hp.gagawa; java.util;
2,619,013
final CreatorImpl clonedCreatorImpl=(CreatorImpl) creatorImpl.clone(); Assert.assertEquals("The clone should be equal to the one it's cloned from",creatorImpl,clonedCreatorImpl); clonedCreatorImpl.setName(String.valueOf(System.currentTimeMillis())); Assert.assertNotEquals("The clone should not be equal to the one it's cloned from after altering it",creatorImpl,clonedCreatorImpl); }
final CreatorImpl clonedCreatorImpl=(CreatorImpl) creatorImpl.clone(); Assert.assertEquals(STR,creatorImpl,clonedCreatorImpl); clonedCreatorImpl.setName(String.valueOf(System.currentTimeMillis())); Assert.assertNotEquals(STR,creatorImpl,clonedCreatorImpl); }
/** * Tests if a clone of a given {@link CreatorImpl} is equal and non-equal after altering it. * @param creatorImpl */
Tests if a clone of a given <code>CreatorImpl</code> is equal and non-equal after altering it
assertCloneable
{ "repo_name": "seriousbusinessbe/java-brusselnieuws-rss", "path": "java/brusselnieuws-rss/brusselnieuws-rss-reader-model/src/test/java/be/seriousbusiness/brusselnieuws/rss/reader/model/impl/CreatorImplTest.java", "license": "mit", "size": 1204 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
96,531
public static boolean containsColumnUpdate( List<ColumnChange> changes) { if(changes == null){ return false; } if(changes.isEmpty()){ return false; } for(ColumnChange change: changes){ if(change.getNewColumnId() != null && change.getOldColumnId() != null){ if(!change.getNewColumnId().equals(change.getOldColumnId())){ // a column change requires a temporary table to validate. return true; } } } return false; }
static boolean function( List<ColumnChange> changes) { if(changes == null){ return false; } if(changes.isEmpty()){ return false; } for(ColumnChange change: changes){ if(change.getNewColumnId() != null && change.getOldColumnId() != null){ if(!change.getNewColumnId().equals(change.getOldColumnId())){ return true; } } } return false; }
/** * Does the given change include an update of an existing column? * * @param changes * @return */
Does the given change include an update of an existing column
containsColumnUpdate
{ "repo_name": "Sage-Bionetworks/Synapse-Repository-Services", "path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/table/TableEntityManagerImpl.java", "license": "apache-2.0", "size": 41780 }
[ "java.util.List", "org.sagebionetworks.repo.model.table.ColumnChange" ]
import java.util.List; import org.sagebionetworks.repo.model.table.ColumnChange;
import java.util.*; import org.sagebionetworks.repo.model.table.*;
[ "java.util", "org.sagebionetworks.repo" ]
java.util; org.sagebionetworks.repo;
836,668
public void addMark(final GPXWaypoint mark) { if (waypoints == null) { waypoints = createFolder(KMLConstants.VALUE_NAME_WAYPOINTS); root.appendChild(waypoints); } final Element placemark = doc.createElement(KMLConstants.NODE_PLACEMARK); waypoints.appendChild(placemark); if(mark.getName() != null) { final Element name = doc.createElement(KMLConstants.NODE_PLACEMARK_NAME); name.appendChild(doc.createTextNode(mark.getName())); placemark.appendChild(name); } final Element styleUrl = doc.createElement(KMLConstants.NODE_PLACEMARK_STYLEURL); styleUrl.appendChild(doc.createTextNode("#" + MarkerManager.getInstance().getMarkerForWaypoint(mark).getMarkerName())); placemark.appendChild(styleUrl); final Element desc = doc.createElement(KMLConstants.NODE_PLACEMARK_DESCRIPTION); if (mark.getDate() != null) { desc.appendChild(doc.createTextNode(mark.getLatitude() + ", " + mark.getLongitude() + " " + KMLConstants.ALTITUDE_LABEL + mark.getElevation() + KMLConstants.ALTITUDE_UNIT + " " + KMLConstants.TIME_LABEL + KMLConstants.KML_DATEFORMAT.format(mark.getDate()))); } else { desc.appendChild(doc.createTextNode(mark.getLatitude() + ", " + mark.getLongitude() + " " + KMLConstants.ALTITUDE_LABEL + mark.getElevation() + KMLConstants.ALTITUDE_UNIT + " " + KMLConstants.TIME_LABEL + KMLConstants.VALUE_NO_VALUE)); } placemark.appendChild(desc); final Element point = doc.createElement(KMLConstants.NODE_PLACEMARK_POINT); placemark.appendChild(point); if(mark.getElevation() > 0) { final Element altitudeMode = doc.createElement(KMLConstants.NODE_LINESTRING_ALTITUDEMODE); altitudeMode.appendChild(doc.createTextNode("clampToGround")); point.appendChild(altitudeMode); } final Element coords = doc.createElement(KMLConstants.NODE_LINESTRING_COORDINATES); coords.appendChild(doc.createTextNode(mark.getLongitude() + ", " + mark.getLatitude() + ", " + mark.getElevation())); point.appendChild(coords); // TFE, 20200909: add only used icons - but all of them iconList.add(MarkerManager.getInstance().getMarkerForWaypoint(mark).getMarkerName()); }
void function(final GPXWaypoint mark) { if (waypoints == null) { waypoints = createFolder(KMLConstants.VALUE_NAME_WAYPOINTS); root.appendChild(waypoints); } final Element placemark = doc.createElement(KMLConstants.NODE_PLACEMARK); waypoints.appendChild(placemark); if(mark.getName() != null) { final Element name = doc.createElement(KMLConstants.NODE_PLACEMARK_NAME); name.appendChild(doc.createTextNode(mark.getName())); placemark.appendChild(name); } final Element styleUrl = doc.createElement(KMLConstants.NODE_PLACEMARK_STYLEURL); styleUrl.appendChild(doc.createTextNode("#" + MarkerManager.getInstance().getMarkerForWaypoint(mark).getMarkerName())); placemark.appendChild(styleUrl); final Element desc = doc.createElement(KMLConstants.NODE_PLACEMARK_DESCRIPTION); if (mark.getDate() != null) { desc.appendChild(doc.createTextNode(mark.getLatitude() + STR + mark.getLongitude() + " " + KMLConstants.ALTITUDE_LABEL + mark.getElevation() + KMLConstants.ALTITUDE_UNIT + " " + KMLConstants.TIME_LABEL + KMLConstants.KML_DATEFORMAT.format(mark.getDate()))); } else { desc.appendChild(doc.createTextNode(mark.getLatitude() + STR + mark.getLongitude() + " " + KMLConstants.ALTITUDE_LABEL + mark.getElevation() + KMLConstants.ALTITUDE_UNIT + " " + KMLConstants.TIME_LABEL + KMLConstants.VALUE_NO_VALUE)); } placemark.appendChild(desc); final Element point = doc.createElement(KMLConstants.NODE_PLACEMARK_POINT); placemark.appendChild(point); if(mark.getElevation() > 0) { final Element altitudeMode = doc.createElement(KMLConstants.NODE_LINESTRING_ALTITUDEMODE); altitudeMode.appendChild(doc.createTextNode(STR)); point.appendChild(altitudeMode); } final Element coords = doc.createElement(KMLConstants.NODE_LINESTRING_COORDINATES); coords.appendChild(doc.createTextNode(mark.getLongitude() + STR + mark.getLatitude() + STR + mark.getElevation())); point.appendChild(coords); iconList.add(MarkerManager.getInstance().getMarkerForWaypoint(mark).getMarkerName()); }
/** * Add a placemark to this KML object. * @param mark */
Add a placemark to this KML object
addMark
{ "repo_name": "ThomasDaheim/GPXEditor", "path": "src/main/java/tf/gpx/edit/parser/KMLWriter.java", "license": "bsd-3-clause", "size": 23540 }
[ "org.w3c.dom.Element", "tf.gpx.edit.items.GPXWaypoint", "tf.gpx.edit.viewer.MarkerManager" ]
import org.w3c.dom.Element; import tf.gpx.edit.items.GPXWaypoint; import tf.gpx.edit.viewer.MarkerManager;
import org.w3c.dom.*; import tf.gpx.edit.items.*; import tf.gpx.edit.viewer.*;
[ "org.w3c.dom", "tf.gpx.edit" ]
org.w3c.dom; tf.gpx.edit;
33,990
BasicFormTag formTag = (BasicFormTag) findAncestorWithClass(this, BasicFormTag.class); if (formTag == null) { throw new JspTagException("the <ur:button> tag must" + " be nested within a <ur:form> tag"); } PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); try { out.print("\n<input "); out.print(getAttributes()); out.print("/>"); } catch (Exception e) { throw new JspException(e); } }
BasicFormTag formTag = (BasicFormTag) findAncestorWithClass(this, BasicFormTag.class); if (formTag == null) { throw new JspTagException(STR + STR); } PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); try { out.print(STR); out.print(getAttributes()); out.print("/>"); } catch (Exception e) { throw new JspException(e); } }
/** * Create the checkbox tag. * * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag() */
Create the checkbox tag
doTag
{ "repo_name": "nate-rcl/irplus", "path": "ur_tags/src/edu/ur/tag/BasicButtonInputTag.java", "license": "apache-2.0", "size": 2362 }
[ "javax.servlet.jsp.JspException", "javax.servlet.jsp.JspTagException", "javax.servlet.jsp.JspWriter", "javax.servlet.jsp.PageContext" ]
import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.*;
[ "javax.servlet" ]
javax.servlet;
606,599
public ColorRGBA getSpecular() { return specular; }
ColorRGBA function() { return specular; }
/** * <code>getSpecular</code> returns the specular color value for this * light. * @return the specular color value of the light. */
<code>getSpecular</code> returns the specular color value for this light
getSpecular
{ "repo_name": "accelazh/ThreeBodyProblem", "path": "lib/jME2_0_1-Stable/src/com/jme/light/Light.java", "license": "mit", "size": 11345 }
[ "com.jme.renderer.ColorRGBA" ]
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.*;
[ "com.jme.renderer" ]
com.jme.renderer;
684,487
private static RgbaColor getDefaultColor() { return null; // new RgbaColor(255,255,255); } // ---------------------------------------------------------------------- // Platform-specific utility methods used for parsing // private static final Pattern rgb = Pattern.compile("^rgb\\s*\\(\\s*([0-9]+),\\s*([0-9]+),\\s*([0-9]+)\\)$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); private static final Pattern rgba = Pattern.compile("^rgba\\s*\\(\\s*([0-9]+),\\s*([0-9]+),\\s*([0-9]+),\\s*([0-9]*\\.?[0-9]+)\\)$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); private static final Pattern hsl = Pattern.compile("^hsl\\s*\\(\\s*([0-9]+),\\s*([0-9]+)%?,\\s*([0-9]+)%?\\)$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); private static final Pattern hsla = Pattern.compile("^hsla\\s*\\(\\s*([0-9]+),\\s*([0-9]+)%?,\\s*([0-9]+)%?,\\s*([0-9]*\\.?[0-9]+)\\)$", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
static RgbaColor function() { return null; } private static final Pattern rgb = Pattern.compile(STR, Pattern.CASE_INSENSITIVE Pattern.DOTALL); private static final Pattern rgba = Pattern.compile(STR, Pattern.CASE_INSENSITIVE Pattern.DOTALL); private static final Pattern hsl = Pattern.compile(STR, Pattern.CASE_INSENSITIVE Pattern.DOTALL); private static final Pattern hsla = Pattern.compile(STR, Pattern.CASE_INSENSITIVE Pattern.DOTALL);
/** * The GWT version of this class provides a default, but we want * to know about parsing failures so we default to null. * * @return null */
The GWT version of this class provides a default, but we want to know about parsing failures so we default to null
getDefaultColor
{ "repo_name": "tractionsoftware/gwt-traction", "path": "src/main/java/com/tractionsoftware/gwt/user/server/util/RgbaColor.java", "license": "apache-2.0", "size": 25980 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,901,227
private void loadTableStates() throws IOException { tableStates = MetaTableAccessor.getTableStates(connection); // Add hbase:meta so this tool keeps working. In hbase2, meta is always enabled though it // has no entry in the table states. HBCK doesn't work right w/ hbase2 but just do this in // meantime. this.tableStates.put(TableName.META_TABLE_NAME, new TableState(TableName.META_TABLE_NAME, TableState.State.ENABLED)); }
void function() throws IOException { tableStates = MetaTableAccessor.getTableStates(connection); this.tableStates.put(TableName.META_TABLE_NAME, new TableState(TableName.META_TABLE_NAME, TableState.State.ENABLED)); }
/** * Load the list of disabled tables in ZK into local set. * @throws ZooKeeperConnectionException * @throws IOException */
Load the list of disabled tables in ZK into local set
loadTableStates
{ "repo_name": "francisliu/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java", "license": "apache-2.0", "size": 155729 }
[ "java.io.IOException", "org.apache.hadoop.hbase.MetaTableAccessor", "org.apache.hadoop.hbase.TableName", "org.apache.hadoop.hbase.client.TableState" ]
import java.io.IOException; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.TableState;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,668,624
public static void zipFile(final File file, final ZipOutputStream out) throws IOException { if (file != null && out != null) { // /////////////////////////////////////////// // Create a buffer for reading the files // /////////////////////////////////////////// byte[] buf = new byte[4096]; FileInputStream in = null; try { in = new FileInputStream(file); // ////////////////////////////////// // Add ZIP entry to output stream. // ////////////////////////////////// out.putNextEntry(new ZipEntry(FilenameUtils.getName(file .getAbsolutePath()))); // ////////////////////////////////////////////// // Transfer bytes from the file to the ZIP file // ////////////////////////////////////////////// int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } // ////////////////////// // Complete the entry // ////////////////////// out.closeEntry(); } catch (IOException e) { if (LOGGER.isErrorEnabled()) LOGGER.error(e.getLocalizedMessage(), e); if (out != null) out.close(); } finally { if (in != null) in.close(); } } else throw new IOException("One or more input parameters are null!"); }
static void function(final File file, final ZipOutputStream out) throws IOException { if (file != null && out != null) { byte[] buf = new byte[4096]; FileInputStream in = null; try { in = new FileInputStream(file); out.putNextEntry(new ZipEntry(FilenameUtils.getName(file .getAbsolutePath()))); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); } catch (IOException e) { if (LOGGER.isErrorEnabled()) LOGGER.error(e.getLocalizedMessage(), e); if (out != null) out.close(); } finally { if (in != null) in.close(); } } else throw new IOException(STR); }
/** * This function zip the input file. * * @param file * The input file to be zipped. * @param out * The zip output stream. * @throws IOException */
This function zip the input file
zipFile
{ "repo_name": "mariolfigueiredo/Local", "path": "src/tools/compress/src/main/java/it/geosolutions/tools/compress/file/Compressor.java", "license": "gpl-3.0", "size": 11066 }
[ "java.io.File", "java.io.FileInputStream", "java.io.IOException", "java.util.zip.ZipEntry", "java.util.zip.ZipOutputStream", "org.apache.commons.io.FilenameUtils" ]
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.io.FilenameUtils;
import java.io.*; import java.util.zip.*; import org.apache.commons.io.*;
[ "java.io", "java.util", "org.apache.commons" ]
java.io; java.util; org.apache.commons;
354,503
public void updateEffectsProbability(AgentModel am) { Effect e; ListIterator<Effect> li = _effects.listIterator(); while(li.hasNext()) { e = (Effect) li.next(); //we only update the probability if the condition is grounded if(e.GetEffect().isGrounded()) { if (e.GetEffect().CheckCondition(am)==1) { e.IncreaseProbability(am); } else { //System.out.println("In updateEffectsProbability" + e.toString()); //MotivationalState.GetInstance().UpdateCertainty((-e.GetProbability())*0.2f); e.DecreaseProbability(am); } } } }
void function(AgentModel am) { Effect e; ListIterator<Effect> li = _effects.listIterator(); while(li.hasNext()) { e = (Effect) li.next(); if(e.GetEffect().isGrounded()) { if (e.GetEffect().CheckCondition(am)==1) { e.IncreaseProbability(am); } else { e.DecreaseProbability(am); } } } }
/** * Updates the probabilities of the step's effects by checking * if the effects did happen or not after the execution of the step */
Updates the probabilities of the step's effects by checking if the effects did happen or not after the execution of the step
updateEffectsProbability
{ "repo_name": "nurv/lirec", "path": "AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/plans/Step.java", "license": "gpl-3.0", "size": 18999 }
[ "java.util.ListIterator" ]
import java.util.ListIterator;
import java.util.*;
[ "java.util" ]
java.util;
25,814
private void setArtifactRoots(PackageRoots packageRoots) { getArtifactFactory().setPackageRoots(packageRoots.getPackageRootLookup()); }
void function(PackageRoots packageRoots) { getArtifactFactory().setPackageRoots(packageRoots.getPackageRootLookup()); }
/** * Sets the possible artifact roots in the artifact factory. This allows the factory to resolve * paths with unknown roots to artifacts. */
Sets the possible artifact roots in the artifact factory. This allows the factory to resolve paths with unknown roots to artifacts
setArtifactRoots
{ "repo_name": "akira-baruah/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/BuildView.java", "license": "apache-2.0", "size": 34084 }
[ "com.google.devtools.build.lib.actions.PackageRoots" ]
import com.google.devtools.build.lib.actions.PackageRoots;
import com.google.devtools.build.lib.actions.*;
[ "com.google.devtools" ]
com.google.devtools;
1,783,337
HistoryEvent createTaskInstanceCreateEvt(DelegateTask task);
HistoryEvent createTaskInstanceCreateEvt(DelegateTask task);
/** * Creates the history event fired when a task instance is <strong>created</strong>. * * @param task the task * @return the history event */
Creates the history event fired when a task instance is created
createTaskInstanceCreateEvt
{ "repo_name": "camunda/camunda-bpm-platform", "path": "engine/src/main/java/org/camunda/bpm/engine/impl/history/producer/HistoryEventProducer.java", "license": "apache-2.0", "size": 10876 }
[ "org.camunda.bpm.engine.delegate.DelegateTask", "org.camunda.bpm.engine.impl.history.event.HistoryEvent" ]
import org.camunda.bpm.engine.delegate.DelegateTask; import org.camunda.bpm.engine.impl.history.event.HistoryEvent;
import org.camunda.bpm.engine.delegate.*; import org.camunda.bpm.engine.impl.history.event.*;
[ "org.camunda.bpm" ]
org.camunda.bpm;
1,232,148
@Path("/edit") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public ResponseStatus editCounter(final ParamsEditCounter params) throws SQLException { return Controller.DB.editCounter(params); }
@Path("/edit") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) ResponseStatus function(final ParamsEditCounter params) throws SQLException { return Controller.DB.editCounter(params); }
/** * Retrieves representation of an instance of main.CounterResource * @param params * @return an instance of java.lang.String * @throws java.sql.SQLException */
Retrieves representation of an instance of main.CounterResource
editCounter
{ "repo_name": "jericomanapsal/genericqueueingsystem", "path": "ws/src/java/main/CounterResource.java", "license": "mit", "size": 2986 }
[ "java.sql.SQLException", "javax.ws.rs.Consumes", "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType" ]
import java.sql.SQLException; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType;
import java.sql.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "java.sql", "javax.ws" ]
java.sql; javax.ws;
2,138,210
private Player foundNextPlayer (Player currentPlayer) throws RemoteException { int i=0; for (Player player : this.players) { i++; if (player.equalsPlayer(currentPlayer)) break; } if (i >= this.players.size()) i=0; return this.players.get(i); }
Player function (Player currentPlayer) throws RemoteException { int i=0; for (Player player : this.players) { i++; if (player.equalsPlayer(currentPlayer)) break; } if (i >= this.players.size()) i=0; return this.players.get(i); }
/** * Function which will found the player which should make the next turn * @param currentPlayer * @return * @throws RemoteException */
Function which will found the player which should make the next turn
foundNextPlayer
{ "repo_name": "TankCommander/JavaServer", "path": "src/gameManagement/MatchImpl.java", "license": "gpl-2.0", "size": 3856 }
[ "java.rmi.RemoteException" ]
import java.rmi.RemoteException;
import java.rmi.*;
[ "java.rmi" ]
java.rmi;
2,373,544
default T defaultInstance(UUID playerId) { return newInstance(playerId, LanatusAccount.INITIAL_MELONS_COUNT, LanatusAccount.DEFAULT_RANK); }
default T defaultInstance(UUID playerId) { return newInstance(playerId, LanatusAccount.INITIAL_MELONS_COUNT, LanatusAccount.DEFAULT_RANK); }
/** * Creates a new instance of an account with the default values provided in the {@link * LanatusAccount} interface. * * @param playerId the unique id of the player to instantiate a default account for * @return the created account object */
Creates a new instance of an account with the default values provided in the <code>LanatusAccount</code> interface
defaultInstance
{ "repo_name": "xxyy/xyc", "path": "lanatus/sql/src/main/java/li/l1t/lanatus/sql/account/LanatusAccountFactory.java", "license": "mit", "size": 2001 }
[ "li.l1t.lanatus.api.account.LanatusAccount" ]
import li.l1t.lanatus.api.account.LanatusAccount;
import li.l1t.lanatus.api.account.*;
[ "li.l1t.lanatus" ]
li.l1t.lanatus;
1,714,838
public SaaSposeResponse DeleteProjectTask (String name, Integer taskUid, String storage, String folder, String fileName) { Object postBody = null; // verify required params are set if(name == null || taskUid == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables String resourcePath = "/tasks/{name}/tasks/{taskUid}/?appSid={appSid}&amp;storage={storage}&amp;folder={folder}&amp;fileName={fileName}"; resourcePath = resourcePath.replaceAll("\\*", "").replace("&amp;", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); if(name!=null) resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name)); else resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", ""); if(taskUid!=null) resourcePath = resourcePath.replace("{" + "taskUid" + "}" , apiInvoker.toPathValue(taskUid)); else resourcePath = resourcePath.replaceAll("[&?]taskUid.*?(?=&|\\?|$)", ""); if(storage!=null) resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage)); else resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", ""); if(folder!=null) resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder)); else resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", ""); if(fileName!=null) resourcePath = resourcePath.replace("{" + "fileName" + "}" , apiInvoker.toPathValue(fileName)); else resourcePath = resourcePath.replaceAll("[&?]fileName.*?(?=&|\\?|$)", ""); String[] contentTypes = { "application/json"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; try { response = apiInvoker.invokeAPI(basePath, resourcePath, "DELETE", queryParams, postBody, headerParams, formParams, contentType); return (SaaSposeResponse) ApiInvoker.deserialize(response, "", SaaSposeResponse.class); } catch (ApiException ex) { if(ex.getCode() == 404) { throw new ApiException(404, ""); } else { throw ex; } } }
SaaSposeResponse function (String name, Integer taskUid, String storage, String folder, String fileName) { Object postBody = null; if(name == null taskUid == null ) { throw new ApiException(400, STR); } String resourcePath = STR; resourcePath = resourcePath.replaceAll("\\*", STR&amp;STR&STR/?STR?STRtoFormat={toFormat}STRformat={format}STR{STRnameSTR}STR[&?]name.*?(?=& \\? $)STRSTR{STRtaskUidSTR}STR[&?]taskUid.*?(?=& \\? $)STRSTR{STRstorageSTR}STR[&?]storage.*?(?=& \\? $)STRSTR{STRfolderSTR}STR[&?]folder.*?(?=& \\? $)STRSTR{STRfileNameSTR}STR[&?]fileName.*?(?=& \\? $)STRSTRapplication/jsonSTRapplication/jsonSTRDELETESTRSTR"); } else { throw ex; } } }
/** * DeleteProjectTask * Deletes a project task with all references to it and rebuilds tasks tree. * @param name String The name of the file. * @param taskUid Integer Task Uid * @param storage String The document storage. * @param folder String The document folder. * @param fileName String The name of the project document to save changes to. If this parameter is omitted then the changes will be saved to the source project document. * @return SaaSposeResponse */
DeleteProjectTask Deletes a project task with all references to it and rebuilds tasks tree
DeleteProjectTask
{ "repo_name": "asposetaskscloud/Aspose.Tasks_Cloud_SDK_For_Java", "path": "src/main/java/com/aspose/tasks/api/TasksApi.java", "license": "mit", "size": 107115 }
[ "com.aspose.tasks.client.ApiException", "com.aspose.tasks.model.SaaSposeResponse" ]
import com.aspose.tasks.client.ApiException; import com.aspose.tasks.model.SaaSposeResponse;
import com.aspose.tasks.client.*; import com.aspose.tasks.model.*;
[ "com.aspose.tasks" ]
com.aspose.tasks;
1,379,800
public static <T> T capture(final Capture<T> captured) { reportMatcher(new Captures<T>(captured)); return null; }
static <T> T function(final Capture<T> captured) { reportMatcher(new Captures<T>(captured)); return null; }
/** * Expect any object but captures it for later use. * * @param <T> * Type of the captured object * @param captured * Where the parameter is captured * @return <code>null</code> */
Expect any object but captures it for later use
capture
{ "repo_name": "devacfr/capsicum", "path": "capsicum-testing/src/main/java/org/cfr/capsicum/test/EasyMockTestCase.java", "license": "apache-2.0", "size": 8261 }
[ "org.easymock.Capture", "org.easymock.internal.matchers.Captures" ]
import org.easymock.Capture; import org.easymock.internal.matchers.Captures;
import org.easymock.*; import org.easymock.internal.matchers.*;
[ "org.easymock", "org.easymock.internal" ]
org.easymock; org.easymock.internal;
2,332,335
public void testMoveViaAppendAndDelete() throws Exception { AlfrescoImapUser poweredUser = new AlfrescoImapUser((USER_NAME + "@alfresco.com"), USER_NAME, USER_PASSWORD); String fileName = "testfile" + GUID.generate(); String destinationName = "testFolder" + GUID.generate(); String destinationPath = IMAP_ROOT + AlfrescoImapConst.HIERARCHY_DELIMITER + destinationName; String nodeContent = "test content"; NodeRef root = findCompanyHomeNodeRef(); AuthenticationUtil.setRunAsUserSystem(); // Create node and destination folder FileInfo origFile = fileFolderService.create(root, fileName, ContentModel.TYPE_CONTENT); ContentWriter contentWriter = contentService.getWriter(origFile.getNodeRef(), ContentModel.PROP_CONTENT, true); contentWriter.setMimetype("text/plain"); contentWriter.setEncoding("UTF-8"); contentWriter.putContent(nodeContent); FileInfo destinationNode = fileFolderService.create(root, destinationName, ContentModel.TYPE_FOLDER); nodeService.addAspect(origFile.getNodeRef(), ImapModel.ASPECT_IMAP_CONTENT, null); nodeService.addAspect(origFile.getNodeRef(), ContentModel.ASPECT_TAGGABLE, null); // Save the message and set X-Alfresco-NodeRef-ID header SimpleStoredMessage origMessage = imapService.getMessage(origFile); origMessage.getMimeMessage().addHeader(AlfrescoImapConst.X_ALF_NODEREF_ID, origFile.getNodeRef().getId()); origMessage.getMimeMessage().saveChanges(); // Append the message to destination AlfrescoImapFolder destinationMailbox = imapService.getOrCreateMailbox(poweredUser, destinationPath, true, false); long uuid = destinationMailbox.appendMessage(origMessage.getMimeMessage(), flags, null); // Delete the node imapService.setFlag(origFile, Flags.Flag.DELETED, true); imapService.expungeMessage(origFile); // Check the destination has copy of original file and only this file FileInfo copiedNode = fileFolderService.getFileInfo(nodeService.getNodeRef(uuid)); assertNotNull("The file should exist.", copiedNode); assertEquals("The file name should not change.", fileName, copiedNode.getName()); NodeRef copiedParentNodeRef = nodeService.getPrimaryParent(copiedNode.getNodeRef()).getParentRef(); assertEquals("The parent should change to destination.", destinationNode.getNodeRef(), copiedParentNodeRef); assertEquals("There should be only one node in the destination folder", 1, nodeService.getChildAssocs(destinationNode.getNodeRef()).size()); assertTrue("New node should have original node aspects", nodeService.hasAspect(copiedNode.getNodeRef(), ContentModel.ASPECT_TAGGABLE)); }
void function() throws Exception { AlfrescoImapUser poweredUser = new AlfrescoImapUser((USER_NAME + STR), USER_NAME, USER_PASSWORD); String fileName = STR + GUID.generate(); String destinationName = STR + GUID.generate(); String destinationPath = IMAP_ROOT + AlfrescoImapConst.HIERARCHY_DELIMITER + destinationName; String nodeContent = STR; NodeRef root = findCompanyHomeNodeRef(); AuthenticationUtil.setRunAsUserSystem(); FileInfo origFile = fileFolderService.create(root, fileName, ContentModel.TYPE_CONTENT); ContentWriter contentWriter = contentService.getWriter(origFile.getNodeRef(), ContentModel.PROP_CONTENT, true); contentWriter.setMimetype(STR); contentWriter.setEncoding("UTF-8"); contentWriter.putContent(nodeContent); FileInfo destinationNode = fileFolderService.create(root, destinationName, ContentModel.TYPE_FOLDER); nodeService.addAspect(origFile.getNodeRef(), ImapModel.ASPECT_IMAP_CONTENT, null); nodeService.addAspect(origFile.getNodeRef(), ContentModel.ASPECT_TAGGABLE, null); SimpleStoredMessage origMessage = imapService.getMessage(origFile); origMessage.getMimeMessage().addHeader(AlfrescoImapConst.X_ALF_NODEREF_ID, origFile.getNodeRef().getId()); origMessage.getMimeMessage().saveChanges(); AlfrescoImapFolder destinationMailbox = imapService.getOrCreateMailbox(poweredUser, destinationPath, true, false); long uuid = destinationMailbox.appendMessage(origMessage.getMimeMessage(), flags, null); imapService.setFlag(origFile, Flags.Flag.DELETED, true); imapService.expungeMessage(origFile); FileInfo copiedNode = fileFolderService.getFileInfo(nodeService.getNodeRef(uuid)); assertNotNull(STR, copiedNode); assertEquals(STR, fileName, copiedNode.getName()); NodeRef copiedParentNodeRef = nodeService.getPrimaryParent(copiedNode.getNodeRef()).getParentRef(); assertEquals(STR, destinationNode.getNodeRef(), copiedParentNodeRef); assertEquals(STR, 1, nodeService.getChildAssocs(destinationNode.getNodeRef()).size()); assertTrue(STR, nodeService.hasAspect(copiedNode.getNodeRef(), ContentModel.ASPECT_TAGGABLE)); }
/** * Test for MNT-12420 * * @throws Exception */
Test for MNT-12420
testMoveViaAppendAndDelete
{ "repo_name": "Alfresco/alfresco-repository", "path": "src/test/java/org/alfresco/repo/imap/ImapServiceImplTest.java", "license": "lgpl-3.0", "size": 52549 }
[ "com.icegreen.greenmail.store.SimpleStoredMessage", "javax.mail.Flags", "org.alfresco.model.ContentModel", "org.alfresco.model.ImapModel", "org.alfresco.repo.security.authentication.AuthenticationUtil", "org.alfresco.service.cmr.model.FileInfo", "org.alfresco.service.cmr.repository.ContentWriter", "org.alfresco.service.cmr.repository.NodeRef", "org.alfresco.util.GUID" ]
import com.icegreen.greenmail.store.SimpleStoredMessage; import javax.mail.Flags; import org.alfresco.model.ContentModel; import org.alfresco.model.ImapModel; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.util.GUID;
import com.icegreen.greenmail.store.*; import javax.mail.*; import org.alfresco.model.*; import org.alfresco.repo.security.authentication.*; import org.alfresco.service.cmr.model.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.util.*;
[ "com.icegreen.greenmail", "javax.mail", "org.alfresco.model", "org.alfresco.repo", "org.alfresco.service", "org.alfresco.util" ]
com.icegreen.greenmail; javax.mail; org.alfresco.model; org.alfresco.repo; org.alfresco.service; org.alfresco.util;
621,828
public static Path createBatchDir(Path root, String prefix) { String batchDirName = SharedUtil.legalizeName(prefix) + "_" + LocalDateTime.now().format(SharedConst.DT_FORMAT_SORTABLE); Path batchDir = root.resolve(batchDirName); Util.createDirectory(batchDir); return batchDir; }
static Path function(Path root, String prefix) { String batchDirName = SharedUtil.legalizeName(prefix) + "_" + LocalDateTime.now().format(SharedConst.DT_FORMAT_SORTABLE); Path batchDir = root.resolve(batchDirName); Util.createDirectory(batchDir); return batchDir; }
/** * Create a directory with a particular prefix within a root directory; * the directory will be suffixed with a date/time stamp. * * @param root Root directory in which batch directory will be created. * @param prefix Prefix for new batch directory * @return The path of the new directory that was created. */
Create a directory with a particular prefix within a root directory; the directory will be suffixed with a date/time stamp
createBatchDir
{ "repo_name": "gbtorrance/TestDataCreator", "path": "core/src/main/java/org/tdc/util/Util.java", "license": "mit", "size": 6668 }
[ "java.nio.file.Path", "java.time.LocalDateTime", "org.tdc.shared.util.SharedConst", "org.tdc.shared.util.SharedUtil" ]
import java.nio.file.Path; import java.time.LocalDateTime; import org.tdc.shared.util.SharedConst; import org.tdc.shared.util.SharedUtil;
import java.nio.file.*; import java.time.*; import org.tdc.shared.util.*;
[ "java.nio", "java.time", "org.tdc.shared" ]
java.nio; java.time; org.tdc.shared;
1,176,061
if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) { throw new IllegalArgumentException(); } }
if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) { throw new IllegalArgumentException(); } }
/** * Ensures the truth of an expression involving one or more arguments passed to the calling * method. * * @param expression A boolean expression. * @throws IllegalArgumentException If {@code expression} is false. */
Ensures the truth of an expression involving one or more arguments passed to the calling method
checkArgument
{ "repo_name": "Lee-Wills/-tv", "path": "mmd/library/src/main/java/com/google/android/exoplayer/util/Assertions.java", "license": "gpl-3.0", "size": 5608 }
[ "com.google.android.exoplayer.ExoPlayerLibraryInfo" ]
import com.google.android.exoplayer.ExoPlayerLibraryInfo;
import com.google.android.exoplayer.*;
[ "com.google.android" ]
com.google.android;
200,921
protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { if (actions != null) { IContributionItem[] items = manager.getItems(); for (int i = 0; i < items.length; i++) { // Look into SubContributionItems // IContributionItem contributionItem = items[i]; while (contributionItem instanceof SubContributionItem) { contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); } // Delete the ActionContributionItems with matching action. // if (contributionItem instanceof ActionContributionItem) { IAction action = ((ActionContributionItem)contributionItem).getAction(); if (actions.contains(action)) { manager.remove(contributionItem); } } } } }
void function(IContributionManager manager, Collection<? extends IAction> actions) { if (actions != null) { IContributionItem[] items = manager.getItems(); for (int i = 0; i < items.length; i++) { IContributionItem contributionItem = items[i]; while (contributionItem instanceof SubContributionItem) { contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); } if (contributionItem instanceof ActionContributionItem) { IAction action = ((ActionContributionItem)contributionItem).getAction(); if (actions.contains(action)) { manager.remove(contributionItem); } } } } }
/** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This removes from the specified <code>manager</code> all <code>org.eclipse.jface.action.ActionContributionItem</code>s based on the <code>org.eclipse.jface.action.IAction</code>s contained in the <code>actions</code> collection.
depopulateManager
{ "repo_name": "KAMP-Research/KAMP4APS", "path": "edu.kit.ipd.sdq.kamp4aps.aps.editor/src/edu/kit/ipd/sdq/kamp4aps/model/aPS/BusComponents/presentation/BusComponentsActionBarContributor.java", "license": "apache-2.0", "size": 14527 }
[ "java.util.Collection", "org.eclipse.jface.action.ActionContributionItem", "org.eclipse.jface.action.IAction", "org.eclipse.jface.action.IContributionItem", "org.eclipse.jface.action.IContributionManager", "org.eclipse.jface.action.SubContributionItem" ]
import java.util.Collection; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IContributionManager; import org.eclipse.jface.action.SubContributionItem;
import java.util.*; import org.eclipse.jface.action.*;
[ "java.util", "org.eclipse.jface" ]
java.util; org.eclipse.jface;
1,146,194
@NotNull @Contract(pure=true) public static <T> T[] append(@NotNull final T[] src, @Nullable final T element) { return append(src, element, (Class<T>)src.getClass().getComponentType()); }
@Contract(pure=true) static <T> T[] function(@NotNull final T[] src, @Nullable final T element) { return append(src, element, (Class<T>)src.getClass().getComponentType()); }
/** * Appends <code>element</code> to the <code>src</code> array. As you can * imagine the appended element will be the last one in the returned result. * * @param src array to which the <code>element</code> should be appended. * @param element object to be appended to the end of <code>src</code> array. * @return new array */
Appends <code>element</code> to the <code>src</code> array. As you can imagine the appended element will be the last one in the returned result
append
{ "repo_name": "blademainer/intellij-community", "path": "platform/util/src/com/intellij/util/ArrayUtil.java", "license": "apache-2.0", "size": 27545 }
[ "org.jetbrains.annotations.Contract", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable" ]
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
25,152
public final void setRadius(double radius) { // resets callback setRadius((RadiusCallback<AnnotationContext>) null); // stores value setValue(Property.RADIUS, Checker.positiveOrZero(radius)); }
final void function(double radius) { setRadius((RadiusCallback<AnnotationContext>) null); setValue(Property.RADIUS, Checker.positiveOrZero(radius)); }
/** * Sets the radius of the annotation shape.<br> * If set to 0, the annotation is not rendered. * * @param radius array of the radius of the point shape. */
Sets the radius of the annotation shape. If set to 0, the annotation is not rendered
setRadius
{ "repo_name": "pepstock-org/Charba", "path": "src/org/pepstock/charba/client/annotation/AbstractCircleBasedAnnotation.java", "license": "apache-2.0", "size": 9080 }
[ "org.pepstock.charba.client.callbacks.RadiusCallback", "org.pepstock.charba.client.commons.Checker" ]
import org.pepstock.charba.client.callbacks.RadiusCallback; import org.pepstock.charba.client.commons.Checker;
import org.pepstock.charba.client.callbacks.*; import org.pepstock.charba.client.commons.*;
[ "org.pepstock.charba" ]
org.pepstock.charba;
1,025,274
public FormValidation doCheckNodesPreferenceScale(@QueryParameter String value) { return ValidationUtil.doCheckInteger(value); }
FormValidation function(@QueryParameter String value) { return ValidationUtil.doCheckInteger(value); }
/** * Verify the input nodesPreferenceScale. * * @param value * @return */
Verify the input nodesPreferenceScale
doCheckNodesPreferenceScale
{ "repo_name": "kohsuke/scoring-load-balancer-plugin", "path": "src/main/java/jp/ikedam/jenkins/plugins/scoringloadbalancer/rules/NodePreferenceScoringRule.java", "license": "mit", "size": 7652 }
[ "hudson.util.FormValidation", "jp.ikedam.jenkins.plugins.scoringloadbalancer.util.ValidationUtil", "org.kohsuke.stapler.QueryParameter" ]
import hudson.util.FormValidation; import jp.ikedam.jenkins.plugins.scoringloadbalancer.util.ValidationUtil; import org.kohsuke.stapler.QueryParameter;
import hudson.util.*; import jp.ikedam.jenkins.plugins.scoringloadbalancer.util.*; import org.kohsuke.stapler.*;
[ "hudson.util", "jp.ikedam.jenkins", "org.kohsuke.stapler" ]
hudson.util; jp.ikedam.jenkins; org.kohsuke.stapler;
1,824,654
@Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConsumerInfo info = (ConsumerInfo) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); bs.readBoolean(); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); bs.readBoolean(); tightMarshalString2(info.getSelector(), dataOut, bs); tightMarshalString2(info.getSubscriptionName(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); dataOut.writeByte(info.getPriority()); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), dataOut, bs); }
void function(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConsumerInfo info = (ConsumerInfo) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); bs.readBoolean(); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); bs.readBoolean(); tightMarshalString2(info.getSelector(), dataOut, bs); tightMarshalString2(info.getSubscriptionName(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); dataOut.writeByte(info.getPriority()); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), dataOut, bs); }
/** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */
Write a object instance to data output stream
tightMarshal2
{ "repo_name": "tabish121/OpenWire", "path": "openwire-legacy/src/main/java/io/openwire/codec/v5/ConsumerInfoMarshaller.java", "license": "apache-2.0", "size": 10304 }
[ "io.openwire.codec.BooleanStream", "io.openwire.codec.OpenWireFormat", "io.openwire.commands.ConsumerInfo", "io.openwire.commands.DataStructure", "java.io.DataOutput", "java.io.IOException" ]
import io.openwire.codec.BooleanStream; import io.openwire.codec.OpenWireFormat; import io.openwire.commands.ConsumerInfo; import io.openwire.commands.DataStructure; import java.io.DataOutput; import java.io.IOException;
import io.openwire.codec.*; import io.openwire.commands.*; import java.io.*;
[ "io.openwire.codec", "io.openwire.commands", "java.io" ]
io.openwire.codec; io.openwire.commands; java.io;
1,583,311
public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String virtualHubName, String connectionName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualHubName, connectionName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String virtualHubName, String connectionName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualHubName, connectionName), serviceCallback); }
/** * Deletes a VirtualHubBgpConnection. * * @param resourceGroupName The resource group name of the VirtualHubBgpConnection. * @param virtualHubName The name of the VirtualHub. * @param connectionName The name of the connection. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Deletes a VirtualHubBgpConnection
beginDeleteAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/implementation/VirtualHubBgpConnectionsInner.java", "license": "mit", "size": 45399 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
646,635
List selectFiredTriggerRecords(Connection conn, String triggerName, String groupName) throws SQLException;
List selectFiredTriggerRecords(Connection conn, String triggerName, String groupName) throws SQLException;
/** * <p> * Select the states of all fired-trigger records for a given trigger, or * trigger group if trigger name is <code>null</code>. * </p> * * @return a List of FiredTriggerRecord objects. */
Select the states of all fired-trigger records for a given trigger, or trigger group if trigger name is <code>null</code>.
selectFiredTriggerRecords
{ "repo_name": "optivo-org/quartz-1.8.3-optivo", "path": "quartz/src/main/java/org/quartz/impl/jdbcjobstore/DriverDelegate.java", "license": "apache-2.0", "size": 41989 }
[ "java.sql.Connection", "java.sql.SQLException", "java.util.List" ]
import java.sql.Connection; import java.sql.SQLException; import java.util.List;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
2,855,072
EReference getTransformerWinding_RatioTapChanger();
EReference getTransformerWinding_RatioTapChanger();
/** * Returns the meta object for the reference '{@link gluemodel.CIM.IEC61970.Wires.TransformerWinding#getRatioTapChanger <em>Ratio Tap Changer</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference '<em>Ratio Tap Changer</em>'. * @see gluemodel.CIM.IEC61970.Wires.TransformerWinding#getRatioTapChanger() * @see #getTransformerWinding() * @generated */
Returns the meta object for the reference '<code>gluemodel.CIM.IEC61970.Wires.TransformerWinding#getRatioTapChanger Ratio Tap Changer</code>'.
getTransformerWinding_RatioTapChanger
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61970/Wires/WiresPackage.java", "license": "mit", "size": 669840 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
533,663
Map<String, String> getData();
Map<String, String> getData();
/** * Returns the work item data. * @return */
Returns the work item data
getData
{ "repo_name": "alexeev/jboss-fuse-mirror", "path": "fabric/fabric-partition/src/main/java/io/fabric8/partition/WorkItem.java", "license": "apache-2.0", "size": 1286 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
936,240
private double piHat2(int indices[], int v[], SemIm semIm) { SemGraph graph = semIm.getSemPm().getGraph(); graph.setShowErrorTerms(true); Node etaNode1 = graph.getNode("eta1"); double varEta1 = semIm.getParamValue(etaNode1, etaNode1); double stdEta1 = Math.sqrt(semIm.getParamValue(etaNode1, etaNode1)); Node etaNode2 = graph.getNode("eta2"); double coeffEta = semIm.getParamValue(etaNode1, etaNode2); Node errorEta2; if (graph.getParents(etaNode2).get(0) == etaNode1) { errorEta2 = graph.getParents(etaNode2) .get(1); } else { errorEta2 = graph.getParents(etaNode2) .get(0); } double varEta2 = coeffEta * coeffEta * varEta1 + semIm.getParamValue(errorEta2, errorEta2); double stdEtaError2 = Math.sqrt(semIm.getParamValue(errorEta2, errorEta2)); double stdE[] = new double[indices.length]; double varEta[] = new double[indices.length]; double stdU[] = new double[indices.length]; double coeff[] = new double[indices.length]; for (int i = 0; i < indices.length; i++) { Node uNode = graph.getNode("xi" + i); Node uParent = null, uError = null; for (Node node : graph.getParents(uNode)) { Node parent = node; if (parent.getNodeType() == NodeType.LATENT) { uParent = parent; } else { uError = parent; } } if (i == 0 || (i == 2 && indices.length == 4) || (i == 3 && indices.length > 4)) { coeff[i] = 1.; } else { coeff[i] = semIm.getParamValue(uParent, uNode); } if (uParent == etaNode1) { varEta[i] = varEta1; } else { varEta[i] = varEta2; } stdE[i] = Math.sqrt(semIm.getParamValue(uError, uError)); stdU[i] = Math.sqrt(coeff[i] * coeff[i] * varEta[i] + semIm.getParamValue(uError, uError)); } double l = 0.; for (int t1 = 0; t1 < GHY.length; t1++) { for (int t2 = 0; t2 < GHY.length; t2++) { double tValue = GHW[t1] * GHW[t2]; double eta1 = GHY[t1] * stdEta1; double eta2 = eta1 * coeffEta + GHY[t2] * stdEtaError2; for (int i = 0; i < indices.length; i++) { double eta; if (indices.length == 4) { if (i < 2) { eta = eta1; } else { eta = eta2; } } else { if (i < 3) { eta = eta1; } else { eta = eta2; } } int numValues = this.values[indices[i]].length; if (v[i] == 0) { tValue *= ProbUtils.normalCdf(( this.thresholds[indices[i]][0] * stdU[i] - coeff[i] * eta) / stdE[i]); } else if (v[i] == numValues - 1) { tValue *= (1. - ProbUtils.normalCdf(( this.thresholds[indices[i]][numValues - 2] * stdU[i] - coeff[i] * eta) / stdE[i])); } else { tValue *= ProbUtils.normalCdf(( this.thresholds[indices[i]][v[i]] * stdU[i] - coeff[i] * eta) / stdE[i]) - ProbUtils.normalCdf(( this.thresholds[indices[i]][v[i] - 1] * stdU[i] - coeff[i] * eta) / stdE[i]); } } l += tValue; } } return l; }
double function(int indices[], int v[], SemIm semIm) { SemGraph graph = semIm.getSemPm().getGraph(); graph.setShowErrorTerms(true); Node etaNode1 = graph.getNode("eta1"); double varEta1 = semIm.getParamValue(etaNode1, etaNode1); double stdEta1 = Math.sqrt(semIm.getParamValue(etaNode1, etaNode1)); Node etaNode2 = graph.getNode("eta2"); double coeffEta = semIm.getParamValue(etaNode1, etaNode2); Node errorEta2; if (graph.getParents(etaNode2).get(0) == etaNode1) { errorEta2 = graph.getParents(etaNode2) .get(1); } else { errorEta2 = graph.getParents(etaNode2) .get(0); } double varEta2 = coeffEta * coeffEta * varEta1 + semIm.getParamValue(errorEta2, errorEta2); double stdEtaError2 = Math.sqrt(semIm.getParamValue(errorEta2, errorEta2)); double stdE[] = new double[indices.length]; double varEta[] = new double[indices.length]; double stdU[] = new double[indices.length]; double coeff[] = new double[indices.length]; for (int i = 0; i < indices.length; i++) { Node uNode = graph.getNode("xi" + i); Node uParent = null, uError = null; for (Node node : graph.getParents(uNode)) { Node parent = node; if (parent.getNodeType() == NodeType.LATENT) { uParent = parent; } else { uError = parent; } } if (i == 0 (i == 2 && indices.length == 4) (i == 3 && indices.length > 4)) { coeff[i] = 1.; } else { coeff[i] = semIm.getParamValue(uParent, uNode); } if (uParent == etaNode1) { varEta[i] = varEta1; } else { varEta[i] = varEta2; } stdE[i] = Math.sqrt(semIm.getParamValue(uError, uError)); stdU[i] = Math.sqrt(coeff[i] * coeff[i] * varEta[i] + semIm.getParamValue(uError, uError)); } double l = 0.; for (int t1 = 0; t1 < GHY.length; t1++) { for (int t2 = 0; t2 < GHY.length; t2++) { double tValue = GHW[t1] * GHW[t2]; double eta1 = GHY[t1] * stdEta1; double eta2 = eta1 * coeffEta + GHY[t2] * stdEtaError2; for (int i = 0; i < indices.length; i++) { double eta; if (indices.length == 4) { if (i < 2) { eta = eta1; } else { eta = eta2; } } else { if (i < 3) { eta = eta1; } else { eta = eta2; } } int numValues = this.values[indices[i]].length; if (v[i] == 0) { tValue *= ProbUtils.normalCdf(( this.thresholds[indices[i]][0] * stdU[i] - coeff[i] * eta) / stdE[i]); } else if (v[i] == numValues - 1) { tValue *= (1. - ProbUtils.normalCdf(( this.thresholds[indices[i]][numValues - 2] * stdU[i] - coeff[i] * eta) / stdE[i])); } else { tValue *= ProbUtils.normalCdf(( this.thresholds[indices[i]][v[i]] * stdU[i] - coeff[i] * eta) / stdE[i]) - ProbUtils.normalCdf(( this.thresholds[indices[i]][v[i] - 1] * stdU[i] - coeff[i] * eta) / stdE[i]); } } l += tValue; } } return l; }
/** * For two factor models. */
For two factor models
piHat2
{ "repo_name": "jmogarrio/tetrad", "path": "tetrad-lib/src/main/java/edu/cmu/tetrad/search/DiscreteTetradTest.java", "license": "gpl-2.0", "size": 83144 }
[ "edu.cmu.tetrad.graph.Node", "edu.cmu.tetrad.graph.NodeType", "edu.cmu.tetrad.graph.SemGraph", "edu.cmu.tetrad.sem.SemIm", "edu.cmu.tetrad.util.ProbUtils" ]
import edu.cmu.tetrad.graph.Node; import edu.cmu.tetrad.graph.NodeType; import edu.cmu.tetrad.graph.SemGraph; import edu.cmu.tetrad.sem.SemIm; import edu.cmu.tetrad.util.ProbUtils;
import edu.cmu.tetrad.graph.*; import edu.cmu.tetrad.sem.*; import edu.cmu.tetrad.util.*;
[ "edu.cmu.tetrad" ]
edu.cmu.tetrad;
828,902
public void setLastAccessDate(Date _value) { if (_value == null) throw new IllegalArgumentException(ModelMessages.getString( ErrorMessages.ARGUMENT_NOT_NULL, "lastAccessDate")); lastAccessDate = _value; }
void function(Date _value) { if (_value == null) throw new IllegalArgumentException(ModelMessages.getString( ErrorMessages.ARGUMENT_NOT_NULL, STR)); lastAccessDate = _value; }
/** * Set value of property lastAccessDate * * @param _value - new field value */
Set value of property lastAccessDate
setLastAccessDate
{ "repo_name": "bdaum/zoraPD", "path": "com.bdaum.zoom.model/src/com/bdaum/zoom/cat/model/SlideShow_typeImpl.java", "license": "gpl-2.0", "size": 12574 }
[ "com.bdaum.aoModeling.runtime.ErrorMessages", "com.bdaum.aoModeling.runtime.ModelMessages", "java.util.Date" ]
import com.bdaum.aoModeling.runtime.ErrorMessages; import com.bdaum.aoModeling.runtime.ModelMessages; import java.util.Date;
import com.bdaum.*; import java.util.*;
[ "com.bdaum", "java.util" ]
com.bdaum; java.util;
475,692
@Test() public void testSingleListenerCertificate() throws Exception { try (InMemoryDirectoryServer ds = getDS(keyStoreFile)) { // Create a configuration file to use for the test. final File configFile = generateConfigFile(null, pemCertificateLines); // Create a trust manager and SSL util configuration. final TopologyRegistryTrustManager trustManager = new TopologyRegistryTrustManager(configFile, 300_000L); final SSLUtil sslUtil = new SSLUtil(null, trustManager); // Perform an initial test to ensure that the connection succeeds when // the configuration is not cached. try (LDAPConnection conn = new LDAPConnection( sslUtil.createSSLSocketFactory(), "localhost", ds.getListenPort())) { assertNotNull(conn.getRootDSE()); } // Perform another test to ensure that the connection succeeds when the // configuration is cached. try (LDAPConnection conn = new LDAPConnection( sslUtil.createSSLSocketFactory(), "localhost", ds.getListenPort())) { assertNotNull(conn.getRootDSE()); } } }
@Test() void function() throws Exception { try (InMemoryDirectoryServer ds = getDS(keyStoreFile)) { final File configFile = generateConfigFile(null, pemCertificateLines); final TopologyRegistryTrustManager trustManager = new TopologyRegistryTrustManager(configFile, 300_000L); final SSLUtil sslUtil = new SSLUtil(null, trustManager); try (LDAPConnection conn = new LDAPConnection( sslUtil.createSSLSocketFactory(), STR, ds.getListenPort())) { assertNotNull(conn.getRootDSE()); } try (LDAPConnection conn = new LDAPConnection( sslUtil.createSSLSocketFactory(), STR, ds.getListenPort())) { assertNotNull(conn.getRootDSE()); } } }
/** * Tests to ensure that the trust manager can trust a certificate if it is * found in a listener entry. * * @throws Exception If an unexpected problem occurs. */
Tests to ensure that the trust manager can trust a certificate if it is found in a listener entry
testSingleListenerCertificate
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/TopologyRegistryTrustManagerTestCase.java", "license": "gpl-2.0", "size": 45549 }
[ "com.unboundid.ldap.listener.InMemoryDirectoryServer", "com.unboundid.ldap.sdk.LDAPConnection", "com.unboundid.util.ssl.SSLUtil", "java.io.File", "org.testng.annotations.Test" ]
import com.unboundid.ldap.listener.InMemoryDirectoryServer; import com.unboundid.ldap.sdk.LDAPConnection; import com.unboundid.util.ssl.SSLUtil; import java.io.File; import org.testng.annotations.Test;
import com.unboundid.ldap.listener.*; import com.unboundid.ldap.sdk.*; import com.unboundid.util.ssl.*; import java.io.*; import org.testng.annotations.*;
[ "com.unboundid.ldap", "com.unboundid.util", "java.io", "org.testng.annotations" ]
com.unboundid.ldap; com.unboundid.util; java.io; org.testng.annotations;
1,169,573
public void checkOTUsAgainstSpeciesPattern(NexmlNEXML nexml, Pattern speciesPattern) { List<NexmlOtu> nexmlOtuList = nexml.getSingleOtusElement().getNexmlOtuList(); argProcessor.LOG.trace("sp pattern: ["+speciesPattern+"]"); for (NexmlOtu otu : nexmlOtuList) { String tipLabel = otu.getValue(); Matcher matcher = speciesPattern.matcher(tipLabel); if (matcher.matches()) { argProcessor.LOG.trace(">"+matcher); } else { argProcessor.LOG.trace("failed match: "+tipLabel); } } }
void function(NexmlNEXML nexml, Pattern speciesPattern) { List<NexmlOtu> nexmlOtuList = nexml.getSingleOtusElement().getNexmlOtuList(); argProcessor.LOG.trace(STR+speciesPattern+"]"); for (NexmlOtu otu : nexmlOtuList) { String tipLabel = otu.getValue(); Matcher matcher = speciesPattern.matcher(tipLabel); if (matcher.matches()) { argProcessor.LOG.trace(">"+matcher); } else { argProcessor.LOG.trace(STR+tipLabel); } } }
/** does this do anything? * * @param nexml * @param speciesPattern */
does this do anything
checkOTUsAgainstSpeciesPattern
{ "repo_name": "petermr/ami-plugin", "path": "src/main/java/org/xmlcml/ami2/plugins/phylotree/NexmlProcessor.java", "license": "apache-2.0", "size": 16578 }
[ "java.util.List", "java.util.regex.Matcher", "java.util.regex.Pattern", "org.xmlcml.ami2.plugins.phylotree.nexml.NexmlNEXML", "org.xmlcml.ami2.plugins.phylotree.nexml.NexmlOtu" ]
import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.xmlcml.ami2.plugins.phylotree.nexml.NexmlNEXML; import org.xmlcml.ami2.plugins.phylotree.nexml.NexmlOtu;
import java.util.*; import java.util.regex.*; import org.xmlcml.ami2.plugins.phylotree.nexml.*;
[ "java.util", "org.xmlcml.ami2" ]
java.util; org.xmlcml.ami2;
1,151,263
protected Path writeThenReadFile(String name, int len) throws IOException { Path path = path(name); writeThenReadFile(path, len); return path; }
Path function(String name, int len) throws IOException { Path path = path(name); writeThenReadFile(path, len); return path; }
/** * Write a file, read it back, validate the dataset. Overwrites the file * if it is present * @param name filename (will have the test path prepended to it) * @param len length of file * @return the full path to the file * @throws IOException any IO problem */
Write a file, read it back, validate the dataset. Overwrites the file if it is present
writeThenReadFile
{ "repo_name": "plusplusjiajia/hadoop", "path": "hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/AbstractS3ATestBase.java", "license": "apache-2.0", "size": 4754 }
[ "java.io.IOException", "org.apache.hadoop.fs.Path" ]
import java.io.IOException; import org.apache.hadoop.fs.Path;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,669,209
EReference getPretendExpression_RightType();
EReference getPretendExpression_RightType();
/** * Returns the meta object for the containment reference '{@link com.euclideanspace.spad.editor.PretendExpression#getRightType <em>Right Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Right Type</em>'. * @see com.euclideanspace.spad.editor.PretendExpression#getRightType() * @see #getPretendExpression() * @generated */
Returns the meta object for the containment reference '<code>com.euclideanspace.spad.editor.PretendExpression#getRightType Right Type</code>'.
getPretendExpression_RightType
{ "repo_name": "martinbaker/euclideanspace", "path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java", "license": "agpl-3.0", "size": 593321 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,228,905
public File getXlf() { if (xlf == null) throw new IllegalStateException("The pack has been deleted"); return xlf; }
File function() { if (xlf == null) throw new IllegalStateException(STR); return xlf; }
/** * Get Xlf * @return Get the xliff file contained inside the pack */
Get Xlf
getXlf
{ "repo_name": "matecat/MateCat-Filters", "path": "filters/src/main/java/com/matecat/converter/core/okapiclient/OkapiPack.java", "license": "lgpl-3.0", "size": 4975 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
845,451
@Override public boolean equals(Object obj) { if (this.getClass().isInstance(obj)) { GeometryFilterImpl geomFilter = (GeometryFilterImpl) obj; return Objects.equals(geomFilter.expression1, expression1) && Objects.equals(geomFilter.expression2, expression2); } else { return false; } }
boolean function(Object obj) { if (this.getClass().isInstance(obj)) { GeometryFilterImpl geomFilter = (GeometryFilterImpl) obj; return Objects.equals(geomFilter.expression1, expression1) && Objects.equals(geomFilter.expression2, expression2); } else { return false; } }
/** * Compares this filter to the specified object. Returns true if the passed in object is the * same as this filter. Checks to make sure the filter types are the same as well as the left * and right geometries. * * @param obj - the object to compare this GeometryFilter against. * @return true if specified object is equal to this filter; else false */
Compares this filter to the specified object. Returns true if the passed in object is the same as this filter. Checks to make sure the filter types are the same as well as the left and right geometries
equals
{ "repo_name": "geotools/geotools", "path": "modules/library/main/src/main/java/org/geotools/filter/GeometryFilterImpl.java", "license": "lgpl-2.1", "size": 10563 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
2,221,339
protected ResultCandidate calculateSimilarity( org.apache.lucene.document.Document document , Map < Integer, Integer > normalizedQuery, float score){ String docName = document.getField( FieldName.DOC_NAME.toString()).stringValue(); TupleInput in = new TupleInput(document.getField( FieldName.MULTI_SET_SIZE.toString()).binaryValue()); // size of the doc in the DB. int docSizeMSet = in.readInt(); int docSizeSet = new TupleInput(document.getField( FieldName.SET_SIZE.toString()).binaryValue()) .readInt(); int cx = 0; int intersectionQueryMSet = 0; int intersectionQuerySet = 0; TupleInput freqs = new TupleInput(document.getField( FieldName.DOC_DETAILS.toString()).binaryValue()); while (cx < docSizeSet) { int wordId = freqs.readInt(); int frecuency = freqs.readInt(); Integer frequencyQuery = normalizedQuery.get(wordId); if (frequencyQuery != null) { intersectionQuerySet++; intersectionQueryMSet += Math.min(frecuency, frequencyQuery); } cx++; } ResultCandidate can = new ResultCandidate(docName, score, intersectionQueryMSet, docSizeMSet, intersectionQuerySet, docSizeSet); return can; } private class FHitCollector extends HitCollector{ PriorityQueue < ResultCandidate > candidates; Map < Integer, Integer > normalizedQuery; private boolean found = false; private String queryName; private ResultCandidate match; public FHitCollector(Map < Integer, Integer > normalizedQuery, String queryName){ this.candidates = new PriorityQueue < ResultCandidate >(); this.normalizedQuery = normalizedQuery; this.queryName = queryName; }
ResultCandidate function( org.apache.lucene.document.Document document , Map < Integer, Integer > normalizedQuery, float score){ String docName = document.getField( FieldName.DOC_NAME.toString()).stringValue(); TupleInput in = new TupleInput(document.getField( FieldName.MULTI_SET_SIZE.toString()).binaryValue()); int docSizeMSet = in.readInt(); int docSizeSet = new TupleInput(document.getField( FieldName.SET_SIZE.toString()).binaryValue()) .readInt(); int cx = 0; int intersectionQueryMSet = 0; int intersectionQuerySet = 0; TupleInput freqs = new TupleInput(document.getField( FieldName.DOC_DETAILS.toString()).binaryValue()); while (cx < docSizeSet) { int wordId = freqs.readInt(); int frecuency = freqs.readInt(); Integer frequencyQuery = normalizedQuery.get(wordId); if (frequencyQuery != null) { intersectionQuerySet++; intersectionQueryMSet += Math.min(frecuency, frequencyQuery); } cx++; } ResultCandidate can = new ResultCandidate(docName, score, intersectionQueryMSet, docSizeMSet, intersectionQuerySet, docSizeSet); return can; } private class FHitCollector extends HitCollector{ PriorityQueue < ResultCandidate > candidates; Map < Integer, Integer > normalizedQuery; private boolean found = false; private String queryName; private ResultCandidate match; public FHitCollector(Map < Integer, Integer > normalizedQuery, String queryName){ this.candidates = new PriorityQueue < ResultCandidate >(); this.normalizedQuery = normalizedQuery; this.queryName = queryName; }
/** * Calculates the ResultCandidate between a normalized query and a Lucene document. * @return A result candidate for the given document and normalized query. */
Calculates the ResultCandidate between a normalized query and a Lucene document
calculateSimilarity
{ "repo_name": "amuller/furia-chan", "path": "src/main/java/org/kit/furia/index/AbstractIRIndex.java", "license": "gpl-3.0", "size": 26598 }
[ "com.sleepycat.bind.tuple.TupleInput", "java.util.Map", "java.util.PriorityQueue", "org.apache.lucene.search.HitCollector", "org.kit.furia.Document", "org.kit.furia.ResultCandidate" ]
import com.sleepycat.bind.tuple.TupleInput; import java.util.Map; import java.util.PriorityQueue; import org.apache.lucene.search.HitCollector; import org.kit.furia.Document; import org.kit.furia.ResultCandidate;
import com.sleepycat.bind.tuple.*; import java.util.*; import org.apache.lucene.search.*; import org.kit.furia.*;
[ "com.sleepycat.bind", "java.util", "org.apache.lucene", "org.kit.furia" ]
com.sleepycat.bind; java.util; org.apache.lucene; org.kit.furia;
1,243,874
private ClusterState.Builder randomBlocks(ClusterState clusterState) { ClusterBlocks.Builder builder = ClusterBlocks.builder().blocks(clusterState.blocks()); int globalBlocksCount = clusterState.blocks().global().size(); if (globalBlocksCount > 0) { List<ClusterBlock> blocks = randomSubsetOf(randomInt(globalBlocksCount - 1), clusterState.blocks().global().toArray(new ClusterBlock[globalBlocksCount])); for (ClusterBlock block : blocks) { builder.removeGlobalBlock(block); } } int additionalGlobalBlocksCount = randomIntBetween(1, 3); for (int i = 0; i < additionalGlobalBlocksCount; i++) { builder.addGlobalBlock(randomGlobalBlock()); } return ClusterState.builder(clusterState).blocks(builder); }
ClusterState.Builder function(ClusterState clusterState) { ClusterBlocks.Builder builder = ClusterBlocks.builder().blocks(clusterState.blocks()); int globalBlocksCount = clusterState.blocks().global().size(); if (globalBlocksCount > 0) { List<ClusterBlock> blocks = randomSubsetOf(randomInt(globalBlocksCount - 1), clusterState.blocks().global().toArray(new ClusterBlock[globalBlocksCount])); for (ClusterBlock block : blocks) { builder.removeGlobalBlock(block); } } int additionalGlobalBlocksCount = randomIntBetween(1, 3); for (int i = 0; i < additionalGlobalBlocksCount; i++) { builder.addGlobalBlock(randomGlobalBlock()); } return ClusterState.builder(clusterState).blocks(builder); }
/** * Randomly creates or removes cluster blocks */
Randomly creates or removes cluster blocks
randomBlocks
{ "repo_name": "gmarz/elasticsearch", "path": "core/src/test/java/org/elasticsearch/cluster/ClusterStateDiffIT.java", "license": "apache-2.0", "size": 31251 }
[ "java.util.List", "org.elasticsearch.cluster.block.ClusterBlock", "org.elasticsearch.cluster.block.ClusterBlocks" ]
import java.util.List; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlocks;
import java.util.*; import org.elasticsearch.cluster.block.*;
[ "java.util", "org.elasticsearch.cluster" ]
java.util; org.elasticsearch.cluster;
2,181,650
public static void initialize() { OpenCms.getExecutor().scheduleWithFixedDelay(() -> { try { String report = get().getReport(5000); if (report.length() > 0) { TASKWATCHER.error("Report:\n"); TASKWATCHER.error(report); } } catch (Exception e) { // ignore } }, 5000, 5000, TimeUnit.MILLISECONDS); }
static void function() { OpenCms.getExecutor().scheduleWithFixedDelay(() -> { try { String report = get().getReport(5000); if (report.length() > 0) { TASKWATCHER.error(STR); TASKWATCHER.error(report); } } catch (Exception e) { } }, 5000, 5000, TimeUnit.MILLISECONDS); }
/** * Initializes the logging job. */
Initializes the logging job
initialize
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/util/CmsTaskWatcher.java", "license": "lgpl-2.1", "size": 6334 }
[ "java.util.concurrent.TimeUnit", "org.opencms.main.OpenCms" ]
import java.util.concurrent.TimeUnit; import org.opencms.main.OpenCms;
import java.util.concurrent.*; import org.opencms.main.*;
[ "java.util", "org.opencms.main" ]
java.util; org.opencms.main;
2,037,858
public void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId) { // checkMain() is called from cancelExistingRequest() if (remoteViews == null) { throw new IllegalArgumentException("remoteViews cannot be null."); } cancelExistingRequest(new RemoteViewsAction.RemoteViewsTarget(remoteViews, viewId)); }
void function(@NonNull RemoteViews remoteViews, @IdRes int viewId) { if (remoteViews == null) { throw new IllegalArgumentException(STR); } cancelExistingRequest(new RemoteViewsAction.RemoteViewsTarget(remoteViews, viewId)); }
/** * Cancel any existing requests for the specified {@link RemoteViews} target with the given {@code * viewId}. */
Cancel any existing requests for the specified <code>RemoteViews</code> target with the given viewId
cancelRequest
{ "repo_name": "perrystreetsoftware/picasso", "path": "picasso/src/main/java/com/squareup/picasso/Picasso.java", "license": "apache-2.0", "size": 30540 }
[ "android.support.annotation.IdRes", "android.support.annotation.NonNull", "android.widget.RemoteViews" ]
import android.support.annotation.IdRes; import android.support.annotation.NonNull; import android.widget.RemoteViews;
import android.support.annotation.*; import android.widget.*;
[ "android.support", "android.widget" ]
android.support; android.widget;
1,678,617
private void executeCommandsNowThatDepsAreBuilt( BuildRule rule, BuildContext context, OnDiskBuildInfo onDiskBuildInfo, BuildInfoRecorder buildInfoRecorder) throws Exception { LOG.debug("Building locally: %s", rule); // Get and run all of the commands. BuildableContext buildableContext = new DefaultBuildableContext(onDiskBuildInfo, buildInfoRecorder); List<Step> steps = rule.getBuildSteps(context, buildableContext); AbiRule abiRule = checkIfRuleOrBuildableIsAbiRule(rule); if (abiRule != null) { buildableContext.addMetadata( ABI_KEY_FOR_DEPS_ON_DISK_METADATA, abiRule.getAbiKeyForDeps().getHash()); } StepRunner stepRunner = context.getStepRunner(); for (Step step : steps) { stepRunner.runStepForBuildTarget(step, rule.getBuildTarget()); // Check for interruptions that may have been ignored by step. if (Thread.interrupted()) { Thread.currentThread().interrupt(); throw new InterruptedException(); } } LOG.debug("Build completed: %s", rule); }
void function( BuildRule rule, BuildContext context, OnDiskBuildInfo onDiskBuildInfo, BuildInfoRecorder buildInfoRecorder) throws Exception { LOG.debug(STR, rule); BuildableContext buildableContext = new DefaultBuildableContext(onDiskBuildInfo, buildInfoRecorder); List<Step> steps = rule.getBuildSteps(context, buildableContext); AbiRule abiRule = checkIfRuleOrBuildableIsAbiRule(rule); if (abiRule != null) { buildableContext.addMetadata( ABI_KEY_FOR_DEPS_ON_DISK_METADATA, abiRule.getAbiKeyForDeps().getHash()); } StepRunner stepRunner = context.getStepRunner(); for (Step step : steps) { stepRunner.runStepForBuildTarget(step, rule.getBuildTarget()); if (Thread.interrupted()) { Thread.currentThread().interrupt(); throw new InterruptedException(); } } LOG.debug(STR, rule); }
/** * Execute the commands for this build rule. Requires all dependent rules are already built * successfully. */
Execute the commands for this build rule. Requires all dependent rules are already built successfully
executeCommandsNowThatDepsAreBuilt
{ "repo_name": "mread/buck", "path": "src/com/facebook/buck/rules/CachingBuildEngine.java", "license": "apache-2.0", "size": 23331 }
[ "com.facebook.buck.step.Step", "com.facebook.buck.step.StepRunner", "java.util.List" ]
import com.facebook.buck.step.Step; import com.facebook.buck.step.StepRunner; import java.util.List;
import com.facebook.buck.step.*; import java.util.*;
[ "com.facebook.buck", "java.util" ]
com.facebook.buck; java.util;
2,294,699
@Override public void enterTypeSwitchCase(@NotNull GolangParser.TypeSwitchCaseContext ctx) { }
@Override public void enterTypeSwitchCase(@NotNull GolangParser.TypeSwitchCaseContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitReceiver
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/GolangBaseListener.java", "license": "gpl-3.0", "size": 35571 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
726,709