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
public ArrayList<Estudiante> darEstudiantes( ) throws DatosException { try { // // Crea el statement y el miniSQL de la operación IStatement statement = crearStatement( ); String operacion = "SELECT *"; // // Realiza la operación IResultado resultado = statement.ejecutarConsulta( operacion ); // // Cierra el statement antes de terminar statement.cerrar( ); // // Devuelve los estudiantes return cargarEstudiantes( resultado ); } catch( MiniDBCException e ) { throw new DatosException( "Error al agregar el estudiante: " + e.getMessage( ), e ); } }
ArrayList<Estudiante> function( ) throws DatosException { try { IStatement statement = crearStatement( ); String operacion = STR; IResultado resultado = statement.ejecutarConsulta( operacion ); statement.cerrar( ); return cargarEstudiantes( resultado ); } catch( MiniDBCException e ) { throw new DatosException( STR + e.getMessage( ), e ); } }
/** * Devuelve todos los estudiantes de la base de datos * @return Todos los estudiantes de la base de datos * @throws DatosException Excepción al cargar los estudiantes */
Devuelve todos los estudiantes de la base de datos
darEstudiantes
{ "repo_name": "vargax/ejemplos", "path": "java/apo/n16_colegioWeb/source/uniandes/cupi2/colegioweb/mundo/EstudianteDAO.java", "license": "gpl-2.0", "size": 11595 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,968,191
private boolean isGainBias(final double[] maxRad, final double[] minRad, List nominalRadVals) { double[] nominalGain = getNomGains(nominalRadVals, bandsPresent); double[] nominalLmin = getNomLmin(nominalRadVals, bandsPresent); if (getDistance(nominalGain, maxRad) < 0.5) { if (getDistance(nominalLmin, minRad) < 0.5) { return true; } } return false; }
boolean function(final double[] maxRad, final double[] minRad, List nominalRadVals) { double[] nominalGain = getNomGains(nominalRadVals, bandsPresent); double[] nominalLmin = getNomLmin(nominalRadVals, bandsPresent); if (getDistance(nominalGain, maxRad) < 0.5) { if (getDistance(nominalLmin, minRad) < 0.5) { return true; } } return false; }
/** * checks if the found data are with a big likelihood GAIN BIAS data * note! Lmin = BIAS * * @param maxRad the found value at the maxRad field * @param minRad the found value at the minRad fiedl * @param nominalRadVals * * @return <code>true</code> if the founded values are Gain Bias (Lmin) values <code>false</code> if the found data are not Gain/Bias values */
checks if the found data are with a big likelihood GAIN BIAS data note! Lmin = BIAS
isGainBias
{ "repo_name": "seadas/beam", "path": "beam-landsat-reader/src/main/java/org/esa/beam/dataio/landsat/RadiometricData.java", "license": "gpl-3.0", "size": 14872 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,505,868
public static Color getRepresentingColor(int id, int value){ if (colorlist[id][value] == null){ //if not in list, add it to the list colorlist[id][value] = new Color(); int colorInt; if (Block.getInstance(id,value, new Coordinate(0,0,0,false)).hasSides){ AtlasRegion texture = getBlockSprite(id, value, 1); if (texture == null) return new Color(); colorInt = getPixmap().getPixel( texture.getRegionX()+SCREEN_DEPTH2, texture.getRegionY()-SCREEN_DEPTH4); } else { AtlasRegion texture = getSprite(CATEGORY, id, value); if (texture == null) return new Color(); colorInt = getPixmap().getPixel( texture.getRegionX()+SCREEN_DEPTH2, texture.getRegionY()-SCREEN_DEPTH2); } Color.rgba8888ToColor(colorlist[id][value], colorInt); return colorlist[id][value]; } else return colorlist[id][value]; //return value when in list }
static Color function(int id, int value){ if (colorlist[id][value] == null){ colorlist[id][value] = new Color(); int colorInt; if (Block.getInstance(id,value, new Coordinate(0,0,0,false)).hasSides){ AtlasRegion texture = getBlockSprite(id, value, 1); if (texture == null) return new Color(); colorInt = getPixmap().getPixel( texture.getRegionX()+SCREEN_DEPTH2, texture.getRegionY()-SCREEN_DEPTH4); } else { AtlasRegion texture = getSprite(CATEGORY, id, value); if (texture == null) return new Color(); colorInt = getPixmap().getPixel( texture.getRegionX()+SCREEN_DEPTH2, texture.getRegionY()-SCREEN_DEPTH2); } Color.rgba8888ToColor(colorlist[id][value], colorInt); return colorlist[id][value]; } else return colorlist[id][value]; }
/** * Returns a color representing the block. Picks from the sprite sprite. * @param id id of the Block * @param value the value of the block. * @return a color representing the block */
Returns a color representing the block. Picks from the sprite sprite
getRepresentingColor
{ "repo_name": "odaymichael/Wurfel-Engine", "path": "com/BombingGames/EngineCore/Gameobjects/Block.java", "license": "bsd-3-clause", "size": 19560 }
[ "com.badlogic.gdx.graphics.Color", "com.badlogic.gdx.graphics.g2d.TextureAtlas" ]
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.graphics.g2d.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
718,735
private void storeDefaultContext(PrintWriter writer, int indent, DefaultContext dcontext) throws Exception { // Store the beginning of this element for (int i = 0; i < indent; i++) { writer.print(' '); } writer.print("<DefaultContext"); storeAttributes(writer, dcontext); writer.println(">"); // Store nested <InstanceListener> elements String iListeners[] = dcontext.findInstanceListeners(); for (int i = 0; i < iListeners.length; i++) { for (int j = 0; j < indent; j++) { writer.print(' '); } writer.print("<InstanceListener>"); writer.print(iListeners[i]); writer.println("</InstanceListener>"); } // Store nested <Listener> elements if (dcontext instanceof Lifecycle) { LifecycleListener listeners[] = ((Lifecycle) dcontext).findLifecycleListeners(); for (int i = 0; i < listeners.length; i++) { if (listeners[i].getClass().getName().equals (SERVER_LISTENER_CLASS_NAME)) { continue; } storeListener(writer, indent + 2, listeners[i]); } } // Store nested <Loader> element Loader loader = dcontext.getLoader(); if (loader != null) { storeLoader(writer, indent + 2, loader); } // Store nested <Logger> element // Store nested <Manager> element Manager manager = dcontext.getManager(); if (manager != null) { storeManager(writer, indent + 2, manager); } // Store nested <Parameter> elements ApplicationParameter[] appParams = dcontext.findApplicationParameters(); for (int i = 0; i < appParams.length; i++) { for (int j = 0; j < indent + 2; j++) { writer.print(' '); } writer.print("<Parameter"); storeAttributes(writer, false, appParams[i]); writer.println("/>"); } // Store nested <Realm> element // Store nested <Resources> element DirContext resources = dcontext.getResources(); if (resources != null) { storeResources(writer, indent + 2, resources); } // Store nested <Valve> elements if (dcontext instanceof Pipeline) { Valve valves[] = ((Pipeline) dcontext).getValves(); for (int i = 0; i < valves.length; i++) { storeValve(writer, indent + 2, valves[i]); } } // Store nested <WrapperLifecycle> elements String wLifecycles[] = dcontext.findWrapperLifecycles(); for (int i = 0; i < wLifecycles.length; i++) { for (int j = 0; j < indent; j++) { writer.print(' '); } writer.print("<WrapperLifecycle>"); writer.print(wLifecycles[i]); writer.println("</WrapperLifecycle>"); } // Store nested <WrapperListener> elements String wListeners[] = dcontext.findWrapperListeners(); for (int i = 0; i < wListeners.length; i++) { for (int j = 0; j < indent; j++) { writer.print(' '); } writer.print("<WrapperListener>"); writer.print(wListeners[i]); writer.println("</WrapperListener>"); } // Store nested naming resources elements NamingResources nresources = dcontext.getNamingResources(); if (nresources != null) { storeNamingResources(writer, indent + 2, nresources); } // Store the ending of this element for (int i = 0; i < indent; i++) { writer.print(' '); } writer.println("</DefaultContext>"); }
void function(PrintWriter writer, int indent, DefaultContext dcontext) throws Exception { for (int i = 0; i < indent; i++) { writer.print(' '); } writer.print(STR); storeAttributes(writer, dcontext); writer.println(">"); String iListeners[] = dcontext.findInstanceListeners(); for (int i = 0; i < iListeners.length; i++) { for (int j = 0; j < indent; j++) { writer.print(' '); } writer.print(STR); writer.print(iListeners[i]); writer.println(STR); } if (dcontext instanceof Lifecycle) { LifecycleListener listeners[] = ((Lifecycle) dcontext).findLifecycleListeners(); for (int i = 0; i < listeners.length; i++) { if (listeners[i].getClass().getName().equals (SERVER_LISTENER_CLASS_NAME)) { continue; } storeListener(writer, indent + 2, listeners[i]); } } Loader loader = dcontext.getLoader(); if (loader != null) { storeLoader(writer, indent + 2, loader); } Manager manager = dcontext.getManager(); if (manager != null) { storeManager(writer, indent + 2, manager); } ApplicationParameter[] appParams = dcontext.findApplicationParameters(); for (int i = 0; i < appParams.length; i++) { for (int j = 0; j < indent + 2; j++) { writer.print(' '); } writer.print(STR); storeAttributes(writer, false, appParams[i]); writer.println("/>"); } DirContext resources = dcontext.getResources(); if (resources != null) { storeResources(writer, indent + 2, resources); } if (dcontext instanceof Pipeline) { Valve valves[] = ((Pipeline) dcontext).getValves(); for (int i = 0; i < valves.length; i++) { storeValve(writer, indent + 2, valves[i]); } } String wLifecycles[] = dcontext.findWrapperLifecycles(); for (int i = 0; i < wLifecycles.length; i++) { for (int j = 0; j < indent; j++) { writer.print(' '); } writer.print(STR); writer.print(wLifecycles[i]); writer.println(STR); } String wListeners[] = dcontext.findWrapperListeners(); for (int i = 0; i < wListeners.length; i++) { for (int j = 0; j < indent; j++) { writer.print(' '); } writer.print(STR); writer.print(wListeners[i]); writer.println(STR); } NamingResources nresources = dcontext.getNamingResources(); if (nresources != null) { storeNamingResources(writer, indent + 2, nresources); } for (int i = 0; i < indent; i++) { writer.print(' '); } writer.println(STR); }
/** * Store the specified DefaultContext properties. * * @param writer PrintWriter to which we are storing * @param indent Number of spaces to indent this element * @param dcontext Object whose properties are being stored * * @exception Exception if an exception occurs while storing */
Store the specified DefaultContext properties
storeDefaultContext
{ "repo_name": "eclipsky/HowTomcatWorks", "path": "src/org/apache/catalina/core/StandardServer.java", "license": "apache-2.0", "size": 71859 }
[ "java.io.PrintWriter", "javax.naming.directory.DirContext", "org.apache.catalina.DefaultContext", "org.apache.catalina.Lifecycle", "org.apache.catalina.LifecycleListener", "org.apache.catalina.Loader", "org.apache.catalina.Manager", "org.apache.catalina.Pipeline", "org.apache.catalina.Valve", "org.apache.catalina.deploy.ApplicationParameter", "org.apache.catalina.deploy.NamingResources" ]
import java.io.PrintWriter; import javax.naming.directory.DirContext; import org.apache.catalina.DefaultContext; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Loader; import org.apache.catalina.Manager; import org.apache.catalina.Pipeline; import org.apache.catalina.Valve; import org.apache.catalina.deploy.ApplicationParameter; import org.apache.catalina.deploy.NamingResources;
import java.io.*; import javax.naming.directory.*; import org.apache.catalina.*; import org.apache.catalina.deploy.*;
[ "java.io", "javax.naming", "org.apache.catalina" ]
java.io; javax.naming; org.apache.catalina;
560,892
Observable<Page<Product>> getMultiplePagesFailureUriNextAsync(final String nextPageLink);
Observable<Page<Product>> getMultiplePagesFailureUriNextAsync(final String nextPageLink);
/** * A paging operation that receives an invalid nextLink. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @return the observable to the PagedList&lt;Product&gt; object */
A paging operation that receives an invalid nextLink
getMultiplePagesFailureUriNextAsync
{ "repo_name": "anudeepsharma/autorest", "path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/paging/Pagings.java", "license": "mit", "size": 49384 }
[ "com.microsoft.azure.Page" ]
import com.microsoft.azure.Page;
import com.microsoft.azure.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,846,390
public Application getApplication(){ return application; }
Application function(){ return application; }
/** * Get the {@link Application} to which this app state is attached. * @return the {@link Application} to which this app state is attached. * @see #getStateManager() */
Get the <code>Application</code> to which this app state is attached
getApplication
{ "repo_name": "atomixnmc/jmonkeyengine", "path": "jme3-vr/src/main/java/com/jme3/app/VRAppState.java", "license": "bsd-3-clause", "size": 24029 }
[ "com.jme3.app.Application" ]
import com.jme3.app.Application;
import com.jme3.app.*;
[ "com.jme3.app" ]
com.jme3.app;
2,426,418
MaterialRegistry<?> getMaterialRegistry();
MaterialRegistry<?> getMaterialRegistry();
/** * Gets the material registry for this world. * * @return The material registry */
Gets the material registry for this world
getMaterialRegistry
{ "repo_name": "Featherblade/VoxelGunsmith", "path": "src/main/java/com/voxelplugineering/voxelsniper/world/World.java", "license": "mit", "size": 4448 }
[ "com.voxelplugineering.voxelsniper.service.registry.MaterialRegistry" ]
import com.voxelplugineering.voxelsniper.service.registry.MaterialRegistry;
import com.voxelplugineering.voxelsniper.service.registry.*;
[ "com.voxelplugineering.voxelsniper" ]
com.voxelplugineering.voxelsniper;
1,277,367
public void setSelectorDrawable(int res) { mViewAbove.setSelectorBitmap(BitmapFactory.decodeResource(getResources(), res)); }
void function(int res) { mViewAbove.setSelectorBitmap(BitmapFactory.decodeResource(getResources(), res)); }
/** * Sets the selector drawable. * * @param res a resource ID for the selector drawable */
Sets the selector drawable
setSelectorDrawable
{ "repo_name": "eduardoweiland/doode-android", "path": "libs/SlidingMenu/src/com/slidingmenu/lib/SlidingMenu.java", "license": "gpl-3.0", "size": 25339 }
[ "android.graphics.BitmapFactory" ]
import android.graphics.BitmapFactory;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,859,279
public void setComparator(int column, Comparator<?> comparator) { checkColumn(column); if (comparators == null) { comparators = new Comparator[getModelWrapper().getColumnCount()]; } comparators[column] = comparator; }
void function(int column, Comparator<?> comparator) { checkColumn(column); if (comparators == null) { comparators = new Comparator[getModelWrapper().getColumnCount()]; } comparators[column] = comparator; }
/** * Sets the <code>Comparator</code> to use when sorting the specified * column. This does not trigger a sort. If you want to sort after * setting the comparator you need to explicitly invoke <code>sort</code>. * * @param column the index of the column the <code>Comparator</code> is * to be used for, in terms of the underlying model * @param comparator the <code>Comparator</code> to use * @throws IndexOutOfBoundsException if <code>column</code> is outside * the range of the underlying model */
Sets the <code>Comparator</code> to use when sorting the specified column. This does not trigger a sort. If you want to sort after setting the comparator you need to explicitly invoke <code>sort</code>
setComparator
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk/jdk/src/share/classes/javax/swing/DefaultRowSorter.java", "license": "mit", "size": 47549 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
955,430
Field getField();
Field getField();
/** * Returns the bean field where the annotation was found. * * @return the {@link Field}. * * @throws ClassCastException * if the bean member is not a field. */
Returns the bean field where the annotation was found
getField
{ "repo_name": "devent/globalpom-utils", "path": "globalpomutils-reflection/src/main/java/com/anrisoftware/globalpom/reflection/annotations/AnnotationBean.java", "license": "apache-2.0", "size": 2530 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,502,249
public ServiceCallConfigurationDefinition serviceChooser(ServiceChooser serviceChooser) { setServiceChooser(serviceChooser); return this; }
ServiceCallConfigurationDefinition function(ServiceChooser serviceChooser) { setServiceChooser(serviceChooser); return this; }
/** * Sets a custom {@link ServiceChooser} to use. */
Sets a custom <code>ServiceChooser</code> to use
serviceChooser
{ "repo_name": "lburgazzoli/apache-camel", "path": "camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java", "license": "apache-2.0", "size": 21269 }
[ "org.apache.camel.cloud.ServiceChooser" ]
import org.apache.camel.cloud.ServiceChooser;
import org.apache.camel.cloud.*;
[ "org.apache.camel" ]
org.apache.camel;
497,278
public boolean commit() { if (os != null) { unlock(); throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotClosed, ref)); } saveStatInformation(); if (lck.renameTo(ref)) return true; if (!ref.exists() || deleteRef()) if (renameLock()) return true; unlock(); return false; }
boolean function() { if (os != null) { unlock(); throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotClosed, ref)); } saveStatInformation(); if (lck.renameTo(ref)) return true; if (!ref.exists() deleteRef()) if (renameLock()) return true; unlock(); return false; }
/** * Commit this change and release the lock. * <p> * If this method fails (returns false) the lock is still released. * * @return true if the commit was successful and the file contains the new * data; false if the commit failed and the file remains with the * old data. * @throws IllegalStateException * the lock is not held. */
Commit this change and release the lock. If this method fails (returns false) the lock is still released
commit
{ "repo_name": "forge/plugin-undo", "path": "src/main/jgit/org/jboss/forge/jgit/storage/file/LockFile.java", "license": "epl-1.0", "size": 15406 }
[ "java.text.MessageFormat", "org.jboss.forge.jgit.internal.JGitText" ]
import java.text.MessageFormat; import org.jboss.forge.jgit.internal.JGitText;
import java.text.*; import org.jboss.forge.jgit.internal.*;
[ "java.text", "org.jboss.forge" ]
java.text; org.jboss.forge;
357,488
public BigDecimal getOvertimeAmt () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OvertimeAmt); if (bd == null) return Env.ZERO; return bd; }
BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OvertimeAmt); if (bd == null) return Env.ZERO; return bd; }
/** Get Overtime Amount. @return Hourly Overtime Rate */
Get Overtime Amount
getOvertimeAmt
{ "repo_name": "adempiere/adempiere", "path": "base/src/org/compiere/model/X_C_UserRemuneration.java", "license": "gpl-2.0", "size": 8136 }
[ "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;
2,260,809
public RefCounted<SolrIndexSearcher> getRegisteredSearcher() { synchronized (searcherLock) { if (_searcher != null) { _searcher.incref(); } return _searcher; } }
RefCounted<SolrIndexSearcher> function() { synchronized (searcherLock) { if (_searcher != null) { _searcher.incref(); } return _searcher; } }
/** * Returns the current registered searcher with its reference count incremented, or null if none are registered. */
Returns the current registered searcher with its reference count incremented, or null if none are registered
getRegisteredSearcher
{ "repo_name": "kankedong/solr_reading", "path": "solr/core/src/java/org/apache/solr/core/SolrCore.java", "license": "apache-2.0", "size": 92758 }
[ "org.apache.solr.search.SolrIndexSearcher", "org.apache.solr.util.RefCounted" ]
import org.apache.solr.search.SolrIndexSearcher; import org.apache.solr.util.RefCounted;
import org.apache.solr.search.*; import org.apache.solr.util.*;
[ "org.apache.solr" ]
org.apache.solr;
2,442,320
protected void setFooterEnabled(boolean enabled) { if (enabled) { if (mGridView.getFooterViewCount() == 0) { if (mGridFooterView.getParent() != null ) { ((ViewGroup) mGridFooterView.getParent()).removeView(mGridFooterView); } mGridView.addFooterView(mGridFooterView, null, false); } mGridFooterView.invalidate(); if (mListView.getFooterViewsCount() == 0) { if (mListFooterView.getParent() != null ) { ((ViewGroup) mListFooterView.getParent()).removeView(mListFooterView); } mListView.addFooterView(mListFooterView, null, false); } mListFooterView.invalidate(); } else { // mGridView.removeFooterView(mGridFooterView); // mListView.removeFooterView(mListFooterView); } }
void function(boolean enabled) { if (enabled) { if (mGridView.getFooterViewCount() == 0) { if (mGridFooterView.getParent() != null ) { ((ViewGroup) mGridFooterView.getParent()).removeView(mGridFooterView); } mGridView.addFooterView(mGridFooterView, null, false); } mGridFooterView.invalidate(); if (mListView.getFooterViewsCount() == 0) { if (mListFooterView.getParent() != null ) { ((ViewGroup) mListFooterView.getParent()).removeView(mListFooterView); } mListView.addFooterView(mListFooterView, null, false); } mListFooterView.invalidate(); } else { } }
/** * TODO doc * To be called before setAdapter, or GridViewWithHeaderAndFooter will throw an exception * * @param enabled */
TODO doc To be called before setAdapter, or GridViewWithHeaderAndFooter will throw an exception
setFooterEnabled
{ "repo_name": "Godine/android", "path": "src/com/owncloud/android/ui/fragment/ExtendedListFragment.java", "license": "gpl-2.0", "size": 14791 }
[ "android.view.ViewGroup" ]
import android.view.ViewGroup;
import android.view.*;
[ "android.view" ]
android.view;
785,244
public final static int getVersionCode() { try { PackageInfo pinfo = sApplication.getPackageManager().getPackageInfo(PACKAGE_NAME, 0); return pinfo.versionCode; } catch (android.content.pm.PackageManager.NameNotFoundException e) { Logger.logApplicationException(e, OfficeApplication.class.getSimpleName() + ".getVersionCode(): Failed."); } return 0; }
final static int function() { try { PackageInfo pinfo = sApplication.getPackageManager().getPackageInfo(PACKAGE_NAME, 0); return pinfo.versionCode; } catch (android.content.pm.PackageManager.NameNotFoundException e) { Logger.logApplicationException(e, OfficeApplication.class.getSimpleName() + STR); } return 0; }
/** * Retrieves application version code from manifest file. * * @return Application version code defined in manifest file, otherwise returns <code>0<code>. */
Retrieves application version code from manifest file
getVersionCode
{ "repo_name": "sujianping/Office-365-SDK-for-Android", "path": "samples/mail-calendar-contacts-app/demo-app/src/main/java/com/example/office/OfficeApplication.java", "license": "apache-2.0", "size": 5911 }
[ "android.content.pm.PackageInfo", "com.example.office.logger.Logger" ]
import android.content.pm.PackageInfo; import com.example.office.logger.Logger;
import android.content.pm.*; import com.example.office.logger.*;
[ "android.content", "com.example.office" ]
android.content; com.example.office;
1,435,345
public ApplicationGatewayUrlPathMap withDefaultBackendHttpSettings(SubResource defaultBackendHttpSettings) { this.defaultBackendHttpSettings = defaultBackendHttpSettings; return this; }
ApplicationGatewayUrlPathMap function(SubResource defaultBackendHttpSettings) { this.defaultBackendHttpSettings = defaultBackendHttpSettings; return this; }
/** * Set default backend http settings resource of URL path map. * * @param defaultBackendHttpSettings the defaultBackendHttpSettings value to set * @return the ApplicationGatewayUrlPathMap object itself. */
Set default backend http settings resource of URL path map
withDefaultBackendHttpSettings
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/ApplicationGatewayUrlPathMap.java", "license": "mit", "size": 6856 }
[ "com.microsoft.azure.SubResource" ]
import com.microsoft.azure.SubResource;
import com.microsoft.azure.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,251,704
//----------------------------------------------------------------------- public MetaProperty<Long> first() { return first; }
MetaProperty<Long> function() { return first; }
/** * The meta-property for the {@code first} property. * @return the meta-property, not null */
The meta-property for the first property
first
{ "repo_name": "OpenGamma/Strata", "path": "modules/collect/src/main/java/com/opengamma/strata/collect/tuple/LongDoublePair.java", "license": "apache-2.0", "size": 11868 }
[ "org.joda.beans.MetaProperty" ]
import org.joda.beans.MetaProperty;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
827,566
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); synchronized (session) { try { CopyOnWriteArrayList<User> users = USER_DAO.getAll(); session.setAttribute("users", users); } catch (DaoException daoExp) { LOG.error("problem with getting all users from dao users class {}", daoExp); } } this.doNotCashData(resp); this.printContent(req, resp); }
void function(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); synchronized (session) { try { CopyOnWriteArrayList<User> users = USER_DAO.getAll(); session.setAttribute("users", users); } catch (DaoException daoExp) { LOG.error(STR, daoExp); } } this.doNotCashData(resp); this.printContent(req, resp); }
/** * doGet method. * @param req request. * @param resp response. * @throws ServletException servlet exception. * @throws IOException input output exception. */
doGet method
doGet
{ "repo_name": "VardanMatevosyan/Vardan-Git-Repository", "path": "Servlet_JSP/musicPlatform/src/main/java/ru/matevosyan/controller/servlet/crud/DeleteServlet.java", "license": "apache-2.0", "size": 4960 }
[ "java.io.IOException", "java.util.concurrent.CopyOnWriteArrayList", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "javax.servlet.http.HttpSession", "ru.matevosyan.dao.DaoException", "ru.matevosyan.entity.User" ]
import java.io.IOException; import java.util.concurrent.CopyOnWriteArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import ru.matevosyan.dao.DaoException; import ru.matevosyan.entity.User;
import java.io.*; import java.util.concurrent.*; import javax.servlet.*; import javax.servlet.http.*; import ru.matevosyan.dao.*; import ru.matevosyan.entity.*;
[ "java.io", "java.util", "javax.servlet", "ru.matevosyan.dao", "ru.matevosyan.entity" ]
java.io; java.util; javax.servlet; ru.matevosyan.dao; ru.matevosyan.entity;
2,297,404
public static Echantillon beanToPojo(EchantillonBean bean) throws Exception { Echantillon pojo = new Echantillon(); Map<FormatDefinition, String> map = bean.getMapValues(); try { for (FormatDefinition key : map.keySet()) { String value = map.get(key); if (!value.isEmpty()) { pojo.setValue(key.toString(), value); } } pojo.setNotes(bean.getNotes()); } catch (Exception e) { LOGGER.error("ERREUR - l'echantillon est null en raison d'une erreur de parsing" + e.getMessage()); return null; } return pojo; }
static Echantillon function(EchantillonBean bean) throws Exception { Echantillon pojo = new Echantillon(); Map<FormatDefinition, String> map = bean.getMapValues(); try { for (FormatDefinition key : map.keySet()) { String value = map.get(key); if (!value.isEmpty()) { pojo.setValue(key.toString(), value); } } pojo.setNotes(bean.getNotes()); } catch (Exception e) { LOGGER.error(STR + e.getMessage()); return null; } return pojo; }
/** * pour chaque valeur du bean, mapping avec un attribut existant * * @param bean * @return */
pour chaque valeur du bean, mapping avec un attribut existant
beanToPojo
{ "repo_name": "Biobanques/ebiobanques-dataloader", "path": "src/main/java/fr/inserm/server/manager/EchantillonManager.java", "license": "lgpl-3.0", "size": 4260 }
[ "fr.inserm.bean.v2.EchantillonBean", "fr.inserm.bean.v2.FormatDefinition", "fr.inserm.server.model.Echantillon", "java.util.Map" ]
import fr.inserm.bean.v2.EchantillonBean; import fr.inserm.bean.v2.FormatDefinition; import fr.inserm.server.model.Echantillon; import java.util.Map;
import fr.inserm.bean.v2.*; import fr.inserm.server.model.*; import java.util.*;
[ "fr.inserm.bean", "fr.inserm.server", "java.util" ]
fr.inserm.bean; fr.inserm.server; java.util;
1,493,157
private StateModelDefinition getIncompleteStateModelDef(String modelName, String initialState, LinkedHashMap<String, Integer> states) { StateModelDefinition.Builder builder = new StateModelDefinition.Builder(StateModelDefId.from(modelName)); builder.initialState(State.from(initialState)); int i = 0; for (String state : states.keySet()) { builder.addState(State.from(state), i); builder.upperBound(State.from(state), states.get(state)); i++; } return builder.build(); } class AutoRebalanceTester { private static final double P_KILL = 0.45; private static final double P_ADD = 0.1; private static final double P_RESURRECT = 0.45; private static final String RESOURCE_NAME = "resource"; private List<String> _partitions; private LinkedHashMap<String, Integer> _states; private List<String> _liveNodes; private Set<String> _liveSet; private Set<String> _removedSet; private Set<String> _nonLiveSet; private Map<String, Map<String, String>> _currentMapping; private List<String> _allNodes; private int _maxPerNode; private StateModelDefinition _stateModelDef; private ReplicaPlacementScheme _placementScheme; private Random _random; public AutoRebalanceTester(List<String> partitions, LinkedHashMap<String, Integer> states, List<String> liveNodes, Map<String, Map<String, String>> currentMapping, List<String> allNodes, int maxPerNode, StateModelDefinition stateModelDef, ReplicaPlacementScheme placementScheme) { _partitions = partitions; _states = states; _liveNodes = liveNodes; _liveSet = new TreeSet<String>(); for (String node : _liveNodes) { _liveSet.add(node); } _removedSet = new TreeSet<String>(); _nonLiveSet = new TreeSet<String>(); _currentMapping = currentMapping; _allNodes = allNodes; for (String node : allNodes) { if (!_liveSet.contains(node)) { _nonLiveSet.add(node); } } _maxPerNode = maxPerNode; _stateModelDef = stateModelDef; _placementScheme = placementScheme; _random = new Random(); }
StateModelDefinition function(String modelName, String initialState, LinkedHashMap<String, Integer> states) { StateModelDefinition.Builder builder = new StateModelDefinition.Builder(StateModelDefId.from(modelName)); builder.initialState(State.from(initialState)); int i = 0; for (String state : states.keySet()) { builder.addState(State.from(state), i); builder.upperBound(State.from(state), states.get(state)); i++; } return builder.build(); } class AutoRebalanceTester { private static final double P_KILL = 0.45; private static final double P_ADD = 0.1; private static final double P_RESURRECT = 0.45; private static final String RESOURCE_NAME = STR; private List<String> _partitions; private LinkedHashMap<String, Integer> _states; private List<String> _liveNodes; private Set<String> _liveSet; private Set<String> _removedSet; private Set<String> _nonLiveSet; private Map<String, Map<String, String>> _currentMapping; private List<String> _allNodes; private int _maxPerNode; private StateModelDefinition _stateModelDef; private ReplicaPlacementScheme _placementScheme; private Random _random; public AutoRebalanceTester(List<String> partitions, LinkedHashMap<String, Integer> states, List<String> liveNodes, Map<String, Map<String, String>> currentMapping, List<String> allNodes, int maxPerNode, StateModelDefinition stateModelDef, ReplicaPlacementScheme placementScheme) { _partitions = partitions; _states = states; _liveNodes = liveNodes; _liveSet = new TreeSet<String>(); for (String node : _liveNodes) { _liveSet.add(node); } _removedSet = new TreeSet<String>(); _nonLiveSet = new TreeSet<String>(); _currentMapping = currentMapping; _allNodes = allNodes; for (String node : allNodes) { if (!_liveSet.contains(node)) { _nonLiveSet.add(node); } } _maxPerNode = maxPerNode; _stateModelDef = stateModelDef; _placementScheme = placementScheme; _random = new Random(); }
/** * Get a StateModelDefinition without transitions. The auto rebalancer doesn't take transitions * into account when computing mappings, so this is acceptable. * @param modelName name to give the model * @param initialState initial state for all nodes * @param states ordered map of state to count * @return incomplete StateModelDefinition for rebalancing */
Get a StateModelDefinition without transitions. The auto rebalancer doesn't take transitions into account when computing mappings, so this is acceptable
getIncompleteStateModelDef
{ "repo_name": "Teino1978-Corp/Teino1978-Corp-helix", "path": "helix-core/src/test/java/org/apache/helix/controller/strategy/TestAutoRebalanceStrategy.java", "license": "apache-2.0", "size": 37719 }
[ "java.util.LinkedHashMap", "java.util.List", "java.util.Map", "java.util.Random", "java.util.Set", "java.util.TreeSet", "org.apache.helix.api.State", "org.apache.helix.api.id.StateModelDefId", "org.apache.helix.controller.strategy.AutoRebalanceStrategy", "org.apache.helix.model.StateModelDefinition" ]
import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; import java.util.TreeSet; import org.apache.helix.api.State; import org.apache.helix.api.id.StateModelDefId; import org.apache.helix.controller.strategy.AutoRebalanceStrategy; import org.apache.helix.model.StateModelDefinition;
import java.util.*; import org.apache.helix.api.*; import org.apache.helix.api.id.*; import org.apache.helix.controller.strategy.*; import org.apache.helix.model.*;
[ "java.util", "org.apache.helix" ]
java.util; org.apache.helix;
2,817,250
private void isConnectionManaged(JSONArray args, CallbackContext callbackCtx) { callbackCtx.sendPluginResult(new PluginResult(PluginResult.Status.OK, _bluetooth.isConnectionManaged())); }
void function(JSONArray args, CallbackContext callbackCtx) { callbackCtx.sendPluginResult(new PluginResult(PluginResult.Status.OK, _bluetooth.isConnectionManaged())); }
/** * See if we have a managed connection active (allows read/write). * * @param args Arguments given. * @param callbackCtx Where to send results. */
See if we have a managed connection active (allows read/write)
isConnectionManaged
{ "repo_name": "nadavelyashiv/metal-finder-new", "path": "platforms/android/src/org/apache/cordova/bluetooth/BluetoothPlugin.java", "license": "mit", "size": 26410 }
[ "org.apache.cordova.CallbackContext", "org.apache.cordova.PluginResult", "org.json.JSONArray" ]
import org.apache.cordova.CallbackContext; import org.apache.cordova.PluginResult; import org.json.JSONArray;
import org.apache.cordova.*; import org.json.*;
[ "org.apache.cordova", "org.json" ]
org.apache.cordova; org.json;
2,851,513
public static RefreshRequest refreshRequest(String... indices) { return new RefreshRequest(indices); }
static RefreshRequest function(String... indices) { return new RefreshRequest(indices); }
/** * Creates a refresh indices request. * * @param indices The indices to refresh. Use <tt>null</tt> or <tt>_all</tt> to execute against all indices * @return The refresh request * @see org.elasticsearch.client.IndicesAdminClient#refresh(org.elasticsearch.action.admin.indices.refresh.RefreshRequest) */
Creates a refresh indices request
refreshRequest
{ "repo_name": "wayeast/elasticsearch", "path": "core/src/main/java/org/elasticsearch/client/Requests.java", "license": "apache-2.0", "size": 20980 }
[ "org.elasticsearch.action.admin.indices.refresh.RefreshRequest" ]
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.refresh.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,456,968
public static RelDataType deriveUncollectRowType(RelNode rel) { RelDataType inputType = rel.getRowType(); assert inputType.isStruct() : inputType + " is not a struct"; final List<RelDataTypeField> fields = inputType.getFieldList(); assert 1 == fields.size() : "expected 1 field"; RelDataType ret = fields.get(0).getType().getComponentType(); assert null != ret; if (!ret.isStruct()) { // Element type is not a record. It may be a scalar type, say // "INTEGER". Wrap it in a struct type. ret = rel.getCluster().getTypeFactory().builder() .add(SqlUtil.deriveAliasFromOrdinal(0), ret) .build(); } return ret; } }
static RelDataType function(RelNode rel) { RelDataType inputType = rel.getRowType(); assert inputType.isStruct() : inputType + STR; final List<RelDataTypeField> fields = inputType.getFieldList(); assert 1 == fields.size() : STR; RelDataType ret = fields.get(0).getType().getComponentType(); assert null != ret; if (!ret.isStruct()) { ret = rel.getCluster().getTypeFactory().builder() .add(SqlUtil.deriveAliasFromOrdinal(0), ret) .build(); } return ret; } }
/** * Returns the row type returned by applying the 'UNNEST' operation to a * relational expression. The relational expression must have precisely one * column, whose type must be a multiset of structs. The return type is the * type of that column. */
Returns the row type returned by applying the 'UNNEST' operation to a relational expression. The relational expression must have precisely one column, whose type must be a multiset of structs. The return type is the type of that column
deriveUncollectRowType
{ "repo_name": "YrAuYong/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/rel/core/Uncollect.java", "license": "apache-2.0", "size": 3842 }
[ "java.util.List", "org.apache.calcite.rel.RelNode", "org.apache.calcite.rel.type.RelDataType", "org.apache.calcite.rel.type.RelDataTypeField", "org.apache.calcite.sql.SqlUtil" ]
import java.util.List; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.sql.SqlUtil;
import java.util.*; import org.apache.calcite.rel.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.sql.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
1,737,850
public static void encodeFileToFile(String infile, String outfile) { String encoded = encodeFromFile(infile); OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(outfile)); out.write(encoded.getBytes("US-ASCII")); // Strict, 7-bit output. } catch (IOException e) { LOG.error("error encoding from file " + infile + " to " + outfile, e); } finally { if (out != null) { try { out.close(); } catch (Exception e) { LOG.error("error closing " + outfile, e); } } } // end finally } // end encodeFileToFile
static void function(String infile, String outfile) { String encoded = encodeFromFile(infile); OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(outfile)); out.write(encoded.getBytes(STR)); } catch (IOException e) { LOG.error(STR + infile + STR + outfile, e); } finally { if (out != null) { try { out.close(); } catch (Exception e) { LOG.error(STR + outfile, e); } } } }
/** * Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>. * * @param infile Input file * @param outfile Output file * @since 2.2 */
Reads infile and encodes it to outfile
encodeFileToFile
{ "repo_name": "amyvmiwei/hbase", "path": "hbase-common/src/main/java/org/apache/hadoop/hbase/util/Base64.java", "license": "apache-2.0", "size": 58936 }
[ "java.io.BufferedOutputStream", "java.io.FileOutputStream", "java.io.IOException", "java.io.OutputStream" ]
import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,900,772
public static int indexOfClasspathEntryContainer( IClasspathEntry[] classpathEntries, String containerId) { for (int i = 0; i < classpathEntries.length; ++i) { IClasspathEntry classpathEntry = classpathEntries[i]; if (classpathEntry.getEntryKind() != IClasspathEntry.CPE_CONTAINER) { // Skip anything that is not a container continue; } IPath containerPath = classpathEntry.getPath(); if (containerPath.segmentCount() > 0 && containerPath.segment(0).equals(containerId)) { return i; } } return -1; }
static int function( IClasspathEntry[] classpathEntries, String containerId) { for (int i = 0; i < classpathEntries.length; ++i) { IClasspathEntry classpathEntry = classpathEntries[i]; if (classpathEntry.getEntryKind() != IClasspathEntry.CPE_CONTAINER) { continue; } IPath containerPath = classpathEntry.getPath(); if (containerPath.segmentCount() > 0 && containerPath.segment(0).equals(containerId)) { return i; } } return -1; }
/** * Returns the first index of the specified * {@link IClasspathEntry#CPE_CONTAINER} entry with the specified container ID * or -1 if one could not be found. * * @param classpathEntries array of classpath entries * @param containerId container ID * @return index of the specified {@link IClasspathEntry#CPE_CONTAINER} entry * with the specified container ID or -1 */
Returns the first index of the specified <code>IClasspathEntry#CPE_CONTAINER</code> entry with the specified container ID or -1 if one could not be found
indexOfClasspathEntryContainer
{ "repo_name": "gwt-plugins/gwt-eclipse-plugin", "path": "plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/ClasspathUtilities.java", "license": "epl-1.0", "size": 18567 }
[ "org.eclipse.core.runtime.IPath", "org.eclipse.jdt.core.IClasspathEntry" ]
import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*;
[ "org.eclipse.core", "org.eclipse.jdt" ]
org.eclipse.core; org.eclipse.jdt;
1,190,915
public static Filter getFilter(Configuration conf) { return FilterCompat.get(getFilterPredicate(conf), getUnboundRecordFilterInstance(conf)); } private LruCache<FileStatusWrapper, FootersCacheValue> footersCache; private final Class<? extends ReadSupport<T>> readSupportClass; public ParquetInputFormat() { this.readSupportClass = null; } public <S extends ReadSupport<T>> ParquetInputFormat(Class<S> readSupportClass) { this.readSupportClass = readSupportClass; } /** * {@inheritDoc}
static Filter function(Configuration conf) { return FilterCompat.get(getFilterPredicate(conf), getUnboundRecordFilterInstance(conf)); } private LruCache<FileStatusWrapper, FootersCacheValue> footersCache; private final Class<? extends ReadSupport<T>> readSupportClass; public ParquetInputFormat() { this.readSupportClass = null; } public <S extends ReadSupport<T>> ParquetInputFormat(Class<S> readSupportClass) { this.readSupportClass = readSupportClass; } /** * {@inheritDoc}
/** * Returns a non-null Filter, which is a wrapper around either a * FilterPredicate, an UnboundRecordFilter, or a no-op filter. */
Returns a non-null Filter, which is a wrapper around either a FilterPredicate, an UnboundRecordFilter, or a no-op filter
getFilter
{ "repo_name": "davidgin/parquet-mr", "path": "parquet-hadoop/src/main/java/parquet/hadoop/ParquetInputFormat.java", "license": "apache-2.0", "size": 29883 }
[ "org.apache.hadoop.conf.Configuration" ]
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
662,797
private static String extractUUIDFromScspResponse(ScspResponse response) { String uuid = null; try { uuid = response.getResponseHeaders() .getHeaderValues("Content-UUID").get(0); } catch (Exception e) { logger .error("Could not extract the UUID from the SCSP response", e); logger.error(response.toString()); } return uuid; }
static String function(ScspResponse response) { String uuid = null; try { uuid = response.getResponseHeaders() .getHeaderValues(STR).get(0); } catch (Exception e) { logger .error(STR, e); logger.error(response.toString()); } return uuid; }
/** * Extract the object UUID from an SCSP response (e.g. an SCSP READ * response). * * @param response * The SCSP response which is expected to contain a UUID. * @return The extracted UUID, or <code>null</code> if extraction fails. */
Extract the object UUID from an SCSP response (e.g. an SCSP READ response)
extractUUIDFromScspResponse
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4jboss-all/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/hsm/module/castor/CAStorHSMModule.java", "license": "apache-2.0", "size": 26596 }
[ "com.caringo.client.ScspResponse" ]
import com.caringo.client.ScspResponse;
import com.caringo.client.*;
[ "com.caringo.client" ]
com.caringo.client;
1,623,951
public static double pointToLineDistance(LatLong L1, LatLong L2, LatLong P) { double A = P.getLatitude() - L1.getLatitude(); double B = P.getLongitude() - L1.getLongitude(); double C = L2.getLatitude() - L1.getLatitude(); double D = L2.getLongitude() - L1.getLongitude(); double dot = A * C + B * D; double len_sq = C * C + D * D; double param = dot / len_sq; double xx, yy; if (param < 0) // point behind the segment { xx = L1.getLatitude(); yy = L1.getLongitude(); } else if (param > 1) // point after the segment { xx = L2.getLatitude(); yy = L2.getLongitude(); } else { // point on the side of the segment xx = L1.getLatitude() + param * C; yy = L1.getLongitude() + param * D; } return Math.hypot(xx - P.getLatitude(), yy - P.getLongitude()); } public static class SplinePath { private static final String TAG = SplinePath.class.getSimpleName(); private final static int SPLINE_DECIMATION = 20;
static double function(LatLong L1, LatLong L2, LatLong P) { double A = P.getLatitude() - L1.getLatitude(); double B = P.getLongitude() - L1.getLongitude(); double C = L2.getLatitude() - L1.getLatitude(); double D = L2.getLongitude() - L1.getLongitude(); double dot = A * C + B * D; double len_sq = C * C + D * D; double param = dot / len_sq; double xx, yy; if (param < 0) { xx = L1.getLatitude(); yy = L1.getLongitude(); } else if (param > 1) { xx = L2.getLatitude(); yy = L2.getLongitude(); } else { xx = L1.getLatitude() + param * C; yy = L1.getLongitude() + param * D; } return Math.hypot(xx - P.getLatitude(), yy - P.getLongitude()); } public static class SplinePath { private static final String TAG = SplinePath.class.getSimpleName(); private final static int SPLINE_DECIMATION = 20;
/** * Provides the distance from a point P to the line segment that passes * through A-B. If the point is not on the side of the line, returns the * distance to the closest point * * @param L1 First point of the line * @param L2 Second point of the line * @param P Point to measure the distance * @return distance between point and line in meters. */
Provides the distance from a point P to the line segment that passes through A-B. If the point is not on the side of the line, returns the distance to the closest point
pointToLineDistance
{ "repo_name": "offbye/Tower", "path": "Android/src/com/o3dr/services/android/lib/util/MathUtils.java", "license": "gpl-3.0", "size": 15008 }
[ "com.o3dr.services.android.lib.coordinate.LatLong" ]
import com.o3dr.services.android.lib.coordinate.LatLong;
import com.o3dr.services.android.lib.coordinate.*;
[ "com.o3dr.services" ]
com.o3dr.services;
1,785,217
protected K standardCeilingKey(K key) { return keyOrNull(ceilingEntry(key)); }
K function(K key) { return keyOrNull(ceilingEntry(key)); }
/** * A sensible definition of {@link #ceilingKey} in terms of {@code ceilingEntry}. If you override * {@code ceilingEntry}, you may wish to override {@code ceilingKey} to forward to this * implementation. */
A sensible definition of <code>#ceilingKey</code> in terms of ceilingEntry. If you override ceilingEntry, you may wish to override ceilingKey to forward to this implementation
standardCeilingKey
{ "repo_name": "trivium-io/trivium-core", "path": "src/io/trivium/dep/com/google/common/collect/ForwardingNavigableMap.java", "license": "apache-2.0", "size": 13266 }
[ "io.trivium.dep.com.google.common.collect.Maps" ]
import io.trivium.dep.com.google.common.collect.Maps;
import io.trivium.dep.com.google.common.collect.*;
[ "io.trivium.dep" ]
io.trivium.dep;
2,467,194
public JRHyperlink getItemHyperlink();
JRHyperlink function();
/** * Returns the hyperlink specification for chart items. * <p> * The hyperlink will be evaluated for every chart item and an image map will be created for the chart. * </p> * * @return hyperlink specification for chart items */
Returns the hyperlink specification for chart items. The hyperlink will be evaluated for every chart item and an image map will be created for the chart.
getItemHyperlink
{ "repo_name": "MHTaleb/Encologim", "path": "lib/JasperReport/src/net/sf/jasperreports/charts/JRCategorySeries.java", "license": "gpl-3.0", "size": 2981 }
[ "net.sf.jasperreports.engine.JRHyperlink" ]
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.*;
[ "net.sf.jasperreports" ]
net.sf.jasperreports;
1,882,889
List<Resource<?>> listResources();
List<Resource<?>> listResources();
/** * Return a list of child resources of the current resource. (Never null.) */
Return a list of child resources of the current resource. (Never null.)
listResources
{ "repo_name": "jerr/jbossforge-core", "path": "resources/api/src/main/java/org/jboss/forge/addon/resource/Resource.java", "license": "epl-1.0", "size": 5616 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
787,667
public static boolean createAccount(Context context, OUser user) { AccountManager accountManager = AccountManager.get(context); Account account = new Account(user.getAndroidName(), KEY_ACCOUNT_TYPE); if (accountManager.addAccountExplicitly(account, String.valueOf(user.getPassword()), user.getAsBundle())) { OPreferenceManager pref = new OPreferenceManager(context); if (pref.getInt(userObjectKEY(user), 0) != OUser.USER_ACCOUNT_VERSION) { pref.putInt(userObjectKEY(user), OUser.USER_ACCOUNT_VERSION); } return true; } return false; }
static boolean function(Context context, OUser user) { AccountManager accountManager = AccountManager.get(context); Account account = new Account(user.getAndroidName(), KEY_ACCOUNT_TYPE); if (accountManager.addAccountExplicitly(account, String.valueOf(user.getPassword()), user.getAsBundle())) { OPreferenceManager pref = new OPreferenceManager(context); if (pref.getInt(userObjectKEY(user), 0) != OUser.USER_ACCOUNT_VERSION) { pref.putInt(userObjectKEY(user), OUser.USER_ACCOUNT_VERSION); } return true; } return false; }
/** * Creates Odoo account for app * * @param context * @param user user instance (OUser) * @return true, if account created successfully */
Creates Odoo account for app
createAccount
{ "repo_name": "js-superion/framework-master", "path": "app/src/main/java/com/odoo/core/auth/OdooAccountManager.java", "license": "agpl-3.0", "size": 8310 }
[ "android.accounts.Account", "android.accounts.AccountManager", "android.content.Context", "com.odoo.core.support.OUser", "com.odoo.core.utils.OPreferenceManager" ]
import android.accounts.Account; import android.accounts.AccountManager; import android.content.Context; import com.odoo.core.support.OUser; import com.odoo.core.utils.OPreferenceManager;
import android.accounts.*; import android.content.*; import com.odoo.core.support.*; import com.odoo.core.utils.*;
[ "android.accounts", "android.content", "com.odoo.core" ]
android.accounts; android.content; com.odoo.core;
2,005,929
@SuppressWarnings("unchecked") default Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) { Multimap<String, AttributeModifier> multimap = __superGetItemAttributeModifiers(equipmentSlot); if (equipmentSlot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", __getHitPower(), 0)); multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", __getAttackSpeed(), 0)); } return multimap; } // Modified Forge ItemTool methods
@SuppressWarnings(STR) default Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) { Multimap<String, AttributeModifier> multimap = __superGetItemAttributeModifiers(equipmentSlot); if (equipmentSlot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, STR, __getHitPower(), 0)); multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, STR, __getAttackSpeed(), 0)); } return multimap; }
/** * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage. */
Gets a map of item attribute modifiers, used by ItemSword to increase hit damage
getItemAttributeModifiers
{ "repo_name": "Skelril/Skree", "path": "src/main/java/com/skelril/nitro/registry/item/ICustomTool.java", "license": "mpl-2.0", "size": 5827 }
[ "com.google.common.collect.Multimap", "net.minecraft.entity.SharedMonsterAttributes", "net.minecraft.entity.ai.attributes.AttributeModifier", "net.minecraft.inventory.EntityEquipmentSlot" ]
import com.google.common.collect.Multimap; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.inventory.EntityEquipmentSlot;
import com.google.common.collect.*; import net.minecraft.entity.*; import net.minecraft.entity.ai.attributes.*; import net.minecraft.inventory.*;
[ "com.google.common", "net.minecraft.entity", "net.minecraft.inventory" ]
com.google.common; net.minecraft.entity; net.minecraft.inventory;
2,138,815
public void stop() { if (state == State.RECORDING) { aRecorder.stop(); try { fWriter.seek(4); // Write filesize to header fWriter.writeInt(Integer.reverseBytes(36 + payloadSize)); fWriter.seek(40); // Write payload size to header fWriter.writeInt(Integer.reverseBytes(payloadSize)); Log.d(TAG, "Stopped recording with payloadSize=" + payloadSize + ", was inserting? " + mIsInserting); // if we have been inserting, copy back the second part // of the file and correct the filesize values if (mIsInserting) { // copy back from second part File secondPart = new File(DICTATE_TEMP_PATH); File record = new File(fPath); appendFile(record, secondPart); // we should theoretically get current sizes easily from // our file writer int totalSize = (int) fWriter.length(); int fileSize = totalSize - 8; int dataSize = totalSize - 44; Log .i(TAG, "Appended file " + secondPart + " to record, totalSize=" + totalSize); fWriter.seek(4); // Write filesize to header fWriter.writeInt(Integer.reverseBytes(fileSize)); fWriter.seek(40); // Write payload size to header fWriter.writeInt(Integer.reverseBytes(dataSize)); // also correct the payloadSize member payloadSize = dataSize; } Log.i(TAG, "Stopped recording, total payloadsize=" + payloadSize); } catch (IOException e) { Log.e(TAG, "I/O exception occured writing to output file in stop()"); state = State.ERROR; } state = State.STOPPED; } else { Log.e(TAG, "stop() called on illegal state"); state = State.ERROR; } }
void function() { if (state == State.RECORDING) { aRecorder.stop(); try { fWriter.seek(4); fWriter.writeInt(Integer.reverseBytes(36 + payloadSize)); fWriter.seek(40); fWriter.writeInt(Integer.reverseBytes(payloadSize)); Log.d(TAG, STR + payloadSize + STR + mIsInserting); if (mIsInserting) { File secondPart = new File(DICTATE_TEMP_PATH); File record = new File(fPath); appendFile(record, secondPart); int totalSize = (int) fWriter.length(); int fileSize = totalSize - 8; int dataSize = totalSize - 44; Log .i(TAG, STR + secondPart + STR + totalSize); fWriter.seek(4); fWriter.writeInt(Integer.reverseBytes(fileSize)); fWriter.seek(40); fWriter.writeInt(Integer.reverseBytes(dataSize)); payloadSize = dataSize; } Log.i(TAG, STR + payloadSize); } catch (IOException e) { Log.e(TAG, STR); state = State.ERROR; } state = State.STOPPED; } else { Log.e(TAG, STR); state = State.ERROR; } }
/** * Stops the recording, and sets the state to STOPPED. In case of further usage, a reset is * needed. Also finalizes the wave file in case of uncompressed recording. */
Stops the recording, and sets the state to STOPPED. In case of further usage, a reset is needed. Also finalizes the wave file in case of uncompressed recording
stop
{ "repo_name": "mobilesec/auth-client-demo-module-voice", "path": "src/at/fhooe/mcm/smc/wav/WaveRecorder.java", "license": "lgpl-3.0", "size": 21835 }
[ "android.util.Log", "java.io.File", "java.io.IOException" ]
import android.util.Log; import java.io.File; import java.io.IOException;
import android.util.*; import java.io.*;
[ "android.util", "java.io" ]
android.util; java.io;
2,210,220
List<String> getLibraryCandidates(String aLibraryName, Long aMajorVersion) { final List<String> retval = new LinkedList<String>(); // Note: when done each of these variables must be set to a non-null, non // empty string array final String[] prefixes; final String[] suffixes; final String[] preSuffixVersions; final String[] postSuffixVersions; switch (getOS()) { case Unknown: case Linux: prefixes = new String[] { "lib", "" }; suffixes = new String[] { ".so" }; preSuffixVersions = new String[] { "" }; postSuffixVersions = (aMajorVersion == null ? new String[] { "" } : new String[] { "." + aMajorVersion.longValue() }); break; case Windows: prefixes = new String[] { "lib", "", "cyg" }; suffixes = new String[] { ".dll" }; preSuffixVersions = (aMajorVersion == null ? new String[] { "" } : new String[] { "-" + aMajorVersion.longValue() }); postSuffixVersions = new String[] { "" }; break; case MacOSX: prefixes = new String[] { "lib", "" }; suffixes = new String[] { ".dylib" }; preSuffixVersions = (aMajorVersion == null ? new String[] { "" } : new String[] { "." + aMajorVersion.longValue() }); postSuffixVersions = new String[] { "" }; break; default: // really no cases should get here prefixes = null; suffixes = null; preSuffixVersions = null; postSuffixVersions = null; break; } initializeSearchPaths(); // First check the versioned paths if (aMajorVersion != null) { for (String directory : mJavaPropPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, true); } for (String directory : mJavaEnvPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, true); } } for (String directory : mJavaPropPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, false); } for (String directory : mJavaEnvPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, false); } return retval; }
List<String> getLibraryCandidates(String aLibraryName, Long aMajorVersion) { final List<String> retval = new LinkedList<String>(); final String[] prefixes; final String[] suffixes; final String[] preSuffixVersions; final String[] postSuffixVersions; switch (getOS()) { case Unknown: case Linux: prefixes = new String[] { "lib", STR.soSTRSTRSTR.STRlibSTRSTRcygSTR.dllSTRSTR-STRSTRlib", STR.dylibSTRSTR.STR" }; break; default: prefixes = null; suffixes = null; preSuffixVersions = null; postSuffixVersions = null; break; } initializeSearchPaths(); if (aMajorVersion != null) { for (String directory : mJavaPropPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, true); } for (String directory : mJavaEnvPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, true); } } for (String directory : mJavaPropPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, false); } for (String directory : mJavaEnvPaths) { generateFileNames(retval, directory, aLibraryName, prefixes, suffixes, preSuffixVersions, postSuffixVersions, false); } return retval; }
/** * For a given library, and the OS we're running on, this method generates a * list of potential absolute file paths that * {@link #loadCandidateLibrary(String, Long, String[])} should attempt (in * order) to load. This method will not check for existence and readability of * the file we're attempting to load. * * @param aLibraryName * The library name * @param aMajorVersion * The version, or null if we don't care. * @return The set of absolute file paths to try. */
For a given library, and the OS we're running on, this method generates a list of potential absolute file paths that <code>#loadCandidateLibrary(String, Long, String[])</code> should attempt (in order) to load. This method will not check for existence and readability of the file we're attempting to load
getLibraryCandidates
{ "repo_name": "10045125/xuggle-xuggler", "path": "src/com/xuggle/ferry/JNILibraryLoader.java", "license": "gpl-3.0", "size": 22164 }
[ "java.util.LinkedList", "java.util.List" ]
import java.util.LinkedList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,211,480
public static <T> Iterator<T> toIterator(Collection<T> col) { if (col == null) return null; else return col.iterator(); }
static <T> Iterator<T> function(Collection<T> col) { if (col == null) return null; else return col.iterator(); }
/** * Get an iterator from a collection, returning null if collection is null * @param col The collection to be turned in to an iterator * @return The resulting Iterator */
Get an iterator from a collection, returning null if collection is null
toIterator
{ "repo_name": "yuri0x7c1/ofbiz-explorer", "path": "src/test/resources/apache-ofbiz-16.11.03/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java", "license": "apache-2.0", "size": 26421 }
[ "java.util.Collection", "java.util.Iterator" ]
import java.util.Collection; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
714,621
public java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> getInput_strings_HLPNStringHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI>(); for (Sort elemnt : getInput()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.strings.impl.HLPNStringImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI( (fr.lip6.move.pnml.hlpn.strings.HLPNString)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI>(); for (Sort elemnt : getInput()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.strings.impl.HLPNStringImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI( (fr.lip6.move.pnml.hlpn.strings.HLPNString)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of HLPNStringHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of HLPNStringHLAPI kind. WARNING : this method can creates a lot of new object in memory
getInput_strings_HLPNStringHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/finiteIntRanges/hlapi/LessThanOrEqualHLAPI.java", "license": "epl-1.0", "size": 108879 }
[ "fr.lip6.move.pnml.hlpn.terms.Sort", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Sort; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
914,936
@Property(order = 13, styleable = false) Point2D getLocation();
@Property(order = 13, styleable = false) Point2D getLocation();
/** * Gets the location of this plot in its parent plot. The origin of a plot is the bottom-left * corner of the content box (the intersect point of left axis and bottom axis). * For root plot, the returned value is always (0,0) * * @return an instance of <code>Point</code> representing the base point of this plot */
Gets the location of this plot in its parent plot. The origin of a plot is the bottom-left corner of the content box (the intersect point of left axis and bottom axis). For root plot, the returned value is always (0,0)
getLocation
{ "repo_name": "jplot2d/jplot2d", "path": "jplot2d-core/src/main/java/org/jplot2d/element/Plot.java", "license": "lgpl-3.0", "size": 13155 }
[ "java.awt.geom.Point2D", "org.jplot2d.annotation.Property" ]
import java.awt.geom.Point2D; import org.jplot2d.annotation.Property;
import java.awt.geom.*; import org.jplot2d.annotation.*;
[ "java.awt", "org.jplot2d.annotation" ]
java.awt; org.jplot2d.annotation;
1,837,158
public static List<URI> findResourcesBySuffix(String resourceLocation, String fileNameSuffix) throws IOException, URISyntaxException { return findResources(resourceLocation, path -> path.toString().endsWith(fileNameSuffix)); }
static List<URI> function(String resourceLocation, String fileNameSuffix) throws IOException, URISyntaxException { return findResources(resourceLocation, path -> path.toString().endsWith(fileNameSuffix)); }
/** * Search the specified location in classpath, and returns the resources with the specified suffix. */
Search the specified location in classpath, and returns the resources with the specified suffix
findResourcesBySuffix
{ "repo_name": "ServiceComb/java-chassis", "path": "foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/ResourceUtil.java", "license": "apache-2.0", "size": 3488 }
[ "java.io.IOException", "java.net.URISyntaxException", "java.util.List" ]
import java.io.IOException; import java.net.URISyntaxException; import java.util.List;
import java.io.*; import java.net.*; import java.util.*;
[ "java.io", "java.net", "java.util" ]
java.io; java.net; java.util;
1,097,058
public boolean satisfies(ExistentialQuantification f) { for (Constant a : this.domain) { Formula<RelationalAtom> fg = this.gop.groundFormula(f.getFormula(), a); if (this.satisfies(fg)) return true; } return false; }
boolean function(ExistentialQuantification f) { for (Constant a : this.domain) { Formula<RelationalAtom> fg = this.gop.groundFormula(f.getFormula(), a); if (this.satisfies(fg)) return true; } return false; }
/** * Checks whether an existentially quantified formula is satisfied. * @param f * Formula * @return true, if satisfied, false otherwise */
Checks whether an existentially quantified formula is satisfied
satisfies
{ "repo_name": "tbsflk/RelationalSystemZ", "path": "src/semantics/worlds/RelationalPossibleWorld.java", "license": "gpl-3.0", "size": 5106 }
[ "edu.cs.ai.log4KR.logical.syntax.Formula", "edu.cs.ai.log4KR.relational.classicalLogic.syntax.RelationalAtom", "edu.cs.ai.log4KR.relational.classicalLogic.syntax.signature.Constant" ]
import edu.cs.ai.log4KR.logical.syntax.Formula; import edu.cs.ai.log4KR.relational.classicalLogic.syntax.RelationalAtom; import edu.cs.ai.log4KR.relational.classicalLogic.syntax.signature.Constant;
import edu.cs.ai.*;
[ "edu.cs.ai" ]
edu.cs.ai;
2,397,642
@Test(enabled = false) public final void testLast() throws TTXPathException { final String query = "//b[last()]"; final String result = "<b xmlns:p=\"ns\" p:x=\"y\"><c/>bar</b>"; XPathStringChecker.testIAxisConventions(holder.getNRtx(), new XPathAxis(holder.getNRtx(), query), new String[] { result }); }
@Test(enabled = false) final void function() throws TTXPathException { final String query = STR<b xmlns:p=\"ns\" p:x=\"y\"><c/>bar</b>"; XPathStringChecker.testIAxisConventions(holder.getNRtx(), new XPathAxis(holder.getNRtx(), query), new String[] { result }); }
/** * Test function last(). * * @throws TTXPathException */
Test function last()
testLast
{ "repo_name": "sebastiangraf/treetank", "path": "interfacemodules/xml/src/test/java/org/treetank/service/xml/xpath/FunctionsTest.java", "license": "bsd-3-clause", "size": 17598 }
[ "org.testng.annotations.Test", "org.treetank.exception.TTXPathException" ]
import org.testng.annotations.Test; import org.treetank.exception.TTXPathException;
import org.testng.annotations.*; import org.treetank.exception.*;
[ "org.testng.annotations", "org.treetank.exception" ]
org.testng.annotations; org.treetank.exception;
447,175
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabContainer); tabLayout.setupWithViewPager(mViewPager); if (savedInstanceState != null) { FragmentManager fm = getSupportFragmentManager(); mFolderListFragment = (FolderListFragment) fm.getFragment( savedInstanceState, FolderListFragment.class.getName()); mDeviceListFragment = (DeviceListFragment) fm.getFragment( savedInstanceState, DeviceListFragment.class.getName()); mDrawerFragment = (DrawerFragment) fm.getFragment( savedInstanceState, DrawerFragment.class.getName()); mViewPager.setCurrentItem(savedInstanceState.getInt("currentTab")); } else { mFolderListFragment = new FolderListFragment(); mDeviceListFragment = new DeviceListFragment(); mDrawerFragment = new DrawerFragment(); } getSupportFragmentManager() .beginTransaction() .replace(R.id.drawer, mDrawerFragment) .commit(); mDrawerToggle = new Toggle(this, mDrawerLayout); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); mDrawerLayout.addDrawerListener(mDrawerToggle); setOptimalDrawerWidth(findViewById(R.id.drawer)); onNewIntent(getIntent()); }
void function(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabContainer); tabLayout.setupWithViewPager(mViewPager); if (savedInstanceState != null) { FragmentManager fm = getSupportFragmentManager(); mFolderListFragment = (FolderListFragment) fm.getFragment( savedInstanceState, FolderListFragment.class.getName()); mDeviceListFragment = (DeviceListFragment) fm.getFragment( savedInstanceState, DeviceListFragment.class.getName()); mDrawerFragment = (DrawerFragment) fm.getFragment( savedInstanceState, DrawerFragment.class.getName()); mViewPager.setCurrentItem(savedInstanceState.getInt(STR)); } else { mFolderListFragment = new FolderListFragment(); mDeviceListFragment = new DeviceListFragment(); mDrawerFragment = new DrawerFragment(); } getSupportFragmentManager() .beginTransaction() .replace(R.id.drawer, mDrawerFragment) .commit(); mDrawerToggle = new Toggle(this, mDrawerLayout); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); mDrawerLayout.addDrawerListener(mDrawerToggle); setOptimalDrawerWidth(findViewById(R.id.drawer)); onNewIntent(getIntent()); }
/** * Initializes tab navigation. */
Initializes tab navigation
onCreate
{ "repo_name": "wweich/syncthing-android", "path": "src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java", "license": "mpl-2.0", "size": 16063 }
[ "android.os.Bundle", "android.support.design.widget.TabLayout", "android.support.v4.app.FragmentManager", "android.support.v4.view.ViewPager", "android.support.v4.widget.DrawerLayout", "com.nutomic.syncthingandroid.fragments.DeviceListFragment", "com.nutomic.syncthingandroid.fragments.DrawerFragment", "com.nutomic.syncthingandroid.fragments.FolderListFragment" ]
import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.app.FragmentManager; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import com.nutomic.syncthingandroid.fragments.DeviceListFragment; import com.nutomic.syncthingandroid.fragments.DrawerFragment; import com.nutomic.syncthingandroid.fragments.FolderListFragment;
import android.os.*; import android.support.design.widget.*; import android.support.v4.app.*; import android.support.v4.view.*; import android.support.v4.widget.*; import com.nutomic.syncthingandroid.fragments.*;
[ "android.os", "android.support", "com.nutomic.syncthingandroid" ]
android.os; android.support; com.nutomic.syncthingandroid;
2,598,466
Optional<ResolvedIndex> resolveIndex(Session session, TableHandle tableHandle, Set<ColumnHandle> indexableColumns, Set<ColumnHandle> outputColumns, TupleDomain<ColumnHandle> tupleDomain);
Optional<ResolvedIndex> resolveIndex(Session session, TableHandle tableHandle, Set<ColumnHandle> indexableColumns, Set<ColumnHandle> outputColumns, TupleDomain<ColumnHandle> tupleDomain);
/** * Try to locate a table index that can lookup results by indexableColumns and provide the requested outputColumns. */
Try to locate a table index that can lookup results by indexableColumns and provide the requested outputColumns
resolveIndex
{ "repo_name": "stewartpark/presto", "path": "presto-main/src/main/java/com/facebook/presto/metadata/Metadata.java", "license": "apache-2.0", "size": 14812 }
[ "com.facebook.presto.Session", "com.facebook.presto.spi.ColumnHandle", "com.facebook.presto.spi.predicate.TupleDomain", "java.util.Optional", "java.util.Set" ]
import com.facebook.presto.Session; import com.facebook.presto.spi.ColumnHandle; import com.facebook.presto.spi.predicate.TupleDomain; import java.util.Optional; import java.util.Set;
import com.facebook.presto.*; import com.facebook.presto.spi.*; import com.facebook.presto.spi.predicate.*; import java.util.*;
[ "com.facebook.presto", "java.util" ]
com.facebook.presto; java.util;
38,118
protected void checkRange(int offset, int numberOfRows) { Preconditions.checkState(offset >= 0, MSG_OFFSET_MUST_BE_POSITIVE_INT); Preconditions.checkState(numberOfRows >= 0 && numberOfRows <= MAX_LIMIT, MSG_LIMIT_RANGE); }
void function(int offset, int numberOfRows) { Preconditions.checkState(offset >= 0, MSG_OFFSET_MUST_BE_POSITIVE_INT); Preconditions.checkState(numberOfRows >= 0 && numberOfRows <= MAX_LIMIT, MSG_LIMIT_RANGE); }
/** * Checks range of the limit when constructing. Throws IllegalStateException when range is invalid. */
Checks range of the limit when constructing. Throws IllegalStateException when range is invalid
checkRange
{ "repo_name": "chillenious/commons", "path": "jooq/src/main/java/com/chillenious/common/db/jooq/svc/Limit.java", "license": "mit", "size": 4546 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,277,815
public void setTravelDocumentService(final TravelDocumentService travelDocumentService) { this.travelDocumentService = travelDocumentService; }
void function(final TravelDocumentService travelDocumentService) { this.travelDocumentService = travelDocumentService; }
/** * Sets the travelDocumentService attribute. * * @return Returns the travelDocumentService. */
Sets the travelDocumentService attribute
setTravelDocumentService
{ "repo_name": "bhutchinson/kfs", "path": "kfs-tem/src/main/java/org/kuali/kfs/module/tem/document/web/struts/ReturnToFiscalOfficerQuestionHandler.java", "license": "agpl-3.0", "size": 7144 }
[ "org.kuali.kfs.module.tem.document.service.TravelDocumentService" ]
import org.kuali.kfs.module.tem.document.service.TravelDocumentService;
import org.kuali.kfs.module.tem.document.service.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
2,170,879
@SuppressWarnings({ "unchecked", "rawtypes" }) private AvroRecordBuilderFactory<E> buildAvroRecordBuilderFactory( Schema schema) { if (specific) { Class<E> specificClass; String className = schema.getFullName(); try { specificClass = (Class<E>) Class.forName(className); } catch (ClassNotFoundException e) { throw new DatasetException("Could not get Class instance for " + className); } return new SpecificAvroRecordBuilderFactory(specificClass); } else { return (AvroRecordBuilderFactory<E>) new GenericAvroRecordBuilderFactory( schema); } }
@SuppressWarnings({ STR, STR }) AvroRecordBuilderFactory<E> function( Schema schema) { if (specific) { Class<E> specificClass; String className = schema.getFullName(); try { specificClass = (Class<E>) Class.forName(className); } catch (ClassNotFoundException e) { throw new DatasetException(STR + className); } return new SpecificAvroRecordBuilderFactory(specificClass); } else { return (AvroRecordBuilderFactory<E>) new GenericAvroRecordBuilderFactory( schema); } }
/** * Build the appropriate AvroRecordBuilderFactory for this instance. Avro has * many different record types, of which we support two: Specific and Generic. * * @param schema * The Avro schema needed to construct the AvroRecordBuilderFactory. * @return The constructed AvroRecordBuilderFactory. */
Build the appropriate AvroRecordBuilderFactory for this instance. Avro has many different record types, of which we support two: Specific and Generic
buildAvroRecordBuilderFactory
{ "repo_name": "cloudera/cdk", "path": "cdk-data/cdk-data-hbase/src/main/java/com/cloudera/cdk/data/hbase/avro/AvroEntityComposer.java", "license": "apache-2.0", "size": 10470 }
[ "com.cloudera.cdk.data.DatasetException", "org.apache.avro.Schema" ]
import com.cloudera.cdk.data.DatasetException; import org.apache.avro.Schema;
import com.cloudera.cdk.data.*; import org.apache.avro.*;
[ "com.cloudera.cdk", "org.apache.avro" ]
com.cloudera.cdk; org.apache.avro;
2,387,390
private View getView(int resource, ViewGroup parent) { switch (resource) { case NO_RESOURCE: return null; case TEXT_VIEW_ITEM_RESOURCE: return new TextView(context); default: return inflater.inflate(resource, parent, false); } }
View function(int resource, ViewGroup parent) { switch (resource) { case NO_RESOURCE: return null; case TEXT_VIEW_ITEM_RESOURCE: return new TextView(context); default: return inflater.inflate(resource, parent, false); } }
/** * Loads view from resources * @param resource the resource Id * @return the loaded view or null if resource is not set */
Loads view from resources
getView
{ "repo_name": "CiLiNet-Android/AndroidProject-CndSteel_External", "path": "CndSteel_External/src/com/cndsteel/framework/views/dialogs/wheelpicker/adapters/AbstractWheelTextAdapter.java", "license": "apache-2.0", "size": 8141 }
[ "android.view.View", "android.view.ViewGroup", "android.widget.TextView" ]
import android.view.View; import android.view.ViewGroup; import android.widget.TextView;
import android.view.*; import android.widget.*;
[ "android.view", "android.widget" ]
android.view; android.widget;
1,779,233
public BufferedReader openBufferedStream() throws IOException { Reader reader = openStream(); return (reader instanceof BufferedReader) ? (BufferedReader) reader : new BufferedReader(reader); } /** * Appends the contents of this source to the given {@link Appendable} (such as a {@link Writer}). * Does not close {@code appendable} if it is {@code Closeable}. * * @throws IOException if an I/O error occurs in the process of reading from this source or * writing to {@code appendable}
BufferedReader function() throws IOException { Reader reader = openStream(); return (reader instanceof BufferedReader) ? (BufferedReader) reader : new BufferedReader(reader); } /** * Appends the contents of this source to the given {@link Appendable} (such as a {@link Writer}). * Does not close {@code appendable} if it is {@code Closeable}. * * @throws IOException if an I/O error occurs in the process of reading from this source or * writing to {@code appendable}
/** * Opens a new {@link BufferedReader} for reading from this source. This method should return a * new, independent reader each time it is called. * * <p>The caller is responsible for ensuring that the returned reader is closed. * * @throws IOException if an I/O error occurs in the process of opening the reader */
Opens a new <code>BufferedReader</code> for reading from this source. This method should return a new, independent reader each time it is called. The caller is responsible for ensuring that the returned reader is closed
openBufferedStream
{ "repo_name": "baratali/guava", "path": "guava/src/com/google/common/io/CharSource.java", "license": "apache-2.0", "size": 15119 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.Reader", "java.io.Writer" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
2,840,018
private void waitChangePoolMasterHost(Host master, Connection conn, String hostUuid) throws BadServerResponse, XenAPIException, XmlRpcException { int count = 0; while (hostUuid.equals(master.getUuid(conn))) { threadUtils.sleepThread(3); count++; if (count > 90) { throw new CloudRuntimeException(String.format("Could not shut down host [uuid=%s]; It was not possible to assign a new master to its pool", hostUuid)); } } }
void function(Host master, Connection conn, String hostUuid) throws BadServerResponse, XenAPIException, XmlRpcException { int count = 0; while (hostUuid.equals(master.getUuid(conn))) { threadUtils.sleepThread(3); count++; if (count > 90) { throw new CloudRuntimeException(String.format(STR, hostUuid)); } } }
/** * Waits until the master of the pool changes, given a total of 90 tries, * each taking 3 seconds of wait. */
Waits until the master of the pool changes, given a total of 90 tries, each taking 3 seconds of wait
waitChangePoolMasterHost
{ "repo_name": "rafaelweingartner/autonomiccs-platform", "path": "autonomic-administration-plugin/src/main/java/br/com/autonomiccs/autonomic/administration/plugin/hypervisors/xenserver/XenHypervisor.java", "license": "apache-2.0", "size": 8725 }
[ "com.cloud.utils.exception.CloudRuntimeException", "com.xensource.xenapi.Connection", "com.xensource.xenapi.Host", "com.xensource.xenapi.Types", "org.apache.xmlrpc.XmlRpcException" ]
import com.cloud.utils.exception.CloudRuntimeException; import com.xensource.xenapi.Connection; import com.xensource.xenapi.Host; import com.xensource.xenapi.Types; import org.apache.xmlrpc.XmlRpcException;
import com.cloud.utils.exception.*; import com.xensource.xenapi.*; import org.apache.xmlrpc.*;
[ "com.cloud.utils", "com.xensource.xenapi", "org.apache.xmlrpc" ]
com.cloud.utils; com.xensource.xenapi; org.apache.xmlrpc;
1,193,860
@GuardedBy("lock") private boolean startPendingStreams() { boolean hasStreamStarted = false; while (!pendingStreams.isEmpty() && streams.size() < maxConcurrentStreams) { OkHttpClientStream stream = pendingStreams.poll(); startStream(stream); hasStreamStarted = true; } return hasStreamStarted; }
@GuardedBy("lock") boolean function() { boolean hasStreamStarted = false; while (!pendingStreams.isEmpty() && streams.size() < maxConcurrentStreams) { OkHttpClientStream stream = pendingStreams.poll(); startStream(stream); hasStreamStarted = true; } return hasStreamStarted; }
/** * Starts pending streams, returns true if at least one pending stream is started. */
Starts pending streams, returns true if at least one pending stream is started
startPendingStreams
{ "repo_name": "louiscryan/grpc-java", "path": "okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java", "license": "bsd-3-clause", "size": 33535 }
[ "javax.annotation.concurrent.GuardedBy" ]
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.*;
[ "javax.annotation" ]
javax.annotation;
2,486,041
public List<LoanRescheduleRequestData> readLoanRescheduleRequests(Long loanId, Integer statusEnum);
List<LoanRescheduleRequestData> function(Long loanId, Integer statusEnum);
/** * get all loan reschedule requests filter by loan ID and status enum * * @param loanId * the loan identifier * @return list of LoanRescheduleRequestData objects **/
get all loan reschedule requests filter by loan ID and status enum
readLoanRescheduleRequests
{ "repo_name": "RanjithKumar5550/RanMifos", "path": "fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestReadPlatformService.java", "license": "apache-2.0", "size": 2257 }
[ "java.util.List", "org.apache.fineract.portfolio.loanaccount.rescheduleloan.data.LoanRescheduleRequestData" ]
import java.util.List; import org.apache.fineract.portfolio.loanaccount.rescheduleloan.data.LoanRescheduleRequestData;
import java.util.*; import org.apache.fineract.portfolio.loanaccount.rescheduleloan.data.*;
[ "java.util", "org.apache.fineract" ]
java.util; org.apache.fineract;
1,751,118
public void setActualEndTime(Date actualEndTime) { this.actualEndTime = actualEndTime; }
void function(Date actualEndTime) { this.actualEndTime = actualEndTime; }
/** * Set actual end time for message * * @param actualEndTime */
Set actual end time for message
setActualEndTime
{ "repo_name": "terrancesnyder/oozie-hadoop2", "path": "client/src/main/java/org/apache/oozie/client/event/message/SLAMessage.java", "license": "apache-2.0", "size": 9345 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
807,794
public void surfaceDestroyed(SurfaceHolder holder) { // Surface will be destroyed when we return mGLThread.surfaceDestroyed(); }
void function(SurfaceHolder holder) { mGLThread.surfaceDestroyed(); }
/** * This method is part of the SurfaceHolder.Callback interface, and is * not normally called or subclassed by clients of GLSurfaceView. */
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of GLSurfaceView
surfaceDestroyed
{ "repo_name": "simonkinghk/Nobuhaka", "path": "src/com/stickycoding/rokon/GLSurfaceView.java", "license": "bsd-3-clause", "size": 56589 }
[ "android.view.SurfaceHolder" ]
import android.view.SurfaceHolder;
import android.view.*;
[ "android.view" ]
android.view;
18,183
public PartitionResponse send(DistributedMember recipient, PartitionedRegion r) throws ForceReattemptException { //Assert.assertTrue(recipient != null, "PutAllPRMessage NULL recipient"); recipient can be null for event notifications Set recipients = Collections.singleton(recipient); PutAllResponse p = new PutAllResponse(r.getSystem(), recipients); initMessage(r, recipients, false, p); setTransactionDistributed(r.getCache().getTxManager().isDistributed()); if (logger.isDebugEnabled()) { logger.debug("PutAllPRMessage.send: recipient is {}, msg is {}", recipient, this); } Set failures =r.getDistributionManager().putOutgoing(this); if (failures != null && failures.size() > 0) { throw new ForceReattemptException("Failed sending <" + this + ">"); } return p; }
PartitionResponse function(DistributedMember recipient, PartitionedRegion r) throws ForceReattemptException { Set recipients = Collections.singleton(recipient); PutAllResponse p = new PutAllResponse(r.getSystem(), recipients); initMessage(r, recipients, false, p); setTransactionDistributed(r.getCache().getTxManager().isDistributed()); if (logger.isDebugEnabled()) { logger.debug(STR, recipient, this); } Set failures =r.getDistributionManager().putOutgoing(this); if (failures != null && failures.size() > 0) { throw new ForceReattemptException(STR + this + ">"); } return p; }
/** * Sends a PartitionedRegion PutAllPRMessage to the recipient * @param recipient the member to which the put message is sent * @param r the PartitionedRegion for which the put was performed * @return the processor used to await acknowledgement that the update was * sent, or null to indicate that no acknowledgement will be sent * @throws ForceReattemptException if the peer is no longer available */
Sends a PartitionedRegion PutAllPRMessage to the recipient
send
{ "repo_name": "nchandrappa/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/PutAllPRMessage.java", "license": "apache-2.0", "size": 33360 }
[ "com.gemstone.gemfire.distributed.DistributedMember", "com.gemstone.gemfire.internal.cache.ForceReattemptException", "com.gemstone.gemfire.internal.cache.PartitionedRegion", "java.util.Collections", "java.util.Set" ]
import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.internal.cache.ForceReattemptException; import com.gemstone.gemfire.internal.cache.PartitionedRegion; import java.util.Collections; import java.util.Set;
import com.gemstone.gemfire.distributed.*; import com.gemstone.gemfire.internal.cache.*; import java.util.*;
[ "com.gemstone.gemfire", "java.util" ]
com.gemstone.gemfire; java.util;
1,833,928
String getCommentsResourcePath(final Resource resource);
String getCommentsResourcePath(final Resource resource);
/** * Return the path to the comments resource for a resource. * @param resource The content resource, this is usually an entry. * @return The path to the comments resource or {@code null} if * the passed in content resource is not part of * Slingshot. */
Return the path to the comments resource for a resource
getCommentsResourcePath
{ "repo_name": "cleliameneghin/sling", "path": "samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/comments/CommentsService.java", "license": "apache-2.0", "size": 1693 }
[ "org.apache.sling.api.resource.Resource" ]
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.*;
[ "org.apache.sling" ]
org.apache.sling;
1,107,254
@Override public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase player, ItemStack is) { super.onBlockPlacedBy(world, i, j, k, player, is); TEBarrel teb = null; TileEntity te = world.getTileEntity(i, j, k); if (te != null && is.hasTagCompound() && te instanceof TEBarrel) { teb = (TEBarrel) te; teb.readFromItemNBT(is.getTagCompound()); world.markBlockForUpdate(i, j, k); } }
void function(World world, int i, int j, int k, EntityLivingBase player, ItemStack is) { super.onBlockPlacedBy(world, i, j, k, player, is); TEBarrel teb = null; TileEntity te = world.getTileEntity(i, j, k); if (te != null && is.hasTagCompound() && te instanceof TEBarrel) { teb = (TEBarrel) te; teb.readFromItemNBT(is.getTagCompound()); world.markBlockForUpdate(i, j, k); } }
/** * Called when the block is placed in the world. */
Called when the block is placed in the world
onBlockPlacedBy
{ "repo_name": "VegasGoat/TFCraft", "path": "src/Common/com/bioxx/tfc/Blocks/Devices/BlockBarrel.java", "license": "gpl-3.0", "size": 16796 }
[ "com.bioxx.tfc.TileEntities", "net.minecraft.entity.EntityLivingBase", "net.minecraft.item.ItemStack", "net.minecraft.tileentity.TileEntity", "net.minecraft.world.World" ]
import com.bioxx.tfc.TileEntities; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World;
import com.bioxx.tfc.*; import net.minecraft.entity.*; import net.minecraft.item.*; import net.minecraft.tileentity.*; import net.minecraft.world.*;
[ "com.bioxx.tfc", "net.minecraft.entity", "net.minecraft.item", "net.minecraft.tileentity", "net.minecraft.world" ]
com.bioxx.tfc; net.minecraft.entity; net.minecraft.item; net.minecraft.tileentity; net.minecraft.world;
667,397
@SuppressWarnings("unchecked") public static HashMap<String, BigDecimal> sortByValue(HashMap<String, BigDecimal> map, final int order) { List list = new LinkedList(map.entrySet()); Collections.sort(list, new Comparator() {
@SuppressWarnings(STR) static HashMap<String, BigDecimal> function(HashMap<String, BigDecimal> map, final int order) { List list = new LinkedList(map.entrySet()); Collections.sort(list, new Comparator() {
/** * Sort HashMap into increasing (order=1) or decreasing (order=0) order * @param map * @param order * @return HashMap<String, BigDecimal> */
Sort HashMap into increasing (order=1) or decreasing (order=0) order
sortByValue
{ "repo_name": "devgeekco/wow", "path": "src/devgeek/expense/algo/GroupDistAlgo.java", "license": "mit", "size": 6862 }
[ "java.math.BigDecimal", "java.util.Collections", "java.util.Comparator", "java.util.HashMap", "java.util.LinkedList", "java.util.List" ]
import java.math.BigDecimal; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedList; import java.util.List;
import java.math.*; import java.util.*;
[ "java.math", "java.util" ]
java.math; java.util;
25,578
JarFile createBootProxyJar() throws IOException { File dataFile = bundleContext.getDataFile("boot-proxy.jar"); // Create the file if it doesn't already exist if (!dataFile.exists()) { dataFile.createNewFile(); } // Generate a manifest Manifest manifest = createBootJarManifest(); // Create the file FileOutputStream fileOutputStream = new FileOutputStream(dataFile, false); JarOutputStream jarOutputStream = new JarOutputStream(fileOutputStream, manifest); // Add the jar path entries to reduce class load times createDirectoryEntries(jarOutputStream, BOOT_DELEGATED_PACKAGE); // Map the template classes into the delegation package and add to the jar Bundle bundle = bundleContext.getBundle(); Enumeration<?> entryPaths = bundle.getEntryPaths(TEMPLATE_CLASSES_PATH); if (entryPaths != null) { while (entryPaths.hasMoreElements()) { URL sourceClassResource = bundle.getEntry((String) entryPaths.nextElement()); if (sourceClassResource != null) writeRemappedClass(sourceClassResource, jarOutputStream, BOOT_DELEGATED_PACKAGE); } } jarOutputStream.close(); fileOutputStream.close(); return new JarFile(dataFile); }
JarFile createBootProxyJar() throws IOException { File dataFile = bundleContext.getDataFile(STR); if (!dataFile.exists()) { dataFile.createNewFile(); } Manifest manifest = createBootJarManifest(); FileOutputStream fileOutputStream = new FileOutputStream(dataFile, false); JarOutputStream jarOutputStream = new JarOutputStream(fileOutputStream, manifest); createDirectoryEntries(jarOutputStream, BOOT_DELEGATED_PACKAGE); Bundle bundle = bundleContext.getBundle(); Enumeration<?> entryPaths = bundle.getEntryPaths(TEMPLATE_CLASSES_PATH); if (entryPaths != null) { while (entryPaths.hasMoreElements()) { URL sourceClassResource = bundle.getEntry((String) entryPaths.nextElement()); if (sourceClassResource != null) writeRemappedClass(sourceClassResource, jarOutputStream, BOOT_DELEGATED_PACKAGE); } } jarOutputStream.close(); fileOutputStream.close(); return new JarFile(dataFile); }
/** * Create a jar file that contains the proxy code that will live in the * boot delegation package. * * @return the jar file containing the proxy code to append to the boot * class path * * @throws IOException if a file I/O error occurs */
Create a jar file that contains the proxy code that will live in the boot delegation package
createBootProxyJar
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java", "license": "epl-1.0", "size": 17648 }
[ "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.util.Enumeration", "java.util.jar.JarFile", "java.util.jar.JarOutputStream", "java.util.jar.Manifest", "org.osgi.framework.Bundle" ]
import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Enumeration; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; import org.osgi.framework.Bundle;
import java.io.*; import java.util.*; import java.util.jar.*; import org.osgi.framework.*;
[ "java.io", "java.util", "org.osgi.framework" ]
java.io; java.util; org.osgi.framework;
2,674,997
public void addExtension(MessageSetMessageExtension ext) { String control = PropertyLoader.loadProperty(ext.getControl()); if (!super.childrenMap.containsKey(control)) { ControlNode cNode = new ControlNode(control); super.childrenMap.put(control, cNode); } ControlNode controlNode = (ControlNode) super.childrenMap.get(control); controlNode.addExtension(ext); }
void function(MessageSetMessageExtension ext) { String control = PropertyLoader.loadProperty(ext.getControl()); if (!super.childrenMap.containsKey(control)) { ControlNode cNode = new ControlNode(control); super.childrenMap.put(control, cNode); } ControlNode controlNode = (ControlNode) super.childrenMap.get(control); controlNode.addExtension(ext); }
/** * Adds a Work Item extesnsion to the tree * * @param ext * extension to be added */
Adds a Work Item extesnsion to the tree
addExtension
{ "repo_name": "NABUCCO/org.nabucco.framework.base", "path": "org.nabucco.framework.base.ui.web/src/main/man/org/nabucco/framework/base/ui/web/component/messageset/ControlTypeNode.java", "license": "epl-1.0", "size": 2181 }
[ "org.nabucco.framework.base.facade.datatype.extension.property.PropertyLoader", "org.nabucco.framework.base.facade.datatype.extension.schema.ui.messageset.MessageSetMessageExtension" ]
import org.nabucco.framework.base.facade.datatype.extension.property.PropertyLoader; import org.nabucco.framework.base.facade.datatype.extension.schema.ui.messageset.MessageSetMessageExtension;
import org.nabucco.framework.base.facade.datatype.extension.property.*; import org.nabucco.framework.base.facade.datatype.extension.schema.ui.messageset.*;
[ "org.nabucco.framework" ]
org.nabucco.framework;
1,571,164
void resetVersion(boolean renewCheckpointTime) throws IOException { this.layoutVersion = FSConstants.LAYOUT_VERSION; if(renewCheckpointTime) this.checkpointTime = FSNamesystem.now(); ArrayList<StorageDirectory> al = null; for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); // delete old edits if sd is the image only the directory if (!sd.getStorageDirType().isOfType(NameNodeDirType.EDITS)) { File editsFile = getImageFile(sd, NameNodeFile.EDITS); if(editsFile.exists() && !editsFile.delete()) throw new IOException("Cannot delete edits file " + editsFile.getCanonicalPath()); } // delete old fsimage if sd is the edits only the directory if (!sd.getStorageDirType().isOfType(NameNodeDirType.IMAGE)) { File imageFile = getImageFile(sd, NameNodeFile.IMAGE); if(imageFile.exists() && !imageFile.delete()) throw new IOException("Cannot delete image file " + imageFile.getCanonicalPath()); } try { sd.write(); } catch (IOException e) { LOG.error("Cannot write file " + sd.getRoot(), e); if(al == null) al = new ArrayList<StorageDirectory> (1); al.add(sd); } } if(al != null) processIOError(al, true); ckptState = FSImage.CheckpointStates.START; }
void resetVersion(boolean renewCheckpointTime) throws IOException { this.layoutVersion = FSConstants.LAYOUT_VERSION; if(renewCheckpointTime) this.checkpointTime = FSNamesystem.now(); ArrayList<StorageDirectory> al = null; for (Iterator<StorageDirectory> it = dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); if (!sd.getStorageDirType().isOfType(NameNodeDirType.EDITS)) { File editsFile = getImageFile(sd, NameNodeFile.EDITS); if(editsFile.exists() && !editsFile.delete()) throw new IOException(STR + editsFile.getCanonicalPath()); } if (!sd.getStorageDirType().isOfType(NameNodeDirType.IMAGE)) { File imageFile = getImageFile(sd, NameNodeFile.IMAGE); if(imageFile.exists() && !imageFile.delete()) throw new IOException(STR + imageFile.getCanonicalPath()); } try { sd.write(); } catch (IOException e) { LOG.error(STR + sd.getRoot(), e); if(al == null) al = new ArrayList<StorageDirectory> (1); al.add(sd); } } if(al != null) processIOError(al, true); ckptState = FSImage.CheckpointStates.START; }
/** * Updates version and fstime files in all directories (fsimage and edits). */
Updates version and fstime files in all directories (fsimage and edits)
resetVersion
{ "repo_name": "toddlipcon/hadoop", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java", "license": "apache-2.0", "size": 67265 }
[ "java.io.File", "java.io.IOException", "java.util.ArrayList", "java.util.Iterator", "org.apache.hadoop.hdfs.protocol.FSConstants" ]
import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import org.apache.hadoop.hdfs.protocol.FSConstants;
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
852,843
public JsonObject createProblem(String code, String name) throws ClientException, ConnectionException { return createProblem(code, name, "", "binary", false, 1001); }
JsonObject function(String code, String name) throws ClientException, ConnectionException { return createProblem(code, name, STRbinary", false, 1001); }
/** * Create a new not interactive binary empty problem for masterjudge = 1001 * * @param {string} code - Problem code * @param {string} name - Problem name * @throws NotAuthorizedException for invalid access token * @throws BadRequestException for empty problem code * @throws BadRequestException for empty problem name * @throws BadRequestException for not unique problem code * @throws BadRequestException for invalid problem code * @throws ClientException * @throws ConnectionException * @return API response */
Create a new not interactive binary empty problem for masterjudge = 1001
createProblem
{ "repo_name": "sphere-engine/java-client", "path": "src/com/SphereEngine/Api/ProblemsClientV3.java", "license": "apache-2.0", "size": 46337 }
[ "com.google.gson.JsonObject" ]
import com.google.gson.JsonObject;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
2,243,625
public GridCacheMvccCandidate addNearLocal(GridCacheEntryEx parent, UUID nodeId, @Nullable UUID otherNodeId, long threadId, GridCacheVersion ver, boolean tx, boolean implicitSingle, boolean read) { GridCacheMvccCandidate cand = new GridCacheMvccCandidate(parent, nodeId, otherNodeId, null, threadId, ver, true, false, tx, implicitSingle, true, false, null, read); add0(cand); return cand; }
GridCacheMvccCandidate function(GridCacheEntryEx parent, UUID nodeId, @Nullable UUID otherNodeId, long threadId, GridCacheVersion ver, boolean tx, boolean implicitSingle, boolean read) { GridCacheMvccCandidate cand = new GridCacheMvccCandidate(parent, nodeId, otherNodeId, null, threadId, ver, true, false, tx, implicitSingle, true, false, null, read); add0(cand); return cand; }
/** * Adds new near local lock candidate. * * @param parent Parent entry. * @param nodeId Node ID. * @param otherNodeId Other node ID. * @param threadId Thread ID. * @param ver Lock version. * @param tx Transaction flag. * @param implicitSingle Implicit flag. * @param read Read lock flag. * @return Add remote candidate. */
Adds new near local lock candidate
addNearLocal
{ "repo_name": "irudyak/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java", "license": "apache-2.0", "size": 47067 }
[ "org.apache.ignite.internal.processors.cache.version.GridCacheVersion", "org.jetbrains.annotations.Nullable" ]
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.jetbrains.annotations.Nullable;
import org.apache.ignite.internal.processors.cache.version.*; import org.jetbrains.annotations.*;
[ "org.apache.ignite", "org.jetbrains.annotations" ]
org.apache.ignite; org.jetbrains.annotations;
2,391,962
public DatagramChannel getChannel() { return null; } static DatagramSocketImplFactory factory;
DatagramChannel function() { return null; } static DatagramSocketImplFactory factory;
/** * Returns the unique {@link java.nio.channels.DatagramChannel} object * associated with this datagram socket, if any. * * <p> A datagram socket will have a channel if, and only if, the channel * itself was created via the {@link java.nio.channels.DatagramChannel#open * DatagramChannel.open} method. * * @return the datagram channel associated with this datagram socket, * or <tt>null</tt> if this socket was not created for a channel * * @since 1.4 * @spec JSR-51 */
Returns the unique <code>java.nio.channels.DatagramChannel</code> object associated with this datagram socket, if any. A datagram socket will have a channel if, and only if, the channel itself was created via the <code>java.nio.channels.DatagramChannel#open DatagramChannel.open</code> method
getChannel
{ "repo_name": "jgaltidor/VarJ", "path": "analyzed_libs/jdk1.6.0_06_src/java/net/DatagramSocket.java", "license": "mit", "size": 42137 }
[ "java.nio.channels.DatagramChannel" ]
import java.nio.channels.DatagramChannel;
import java.nio.channels.*;
[ "java.nio" ]
java.nio;
580,339
private int onStartEscapeSequence(String sql, StringBuffer sb, int i) throws SQLException { sb.setCharAt(i++, ' '); i = StringUtil.skipSpaces(sql, i); if (sql.regionMatches(true, i, "fn ", 0, 3) || sql.regionMatches(true, i, "oj ", 0, 3) || sql.regionMatches(true, i, "ts ", 0, 3)) { sb.setCharAt(i++, ' '); sb.setCharAt(i++, ' '); } else if (sql.regionMatches(true, i, "d ", 0, 2) || sql.regionMatches(true, i, "t ", 0, 2)) { sb.setCharAt(i++, ' '); } else if (sql.regionMatches(true, i, "call ", 0, 5)) { i += 4; } else if (sql.regionMatches(true, i, "?= call ", 0, 8)) { sb.setCharAt(i++, ' '); sb.setCharAt(i++, ' '); i += 5; } else if (sql.regionMatches(true, i, "escape ", 0, 7)) { i += 6; } else { i--; throw Util.sqlException( Error.error( ErrorCode.JDBC_CONNECTION_NATIVE_SQL, sql.substring(i))); } return i; }
int function(String sql, StringBuffer sb, int i) throws SQLException { sb.setCharAt(i++, ' '); i = StringUtil.skipSpaces(sql, i); if (sql.regionMatches(true, i, STR, 0, 3) sql.regionMatches(true, i, STR, 0, 3) sql.regionMatches(true, i, STR, 0, 3)) { sb.setCharAt(i++, ' '); sb.setCharAt(i++, ' '); } else if (sql.regionMatches(true, i, STR, 0, 2) sql.regionMatches(true, i, STR, 0, 2)) { sb.setCharAt(i++, ' '); } else if (sql.regionMatches(true, i, STR, 0, 5)) { i += 4; } else if (sql.regionMatches(true, i, STR, 0, 8)) { sb.setCharAt(i++, ' '); sb.setCharAt(i++, ' '); i += 5; } else if (sql.regionMatches(true, i, STR, 0, 7)) { i += 6; } else { i--; throw Util.sqlException( Error.error( ErrorCode.JDBC_CONNECTION_NATIVE_SQL, sql.substring(i))); } return i; }
/** * is called from within nativeSQL when the start of an JDBC escape sequence is encountered */
is called from within nativeSQL when the start of an JDBC escape sequence is encountered
onStartEscapeSequence
{ "repo_name": "ifcharming/original2.0", "path": "src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCConnection.java", "license": "gpl-3.0", "size": 139611 }
[ "java.sql.SQLException", "org.hsqldb_voltpatches.Error", "org.hsqldb_voltpatches.ErrorCode", "org.hsqldb_voltpatches.lib.StringUtil" ]
import java.sql.SQLException; import org.hsqldb_voltpatches.Error; import org.hsqldb_voltpatches.ErrorCode; import org.hsqldb_voltpatches.lib.StringUtil;
import java.sql.*; import org.hsqldb_voltpatches.*; import org.hsqldb_voltpatches.lib.*;
[ "java.sql", "org.hsqldb_voltpatches", "org.hsqldb_voltpatches.lib" ]
java.sql; org.hsqldb_voltpatches; org.hsqldb_voltpatches.lib;
1,182,892
@Test public void testT1RV6D5_T1LV6D1() { test_id = getTestId("T1RV6D5", "T1LV6D1", "232"); String src = selectTRVD("T1RV6D5"); String dest = selectTLVD("T1LV6D1"); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ParamFailure2, checkResult_ParamFailure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } }
void function() { test_id = getTestId(STR, STR, "232"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ParamFailure2, checkResult_ParamFailure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } }
/** * Perform the test for the given matrix column (T1RV6D5) and row (T1LV6D1). * */
Perform the test for the given matrix column (T1RV6D5) and row (T1LV6D1)
testT1RV6D5_T1LV6D1
{ "repo_name": "jason-rhodes/bridgepoint", "path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_12_Generics.java", "license": "apache-2.0", "size": 155634 }
[ "org.xtuml.bp.ui.graphics.editor.GraphicalEditor" ]
import org.xtuml.bp.ui.graphics.editor.GraphicalEditor;
import org.xtuml.bp.ui.graphics.editor.*;
[ "org.xtuml.bp" ]
org.xtuml.bp;
1,489,509
@Test public void testBasicDrillOperation6( ) throws Exception { ICubeQueryDefinition cqd = new CubeQueryDefinition( cubeName ); IEdgeDefinition rowEdge = cqd.createEdge( ICubeQueryDefinition.ROW_EDGE ); IDimensionDefinition dim1 = rowEdge.createDimension( "dimension1" ); IHierarchyDefinition hier1 = dim1.createHierarchy( "dimension1" ); hier1.createLevel( "COUNTRY" ); hier1.createLevel( "STATE" ); hier1.createLevel( "CITY" ); IDimensionDefinition dim2 = rowEdge.createDimension( "dimension2" ); IHierarchyDefinition hier2 = dim2.createHierarchy( "dimension2" ); hier2.createLevel( "YEAR" ); hier2.createLevel( "QUARTER" ); hier2.createLevel( "MONTH" ); IEdgeDefinition columnEdge = cqd.createEdge( ICubeQueryDefinition.COLUMN_EDGE ); IDimensionDefinition dim3 = columnEdge.createDimension( "dimension3" ); IHierarchyDefinition hier3 = dim3.createHierarchy( "dimension3" ); hier3.createLevel( "PRODUCTLINE" ); IMeasureDefinition measure =cqd.createMeasure( "measure1" ); measure.setAggrFunction( "SUM" ); IBinding binding1 = new Binding( "binding1" ); binding1.setExpression( new ScriptExpression( "dimension[\"dimension1\"][\"COUNTRY\"]" ) ); cqd.addBinding( binding1 ); IBinding binding2 = new Binding( "binding2" ); binding2.setExpression( new ScriptExpression( "dimension[\"dimension1\"][\"STATE\"]" ) ); cqd.addBinding( binding2 ); IBinding binding3 = new Binding( "binding3" ); binding3.setExpression( new ScriptExpression( "dimension[\"dimension1\"][\"CITY\"]" ) ); cqd.addBinding( binding3 ); IBinding binding4 = new Binding( "binding4" ); binding4.setExpression( new ScriptExpression( "dimension[\"dimension2\"][\"YEAR\"]" ) ); cqd.addBinding( binding4 ); IBinding binding5 = new Binding( "binding5" ); binding5.setExpression( new ScriptExpression( "dimension[\"dimension2\"][\"QUARTER\"]" ) ); cqd.addBinding( binding5 ); IBinding binding6 = new Binding( "binding6" ); binding6.setExpression( new ScriptExpression( "dimension[\"dimension2\"][\"MONTH\"]" ) ); cqd.addBinding( binding6 ); IBinding binding7 = new Binding( "binding7" ); binding7.setExpression( new ScriptExpression( "dimension[\"dimension3\"][\"PRODUCTLINE\"]" ) ); cqd.addBinding( binding7 ); IBinding binding8 = new Binding( "measure1" ); binding8.setExpression( new ScriptExpression( "measure[\"measure1\"]" ) ); cqd.addBinding( binding8 ); IBinding binding9 = new Binding( "total1" ); binding9.setExpression( new ScriptExpression( "measure[\"measure1\"]" ) ); binding9.addAggregateOn( "dimension[\"dimension1\"][\"COUNTRY\"]"); binding9.addAggregateOn( "dimension[\"dimension1\"][\"STATE\"]"); binding9.addAggregateOn( "dimension[\"dimension1\"][\"CITY\"]"); binding9.addAggregateOn( "dimension[\"dimension2\"][\"YEAR\"]"); binding9.addAggregateOn( "dimension[\"dimension2\"][\"QUARTER\"]"); binding9.addAggregateOn( "dimension[\"dimension2\"][\"MONTH\"]"); binding9.setAggrFunction( IBuildInAggregation.TOTAL_SUM_FUNC ); cqd.addBinding( binding9 ); IBinding binding10 = new Binding( "total2" ); binding10.setExpression( new ScriptExpression( "measure[\"measure1\"]" ) ); binding10.addAggregateOn( "dimension[\"dimension3\"][\"PRODUCTLINE\"]"); binding10.setAggrFunction( IBuildInAggregation.TOTAL_SUM_FUNC ); cqd.addBinding( binding10 ); IBinding binding11 = new Binding( "grandTotal1" ); binding11.setExpression( new ScriptExpression( "measure[\"measure1\"]" ) ); binding11.setAggrFunction( IBuildInAggregation.TOTAL_SUM_FUNC ); cqd.addBinding( binding11 ); IEdgeDrillFilter filter1 = rowEdge.createDrillFilter( "drill2" ); filter1.setTargetHierarchy( hier1 ); filter1.setTargetLevelName( "COUNTRY" ); List memberList = new ArrayList( ); memberList.add( new Object[]{ "USA","CHINA" } ); filter1.setTuple( memberList ); IEdgeDrillFilter filter = rowEdge.createDrillFilter( "drill1" ); filter.setTargetHierarchy( hier2 ); filter.setTargetLevelName( "YEAR" ); memberList = new ArrayList( ); memberList.add( new Object[]{ "2003" } ); memberList.add( null ); memberList.add( null ); filter.setTuple( memberList ); DataEngineImpl engine = (DataEngineImpl) DataEngine.newDataEngine( createPresentationContext( ) ); DrilledCube cube = new DrilledCube( ); cube.createCube( engine ); IPreparedCubeQuery pcq = engine.prepare( cqd, null ); ICubeQueryResults queryResults = pcq.execute( null ); CubeCursor cursor = queryResults.getCubeCursor( ); List rowEdgeBindingNames = new ArrayList( ); rowEdgeBindingNames.add( "binding1" ); rowEdgeBindingNames.add( "binding2" ); rowEdgeBindingNames.add( "binding3" ); rowEdgeBindingNames.add( "binding4" ); rowEdgeBindingNames.add( "binding5" ); rowEdgeBindingNames.add( "binding6" ); List columnEdgeBindingNames = new ArrayList( ); columnEdgeBindingNames.add( "binding7" ); printCube( cursor, columnEdgeBindingNames, rowEdgeBindingNames, "measure1", "total2", "total1", "grandTotal1", null ); engine.shutdown( ); }
void function( ) throws Exception { ICubeQueryDefinition cqd = new CubeQueryDefinition( cubeName ); IEdgeDefinition rowEdge = cqd.createEdge( ICubeQueryDefinition.ROW_EDGE ); IDimensionDefinition dim1 = rowEdge.createDimension( STR ); IHierarchyDefinition hier1 = dim1.createHierarchy( STR ); hier1.createLevel( STR ); hier1.createLevel( "STATE" ); hier1.createLevel( "CITY" ); IDimensionDefinition dim2 = rowEdge.createDimension( STR ); IHierarchyDefinition hier2 = dim2.createHierarchy( STR ); hier2.createLevel( "YEAR" ); hier2.createLevel( STR ); hier2.createLevel( "MONTH" ); IEdgeDefinition columnEdge = cqd.createEdge( ICubeQueryDefinition.COLUMN_EDGE ); IDimensionDefinition dim3 = columnEdge.createDimension( STR ); IHierarchyDefinition hier3 = dim3.createHierarchy( STR ); hier3.createLevel( STR ); IMeasureDefinition measure =cqd.createMeasure( STR ); measure.setAggrFunction( "SUM" ); IBinding binding1 = new Binding( STR ); binding1.setExpression( new ScriptExpression( STRdimension1\"][\"COUNTRY\"]" ) ); cqd.addBinding( binding1 ); IBinding binding2 = new Binding( STR ); binding2.setExpression( new ScriptExpression( STRdimension1\"][\"STATE\"]" ) ); cqd.addBinding( binding2 ); IBinding binding3 = new Binding( STR ); binding3.setExpression( new ScriptExpression( STRdimension1\"][\"CITY\"]" ) ); cqd.addBinding( binding3 ); IBinding binding4 = new Binding( STR ); binding4.setExpression( new ScriptExpression( STRdimension2\"][\"YEAR\"]" ) ); cqd.addBinding( binding4 ); IBinding binding5 = new Binding( STR ); binding5.setExpression( new ScriptExpression( STRdimension2\"][\"QUARTER\"]" ) ); cqd.addBinding( binding5 ); IBinding binding6 = new Binding( STR ); binding6.setExpression( new ScriptExpression( STRdimension2\"][\"MONTH\"]" ) ); cqd.addBinding( binding6 ); IBinding binding7 = new Binding( STR ); binding7.setExpression( new ScriptExpression( STRdimension3\"][\"PRODUCTLINE\"]" ) ); cqd.addBinding( binding7 ); IBinding binding8 = new Binding( STR ); binding8.setExpression( new ScriptExpression( STRmeasure1\"]" ) ); cqd.addBinding( binding8 ); IBinding binding9 = new Binding( STR ); binding9.setExpression( new ScriptExpression( STRmeasure1\"]" ) ); binding9.addAggregateOn( STRdimension1\"][\"COUNTRY\"]"); binding9.addAggregateOn( STRdimension1\"][\"STATE\"]"); binding9.addAggregateOn( STRdimension1\"][\"CITY\"]"); binding9.addAggregateOn( STRdimension2\"][\"YEAR\"]"); binding9.addAggregateOn( STRdimension2\"][\"QUARTER\"]"); binding9.addAggregateOn( STRdimension2\"][\"MONTH\"]"); binding9.setAggrFunction( IBuildInAggregation.TOTAL_SUM_FUNC ); cqd.addBinding( binding9 ); IBinding binding10 = new Binding( STR ); binding10.setExpression( new ScriptExpression( STRmeasure1\"]" ) ); binding10.addAggregateOn( STRdimension3\"][\"PRODUCTLINE\"]"); binding10.setAggrFunction( IBuildInAggregation.TOTAL_SUM_FUNC ); cqd.addBinding( binding10 ); IBinding binding11 = new Binding( STR ); binding11.setExpression( new ScriptExpression( STRmeasure1\"]" ) ); binding11.setAggrFunction( IBuildInAggregation.TOTAL_SUM_FUNC ); cqd.addBinding( binding11 ); IEdgeDrillFilter filter1 = rowEdge.createDrillFilter( STR ); filter1.setTargetHierarchy( hier1 ); filter1.setTargetLevelName( STR ); List memberList = new ArrayList( ); memberList.add( new Object[]{ "USA","CHINA" } ); filter1.setTuple( memberList ); IEdgeDrillFilter filter = rowEdge.createDrillFilter( STR ); filter.setTargetHierarchy( hier2 ); filter.setTargetLevelName( "YEAR" ); memberList = new ArrayList( ); memberList.add( new Object[]{ "2003" } ); memberList.add( null ); memberList.add( null ); filter.setTuple( memberList ); DataEngineImpl engine = (DataEngineImpl) DataEngine.newDataEngine( createPresentationContext( ) ); DrilledCube cube = new DrilledCube( ); cube.createCube( engine ); IPreparedCubeQuery pcq = engine.prepare( cqd, null ); ICubeQueryResults queryResults = pcq.execute( null ); CubeCursor cursor = queryResults.getCubeCursor( ); List rowEdgeBindingNames = new ArrayList( ); rowEdgeBindingNames.add( STR ); rowEdgeBindingNames.add( STR ); rowEdgeBindingNames.add( STR ); rowEdgeBindingNames.add( STR ); rowEdgeBindingNames.add( STR ); rowEdgeBindingNames.add( STR ); List columnEdgeBindingNames = new ArrayList( ); columnEdgeBindingNames.add( STR ); printCube( cursor, columnEdgeBindingNames, rowEdgeBindingNames, STR, STR, STR, STR, null ); engine.shutdown( ); }
/** * Drill on the first, second and the sub total. * @throws Exception */
Drill on the first, second and the sub total
testBasicDrillOperation6
{ "repo_name": "rrimmana/birt-1", "path": "data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/api/CubeDrillFeatureTest.java", "license": "epl-1.0", "size": 47379 }
[ "java.util.ArrayList", "java.util.List", "javax.olap.cursor.CubeCursor", "org.eclipse.birt.data.aggregation.api.IBuildInAggregation", "org.eclipse.birt.data.engine.api.DataEngine", "org.eclipse.birt.data.engine.api.IBinding", "org.eclipse.birt.data.engine.api.querydefn.Binding", "org.eclipse.birt.data.engine.api.querydefn.ScriptExpression", "org.eclipse.birt.data.engine.impl.DataEngineImpl", "org.eclipse.birt.data.engine.olap.api.query.ICubeQueryDefinition", "org.eclipse.birt.data.engine.olap.api.query.IDimensionDefinition", "org.eclipse.birt.data.engine.olap.api.query.IEdgeDefinition", "org.eclipse.birt.data.engine.olap.api.query.IEdgeDrillFilter", "org.eclipse.birt.data.engine.olap.api.query.IHierarchyDefinition", "org.eclipse.birt.data.engine.olap.api.query.IMeasureDefinition", "org.eclipse.birt.data.engine.olap.impl.query.CubeQueryDefinition" ]
import java.util.ArrayList; import java.util.List; import javax.olap.cursor.CubeCursor; import org.eclipse.birt.data.aggregation.api.IBuildInAggregation; import org.eclipse.birt.data.engine.api.DataEngine; import org.eclipse.birt.data.engine.api.IBinding; import org.eclipse.birt.data.engine.api.querydefn.Binding; import org.eclipse.birt.data.engine.api.querydefn.ScriptExpression; import org.eclipse.birt.data.engine.impl.DataEngineImpl; import org.eclipse.birt.data.engine.olap.api.query.ICubeQueryDefinition; import org.eclipse.birt.data.engine.olap.api.query.IDimensionDefinition; import org.eclipse.birt.data.engine.olap.api.query.IEdgeDefinition; import org.eclipse.birt.data.engine.olap.api.query.IEdgeDrillFilter; import org.eclipse.birt.data.engine.olap.api.query.IHierarchyDefinition; import org.eclipse.birt.data.engine.olap.api.query.IMeasureDefinition; import org.eclipse.birt.data.engine.olap.impl.query.CubeQueryDefinition;
import java.util.*; import javax.olap.cursor.*; import org.eclipse.birt.data.aggregation.api.*; import org.eclipse.birt.data.engine.api.*; import org.eclipse.birt.data.engine.api.querydefn.*; import org.eclipse.birt.data.engine.impl.*; import org.eclipse.birt.data.engine.olap.api.query.*; import org.eclipse.birt.data.engine.olap.impl.query.*;
[ "java.util", "javax.olap", "org.eclipse.birt" ]
java.util; javax.olap; org.eclipse.birt;
712,059
public Rectangle2D getVisualBounds() { return getVisualBounds(0f, 0f); }
Rectangle2D function() { return getVisualBounds(0f, 0f); }
/** * A convenience method that returns the visual bounds when rendered at 0, 0. */
A convenience method that returns the visual bounds when rendered at 0, 0
getVisualBounds
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jdk/src/share/classes/sun/font/TextLabel.java", "license": "gpl-2.0", "size": 4010 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,661,849
private static void extractGeneratedClasses(Path classJar, Manifest manifest, Path tempDir) throws IOException { ImmutableSet<String> generatedFilePrefixes = getPrefixes(manifest, unit -> unit.getGeneratedByAnnotationProcessor()); ImmutableSet<String> userWrittenFilePrefixes = getPrefixes(manifest, unit -> !unit.getGeneratedByAnnotationProcessor()); try (JarFile jar = new JarFile(classJar.toFile())) { Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); if (!name.endsWith(".class")) { continue; } String className = name.substring(0, name.length() - ".class".length()); if (prefixesContains(generatedFilePrefixes, className) // Assume that prefixes that don't correspond to a known hand-written source are // generated. || !prefixesContains(userWrittenFilePrefixes, className)) { Files.createDirectories(tempDir.resolve(name).getParent()); // InputStream closing: JarFile extends ZipFile, and ZipFile.close() will close all of the // input streams previously returned by invocations of the getInputStream method. // See https://docs.oracle.com/javase/8/docs/api/java/util/zip/ZipFile.html#close-- Files.copy(jar.getInputStream(entry), tempDir.resolve(name)); } } } }
static void function(Path classJar, Manifest manifest, Path tempDir) throws IOException { ImmutableSet<String> generatedFilePrefixes = getPrefixes(manifest, unit -> unit.getGeneratedByAnnotationProcessor()); ImmutableSet<String> userWrittenFilePrefixes = getPrefixes(manifest, unit -> !unit.getGeneratedByAnnotationProcessor()); try (JarFile jar = new JarFile(classJar.toFile())) { Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); if (!name.endsWith(STR)) { continue; } String className = name.substring(0, name.length() - STR.length()); if (prefixesContains(generatedFilePrefixes, className) !prefixesContains(userWrittenFilePrefixes, className)) { Files.createDirectories(tempDir.resolve(name).getParent()); Files.copy(jar.getInputStream(entry), tempDir.resolve(name)); } } } }
/** * Unzip all the class files that correspond to annotation processor- generated sources into the * temporary directory. */
Unzip all the class files that correspond to annotation processor- generated sources into the temporary directory
extractGeneratedClasses
{ "repo_name": "twitter-forks/bazel", "path": "src/java_tools/buildjar/java/com/google/devtools/build/buildjar/genclass/GenClass.java", "license": "apache-2.0", "size": 6683 }
[ "com.google.common.collect.ImmutableSet", "com.google.devtools.build.buildjar.proto.JavaCompilation", "java.io.IOException", "java.nio.file.Files", "java.nio.file.Path", "java.util.Enumeration", "java.util.jar.JarEntry", "java.util.jar.JarFile" ]
import com.google.common.collect.ImmutableSet; import com.google.devtools.build.buildjar.proto.JavaCompilation; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile;
import com.google.common.collect.*; import com.google.devtools.build.buildjar.proto.*; import java.io.*; import java.nio.file.*; import java.util.*; import java.util.jar.*;
[ "com.google.common", "com.google.devtools", "java.io", "java.nio", "java.util" ]
com.google.common; com.google.devtools; java.io; java.nio; java.util;
2,089,746
public void writeMessage(Message message) throws IOException;
void function(Message message) throws IOException;
/** * Writes the given message out over the network using the protocol tag. For a Transaction * this should be "tx" for example. It's safe to call this from multiple threads simultaneously, * the actual writing will be serialized. * * @throws IOException */
Writes the given message out over the network using the protocol tag. For a Transaction this should be "tx" for example. It's safe to call this from multiple threads simultaneously, the actual writing will be serialized
writeMessage
{ "repo_name": "hank/litecoinj-new", "path": "core/src/main/java/com/google/litecoin/core/NetworkConnection.java", "license": "apache-2.0", "size": 2706 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,332,520
public void parse(InputStream is, DefaultHandler dh, String systemId) throws SAXException, IOException { XMLReader reader = getXMLReader(); InputSource source = new InputSource(is); source.setSystemId(systemId); reader.setContentHandler(dh); reader.parse(source); }
void function(InputStream is, DefaultHandler dh, String systemId) throws SAXException, IOException { XMLReader reader = getXMLReader(); InputSource source = new InputSource(is); source.setSystemId(systemId); reader.setContentHandler(dh); reader.parse(source); }
/** * parses and validates the given InputSream using the given DefaultHandler and systemId */
parses and validates the given InputSream using the given DefaultHandler and systemId
parse
{ "repo_name": "league/rngzip", "path": "libs/iso-relax/org/iso_relax/jaxp/ValidatingSAXParser.java", "license": "gpl-2.0", "size": 5011 }
[ "java.io.IOException", "java.io.InputStream", "org.xml.sax.InputSource", "org.xml.sax.SAXException", "org.xml.sax.XMLReader", "org.xml.sax.helpers.DefaultHandler" ]
import java.io.IOException; import java.io.InputStream; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler;
import java.io.*; import org.xml.sax.*; import org.xml.sax.helpers.*;
[ "java.io", "org.xml.sax" ]
java.io; org.xml.sax;
581,666
Number getShutdownValue(Pin pin);
Number getShutdownValue(Pin pin);
/** * Get the shutdown/terminate value that the DAC should apply to the given GPIO pin * when the class is destroyed/terminated. * * @param pin analog output pin * @return return the shutdown value if one has been defined, else NULL. */
Get the shutdown/terminate value that the DAC should apply to the given GPIO pin when the class is destroyed/terminated
getShutdownValue
{ "repo_name": "ARIG-Robotique/robots", "path": "robot-system-lib-parent/robot-system-lib-raspi/src/main/java/com/pi4j/gpio/extension/base/DacGpioProvider.java", "license": "gpl-3.0", "size": 4481 }
[ "com.pi4j.io.gpio.Pin" ]
import com.pi4j.io.gpio.Pin;
import com.pi4j.io.gpio.*;
[ "com.pi4j.io" ]
com.pi4j.io;
601,198
public interface EntryProvider { public Iterator getIterator();
interface EntryProvider { public Iterator function();
/** * Gets an iterator for the channels, calendars, etc. */
Gets an iterator for the channels, calendars, etc
getIterator
{ "repo_name": "OpenCollabZA/sakai", "path": "site/mergedlist-util/util/src/java/org/sakaiproject/util/MergedList.java", "license": "apache-2.0", "size": 16947 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,459,317
private synchronized static void getDatabaseCredentials() { try { // Setup the input stream. InputStream dbSetup = LineSideModule.class.getResourceAsStream("dbAccess.txt"); BufferedReader reader = new BufferedReader (new InputStreamReader(dbSetup)); // Declare method variables. String line; int linesRead = 0; // Read the contents of the file. while ((line = reader.readLine())!= null) { if (linesRead >= 5) { break; // We have reached the limit needed (5 lines). } else { DB_CONNECTION_CREDENTIALS.add(line.trim()); // Add the contents of the line into the ArrayList linesRead ++; // Increment the Linesread method variable. } } // Check again that we have the correct number of lines/credentials from the file - apply to class variables. if (DB_CONNECTION_CREDENTIALS.size() == 5) { dbHost = DB_CONNECTION_CREDENTIALS.get(0); dbPort = DB_CONNECTION_CREDENTIALS.get(1); dbName = DB_CONNECTION_CREDENTIALS.get(2); dbUserName = DB_CONNECTION_CREDENTIALS.get(3); dbPassword = DB_CONNECTION_CREDENTIALS.get(4); } else { // Alert the user - close the programme (no point continuing). } } catch (NullPointerException | IOException e) { // Alert the user - close the programme (no point continuing). } }
synchronized static void function() { try { InputStream dbSetup = LineSideModule.class.getResourceAsStream(STR); BufferedReader reader = new BufferedReader (new InputStreamReader(dbSetup)); String line; int linesRead = 0; while ((line = reader.readLine())!= null) { if (linesRead >= 5) { break; } else { DB_CONNECTION_CREDENTIALS.add(line.trim()); linesRead ++; } } if (DB_CONNECTION_CREDENTIALS.size() == 5) { dbHost = DB_CONNECTION_CREDENTIALS.get(0); dbPort = DB_CONNECTION_CREDENTIALS.get(1); dbName = DB_CONNECTION_CREDENTIALS.get(2); dbUserName = DB_CONNECTION_CREDENTIALS.get(3); dbPassword = DB_CONNECTION_CREDENTIALS.get(4); } else { } } catch (NullPointerException IOException e) { } }
/** * This Method reads the DataBase connection details and credentials from dbAccess.txt */
This Method reads the DataBase connection details and credentials from dbAccess.txt
getDatabaseCredentials
{ "repo_name": "JonathanMoss/LinesideModule", "path": "src/com/jgm/lineside/database/MySqlConnect.java", "license": "gpl-3.0", "size": 4963 }
[ "com.jgm.lineside.LineSideModule", "java.io.BufferedReader", "java.io.IOException", "java.io.InputStream", "java.io.InputStreamReader" ]
import com.jgm.lineside.LineSideModule; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader;
import com.jgm.lineside.*; import java.io.*;
[ "com.jgm.lineside", "java.io" ]
com.jgm.lineside; java.io;
2,595,978
public static final ExtendedPlayerP get(EntityPlayer player) { return (ExtendedPlayerP)player.getExtendedProperties(EXT_PROP_NAME); }
static final ExtendedPlayerP function(EntityPlayer player) { return (ExtendedPlayerP)player.getExtendedProperties(EXT_PROP_NAME); }
/** * Get the extended properties for the player. * @param player * @return */
Get the extended properties for the player
get
{ "repo_name": "mrubinsk/RoadieMod", "path": "java/com/theupstairsroom/roadiemod/ExtendedPlayerP.java", "license": "gpl-3.0", "size": 3691 }
[ "net.minecraft.entity.player.EntityPlayer" ]
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
2,345,043
public synchronized void signOn() { // ^^^^^^^^^^^^ Added synchronized to be symmetric with sign off and to // fix a possible dead-lock see also OLAT-3390 log.debug("signOn() START"); if (isAuthenticated()) throw new AssertException("sign on: already signed on!"); Identity identity = identityEnvironment.getIdentity(); if (identity == null) throw new AssertException("identity is null in identityEnvironment!"); if (sessionInfo == null) throw new AssertException("sessionInfo was null for identity " + identity); // String login = identity.getName(); authenticated = true; if (sessionInfo.isWebDAV()) { // load user prefs PreferencesService prefstorage = (PreferencesService) CoreSpringFactory.getBean(PreferencesService.class); guiPreferences = prefstorage.getPreferencesFor(identity, identityEnvironment.getRoles().isGuestOnly()); synchronized (authUserSessions) { // o_clusterOK by:se // we're only adding this webdav session to the authUserSessions - not to the userNameToIdentity. // userNameToIdentity is only needed for IM which can't do anything with a webdav session authUserSessions.add(this); } log.info("Audit:Logged on [via webdav]: " + sessionInfo.toString()); return; } if (log.isDebugEnabled()) { log.debug("signOn() authUsersNamesOtherNodes.contains " + identity.getName() + ": " + authUsersNamesOtherNodes.contains(identity.getName())); } UserSession invalidatedSession = null; synchronized (authUserSessions) { // o_clusterOK by:fj // check if allready a session exist for this user if ((userNameToIdentity.containsKey(identity.getName().toLowerCase()) || authUsersNamesOtherNodes.contains(identity.getName())) && !sessionInfo.isWebDAV() && !this.getRoles().isGuestOnly()) { log.info("Loggin-process II: User has already a session => signOffAndClear existing session"); invalidatedSession = getUserSessionFor(identity.getName().toLowerCase()); // remove session to be invalidated // SIDEEFFECT!! to signOffAndClear // if invalidatedSession is removed from authUserSessions // signOffAndClear does not remove the identity.getName().toLowerCase() from the userNameToIdentity // authUserSessions.remove(invalidatedSession); } authUserSessions.add(this); // user can choose upercase letters in identity name, but this has no effect on the // database queries, the login form or the IM account. IM works only with lowercase // characters -> map stores values as such log.debug("signOn() adding to userNameToIdentity: " + identity.getName().toLowerCase()); userNameToIdentity.put(identity.getName().toLowerCase(), identity); } // load user prefs PreferencesService prefstorage = (PreferencesService) CoreSpringFactory.getBean(PreferencesService.class); guiPreferences = prefstorage.getPreferencesFor(identity, identityEnvironment.getRoles().isGuestOnly()); if (!registeredWithBus) { // OLAT-3706 CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, null, SignOnOffEventResourceable.getResourceable()); } log.info("Audit:Logged on: " + sessionInfo.toString()); CoordinatorManager.getInstance().getCoordinator().getEventBus() .fireEventToListenersOf(new SignOnOffEvent(identity, true), SignOnOffEventResourceable.getResourceable()); // THE FOLLOWING CHECK MUST BE PLACED HERE NOT TO PRODUCE A DEAD-LOCK WITH SIGNOFFANDCLEAR // check if a session from any browser was invalidated (IE has a cookie set per Browserinstance!!) if (invalidatedSession != null || authUsersNamesOtherNodes.contains(identity.getName())) { // put flag killed-existing-session into session-store to show info-message 'only one session for each user' on user-home screen this.putEntry(STORE_KEY_KILLED_EXISTING_SESSION, Boolean.TRUE); log.debug("signOn() removing from authUsersNamesOtherNodes: " + identity.getName()); authUsersNamesOtherNodes.remove(identity.getName()); // OLAT-3381 & OLAT-3382 if (invalidatedSession != null) { invalidatedSession.signOffAndClear(); } } log.debug("signOn() END"); }
synchronized void function() { log.debug(STR); if (isAuthenticated()) throw new AssertException(STR); Identity identity = identityEnvironment.getIdentity(); if (identity == null) throw new AssertException(STR); if (sessionInfo == null) throw new AssertException(STR + identity); authenticated = true; if (sessionInfo.isWebDAV()) { PreferencesService prefstorage = (PreferencesService) CoreSpringFactory.getBean(PreferencesService.class); guiPreferences = prefstorage.getPreferencesFor(identity, identityEnvironment.getRoles().isGuestOnly()); synchronized (authUserSessions) { authUserSessions.add(this); } log.info(STR + sessionInfo.toString()); return; } if (log.isDebugEnabled()) { log.debug(STR + identity.getName() + STR + authUsersNamesOtherNodes.contains(identity.getName())); } UserSession invalidatedSession = null; synchronized (authUserSessions) { if ((userNameToIdentity.containsKey(identity.getName().toLowerCase()) authUsersNamesOtherNodes.contains(identity.getName())) && !sessionInfo.isWebDAV() && !this.getRoles().isGuestOnly()) { log.info(STR); invalidatedSession = getUserSessionFor(identity.getName().toLowerCase()); } authUserSessions.add(this); log.debug(STR + identity.getName().toLowerCase()); userNameToIdentity.put(identity.getName().toLowerCase(), identity); } PreferencesService prefstorage = (PreferencesService) CoreSpringFactory.getBean(PreferencesService.class); guiPreferences = prefstorage.getPreferencesFor(identity, identityEnvironment.getRoles().isGuestOnly()); if (!registeredWithBus) { CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, null, SignOnOffEventResourceable.getResourceable()); } log.info(STR + sessionInfo.toString()); CoordinatorManager.getInstance().getCoordinator().getEventBus() .fireEventToListenersOf(new SignOnOffEvent(identity, true), SignOnOffEventResourceable.getResourceable()); if (invalidatedSession != null authUsersNamesOtherNodes.contains(identity.getName())) { this.putEntry(STORE_KEY_KILLED_EXISTING_SESSION, Boolean.TRUE); log.debug(STR + identity.getName()); authUsersNamesOtherNodes.remove(identity.getName()); if (invalidatedSession != null) { invalidatedSession.signOffAndClear(); } } log.debug(STR); }
/** * prior to calling this method, all instance vars must be set. */
prior to calling this method, all instance vars must be set
signOn
{ "repo_name": "huihoo/olat", "path": "olat7.8/src/main/java/org/olat/presentation/commons/session/UserSession.java", "license": "apache-2.0", "size": 30163 }
[ "org.olat.data.basesecurity.Identity", "org.olat.lms.preferences.PreferencesService", "org.olat.system.coordinate.CoordinatorManager", "org.olat.system.event.SignOnOffEvent", "org.olat.system.event.SignOnOffEventResourceable", "org.olat.system.exception.AssertException", "org.olat.system.spring.CoreSpringFactory" ]
import org.olat.data.basesecurity.Identity; import org.olat.lms.preferences.PreferencesService; import org.olat.system.coordinate.CoordinatorManager; import org.olat.system.event.SignOnOffEvent; import org.olat.system.event.SignOnOffEventResourceable; import org.olat.system.exception.AssertException; import org.olat.system.spring.CoreSpringFactory;
import org.olat.data.basesecurity.*; import org.olat.lms.preferences.*; import org.olat.system.coordinate.*; import org.olat.system.event.*; import org.olat.system.exception.*; import org.olat.system.spring.*;
[ "org.olat.data", "org.olat.lms", "org.olat.system" ]
org.olat.data; org.olat.lms; org.olat.system;
1,912,737
public final <U2> Tuple9<T1, U2, T3, T4, T5, T6, T7, T8, T9> map2(Function<? super T2, ? extends U2> function) { return Tuple.tuple(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9); }
final <U2> Tuple9<T1, U2, T3, T4, T5, T6, T7, T8, T9> function(Function<? super T2, ? extends U2> function) { return Tuple.tuple(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9); }
/** * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument. */
Apply attribute 2 as argument to a function and return a new tuple with the substituted argument
map2
{ "repo_name": "jOOQ/jOOL", "path": "jOOL/src/main/java/org/jooq/lambda/tuple/Tuple9.java", "license": "apache-2.0", "size": 19161 }
[ "java.util.function.Function" ]
import java.util.function.Function;
import java.util.function.*;
[ "java.util" ]
java.util;
799,251
protected static Object convertTo(Schema toSchema, Schema fromSchema, Object value) throws DataException { if (value == null) { if (toSchema.isOptional()) { return null; } throw new DataException("Unable to convert a null value to a schema that requires a value"); } switch (toSchema.type()) { case BYTES: if (Decimal.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof ByteBuffer) { value = Utils.toArray((ByteBuffer) value); } if (value instanceof byte[]) { return Decimal.toLogical(toSchema, (byte[]) value); } if (value instanceof BigDecimal) { return value; } if (value instanceof Number) { // Not already a decimal, so treat it as a double ... double converted = ((Number) value).doubleValue(); return new BigDecimal(converted); } if (value instanceof String) { return new BigDecimal(value.toString()).doubleValue(); } } if (value instanceof ByteBuffer) { return Utils.toArray((ByteBuffer) value); } if (value instanceof byte[]) { return value; } if (value instanceof BigDecimal) { return Decimal.fromLogical(toSchema, (BigDecimal) value); } break; case STRING: StringBuilder sb = new StringBuilder(); append(sb, value, false); return sb.toString(); case BOOLEAN: if (value instanceof Boolean) { return value; } if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); if (parsed.value() instanceof Boolean) { return parsed.value(); } } return asLong(value, fromSchema, null) == 0L ? Boolean.FALSE : Boolean.TRUE; case INT8: if (value instanceof Byte) { return value; } return (byte) asLong(value, fromSchema, null); case INT16: if (value instanceof Short) { return value; } return (short) asLong(value, fromSchema, null); case INT32: if (Date.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); value = parsed.value(); } if (value instanceof java.util.Date) { if (fromSchema != null) { String fromSchemaName = fromSchema.name(); if (Date.LOGICAL_NAME.equals(fromSchemaName)) { return value; } if (Timestamp.LOGICAL_NAME.equals(fromSchemaName)) { // Just get the number of days from this timestamp long millis = ((java.util.Date) value).getTime(); int days = (int) (millis / MILLIS_PER_DAY); // truncates return Date.toLogical(toSchema, days); } } } long numeric = asLong(value, fromSchema, null); return Date.toLogical(toSchema, (int) numeric); } if (Time.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); value = parsed.value(); } if (value instanceof java.util.Date) { if (fromSchema != null) { String fromSchemaName = fromSchema.name(); if (Time.LOGICAL_NAME.equals(fromSchemaName)) { return value; } if (Timestamp.LOGICAL_NAME.equals(fromSchemaName)) { // Just get the time portion of this timestamp Calendar calendar = Calendar.getInstance(UTC); calendar.setTime((java.util.Date) value); calendar.set(Calendar.YEAR, 1970); calendar.set(Calendar.MONTH, 1); calendar.set(Calendar.DAY_OF_MONTH, 1); return Time.toLogical(toSchema, (int) calendar.getTimeInMillis()); } } } long numeric = asLong(value, fromSchema, null); return Time.toLogical(toSchema, (int) numeric); } if (value instanceof Integer) { return value; } return (int) asLong(value, fromSchema, null); case INT64: if (Timestamp.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); value = parsed.value(); } if (value instanceof java.util.Date) { java.util.Date date = (java.util.Date) value; if (fromSchema != null) { String fromSchemaName = fromSchema.name(); if (Date.LOGICAL_NAME.equals(fromSchemaName)) { int days = Date.fromLogical(fromSchema, date); long millis = days * MILLIS_PER_DAY; return Timestamp.toLogical(toSchema, millis); } if (Time.LOGICAL_NAME.equals(fromSchemaName)) { long millis = Time.fromLogical(fromSchema, date); return Timestamp.toLogical(toSchema, millis); } if (Timestamp.LOGICAL_NAME.equals(fromSchemaName)) { return value; } } } long numeric = asLong(value, fromSchema, null); return Timestamp.toLogical(toSchema, numeric); } if (value instanceof Long) { return value; } return asLong(value, fromSchema, null); case FLOAT32: if (value instanceof Float) { return value; } return (float) asDouble(value, fromSchema, null); case FLOAT64: if (value instanceof Double) { return value; } return asDouble(value, fromSchema, null); case ARRAY: if (value instanceof String) { SchemaAndValue schemaAndValue = parseString(value.toString()); value = schemaAndValue.value(); } if (value instanceof List) { return value; } break; case MAP: if (value instanceof String) { SchemaAndValue schemaAndValue = parseString(value.toString()); value = schemaAndValue.value(); } if (value instanceof Map) { return value; } break; case STRUCT: if (value instanceof Struct) { Struct struct = (Struct) value; return struct; } } throw new DataException("Unable to convert " + value + " (" + value.getClass() + ") to " + toSchema); }
static Object function(Schema toSchema, Schema fromSchema, Object value) throws DataException { if (value == null) { if (toSchema.isOptional()) { return null; } throw new DataException(STR); } switch (toSchema.type()) { case BYTES: if (Decimal.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof ByteBuffer) { value = Utils.toArray((ByteBuffer) value); } if (value instanceof byte[]) { return Decimal.toLogical(toSchema, (byte[]) value); } if (value instanceof BigDecimal) { return value; } if (value instanceof Number) { double converted = ((Number) value).doubleValue(); return new BigDecimal(converted); } if (value instanceof String) { return new BigDecimal(value.toString()).doubleValue(); } } if (value instanceof ByteBuffer) { return Utils.toArray((ByteBuffer) value); } if (value instanceof byte[]) { return value; } if (value instanceof BigDecimal) { return Decimal.fromLogical(toSchema, (BigDecimal) value); } break; case STRING: StringBuilder sb = new StringBuilder(); append(sb, value, false); return sb.toString(); case BOOLEAN: if (value instanceof Boolean) { return value; } if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); if (parsed.value() instanceof Boolean) { return parsed.value(); } } return asLong(value, fromSchema, null) == 0L ? Boolean.FALSE : Boolean.TRUE; case INT8: if (value instanceof Byte) { return value; } return (byte) asLong(value, fromSchema, null); case INT16: if (value instanceof Short) { return value; } return (short) asLong(value, fromSchema, null); case INT32: if (Date.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); value = parsed.value(); } if (value instanceof java.util.Date) { if (fromSchema != null) { String fromSchemaName = fromSchema.name(); if (Date.LOGICAL_NAME.equals(fromSchemaName)) { return value; } if (Timestamp.LOGICAL_NAME.equals(fromSchemaName)) { long millis = ((java.util.Date) value).getTime(); int days = (int) (millis / MILLIS_PER_DAY); return Date.toLogical(toSchema, days); } } } long numeric = asLong(value, fromSchema, null); return Date.toLogical(toSchema, (int) numeric); } if (Time.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); value = parsed.value(); } if (value instanceof java.util.Date) { if (fromSchema != null) { String fromSchemaName = fromSchema.name(); if (Time.LOGICAL_NAME.equals(fromSchemaName)) { return value; } if (Timestamp.LOGICAL_NAME.equals(fromSchemaName)) { Calendar calendar = Calendar.getInstance(UTC); calendar.setTime((java.util.Date) value); calendar.set(Calendar.YEAR, 1970); calendar.set(Calendar.MONTH, 1); calendar.set(Calendar.DAY_OF_MONTH, 1); return Time.toLogical(toSchema, (int) calendar.getTimeInMillis()); } } } long numeric = asLong(value, fromSchema, null); return Time.toLogical(toSchema, (int) numeric); } if (value instanceof Integer) { return value; } return (int) asLong(value, fromSchema, null); case INT64: if (Timestamp.LOGICAL_NAME.equals(toSchema.name())) { if (value instanceof String) { SchemaAndValue parsed = parseString(value.toString()); value = parsed.value(); } if (value instanceof java.util.Date) { java.util.Date date = (java.util.Date) value; if (fromSchema != null) { String fromSchemaName = fromSchema.name(); if (Date.LOGICAL_NAME.equals(fromSchemaName)) { int days = Date.fromLogical(fromSchema, date); long millis = days * MILLIS_PER_DAY; return Timestamp.toLogical(toSchema, millis); } if (Time.LOGICAL_NAME.equals(fromSchemaName)) { long millis = Time.fromLogical(fromSchema, date); return Timestamp.toLogical(toSchema, millis); } if (Timestamp.LOGICAL_NAME.equals(fromSchemaName)) { return value; } } } long numeric = asLong(value, fromSchema, null); return Timestamp.toLogical(toSchema, numeric); } if (value instanceof Long) { return value; } return asLong(value, fromSchema, null); case FLOAT32: if (value instanceof Float) { return value; } return (float) asDouble(value, fromSchema, null); case FLOAT64: if (value instanceof Double) { return value; } return asDouble(value, fromSchema, null); case ARRAY: if (value instanceof String) { SchemaAndValue schemaAndValue = parseString(value.toString()); value = schemaAndValue.value(); } if (value instanceof List) { return value; } break; case MAP: if (value instanceof String) { SchemaAndValue schemaAndValue = parseString(value.toString()); value = schemaAndValue.value(); } if (value instanceof Map) { return value; } break; case STRUCT: if (value instanceof Struct) { Struct struct = (Struct) value; return struct; } } throw new DataException(STR + value + STR + value.getClass() + STR + toSchema); }
/** * Convert the value to the desired type. * * @param toSchema the schema for the desired type; may not be null * @param fromSchema the schema for the supplied value; may be null if not known * @return the converted value; never null * @throws DataException if the value could not be converted to the desired type */
Convert the value to the desired type
convertTo
{ "repo_name": "richhaase/kafka", "path": "connect/api/src/main/java/org/apache/kafka/connect/data/Values.java", "license": "apache-2.0", "size": 50599 }
[ "java.math.BigDecimal", "java.nio.ByteBuffer", "java.util.Calendar", "java.util.List", "java.util.Map", "org.apache.kafka.common.utils.Utils", "org.apache.kafka.connect.errors.DataException" ]
import java.math.BigDecimal; import java.nio.ByteBuffer; import java.util.Calendar; import java.util.List; import java.util.Map; import org.apache.kafka.common.utils.Utils; import org.apache.kafka.connect.errors.DataException;
import java.math.*; import java.nio.*; import java.util.*; import org.apache.kafka.common.utils.*; import org.apache.kafka.connect.errors.*;
[ "java.math", "java.nio", "java.util", "org.apache.kafka" ]
java.math; java.nio; java.util; org.apache.kafka;
176,794
EAttribute getExtendedQueryExpressionBody_OptimizeRecordsNumber();
EAttribute getExtendedQueryExpressionBody_OptimizeRecordsNumber();
/** * Returns the meta object for the attribute '{@link org.asup.db.syntax.dml.QExtendedQueryExpressionBody#getOptimizeRecordsNumber <em>Optimize Records Number</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Optimize Records Number</em>'. * @see org.asup.db.syntax.dml.QExtendedQueryExpressionBody#getOptimizeRecordsNumber() * @see #getExtendedQueryExpressionBody() * @generated */
Returns the meta object for the attribute '<code>org.asup.db.syntax.dml.QExtendedQueryExpressionBody#getOptimizeRecordsNumber Optimize Records Number</code>'.
getExtendedQueryExpressionBody_OptimizeRecordsNumber
{ "repo_name": "asupdev/asup", "path": "org.asup.db.syntax/src/org/asup/db/syntax/dml/QDatabaseDMLPackage.java", "license": "epl-1.0", "size": 23501 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,039,287
public static CouponIborSpreadDefinition from(final CouponIborDefinition couponIbor, final double spread) { Validate.notNull(couponIbor, "Ibor coupon"); return new CouponIborSpreadDefinition(couponIbor.getCurrency(), couponIbor.getPaymentDate(), couponIbor.getAccrualStartDate(), couponIbor.getAccrualEndDate(), couponIbor.getPaymentYearFraction(), couponIbor.getNotional(), couponIbor.getFixingDate(), couponIbor.getIndex(), spread); }
static CouponIborSpreadDefinition function(final CouponIborDefinition couponIbor, final double spread) { Validate.notNull(couponIbor, STR); return new CouponIborSpreadDefinition(couponIbor.getCurrency(), couponIbor.getPaymentDate(), couponIbor.getAccrualStartDate(), couponIbor.getAccrualEndDate(), couponIbor.getPaymentYearFraction(), couponIbor.getNotional(), couponIbor.getFixingDate(), couponIbor.getIndex(), spread); }
/** * Builder from an Ibor coupon and the spread. * @param couponIbor An Ibor coupon. * @param spread The spread. * @return The Ibor coupon with spread. */
Builder from an Ibor coupon and the spread
from
{ "repo_name": "charles-cooper/idylfin", "path": "src/com/opengamma/analytics/financial/instrument/payment/CouponIborSpreadDefinition.java", "license": "apache-2.0", "size": 12817 }
[ "org.apache.commons.lang.Validate" ]
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
2,798,531
public void status(final StatusType status, final MAP map, final ArjunaContext arjunaContext) ;
void function(final StatusType status, final MAP map, final ArjunaContext arjunaContext) ;
/** * Handle the status event. * @param status The status type. * @param map The addressing context. * @param arjunaContext The arjuna context. */
Handle the status event
status
{ "repo_name": "nmcl/scratch", "path": "graalvm/transactions/fork/narayana/XTS/WS-T/dev/src/com/arjuna/webservices11/wsba/CoordinatorCompletionParticipantInboundEvents.java", "license": "apache-2.0", "size": 4351 }
[ "com.arjuna.webservices11.wsarj.ArjunaContext", "org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType" ]
import com.arjuna.webservices11.wsarj.ArjunaContext; import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
import com.arjuna.webservices11.wsarj.*; import org.oasis_open.docs.ws_tx.wsba.*;
[ "com.arjuna.webservices11", "org.oasis_open.docs" ]
com.arjuna.webservices11; org.oasis_open.docs;
1,480,878
public static void handleBadRequest(String msg, Log log) throws BadRequestException { BadRequestException badRequestException = buildBadRequestException(msg); log.error(msg); throw badRequestException; }
static void function(String msg, Log log) throws BadRequestException { BadRequestException badRequestException = buildBadRequestException(msg); log.error(msg); throw badRequestException; }
/** * Logs the error, builds a BadRequestException with specified details and throws it * * @param msg error message * @param log Log instance * @throws BadRequestException */
Logs the error, builds a BadRequestException with specified details and throws it
handleBadRequest
{ "repo_name": "pradeepmurugesan/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/utils/RestApiUtil.java", "license": "apache-2.0", "size": 49979 }
[ "org.apache.commons.logging.Log", "org.wso2.carbon.apimgt.rest.api.util.exception.BadRequestException" ]
import org.apache.commons.logging.Log; import org.wso2.carbon.apimgt.rest.api.util.exception.BadRequestException;
import org.apache.commons.logging.*; import org.wso2.carbon.apimgt.rest.api.util.exception.*;
[ "org.apache.commons", "org.wso2.carbon" ]
org.apache.commons; org.wso2.carbon;
2,830,527
@Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(TimeClockPropertyType.class)) { case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__ACTUATE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__ARCROLE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__HREF: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__REMOTE_SCHEMA: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__ROLE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__SHOW: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__TITLE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__TYPE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__TIME_CLOCK: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(TimeClockPropertyType.class)) { case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__ACTUATE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__ARCROLE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__HREF: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__REMOTE_SCHEMA: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__ROLE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__SHOW: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__TITLE: case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__TYPE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case GmlPackage.TIME_CLOCK_PROPERTY_TYPE__TIME_CLOCK: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/TimeClockPropertyTypeItemProvider.java", "license": "apache-2.0", "size": 12126 }
[ "net.opengis.gml.GmlPackage", "net.opengis.gml.TimeClockPropertyType", "org.eclipse.emf.common.notify.Notification", "org.eclipse.emf.edit.provider.ViewerNotification" ]
import net.opengis.gml.GmlPackage; import net.opengis.gml.TimeClockPropertyType; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification;
import net.opengis.gml.*; import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*;
[ "net.opengis.gml", "org.eclipse.emf" ]
net.opengis.gml; org.eclipse.emf;
419,663
public static final class Solenoids { public static Solenoid doubleSolenoid(int extendChannel, int retractChannel, Solenoid.Direction initialDirection) { DoubleSolenoid solenoid = new DoubleSolenoid(extendChannel, retractChannel); return new HardwareDoubleSolenoid(solenoid, initialDirection); }
static final class Solenoids { public static Solenoid function(int extendChannel, int retractChannel, Solenoid.Direction initialDirection) { DoubleSolenoid solenoid = new DoubleSolenoid(extendChannel, retractChannel); return new HardwareDoubleSolenoid(solenoid, initialDirection); }
/** * Create a double-acting solenoid that uses the specified channels on the default module. * * @param extendChannel the channel that extends the solenoid * @param retractChannel the channel that retracts the solenoid * @param initialDirection the initial direction for the solenoid; may not be null * @return a solenoid on the specified channels; never null */
Create a double-acting solenoid that uses the specified channels on the default module
doubleSolenoid
{ "repo_name": "WawerOS/strongback-java", "path": "strongback/src/org/strongback/hardware/Hardware.java", "license": "mit", "size": 49556 }
[ "edu.wpi.first.wpilibj.DoubleSolenoid", "org.strongback.components.Solenoid" ]
import edu.wpi.first.wpilibj.DoubleSolenoid; import org.strongback.components.Solenoid;
import edu.wpi.first.wpilibj.*; import org.strongback.components.*;
[ "edu.wpi.first", "org.strongback.components" ]
edu.wpi.first; org.strongback.components;
1,537,574
public Value []getGlobalList() { return _globalValues; }
public Value []getGlobalList() { return _globalValues; }
/** * Returns the global values */
Returns the global values
getGlobalList
{ "repo_name": "christianchristensen/resin", "path": "modules/quercus/src/com/caucho/quercus/env/SaveState.java", "license": "gpl-2.0", "size": 5283 }
[ "com.caucho.quercus.env.Value" ]
import com.caucho.quercus.env.Value;
import com.caucho.quercus.env.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
675,412
private File getSampleProjectCodenameOneSettingsFile(SamplesContext context) { return new File(getBuildProjectDir(context), "codenameone_settings.properties"); }
File function(SamplesContext context) { return new File(getBuildProjectDir(context), STR); }
/** * Gets the codenameone_settings.properties file from the sample project. * @param context * @return */
Gets the codenameone_settings.properties file from the sample project
getSampleProjectCodenameOneSettingsFile
{ "repo_name": "saeder/CodenameOne", "path": "Samples/src/com/codename1/samples/Sample.java", "license": "gpl-2.0", "size": 26694 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,508,995
private void insertGeneratedDeclarationCodeToGlobalScope( Node enclosingNode, Node declarationCode) { switch (enclosingNode.getToken()) { case MODULE_BODY: { Node insertionPoint = getNodeForInsertion(enclosingNode.getParent()); insertionPoint.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(insertionPoint)); } break; case SCRIPT: { enclosingNode.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(enclosingNode)); } break; case CALL: { // This case represents only the Polymer calls which are enclosed inside an IIFE checkState(isIIFE(enclosingNode)); Node enclosingNodeForIIFE = NodeUtil.getEnclosingNode( enclosingNode.getParent(), node -> node.isScript() || node.isModuleBody()); if (enclosingNodeForIIFE.isScript()) { enclosingNodeForIIFE.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(enclosingNodeForIIFE)); } else { checkState(enclosingNodeForIIFE.isModuleBody()); Node insertionPoint = getNodeForInsertion(enclosingNodeForIIFE.getParent()); insertionPoint.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(insertionPoint)); } } break; case FUNCTION: { // This case represents only the Polymer calls that are inside a function which is an arg // to goog.loadModule checkState(isFunctionArgInGoogLoadModule(enclosingNode)); Node enclosingScript = NodeUtil.getEnclosingScript(enclosingNode); Node insertionPoint = getNodeForInsertion(enclosingScript); insertionPoint.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(insertionPoint); } break; default: throw new RuntimeException("Enclosing node for Polymer is incorrect"); } }
void function( Node enclosingNode, Node declarationCode) { switch (enclosingNode.getToken()) { case MODULE_BODY: { Node insertionPoint = getNodeForInsertion(enclosingNode.getParent()); insertionPoint.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(insertionPoint)); } break; case SCRIPT: { enclosingNode.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(enclosingNode)); } break; case CALL: { checkState(isIIFE(enclosingNode)); Node enclosingNodeForIIFE = NodeUtil.getEnclosingNode( enclosingNode.getParent(), node -> node.isScript() node.isModuleBody()); if (enclosingNodeForIIFE.isScript()) { enclosingNodeForIIFE.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(enclosingNodeForIIFE)); } else { checkState(enclosingNodeForIIFE.isModuleBody()); Node insertionPoint = getNodeForInsertion(enclosingNodeForIIFE.getParent()); insertionPoint.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(NodeUtil.getEnclosingScript(insertionPoint)); } } break; case FUNCTION: { checkState(isFunctionArgInGoogLoadModule(enclosingNode)); Node enclosingScript = NodeUtil.getEnclosingScript(enclosingNode); Node insertionPoint = getNodeForInsertion(enclosingScript); insertionPoint.addChildToFront(declarationCode); compiler.reportChangeToChangeScope(insertionPoint); } break; default: throw new RuntimeException(STR); } }
/** * This function accepts declaration code generated for a nonGlobal Polymer call and inserts that * into the AST depending on the enclosing scope of the Polymer call. * * @param enclosingNode The enclosing scope of the Polymer call decided by the rewritePolymerCall * @param declarationCode declaration code generated for Polymer call */
This function accepts declaration code generated for a nonGlobal Polymer call and inserts that into the AST depending on the enclosing scope of the Polymer call
insertGeneratedDeclarationCodeToGlobalScope
{ "repo_name": "vobruba-martin/closure-compiler", "path": "src/com/google/javascript/jscomp/PolymerClassRewriter.java", "license": "apache-2.0", "size": 63474 }
[ "com.google.common.base.Preconditions", "com.google.javascript.rhino.Node" ]
import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node;
import com.google.common.base.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
384,204
public long orElseThrow() { if (!isPresent) { throw new NoSuchElementException("No value present"); } return value; }
long function() { if (!isPresent) { throw new NoSuchElementException(STR); } return value; }
/** * Returns inner value if present, otherwise throws {@code NoSuchElementException}. * * @return inner value if present * @throws NoSuchElementException if inner value is not present * @since 1.2.0 */
Returns inner value if present, otherwise throws NoSuchElementException
orElseThrow
{ "repo_name": "aNNiMON/Lightweight-Stream-API", "path": "stream/src/main/java/com/annimon/stream/OptionalLong.java", "license": "apache-2.0", "size": 11637 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
2,072,226
public void setType(TypeVariable type) { this.type = type; }
void function(TypeVariable type) { this.type = type; }
/** * Sets the TypeVariable this TypeParameter evaluates to * @param type the TypeVariable this TypeParameter evaluates to */
Sets the TypeVariable this TypeParameter evaluates to
setType
{ "repo_name": "mhems/jhelp", "path": "src/com/binghamton/jhelp/ast/TypeParameter.java", "license": "bsd-3-clause", "size": 4676 }
[ "com.binghamton.jhelp.types.TypeVariable" ]
import com.binghamton.jhelp.types.TypeVariable;
import com.binghamton.jhelp.types.*;
[ "com.binghamton.jhelp" ]
com.binghamton.jhelp;
1,085,390
public YieldAndDiscountCurve getCurve(final Currency ccy) { return getMulticurveProvider().getCurve(ccy); }
YieldAndDiscountCurve function(final Currency ccy) { return getMulticurveProvider().getCurve(ccy); }
/** * Gets the discounting curve associated in a given currency in the market. * @param ccy The currency. * @return The curve. */
Gets the discounting curve associated in a given currency in the market
getCurve
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/provider/description/interestrate/BlackSwaptionFlatProviderDiscount.java", "license": "apache-2.0", "size": 6302 }
[ "com.opengamma.analytics.financial.model.interestrate.curve.YieldAndDiscountCurve", "com.opengamma.util.money.Currency" ]
import com.opengamma.analytics.financial.model.interestrate.curve.YieldAndDiscountCurve; import com.opengamma.util.money.Currency;
import com.opengamma.analytics.financial.model.interestrate.curve.*; import com.opengamma.util.money.*;
[ "com.opengamma.analytics", "com.opengamma.util" ]
com.opengamma.analytics; com.opengamma.util;
2,322,378
protected Ignite startGrid(String igniteInstanceName, String springCfgPath) throws Exception { return startGrid(igniteInstanceName, loadConfiguration(springCfgPath)); }
Ignite function(String igniteInstanceName, String springCfgPath) throws Exception { return startGrid(igniteInstanceName, loadConfiguration(springCfgPath)); }
/** * Starts grid using provided Ignite instance name and spring config location. * <p> * Note that grids started this way should be stopped with {@code G.stop(..)} methods. * * @param igniteInstanceName Ignite instance name. * @param springCfgPath Path to config file. * @return Grid Started grid. * @throws Exception If failed. */
Starts grid using provided Ignite instance name and spring config location. Note that grids started this way should be stopped with G.stop(..) methods
startGrid
{ "repo_name": "WilliamDo/ignite", "path": "modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java", "license": "apache-2.0", "size": 76816 }
[ "org.apache.ignite.Ignite" ]
import org.apache.ignite.Ignite;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
632,536
SqlNodeList expandStar( SqlNodeList selectList, SqlSelect query, boolean includeSystemVars);
SqlNodeList expandStar( SqlNodeList selectList, SqlSelect query, boolean includeSystemVars);
/** * Returns a list of expressions, with every occurrence of "&#42;" or * "TABLE.&#42;" expanded. * * @param selectList Select clause to be expanded * @param query Query * @param includeSystemVars Whether to include system variables * @return expanded select clause */
Returns a list of expressions, with every occurrence of "&#42;" or "TABLE.&#42;" expanded
expandStar
{ "repo_name": "glimpseio/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/sql/validate/SqlValidator.java", "license": "apache-2.0", "size": 24006 }
[ "org.apache.calcite.sql.SqlNodeList", "org.apache.calcite.sql.SqlSelect" ]
import org.apache.calcite.sql.SqlNodeList; import org.apache.calcite.sql.SqlSelect;
import org.apache.calcite.sql.*;
[ "org.apache.calcite" ]
org.apache.calcite;
237,926
public List<BigInteger> calculate(List<BigInteger> list, int begin, int length) { List<BigInteger> result = new ArrayList<BigInteger>(); for(int i = begin; i < begin + length; i++) { result.add(list.get(i).add(BigInteger.ONE)); } return result; }
List<BigInteger> function(List<BigInteger> list, int begin, int length) { List<BigInteger> result = new ArrayList<BigInteger>(); for(int i = begin; i < begin + length; i++) { result.add(list.get(i).add(BigInteger.ONE)); } return result; }
/** * Increments the values in the list between the indices. * @param List<BigInteger> the list * @return the result */
Increments the values in the list between the indices
calculate
{ "repo_name": "jessemull/MicroFlex", "path": "src/main/java/com/github/jessemull/microflex/bigintegerflex/math/IncrementBigInteger.java", "license": "apache-2.0", "size": 2487 }
[ "java.math.BigInteger", "java.util.ArrayList", "java.util.List" ]
import java.math.BigInteger; import java.util.ArrayList; import java.util.List;
import java.math.*; import java.util.*;
[ "java.math", "java.util" ]
java.math; java.util;
2,778,893
URL base; try { try { base = new URL(refer); } catch (MalformedURLException e) { // the base is unsuitable, but the attribute may be abs on its own, so try that URL abs = new URL(refer); return abs.toExternalForm(); } // workaround: java resolves '//path/file + ?foo' to '//path/?foo', not '//path/file?foo' as desired if (url.startsWith("?")) url = base.getPath() + url; URL abs = new URL(base, url); return encodeIllegalCharacterInUrl(abs.toExternalForm()); } catch (MalformedURLException e) { return ""; } }
URL base; try { try { base = new URL(refer); } catch (MalformedURLException e) { URL abs = new URL(refer); return abs.toExternalForm(); } if (url.startsWith("?")) url = base.getPath() + url; URL abs = new URL(base, url); return encodeIllegalCharacterInUrl(abs.toExternalForm()); } catch (MalformedURLException e) { return ""; } }
/** * canonicalizeUrl * <br> * Borrowed from Jsoup. * * @param url url * @param refer refer * @return canonicalizeUrl */
canonicalizeUrl Borrowed from Jsoup
canonicalizeUrl
{ "repo_name": "zhuyuesut/webmagic", "path": "webmagic-core/src/main/java/us/codecraft/webmagic/utils/UrlUtils.java", "license": "apache-2.0", "size": 3611 }
[ "java.net.MalformedURLException" ]
import java.net.MalformedURLException;
import java.net.*;
[ "java.net" ]
java.net;
325,294
public List<DiscoveryNode> filteredNodes() { return nodesService.filteredNodes(); }
List<DiscoveryNode> function() { return nodesService.filteredNodes(); }
/** * The list of filtered nodes that were not connected to, for example, due to * mismatch in cluster name. */
The list of filtered nodes that were not connected to, for example, due to mismatch in cluster name
filteredNodes
{ "repo_name": "nezirus/elasticsearch", "path": "core/src/main/java/org/elasticsearch/client/transport/TransportClient.java", "license": "apache-2.0", "size": 18756 }
[ "java.util.List", "org.elasticsearch.cluster.node.DiscoveryNode" ]
import java.util.List; import org.elasticsearch.cluster.node.DiscoveryNode;
import java.util.*; import org.elasticsearch.cluster.node.*;
[ "java.util", "org.elasticsearch.cluster" ]
java.util; org.elasticsearch.cluster;
798,660
private Attribute[] getOnDemandQueryOutputAttributes(OnDemandQuery onDemandQuery, String onDemandQueryString) { try { OnDemandQueryRuntime onDemandQueryRuntime = onDemandQueryRuntimeMap.get(onDemandQuery); if (onDemandQueryRuntime == null) { onDemandQueryRuntime = OnDemandQueryParser.parse(onDemandQuery, onDemandQueryString, siddhiAppContext, tableMap, windowMap, aggregationMap); onDemandQueryRuntimeMap.put(onDemandQuery, onDemandQueryRuntime); } return onDemandQueryRuntime.getOnDemandQueryOutputAttributes(); } catch (RuntimeException e) { if (e instanceof SiddhiAppContextException) { throw new OnDemandQueryCreationException(((SiddhiAppContextException) e).getMessageWithOutContext(), e, ((SiddhiAppContextException) e).getQueryContextStartIndex(), ((SiddhiAppContextException) e).getQueryContextEndIndex(), null, siddhiAppContext .getSiddhiAppString()); } throw new OnDemandQueryCreationException(e.getMessage(), e); } }
Attribute[] function(OnDemandQuery onDemandQuery, String onDemandQueryString) { try { OnDemandQueryRuntime onDemandQueryRuntime = onDemandQueryRuntimeMap.get(onDemandQuery); if (onDemandQueryRuntime == null) { onDemandQueryRuntime = OnDemandQueryParser.parse(onDemandQuery, onDemandQueryString, siddhiAppContext, tableMap, windowMap, aggregationMap); onDemandQueryRuntimeMap.put(onDemandQuery, onDemandQueryRuntime); } return onDemandQueryRuntime.getOnDemandQueryOutputAttributes(); } catch (RuntimeException e) { if (e instanceof SiddhiAppContextException) { throw new OnDemandQueryCreationException(((SiddhiAppContextException) e).getMessageWithOutContext(), e, ((SiddhiAppContextException) e).getQueryContextStartIndex(), ((SiddhiAppContextException) e).getQueryContextEndIndex(), null, siddhiAppContext .getSiddhiAppString()); } throw new OnDemandQueryCreationException(e.getMessage(), e); } }
/** * This method get the onDemandQuery and return the corresponding output and its types. * * @param onDemandQuery this onDemandQuery is processed and get the output attributes. * @param onDemandQueryString this passed to report errors with context if there are any. * @return List of output attributes */
This method get the onDemandQuery and return the corresponding output and its types
getOnDemandQueryOutputAttributes
{ "repo_name": "suhothayan/siddhi", "path": "modules/siddhi-core/src/main/java/io/siddhi/core/SiddhiAppRuntimeImpl.java", "license": "apache-2.0", "size": 41827 }
[ "io.siddhi.core.exception.OnDemandQueryCreationException", "io.siddhi.core.query.OnDemandQueryRuntime", "io.siddhi.core.util.parser.OnDemandQueryParser", "io.siddhi.query.api.definition.Attribute", "io.siddhi.query.api.exception.SiddhiAppContextException", "io.siddhi.query.api.execution.query.OnDemandQuery" ]
import io.siddhi.core.exception.OnDemandQueryCreationException; import io.siddhi.core.query.OnDemandQueryRuntime; import io.siddhi.core.util.parser.OnDemandQueryParser; import io.siddhi.query.api.definition.Attribute; import io.siddhi.query.api.exception.SiddhiAppContextException; import io.siddhi.query.api.execution.query.OnDemandQuery;
import io.siddhi.core.exception.*; import io.siddhi.core.query.*; import io.siddhi.core.util.parser.*; import io.siddhi.query.api.definition.*; import io.siddhi.query.api.exception.*; import io.siddhi.query.api.execution.query.*;
[ "io.siddhi.core", "io.siddhi.query" ]
io.siddhi.core; io.siddhi.query;
2,424,088
@GetMapping(value = "/getMemStats") @ResponseBody public Map<String, Object> getMemoryStats(final HttpServletRequest request, final HttpServletResponse response) { ensureEndpointAccessIsAuthorized(request, response); final Map<String, Object> model = new HashMap<>(); model.put("totalMemory", convertToMegaBytes(Runtime.getRuntime().totalMemory())); model.put("maxMemory", convertToMegaBytes(Runtime.getRuntime().maxMemory())); model.put("freeMemory", convertToMegaBytes(Runtime.getRuntime().freeMemory())); return model; }
@GetMapping(value = STR) Map<String, Object> function(final HttpServletRequest request, final HttpServletResponse response) { ensureEndpointAccessIsAuthorized(request, response); final Map<String, Object> model = new HashMap<>(); model.put(STR, convertToMegaBytes(Runtime.getRuntime().totalMemory())); model.put(STR, convertToMegaBytes(Runtime.getRuntime().maxMemory())); model.put(STR, convertToMegaBytes(Runtime.getRuntime().freeMemory())); return model; }
/** * Gets memory stats. * * @param request the http servlet request * @param response the http servlet response * @return the memory stats */
Gets memory stats
getMemoryStats
{ "repo_name": "doodelicious/cas", "path": "support/cas-server-support-reports/src/main/java/org/apereo/cas/web/report/StatisticsController.java", "license": "apache-2.0", "size": 14152 }
[ "java.util.HashMap", "java.util.Map", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.springframework.web.bind.annotation.GetMapping" ]
import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.bind.annotation.GetMapping;
import java.util.*; import javax.servlet.http.*; import org.springframework.web.bind.annotation.*;
[ "java.util", "javax.servlet", "org.springframework.web" ]
java.util; javax.servlet; org.springframework.web;
2,350,261
protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { if (actions != null) { for (IAction action : actions) { if (contributionID != null) { manager.insertBefore(contributionID, action); } else { manager.add(action); } } } }
void function(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { if (actions != null) { for (IAction action : actions) { if (contributionID != null) { manager.insertBefore(contributionID, action); } else { manager.add(action); } } } }
/** * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, * by inserting them before the specified contribution item <code>contributionID</code>. * If <code>contributionID</code> is <code>null</code>, they are simply added. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This populates the specified <code>manager</code> with <code>org.eclipse.jface.action.ActionContributionItem</code>s based on the <code>org.eclipse.jface.action.IAction</code>s contained in the <code>actions</code> collection, by inserting them before the specified contribution item <code>contributionID</code>. If <code>contributionID</code> is <code>null</code>, they are simply added.
populateManager
{ "repo_name": "lfmendivelso10/AppModernization", "path": "source/i2/VisualizacionMetricas3.editor/src/visualizacionMetricas3/visualizacion/presentation/VisualizacionActionBarContributor.java", "license": "mit", "size": 14235 }
[ "java.util.Collection", "org.eclipse.jface.action.IAction", "org.eclipse.jface.action.IContributionManager" ]
import java.util.Collection; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionManager;
import java.util.*; import org.eclipse.jface.action.*;
[ "java.util", "org.eclipse.jface" ]
java.util; org.eclipse.jface;
2,035,979
public static java.util.List extractSafeEnvironmentComponentList(ims.domain.ILightweightDomainFactory domainFactory, ims.spinalinjuries.vo.NurAssessmentSafeEnvironmentVoCollection voCollection) { return extractSafeEnvironmentComponentList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.spinalinjuries.vo.NurAssessmentSafeEnvironmentVoCollection voCollection) { return extractSafeEnvironmentComponentList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.nursing.assessment.domain.objects.SafeEnvironmentComponent list from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.nursing.assessment.domain.objects.SafeEnvironmentComponent list from the value object collection
extractSafeEnvironmentComponentList
{ "repo_name": "FreudianNM/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/spinalinjuries/vo/domain/NurAssessmentSafeEnvironmentVoAssembler.java", "license": "agpl-3.0", "size": 27720 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,270,265
private Controller getController() throws JspException { if (controllerType == null) { return null; } try { return ComponentDefinition.createController( controllerName, controllerType); } catch (InstantiationException ex) { throw new JspException(ex); } }
Controller function() throws JspException { if (controllerType == null) { return null; } try { return ComponentDefinition.createController( controllerName, controllerType); } catch (InstantiationException ex) { throw new JspException(ex); } }
/** * Get instantiated Controller. * Return controller denoted by controllerType, or <code>null</code> if controllerType * is null. * @throws JspException If controller can't be created. */
Get instantiated Controller. Return controller denoted by controllerType, or <code>null</code> if controllerType is null
getController
{ "repo_name": "shuliangtao/struts-1.3.10", "path": "src/tiles/src/main/java/org/apache/struts/tiles/taglib/InsertTag.java", "license": "apache-2.0", "size": 32416 }
[ "javax.servlet.jsp.JspException", "org.apache.struts.tiles.ComponentDefinition", "org.apache.struts.tiles.Controller" ]
import javax.servlet.jsp.JspException; import org.apache.struts.tiles.ComponentDefinition; import org.apache.struts.tiles.Controller;
import javax.servlet.jsp.*; import org.apache.struts.tiles.*;
[ "javax.servlet", "org.apache.struts" ]
javax.servlet; org.apache.struts;
1,720,414