method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
ImmutableSet<QueryTarget> eval( QueryEnvironment env, ImmutableList<Argument> args, ListeningExecutorService executor) throws QueryException, InterruptedException; }
ImmutableSet<QueryTarget> eval( QueryEnvironment env, ImmutableList<Argument> args, ListeningExecutorService executor) throws QueryException, InterruptedException; }
/** * Called when a user-defined function is to be evaluated. * @param env the query environment this function is evaluated in. * @param args the input arguments. These are type-checked against the specification returned * by {@link #getArgumentTypes} and {@link #getMandatoryArguments}*/
Called when a user-defined function is to be evaluated
eval
{ "repo_name": "vschs007/buck", "path": "src/com/facebook/buck/query/QueryEnvironment.java", "license": "apache-2.0", "size": 9442 }
[ "com.google.common.collect.ImmutableList", "com.google.common.collect.ImmutableSet", "com.google.common.util.concurrent.ListeningExecutorService" ]
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.collect.*; import com.google.common.util.concurrent.*;
[ "com.google.common" ]
com.google.common;
263,255
public OutputStream createOutputStream(String name) throws IOException { name = fixFileName(name); return Util.getImplementation().createStorageOutputStream(name); }
OutputStream function(String name) throws IOException { name = fixFileName(name); return Util.getImplementation().createStorageOutputStream(name); }
/** * Creates an output stream to the storage with the given name * * @param name the storage file name * @return an output stream of limited capacity */
Creates an output stream to the storage with the given name
createOutputStream
{ "repo_name": "sannysanoff/CodenameOne", "path": "CodenameOne/src/com/codename1/io/Storage.java", "license": "gpl-2.0", "size": 9445 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,999,942
public List<TriggerListener> getInternalTriggerListeners() { synchronized (internalTriggerListeners) { return java.util.Collections.unmodifiableList(new LinkedList<TriggerListener>(internalTriggerListeners.values())); } }
List<TriggerListener> function() { synchronized (internalTriggerListeners) { return java.util.Collections.unmodifiableList(new LinkedList<TriggerListener>(internalTriggerListeners.values())); } }
/** * <p> * Get a list containing all of the <code>{@link org.quartz.listeners.TriggerListener}</code>s in the <code>Scheduler</code>'s <i>internal</i> list. * </p> */
Get a list containing all of the <code><code>org.quartz.listeners.TriggerListener</code></code>s in the <code>Scheduler</code>'s internal list.
getInternalTriggerListeners
{ "repo_name": "micke-a/Sundial", "path": "src/main/java/org/quartz/QuartzScheduler.java", "license": "apache-2.0", "size": 37328 }
[ "java.util.LinkedList", "java.util.List", "org.quartz.listeners.TriggerListener" ]
import java.util.LinkedList; import java.util.List; import org.quartz.listeners.TriggerListener;
import java.util.*; import org.quartz.listeners.*;
[ "java.util", "org.quartz.listeners" ]
java.util; org.quartz.listeners;
1,519,173
@JsonAnyGetter public Map<String, Object> additionalProperties() { return this.additionalProperties; }
Map<String, Object> function() { return this.additionalProperties; }
/** * Get the additionalProperties property: settingValue. * * @return the additionalProperties value. */
Get the additionalProperties property: settingValue
additionalProperties
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/MicrosoftGraphSettingValue.java", "license": "mit", "size": 3194 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,980,386
private void basicInvalidate(final EntryEventImpl event, boolean invokeCallbacks) throws EntryNotFoundException { final boolean forceNewEntryInClientCache = serverRegionProxy != null && getConcurrencyChecksEnabled(); basicInvalidate(event, invokeCallbacks, forceNewEntryInClientCache); }
void function(final EntryEventImpl event, boolean invokeCallbacks) throws EntryNotFoundException { final boolean forceNewEntryInClientCache = serverRegionProxy != null && getConcurrencyChecksEnabled(); basicInvalidate(event, invokeCallbacks, forceNewEntryInClientCache); }
/** * Return true if invalidation occurred; false if it did not, for example if it was already * invalidated */
Return true if invalidation occurred; false if it did not, for example if it was already invalidated
basicInvalidate
{ "repo_name": "PurelyApplied/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java", "license": "apache-2.0", "size": 391137 }
[ "org.apache.geode.cache.EntryNotFoundException" ]
import org.apache.geode.cache.EntryNotFoundException;
import org.apache.geode.cache.*;
[ "org.apache.geode" ]
org.apache.geode;
1,585,799
private void throwError(HttpServletResponse resp, int code) throws IOException { resp.sendRedirect("/" + Constants.SETUP + "&e=" + code); resp.getWriter().println("Could not update config - Code " + code); }
void function(HttpServletResponse resp, int code) throws IOException { resp.sendRedirect("/" + Constants.SETUP + "&e=" + code); resp.getWriter().println(STR + code); }
/** * Sends parametrized redirect in case of an occured error. * * @param resp the http response * @param code error code * @throws IOException if an error occurred during access */
Sends parametrized redirect in case of an occured error
throwError
{ "repo_name": "slauber/Crawcial", "path": "src/main/java/de/crawcial/web/setup/Updateconfig.java", "license": "mit", "size": 7063 }
[ "de.crawcial.Constants", "java.io.IOException", "javax.servlet.http.HttpServletResponse" ]
import de.crawcial.Constants; import java.io.IOException; import javax.servlet.http.HttpServletResponse;
import de.crawcial.*; import java.io.*; import javax.servlet.http.*;
[ "de.crawcial", "java.io", "javax.servlet" ]
de.crawcial; java.io; javax.servlet;
1,419,130
EReference getDepartment_Subdepts();
EReference getDepartment_Subdepts();
/** * Returns the meta object for the containment reference list '{@link org.spoofax.example.company.Department#getSubdepts <em>Subdepts</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Subdepts</em>'. * @see org.spoofax.example.company.Department#getSubdepts() * @see #getDepartment() * @generated */
Returns the meta object for the containment reference list '<code>org.spoofax.example.company.Department#getSubdepts Subdepts</code>'.
getDepartment_Subdepts
{ "repo_name": "adolfosbh/cs2as", "path": "org.spoofax.example.companies.as/emf-gen/org/spoofax/example/company/CompanyPackage.java", "license": "epl-1.0", "size": 14528 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,497,541
Builder addProperty(String name, SchemaOrgType value);
Builder addProperty(String name, SchemaOrgType value);
/** * Add a value to property. * * @param name The property name. * @param value The value of the property. */
Add a value to property
addProperty
{ "repo_name": "google/schemaorg-java", "path": "src/main/java/com/google/schemaorg/core/MobileApplication.java", "license": "apache-2.0", "size": 31267 }
[ "com.google.schemaorg.SchemaOrgType" ]
import com.google.schemaorg.SchemaOrgType;
import com.google.schemaorg.*;
[ "com.google.schemaorg" ]
com.google.schemaorg;
1,910,782
@Deprecated public long getEditLogSize() throws IOException { return namesystem.getEditLogSize(); }
long function() throws IOException { return namesystem.getEditLogSize(); }
/** * Returns the size of the current edit log. */
Returns the size of the current edit log
getEditLogSize
{ "repo_name": "cloudera/hadoop-hdfs", "path": "src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java", "license": "apache-2.0", "size": 56509 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,222,035
protected Result[] getResult(String answer, String docID) { Result[] results = new Result[1]; results[0] = new Result(answer, query, docID); // result is always returned by the QA engine results[0].setScore(Float.POSITIVE_INFINITY); return results; }
Result[] function(String answer, String docID) { Result[] results = new Result[1]; results[0] = new Result(answer, query, docID); results[0].setScore(Float.POSITIVE_INFINITY); return results; }
/** * Creates an array of a single <code>Result</code> object form an answer * string and a document ID. * * @param answer answer string * @param docID document ID * @return array of a single <code>Result</code> object */
Creates an array of a single <code>Result</code> object form an answer string and a document ID
getResult
{ "repo_name": "csarron/PriaQA", "path": "src/info/ephyra/search/searchers/KnowledgeAnnotator.java", "license": "gpl-3.0", "size": 7177 }
[ "info.ephyra.search.Result" ]
import info.ephyra.search.Result;
import info.ephyra.search.*;
[ "info.ephyra.search" ]
info.ephyra.search;
613,031
static List<SyncSession> getAllSessions(SyncUser syncUser) { if (syncUser == null) { throw new IllegalArgumentException("A non-empty 'syncUser' is required."); } ArrayList<SyncSession> allSessions = new ArrayList<SyncSession>(); for (SyncSession syncSession : sessions.values()) { if (syncSession.getState() != SyncSession.State.ERROR && syncSession.getUser().equals(syncUser)) { allSessions.add(syncSession); } } return allSessions; }
static List<SyncSession> getAllSessions(SyncUser syncUser) { if (syncUser == null) { throw new IllegalArgumentException(STR); } ArrayList<SyncSession> allSessions = new ArrayList<SyncSession>(); for (SyncSession syncSession : sessions.values()) { if (syncSession.getState() != SyncSession.State.ERROR && syncSession.getUser().equals(syncUser)) { allSessions.add(syncSession); } } return allSessions; }
/** * Retruns the all valid sessions belonging to the user. * * @param syncUser the user to use. * @return the all valid sessions belonging to the user. */
Retruns the all valid sessions belonging to the user
getAllSessions
{ "repo_name": "weiwenqiang/GitHub", "path": "expert/realm-java/realm/realm-library/src/objectServer/java/io/realm/SyncManager.java", "license": "apache-2.0", "size": 21858 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
592,915
private static void writeTimestamp(final long absPtr, long tstamp) { tstamp >>= 8; GridUnsafe.putLongVolatile(null, absPtr, (tstamp << 8) | 0x01); }
static void function(final long absPtr, long tstamp) { tstamp >>= 8; GridUnsafe.putLongVolatile(null, absPtr, (tstamp << 8) 0x01); }
/** * Volatile write for current timestamp to page in {@code absAddr} address. * * @param absPtr Absolute page address. */
Volatile write for current timestamp to page in absAddr address
writeTimestamp
{ "repo_name": "alexzaitzev/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java", "license": "apache-2.0", "size": 96630 }
[ "org.apache.ignite.internal.util.GridUnsafe" ]
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,763,670
public void testSimpleShrinkMultipleWithEventHandler() throws Exception { // SETUP MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 1 ); cacheAttr.setMaxSpoolPerRun( 3 ); memory.setCacheAttributes( cacheAttr ); ElementEventHandlerMockImpl handler = new ElementEventHandlerMockImpl(); for ( int i = 0; i < 10; i++ ) { String key = "key" + i; String value = "value"; ICacheElement<String, String> element = new CacheElement<String, String>( "testRegion", key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.addElementEventHandler( handler ); elementAttr.setIsEternal( false ); element.setElementAttributes( elementAttr ); element.getElementAttributes().setMaxLifeSeconds( 1 ); memory.update( element ); ICacheElement<String, String> returnedElement1 = memory.get( key ); assertNotNull( "We should have received an element", returnedElement1 ); // set this to 2 seconds ago. elementAttr.lastAccessTime = System.currentTimeMillis() - 2000; } // DO WORK ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); Thread runner = new Thread( shrinker ); runner.run(); // VERIFY Thread.sleep( 500 ); assertEquals( "Waterfall called the wrong number of times.", 3, memory.waterfallCallCount ); // the shrinker delegates the the composite cache on the memory cache to put the // event on the queue. This make it hard to test. TODO we need to change this to make it easier to verify. //assertEquals( "Event handler ExceededIdleTimeBackground called the wrong number of times.", 3, handler.getExceededIdleTimeBackgroundCount() ); assertEquals( "Wrong number of elements remain.", 7, memory.getSize() ); }
void function() throws Exception { MockMemoryCache<String, String> memory = new MockMemoryCache<String, String>(); CompositeCacheAttributes cacheAttr = new CompositeCacheAttributes(); cacheAttr.setMaxMemoryIdleTimeSeconds( 1 ); cacheAttr.setMaxSpoolPerRun( 3 ); memory.setCacheAttributes( cacheAttr ); ElementEventHandlerMockImpl handler = new ElementEventHandlerMockImpl(); for ( int i = 0; i < 10; i++ ) { String key = "key" + i; String value = "value"; ICacheElement<String, String> element = new CacheElement<String, String>( STR, key, value ); ElementAttributes elementAttr = new ElementAttributes(); elementAttr.addElementEventHandler( handler ); elementAttr.setIsEternal( false ); element.setElementAttributes( elementAttr ); element.getElementAttributes().setMaxLifeSeconds( 1 ); memory.update( element ); ICacheElement<String, String> returnedElement1 = memory.get( key ); assertNotNull( STR, returnedElement1 ); elementAttr.lastAccessTime = System.currentTimeMillis() - 2000; } ShrinkerThread<String, String> shrinker = new ShrinkerThread<String, String>( memory ); Thread runner = new Thread( shrinker ); runner.run(); Thread.sleep( 500 ); assertEquals( STR, 3, memory.waterfallCallCount ); assertEquals( STR, 7, memory.getSize() ); }
/** * Add a mock event handler to the items. Verify that it gets called. * <p> * This is only testing the spooled background event * <p> * @throws Exception */
Add a mock event handler to the items. Verify that it gets called. This is only testing the spooled background event
testSimpleShrinkMultipleWithEventHandler
{ "repo_name": "tikue/jcs2-snapshot", "path": "src/test/org/apache/commons/jcs/engine/memory/shrinking/ShrinkerThreadUnitTest.java", "license": "apache-2.0", "size": 12471 }
[ "org.apache.commons.jcs.engine.CacheElement", "org.apache.commons.jcs.engine.CompositeCacheAttributes", "org.apache.commons.jcs.engine.ElementAttributes", "org.apache.commons.jcs.engine.behavior.ICacheElement", "org.apache.commons.jcs.engine.control.event.ElementEventHandlerMockImpl", "org.apache.commons.jcs.engine.memory.MockMemoryCache" ]
import org.apache.commons.jcs.engine.CacheElement; import org.apache.commons.jcs.engine.CompositeCacheAttributes; import org.apache.commons.jcs.engine.ElementAttributes; import org.apache.commons.jcs.engine.behavior.ICacheElement; import org.apache.commons.jcs.engine.control.event.ElementEventHandlerMockImpl; import org.apache.commons.jcs.engine.memory.MockMemoryCache;
import org.apache.commons.jcs.engine.*; import org.apache.commons.jcs.engine.behavior.*; import org.apache.commons.jcs.engine.control.event.*; import org.apache.commons.jcs.engine.memory.*;
[ "org.apache.commons" ]
org.apache.commons;
2,267,393
public void pause() { if (flutterRenderer != null) { // Don't remove the `flutterUiDisplayListener` as `onFlutterUiDisplayed()` will make // the `FlutterSurfaceView` visible. flutterRenderer = null; isAttachedToFlutterRenderer = false; } else { Log.w(TAG, "pause() invoked when no FlutterRenderer was attached."); } }
void function() { if (flutterRenderer != null) { flutterRenderer = null; isAttachedToFlutterRenderer = false; } else { Log.w(TAG, STR); } }
/** * Invoked by the owner of this {@code FlutterSurfaceView} when it should pause rendering Flutter * UI to this {@code FlutterSurfaceView}. */
Invoked by the owner of this FlutterSurfaceView when it should pause rendering Flutter UI to this FlutterSurfaceView
pause
{ "repo_name": "chinmaygarde/flutter_engine", "path": "shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java", "license": "bsd-3-clause", "size": 10954 }
[ "io.flutter.Log" ]
import io.flutter.Log;
import io.flutter.*;
[ "io.flutter" ]
io.flutter;
175,069
Observable<ServiceResponse<SimpleProduct>> putSimpleProductWithGroupingWithServiceResponseAsync(FlattenParameterGroup flattenParameterGroup);
Observable<ServiceResponse<SimpleProduct>> putSimpleProductWithGroupingWithServiceResponseAsync(FlattenParameterGroup flattenParameterGroup);
/** * Put Simple Product with client flattening true on the model. * * @param flattenParameterGroup Additional parameters for the operation * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the SimpleProduct object */
Put Simple Product with client flattening true on the model
putSimpleProductWithGroupingWithServiceResponseAsync
{ "repo_name": "devigned/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestService.java", "license": "mit", "size": 26691 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,554,142
Optional<URL> envHome = new ResolveGeogitDir(platform).call(); checkState(envHome.isPresent(), "Not inside a geogit directory"); final URL envURL = envHome.get(); if (!"file".equals(envURL.getProtocol())) { throw new UnsupportedOperationException( "This References Database works only against file system repositories. " + "Repository location: " + envURL.toExternalForm()); } File repoDir; try { repoDir = new File(envURL.toURI()); } catch (URISyntaxException e) { throw Throwables.propagate(e); } File refs = new File(repoDir, "refs"); if (!refs.exists() && !refs.mkdir()) { throw new IllegalStateException("Cannot create refs directory '" + refs.getAbsolutePath() + "'"); } }
Optional<URL> envHome = new ResolveGeogitDir(platform).call(); checkState(envHome.isPresent(), STR); final URL envURL = envHome.get(); if (!"file".equals(envURL.getProtocol())) { throw new UnsupportedOperationException( STR + STR + envURL.toExternalForm()); } File repoDir; try { repoDir = new File(envURL.toURI()); } catch (URISyntaxException e) { throw Throwables.propagate(e); } File refs = new File(repoDir, "refs"); if (!refs.exists() && !refs.mkdir()) { throw new IllegalStateException(STR + refs.getAbsolutePath() + "'"); } }
/** * Creates the reference database. */
Creates the reference database
create
{ "repo_name": "markles/GeoGit", "path": "src/core/src/main/java/org/geogit/storage/fs/FileRefDatabase.java", "license": "bsd-3-clause", "size": 11445 }
[ "com.google.common.base.Optional", "com.google.common.base.Preconditions", "com.google.common.base.Throwables", "java.io.File", "java.net.URISyntaxException", "org.geogit.api.plumbing.ResolveGeogitDir" ]
import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.base.Throwables; import java.io.File; import java.net.URISyntaxException; import org.geogit.api.plumbing.ResolveGeogitDir;
import com.google.common.base.*; import java.io.*; import java.net.*; import org.geogit.api.plumbing.*;
[ "com.google.common", "java.io", "java.net", "org.geogit.api" ]
com.google.common; java.io; java.net; org.geogit.api;
2,396,260
public void addSwipeListener(SwipeListener listener) { if (mListeners == null) { mListeners = new ArrayList<SwipeListener>(); } mListeners.add(listener); }
void function(SwipeListener listener) { if (mListeners == null) { mListeners = new ArrayList<SwipeListener>(); } mListeners.add(listener); }
/** * Add a callback to be invoked when a swipe event is sent to this view. * * @param listener the swipe listener to attach to this view */
Add a callback to be invoked when a swipe event is sent to this view
addSwipeListener
{ "repo_name": "x251089003/EveryXDay", "path": "EveryXDay/src/main/java/com/xinxin/everyxday/widget/swipeback/SwipeBackLayout.java", "license": "apache-2.0", "size": 20638 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
615,787
protected void doneParsing() throws SAXException { guidelineValues = new Guideline[ guidelines.size() ]; for ( int i = 0; i < guidelines.size(); i++ ) { final GuidelineReadHandler handler = (GuidelineReadHandler) guidelines.get( i ); guidelineValues[ i ] = (Guideline) handler.getObject(); } }
void function() throws SAXException { guidelineValues = new Guideline[ guidelines.size() ]; for ( int i = 0; i < guidelines.size(); i++ ) { final GuidelineReadHandler handler = (GuidelineReadHandler) guidelines.get( i ); guidelineValues[ i ] = (Guideline) handler.getObject(); } }
/** * Done parsing. * * @throws SAXException if there is a parsing error. */
Done parsing
doneParsing
{ "repo_name": "mbatchelor/pentaho-reporting", "path": "engine/extensions-reportdesigner-parser/src/main/java/org/pentaho/reporting/engine/classic/extensions/parsers/reportdesigner/report/LinealModelReadHandler.java", "license": "lgpl-2.1", "size": 2993 }
[ "org.pentaho.reporting.engine.classic.extensions.parsers.reportdesigner.model.Guideline", "org.xml.sax.SAXException" ]
import org.pentaho.reporting.engine.classic.extensions.parsers.reportdesigner.model.Guideline; import org.xml.sax.SAXException;
import org.pentaho.reporting.engine.classic.extensions.parsers.reportdesigner.model.*; import org.xml.sax.*;
[ "org.pentaho.reporting", "org.xml.sax" ]
org.pentaho.reporting; org.xml.sax;
1,783,245
public void setActivateOnItemClick(boolean activateOnItemClick) { // When setting CHOICE_MODE_SINGLE, ListView will automatically // give items the 'activated' state when touched. getListView().setChoiceMode( activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE); }
void function(boolean activateOnItemClick) { getListView().setChoiceMode( activateOnItemClick ? AbsListView.CHOICE_MODE_SINGLE : AbsListView.CHOICE_MODE_NONE); }
/** * Turns on activate-on-click mode. When this mode is on, list items will be * given the 'activated' state when touched. */
Turns on activate-on-click mode. When this mode is on, list items will be given the 'activated' state when touched
setActivateOnItemClick
{ "repo_name": "SimoneLocatelli/androidbase", "path": "AndroidBase/src/com/androidbase/fragments/MasterFragment.java", "license": "apache-2.0", "size": 3735 }
[ "android.widget.AbsListView" ]
import android.widget.AbsListView;
import android.widget.*;
[ "android.widget" ]
android.widget;
1,897,072
private Animator prepareStyle3Animation() { AnimatorSet animation = new AnimatorSet(); ObjectAnimator progressAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0.75f, 0f); progressAnimation.setDuration(1200); progressAnimation.setInterpolator(new AnticipateInterpolator()); Animator innerCircleAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0.75f, 0f); innerCircleAnimation.setDuration(1200); innerCircleAnimation.setInterpolator(new AnticipateInterpolator()); ObjectAnimator invertedProgress = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0f, 0.75f); invertedProgress.setDuration(1200); invertedProgress.setStartDelay(3200); invertedProgress.setInterpolator(new OvershootInterpolator()); Animator invertedCircle = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0f, 0.75f); invertedCircle.setDuration(1200); invertedCircle.setStartDelay(3200); invertedCircle.setInterpolator(new OvershootInterpolator()); animation.playTogether(progressAnimation, innerCircleAnimation, invertedProgress, invertedCircle); return animation; }
Animator function() { AnimatorSet animation = new AnimatorSet(); ObjectAnimator progressAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0.75f, 0f); progressAnimation.setDuration(1200); progressAnimation.setInterpolator(new AnticipateInterpolator()); Animator innerCircleAnimation = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0.75f, 0f); innerCircleAnimation.setDuration(1200); innerCircleAnimation.setInterpolator(new AnticipateInterpolator()); ObjectAnimator invertedProgress = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.PROGRESS_PROPERTY, 0f, 0.75f); invertedProgress.setDuration(1200); invertedProgress.setStartDelay(3200); invertedProgress.setInterpolator(new OvershootInterpolator()); Animator invertedCircle = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0f, 0.75f); invertedCircle.setDuration(1200); invertedCircle.setStartDelay(3200); invertedCircle.setInterpolator(new OvershootInterpolator()); animation.playTogether(progressAnimation, innerCircleAnimation, invertedProgress, invertedCircle); return animation; }
/** * Style 3 animation will turn a 3/4 animation with Anticipate/Overshoot interpolation to a * blank waiting - like state, wait for 2 seconds then return to the original state * * @return Animation */
Style 3 animation will turn a 3/4 animation with Anticipate/Overshoot interpolation to a blank waiting - like state, wait for 2 seconds then return to the original state
prepareStyle3Animation
{ "repo_name": "adrianomazucato/CircularProgressDrawable", "path": "circular-progress-drawable-sample/src/main/java/com/sefford/circularprogressdrawable/sample/MainActivity.java", "license": "apache-2.0", "size": 9109 }
[ "android.animation.Animator", "android.animation.AnimatorSet", "android.animation.ObjectAnimator", "android.view.animation.AnticipateInterpolator", "android.view.animation.OvershootInterpolator", "com.sefford.circularprogressdrawable.CircularProgressDrawable" ]
import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.view.animation.AnticipateInterpolator; import android.view.animation.OvershootInterpolator; import com.sefford.circularprogressdrawable.CircularProgressDrawable;
import android.animation.*; import android.view.animation.*; import com.sefford.circularprogressdrawable.*;
[ "android.animation", "android.view", "com.sefford.circularprogressdrawable" ]
android.animation; android.view; com.sefford.circularprogressdrawable;
783,470
private void loadLaborTestData(String testTarget) throws Exception { TestDataPreparator.doCleanUpWithoutReference(ledgerEntryClass, properties, testTarget + EffortTestDataPropertyConstants.DATA_CLEANUP, entryFieldNames, deliminator); TestDataPreparator.doCleanUpWithoutReference(ledgerBalanceClass, properties, testTarget + EffortTestDataPropertyConstants.DATA_CLEANUP, balanceFieldNames, deliminator); int numberOfEntries = Integer.valueOf(properties.getProperty(testTarget + EffortTestDataPropertyConstants.NUM_OF_ENTRIES)); List<LaborLedgerEntry> ledgerEntries = TestDataPreparator.buildTestDataList(ledgerEntryClass, properties, testTarget + EffortTestDataPropertyConstants.INPUT_ENTRY, entryFieldNames, deliminator, numberOfEntries); TestDataPreparator.persistDataObject(ledgerEntries); int numberOfBalances = Integer.valueOf(properties.getProperty(testTarget + EffortTestDataPropertyConstants.NUM_OF_BALANCES)); List<LaborLedgerBalance> ledgerBalances = TestDataPreparator.buildTestDataList(ledgerBalanceClass, properties, testTarget + EffortTestDataPropertyConstants.INPUT_BALANCE, balanceFieldNames, deliminator, numberOfBalances); TestDataPreparator.persistDataObject(ledgerBalances); }
void function(String testTarget) throws Exception { TestDataPreparator.doCleanUpWithoutReference(ledgerEntryClass, properties, testTarget + EffortTestDataPropertyConstants.DATA_CLEANUP, entryFieldNames, deliminator); TestDataPreparator.doCleanUpWithoutReference(ledgerBalanceClass, properties, testTarget + EffortTestDataPropertyConstants.DATA_CLEANUP, balanceFieldNames, deliminator); int numberOfEntries = Integer.valueOf(properties.getProperty(testTarget + EffortTestDataPropertyConstants.NUM_OF_ENTRIES)); List<LaborLedgerEntry> ledgerEntries = TestDataPreparator.buildTestDataList(ledgerEntryClass, properties, testTarget + EffortTestDataPropertyConstants.INPUT_ENTRY, entryFieldNames, deliminator, numberOfEntries); TestDataPreparator.persistDataObject(ledgerEntries); int numberOfBalances = Integer.valueOf(properties.getProperty(testTarget + EffortTestDataPropertyConstants.NUM_OF_BALANCES)); List<LaborLedgerBalance> ledgerBalances = TestDataPreparator.buildTestDataList(ledgerBalanceClass, properties, testTarget + EffortTestDataPropertyConstants.INPUT_BALANCE, balanceFieldNames, deliminator, numberOfBalances); TestDataPreparator.persistDataObject(ledgerBalances); }
/** * load test data into database before a test case starts * * @param testTarget the target test case */
load test data into database before a test case starts
loadLaborTestData
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-ec/src/test/java/org/kuali/kfs/module/ec/service/EffortCertificationDocumentServiceTest.java", "license": "agpl-3.0", "size": 12920 }
[ "java.util.List", "org.kuali.kfs.integration.ld.LaborLedgerBalance", "org.kuali.kfs.integration.ld.LaborLedgerEntry", "org.kuali.kfs.module.ec.testdata.EffortTestDataPropertyConstants", "org.kuali.kfs.sys.TestDataPreparator" ]
import java.util.List; import org.kuali.kfs.integration.ld.LaborLedgerBalance; import org.kuali.kfs.integration.ld.LaborLedgerEntry; import org.kuali.kfs.module.ec.testdata.EffortTestDataPropertyConstants; import org.kuali.kfs.sys.TestDataPreparator;
import java.util.*; import org.kuali.kfs.integration.ld.*; import org.kuali.kfs.module.ec.testdata.*; import org.kuali.kfs.sys.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
2,516,659
void decode(ReadableBuffer buffer);
void decode(ReadableBuffer buffer);
/** * Decodes the Message from the given {@link ReadableBuffer}. * <p> * If the buffer given does not contain the fully encoded Message bytes for decode * this method will throw an exception to indicate the buffer underflow condition and * the message object will be left in an undefined state. * * @param buffer * A {@link ReadableBuffer} that contains the complete message bytes. */
Decodes the Message from the given <code>ReadableBuffer</code>. If the buffer given does not contain the fully encoded Message bytes for decode this method will throw an exception to indicate the buffer underflow condition and the message object will be left in an undefined state
decode
{ "repo_name": "gemmellr/qpid-proton-j", "path": "proton-j/src/main/java/org/apache/qpid/proton/message/Message.java", "license": "apache-2.0", "size": 6208 }
[ "org.apache.qpid.proton.codec.ReadableBuffer" ]
import org.apache.qpid.proton.codec.ReadableBuffer;
import org.apache.qpid.proton.codec.*;
[ "org.apache.qpid" ]
org.apache.qpid;
2,357,693
public CFile getFile( CPath path ) { Headers headers = headOrNull( path ); if ( headers == null ) { return null; } if ( !headers.contains( "Content-Type" ) ) { LOGGER.warn( "{} object has no content type ?!", path ); return null; } CFile file; if ( !CONTENT_TYPE_DIRECTORY.equals( headers.getHeaderValue( "Content-Type" ) ) ) { file = new CBlob( path, Long.parseLong( headers.getHeaderValue( "Content-Length" ) ), headers.getHeaderValue( "Content-Type" ), parseTimestamp( headers ), parseMetaHeaders( headers ) ); } else { file = new CFolder( path, parseTimestamp( headers ), parseMetaHeaders( headers ) ); } return file; }
CFile function( CPath path ) { Headers headers = headOrNull( path ); if ( headers == null ) { return null; } if ( !headers.contains( STR ) ) { LOGGER.warn( STR, path ); return null; } CFile file; if ( !CONTENT_TYPE_DIRECTORY.equals( headers.getHeaderValue( STR ) ) ) { file = new CBlob( path, Long.parseLong( headers.getHeaderValue( STR ) ), headers.getHeaderValue( STR ), parseTimestamp( headers ), parseMetaHeaders( headers ) ); } else { file = new CFolder( path, parseTimestamp( headers ), parseMetaHeaders( headers ) ); } return file; }
/** * Inquire details about object at given path. * * @param path The file path * @return a CFolder, CBlob or None if no object exist at this path */
Inquire details about object at given path
getFile
{ "repo_name": "netheosgithub/pcs_api", "path": "java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java", "license": "apache-2.0", "size": 25935 }
[ "net.netheos.pcsapi.models.CBlob", "net.netheos.pcsapi.models.CFile", "net.netheos.pcsapi.models.CFolder", "net.netheos.pcsapi.models.CPath", "net.netheos.pcsapi.request.Headers" ]
import net.netheos.pcsapi.models.CBlob; import net.netheos.pcsapi.models.CFile; import net.netheos.pcsapi.models.CFolder; import net.netheos.pcsapi.models.CPath; import net.netheos.pcsapi.request.Headers;
import net.netheos.pcsapi.models.*; import net.netheos.pcsapi.request.*;
[ "net.netheos.pcsapi" ]
net.netheos.pcsapi;
525,844
public static final long getChecksumFailuresCount() { return checksumFailures.getAndSet(0); } public interface Writer extends Closeable {
static final long function() { return checksumFailures.getAndSet(0); } public interface Writer extends Closeable {
/** * Number of checksum verification failures. It also * clears the counter. */
Number of checksum verification failures. It also clears the counter
getChecksumFailuresCount
{ "repo_name": "mapr/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java", "license": "apache-2.0", "size": 32867 }
[ "java.io.Closeable" ]
import java.io.Closeable;
import java.io.*;
[ "java.io" ]
java.io;
129,031
CompletionStage<WSResponse> post(Document body); /** * Perform a POST on the request asynchronously. * * @deprecated use {@link #post(BodyWritable)}
CompletionStage<WSResponse> post(Document body); /** * Perform a POST on the request asynchronously. * * @deprecated use {@link #post(BodyWritable)}
/** * Perform a POST on the request asynchronously. * * @param body represented as a Document * @return a promise to the response */
Perform a POST on the request asynchronously
post
{ "repo_name": "Shenker93/playframework", "path": "framework/src/play-ws/src/main/java/play/libs/ws/WSRequest.java", "license": "apache-2.0", "size": 16160 }
[ "java.util.concurrent.CompletionStage", "org.w3c.dom.Document" ]
import java.util.concurrent.CompletionStage; import org.w3c.dom.Document;
import java.util.concurrent.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
348,958
@Override public void refresh(String refreshCaller, Map fieldValues, MaintenanceDocument document) { refreshProposal(KFSConstants.KUALI_LOOKUPABLE_IMPL.equals(fieldValues.get(KFSConstants.REFRESH_CALLER))); super.refresh(refreshCaller, fieldValues, document); }
void function(String refreshCaller, Map fieldValues, MaintenanceDocument document) { refreshProposal(KFSConstants.KUALI_LOOKUPABLE_IMPL.equals(fieldValues.get(KFSConstants.REFRESH_CALLER))); super.refresh(refreshCaller, fieldValues, document); }
/** * This method is called for refreshing the {@link Agency} and other related BOs after a lookup, to display their full name & * etc without AJAX. * * @param refreshCaller * @param fieldValues * @param document */
This method is called for refreshing the <code>Agency</code> and other related BOs after a lookup, to display their full name & etc without AJAX
refresh
{ "repo_name": "bhutchinson/kfs", "path": "kfs-cg/src/main/java/org/kuali/kfs/module/cg/document/ProposalMaintainableImpl.java", "license": "agpl-3.0", "size": 10530 }
[ "java.util.Map", "org.kuali.kfs.sys.KFSConstants", "org.kuali.rice.kns.document.MaintenanceDocument" ]
import java.util.Map; import org.kuali.kfs.sys.KFSConstants; import org.kuali.rice.kns.document.MaintenanceDocument;
import java.util.*; import org.kuali.kfs.sys.*; import org.kuali.rice.kns.document.*;
[ "java.util", "org.kuali.kfs", "org.kuali.rice" ]
java.util; org.kuali.kfs; org.kuali.rice;
1,964,839
@Test public void test_buildBPartnerAddressStringBPartnerBlock_0060() { final I_C_Location location = prepareLocation("addr1", "addr2", null, null, "City1", "Region1", "121212", false, "", prepareCountry("Germany", "@BP@ \\(test\\) @FN@ @LN@ @CON@ @A2@ @A1@ @P@ @C@ @CO@")); final I_C_BPartner_Location bpLocation = prepareBPLocation(location); final I_C_BPartner bPartner = prepareBPartner("Name1", "Name2", false); final I_C_Greeting greeting = prepareGreeting("Frau"); final I_AD_User user = prepareUser("UserFN", "UserLN", "", greeting); Assert.assertEquals( "LOCAL: (test) \nUserFN UserLN\naddr2\naddr1\n121212 City1", Services.get(IBPartnerBL.class).mkFullAddress(bPartner, bpLocation, user, null)); }
void function() { final I_C_Location location = prepareLocation("addr1STRaddr2", null, null, "City1", STR, STR, false, STRGermanySTR@BP@ \\(test\\) @FN@ @LN@ @CON@ @A2@ @A1@ @P@ @C@ @CO@STRName1STRName2STRFrauSTRUserFNSTRUserLNSTRSTRLOCAL: (test) \nUserFN UserLN\naddr2\naddr1\n121212 City1", Services.get(IBPartnerBL.class).mkFullAddress(bPartner, bpLocation, user, null)); }
/** * task 04121 <br> * check if the brackets are escaped also in user sequence */
task 04121 check if the brackets are escaped also in user sequence
test_buildBPartnerAddressStringBPartnerBlock_0060
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.swat/de.metas.swat.base/src/test/java/de/metas/adempiere/service/impl/AddressBuilderTest.java", "license": "gpl-2.0", "size": 28457 }
[ "org.adempiere.bpartner.service.IBPartnerBL", "org.adempiere.util.Services" ]
import org.adempiere.bpartner.service.IBPartnerBL; import org.adempiere.util.Services;
import org.adempiere.bpartner.service.*; import org.adempiere.util.*;
[ "org.adempiere.bpartner", "org.adempiere.util" ]
org.adempiere.bpartner; org.adempiere.util;
50,978
private double estimateBulgeWidthOLD(int firstBase, int lastBase) { if (firstBase + 1 == lastBase) return LOOP_DISTANCE; // there is actually no bulge double len = estimateBulgeArcLength(firstBase, lastBase); // We expect the bases to be drawn on a circle having its center in the middle of the helix. len += BASE_PAIR_DISTANCE; // 2 * half base pair part of the helix return 2 * (len / Math.PI); }
double function(int firstBase, int lastBase) { if (firstBase + 1 == lastBase) return LOOP_DISTANCE; double len = estimateBulgeArcLength(firstBase, lastBase); len += BASE_PAIR_DISTANCE; return 2 * (len / Math.PI); }
/** * Estimate bulge width, the given first and last bases must be those in the helix. */
Estimate bulge width, the given first and last bases must be those in the helix
estimateBulgeWidthOLD
{ "repo_name": "statalign/statalign", "path": "src/fr/orsay/lri/varna/models/rna/RNA.java", "license": "gpl-3.0", "size": 146442 }
[ "java.lang.Math" ]
import java.lang.Math;
import java.lang.*;
[ "java.lang" ]
java.lang;
2,149,697
EReference getETimeline_TopContents();
EReference getETimeline_TopContents();
/** * Returns the meta object for the containment reference list '{@link gov.nasa.arc.spife.timeline.model.ETimeline#getTopContents <em>Top Contents</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Top Contents</em>'. * @see gov.nasa.arc.spife.timeline.model.ETimeline#getTopContents() * @see #getETimeline() * @generated */
Returns the meta object for the containment reference list '<code>gov.nasa.arc.spife.timeline.model.ETimeline#getTopContents Top Contents</code>'.
getETimeline_TopContents
{ "repo_name": "nasa/OpenSPIFe", "path": "gov.nasa.arc.spife/src/gov/nasa/arc/spife/timeline/TimelinePackage.java", "license": "apache-2.0", "size": 36126 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,500,929
private void verifyCacheHeaders(boolean isPrivate, MockRestResponseChannel restResponseChannel) { if (isPrivate) { Assert.assertEquals("Expires value is incorrect for private blob", restResponseChannel.getHeader(RestUtils.Headers.DATE), restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)); Assert.assertEquals("Cache-Control value not as expected", "private, no-cache, no-store, proxy-revalidate", restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertEquals("Pragma value not as expected", "no-cache", restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } else { Assert.assertTrue("Expires value should be in the future", RestUtils.getTimeFromDateString(restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)) > System.currentTimeMillis()); Assert.assertEquals("Cache-Control value not as expected", "max-age=" + FRONTEND_CONFIG.frontendCacheValiditySeconds, restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertNull("Pragma value should not have been set", restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } }
void function(boolean isPrivate, MockRestResponseChannel restResponseChannel) { if (isPrivate) { Assert.assertEquals(STR, restResponseChannel.getHeader(RestUtils.Headers.DATE), restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)); Assert.assertEquals(STR, STR, restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertEquals(STR, STR, restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } else { Assert.assertTrue(STR, RestUtils.getTimeFromDateString(restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)) > System.currentTimeMillis()); Assert.assertEquals(STR, STR + FRONTEND_CONFIG.frontendCacheValiditySeconds, restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertNull(STR, restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); } }
/** * Verifies that the right cache headers are returned. * @param isPrivate {@code true} if the blob is private, {@code false} if not. * @param restResponseChannel the {@link RestResponseChannel} over which the response is sent. */
Verifies that the right cache headers are returned
verifyCacheHeaders
{ "repo_name": "nsivabalan/ambry", "path": "ambry-frontend/src/test/java/com.github.ambry.frontend/AmbrySecurityServiceTest.java", "license": "apache-2.0", "size": 37704 }
[ "com.github.ambry.rest.MockRestResponseChannel", "com.github.ambry.rest.RestUtils", "junit.framework.Assert" ]
import com.github.ambry.rest.MockRestResponseChannel; import com.github.ambry.rest.RestUtils; import junit.framework.Assert;
import com.github.ambry.rest.*; import junit.framework.*;
[ "com.github.ambry", "junit.framework" ]
com.github.ambry; junit.framework;
1,185,419
public void setMembersToMove(final IMember[] members) { Assert.isNotNull(members); fMembersToMove= (IMember[]) SourceReferenceUtil.sortByOffset(members); }
void function(final IMember[] members) { Assert.isNotNull(members); fMembersToMove= (IMember[]) SourceReferenceUtil.sortByOffset(members); }
/** * Sets the members to move. * * @param members * the members to move */
Sets the members to move
setMembersToMove
{ "repo_name": "kumattau/JDTPatch", "path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/corext/refactoring/structure/PullUpRefactoringProcessor.java", "license": "epl-1.0", "size": 100820 }
[ "org.eclipse.core.runtime.Assert", "org.eclipse.jdt.core.IMember", "org.eclipse.jdt.internal.corext.refactoring.reorg.SourceReferenceUtil" ]
import org.eclipse.core.runtime.Assert; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.internal.corext.refactoring.reorg.SourceReferenceUtil;
import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; import org.eclipse.jdt.internal.corext.refactoring.reorg.*;
[ "org.eclipse.core", "org.eclipse.jdt" ]
org.eclipse.core; org.eclipse.jdt;
546,827
@ApiOperation(value = "Delete owner verifier", notes = "Deletes an owner verifier by the owner verifier ID. Only users with the " + "TENANT_DEVELOPER or TENANT_USER role are allowed to perform this " + "operation.") @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid userVerifierId supplied"), @ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"), @ApiResponse(code = 403, message = "The authenticated user does not have the required role" + " (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " + "of the application does not match the Tenant ID of the authenticated user"), @ApiResponse(code = 404, message = "An owner verifier with the specified userVerifierId does not exist"), @ApiResponse(code = 500, message = "An unexpected error occurred on the server side")}) @RequestMapping(value = "delUserVerifier", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void deleteUserVerifier( @ApiParam(name = "userVerifierId", value = "A unique owner verifier identifier", required = true) @RequestParam(value = "userVerifierId") String userVerifierId) throws KaaAdminServiceException { verifierService.deleteUserVerifier(userVerifierId); }
@ApiOperation(value = STR, notes = STR + STR + STR) @ApiResponses(value = { @ApiResponse(code = 400, message = STR), @ApiResponse(code = 401, message = STR), @ApiResponse(code = 403, message = STR + STR + STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 500, message = STR)}) @RequestMapping(value = STR, method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) void function( @ApiParam(name = STR, value = STR, required = true) @RequestParam(value = STR) String userVerifierId) throws KaaAdminServiceException { verifierService.deleteUserVerifier(userVerifierId); }
/** * Delete user verifier by its id. * * @param userVerifierId the user verifier id * @throws KaaAdminServiceException the kaa admin service exception */
Delete user verifier by its id
deleteUserVerifier
{ "repo_name": "vtkhir/kaa", "path": "server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/VerifierController.java", "license": "apache-2.0", "size": 8116 }
[ "io.swagger.annotations.ApiOperation", "io.swagger.annotations.ApiParam", "io.swagger.annotations.ApiResponse", "io.swagger.annotations.ApiResponses", "org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException", "org.springframework.http.HttpStatus", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam", "org.springframework.web.bind.annotation.ResponseStatus" ]
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus;
import io.swagger.annotations.*; import org.kaaproject.kaa.server.admin.shared.services.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "io.swagger.annotations", "org.kaaproject.kaa", "org.springframework.http", "org.springframework.web" ]
io.swagger.annotations; org.kaaproject.kaa; org.springframework.http; org.springframework.web;
2,742,096
protected boolean resumeReliability(InternalDistributedMember id, Set newlyAcquiredRoles) { boolean async = false; try { ResumptionAction ra = getMembershipAttributes().getResumptionAction(); if (ra.isNone()) { if (logger.isDebugEnabled()) { logger.debug("Reliability resumption for action of none"); } resumeExpiration(); } else if (ra.isReinitialize()) { async = true; asyncResumeReliability(id, newlyAcquiredRoles); } } catch (Exception e) { logger.fatal(LocalizedMessage.create(LocalizedStrings.DistributedRegion_UNEXPECTED_EXCEPTION), e); } return async; }
boolean function(InternalDistributedMember id, Set newlyAcquiredRoles) { boolean async = false; try { ResumptionAction ra = getMembershipAttributes().getResumptionAction(); if (ra.isNone()) { if (logger.isDebugEnabled()) { logger.debug(STR); } resumeExpiration(); } else if (ra.isReinitialize()) { async = true; asyncResumeReliability(id, newlyAcquiredRoles); } } catch (Exception e) { logger.fatal(LocalizedMessage.create(LocalizedStrings.DistributedRegion_UNEXPECTED_EXCEPTION), e); } return async; }
/** * Performs the resumption action when reliability is resumed. * * @return true if asynchronous resumption is triggered */
Performs the resumption action when reliability is resumed
resumeReliability
{ "repo_name": "robertgeiger/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedRegion.java", "license": "apache-2.0", "size": 162027 }
[ "com.gemstone.gemfire.cache.ResumptionAction", "com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember", "com.gemstone.gemfire.internal.i18n.LocalizedStrings", "com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage", "java.util.Set" ]
import com.gemstone.gemfire.cache.ResumptionAction; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage; import java.util.Set;
import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.distributed.internal.membership.*; import com.gemstone.gemfire.internal.i18n.*; import com.gemstone.gemfire.internal.logging.log4j.*; import java.util.*;
[ "com.gemstone.gemfire", "java.util" ]
com.gemstone.gemfire; java.util;
1,289,462
public boolean handleEvent(Event e) { if (e.target == inputField && e.id == Event.ACTION_EVENT) { clientConnection.send(MessageFactory.newTextMessage((String) e.arg)); inputField.setText(""); return true; } else if ((e.target == this) && (e.id == Event.WINDOW_DESTROY)) { if (clientConnection != null) clientConnection.close(); setVisible(false); System.exit(0); return true; } return super.handleEvent(e); }
boolean function(Event e) { if (e.target == inputField && e.id == Event.ACTION_EVENT) { clientConnection.send(MessageFactory.newTextMessage((String) e.arg)); inputField.setText(""); return true; } else if ((e.target == this) && (e.id == Event.WINDOW_DESTROY)) { if (clientConnection != null) clientConnection.close(); setVisible(false); System.exit(0); return true; } return super.handleEvent(e); }
/** * handles AWT events (enter in textfield and closing window) */
handles AWT events (enter in textfield and closing window)
handleEvent
{ "repo_name": "SergiyKolesnikov/fuji", "path": "examples/Chat_casestudies/chat-steffen-harbich/src/GUI/Gui.java", "license": "lgpl-3.0", "size": 2039 }
[ "java.awt.Event" ]
import java.awt.Event;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,585,641
private File initDirectory(String cfg, String defDir, String consId, String msg) throws IgniteCheckedException { File dir; if (cfg != null) { File workDir0 = new File(cfg); dir = workDir0.isAbsolute() ? new File(workDir0, consId) : new File(U.resolveWorkDirectory(igCfg.getWorkDirectory(), cfg, false), consId); } else dir = new File(U.resolveWorkDirectory(igCfg.getWorkDirectory(), defDir, false), consId); U.ensureDirectory(dir, msg, log); return dir; }
File function(String cfg, String defDir, String consId, String msg) throws IgniteCheckedException { File dir; if (cfg != null) { File workDir0 = new File(cfg); dir = workDir0.isAbsolute() ? new File(workDir0, consId) : new File(U.resolveWorkDirectory(igCfg.getWorkDirectory(), cfg, false), consId); } else dir = new File(U.resolveWorkDirectory(igCfg.getWorkDirectory(), defDir, false), consId); U.ensureDirectory(dir, msg, log); return dir; }
/** * Creates a directory specified by the given arguments. * * @param cfg Configured directory path, may be {@code null}. * @param defDir Default directory path, will be used if cfg is {@code null}. * @param consId Local node consistent ID. * @param msg File description to print out on successful initialization. * @return Initialized directory. * @throws IgniteCheckedException If failed to initialize directory. */
Creates a directory specified by the given arguments
initDirectory
{ "repo_name": "daradurvs/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java", "license": "apache-2.0", "size": 115983 }
[ "java.io.File", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.util.typedef.internal.U" ]
import java.io.File; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.util.typedef.internal.U;
import java.io.*; import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*;
[ "java.io", "org.apache.ignite" ]
java.io; org.apache.ignite;
647,447
public void setIndexedReadMethod(Method m) throws IntrospectionException { getIndex = m; }
void function(Method m) throws IntrospectionException { getIndex = m; }
/** * Sets the method that is used to read an indexed property. * * @param m the method to set */
Sets the method that is used to read an indexed property
setIndexedReadMethod
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/java/beans/IndexedPropertyDescriptor.java", "license": "gpl-2.0", "size": 16114 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
43,579
public List<T> getData() { return mData; }
List<T> function() { return mData; }
/** * Get the data of list * * @return */
Get the data of list
getData
{ "repo_name": "AFinalStone/adstar", "path": "uikit/src/com/netease/nim/uikit/common/ui/recyclerview/adapter/BaseFetchLoadAdapter.java", "license": "apache-2.0", "size": 31301 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,464,394
public List<Object> getResult() { return result; }
List<Object> function() { return result; }
/** * Returns result. * @return result */
Returns result
getResult
{ "repo_name": "donNewtonAlpha/onos", "path": "protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcResponse.java", "license": "apache-2.0", "size": 3415 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,153,683
@Test public void testArrayAccessors() throws Exception { Expression e = auraExpressionBuilder.buildExpression("im[0]", null); assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType()); PropertyReference pr = (PropertyReference) e; assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot()); pr = pr.getStem(); assertEquals("Unable to access array member via PropertyReference", "0", pr.getRoot()); assertNull("Stemming end of PropertyReference should return null", pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); e = auraExpressionBuilder.buildExpression("im.an[3151345]", null); assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType()); pr = (PropertyReference) e; assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot()); pr = pr.getStem(); assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot()); pr = pr.getStem(); assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot()); assertNull("Stemming end of PropertyReference should return null", pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); e = auraExpressionBuilder.buildExpression("im.an[3151345].array", null); assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType()); pr = (PropertyReference) e; assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot()); pr = pr.getStem(); assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot()); pr = pr.getStem(); assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot()); pr = pr.getStem(); assertEquals("Unexpected root of PropertyReference after stemming and accessing array", "array", pr.getRoot()); assertNull("Stemming end of PropertyReference should return null", pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); e = auraExpressionBuilder.buildExpression("multi[1][364]", null); assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType()); pr = (PropertyReference) e; assertEquals("Unexpected root of PropertyReference", "multi", pr.getRoot()); pr = pr.getStem(); assertEquals("Unable to access array member via PropertyReference", "1", pr.getRoot()); pr = pr.getStem(); assertEquals("Unable to access second array member via PropertyReference", "364", pr.getRoot()); assertNull("Stemming end of PropertyReference should return null", pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); }
void function() throws Exception { Expression e = auraExpressionBuilder.buildExpression("im[0]", null); assertEquals(STR, ExpressionType.PROPERTY, e.getExpressionType()); PropertyReference pr = (PropertyReference) e; assertEquals(STR, "im", pr.getRoot()); pr = pr.getStem(); assertEquals(STR, "0", pr.getRoot()); assertNull(STR, pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); e = auraExpressionBuilder.buildExpression(STR, null); assertEquals(STR, ExpressionType.PROPERTY, e.getExpressionType()); pr = (PropertyReference) e; assertEquals(STR, "im", pr.getRoot()); pr = pr.getStem(); assertEquals(STR, "an", pr.getRoot()); pr = pr.getStem(); assertEquals(STR, STR, pr.getRoot()); assertNull(STR, pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); e = auraExpressionBuilder.buildExpression(STR, null); assertEquals(STR, ExpressionType.PROPERTY, e.getExpressionType()); pr = (PropertyReference) e; assertEquals(STR, "im", pr.getRoot()); pr = pr.getStem(); assertEquals(STR, "an", pr.getRoot()); pr = pr.getStem(); assertEquals(STR, STR, pr.getRoot()); pr = pr.getStem(); assertEquals(STR, "array", pr.getRoot()); assertNull(STR, pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); e = auraExpressionBuilder.buildExpression(STR, null); assertEquals(STR, ExpressionType.PROPERTY, e.getExpressionType()); pr = (PropertyReference) e; assertEquals(STR, "multi", pr.getRoot()); pr = pr.getStem(); assertEquals(STR, "1", pr.getRoot()); pr = pr.getStem(); assertEquals(STR, "364", pr.getRoot()); assertNull(STR, pr.getStem()); Mockito.verifyZeroInteractions(contextService, definitionService); }
/** * Property references can access array members */
Property references can access array members
testArrayAccessors
{ "repo_name": "forcedotcom/aura", "path": "aura-impl-expression/src/test/java/org/auraframework/impl/expression/parser/ExpressionParserTest.java", "license": "apache-2.0", "size": 33476 }
[ "org.auraframework.expression.Expression", "org.auraframework.expression.ExpressionType", "org.auraframework.expression.PropertyReference", "org.mockito.Mockito" ]
import org.auraframework.expression.Expression; import org.auraframework.expression.ExpressionType; import org.auraframework.expression.PropertyReference; import org.mockito.Mockito;
import org.auraframework.expression.*; import org.mockito.*;
[ "org.auraframework.expression", "org.mockito" ]
org.auraframework.expression; org.mockito;
1,063,896
void onFoldRegionStateChange(@NotNull FoldRegion region);
void onFoldRegionStateChange(@NotNull FoldRegion region);
/** * Informs that {@code 'collapsed'} state of given fold region is just changed. * <p/> * <b>Note:</b> listener should delay fold region state processing until {@link #onFoldProcessingEnd()} is called. * I.e. folding model may return inconsistent data between current moment and {@link #onFoldProcessingEnd()}. * * @param region fold region that is just collapsed or expanded */
Informs that 'collapsed' state of given fold region is just changed. Note: listener should delay fold region state processing until <code>#onFoldProcessingEnd()</code> is called. I.e. folding model may return inconsistent data between current moment and <code>#onFoldProcessingEnd()</code>
onFoldRegionStateChange
{ "repo_name": "asedunov/intellij-community", "path": "platform/platform-impl/src/com/intellij/openapi/editor/ex/FoldingListener.java", "license": "apache-2.0", "size": 1466 }
[ "com.intellij.openapi.editor.FoldRegion", "org.jetbrains.annotations.NotNull" ]
import com.intellij.openapi.editor.FoldRegion; import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.editor.*; import org.jetbrains.annotations.*;
[ "com.intellij.openapi", "org.jetbrains.annotations" ]
com.intellij.openapi; org.jetbrains.annotations;
2,672,355
public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); }
void function(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); }
/** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This implements <code>org.eclipse.jface.viewers.ISelectionProvider</code>.
addSelectionChangedListener
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.editor/src/net/opengis/citygml/appearance/presentation/AppearanceEditor.java", "license": "apache-2.0", "size": 56486 }
[ "org.eclipse.jface.viewers.ISelectionChangedListener" ]
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
1,694,493
private void initGui() { setHeading("Script: " + scriptname); setAnimCollapse(true); setModal(true); setBlinkModal(true); setLayout(new FitLayout()); setSize(658, 369); setResizable(false); setClosable(false); editor = new ScriptArea("lua"); Button btnSave = new Button("Save"); btnSave.addSelectionListener(new SelectionListener<ButtonEvent>() {
void function() { setHeading(STR + scriptname); setAnimCollapse(true); setModal(true); setBlinkModal(true); setLayout(new FitLayout()); setSize(658, 369); setResizable(false); setClosable(false); editor = new ScriptArea("lua"); Button btnSave = new Button("Save"); btnSave.addSelectionListener(new SelectionListener<ButtonEvent>() {
/** * Inits the gui. */
Inits the gui
initGui
{ "repo_name": "alexript/balas", "path": "src/net/autosauler/ballance/client/gui/ScriptEditor.java", "license": "apache-2.0", "size": 3887 }
[ "com.extjs.gxt.ui.client.event.ButtonEvent", "com.extjs.gxt.ui.client.event.SelectionListener", "com.extjs.gxt.ui.client.widget.button.Button", "com.extjs.gxt.ui.client.widget.layout.FitLayout" ]
import com.extjs.gxt.ui.client.event.ButtonEvent; import com.extjs.gxt.ui.client.event.SelectionListener; import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.event.*; import com.extjs.gxt.ui.client.widget.button.*; import com.extjs.gxt.ui.client.widget.layout.*;
[ "com.extjs.gxt" ]
com.extjs.gxt;
901,243
public void setStepTransitionPersistence( StepTransitionPersistence stepTransitionPersistence) { this.stepTransitionPersistence = stepTransitionPersistence; }
void function( StepTransitionPersistence stepTransitionPersistence) { this.stepTransitionPersistence = stepTransitionPersistence; }
/** * Sets the step transition persistence. * * @param stepTransitionPersistence the step transition persistence */
Sets the step transition persistence
setStepTransitionPersistence
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-core-processmgt-portlet/docroot/WEB-INF/src/org/oep/core/processmgt/service/base/TransitionHistoryServiceBaseImpl.java", "license": "apache-2.0", "size": 35828 }
[ "org.oep.core.processmgt.service.persistence.StepTransitionPersistence" ]
import org.oep.core.processmgt.service.persistence.StepTransitionPersistence;
import org.oep.core.processmgt.service.persistence.*;
[ "org.oep.core" ]
org.oep.core;
2,444,339
public void bind(final String name, final Object object) throws NamingException { if (logger.isInfoEnabled()) { logger.info("Binding JNDI object with name [" + name + "]"); }
void function(final String name, final Object object) throws NamingException { if (logger.isInfoEnabled()) { logger.info(STR + name + "]"); }
/** * Bind the given object to the current JNDI context, using the given name. * @param name the JNDI name of the object * @param object the object to bind * @throws NamingException thrown by JNDI, mostly name already bound */
Bind the given object to the current JNDI context, using the given name
bind
{ "repo_name": "dachengxi/spring1.1.1_source", "path": "src/org/springframework/jndi/JndiTemplate.java", "license": "mit", "size": 5534 }
[ "javax.naming.NamingException" ]
import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
2,486,919
public Map<String, String> validate(Map<String, String[]> data, String requestToken) throws SignatureValidationError { return validate(data, requestToken, DEFAULT_TTL); }
Map<String, String> function(Map<String, String[]> data, String requestToken) throws SignatureValidationError { return validate(data, requestToken, DEFAULT_TTL); }
/** * Verify the authenticity of data returned from the Toopher Iframe by validating the cryptographic signature * * @param data * The data returned from the Iframe * @param requestToken * The requestToken used to create the Auth or Pairing Iframe URL * @return * A map of the validated data if the signature is valid, or null if the signature is invalid */
Verify the authenticity of data returned from the Toopher Iframe by validating the cryptographic signature
validate
{ "repo_name": "toopher/toopher-pingfederate", "path": "plugin-src/idp-toopher/java/com/toopher/api/ToopherIframe.java", "license": "mit", "size": 15204 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,191,186
public boolean reconnectStreams() { if (_teeName != null) try { _inputStream = new CyclicBufferFileInputStream(new File(_tmpPath, "out_" + _teeName)); _errorStream = new CyclicBufferFileInputStream(new File(_tmpPath, "err_" + _teeName)); _outputStream = new CyclicBufferFilePrintStream(new File(_tmpPath, "in_" + _teeName)); return true; } catch (Exception ex) { ex.printStackTrace(); } return false; }
boolean function() { if (_teeName != null) try { _inputStream = new CyclicBufferFileInputStream(new File(_tmpPath, "out_" + _teeName)); _errorStream = new CyclicBufferFileInputStream(new File(_tmpPath, "err_" + _teeName)); _outputStream = new CyclicBufferFilePrintStream(new File(_tmpPath, "in_" + _teeName)); return true; } catch (Exception ex) { ex.printStackTrace(); } return false; }
/** * Reconnect streams. * * @return true, if successful */
Reconnect streams
reconnectStreams
{ "repo_name": "ColFusion/PentahoKettle", "path": "CarteService/default/src/main/java/org/rzo/yajsw/os/ms/win/w32/WindowsXPProcess.java", "license": "mit", "size": 113666 }
[ "java.io.File", "org.rzo.yajsw.io.CyclicBufferFileInputStream", "org.rzo.yajsw.io.CyclicBufferFilePrintStream" ]
import java.io.File; import org.rzo.yajsw.io.CyclicBufferFileInputStream; import org.rzo.yajsw.io.CyclicBufferFilePrintStream;
import java.io.*; import org.rzo.yajsw.io.*;
[ "java.io", "org.rzo.yajsw" ]
java.io; org.rzo.yajsw;
2,356,253
public void start() { if (hasVibratePermission(mContext)) { mVibrator = (Vibrator) mContext.getSystemService(Service.VIBRATOR_SERVICE); } // Setup a listener for changes in haptic feedback settings mIsGloballyEnabled = checkGlobalSetting(mContext); Uri uri = Settings.System.getUriFor(Settings.System.HAPTIC_FEEDBACK_ENABLED); mContext.getContentResolver().registerContentObserver(uri, false, mContentObserver); }
void function() { if (hasVibratePermission(mContext)) { mVibrator = (Vibrator) mContext.getSystemService(Service.VIBRATOR_SERVICE); } mIsGloballyEnabled = checkGlobalSetting(mContext); Uri uri = Settings.System.getUriFor(Settings.System.HAPTIC_FEEDBACK_ENABLED); mContext.getContentResolver().registerContentObserver(uri, false, mContentObserver); }
/** * Call to setup the controller. */
Call to setup the controller
start
{ "repo_name": "alhazmy13/HijriDatePicker", "path": "library/src/main/java/net/alhazmy13/hijridatepicker/HapticFeedbackController.java", "license": "apache-2.0", "size": 3038 }
[ "android.app.Service", "android.net.Uri", "android.os.Vibrator", "android.provider.Settings" ]
import android.app.Service; import android.net.Uri; import android.os.Vibrator; import android.provider.Settings;
import android.app.*; import android.net.*; import android.os.*; import android.provider.*;
[ "android.app", "android.net", "android.os", "android.provider" ]
android.app; android.net; android.os; android.provider;
435,190
private IRepositoryInfoPrx getRepositoryService(SecurityContext ctx) throws DSAccessException, DSOutOfServiceException { Connector c = null; try { c = getConnector(ctx, true, false); return c.getRepositoryService(); } catch (Throwable e) { handleException(e, "Cannot access the RepositoryInfo service."); } return null; }
IRepositoryInfoPrx function(SecurityContext ctx) throws DSAccessException, DSOutOfServiceException { Connector c = null; try { c = getConnector(ctx, true, false); return c.getRepositoryService(); } catch (Throwable e) { handleException(e, STR); } return null; }
/** * Returns the {@link IRepositoryInfoPrx} service. * * @param ctx The security context. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. */
Returns the <code>IRepositoryInfoPrx</code> service
getRepositoryService
{ "repo_name": "jballanc/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java", "license": "gpl-2.0", "size": 286379 }
[ "org.openmicroscopy.shoola.env.data.util.SecurityContext" ]
import org.openmicroscopy.shoola.env.data.util.SecurityContext;
import org.openmicroscopy.shoola.env.data.util.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
2,598,111
void propertyBecameSaturated(IndexedPropertyChain chain);
void propertyBecameSaturated(IndexedPropertyChain chain);
/** * Called immediately after {@link SaturatedPropertyChain#isClear() * chain.getSaturated().isClear()} changes from <code>true</code> to * <code>false</code>. * * @param chain */
Called immediately after <code>SaturatedPropertyChain#isClear() chain.getSaturated().isClear()</code> changes from <code>true</code> to <code>false</code>
propertyBecameSaturated
{ "repo_name": "aifargonos/elk-reasoner", "path": "elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/stages/PropertyHierarchyCompositionState.java", "license": "apache-2.0", "size": 4376 }
[ "org.semanticweb.elk.reasoner.indexing.model.IndexedPropertyChain" ]
import org.semanticweb.elk.reasoner.indexing.model.IndexedPropertyChain;
import org.semanticweb.elk.reasoner.indexing.model.*;
[ "org.semanticweb.elk" ]
org.semanticweb.elk;
1,273,845
boolean containsAll(Collection<?> collection);
boolean containsAll(Collection<?> collection);
/** * Tests the collection to determine if all of the elements in * <tt>collection</tt> are present. * * @param collection a <code>Collection</code> value * @return true if all elements were present in the collection. */
Tests the collection to determine if all of the elements in collection are present
containsAll
{ "repo_name": "mauro-idsia/blip", "path": "core/src/main/java/ch/idsia/blip/core/utils/data/common/TIntCollection.java", "license": "lgpl-3.0", "size": 9040 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,330,344
@Deprecated @InterfaceAudience.Private public static String prettyPrint(final String encodedRegionName) { return RegionInfo.prettyPrint(encodedRegionName); } private byte [] endKey = HConstants.EMPTY_BYTE_ARRAY; // This flag is in the parent of a split while the parent is still referenced by daughter regions. // We USED to set this flag when we disabled a table but now table state is kept up in zookeeper // as of 0.90.0 HBase. And now in DisableTableProcedure, finally we will create bunch of // UnassignProcedures and at the last of the procedure we will set the region state to CLOSED, and // will not change the offLine flag. private boolean offLine = false; private long regionId = -1; private transient byte [] regionName = HConstants.EMPTY_BYTE_ARRAY; private boolean split = false; private byte [] startKey = HConstants.EMPTY_BYTE_ARRAY; private int hashCode = -1; //TODO: Move NO_HASH to HStoreFile which is really the only place it is used. public static final String NO_HASH = null; private String encodedName = null; private byte [] encodedNameAsBytes = null; private int replicaId = DEFAULT_REPLICA_ID; // Current TableName private TableName tableName = null; // Duplicated over in RegionInfoDisplay final static String DISPLAY_KEYS_KEY = RegionInfoDisplay.DISPLAY_KEYS_KEY; public final static byte[] HIDDEN_END_KEY = RegionInfoDisplay.HIDDEN_END_KEY; public final static byte[] HIDDEN_START_KEY = RegionInfoDisplay.HIDDEN_START_KEY; // TODO: How come Meta regions still do not have encoded region names? Fix. public static final HRegionInfo FIRST_META_REGIONINFO = new HRegionInfo(1L, TableName.META_TABLE_NAME);
@InterfaceAudience.Private static String function(final String encodedRegionName) { return RegionInfo.prettyPrint(encodedRegionName); } private byte [] endKey = HConstants.EMPTY_BYTE_ARRAY; private boolean offLine = false; private long regionId = -1; private transient byte [] regionName = HConstants.EMPTY_BYTE_ARRAY; private boolean split = false; private byte [] startKey = HConstants.EMPTY_BYTE_ARRAY; private int hashCode = -1; public static final String NO_HASH = null; private String encodedName = null; private byte [] encodedNameAsBytes = null; private int replicaId = DEFAULT_REPLICA_ID; private TableName tableName = null; final static String DISPLAY_KEYS_KEY = RegionInfoDisplay.DISPLAY_KEYS_KEY; public final static byte[] HIDDEN_END_KEY = RegionInfoDisplay.HIDDEN_END_KEY; public final static byte[] HIDDEN_START_KEY = RegionInfoDisplay.HIDDEN_START_KEY; public static final HRegionInfo FIRST_META_REGIONINFO = new HRegionInfo(1L, TableName.META_TABLE_NAME);
/** * Use logging. * @param encodedRegionName The encoded regionname. * @return <code>hbase:meta</code> if passed <code>1028785192</code> else returns * <code>encodedRegionName</code> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * Use {@link RegionInfo#prettyPrint(String)}. */
Use logging
prettyPrint
{ "repo_name": "HubSpot/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java", "license": "apache-2.0", "size": 37347 }
[ "org.apache.hadoop.hbase.client.RegionInfo", "org.apache.hadoop.hbase.client.RegionInfoDisplay", "org.apache.yetus.audience.InterfaceAudience" ]
import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionInfoDisplay; import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.*; import org.apache.yetus.audience.*;
[ "org.apache.hadoop", "org.apache.yetus" ]
org.apache.hadoop; org.apache.yetus;
1,465,583
public static FtpMessage connect(String sessionId) { ConnectCommand cmd = new ConnectCommand(); cmd.setSignal("OPEN"); cmd.setSessionId(sessionId); return new FtpMessage(cmd); }
static FtpMessage function(String sessionId) { ConnectCommand cmd = new ConnectCommand(); cmd.setSignal("OPEN"); cmd.setSessionId(sessionId); return new FtpMessage(cmd); }
/** * Creates new connect command message. * @param sessionId * @return */
Creates new connect command message
connect
{ "repo_name": "christophd/citrus", "path": "endpoints/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java", "license": "apache-2.0", "size": 14723 }
[ "com.consol.citrus.ftp.model.ConnectCommand" ]
import com.consol.citrus.ftp.model.ConnectCommand;
import com.consol.citrus.ftp.model.*;
[ "com.consol.citrus" ]
com.consol.citrus;
1,051,947
@Test public void testImmediateDiskIdCreationInOverflowWithPersistMode() { diskProps.setPersistBackup(true); diskProps.setRolling(false); diskProps.setMaxOplogSize(1024 * 1024); diskProps.setSynchronous(false); diskProps.setOverflow(true); diskProps.setBytesThreshold(10000); diskProps.setTimeInterval(0); diskProps.setOverFlowCapacity(1); region = DiskRegionHelperFactory.getAsyncOverFlowAndPersistRegion(cache, diskProps); final byte[] val = new byte[1000]; region.put("1", val); DiskEntry entry = (DiskEntry)((LocalRegion)region).basicGetEntry("1"); assertTrue(entry instanceof AbstractDiskLRURegionEntry); assertNotNull(entry.getDiskId()); region.put("2", val); assertNotNull(entry.getDiskId()); entry = (DiskEntry)((LocalRegion)region).basicGetEntry("2"); assertTrue(entry instanceof AbstractDiskLRURegionEntry); assertNotNull(entry.getDiskId()); }
void function() { diskProps.setPersistBackup(true); diskProps.setRolling(false); diskProps.setMaxOplogSize(1024 * 1024); diskProps.setSynchronous(false); diskProps.setOverflow(true); diskProps.setBytesThreshold(10000); diskProps.setTimeInterval(0); diskProps.setOverFlowCapacity(1); region = DiskRegionHelperFactory.getAsyncOverFlowAndPersistRegion(cache, diskProps); final byte[] val = new byte[1000]; region.put("1", val); DiskEntry entry = (DiskEntry)((LocalRegion)region).basicGetEntry("1"); assertTrue(entry instanceof AbstractDiskLRURegionEntry); assertNotNull(entry.getDiskId()); region.put("2", val); assertNotNull(entry.getDiskId()); entry = (DiskEntry)((LocalRegion)region).basicGetEntry("2"); assertTrue(entry instanceof AbstractDiskLRURegionEntry); assertNotNull(entry.getDiskId()); }
/** * Tests immediate creation of DiskID in overflow With Persistence mode * * @author Asif */
Tests immediate creation of DiskID in overflow With Persistence mode
testImmediateDiskIdCreationInOverflowWithPersistMode
{ "repo_name": "ysung-pivotal/incubator-geode", "path": "gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java", "license": "apache-2.0", "size": 145020 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
11,252
private static void createSuperForwarder(ClassNode targetNode, MethodNode forwarder, final Map<String,ClassNode> genericsSpec) { List<ClassNode> interfaces = new ArrayList<ClassNode>(Traits.collectAllInterfacesReverseOrder(targetNode, new LinkedHashSet<ClassNode>())); String name = forwarder.getName(); Parameter[] forwarderParameters = forwarder.getParameters(); LinkedHashSet<ClassNode> traits = new LinkedHashSet<ClassNode>(); List<MethodNode> superForwarders = new LinkedList<MethodNode>(); for (ClassNode node : interfaces) { if (Traits.isTrait(node)) { MethodNode method = node.getDeclaredMethod(name, forwarderParameters); if (method!=null) { // a similar method exists, we need a super bridge // trait$super$foo(Class currentTrait, ...) traits.add(node); superForwarders.add(method); } } } for (MethodNode superForwarder : superForwarders) { doCreateSuperForwarder(targetNode, superForwarder, traits.toArray(new ClassNode[traits.size()]), genericsSpec); } } /** * Creates a method to dispatch to "super traits" in a "stackable" fashion. The generated method looks like this: * <p> * <code>ReturnType trait$super$method(Class clazz, Arg1 arg1, Arg2 arg2, ...) { * if (SomeTrait.is(A) { return SomeOtherTrait$Trait$Helper.method(this, arg1, arg2) }
static void function(ClassNode targetNode, MethodNode forwarder, final Map<String,ClassNode> genericsSpec) { List<ClassNode> interfaces = new ArrayList<ClassNode>(Traits.collectAllInterfacesReverseOrder(targetNode, new LinkedHashSet<ClassNode>())); String name = forwarder.getName(); Parameter[] forwarderParameters = forwarder.getParameters(); LinkedHashSet<ClassNode> traits = new LinkedHashSet<ClassNode>(); List<MethodNode> superForwarders = new LinkedList<MethodNode>(); for (ClassNode node : interfaces) { if (Traits.isTrait(node)) { MethodNode method = node.getDeclaredMethod(name, forwarderParameters); if (method!=null) { traits.add(node); superForwarders.add(method); } } } for (MethodNode superForwarder : superForwarders) { doCreateSuperForwarder(targetNode, superForwarder, traits.toArray(new ClassNode[traits.size()]), genericsSpec); } } /** * Creates a method to dispatch to STR in a STR fashion. The generated method looks like this: * <p> * <code>ReturnType trait$super$method(Class clazz, Arg1 arg1, Arg2 arg2, ...) { * if (SomeTrait.is(A) { return SomeOtherTrait$Trait$Helper.method(this, arg1, arg2) }
/** * Creates, if necessary, a super forwarder method, for stackable traits. * @param forwarder a forwarder method * @param genericsSpec */
Creates, if necessary, a super forwarder method, for stackable traits
createSuperForwarder
{ "repo_name": "dpolivaev/groovy", "path": "src/main/org/codehaus/groovy/transform/trait/TraitComposer.java", "license": "apache-2.0", "size": 30487 }
[ "java.util.ArrayList", "java.util.LinkedHashSet", "java.util.LinkedList", "java.util.List", "java.util.Map", "org.codehaus.groovy.ast.ClassNode", "org.codehaus.groovy.ast.MethodNode", "org.codehaus.groovy.ast.Parameter" ]
import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.Parameter;
import java.util.*; import org.codehaus.groovy.ast.*;
[ "java.util", "org.codehaus.groovy" ]
java.util; org.codehaus.groovy;
2,808,056
public Object[] getCustomOptions(String sessionKey, String ksLabel) throws FaultException { User user = getLoggedInUser(sessionKey); KickstartData ksdata = KickstartFactory.lookupKickstartDataByLabelAndOrgId( ksLabel, user.getOrg().getId()); if (ksdata == null) { throw new FaultException(-3, "kickstartProfileNotFound", "No Kickstart Profile found with label: " + ksLabel); } SortedSet options = ksdata.getCustomOptions(); return options.toArray(); }
Object[] function(String sessionKey, String ksLabel) throws FaultException { User user = getLoggedInUser(sessionKey); KickstartData ksdata = KickstartFactory.lookupKickstartDataByLabelAndOrgId( ksLabel, user.getOrg().getId()); if (ksdata == null) { throw new FaultException(-3, STR, STR + ksLabel); } SortedSet options = ksdata.getCustomOptions(); return options.toArray(); }
/** * Get custom options for a kickstart profile. * @param sessionKey the session key * @param ksLabel the kickstart label * @return a list of hashes holding this info. * @throws FaultException A FaultException is thrown if * the profile associated with ksLabel cannot be found * * @xmlrpc.doc Get custom options for a kickstart profile. * @xmlrpc.param #session_key() * @xmlrpc.param #param("string","ksLabel") * * @xmlrpc.returntype * #array() * $KickstartCommandSerializer * #array_end() */
Get custom options for a kickstart profile
getCustomOptions
{ "repo_name": "colloquium/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java", "license": "gpl-2.0", "size": 44597 }
[ "com.redhat.rhn.FaultException", "com.redhat.rhn.domain.kickstart.KickstartData", "com.redhat.rhn.domain.kickstart.KickstartFactory", "com.redhat.rhn.domain.user.User", "java.util.SortedSet" ]
import com.redhat.rhn.FaultException; import com.redhat.rhn.domain.kickstart.KickstartData; import com.redhat.rhn.domain.kickstart.KickstartFactory; import com.redhat.rhn.domain.user.User; import java.util.SortedSet;
import com.redhat.rhn.*; import com.redhat.rhn.domain.kickstart.*; import com.redhat.rhn.domain.user.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
388,188
private Uri getUriFromPath(String path) { String absPath = path.replaceFirst("file://", ""); File file = new File(absPath); if (!file.exists()) { Log.e("Asset", "File not found: " + file.getAbsolutePath()); return Uri.EMPTY; } return Uri.fromFile(file); }
Uri function(String path) { String absPath = path.replaceFirst(STRAssetSTRFile not found: " + file.getAbsolutePath()); return Uri.EMPTY; } return Uri.fromFile(file); }
/** * URI for a file. * * @param path * Absolute path like file:///... * * @return * URI pointing to the given path */
URI for a file
getUriFromPath
{ "repo_name": "nozelrosario/Dcare", "path": "plugins/de.appplant.cordova.plugin.local-notification/src/android/notification/AssetUtil.java", "license": "apache-2.0", "size": 12251 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
1,295,582
public void setExponentFormat(NumberFormat format) { ParamChecks.nullNotPermitted(format, "format"); this.formatter = format; }
void function(NumberFormat format) { ParamChecks.nullNotPermitted(format, STR); this.formatter = format; }
/** * Sets the number format used for the exponent. * * @param format the formatter (<code>null</code> not permitted). * * @since 1.0.13 */
Sets the number format used for the exponent
setExponentFormat
{ "repo_name": "Mr-Steve/LTSpice_Library_Manager", "path": "libs/jfreechart-1.0.16/source/org/jfree/chart/util/LogFormat.java", "license": "gpl-2.0", "size": 7974 }
[ "java.text.NumberFormat" ]
import java.text.NumberFormat;
import java.text.*;
[ "java.text" ]
java.text;
2,058,123
Color color = JColorChooser.showDialog(null, "Color Picker", Color.black); Utils.setColorInClipboard(color); }
Color color = JColorChooser.showDialog(null, STR, Color.black); Utils.setColorInClipboard(color); }
/** * Opens the system native color chooser */
Opens the system native color chooser
callColorPicker
{ "repo_name": "gscrot/gscrot", "path": "src/com/redpois0n/gscrot/Tools.java", "license": "mit", "size": 602 }
[ "com.redpois0n.gscrot.utils.Utils", "java.awt.Color", "javax.swing.JColorChooser" ]
import com.redpois0n.gscrot.utils.Utils; import java.awt.Color; import javax.swing.JColorChooser;
import com.redpois0n.gscrot.utils.*; import java.awt.*; import javax.swing.*;
[ "com.redpois0n.gscrot", "java.awt", "javax.swing" ]
com.redpois0n.gscrot; java.awt; javax.swing;
1,317,641
void coordinatorIsElected( InstanceId coordinatorId );
void coordinatorIsElected( InstanceId coordinatorId );
/** * Called when new coordinator has been elected. * * @param coordinatorId the Id of the coordinator */
Called when new coordinator has been elected
coordinatorIsElected
{ "repo_name": "HuangLS/neo4j", "path": "enterprise/cluster/src/main/java/org/neo4j/cluster/member/ClusterMemberListener.java", "license": "apache-2.0", "size": 3312 }
[ "org.neo4j.cluster.InstanceId" ]
import org.neo4j.cluster.InstanceId;
import org.neo4j.cluster.*;
[ "org.neo4j.cluster" ]
org.neo4j.cluster;
2,078,805
public int quantityDropped(Random p_149745_1_) { return this == Blocks.lapis_ore ? 4 + p_149745_1_.nextInt(5) : 1; }
int function(Random p_149745_1_) { return this == Blocks.lapis_ore ? 4 + p_149745_1_.nextInt(5) : 1; }
/** * Returns the quantity of items to drop on block destruction. */
Returns the quantity of items to drop on block destruction
quantityDropped
{ "repo_name": "TheHecticByte/BananaJ1.7.10Beta", "path": "src/net/minecraft/Server1_7_10/block/BlockOre.java", "license": "gpl-3.0", "size": 3511 }
[ "java.util.Random", "net.minecraft.Server1_7_10" ]
import java.util.Random; import net.minecraft.Server1_7_10;
import java.util.*; import net.minecraft.*;
[ "java.util", "net.minecraft" ]
java.util; net.minecraft;
1,313,404
public List<SiteNode> getTopNodesInScopeFromSiteTree() { List<SiteNode> nodes = new LinkedList<>(); SiteNode rootNode = getSiteTree().getRoot(); @SuppressWarnings("unchecked") Enumeration<TreeNode> en = rootNode.children(); while (en.hasMoreElements()) { SiteNode sn = (SiteNode) en.nextElement(); if (isContainsNodesInScope(sn)) { nodes.add(sn); } } return nodes; }
List<SiteNode> function() { List<SiteNode> nodes = new LinkedList<>(); SiteNode rootNode = getSiteTree().getRoot(); @SuppressWarnings(STR) Enumeration<TreeNode> en = rootNode.children(); while (en.hasMoreElements()) { SiteNode sn = (SiteNode) en.nextElement(); if (isContainsNodesInScope(sn)) { nodes.add(sn); } } return nodes; }
/** * Gets the top nodes from the site tree which contain nodes that are "In Scope". Searches * recursively starting from the root node. Should be used with care, as it is time-consuming, * querying the database for every node in the Site Tree. * * @return the nodes in scope from site tree */
Gets the top nodes from the site tree which contain nodes that are "In Scope". Searches recursively starting from the root node. Should be used with care, as it is time-consuming, querying the database for every node in the Site Tree
getTopNodesInScopeFromSiteTree
{ "repo_name": "psiinon/zaproxy", "path": "zap/src/main/java/org/parosproxy/paros/model/Session.java", "license": "apache-2.0", "size": 68333 }
[ "java.util.Enumeration", "java.util.LinkedList", "java.util.List", "javax.swing.tree.TreeNode" ]
import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import javax.swing.tree.TreeNode;
import java.util.*; import javax.swing.tree.*;
[ "java.util", "javax.swing" ]
java.util; javax.swing;
1,396,478
@Test public void whenHasNextThenReturnAllUniqueElement() { List<String> expectedResult = new ArrayList<>(); expectedResult.add("one"); expectedResult.add("two"); expectedResult.add("three"); expectedResult.add("1"); expectedResult.add("2"); List<String> result = new ArrayList<>(); Iterator<String> it = this.set.iterator(); while (it.hasNext()) { result.add(it.next()); } assertTrue(result.containsAll(expectedResult)); }
void function() { List<String> expectedResult = new ArrayList<>(); expectedResult.add("one"); expectedResult.add("two"); expectedResult.add("three"); expectedResult.add("1"); expectedResult.add("2"); List<String> result = new ArrayList<>(); Iterator<String> it = this.set.iterator(); while (it.hasNext()) { result.add(it.next()); } assertTrue(result.containsAll(expectedResult)); }
/** * Tests iterator in fight. */
Tests iterator in fight
whenHasNextThenReturnAllUniqueElement
{ "repo_name": "OleksandrProshak/Alexandr_Proshak", "path": "Level_Junior/Part_001_Collections_Pro/4_Set/src/test/java/ru/job4j/task1/SimpleSetArrayTest.java", "license": "apache-2.0", "size": 1688 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.junit.Assert" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,778,809
@Override public Predicate<String> punctuationTagRejectFilter() { return Filters.notFilter(punctTagStringAcceptFilter); }
Predicate<String> function() { return Filters.notFilter(punctTagStringAcceptFilter); }
/** * Return a filter that rejects a String that is a punctuation * tag name, and rejects everything else. * * @return The filter */
Return a filter that rejects a String that is a punctuation tag name, and rejects everything else
punctuationTagRejectFilter
{ "repo_name": "intfloat/CoreNLP", "path": "src/edu/stanford/nlp/trees/AbstractTreebankLanguagePack.java", "license": "gpl-2.0", "size": 19231 }
[ "edu.stanford.nlp.util.Filters", "java.util.function.Predicate" ]
import edu.stanford.nlp.util.Filters; import java.util.function.Predicate;
import edu.stanford.nlp.util.*; import java.util.function.*;
[ "edu.stanford.nlp", "java.util" ]
edu.stanford.nlp; java.util;
2,036,731
public static int findFarthest( Point2D_I32 a , List<Point2D_I32> contour ) { int best = -1; int index = -1; for( int i = 0; i < contour.size(); i++ ) { Point2D_I32 b = contour.get(i); int d = a.distance2(b); if( d > best ) { best = d; index = i; } } return index; }
static int function( Point2D_I32 a , List<Point2D_I32> contour ) { int best = -1; int index = -1; for( int i = 0; i < contour.size(); i++ ) { Point2D_I32 b = contour.get(i); int d = a.distance2(b); if( d > best ) { best = d; index = i; } } return index; }
/** * Returns the index of the point farthest away from the sample point */
Returns the index of the point farthest away from the sample point
findFarthest
{ "repo_name": "intrack/BoofCV-master", "path": "main/calibration/src/boofcv/alg/feature/detect/grid/UtilCalibrationGrid.java", "license": "apache-2.0", "size": 7118 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,088,583
public List<Dependency> scan(List<File> files) { final List<Dependency> deps = new ArrayList<Dependency>(); for (File file : files) { final List<Dependency> d = scan(file); if (d != null) { deps.addAll(d); } } return deps; }
List<Dependency> function(List<File> files) { final List<Dependency> deps = new ArrayList<Dependency>(); for (File file : files) { final List<Dependency> d = scan(file); if (d != null) { deps.addAll(d); } } return deps; }
/** * Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies * identified are added to the dependency collection. * * @param files a set of paths to files or directories to be analyzed * @return the list of dependencies scanned * @since v0.3.2.5 */
Scans a list of files or directories. If a directory is specified, it will be scanned recursively. Any dependencies identified are added to the dependency collection
scan
{ "repo_name": "wmaintw/DependencyCheck", "path": "dependency-check-core/src/main/java/org/owasp/dependencycheck/Engine.java", "license": "apache-2.0", "size": 18726 }
[ "java.io.File", "java.util.ArrayList", "java.util.List", "org.owasp.dependencycheck.dependency.Dependency" ]
import java.io.File; import java.util.ArrayList; import java.util.List; import org.owasp.dependencycheck.dependency.Dependency;
import java.io.*; import java.util.*; import org.owasp.dependencycheck.dependency.*;
[ "java.io", "java.util", "org.owasp.dependencycheck" ]
java.io; java.util; org.owasp.dependencycheck;
2,560,837
@SideOnly(Side.CLIENT) public int getSkyColorByTemp(float currentTemperature) { currentTemperature = currentTemperature / 3.0F; currentTemperature = MathHelper.clamp(currentTemperature, -1.0F, 1.0F); return MathHelper.hsvToRGB(0.62222224F - currentTemperature * 0.05F, 0.5F + currentTemperature * 0.1F, 1.0F); }
@SideOnly(Side.CLIENT) int function(float currentTemperature) { currentTemperature = currentTemperature / 3.0F; currentTemperature = MathHelper.clamp(currentTemperature, -1.0F, 1.0F); return MathHelper.hsvToRGB(0.62222224F - currentTemperature * 0.05F, 0.5F + currentTemperature * 0.1F, 1.0F); }
/** * takes temperature, returns color */
takes temperature, returns color
getSkyColorByTemp
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraft/world/biome/Biome.java", "license": "lgpl-2.1", "size": 39987 }
[ "net.minecraft.util.math.MathHelper", "net.minecraftforge.fml.relauncher.Side", "net.minecraftforge.fml.relauncher.SideOnly" ]
import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.util.math.*; import net.minecraftforge.fml.relauncher.*;
[ "net.minecraft.util", "net.minecraftforge.fml" ]
net.minecraft.util; net.minecraftforge.fml;
1,679,888
public static void close(Writer writer) { if (writer != null) { try { writer.close(); } catch (IOException ioe1) { } } }
static void function(Writer writer) { if (writer != null) { try { writer.close(); } catch (IOException ioe1) { } } }
/** * Closes the given writer. * * @param writer * The write to close * @see Writer#close() */
Closes the given writer
close
{ "repo_name": "freenet/Thingamablog-Freenet", "path": "src/net/sf/thingamablog/util/io/Closer.java", "license": "gpl-2.0", "size": 4166 }
[ "java.io.IOException", "java.io.Writer" ]
import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
430,459
public State update(StateGraph SG, HashMap<String, Integer> newVector, DualHashMap<String, Integer> VarIndexMap) { int[] newVariableVector = new int[this.vector.length]; boolean newState = false; for(int index = 0; index < vector.length; index++) { String var = VarIndexMap.getKey(index); int this_val = this.vector[index]; Integer newVal = newVector.get(var); if(newVal != null) { if(this_val != newVal) { newState = true; newVariableVector[index] = newVal; } else newVariableVector[index] = this.vector[index]; } else newVariableVector[index] = this.vector[index]; } if(newState == true) { boolean[] newTranVector = SG.updateTranVector(this, this.marking, newVariableVector, null); return new State(this.lpn, this.marking, newVariableVector, newTranVector); } return null; }
State function(StateGraph SG, HashMap<String, Integer> newVector, DualHashMap<String, Integer> VarIndexMap) { int[] newVariableVector = new int[this.vector.length]; boolean newState = false; for(int index = 0; index < vector.length; index++) { String var = VarIndexMap.getKey(index); int this_val = this.vector[index]; Integer newVal = newVector.get(var); if(newVal != null) { if(this_val != newVal) { newState = true; newVariableVector[index] = newVal; } else newVariableVector[index] = this.vector[index]; } else newVariableVector[index] = this.vector[index]; } if(newState == true) { boolean[] newTranVector = SG.updateTranVector(this, this.marking, newVariableVector, null); return new State(this.lpn, this.marking, newVariableVector, newTranVector); } return null; }
/** * Return a new state if the newVector leads to a new state from this state; otherwise return null. * @param newVector * @param VarIndexMap * @return */
Return a new state if the newVector leads to a new state from this state; otherwise return null
update
{ "repo_name": "MyersResearchGroup/iBioSim", "path": "verification/src/main/java/edu/utah/ece/async/lema/verification/platu/stategraph/State.java", "license": "apache-2.0", "size": 18498 }
[ "edu.utah.ece.async.lema.verification.platu.platuLpn.DualHashMap", "java.util.HashMap" ]
import edu.utah.ece.async.lema.verification.platu.platuLpn.DualHashMap; import java.util.HashMap;
import edu.utah.ece.async.lema.verification.platu.*; import java.util.*;
[ "edu.utah.ece", "java.util" ]
edu.utah.ece; java.util;
2,525,789
@Override public void trace(final Object message) { log(Level.FINER, message); }
void function(final Object message) { log(Level.FINER, message); }
/** * Logs a message object with the TRACE level. * * @param message the message object to log. */
Logs a message object with the TRACE level
trace
{ "repo_name": "apache/commons-jcs", "path": "commons-jcs-core/src/main/java/org/apache/commons/jcs3/log/JulLogAdapter.java", "license": "apache-2.0", "size": 16168 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
177,947
@Test public void testLookupReturnLimits_TestDataObject() throws Exception { Map formProps = new HashMap(); Collection testDataObjects = findCollectionBySearchHelper(TestDataObject.class, formProps, false); assertEquals(200, testDataObjects.size()); testDataObjects = findCollectionBySearch(TestDataObject.class, formProps); assertEquals(200, testDataObjects.size()); }
void function() throws Exception { Map formProps = new HashMap(); Collection testDataObjects = findCollectionBySearchHelper(TestDataObject.class, formProps, false); assertEquals(200, testDataObjects.size()); testDataObjects = findCollectionBySearch(TestDataObject.class, formProps); assertEquals(200, testDataObjects.size()); }
/** * tests lookup return limits * * @throws Exception */
tests lookup return limits
testLookupReturnLimits_TestDataObject
{ "repo_name": "geothomasp/kualico-rice-kc", "path": "rice-framework/krad-it/src/test/java/org/kuali/rice/krad/service/LookupServiceTest.java", "license": "apache-2.0", "size": 6192 }
[ "java.util.Collection", "java.util.HashMap", "java.util.Map", "org.junit.Assert", "org.kuali.rice.krad.data.jpa.testbo.TestDataObject" ]
import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.kuali.rice.krad.data.jpa.testbo.TestDataObject;
import java.util.*; import org.junit.*; import org.kuali.rice.krad.data.jpa.testbo.*;
[ "java.util", "org.junit", "org.kuali.rice" ]
java.util; org.junit; org.kuali.rice;
27,787
public void removeAlbumById(int songId) throws MPDServerException { List<Music> songs = getMusicList(); // Better way to get artist of given songId? String artist = ""; String album = ""; boolean usingAlbumArtist = true; for (Music song : songs) if (song.getSongId() == songId) { artist = song.getAlbumArtist(); if (artist == null || artist.equals("")) { usingAlbumArtist = false; artist = song.getArtist(); } album = song.getAlbum(); break; } if (artist == null || album == null) return; if (DEBUG) Log.d("MPD", "Remove album "+album + " of "+artist); @SuppressWarnings("unused") int num=0; for (Music song : songs) if (album.equals(song.getAlbum())) { if (usingAlbumArtist && artist.equals(song.getAlbumArtist()) || !usingAlbumArtist && artist.equals(song.getArtist())) { int id = song.getSongId(); this.mpd.getMpdConnection().queueCommand(MPD_CMD_PLAYLIST_REMOVE_ID, Integer.toString(id)); list.removeById(id); num++; } } if (DEBUG) Log.d("MPD", "Removed "+num + " songs"); this.mpd.getMpdConnection().sendCommandQueue(); }
void function(int songId) throws MPDServerException { List<Music> songs = getMusicList(); String artist = STRSTRSTRMPDSTRRemove album STR of STRunusedSTRMPDSTRRemoved STR songs"); this.mpd.getMpdConnection().sendCommandQueue(); }
/** * Removes album of given ID from playlist. * * @param songs * entries positions. * @throws MPDServerException * if an error occur while contacting server. * @see #removeById(int[]) */
Removes album of given ID from playlist
removeAlbumById
{ "repo_name": "philchand/mpdroid-2014", "path": "JMPDComm/src/org/a0z/mpd/MPDPlaylist.java", "license": "apache-2.0", "size": 14213 }
[ "java.util.List", "org.a0z.mpd.exception.MPDServerException" ]
import java.util.List; import org.a0z.mpd.exception.MPDServerException;
import java.util.*; import org.a0z.mpd.exception.*;
[ "java.util", "org.a0z.mpd" ]
java.util; org.a0z.mpd;
446,802
public static void main(final String[] args) throws Exception { System.exit(ToolRunner.run(new ShortestPathsBenchmark(), args)); }
static void function(final String[] args) throws Exception { System.exit(ToolRunner.run(new ShortestPathsBenchmark(), args)); }
/** * Execute the benchmark. * * @param args Typically the command line arguments. * @throws Exception Any exception from the computation. */
Execute the benchmark
main
{ "repo_name": "skymanaditya1/giraph", "path": "giraph-core/src/main/java/org/apache/giraph/benchmark/ShortestPathsBenchmark.java", "license": "apache-2.0", "size": 3367 }
[ "org.apache.hadoop.util.ToolRunner" ]
import org.apache.hadoop.util.ToolRunner;
import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,244,222
public static void drawStringCenter(Font font, String s, float y, Color filter) { int size = font.getWidth(s); font.drawString((Loader.CONFIGURATIONS.screenWidth - size) / 2, y, s, filter); }
static void function(Font font, String s, float y, Color filter) { int size = font.getWidth(s); font.drawString((Loader.CONFIGURATIONS.screenWidth - size) / 2, y, s, filter); }
/** * Escreve uma string centralizada. * @param font Fonte a ser utilizada para escrita. * @param s Texto a ser escrito. * @param y Posição no eixo Y a ser utilizada para escrita. * @param filter Cor para filtragem da fonte. */
Escreve uma string centralizada
drawStringCenter
{ "repo_name": "intentor/telyn", "path": "src/desktop/src/org/escape2team/telyn/core/Utils.java", "license": "gpl-3.0", "size": 15151 }
[ "org.escape2team.telyn.states.Loader", "org.newdawn.slick.Color", "org.newdawn.slick.Font" ]
import org.escape2team.telyn.states.Loader; import org.newdawn.slick.Color; import org.newdawn.slick.Font;
import org.escape2team.telyn.states.*; import org.newdawn.slick.*;
[ "org.escape2team.telyn", "org.newdawn.slick" ]
org.escape2team.telyn; org.newdawn.slick;
1,086,976
private void executeSql(Ignite node, String cacheName, String sql) { log.info("Executing DDL: " + sql); node.cache(cacheName).query(new SqlFieldsQuery(sql)).getAll(); } public static class KeyClass { @QuerySqlField private long id; public KeyClass(long id) { this.id = id; }
void function(Ignite node, String cacheName, String sql) { log.info(STR + sql); node.cache(cacheName).query(new SqlFieldsQuery(sql)).getAll(); } public static class KeyClass { private long id; public KeyClass(long id) { this.id = id; }
/** * Execute SQL. * * @param node Ignite node. * @param cacheName Cache name. * @param sql SQL. */
Execute SQL
executeSql
{ "repo_name": "irudyak/ignite", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java", "license": "apache-2.0", "size": 17364 }
[ "org.apache.ignite.Ignite", "org.apache.ignite.cache.query.SqlFieldsQuery" ]
import org.apache.ignite.Ignite; import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.*; import org.apache.ignite.cache.query.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,472,301
public List<Integer> calculate(List<Integer> list, int n, int begin, int length) { List<Integer> result = new ArrayList<Integer>(); for(int i = begin; i < begin + length; i++) { result.add(list.get(i) >> n); } return result; }
List<Integer> function(List<Integer> list, int n, int begin, int length) { List<Integer> result = new ArrayList<Integer>(); for(int i = begin; i < begin + length; i++) { result.add(list.get(i) >> n); } return result; }
/** * Shifts the values between the indices in the list n bits to the right. * @param List<Integer> the list * @param int number of bits to shift * @return the result * @override */
Shifts the values between the indices in the list n bits to the right
calculate
{ "repo_name": "jessemull/MicroFlex", "path": "src/main/java/com/github/jessemull/microflex/integerflex/math/RightShiftArithmeticInteger.java", "license": "apache-2.0", "size": 2587 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
459,230
protected boolean requestRequiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) { val revokeTokenRequest = isRevokeTokenRequest(request, response); if (revokeTokenRequest) { return clientNeedAuthentication(request, response); } val accessTokenRequest = isAccessTokenRequest(request, response); val extractor = extractAccessTokenGrantRequest(request); if (!accessTokenRequest) { if (extractor.isPresent()) { val ext = extractor.get(); return ext.requestMustBeAuthenticated(); } } else { if (extractor.isPresent()) { val ext = extractor.get(); return ext.getResponseType() != OAuth20ResponseTypes.DEVICE_CODE; } } return false; }
boolean function(final HttpServletRequest request, final HttpServletResponse response) { val revokeTokenRequest = isRevokeTokenRequest(request, response); if (revokeTokenRequest) { return clientNeedAuthentication(request, response); } val accessTokenRequest = isAccessTokenRequest(request, response); val extractor = extractAccessTokenGrantRequest(request); if (!accessTokenRequest) { if (extractor.isPresent()) { val ext = extractor.get(); return ext.requestMustBeAuthenticated(); } } else { if (extractor.isPresent()) { val ext = extractor.get(); return ext.getResponseType() != OAuth20ResponseTypes.DEVICE_CODE; } } return false; }
/** * Request requires authentication. * * @param request the request * @param response the response * @return true/false */
Request requires authentication
requestRequiresAuthentication
{ "repo_name": "fogbeam/cas_mirror", "path": "support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java", "license": "apache-2.0", "size": 8230 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apereo.cas.support.oauth.OAuth20ResponseTypes" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apereo.cas.support.oauth.OAuth20ResponseTypes;
import javax.servlet.http.*; import org.apereo.cas.support.oauth.*;
[ "javax.servlet", "org.apereo.cas" ]
javax.servlet; org.apereo.cas;
1,589,220
public PublishedAssessmentIfc publishAssessment(AssessmentIfc assessment) { try { PublishedAssessmentService service = new PublishedAssessmentService(); AssessmentService assessmentService = new AssessmentService(); AssessmentFacade facade = assessmentService.getAssessment( assessment.getAssessmentId().toString()); return service.publishAssessment(facade); } catch (Exception ex) { throw new AssessmentServiceException(ex); } }
PublishedAssessmentIfc function(AssessmentIfc assessment) { try { PublishedAssessmentService service = new PublishedAssessmentService(); AssessmentService assessmentService = new AssessmentService(); AssessmentFacade facade = assessmentService.getAssessment( assessment.getAssessmentId().toString()); return service.publishAssessment(facade); } catch (Exception ex) { throw new AssessmentServiceException(ex); } }
/** * Publish an assessment. * @param assessment * @return */
Publish an assessment
publishAssessment
{ "repo_name": "bzhouduke123/sakai", "path": "samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/shared/impl/assessment/PublishedAssessmentServiceImpl.java", "license": "apache-2.0", "size": 16234 }
[ "org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc", "org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc", "org.sakaiproject.tool.assessment.facade.AssessmentFacade", "org.sakaiproject.tool.assessment.services.assessment.AssessmentService", "org.sakaiproject.tool.assessment.services.assessment.AssessmentServiceException", "org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService" ]
import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc; import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc; import org.sakaiproject.tool.assessment.facade.AssessmentFacade; import org.sakaiproject.tool.assessment.services.assessment.AssessmentService; import org.sakaiproject.tool.assessment.services.assessment.AssessmentServiceException; import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService;
import org.sakaiproject.tool.assessment.data.ifc.assessment.*; import org.sakaiproject.tool.assessment.facade.*; import org.sakaiproject.tool.assessment.services.assessment.*;
[ "org.sakaiproject.tool" ]
org.sakaiproject.tool;
2,217,148
public void setFields(String fields) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(fields)) { throw new CmsIllegalStateException(Messages.get().container(Messages.ERR_VALIDATE_SEARCH_PARAMS_0)); } m_fields = fields; }
void function(String fields) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(fields)) { throw new CmsIllegalStateException(Messages.get().container(Messages.ERR_VALIDATE_SEARCH_PARAMS_0)); } m_fields = fields; }
/** * Sets the fields parameter value.<p> * * @param fields the fields parameter value to set */
Sets the fields parameter value
setFields
{ "repo_name": "comundus/opencms-comundus", "path": "src/main/java/org/opencms/workplace/search/CmsSearchWorkplaceBean.java", "license": "lgpl-2.1", "size": 7606 }
[ "org.opencms.main.CmsIllegalStateException", "org.opencms.util.CmsStringUtil" ]
import org.opencms.main.CmsIllegalStateException; import org.opencms.util.CmsStringUtil;
import org.opencms.main.*; import org.opencms.util.*;
[ "org.opencms.main", "org.opencms.util" ]
org.opencms.main; org.opencms.util;
170,441
protected Icon createImageIcon(String name) { Icon newLeafIcon = new ImageIcon(getClass().getClassLoader() .getResource("images/" + name)); return newLeafIcon; }
Icon function(String name) { Icon newLeafIcon = new ImageIcon(getClass().getClassLoader() .getResource(STR + name)); return newLeafIcon; }
/** * Returns an Icon, or null if the path was invalid. * */
Returns an Icon, or null if the path was invalid
createImageIcon
{ "repo_name": "NCIP/cab2b", "path": "software/dependencies/commonpackage/HEAD_TAG_10_Jan_2007_RELEASE_BRANCH_FOR_V11/src/edu/wustl/common/tree/StorageContainerRenderer.java", "license": "bsd-3-clause", "size": 2403 }
[ "javax.swing.Icon", "javax.swing.ImageIcon" ]
import javax.swing.Icon; import javax.swing.ImageIcon;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
103,097
@Override public void startSeriesPass(XYDataset dataset, int series, int firstItem, int lastItem, int pass, int passCount) { this.seriesPath.reset(); this.lastPointGood = false; super.startSeriesPass(dataset, series, firstItem, lastItem, pass, passCount); } }
void function(XYDataset dataset, int series, int firstItem, int lastItem, int pass, int passCount) { this.seriesPath.reset(); this.lastPointGood = false; super.startSeriesPass(dataset, series, firstItem, lastItem, pass, passCount); } }
/** * This method is called by the {@link XYPlot} at the start of each * series pass. We reset the state for the current series. * * @param dataset the dataset. * @param series the series index. * @param firstItem the first item index for this pass. * @param lastItem the last item index for this pass. * @param pass the current pass index. * @param passCount the number of passes. */
This method is called by the <code>XYPlot</code> at the start of each series pass. We reset the state for the current series
startSeriesPass
{ "repo_name": "GitoMat/jfreechart", "path": "src/main/java/org/jfree/chart/renderer/xy/XYLineAndShapeRenderer.java", "license": "lgpl-2.1", "size": 47085 }
[ "org.jfree.data.xy.XYDataset" ]
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.*;
[ "org.jfree.data" ]
org.jfree.data;
67,055
public static API getAPIForPublishing(GovernanceArtifact artifact, Registry registry) throws APIManagementException { API api; try { String providerName = artifact.getAttribute(APIConstants.API_OVERVIEW_PROVIDER); String apiName = artifact.getAttribute(APIConstants.API_OVERVIEW_NAME); String apiVersion = artifact.getAttribute(APIConstants.API_OVERVIEW_VERSION); APIIdentifier apiIdentifier = new APIIdentifier(providerName, apiName, apiVersion, artifact.getId()); String currentApiUuid; APIRevision apiRevision = ApiMgtDAO.getInstance().checkAPIUUIDIsARevisionUUID(artifact.getId()); if (apiRevision != null && apiRevision.getApiUUID() != null) { currentApiUuid = apiRevision.getApiUUID(); } else { currentApiUuid = artifact.getId(); } int apiId = ApiMgtDAO.getInstance().getAPIID(currentApiUuid); if (apiId == -1) { return null; } api = new API(apiIdentifier); //set uuid api.setUUID(artifact.getId()); // set rating String artifactPath = GovernanceUtils.getArtifactPath(registry, artifact.getId()); api = setResourceProperties(api, registry, artifactPath); api.setRating(getAverageRating(apiId)); //set description api.setDescription(artifact.getAttribute(APIConstants.API_OVERVIEW_DESCRIPTION)); //set last access time api.setLastUpdated(registry.get(artifactPath).getLastModified()); // set url api.setStatus(getLcStateFromArtifact(artifact)); api.setThumbnailUrl(artifact.getAttribute(APIConstants.API_OVERVIEW_THUMBNAIL_URL)); api.setWsdlUrl(artifact.getAttribute(APIConstants.API_OVERVIEW_WSDL)); api.setWadlUrl(artifact.getAttribute(APIConstants.API_OVERVIEW_WADL)); api.setTechnicalOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_TEC_OWNER)); api.setTechnicalOwnerEmail(artifact.getAttribute(APIConstants.API_OVERVIEW_TEC_OWNER_EMAIL)); api.setBusinessOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_BUSS_OWNER)); api.setBusinessOwnerEmail(artifact.getAttribute(APIConstants.API_OVERVIEW_BUSS_OWNER_EMAIL)); api.setVisibility(artifact.getAttribute(APIConstants.API_OVERVIEW_VISIBILITY)); api.setVisibleRoles(artifact.getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ROLES)); api.setVisibleTenants(artifact.getAttribute(APIConstants.API_OVERVIEW_VISIBLE_TENANTS)); api.setEndpointSecured(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_ENDPOINT_SECURED))); api.setEndpointAuthDigest(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_ENDPOINT_AUTH_DIGEST))); api.setEndpointUTUsername(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_USERNAME)); api.setGatewayVendor(artifact.getAttribute(APIConstants.API_OVERVIEW_GATEWAY_VENDOR)); if (!((APIConstants.DEFAULT_MODIFIED_ENDPOINT_PASSWORD) .equals(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_PASSWORD)))) { api.setEndpointUTPassword(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_PASSWORD)); } else { //If APIEndpointPasswordRegistryHandler is enabled take password from the registry hidden property api.setEndpointUTPassword(getActualEpPswdFromHiddenProperty(api, registry)); } api.setTransports(artifact.getAttribute(APIConstants.API_OVERVIEW_TRANSPORTS)); api.setInSequence(artifact.getAttribute(APIConstants.API_OVERVIEW_INSEQUENCE)); api.setOutSequence(artifact.getAttribute(APIConstants.API_OVERVIEW_OUTSEQUENCE)); api.setFaultSequence(artifact.getAttribute(APIConstants.API_OVERVIEW_FAULTSEQUENCE)); api.setResponseCache(artifact.getAttribute(APIConstants.API_OVERVIEW_RESPONSE_CACHING)); api.setImplementation(artifact.getAttribute(APIConstants.PROTOTYPE_OVERVIEW_IMPLEMENTATION)); api.setType(artifact.getAttribute(APIConstants.API_OVERVIEW_TYPE)); api.setProductionMaxTps(artifact.getAttribute(APIConstants.API_PRODUCTION_THROTTLE_MAXTPS)); api.setSandboxMaxTps(artifact.getAttribute(APIConstants.API_SANDBOX_THROTTLE_MAXTPS)); int cacheTimeout = APIConstants.API_RESPONSE_CACHE_TIMEOUT; try { String strCacheTimeout = artifact.getAttribute(APIConstants.API_OVERVIEW_CACHE_TIMEOUT); if (strCacheTimeout != null && !strCacheTimeout.isEmpty()) { cacheTimeout = Integer.parseInt(strCacheTimeout); } } catch (NumberFormatException e) { if (log.isWarnEnabled()) { log.warn("Error while retrieving cache timeout from the registry for " + apiIdentifier); } // ignore the exception and use default cache timeout value } api.setCacheTimeout(cacheTimeout); api.setEndpointConfig(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_CONFIG)); api.setRedirectURL(artifact.getAttribute(APIConstants.API_OVERVIEW_REDIRECT_URL)); api.setApiOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_OWNER)); api.setAdvertiseOnly(Boolean.parseBoolean(artifact.getAttribute(APIConstants.API_OVERVIEW_ADVERTISE_ONLY))); api.setApiExternalProductionEndpoint(artifact.getAttribute(APIConstants.API_OVERVIEW_EXTERNAL_PRODUCTION_ENDPOINT)); api.setApiExternalSandboxEndpoint(artifact.getAttribute(APIConstants.API_OVERVIEW_EXTERNAL_SANDBOX_ENDPOINT)); api.setType(artifact.getAttribute(APIConstants.API_OVERVIEW_TYPE)); api.setSubscriptionAvailability(artifact.getAttribute(APIConstants.API_OVERVIEW_SUBSCRIPTION_AVAILABILITY)); api.setSubscriptionAvailableTenants(artifact.getAttribute( APIConstants.API_OVERVIEW_SUBSCRIPTION_AVAILABLE_TENANTS)); String tenantDomainName = MultitenantUtils.getTenantDomain(replaceEmailDomainBack(providerName)); int tenantId = ServiceReferenceHolder.getInstance().getRealmService().getTenantManager() .getTenantId(tenantDomainName); APIManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); String apiLevelTier = ApiMgtDAO.getInstance().getAPILevelTier(apiId); api.setApiLevelPolicy(apiLevelTier); String tiers = artifact.getAttribute(APIConstants.API_OVERVIEW_TIER); Map<String, Tier> definedTiers = getTiers(tenantId); Set<Tier> availableTier = getAvailableTiers(definedTiers, tiers, apiName); api.addAvailableTiers(availableTier); // This contains the resolved context api.setContext(artifact.getAttribute(APIConstants.API_OVERVIEW_CONTEXT)); // We set the context template here api.setContextTemplate(artifact.getAttribute(APIConstants.API_OVERVIEW_CONTEXT_TEMPLATE)); api.setLatest(Boolean.parseBoolean(artifact.getAttribute(APIConstants.API_OVERVIEW_IS_LATEST))); api.setEnableSchemaValidation(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_ENABLE_JSON_SCHEMA))); api.setEnableStore(Boolean.parseBoolean(artifact.getAttribute(APIConstants.API_OVERVIEW_ENABLE_STORE))); api.setTestKey(artifact.getAttribute(APIConstants.API_OVERVIEW_TESTKEY)); Map<String, Scope> scopeToKeyMapping = getAPIScopes(api.getUuid(), tenantDomainName); api.setScopes(new LinkedHashSet<>(scopeToKeyMapping.values())); Set<URITemplate> uriTemplates = ApiMgtDAO.getInstance().getURITemplatesOfAPI(api.getUuid()); // AWS Lambda: get paths OASParserUtil oasParserUtil = new OASParserUtil(); String resourceConfigsString = oasParserUtil.getAPIDefinition(apiIdentifier, registry); JSONParser jsonParser = new JSONParser(); JSONObject paths = null; if (resourceConfigsString != null) { JSONObject resourceConfigsJSON = (JSONObject) jsonParser.parse(resourceConfigsString); paths = (JSONObject) resourceConfigsJSON.get(APIConstants.SWAGGER_PATHS); } for (URITemplate uriTemplate : uriTemplates) { String uTemplate = uriTemplate.getUriTemplate(); String method = uriTemplate.getHTTPVerb(); List<Scope> oldTemplateScopes = uriTemplate.retrieveAllScopes(); List<Scope> newTemplateScopes = new ArrayList<>(); if (!oldTemplateScopes.isEmpty()) { for (Scope templateScope : oldTemplateScopes) { Scope scope = scopeToKeyMapping.get(templateScope.getKey()); newTemplateScopes.add(scope); } } uriTemplate.addAllScopes(newTemplateScopes); uriTemplate.setResourceURI(api.getUrl()); uriTemplate.setResourceSandboxURI(api.getSandboxUrl()); // AWS Lambda: set arn & timeout to URI template if (paths != null) { JSONObject path = (JSONObject) paths.get(uTemplate); if (path != null) { JSONObject operation = (JSONObject) path.get(method.toLowerCase()); if (operation != null) { if (operation.containsKey(APIConstants.SWAGGER_X_AMZN_RESOURCE_NAME)) { uriTemplate.setAmznResourceName((String) operation.get(APIConstants.SWAGGER_X_AMZN_RESOURCE_NAME)); } if (operation.containsKey(APIConstants.SWAGGER_X_AMZN_RESOURCE_TIMEOUT)) { uriTemplate.setAmznResourceTimeout(((Long) operation.get(APIConstants.SWAGGER_X_AMZN_RESOURCE_TIMEOUT)).intValue()); } } } } } if (APIConstants.IMPLEMENTATION_TYPE_INLINE.equalsIgnoreCase(api.getImplementation())) { for (URITemplate template : uriTemplates) { template.setMediationScript(template.getAggregatedMediationScript()); } } api.setUriTemplates(uriTemplates); api.setAsDefaultVersion(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_IS_DEFAULT_VERSION))); Set<String> tags = new HashSet<String>(); Tag[] tag = registry.getTags(artifactPath); for (Tag tag1 : tag) { tags.add(tag1.getTagName()); } api.addTags(tags); api.setLastUpdated(registry.get(artifactPath).getLastModified()); api.setCreatedTime(String.valueOf(registry.get(artifactPath).getCreatedTime().getTime())); api.setImplementation(artifact.getAttribute(APIConstants.PROTOTYPE_OVERVIEW_IMPLEMENTATION)); String environments = artifact.getAttribute(APIConstants.API_OVERVIEW_ENVIRONMENTS); api.setEnvironments(extractEnvironmentsForAPI(environments)); api.setCorsConfiguration(getCorsConfigurationFromArtifact(artifact)); api.setWebsubSubscriptionConfiguration(getWebsubSubscriptionConfigurationFromArtifact(artifact)); api.setAuthorizationHeader(artifact.getAttribute(APIConstants.API_OVERVIEW_AUTHORIZATION_HEADER)); api.setApiSecurity(artifact.getAttribute(APIConstants.API_OVERVIEW_API_SECURITY)); //set data and status related to monetization api.setMonetizationStatus(Boolean.parseBoolean(artifact.getAttribute (APIConstants.Monetization.API_MONETIZATION_STATUS))); String monetizationInfo = artifact.getAttribute(APIConstants.Monetization.API_MONETIZATION_PROPERTIES); if (StringUtils.isNotBlank(monetizationInfo)) { JSONParser parser = new JSONParser(); JSONObject jsonObj = (JSONObject) parser.parse(monetizationInfo); api.setMonetizationProperties(jsonObj); } api.setApiCategories(getAPICategoriesFromAPIGovernanceArtifact(artifact, tenantId)); //get endpoint config string from artifact, parse it as a json and set the environment list configured with //non empty URLs to API object String keyManagers = artifact.getAttribute(APIConstants.API_OVERVIEW_KEY_MANAGERS); if (StringUtils.isNotEmpty(keyManagers)) { api.setKeyManagers(new Gson().fromJson(keyManagers, List.class)); } else { api.setKeyManagers(Arrays.asList(APIConstants.KeyManager.API_LEVEL_ALL_KEY_MANAGERS)); } try { api.setEnvironmentList(extractEnvironmentListForAPI( artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_CONFIG))); } catch (ParseException e) { String msg = "Failed to parse endpoint config JSON of API: " + apiName + " " + apiVersion; log.error(msg, e); throw new APIManagementException(msg, e); } catch (ClassCastException e) { String msg = "Invalid endpoint config JSON found in API: " + apiName + " " + apiVersion; log.error(msg, e); throw new APIManagementException(msg, e); } } catch (GovernanceException e) { String msg = "Failed to get API for artifact "; throw new APIManagementException(msg, e); } catch (RegistryException e) { String msg = "Failed to get LastAccess time or Rating"; throw new APIManagementException(msg, e); } catch (UserStoreException e) { String msg = "Failed to get User Realm of API Provider"; throw new APIManagementException(msg, e); } catch (ParseException e) { String msg = "Failed to get parse monetization information."; throw new APIManagementException(msg, e); } return api; }
static API function(GovernanceArtifact artifact, Registry registry) throws APIManagementException { API api; try { String providerName = artifact.getAttribute(APIConstants.API_OVERVIEW_PROVIDER); String apiName = artifact.getAttribute(APIConstants.API_OVERVIEW_NAME); String apiVersion = artifact.getAttribute(APIConstants.API_OVERVIEW_VERSION); APIIdentifier apiIdentifier = new APIIdentifier(providerName, apiName, apiVersion, artifact.getId()); String currentApiUuid; APIRevision apiRevision = ApiMgtDAO.getInstance().checkAPIUUIDIsARevisionUUID(artifact.getId()); if (apiRevision != null && apiRevision.getApiUUID() != null) { currentApiUuid = apiRevision.getApiUUID(); } else { currentApiUuid = artifact.getId(); } int apiId = ApiMgtDAO.getInstance().getAPIID(currentApiUuid); if (apiId == -1) { return null; } api = new API(apiIdentifier); api.setUUID(artifact.getId()); String artifactPath = GovernanceUtils.getArtifactPath(registry, artifact.getId()); api = setResourceProperties(api, registry, artifactPath); api.setRating(getAverageRating(apiId)); api.setDescription(artifact.getAttribute(APIConstants.API_OVERVIEW_DESCRIPTION)); api.setLastUpdated(registry.get(artifactPath).getLastModified()); api.setStatus(getLcStateFromArtifact(artifact)); api.setThumbnailUrl(artifact.getAttribute(APIConstants.API_OVERVIEW_THUMBNAIL_URL)); api.setWsdlUrl(artifact.getAttribute(APIConstants.API_OVERVIEW_WSDL)); api.setWadlUrl(artifact.getAttribute(APIConstants.API_OVERVIEW_WADL)); api.setTechnicalOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_TEC_OWNER)); api.setTechnicalOwnerEmail(artifact.getAttribute(APIConstants.API_OVERVIEW_TEC_OWNER_EMAIL)); api.setBusinessOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_BUSS_OWNER)); api.setBusinessOwnerEmail(artifact.getAttribute(APIConstants.API_OVERVIEW_BUSS_OWNER_EMAIL)); api.setVisibility(artifact.getAttribute(APIConstants.API_OVERVIEW_VISIBILITY)); api.setVisibleRoles(artifact.getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ROLES)); api.setVisibleTenants(artifact.getAttribute(APIConstants.API_OVERVIEW_VISIBLE_TENANTS)); api.setEndpointSecured(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_ENDPOINT_SECURED))); api.setEndpointAuthDigest(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_ENDPOINT_AUTH_DIGEST))); api.setEndpointUTUsername(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_USERNAME)); api.setGatewayVendor(artifact.getAttribute(APIConstants.API_OVERVIEW_GATEWAY_VENDOR)); if (!((APIConstants.DEFAULT_MODIFIED_ENDPOINT_PASSWORD) .equals(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_PASSWORD)))) { api.setEndpointUTPassword(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_PASSWORD)); } else { api.setEndpointUTPassword(getActualEpPswdFromHiddenProperty(api, registry)); } api.setTransports(artifact.getAttribute(APIConstants.API_OVERVIEW_TRANSPORTS)); api.setInSequence(artifact.getAttribute(APIConstants.API_OVERVIEW_INSEQUENCE)); api.setOutSequence(artifact.getAttribute(APIConstants.API_OVERVIEW_OUTSEQUENCE)); api.setFaultSequence(artifact.getAttribute(APIConstants.API_OVERVIEW_FAULTSEQUENCE)); api.setResponseCache(artifact.getAttribute(APIConstants.API_OVERVIEW_RESPONSE_CACHING)); api.setImplementation(artifact.getAttribute(APIConstants.PROTOTYPE_OVERVIEW_IMPLEMENTATION)); api.setType(artifact.getAttribute(APIConstants.API_OVERVIEW_TYPE)); api.setProductionMaxTps(artifact.getAttribute(APIConstants.API_PRODUCTION_THROTTLE_MAXTPS)); api.setSandboxMaxTps(artifact.getAttribute(APIConstants.API_SANDBOX_THROTTLE_MAXTPS)); int cacheTimeout = APIConstants.API_RESPONSE_CACHE_TIMEOUT; try { String strCacheTimeout = artifact.getAttribute(APIConstants.API_OVERVIEW_CACHE_TIMEOUT); if (strCacheTimeout != null && !strCacheTimeout.isEmpty()) { cacheTimeout = Integer.parseInt(strCacheTimeout); } } catch (NumberFormatException e) { if (log.isWarnEnabled()) { log.warn(STR + apiIdentifier); } } api.setCacheTimeout(cacheTimeout); api.setEndpointConfig(artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_CONFIG)); api.setRedirectURL(artifact.getAttribute(APIConstants.API_OVERVIEW_REDIRECT_URL)); api.setApiOwner(artifact.getAttribute(APIConstants.API_OVERVIEW_OWNER)); api.setAdvertiseOnly(Boolean.parseBoolean(artifact.getAttribute(APIConstants.API_OVERVIEW_ADVERTISE_ONLY))); api.setApiExternalProductionEndpoint(artifact.getAttribute(APIConstants.API_OVERVIEW_EXTERNAL_PRODUCTION_ENDPOINT)); api.setApiExternalSandboxEndpoint(artifact.getAttribute(APIConstants.API_OVERVIEW_EXTERNAL_SANDBOX_ENDPOINT)); api.setType(artifact.getAttribute(APIConstants.API_OVERVIEW_TYPE)); api.setSubscriptionAvailability(artifact.getAttribute(APIConstants.API_OVERVIEW_SUBSCRIPTION_AVAILABILITY)); api.setSubscriptionAvailableTenants(artifact.getAttribute( APIConstants.API_OVERVIEW_SUBSCRIPTION_AVAILABLE_TENANTS)); String tenantDomainName = MultitenantUtils.getTenantDomain(replaceEmailDomainBack(providerName)); int tenantId = ServiceReferenceHolder.getInstance().getRealmService().getTenantManager() .getTenantId(tenantDomainName); APIManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); String apiLevelTier = ApiMgtDAO.getInstance().getAPILevelTier(apiId); api.setApiLevelPolicy(apiLevelTier); String tiers = artifact.getAttribute(APIConstants.API_OVERVIEW_TIER); Map<String, Tier> definedTiers = getTiers(tenantId); Set<Tier> availableTier = getAvailableTiers(definedTiers, tiers, apiName); api.addAvailableTiers(availableTier); api.setContext(artifact.getAttribute(APIConstants.API_OVERVIEW_CONTEXT)); api.setContextTemplate(artifact.getAttribute(APIConstants.API_OVERVIEW_CONTEXT_TEMPLATE)); api.setLatest(Boolean.parseBoolean(artifact.getAttribute(APIConstants.API_OVERVIEW_IS_LATEST))); api.setEnableSchemaValidation(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_ENABLE_JSON_SCHEMA))); api.setEnableStore(Boolean.parseBoolean(artifact.getAttribute(APIConstants.API_OVERVIEW_ENABLE_STORE))); api.setTestKey(artifact.getAttribute(APIConstants.API_OVERVIEW_TESTKEY)); Map<String, Scope> scopeToKeyMapping = getAPIScopes(api.getUuid(), tenantDomainName); api.setScopes(new LinkedHashSet<>(scopeToKeyMapping.values())); Set<URITemplate> uriTemplates = ApiMgtDAO.getInstance().getURITemplatesOfAPI(api.getUuid()); OASParserUtil oasParserUtil = new OASParserUtil(); String resourceConfigsString = oasParserUtil.getAPIDefinition(apiIdentifier, registry); JSONParser jsonParser = new JSONParser(); JSONObject paths = null; if (resourceConfigsString != null) { JSONObject resourceConfigsJSON = (JSONObject) jsonParser.parse(resourceConfigsString); paths = (JSONObject) resourceConfigsJSON.get(APIConstants.SWAGGER_PATHS); } for (URITemplate uriTemplate : uriTemplates) { String uTemplate = uriTemplate.getUriTemplate(); String method = uriTemplate.getHTTPVerb(); List<Scope> oldTemplateScopes = uriTemplate.retrieveAllScopes(); List<Scope> newTemplateScopes = new ArrayList<>(); if (!oldTemplateScopes.isEmpty()) { for (Scope templateScope : oldTemplateScopes) { Scope scope = scopeToKeyMapping.get(templateScope.getKey()); newTemplateScopes.add(scope); } } uriTemplate.addAllScopes(newTemplateScopes); uriTemplate.setResourceURI(api.getUrl()); uriTemplate.setResourceSandboxURI(api.getSandboxUrl()); if (paths != null) { JSONObject path = (JSONObject) paths.get(uTemplate); if (path != null) { JSONObject operation = (JSONObject) path.get(method.toLowerCase()); if (operation != null) { if (operation.containsKey(APIConstants.SWAGGER_X_AMZN_RESOURCE_NAME)) { uriTemplate.setAmznResourceName((String) operation.get(APIConstants.SWAGGER_X_AMZN_RESOURCE_NAME)); } if (operation.containsKey(APIConstants.SWAGGER_X_AMZN_RESOURCE_TIMEOUT)) { uriTemplate.setAmznResourceTimeout(((Long) operation.get(APIConstants.SWAGGER_X_AMZN_RESOURCE_TIMEOUT)).intValue()); } } } } } if (APIConstants.IMPLEMENTATION_TYPE_INLINE.equalsIgnoreCase(api.getImplementation())) { for (URITemplate template : uriTemplates) { template.setMediationScript(template.getAggregatedMediationScript()); } } api.setUriTemplates(uriTemplates); api.setAsDefaultVersion(Boolean.parseBoolean(artifact.getAttribute( APIConstants.API_OVERVIEW_IS_DEFAULT_VERSION))); Set<String> tags = new HashSet<String>(); Tag[] tag = registry.getTags(artifactPath); for (Tag tag1 : tag) { tags.add(tag1.getTagName()); } api.addTags(tags); api.setLastUpdated(registry.get(artifactPath).getLastModified()); api.setCreatedTime(String.valueOf(registry.get(artifactPath).getCreatedTime().getTime())); api.setImplementation(artifact.getAttribute(APIConstants.PROTOTYPE_OVERVIEW_IMPLEMENTATION)); String environments = artifact.getAttribute(APIConstants.API_OVERVIEW_ENVIRONMENTS); api.setEnvironments(extractEnvironmentsForAPI(environments)); api.setCorsConfiguration(getCorsConfigurationFromArtifact(artifact)); api.setWebsubSubscriptionConfiguration(getWebsubSubscriptionConfigurationFromArtifact(artifact)); api.setAuthorizationHeader(artifact.getAttribute(APIConstants.API_OVERVIEW_AUTHORIZATION_HEADER)); api.setApiSecurity(artifact.getAttribute(APIConstants.API_OVERVIEW_API_SECURITY)); api.setMonetizationStatus(Boolean.parseBoolean(artifact.getAttribute (APIConstants.Monetization.API_MONETIZATION_STATUS))); String monetizationInfo = artifact.getAttribute(APIConstants.Monetization.API_MONETIZATION_PROPERTIES); if (StringUtils.isNotBlank(monetizationInfo)) { JSONParser parser = new JSONParser(); JSONObject jsonObj = (JSONObject) parser.parse(monetizationInfo); api.setMonetizationProperties(jsonObj); } api.setApiCategories(getAPICategoriesFromAPIGovernanceArtifact(artifact, tenantId)); String keyManagers = artifact.getAttribute(APIConstants.API_OVERVIEW_KEY_MANAGERS); if (StringUtils.isNotEmpty(keyManagers)) { api.setKeyManagers(new Gson().fromJson(keyManagers, List.class)); } else { api.setKeyManagers(Arrays.asList(APIConstants.KeyManager.API_LEVEL_ALL_KEY_MANAGERS)); } try { api.setEnvironmentList(extractEnvironmentListForAPI( artifact.getAttribute(APIConstants.API_OVERVIEW_ENDPOINT_CONFIG))); } catch (ParseException e) { String msg = STR + apiName + " " + apiVersion; log.error(msg, e); throw new APIManagementException(msg, e); } catch (ClassCastException e) { String msg = STR + apiName + " " + apiVersion; log.error(msg, e); throw new APIManagementException(msg, e); } } catch (GovernanceException e) { String msg = STR; throw new APIManagementException(msg, e); } catch (RegistryException e) { String msg = STR; throw new APIManagementException(msg, e); } catch (UserStoreException e) { String msg = STR; throw new APIManagementException(msg, e); } catch (ParseException e) { String msg = STR; throw new APIManagementException(msg, e); } return api; }
/** * This Method is different from getAPI method, as this one returns * URLTemplates without aggregating duplicates. This is to be used for building synapse config. * * @param artifact * @param registry * @return API * @throws org.wso2.carbon.apimgt.api.APIManagementException */
This Method is different from getAPI method, as this one returns URLTemplates without aggregating duplicates. This is to be used for building synapse config
getAPIForPublishing
{ "repo_name": "ruks/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java", "license": "apache-2.0", "size": 564037 }
[ "com.google.gson.Gson", "java.util.ArrayList", "java.util.Arrays", "java.util.HashSet", "java.util.LinkedHashSet", "java.util.List", "java.util.Map", "java.util.Set", "org.apache.commons.lang3.StringUtils", "org.json.simple.JSONObject", "org.json.simple.parser.JSONParser", "org.json.simple.parser.ParseException", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.APIIdentifier", "org.wso2.carbon.apimgt.api.model.APIRevision", "org.wso2.carbon.apimgt.api.model.Scope", "org.wso2.carbon.apimgt.api.model.Tier", "org.wso2.carbon.apimgt.api.model.URITemplate", "org.wso2.carbon.apimgt.impl.APIConstants", "org.wso2.carbon.apimgt.impl.APIManagerConfiguration", "org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO", "org.wso2.carbon.apimgt.impl.definitions.OASParserUtil", "org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder", "org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifact", "org.wso2.carbon.governance.api.exception.GovernanceException", "org.wso2.carbon.governance.api.util.GovernanceUtils", "org.wso2.carbon.registry.core.Registry", "org.wso2.carbon.registry.core.Tag", "org.wso2.carbon.registry.core.exceptions.RegistryException", "org.wso2.carbon.user.api.UserStoreException", "org.wso2.carbon.utils.multitenancy.MultitenantUtils" ]
import com.google.gson.Gson; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.APIIdentifier; import org.wso2.carbon.apimgt.api.model.APIRevision; import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.api.model.Tier; import org.wso2.carbon.apimgt.api.model.URITemplate; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIManagerConfiguration; import org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO; import org.wso2.carbon.apimgt.impl.definitions.OASParserUtil; import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder; import org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifact; import org.wso2.carbon.governance.api.exception.GovernanceException; import org.wso2.carbon.governance.api.util.GovernanceUtils; import org.wso2.carbon.registry.core.Registry; import org.wso2.carbon.registry.core.Tag; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import com.google.gson.*; import java.util.*; import org.apache.commons.lang3.*; import org.json.simple.*; import org.json.simple.parser.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.*; import org.wso2.carbon.apimgt.impl.dao.*; import org.wso2.carbon.apimgt.impl.definitions.*; import org.wso2.carbon.apimgt.impl.internal.*; import org.wso2.carbon.governance.api.common.dataobjects.*; import org.wso2.carbon.governance.api.exception.*; import org.wso2.carbon.governance.api.util.*; import org.wso2.carbon.registry.core.*; import org.wso2.carbon.registry.core.exceptions.*; import org.wso2.carbon.user.api.*; import org.wso2.carbon.utils.multitenancy.*;
[ "com.google.gson", "java.util", "org.apache.commons", "org.json.simple", "org.wso2.carbon" ]
com.google.gson; java.util; org.apache.commons; org.json.simple; org.wso2.carbon;
889,230
@Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); OpenWireBlobMessage info = (OpenWireBlobMessage) o; info.setRemoteBlobUrl(looseUnmarshalString(dataIn)); info.setMimeType(looseUnmarshalString(dataIn)); info.setDeletedByBroker(dataIn.readBoolean()); }
void function(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); OpenWireBlobMessage info = (OpenWireBlobMessage) o; info.setRemoteBlobUrl(looseUnmarshalString(dataIn)); info.setMimeType(looseUnmarshalString(dataIn)); info.setDeletedByBroker(dataIn.readBoolean()); }
/** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */
Un-marshal an object instance from the data input stream
looseUnmarshal
{ "repo_name": "tabish121/OpenWire", "path": "openwire-legacy/src/main/java/io/openwire/codec/v3/OpenWireBlobMessageMarshaller.java", "license": "apache-2.0", "size": 4638 }
[ "io.openwire.codec.OpenWireFormat", "io.openwire.commands.OpenWireBlobMessage", "java.io.DataInput", "java.io.IOException" ]
import io.openwire.codec.OpenWireFormat; import io.openwire.commands.OpenWireBlobMessage; import java.io.DataInput; import java.io.IOException;
import io.openwire.codec.*; import io.openwire.commands.*; import java.io.*;
[ "io.openwire.codec", "io.openwire.commands", "java.io" ]
io.openwire.codec; io.openwire.commands; java.io;
970,036
public void unregisterUser( HttpServletRequest request ) { HttpSession session = request.getSession( true ); session.removeAttribute( ATTRIBUTE_LUTECE_USER ); }
void function( HttpServletRequest request ) { HttpSession session = request.getSession( true ); session.removeAttribute( ATTRIBUTE_LUTECE_USER ); }
/** * Unregister the user in the Http session * * @param request The Http request */
Unregister the user in the Http session
unregisterUser
{ "repo_name": "rzara/lutece-core", "path": "src/java/fr/paris/lutece/portal/service/security/SecurityService.java", "license": "bsd-3-clause", "size": 17650 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpSession" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,615,607
public void testRequiredAffiliateSiteResponse() throws Exception{ GridEndPoint gridEndPoint = new GridEndPoint(); gridEndPoint.setStatus(WorkFlowStatusType.MESSAGE_RECIEVED); studySubject.addEndPoint(gridEndPoint); assertTrue("Expected to require affiliate site response",studySubject.requiresAffiliateSiteResponse()); }
void function() throws Exception{ GridEndPoint gridEndPoint = new GridEndPoint(); gridEndPoint.setStatus(WorkFlowStatusType.MESSAGE_RECIEVED); studySubject.addEndPoint(gridEndPoint); assertTrue(STR,studySubject.requiresAffiliateSiteResponse()); }
/** * Test required affiliate site response. * * @throws Exception the exception */
Test required affiliate site response
testRequiredAffiliateSiteResponse
{ "repo_name": "NCIP/c3pr", "path": "codebase/projects/core/test/src/java/edu/duke/cabig/c3pr/domain/StudySubjectTest.java", "license": "bsd-3-clause", "size": 170087 }
[ "edu.duke.cabig.c3pr.constants.WorkFlowStatusType" ]
import edu.duke.cabig.c3pr.constants.WorkFlowStatusType;
import edu.duke.cabig.c3pr.constants.*;
[ "edu.duke.cabig" ]
edu.duke.cabig;
2,022,593
public BigDecimal getAmtSourceDr () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_AmtSourceDr); if (bd == null) return Env.ZERO; return bd; }
BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_AmtSourceDr); if (bd == null) return Env.ZERO; return bd; }
/** Get Source Debit. @return Source Debit Amount */
Get Source Debit
getAmtSourceDr
{ "repo_name": "geneos/adempiere", "path": "base/src/org/compiere/model/X_I_FAJournal.java", "license": "gpl-2.0", "size": 37254 }
[ "java.math.BigDecimal", "org.compiere.util.Env" ]
import java.math.BigDecimal; import org.compiere.util.Env;
import java.math.*; import org.compiere.util.*;
[ "java.math", "org.compiere.util" ]
java.math; org.compiere.util;
1,548,291
public void assertContainsOnly(AssertionInfo info, float[] actual, float[] values) { arrays.assertContainsOnly(info, failures, actual, values); }
void function(AssertionInfo info, float[] actual, float[] values) { arrays.assertContainsOnly(info, failures, actual, values); }
/** * Asserts that the given array contains only the given values and nothing else, in any order. * @param info contains information about the assertion. * @param actual the given array. * @param values the values that are expected to be in the given array. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given array is {@code null}. * @throws AssertionError if the given array does not contain the given values or if the given array contains values that are * not in the given array. */
Asserts that the given array contains only the given values and nothing else, in any order
assertContainsOnly
{ "repo_name": "dorzey/assertj-core", "path": "src/main/java/org/assertj/core/internal/FloatArrays.java", "license": "apache-2.0", "size": 14381 }
[ "org.assertj.core.api.AssertionInfo" ]
import org.assertj.core.api.AssertionInfo;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
829,482
public void setGenericType(Type genericType);
void function(Type genericType);
/** * Update type of the object to be produced or written. * * @param genericType new type for object */
Update type of the object to be produced or written
setGenericType
{ "repo_name": "raphaelning/resteasy-client-android", "path": "jaxrs/jaxrs-api/src/main/java/javax/ws/rs/ext/InterceptorContext.java", "license": "apache-2.0", "size": 8980 }
[ "java.lang.reflect.Type" ]
import java.lang.reflect.Type;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,143,900
public LoanFile open(final Path path) throws IOException, JAXBException { currentFile = (BaseLoanFile) xmlParser.read(path); return currentFile; }
LoanFile function(final Path path) throws IOException, JAXBException { currentFile = (BaseLoanFile) xmlParser.read(path); return currentFile; }
/** * Open a file. * * @param path * the Path */
Open a file
open
{ "repo_name": "sambalmueslie/LoanCalculator", "path": "Loan Calculator/src/main/java/de/sambalmueslie/loan_calculator/controller/file/FileController.java", "license": "apache-2.0", "size": 2396 }
[ "java.io.IOException", "java.nio.file.Path", "javax.xml.bind.JAXBException" ]
import java.io.IOException; import java.nio.file.Path; import javax.xml.bind.JAXBException;
import java.io.*; import java.nio.file.*; import javax.xml.bind.*;
[ "java.io", "java.nio", "javax.xml" ]
java.io; java.nio; javax.xml;
1,021,258
protected static Map<String, String> convertHeaders(Header[] headers) { Map<String, String> result = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); for (int i = 0; i < headers.length; i++) { result.put(headers[i].getName(), headers[i].getValue()); } return result; }
static Map<String, String> function(Header[] headers) { Map<String, String> result = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); for (int i = 0; i < headers.length; i++) { result.put(headers[i].getName(), headers[i].getValue()); } return result; }
/** * Converts Headers[] to Map<String, String>. */
Converts Headers[] to Map
convertHeaders
{ "repo_name": "chashmeetsingh/PayUApp", "path": "app/src/main/java/com/android/volley/toolbox/BasicNetwork.java", "license": "mit", "size": 10974 }
[ "java.util.Map", "java.util.TreeMap", "org.apache.http.Header" ]
import java.util.Map; import java.util.TreeMap; import org.apache.http.Header;
import java.util.*; import org.apache.http.*;
[ "java.util", "org.apache.http" ]
java.util; org.apache.http;
2,558,108
@Override public RecordReader getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { if (!(split instanceof CombineHiveInputSplit)) { return super.getRecordReader(split, job, reporter); } CombineHiveInputSplit hsplit = (CombineHiveInputSplit) split; String inputFormatClassName = null; Class inputFormatClass = null; try { inputFormatClassName = hsplit.inputFormatClassName(); inputFormatClass = job.getClassByName(inputFormatClassName); } catch (Exception e) { throw new IOException("cannot find class " + inputFormatClassName); } pushProjectionsAndFilters(job, inputFormatClass, hsplit.getPath(0).toString(), hsplit.getPath(0).toUri().getPath()); return ShimLoader.getHadoopShims().getCombineFileInputFormat() .getRecordReader(job, (CombineFileSplit) split, reporter, CombineHiveRecordReader.class); } static class CombineFilter implements PathFilter { private final Set<String> pStrings = new HashSet<String>(); // store a path prefix in this TestFilter // PRECONDITION: p should always be a directory public CombineFilter(Path p) { // we need to keep the path part only because the Hadoop CombineFileInputFormat will // pass the path part only to accept(). // Trailing the path with a separator to prevent partial matching. addPath(p); }
RecordReader function(InputSplit split, JobConf job, Reporter reporter) throws IOException { if (!(split instanceof CombineHiveInputSplit)) { return super.getRecordReader(split, job, reporter); } CombineHiveInputSplit hsplit = (CombineHiveInputSplit) split; String inputFormatClassName = null; Class inputFormatClass = null; try { inputFormatClassName = hsplit.inputFormatClassName(); inputFormatClass = job.getClassByName(inputFormatClassName); } catch (Exception e) { throw new IOException(STR + inputFormatClassName); } pushProjectionsAndFilters(job, inputFormatClass, hsplit.getPath(0).toString(), hsplit.getPath(0).toUri().getPath()); return ShimLoader.getHadoopShims().getCombineFileInputFormat() .getRecordReader(job, (CombineFileSplit) split, reporter, CombineHiveRecordReader.class); } static class CombineFilter implements PathFilter { private final Set<String> pStrings = new HashSet<String>(); public CombineFilter(Path p) { addPath(p); }
/** * Create a generic Hive RecordReader than can iterate over all chunks in a * CombinedFileSplit. */
Create a generic Hive RecordReader than can iterate over all chunks in a CombinedFileSplit
getRecordReader
{ "repo_name": "cschenyuan/hive-hack", "path": "ql/src/java/org/apache/hadoop/hive/ql/io/CombineHiveInputFormat.java", "license": "apache-2.0", "size": 29352 }
[ "java.io.IOException", "java.util.HashSet", "java.util.Set", "org.apache.hadoop.fs.Path", "org.apache.hadoop.fs.PathFilter", "org.apache.hadoop.hive.shims.ShimLoader", "org.apache.hadoop.mapred.InputSplit", "org.apache.hadoop.mapred.JobConf", "org.apache.hadoop.mapred.RecordReader", "org.apache.hadoop.mapred.Reporter", "org.apache.hadoop.mapred.lib.CombineFileSplit" ]
import java.io.IOException; import java.util.HashSet; import java.util.Set; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.PathFilter; import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.mapred.InputSplit; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.RecordReader; import org.apache.hadoop.mapred.Reporter; import org.apache.hadoop.mapred.lib.CombineFileSplit;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.shims.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.mapred.lib.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,140,077
public boolean isSelectedFix(CMnPatchFix fix) { boolean found = false; if ((selectedFixes != null) && (fix != null)) { Integer bugId = new Integer(fix.getBugId()); if (selectedFixes.indexOf(bugId) >= 0) { return true; } } return found; }
boolean function(CMnPatchFix fix) { boolean found = false; if ((selectedFixes != null) && (fix != null)) { Integer bugId = new Integer(fix.getBugId()); if (selectedFixes.indexOf(bugId) >= 0) { return true; } } return found; }
/** * Determine if the fix is currently selected. * * @param fix Fix in question * @return TRUE if the fix is selected */
Determine if the fix is currently selected
isSelectedFix
{ "repo_name": "ModelN/build-management", "path": "mn-build-webapp/src/main/java/com/modeln/build/ctrl/forms/CMnPatchFixForm.java", "license": "mit", "size": 43757 }
[ "com.modeln.build.common.data.product.CMnPatchFix" ]
import com.modeln.build.common.data.product.CMnPatchFix;
import com.modeln.build.common.data.product.*;
[ "com.modeln.build" ]
com.modeln.build;
1,559,016
public Future<BulkEntityIterable> downloadEntitiesAsync(DownloadParameters parameters, Progress<BulkOperationProgressInfo> progress, AsyncCallback<BulkEntityIterable> callback) { this.validateSubmitDownloadParameters(parameters.getSubmitDownloadParameters()); this.validateUserData(); return downloadEntitiesAsyncImpl(parameters, progress, callback); }
Future<BulkEntityIterable> function(DownloadParameters parameters, Progress<BulkOperationProgressInfo> progress, AsyncCallback<BulkEntityIterable> callback) { this.validateSubmitDownloadParameters(parameters.getSubmitDownloadParameters()); this.validateUserData(); return downloadEntitiesAsyncImpl(parameters, progress, callback); }
/** * Downloads the specified Bulk entities. * * @param parameters Determines the download entities and file path. If a file path is not specified in the download parameters, the enumerable of {@link BulkEntity} is read from a temporary file path designated at run time. * @param progress an object which is updated with the progress of a bulk operation * @param callback a callback to call with an {@link Iterable} of {@link BulkEntity} objects * * @return a Future indicating whether the operation has been completed */
Downloads the specified Bulk entities
downloadEntitiesAsync
{ "repo_name": "JeffRisberg/BING01", "path": "src/main/java/com/microsoft/bingads/bulk/BulkServiceManager.java", "license": "mit", "size": 29605 }
[ "com.microsoft.bingads.AsyncCallback", "java.util.concurrent.Future" ]
import com.microsoft.bingads.AsyncCallback; import java.util.concurrent.Future;
import com.microsoft.bingads.*; import java.util.concurrent.*;
[ "com.microsoft.bingads", "java.util" ]
com.microsoft.bingads; java.util;
300,509
List<AbstractFile> getAllFileObjects() { List<AbstractFile> ret = new ArrayList<>(); for (UnpackedNode child : rootNode.children) { getAllFileObjectsRec(ret, child); } return ret; }
List<AbstractFile> getAllFileObjects() { List<AbstractFile> ret = new ArrayList<>(); for (UnpackedNode child : rootNode.children) { getAllFileObjectsRec(ret, child); } return ret; }
/** * Get the all file objects (after createDerivedFiles() ) of this tree, * so that they can be rescheduled. * * @return all file objects of this unpacked tree */
Get the all file objects (after createDerivedFiles() ) of this tree, so that they can be rescheduled
getAllFileObjects
{ "repo_name": "narfindustries/autopsy", "path": "Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java", "license": "apache-2.0", "size": 45210 }
[ "java.util.ArrayList", "java.util.List", "org.sleuthkit.datamodel.AbstractFile" ]
import java.util.ArrayList; import java.util.List; import org.sleuthkit.datamodel.AbstractFile;
import java.util.*; import org.sleuthkit.datamodel.*;
[ "java.util", "org.sleuthkit.datamodel" ]
java.util; org.sleuthkit.datamodel;
1,695,166
public void setSaltGenerator(final SaltGenerator saltGenerator) { this.firstEncryptor.setSaltGenerator(saltGenerator); } /** * <p> * Sets the name of the security provider to be asked for the * encryption algorithm. This security provider has to be registered * beforehand at the JVM security framework. * </p> * <p> * The provider can also be set with the {@link #setProvider(Provider)}
void function(final SaltGenerator saltGenerator) { this.firstEncryptor.setSaltGenerator(saltGenerator); } /** * <p> * Sets the name of the security provider to be asked for the * encryption algorithm. This security provider has to be registered * beforehand at the JVM security framework. * </p> * <p> * The provider can also be set with the {@link #setProvider(Provider)}
/** * <p> * Sets the salt generator to be used. If no salt generator is specified, * an instance of {@link org.jasypt.salt.RandomSaltGenerator} will be used. * </p> * * @param saltGenerator the salt generator to be used. */
Sets the salt generator to be used. If no salt generator is specified, an instance of <code>org.jasypt.salt.RandomSaltGenerator</code> will be used.
setSaltGenerator
{ "repo_name": "Mark-Booth/daq-eclipse", "path": "uk.ac.diamond.org.apache.activemq/org/jasypt/encryption/pbe/PooledPBEBigIntegerEncryptor.java", "license": "epl-1.0", "size": 16412 }
[ "java.security.Provider", "org.jasypt.salt.SaltGenerator" ]
import java.security.Provider; import org.jasypt.salt.SaltGenerator;
import java.security.*; import org.jasypt.salt.*;
[ "java.security", "org.jasypt.salt" ]
java.security; org.jasypt.salt;
677,687
public List<FieldChange> removeEntriesFromGroup(List<BibEntry> entries) { if (getGroup() instanceof GroupEntryChanger) { return ((GroupEntryChanger) getGroup()).remove(entries); } else { return Collections.emptyList(); } }
List<FieldChange> function(List<BibEntry> entries) { if (getGroup() instanceof GroupEntryChanger) { return ((GroupEntryChanger) getGroup()).remove(entries); } else { return Collections.emptyList(); } }
/** * Removes the given entries from this group. If the group does not support the explicit removal of entries (i.e., * does not implement {@link GroupEntryChanger}), then no action is performed. */
Removes the given entries from this group. If the group does not support the explicit removal of entries (i.e., does not implement <code>GroupEntryChanger</code>), then no action is performed
removeEntriesFromGroup
{ "repo_name": "zellerdev/jabref", "path": "src/main/java/org/jabref/model/groups/GroupTreeNode.java", "license": "mit", "size": 11493 }
[ "java.util.Collections", "java.util.List", "org.jabref.model.FieldChange", "org.jabref.model.entry.BibEntry" ]
import java.util.Collections; import java.util.List; import org.jabref.model.FieldChange; import org.jabref.model.entry.BibEntry;
import java.util.*; import org.jabref.model.*; import org.jabref.model.entry.*;
[ "java.util", "org.jabref.model" ]
java.util; org.jabref.model;
1,891,820
@ApiModelProperty(example = "null", value = "") public List<MetaSubsection> getSubsections() { return subsections; }
@ApiModelProperty(example = "null", value = "") List<MetaSubsection> function() { return subsections; }
/** * Get subsections * @return subsections **/
Get subsections
getSubsections
{ "repo_name": "leanix/leanix-sdk-java", "path": "src/main/java/net/leanix/api/models/MetaSection.java", "license": "mit", "size": 4873 }
[ "io.swagger.annotations.ApiModelProperty", "java.util.List", "net.leanix.api.models.MetaSubsection" ]
import io.swagger.annotations.ApiModelProperty; import java.util.List; import net.leanix.api.models.MetaSubsection;
import io.swagger.annotations.*; import java.util.*; import net.leanix.api.models.*;
[ "io.swagger.annotations", "java.util", "net.leanix.api" ]
io.swagger.annotations; java.util; net.leanix.api;
969,173
private Cursor getTrackCursor( String[] projection, String selection, String[] selectionArgs, String sortOrder) { return contentResolver.query( TracksColumns.CONTENT_URI, projection, selection, selectionArgs, sortOrder); }
Cursor function( String[] projection, String selection, String[] selectionArgs, String sortOrder) { return contentResolver.query( TracksColumns.CONTENT_URI, projection, selection, selectionArgs, sortOrder); }
/** * Gets a track cursor. * * @param projection the projection * @param selection the selection * @param selectionArgs the selection arguments * @param sortOrder the sort oder */
Gets a track cursor
getTrackCursor
{ "repo_name": "AdaDeb/septracks", "path": "MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImpl.java", "license": "gpl-2.0", "size": 41273 }
[ "android.database.Cursor" ]
import android.database.Cursor;
import android.database.*;
[ "android.database" ]
android.database;
353,050
@Override public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); Args.notNull(origin, "Cookie origin"); final String host = origin.getHost().toLowerCase(Locale.ROOT); if (cookie.getDomain() == null) { throw new CookieRestrictionViolationException("Invalid cookie state: " + "domain not specified"); } final String cookieDomain = cookie.getDomain().toLowerCase(Locale.ROOT); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) { // Domain attribute must start with a dot if (!cookieDomain.startsWith(".")) { throw new CookieRestrictionViolationException("Domain attribute \"" + cookie.getDomain() + "\" violates RFC 2109: domain must start with a dot"); } // Domain attribute must contain at least one embedded dot, // or the value must be equal to .local. final int dotIndex = cookieDomain.indexOf('.', 1); if (((dotIndex < 0) || (dotIndex == cookieDomain.length() - 1)) && (!cookieDomain.equals(".local"))) { throw new CookieRestrictionViolationException( "Domain attribute \"" + cookie.getDomain() + "\" violates RFC 2965: the value contains no embedded dots " + "and the value is not .local"); } // The effective host name must domain-match domain attribute. if (!domainMatch(host, cookieDomain)) { throw new CookieRestrictionViolationException( "Domain attribute \"" + cookie.getDomain() + "\" violates RFC 2965: effective host name does not " + "domain-match domain attribute."); } // effective host name minus domain must not contain any dots final String effectiveHostWithoutDomain = host.substring( 0, host.length() - cookieDomain.length()); if (effectiveHostWithoutDomain.indexOf('.') != -1) { throw new CookieRestrictionViolationException("Domain attribute \"" + cookie.getDomain() + "\" violates RFC 2965: " + "effective host minus domain may not contain any dots"); } } else { // Domain was not specified in header. In this case, domain must // string match request host (case-insensitive). if (!cookie.getDomain().equals(host)) { throw new CookieRestrictionViolationException("Illegal domain attribute: \"" + cookie.getDomain() + "\"." + "Domain of origin: \"" + host + "\""); } } }
void function(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException { Args.notNull(cookie, STR); Args.notNull(origin, STR); final String host = origin.getHost().toLowerCase(Locale.ROOT); if (cookie.getDomain() == null) { throw new CookieRestrictionViolationException(STR + STR); } final String cookieDomain = cookie.getDomain().toLowerCase(Locale.ROOT); if (cookie instanceof ClientCookie && ((ClientCookie) cookie).containsAttribute(ClientCookie.DOMAIN_ATTR)) { if (!cookieDomain.startsWith(".")) { throw new CookieRestrictionViolationException(STRSTR\STR); } final int dotIndex = cookieDomain.indexOf('.', 1); if (((dotIndex < 0) (dotIndex == cookieDomain.length() - 1)) && (!cookieDomain.equals(STR))) { throw new CookieRestrictionViolationException( STRSTR\STR + STR); } if (!domainMatch(host, cookieDomain)) { throw new CookieRestrictionViolationException( STRSTR\STR + STR); } final String effectiveHostWithoutDomain = host.substring( 0, host.length() - cookieDomain.length()); if (effectiveHostWithoutDomain.indexOf('.') != -1) { throw new CookieRestrictionViolationException(STRSTR\STR + STR); } } else { if (!cookie.getDomain().equals(host)) { throw new CookieRestrictionViolationException(STRSTR\"." + STRSTR\""); } } }
/** * Validate cookie domain attribute. */
Validate cookie domain attribute
validate
{ "repo_name": "garymabin/YGOMobile", "path": "apache-async-http-HC4/src/org/apache/http/HC4/impl/cookie/RFC2965DomainAttributeHandler.java", "license": "mit", "size": 8198 }
[ "java.util.Locale", "org.apache.http.HC4" ]
import java.util.Locale; import org.apache.http.HC4;
import java.util.*; import org.apache.http.*;
[ "java.util", "org.apache.http" ]
java.util; org.apache.http;
1,551,330
private void createFromList(Polylist l) throws ThinklabException { Object[] def = l.array(); ArrayList<Restriction> restrictions = new ArrayList<Restriction>(); for (int i = 0; i < def.length; i++) { if (def[i] instanceof Polylist) { Polylist content = (Polylist)def[i]; if (content.length() == 2 && content.first().toString().toLowerCase().equals("id")) { id = content.second().toString(); } else if (content.length() == 2 && content.first().toString().toLowerCase().equals("description")) { description = content.second().toString(); } else if (content.length() == 2 && content.first().toString().toLowerCase().equals("kbox")) { kbox = content.second().toString(); } else { restrictions.add(Restriction.parseList(content)); } } else { if (concept != null) throw new ThinklabConstraintValidationException( "constraint: invalid token " + def[i] + "; concept has been already specified"); if (def[i] instanceof IConcept) concept = (IConcept)def[i]; else concept = KnowledgeManager.get().requireConcept(def[i].toString()); } } if (restrictions.size() == 1) body = restrictions.get(0); else if (restrictions.size() > 1) body = Restriction.AND(restrictions.toArray(new Restriction[restrictions.size()])); if (concept == null) { concept = KnowledgeManager.Thing(); } }
void function(Polylist l) throws ThinklabException { Object[] def = l.array(); ArrayList<Restriction> restrictions = new ArrayList<Restriction>(); for (int i = 0; i < def.length; i++) { if (def[i] instanceof Polylist) { Polylist content = (Polylist)def[i]; if (content.length() == 2 && content.first().toString().toLowerCase().equals("id")) { id = content.second().toString(); } else if (content.length() == 2 && content.first().toString().toLowerCase().equals(STR)) { description = content.second().toString(); } else if (content.length() == 2 && content.first().toString().toLowerCase().equals("kbox")) { kbox = content.second().toString(); } else { restrictions.add(Restriction.parseList(content)); } } else { if (concept != null) throw new ThinklabConstraintValidationException( STR + def[i] + STR); if (def[i] instanceof IConcept) concept = (IConcept)def[i]; else concept = KnowledgeManager.get().requireConcept(def[i].toString()); } } if (restrictions.size() == 1) body = restrictions.get(0); else if (restrictions.size() > 1) body = Restriction.AND(restrictions.toArray(new Restriction[restrictions.size()])); if (concept == null) { concept = KnowledgeManager.Thing(); } }
/** * Define constraint from a list. * @param l a Polylist with the constraint definition. * @throws ThinklabConstraintValidationException */
Define constraint from a list
createFromList
{ "repo_name": "Dana-Kath/thinklab", "path": "plugins/org.integratedmodelling.thinklab.core/src/org/integratedmodelling/thinklab/constraint/Constraint.java", "license": "gpl-3.0", "size": 16266 }
[ "java.util.ArrayList", "org.integratedmodelling.thinklab.KnowledgeManager", "org.integratedmodelling.thinklab.exception.ThinklabConstraintValidationException", "org.integratedmodelling.thinklab.exception.ThinklabException", "org.integratedmodelling.thinklab.interfaces.knowledge.IConcept", "org.integratedmodelling.utils.Polylist" ]
import java.util.ArrayList; import org.integratedmodelling.thinklab.KnowledgeManager; import org.integratedmodelling.thinklab.exception.ThinklabConstraintValidationException; import org.integratedmodelling.thinklab.exception.ThinklabException; import org.integratedmodelling.thinklab.interfaces.knowledge.IConcept; import org.integratedmodelling.utils.Polylist;
import java.util.*; import org.integratedmodelling.thinklab.*; import org.integratedmodelling.thinklab.exception.*; import org.integratedmodelling.thinklab.interfaces.knowledge.*; import org.integratedmodelling.utils.*;
[ "java.util", "org.integratedmodelling.thinklab", "org.integratedmodelling.utils" ]
java.util; org.integratedmodelling.thinklab; org.integratedmodelling.utils;
1,099,269
List<PrivilegedOperation> teardown() throws ResourceHandlerException;
List<PrivilegedOperation> teardown() throws ResourceHandlerException;
/** * Teardown environment for resource subsystem if requested. This method * needs to be used with care since it could impact running containers. * * @return (possibly empty) list of operations that require elevated * privileges */
Teardown environment for resource subsystem if requested. This method needs to be used with care since it could impact running containers
teardown
{ "repo_name": "NJUJYB/disYarn", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/ResourceHandler.java", "license": "apache-2.0", "size": 3298 }
[ "java.util.List", "org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperation" ]
import java.util.List; import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperation;
import java.util.*; import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
701,400