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 subscribe()throws IllegalStateException, ServiceClosedException; | void function()throws IllegalStateException, ServiceClosedException; | /**
* Sends a subscription request.
* The Subscription will transit to STATE_PENDING after calling this method.
*
* @throws IllegalStateException - if the Subscription is not in STATE_INACTIVE
* @throws ServiceClosedException - if the Service is closed
*/ | Sends a subscription request. The Subscription will transit to STATE_PENDING after calling this method | subscribe | {
"repo_name": "fhg-fokus-nubomedia/signaling-plane",
"path": "modules/lib-sip/src/main/java/javax/ims/core/Subscription.java",
"license": "apache-2.0",
"size": 2263
} | [
"javax.ims.ServiceClosedException"
] | import javax.ims.ServiceClosedException; | import javax.ims.*; | [
"javax.ims"
] | javax.ims; | 2,255,121 |
public List<ViewManager> createAllViewManagers(
ReactApplicationContext catalystApplicationContext) {
ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createAllViewManagers");
try {
synchronized (mPackages) {
List<ViewManager> allViewManagers = new ArrayList<>();
for (ReactPackage reactPackage : mPackages) {
allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
}
return allViewManagers;
}
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);
}
} | List<ViewManager> function( ReactApplicationContext catalystApplicationContext) { ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START); Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, STR); try { synchronized (mPackages) { List<ViewManager> allViewManagers = new ArrayList<>(); for (ReactPackage reactPackage : mPackages) { allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext)); } return allViewManagers; } } finally { Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END); } } | /**
* Uses configured {@link ReactPackage} instances to create all view managers.
*/ | Uses configured <code>ReactPackage</code> instances to create all view managers | createAllViewManagers | {
"repo_name": "jevakallio/react-native",
"path": "ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java",
"license": "bsd-3-clause",
"size": 47116
} | [
"com.facebook.react.bridge.ReactApplicationContext",
"com.facebook.react.bridge.ReactMarker",
"com.facebook.react.uimanager.ViewManager",
"com.facebook.systrace.Systrace",
"java.util.ArrayList",
"java.util.List"
] | import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactMarker; import com.facebook.react.uimanager.ViewManager; import com.facebook.systrace.Systrace; import java.util.ArrayList; import java.util.List; | import com.facebook.react.bridge.*; import com.facebook.react.uimanager.*; import com.facebook.systrace.*; import java.util.*; | [
"com.facebook.react",
"com.facebook.systrace",
"java.util"
] | com.facebook.react; com.facebook.systrace; java.util; | 1,766,461 |
private AlarmEvent activation( AlarmPoint alarm )
{
AlarmStatus status = alarm.currentStatus();
if( ( status.name(null).equals( AlarmPoint.STATUS_NORMAL ) ) ||
( status.name(null).equals( AlarmPoint.STATUS_DEACTIVATED ) ) )
{
AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_ACTIVATED );
return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_ACTIVATION );
}
return null;
} | AlarmEvent function( AlarmPoint alarm ) { AlarmStatus status = alarm.currentStatus(); if( ( status.name(null).equals( AlarmPoint.STATUS_NORMAL ) ) ( status.name(null).equals( AlarmPoint.STATUS_DEACTIVATED ) ) ) { AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_ACTIVATED ); return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_ACTIVATION ); } return null; } | /**
* StateMachine change for activate trigger.
*
* @param alarm the alarm that is being triggered.
*
* @return The event to be fired on activation.
*/ | StateMachine change for activate trigger | activation | {
"repo_name": "joobn72/qi4j-sdk",
"path": "libraries/alarm/src/main/java/org/qi4j/library/alarm/ExtendedAlarmModelService.java",
"license": "apache-2.0",
"size": 17690
} | [
"org.qi4j.api.entity.Identity"
] | import org.qi4j.api.entity.Identity; | import org.qi4j.api.entity.*; | [
"org.qi4j.api"
] | org.qi4j.api; | 1,493,528 |
public void customizedCPTInOrderSearch(ADDNode node,
ArrayList<Boolean> assign, ArrayList<ProbState> transicoes,
boolean extracting) {
if (node != null) {
if (node instanceof ADDINode) {
ADDINode internalNode = (ADDINode) node;
ADDNode lowNode = _context.getNode(internalNode._nLow);
ADDNode highNode = _context.getNode(internalNode._nHigh);
int id_var_prime = _hmPrimeVarID2VarID
.get(internalNode._nTestVarID);
int level_var = (Integer) _context._hmGVarToLevel
.get(id_var_prime);
// Expande a subarvore low
ArrayList<Boolean> assignFalse = (ArrayList<Boolean>) assign
.clone();
assignFalse.set(level_var, new Boolean(false));
customizedCPTInOrderSearch(lowNode, assignFalse, transicoes,
extracting);
// Expande a subarvore high
ArrayList<Boolean> assignTrue = (ArrayList<Boolean>) assign
.clone();
assignTrue.set(level_var, new Boolean(true));
customizedCPTInOrderSearch(highNode, assignTrue, transicoes,
extracting);
} else if (node instanceof ADDDNode) {
ADDDNode leaf = (ADDDNode) node;
Double probabilidade = leaf._dLower;
// Adiciona apenas os estados com probabilidade maior que de
// serem alcançados
if (probabilidade > 0.0d) {
@SuppressWarnings("unchecked")
ArrayList<Boolean> newAssign = (ArrayList<Boolean>) assign
.clone();
boolean hasNulls = false;
for (int i = 0; i < newAssign.size() / 2; i++) {
if (newAssign.get(i) == null) {
newAssign.set(i, false);
hasNulls = true;
}
}
double valorBloco = _context.evaluate(
stochasticBisimulation, newAssign);
newAssign.add(0, null);
ArrayList<Boolean> representantAux = mdp
.getRepresentant(valorBloco);
if (representantAux != null) {
// Transi��o para um estado que j� foi adicionado ao
// MDP.
boolean transitionExists = false;
for (int i = 0; i < transicoes.size(); i++) {
ProbState t = transicoes.get(i);
double valorBlocoAlState = getValorBloco(t.nextRepresentant);
ArrayList<Boolean> alStateRepresentant = mdp
.setRepresentant(valorBlocoAlState,
t.nextRepresentant);
if (alStateRepresentant.equals(representantAux)) {
t._dProb = t._dProb
+ probabilidade.floatValue();
transitionExists = true;
break;
}
}
if (!transitionExists) {
ProbState t = new ProbState(probabilidade,
representantAux);
transicoes.add(t);
}
if (valueFunction.get(representantAux) == null) {
valueFunction.put(representantAux,
heuristicaAdmissivel);
solved.put(representantAux, false);
}
} else {
// Estado seguinte que ainda n�o est� no MDP.
if (extracting) {
HashSet blocos = new HashSet();
_context.collectLeaves(stochasticBisimulation,
blocos);
ArrayList<Boolean> stateAssignClone = (ArrayList<Boolean>) newAssign
.clone();
stateAssignClone.remove(0);
if (!hasNulls) {
valorBloco = _context.evaluate(
stochasticBisimulation,
stateAssignClone);
stateAssignClone.add(0, null);
ArrayList<Boolean> representant = mdp
.setRepresentant(valorBloco,
stateAssignClone);
ProbState t = new ProbState(probabilidade,
representant);
transicoes.add(t);
if (valueFunction.get(representant) == null) {
valueFunction.put(representant,
heuristicaAdmissivel);
solved.put(representant, false);
}
} else {
stateAssignClone.add(0, null);
HashSet<ArrayList<Boolean>> validAssignments = new HashSet<ArrayList<Boolean>>();
findValidAssignments(assign, validAssignments,
(assign.size() / 2) - 1);
for (ArrayList<Boolean> assignment : validAssignments) {
ProbState t = null;
valorBloco = _context.evaluate(
stochasticBisimulation, assignment);
assignment.add(0, null);
ArrayList<Boolean> representant = mdp
.setRepresentant(valorBloco,
assignment);
boolean transitionExists = false;
for (int i = 0; i < transicoes.size(); i++) {
t = transicoes.get(i);
double valorBlocoAlState = getValorBloco(t.nextRepresentant);
ArrayList<Boolean> alStateRepresentant = mdp
.setRepresentant(
valorBlocoAlState,
t.nextRepresentant);
if (alStateRepresentant
.equals(representant)) {
t._dProb = t._dProb + probabilidade;
transitionExists = true;
break;
}
}
if (!transitionExists) {
t = new ProbState(probabilidade,
representant);
transicoes.add(t);
}
if (valueFunction.get(representant) == null) {
valueFunction.put(representant,
heuristicaAdmissivel);
solved.put(representant, false);
}
}
}
}
}
}
}
}
}
| void function(ADDNode node, ArrayList<Boolean> assign, ArrayList<ProbState> transicoes, boolean extracting) { if (node != null) { if (node instanceof ADDINode) { ADDINode internalNode = (ADDINode) node; ADDNode lowNode = _context.getNode(internalNode._nLow); ADDNode highNode = _context.getNode(internalNode._nHigh); int id_var_prime = _hmPrimeVarID2VarID .get(internalNode._nTestVarID); int level_var = (Integer) _context._hmGVarToLevel .get(id_var_prime); ArrayList<Boolean> assignFalse = (ArrayList<Boolean>) assign .clone(); assignFalse.set(level_var, new Boolean(false)); customizedCPTInOrderSearch(lowNode, assignFalse, transicoes, extracting); ArrayList<Boolean> assignTrue = (ArrayList<Boolean>) assign .clone(); assignTrue.set(level_var, new Boolean(true)); customizedCPTInOrderSearch(highNode, assignTrue, transicoes, extracting); } else if (node instanceof ADDDNode) { ADDDNode leaf = (ADDDNode) node; Double probabilidade = leaf._dLower; if (probabilidade > 0.0d) { @SuppressWarnings(STR) ArrayList<Boolean> newAssign = (ArrayList<Boolean>) assign .clone(); boolean hasNulls = false; for (int i = 0; i < newAssign.size() / 2; i++) { if (newAssign.get(i) == null) { newAssign.set(i, false); hasNulls = true; } } double valorBloco = _context.evaluate( stochasticBisimulation, newAssign); newAssign.add(0, null); ArrayList<Boolean> representantAux = mdp .getRepresentant(valorBloco); if (representantAux != null) { boolean transitionExists = false; for (int i = 0; i < transicoes.size(); i++) { ProbState t = transicoes.get(i); double valorBlocoAlState = getValorBloco(t.nextRepresentant); ArrayList<Boolean> alStateRepresentant = mdp .setRepresentant(valorBlocoAlState, t.nextRepresentant); if (alStateRepresentant.equals(representantAux)) { t._dProb = t._dProb + probabilidade.floatValue(); transitionExists = true; break; } } if (!transitionExists) { ProbState t = new ProbState(probabilidade, representantAux); transicoes.add(t); } if (valueFunction.get(representantAux) == null) { valueFunction.put(representantAux, heuristicaAdmissivel); solved.put(representantAux, false); } } else { if (extracting) { HashSet blocos = new HashSet(); _context.collectLeaves(stochasticBisimulation, blocos); ArrayList<Boolean> stateAssignClone = (ArrayList<Boolean>) newAssign .clone(); stateAssignClone.remove(0); if (!hasNulls) { valorBloco = _context.evaluate( stochasticBisimulation, stateAssignClone); stateAssignClone.add(0, null); ArrayList<Boolean> representant = mdp .setRepresentant(valorBloco, stateAssignClone); ProbState t = new ProbState(probabilidade, representant); transicoes.add(t); if (valueFunction.get(representant) == null) { valueFunction.put(representant, heuristicaAdmissivel); solved.put(representant, false); } } else { stateAssignClone.add(0, null); HashSet<ArrayList<Boolean>> validAssignments = new HashSet<ArrayList<Boolean>>(); findValidAssignments(assign, validAssignments, (assign.size() / 2) - 1); for (ArrayList<Boolean> assignment : validAssignments) { ProbState t = null; valorBloco = _context.evaluate( stochasticBisimulation, assignment); assignment.add(0, null); ArrayList<Boolean> representant = mdp .setRepresentant(valorBloco, assignment); boolean transitionExists = false; for (int i = 0; i < transicoes.size(); i++) { t = transicoes.get(i); double valorBlocoAlState = getValorBloco(t.nextRepresentant); ArrayList<Boolean> alStateRepresentant = mdp .setRepresentant( valorBlocoAlState, t.nextRepresentant); if (alStateRepresentant .equals(representant)) { t._dProb = t._dProb + probabilidade; transitionExists = true; break; } } if (!transitionExists) { t = new ProbState(probabilidade, representant); transicoes.add(t); } if (valueFunction.get(representant) == null) { valueFunction.put(representant, heuristicaAdmissivel); solved.put(representant, false); } } } } } } } } } | /**
* Method used to discover the probabilities transitions to a next state.
* @param node
* @param assign
* @param transicoes
* @param extracting
*/ | Method used to discover the probabilities transitions to a next state | customizedCPTInOrderSearch | {
"repo_name": "felipemartinsss/repository",
"path": "AIPlannersForRDDLSim/src/rddl/solver/mdp/refactored/sbisimulation/ReachMRFSWithTopologicalValueIteration.java",
"license": "gpl-3.0",
"size": 50726
} | [
"java.util.ArrayList",
"java.util.HashSet"
] | import java.util.ArrayList; import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 689,412 |
final IRasterFunction functionMock = PowerMockito
.mock(IRasterFunction.class);
// test to create an invalid function entry
new BaseRasterModelEntry(null, RasterModelEntryType.VALUE, functionMock);
} | final IRasterFunction functionMock = PowerMockito .mock(IRasterFunction.class); new BaseRasterModelEntry(null, RasterModelEntryType.VALUE, functionMock); } | /**
* Tests the creation of an invalid <code>RasterModelEntry</code>, using an
* invalid name
*/ | Tests the creation of an invalid <code>RasterModelEntry</code>, using an invalid name | testEntryConstructorNameFailure | {
"repo_name": "pmeisen/gen-misc",
"path": "test/net/meisen/general/genmisc/raster/definition/impl/TestBaseRasterModelEntry.java",
"license": "mit",
"size": 3290
} | [
"net.meisen.general.genmisc.raster.definition.RasterModelEntryType",
"net.meisen.general.genmisc.raster.definition.impl.BaseRasterModelEntry",
"net.meisen.general.genmisc.raster.function.IRasterFunction",
"org.powermock.api.mockito.PowerMockito"
] | import net.meisen.general.genmisc.raster.definition.RasterModelEntryType; import net.meisen.general.genmisc.raster.definition.impl.BaseRasterModelEntry; import net.meisen.general.genmisc.raster.function.IRasterFunction; import org.powermock.api.mockito.PowerMockito; | import net.meisen.general.genmisc.raster.definition.*; import net.meisen.general.genmisc.raster.definition.impl.*; import net.meisen.general.genmisc.raster.function.*; import org.powermock.api.mockito.*; | [
"net.meisen.general",
"org.powermock.api"
] | net.meisen.general; org.powermock.api; | 962,104 |
long delete(final KeyValue delete) {
long s = 0;
KeyValue toAdd = maybeCloneWithAllocator(delete);
s += heapSizeChange(toAdd, addToKVSet(toAdd));
timeRangeTracker.includeTimestamp(toAdd);
this.size.addAndGet(s);
return s;
} | long delete(final KeyValue delete) { long s = 0; KeyValue toAdd = maybeCloneWithAllocator(delete); s += heapSizeChange(toAdd, addToKVSet(toAdd)); timeRangeTracker.includeTimestamp(toAdd); this.size.addAndGet(s); return s; } | /**
* Write a delete
* @param delete
* @return approximate size of the passed key and value.
*/ | Write a delete | delete | {
"repo_name": "alipayhuber/hack-hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java",
"license": "apache-2.0",
"size": 37283
} | [
"org.apache.hadoop.hbase.KeyValue"
] | import org.apache.hadoop.hbase.KeyValue; | import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,451,552 |
protected String[] updateArray(String[] existingArray, String[] newValues)
{
//if we have no new values, nothing to update.
if(newValues == null || newValues.length == 0)
return null;
//if we have no old values, the new values are update.
if(existingArray == null || existingArray.length == 0)
return newValues;
//easy cases out, now we have to update.
boolean newFilesAdded = false;
//checking if there's new files to add.
Set<String> existingSet = new LinkedHashSet<String>(Arrays.asList(existingArray));
for(String value : newValues)
if(!existingSet.contains(value))
{
existingSet.add(value);
newFilesAdded = true;
}
if(newFilesAdded)
return existingSet.toArray(new String[existingSet.size()]);
return null;//no new files added.
}
//----------------------PUBLIC INTERFACE----------------------
| String[] function(String[] existingArray, String[] newValues) { if(newValues == null newValues.length == 0) return null; if(existingArray == null existingArray.length == 0) return newValues; boolean newFilesAdded = false; Set<String> existingSet = new LinkedHashSet<String>(Arrays.asList(existingArray)); for(String value : newValues) if(!existingSet.contains(value)) { existingSet.add(value); newFilesAdded = true; } if(newFilesAdded) return existingSet.toArray(new String[existingSet.size()]); return null; } | /**
* Updates the array with new values. If the array was actually changed,
* returns the new array. Otherwise, returns null.
* @param existingArray
* The array that should be updated.
* @param newValues
* The new values that should be added.
* @return
* The new, updated, array that contains new values or null if array was not changed.
*/ | Updates the array with new values. If the array was actually changed, returns the new array. Otherwise, returns null | updateArray | {
"repo_name": "xLeitix/jcloudscale",
"path": "core/src/main/java/at/ac/tuwien/infosys/jcloudscale/classLoader/caching/cache/CacheManagerAbstract.java",
"license": "apache-2.0",
"size": 7384
} | [
"java.util.Arrays",
"java.util.LinkedHashSet",
"java.util.Set"
] | import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 492,154 |
public static MetadataBlockHeader readHeader(RandomAccessFile raf) throws IOException
{
ByteBuffer rawdata = ByteBuffer.allocate(HEADER_LENGTH);
int bytesRead = raf.getChannel().read(rawdata);
if (bytesRead < HEADER_LENGTH)
{
throw new IOException("Unable to read required number of databytes read:" + bytesRead + ":required:" + HEADER_LENGTH);
}
rawdata.rewind();
return new MetadataBlockHeader(rawdata);
} | static MetadataBlockHeader function(RandomAccessFile raf) throws IOException { ByteBuffer rawdata = ByteBuffer.allocate(HEADER_LENGTH); int bytesRead = raf.getChannel().read(rawdata); if (bytesRead < HEADER_LENGTH) { throw new IOException(STR + bytesRead + STR + HEADER_LENGTH); } rawdata.rewind(); return new MetadataBlockHeader(rawdata); } | /**
* Create header by reading from file
*
* @param raf
* @return
* @throws IOException
*/ | Create header by reading from file | readHeader | {
"repo_name": "craigpetchell/Jaudiotagger",
"path": "src/org/jaudiotagger/audio/flac/metadatablock/MetadataBlockHeader.java",
"license": "lgpl-2.1",
"size": 4110
} | [
"java.io.IOException",
"java.io.RandomAccessFile",
"java.nio.ByteBuffer"
] | import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; | import java.io.*; import java.nio.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,857,519 |
public static void disp(Matrix A) {
display(A, 4);
}
| static void function(Matrix A) { display(A, 4); } | /**
* Display a matrix.
*
* @param A a dense or sparse matrix
*/ | Display a matrix | disp | {
"repo_name": "MingjieQian/LAML",
"path": "src/ml/utils/Printer.java",
"license": "apache-2.0",
"size": 19651
} | [
"la.matrix.Matrix"
] | import la.matrix.Matrix; | import la.matrix.*; | [
"la.matrix"
] | la.matrix; | 160,273 |
this.buf = key;
this.offset = offset;
this.length = length;
this.rowLen = ByteBufferUtils.toShort(this.buf, this.offset);
} | this.buf = key; this.offset = offset; this.length = length; this.rowLen = ByteBufferUtils.toShort(this.buf, this.offset); } | /**
* A setter that helps to avoid object creation every time and whenever
* there is a need to create new OffheapKeyOnlyKeyValue.
* @param key
* @param offset
* @param length
*/ | A setter that helps to avoid object creation every time and whenever there is a need to create new OffheapKeyOnlyKeyValue | setKey | {
"repo_name": "vincentpoon/hbase",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyOnlyKeyValue.java",
"license": "apache-2.0",
"size": 5936
} | [
"org.apache.hadoop.hbase.util.ByteBufferUtils"
] | import org.apache.hadoop.hbase.util.ByteBufferUtils; | import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 113,308 |
protected BusinessObjectFormatDdlCollectionResponse generateBusinessObjectFormatDdlCollectionImpl(
BusinessObjectFormatDdlCollectionRequest businessObjectFormatDdlCollectionRequest)
{
// Perform the validation of the entire request, before we start processing the individual requests that requires the database access.
validateBusinessObjectFormatDdlCollectionRequest(businessObjectFormatDdlCollectionRequest);
// Process the individual requests and build the response.
BusinessObjectFormatDdlCollectionResponse businessObjectFormatDdlCollectionResponse = new BusinessObjectFormatDdlCollectionResponse();
List<BusinessObjectFormatDdl> businessObjectFormatDdlResponses = new ArrayList<>();
businessObjectFormatDdlCollectionResponse.setBusinessObjectFormatDdlResponses(businessObjectFormatDdlResponses);
List<String> ddls = new ArrayList<>();
for (BusinessObjectFormatDdlRequest request : businessObjectFormatDdlCollectionRequest.getBusinessObjectFormatDdlRequests())
{
// Please note that when calling to process individual ddl requests, we ask to skip the request validation and trimming step.
BusinessObjectFormatDdl businessObjectFormatDdl = generateBusinessObjectFormatDdlImpl(request, true);
businessObjectFormatDdlResponses.add(businessObjectFormatDdl);
ddls.add(businessObjectFormatDdl.getDdl());
}
businessObjectFormatDdlCollectionResponse.setDdlCollection(StringUtils.join(ddls, "\n\n"));
return businessObjectFormatDdlCollectionResponse;
} | BusinessObjectFormatDdlCollectionResponse function( BusinessObjectFormatDdlCollectionRequest businessObjectFormatDdlCollectionRequest) { validateBusinessObjectFormatDdlCollectionRequest(businessObjectFormatDdlCollectionRequest); BusinessObjectFormatDdlCollectionResponse businessObjectFormatDdlCollectionResponse = new BusinessObjectFormatDdlCollectionResponse(); List<BusinessObjectFormatDdl> businessObjectFormatDdlResponses = new ArrayList<>(); businessObjectFormatDdlCollectionResponse.setBusinessObjectFormatDdlResponses(businessObjectFormatDdlResponses); List<String> ddls = new ArrayList<>(); for (BusinessObjectFormatDdlRequest request : businessObjectFormatDdlCollectionRequest.getBusinessObjectFormatDdlRequests()) { BusinessObjectFormatDdl businessObjectFormatDdl = generateBusinessObjectFormatDdlImpl(request, true); businessObjectFormatDdlResponses.add(businessObjectFormatDdl); ddls.add(businessObjectFormatDdl.getDdl()); } businessObjectFormatDdlCollectionResponse.setDdlCollection(StringUtils.join(ddls, "\n\n")); return businessObjectFormatDdlCollectionResponse; } | /**
* Retrieves the DDL to initialize the specified type of the database system (e.g. Hive) by creating tables for a collection of business object formats.
*
* @param businessObjectFormatDdlCollectionRequest the business object format DDL collection request
*
* @return the business object format DDL information
*/ | Retrieves the DDL to initialize the specified type of the database system (e.g. Hive) by creating tables for a collection of business object formats | generateBusinessObjectFormatDdlCollectionImpl | {
"repo_name": "seoj/herd",
"path": "herd-code/herd-service/src/main/java/org/finra/herd/service/impl/BusinessObjectFormatServiceImpl.java",
"license": "apache-2.0",
"size": 55759
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.commons.lang3.StringUtils",
"org.finra.herd.model.api.xml.BusinessObjectFormatDdl",
"org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest",
"org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionResponse",
"org.finra.herd.model.api.xml.BusinessObjectFormatDdlRequest"
] | import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.finra.herd.model.api.xml.BusinessObjectFormatDdl; import org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionRequest; import org.finra.herd.model.api.xml.BusinessObjectFormatDdlCollectionResponse; import org.finra.herd.model.api.xml.BusinessObjectFormatDdlRequest; | import java.util.*; import org.apache.commons.lang3.*; import org.finra.herd.model.api.xml.*; | [
"java.util",
"org.apache.commons",
"org.finra.herd"
] | java.util; org.apache.commons; org.finra.herd; | 512,234 |
public DistributedMember queryLock() {
try {
DLockRemoteToken remoteToken = this.lockService.queryLock(this.lockName);
return remoteToken.getLessee();
} catch (LockServiceDestroyedException e) {
cache.getCancelCriterion().checkCancelInProgress(null);
throw e;
}
} | DistributedMember function() { try { DLockRemoteToken remoteToken = this.lockService.queryLock(this.lockName); return remoteToken.getLessee(); } catch (LockServiceDestroyedException e) { cache.getCancelCriterion().checkCancelInProgress(null); throw e; } } | /**
* Ask the grantor who has the lock
*
* @return the ID of the member holding the lock
*/ | Ask the grantor who has the lock | queryLock | {
"repo_name": "davinash/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java",
"license": "apache-2.0",
"size": 383155
} | [
"org.apache.geode.distributed.DistributedMember",
"org.apache.geode.distributed.LockServiceDestroyedException",
"org.apache.geode.distributed.internal.locks.DLockRemoteToken"
] | import org.apache.geode.distributed.DistributedMember; import org.apache.geode.distributed.LockServiceDestroyedException; import org.apache.geode.distributed.internal.locks.DLockRemoteToken; | import org.apache.geode.distributed.*; import org.apache.geode.distributed.internal.locks.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,354,526 |
T visitDirectionalBultin_oppositeDirectionTo(@NotNull SofaLangParser.DirectionalBultin_oppositeDirectionToContext ctx); | T visitDirectionalBultin_oppositeDirectionTo(@NotNull SofaLangParser.DirectionalBultin_oppositeDirectionToContext ctx); | /**
* Visit a parse tree produced by {@link SofaLangParser#directionalBultin_oppositeDirectionTo}.
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>SofaLangParser#directionalBultin_oppositeDirectionTo</code> | visitDirectionalBultin_oppositeDirectionTo | {
"repo_name": "mockillo/sofa",
"path": "sofa/src/com/tehforce/sofa/parser/SofaLangVisitor.java",
"license": "mit",
"size": 10535
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,875,730 |
public List<T> findByQuery(String statement, String language); | List<T> function(String statement, String language); | /**
* Execute a JCR query in the specified language.
*
* @param statement the query to execute
* @param language the language of the query
* @return the list of found entites. An empty list if no entity was found.
*/ | Execute a JCR query in the specified language | findByQuery | {
"repo_name": "wisdom-framework/wisdom-jcr",
"path": "wisdom-jcr-core/src/main/java/org/wisdom/jcrom/object/JcrCrud.java",
"license": "apache-2.0",
"size": 2349
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,490,217 |
@SuppressWarnings("unchecked")
public static <V> DefaultAttributeType<V> cast(final DefaultAttributeType<?> type, final Class<V> valueClass)
throws ClassCastException
{
if (type != null) {
final Class<?> actual = type.getValueClass();
if (!valueClass.equals(actual)) {
throw new ClassCastException(Resources.format(Resources.Keys.MismatchedValueClass_3,
type.getName(), valueClass, actual));
}
}
return (DefaultAttributeType<V>) type;
} | @SuppressWarnings(STR) static <V> DefaultAttributeType<V> function(final DefaultAttributeType<?> type, final Class<V> valueClass) throws ClassCastException { if (type != null) { final Class<?> actual = type.getValueClass(); if (!valueClass.equals(actual)) { throw new ClassCastException(Resources.format(Resources.Keys.MismatchedValueClass_3, type.getName(), valueClass, actual)); } } return (DefaultAttributeType<V>) type; } | /**
* Casts the given attribute type to the given parameterized type.
* An exception is thrown immediately if the given type does not have the expected
* {@linkplain DefaultAttributeType#getValueClass() value class}.
*
* @param <V> the expected value class.
* @param type the attribute type to cast, or {@code null}.
* @param valueClass the expected value class.
* @return the attribute type casted to the given value class, or {@code null} if the given type was null.
* @throws ClassCastException if the given attribute type does not have the expected value class.
*
* @category verification
*/ | Casts the given attribute type to the given parameterized type. An exception is thrown immediately if the given type does not have the expected DefaultAttributeType#getValueClass() value class | cast | {
"repo_name": "apache/sis",
"path": "core/sis-feature/src/main/java/org/apache/sis/feature/Features.java",
"license": "apache-2.0",
"size": 13333
} | [
"org.apache.sis.internal.feature.Resources"
] | import org.apache.sis.internal.feature.Resources; | import org.apache.sis.internal.feature.*; | [
"org.apache.sis"
] | org.apache.sis; | 350,078 |
DataSource getDataSource() {
return ingestJob.getDataSource();
} | DataSource getDataSource() { return ingestJob.getDataSource(); } | /**
* Gets the data source for the ingest job that this ingest job executor is
* executing.
*
* @return The data source.
*/ | Gets the data source for the ingest job that this ingest job executor is executing | getDataSource | {
"repo_name": "rcordovano/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/ingest/IngestJobExecutor.java",
"license": "apache-2.0",
"size": 66701
} | [
"org.sleuthkit.datamodel.DataSource"
] | import org.sleuthkit.datamodel.DataSource; | import org.sleuthkit.datamodel.*; | [
"org.sleuthkit.datamodel"
] | org.sleuthkit.datamodel; | 438,012 |
private static String findFunction(String value, String dataType) {
if (value == null) {
return PolicyConstants.Functions.FUNCTION_EQUAL;
}
value = value.replace(">", ">");
value = value.replace("<", "<");
// only time range finction are valid for following data types
if (PolicyConstants.DataType.DATE.equals(dataType) ||
PolicyConstants.DataType.INT.equals(dataType) ||
PolicyConstants.DataType.TIME.equals(dataType) ||
PolicyConstants.DataType.DATE_TIME.equals(dataType) ||
PolicyConstants.DataType.DOUBLE.equals(dataType) ||
PolicyConstants.DataType.STRING.equals(dataType)) {
if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.EQUAL_RANGE)) {
if (value.contains(PolicyEditorConstants.FunctionIdentifier.RANGE_CLOSE)) {
return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS;
} else {
return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS_EQUAL;
}
}
if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.RANGE)) {
if (value.contains(PolicyEditorConstants.FunctionIdentifier.EQUAL_RANGE_CLOSE)) {
return PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS_EQUAL;
} else {
return PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS;
}
}
if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER)) {
return PolicyConstants.Functions.FUNCTION_GREATER;
} else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER_EQUAL)) {
return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL;
} else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS)) {
return PolicyConstants.Functions.FUNCTION_LESS;
} else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS_EQUAL)) {
return PolicyConstants.Functions.FUNCTION_LESS_EQUAL;
}
}
if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.REGEX)) {
return PolicyConstants.Functions.FUNCTION_EQUAL_MATCH_REGEXP;
}
if (value.contains(PolicyEditorConstants.FunctionIdentifier.OR)) {
return PolicyConstants.Functions.FUNCTION_AT_LEAST_ONE;
}
if (value.contains(PolicyEditorConstants.FunctionIdentifier.AND)) {
return PolicyConstants.Functions.FUNCTION_SET_EQUALS;
}
return PolicyConstants.Functions.FUNCTION_EQUAL;
} | static String function(String value, String dataType) { if (value == null) { return PolicyConstants.Functions.FUNCTION_EQUAL; } value = value.replace(">", ">"); value = value.replace("<", "<"); if (PolicyConstants.DataType.DATE.equals(dataType) PolicyConstants.DataType.INT.equals(dataType) PolicyConstants.DataType.TIME.equals(dataType) PolicyConstants.DataType.DATE_TIME.equals(dataType) PolicyConstants.DataType.DOUBLE.equals(dataType) PolicyConstants.DataType.STRING.equals(dataType)) { if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.EQUAL_RANGE)) { if (value.contains(PolicyEditorConstants.FunctionIdentifier.RANGE_CLOSE)) { return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS; } else { return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS_EQUAL; } } if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.RANGE)) { if (value.contains(PolicyEditorConstants.FunctionIdentifier.EQUAL_RANGE_CLOSE)) { return PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS_EQUAL; } else { return PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS; } } if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER)) { return PolicyConstants.Functions.FUNCTION_GREATER; } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER_EQUAL)) { return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL; } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS)) { return PolicyConstants.Functions.FUNCTION_LESS; } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS_EQUAL)) { return PolicyConstants.Functions.FUNCTION_LESS_EQUAL; } } if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.REGEX)) { return PolicyConstants.Functions.FUNCTION_EQUAL_MATCH_REGEXP; } if (value.contains(PolicyEditorConstants.FunctionIdentifier.OR)) { return PolicyConstants.Functions.FUNCTION_AT_LEAST_ONE; } if (value.contains(PolicyEditorConstants.FunctionIdentifier.AND)) { return PolicyConstants.Functions.FUNCTION_SET_EQUALS; } return PolicyConstants.Functions.FUNCTION_EQUAL; } | /**
* Helper method to create SOA policy
*
* @param value
* @param dataType
* @return
*/ | Helper method to create SOA policy | findFunction | {
"repo_name": "dharshanaw/carbon-identity-framework",
"path": "components/entitlement/org.wso2.carbon.identity.entitlement.common/src/main/java/org/wso2/carbon/identity/entitlement/common/util/PolicyEditorUtil.java",
"license": "apache-2.0",
"size": 134713
} | [
"org.wso2.balana.utils.Constants",
"org.wso2.carbon.identity.entitlement.common.PolicyEditorConstants"
] | import org.wso2.balana.utils.Constants; import org.wso2.carbon.identity.entitlement.common.PolicyEditorConstants; | import org.wso2.balana.utils.*; import org.wso2.carbon.identity.entitlement.common.*; | [
"org.wso2.balana",
"org.wso2.carbon"
] | org.wso2.balana; org.wso2.carbon; | 2,543,900 |
void setContent(ByteBuf buffer) throws IOException; | void setContent(ByteBuf buffer) throws IOException; | /**
* Set the content from the ChannelBuffer (erase any previous data)
*
* @param buffer
* must be not null
* @exception IOException
*/ | Set the content from the ChannelBuffer (erase any previous data) | setContent | {
"repo_name": "satishsaley/netty",
"path": "codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpData.java",
"license": "apache-2.0",
"size": 6862
} | [
"io.netty.buffer.ByteBuf",
"java.io.IOException"
] | import io.netty.buffer.ByteBuf; import java.io.IOException; | import io.netty.buffer.*; import java.io.*; | [
"io.netty.buffer",
"java.io"
] | io.netty.buffer; java.io; | 135,028 |
@Nullable
ASTNode getNameNode(); | ASTNode getNameNode(); | /**
* Returns the AST node for the function name identifier.
*
* @return the node, or null if the function is incomplete (only the "def"
* keyword was typed)
*/ | Returns the AST node for the function name identifier | getNameNode | {
"repo_name": "Soya93/Extract-Refactoring",
"path": "python/psi-api/src/com/jetbrains/python/psi/PyFunction.java",
"license": "apache-2.0",
"size": 4090
} | [
"com.intellij.lang.ASTNode"
] | import com.intellij.lang.ASTNode; | import com.intellij.lang.*; | [
"com.intellij.lang"
] | com.intellij.lang; | 892,353 |
@Override
public Object clone() throws CloneNotSupportedException {
XYAreaRenderer clone = (XYAreaRenderer) super.clone();
clone.legendArea = ShapeUtils.clone(this.legendArea);
return clone;
} | Object function() throws CloneNotSupportedException { XYAreaRenderer clone = (XYAreaRenderer) super.clone(); clone.legendArea = ShapeUtils.clone(this.legendArea); return clone; } | /**
* Returns a clone of the renderer.
*
* @return A clone.
*
* @throws CloneNotSupportedException if the renderer cannot be cloned.
*/ | Returns a clone of the renderer | clone | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/renderer/xy/XYAreaRenderer.java",
"license": "lgpl-2.1",
"size": 28627
} | [
"org.jfree.chart.util.ShapeUtils"
] | import org.jfree.chart.util.ShapeUtils; | import org.jfree.chart.util.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,326,577 |
public List<ReplenishDetail> findWhereToLocationEquals(String toLocation) throws ReplenishDetailDaoException; | List<ReplenishDetail> function(String toLocation) throws ReplenishDetailDaoException; | /**
* Returns all rows from the replenish_detail table that match the criteria 'to_location = :toLocation'.
*/ | Returns all rows from the replenish_detail table that match the criteria 'to_location = :toLocation' | findWhereToLocationEquals | {
"repo_name": "rmage/gnvc-ims",
"path": "src/java/com/app/wms/engine/db/dao/ReplenishDetailDao.java",
"license": "lgpl-3.0",
"size": 4427
} | [
"com.app.wms.engine.db.dto.ReplenishDetail",
"com.app.wms.engine.db.exceptions.ReplenishDetailDaoException",
"java.util.List"
] | import com.app.wms.engine.db.dto.ReplenishDetail; import com.app.wms.engine.db.exceptions.ReplenishDetailDaoException; import java.util.List; | import com.app.wms.engine.db.dto.*; import com.app.wms.engine.db.exceptions.*; import java.util.*; | [
"com.app.wms",
"java.util"
] | com.app.wms; java.util; | 1,668,559 |
public void removeIgnoredView(View v) {
mViewAbove.removeIgnoredView(v);
} | void function(View v) { mViewAbove.removeIgnoredView(v); } | /**
* Remove a View ignored by the Touch Down event when mode is Fullscreen
*
* @param v a view not wanted to be ignored anymore
*/ | Remove a View ignored by the Touch Down event when mode is Fullscreen | removeIgnoredView | {
"repo_name": "qmc000/NewMessage",
"path": "message/src/main/java/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java",
"license": "apache-2.0",
"size": 28211
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 219,027 |
private void processGroupConfiguration(TreeNode<Resource> host) {
Map<String, Object> desiredConfigMap = host.getObject().getPropertiesMap().get("Hosts/desired_configs");
if (desiredConfigMap != null) {
for (Map.Entry<String, Object> entry : desiredConfigMap.entrySet()) {
String type = entry.getKey();
HostConfig hostConfig = (HostConfig) entry.getValue();
Map<Long, String> overrides = hostConfig.getConfigGroupOverrides();
if (overrides != null && ! overrides.isEmpty()) {
Long version = Collections.max(overrides.keySet());
String tag = overrides.get(version);
TreeNode<Resource> clusterNode = host.getParent().getParent();
TreeNode<Resource> configNode = clusterNode.getChild("configurations");
for (TreeNode<Resource> config : configNode.getChildren()) {
ExportedConfiguration configuration = new ExportedConfiguration(config);
if (type.equals(configuration.getType()) && tag.equals(configuration.getTag())) {
getConfigurations().add(configuration);
break;
}
}
}
}
}
} | void function(TreeNode<Resource> host) { Map<String, Object> desiredConfigMap = host.getObject().getPropertiesMap().get(STR); if (desiredConfigMap != null) { for (Map.Entry<String, Object> entry : desiredConfigMap.entrySet()) { String type = entry.getKey(); HostConfig hostConfig = (HostConfig) entry.getValue(); Map<Long, String> overrides = hostConfig.getConfigGroupOverrides(); if (overrides != null && ! overrides.isEmpty()) { Long version = Collections.max(overrides.keySet()); String tag = overrides.get(version); TreeNode<Resource> clusterNode = host.getParent().getParent(); TreeNode<Resource> configNode = clusterNode.getChild(STR); for (TreeNode<Resource> config : configNode.getChildren()) { ExportedConfiguration configuration = new ExportedConfiguration(config); if (type.equals(configuration.getType()) && tag.equals(configuration.getTag())) { getConfigurations().add(configuration); break; } } } } } } | /**
* Process host group configuration.
*
* @param host host node
*/ | Process host group configuration | processGroupConfiguration | {
"repo_name": "zouzhberk/ambaridemo",
"path": "demo-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java",
"license": "apache-2.0",
"size": 17880
} | [
"java.util.Collections",
"java.util.Map",
"org.apache.ambari.server.api.util.TreeNode",
"org.apache.ambari.server.controller.spi.Resource",
"org.apache.ambari.server.state.HostConfig"
] | import java.util.Collections; import java.util.Map; import org.apache.ambari.server.api.util.TreeNode; import org.apache.ambari.server.controller.spi.Resource; import org.apache.ambari.server.state.HostConfig; | import java.util.*; import org.apache.ambari.server.api.util.*; import org.apache.ambari.server.controller.spi.*; import org.apache.ambari.server.state.*; | [
"java.util",
"org.apache.ambari"
] | java.util; org.apache.ambari; | 947,242 |
protected final int storeSingleFile(SingleFileRequest saveReq)
throws Exception {
// DEBUG
long startTime = 0L;
if ( Debug.EnableInfo && hasDebug()) {
Debug.println("## DBFileLoader storeFile() req=" + saveReq.toString() + ", thread="
+ Thread.currentThread().getName());
startTime = System.currentTimeMillis();
}
// Check if the temporary file still exists, if not then the file has been deleted from the
// filesystem
File tempFile = new File(saveReq.getTemporaryFile());
FileSegment fileSeg = findFileSegmentForPath(saveReq.getVirtualPath());
if ( tempFile.exists() == false || fileSeg == null) {
// DEBUG
if ( Debug.EnableInfo && hasDebug())
Debug.println(" Temporary file deleted");
// Return an error status
return StsError;
}
// Run any file store processors
runFileStoreProcessors(m_dbCtx, saveReq.getFileState(), fileSeg);
// Get the temporary file size
long fileSize = tempFile.length();
// DEBUG
if ( Debug.EnableInfo && hasDebug())
Debug.println("## DBFileLoader fileSize=" + fileSize);
// Update the segment status, and clear the updated flag
fileSeg.setStatus(FileSegmentInfo.Saving);
fileSeg.getInfo().setUpdated(false);
try {
// Save the file data to the database
getDBDataInterface().saveFileData(saveReq.getFileId(), saveReq.getStreamId(), fileSeg);
}
catch (DBException ex) {
Debug.println(ex);
}
catch (IOException ex) {
Debug.println(ex);
}
// DEBUG
if ( Debug.EnableInfo && hasDebug()) {
long endTime = System.currentTimeMillis();
Debug.println("## DBFileLoader saved file=" + saveReq.toString() + ", time=" + (endTime - startTime) + "ms");
}
// Update the segment status
fileSeg.setStatus(FileSegmentInfo.Saved, false);
// Indicate that the file save request was processed
return StsSuccess;
} | final int function(SingleFileRequest saveReq) throws Exception { long startTime = 0L; if ( Debug.EnableInfo && hasDebug()) { Debug.println(STR + saveReq.toString() + STR + Thread.currentThread().getName()); startTime = System.currentTimeMillis(); } File tempFile = new File(saveReq.getTemporaryFile()); FileSegment fileSeg = findFileSegmentForPath(saveReq.getVirtualPath()); if ( tempFile.exists() == false fileSeg == null) { if ( Debug.EnableInfo && hasDebug()) Debug.println(STR); return StsError; } runFileStoreProcessors(m_dbCtx, saveReq.getFileState(), fileSeg); long fileSize = tempFile.length(); if ( Debug.EnableInfo && hasDebug()) Debug.println(STR + fileSize); fileSeg.setStatus(FileSegmentInfo.Saving); fileSeg.getInfo().setUpdated(false); try { getDBDataInterface().saveFileData(saveReq.getFileId(), saveReq.getStreamId(), fileSeg); } catch (DBException ex) { Debug.println(ex); } catch (IOException ex) { Debug.println(ex); } if ( Debug.EnableInfo && hasDebug()) { long endTime = System.currentTimeMillis(); Debug.println(STR + saveReq.toString() + STR + (endTime - startTime) + "ms"); } fileSeg.setStatus(FileSegmentInfo.Saved, false); return StsSuccess; } | /**
* Process a store single file request
*
* @param saveReq SingleFileRequest
* @return int
* @throws Exception
*/ | Process a store single file request | storeSingleFile | {
"repo_name": "loftuxab/community-edition-old",
"path": "projects/alfresco-jlan/source/java/org/alfresco/jlan/server/filesys/db/DBFileLoader.java",
"license": "lgpl-3.0",
"size": 68345
} | [
"java.io.File",
"java.io.IOException",
"org.alfresco.jlan.debug.Debug",
"org.alfresco.jlan.server.filesys.loader.FileSegment",
"org.alfresco.jlan.server.filesys.loader.FileSegmentInfo",
"org.alfresco.jlan.server.filesys.loader.SingleFileRequest"
] | import java.io.File; import java.io.IOException; import org.alfresco.jlan.debug.Debug; import org.alfresco.jlan.server.filesys.loader.FileSegment; import org.alfresco.jlan.server.filesys.loader.FileSegmentInfo; import org.alfresco.jlan.server.filesys.loader.SingleFileRequest; | import java.io.*; import org.alfresco.jlan.debug.*; import org.alfresco.jlan.server.filesys.loader.*; | [
"java.io",
"org.alfresco.jlan"
] | java.io; org.alfresco.jlan; | 252,877 |
public void setBackGroundColor(Color color) {
backgroundColor = color;
repaint();
}
| void function(Color color) { backgroundColor = color; repaint(); } | /**
* Sets the background color.
* @param color the color
*/ | Sets the background color | setBackGroundColor | {
"repo_name": "kuriking/testdc2",
"path": "net.dependableos.dcase.diagram/src/net/dependableos/dcase/diagram/edit/parts/custom/CustomWrappingLabel.java",
"license": "epl-1.0",
"size": 4572
} | [
"org.eclipse.swt.graphics.Color"
] | import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 618,315 |
public TopologyParameters withTargetSubnet(SubResource targetSubnet) {
this.targetSubnet = targetSubnet;
return this;
} | TopologyParameters function(SubResource targetSubnet) { this.targetSubnet = targetSubnet; return this; } | /**
* Set the reference of the Subnet resource.
*
* @param targetSubnet the targetSubnet value to set
* @return the TopologyParameters object itself.
*/ | Set the reference of the Subnet resource | withTargetSubnet | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/TopologyParameters.java",
"license": "mit",
"size": 2763
} | [
"com.microsoft.azure.SubResource"
] | import com.microsoft.azure.SubResource; | import com.microsoft.azure.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 542,840 |
private static int getIntermediarId(Class clazz, Component comp)
{
if (comp != null)
{
if (MultiLineLabel.class.isAssignableFrom(clazz)
|| LabelFactory.FullLineLabel.class.isAssignableFrom(clazz))
return (FULL_LINE_COMPONENT_CONSTRAINT);
if (PathSelectionPanel.class.isAssignableFrom(clazz)
|| JCheckBox.class.isAssignableFrom(clazz)
|| JRadioButton.class.isAssignableFrom(clazz))
return (FULL_LINE_CONTROL_CONSTRAINT);
if (FillerComponent.class.isAssignableFrom(clazz)
|| javax.swing.Box.Filler.class.isAssignableFrom(clazz))
{
Dimension size = comp.getPreferredSize();
if (size.height >= Short.MAX_VALUE || size.height <= 0)
{
size.height = 0;
comp.setSize(size);
return (XDUMMY_CONSTRAINT);
}
else if (size.width >= Short.MAX_VALUE || size.width <= 0)
{
size.width = 0;
comp.setSize(size);
return (YDUMMY_CONSTRAINT);
}
}
}
if (JScrollPane.class.isAssignableFrom(clazz)) return (XY_VARIABLE_CONSTRAINT);
if (JLabel.class.isAssignableFrom(clazz)) return (LABEL_CONSTRAINT);
if (JTextComponent.class.isAssignableFrom(clazz)) return (TEXT_CONSTRAINT);
if (FillerComponent.class.isAssignableFrom(clazz)) return (XDUMMY_CONSTRAINT);
if (javax.swing.Box.Filler.class.isAssignableFrom(clazz)) return (XDUMMY_CONSTRAINT);
return (CONTROL_CONSTRAINT); // Other controls.
} | static int function(Class clazz, Component comp) { if (comp != null) { if (MultiLineLabel.class.isAssignableFrom(clazz) LabelFactory.FullLineLabel.class.isAssignableFrom(clazz)) return (FULL_LINE_COMPONENT_CONSTRAINT); if (PathSelectionPanel.class.isAssignableFrom(clazz) JCheckBox.class.isAssignableFrom(clazz) JRadioButton.class.isAssignableFrom(clazz)) return (FULL_LINE_CONTROL_CONSTRAINT); if (FillerComponent.class.isAssignableFrom(clazz) javax.swing.Box.Filler.class.isAssignableFrom(clazz)) { Dimension size = comp.getPreferredSize(); if (size.height >= Short.MAX_VALUE size.height <= 0) { size.height = 0; comp.setSize(size); return (XDUMMY_CONSTRAINT); } else if (size.width >= Short.MAX_VALUE size.width <= 0) { size.width = 0; comp.setSize(size); return (YDUMMY_CONSTRAINT); } } } if (JScrollPane.class.isAssignableFrom(clazz)) return (XY_VARIABLE_CONSTRAINT); if (JLabel.class.isAssignableFrom(clazz)) return (LABEL_CONSTRAINT); if (JTextComponent.class.isAssignableFrom(clazz)) return (TEXT_CONSTRAINT); if (FillerComponent.class.isAssignableFrom(clazz)) return (XDUMMY_CONSTRAINT); if (javax.swing.Box.Filler.class.isAssignableFrom(clazz)) return (XDUMMY_CONSTRAINT); return (CONTROL_CONSTRAINT); } | /**
* Returns an index depending on the class type. Only for internal use.
*
* @param clazz class for which the index should be returned
* @param comp component for which the index should be returned
* @return an index depending on the class type
*/ | Returns an index depending on the class type. Only for internal use | getIntermediarId | {
"repo_name": "RomRaider/original.mirror",
"path": "installer/IzPack/src/lib/com/izforge/izpack/gui/IzPanelLayout.java",
"license": "gpl-2.0",
"size": 54515
} | [
"com.izforge.izpack.panels.PathSelectionPanel",
"com.izforge.izpack.util.MultiLineLabel",
"java.awt.Component",
"java.awt.Dimension",
"javax.swing.JCheckBox",
"javax.swing.JLabel",
"javax.swing.JRadioButton",
"javax.swing.JScrollPane",
"javax.swing.text.JTextComponent"
] | import com.izforge.izpack.panels.PathSelectionPanel; import com.izforge.izpack.util.MultiLineLabel; import java.awt.Component; import java.awt.Dimension; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.text.JTextComponent; | import com.izforge.izpack.panels.*; import com.izforge.izpack.util.*; import java.awt.*; import javax.swing.*; import javax.swing.text.*; | [
"com.izforge.izpack",
"java.awt",
"javax.swing"
] | com.izforge.izpack; java.awt; javax.swing; | 1,824,731 |
public static String getApiInfo() {
String res = "";
RestClient rc = new RestClient(null, null);
try {
res = rc.get(Settings.SERVER_URL + "/info", null);
} catch (IOException ex) {
}
return res;
} | static String function() { String res = STR/info", null); } catch (IOException ex) { } return res; } | /**
* Get the server API information.
*
* @return The response string.
*/ | Get the server API information | getApiInfo | {
"repo_name": "devicehive/devicehive-j2me",
"path": "src/framework/src/com/dataart/devicehive/RestClient.java",
"license": "mit",
"size": 12821
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,884,947 |
public static Activity getCurrentActivity(){
return activityStack.lastElement();
}
| static Activity function(){ return activityStack.lastElement(); } | /**
* get current activity
* @return
*/ | get current activity | getCurrentActivity | {
"repo_name": "fantasymaker-cn/LSQ-Android-Utils",
"path": "src/cn/fantasymaker/lsqandroidutils/base/BaseApplication.java",
"license": "apache-2.0",
"size": 3490
} | [
"android.app.Activity"
] | import android.app.Activity; | import android.app.*; | [
"android.app"
] | android.app; | 1,775,334 |
ItemStack extractItem(ItemStack container, ItemStack item, boolean simulate); | ItemStack extractItem(ItemStack container, ItemStack item, boolean simulate); | /**
* Extract an ItemStack from the inventory of this container item. This returns the resulting stack - a null return means that nothing was extracted!
*
* @param container
* ItemStack with the inventory.
* @param item
* ItemStack to be extracted. The size of this stack corresponds to the maximum amount to extract. If this is null, then a null ItemStack should
* immediately be returned.
* @param simulate
* If TRUE, the extraction will only be simulated.
* @return An ItemStack representing how much was extracted (or would have been, if simulated) from the container inventory.
*/ | Extract an ItemStack from the inventory of this container item. This returns the resulting stack - a null return means that nothing was extracted | extractItem | {
"repo_name": "Azhdev/advanced-turbines",
"path": "turbines/java/cofh/api/item/IInventoryContainerItem.java",
"license": "gpl-3.0",
"size": 2990
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 927,123 |
public void setNextLink(final String nextLinkValue) {
this.nextLink = nextLinkValue;
}
private ArrayList<RecordSet> recordSets; | void function(final String nextLinkValue) { this.nextLink = nextLinkValue; } private ArrayList<RecordSet> recordSets; | /**
* Optional. Gets or sets the continuation token for the next page.
* @param nextLinkValue The NextLink value.
*/ | Optional. Gets or sets the continuation token for the next page | setNextLink | {
"repo_name": "southworkscom/azure-sdk-for-java",
"path": "resource-management/azure-mgmt-dns/src/main/java/com/microsoft/azure/management/dns/models/RecordSetListResponse.java",
"license": "apache-2.0",
"size": 2786
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,910,064 |
public void startDescription(DatabaseMetaData dbMetaData
, String schema, String tableName, String tableType) {
try {
writeMarkup("\n<table><tr><td><pre>");
sqlTable = new SQLTable();
sqlTable.setOutputFormat("sql");
sqlTable.setCharWriter(charWriter);
sqlTable.setTargetEncoding(getTargetEncoding());
sqlTable.startDescription(dbMetaData, schema, tableName, tableType);
} catch (Exception exc) {
log.error(exc.getMessage(), exc);
}
} // startDescription | void function(DatabaseMetaData dbMetaData , String schema, String tableName, String tableType) { try { writeMarkup(STR); sqlTable = new SQLTable(); sqlTable.setOutputFormat("sql"); sqlTable.setCharWriter(charWriter); sqlTable.setTargetEncoding(getTargetEncoding()); sqlTable.startDescription(dbMetaData, schema, tableName, tableType); } catch (Exception exc) { log.error(exc.getMessage(), exc); } } | /** Starts the description of a table with DROP table and CREATE TABLE
* @param dbMetaData database metadata
* as obtained with <code>con.getMetaData()</code>
* @param schema name of the table's schema, or null if none
* @param tableName name of the table
* @param tableType type of the table: "TABLE", "VIEW", etc.
*/ | Starts the description of a table with DROP table and CREATE TABLE | startDescription | {
"repo_name": "gfis/dbat",
"path": "src/main/java/org/teherba/dbat/format/HTMLTable.java",
"license": "apache-2.0",
"size": 36396
} | [
"java.sql.DatabaseMetaData"
] | import java.sql.DatabaseMetaData; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,334,449 |
private void assertExpectedSuggestion(String expectedSrc,
String destPath, OneTest thisTest)
throws SubversionException
{
String wcPath = fileToSVNPath(new File(thisTest.getWCPath(),
destPath), false);
String[] suggestions = client.suggestMergeSources(wcPath,
Revision.WORKING);
assertNotNull(suggestions);
assertTrue(suggestions.length >= 1);
assertTrue("Unexpected copy source path, expected " +
expectedSrc + ", got " + suggestions[0],
expectedSrc.equals(suggestions[0]));
// Same test using URL
String url = thisTest.getUrl() + "/" + destPath;
suggestions = client.suggestMergeSources(url, Revision.HEAD);
assertNotNull(suggestions);
assertTrue(suggestions.length >= 1);
assertTrue("Unexpected copy source path, expected " +
expectedSrc + ", got " + suggestions[0],
expectedSrc.equals(suggestions[0]));
} | void function(String expectedSrc, String destPath, OneTest thisTest) throws SubversionException { String wcPath = fileToSVNPath(new File(thisTest.getWCPath(), destPath), false); String[] suggestions = client.suggestMergeSources(wcPath, Revision.WORKING); assertNotNull(suggestions); assertTrue(suggestions.length >= 1); assertTrue(STR + expectedSrc + STR + suggestions[0], expectedSrc.equals(suggestions[0])); String url = thisTest.getUrl() + "/" + destPath; suggestions = client.suggestMergeSources(url, Revision.HEAD); assertNotNull(suggestions); assertTrue(suggestions.length >= 1); assertTrue(STR + expectedSrc + STR + suggestions[0], expectedSrc.equals(suggestions[0])); } | /**
* Assert that the first merge source suggested for
* <code>destPath</code> at {@link Revision#WORKING} and {@link
* Revision#HEAD} is equivalent to <code>expectedSrc</code>.
* @exception SubversionException If retrieval of the copy source fails.
* @since 1.5
*/ | Assert that the first merge source suggested for <code>destPath</code> at <code>Revision#WORKING</code> and <code>Revision#HEAD</code> is equivalent to <code>expectedSrc</code> | assertExpectedSuggestion | {
"repo_name": "YueLinHo/Subversion",
"path": "subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java",
"license": "apache-2.0",
"size": 141745
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,858,466 |
private void assertPhase(@Nullable ReplicationTask task, String phase) {
assertPhase(task, equalTo(phase));
} | void function(@Nullable ReplicationTask task, String phase) { assertPhase(task, equalTo(phase)); } | /**
* If the task is non-null this asserts that the phrase matches.
*/ | If the task is non-null this asserts that the phrase matches | assertPhase | {
"repo_name": "strahanjen/strahanjen.github.io",
"path": "elasticsearch-master/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java",
"license": "bsd-3-clause",
"size": 56131
} | [
"org.elasticsearch.common.Nullable",
"org.hamcrest.Matchers"
] | import org.elasticsearch.common.Nullable; import org.hamcrest.Matchers; | import org.elasticsearch.common.*; import org.hamcrest.*; | [
"org.elasticsearch.common",
"org.hamcrest"
] | org.elasticsearch.common; org.hamcrest; | 2,802,192 |
EList getTitle(); | EList getTitle(); | /**
* Returns the value of the '<em><b>Title</b></em>' containment reference list.
* The list contents are of type {@link org.w3.xlink.TitleEltType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Title</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Title</em>' containment reference list.
* @see org.w3.xlink.XlinkPackage#getExtended_Title()
* @model type="org.w3.xlink.TitleEltType" containment="true" transient="true" changeable="false" volatile="true" derived="true"
* extendedMetaData="kind='element' name='title' namespace='##targetNamespace' group='title:group'"
* @generated
*/ | Returns the value of the 'Title' containment reference list. The list contents are of type <code>org.w3.xlink.TitleEltType</code>. If the meaning of the 'Title' containment reference list isn't clear, there really should be more of a description here... | getTitle | {
"repo_name": "geotools/geotools",
"path": "modules/ogc/org.w3.xlink/src/org/w3/xlink/Extended.java",
"license": "lgpl-2.1",
"size": 8573
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,547,271 |
@Transactional
public void validatePut(TradeJson json, UserEntity user) {
verifyThatUserNameIsBetween3And150(json.getName());
verifyThatDescriptionIsBetween3And25000(json.getDescription());
verifyThatTradeExists(json.getTradeId());
validateThatUserOwnsTrade(json.getTradeId(), user.getUserId());
verifyThatNameIsUniqueExceptForTheCurrentTrade(json);
} | void function(TradeJson json, UserEntity user) { verifyThatUserNameIsBetween3And150(json.getName()); verifyThatDescriptionIsBetween3And25000(json.getDescription()); verifyThatTradeExists(json.getTradeId()); validateThatUserOwnsTrade(json.getTradeId(), user.getUserId()); verifyThatNameIsUniqueExceptForTheCurrentTrade(json); } | /**
* Validates if name is mandatory and must be between 3 and 150 characters in length.
* Validates if the {@code Trade.tradeId} exists otherwise return status NOT_FOUND.
* Validates if authenticated {@code user} is the owner of the trade
* Validates if name is unique but not the same which is being updated
* @param json
* @param user
*/ | Validates if name is mandatory and must be between 3 and 150 characters in length. Validates if the Trade.tradeId exists otherwise return status NOT_FOUND. Validates if authenticated user is the owner of the trade Validates if name is unique but not the same which is being updated | validatePut | {
"repo_name": "rafasantos/matchandtrade",
"path": "src/main/java/com/matchandtrade/rest/v1/validator/TradeValidator.java",
"license": "mit",
"size": 4067
} | [
"com.matchandtrade.persistence.entity.UserEntity",
"com.matchandtrade.rest.v1.json.TradeJson"
] | import com.matchandtrade.persistence.entity.UserEntity; import com.matchandtrade.rest.v1.json.TradeJson; | import com.matchandtrade.persistence.entity.*; import com.matchandtrade.rest.v1.json.*; | [
"com.matchandtrade.persistence",
"com.matchandtrade.rest"
] | com.matchandtrade.persistence; com.matchandtrade.rest; | 2,685,938 |
// JUnitDoclet begin method testcase.createInstance
return new OffsetLocator();
// JUnitDoclet end method testcase.createInstance
}
| return new OffsetLocator(); } | /**
* Factory method for instances of the class to be tested.
*/ | Factory method for instances of the class to be tested | createInstance | {
"repo_name": "samskivert/jhotdraw6",
"path": "src/test/java/org/jhotdraw/test/standard/OffsetLocatorTest.java",
"license": "lgpl-2.1",
"size": 4500
} | [
"org.jhotdraw.standard.OffsetLocator"
] | import org.jhotdraw.standard.OffsetLocator; | import org.jhotdraw.standard.*; | [
"org.jhotdraw.standard"
] | org.jhotdraw.standard; | 702,025 |
static Class<? extends JournalManager> getJournalClass(Configuration conf,
String uriScheme) {
String key
= DFSConfigKeys.DFS_NAMENODE_EDITS_PLUGIN_PREFIX + "." + uriScheme;
Class <? extends JournalManager> clazz = null;
try {
clazz = conf.getClass(key, null, JournalManager.class);
} catch (RuntimeException re) {
throw new IllegalArgumentException(
"Invalid class specified for " + uriScheme, re);
}
if (clazz == null) {
LOG.warn("No class configured for " +uriScheme
+ ", " + key + " is empty");
throw new IllegalArgumentException(
"No class configured for " + uriScheme);
}
return clazz;
} | static Class<? extends JournalManager> getJournalClass(Configuration conf, String uriScheme) { String key = DFSConfigKeys.DFS_NAMENODE_EDITS_PLUGIN_PREFIX + "." + uriScheme; Class <? extends JournalManager> clazz = null; try { clazz = conf.getClass(key, null, JournalManager.class); } catch (RuntimeException re) { throw new IllegalArgumentException( STR + uriScheme, re); } if (clazz == null) { LOG.warn(STR +uriScheme + STR + key + STR); throw new IllegalArgumentException( STR + uriScheme); } return clazz; } | /**
* Retrieve the implementation class for a Journal scheme.
* @param conf The configuration to retrieve the information from
* @param uriScheme The uri scheme to look up.
* @return the class of the journal implementation
* @throws IllegalArgumentException if no class is configured for uri
*/ | Retrieve the implementation class for a Journal scheme | getJournalClass | {
"repo_name": "cnfire/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java",
"license": "apache-2.0",
"size": 56758
} | [
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hdfs.DFSConfigKeys"
] | import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.DFSConfigKeys; | import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 635,167 |
void stopAnimation() {
mHasAnimation = false;
if (mIndeterminateDrawable instanceof Animatable) {
((Animatable) mIndeterminateDrawable).stop();
mShouldStartAnimationDrawable = false;
}
postInvalidate();
} | void stopAnimation() { mHasAnimation = false; if (mIndeterminateDrawable instanceof Animatable) { ((Animatable) mIndeterminateDrawable).stop(); mShouldStartAnimationDrawable = false; } postInvalidate(); } | /**
* <p>Stop the indeterminate progress animation.</p>
*/ | Stop the indeterminate progress animation | stopAnimation | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/widget/ProgressBar.java",
"license": "gpl-3.0",
"size": 69704
} | [
"android.graphics.drawable.Animatable"
] | import android.graphics.drawable.Animatable; | import android.graphics.drawable.*; | [
"android.graphics"
] | android.graphics; | 2,377,496 |
public void setContainerHLMarkingHLAPI(
HLMarkingHLAPI elem){
if(elem!=null)
item.setContainerHLMarking((HLMarking)elem.getContainedItem());
}
| void function( HLMarkingHLAPI elem){ if(elem!=null) item.setContainerHLMarking((HLMarking)elem.getContainedItem()); } | /**
* set ContainerHLMarking
*/ | set ContainerHLMarking | setContainerHLMarkingHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/finiteIntRanges/hlapi/GreaterThanOrEqualHLAPI.java",
"license": "epl-1.0",
"size": 90341
} | [
"fr.lip6.move.pnml.symmetricnet.hlcorestructure.HLMarking",
"fr.lip6.move.pnml.symmetricnet.hlcorestructure.hlapi.HLMarkingHLAPI"
] | import fr.lip6.move.pnml.symmetricnet.hlcorestructure.HLMarking; import fr.lip6.move.pnml.symmetricnet.hlcorestructure.hlapi.HLMarkingHLAPI; | import fr.lip6.move.pnml.symmetricnet.hlcorestructure.*; import fr.lip6.move.pnml.symmetricnet.hlcorestructure.hlapi.*; | [
"fr.lip6.move"
] | fr.lip6.move; | 529,939 |
public Observable<ServiceResponse<VpnClientIPsecParametersInner>> getVpnclientIpsecParametersWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (virtualNetworkGatewayName == null) {
throw new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-08-01";
Observable<Response<ResponseBody>> observable = service.getVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken<VpnClientIPsecParametersInner>() { }.getType());
} | Observable<ServiceResponse<VpnClientIPsecParametersInner>> function(String resourceGroupName, String virtualNetworkGatewayName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (virtualNetworkGatewayName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } final String apiVersion = STR; Observable<Response<ResponseBody>> observable = service.getVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken<VpnClientIPsecParametersInner>() { }.getType()); } | /**
* The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The virtual network gateway name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/ | The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider | getVpnclientIpsecParametersWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewaysInner.java",
"license": "mit",
"size": 230879
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.azure.LongRunningFinalState",
"com.microsoft.azure.LongRunningOperationOptions",
"com.microsoft.rest.ServiceResponse"
] | import com.google.common.reflect.TypeToken; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; import com.microsoft.rest.ServiceResponse; | import com.google.common.reflect.*; import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.google.common",
"com.microsoft.azure",
"com.microsoft.rest"
] | com.google.common; com.microsoft.azure; com.microsoft.rest; | 2,578,512 |
private int[] evaluateIntervalLiteralAsHour(
RelDataTypeSystem typeSystem, int sign,
String value,
String originalValue,
SqlParserPos pos) {
BigDecimal hour;
// validate as HOUR(startPrecision), e.g. 'HH'
String intervalPattern = "(\\d+)";
Matcher m = Pattern.compile(intervalPattern).matcher(value);
if (m.matches()) {
// Break out field values
try {
hour = parseField(m, 1);
} catch (NumberFormatException e) {
throw invalidValueException(pos, originalValue);
}
// Validate individual fields
checkLeadFieldInRange(typeSystem, sign, hour, TimeUnit.HOUR, pos);
// package values up for return
return fillIntervalValueArray(sign, ZERO, hour, ZERO, ZERO, ZERO);
} else {
throw invalidValueException(pos, originalValue);
}
} | int[] function( RelDataTypeSystem typeSystem, int sign, String value, String originalValue, SqlParserPos pos) { BigDecimal hour; String intervalPattern = STR; Matcher m = Pattern.compile(intervalPattern).matcher(value); if (m.matches()) { try { hour = parseField(m, 1); } catch (NumberFormatException e) { throw invalidValueException(pos, originalValue); } checkLeadFieldInRange(typeSystem, sign, hour, TimeUnit.HOUR, pos); return fillIntervalValueArray(sign, ZERO, hour, ZERO, ZERO, ZERO); } else { throw invalidValueException(pos, originalValue); } } | /**
* Validates an INTERVAL literal against an HOUR interval qualifier.
*
* @throws org.apache.calcite.runtime.CalciteContextException if the interval
* value is illegal
*/ | Validates an INTERVAL literal against an HOUR interval qualifier | evaluateIntervalLiteralAsHour | {
"repo_name": "datametica/calcite",
"path": "core/src/main/java/org/apache/calcite/sql/SqlIntervalQualifier.java",
"license": "apache-2.0",
"size": 37956
} | [
"java.math.BigDecimal",
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"org.apache.calcite.avatica.util.TimeUnit",
"org.apache.calcite.rel.type.RelDataTypeSystem",
"org.apache.calcite.sql.parser.SqlParserPos"
] | import java.math.BigDecimal; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.calcite.avatica.util.TimeUnit; import org.apache.calcite.rel.type.RelDataTypeSystem; import org.apache.calcite.sql.parser.SqlParserPos; | import java.math.*; import java.util.regex.*; import org.apache.calcite.avatica.util.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.sql.parser.*; | [
"java.math",
"java.util",
"org.apache.calcite"
] | java.math; java.util; org.apache.calcite; | 97,490 |
public DeltaSequence getDeltas() {
return deltas;
} | DeltaSequence function() { return deltas; } | /**
* Returns all deltas collected.
*/ | Returns all deltas collected | getDeltas | {
"repo_name": "nelsonsilva/wave-protocol",
"path": "src/org/waveprotocol/box/server/robots/passive/WaveletAndDeltas.java",
"license": "apache-2.0",
"size": 8396
} | [
"org.waveprotocol.box.common.DeltaSequence"
] | import org.waveprotocol.box.common.DeltaSequence; | import org.waveprotocol.box.common.*; | [
"org.waveprotocol.box"
] | org.waveprotocol.box; | 1,548,464 |
User findByEmailAddressAndLastname(String emailAddress, String lastname); | User findByEmailAddressAndLastname(String emailAddress, String lastname); | /**
* Retrieves users by the given email and lastname. Acts as a dummy method declaration to test finder query creation.
*
* @param emailAddress
* @param lastname
* @return the user with the given email address and lastname
*/ | Retrieves users by the given email and lastname. Acts as a dummy method declaration to test finder query creation | findByEmailAddressAndLastname | {
"repo_name": "sdw2330976/Research-spring-data-jpa",
"path": "spring-data-jpa-1.7.1.RELEASE/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java",
"license": "apache-2.0",
"size": 14429
} | [
"org.springframework.data.jpa.domain.sample.User"
] | import org.springframework.data.jpa.domain.sample.User; | import org.springframework.data.jpa.domain.sample.*; | [
"org.springframework.data"
] | org.springframework.data; | 1,579,265 |
@Override
public TLocation rename(Name name) {
return new TLocation(name, null);
} | TLocation function(Name name) { return new TLocation(name, null); } | /**
* Rename this table
*/ | Rename this table | rename | {
"repo_name": "jottyfan/CampOrganizer",
"path": "src/main/jooq/de/jottyfan/camporganizer/db/jooq/tables/TLocation.java",
"license": "unlicense",
"size": 4029
} | [
"org.jooq.Name"
] | import org.jooq.Name; | import org.jooq.*; | [
"org.jooq"
] | org.jooq; | 2,805,855 |
public static void sendBinary(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendInternal(data, WebSocketFrameType.BINARY, wsChannel, callback);
} | static void function(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { sendInternal(data, WebSocketFrameType.BINARY, wsChannel, callback); } | /**
* Sends a complete text message, invoking the callback when complete
*
* @param data
* @param wsChannel
* @param callback
*/ | Sends a complete text message, invoking the callback when complete | sendBinary | {
"repo_name": "emag/codereading-undertow",
"path": "core/src/main/java/io/undertow/websockets/core/WebSockets.java",
"license": "apache-2.0",
"size": 13587
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,146,434 |
public SelectionModel get(Model model) {
return hashModels.get(model);
} | SelectionModel function(Model model) { return hashModels.get(model); } | /**
* Gets the SelectionModel filled with this criterion data that
* wraps the specified model.
* @see SelectionModel
*
* @param model the model contained in the SelectionModel
*
* @return the SelectionModel that wraps the model
*
*/ | Gets the SelectionModel filled with this criterion data that wraps the specified model | get | {
"repo_name": "solarknow/prottest3",
"path": "src/main/java/es/uvigo/darwin/prottest/selection/InformationCriterion.java",
"license": "gpl-2.0",
"size": 13347
} | [
"es.uvigo.darwin.prottest.model.Model",
"es.uvigo.darwin.prottest.selection.model.SelectionModel"
] | import es.uvigo.darwin.prottest.model.Model; import es.uvigo.darwin.prottest.selection.model.SelectionModel; | import es.uvigo.darwin.prottest.model.*; import es.uvigo.darwin.prottest.selection.model.*; | [
"es.uvigo.darwin"
] | es.uvigo.darwin; | 1,938,714 |
void deleteChain(Chain chain) throws DotDataException, DotCacheException;
| void deleteChain(Chain chain) throws DotDataException, DotCacheException; | /**
* Removes a chain and all its related states from the database
* @param chain
* @throws DotDataException
* @throws DotCacheException
*/ | Removes a chain and all its related states from the database | deleteChain | {
"repo_name": "zhiqinghuang/core",
"path": "src/com/dotmarketing/portlets/chains/business/ChainFactory.java",
"license": "gpl-3.0",
"size": 7040
} | [
"com.dotmarketing.business.DotCacheException",
"com.dotmarketing.exception.DotDataException",
"com.dotmarketing.portlets.chains.model.Chain"
] | import com.dotmarketing.business.DotCacheException; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.portlets.chains.model.Chain; | import com.dotmarketing.business.*; import com.dotmarketing.exception.*; import com.dotmarketing.portlets.chains.model.*; | [
"com.dotmarketing.business",
"com.dotmarketing.exception",
"com.dotmarketing.portlets"
] | com.dotmarketing.business; com.dotmarketing.exception; com.dotmarketing.portlets; | 1,991,575 |
public int getStartDateTotalDays() {
calendar.setTime(startDate);
return calendar.getActualMaximum(Calendar.DATE);
} // end getStartDateNoOfDays | int function() { calendar.setTime(startDate); return calendar.getActualMaximum(Calendar.DATE); } | /**
* Returns the total no. of days in startDate
*
* @return int
*/ | Returns the total no. of days in startDate | getStartDateTotalDays | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/main/java/org/kuali/coeus/common/budget/impl/calculator/Boundary.java",
"license": "apache-2.0",
"size": 5803
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,699,710 |
public ErrorResponse error() {
return this.error;
} | ErrorResponse function() { return this.error; } | /**
* Get error when What-If operation fails.
*
* @return the error value
*/ | Get error when What-If operation fails | error | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resources/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/resources/v2020_06_01/implementation/WhatIfOperationResultInner.java",
"license": "mit",
"size": 2667
} | [
"com.microsoft.azure.management.resources.v2020_06_01.ErrorResponse"
] | import com.microsoft.azure.management.resources.v2020_06_01.ErrorResponse; | import com.microsoft.azure.management.resources.v2020_06_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,303,597 |
public GiraphClasses setVertexOutputFormatClass(
Class<? extends VertexOutputFormat<I, V, E>> vertexOutputFormatClass) {
this.vertexOutputFormatClass = vertexOutputFormatClass;
return this;
} | GiraphClasses function( Class<? extends VertexOutputFormat<I, V, E>> vertexOutputFormatClass) { this.vertexOutputFormatClass = vertexOutputFormatClass; return this; } | /**
* Set VertexOutputFormat held
*
* @param vertexOutputFormatClass VertexOutputFormat to set
* @return this
*/ | Set VertexOutputFormat held | setVertexOutputFormatClass | {
"repo_name": "basio/graph",
"path": "giraph-core/src/main/java/org/apache/giraph/conf/GiraphClasses.java",
"license": "apache-2.0",
"size": 22271
} | [
"org.apache.giraph.io.VertexOutputFormat"
] | import org.apache.giraph.io.VertexOutputFormat; | import org.apache.giraph.io.*; | [
"org.apache.giraph"
] | org.apache.giraph; | 211,976 |
public CloudAnalyticsClient createCloudAnalyticsClient() {
if (this.getBlobStorageUri() == null) {
throw new IllegalArgumentException(SR.BLOB_ENDPOINT_NOT_CONFIGURED);
}
if (this.getTableStorageUri() == null) {
throw new IllegalArgumentException(SR.TABLE_ENDPOINT_NOT_CONFIGURED);
}
if (this.credentials == null) {
throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
}
return new CloudAnalyticsClient(this.getBlobStorageUri(), this.getTableStorageUri(), this.getCredentials());
} | CloudAnalyticsClient function() { if (this.getBlobStorageUri() == null) { throw new IllegalArgumentException(SR.BLOB_ENDPOINT_NOT_CONFIGURED); } if (this.getTableStorageUri() == null) { throw new IllegalArgumentException(SR.TABLE_ENDPOINT_NOT_CONFIGURED); } if (this.credentials == null) { throw new IllegalArgumentException(SR.MISSING_CREDENTIALS); } return new CloudAnalyticsClient(this.getBlobStorageUri(), this.getTableStorageUri(), this.getCredentials()); } | /**
* Creates a new Analytics service client.
*
* @return An analytics client object that uses the Blob and Table service endpoints.
*/ | Creates a new Analytics service client | createCloudAnalyticsClient | {
"repo_name": "dominicjprice/runspotrun-android-client",
"path": "src/com/microsoft/azure/storage/CloudStorageAccount.java",
"license": "agpl-3.0",
"size": 44591
} | [
"com.microsoft.azure.storage.analytics.CloudAnalyticsClient"
] | import com.microsoft.azure.storage.analytics.CloudAnalyticsClient; | import com.microsoft.azure.storage.analytics.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,952,991 |
public SizeConfigurationPropertiesFragment withEnvironmentSizes(List<EnvironmentSizeFragment> environmentSizes) {
this.environmentSizes = environmentSizes;
return this;
} | SizeConfigurationPropertiesFragment function(List<EnvironmentSizeFragment> environmentSizes) { this.environmentSizes = environmentSizes; return this; } | /**
* Set represents a list of size categories supported by this Lab Account (Small, Medium, Large).
*
* @param environmentSizes the environmentSizes value to set
* @return the SizeConfigurationPropertiesFragment object itself.
*/ | Set represents a list of size categories supported by this Lab Account (Small, Medium, Large) | withEnvironmentSizes | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/labservices/mgmt-v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/SizeConfigurationPropertiesFragment.java",
"license": "mit",
"size": 1454
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,865,775 |
public void dispatch(Channel channel, HttpRequest request) {
if (httpQueue.size() >= MAXIMUM_QUEUE_SIZE) {
channel.close();
return;
}
httpQueue.add(new ChannelRequest<>(channel, request));
} | void function(Channel channel, HttpRequest request) { if (httpQueue.size() >= MAXIMUM_QUEUE_SIZE) { channel.close(); return; } httpQueue.add(new ChannelRequest<>(channel, request)); } | /**
* Dispatches a HTTP request.
*
* @param channel The channel.
* @param request The request.
*/ | Dispatches a HTTP request | dispatch | {
"repo_name": "atomicint/aj8",
"path": "server/src/src/main/java/org/apollo/update/UpdateDispatcher.java",
"license": "isc",
"size": 3025
} | [
"io.netty.channel.Channel",
"io.netty.handler.codec.http.HttpRequest"
] | import io.netty.channel.Channel; import io.netty.handler.codec.http.HttpRequest; | import io.netty.channel.*; import io.netty.handler.codec.http.*; | [
"io.netty.channel",
"io.netty.handler"
] | io.netty.channel; io.netty.handler; | 435,539 |
@Override
public String costElementInVersion(DevelopmentProposal developmentProposal, String versionNumber, String costElement) {
Long versionNumberLong = Long.parseLong(versionNumber);
for (Budget budget : developmentProposal.getBudgets()) {
if (budget.getVersionNumber().equals(versionNumberLong)) {
for (BudgetPeriod period : budget.getBudgetPeriods()) {
if (!period.getBudgetLineItems().isEmpty()) {
return TRUE;
}
}
}
}
return FALSE;
} | String function(DevelopmentProposal developmentProposal, String versionNumber, String costElement) { Long versionNumberLong = Long.parseLong(versionNumber); for (Budget budget : developmentProposal.getBudgets()) { if (budget.getVersionNumber().equals(versionNumberLong)) { for (BudgetPeriod period : budget.getBudgetPeriods()) { if (!period.getBudgetLineItems().isEmpty()) { return TRUE; } } } } return FALSE; } | /**
*
* This method is used to verify that a cost element is used in the specified version of the proposal.
* See fn_cost_element_in_version
* @return 'false' if the cost element is not in the version of the proposal, otherwise returns 'true'
*/ | This method is used to verify that a cost element is used in the specified version of the proposal. See fn_cost_element_in_version | costElementInVersion | {
"repo_name": "jwillia/kc-old1",
"path": "coeus-impl/src/main/java/org/kuali/coeus/propdev/impl/krms/PropDevJavaFunctionKrmsTermServiceImpl.java",
"license": "agpl-3.0",
"size": 46897
} | [
"org.kuali.coeus.common.budget.framework.core.Budget",
"org.kuali.coeus.common.budget.framework.period.BudgetPeriod",
"org.kuali.coeus.propdev.impl.core.DevelopmentProposal"
] | import org.kuali.coeus.common.budget.framework.core.Budget; import org.kuali.coeus.common.budget.framework.period.BudgetPeriod; import org.kuali.coeus.propdev.impl.core.DevelopmentProposal; | import org.kuali.coeus.common.budget.framework.core.*; import org.kuali.coeus.common.budget.framework.period.*; import org.kuali.coeus.propdev.impl.core.*; | [
"org.kuali.coeus"
] | org.kuali.coeus; | 1,846,977 |
protected void addCatalogNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_RenameViewType_catalogName_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_RenameViewType_catalogName_feature", "_UI_RenameViewType_type"),
DbchangelogPackage.eINSTANCE.getRenameViewType_CatalogName(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
| void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), DbchangelogPackage.eINSTANCE.getRenameViewType_CatalogName(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Catalog Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Catalog Name feature. | addCatalogNamePropertyDescriptor | {
"repo_name": "Treehopper/EclipseAugments",
"path": "liquibase-editor/eu.hohenegger.xsd.liquibase.ui/src-gen/org/liquibase/xml/ns/dbchangelog/provider/RenameViewTypeItemProvider.java",
"license": "epl-1.0",
"size": 8770
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.liquibase.xml.ns.dbchangelog.DbchangelogPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.liquibase.xml.ns.dbchangelog.DbchangelogPackage; | import org.eclipse.emf.edit.provider.*; import org.liquibase.xml.ns.dbchangelog.*; | [
"org.eclipse.emf",
"org.liquibase.xml"
] | org.eclipse.emf; org.liquibase.xml; | 594,317 |
@SuppressWarnings("NewApi")
protected RippleDrawable createRippleDrawable() {
ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
drawable.getPaint().setColor(mColorNormal);
return new RippleDrawable(createRippleStateList(), drawable, null);
} | @SuppressWarnings(STR) RippleDrawable function() { ShapeDrawable drawable = new ShapeDrawable(new OvalShape()); drawable.getPaint().setColor(mColorNormal); return new RippleDrawable(createRippleStateList(), drawable, null); } | /**
* >= api 21
*/ | >= api 21 | createRippleDrawable | {
"repo_name": "OpenSilk/Orpheus",
"path": "common/src/main/java/org/opensilk/common/widget/FloatingActionButton.java",
"license": "gpl-3.0",
"size": 8693
} | [
"android.graphics.drawable.RippleDrawable",
"android.graphics.drawable.ShapeDrawable",
"android.graphics.drawable.shapes.OvalShape"
] | import android.graphics.drawable.RippleDrawable; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; | import android.graphics.drawable.*; import android.graphics.drawable.shapes.*; | [
"android.graphics"
] | android.graphics; | 481,537 |
T createProxy(T pooledObject, UsageTracking<T> usageTracking);
| T createProxy(T pooledObject, UsageTracking<T> usageTracking); | /**
* Create a new proxy object, wrapping the given pooled object.
*
* @param pooledObject The object to wrap
* @param usageTracking The instance, if any (usually the object pool) to
* be provided with usage tracking information for this
* wrapped object
*
* @return the new proxy object
*/ | Create a new proxy object, wrapping the given pooled object | createProxy | {
"repo_name": "angelowolf/SEW",
"path": "SistemaElecciones/lib/commons-pool/src/main/java/org/apache/commons/pool2/proxy/ProxySource.java",
"license": "apache-2.0",
"size": 1856
} | [
"org.apache.commons.pool2.UsageTracking"
] | import org.apache.commons.pool2.UsageTracking; | import org.apache.commons.pool2.*; | [
"org.apache.commons"
] | org.apache.commons; | 284,428 |
@Override
protected void addCapabilities(final Collection<Capability> caps) {
caps.addAll(UrlFileProvider.capabilities);
} | void function(final Collection<Capability> caps) { caps.addAll(UrlFileProvider.capabilities); } | /**
* Returns the capabilities of this file system.
*/ | Returns the capabilities of this file system | addCapabilities | {
"repo_name": "seeburger-ag/commons-vfs",
"path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java",
"license": "apache-2.0",
"size": 1833
} | [
"java.util.Collection",
"org.apache.commons.vfs2.Capability"
] | import java.util.Collection; import org.apache.commons.vfs2.Capability; | import java.util.*; import org.apache.commons.vfs2.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 875,083 |
final public void write(String s, int off, int len)
{
try {
char []writeBuffer = _out.getCharBuffer();
int size = writeBuffer.length;
int writeLength = _out.getCharOffset();
int end = off + len;
while (off < end) {
int sublen = end - off;
if (size - writeLength < sublen) {
if (size == writeLength) {
writeBuffer = _out.nextCharBuffer(writeLength);
writeLength = _out.getCharOffset();
if (size < sublen)
sublen = size;
}
else
sublen = size - writeLength;
}
int tail = off + sublen;
s.getChars(off, tail, writeBuffer, writeLength);
off = tail;
writeLength += sublen;
}
_out.setCharOffset(writeLength);
} catch (IOException e) {
_hasError = true;
log.log(Level.FINE, e.toString(), e);
}
} | final void function(String s, int off, int len) { try { char []writeBuffer = _out.getCharBuffer(); int size = writeBuffer.length; int writeLength = _out.getCharOffset(); int end = off + len; while (off < end) { int sublen = end - off; if (size - writeLength < sublen) { if (size == writeLength) { writeBuffer = _out.nextCharBuffer(writeLength); writeLength = _out.getCharOffset(); if (size < sublen) sublen = size; } else sublen = size - writeLength; } int tail = off + sublen; s.getChars(off, tail, writeBuffer, writeLength); off = tail; writeLength += sublen; } _out.setCharOffset(writeLength); } catch (IOException e) { _hasError = true; log.log(Level.FINE, e.toString(), e); } } | /**
* Writes a subsection of a string to the output.
*/ | Writes a subsection of a string to the output | write | {
"repo_name": "gruppo4/quercus-upstream",
"path": "modules/resin/src/com/caucho/server/http/ResponseWriter.java",
"license": "gpl-2.0",
"size": 4833
} | [
"java.io.IOException",
"java.util.logging.Level"
] | import java.io.IOException; import java.util.logging.Level; | import java.io.*; import java.util.logging.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 238,628 |
void validateTransitions(final CharSequence transitions) {
final long length = transitions.length();
if (length == 0) {
return; // assume we haven't started yet
}
final Matcher matcher = fsmPattern.matcher(transitions);
if (!matcher.find() || (matcher.start() != 0) || (matcher.end() != length)) {
throw new IllegalStateException("Illegal state transition(s): " + transitions);
}
} | void validateTransitions(final CharSequence transitions) { final long length = transitions.length(); if (length == 0) { return; } final Matcher matcher = fsmPattern.matcher(transitions); if (!matcher.find() (matcher.start() != 0) (matcher.end() != length)) { throw new IllegalStateException(STR + transitions); } } | /**
* Validate the given transitions against this state machine.
*
* @param transitions a character sequence indicating a set of transitions or
* states as defined by the tokenMap used at construction time.
* @throws IllegalStateException if the set of transitions is not allowed
*/ | Validate the given transitions against this state machine | validateTransitions | {
"repo_name": "pwong-mapr/incubator-drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/compile/FsmDescriptor.java",
"license": "apache-2.0",
"size": 5709
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 1,348,169 |
public Query setResultTransformer(ResultTransformer transformer); | Query function(ResultTransformer transformer); | /**
* Set a strategy for handling the query results. This can be used to change
* "shape" of the query result.
*
* @param transformer The transformer to apply
* @return this (for method chaining)
*/ | Set a strategy for handling the query results. This can be used to change "shape" of the query result | setResultTransformer | {
"repo_name": "cacheonix/cacheonix-core",
"path": "3rdparty/hibernate-3.2/src/org/hibernate/Query.java",
"license": "lgpl-2.1",
"size": 14050
} | [
"org.hibernate.transform.ResultTransformer"
] | import org.hibernate.transform.ResultTransformer; | import org.hibernate.transform.*; | [
"org.hibernate.transform"
] | org.hibernate.transform; | 1,211,759 |
public boolean bulkApiLogin() throws Exception {
this.log.info("Authenticating salesforce bulk api");
boolean success = false;
String hostName = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_HOST_NAME);
String apiVersion = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_VERSION);
if (Strings.isNullOrEmpty(apiVersion)) {
apiVersion = "29.0";
}
String soapAuthEndPoint = hostName + SALESFORCE_SOAP_AUTH_SERVICE + "/" + apiVersion;
try {
ConnectorConfig partnerConfig = new ConnectorConfig();
if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
&& !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
partnerConfig.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
}
partnerConfig.setUsername(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_USERNAME));
partnerConfig.setPassword(PasswordManager.getInstance(this.workUnit)
.readPassword(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_PASSWORD)));
partnerConfig.setAuthEndpoint(soapAuthEndPoint);
PartnerConnection connection = new PartnerConnection(partnerConfig);
String soapEndpoint = partnerConfig.getServiceEndpoint();
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;
ConnectorConfig config = new ConnectorConfig();
config.setSessionId(partnerConfig.getSessionId());
config.setRestEndpoint(restEndpoint);
config.setCompression(true);
config.setTraceFile("traceLogs.txt");
config.setTraceMessage(false);
config.setPrettyPrintXml(true);
if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL)
&& !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) {
config.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL),
super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT));
}
this.bulkConnection = new BulkConnection(config);
success = true;
} catch (Exception e) {
throw new Exception("Failed to connect to salesforce bulk api; error - " + e.getMessage(), e);
}
return success;
} | boolean function() throws Exception { this.log.info(STR); boolean success = false; String hostName = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_HOST_NAME); String apiVersion = this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_VERSION); if (Strings.isNullOrEmpty(apiVersion)) { apiVersion = "29.0"; } String soapAuthEndPoint = hostName + SALESFORCE_SOAP_AUTH_SERVICE + "/" + apiVersion; try { ConnectorConfig partnerConfig = new ConnectorConfig(); if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL) && !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) { partnerConfig.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL), super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT)); } partnerConfig.setUsername(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_USERNAME)); partnerConfig.setPassword(PasswordManager.getInstance(this.workUnit) .readPassword(this.workUnit.getProp(ConfigurationKeys.SOURCE_CONN_PASSWORD))); partnerConfig.setAuthEndpoint(soapAuthEndPoint); PartnerConnection connection = new PartnerConnection(partnerConfig); String soapEndpoint = partnerConfig.getServiceEndpoint(); String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + STR + apiVersion; ConnectorConfig config = new ConnectorConfig(); config.setSessionId(partnerConfig.getSessionId()); config.setRestEndpoint(restEndpoint); config.setCompression(true); config.setTraceFile(STR); config.setTraceMessage(false); config.setPrettyPrintXml(true); if (super.workUnitState.contains(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL) && !super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL).isEmpty()) { config.setProxy(super.workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_USE_PROXY_URL), super.workUnitState.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT)); } this.bulkConnection = new BulkConnection(config); success = true; } catch (Exception e) { throw new Exception(STR + e.getMessage(), e); } return success; } | /**
* Login to salesforce
* @return login status
*/ | Login to salesforce | bulkApiLogin | {
"repo_name": "rayortigas/gobblin",
"path": "gobblin-salesforce/src/main/java/gobblin/salesforce/SalesforceExtractor.java",
"license": "apache-2.0",
"size": 33870
} | [
"com.google.common.base.Strings",
"com.sforce.async.BulkConnection",
"com.sforce.soap.partner.PartnerConnection",
"com.sforce.ws.ConnectorConfig"
] | import com.google.common.base.Strings; import com.sforce.async.BulkConnection; import com.sforce.soap.partner.PartnerConnection; import com.sforce.ws.ConnectorConfig; | import com.google.common.base.*; import com.sforce.async.*; import com.sforce.soap.partner.*; import com.sforce.ws.*; | [
"com.google.common",
"com.sforce.async",
"com.sforce.soap",
"com.sforce.ws"
] | com.google.common; com.sforce.async; com.sforce.soap; com.sforce.ws; | 1,278,125 |
private Object getTemplateModel(Object model, String template)
{
// create an instance of the default FreeMarker template object model
FacesContext fc = FacesContext.getCurrentInstance();
ServiceRegistry services = Repository.getServiceRegistry(fc);
User user = Application.getCurrentUser(fc);
// add the template itself to the model
NodeRef templateRef = null;
if (template.indexOf(StoreRef.URI_FILLER) != -1)
{
// found a noderef template
templateRef = new NodeRef(template);
}
Map root = DefaultModelHelper.buildDefaultModel(services, user, templateRef);
root.put("url", new URLHelper(fc.getExternalContext().getRequestContextPath()));
// merge models
if (model instanceof Map)
{
if (logger.isDebugEnabled())
logger.debug("Found valid Map model to merge with FreeMarker: " + model);
root.putAll((Map)model);
}
model = root;
return model;
}
// ------------------------------------------------------------------------------
// Strongly typed component property accessors
| Object function(Object model, String template) { FacesContext fc = FacesContext.getCurrentInstance(); ServiceRegistry services = Repository.getServiceRegistry(fc); User user = Application.getCurrentUser(fc); NodeRef templateRef = null; if (template.indexOf(StoreRef.URI_FILLER) != -1) { templateRef = new NodeRef(template); } Map root = DefaultModelHelper.buildDefaultModel(services, user, templateRef); root.put("url", new URLHelper(fc.getExternalContext().getRequestContextPath())); if (model instanceof Map) { if (logger.isDebugEnabled()) logger.debug(STR + model); root.putAll((Map)model); } model = root; return model; } | /**
* By default we return a Map model containing root references to the Company Home Space,
* the users Home Space and the Person Node for the current user.
*
* @param model Custom model to merge into default model
* @param template Optional reference to the template to add to model
*
* @return Returns the data model to bind template against.
*/ | By default we return a Map model containing root references to the Company Home Space, the users Home Space and the Person Node for the current user | getTemplateModel | {
"repo_name": "Tybion/community-edition",
"path": "projects/web-client/source/java/org/alfresco/web/ui/repo/component/template/UITemplate.java",
"license": "lgpl-3.0",
"size": 10284
} | [
"java.util.Map",
"javax.faces.context.FacesContext",
"org.alfresco.service.ServiceRegistry",
"org.alfresco.service.cmr.repository.NodeRef",
"org.alfresco.service.cmr.repository.StoreRef",
"org.alfresco.web.app.Application",
"org.alfresco.web.bean.repository.Repository",
"org.alfresco.web.bean.repository.User"
] | import java.util.Map; import javax.faces.context.FacesContext; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.User; | import java.util.*; import javax.faces.context.*; import org.alfresco.service.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.web.app.*; import org.alfresco.web.bean.repository.*; | [
"java.util",
"javax.faces",
"org.alfresco.service",
"org.alfresco.web"
] | java.util; javax.faces; org.alfresco.service; org.alfresco.web; | 2,635,088 |
public void testParseTokenValues() {
getParameterTableFor("a b = \"'\"");
assertEquals("Value","'",((Attribute)(attributes.elementAt (2))).getValue ());
}
| void function() { getParameterTableFor(STR'\STRValue","'",((Attribute)(attributes.elementAt (2))).getValue ()); } | /**
* Test quote value.
*/ | Test quote value | testParseTokenValues | {
"repo_name": "socialwareinc/html-parser",
"path": "parser/src/test/java/org/htmlparser/tests/lexerTests/AttributeTests.java",
"license": "lgpl-3.0",
"size": 37178
} | [
"org.htmlparser.Attribute"
] | import org.htmlparser.Attribute; | import org.htmlparser.*; | [
"org.htmlparser"
] | org.htmlparser; | 2,466,354 |
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
Bundle instanceState = new Bundle();
instanceState.putParcelable(SUPER_STATE_KEY, superState);
instanceState.putString(PROFILE_ID_KEY, profileId);
instanceState.putInt(PRESET_SIZE_KEY, presetSizeType);
instanceState.putBoolean(IS_CROPPED_KEY, isCropped);
instanceState.putParcelable(BITMAP_KEY, imageContents);
instanceState.putInt(BITMAP_WIDTH_KEY, queryWidth);
instanceState.putInt(BITMAP_HEIGHT_KEY, queryHeight);
instanceState.putBoolean(PENDING_REFRESH_KEY, lastRequest != null);
return instanceState;
} | Parcelable function() { Parcelable superState = super.onSaveInstanceState(); Bundle instanceState = new Bundle(); instanceState.putParcelable(SUPER_STATE_KEY, superState); instanceState.putString(PROFILE_ID_KEY, profileId); instanceState.putInt(PRESET_SIZE_KEY, presetSizeType); instanceState.putBoolean(IS_CROPPED_KEY, isCropped); instanceState.putParcelable(BITMAP_KEY, imageContents); instanceState.putInt(BITMAP_WIDTH_KEY, queryWidth); instanceState.putInt(BITMAP_HEIGHT_KEY, queryHeight); instanceState.putBoolean(PENDING_REFRESH_KEY, lastRequest != null); return instanceState; } | /**
* Some of the current state is returned as a Bundle to allow quick restoration
* of the ProfilePictureView object in scenarios like orientation changes.
* @return a Parcelable containing the current state
*/ | Some of the current state is returned as a Bundle to allow quick restoration of the ProfilePictureView object in scenarios like orientation changes | onSaveInstanceState | {
"repo_name": "daffycricket/tarotdroid",
"path": "libFacebookSDK/src/main/java/com/facebook/widget/ProfilePictureView.java",
"license": "gpl-2.0",
"size": 19761
} | [
"android.os.Bundle",
"android.os.Parcelable"
] | import android.os.Bundle; import android.os.Parcelable; | import android.os.*; | [
"android.os"
] | android.os; | 548,948 |
public short getVersion() throws BusException {
return proxy.getVersion();
}
About proxy; | short function() throws BusException { return proxy.getVersion(); } About proxy; | /**
* Get the version of the remote About interface
* @return the version of the remote About interface
* @throws BusException
* throws an exception indicating failure to make the remote method call
*/ | Get the version of the remote About interface | getVersion | {
"repo_name": "danilomendonca/A3Droid_Test_Greenhouse",
"path": "alljoyn_java/src/main/java/org/alljoyn/bus/AboutProxy.java",
"license": "apache-2.0",
"size": 3308
} | [
"org.alljoyn.bus.ifaces.About"
] | import org.alljoyn.bus.ifaces.About; | import org.alljoyn.bus.ifaces.*; | [
"org.alljoyn.bus"
] | org.alljoyn.bus; | 363,158 |
public Converter getDepartmentConverter() {
return new DepartmentConverter(outletFacade);
}
| Converter function() { return new DepartmentConverter(outletFacade); } | /**
* Gets a {@link Converter} for {@link Department} objects.
*
* @return {@link Converter} for {@link Department} objects
*/ | Gets a <code>Converter</code> for <code>Department</code> objects | getDepartmentConverter | {
"repo_name": "getconverge/converge-1.x",
"path": "modules/converge-war/src/main/java/dk/i2m/converge/jsf/beans/Converters.java",
"license": "gpl-3.0",
"size": 9492
} | [
"dk.i2m.converge.jsf.converters.DepartmentConverter",
"javax.faces.convert.Converter"
] | import dk.i2m.converge.jsf.converters.DepartmentConverter; import javax.faces.convert.Converter; | import dk.i2m.converge.jsf.converters.*; import javax.faces.convert.*; | [
"dk.i2m.converge",
"javax.faces"
] | dk.i2m.converge; javax.faces; | 2,797,702 |
public static List<EbPartnerShip> toModels(EbPartnerShipSoap[] soapModels) {
if (soapModels == null) {
return null;
}
List<EbPartnerShip> models = new ArrayList<EbPartnerShip>(soapModels.length);
for (EbPartnerShipSoap soapModel : soapModels) {
models.add(toModel(soapModel));
}
return models;
}
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
"lock.expiration.time.org.oep.dossiermgt.model.EbPartnerShip"));
public EbPartnerShipModelImpl() {
} | static List<EbPartnerShip> function(EbPartnerShipSoap[] soapModels) { if (soapModels == null) { return null; } List<EbPartnerShip> models = new ArrayList<EbPartnerShip>(soapModels.length); for (EbPartnerShipSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get( STR)); public EbPartnerShipModelImpl() { } | /**
* Converts the soap model instances into normal model instances.
*
* @param soapModels the soap model instances to convert
* @return the normal model instances
*/ | Converts the soap model instances into normal model instances | toModels | {
"repo_name": "openegovplatform/OEPv2",
"path": "oep-dossier-portlet/docroot/WEB-INF/src/org/oep/dossiermgt/model/impl/EbPartnerShipModelImpl.java",
"license": "apache-2.0",
"size": 15087
} | [
"com.liferay.portal.kernel.util.GetterUtil",
"java.util.ArrayList",
"java.util.List",
"org.oep.dossiermgt.model.EbPartnerShip",
"org.oep.dossiermgt.model.EbPartnerShipSoap"
] | import com.liferay.portal.kernel.util.GetterUtil; import java.util.ArrayList; import java.util.List; import org.oep.dossiermgt.model.EbPartnerShip; import org.oep.dossiermgt.model.EbPartnerShipSoap; | import com.liferay.portal.kernel.util.*; import java.util.*; import org.oep.dossiermgt.model.*; | [
"com.liferay.portal",
"java.util",
"org.oep.dossiermgt"
] | com.liferay.portal; java.util; org.oep.dossiermgt; | 2,729,662 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<BillingPropertyInner>> updateWithResponseAsync(BillingPropertyInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2020-05-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
apiVersion,
parameters,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<BillingPropertyInner>> function(BillingPropertyInner parameters) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (parameters == null) { return Mono.error(new IllegalArgumentException(STR)); } else { parameters.validate(); } final String apiVersion = STR; final String accept = STR; return FluxUtil .withContext( context -> service .update( this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported
* only for billing accounts with agreement type Microsoft Customer Agreement.
*
* @param parameters Request parameters that are provided to the update billing property operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a billing property.
*/ | Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement | updateWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesClientImpl.java",
"license": "mit",
"size": 15882
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.billing.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,024,665 |
public static void dumpAllServices() { // used by: distributed/DistributedLockServiceTest
synchronized (services) {
logger.info(LogMarker.DLS_MARKER,
"DLockService.dumpAllServices() - " + services.size() + " services:\n");
for (final Map.Entry<String, DLockService> entry : services.entrySet()) {
DLockService svc = entry.getValue();
svc.dumpService();
if (svc.isCurrentlyLockGrantor()) {
svc.grantor.dumpService();
}
}
}
} | static void function() { synchronized (services) { logger.info(LogMarker.DLS_MARKER, STR + services.size() + STR); for (final Map.Entry<String, DLockService> entry : services.entrySet()) { DLockService svc = entry.getValue(); svc.dumpService(); if (svc.isCurrentlyLockGrantor()) { svc.grantor.dumpService(); } } } } | /**
* TEST HOOK: Logs all lock tokens for every service at INFO level. Synchronizes on services map,
* service tokens maps and each lock token.
*/ | service tokens maps and each lock token | dumpAllServices | {
"repo_name": "jdeppe-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockService.java",
"license": "apache-2.0",
"size": 109340
} | [
"java.util.Map",
"org.apache.geode.internal.logging.log4j.LogMarker"
] | import java.util.Map; import org.apache.geode.internal.logging.log4j.LogMarker; | import java.util.*; import org.apache.geode.internal.logging.log4j.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 1,984,459 |
public PortComponentRefType<T> removeMtomThreshold()
{
childNode.removeChildren("mtom-threshold");
return this;
}
// --------------------------------------------------------------------------------------------------------||
// ClassName: PortComponentRefType ElementName: javaee:addressingType ElementType : addressing
// MaxOccurs: -1 isGeneric: true isAttribute: false isEnum: false isDataType: false
// --------------------------------------------------------------------------------------------------------|| | PortComponentRefType<T> function() { childNode.removeChildren(STR); return this; } | /**
* Removes the <code>mtom-threshold</code> element
* @return the current instance of <code>PortComponentRefType<T></code>
*/ | Removes the <code>mtom-threshold</code> element | removeMtomThreshold | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/javaeewebservicesclient13/PortComponentRefTypeImpl.java",
"license": "epl-1.0",
"size": 11232
} | [
"org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient13.PortComponentRefType"
] | import org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient13.PortComponentRefType; | import org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient13.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 797,843 |
Date getCurrentTime() throws SchedulerException; | Date getCurrentTime() throws SchedulerException; | /**
* <p>
* Get the current time, as known by the <code>TimeBroker</code>.
* </p>
*
* @throws SchedulerException
* with the error code set to
* SchedulerException.ERR_TIME_BROKER_FAILURE
*/ | Get the current time, as known by the <code>TimeBroker</code>. | getCurrentTime | {
"repo_name": "suthat/signal",
"path": "vendor/quartz-2.2.0/src/org/quartz/spi/TimeBroker.java",
"license": "apache-2.0",
"size": 2788
} | [
"java.util.Date",
"org.quartz.SchedulerException"
] | import java.util.Date; import org.quartz.SchedulerException; | import java.util.*; import org.quartz.*; | [
"java.util",
"org.quartz"
] | java.util; org.quartz; | 927,342 |
public GroupDescription getInnerMostGroupDesc() {
return innerMostGroupDesc;
} | GroupDescription function() { return innerMostGroupDesc; } | /**
* Getter for innerMostGroupDesc.
*
* @return the inner most group description
*/ | Getter for innerMostGroupDesc | getInnerMostGroupDesc | {
"repo_name": "donNewtonAlpha/onos",
"path": "drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java",
"license": "apache-2.0",
"size": 84225
} | [
"org.onosproject.net.group.GroupDescription"
] | import org.onosproject.net.group.GroupDescription; | import org.onosproject.net.group.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 866,817 |
public final StoredSortedMap getSupplierByCityMap() {
return supplierByCityMap;
}
private static class PartBinding extends SerialSerialBinding {
private PartBinding(ClassCatalog classCatalog,
Class keyClass,
Class dataClass) {
super(classCatalog, keyClass, dataClass);
} | final StoredSortedMap function() { return supplierByCityMap; } private static class PartBinding extends SerialSerialBinding { private PartBinding(ClassCatalog classCatalog, Class keyClass, Class dataClass) { super(classCatalog, keyClass, dataClass); } | /**
* Return a map view of the supplier-by-city index.
*/ | Return a map view of the supplier-by-city index | getSupplierByCityMap | {
"repo_name": "bjorndm/prebake",
"path": "code/third_party/bdb/examples/collections/ship/entity/SampleViews.java",
"license": "apache-2.0",
"size": 9836
} | [
"com.sleepycat.bind.serial.ClassCatalog",
"com.sleepycat.bind.serial.SerialSerialBinding",
"com.sleepycat.collections.StoredSortedMap"
] | import com.sleepycat.bind.serial.ClassCatalog; import com.sleepycat.bind.serial.SerialSerialBinding; import com.sleepycat.collections.StoredSortedMap; | import com.sleepycat.bind.serial.*; import com.sleepycat.collections.*; | [
"com.sleepycat.bind",
"com.sleepycat.collections"
] | com.sleepycat.bind; com.sleepycat.collections; | 1,641,278 |
public void postConstruct(T instance)
{
CreationalContext<T> cc = BeanManagerLookup.lookup().createCreationalContext(null);
it.inject(instance, cc);
it.postConstruct(instance);
} | void function(T instance) { CreationalContext<T> cc = BeanManagerLookup.lookup().createCreationalContext(null); it.inject(instance, cc); it.postConstruct(instance); } | /**
* Injects the instance and calls any {@link PostConstruct} methods
*
* @param instance
*/ | Injects the instance and calls any <code>PostConstruct</code> methods | postConstruct | {
"repo_name": "mafulafunk/wicket",
"path": "wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/NonContextual.java",
"license": "apache-2.0",
"size": 4201
} | [
"javax.enterprise.context.spi.CreationalContext"
] | import javax.enterprise.context.spi.CreationalContext; | import javax.enterprise.context.spi.*; | [
"javax.enterprise"
] | javax.enterprise; | 1,212,913 |
public List<String> getDefaultAuthorities() {
return Collections.unmodifiableList(defaultAuthorities);
} | List<String> function() { return Collections.unmodifiableList(defaultAuthorities); } | /**
* Get default authorities to add to the user in any case.
* @return default authorities
*/ | Get default authorities to add to the user in any case | getDefaultAuthorities | {
"repo_name": "fcrespel/jenkins-cas-plugin",
"path": "src/main/java/org/jenkinsci/plugins/cas/spring/security/CasUserDetailsService.java",
"license": "mit",
"size": 3878
} | [
"java.util.Collections",
"java.util.List"
] | import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,143,967 |
protected void copy(ResultSet resultSet) throws SQLException {
int cnt = 0;
while (resultSet.next() && (limit < 0 || cnt++ < limit) ) {
DynaBean bean = createDynaBean();
for (int i = 0; i < properties.length; i++) {
String name = properties[i].getName();
bean.set(name, resultSet.getObject(name));
}
rows.add(bean);
}
} | void function(ResultSet resultSet) throws SQLException { int cnt = 0; while (resultSet.next() && (limit < 0 cnt++ < limit) ) { DynaBean bean = createDynaBean(); for (int i = 0; i < properties.length; i++) { String name = properties[i].getName(); bean.set(name, resultSet.getObject(name)); } rows.add(bean); } } | /**
* <p>Copy the column values for each row in the specified
* <code>ResultSet</code> into a newly created {@link DynaBean}, and add
* this bean to the list of {@link DynaBean}s that will later by
* returned by a call to <code>getRows()</code>.</p>
*
* @param resultSet The <code>ResultSet</code> whose data is to be
* copied
*
* @exception SQLException if an error is encountered copying the data
*/ | Copy the column values for each row in the specified <code>ResultSet</code> into a newly created <code>DynaBean</code>, and add this bean to the list of <code>DynaBean</code>s that will later by returned by a call to <code>getRows()</code> | copy | {
"repo_name": "ProfilingLabs/Usemon2",
"path": "usemon-agent-commons-java/src/main/java/com/usemon/lib/org/apache/commons/beanutils/RowSetDynaClass.java",
"license": "mpl-2.0",
"size": 9039
} | [
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,900,429 |
private NonArray matchType(org.eclipse.jdt.core.dom.Type type){
if(type instanceof org.eclipse.jdt.core.dom.SimpleType){
return new Simple(type.getClass());
}
else if(type instanceof org.eclipse.jdt.core.dom.PrimitiveType){
org.eclipse.jdt.core.dom.PrimitiveType.Code code = ((org.eclipse.jdt.core.dom.PrimitiveType) type).getPrimitiveTypeCode();
switch(code.toString()){
case "boolean":
return new Boolean();
case "byte":
return new Byte();
case "char":
return new Char();
case "double":
return new Double();
case "float":
return new Float();
case "int":
return new Int();
case "long":
return new Long();
case "short":
return new Short();
}
}
return null;
} | NonArray function(org.eclipse.jdt.core.dom.Type type){ if(type instanceof org.eclipse.jdt.core.dom.SimpleType){ return new Simple(type.getClass()); } else if(type instanceof org.eclipse.jdt.core.dom.PrimitiveType){ org.eclipse.jdt.core.dom.PrimitiveType.Code code = ((org.eclipse.jdt.core.dom.PrimitiveType) type).getPrimitiveTypeCode(); switch(code.toString()){ case STR: return new Boolean(); case "byte": return new Byte(); case "char": return new Char(); case STR: return new Double(); case "float": return new Float(); case "int": return new Int(); case "long": return new Long(); case "short": return new Short(); } } return null; } | /**
* Matches the given {@link org.eclipse.jdt.core.dom.Type} to a type of the class hierarchy of {@link Type}.
*
* @param type the type to be matched.
* @return an instance of the matched type (a subclass of {@link Type})
*/ | Matches the given <code>org.eclipse.jdt.core.dom.Type</code> to a type of the class hierarchy of <code>Type</code> | matchType | {
"repo_name": "TimoEtzold/JavaTemplates",
"path": "de.tu_dortmund.javatemplates/src/de/tu_dortmund/javatemplates/types/TypeFinder.java",
"license": "apache-2.0",
"size": 3436
} | [
"de.tu_dortmund.javatemplates.types.value.Boolean",
"de.tu_dortmund.javatemplates.types.value.Byte",
"de.tu_dortmund.javatemplates.types.value.Char",
"de.tu_dortmund.javatemplates.types.value.Double",
"de.tu_dortmund.javatemplates.types.value.Float",
"de.tu_dortmund.javatemplates.types.value.Int",
"de.tu_dortmund.javatemplates.types.value.Long",
"de.tu_dortmund.javatemplates.types.value.NonArray",
"de.tu_dortmund.javatemplates.types.value.Short",
"de.tu_dortmund.javatemplates.types.value.Simple",
"org.eclipse.jdt.core.dom.PrimitiveType",
"org.eclipse.jdt.core.dom.SimpleType"
] | import de.tu_dortmund.javatemplates.types.value.Boolean; import de.tu_dortmund.javatemplates.types.value.Byte; import de.tu_dortmund.javatemplates.types.value.Char; import de.tu_dortmund.javatemplates.types.value.Double; import de.tu_dortmund.javatemplates.types.value.Float; import de.tu_dortmund.javatemplates.types.value.Int; import de.tu_dortmund.javatemplates.types.value.Long; import de.tu_dortmund.javatemplates.types.value.NonArray; import de.tu_dortmund.javatemplates.types.value.Short; import de.tu_dortmund.javatemplates.types.value.Simple; import org.eclipse.jdt.core.dom.PrimitiveType; import org.eclipse.jdt.core.dom.SimpleType; | import de.tu_dortmund.javatemplates.types.value.*; import org.eclipse.jdt.core.dom.*; | [
"de.tu_dortmund.javatemplates",
"org.eclipse.jdt"
] | de.tu_dortmund.javatemplates; org.eclipse.jdt; | 46,886 |
//-----------------------------------------------------------------------
int checkValidYear(long prolepticYear) {
if (prolepticYear < getMinimumYear() || prolepticYear > getMaximumYear()) {
throw new DateTimeException("Invalid Hijrah year: " + prolepticYear);
}
return (int) prolepticYear;
} | int checkValidYear(long prolepticYear) { if (prolepticYear < getMinimumYear() prolepticYear > getMaximumYear()) { throw new DateTimeException(STR + prolepticYear); } return (int) prolepticYear; } | /**
* Check the validity of a year.
*
* @param prolepticYear the year to check
*/ | Check the validity of a year | checkValidYear | {
"repo_name": "wangsongpeng/jdk-src",
"path": "src/main/java/java/time/chrono/HijrahChronology.java",
"license": "apache-2.0",
"size": 40276
} | [
"java.time.DateTimeException"
] | import java.time.DateTimeException; | import java.time.*; | [
"java.time"
] | java.time; | 1,702,527 |
protected boolean isContainerProvidedServlet(String classname) {
if (classname.startsWith("org.apache.catalina.")) {
return (true);
}
try {
Class clazz =
this.getClass().getClassLoader().loadClass(classname);
return (ContainerServlet.class.isAssignableFrom(clazz));
} catch (Throwable t) {
return (false);
}
} | boolean function(String classname) { if (classname.startsWith(STR)) { return (true); } try { Class clazz = this.getClass().getClassLoader().loadClass(classname); return (ContainerServlet.class.isAssignableFrom(clazz)); } catch (Throwable t) { return (false); } } | /**
* Return <code>true</code> if the specified class name represents a
* container provided servlet class that should be loaded by the
* server class loader.
*
* @param classname Name of the class to be checked
*/ | Return <code>true</code> if the specified class name represents a container provided servlet class that should be loaded by the server class loader | isContainerProvidedServlet | {
"repo_name": "plumer/codana",
"path": "tomcat_files/6.0.0/StandardWrapper.java",
"license": "mit",
"size": 60344
} | [
"org.apache.catalina.ContainerServlet"
] | import org.apache.catalina.ContainerServlet; | import org.apache.catalina.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 728,836 |
public void testHistory() {
assertNull(CONVERTER.convertForHistory(CONVERTERS, SPEC, VEGA));
} | void function() { assertNull(CONVERTER.convertForHistory(CONVERTERS, SPEC, VEGA)); } | /**
* Tests that no history is available.
*/ | Tests that no history is available | testHistory | {
"repo_name": "McLeodMoores/starling",
"path": "projects/web/src/test/java/com/opengamma/web/server/conversion/BucketedVegaConverterTest.java",
"license": "apache-2.0",
"size": 4417
} | [
"org.testng.Assert"
] | import org.testng.Assert; | import org.testng.*; | [
"org.testng"
] | org.testng; | 1,694,405 |
public String getSQL()
{
final StringBuilder cmd = new StringBuilder().append(" ")
.append(Context.getDbType().getSQLPart(SQLPart.SELECT)).append(" ");
if (this.distinct) {
cmd.append(Context.getDbType().getSQLPart(SQLPart.DISTINCT)).append(" ");
}
boolean first = true;
for (final Column column : this.columns) {
if (first) {
first = false;
} else {
cmd.append(Context.getDbType().getSQLPart(SQLPart.COMMA));
}
column.appendSQL(cmd);
}
cmd.append(" ").append(Context.getDbType().getSQLPart(SQLPart.FROM)).append(" ");
first = true;
for (final FromTable fromTable : this.fromTables) {
fromTable.appendSQL(first, cmd);
if (first) {
first = false;
}
}
cmd.append(" ");
for (final SQLSelectPart part : this.parts) {
part.appendSQL(cmd);
cmd.append(" ");
}
return cmd.toString();
} | String function() { final StringBuilder cmd = new StringBuilder().append(" ") .append(Context.getDbType().getSQLPart(SQLPart.SELECT)).append(" "); if (this.distinct) { cmd.append(Context.getDbType().getSQLPart(SQLPart.DISTINCT)).append(" "); } boolean first = true; for (final Column column : this.columns) { if (first) { first = false; } else { cmd.append(Context.getDbType().getSQLPart(SQLPart.COMMA)); } column.appendSQL(cmd); } cmd.append(" ").append(Context.getDbType().getSQLPart(SQLPart.FROM)).append(" "); first = true; for (final FromTable fromTable : this.fromTables) { fromTable.appendSQL(first, cmd); if (first) { first = false; } } cmd.append(" "); for (final SQLSelectPart part : this.parts) { part.appendSQL(cmd); cmd.append(" "); } return cmd.toString(); } | /**
* Returns the depending SQL statement.
*
* @return SQL statement
*/ | Returns the depending SQL statement | getSQL | {
"repo_name": "ov3rflow/eFaps-Kernel",
"path": "src/main/java/org/efaps/db/wrapper/SQLSelect.java",
"license": "apache-2.0",
"size": 26241
} | [
"org.efaps.db.Context"
] | import org.efaps.db.Context; | import org.efaps.db.*; | [
"org.efaps.db"
] | org.efaps.db; | 2,471,416 |
public static CharSequence getStyledText(AbstractPost post, List<CharacterStyle> mentionStyles, List<CharacterStyle> hashtagStyles, List<CharacterStyle> linkStyles) {
SpannableStringBuilder string = new SpannableStringBuilder(post.getText());
Entities entities = post.getEntities();
if(entities != null) {
if(mentionStyles != null) {
applyStylesToEntities(string, entities.getMentions(), mentionStyles);
}
if(hashtagStyles != null) {
applyStylesToEntities(string, entities.getHashtags(), hashtagStyles);
}
if(linkStyles != null) {
applyStylesToEntities(string, entities.getLinks(), linkStyles);
}
}
return string;
} | static CharSequence function(AbstractPost post, List<CharacterStyle> mentionStyles, List<CharacterStyle> hashtagStyles, List<CharacterStyle> linkStyles) { SpannableStringBuilder string = new SpannableStringBuilder(post.getText()); Entities entities = post.getEntities(); if(entities != null) { if(mentionStyles != null) { applyStylesToEntities(string, entities.getMentions(), mentionStyles); } if(hashtagStyles != null) { applyStylesToEntities(string, entities.getHashtags(), hashtagStyles); } if(linkStyles != null) { applyStylesToEntities(string, entities.getLinks(), linkStyles); } } return string; } | /**
* Get styled entities. If none exist, then the returned CharSequence has no styled spans.
*
* @param post the post or Message whose entities should be styled
* @param mentionStyles the CharacterStyles to apply to the mentions. may be null.
* @param hashtagStyles the CharacterStyles to apply to the hashtags. may be null.
* @param linkStyles the CharacterStyles to apply to the links. may be null.
* @return A CharSequence with styled spans
*/ | Get styled entities. If none exist, then the returned CharSequence has no styled spans | getStyledText | {
"repo_name": "rrbrambley/MessageBeast-Android",
"path": "src/main/java/com/alwaysallthetime/messagebeast/EntityStyler.java",
"license": "mit",
"size": 4099
} | [
"android.text.SpannableStringBuilder",
"android.text.style.CharacterStyle",
"com.alwaysallthetime.adnlib.data.AbstractPost",
"com.alwaysallthetime.adnlib.data.Entities",
"java.util.List"
] | import android.text.SpannableStringBuilder; import android.text.style.CharacterStyle; import com.alwaysallthetime.adnlib.data.AbstractPost; import com.alwaysallthetime.adnlib.data.Entities; import java.util.List; | import android.text.*; import android.text.style.*; import com.alwaysallthetime.adnlib.data.*; import java.util.*; | [
"android.text",
"com.alwaysallthetime.adnlib",
"java.util"
] | android.text; com.alwaysallthetime.adnlib; java.util; | 2,659,544 |
public void setDate(String field, Date val); | void function(String field, Date val); | /**
* Set the data value of the given field with a <code>Date</code>.
* @param field the data field to set
* @param val the value to set
* @see #canSetDate(String)
*/ | Set the data value of the given field with a <code>Date</code> | setDate | {
"repo_name": "dritanlatifi/AndroidPrefuse",
"path": "src/prefuse/data/Tuple.java",
"license": "bsd-3-clause",
"size": 24990
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,302,463 |
public static String getFromCompressedUnicode(
final byte[] string,
final int offset,
final int len) {
try {
return new String(string, offset, len, "ISO-8859-1");
} catch (UnsupportedEncodingException e) {
throw new InternalError();
}
} | static String function( final byte[] string, final int offset, final int len) { try { return new String(string, offset, len, STR); } catch (UnsupportedEncodingException e) { throw new InternalError(); } } | /**
* Read 8 bit data (in ISO-8859-1 codepage) into a (unicode) Java
* String and return.
* (In Excel terms, read compressed 8 bit unicode as a string)
*
* @param string byte array to read
* @param offset offset to read byte array
* @param len length to read byte array
* @return String generated String instance by reading byte array
*/ | Read 8 bit data (in ISO-8859-1 codepage) into a (unicode) Java String and return. (In Excel terms, read compressed 8 bit unicode as a string) | getFromCompressedUnicode | {
"repo_name": "ctrueden/bioformats",
"path": "components/forks/poi/src/loci/poi/util/StringUtil.java",
"license": "gpl-2.0",
"size": 12844
} | [
"java.io.UnsupportedEncodingException"
] | import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 1,770,711 |
public static void replaceMessage(Exchange exchange, Message newMessage, boolean outOnly) {
Message old = exchange.hasOut() ? exchange.getOut() : exchange.getIn();
if (outOnly || exchange.hasOut()) {
exchange.setOut(newMessage);
} else {
exchange.setIn(newMessage);
}
// need to de-reference old from the exchange so it can be GC
if (old instanceof MessageSupport) {
((MessageSupport) old).setExchange(null);
}
} | static void function(Exchange exchange, Message newMessage, boolean outOnly) { Message old = exchange.hasOut() ? exchange.getOut() : exchange.getIn(); if (outOnly exchange.hasOut()) { exchange.setOut(newMessage); } else { exchange.setIn(newMessage); } if (old instanceof MessageSupport) { ((MessageSupport) old).setExchange(null); } } | /**
* Replaces the existing message with the new message
*
* @param exchange the exchange
* @param newMessage the new message
* @param outOnly whether to replace the message as OUT message
*/ | Replaces the existing message with the new message | replaceMessage | {
"repo_name": "noelo/camel",
"path": "camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java",
"license": "apache-2.0",
"size": 35499
} | [
"org.apache.camel.Exchange",
"org.apache.camel.Message",
"org.apache.camel.impl.MessageSupport"
] | import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.impl.MessageSupport; | import org.apache.camel.*; import org.apache.camel.impl.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,581,105 |
public static Date yesterday() {
return castToDate(CalendarUtils.yesterday());
}
| static Date function() { return castToDate(CalendarUtils.yesterday()); } | /**
* Returns the yesterday date, <b>truncating</b> time info.
*
* @return The yesterday date.
*/ | Returns the yesterday date, truncating time info | yesterday | {
"repo_name": "taperinha/commons",
"path": "commons-core/src/main/java/br/ojimarcius/commons/util/DateUtils.java",
"license": "lgpl-2.1",
"size": 4096
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,778,643 |
public static String getFileSuffix(String filePath) {
if (StringUtils.isEmpty(filePath)) {
return filePath;
}
int suffix = filePath.lastIndexOf(FILE_SUFFIX_SEPARATOR);
int fp = filePath.lastIndexOf(File.separator);
if (suffix == -1) {
return "";
}
return (fp >= suffix) ? "" : filePath.substring(suffix + 1);
} | static String function(String filePath) { if (StringUtils.isEmpty(filePath)) { return filePath; } int suffix = filePath.lastIndexOf(FILE_SUFFIX_SEPARATOR); int fp = filePath.lastIndexOf(File.separator); if (suffix == -1) { return STR" : filePath.substring(suffix + 1); } | /**
* Get suffix of file
*
* @param filePath
* @return
*/ | Get suffix of file | getFileSuffix | {
"repo_name": "ifwx/AndroidCommon",
"path": "common/src/main/java/com/wx/android/common/util/FileUtils.java",
"license": "apache-2.0",
"size": 11899
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,020,217 |
public final void send(AsyncRequestCallback<?> callback) {
this.callback = callback;
try {
if (async) {
sendRequest(initCallback);
} else {
sendRequest(callback);
}
} catch (RequestException e) {
callback.onFailure(e);
}
} | final void function(AsyncRequestCallback<?> callback) { this.callback = callback; try { if (async) { sendRequest(initCallback); } else { sendRequest(callback); } } catch (RequestException e) { callback.onFailure(e); } } | /**
* Sends an HTTP request based on the current {@link AsyncRequest} configuration.
*
* @param callback
* the response handler to be notified when the request fails or completes
*/ | Sends an HTTP request based on the current <code>AsyncRequest</code> configuration | send | {
"repo_name": "vitaliy0922/cop_che-core",
"path": "commons/che-core-commons-gwt/src/main/java/org/eclipse/che/ide/rest/AsyncRequest.java",
"license": "epl-1.0",
"size": 10218
} | [
"com.google.gwt.http.client.RequestException"
] | import com.google.gwt.http.client.RequestException; | import com.google.gwt.http.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 916,020 |
private void runSync() throws Exception {
if (!syncRunning.get()) {
syncRunning.set(true);
syncRequested.set(false);
logger.log(Level.INFO, "RUNNING SYNC ...");
fireStartEvent();
try {
boolean notifyChanges = false;
// Run down
DownOperationResult downResult = new DownOperation(config, options.getDownOptions()).execute();
if (downResult.getResultCode() == DownResultCode.OK_WITH_REMOTE_CHANGES) {
// TODO [low] Do something?
}
// Run up
UpOperationResult upOperationResult = new UpOperation(config, options.getUpOptions()).execute();
if (upOperationResult.getResultCode() == UpResultCode.OK_CHANGES_UPLOADED && upOperationResult.getChangeSet().hasChanges()) {
upCount.incrementAndGet();
notifyChanges = true;
}
CleanupOperationResult cleanupOperationResult = new CleanupOperation(config, options.getCleanupOptions()).execute();
if (cleanupOperationResult.getResultCode() == CleanupResultCode.OK) {
notifyChanges = true;
}
// Fire change event if up and/or cleanup
if (notifyChanges) {
notifyChanges();
}
}
finally {
logger.log(Level.INFO, "SYNC DONE.");
syncRunning.set(false);
fireEndEvent();
}
}
else {
// Can't do a log message here, because this bit is called thousand
// of times when file system events occur.
syncRequested.set(true);
}
} | void function() throws Exception { if (!syncRunning.get()) { syncRunning.set(true); syncRequested.set(false); logger.log(Level.INFO, STR); fireStartEvent(); try { boolean notifyChanges = false; DownOperationResult downResult = new DownOperation(config, options.getDownOptions()).execute(); if (downResult.getResultCode() == DownResultCode.OK_WITH_REMOTE_CHANGES) { } UpOperationResult upOperationResult = new UpOperation(config, options.getUpOptions()).execute(); if (upOperationResult.getResultCode() == UpResultCode.OK_CHANGES_UPLOADED && upOperationResult.getChangeSet().hasChanges()) { upCount.incrementAndGet(); notifyChanges = true; } CleanupOperationResult cleanupOperationResult = new CleanupOperation(config, options.getCleanupOptions()).execute(); if (cleanupOperationResult.getResultCode() == CleanupResultCode.OK) { notifyChanges = true; } if (notifyChanges) { notifyChanges(); } } finally { logger.log(Level.INFO, STR); syncRunning.set(false); fireEndEvent(); } } else { syncRequested.set(true); } } | /**
* Runs one iteration of the main synchronization loop, containing a {@link DownOperation},
* an {@link UpOperation} and (if required), a {@link CleanupOperation}.
*/ | Runs one iteration of the main synchronization loop, containing a <code>DownOperation</code>, an <code>UpOperation</code> and (if required), a <code>CleanupOperation</code> | runSync | {
"repo_name": "syncany/syncany-plugin-sftp",
"path": "core/syncany-lib/src/main/java/org/syncany/operations/watch/WatchOperation.java",
"license": "gpl-3.0",
"size": 12435
} | [
"java.util.logging.Level",
"org.syncany.operations.cleanup.CleanupOperation",
"org.syncany.operations.cleanup.CleanupOperationResult",
"org.syncany.operations.down.DownOperation",
"org.syncany.operations.down.DownOperationResult",
"org.syncany.operations.up.UpOperation",
"org.syncany.operations.up.UpOperationResult"
] | import java.util.logging.Level; import org.syncany.operations.cleanup.CleanupOperation; import org.syncany.operations.cleanup.CleanupOperationResult; import org.syncany.operations.down.DownOperation; import org.syncany.operations.down.DownOperationResult; import org.syncany.operations.up.UpOperation; import org.syncany.operations.up.UpOperationResult; | import java.util.logging.*; import org.syncany.operations.cleanup.*; import org.syncany.operations.down.*; import org.syncany.operations.up.*; | [
"java.util",
"org.syncany.operations"
] | java.util; org.syncany.operations; | 668,369 |
public void testUnionColumnTypes() {
try {
Connection conn = newConnection();
Statement stmt = conn.createStatement();
stmt.execute("DROP TABLE test1 IF EXISTS");
stmt.execute("DROP TABLE test2 IF EXISTS");
stmt.execute("CREATE TABLE test1 (id int, b1 boolean)");
stmt.execute("CREATE TABLE test2 (id int)");
stmt.execute("INSERT INTO test1 VALUES(1,true)");
stmt.execute("INSERT INTO test2 VALUES(2)");
ResultSet rs = stmt.executeQuery(
"select id,null as b1 from test2 union select id, b1 from test1");
Boolean[] array = new Boolean[2];
for (int i = 0; rs.next(); i++) {
boolean boole = rs.getBoolean(2);
array[i] = Boolean.valueOf(boole);
if (rs.wasNull()) {
array[i] = null;
}
}
boolean result = (array[0] == null && array[1] == Boolean.TRUE)
|| (array[0] == Boolean.TRUE && array[1] == null);
assertTrue(result);
} catch (SQLException e) {
e.printStackTrace();
System.out.println("TestSql.testUnionColumnType() error: "
+ e.getMessage());
}
} | void function() { try { Connection conn = newConnection(); Statement stmt = conn.createStatement(); stmt.execute(STR); stmt.execute(STR); stmt.execute(STR); stmt.execute(STR); stmt.execute(STR); stmt.execute(STR); ResultSet rs = stmt.executeQuery( STR); Boolean[] array = new Boolean[2]; for (int i = 0; rs.next(); i++) { boolean boole = rs.getBoolean(2); array[i] = Boolean.valueOf(boole); if (rs.wasNull()) { array[i] = null; } } boolean result = (array[0] == null && array[1] == Boolean.TRUE) (array[0] == Boolean.TRUE && array[1] == null); assertTrue(result); } catch (SQLException e) { e.printStackTrace(); System.out.println(STR + e.getMessage()); } } | /**
* In 1.8.0.2, this fails in client / server due to column type of the
* second select for b1 being boolean, while the first select is interpreted
* as varchar. The rowOutputBase class attempts to cast the Java Boolean
* into String.
*/ | In 1.8.0.2, this fails in client / server due to column type of the second select for b1 being boolean, while the first select is interpreted as varchar. The rowOutputBase class attempts to cast the Java Boolean into String | testUnionColumnTypes | {
"repo_name": "ggorsontanguy/pocHSQLDB",
"path": "hsqldb-2.2.9/hsqldb/src/org/hsqldb/test/TestSql.java",
"license": "gpl-3.0",
"size": 32040
} | [
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 408,686 |
public Button getClearFilters() {
return _clearFilters;
} | Button function() { return _clearFilters; } | /**
* Gets the clear filters.
*
* @return the clear filters
*/ | Gets the clear filters | getClearFilters | {
"repo_name": "Governance/dtgov",
"path": "dtgov-ui-war/src/main/java/org/overlord/dtgov/ui/client/local/pages/workflowQuery/WorkflowQueriesFilter.java",
"license": "apache-2.0",
"size": 8922
} | [
"com.google.gwt.user.client.ui.Button"
] | import com.google.gwt.user.client.ui.Button; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,190,004 |
public Builder firstDeliveryDate(LocalDate firstDeliveryDate) {
JodaBeanUtils.notNull(firstDeliveryDate, "firstDeliveryDate");
this.firstDeliveryDate = firstDeliveryDate;
return this;
} | Builder function(LocalDate firstDeliveryDate) { JodaBeanUtils.notNull(firstDeliveryDate, STR); this.firstDeliveryDate = firstDeliveryDate; return this; } | /**
* Sets the first delivery date.
* <p>
* The first date on which the underlying is delivered.
* @param firstDeliveryDate the new value, not null
* @return this, for chaining, not null
*/ | Sets the first delivery date. The first date on which the underlying is delivered | firstDeliveryDate | {
"repo_name": "OpenGamma/Strata",
"path": "modules/product/src/main/java/com/opengamma/strata/product/bond/ResolvedBondFuture.java",
"license": "apache-2.0",
"size": 35094
} | [
"java.time.LocalDate",
"org.joda.beans.JodaBeanUtils"
] | import java.time.LocalDate; import org.joda.beans.JodaBeanUtils; | import java.time.*; import org.joda.beans.*; | [
"java.time",
"org.joda.beans"
] | java.time; org.joda.beans; | 1,950,135 |
@CheckReturnValue
public static AtomicIntegerArrayAssert then(AtomicIntegerArray actual) {
return assertThat(actual);
} | static AtomicIntegerArrayAssert function(AtomicIntegerArray actual) { return assertThat(actual); } | /**
* Create assertion for {@link AtomicIntegerArray}.
*
* @param actual the actual value.
* @return the created assertion object.
* @since 2.7.0 / 3.7.0
*/ | Create assertion for <code>AtomicIntegerArray</code> | then | {
"repo_name": "ChrisA89/assertj-core",
"path": "src/main/java/org/assertj/core/api/BDDAssertions.java",
"license": "apache-2.0",
"size": 43717
} | [
"java.util.concurrent.atomic.AtomicIntegerArray"
] | import java.util.concurrent.atomic.AtomicIntegerArray; | import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 2,019 |
public List<ByteArrayRange> getQueryRanges(
QueryRangeType indexedRange,
int maxEstimatedRangeDecomposition,
IndexMetaData... hints ); | List<ByteArrayRange> function( QueryRangeType indexedRange, int maxEstimatedRangeDecomposition, IndexMetaData... hints ); | /**
* Returns a list of query ranges for an specified numeric range.
*
* @param indexedRange
* defines the numeric range for the query
* @param maxRangeDecomposition
* the maximum number of ranges provided by a single query
* decomposition, this is a best attempt and not a guarantee
* @return a List of query ranges
*/ | Returns a list of query ranges for an specified numeric range | getQueryRanges | {
"repo_name": "dcy2003/geowave",
"path": "core/index/src/main/java/mil/nga/giat/geowave/core/index/IndexStrategy.java",
"license": "apache-2.0",
"size": 2756
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 950,155 |
List<File> getLatestUserLibFiles(boolean getDatanucleusFiles) throws ReflectionException; | List<File> getLatestUserLibFiles(boolean getDatanucleusFiles) throws ReflectionException; | /**
* Returns the latest version of all the user libs.
*
* @param getDatanucleusFiles should the datanucleus jars be returned. If the SDK doesn't support
* optional libraries, the datanucleus jars are returned regardless of the parameter.
*/ | Returns the latest version of all the user libs | getLatestUserLibFiles | {
"repo_name": "pruebasetichat/google-plugin-for-eclipse",
"path": "plugins/com.google.appengine.eclipse.core/src/com/google/appengine/eclipse/core/sdk/AppEngineBridge.java",
"license": "epl-1.0",
"size": 7391
} | [
"java.io.File",
"java.util.List",
"javax.management.ReflectionException"
] | import java.io.File; import java.util.List; import javax.management.ReflectionException; | import java.io.*; import java.util.*; import javax.management.*; | [
"java.io",
"java.util",
"javax.management"
] | java.io; java.util; javax.management; | 2,665,835 |
public Builder putAllItems(Map<String, NodeTypesScopedList> items) {
this.items = items;
return this;
} | Builder function(Map<String, NodeTypesScopedList> items) { this.items = items; return this; } | /**
* A list of NodeTypesScopedList resources. The key for the map is: [Output Only] Name of the
* scope containing this set of node types.
*/ | A list of NodeTypesScopedList resources. The key for the map is: [Output Only] Name of the scope containing this set of node types | putAllItems | {
"repo_name": "vam-google/google-cloud-java",
"path": "google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/NodeTypeAggregatedList.java",
"license": "apache-2.0",
"size": 10114
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,441,202 |
public static NeighbourMeasurementElement fromPerUnaligned(byte[] encodedBytes) {
NeighbourMeasurementElement result = new NeighbourMeasurementElement();
result.decodePerUnaligned(new BitStreamReader(encodedBytes));
return result;
} | static NeighbourMeasurementElement function(byte[] encodedBytes) { NeighbourMeasurementElement result = new NeighbourMeasurementElement(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; } | /**
* Creates a new NeighbourMeasurementElement from encoded stream.
*/ | Creates a new NeighbourMeasurementElement from encoded stream | fromPerUnaligned | {
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/lpp/NeighbourMeasurementElement.java",
"license": "apache-2.0",
"size": 24421
} | [
"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,677,971 |
private ResultSet getFirstResultSet(StatementScope scope, Statement stmt) throws SQLException {
ResultSet rs = null;
boolean hasMoreResults = true;
while (hasMoreResults) {
rs = stmt.getResultSet();
if (rs != null) {
break;
}
hasMoreResults = moveToNextResultsIfPresent(scope, stmt);
}
return rs;
} | ResultSet function(StatementScope scope, Statement stmt) throws SQLException { ResultSet rs = null; boolean hasMoreResults = true; while (hasMoreResults) { rs = stmt.getResultSet(); if (rs != null) { break; } hasMoreResults = moveToNextResultsIfPresent(scope, stmt); } return rs; } | /**
* Gets the first result set.
*
* @param scope
* the scope
* @param stmt
* the stmt
* @return the first result set
* @throws SQLException
* the SQL exception
*/ | Gets the first result set | getFirstResultSet | {
"repo_name": "hazendaz/mybatis-2",
"path": "src/main/java/com/ibatis/sqlmap/engine/execution/DefaultSqlExecutor.java",
"license": "apache-2.0",
"size": 32810
} | [
"com.ibatis.sqlmap.engine.scope.StatementScope",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import com.ibatis.sqlmap.engine.scope.StatementScope; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import com.ibatis.sqlmap.engine.scope.*; import java.sql.*; | [
"com.ibatis.sqlmap",
"java.sql"
] | com.ibatis.sqlmap; java.sql; | 2,057,720 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.