method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void setTileSource(final ITileSource pTileSource) { mTileSource = pTileSource; clearTileCache(); }
void function(final ITileSource pTileSource) { mTileSource = pTileSource; clearTileCache(); }
/** * Sets the tile source for this tile provider. * * @param pTileSource * the tile source */
Sets the tile source for this tile provider
setTileSource
{ "repo_name": "dimy93/sports-cubed-android", "path": "osmdroid-android/src/main/java/org/osmdroid/tileprovider/MapTileProviderBase.java", "license": "mpl-2.0", "size": 14281 }
[ "org.osmdroid.tileprovider.tilesource.ITileSource" ]
import org.osmdroid.tileprovider.tilesource.ITileSource;
import org.osmdroid.tileprovider.tilesource.*;
[ "org.osmdroid.tileprovider" ]
org.osmdroid.tileprovider;
2,836,280
public ServiceFuture<VirtualMachineAssessPatchesResultInner> assessPatchesAsync(String resourceGroupName, String vmName, final ServiceCallback<VirtualMachineAssessPatchesResultInner> serviceCallback) { return ServiceFuture.fromResponse(assessPatchesWithServiceResponseAsync(resourceGroupName, vmName), serviceCallback); }
ServiceFuture<VirtualMachineAssessPatchesResultInner> function(String resourceGroupName, String vmName, final ServiceCallback<VirtualMachineAssessPatchesResultInner> serviceCallback) { return ServiceFuture.fromResponse(assessPatchesWithServiceResponseAsync(resourceGroupName, vmName), serviceCallback); }
/** * Assess patches on the VM. * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Assess patches on the VM
assessPatchesAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachinesInner.java", "license": "mit", "size": 261375 }
[ "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;
1,926,641
void setQuota(String src, long nsQuota, long ssQuota, StorageType type) throws IOException { checkOperation(OperationCategory.WRITE); writeLock(); boolean success = false; try { checkOperation(OperationCategory.WRITE); checkNameNodeSafeMode("Cannot set quota on " + src); FSDirAttrOp.setQuota(dir, src, nsQuota, ssQuota, type); success = true; } finally { writeUnlock(); if (success) { getEditLog().logSync(); } logAuditEvent(success, "setQuota", src); } }
void setQuota(String src, long nsQuota, long ssQuota, StorageType type) throws IOException { checkOperation(OperationCategory.WRITE); writeLock(); boolean success = false; try { checkOperation(OperationCategory.WRITE); checkNameNodeSafeMode(STR + src); FSDirAttrOp.setQuota(dir, src, nsQuota, ssQuota, type); success = true; } finally { writeUnlock(); if (success) { getEditLog().logSync(); } logAuditEvent(success, STR, src); } }
/** * Set the namespace quota and storage space quota for a directory. * See {@link ClientProtocol#setQuota(String, long, long, StorageType)} for the * contract. * * Note: This does not support ".inodes" relative path. */
Set the namespace quota and storage space quota for a directory. See <code>ClientProtocol#setQuota(String, long, long, StorageType)</code> for the contract. Note: This does not support ".inodes" relative path
setQuota
{ "repo_name": "myeoje/PhillyYarn", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 298468 }
[ "java.io.IOException", "org.apache.hadoop.fs.StorageType", "org.apache.hadoop.hdfs.server.namenode.NameNode" ]
import java.io.IOException; import org.apache.hadoop.fs.StorageType; import org.apache.hadoop.hdfs.server.namenode.NameNode;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.server.namenode.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,602,849
@Test public void testConvertFromAvroLogicalTimeMicros() { TalendType expectedType = TalendType.LONG; Schema fieldSchema = AvroUtils._logicalTimeMicros(); assertEquals(expectedType, TalendType.convertFromAvro(fieldSchema)); }
void function() { TalendType expectedType = TalendType.LONG; Schema fieldSchema = AvroUtils._logicalTimeMicros(); assertEquals(expectedType, TalendType.convertFromAvro(fieldSchema)); }
/** * Checks {@link TalendType#convertFromAvro(Schema)} converts logical time-micros avro type to "id_Long" di type */
Checks <code>TalendType#convertFromAvro(Schema)</code> converts logical time-micros avro type to "id_Long" di type
testConvertFromAvroLogicalTimeMicros
{ "repo_name": "Talend/components", "path": "core/components-common/src/test/java/org/talend/components/common/config/jdbc/TalendTypeTest.java", "license": "apache-2.0", "size": 10024 }
[ "org.apache.avro.Schema", "org.junit.Assert", "org.talend.daikon.avro.AvroUtils" ]
import org.apache.avro.Schema; import org.junit.Assert; import org.talend.daikon.avro.AvroUtils;
import org.apache.avro.*; import org.junit.*; import org.talend.daikon.avro.*;
[ "org.apache.avro", "org.junit", "org.talend.daikon" ]
org.apache.avro; org.junit; org.talend.daikon;
1,113,510
public static void showTimesHelpDialog(Context context, boolean isFromMenu) { if(isFromMenu) { showDialog(context, R.string.help_times_content); } else if(!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(Constants.ISRUNBEFORE_TIMES, false)) { showDialog(context, R.string.help_times_content); PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(Constants.ISRUNBEFORE_TIMES, true).commit(); } }
static void function(Context context, boolean isFromMenu) { if(isFromMenu) { showDialog(context, R.string.help_times_content); } else if(!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(Constants.ISRUNBEFORE_TIMES, false)) { showDialog(context, R.string.help_times_content); PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(Constants.ISRUNBEFORE_TIMES, true).commit(); } }
/** * Shows the help dialog for times activity * * @param context Context of the activity * @param isFromMenu If this is true, the dialog will always be shown whether or not it is the first time of running */
Shows the help dialog for times activity
showTimesHelpDialog
{ "repo_name": "mehmetakiftutuncu/eshotroid-legacy", "path": "Eshotroid_1.1/Eshotroid/src/com/mehmetakiftutuncu/eshotroid/utilities/Dialogs.java", "license": "gpl-3.0", "size": 3137 }
[ "android.content.Context", "android.preference.PreferenceManager", "com.mehmetakiftutuncu.eshotroid.Constants" ]
import android.content.Context; import android.preference.PreferenceManager; import com.mehmetakiftutuncu.eshotroid.Constants;
import android.content.*; import android.preference.*; import com.mehmetakiftutuncu.eshotroid.*;
[ "android.content", "android.preference", "com.mehmetakiftutuncu.eshotroid" ]
android.content; android.preference; com.mehmetakiftutuncu.eshotroid;
715,694
public void printFullFeatureMatrix(PrintWriter pw) { String sep = "\t"; for (int i = 0; i < featureIndex.size(); i++) { pw.print(sep + featureIndex.get(i)); } pw.println(); for (int i = 0; i < labels.length; i++) { pw.print(labelIndex.get(i)); Set<Integer> feats = Generics.newHashSet(); for (int j = 0; j < data[i].length; j++) { int feature = data[i][j]; feats.add(Integer.valueOf(feature)); } for (int j = 0; j < featureIndex.size(); j++) { if (feats.contains(Integer.valueOf(j))) { pw.print(sep + '1'); } else { pw.print(sep + '0'); } } pw.println(); } }
void function(PrintWriter pw) { String sep = "\t"; for (int i = 0; i < featureIndex.size(); i++) { pw.print(sep + featureIndex.get(i)); } pw.println(); for (int i = 0; i < labels.length; i++) { pw.print(labelIndex.get(i)); Set<Integer> feats = Generics.newHashSet(); for (int j = 0; j < data[i].length; j++) { int feature = data[i][j]; feats.add(Integer.valueOf(feature)); } for (int j = 0; j < featureIndex.size(); j++) { if (feats.contains(Integer.valueOf(j))) { pw.print(sep + '1'); } else { pw.print(sep + '0'); } } pw.println(); } }
/** * prints the full feature matrix in tab-delimited form. These can be BIG * matrices, so be careful! [Can also use printFullFeatureMatrixWithValues] */
prints the full feature matrix in tab-delimited form. These can be BIG matrices, so be careful! [Can also use printFullFeatureMatrixWithValues]
printFullFeatureMatrix
{ "repo_name": "automenta/corenlp", "path": "src/edu/stanford/nlp/classify/RVFDataset.java", "license": "gpl-2.0", "size": 34799 }
[ "edu.stanford.nlp.util.Generics", "java.io.PrintWriter", "java.util.Set" ]
import edu.stanford.nlp.util.Generics; import java.io.PrintWriter; import java.util.Set;
import edu.stanford.nlp.util.*; import java.io.*; import java.util.*;
[ "edu.stanford.nlp", "java.io", "java.util" ]
edu.stanford.nlp; java.io; java.util;
1,451,551
public String getPort() { return getPort(ServletPropertySet.PORT); }
String function() { return getPort(ServletPropertySet.PORT); }
/** * Get the basic port for the container * * Calls {@link #getPort()} with the {@link ServletPropertySet#PORT} option. */
Get the basic port for the container Calls <code>#getPort()</code> with the <code>ServletPropertySet#PORT</code> option
getPort
{ "repo_name": "PurelyApplied/geode", "path": "geode-assembly/geode-assembly-test/src/main/java/org/apache/geode/session/tests/ServerContainer.java", "license": "apache-2.0", "size": 17179 }
[ "org.codehaus.cargo.container.property.ServletPropertySet" ]
import org.codehaus.cargo.container.property.ServletPropertySet;
import org.codehaus.cargo.container.property.*;
[ "org.codehaus.cargo" ]
org.codehaus.cargo;
1,410,140
public EncryptConfiguration build() { return new EncryptConfiguration(this); } /** * Set chunk size. The chuck size is used while reading the file by * chunks {@link FileInputStream#read(byte[], int, int)}. The preferable * value is 1024xN bits. While N is power of 2 (like 1,2,4,8,16,...)<br> * <br> * <p> * The default: <b>8 * 1024</b> = 8192 bits * * @param chunkSize The chunk size in bits * @return The {@link Builder}
EncryptConfiguration function() { return new EncryptConfiguration(this); } /** * Set chunk size. The chuck size is used while reading the file by * chunks {@link FileInputStream#read(byte[], int, int)}. The preferable * value is 1024xN bits. While N is power of 2 (like 1,2,4,8,16,...)<br> * <br> * <p> * The default: <b>8 * 1024</b> = 8192 bits * * @param chunkSize The chunk size in bits * @return The {@link Builder}
/** * Build the configuration for storage. * * @return */
Build the configuration for storage
build
{ "repo_name": "sromku/android-simple-storage", "path": "storage/src/main/java/com/snatik/storage/EncryptConfiguration.java", "license": "apache-2.0", "size": 7432 }
[ "java.io.FileInputStream" ]
import java.io.FileInputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,997,713
private static <M extends Mapper> M parseAndMergeUpdate(M mapper, ParseContext context) throws IOException { final Mapper update = parseObjectOrField(context, mapper); if (update != null) { MapperUtils.merge(mapper, update); } return mapper; }
static <M extends Mapper> M function(M mapper, ParseContext context) throws IOException { final Mapper update = parseObjectOrField(context, mapper); if (update != null) { MapperUtils.merge(mapper, update); } return mapper; }
/** * Parse the given {@code context} with the given {@code mapper} and apply * the potential mapping update in-place. This method is useful when * composing mapping updates. */
Parse the given context with the given mapper and apply the potential mapping update in-place. This method is useful when composing mapping updates
parseAndMergeUpdate
{ "repo_name": "phani546/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java", "license": "apache-2.0", "size": 38400 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
359,174
Expression expression = Expression.comparison("columnName", "qualifier", Comparison.Operator.EQ, Bytes.toBytes("value")); IdxScan idxScan = new IdxScan(expression); DataOutputBuffer dataOutputBuffer = new DataOutputBuffer(); idxScan.write(dataOutputBuffer); DataInputBuffer dataInputBuffer = new DataInputBuffer(); dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength()); IdxScan clonedScan = new IdxScan(); clonedScan.readFields(dataInputBuffer); Assert.assertEquals("The expression was not the same after being written and read", idxScan.getExpression(), clonedScan.getExpression()); }
Expression expression = Expression.comparison(STR, STR, Comparison.Operator.EQ, Bytes.toBytes("value")); IdxScan idxScan = new IdxScan(expression); DataOutputBuffer dataOutputBuffer = new DataOutputBuffer(); idxScan.write(dataOutputBuffer); DataInputBuffer dataInputBuffer = new DataInputBuffer(); dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength()); IdxScan clonedScan = new IdxScan(); clonedScan.readFields(dataInputBuffer); Assert.assertEquals(STR, idxScan.getExpression(), clonedScan.getExpression()); }
/** * Tests that the writable and readFields methods work as expected. * * @throws java.io.IOException if an IO error occurs */
Tests that the writable and readFields methods work as expected
testWritable
{ "repo_name": "ykulbak/ihbase", "path": "src/test/java/org/apache/hadoop/hbase/client/idx/TestIdxScan.java", "license": "apache-2.0", "size": 3004 }
[ "junit.framework.Assert", "org.apache.hadoop.hbase.client.idx.exp.Comparison", "org.apache.hadoop.hbase.client.idx.exp.Expression", "org.apache.hadoop.hbase.util.Bytes", "org.apache.hadoop.io.DataInputBuffer", "org.apache.hadoop.io.DataOutputBuffer" ]
import junit.framework.Assert; import org.apache.hadoop.hbase.client.idx.exp.Comparison; import org.apache.hadoop.hbase.client.idx.exp.Expression; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.io.DataInputBuffer; import org.apache.hadoop.io.DataOutputBuffer;
import junit.framework.*; import org.apache.hadoop.hbase.client.idx.exp.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.io.*;
[ "junit.framework", "org.apache.hadoop" ]
junit.framework; org.apache.hadoop;
2,245,536
//@@author A0163559U @Override public int compareTo(Task compareTask) { int compareToResult = 0; if (this.isComplete() && compareTask.isComplete()) { compareToResult = 0; } else if (this.isComplete()) { compareToResult = 1; } else if (compareTask.isComplete()) { compareToResult = -1; } if (compareToResult == 0) { compareToResult = this.priority.compareTo(compareTask.priority); } if (compareToResult == 0) { compareToResult = this.getEndTiming().compareTo(compareTask.getEndTiming()); } if (compareToResult == 0) { compareToResult = this.getStartTiming().compareTo(compareTask.getStartTiming()); } if (compareToResult == 0) { compareToResult = this.getDescription().compareTo(compareTask.getDescription()); } return compareToResult; } public static Comparator<Task> taskComparator = new Comparator<Task>() {
int function(Task compareTask) { int compareToResult = 0; if (this.isComplete() && compareTask.isComplete()) { compareToResult = 0; } else if (this.isComplete()) { compareToResult = 1; } else if (compareTask.isComplete()) { compareToResult = -1; } if (compareToResult == 0) { compareToResult = this.priority.compareTo(compareTask.priority); } if (compareToResult == 0) { compareToResult = this.getEndTiming().compareTo(compareTask.getEndTiming()); } if (compareToResult == 0) { compareToResult = this.getStartTiming().compareTo(compareTask.getStartTiming()); } if (compareToResult == 0) { compareToResult = this.getDescription().compareTo(compareTask.getDescription()); } return compareToResult; } public static Comparator<Task> taskComparator = new Comparator<Task>() {
/** * Results in Tasks sorted by completed state, followed by priority, endTiming, startTiming * and lastly by frequency. * Note: If a and b are tasks and a.compareTo(b) == 0, that does not imply * a.equals(b). */
Results in Tasks sorted by completed state, followed by priority, endTiming, startTiming and lastly by frequency. Note: If a and b are tasks and a.compareTo(b) == 0, that does not imply a.equals(b)
compareTo
{ "repo_name": "CS2103JAN2017-T11-B3/main", "path": "src/main/java/seedu/task/model/task/Task.java", "license": "mit", "size": 14792 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
256,601
public Demographic getDemographic() { return demographic; }
Demographic function() { return demographic; }
/** * Gets the demographic for the document. * @return Returns the Demographic object for the document. */
Gets the demographic for the document
getDemographic
{ "repo_name": "scoophealth/oscar", "path": "src/main/java/org/oscarehr/sharingcenter/model/DemographicExport.java", "license": "gpl-2.0", "size": 3235 }
[ "org.oscarehr.common.model.Demographic" ]
import org.oscarehr.common.model.Demographic;
import org.oscarehr.common.model.*;
[ "org.oscarehr.common" ]
org.oscarehr.common;
986,738
public Enumeration elements() { return new Enumeration() { int idx=-1, bit=BITS; { advance(); }
Enumeration function() { return new Enumeration() { int idx=-1, bit=BITS; { advance(); }
/** * Return an <code>Enumeration</code> of <code>Integer</code>s * which represent set bit indices in this SparseBitSet. */
Return an <code>Enumeration</code> of <code>Integer</code>s which represent set bit indices in this SparseBitSet
elements
{ "repo_name": "mingyuan-xia/TigerCC", "path": "ref/ref1/JLex/Main.java", "license": "apache-2.0", "size": 204122 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
2,110,817
public static String parseTokenFromResponse(String response) { Pattern pattern = Pattern.compile("Token=\"(.+)\""); Matcher matcher = pattern.matcher(response); matcher.find(); return matcher.group().replaceFirst("Token=\"", "").replaceAll("\"", ""); }
static String function(String response) { Pattern pattern = Pattern.compile(STR(.+)\""); Matcher matcher = pattern.matcher(response); matcher.find(); return matcher.group().replaceFirst(STR", "STR\STR"); }
/** * Parses the token in the response. * * @param response The response from the AC * @return the token */
Parses the token in the response
parseTokenFromResponse
{ "repo_name": "computergeek1507/openhab", "path": "bundles/binding/org.openhab.binding.samsungac/src/main/java/org/openhab/binding/samsungac/internal/ResponseParser.java", "license": "epl-1.0", "size": 6993 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,284,071
public void setPost(HashMap<Integer, ArrayList<Integer>> post) { this.post = post; }//setPost
void function(HashMap<Integer, ArrayList<Integer>> post) { this.post = post; }
/** * Sets the post Adjacency List for all nodes * @param post the post to set */
Sets the post Adjacency List for all nodes
setPost
{ "repo_name": "mepcotterell/SuggestionEngine", "path": "src/pHomomorphism/H1adjacency.java", "license": "mit", "size": 3750 }
[ "java.util.ArrayList", "java.util.HashMap" ]
import java.util.ArrayList; import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
700,639
protected boolean checkFinancialObjectSubtypeCodeChange() { if (ObjectUtils.isNotNull(newAsset.getFinancialObjectSubType()) || StringUtils.isNotBlank(newAsset.getFinancialObjectSubTypeCode())) { newAsset.refreshReferenceObject(CamsPropertyConstants.Asset.REF_OBJECT_SUB_TYPE); if (ObjectUtils.isNull(newAsset.getFinancialObjectSubType())) { putFieldError(CamsPropertyConstants.Asset.FINANCIAL_OBJECT_SUB_TYP_CODE, CamsKeyConstants.Asset.ERROR_FINANCIAL_OBJECT_SUBTYPE_CODE_INVALID); return false; } else if (!newAsset.getFinancialObjectSubType().isActive()) { putFieldError(CamsPropertyConstants.Asset.FINANCIAL_OBJECT_SUB_TYP_CODE, CamsKeyConstants.Asset.ERROR_FINANCIAL_OBJECT_SUBTYPE_CODE_INACTIVE); return false; } } return true; }
boolean function() { if (ObjectUtils.isNotNull(newAsset.getFinancialObjectSubType()) StringUtils.isNotBlank(newAsset.getFinancialObjectSubTypeCode())) { newAsset.refreshReferenceObject(CamsPropertyConstants.Asset.REF_OBJECT_SUB_TYPE); if (ObjectUtils.isNull(newAsset.getFinancialObjectSubType())) { putFieldError(CamsPropertyConstants.Asset.FINANCIAL_OBJECT_SUB_TYP_CODE, CamsKeyConstants.Asset.ERROR_FINANCIAL_OBJECT_SUBTYPE_CODE_INVALID); return false; } else if (!newAsset.getFinancialObjectSubType().isActive()) { putFieldError(CamsPropertyConstants.Asset.FINANCIAL_OBJECT_SUB_TYP_CODE, CamsKeyConstants.Asset.ERROR_FINANCIAL_OBJECT_SUBTYPE_CODE_INACTIVE); return false; } } return true; }
/** * Check if the Financial Object Sub-Type Code is valid or is inactive. * * @param oldObjectSubType * @param newObjectSubType * @return boolean */
Check if the Financial Object Sub-Type Code is valid or is inactive
checkFinancialObjectSubtypeCodeChange
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-cam/src/main/java/org/kuali/kfs/module/cam/document/validation/impl/AssetRule.java", "license": "agpl-3.0", "size": 35887 }
[ "org.apache.commons.lang.StringUtils", "org.kuali.kfs.krad.util.ObjectUtils", "org.kuali.kfs.module.cam.CamsKeyConstants", "org.kuali.kfs.module.cam.CamsPropertyConstants", "org.kuali.kfs.module.cam.businessobject.Asset" ]
import org.apache.commons.lang.StringUtils; import org.kuali.kfs.krad.util.ObjectUtils; import org.kuali.kfs.module.cam.CamsKeyConstants; import org.kuali.kfs.module.cam.CamsPropertyConstants; import org.kuali.kfs.module.cam.businessobject.Asset;
import org.apache.commons.lang.*; import org.kuali.kfs.krad.util.*; import org.kuali.kfs.module.cam.*; import org.kuali.kfs.module.cam.businessobject.*;
[ "org.apache.commons", "org.kuali.kfs" ]
org.apache.commons; org.kuali.kfs;
773,976
static @Nullable Pair<RelTraitSet, List<RelTraitSet>> deriveTraitsForJoin( RelTraitSet childTraits, int childId, JoinRelType joinType, RelTraitSet joinTraitSet, RelTraitSet rightTraitSet) { // should only derive traits (limited to collation for now) from left join input. assert childId == 0; RelCollation collation = childTraits.getCollation(); if (collation == null || collation == RelCollations.EMPTY || joinType == JoinRelType.FULL || joinType == JoinRelType.RIGHT) { return null; } RelTraitSet derivedTraits = joinTraitSet.replace(collation); return Pair.of( derivedTraits, ImmutableList.of(derivedTraits, rightTraitSet)); }
static @Nullable Pair<RelTraitSet, List<RelTraitSet>> deriveTraitsForJoin( RelTraitSet childTraits, int childId, JoinRelType joinType, RelTraitSet joinTraitSet, RelTraitSet rightTraitSet) { assert childId == 0; RelCollation collation = childTraits.getCollation(); if (collation == null collation == RelCollations.EMPTY joinType == JoinRelType.FULL joinType == JoinRelType.RIGHT) { return null; } RelTraitSet derivedTraits = joinTraitSet.replace(collation); return Pair.of( derivedTraits, ImmutableList.of(derivedTraits, rightTraitSet)); }
/** * This function can be reused when a Join's traits derivation shall only * derive collation from left input. * * @param childTraits trait set of the child * @param childId id of the child (0 is left join input) * @param joinType the join type * @param joinTraitSet trait set of the join * @param rightTraitSet trait set of the right join input */
This function can be reused when a Join's traits derivation shall only derive collation from left input
deriveTraitsForJoin
{ "repo_name": "datametica/calcite", "path": "core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTraitsUtils.java", "license": "apache-2.0", "size": 8006 }
[ "com.google.common.collect.ImmutableList", "java.util.List", "org.apache.calcite.plan.RelTraitSet", "org.apache.calcite.rel.RelCollation", "org.apache.calcite.rel.RelCollations", "org.apache.calcite.rel.core.JoinRelType", "org.apache.calcite.util.Pair", "org.checkerframework.checker.nullness.qual.Nullable" ]
import com.google.common.collect.ImmutableList; import java.util.List; import org.apache.calcite.plan.RelTraitSet; import org.apache.calcite.rel.RelCollation; import org.apache.calcite.rel.RelCollations; import org.apache.calcite.rel.core.JoinRelType; import org.apache.calcite.util.Pair; import org.checkerframework.checker.nullness.qual.Nullable;
import com.google.common.collect.*; import java.util.*; import org.apache.calcite.plan.*; import org.apache.calcite.rel.*; import org.apache.calcite.rel.core.*; import org.apache.calcite.util.*; import org.checkerframework.checker.nullness.qual.*;
[ "com.google.common", "java.util", "org.apache.calcite", "org.checkerframework.checker" ]
com.google.common; java.util; org.apache.calcite; org.checkerframework.checker;
2,227,546
public void applyProcessedEvent(final Event event) { mCombinerChain.applyProcessedEvent(event); final int primaryCode = event.mCodePoint; final int keyX = event.mX; final int keyY = event.mY; final int newIndex = size(); refreshTypedWordCache(); mCursorPositionWithinWord = mCodePointSize; // We may have deleted the last one. if (0 == mCodePointSize) { mIsOnlyFirstCharCapitalized = false; } if (Constants.CODE_DELETE != event.mKeyCode) { if (newIndex < MAX_WORD_LENGTH) { // In the batch input mode, the {@code mInputPointers} holds batch input points and // shouldn't be overridden by the "typed key" coordinates // (See {@link #setBatchInputWord}). if (!mIsBatchMode) { // TODO: Set correct pointer id and time mInputPointers.addPointerAt(newIndex, keyX, keyY, 0, 0); } } if (0 == newIndex) { mIsOnlyFirstCharCapitalized = Character.isUpperCase(primaryCode); } else { mIsOnlyFirstCharCapitalized = mIsOnlyFirstCharCapitalized && !Character.isUpperCase(primaryCode); } if (Character.isUpperCase(primaryCode)) mCapsCount++; if (Character.isDigit(primaryCode)) mDigitsCount++; } mAutoCorrection = null; }
void function(final Event event) { mCombinerChain.applyProcessedEvent(event); final int primaryCode = event.mCodePoint; final int keyX = event.mX; final int keyY = event.mY; final int newIndex = size(); refreshTypedWordCache(); mCursorPositionWithinWord = mCodePointSize; if (0 == mCodePointSize) { mIsOnlyFirstCharCapitalized = false; } if (Constants.CODE_DELETE != event.mKeyCode) { if (newIndex < MAX_WORD_LENGTH) { if (!mIsBatchMode) { mInputPointers.addPointerAt(newIndex, keyX, keyY, 0, 0); } } if (0 == newIndex) { mIsOnlyFirstCharCapitalized = Character.isUpperCase(primaryCode); } else { mIsOnlyFirstCharCapitalized = mIsOnlyFirstCharCapitalized && !Character.isUpperCase(primaryCode); } if (Character.isUpperCase(primaryCode)) mCapsCount++; if (Character.isDigit(primaryCode)) mDigitsCount++; } mAutoCorrection = null; }
/** * Apply a processed input event. * * All input events should be supported, including software/hardware events, characters as well * as deletions, multiple inputs and gestures. * * @param event the event to apply. Must not be null. */
Apply a processed input event. All input events should be supported, including software/hardware events, characters as well as deletions, multiple inputs and gestures
applyProcessedEvent
{ "repo_name": "vorgoron/LatinIME-extended-with-Russian-languages", "path": "app/src/main/java/com/udmurtlyk/extrainputmethod/latin/WordComposer.java", "license": "apache-2.0", "size": 20102 }
[ "com.udmurtlyk.extrainputmethod.event.Event" ]
import com.udmurtlyk.extrainputmethod.event.Event;
import com.udmurtlyk.extrainputmethod.event.*;
[ "com.udmurtlyk.extrainputmethod" ]
com.udmurtlyk.extrainputmethod;
2,197
@ServiceMethod(returns = ReturnType.SINGLE) Response<AttachedDatabaseConfigurationInner> getWithResponse( String resourceGroupName, String clusterName, String attachedDatabaseConfigurationName, Context context);
@ServiceMethod(returns = ReturnType.SINGLE) Response<AttachedDatabaseConfigurationInner> getWithResponse( String resourceGroupName, String clusterName, String attachedDatabaseConfigurationName, Context context);
/** * Returns an attached database configuration. * * @param resourceGroupName The name of the resource group containing the Kusto cluster. * @param clusterName The name of the Kusto cluster. * @param attachedDatabaseConfigurationName The name of the attached database configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return class representing an attached database configuration along with {@link Response}. */
Returns an attached database configuration
getWithResponse
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/fluent/AttachedDatabaseConfigurationsClient.java", "license": "mit", "size": 15001 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.kusto.fluent.models.AttachedDatabaseConfigurationInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.kusto.fluent.models.AttachedDatabaseConfigurationInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.kusto.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
783,659
private void dispatchPacket(RawPacket pkt) { // for now we treat all listeners as serial listeners for (List<DataPacketListener> serialListeners : listenDataPacket) { for (DataPacketListener l : serialListeners) { // TODO: possibly deal with read-only and read-write packet // copies IListenDataPacket s = (l == null ? null : l.listener); if (s != null) { try { // TODO Make sure to filter based on the match too, // later on PacketResult res = s.receiveDataPacket(pkt); increaseStat("RXPacketSuccess"); if (res.equals(PacketResult.CONSUME)) { increaseStat("RXPacketSerialExit"); break; } } catch (Exception e) { increaseStat("RXPacketFailedForException"); } } } } }
void function(RawPacket pkt) { for (List<DataPacketListener> serialListeners : listenDataPacket) { for (DataPacketListener l : serialListeners) { IListenDataPacket s = (l == null ? null : l.listener); if (s != null) { try { PacketResult res = s.receiveDataPacket(pkt); increaseStat(STR); if (res.equals(PacketResult.CONSUME)) { increaseStat(STR); break; } } catch (Exception e) { increaseStat(STR); } } } } }
/** * Loop for processing Received packets */
Loop for processing Received packets
dispatchPacket
{ "repo_name": "my76128/controller", "path": "opendaylight/adsal/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/DataPacketService.java", "license": "epl-1.0", "size": 16783 }
[ "java.util.List", "org.opendaylight.controller.sal.packet.IListenDataPacket", "org.opendaylight.controller.sal.packet.PacketResult", "org.opendaylight.controller.sal.packet.RawPacket" ]
import java.util.List; import org.opendaylight.controller.sal.packet.IListenDataPacket; import org.opendaylight.controller.sal.packet.PacketResult; import org.opendaylight.controller.sal.packet.RawPacket;
import java.util.*; import org.opendaylight.controller.sal.packet.*;
[ "java.util", "org.opendaylight.controller" ]
java.util; org.opendaylight.controller;
696,921
private void installLogger() { Jenkins.logRecords = handler.getView(); Logger.getLogger("hudson").addHandler(handler); Logger.getLogger("jenkins").addHandler(handler); } private static class FileAndDescription { File file; String description; public FileAndDescription(File file,String description) { this.file = file; this.description = description; } }
void function() { Jenkins.logRecords = handler.getView(); Logger.getLogger(STR).addHandler(handler); Logger.getLogger(STR).addHandler(handler); } private static class FileAndDescription { File file; String description; public FileAndDescription(File file,String description) { this.file = file; this.description = description; } }
/** * Installs log handler to monitor all Hudson logs. */
Installs log handler to monitor all Hudson logs
installLogger
{ "repo_name": "IsCoolEntertainment/debpkg_jenkins", "path": "core/src/main/java/hudson/WebAppMain.java", "license": "mit", "size": 15947 }
[ "java.io.File", "java.util.logging.Logger" ]
import java.io.File; import java.util.logging.Logger;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
501
static public void put(final byte[] src, final IAllocation[] a) { int offset = 0; int remaining = src.length; for (int i = 0; i < a.length && remaining > 0; i++) { final ByteBuffer slice = a[i].getSlice(); final int length = Math.min(remaining, slice.remaining()); slice.put(src, offset, length); offset += length; remaining -= length; } if (remaining > 0) throw new BufferOverflowException(); }
static void function(final byte[] src, final IAllocation[] a) { int offset = 0; int remaining = src.length; for (int i = 0; i < a.length && remaining > 0; i++) { final ByteBuffer slice = a[i].getSlice(); final int length = Math.min(remaining, slice.remaining()); slice.put(src, offset, length); offset += length; remaining -= length; } if (remaining > 0) throw new BufferOverflowException(); }
/** * Copy the caller's data onto the ordered array of allocations. The * position of each {@link IAllocation#getSlice() allocation} will be * advanced by the #of bytes copied into that allocation. * * @param src * The source data. * @param a * The allocations. * * @throws BufferOverflowException * if there is not enough room in the allocations for the data * to be copied. */
Copy the caller's data onto the ordered array of allocations. The position of each <code>IAllocation#getSlice() allocation</code> will be advanced by the #of bytes copied into that allocation
put
{ "repo_name": "smalyshev/blazegraph", "path": "bigdata/src/java/com/bigdata/io/DirectBufferPoolAllocator.java", "license": "gpl-2.0", "size": 21170 }
[ "java.nio.BufferOverflowException", "java.nio.ByteBuffer" ]
import java.nio.BufferOverflowException; import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
438,191
public synchronized void setIndeterminate(boolean indeterminate) { if (!indeterminate) { mCurrentProgress = 0.0f; } mProgressBarEnabled = indeterminate; mShouldUpdateButtonPosition = true; mProgressIndeterminate = indeterminate; mLastTimeAnimated = SystemClock.uptimeMillis(); setupProgressBounds(); saveButtonOriginalPosition(); updateBackground(); }
synchronized void function(boolean indeterminate) { if (!indeterminate) { mCurrentProgress = 0.0f; } mProgressBarEnabled = indeterminate; mShouldUpdateButtonPosition = true; mProgressIndeterminate = indeterminate; mLastTimeAnimated = SystemClock.uptimeMillis(); setupProgressBounds(); saveButtonOriginalPosition(); updateBackground(); }
/** * <p>Change the indeterminate mode for the progress bar. In indeterminate * mode, the progress is ignored and the progress bar shows an infinite * animation instead.</p> * * @param indeterminate true to enable the indeterminate mode */
Change the indeterminate mode for the progress bar. In indeterminate mode, the progress is ignored and the progress bar shows an infinite animation instead
setIndeterminate
{ "repo_name": "yeojoy/FloatingActionButton", "path": "library/src/main/java/com/github/clans/fab/FloatingActionButton.java", "license": "apache-2.0", "size": 42935 }
[ "android.os.SystemClock" ]
import android.os.SystemClock;
import android.os.*;
[ "android.os" ]
android.os;
239,125
public void testCreateDatabaseJar() throws Exception { CallableStatement cs = prepareCall( "CALL SYSCS_UTIL.SYSCS_CHECKPOINT_DATABASE()"); cs.executeUpdate(); cs.close(); cs = prepareCall( "CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE_NOWAIT(?)"); final File backupDir = SupportFilesSetup.getReadWrite("dbreadonly"); cs.setString(1, backupDir.getPath()); cs.executeUpdate(); cs.close(); final String db = getTestConfiguration().getDefaultDatabaseName(); AccessController.doPrivileged (new java.security.PrivilegedExceptionAction(){
void function() throws Exception { CallableStatement cs = prepareCall( STR); cs.executeUpdate(); cs.close(); cs = prepareCall( STR); final File backupDir = SupportFilesSetup.getReadWrite(STR); cs.setString(1, backupDir.getPath()); cs.executeUpdate(); cs.close(); final String db = getTestConfiguration().getDefaultDatabaseName(); AccessController.doPrivileged (new java.security.PrivilegedExceptionAction(){
/** * Create a Jar of the current database. * @throws Exception * */
Create a Jar of the current database
testCreateDatabaseJar
{ "repo_name": "viaper/DBPlus", "path": "DerbyHodgepodge/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java", "license": "apache-2.0", "size": 48889 }
[ "java.io.File", "java.security.AccessController", "java.sql.CallableStatement", "org.apache.derbyTesting.junit.SupportFilesSetup" ]
import java.io.File; import java.security.AccessController; import java.sql.CallableStatement; import org.apache.derbyTesting.junit.SupportFilesSetup;
import java.io.*; import java.security.*; import java.sql.*; import org.apache.*;
[ "java.io", "java.security", "java.sql", "org.apache" ]
java.io; java.security; java.sql; org.apache;
278,252
public IncludeActionRule getIncludeActionRule() { return includeActionRule; }
IncludeActionRule function() { return includeActionRule; }
/** * Returns the include action rule. * @return the include action rule */
Returns the include action rule
getIncludeActionRule
{ "repo_name": "aspectran/aspectran", "path": "core/src/main/java/com/aspectran/core/activity/process/action/IncludeAction.java", "license": "apache-2.0", "size": 3971 }
[ "com.aspectran.core.context.rule.IncludeActionRule" ]
import com.aspectran.core.context.rule.IncludeActionRule;
import com.aspectran.core.context.rule.*;
[ "com.aspectran.core" ]
com.aspectran.core;
2,657,908
private int copySelectedToChannel(ListSessionSetHelper helper, ConfigChannel channel, HttpServletRequest request, User user) { ConfigurationManager cm = ConfigurationManager.getInstance(); Set<String> set = helper.getSet(); for (String key : set) { ConfigFile cf = cm.lookupConfigFile(user, Long.valueOf(key)); ConfigRevision cr = cf.getLatestConfigRevision(); cm.copyConfigFile(cr, channel, user); } int size = set.size(); helper.destroy(); return size; }
int function(ListSessionSetHelper helper, ConfigChannel channel, HttpServletRequest request, User user) { ConfigurationManager cm = ConfigurationManager.getInstance(); Set<String> set = helper.getSet(); for (String key : set) { ConfigFile cf = cm.lookupConfigFile(user, Long.valueOf(key)); ConfigRevision cr = cf.getLatestConfigRevision(); cm.copyConfigFile(cr, channel, user); } int size = set.size(); helper.destroy(); return size; }
/** * Copies the select files to a given channel.. * @param channel channel to copy the files to.. * @param user used for security.. * @return returns the number of files copied */
Copies the select files to a given channel.
copySelectedToChannel
{ "repo_name": "xkollar/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/ViewModifyPathsAction.java", "license": "gpl-2.0", "size": 12603 }
[ "com.redhat.rhn.domain.config.ConfigChannel", "com.redhat.rhn.domain.config.ConfigFile", "com.redhat.rhn.domain.config.ConfigRevision", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.taglibs.list.helper.ListSessionSetHelper", "com.redhat.rhn.manager.configuration.ConfigurationManager", "java.util.Set", "javax.servlet.http.HttpServletRequest" ]
import com.redhat.rhn.domain.config.ConfigChannel; import com.redhat.rhn.domain.config.ConfigFile; import com.redhat.rhn.domain.config.ConfigRevision; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.taglibs.list.helper.ListSessionSetHelper; import com.redhat.rhn.manager.configuration.ConfigurationManager; import java.util.Set; import javax.servlet.http.HttpServletRequest;
import com.redhat.rhn.domain.config.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.taglibs.list.helper.*; import com.redhat.rhn.manager.configuration.*; import java.util.*; import javax.servlet.http.*;
[ "com.redhat.rhn", "java.util", "javax.servlet" ]
com.redhat.rhn; java.util; javax.servlet;
2,747,515
public Service getService(String gateway) { return serviceRepo.get(gateway); }
Service function(String gateway) { return serviceRepo.get(gateway); }
/** * get the service given the gateway id * @param gateway * @return */
get the service given the gateway id
getService
{ "repo_name": "shafreenAnfar/wso2-axis2", "path": "modules/transport/sms/src/main/java/org/apache/axis2/transport/sms/gsm/GSMServiceRepository.java", "license": "apache-2.0", "size": 2244 }
[ "org.smslib.Service" ]
import org.smslib.Service;
import org.smslib.*;
[ "org.smslib" ]
org.smslib;
989,777
public static <N, E extends N, T extends N> ValidationResult validate( final ViolationCollector v, DocumentSchema schema, AutomatonDocument doc, DocOp op) { if (schema == null) { schema = DocumentSchema.NO_SCHEMA_CONSTRAINTS; }
static <N, E extends N, T extends N> ValidationResult function( final ViolationCollector v, DocumentSchema schema, AutomatonDocument doc, DocOp op) { if (schema == null) { schema = DocumentSchema.NO_SCHEMA_CONSTRAINTS; }
/** * Returns whether op is well-formed, applies to doc, and preserves the given * schema constraints. Will not modify doc. */
Returns whether op is well-formed, applies to doc, and preserves the given schema constraints. Will not modify doc
validate
{ "repo_name": "processone/google-wave-api", "path": "wave-model/src/main/java/org/waveprotocol/wave/model/document/operation/impl/DocOpValidator.java", "license": "apache-2.0", "size": 7081 }
[ "org.waveprotocol.wave.model.document.operation.DocOp", "org.waveprotocol.wave.model.document.operation.automaton.AutomatonDocument", "org.waveprotocol.wave.model.document.operation.automaton.DocOpAutomaton", "org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema" ]
import org.waveprotocol.wave.model.document.operation.DocOp; import org.waveprotocol.wave.model.document.operation.automaton.AutomatonDocument; import org.waveprotocol.wave.model.document.operation.automaton.DocOpAutomaton; import org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema;
import org.waveprotocol.wave.model.document.operation.*; import org.waveprotocol.wave.model.document.operation.automaton.*;
[ "org.waveprotocol.wave" ]
org.waveprotocol.wave;
1,185,987
public final List<Coordinate> getPartialPath(World world, Coordinate start, Coordinate end) { Guard.argumentsAreNotNull(world, start, end); Guard.argumentsInsideBounds(start.x(), start.y(), world.width(), world.height()); return Guard.returnNonNull(calcPath(world, start, end)); }
final List<Coordinate> function(World world, Coordinate start, Coordinate end) { Guard.argumentsAreNotNull(world, start, end); Guard.argumentsInsideBounds(start.x(), start.y(), world.width(), world.height()); return Guard.returnNonNull(calcPath(world, start, end)); }
/** * Returns a partial path from the given start to end on the provided {@code World}. Since the * path is incomplete, it may or may not terminate at the provided end. * @param world the world on which the path is calculated * @param start the start of the calculated path * @param end the intended end of the calculated path * @return a path from start to end on world */
Returns a partial path from the given start to end on the provided World. Since the path is incomplete, it may or may not terminate at the provided end
getPartialPath
{ "repo_name": "kinnla/swp-2013", "path": "src/jade/path/PathFinder.java", "license": "bsd-3-clause", "size": 3824 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,131,078
T encode(S objectToEncode) throws OwsExceptionReport, UnsupportedEncoderInputException; /** * Encodes the specified object with the specified {@linkplain HelperValues}
T encode(S objectToEncode) throws OwsExceptionReport, UnsupportedEncoderInputException; /** * Encodes the specified object with the specified {@linkplain HelperValues}
/** * Encodes the specified object. * * @param objectToEncode * the object to encode * * @return the encoded object * * @throws OwsExceptionReport * if an error occurs * @throws UnsupportedEncoderInputException * if the supplied object (or any of it's contents) is not * supported by this encoder */
Encodes the specified object
encode
{ "repo_name": "nuest/SOS", "path": "core/api/src/main/java/org/n52/sos/encode/Encoder.java", "license": "gpl-2.0", "size": 3923 }
[ "org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException", "org.n52.sos.ogc.ows.OwsExceptionReport", "org.n52.sos.ogc.sos.SosConstants" ]
import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException; import org.n52.sos.ogc.ows.OwsExceptionReport; import org.n52.sos.ogc.sos.SosConstants;
import org.n52.sos.exception.ows.concrete.*; import org.n52.sos.ogc.ows.*; import org.n52.sos.ogc.sos.*;
[ "org.n52.sos" ]
org.n52.sos;
2,014,061
@Override public int read( byte[] dest, int off, int len ) throws java.io.IOException { int i; int b; for( i = 0; i < len; i++ ) { b = read(); if( b >= 0 ) { dest[off + i] = (byte) b; } else if( i == 0 ) { return -1; } else { break; // Out of 'for' loop } // Out of 'for' loop } // end for: each byte read return i; } // end read } // end inner class InputStream public static class OutputStream extends java.io.FilterOutputStream { private boolean encode; private int position; private byte[] buffer; private int bufferLength; private int lineLength; private boolean breakLines; private byte[] b4; // Scratch used in a few places private boolean suspendEncoding; private int options; // Record for later private byte[] decodabet; // Local copies to avoid extra method calls public OutputStream( java.io.OutputStream out ) { this( out, ENCODE ); } // end constructor public OutputStream( java.io.OutputStream out, int options ) { super( out ); this.breakLines = (options & DO_BREAK_LINES) != 0; this.encode = (options & ENCODE) != 0; this.bufferLength = encode ? 3 : 4; this.buffer = new byte[ bufferLength ]; this.position = 0; this.lineLength = 0; this.suspendEncoding = false; this.b4 = new byte[4]; this.options = options; this.decodabet = getDecodabet(options); } // end constructor
int function( byte[] dest, int off, int len ) throws java.io.IOException { int i; int b; for( i = 0; i < len; i++ ) { b = read(); if( b >= 0 ) { dest[off + i] = (byte) b; } else if( i == 0 ) { return -1; } else { break; } } return i; } } public static class OutputStream extends java.io.FilterOutputStream { private boolean encode; private int position; private byte[] buffer; private int bufferLength; private int lineLength; private boolean breakLines; private byte[] b4; private boolean suspendEncoding; private int options; private byte[] decodabet; public OutputStream( java.io.OutputStream out ) { this( out, ENCODE ); } public OutputStream( java.io.OutputStream out, int options ) { super( out ); this.breakLines = (options & DO_BREAK_LINES) != 0; this.encode = (options & ENCODE) != 0; this.bufferLength = encode ? 3 : 4; this.buffer = new byte[ bufferLength ]; this.position = 0; this.lineLength = 0; this.suspendEncoding = false; this.b4 = new byte[4]; this.options = options; this.decodabet = getDecodabet(options); }
/** * Calls {@link #read()} repeatedly until the end of stream * is reached or <var>len</var> bytes are read. * Returns number of bytes read into array or -1 if * end of stream is encountered. * * @param dest array to hold values * @param off offset for array * @param len max number of bytes to read into array * @return bytes read into array or -1 if end of stream is encountered. * @since 1.3 */
Calls <code>#read()</code> repeatedly until the end of stream is reached or len bytes are read. Returns number of bytes read into array or -1 if end of stream is encountered
read
{ "repo_name": "micheal-swiggs/jumblar", "path": "src/main/java/com/jumblar/core/encodings/Base64.java", "license": "apache-2.0", "size": 81922 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,871,868
protected Image getImage(Plot plot, int series, int item, double x, double y) { // this method must be overridden if you want to display images return null; }
Image function(Plot plot, int series, int item, double x, double y) { return null; }
/** * Returns the image used to draw a single data item. * * @param plot the plot (can be used to obtain standard color information * etc). * @param series the series index. * @param item the item index. * @param x the x value of the item. * @param y the y value of the item. * * @return The image. * * @see #getPlotImages() */
Returns the image used to draw a single data item
getImage
{ "repo_name": "simon04/jfreechart", "path": "src/main/java/org/jfree/chart/renderer/xy/StandardXYItemRenderer.java", "license": "lgpl-2.1", "size": 41298 }
[ "java.awt.Image", "org.jfree.chart.plot.Plot" ]
import java.awt.Image; import org.jfree.chart.plot.Plot;
import java.awt.*; import org.jfree.chart.plot.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
1,073,195
protected static Ptg calcImDiv( Ptg[] operands ) { if( operands.length < 2 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "IMDIV" ); String complexString1 = StringTool.allTrim( operands[0].getString() ); String complexString2 = StringTool.allTrim( operands[1].getString() ); Complex c1; Complex c2; try { c1 = imParseComplexNumber( complexString1 ); c2 = imParseComplexNumber( complexString2 ); } catch( Exception e ) { return new PtgErr( PtgErr.ERROR_NUM ); } double divisor = Math.pow( c2.real, 2 ) + Math.pow( c2.imaginary, 2 ); double a = (c1.real * c2.real) + (c1.imaginary * c2.imaginary); double b = (c1.imaginary * c2.real) - (c1.real * c2.imaginary); double c = a / divisor; double d = b / divisor; String imDiv; if( d > 0 ) { imDiv = imGetExcelStr( c ) + "+" + imGetExcelStr( d ) + "i"; } else { imDiv = imGetExcelStr( c ) + "-" + imGetExcelStr( d ) + "i"; } PtgStr pstr = new PtgStr( imDiv ); log.debug( "Result from IMDIV= " + pstr.getString() ); return pstr; }
static Ptg function( Ptg[] operands ) { if( operands.length < 2 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "IMDIV" ); String complexString1 = StringTool.allTrim( operands[0].getString() ); String complexString2 = StringTool.allTrim( operands[1].getString() ); Complex c1; Complex c2; try { c1 = imParseComplexNumber( complexString1 ); c2 = imParseComplexNumber( complexString2 ); } catch( Exception e ) { return new PtgErr( PtgErr.ERROR_NUM ); } double divisor = Math.pow( c2.real, 2 ) + Math.pow( c2.imaginary, 2 ); double a = (c1.real * c2.real) + (c1.imaginary * c2.imaginary); double b = (c1.imaginary * c2.real) - (c1.real * c2.imaginary); double c = a / divisor; double d = b / divisor; String imDiv; if( d > 0 ) { imDiv = imGetExcelStr( c ) + "+" + imGetExcelStr( d ) + "i"; } else { imDiv = imGetExcelStr( c ) + "-" + imGetExcelStr( d ) + "i"; } PtgStr pstr = new PtgStr( imDiv ); log.debug( STR + pstr.getString() ); return pstr; }
/** * IMDIV * Returns the quotient of two complex numbers, defined as (deep breath): * <p/> * (r1 + i1j)/(r2 + i2j) == ( r1r2 + i1i2 + (r2i1 - r1i2)i ) / (r2^2 + i2^2) */
IMDIV Returns the quotient of two complex numbers, defined as (deep breath): (r1 + i1j)/(r2 + i2j) == ( r1r2 + i1i2 + (r2i1 - r1i2)i ) / (r2^2 + i2^2)
calcImDiv
{ "repo_name": "Maxels88/openxls", "path": "src/main/java/org/openxls/formats/XLS/formulas/EngineeringCalculator.java", "license": "gpl-3.0", "size": 74340 }
[ "org.openxls.toolkit.StringTool" ]
import org.openxls.toolkit.StringTool;
import org.openxls.toolkit.*;
[ "org.openxls.toolkit" ]
org.openxls.toolkit;
1,573,829
public int deactivateProxy(String clientcert) throws ProxyNotActivatedException, MethodInvalidParamException { Server server = validateClientCertificate(clientcert); if (!server.isProxy()) { throw new ProxyNotActivatedException(); } SystemManager.deactivateProxy(server); return 1; }
int function(String clientcert) throws ProxyNotActivatedException, MethodInvalidParamException { Server server = validateClientCertificate(clientcert); if (!server.isProxy()) { throw new ProxyNotActivatedException(); } SystemManager.deactivateProxy(server); return 1; }
/** * Deactivates the system identified by the given client certificate. * @param clientcert client certificate of the system. * @return 1 if the deactivation succeeded, 0 otherwise. * @throws ProxyNotActivatedException thrown if server is not a proxy. * @throws MethodInvalidParamException thrown if certificate is invalid. * * @xmlrpc.doc Deactivates the proxy identified by the given client * certificate i.e. systemid file. * @xmlrpc.param #param_desc("string", "systemid", "systemid file") * @xmlrpc.returntype #return_int_success() */
Deactivates the system identified by the given client certificate
deactivateProxy
{ "repo_name": "wraiden/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java", "license": "gpl-2.0", "size": 7635 }
[ "com.redhat.rhn.domain.server.Server", "com.redhat.rhn.frontend.xmlrpc.MethodInvalidParamException", "com.redhat.rhn.frontend.xmlrpc.ProxyNotActivatedException", "com.redhat.rhn.manager.system.SystemManager" ]
import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.frontend.xmlrpc.MethodInvalidParamException; import com.redhat.rhn.frontend.xmlrpc.ProxyNotActivatedException; import com.redhat.rhn.manager.system.SystemManager;
import com.redhat.rhn.domain.server.*; import com.redhat.rhn.frontend.xmlrpc.*; import com.redhat.rhn.manager.system.*;
[ "com.redhat.rhn" ]
com.redhat.rhn;
2,840,534
@SuppressWarnings("resource") @Test(expected = NullPointerException.class) public void testReaderConstructorWithNullPreferences() { new CsvListReader(reader, null); }
@SuppressWarnings(STR) @Test(expected = NullPointerException.class) void function() { new CsvListReader(reader, null); }
/** * Tests the Reader constructor with a null preference. */
Tests the Reader constructor with a null preference
testReaderConstructorWithNullPreferences
{ "repo_name": "jrw2/super-csv", "path": "super-csv/src/test/java/org/supercsv/io/CsvListReaderTest.java", "license": "apache-2.0", "size": 9486 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
231,412
public long getMiddleMillisecond(final Calendar calendar) { final long m1 = getFirstMillisecond(calendar); final long m2 = getLastMillisecond(calendar); return m1 + (m2 - m1) / 2; }
long function(final Calendar calendar) { final long m1 = getFirstMillisecond(calendar); final long m2 = getLastMillisecond(calendar); return m1 + (m2 - m1) / 2; }
/** * Returns the millisecond closest to the middle of the time period, * evaluated using the supplied calendar (which incorporates a timezone). * * @param calendar the calendar. * * @return The middle millisecond. */
Returns the millisecond closest to the middle of the time period, evaluated using the supplied calendar (which incorporates a timezone)
getMiddleMillisecond
{ "repo_name": "simeshev/parabuild-ci", "path": "3rdparty/jfreechart0921/source/org/jfree/data/time/RegularTimePeriod.java", "license": "lgpl-3.0", "size": 7579 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
2,760,593
EAttribute getMaterial_MaterialFiles();
EAttribute getMaterial_MaterialFiles();
/** * Returns the meta object for the attribute list '{@link org.eclipse.january.geometry.Material#getMaterialFiles <em>Material Files</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Material Files</em>'. * @see org.eclipse.january.geometry.Material#getMaterialFiles() * @see #getMaterial() * @generated */
Returns the meta object for the attribute list '<code>org.eclipse.january.geometry.Material#getMaterialFiles Material Files</code>'.
getMaterial_MaterialFiles
{ "repo_name": "jarrah42/eavp", "path": "org.eclipse.january.geometry/src/org/eclipse/january/geometry/GeometryPackage.java", "license": "epl-1.0", "size": 160105 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,591,364
private static void findProtoTypesRecurse(SoyType type, SortedSet<String> protoTypes) { if (type instanceof SoyProtoType) { protoTypes.add(((SoyProtoType) type).getDescriptorExpression()); } else { switch (type.getKind()) { case UNION: for (SoyType member: ((UnionType) type).getMembers()) { findProtoTypesRecurse(member, protoTypes); } break; case LIST: { ListType listType = (ListType) type; findProtoTypesRecurse(listType.getElementType(), protoTypes); break; } case MAP: { MapType mapType = (MapType) type; findProtoTypesRecurse(mapType.getKeyType(), protoTypes); findProtoTypesRecurse(mapType.getValueType(), protoTypes); break; } case RECORD: { RecordType recordType = (RecordType) type; for (SoyType fieldType : recordType.getMembers().values()) { findProtoTypesRecurse(fieldType, protoTypes); } break; } } } }
static void function(SoyType type, SortedSet<String> protoTypes) { if (type instanceof SoyProtoType) { protoTypes.add(((SoyProtoType) type).getDescriptorExpression()); } else { switch (type.getKind()) { case UNION: for (SoyType member: ((UnionType) type).getMembers()) { findProtoTypesRecurse(member, protoTypes); } break; case LIST: { ListType listType = (ListType) type; findProtoTypesRecurse(listType.getElementType(), protoTypes); break; } case MAP: { MapType mapType = (MapType) type; findProtoTypesRecurse(mapType.getKeyType(), protoTypes); findProtoTypesRecurse(mapType.getValueType(), protoTypes); break; } case RECORD: { RecordType recordType = (RecordType) type; for (SoyType fieldType : recordType.getMembers().values()) { findProtoTypesRecurse(fieldType, protoTypes); } break; } } } }
/** * Recursively search for protocol buffer types within the given type. * @param type The type to search. * @param protoTypes Output set. */
Recursively search for protocol buffer types within the given type
findProtoTypesRecurse
{ "repo_name": "atul-bhouraskar/closure-templates", "path": "java/src/com/google/template/soy/parseinfo/passes/GenerateParseInfoVisitor.java", "license": "apache-2.0", "size": 37171 }
[ "com.google.template.soy.types.SoyType", "com.google.template.soy.types.aggregate.ListType", "com.google.template.soy.types.aggregate.MapType", "com.google.template.soy.types.aggregate.RecordType", "com.google.template.soy.types.aggregate.UnionType", "com.google.template.soy.types.proto.SoyProtoType", "java.util.SortedSet" ]
import com.google.template.soy.types.SoyType; import com.google.template.soy.types.aggregate.ListType; import com.google.template.soy.types.aggregate.MapType; import com.google.template.soy.types.aggregate.RecordType; import com.google.template.soy.types.aggregate.UnionType; import com.google.template.soy.types.proto.SoyProtoType; import java.util.SortedSet;
import com.google.template.soy.types.*; import com.google.template.soy.types.aggregate.*; import com.google.template.soy.types.proto.*; import java.util.*;
[ "com.google.template", "java.util" ]
com.google.template; java.util;
72,357
public static String[] toStringArray(Enumeration<String> enumeration) { if (enumeration == null) { return null; } List<String> list = Collections.list(enumeration); return list.toArray(new String[list.size()]); }
static String[] function(Enumeration<String> enumeration) { if (enumeration == null) { return null; } List<String> list = Collections.list(enumeration); return list.toArray(new String[list.size()]); }
/** * Copy the given Enumeration into a String array. * The Enumeration must contain String elements only. * @param enumeration the Enumeration to copy * @return the String array ({@code null} if the passed-in * Enumeration was {@code null}) */
Copy the given Enumeration into a String array. The Enumeration must contain String elements only
toStringArray
{ "repo_name": "cnlinjie/infrastructure", "path": "util/src/main/java/com/github/cnlinjie/infrastructure/util/spring/StringUtils.java", "license": "apache-2.0", "size": 39809 }
[ "java.util.Collections", "java.util.Enumeration", "java.util.List" ]
import java.util.Collections; import java.util.Enumeration; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,370,054
public ServiceFuture<Void> getEntityTagAsync(String resourceGroupName, String serviceName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String serviceName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromHeaderResponse(getEntityTagWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); }
/** * Gets the entity state (Etag) version of the Global policy definition in the Api Management service. * * @param resourceGroupName The name of the resource group. * @param serviceName The name of the API Management service. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Gets the entity state (Etag) version of the Global policy definition in the Api Management service
getEntityTagAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/apimanagement/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/apimanagement/v2018_06_01_preview/implementation/PolicysInner.java", "license": "mit", "size": 37557 }
[ "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;
2,340,992
@Test public void isOneToManyAutoMerge() { Assert.assertFalse(JpaProviderFactory.getInstance().getImplementation().isOneToManyAutoMerge()); }
void function() { Assert.assertFalse(JpaProviderFactory.getInstance().getImplementation().isOneToManyAutoMerge()); }
/** * Test isOneToManyAutoMerge() method. */
Test isOneToManyAutoMerge() method
isOneToManyAutoMerge
{ "repo_name": "qjafcunuas/jbromo", "path": "jbromo-dao/jbromo-dao-jpa/jbromo-dao-jpa-container/jbromo-dao-jpa-container-openjpa/src/test/java/org/jbromo/dao/jpa/container/openjpa/JpaOpenJPAProviderTest.java", "license": "apache-2.0", "size": 3269 }
[ "org.jbromo.dao.jpa.container.common.JpaProviderFactory", "org.junit.Assert" ]
import org.jbromo.dao.jpa.container.common.JpaProviderFactory; import org.junit.Assert;
import org.jbromo.dao.jpa.container.common.*; import org.junit.*;
[ "org.jbromo.dao", "org.junit" ]
org.jbromo.dao; org.junit;
2,134,487
@SuppressLint("NewApi") public static File getExternalCacheDir(Context context) { if (hasExternalCacheDir()) { return context.getExternalCacheDir(); } // Anterior a Froyo necesitamos construir el directorio de cache externa nosotros mismos final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
@SuppressLint(STR) static File function(Context context) { if (hasExternalCacheDir()) { return context.getExternalCacheDir(); } final String cacheDir = STR + context.getPackageName() + STR; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
/** * Devuelve el directorio de cache de la app. * * @param context El contexto a usar * @return El directorio de cache externa */
Devuelve el directorio de cache de la app
getExternalCacheDir
{ "repo_name": "Android-Hispano/FotoCach", "path": "src/android/hispano/fotocach/utils/Utils.java", "license": "apache-2.0", "size": 4275 }
[ "android.annotation.SuppressLint", "android.content.Context", "android.os.Environment", "java.io.File" ]
import android.annotation.SuppressLint; import android.content.Context; import android.os.Environment; import java.io.File;
import android.annotation.*; import android.content.*; import android.os.*; import java.io.*;
[ "android.annotation", "android.content", "android.os", "java.io" ]
android.annotation; android.content; android.os; java.io;
2,625,335
XSComplexTypeDecl traverseLocal(Element complexTypeNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar) { Object[] attrValues = fAttrChecker.checkAttributes(complexTypeNode, false, schemaDoc); String complexTypeName = genAnonTypeName(complexTypeNode); contentBackup(); XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode, complexTypeName, attrValues, schemaDoc, grammar); contentRestore(); // need to add the type to the grammar for later constraint checking grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode)); type.setIsAnonymous(); fAttrChecker.returnAttrArray(attrValues, schemaDoc); return type; }
XSComplexTypeDecl traverseLocal(Element complexTypeNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar) { Object[] attrValues = fAttrChecker.checkAttributes(complexTypeNode, false, schemaDoc); String complexTypeName = genAnonTypeName(complexTypeNode); contentBackup(); XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode, complexTypeName, attrValues, schemaDoc, grammar); contentRestore(); grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode)); type.setIsAnonymous(); fAttrChecker.returnAttrArray(attrValues, schemaDoc); return type; }
/** * Traverse local complexType declarations * * @param Element * @param XSDocumentInfo * @param SchemaGrammar * @return XSComplexTypeDecl */
Traverse local complexType declarations
traverseLocal
{ "repo_name": "jimma/xerces", "path": "src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java", "license": "apache-2.0", "size": 60880 }
[ "org.apache.xerces.impl.xs.SchemaGrammar", "org.apache.xerces.impl.xs.XSComplexTypeDecl", "org.w3c.dom.Element" ]
import org.apache.xerces.impl.xs.SchemaGrammar; import org.apache.xerces.impl.xs.XSComplexTypeDecl; import org.w3c.dom.Element;
import org.apache.xerces.impl.xs.*; import org.w3c.dom.*;
[ "org.apache.xerces", "org.w3c.dom" ]
org.apache.xerces; org.w3c.dom;
433,674
private void securityCheck(int id, int requiredRights) throws AcsJNoPermissionEx { try { // check if already shutdown if (id != this.getHandle() && shutdown.get()) { // already shutdown AcsJNoPermissionEx npe = new AcsJNoPermissionEx(); npe.setID(HandleHelper.toString(id)); npe.setReason("Manager in shutdown state."); throw npe; } // parse handle part int handle = id & HANDLE_MASK; int grantedRights = 0; boolean invalidHandle = true; switch (id & TYPE_MASK) { case CONTAINER_MASK: synchronized (containers) { if (containers.isAllocated(handle)) { ContainerInfo info = (ContainerInfo)containers.get(handle); if (info.getHandle() == id) invalidHandle = false; grantedRights = CONTAINER_RIGHTS; } } break; case CLIENT_MASK: synchronized (clients) { if (clients.isAllocated(handle)) { ClientInfo info = (ClientInfo)clients.get(handle); if (info.getHandle() == id) invalidHandle = false; grantedRights = info.getAccessRights(); } } break; case ADMINISTRATOR_MASK: synchronized (administrators) { if (administrators.isAllocated(handle)) { ClientInfo info = (ClientInfo)administrators.get(handle); if (info.getHandle() == id) invalidHandle = false; grantedRights = info.getAccessRights(); } } break; case COMPONENT_MASK: componentsLock.lock(); try { if (components.isAllocated(handle)) { ComponentInfo info = (ComponentInfo)components.get(handle); if (info != null && info.getHandle() == id) invalidHandle = false; grantedRights = AccessRights.REGISTER_COMPONENT; } } finally { componentsLock.unlock(); } break; case MANAGER_MASK: invalidHandle = false; grantedRights = AccessRights.REGISTER_COMPONENT | AccessRights.SHUTDOWN_SYSTEM | AccessRights.INTROSPECT_MANAGER; break; } if (invalidHandle) { // NO_PERMISSION AcsJNoPermissionEx npe = new AcsJNoPermissionEx(); npe.setID(HandleHelper.toString(id)); HandleMonitorEntry hme = getHandleReleaseLog(id); if (hme != null) { final String timeISO = IsoDateFormat.formatDate(new Date(hme.timestamp)); switch (hme.reason) { case REMOVED: npe.setReason("Invalid handle, handle was properly removed at " + timeISO + "."); break; case TIMEOUT: npe.setReason("Invalid handle, handle was removed due to timeout at " + timeISO + "."); break; case DISAPPEARED: npe.setReason("Invalid handle, handle was removed due to client/container/component disappearing at " + timeISO + "."); break; } } else { if (enableHandleMonitoringDurationMins <= 0) npe.setReason("Invalid handle, handle was never known."); else npe.setReason("Invalid handle, handle is not known for the last " + enableHandleMonitoringDurationMins + " minutes."); } throw npe; } if ((grantedRights & requiredRights) != requiredRights) { // NO_PERMISSION AcsJNoPermissionEx npe = new AcsJNoPermissionEx(); npe.setID(HandleHelper.toString(id)); npe.setReason("Insufficient rights."); throw npe; } } catch (AcsJNoPermissionEx ex) { logger.log(AcsLogLevel.DELOUSE, "securityCheck fails with AcsJNoPermissionEx:", ex); throw ex; } }
void function(int id, int requiredRights) throws AcsJNoPermissionEx { try { if (id != this.getHandle() && shutdown.get()) { AcsJNoPermissionEx npe = new AcsJNoPermissionEx(); npe.setID(HandleHelper.toString(id)); npe.setReason(STR); throw npe; } int handle = id & HANDLE_MASK; int grantedRights = 0; boolean invalidHandle = true; switch (id & TYPE_MASK) { case CONTAINER_MASK: synchronized (containers) { if (containers.isAllocated(handle)) { ContainerInfo info = (ContainerInfo)containers.get(handle); if (info.getHandle() == id) invalidHandle = false; grantedRights = CONTAINER_RIGHTS; } } break; case CLIENT_MASK: synchronized (clients) { if (clients.isAllocated(handle)) { ClientInfo info = (ClientInfo)clients.get(handle); if (info.getHandle() == id) invalidHandle = false; grantedRights = info.getAccessRights(); } } break; case ADMINISTRATOR_MASK: synchronized (administrators) { if (administrators.isAllocated(handle)) { ClientInfo info = (ClientInfo)administrators.get(handle); if (info.getHandle() == id) invalidHandle = false; grantedRights = info.getAccessRights(); } } break; case COMPONENT_MASK: componentsLock.lock(); try { if (components.isAllocated(handle)) { ComponentInfo info = (ComponentInfo)components.get(handle); if (info != null && info.getHandle() == id) invalidHandle = false; grantedRights = AccessRights.REGISTER_COMPONENT; } } finally { componentsLock.unlock(); } break; case MANAGER_MASK: invalidHandle = false; grantedRights = AccessRights.REGISTER_COMPONENT AccessRights.SHUTDOWN_SYSTEM AccessRights.INTROSPECT_MANAGER; break; } if (invalidHandle) { AcsJNoPermissionEx npe = new AcsJNoPermissionEx(); npe.setID(HandleHelper.toString(id)); HandleMonitorEntry hme = getHandleReleaseLog(id); if (hme != null) { final String timeISO = IsoDateFormat.formatDate(new Date(hme.timestamp)); switch (hme.reason) { case REMOVED: npe.setReason(STR + timeISO + "."); break; case TIMEOUT: npe.setReason(STR + timeISO + "."); break; case DISAPPEARED: npe.setReason(STR + timeISO + "."); break; } } else { if (enableHandleMonitoringDurationMins <= 0) npe.setReason(STR); else npe.setReason(STR + enableHandleMonitoringDurationMins + STR); } throw npe; } if ((grantedRights & requiredRights) != requiredRights) { AcsJNoPermissionEx npe = new AcsJNoPermissionEx(); npe.setID(HandleHelper.toString(id)); npe.setReason(STR); throw npe; } } catch (AcsJNoPermissionEx ex) { logger.log(AcsLogLevel.DELOUSE, STR, ex); throw ex; } }
/** * Performs security check on given handle and if check if owner has <code>rights</code> permissions granted. * * Validating means checking key part (KEY_MASK) of the handle. * * @param id handle to be checked. * @param rights checks if owner of the handle has this permissions granted, can be 0. * @throws AcsJNoPermissionEx thrown if handle is not valid or handle owner has not enough permissions */
Performs security check on given handle and if check if owner has <code>rights</code> permissions granted. Validating means checking key part (KEY_MASK) of the handle
securityCheck
{ "repo_name": "csrg-utfsm/acscb", "path": "LGPL/CommonSoftware/jmanager/src/com/cosylab/acs/maci/manager/ManagerImpl.java", "license": "mit", "size": 309850 }
[ "com.cosylab.acs.maci.AccessRights", "com.cosylab.acs.maci.ClientInfo", "com.cosylab.acs.maci.ComponentInfo", "com.cosylab.acs.maci.ContainerInfo", "com.cosylab.acs.maci.HandleHelper", "java.util.Date" ]
import com.cosylab.acs.maci.AccessRights; import com.cosylab.acs.maci.ClientInfo; import com.cosylab.acs.maci.ComponentInfo; import com.cosylab.acs.maci.ContainerInfo; import com.cosylab.acs.maci.HandleHelper; import java.util.Date;
import com.cosylab.acs.maci.*; import java.util.*;
[ "com.cosylab.acs", "java.util" ]
com.cosylab.acs; java.util;
2,046,871
EDataType getEntityAttributeList();
EDataType getEntityAttributeList();
/** * Returns the meta object for data type '{@link java.util.List <em>Entity Attribute List</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for data type '<em>Entity Attribute List</em>'. * @see java.util.List * @model instanceClass="java.util.List<org.lunifera.dsl.semantic.entity.LEntityAttribute>" * @generated */
Returns the meta object for data type '<code>java.util.List Entity Attribute List</code>'.
getEntityAttributeList
{ "repo_name": "lunifera/lunifera-dsl", "path": "org.lunifera.dsl.semantic.entity/emf-gen/org/lunifera/dsl/semantic/entity/LunEntityPackage.java", "license": "epl-1.0", "size": 119334 }
[ "org.eclipse.emf.ecore.EDataType" ]
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,025,764
public Date getLoggedInTime(User loggedInUser, String login) throws UserNeverLoggedInException { User target = XmlRpcUserHelper.getInstance().lookupTargetUser( loggedInUser, login); Date d = target.getLastLoggedIn(); if (d != null) { return d; } throw new UserNeverLoggedInException(); }
Date function(User loggedInUser, String login) throws UserNeverLoggedInException { User target = XmlRpcUserHelper.getInstance().lookupTargetUser( loggedInUser, login); Date d = target.getLastLoggedIn(); if (d != null) { return d; } throw new UserNeverLoggedInException(); }
/** * Returns the last logged in time of the given user. * @param loggedInUser The current user * in user. * @param login The login of the user. * @return last logged in time * @throws UserNeverLoggedInException if the given user has never logged in. * * @xmlrpc.doc Returns the time user last logged in. * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param_desc("string", "login", "User's login name.") * @xmlrpc.returntype dateTime.iso8601 */
Returns the last logged in time of the given user
getLoggedInTime
{ "repo_name": "moio/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/user/UserHandler.java", "license": "gpl-2.0", "size": 51229 }
[ "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.xmlrpc.UserNeverLoggedInException", "java.util.Date" ]
import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.xmlrpc.UserNeverLoggedInException; import java.util.Date;
import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.xmlrpc.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
1,618,041
StendhalCursor getCursor(); void applyChanges();
StendhalCursor getCursor(); void applyChanges();
/** * Update the view with the changes in entity. */
Update the view with the changes in entity
applyChanges
{ "repo_name": "sourceress-project/archestica", "path": "src/games/stendhal/client/gui/j2d/entity/EntityView.java", "license": "gpl-2.0", "size": 2854 }
[ "games.stendhal.client.gui.styled.cursor.StendhalCursor" ]
import games.stendhal.client.gui.styled.cursor.StendhalCursor;
import games.stendhal.client.gui.styled.cursor.*;
[ "games.stendhal.client" ]
games.stendhal.client;
213,175
@Override protected void initialize() { Properties props; String[] cmds; List<AbstractOutputGenerator> generators; AbstractOutputGenerator generator; int i; super.initialize(); props = InvestigatorPanel.getProperties(); m_CurrentEvaluation = null; m_CurrentClassifier = null; m_Stopping = false; try { cmds = OptionUtils.splitOptions( props.getProperty("Classify.OutputGenerators", TextStatistics.class.getName())); } catch (Exception e) { ConsolePanel.getSingleton().append( Level.SEVERE, "Failed to parse output generators:\n" + props.getProperty("Classify.OutputGenerators"), e); cmds = new String[]{TextStatistics.class.getName()}; } generators = new ArrayList<>(); for (i = 0; i < cmds.length; i++) { try { generator = (AbstractOutputGenerator) OptionUtils.forAnyCommandLine(AbstractOutputGenerator.class, cmds[i]); generators.add(generator); } catch (Exception e) { ConsolePanel.getSingleton().append( Level.SEVERE, "Failed to instantiate output generator:\n" + cmds[i], e); } } m_OutputGenerators = generators.toArray(new AbstractOutputGenerator[0]); }
void function() { Properties props; String[] cmds; List<AbstractOutputGenerator> generators; AbstractOutputGenerator generator; int i; super.initialize(); props = InvestigatorPanel.getProperties(); m_CurrentEvaluation = null; m_CurrentClassifier = null; m_Stopping = false; try { cmds = OptionUtils.splitOptions( props.getProperty(STR, TextStatistics.class.getName())); } catch (Exception e) { ConsolePanel.getSingleton().append( Level.SEVERE, STR + props.getProperty(STR), e); cmds = new String[]{TextStatistics.class.getName()}; } generators = new ArrayList<>(); for (i = 0; i < cmds.length; i++) { try { generator = (AbstractOutputGenerator) OptionUtils.forAnyCommandLine(AbstractOutputGenerator.class, cmds[i]); generators.add(generator); } catch (Exception e) { ConsolePanel.getSingleton().append( Level.SEVERE, STR + cmds[i], e); } } m_OutputGenerators = generators.toArray(new AbstractOutputGenerator[0]); }
/** * Initializes the members. */
Initializes the members
initialize
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-weka/src/main/java/adams/gui/tools/wekainvestigator/tab/ClassifyTab.java", "license": "gpl-3.0", "size": 37828 }
[ "java.util.ArrayList", "java.util.List", "java.util.logging.Level" ]
import java.util.ArrayList; import java.util.List; import java.util.logging.Level;
import java.util.*; import java.util.logging.*;
[ "java.util" ]
java.util;
1,917,521
public int requestLiquid(Object source, FluidStack request);
int function(Object source, FluidStack request);
/** * Requests liquid from this object. * * Is not used by the Liquid Unloader to drain carts, the traditional * ILiquidContainer is used for that. * * @param source The Object requesting the liquid, used to prevent request * loops in trains * @param quantity The quantity requested * @param id The liquid type requested * @return the liquid provided */
Requests liquid from this object. Is not used by the Liquid Unloader to drain carts, the traditional ILiquidContainer is used for that
requestLiquid
{ "repo_name": "Dasug/rail-scanner", "path": "src/main/java/mods/railcraft/api/carts/ILiquidTransfer.java", "license": "mit", "size": 1852 }
[ "net.minecraftforge.fluids.FluidStack" ]
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.*;
[ "net.minecraftforge.fluids" ]
net.minecraftforge.fluids;
194,740
@ViewLifecycleRestriction @BeanTagAttribute public List<Component> getInlineComponents() { return inlineComponents; }
List<Component> function() { return inlineComponents; }
/** * Gets the inlineComponents used by index in a Label that has rich message component index tags in its labelText * * @return the Label's inlineComponents */
Gets the inlineComponents used by index in a Label that has rich message component index tags in its labelText
getInlineComponents
{ "repo_name": "mztaylor/rice-git", "path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/element/Label.java", "license": "apache-2.0", "size": 9804 }
[ "java.util.List", "org.kuali.rice.krad.uif.component.Component" ]
import java.util.List; import org.kuali.rice.krad.uif.component.Component;
import java.util.*; import org.kuali.rice.krad.uif.component.*;
[ "java.util", "org.kuali.rice" ]
java.util; org.kuali.rice;
2,307,969
public static requestedMeasurements_r13Type fromPerUnaligned(byte[] encodedBytes) { requestedMeasurements_r13Type result = new requestedMeasurements_r13Type(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; }
static requestedMeasurements_r13Type function(byte[] encodedBytes) { requestedMeasurements_r13Type result = new requestedMeasurements_r13Type(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; }
/** * Creates a new requestedMeasurements_r13Type from encoded stream. */
Creates a new requestedMeasurements_r13Type from encoded stream
fromPerUnaligned
{ "repo_name": "google/supl-client", "path": "src/main/java/com/google/location/suplclient/asn1/supl2/lpp/BT_RequestLocationInformation_r13.java", "license": "apache-2.0", "size": 9428 }
[ "com.google.location.suplclient.asn1.base.BitStreamReader" ]
import com.google.location.suplclient.asn1.base.BitStreamReader;
import com.google.location.suplclient.asn1.base.*;
[ "com.google.location" ]
com.google.location;
2,055,409
public void setEmailNotificationSupport( final EmailNotificationSupport emailNotificationSupport) { }
void function( final EmailNotificationSupport emailNotificationSupport) { }
/** * Sets the email notification support. * * @param emailNotificationSupport * the new email notification support */
Sets the email notification support
setEmailNotificationSupport
{ "repo_name": "alarulrajan/CodeFest", "path": "src/net/sf/xplanner/email/EmailHelper.java", "license": "gpl-2.0", "size": 5611 }
[ "com.technoetic.xplanner.mail.EmailNotificationSupport" ]
import com.technoetic.xplanner.mail.EmailNotificationSupport;
import com.technoetic.xplanner.mail.*;
[ "com.technoetic.xplanner" ]
com.technoetic.xplanner;
353,091
@Test public void testDetachedJobSubmission() throws Exception { final TestJobSubmitHandler testJobSubmitHandler = new TestJobSubmitHandler(); try (TestRestServerEndpoint restServerEndpoint = createRestServerEndpoint( testJobSubmitHandler)) { RestClusterClient<?> restClusterClient = createRestClusterClient(restServerEndpoint.getServerAddress().getPort()); try { restClusterClient.setDetached(true); final JobSubmissionResult jobSubmissionResult = restClusterClient.submitJob(jobGraph, ClassLoader.getSystemClassLoader()); // if the detached mode didn't work, then we would not reach this point because the execution result // retrieval would have failed. assertThat(jobSubmissionResult, is(not(instanceOf(JobExecutionResult.class)))); assertThat(jobSubmissionResult.getJobID(), is(jobId)); } finally { restClusterClient.shutdown(); } } } private class TestJobSubmitHandler extends TestHandler<JobSubmitRequestBody, JobSubmitResponseBody, EmptyMessageParameters> { private volatile boolean jobSubmitted = false; private TestJobSubmitHandler() { super(JobSubmitHeaders.getInstance()); }
void function() throws Exception { final TestJobSubmitHandler testJobSubmitHandler = new TestJobSubmitHandler(); try (TestRestServerEndpoint restServerEndpoint = createRestServerEndpoint( testJobSubmitHandler)) { RestClusterClient<?> restClusterClient = createRestClusterClient(restServerEndpoint.getServerAddress().getPort()); try { restClusterClient.setDetached(true); final JobSubmissionResult jobSubmissionResult = restClusterClient.submitJob(jobGraph, ClassLoader.getSystemClassLoader()); assertThat(jobSubmissionResult, is(not(instanceOf(JobExecutionResult.class)))); assertThat(jobSubmissionResult.getJobID(), is(jobId)); } finally { restClusterClient.shutdown(); } } } private class TestJobSubmitHandler extends TestHandler<JobSubmitRequestBody, JobSubmitResponseBody, EmptyMessageParameters> { private volatile boolean jobSubmitted = false; private TestJobSubmitHandler() { super(JobSubmitHeaders.getInstance()); }
/** * Tests that we can submit a jobGraph in detached mode. */
Tests that we can submit a jobGraph in detached mode
testDetachedJobSubmission
{ "repo_name": "ueshin/apache-flink", "path": "flink-clients/src/test/java/org/apache/flink/client/program/rest/RestClusterClientTest.java", "license": "apache-2.0", "size": 32550 }
[ "org.apache.flink.api.common.JobExecutionResult", "org.apache.flink.api.common.JobSubmissionResult", "org.apache.flink.runtime.rest.messages.EmptyMessageParameters", "org.apache.flink.runtime.rest.messages.job.JobSubmitHeaders", "org.apache.flink.runtime.rest.messages.job.JobSubmitRequestBody", "org.apache.flink.runtime.rest.messages.job.JobSubmitResponseBody", "org.hamcrest.Matchers", "org.junit.Assert" ]
import org.apache.flink.api.common.JobExecutionResult; import org.apache.flink.api.common.JobSubmissionResult; import org.apache.flink.runtime.rest.messages.EmptyMessageParameters; import org.apache.flink.runtime.rest.messages.job.JobSubmitHeaders; import org.apache.flink.runtime.rest.messages.job.JobSubmitRequestBody; import org.apache.flink.runtime.rest.messages.job.JobSubmitResponseBody; import org.hamcrest.Matchers; import org.junit.Assert;
import org.apache.flink.api.common.*; import org.apache.flink.runtime.rest.messages.*; import org.apache.flink.runtime.rest.messages.job.*; import org.hamcrest.*; import org.junit.*;
[ "org.apache.flink", "org.hamcrest", "org.junit" ]
org.apache.flink; org.hamcrest; org.junit;
972,552
public boolean optionMatches(String namePattern, String valuePattern) { Matcher nameMatcher = Pattern.compile(namePattern).matcher(""); Matcher valueMatcher = Pattern.compile(valuePattern).matcher(""); for (Map.Entry<ProtoMember, Object> entry : map.entrySet()) { if (nameMatcher.reset(entry.getKey().member()).matches() && valueMatcher.reset(String.valueOf(entry.getValue())).matches()) { return true; } } return false; }
boolean function(String namePattern, String valuePattern) { Matcher nameMatcher = Pattern.compile(namePattern).matcher(STR"); for (Map.Entry<ProtoMember, Object> entry : map.entrySet()) { if (nameMatcher.reset(entry.getKey().member()).matches() && valueMatcher.reset(String.valueOf(entry.getValue())).matches()) { return true; } } return false; }
/** * Returns true if any of the options in {@code options} matches both of the regular expressions * provided: its name matches the option's name and its value matches the option's value. */
Returns true if any of the options in options matches both of the regular expressions provided: its name matches the option's name and its value matches the option's value
optionMatches
{ "repo_name": "drakelord/wire", "path": "wire-schema/src/main/java/com/squareup/wire/schema/Options.java", "license": "apache-2.0", "size": 13091 }
[ "java.util.Map", "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.*; import java.util.regex.*;
[ "java.util" ]
java.util;
906,393
public AsyncRequest createPostRequest(String url, List<Object> dtoArray, boolean async) { return createRequest(RequestBuilder.POST, url, dtoArray, async); }
AsyncRequest function(String url, List<Object> dtoArray, boolean async) { return createRequest(RequestBuilder.POST, url, dtoArray, async); }
/** * Creates new POST request to the specified {@code url} with the provided {@code data}. * * @param url * request URL * @param dtoArray * the array of DTO to send as body of the request. Must contain objects that implement {@link * org.eclipse.che.ide.dto.JsonSerializable} interface. May be {@code null}. * @param async * if <b>true</b> - request will be sent in asynchronous mode * @return new {@link AsyncRequest} instance to send POST request */
Creates new POST request to the specified url with the provided data
createPostRequest
{ "repo_name": "kaloyan-raev/che", "path": "ide/commons-gwt/src/main/java/org/eclipse/che/ide/rest/AsyncRequestFactory.java", "license": "epl-1.0", "size": 8676 }
[ "com.google.gwt.http.client.RequestBuilder", "java.util.List" ]
import com.google.gwt.http.client.RequestBuilder; import java.util.List;
import com.google.gwt.http.client.*; import java.util.*;
[ "com.google.gwt", "java.util" ]
com.google.gwt; java.util;
899,468
final public static int getViewHeight(View view){ view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); return view.getMeasuredHeight(); } final static float LOW_LEVEL=0.75f; final static float MEDIUM_LEVEL=1.0f; final static float HIGH_LEVEL=1.5f; final static float X_HIGH_LEVEL = 2.0f; final static float XX_HIGH_LEVEL = 3.0f; final static float XXX_HIGH_LEVEL = 4.0f;
final static int function(View view){ view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); return view.getMeasuredHeight(); } final static float LOW_LEVEL=0.75f; final static float MEDIUM_LEVEL=1.0f; final static float HIGH_LEVEL=1.5f; final static float X_HIGH_LEVEL = 2.0f; final static float XX_HIGH_LEVEL = 3.0f; final static float XXX_HIGH_LEVEL = 4.0f;
/** * Get view height * This is not applicable if you set the view height in params * @param view The view that will get the height * @return View height */
Get view height This is not applicable if you set the view height in params
getViewHeight
{ "repo_name": "lauroabogne/android-table-with-fixed-header-and-column", "path": "app/src/main/java/table_1/ViewSizeUtils.java", "license": "gpl-3.0", "size": 3128 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,670,692
public void pushToken(Token<TokenType> token) { tokenStack.push(Objects.requireNonNull(token)); }
void function(Token<TokenType> token) { tokenStack.push(Objects.requireNonNull(token)); }
/** * Pushes the given token onto the token stack. * * @param token * the token to push onto the token stack */
Pushes the given token onto the token stack
pushToken
{ "repo_name": "lbeurerkellner/n4js", "path": "plugins/org.eclipse.n4js.utils/src/org/eclipse/n4js/utils/SimpleParser.java", "license": "epl-1.0", "size": 23775 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
1,754,516
@Deprecated void createTemporaryQueue(SimpleString address, SimpleString queueName) throws ActiveMQException;
void createTemporaryQueue(SimpleString address, SimpleString queueName) throws ActiveMQException;
/** * Creates a <em>temporary</em> queue. * * @param address the queue will be bound to this address * @param queueName the name of the queue * @throws ActiveMQException in an exception occurs while creating the queue */
Creates a temporary queue
createTemporaryQueue
{ "repo_name": "iweiss/activemq-artemis", "path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java", "license": "apache-2.0", "size": 50872 }
[ "org.apache.activemq.artemis.api.core.ActiveMQException", "org.apache.activemq.artemis.api.core.SimpleString" ]
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.*;
[ "org.apache.activemq" ]
org.apache.activemq;
585,913
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { String name = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName(); StopWatch stopWatch = new StopWatch(name); Object returnValue = null; boolean exitThroughException = false; try { stopWatch.start(name); writeToLog(logger, replacePlaceholders(this.enterMessage, invocation, null, null, -1)); returnValue = invocation.proceed(); return returnValue; } catch (Throwable ex) { if(stopWatch.isRunning()) { stopWatch.stop(); } exitThroughException = true; writeToLog(logger, replacePlaceholders(this.exceptionMessage, invocation, null, ex, stopWatch.getTotalTimeMillis()), ex); throw ex; } finally { if (!exitThroughException) { if(stopWatch.isRunning()) { stopWatch.stop(); } writeToLog(logger, replacePlaceholders(this.exitMessage, invocation, returnValue, null, stopWatch.getTotalTimeMillis())); } } }
Object function(MethodInvocation invocation, Log logger) throws Throwable { String name = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName(); StopWatch stopWatch = new StopWatch(name); Object returnValue = null; boolean exitThroughException = false; try { stopWatch.start(name); writeToLog(logger, replacePlaceholders(this.enterMessage, invocation, null, null, -1)); returnValue = invocation.proceed(); return returnValue; } catch (Throwable ex) { if(stopWatch.isRunning()) { stopWatch.stop(); } exitThroughException = true; writeToLog(logger, replacePlaceholders(this.exceptionMessage, invocation, null, ex, stopWatch.getTotalTimeMillis()), ex); throw ex; } finally { if (!exitThroughException) { if(stopWatch.isRunning()) { stopWatch.stop(); } writeToLog(logger, replacePlaceholders(this.exitMessage, invocation, returnValue, null, stopWatch.getTotalTimeMillis())); } } }
/** * Writes a log message before the invocation based on the value of <code>enterMessage</code>. * If the invocation succeeds, then a log message is written on exit based on the value * <code>exitMessage</code>. If an exception occurs during invocation, then a message is * written based on the value of <code>exceptionMessage</code>. * @see #setEnterMessage * @see #setExitMessage * @see #setExceptionMessage */
Writes a log message before the invocation based on the value of <code>enterMessage</code>. If the invocation succeeds, then a log message is written on exit based on the value <code>exitMessage</code>. If an exception occurs during invocation, then a message is written based on the value of <code>exceptionMessage</code>
invokeUnderTrace
{ "repo_name": "mattxia/spring-2.5-analysis", "path": "src/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java", "license": "apache-2.0", "size": 17562 }
[ "org.aopalliance.intercept.MethodInvocation", "org.apache.commons.logging.Log", "org.springframework.util.StopWatch" ]
import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; import org.springframework.util.StopWatch;
import org.aopalliance.intercept.*; import org.apache.commons.logging.*; import org.springframework.util.*;
[ "org.aopalliance.intercept", "org.apache.commons", "org.springframework.util" ]
org.aopalliance.intercept; org.apache.commons; org.springframework.util;
1,282,812
public void updateMorphTime(float delta) { for (int i=0;i<figures.size();i++) { Figure figure = (Figure) figures.get(i); MorphShape shape = (MorphShape) figure.getShape(); shape.updateMorphTime(delta); } }
void function(float delta) { for (int i=0;i<figures.size();i++) { Figure figure = (Figure) figures.get(i); MorphShape shape = (MorphShape) figure.getShape(); shape.updateMorphTime(delta); } }
/** * Update the morph time index by the amount specified * * @param delta The amount to update the morph by */
Update the morph time index by the amount specified
updateMorphTime
{ "repo_name": "SenshiSentou/SourceFight", "path": "slick_dev/tags/Slick0.19/src/org/newdawn/slick/svg/SVGMorph.java", "license": "bsd-2-clause", "size": 3291 }
[ "org.newdawn.slick.geom.MorphShape" ]
import org.newdawn.slick.geom.MorphShape;
import org.newdawn.slick.geom.*;
[ "org.newdawn.slick" ]
org.newdawn.slick;
2,428,600
public static List<OWLOntologyChange> associateChangesWithAspects(List<OWLOntologyChange> changes, String[] currentAspects) { List<OWLOntologyChange> changesUpdated = new ArrayList<OWLOntologyChange>(); for (OWLOntologyChange change : changes) { changesUpdated.add(associateChangeWithAspects(change, currentAspects)); } return changesUpdated; }
static List<OWLOntologyChange> function(List<OWLOntologyChange> changes, String[] currentAspects) { List<OWLOntologyChange> changesUpdated = new ArrayList<OWLOntologyChange>(); for (OWLOntologyChange change : changes) { changesUpdated.add(associateChangeWithAspects(change, currentAspects)); } return changesUpdated; }
/** * replace all axioms inside axiom changes with their copies annotated with aspects * and return result as a new list of changes * * @param changes * axiom changes * @param currentAspects * IRIs of current aspects as String array * @return list of changes with updated axioms */
replace all axioms inside axiom changes with their copies annotated with aspects and return result as a new list of changes
associateChangesWithAspects
{ "repo_name": "ag-csw/aspect-owlapi", "path": "src/main/java/de/fuberlin/csw/aood/owlapi/helpers/ModificationHelper.java", "license": "gpl-3.0", "size": 7917 }
[ "java.util.ArrayList", "java.util.List", "org.semanticweb.owlapi.model.OWLOntologyChange" ]
import java.util.ArrayList; import java.util.List; import org.semanticweb.owlapi.model.OWLOntologyChange;
import java.util.*; import org.semanticweb.owlapi.model.*;
[ "java.util", "org.semanticweb.owlapi" ]
java.util; org.semanticweb.owlapi;
781,185
boolean validatePlanOfCareActivityObservationTemplateId(DiagnosticChain diagnostics, Map<Object, Object> context);
boolean validatePlanOfCareActivityObservationTemplateId(DiagnosticChain diagnostics, Map<Object, Object> context);
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * self.templateId->exists(id : datatypes::II | id.root = '2.16.840.1.113883.10.20.1.25') * @param diagnostics The chain of diagnostics to which problems are to be appended. * @param context The cache of context-specific information. * <!-- end-model-doc --> * @model annotation="http://www.eclipse.org/uml2/1.1.0/GenModel body='self.templateId->exists(id : datatypes::II | id.root = \'2.16.840.1.113883.10.20.1.25\')'" * @generated */
self.templateId->exists(id : datatypes::II | id.root = '2.16.840.1.113883.10.20.1.25')
validatePlanOfCareActivityObservationTemplateId
{ "repo_name": "drbgfc/mdht", "path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.ccd/src/org/openhealthtools/mdht/uml/cda/ccd/PlanOfCareActivityObservation.java", "license": "epl-1.0", "size": 3972 }
[ "java.util.Map", "org.eclipse.emf.common.util.DiagnosticChain" ]
import java.util.Map; import org.eclipse.emf.common.util.DiagnosticChain;
import java.util.*; import org.eclipse.emf.common.util.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
2,691,618
public void requestPreviewFrame(PreviewCallback callback) { Camera theCamera = camera; if (theCamera != null && previewing) { cameraPreviewCallback.setCallback(callback); theCamera.setOneShotPreviewCallback(cameraPreviewCallback); } }
void function(PreviewCallback callback) { Camera theCamera = camera; if (theCamera != null && previewing) { cameraPreviewCallback.setCallback(callback); theCamera.setOneShotPreviewCallback(cameraPreviewCallback); } }
/** * A single preview frame will be returned to the supplied callback. * * The thread on which this called is undefined, so a Handler should be used to post the result * to the correct thread. * * @param callback The callback to receive the preview. */
A single preview frame will be returned to the supplied callback. The thread on which this called is undefined, so a Handler should be used to post the result to the correct thread
requestPreviewFrame
{ "repo_name": "jemsnaban/zxing-android-embedded", "path": "zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraManager.java", "license": "apache-2.0", "size": 14879 }
[ "android.hardware.Camera" ]
import android.hardware.Camera;
import android.hardware.*;
[ "android.hardware" ]
android.hardware;
1,459,830
@Generated @CVariable() @MappedReturn(ObjCStringMapper.class) public static native String NSURLAuthenticationMethodHTMLForm();
@CVariable() @MappedReturn(ObjCStringMapper.class) static native String function();
/** * [@const] NSURLAuthenticationMethodHTMLForm * <p> * HTML form authentication. Applies to any protocol. */
[@const] NSURLAuthenticationMethodHTMLForm HTML form authentication. Applies to any protocol
NSURLAuthenticationMethodHTMLForm
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/foundation/c/Foundation.java", "license": "apache-2.0", "size": 156135 }
[ "org.moe.natj.c.ann.CVariable", "org.moe.natj.general.ann.MappedReturn", "org.moe.natj.objc.map.ObjCStringMapper" ]
import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper;
import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*;
[ "org.moe.natj" ]
org.moe.natj;
2,658,088
private void initialize() { frame = new JFrame(); frame.setIconImage(Toolkit .getDefaultToolkit() .getImage( NPC4.class .getResource("/images/Historias de Zagas, logo.png"))); frame.setTitle("Historias de Zagas"); frame.setBounds(100, 100, 380, 301); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.setResizable(false); frame.getContentPane().setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(135, 51, 221, 99); frame.getContentPane().add(scrollPane); JTextArea textArea = new JTextArea(); textArea.setFont(mf.MyFont(0, 13)); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); scrollPane.setViewportView(textArea); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(135, 153, 221, 99); frame.getContentPane().add(scrollPane_1); JTextArea textArea_1 = new JTextArea(); textArea_1.setWrapStyleWord(true); textArea_1.setText(""); textArea_1.setLineWrap(true); textArea_1.setFont(mf.MyFont(0, 13)); textArea_1.setEditable(false); scrollPane_1.setViewportView(textArea_1); if (JugarOnline.npc4.getMisc1().isPosesion() == true) { ArrayList<String> pos = JugarOnline.npc4.getMisc1().getPossesion().getPos(); for (int i = 0; i < pos.size(); i++) { if (pos.get(i) != ("-Propiedad-")) { if(!pos.get(i).equals("null")){ textArea_1.append(pos.get(i) + "\n"); } } } } txtNombreDelObjeto = new JTextField(); txtNombreDelObjeto.setOpaque(false); txtNombreDelObjeto.setForeground(Color.WHITE); txtNombreDelObjeto.setText("Nombre del Objeto:"); txtNombreDelObjeto.setFont(mf.MyFont(0, 13)); txtNombreDelObjeto.setEditable(false); txtNombreDelObjeto.setColumns(10); txtNombreDelObjeto.setBorder(null); txtNombreDelObjeto.setBounds(10, 20, 115, 20); frame.getContentPane().add(txtNombreDelObjeto); textField = new JTextField(); textField.setEditable(false); textField.setFont(mf.MyFont(0, 11)); textField.setColumns(10); textField.setBounds(10, 51, 115, 20); frame.getContentPane().add(textField);
void function() { frame = new JFrame(); frame.setIconImage(Toolkit .getDefaultToolkit() .getImage( NPC4.class .getResource(STR))); frame.setTitle(STR); frame.setBounds(100, 100, 380, 301); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.setResizable(false); frame.getContentPane().setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(135, 51, 221, 99); frame.getContentPane().add(scrollPane); JTextArea textArea = new JTextArea(); textArea.setFont(mf.MyFont(0, 13)); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); scrollPane.setViewportView(textArea); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(135, 153, 221, 99); frame.getContentPane().add(scrollPane_1); JTextArea textArea_1 = new JTextArea(); textArea_1.setWrapStyleWord(true); textArea_1.setText(STR-Propiedad-STRnullSTR\nSTRNombre del Objeto:"); txtNombreDelObjeto.setFont(mf.MyFont(0, 13)); txtNombreDelObjeto.setEditable(false); txtNombreDelObjeto.setColumns(10); txtNombreDelObjeto.setBorder(null); txtNombreDelObjeto.setBounds(10, 20, 115, 20); frame.getContentPane().add(txtNombreDelObjeto); textField = new JTextField(); textField.setEditable(false); textField.setFont(mf.MyFont(0, 11)); textField.setColumns(10); textField.setBounds(10, 51, 115, 20); frame.getContentPane().add(textField);
/** * Initialize the contents of the frame. */
Initialize the contents of the frame
initialize
{ "repo_name": "ZagasTales/HistoriasdeZagas", "path": "src Graf/es/thesinsprods/zagastales/juegozagas/jugar/master/npc4/InfoMisc1Jugadores.java", "license": "cc0-1.0", "size": 7247 }
[ "java.awt.Toolkit", "javax.swing.JFrame", "javax.swing.JScrollPane", "javax.swing.JTextArea", "javax.swing.JTextField" ]
import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
268,000
public void setShortDescription(String shortDescription) { this.shortDescription = shortDescription; } public static class Page extends PagedModel<DetailedAppRegistrationResource> { }
void function(String shortDescription) { this.shortDescription = shortDescription; } public static class Page extends PagedModel<DetailedAppRegistrationResource> { }
/** * Set a description for this application. * * @param shortDescription description for application */
Set a description for this application
setShortDescription
{ "repo_name": "mminella/spring-cloud-data", "path": "spring-cloud-dataflow-rest-resource/src/main/java/org/springframework/cloud/dataflow/rest/resource/DetailedAppRegistrationResource.java", "license": "apache-2.0", "size": 3338 }
[ "org.springframework.hateoas.PagedModel" ]
import org.springframework.hateoas.PagedModel;
import org.springframework.hateoas.*;
[ "org.springframework.hateoas" ]
org.springframework.hateoas;
1,539,708
public void printSubNodes(int depth) { if (SanityManager.DEBUG) { int parm; super.printSubNodes(depth); if (receiver != null) { printLabel(depth, "receiver :"); receiver.treePrint(depth + 1); } } }
void function(int depth) { if (SanityManager.DEBUG) { int parm; super.printSubNodes(depth); if (receiver != null) { printLabel(depth, STR); receiver.treePrint(depth + 1); } } }
/** * Prints the sub-nodes of this object. See QueryTreeNode.java for * how tree printing is supposed to work. * * @param depth The depth of this node in the tree */
Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work
printSubNodes
{ "repo_name": "kavin256/Derby", "path": "java/engine/org/apache/derby/impl/sql/compile/NonStaticMethodCallNode.java", "license": "apache-2.0", "size": 15300 }
[ "org.apache.derby.iapi.services.sanity.SanityManager" ]
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.services.sanity.*;
[ "org.apache.derby" ]
org.apache.derby;
1,832,235
private Long createTestRun(CuantoConnector cuanto, String cuantoProjectKey) { TestRun testRun = new TestRun(cuantoProjectKey); testRun.setDateExecuted(new Date()); testRun.setNote("Created by " + this.getClass().getSimpleName()); return cuanto.addTestRun(testRun); }
Long function(CuantoConnector cuanto, String cuantoProjectKey) { TestRun testRun = new TestRun(cuantoProjectKey); testRun.setDateExecuted(new Date()); testRun.setNote(STR + this.getClass().getSimpleName()); return cuanto.addTestRun(testRun); }
/** * Create a new TestRun for the given project key. * * @param cuanto the Cuanto connector to use to either retrieve the test run, if applicable, or create a new one * @param cuantoProjectKey for which to create a new TestRun * @return the id of the created TestRun */
Create a new TestRun for the given project key
createTestRun
{ "repo_name": "ttop/cuanto", "path": "adapter/src/main/java/cuanto/adapter/listener/testng/TestNgListener.java", "license": "lgpl-3.0", "size": 14443 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,348,907
public void onRemoveDefinition(StreamDefinition definition);
void function(StreamDefinition definition);
/** * This method will be triggered when a new stream definition is removed. * This method will be triggered only when the input events are of type WSO2Event * * @param definition the stream definition as an object. */
This method will be triggered when a new stream definition is removed. This method will be triggered only when the input events are of type WSO2Event
onRemoveDefinition
{ "repo_name": "firzhan/carbon-event-processing", "path": "components/event-stream/event-stream-manager/org.wso2.carbon.event.stream.manager.core/src/main/java/org/wso2/carbon/event/stream/manager/core/WSO2EventConsumer.java", "license": "apache-2.0", "size": 1789 }
[ "org.wso2.carbon.databridge.commons.StreamDefinition" ]
import org.wso2.carbon.databridge.commons.StreamDefinition;
import org.wso2.carbon.databridge.commons.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,232,019
public void setInputDirectories(Set<String> inputs) { this.mInputDirs = new HashSet(); for (String dir : inputs) { this.mInputDirs.add(sanitizePath(dir)); } }
void function(Set<String> inputs) { this.mInputDirs = new HashSet(); for (String dir : inputs) { this.mInputDirs.add(sanitizePath(dir)); } }
/** * Set the input directory. * * @param inputs the input directories to use for the workflow */
Set the input directory
setInputDirectories
{ "repo_name": "pegasus-isi/pegasus", "path": "src/edu/isi/pegasus/planner/classes/PlannerOptions.java", "license": "apache-2.0", "size": 50453 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,026,591
public static int hashCode(Object... objects) { return Arrays.hashCode(objects); }
static int function(Object... objects) { return Arrays.hashCode(objects); }
/** * Hash code for multiple objects using {@link Arrays#hashCode(Object[])}. */
Hash code for multiple objects using <code>Arrays#hashCode(Object[])</code>
hashCode
{ "repo_name": "dsukhoroslov/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/util/HashUtil.java", "license": "apache-2.0", "size": 14966 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
785,213
public void updateSelectionInfos() { int selectedBeads = selectionModel.getSelected().size(); int validBeads = selectionModel.getSelected().getValidBeadFrameCount(); if (selectedBeads > 0) { selectionInfos.setForeground(Color.green.darker()); selectionInfos.setText(String.format( "%d beads selected, %d are valid.", selectedBeads, validBeads)); } else { selectionInfos.setForeground(Color.red); String selectionString; if (IJ.isMacOSX() || IJ.isMacOSX()) { selectionString = "Use right-click or (CMD + left-click) to select beads."; } else { selectionString = "Use right-click to select beads"; } selectionInfos.setText(selectionString); } showSubstackButton.setEnabled(validBeads == 1); averageBeadsButton.setEnabled(validBeads > 1); exportSubstacksButton.setEnabled(selectedBeads > 0); displayIndividualReports.setEnabled(selectedBeads > 0); exportCsvButton.setEnabled(selectionModel.getLastSelection() != null); }
void function() { int selectedBeads = selectionModel.getSelected().size(); int validBeads = selectionModel.getSelected().getValidBeadFrameCount(); if (selectedBeads > 0) { selectionInfos.setForeground(Color.green.darker()); selectionInfos.setText(String.format( STR, selectedBeads, validBeads)); } else { selectionInfos.setForeground(Color.red); String selectionString; if (IJ.isMacOSX() IJ.isMacOSX()) { selectionString = STR; } else { selectionString = STR; } selectionInfos.setText(selectionString); } showSubstackButton.setEnabled(validBeads == 1); averageBeadsButton.setEnabled(validBeads > 1); exportSubstacksButton.setEnabled(selectedBeads > 0); displayIndividualReports.setEnabled(selectedBeads > 0); exportCsvButton.setEnabled(selectionModel.getLastSelection() != null); }
/** * Update selection infos. */
Update selection infos
updateSelectionInfos
{ "repo_name": "cmongis/psfj", "path": "src/knop/psfj/view/BeadInspectionPage.java", "license": "gpl-3.0", "size": 19904 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
381,683
private static void gvg_056t() { Heroi h = comprado.getDono(); partida.addHistorico(Utils.getDescricao(hero.getNome(), comprado)); h.delHealth(10); h.delMao(comprado); h.delDeck(comprado); h.comprarCarta(Card.COMPRA_EVENTO); }
static void function() { Heroi h = comprado.getDono(); partida.addHistorico(Utils.getDescricao(hero.getNome(), comprado)); h.delHealth(10); h.delMao(comprado); h.delDeck(comprado); h.comprarCarta(Card.COMPRA_EVENTO); }
/** * Mina entocada (Ao comprar este card, ele explode. Recebe 10 de dano e * compre um card) */
Mina entocada (Ao comprar este card, ele explode. Recebe 10 de dano e compre um card)
gvg_056t
{ "repo_name": "limagiran/hearthstone", "path": "src/com/limagiran/hearthstoneia/evento/ComprouCard.java", "license": "apache-2.0", "size": 4993 }
[ "com.limagiran.hearthstoneia.Utils", "com.limagiran.hearthstoneia.card.control.Card", "com.limagiran.hearthstoneia.heroi.control.Heroi" ]
import com.limagiran.hearthstoneia.Utils; import com.limagiran.hearthstoneia.card.control.Card; import com.limagiran.hearthstoneia.heroi.control.Heroi;
import com.limagiran.hearthstoneia.*; import com.limagiran.hearthstoneia.card.control.*; import com.limagiran.hearthstoneia.heroi.control.*;
[ "com.limagiran.hearthstoneia" ]
com.limagiran.hearthstoneia;
1,042,846
@Override public List<GenericEntity> getSectionsForStudent(final String token, final String studentId, Map<String, String> params) { //params.put(Constants.ATTR_SELECTOR_FIELD, ":(.,studentSectionAssociations)"); List<GenericEntity> studentSectionAssociations = getStudentSectionAssociations(token, studentId, params); List<GenericEntity> sections = this.readEntityList(token, SDKConstants.STUDENTS_ENTITY + studentId + SDKConstants.STUDENT_SECTION_ASSOC + SDKConstants.SECTIONS_ENTITY + "?" + this.buildQueryString(params), studentId); sections = mergeLists(sections, studentSectionAssociations, "id", "sectionId", "studentSectionAssociations"); // Disable filtering, so just adding section codes to sections with no name sections = filterCurrentSections(sections, false); return sections; }
List<GenericEntity> function(final String token, final String studentId, Map<String, String> params) { List<GenericEntity> studentSectionAssociations = getStudentSectionAssociations(token, studentId, params); List<GenericEntity> sections = this.readEntityList(token, SDKConstants.STUDENTS_ENTITY + studentId + SDKConstants.STUDENT_SECTION_ASSOC + SDKConstants.SECTIONS_ENTITY + "?" + this.buildQueryString(params), studentId); sections = mergeLists(sections, studentSectionAssociations, "id", STR, STR); sections = filterCurrentSections(sections, false); return sections; }
/** * Get a list of sections for the given student id * * @param token * @param studentId * @param params * @return */
Get a list of sections for the given student id
getSectionsForStudent
{ "repo_name": "inbloom/APP-dashboard", "path": "src/main/java/org/slc/sli/dashboard/client/SDKAPIClient.java", "license": "apache-2.0", "size": 64356 }
[ "java.util.List", "java.util.Map", "org.slc.sli.dashboard.entity.GenericEntity" ]
import java.util.List; import java.util.Map; import org.slc.sli.dashboard.entity.GenericEntity;
import java.util.*; import org.slc.sli.dashboard.entity.*;
[ "java.util", "org.slc.sli" ]
java.util; org.slc.sli;
1,381,519
public void testRollback1b() throws Exception { // Note: We start out with an empty file RecordManager recman = newRecordManager(); long root = recman.getNamedObject( "xyz" ); BTree<String,String> tree = null; if ( root == 0 ) { // create a new one tree = BTree.createInstance( recman ); root = tree.getRecid(); recman.setNamedObject( "xyz", root ); recman.commit(); } else { tree = BTree.load( recman, root ); } tree.insert( "Foo", "Bar",true ); tree.insert( "Fo", "Fum",true ); recman.commit(); tree.insert( "Hello", "World",true ); recman.rollback(); tree = BTree.load( recman, root ); assertTrue( tree.find( "Foo" ).equals( "Bar" ) ); assertTrue( tree.find( "Fo" ).equals( "Fum" ) ); assertTrue( tree.find( "Hello" ) == null ); }
void function() throws Exception { RecordManager recman = newRecordManager(); long root = recman.getNamedObject( "xyz" ); BTree<String,String> tree = null; if ( root == 0 ) { tree = BTree.createInstance( recman ); root = tree.getRecid(); recman.setNamedObject( "xyz", root ); recman.commit(); } else { tree = BTree.load( recman, root ); } tree.insert( "Foo", "Bar",true ); tree.insert( "Fo", "Fum",true ); recman.commit(); tree.insert( "Hello", "World",true ); recman.rollback(); tree = BTree.load( recman, root ); assertTrue( tree.find( "Foo" ).equals( "Bar" ) ); assertTrue( tree.find( "Fo" ).equals( "Fum" ) ); assertTrue( tree.find( "Hello" ) == null ); }
/** * Test case courtesy of Derek Dick (mailto:ddick users.sourceforge.net) */
Test case courtesy of Derek Dick (mailto:ddick users.sourceforge.net)
testRollback1b
{ "repo_name": "godwingrs22/jdbm2", "path": "src/tests/jdbm/htree/TestRollback.java", "license": "apache-2.0", "size": 5454 }
[ "jdbm.btree.BTree" ]
import jdbm.btree.BTree;
import jdbm.btree.*;
[ "jdbm.btree" ]
jdbm.btree;
939,547
public Coord position(int posX, int posY) { double longitude = coord(1.0 * posX / dimension.getWidth(), bbox.getSouthWest().getLongitude(), bbox.getNorthEast().getLongitude()); double latitude = coord(1.0 * posY / dimension.getHeight(), bbox.getSouthWest().getLatitude(), bbox.getNorthEast().getLatitude()); return new Coord(latitude, longitude, bbox.getSouthWest().isProjected()); }
Coord function(int posX, int posY) { double longitude = coord(1.0 * posX / dimension.getWidth(), bbox.getSouthWest().getLongitude(), bbox.getNorthEast().getLongitude()); double latitude = coord(1.0 * posY / dimension.getHeight(), bbox.getSouthWest().getLatitude(), bbox.getNorthEast().getLatitude()); return new Coord(latitude, longitude, bbox.getSouthWest().isProjected()); }
/** * Returns the Coordinate of the given x, y position on the tile * @param posX * @param posY * @return a Coordinate that was created from the given x, y position */
Returns the Coordinate of the given x, y position on the tile
position
{ "repo_name": "saeder/CodenameOne", "path": "CodenameOne/src/com/codename1/maps/Tile.java", "license": "gpl-2.0", "size": 8000 }
[ "com.codename1.maps.Coord" ]
import com.codename1.maps.Coord;
import com.codename1.maps.*;
[ "com.codename1.maps" ]
com.codename1.maps;
354,847
@Test public void getDogmaAttributesAttributeIdTest() throws ApiException { Integer attributeId = null; String datasource = null; String userAgent = null; String xUserAgent = null; GetDogmaAttributesAttributeIdOk response = api.getDogmaAttributesAttributeId(attributeId, datasource, userAgent, xUserAgent); // TODO: test validations }
void function() throws ApiException { Integer attributeId = null; String datasource = null; String userAgent = null; String xUserAgent = null; GetDogmaAttributesAttributeIdOk response = api.getDogmaAttributesAttributeId(attributeId, datasource, userAgent, xUserAgent); }
/** * Get attribute information * * Get information on a dogma attribute --- Alternate route: &#x60;/v1/dogma/attributes/{attribute_id}/&#x60; Alternate route: &#x60;/legacy/dogma/attributes/{attribute_id}/&#x60; Alternate route: &#x60;/dev/dogma/attributes/{attribute_id}/&#x60; --- This route is cached for up to 3600 seconds * * @throws ApiException * if the Api call fails */
Get attribute information Get information on a dogma attribute --- Alternate route: &#x60;/v1/dogma/attributes/{attribute_id}/&#x60; Alternate route: &#x60;/legacy/dogma/attributes/{attribute_id}/&#x60; Alternate route: &#x60;/dev/dogma/attributes/{attribute_id}/&#x60; --- This route is cached for up to 3600 seconds
getDogmaAttributesAttributeIdTest
{ "repo_name": "Tmin10/EVE-Security-Service", "path": "server-api/src/test/java/ru/tmin10/EVESecurityService/serverApi/api/DogmaApiTest.java", "license": "gpl-3.0", "size": 4307 }
[ "ru.tmin10.EVESecurityService" ]
import ru.tmin10.EVESecurityService;
import ru.tmin10.*;
[ "ru.tmin10" ]
ru.tmin10;
2,493,845
protected void registerObjectUpdates(UAVObject object) { Observer o = new ActivityUpdatedObserver(object); listeners.put(o, object); if (!paused) object.addUpdatedObserver(o); }
void function(UAVObject object) { Observer o = new ActivityUpdatedObserver(object); listeners.put(o, object); if (!paused) object.addUpdatedObserver(o); }
/** * Register an activity to receive updates from this object * @param object The object the activity should listen to updates from * the objectUpdated() method will be called in the original UI thread */
Register an activity to receive updates from this object
registerObjectUpdates
{ "repo_name": "jpbarraca/dRonin", "path": "androidgcs/src/org/dronin/androidgcs/ObjectManagerActivity.java", "license": "gpl-3.0", "size": 27263 }
[ "java.util.Observer", "org.dronin.uavtalk.UAVObject" ]
import java.util.Observer; import org.dronin.uavtalk.UAVObject;
import java.util.*; import org.dronin.uavtalk.*;
[ "java.util", "org.dronin.uavtalk" ]
java.util; org.dronin.uavtalk;
1,074,317
@Override protected void initCreatingData() { Detail object = new Detail(); object.setId(UUID.randomUUID().toString()); this.setUpdatingData(this.wrap(object)); this.setMode("Create"); }
void function() { Detail object = new Detail(); object.setId(UUID.randomUUID().toString()); this.setUpdatingData(this.wrap(object)); this.setMode(STR); }
/** * Init create object * * @see com.hsuforum.common.web.jsf.managedbean.impl.BaseJpaManagedBeanImpl#initCreatingData() * */
Init create object
initCreatingData
{ "repo_name": "MarvinHsu/EASJavaJSFTemplate", "path": "EASJavaJSFTemplate/src/main/java/com/hsuforum/easjavatemplate/web/jsf/managed/detail/DetailManagedBean.java", "license": "apache-2.0", "size": 6666 }
[ "com.hsuforum.easjavatemplate.entity.Detail", "java.util.UUID" ]
import com.hsuforum.easjavatemplate.entity.Detail; import java.util.UUID;
import com.hsuforum.easjavatemplate.entity.*; import java.util.*;
[ "com.hsuforum.easjavatemplate", "java.util" ]
com.hsuforum.easjavatemplate; java.util;
2,602,815
public void writeBeginComponent(String componentName) throws IOException { writeProperty("BEGIN", componentName); }
void function(String componentName) throws IOException { writeProperty("BEGIN", componentName); }
/** * Writes a property marking the beginning of a component (in other words, * writes a "BEGIN:NAME" property). * @param componentName the component name (e.g. "VCARD") * @throws IOException if there's an I/O problem */
Writes a property marking the beginning of a component (in other words
writeBeginComponent
{ "repo_name": "hongnguyenpro/ez-vcard", "path": "src/main/java/ezvcard/io/text/VCardRawWriter.java", "license": "bsd-2-clause", "size": 19070 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,143,894
Set<NamedAttributeType<?>> getAttributeListenerTypes();
Set<NamedAttributeType<?>> getAttributeListenerTypes();
/** * Gets all of the named attribute types with listeners bound. * * @return All named types with listeners. */
Gets all of the named attribute types with listeners bound
getAttributeListenerTypes
{ "repo_name": "Ellzord/JALSE", "path": "src/main/java/jalse/attributes/AttributeContainer.java", "license": "apache-2.0", "size": 18324 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
251,456
public void execute(CmsSetupBean setupBean) throws Exception { Iterator<String> it = m_selectedPlugins.iterator(); while (it.hasNext()) { String id = it.next(); int d = id.lastIndexOf(".xml") + ".xml".length(); String fileName = id.substring(0, d); int pos = Integer.parseInt(id.substring(d)); List<I_CmsSetupXmlUpdate> plugins = m_sortedPlugins.get(fileName); I_CmsSetupXmlUpdate plugin = plugins.get(pos); plugin.execute(setupBean); } setupBean.getXmlHelper().writeAll(); }
void function(CmsSetupBean setupBean) throws Exception { Iterator<String> it = m_selectedPlugins.iterator(); while (it.hasNext()) { String id = it.next(); int d = id.lastIndexOf(".xml") + ".xml".length(); String fileName = id.substring(0, d); int pos = Integer.parseInt(id.substring(d)); List<I_CmsSetupXmlUpdate> plugins = m_sortedPlugins.get(fileName); I_CmsSetupXmlUpdate plugin = plugins.get(pos); plugin.execute(setupBean); } setupBean.getXmlHelper().writeAll(); }
/** * Executes all user selected plugins.<p> * * @param setupBean the setup bean * * @throws Exception if something goes wrong */
Executes all user selected plugins
execute
{ "repo_name": "PatidarWeb/opencms-core", "path": "src-setup/org/opencms/setup/xml/CmsSetupXmlManager.java", "license": "lgpl-2.1", "size": 12412 }
[ "java.util.Iterator", "java.util.List", "org.opencms.setup.CmsSetupBean" ]
import java.util.Iterator; import java.util.List; import org.opencms.setup.CmsSetupBean;
import java.util.*; import org.opencms.setup.*;
[ "java.util", "org.opencms.setup" ]
java.util; org.opencms.setup;
2,704,893
System.out.println("[ ReverseStringQueue ]"); Scanner input = new Scanner(System.in); // cli input GenericQueue<String> queue = new GenericQueue<String>(); System.out.print("Enter some words: "); String wordsLine = input.nextLine(); String[] words = wordsLine.split(" ");//split the words separated by space for(String word: words){ queue.enqueueFirst(word);//add one word at a time } System.out.println(queue); }
System.out.println(STR); Scanner input = new Scanner(System.in); GenericQueue<String> queue = new GenericQueue<String>(); System.out.print(STR); String wordsLine = input.nextLine(); String[] words = wordsLine.split(" "); for(String word: words){ queue.enqueueFirst(word); } System.out.println(queue); }
/** * ReverseStringQueue printers a list of words in reverse order * as entered on the command line. * Uses a generic list based queue * * @param args list words **/
ReverseStringQueue printers a list of words in reverse order as entered on the command line. Uses a generic list based queue
main
{ "repo_name": "abitofalchemy/sde_technical_interviews", "path": "TechnicalInterview/src/common/questions/ReverseStringQueue.java", "license": "apache-2.0", "size": 813 }
[ "java.util.Scanner" ]
import java.util.Scanner;
import java.util.*;
[ "java.util" ]
java.util;
2,487,713
private String addRealPortsCell(CellNetInfo cni, Nodable no, Map<ArcInst,Integer> negatedHeads, Map<ArcInst,Integer> negatedTails, Netlist nl) { Cell subCell = (Cell)no.getProto(); Netlist subNL = cni.getNetList(); boolean first = false; StringBuffer infstr = new StringBuffer(); for(int pass = 0; pass < 5; pass++) { for(Iterator<Export> it = subCell.getExports(); it.hasNext(); ) { Export e = it.next(); if (!matchesPass(e.getCharacteristic(), pass)) continue; int exportWidth = subNL.getBusWidth(e); for(int i=0; i<exportWidth; i++) { Network net = nl.getNetwork(no, e, i); // get connection boolean portNamed = false; for(Iterator<Connection> cIt = no.getNodeInst().getConnections(); cIt.hasNext(); ) { Connection con = cIt.next(); PortProto otherPP = con.getPortInst().getPortProto(); if (otherPP instanceof Export) otherPP = ((Export)otherPP).getEquivalent(); if (otherPP == e) { ArcInst ai = con.getArc(); if (ai.getProto().getFunction() != ArcProto.Function.NONELEC) { if (con.isNegated()) { Integer index; if (con.getEndIndex() == ArcInst.HEADEND) index = negatedHeads.get(ai); else index = negatedTails.get(ai); if (index != null) { if (first) infstr.append(", "); first = true; String sigName = "PINV" + index.intValue(); infstr.append(sigName); continue; } } } break; } } if (portNamed) continue; // write connection String sigName = addString(net.getName(), null); if (!net.isExported() && !net.getArcs().hasNext()) sigName = "open"; if (first) infstr.append(", "); first = true; infstr.append(sigName); } } } return infstr.toString(); }
String function(CellNetInfo cni, Nodable no, Map<ArcInst,Integer> negatedHeads, Map<ArcInst,Integer> negatedTails, Netlist nl) { Cell subCell = (Cell)no.getProto(); Netlist subNL = cni.getNetList(); boolean first = false; StringBuffer infstr = new StringBuffer(); for(int pass = 0; pass < 5; pass++) { for(Iterator<Export> it = subCell.getExports(); it.hasNext(); ) { Export e = it.next(); if (!matchesPass(e.getCharacteristic(), pass)) continue; int exportWidth = subNL.getBusWidth(e); for(int i=0; i<exportWidth; i++) { Network net = nl.getNetwork(no, e, i); boolean portNamed = false; for(Iterator<Connection> cIt = no.getNodeInst().getConnections(); cIt.hasNext(); ) { Connection con = cIt.next(); PortProto otherPP = con.getPortInst().getPortProto(); if (otherPP instanceof Export) otherPP = ((Export)otherPP).getEquivalent(); if (otherPP == e) { ArcInst ai = con.getArc(); if (ai.getProto().getFunction() != ArcProto.Function.NONELEC) { if (con.isNegated()) { Integer index; if (con.getEndIndex() == ArcInst.HEADEND) index = negatedHeads.get(ai); else index = negatedTails.get(ai); if (index != null) { if (first) infstr.append(STR); first = true; String sigName = "PINV" + index.intValue(); infstr.append(sigName); continue; } } } break; } } if (portNamed) continue; String sigName = addString(net.getName(), null); if (!net.isExported() && !net.getArcs().hasNext()) sigName = "open"; if (first) infstr.append(STR); first = true; infstr.append(sigName); } } } return infstr.toString(); }
/** * Method to write actual signals that connect to a cell instance. * @param cni signal information for the cell being instantiated. * @param no the instance node. * @param negatedHeads map of arcs with negated head ends. * @param negatedTails map of arcs with negated tail ends. * @param nl the Netlist for the Cell containing the instance. * @return a string with the connection signals. */
Method to write actual signals that connect to a cell instance
addRealPortsCell
{ "repo_name": "imr/Electric8", "path": "com/sun/electric/tool/io/output/GenerateVHDL.java", "license": "gpl-3.0", "size": 41095 }
[ "com.sun.electric.database.hierarchy.Cell", "com.sun.electric.database.hierarchy.Export", "com.sun.electric.database.hierarchy.Nodable", "com.sun.electric.database.network.Netlist", "com.sun.electric.database.network.Network", "com.sun.electric.database.prototype.PortProto", "com.sun.electric.database.topology.ArcInst", "com.sun.electric.database.topology.Connection", "com.sun.electric.technology.ArcProto", "java.util.Iterator", "java.util.Map" ]
import com.sun.electric.database.hierarchy.Cell; import com.sun.electric.database.hierarchy.Export; import com.sun.electric.database.hierarchy.Nodable; import com.sun.electric.database.network.Netlist; import com.sun.electric.database.network.Network; import com.sun.electric.database.prototype.PortProto; import com.sun.electric.database.topology.ArcInst; import com.sun.electric.database.topology.Connection; import com.sun.electric.technology.ArcProto; import java.util.Iterator; import java.util.Map;
import com.sun.electric.database.hierarchy.*; import com.sun.electric.database.network.*; import com.sun.electric.database.prototype.*; import com.sun.electric.database.topology.*; import com.sun.electric.technology.*; import java.util.*;
[ "com.sun.electric", "java.util" ]
com.sun.electric; java.util;
563,841
void populateOutputFiles(EventHandler eventHandler, Package.Builder pkgBuilder) throws LabelSyntaxException, InterruptedException { populateOutputFilesInternal(eventHandler, pkgBuilder, true); }
void populateOutputFiles(EventHandler eventHandler, Package.Builder pkgBuilder) throws LabelSyntaxException, InterruptedException { populateOutputFilesInternal(eventHandler, pkgBuilder, true); }
/** * Collects the output files (both implicit and explicit). All the implicit output files are added * first, followed by any explicit files. Additionally both implicit and explicit output files * will retain the relative order in which they were declared. */
Collects the output files (both implicit and explicit). All the implicit output files are added first, followed by any explicit files. Additionally both implicit and explicit output files will retain the relative order in which they were declared
populateOutputFiles
{ "repo_name": "akira-baruah/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/Rule.java", "license": "apache-2.0", "size": 25470 }
[ "com.google.devtools.build.lib.cmdline.LabelSyntaxException", "com.google.devtools.build.lib.events.EventHandler" ]
import com.google.devtools.build.lib.cmdline.LabelSyntaxException; import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.cmdline.*; import com.google.devtools.build.lib.events.*;
[ "com.google.devtools" ]
com.google.devtools;
2,715,558
public OmemoMessage.Sent encrypt(BareJid recipient, String message) throws CryptoFailedException, UndecidedOmemoIdentityException, InterruptedException, SmackException.NotConnectedException, SmackException.NoResponseException, SmackException.NotLoggedInException, IOException { Set<BareJid> recipients = new HashSet<>(); recipients.add(recipient); return encrypt(recipients, message); }
OmemoMessage.Sent function(BareJid recipient, String message) throws CryptoFailedException, UndecidedOmemoIdentityException, InterruptedException, SmackException.NotConnectedException, SmackException.NoResponseException, SmackException.NotLoggedInException, IOException { Set<BareJid> recipients = new HashSet<>(); recipients.add(recipient); return encrypt(recipients, message); }
/** * OMEMO encrypt a cleartext message for a single recipient. * Note that this method does NOT set the 'to' attribute of the message. * * @param recipient recipients bareJid * @param message text to encrypt * @return encrypted message * * @throws CryptoFailedException when something crypto related fails * @throws UndecidedOmemoIdentityException When there are undecided devices * @throws InterruptedException if the calling thread was interrupted. * @throws SmackException.NotConnectedException if the XMPP connection is not connected. * @throws SmackException.NoResponseException if there was no response from the remote entity. * @throws SmackException.NotLoggedInException if the XMPP connection is not authenticated. * @throws IOException if an I/O error occurred. */
OMEMO encrypt a cleartext message for a single recipient. Note that this method does NOT set the 'to' attribute of the message
encrypt
{ "repo_name": "igniterealtime/Smack", "path": "smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java", "license": "apache-2.0", "size": 49782 }
[ "java.io.IOException", "java.util.HashSet", "java.util.Set", "org.jivesoftware.smack.SmackException", "org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException", "org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException", "org.jxmpp.jid.BareJid" ]
import java.io.IOException; import java.util.HashSet; import java.util.Set; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException; import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException; import org.jxmpp.jid.BareJid;
import java.io.*; import java.util.*; import org.jivesoftware.smack.*; import org.jivesoftware.smackx.omemo.exceptions.*; import org.jxmpp.jid.*;
[ "java.io", "java.util", "org.jivesoftware.smack", "org.jivesoftware.smackx", "org.jxmpp.jid" ]
java.io; java.util; org.jivesoftware.smack; org.jivesoftware.smackx; org.jxmpp.jid;
1,285,692
TestpressService getService() { if (CommonUtils.isUserAuthenticated(this)) { try { testpressService = serviceProvider.getService(ForumActivity.this); } catch (IOException | AccountsException e) { e.printStackTrace(); } } return testpressService; }
TestpressService getService() { if (CommonUtils.isUserAuthenticated(this)) { try { testpressService = serviceProvider.getService(ForumActivity.this); } catch (IOException AccountsException e) { e.printStackTrace(); } } return testpressService; }
/** * Call this method only from async task * * @return TestpressService */
Call this method only from async task
getService
{ "repo_name": "testpress/android", "path": "app/src/main/java/in/testpress/testpress/ui/ForumActivity.java", "license": "mit", "size": 41538 }
[ "android.accounts.AccountsException", "in.testpress.testpress.core.TestpressService", "in.testpress.testpress.util.CommonUtils", "java.io.IOException" ]
import android.accounts.AccountsException; import in.testpress.testpress.core.TestpressService; import in.testpress.testpress.util.CommonUtils; import java.io.IOException;
import android.accounts.*; import in.testpress.testpress.core.*; import in.testpress.testpress.util.*; import java.io.*;
[ "android.accounts", "in.testpress.testpress", "java.io" ]
android.accounts; in.testpress.testpress; java.io;
1,401,925
public void addChild(Item child) { PredictionTree newChild = new PredictionTree(child); newChild.Parent = this; Children.add(newChild); }
void function(Item child) { PredictionTree newChild = new PredictionTree(child); newChild.Parent = this; Children.add(newChild); }
/** * Adds a child to the current node */
Adds a child to the current node
addChild
{ "repo_name": "ArneBinder/LanguageAnalyzer", "path": "src/main/java/ca/pfv/spmf/algorithms/sequenceprediction/ipredict/predictor/CPT/CPTPlus/PredictionTree.java", "license": "gpl-3.0", "size": 2520 }
[ "ca.pfv.spmf.algorithms.sequenceprediction.ipredict.database.Item" ]
import ca.pfv.spmf.algorithms.sequenceprediction.ipredict.database.Item;
import ca.pfv.spmf.algorithms.sequenceprediction.ipredict.database.*;
[ "ca.pfv.spmf" ]
ca.pfv.spmf;
378,368
public void pause() { Log.d(TAG, "pause()"); if (this.mTimerActive) { this.mTimerActive = false; this.mTimer.cancel(); } }
void function() { Log.d(TAG, STR); if (this.mTimerActive) { this.mTimerActive = false; this.mTimer.cancel(); } }
/** * Pause an active timer. Use resume() to resume. */
Pause an active timer. Use resume() to resume
pause
{ "repo_name": "siramix/buzzwords", "path": "src/com/buzzwords/PauseTimer.java", "license": "gpl-3.0", "size": 3609 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,268,302
public BookView build() { return new BookView(this.title, this.author, ImmutableList.copyOf(this.pages)); }
BookView function() { return new BookView(this.title, this.author, ImmutableList.copyOf(this.pages)); }
/** * Creates a new {@link BookView} from the current state of this * builder. * * @return New BookView */
Creates a new <code>BookView</code> from the current state of this builder
build
{ "repo_name": "JBYoshi/SpongeAPI", "path": "src/main/java/org/spongepowered/api/text/BookView.java", "license": "mit", "size": 9529 }
[ "com.google.common.collect.ImmutableList" ]
import com.google.common.collect.ImmutableList;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
2,039,696
public PatientBean getPatient() throws DBException { transDAO.logTransaction(TransactionType.ENTER_EDIT_DEMOGRAPHICS, loggedInMID, pid, "EditPatient - View Patient"); return patientDAO.getPatient(this.getPid()); }
PatientBean function() throws DBException { transDAO.logTransaction(TransactionType.ENTER_EDIT_DEMOGRAPHICS, loggedInMID, pid, STR); return patientDAO.getPatient(this.getPid()); }
/** * Returns a PatientBean for the patient * * @return the PatientBean * @throws DBException */
Returns a PatientBean for the patient
getPatient
{ "repo_name": "qynnine/JDiffOriginDemo", "path": "examples/iTrust_v10/edu/ncsu/csc/itrust/action/EditPatientAction.java", "license": "lgpl-2.1", "size": 3702 }
[ "edu.ncsu.csc.itrust.beans.PatientBean", "edu.ncsu.csc.itrust.enums.TransactionType", "edu.ncsu.csc.itrust.exception.DBException" ]
import edu.ncsu.csc.itrust.beans.PatientBean; import edu.ncsu.csc.itrust.enums.TransactionType; import edu.ncsu.csc.itrust.exception.DBException;
import edu.ncsu.csc.itrust.beans.*; import edu.ncsu.csc.itrust.enums.*; import edu.ncsu.csc.itrust.exception.*;
[ "edu.ncsu.csc" ]
edu.ncsu.csc;
1,405,386
public Container getContainer() { return (this.context); }
Container function() { return (this.context); }
/** * Return the Container to which this Valve is attached. */
Return the Container to which this Valve is attached
getContainer
{ "repo_name": "devjin24/howtomcatworks", "path": "bookrefer/jakarta-tomcat-5.0.18-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java", "license": "apache-2.0", "size": 34119 }
[ "org.apache.catalina.Container" ]
import org.apache.catalina.Container;
import org.apache.catalina.*;
[ "org.apache.catalina" ]
org.apache.catalina;
34,141
private void applyCurrentPageAttributes() { PageTemplate lPageTemplate = getCurrentPageTemplate(); PageAttributes lPageAttributes = lPageTemplate.getPageAttributes(); float lTotalLeftMargin = lPageAttributes.getMarginLeft() + lPageAttributes.getBodyAttributes().getMarginLeft(); float lTotalRightMargin = lPageAttributes.getMarginRight() + lPageAttributes.getBodyAttributes().getMarginRight(); float lTotalTopMargin = lPageAttributes.getMarginTop() + lPageAttributes.getBodyAttributes().getMarginTop() + lPageAttributes.getHeaderAttributes().getHeight(); float lTotalBottomMargin = lPageAttributes.getMarginBottom() + lPageAttributes.getBodyAttributes().getMarginBottom() + lPageAttributes.getFooterAttributes().getHeight(); mDocument.setPageSize(new Rectangle(lPageAttributes.getPageWidth(), lPageAttributes.getPageHeight())); mDocument.setMargins(lTotalLeftMargin, lTotalRightMargin, lTotalTopMargin, lTotalBottomMargin); }
void function() { PageTemplate lPageTemplate = getCurrentPageTemplate(); PageAttributes lPageAttributes = lPageTemplate.getPageAttributes(); float lTotalLeftMargin = lPageAttributes.getMarginLeft() + lPageAttributes.getBodyAttributes().getMarginLeft(); float lTotalRightMargin = lPageAttributes.getMarginRight() + lPageAttributes.getBodyAttributes().getMarginRight(); float lTotalTopMargin = lPageAttributes.getMarginTop() + lPageAttributes.getBodyAttributes().getMarginTop() + lPageAttributes.getHeaderAttributes().getHeight(); float lTotalBottomMargin = lPageAttributes.getMarginBottom() + lPageAttributes.getBodyAttributes().getMarginBottom() + lPageAttributes.getFooterAttributes().getHeight(); mDocument.setPageSize(new Rectangle(lPageAttributes.getPageWidth(), lPageAttributes.getPageHeight())); mDocument.setMargins(lTotalLeftMargin, lTotalRightMargin, lTotalTopMargin, lTotalBottomMargin); }
/** * Applies the page attributes of the current page template to the document, i.e. the page size and margins */
Applies the page attributes of the current page template to the document, i.e. the page size and margins
applyCurrentPageAttributes
{ "repo_name": "Fivium/FOXopen", "path": "src/main/java/net/foxopen/fox/module/serialiser/pdf/pages/PageManager.java", "license": "gpl-3.0", "size": 13330 }
[ "com.itextpdf.text.Rectangle" ]
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.*;
[ "com.itextpdf.text" ]
com.itextpdf.text;
689,254
private void forwardV3Trap(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV3TrapBuilder trap = SnmpUtils.getV3TrapBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.send(config.getAddress().getHostAddress(), config.getPort(), config.getSecurityLevel(), config.getSecurityName(), config.getAuthPassPhrase(), config.getAuthProtocol(), config.getPrivPassPhrase(), config.getPrivProtocol()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
void function(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV3TrapBuilder trap = SnmpUtils.getV3TrapBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.send(config.getAddress().getHostAddress(), config.getPort(), config.getSecurityLevel(), config.getSecurityName(), config.getAuthPassPhrase(), config.getAuthProtocol(), config.getPrivPassPhrase(), config.getPrivProtocol()); } catch (Throwable e) { throw new SnmpTrapException(STR+e.getMessage(), e); } }
/** * Create an SNMP V3 trap based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */
Create an SNMP V3 trap based on the content of the specified trap configuration, and send it to the appropriate destination
forwardV3Trap
{ "repo_name": "aihua/opennms", "path": "opennms-alarms/snmptrap-northbounder/src/main/java/org/opennms/netmgt/alarmd/northbounder/snmptrap/SnmpTrapHelper.java", "license": "agpl-3.0", "size": 28209 }
[ "org.opennms.netmgt.snmp.SnmpAgentConfig", "org.opennms.netmgt.snmp.SnmpUtils", "org.opennms.netmgt.snmp.SnmpV3TrapBuilder" ]
import org.opennms.netmgt.snmp.SnmpAgentConfig; import org.opennms.netmgt.snmp.SnmpUtils; import org.opennms.netmgt.snmp.SnmpV3TrapBuilder;
import org.opennms.netmgt.snmp.*;
[ "org.opennms.netmgt" ]
org.opennms.netmgt;
783,197
private void extractStatisticsOfActors(Map<String, Counters> data) { extractStatisticsPersons(data, ACTORS_COUNTER, 'a'); }
void function(Map<String, Counters> data) { extractStatisticsPersons(data, ACTORS_COUNTER, 'a'); }
/** * Extract the statistics of the actors. * * @param data The data of stats. */
Extract the statistics of the actors
extractStatisticsOfActors
{ "repo_name": "wichtounet/jtheque-stats-module", "path": "src/main/java/org/jtheque/films/stats/services/impl/utils/StatsCalculator.java", "license": "apache-2.0", "size": 8539 }
[ "java.util.Map", "org.jtheque.utils.count.Counters" ]
import java.util.Map; import org.jtheque.utils.count.Counters;
import java.util.*; import org.jtheque.utils.count.*;
[ "java.util", "org.jtheque.utils" ]
java.util; org.jtheque.utils;
2,111,002
public NinePatch getPatch (String name) { NinePatch patch = optional(name, NinePatch.class); if (patch != null) return patch; try { TextureRegion region = getRegion(name); if (region instanceof AtlasRegion) { int[] splits = ((AtlasRegion)region).splits; if (splits != null) { patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]); int[] pads = ((AtlasRegion)region).pads; if (pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]); } } if (patch == null) patch = new NinePatch(region); add(name, patch, NinePatch.class); return patch; } catch (GdxRuntimeException ex) { throw new GdxRuntimeException("No NinePatch, TextureRegion, or Texture registered with name: " + name); } }
NinePatch function (String name) { NinePatch patch = optional(name, NinePatch.class); if (patch != null) return patch; try { TextureRegion region = getRegion(name); if (region instanceof AtlasRegion) { int[] splits = ((AtlasRegion)region).splits; if (splits != null) { patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]); int[] pads = ((AtlasRegion)region).pads; if (pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]); } } if (patch == null) patch = new NinePatch(region); add(name, patch, NinePatch.class); return patch; } catch (GdxRuntimeException ex) { throw new GdxRuntimeException(STR + name); } }
/** Returns a registered ninepatch. If no ninepatch is found but a region exists with the name, a ninepatch is created from the * region and stored in the skin. If the region is an {@link AtlasRegion} then the {@link AtlasRegion#splits} are used, * otherwise the ninepatch will have the region as the center patch. */
Returns a registered ninepatch. If no ninepatch is found but a region exists with the name, a ninepatch is created from the region and stored in the skin. If the region is an <code>AtlasRegion</code> then the <code>AtlasRegion#splits</code> are used
getPatch
{ "repo_name": "sarkanyi/libgdx", "path": "gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Skin.java", "license": "apache-2.0", "size": 26039 }
[ "com.badlogic.gdx.graphics.g2d.NinePatch", "com.badlogic.gdx.graphics.g2d.TextureAtlas", "com.badlogic.gdx.graphics.g2d.TextureRegion", "com.badlogic.gdx.utils.GdxRuntimeException" ]
import com.badlogic.gdx.graphics.g2d.NinePatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.graphics.g2d.*; import com.badlogic.gdx.utils.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
1,758,785
@Override public boolean accept(Path keyPath, S3ObjectSummary summary) { return !keyPath.equals(qualifiedPath) && !summary.getKey().endsWith(S3N_FOLDER_SUFFIX) && !objectRepresentsDirectory(summary.getKey()); }
boolean function(Path keyPath, S3ObjectSummary summary) { return !keyPath.equals(qualifiedPath) && !summary.getKey().endsWith(S3N_FOLDER_SUFFIX) && !objectRepresentsDirectory(summary.getKey()); }
/** * Reject a summary entry if the key path is the qualified Path, or * it ends with {@code "_$folder$"}. * @param keyPath key path of the entry * @param summary summary entry * @return true if the entry is accepted (i.e. that a status entry * should be generated. */
Reject a summary entry if the key path is the qualified Path, or it ends with "_$folder$"
accept
{ "repo_name": "JingchengDu/hadoop", "path": "hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java", "license": "apache-2.0", "size": 28366 }
[ "com.amazonaws.services.s3.model.S3ObjectSummary", "org.apache.hadoop.fs.Path" ]
import com.amazonaws.services.s3.model.S3ObjectSummary; import org.apache.hadoop.fs.Path;
import com.amazonaws.services.s3.model.*; import org.apache.hadoop.fs.*;
[ "com.amazonaws.services", "org.apache.hadoop" ]
com.amazonaws.services; org.apache.hadoop;
2,436,176
this.configServerService = configServerService; } private Map<String, ConfigItemChangedCallable> callables = new HashMap<String, ConfigItemChangedCallable>(); private String ccUser; private String ccPassword; private Long ccVersion; private String ccVersionName; private Long ccEnvId; private String projectName; private String envName; private long callbackInteval; private String versionTag; private File localPropertyFile;
this.configServerService = configServerService; } private Map<String, ConfigItemChangedCallable> callables = new HashMap<String, ConfigItemChangedCallable>(); private String ccUser; private String ccPassword; private Long ccVersion; private String ccVersionName; private Long ccEnvId; private String projectName; private String envName; private long callbackInteval; private String versionTag; private File localPropertyFile;
/** * set configServerService instance. * @param configServerService the configServerService to set */
set configServerService instance
setConfigServerService
{ "repo_name": "sdgdsffdsfff/configcenter-client", "path": "src/main/java/com/baidu/cc/ConfigLoader.java", "license": "apache-2.0", "size": 18415 }
[ "com.baidu.cc.interfaces.ConfigItemChangedCallable", "java.io.File", "java.util.HashMap", "java.util.Map" ]
import com.baidu.cc.interfaces.ConfigItemChangedCallable; import java.io.File; import java.util.HashMap; import java.util.Map;
import com.baidu.cc.interfaces.*; import java.io.*; import java.util.*;
[ "com.baidu.cc", "java.io", "java.util" ]
com.baidu.cc; java.io; java.util;
1,479,919
public static Object obtainParamValue(final Param param, final Object bean) throws FrameworkException, ApplicationExceptions { return INSTANCE.obtainParamObject(param, bean); }
static Object function(final Param param, final Object bean) throws FrameworkException, ApplicationExceptions { return INSTANCE.obtainParamObject(param, bean); }
/** * Returns the value from the input Param object. Uses BSF to evaluate the * value, in case its an expression. * * @param param * the Param object. * @param bean * the bean to be used in the context of BSF. * @return the value from the input Param object. * @throws FrameworkException * in case any internal error occurs. * @throws ApplicationExceptions * Indicates application error(s). */
Returns the value from the input Param object. Uses BSF to evaluate the value, in case its an expression
obtainParamValue
{ "repo_name": "jaffa-projects/jaffa-framework", "path": "jaffa-soa/source/java/org/jaffa/modules/messaging/services/InitialContextFactrory.java", "license": "gpl-3.0", "size": 7897 }
[ "org.jaffa.exceptions.ApplicationExceptions", "org.jaffa.exceptions.FrameworkException", "org.jaffa.modules.messaging.services.configdomain.Param" ]
import org.jaffa.exceptions.ApplicationExceptions; import org.jaffa.exceptions.FrameworkException; import org.jaffa.modules.messaging.services.configdomain.Param;
import org.jaffa.exceptions.*; import org.jaffa.modules.messaging.services.configdomain.*;
[ "org.jaffa.exceptions", "org.jaffa.modules" ]
org.jaffa.exceptions; org.jaffa.modules;
969,598
private static List<AggregateFunction> getAggregators(String aggs, String keys, String resultKeys) { List<AggregateFunction> aggregatorList = Lists.newArrayList(); aggs = aggs.replace("\\s", ""); keys = keys.replace("\\s", ""); resultKeys = resultKeys.replace("\\s", ""); List<String> aggsList = Arrays.asList(TOKEN_SEPARATOR.split(aggs)); List<String> keyList = Arrays.asList(TOKEN_SEPARATOR.split(keys)); List<String> resultKeyList = Arrays.asList(TOKEN_SEPARATOR.split (resultKeys)); if (!aggs.equals("none")) { for (int i = 0; i < aggsList.size(); i++) { switch (aggsList.get(i)) { case "count" : aggregatorList.add(new Count()); break; case "max" : aggregatorList.add(new MaxProperty(keyList.get(i), resultKeyList.get(i))); break; case "min" : aggregatorList.add(new MinProperty(keyList.get(i), resultKeyList.get(i))); break; default: aggregatorList.add(null); break; } } } return aggregatorList; }
static List<AggregateFunction> function(String aggs, String keys, String resultKeys) { List<AggregateFunction> aggregatorList = Lists.newArrayList(); aggs = aggs.replace("\\s", STR\\sSTRSTR\\sSTRSTRnoneSTRcountSTRmaxSTRmin" : aggregatorList.add(new MinProperty(keyList.get(i), resultKeyList.get(i))); break; default: aggregatorList.add(null); break; } } } return aggregatorList; }
/** * Method to build aggregators * * @param aggs aggregators as whole string * @param keys aggregator keys as whole string * @param resultKeys aggregator result keys as whole string * @return List of PropertyValueAggregators */
Method to build aggregators
getAggregators
{ "repo_name": "niklasteichmann/gradoop", "path": "gradoop-examples/src/main/java/org/gradoop/benchmark/grouping/GroupingBenchmark.java", "license": "apache-2.0", "size": 16381 }
[ "com.google.common.collect.Lists", "java.util.List", "org.gradoop.flink.model.api.functions.AggregateFunction", "org.gradoop.flink.model.impl.operators.aggregation.functions.min.MinProperty" ]
import com.google.common.collect.Lists; import java.util.List; import org.gradoop.flink.model.api.functions.AggregateFunction; import org.gradoop.flink.model.impl.operators.aggregation.functions.min.MinProperty;
import com.google.common.collect.*; import java.util.*; import org.gradoop.flink.model.api.functions.*; import org.gradoop.flink.model.impl.operators.aggregation.functions.min.*;
[ "com.google.common", "java.util", "org.gradoop.flink" ]
com.google.common; java.util; org.gradoop.flink;
2,332,306