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
protected void setDisplayOrientation(Camera camera, int angle){ Method downPolymorphic; try { downPolymorphic = camera.getClass().getMethod("setDisplayOrientation", new Class[] { int.class }); if (downPolymorphic != null) downPolymorphic.invoke(camera, new Object[] { angle }); } catch (Exception e1) { } }
void function(Camera camera, int angle){ Method downPolymorphic; try { downPolymorphic = camera.getClass().getMethod(STR, new Class[] { int.class }); if (downPolymorphic != null) downPolymorphic.invoke(camera, new Object[] { angle }); } catch (Exception e1) { } }
/** * compatible 1.6 * @param camera * @param angle */
compatible 1.6
setDisplayOrientation
{ "repo_name": "taozhiheng/SimpleRepository", "path": "Book/app/src/main/java/zxing/camera/CameraConfigurationManager.java", "license": "mit", "size": 9523 }
[ "android.hardware.Camera", "java.lang.reflect.Method" ]
import android.hardware.Camera; import java.lang.reflect.Method;
import android.hardware.*; import java.lang.reflect.*;
[ "android.hardware", "java.lang" ]
android.hardware; java.lang;
854,030
public BinaryField affinityKeyField(int typeId) { // Fast path for already cached field. T1<BinaryField> fieldHolder = affKeyFields.get(typeId); if (fieldHolder != null) return fieldHolder.get(); // Slow path if affinity field is not cached yet. String name = binaryCtx.affinityKeyFieldName(typeId); if (name != null) { BinaryField field = binaryCtx.createField(typeId, name); affKeyFields.putIfAbsent(typeId, new T1<>(field)); return field; } else { affKeyFields.putIfAbsent(typeId, new T1<>(null)); return null; } }
BinaryField function(int typeId) { T1<BinaryField> fieldHolder = affKeyFields.get(typeId); if (fieldHolder != null) return fieldHolder.get(); String name = binaryCtx.affinityKeyFieldName(typeId); if (name != null) { BinaryField field = binaryCtx.createField(typeId, name); affKeyFields.putIfAbsent(typeId, new T1<>(field)); return field; } else { affKeyFields.putIfAbsent(typeId, new T1<>(null)); return null; } }
/** * Get affinity key field. * * @param typeId Binary object type ID. * @return Affinity key. */
Get affinity key field
affinityKeyField
{ "repo_name": "ptupitsyn/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java", "license": "apache-2.0", "size": 55478 }
[ "org.apache.ignite.binary.BinaryField" ]
import org.apache.ignite.binary.BinaryField;
import org.apache.ignite.binary.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,271,195
public @Bean SimpleMappingExceptionResolver simpleMappingExceptionResolver () { final SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver (); resolver.setDefaultErrorView ("defaultException"); resolver.setDefaultStatusCode (500); return resolver; }
@Bean SimpleMappingExceptionResolver function () { final SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver (); resolver.setDefaultErrorView (STR); resolver.setDefaultStatusCode (500); return resolver; }
/** * Route exceptions to defaultException.vm with a default status code of 500. */
Route exceptions to defaultException.vm with a default status code of 500
simpleMappingExceptionResolver
{ "repo_name": "CDS-VRN/InSpider", "path": "admin/src/main/java/nl/ipo/cds/admin/config/AdminWebMvcConfig.java", "license": "gpl-3.0", "size": 9599 }
[ "org.springframework.context.annotation.Bean", "org.springframework.web.servlet.handler.SimpleMappingExceptionResolver" ]
import org.springframework.context.annotation.Bean; import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
import org.springframework.context.annotation.*; import org.springframework.web.servlet.handler.*;
[ "org.springframework.context", "org.springframework.web" ]
org.springframework.context; org.springframework.web;
2,553,769
@Override public AqlLazyResult executeQueryLazy(String query) { log.debug("Processing textual AqlApi query: {}", query); ParserElementResultContainer parserResult = parser.parse(query); return executeQueryLazy(parserResult); }
AqlLazyResult function(String query) { log.debug(STR, query); ParserElementResultContainer parserResult = parser.parse(query); return executeQueryLazy(parserResult); }
/** * Converts the Json query into SQL query and executes the query lazy */
Converts the Json query into SQL query and executes the query lazy
executeQueryLazy
{ "repo_name": "alancnet/artifactory", "path": "storage/db/src/main/java/org/artifactory/storage/db/aql/service/AqlServiceImpl.java", "license": "apache-2.0", "size": 6869 }
[ "org.artifactory.aql.result.AqlLazyResult", "org.artifactory.storage.db.aql.parser.ParserElementResultContainer" ]
import org.artifactory.aql.result.AqlLazyResult; import org.artifactory.storage.db.aql.parser.ParserElementResultContainer;
import org.artifactory.aql.result.*; import org.artifactory.storage.db.aql.parser.*;
[ "org.artifactory.aql", "org.artifactory.storage" ]
org.artifactory.aql; org.artifactory.storage;
225,944
public EnvEntryType<T> envEntryValue(String envEntryValue) { childNode.getOrCreate("env-entry-value").text(envEntryValue); return this; }
EnvEntryType<T> function(String envEntryValue) { childNode.getOrCreate(STR).text(envEntryValue); return this; }
/** * Sets the <code>env-entry-value</code> element * @param envEntryValue the value for the element <code>env-entry-value</code> * @return the current instance of <code>EnvEntryType<T></code> */
Sets the <code>env-entry-value</code> element
envEntryValue
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/javaee7/EnvEntryTypeImpl.java", "license": "epl-1.0", "size": 12856 }
[ "org.jboss.shrinkwrap.descriptor.api.javaee7.EnvEntryType" ]
import org.jboss.shrinkwrap.descriptor.api.javaee7.EnvEntryType;
import org.jboss.shrinkwrap.descriptor.api.javaee7.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
388,122
@JsOverlay public static boolean is(JavaScriptObject o) { if (Element.is(o)) { return is((Element) o); } return false; }
static boolean function(JavaScriptObject o) { if (Element.is(o)) { return is((Element) o); } return false; }
/** * Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null * </code> object will cause this method to return <code>false</code>. * * @param o the object to check if it is an instance of this type * @return true of the object is an instance of this type, false otherwise */
Determines whether the given <code>JavaScriptObject</code> can be cast to this class. A <code>null </code> object will cause this method to return <code>false</code>
is
{ "repo_name": "gwtproject/gwt-dom", "path": "gwt-dom/src/main/java/org/gwtproject/dom/client/TableElement.java", "license": "apache-2.0", "size": 9803 }
[ "org.gwtproject.core.client.JavaScriptObject" ]
import org.gwtproject.core.client.JavaScriptObject;
import org.gwtproject.core.client.*;
[ "org.gwtproject.core" ]
org.gwtproject.core;
1,074,813
public static ConstructorCallExpression getFirstIfSpecialConstructorCall(final Statement code) { if (code == null) return null; if (code instanceof BlockStatement) { final BlockStatement block = (BlockStatement) code; final List<Statement> statementList = block.getStatements(); if (statementList.isEmpty()) return null; // handle blocks of blocks return getFirstIfSpecialConstructorCall(statementList.get(0)); } if (!(code instanceof ExpressionStatement)) return null; Expression expression = ((ExpressionStatement) code).getExpression(); if (!(expression instanceof ConstructorCallExpression)) return null; ConstructorCallExpression cce = (ConstructorCallExpression) expression; if (cce.isSpecialCall()) return cce; return null; }
static ConstructorCallExpression function(final Statement code) { if (code == null) return null; if (code instanceof BlockStatement) { final BlockStatement block = (BlockStatement) code; final List<Statement> statementList = block.getStatements(); if (statementList.isEmpty()) return null; return getFirstIfSpecialConstructorCall(statementList.get(0)); } if (!(code instanceof ExpressionStatement)) return null; Expression expression = ((ExpressionStatement) code).getExpression(); if (!(expression instanceof ConstructorCallExpression)) return null; ConstructorCallExpression cce = (ConstructorCallExpression) expression; if (cce.isSpecialCall()) return cce; return null; }
/** * Return the first statement from the constructor code if it is a call to super or this, otherwise null. * * @param code the code to check * @return the first statement if a special call or null */
Return the first statement from the constructor code if it is a call to super or this, otherwise null
getFirstIfSpecialConstructorCall
{ "repo_name": "apache/incubator-groovy", "path": "src/main/java/org/apache/groovy/ast/tools/ConstructorNodeUtils.java", "license": "apache-2.0", "size": 5581 }
[ "java.util.List", "org.codehaus.groovy.ast.expr.ConstructorCallExpression", "org.codehaus.groovy.ast.expr.Expression", "org.codehaus.groovy.ast.stmt.BlockStatement", "org.codehaus.groovy.ast.stmt.ExpressionStatement", "org.codehaus.groovy.ast.stmt.Statement" ]
import java.util.List; import org.codehaus.groovy.ast.expr.ConstructorCallExpression; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.stmt.BlockStatement; import org.codehaus.groovy.ast.stmt.ExpressionStatement; import org.codehaus.groovy.ast.stmt.Statement;
import java.util.*; import org.codehaus.groovy.ast.expr.*; import org.codehaus.groovy.ast.stmt.*;
[ "java.util", "org.codehaus.groovy" ]
java.util; org.codehaus.groovy;
2,503,065
private static boolean showCheatSheet(View view, CharSequence text) { if (TextUtils.isEmpty(text)) { return false; } final int[] screenPos = new int[2]; // origin is device display final Rect displayFrame = new Rect(); // includes decorations (e.g. status bar) view.getLocationOnScreen(screenPos); view.getWindowVisibleDisplayFrame(displayFrame); final Context context = view.getContext(); final int viewWidth = view.getWidth(); final int viewHeight = view.getHeight(); final int viewCenterX = screenPos[0] + (viewWidth / 2); final int screenWidth = context.getResources().getDisplayMetrics().widthPixels; final int estimatedToastHeight = (int)(ESTIMATED_TOAST_HEIGHT_DPS * context.getResources().getDisplayMetrics().density); Toast cheatSheet = Toast.makeText(context, text, Toast.LENGTH_SHORT); boolean showBelow = screenPos[1] < estimatedToastHeight; if (showBelow) { // Show below // Offsets are after decorations (e.g. status bar) are factored in cheatSheet.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2), (screenPos[1] - displayFrame.top) + viewHeight); } else { // Show above // Offsets are after decorations (e.g. status bar) are factored in cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2), displayFrame.bottom - screenPos[1]); } cheatSheet.show(); return true; }
static boolean function(View view, CharSequence text) { if (TextUtils.isEmpty(text)) { return false; } final int[] screenPos = new int[2]; final Rect displayFrame = new Rect(); view.getLocationOnScreen(screenPos); view.getWindowVisibleDisplayFrame(displayFrame); final Context context = view.getContext(); final int viewWidth = view.getWidth(); final int viewHeight = view.getHeight(); final int viewCenterX = screenPos[0] + (viewWidth / 2); final int screenWidth = context.getResources().getDisplayMetrics().widthPixels; final int estimatedToastHeight = (int)(ESTIMATED_TOAST_HEIGHT_DPS * context.getResources().getDisplayMetrics().density); Toast cheatSheet = Toast.makeText(context, text, Toast.LENGTH_SHORT); boolean showBelow = screenPos[1] < estimatedToastHeight; if (showBelow) { cheatSheet.setGravity(Gravity.TOP Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2), (screenPos[1] - displayFrame.top) + viewHeight); } else { cheatSheet.setGravity(Gravity.BOTTOM Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2), displayFrame.bottom - screenPos[1]); } cheatSheet.show(); return true; }
/** * Internal helper method to show the cheat sheet toast. */
Internal helper method to show the cheat sheet toast
showCheatSheet
{ "repo_name": "wskplho/jdroid", "path": "jdroid-android/src/main/java/com/jdroid/android/utils/TooltipHelper.java", "license": "apache-2.0", "size": 4798 }
[ "android.content.Context", "android.graphics.Rect", "android.text.TextUtils", "android.view.Gravity", "android.view.View", "android.widget.Toast" ]
import android.content.Context; import android.graphics.Rect; import android.text.TextUtils; import android.view.Gravity; import android.view.View; import android.widget.Toast;
import android.content.*; import android.graphics.*; import android.text.*; import android.view.*; import android.widget.*;
[ "android.content", "android.graphics", "android.text", "android.view", "android.widget" ]
android.content; android.graphics; android.text; android.view; android.widget;
757,146
protected void establishRoute(HttpRoute route, HttpContext context) throws HttpException, IOException { HttpRouteDirector rowdy = new BasicRouteDirector(); int step; do { HttpRoute fact = managedConn.getRoute(); step = rowdy.nextStep(route, fact); switch (step) { case HttpRouteDirector.CONNECT_TARGET: case HttpRouteDirector.CONNECT_PROXY: managedConn.open(route, context, this.params); break; case HttpRouteDirector.TUNNEL_TARGET: { boolean secure = createTunnelToTarget(route, context); this.log.debug("Tunnel to target created."); managedConn.tunnelTarget(secure, this.params); } break; case HttpRouteDirector.TUNNEL_PROXY: { // The most simple example for this case is a proxy chain // of two proxies, where P1 must be tunnelled to P2. // route: Source -> P1 -> P2 -> Target (3 hops) // fact: Source -> P1 -> Target (2 hops) final int hop = fact.getHopCount()-1; // the hop to establish boolean secure = createTunnelToProxy(route, hop, context); this.log.debug("Tunnel to proxy created."); managedConn.tunnelProxy(route.getHopTarget(hop), secure, this.params); } break; case HttpRouteDirector.LAYER_PROTOCOL: managedConn.layerProtocol(context, this.params); break; case HttpRouteDirector.UNREACHABLE: throw new IllegalStateException ("Unable to establish route." + "\nplanned = " + route + "\ncurrent = " + fact); case HttpRouteDirector.COMPLETE: // do nothing break; default: throw new IllegalStateException ("Unknown step indicator "+step+" from RouteDirector."); } // switch } while (step > HttpRouteDirector.COMPLETE); } // establishConnection
void function(HttpRoute route, HttpContext context) throws HttpException, IOException { HttpRouteDirector rowdy = new BasicRouteDirector(); int step; do { HttpRoute fact = managedConn.getRoute(); step = rowdy.nextStep(route, fact); switch (step) { case HttpRouteDirector.CONNECT_TARGET: case HttpRouteDirector.CONNECT_PROXY: managedConn.open(route, context, this.params); break; case HttpRouteDirector.TUNNEL_TARGET: { boolean secure = createTunnelToTarget(route, context); this.log.debug(STR); managedConn.tunnelTarget(secure, this.params); } break; case HttpRouteDirector.TUNNEL_PROXY: { final int hop = fact.getHopCount()-1; boolean secure = createTunnelToProxy(route, hop, context); this.log.debug(STR); managedConn.tunnelProxy(route.getHopTarget(hop), secure, this.params); } break; case HttpRouteDirector.LAYER_PROTOCOL: managedConn.layerProtocol(context, this.params); break; case HttpRouteDirector.UNREACHABLE: throw new IllegalStateException (STR + STR + route + STR + fact); case HttpRouteDirector.COMPLETE: break; default: throw new IllegalStateException (STR+step+STR); } } while (step > HttpRouteDirector.COMPLETE); }
/** * Establishes the target route. * * @param route the route to establish * @param context the context for the request execution * * @throws HttpException in case of a problem * @throws IOException in case of an IO problem */
Establishes the target route
establishRoute
{ "repo_name": "onedanshow/Screen-Courter", "path": "lib/src/org/apache/http/impl/client/DefaultRequestDirector.java", "license": "gpl-3.0", "size": 50680 }
[ "java.io.IOException", "org.apache.http.HttpException", "org.apache.http.conn.routing.BasicRouteDirector", "org.apache.http.conn.routing.HttpRoute", "org.apache.http.conn.routing.HttpRouteDirector", "org.apache.http.protocol.HttpContext" ]
import java.io.IOException; import org.apache.http.HttpException; import org.apache.http.conn.routing.BasicRouteDirector; import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRouteDirector; import org.apache.http.protocol.HttpContext;
import java.io.*; import org.apache.http.*; import org.apache.http.conn.routing.*; import org.apache.http.protocol.*;
[ "java.io", "org.apache.http" ]
java.io; org.apache.http;
1,055,896
public Template getParseTree() { getTemplateClass(); if (findExecuteMethod() == null) throw new IllegalArgumentException("Cannot locate compiled template entry point."); reflectParameters(); mTree = new Template(mCallerInfo, new Name(mCallerInfo, getName()), mParameters, mSubParam, null, null); mTree.setReturnType(new Type(mExecuteMethod.getReturnType(), mExecuteMethod.getGenericReturnType())); return mTree; }
Template function() { getTemplateClass(); if (findExecuteMethod() == null) throw new IllegalArgumentException(STR); reflectParameters(); mTree = new Template(mCallerInfo, new Name(mCallerInfo, getName()), mParameters, mSubParam, null, null); mTree.setReturnType(new Type(mExecuteMethod.getReturnType(), mExecuteMethod.getGenericReturnType())); return mTree; }
/** * This method is called by JavaClassGenerator during the compile phase. It overrides the * method in CompilationUnit and returns just the reflected template signature. */
This method is called by JavaClassGenerator during the compile phase. It overrides the method in CompilationUnit and returns just the reflected template signature
getParseTree
{ "repo_name": "teatrove/teatrove", "path": "tea/src/main/java/org/teatrove/tea/compiler/CompiledTemplate.java", "license": "apache-2.0", "size": 8462 }
[ "org.teatrove.tea.parsetree.Name", "org.teatrove.tea.parsetree.Template" ]
import org.teatrove.tea.parsetree.Name; import org.teatrove.tea.parsetree.Template;
import org.teatrove.tea.parsetree.*;
[ "org.teatrove.tea" ]
org.teatrove.tea;
2,840,765
private boolean pushTypeCheckBelowIf(Instruction s, IR ir) { if (s.operator() == CHECKCAST) { Register r = TypeCheck.getRef(s).asRegister().getRegister(); Instruction n = s.nextInstructionInCodeOrder(); while (n.operator() == REF_MOVE && Move.getVal(n) instanceof RegisterOperand && Move.getVal(n).asRegister().getRegister() == r) { r = Move.getResult(n).asRegister().getRegister(); n = n.nextInstructionInCodeOrder(); } if (n.operator() == REF_IFCMP && IfCmp.getVal2(n) instanceof NullConstantOperand && IfCmp.getVal1(n) instanceof RegisterOperand && r == IfCmp.getVal1(n).asRegister().getRegister()) { BasicBlock newBlock, patchBlock; BasicBlock myBlock = n.getBasicBlock(); Instruction after = n.nextInstructionInCodeOrder(); if (IfCmp.getCond(n).isEQUAL()) { if (after.operator() == BBEND) { patchBlock = myBlock.nextBasicBlockInCodeOrder(); } else if (after.operator() == GOTO) { patchBlock = after.getBranchTarget(); } else if (after.operator() == REF_IFCMP) { patchBlock = myBlock.splitNodeAt(n, ir); myBlock.insertOut(patchBlock); ir.cfg.linkInCodeOrder(myBlock, patchBlock); } else { return false; } } else { patchBlock = n.getBranchTarget(); } newBlock = IRTools.makeBlockOnEdge(myBlock, patchBlock, ir); s.remove(); TypeCheck.mutate(s, CHECKCAST_NOTNULL, TypeCheck.getClearResult(s), TypeCheck.getClearRef(s), TypeCheck.getClearType(s), IfCmp.getGuardResult(n).copyRO()); newBlock.prependInstruction(s); return true; } } return false; }
boolean function(Instruction s, IR ir) { if (s.operator() == CHECKCAST) { Register r = TypeCheck.getRef(s).asRegister().getRegister(); Instruction n = s.nextInstructionInCodeOrder(); while (n.operator() == REF_MOVE && Move.getVal(n) instanceof RegisterOperand && Move.getVal(n).asRegister().getRegister() == r) { r = Move.getResult(n).asRegister().getRegister(); n = n.nextInstructionInCodeOrder(); } if (n.operator() == REF_IFCMP && IfCmp.getVal2(n) instanceof NullConstantOperand && IfCmp.getVal1(n) instanceof RegisterOperand && r == IfCmp.getVal1(n).asRegister().getRegister()) { BasicBlock newBlock, patchBlock; BasicBlock myBlock = n.getBasicBlock(); Instruction after = n.nextInstructionInCodeOrder(); if (IfCmp.getCond(n).isEQUAL()) { if (after.operator() == BBEND) { patchBlock = myBlock.nextBasicBlockInCodeOrder(); } else if (after.operator() == GOTO) { patchBlock = after.getBranchTarget(); } else if (after.operator() == REF_IFCMP) { patchBlock = myBlock.splitNodeAt(n, ir); myBlock.insertOut(patchBlock); ir.cfg.linkInCodeOrder(myBlock, patchBlock); } else { return false; } } else { patchBlock = n.getBranchTarget(); } newBlock = IRTools.makeBlockOnEdge(myBlock, patchBlock, ir); s.remove(); TypeCheck.mutate(s, CHECKCAST_NOTNULL, TypeCheck.getClearResult(s), TypeCheck.getClearRef(s), TypeCheck.getClearType(s), IfCmp.getGuardResult(n).copyRO()); newBlock.prependInstruction(s); return true; } } return false; }
/** * Where legal, move a type check below an if instruction. * @param s the potential typecheck instruction * @param ir the governing IR */
Where legal, move a type check below an if instruction
pushTypeCheckBelowIf
{ "repo_name": "CodeOffloading/JikesRVM-CCO", "path": "jikesrvm-3.1.3/rvm/src/org/jikesrvm/compilers/opt/LocalCastOptimization.java", "license": "epl-1.0", "size": 8342 }
[ "org.jikesrvm.compilers.opt.ir.BasicBlock", "org.jikesrvm.compilers.opt.ir.IRTools", "org.jikesrvm.compilers.opt.ir.IfCmp", "org.jikesrvm.compilers.opt.ir.Instruction", "org.jikesrvm.compilers.opt.ir.Move", "org.jikesrvm.compilers.opt.ir.Register", "org.jikesrvm.compilers.opt.ir.TypeCheck", "org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand", "org.jikesrvm.compilers.opt.ir.operand.RegisterOperand" ]
import org.jikesrvm.compilers.opt.ir.BasicBlock; import org.jikesrvm.compilers.opt.ir.IRTools; import org.jikesrvm.compilers.opt.ir.IfCmp; import org.jikesrvm.compilers.opt.ir.Instruction; import org.jikesrvm.compilers.opt.ir.Move; import org.jikesrvm.compilers.opt.ir.Register; import org.jikesrvm.compilers.opt.ir.TypeCheck; import org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand; import org.jikesrvm.compilers.opt.ir.operand.RegisterOperand;
import org.jikesrvm.compilers.opt.ir.*; import org.jikesrvm.compilers.opt.ir.operand.*;
[ "org.jikesrvm.compilers" ]
org.jikesrvm.compilers;
1,442,640
protected void onResponseReady(final Request request, final Response response) { }
void function(final Request request, final Response response) { }
/** * Do some stuff just before the response is sent. * * @param request The original request * @param response The response ready to be sent */
Do some stuff just before the response is sent
onResponseReady
{ "repo_name": "jackybourgeois/active-home", "path": "org.active-home.service/src/main/java/org/activehome/service/Service.java", "license": "gpl-3.0", "size": 19230 }
[ "org.activehome.com.Request", "org.activehome.com.Response" ]
import org.activehome.com.Request; import org.activehome.com.Response;
import org.activehome.com.*;
[ "org.activehome.com" ]
org.activehome.com;
791,779
@AlfrescoPublicApi public interface VersionHistory extends Serializable { public Version getRootVersion();
interface VersionHistory extends Serializable { public Version function();
/** * Gets the root (initial / least recent) version of the version history. * * @return the root version */
Gets the root (initial / least recent) version of the version history
getRootVersion
{ "repo_name": "Alfresco/alfresco-repository", "path": "src/main/java/org/alfresco/service/cmr/version/VersionHistory.java", "license": "lgpl-3.0", "size": 3052 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
458,053
public IconType<ServiceRefHandlerType<T>> createIcon();
IconType<ServiceRefHandlerType<T>> function();
/** * Creates a new <code>icon</code> element * @return the new created instance of <code>IconType<ServiceRefHandlerType<T>></code> */
Creates a new <code>icon</code> element
createIcon
{ "repo_name": "forge/javaee-descriptors", "path": "api/src/main/java/org/jboss/shrinkwrap/descriptor/api/j2eewebservicesclient11/ServiceRefHandlerType.java", "license": "epl-1.0", "size": 12029 }
[ "org.jboss.shrinkwrap.descriptor.api.j2ee14.IconType" ]
import org.jboss.shrinkwrap.descriptor.api.j2ee14.IconType;
import org.jboss.shrinkwrap.descriptor.api.j2ee14.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
1,334,393
public void testFacetLazyLoadWithNonBasicAttribute() throws Exception { DefDescriptor<ComponentDef> cmpAttr = addSourceAutoCleanup(ComponentDef.class, "<aura:component><aura:attribute name='cmps' type='Aura.Component'/> </aura:component>"); DefDescriptor<T> desc = addSourceAutoCleanup( getDefClass(), String.format(baseTag, "", "<" + cmpAttr.getDescriptorName() + " aura:load='LAZY'>" + "<aura:set attribute='cmps'>" + "<aura:text/>" + "</aura:set>" + "</" + cmpAttr.getDescriptorName() + ">")); try { definitionService.getDefinition(desc); fail("should not be able to use a non-basic attribute type in lazy loaded component"); } catch (QuickFixException e) { checkExceptionFull( e, InvalidReferenceException.class, "Lazy Component References can only have attributes of simple types passed in (cmps is not simple)", desc.getQualifiedName()); } }
void function() throws Exception { DefDescriptor<ComponentDef> cmpAttr = addSourceAutoCleanup(ComponentDef.class, STR); DefDescriptor<T> desc = addSourceAutoCleanup( getDefClass(), String.format(baseTag, STR<STR aura:load='LAZY'>STR<aura:set attribute='cmps'>STR<aura:text/>STR</aura:set>STR</STR>STRshould not be able to use a non-basic attribute type in lazy loaded componentSTRLazy Component References can only have attributes of simple types passed in (cmps is not simple)", desc.getQualifiedName()); } }
/** * Should not be able to lazy load a component with an invalid attribute. */
Should not be able to lazy load a component with an invalid attribute
testFacetLazyLoadWithNonBasicAttribute
{ "repo_name": "badlogicmanpreet/aura", "path": "aura-impl/src/test/java/org/auraframework/impl/root/component/BaseComponentDefTest.java", "license": "apache-2.0", "size": 99025 }
[ "org.auraframework.def.ComponentDef", "org.auraframework.def.DefDescriptor" ]
import org.auraframework.def.ComponentDef; import org.auraframework.def.DefDescriptor;
import org.auraframework.def.*;
[ "org.auraframework.def" ]
org.auraframework.def;
1,618,645
protected void addZookeeperConnectPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_InboundEndpoint_zookeeperConnect_feature"), getString("_UI_PropertyDescriptor_description", "_UI_InboundEndpoint_zookeeperConnect_feature", "_UI_InboundEndpoint_type"), EsbPackage.Literals.INBOUND_ENDPOINT__ZOOKEEPER_CONNECT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.INBOUND_ENDPOINT__ZOOKEEPER_CONNECT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Zookeeper Connect feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Zookeeper Connect feature.
addZookeeperConnectPropertyDescriptor
{ "repo_name": "nwnpallewela/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/InboundEndpointItemProvider.java", "license": "apache-2.0", "size": 165854 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "org.eclipse.emf", "org.wso2.developerstudio" ]
org.eclipse.emf; org.wso2.developerstudio;
2,530,628
public final boolean isStarted() { return rangeTracker.isStarted(); } private final OffsetRangeTracker rangeTracker; public OffsetBasedReader(OffsetBasedSource<T> source) { this.source = source; this.rangeTracker = new OffsetRangeTracker(source.getStartOffset(), source.getEndOffset()); }
final boolean function() { return rangeTracker.isStarted(); } private final OffsetRangeTracker rangeTracker; public OffsetBasedReader(OffsetBasedSource<T> source) { this.source = source; this.rangeTracker = new OffsetRangeTracker(source.getStartOffset(), source.getEndOffset()); }
/** * Returns true if there has been a call to {@link #start}. */
Returns true if there has been a call to <code>#start</code>
isStarted
{ "repo_name": "amarouni/incubator-beam", "path": "sdks/java/core/src/main/java/org/apache/beam/sdk/io/OffsetBasedSource.java", "license": "apache-2.0", "size": 15634 }
[ "org.apache.beam.sdk.io.range.OffsetRangeTracker" ]
import org.apache.beam.sdk.io.range.OffsetRangeTracker;
import org.apache.beam.sdk.io.range.*;
[ "org.apache.beam" ]
org.apache.beam;
894,770
public T background(ComponentBuilder<?, ?> ...components) { return addBackground(components); }
T function(ComponentBuilder<?, ?> ...components) { return addBackground(components); }
/** * Adds components to the background band. * The band is printed on each page. It's mostly used for adding watermarks to the report. * * @param components the background components * @return a report builder */
Adds components to the background band. The band is printed on each page. It's mostly used for adding watermarks to the report
background
{ "repo_name": "robcowell/dynamicreports", "path": "dynamicreports-core/src/main/java/net/sf/dynamicreports/report/builder/ReportBuilder.java", "license": "lgpl-3.0", "size": 61004 }
[ "net.sf.dynamicreports.report.builder.component.ComponentBuilder" ]
import net.sf.dynamicreports.report.builder.component.ComponentBuilder;
import net.sf.dynamicreports.report.builder.component.*;
[ "net.sf.dynamicreports" ]
net.sf.dynamicreports;
2,876,444
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic (Diagnostic.ERROR, "hu.bme.mit.inf.gs.dsl.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; } else if (exception != null) { return new BasicDiagnostic (Diagnostic.ERROR, "hu.bme.mit.inf.gs.dsl.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; } }
Diagnostic function(Resource resource, Exception exception) { if (!resource.getErrors().isEmpty() !resource.getWarnings().isEmpty()) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic (Diagnostic.ERROR, STR, 0, getString(STR, resource.getURI()), new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; } else if (exception != null) { return new BasicDiagnostic (Diagnostic.ERROR, STR, 0, getString(STR, resource.getURI()), new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; } }
/** * Returns a diagnostic describing the errors and warnings listed in the resource * and the specified exception (if any). * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if any).
analyzeResourceProblems
{ "repo_name": "darvasd/gsoaarchitect", "path": "hu.bme.mit.inf.gs.dsl.editor/src/soamodel/presentation/SoamodelEditor.java", "license": "mit", "size": 54519 }
[ "org.eclipse.emf.common.util.BasicDiagnostic", "org.eclipse.emf.common.util.Diagnostic", "org.eclipse.emf.ecore.resource.Resource", "org.eclipse.emf.ecore.util.EcoreUtil" ]
import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.common.util.*; import org.eclipse.emf.ecore.resource.*; import org.eclipse.emf.ecore.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,570,952
public static <T> T removeLast(@NonNull List<T> list) { if (!list.isEmpty()) { return list.remove(list.size() - 1); } else { return null; } }
static <T> T function(@NonNull List<T> list) { if (!list.isEmpty()) { return list.remove(list.size() - 1); } else { return null; } }
/** * Removes the last element from a list * * @param list the {@link List} from which the last element will be removed * @return the last element in the list of type {@link T} or {@code null} if there is no last element (i.e. the list is already empty) */
Removes the last element from a list
removeLast
{ "repo_name": "JuliaSoboleva/SmartReceiptsLibrary", "path": "app/src/main/java/co/smartreceipts/android/utils/ListUtils.java", "license": "agpl-3.0", "size": 1322 }
[ "androidx.annotation.NonNull", "java.util.List" ]
import androidx.annotation.NonNull; import java.util.List;
import androidx.annotation.*; import java.util.*;
[ "androidx.annotation", "java.util" ]
androidx.annotation; java.util;
982,186
@Override public Organization getOrganization() { Identity identity = getIdentity(); HttpResponse response = RestResource.get(identity.getUrls().getSObjects()) .acceptCharset(StandardCharsets.UTF_8) .accept(MediaType.APPLICATION_JSON) .bearerAuthorization(getToken().getAccessToken()) .path("Organization") .path(identity.getOrganizationId()) .queryParameter("fields", ORGANIZATION_FIELDS) .queryParameter("version", "latest") .execute(); Organization organization = null; if (response.getStatusCode() == Status.OK) { organization = response.getEntity(Organization.class); } else { throw new SalesforceClientException(response.getStatusCode(), response.getEntity(Error.class)); } return organization; }
Organization function() { Identity identity = getIdentity(); HttpResponse response = RestResource.get(identity.getUrls().getSObjects()) .acceptCharset(StandardCharsets.UTF_8) .accept(MediaType.APPLICATION_JSON) .bearerAuthorization(getToken().getAccessToken()) .path(STR) .path(identity.getOrganizationId()) .queryParameter(STR, ORGANIZATION_FIELDS) .queryParameter(STR, STR) .execute(); Organization organization = null; if (response.getStatusCode() == Status.OK) { organization = response.getEntity(Organization.class); } else { throw new SalesforceClientException(response.getStatusCode(), response.getEntity(Error.class)); } return organization; }
/** * Retrieves and returns <code>Organization</code> for the organization associated with the Token * * @param token the token returned from one of the authenticate methods. */
Retrieves and returns <code>Organization</code> for the organization associated with the Token
getOrganization
{ "repo_name": "nowellpoint/nowellpoint-aws", "path": "nowellpoint-aws-sforce/src/main/java/com/nowellpoint/client/sforce/SalesforceClient.java", "license": "apache-2.0", "size": 16547 }
[ "com.nowellpoint.client.sforce.model.Error", "com.nowellpoint.client.sforce.model.Identity", "com.nowellpoint.client.sforce.model.Organization", "com.nowellpoint.http.HttpResponse", "com.nowellpoint.http.MediaType", "com.nowellpoint.http.RestResource", "com.nowellpoint.http.Status", "java.nio.charset.StandardCharsets" ]
import com.nowellpoint.client.sforce.model.Error; import com.nowellpoint.client.sforce.model.Identity; import com.nowellpoint.client.sforce.model.Organization; import com.nowellpoint.http.HttpResponse; import com.nowellpoint.http.MediaType; import com.nowellpoint.http.RestResource; import com.nowellpoint.http.Status; import java.nio.charset.StandardCharsets;
import com.nowellpoint.client.sforce.model.*; import com.nowellpoint.http.*; import java.nio.charset.*;
[ "com.nowellpoint.client", "com.nowellpoint.http", "java.nio" ]
com.nowellpoint.client; com.nowellpoint.http; java.nio;
1,616,309
public static ByteString copyFromUtf8(final String text) { try { return copyFrom(text, Charsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException("UTF-8 not supported?", e); } }
static ByteString function(final String text) { try { return copyFrom(text, Charsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(STR, e); } }
/** * Encodes {@code text} into a sequence of UTF-8 bytes and returns the result as a * {@code ByteString}. */
Encodes text into a sequence of UTF-8 bytes and returns the result as a ByteString
copyFromUtf8
{ "repo_name": "tylerchen/tc-util-project", "path": "src/main/java/org/iff/infra/util/jaxrs/gson/ByteString.java", "license": "mit", "size": 14373 }
[ "com.google.common.base.Charsets", "java.io.UnsupportedEncodingException" ]
import com.google.common.base.Charsets; import java.io.UnsupportedEncodingException;
import com.google.common.base.*; import java.io.*;
[ "com.google.common", "java.io" ]
com.google.common; java.io;
21,012
// Not a designer property, since this could lead to unpredictable // results if Selection is set to an incompatible value. @SimpleProperty public void SelectionIndex(int index) { selectionIndex = ElementsUtil.selectionIndex(index, items); // Now, we need to change Selection to correspond to SelectionIndex. selection = ElementsUtil.setSelectionFromIndex(index, items); }
void function(int index) { selectionIndex = ElementsUtil.selectionIndex(index, items); selection = ElementsUtil.setSelectionFromIndex(index, items); }
/** * Selection index property setter method. */
Selection index property setter method
SelectionIndex
{ "repo_name": "kidebit/AudioBlurp", "path": "appinventor/components/src/com/google/appinventor/components/runtime/ListPicker.java", "license": "apache-2.0", "size": 10024 }
[ "com.google.appinventor.components.runtime.util.ElementsUtil" ]
import com.google.appinventor.components.runtime.util.ElementsUtil;
import com.google.appinventor.components.runtime.util.*;
[ "com.google.appinventor" ]
com.google.appinventor;
901,977
void init(Context context);
void init(Context context);
/** * Hook point for provider initialization. * * @param context * Never <code>null</code>. */
Hook point for provider initialization
init
{ "repo_name": "k9mail/k-9", "path": "app/core/src/main/java/com/fsck/k9/mailstore/StorageManager.java", "license": "apache-2.0", "size": 9191 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
1,493,516
private void updateAssignAllowedStack(Node n, boolean entering) { switch (n.getToken()) { case CASE: case FOR: case FOR_IN: case FUNCTION: case HOOK: case IF: case SWITCH: case WHILE: if (entering) { assignAllowed.push(0); } else { assignAllowed.remove(); } break; default: break; } }
void function(Node n, boolean entering) { switch (n.getToken()) { case CASE: case FOR: case FOR_IN: case FUNCTION: case HOOK: case IF: case SWITCH: case WHILE: if (entering) { assignAllowed.push(0); } else { assignAllowed.remove(); } break; default: break; } }
/** * Determines whether assignment to a define should be allowed * in the subtree of the given node, and if not, records that fact. * * @param n The node whose subtree we're about to enter or exit. * @param entering True if we're entering the subtree, false otherwise. */
Determines whether assignment to a define should be allowed in the subtree of the given node, and if not, records that fact
updateAssignAllowedStack
{ "repo_name": "Yannic/closure-compiler", "path": "src/com/google/javascript/jscomp/ProcessDefines.java", "license": "apache-2.0", "size": 25906 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
1,226,103
public static java.util.List extractEpisodeOfCareList(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.EpisodeOfCareListVoCollection voCollection) { return extractEpisodeOfCareList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.EpisodeOfCareListVoCollection voCollection) { return extractEpisodeOfCareList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.core.admin.domain.objects.EpisodeOfCare 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.core.admin.domain.objects.EpisodeOfCare list from the value object collection
extractEpisodeOfCareList
{ "repo_name": "FreudianNM/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/core/vo/domain/EpisodeOfCareListVoAssembler.java", "license": "agpl-3.0", "size": 16612 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,336,797
@Nonnull public Optional<String> getContainerId() { return Optional.ofNullable(containerId); } /** * Persists the current test reference in the provided HTTP session. Will have no effect if the session has been * invalidated. * * @param session the HTTP session * * @throws NullPointerException if {@code session} is {@code null}
Optional<String> function() { return Optional.ofNullable(containerId); } /** * Persists the current test reference in the provided HTTP session. Will have no effect if the session has been * invalidated. * * @param session the HTTP session * * @throws NullPointerException if {@code session} is {@code null}
/** * Gets the created container ID for this test (if any) * * @return the created container ID if any */
Gets the created container ID for this test (if any)
getContainerId
{ "repo_name": "JeanRev/TeamcityDockerCloudPlugin", "path": "server/src/main/java/run/var/teamcity/cloud/docker/web/ContainerTestReference.java", "license": "apache-2.0", "size": 7064 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
2,560,142
LevelListDrawable backupRoundTrip; AnimatedVectorDrawable currentBackupDrawable; boolean backupRoundTripFirstLaunched=true; @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void launchAnimBackup(){ if(!backupRoundTripFirstLaunched) { if (backupRoundTrip.getLevel() == 1) { //then reverse backupRoundTrip.setLevel(0); } else { //then reverse backupRoundTrip.setLevel(1); } }else{ backupRoundTripFirstLaunched=false; } //find the current AnimatedVectorDrawable displayed currentBackupDrawable = (AnimatedVectorDrawable) backupRoundTrip.getCurrent(); //start the animation currentBackupDrawable.start(); //You need the API 23 to add a AnimationListener using registerAnimationCallBack //So if you want to permanently animate your animation, use xml }
LevelListDrawable backupRoundTrip; AnimatedVectorDrawable currentBackupDrawable; boolean backupRoundTripFirstLaunched=true; @TargetApi(Build.VERSION_CODES.LOLLIPOP) void function(){ if(!backupRoundTripFirstLaunched) { if (backupRoundTrip.getLevel() == 1) { backupRoundTrip.setLevel(0); } else { backupRoundTrip.setLevel(1); } }else{ backupRoundTripFirstLaunched=false; } currentBackupDrawable = (AnimatedVectorDrawable) backupRoundTrip.getCurrent(); currentBackupDrawable.start(); }
/** * Launch the animation on the currentAnimatedVectorDrawable */
Launch the animation on the currentAnimatedVectorDrawable
launchAnimBackup
{ "repo_name": "MathiasSeguy-Android2EE/Animation", "path": "animation/src/main/java/com/android2ee/droidcon/greece/animation/DrawableActivity.java", "license": "apache-2.0", "size": 16560 }
[ "android.annotation.TargetApi", "android.graphics.drawable.AnimatedVectorDrawable", "android.graphics.drawable.LevelListDrawable", "android.os.Build" ]
import android.annotation.TargetApi; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.LevelListDrawable; import android.os.Build;
import android.annotation.*; import android.graphics.drawable.*; import android.os.*;
[ "android.annotation", "android.graphics", "android.os" ]
android.annotation; android.graphics; android.os;
2,308,930
public static ConfigRevision createConfigRevision(ConfigFile file, ConfigContent content, ConfigInfo info, Long revision, ConfigFileType type) { ConfigRevision cr = ConfigurationFactory.newConfigRevision(); cr.setRevision(revision); cr.setCreated(new Date()); cr.setModified(new Date()); cr.setConfigContent(content); cr.setConfigFile(file); cr.setConfigInfo(info); cr.setConfigFileType(type); return ConfigurationFactory.commit(cr); }
static ConfigRevision function(ConfigFile file, ConfigContent content, ConfigInfo info, Long revision, ConfigFileType type) { ConfigRevision cr = ConfigurationFactory.newConfigRevision(); cr.setRevision(revision); cr.setCreated(new Date()); cr.setModified(new Date()); cr.setConfigContent(content); cr.setConfigFile(file); cr.setConfigInfo(info); cr.setConfigFileType(type); return ConfigurationFactory.commit(cr); }
/** * Creates a test configuration revision and saves it to the database * with the given information. Note: does not flush hibernate. * Note2: users of the same org do not automatically have access to this revision. * See rhn_config_channel.get_user_revision_access * @param file The file for this revision to belong to. * @param content The content of this revision. * @param info Permissions and file information. * @param revision The revision number. * @param type the desired fileType for this revision * @return The newly created ConfigRevision * */
Creates a test configuration revision and saves it to the database with the given information. Note: does not flush hibernate. Note2: users of the same org do not automatically have access to this revision. See rhn_config_channel.get_user_revision_access
createConfigRevision
{ "repo_name": "xkollar/spacewalk", "path": "java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java", "license": "gpl-2.0", "size": 16082 }
[ "com.redhat.rhn.domain.config.ConfigContent", "com.redhat.rhn.domain.config.ConfigFile", "com.redhat.rhn.domain.config.ConfigFileType", "com.redhat.rhn.domain.config.ConfigInfo", "com.redhat.rhn.domain.config.ConfigRevision", "com.redhat.rhn.domain.config.ConfigurationFactory", "java.util.Date" ]
import com.redhat.rhn.domain.config.ConfigContent; import com.redhat.rhn.domain.config.ConfigFile; import com.redhat.rhn.domain.config.ConfigFileType; import com.redhat.rhn.domain.config.ConfigInfo; import com.redhat.rhn.domain.config.ConfigRevision; import com.redhat.rhn.domain.config.ConfigurationFactory; import java.util.Date;
import com.redhat.rhn.domain.config.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
726,282
public Iterator<CarbonRowBatch>[] execute() throws CarbonDataLoadingException { Iterator<CarbonRowBatch>[] childIters = child.execute(); Iterator<CarbonRowBatch>[] iterators = new Iterator[childIters.length]; for (int i = 0; i < childIters.length; i++) { iterators[i] = getIterator(childIters[i]); } return iterators; }
Iterator<CarbonRowBatch>[] function() throws CarbonDataLoadingException { Iterator<CarbonRowBatch>[] childIters = child.execute(); Iterator<CarbonRowBatch>[] iterators = new Iterator[childIters.length]; for (int i = 0; i < childIters.length; i++) { iterators[i] = getIterator(childIters[i]); } return iterators; }
/** * Tranform the data as per the implementation. * * @return Array of Iterator with data. It can be processed parallel if implementation class wants * @throws CarbonDataLoadingException */
Tranform the data as per the implementation
execute
{ "repo_name": "shivangi1015/incubator-carbondata", "path": "processing/src/main/java/org/apache/carbondata/processing/newflow/AbstractDataLoadProcessorStep.java", "license": "apache-2.0", "size": 5204 }
[ "java.util.Iterator", "org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException", "org.apache.carbondata.processing.newflow.row.CarbonRowBatch" ]
import java.util.Iterator; import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException; import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
import java.util.*; import org.apache.carbondata.processing.newflow.exception.*; import org.apache.carbondata.processing.newflow.row.*;
[ "java.util", "org.apache.carbondata" ]
java.util; org.apache.carbondata;
882,700
public void close() { if (objectContainer != null) { boolean result = objectContainer.close(); LogUtil.log(LogUtil.INFO, "AppleTrailer: closed " + result); objectContainer = null; } else { LogUtil.log(LogUtil.INFO, "AppleTrailer: Tried to close " + "but objectContainer null."); } }
void function() { if (objectContainer != null) { boolean result = objectContainer.close(); LogUtil.log(LogUtil.INFO, STR + result); objectContainer = null; } else { LogUtil.log(LogUtil.INFO, STR + STR); } }
/** * Close up all resources. */
Close up all resources
close
{ "repo_name": "djb61230/jflicks", "path": "src/org/jflicks/trailer/apple/AppleTrailer.java", "license": "gpl-3.0", "size": 6433 }
[ "org.jflicks.util.LogUtil" ]
import org.jflicks.util.LogUtil;
import org.jflicks.util.*;
[ "org.jflicks.util" ]
org.jflicks.util;
2,154,370
Observable<ServiceResponse<List<Integer>>> getIntInvalidNullWithServiceResponseAsync();
Observable<ServiceResponse<List<Integer>>> getIntInvalidNullWithServiceResponseAsync();
/** * Get integer array value [1, null, 0]. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List&lt;Integer&gt; object */
Get integer array value [1, null, 0]
getIntInvalidNullWithServiceResponseAsync
{ "repo_name": "balajikris/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodyarray/Arrays.java", "license": "mit", "size": 104816 }
[ "com.microsoft.rest.ServiceResponse", "java.util.List" ]
import com.microsoft.rest.ServiceResponse; import java.util.List;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
120,458
@NonNull private static String getAUTHORITY(@NonNull Context context) { if (authority == null) { authority = context.getResources().getString(R.string.rtc_quebec_authority); } return authority; } @Nullable private static Uri authorityUri = null;
static String function(@NonNull Context context) { if (authority == null) { authority = context.getResources().getString(R.string.rtc_quebec_authority); } return authority; } private static Uri authorityUri = null;
/** * Override if multiple {@link RTCQuebecProvider} implementations in same app. */
Override if multiple <code>RTCQuebecProvider</code> implementations in same app
getAUTHORITY
{ "repo_name": "mtransitapps/commons-android", "path": "src/main/java/org/mtransit/android/commons/provider/RTCQuebecProvider.java", "license": "apache-2.0", "size": 46609 }
[ "android.content.Context", "android.net.Uri", "androidx.annotation.NonNull" ]
import android.content.Context; import android.net.Uri; import androidx.annotation.NonNull;
import android.content.*; import android.net.*; import androidx.annotation.*;
[ "android.content", "android.net", "androidx.annotation" ]
android.content; android.net; androidx.annotation;
2,566,434
private static String scaleAxesKVP(ScaleAxesByFactor sabf) { ScaleAxis[] scaleAxes = sabf.scaleAxes; int n = scaleAxes.length; String[] values = new String[n]; for (int i = 0; i < n; i++) { values[i] = String.format(Locale.US, "%s(%f)", scaleAxes[i].axis, scaleAxes[i].scaleFactor); } return StringUtils.join(values, ','); }
static String function(ScaleAxesByFactor sabf) { ScaleAxis[] scaleAxes = sabf.scaleAxes; int n = scaleAxes.length; String[] values = new String[n]; for (int i = 0; i < n; i++) { values[i] = String.format(Locale.US, STR, scaleAxes[i].axis, scaleAxes[i].scaleFactor); } return StringUtils.join(values, ','); }
/** * SCALEAXES=a1(s1),...,an(sn) where, for 1<=i<=n, * - ai is an axis abbreviation; * - si is a scaleFactor expressed as the ASCII representation of a positive floating-point number */
SCALEAXES=a1(s1),...,an(sn) where, for 1<=i<=n, - ai is an axis abbreviation; - si is a scaleFactor expressed as the ASCII representation of a positive floating-point number
scaleAxesKVP
{ "repo_name": "nls-oskari/oskari-server", "path": "service-wcs/src/main/java/org/oskari/wcs/request/GetCoverage.java", "license": "mit", "size": 8459 }
[ "java.util.Locale", "org.oskari.utils.common.StringUtils", "org.oskari.wcs.extension.scaling.ScaleAxesByFactor", "org.oskari.wcs.extension.scaling.ScaleAxis" ]
import java.util.Locale; import org.oskari.utils.common.StringUtils; import org.oskari.wcs.extension.scaling.ScaleAxesByFactor; import org.oskari.wcs.extension.scaling.ScaleAxis;
import java.util.*; import org.oskari.utils.common.*; import org.oskari.wcs.extension.scaling.*;
[ "java.util", "org.oskari.utils", "org.oskari.wcs" ]
java.util; org.oskari.utils; org.oskari.wcs;
2,385,253
public boolean doAuthenticateHashedPassword(Request request, String hashedPassword) { ProxyAuthorizationHeader authHeader = (ProxyAuthorizationHeader) request.getHeader(ProxyAuthorizationHeader.NAME); if ( authHeader == null ) return false; String realm = authHeader.getRealm(); String username = authHeader.getUsername(); if ( username == null || realm == null ) { return false; } String nonce = authHeader.getNonce(); URI uri = authHeader.getURI(); if (uri == null) { return false; } String A2 = request.getMethod().toUpperCase() + ":" + uri.toString(); String HA1 = hashedPassword; byte[] mdbytes = messageDigest.digest(A2.getBytes()); String HA2 = toHexString(mdbytes); String cnonce = authHeader.getCNonce(); String KD = HA1 + ":" + nonce; if (cnonce != null) { KD += ":" + cnonce; } KD += ":" + HA2; mdbytes = messageDigest.digest(KD.getBytes()); String mdString = toHexString(mdbytes); String response = authHeader.getResponse(); return mdString.equals(response); }
boolean function(Request request, String hashedPassword) { ProxyAuthorizationHeader authHeader = (ProxyAuthorizationHeader) request.getHeader(ProxyAuthorizationHeader.NAME); if ( authHeader == null ) return false; String realm = authHeader.getRealm(); String username = authHeader.getUsername(); if ( username == null realm == null ) { return false; } String nonce = authHeader.getNonce(); URI uri = authHeader.getURI(); if (uri == null) { return false; } String A2 = request.getMethod().toUpperCase() + ":" + uri.toString(); String HA1 = hashedPassword; byte[] mdbytes = messageDigest.digest(A2.getBytes()); String HA2 = toHexString(mdbytes); String cnonce = authHeader.getCNonce(); String KD = HA1 + ":" + nonce; if (cnonce != null) { KD += ":" + cnonce; } KD += ":" + HA2; mdbytes = messageDigest.digest(KD.getBytes()); String mdString = toHexString(mdbytes); String response = authHeader.getResponse(); return mdString.equals(response); }
/** * Authenticate the inbound request. * * @param request - the request to authenticate. * @param hashedPassword -- the MD5 hashed string of username:realm:plaintext password. * * @return true if authentication succeded and false otherwise. */
Authenticate the inbound request
doAuthenticateHashedPassword
{ "repo_name": "fhg-fokus-nubomedia/signaling-plane", "path": "modules/lib-sip/src/main/java/gov/nist/javax/sip/clientauthutils/DigestServerAuthenticationHelper.java", "license": "apache-2.0", "size": 7225 }
[ "javax.sip.header.ProxyAuthorizationHeader", "javax.sip.message.Request" ]
import javax.sip.header.ProxyAuthorizationHeader; import javax.sip.message.Request;
import javax.sip.header.*; import javax.sip.message.*;
[ "javax.sip" ]
javax.sip;
2,478,802
EOperation getNonConformLoadGroup__CheckDEC_FWD__MeterAsset_NonConformLoadGroup_MeterAssetPhysicalDevicePair_ServiceDeliveryPoint_NonConformLoad();
EOperation getNonConformLoadGroup__CheckDEC_FWD__MeterAsset_NonConformLoadGroup_MeterAssetPhysicalDevicePair_ServiceDeliveryPoint_NonConformLoad();
/** * Returns the meta object for the '{@link rgse.ttc17.emoflon.tgg.task2.Rules.NonConformLoadGroup#checkDEC_FWD(gluemodel.CIM.IEC61968.Metering.MeterAsset, gluemodel.CIM.IEC61970.LoadModel.NonConformLoadGroup, gluemodel.MeterAssetPhysicalDevicePair, gluemodel.CIM.IEC61968.Metering.ServiceDeliveryPoint, gluemodel.CIM.IEC61970.LoadModel.NonConformLoad) <em>Check DEC FWD</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the '<em>Check DEC FWD</em>' operation. * @see rgse.ttc17.emoflon.tgg.task2.Rules.NonConformLoadGroup#checkDEC_FWD(gluemodel.CIM.IEC61968.Metering.MeterAsset, gluemodel.CIM.IEC61970.LoadModel.NonConformLoadGroup, gluemodel.MeterAssetPhysicalDevicePair, gluemodel.CIM.IEC61968.Metering.ServiceDeliveryPoint, gluemodel.CIM.IEC61970.LoadModel.NonConformLoad) * @generated */
Returns the meta object for the '<code>rgse.ttc17.emoflon.tgg.task2.Rules.NonConformLoadGroup#checkDEC_FWD(gluemodel.CIM.IEC61968.Metering.MeterAsset, gluemodel.CIM.IEC61970.LoadModel.NonConformLoadGroup, gluemodel.MeterAssetPhysicalDevicePair, gluemodel.CIM.IEC61968.Metering.ServiceDeliveryPoint, gluemodel.CIM.IEC61970.LoadModel.NonConformLoad) Check DEC FWD</code>' operation.
getNonConformLoadGroup__CheckDEC_FWD__MeterAsset_NonConformLoadGroup_MeterAssetPhysicalDevicePair_ServiceDeliveryPoint_NonConformLoad
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/eMoflon/rgse.ttc17.emoflon.tgg.task2/gen/rgse/ttc17/emoflon/tgg/task2/Rules/RulesPackage.java", "license": "mit", "size": 437406 }
[ "org.eclipse.emf.ecore.EOperation" ]
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,727,852
public void trace(String msg) { logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, null); }
void function(String msg) { logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, null); }
/** * Log a message object at level TRACE. * * @param msg * - the message object to be logged */
Log a message object at level TRACE
trace
{ "repo_name": "geekboxzone/mmallow_external_slf4j", "path": "slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java", "license": "mit", "size": 18372 }
[ "org.apache.log4j.Level" ]
import org.apache.log4j.Level;
import org.apache.log4j.*;
[ "org.apache.log4j" ]
org.apache.log4j;
1,986,359
public int getPartColIndexForFilter( Table table, FilterBuilder filterBuilder) throws MetaException { int partitionColumnIndex; assert (table.getPartitionKeys().size() > 0); for (partitionColumnIndex = 0; partitionColumnIndex < table.getPartitionKeys().size(); ++partitionColumnIndex) { if (table.getPartitionKeys().get(partitionColumnIndex).getName(). equalsIgnoreCase(keyName)) { break; } } if( partitionColumnIndex == table.getPartitionKeys().size()) { filterBuilder.setError("Specified key <" + keyName + "> is not a partitioning key for the table"); return -1; } return partitionColumnIndex; }
int function( Table table, FilterBuilder filterBuilder) throws MetaException { int partitionColumnIndex; assert (table.getPartitionKeys().size() > 0); for (partitionColumnIndex = 0; partitionColumnIndex < table.getPartitionKeys().size(); ++partitionColumnIndex) { if (table.getPartitionKeys().get(partitionColumnIndex).getName(). equalsIgnoreCase(keyName)) { break; } } if( partitionColumnIndex == table.getPartitionKeys().size()) { filterBuilder.setError(STR + keyName + STR); return -1; } return partitionColumnIndex; }
/** * Get partition column index in the table partition column list that * corresponds to the key that is being filtered on by this tree node. * @param table The table. * @param filterBuilder filter builder used to report error, if any. * @return The index. */
Get partition column index in the table partition column list that corresponds to the key that is being filtered on by this tree node
getPartColIndexForFilter
{ "repo_name": "BUPTAnderson/apache-hive-2.1.1-src", "path": "metastore/src/java/org/apache/hadoop/hive/metastore/parser/ExpressionTree.java", "license": "apache-2.0", "size": 21867 }
[ "org.apache.hadoop.hive.metastore.api.MetaException", "org.apache.hadoop.hive.metastore.api.Table" ]
import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.api.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,580,757
public void loadEvidences(String[] evidFiles){ int chunkSize = Config.evidence_file_chunk_size; for(String f : evidFiles){ String g = FileMan.getGZIPVariant(f); if(g == null){ ExceptionMan.die("File does not exist: " + f); }else{ f = g; } UIMan.println(">>> Parsing evidence file: " + f); if(FileMan.getFileSize(f) <= chunkSize){ parser.parseEvidenceFile(f); }else{ try{ long lineOffset = 0, lastChunkLines = 0; BufferedReader reader = FileMan.getBufferedReaderMaybeGZ(f); StringBuilder sb = new StringBuilder(); String line = reader.readLine(); while(line != null){ sb.append(line); sb.append("\n"); lastChunkLines ++; if(sb.length() >= chunkSize){ parser.parseEvidenceString(sb.toString(), lineOffset); sb.delete(0, sb.length()); sb = new StringBuilder(); lineOffset += lastChunkLines; lastChunkLines = 0; UIMan.print("."); } line = reader.readLine(); } reader.close(); if(sb.length() > 0){ parser.parseEvidenceString(sb.toString(), lineOffset); } UIMan.println(); }catch(Exception e){ ExceptionMan.handle(e); } } try { DebugMan.runGC(); } catch (Exception e) { e.printStackTrace(); } } }
void function(String[] evidFiles){ int chunkSize = Config.evidence_file_chunk_size; for(String f : evidFiles){ String g = FileMan.getGZIPVariant(f); if(g == null){ ExceptionMan.die(STR + f); }else{ f = g; } UIMan.println(STR + f); if(FileMan.getFileSize(f) <= chunkSize){ parser.parseEvidenceFile(f); }else{ try{ long lineOffset = 0, lastChunkLines = 0; BufferedReader reader = FileMan.getBufferedReaderMaybeGZ(f); StringBuilder sb = new StringBuilder(); String line = reader.readLine(); while(line != null){ sb.append(line); sb.append("\n"); lastChunkLines ++; if(sb.length() >= chunkSize){ parser.parseEvidenceString(sb.toString(), lineOffset); sb.delete(0, sb.length()); sb = new StringBuilder(); lineOffset += lastChunkLines; lastChunkLines = 0; UIMan.print("."); } line = reader.readLine(); } reader.close(); if(sb.length() > 0){ parser.parseEvidenceString(sb.toString(), lineOffset); } UIMan.println(); }catch(Exception e){ ExceptionMan.handle(e); } } try { DebugMan.runGC(); } catch (Exception e) { e.printStackTrace(); } } }
/** * Parse multiple MLN evidence files. If file size is larger * than 1MB, then uses a file stream * incrementally parse this file. Can also accept .gz file (see {@link GZIPInputStream#GZIPInputStream(InputStream)}). * * @param evidFiles list of MLN evidence files (in Alchemy format) */
Parse multiple MLN evidence files. If file size is larger than 1MB, then uses a file stream incrementally parse this file. Can also accept .gz file (see <code>GZIPInputStream#GZIPInputStream(InputStream)</code>)
loadEvidences
{ "repo_name": "sai16vicky/deepdive", "path": "mln/src/tuffy/mln/MarkovLogicNetwork.java", "license": "apache-2.0", "size": 28427 }
[ "java.io.BufferedReader" ]
import java.io.BufferedReader;
import java.io.*;
[ "java.io" ]
java.io;
212,881
ControllerServiceNode updateControllerService(ControllerServiceDTO controllerServiceDTO);
ControllerServiceNode updateControllerService(ControllerServiceDTO controllerServiceDTO);
/** * Updates the specified controller service. * * @param controllerServiceDTO The controller service DTO * @return The controller service */
Updates the specified controller service
updateControllerService
{ "repo_name": "mcgilman/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ControllerServiceDAO.java", "license": "apache-2.0", "size": 4887 }
[ "org.apache.nifi.controller.service.ControllerServiceNode", "org.apache.nifi.web.api.dto.ControllerServiceDTO" ]
import org.apache.nifi.controller.service.ControllerServiceNode; import org.apache.nifi.web.api.dto.ControllerServiceDTO;
import org.apache.nifi.controller.service.*; import org.apache.nifi.web.api.dto.*;
[ "org.apache.nifi" ]
org.apache.nifi;
2,556,776
public FunctionType<T> description(String ... values) { if (values != null) { for(String name: values) { childNode.createChild("description").text(name); } } return this; }
FunctionType<T> function(String ... values) { if (values != null) { for(String name: values) { childNode.createChild(STR).text(name); } } return this; }
/** * Creates for all String objects representing <code>description</code> elements, * a new <code>description</code> element * @param values list of <code>description</code> objects * @return the current instance of <code>FunctionType<T></code> */
Creates for all String objects representing <code>description</code> elements, a new <code>description</code> element
description
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/jsptaglibrary21/FunctionTypeImpl.java", "license": "epl-1.0", "size": 15198 }
[ "org.jboss.shrinkwrap.descriptor.api.jsptaglibrary21.FunctionType" ]
import org.jboss.shrinkwrap.descriptor.api.jsptaglibrary21.FunctionType;
import org.jboss.shrinkwrap.descriptor.api.jsptaglibrary21.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
1,474,698
public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } @SuppressWarnings("ucd") protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); }
void function() { oredCriteria.clear(); orderByClause = null; distinct = false; } @SuppressWarnings("ucd") protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); }
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_prj_customize_view * * @mbggenerated Mon Sep 21 13:52:03 ICT 2015 */
This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_customize_view
clear
{ "repo_name": "maduhu/mycollab", "path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/domain/ProjectCustomizeViewExample.java", "license": "agpl-3.0", "size": 35727 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,837,048
public SolrPing removeAction() { params.remove(CommonParams.ACTION); return this; }
SolrPing function() { params.remove(CommonParams.ACTION); return this; }
/** * Remove the action parameter from this request. This will result in the same * behavior as {@code SolrPing#setActionPing()}. For Solr server version 4.0 * and later. * * @return this */
Remove the action parameter from this request. This will result in the same behavior as SolrPing#setActionPing(). For Solr server version 4.0 and later
removeAction
{ "repo_name": "q474818917/solr-5.2.0", "path": "solr/solrj/src/java/org/apache/solr/client/solrj/request/SolrPing.java", "license": "apache-2.0", "size": 3408 }
[ "org.apache.solr.common.params.CommonParams" ]
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.*;
[ "org.apache.solr" ]
org.apache.solr;
2,337,315
public static long fetchLastTemperatureAlertDate(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getLong(PREF_LAST_TEMPERATURE_ALERT, 0); }
static long function(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getLong(PREF_LAST_TEMPERATURE_ALERT, 0); }
/** * Return the time in millis of the last battery temperature alert * * @param context Context to be used to lookup the {@link android.content.SharedPreferences}. */
Return the time in millis of the last battery temperature alert
fetchLastTemperatureAlertDate
{ "repo_name": "hmatalonga/GreenHub", "path": "app/src/main/java/com/hmatalonga/greenhub/util/SettingsUtils.java", "license": "apache-2.0", "size": 20340 }
[ "android.content.Context", "android.content.SharedPreferences", "android.preference.PreferenceManager" ]
import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager;
import android.content.*; import android.preference.*;
[ "android.content", "android.preference" ]
android.content; android.preference;
487,565
public void setAlignment(BitmapFont.Align align) { if (block.getTextBox() == null && align != Align.Left) { throw new RuntimeException("Bound is not set"); } block.setAlignment(align); letters.invalidate(); needRefresh = true; }
void function(BitmapFont.Align align) { if (block.getTextBox() == null && align != Align.Left) { throw new RuntimeException(STR); } block.setAlignment(align); letters.invalidate(); needRefresh = true; }
/** * Set horizontal alignment. Applicable only when text bound is set. * @param align */
Set horizontal alignment. Applicable only when text bound is set
setAlignment
{ "repo_name": "GreenCubes/jmonkeyengine", "path": "jme3-core/src/main/java/com/jme3/font/BitmapText.java", "license": "bsd-3-clause", "size": 14538 }
[ "com.jme3.font.BitmapFont" ]
import com.jme3.font.BitmapFont;
import com.jme3.font.*;
[ "com.jme3.font" ]
com.jme3.font;
2,747,369
public ContextEjb[] findEjbs() { return namingResources.findEjbs(); }
ContextEjb[] function() { return namingResources.findEjbs(); }
/** * Return the defined EJB resource references for this application. * If there are none, a zero-length array is returned. */
Return the defined EJB resource references for this application. If there are none, a zero-length array is returned
findEjbs
{ "repo_name": "c-rainstorm/jerrydog", "path": "src/main/java/org/apache/catalina/core/StandardDefaultContext.java", "license": "gpl-3.0", "size": 40782 }
[ "org.apache.catalina.deploy.ContextEjb" ]
import org.apache.catalina.deploy.ContextEjb;
import org.apache.catalina.deploy.*;
[ "org.apache.catalina" ]
org.apache.catalina;
974,361
public void addText(Chunk chunk) { columnText.addText(chunk); } /** * Add an element to be rendered in a column. * Note that you can only add a <CODE>Phrase</CODE> * or a <CODE>Chunk</CODE> if the columns are * not all simple. This is an underlying restriction in * {@link com.lowagie.text.pdf.ColumnText}
void function(Chunk chunk) { columnText.addText(chunk); } /** * Add an element to be rendered in a column. * Note that you can only add a <CODE>Phrase</CODE> * or a <CODE>Chunk</CODE> if the columns are * not all simple. This is an underlying restriction in * {@link com.lowagie.text.pdf.ColumnText}
/** * Adds a <CODE>Chunk</CODE> to the current text array. * Will not have any effect if addElement() was called before. * @param chunk the text * @since 2.1.5 */
Adds a <code>Chunk</code> to the current text array. Will not have any effect if addElement() was called before
addText
{ "repo_name": "yogthos/itext", "path": "src/com/lowagie/text/pdf/MultiColumnText.java", "license": "lgpl-3.0", "size": 20515 }
[ "com.lowagie.text.Chunk", "com.lowagie.text.Phrase" ]
import com.lowagie.text.Chunk; import com.lowagie.text.Phrase;
import com.lowagie.text.*;
[ "com.lowagie.text" ]
com.lowagie.text;
2,483,819
public ArrayList<PasswordSet> getPasswords() { SQLiteDatabase sqliteDB = dbHelper.getWritableDatabase(); ArrayList<PasswordSet> ps = new ArrayList<PasswordSet>(); Cursor crsr = sqliteDB.rawQuery(SELECT_PASSWORDS, null); crsr.moveToFirst(); for (int i = 0; i < crsr.getCount(); i++) { ps.add(new PasswordSet(crsr.getInt(0), crsr.getString(1), crsr .getString(2), crsr.getString(3))); crsr.moveToNext(); } sqliteDB.close(); return ps; }
ArrayList<PasswordSet> function() { SQLiteDatabase sqliteDB = dbHelper.getWritableDatabase(); ArrayList<PasswordSet> ps = new ArrayList<PasswordSet>(); Cursor crsr = sqliteDB.rawQuery(SELECT_PASSWORDS, null); crsr.moveToFirst(); for (int i = 0; i < crsr.getCount(); i++) { ps.add(new PasswordSet(crsr.getInt(0), crsr.getString(1), crsr .getString(2), crsr.getString(3))); crsr.moveToNext(); } sqliteDB.close(); return ps; }
/** * ! Get all password set's from database * * @return Array List with all the password set's into database */
! Get all password set's from database
getPasswords
{ "repo_name": "LuisMRibeiro/EZ-Password", "path": "src/pt/ez/lmr/password/DBPasswordAdapter.java", "license": "unlicense", "size": 4123 }
[ "android.database.Cursor", "android.database.sqlite.SQLiteDatabase", "java.util.ArrayList" ]
import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import java.util.ArrayList;
import android.database.*; import android.database.sqlite.*; import java.util.*;
[ "android.database", "java.util" ]
android.database; java.util;
804,981
final MultiTermQuery.RewriteMethod m = query.getRewriteMethod(); if (!(m instanceof SpanRewriteMethod)) throw new UnsupportedOperationException("You can only use SpanMultiTermQueryWrapper with a suitable SpanRewriteMethod."); return (SpanRewriteMethod) m; }
final MultiTermQuery.RewriteMethod m = query.getRewriteMethod(); if (!(m instanceof SpanRewriteMethod)) throw new UnsupportedOperationException(STR); return (SpanRewriteMethod) m; }
/** * Expert: returns the rewriteMethod */
Expert: returns the rewriteMethod
getRewriteMethod
{ "repo_name": "fnp/pylucene", "path": "lucene-java-3.5.0/lucene/src/java/org/apache/lucene/search/spans/SpanMultiTermQueryWrapper.java", "license": "apache-2.0", "size": 9194 }
[ "org.apache.lucene.search.MultiTermQuery" ]
import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.*;
[ "org.apache.lucene" ]
org.apache.lucene;
1,237,513
public Term get(SynDiaElem key) { return observableLinkedHashMap.get(key); }
Term function(SynDiaElem key) { return observableLinkedHashMap.get(key); }
/** * This method calls the get()-method of the LinkeHashMap * * @param key a SyntaxDiagram element * @return The Term associated to SyntaxDiagram element */
This method calls the get()-method of the LinkeHashMap
get
{ "repo_name": "jurkov/j-algo-mod", "path": "src/org/jalgo/module/ebnf/model/trans/TransMap.java", "license": "gpl-2.0", "size": 1863 }
[ "org.jalgo.module.ebnf.model.ebnf.Term", "org.jalgo.module.ebnf.model.syndia.SynDiaElem" ]
import org.jalgo.module.ebnf.model.ebnf.Term; import org.jalgo.module.ebnf.model.syndia.SynDiaElem;
import org.jalgo.module.ebnf.model.ebnf.*; import org.jalgo.module.ebnf.model.syndia.*;
[ "org.jalgo.module" ]
org.jalgo.module;
2,862,601
public Map<String, Object> getSparkConfig() { return this.sparkConfig; }
Map<String, Object> function() { return this.sparkConfig; }
/** * Get the sparkConfig property: Spark configuration property. * * @return the sparkConfig value. */
Get the sparkConfig property: Spark configuration property
getSparkConfig
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/synapse/azure-analytics-synapse-artifacts/src/main/java/com/azure/analytics/synapse/artifacts/models/HDInsightSparkActivity.java", "license": "mit", "size": 7677 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,416,265
public void pushLayers(Context context, Rect viewport, Rect contentViewport, Layout layout, LayerTitleCache layerTitleCache, TabContentManager tabContentManager, ResourceManager resourceManager) { if (mNativePtr == 0) return; Resources res = context.getResources(); final float dpToPx = res.getDisplayMetrics().density; LayoutTab[] tabs = layout.getLayoutTabsToRender(); int tabsCount = tabs != null ? tabs.length : 0; nativeBeginBuildingFrame(mNativePtr); nativeUpdateLayer(mNativePtr, getTabListBackgroundColor(context), viewport.left, viewport.top, viewport.width(), viewport.height(), layerTitleCache, tabContentManager, resourceManager); for (int i = 0; i < tabsCount; i++) { LayoutTab t = tabs[i]; assert t.isVisible() : "LayoutTab in that list should be visible"; final float decoration = t.getDecorationAlpha(); int borderResource = t.isIncognito() ? R.drawable.tabswitcher_border_frame_incognito : R.drawable.tabswitcher_border_frame; int closeBtnResource = t.isIncognito() ? R.drawable.btn_tab_close_white_normal : R.drawable.btn_tab_close_normal; int borderColorResource = t.isIncognito() ? R.color.tab_back_incognito : R.color.tab_back; // TODO(dtrainor, clholgat): remove "* dpToPx" once the native part fully supports dp. nativePutTabLayer(mNativePtr, t.getId(), R.id.control_container, closeBtnResource, R.drawable.tabswitcher_border_frame_shadow, R.drawable.tabswitcher_border_frame_decoration, R.drawable.logo_card_back, borderResource, R.drawable.tabswitcher_border_frame_inner_shadow, t.canUseLiveTexture(), t.getBackgroundColor(), ApiCompatibilityUtils.getColor(res, borderColorResource), t.isIncognito(), layout.getOrientation() == Orientation.PORTRAIT, t.getRenderX() * dpToPx, t.getRenderY() * dpToPx, t.getScaledContentWidth() * dpToPx, t.getScaledContentHeight() * dpToPx, t.getOriginalContentWidth() * dpToPx, t.getOriginalContentHeight() * dpToPx, contentViewport.height(), t.getClippedX() * dpToPx, t.getClippedY() * dpToPx, Math.min(t.getClippedWidth(), t.getScaledContentWidth()) * dpToPx, Math.min(t.getClippedHeight(), t.getScaledContentHeight()) * dpToPx, t.getTiltXPivotOffset() * dpToPx, t.getTiltYPivotOffset() * dpToPx, t.getTiltX(), t.getTiltY(), t.getAlpha(), t.getBorderAlpha() * decoration, t.getBorderInnerShadowAlpha() * decoration, decoration, t.getShadowOpacity() * decoration, t.getBorderCloseButtonAlpha() * decoration, LayoutTab.CLOSE_BUTTON_WIDTH_DP * dpToPx, t.getStaticToViewBlend(), t.getBorderScale(), t.getSaturation(), t.getBrightness(), t.showToolbar(), t.getToolbarBackgroundColor(), t.anonymizeToolbar(), R.drawable.textbox, t.getTextBoxBackgroundColor(), t.getTextBoxAlpha(), t.getToolbarAlpha(), t.getToolbarYOffset() * dpToPx, t.getSideBorderScale(), true, t.insetBorderVertical()); } nativeFinishBuildingFrame(mNativePtr); }
void function(Context context, Rect viewport, Rect contentViewport, Layout layout, LayerTitleCache layerTitleCache, TabContentManager tabContentManager, ResourceManager resourceManager) { if (mNativePtr == 0) return; Resources res = context.getResources(); final float dpToPx = res.getDisplayMetrics().density; LayoutTab[] tabs = layout.getLayoutTabsToRender(); int tabsCount = tabs != null ? tabs.length : 0; nativeBeginBuildingFrame(mNativePtr); nativeUpdateLayer(mNativePtr, getTabListBackgroundColor(context), viewport.left, viewport.top, viewport.width(), viewport.height(), layerTitleCache, tabContentManager, resourceManager); for (int i = 0; i < tabsCount; i++) { LayoutTab t = tabs[i]; assert t.isVisible() : STR; final float decoration = t.getDecorationAlpha(); int borderResource = t.isIncognito() ? R.drawable.tabswitcher_border_frame_incognito : R.drawable.tabswitcher_border_frame; int closeBtnResource = t.isIncognito() ? R.drawable.btn_tab_close_white_normal : R.drawable.btn_tab_close_normal; int borderColorResource = t.isIncognito() ? R.color.tab_back_incognito : R.color.tab_back; nativePutTabLayer(mNativePtr, t.getId(), R.id.control_container, closeBtnResource, R.drawable.tabswitcher_border_frame_shadow, R.drawable.tabswitcher_border_frame_decoration, R.drawable.logo_card_back, borderResource, R.drawable.tabswitcher_border_frame_inner_shadow, t.canUseLiveTexture(), t.getBackgroundColor(), ApiCompatibilityUtils.getColor(res, borderColorResource), t.isIncognito(), layout.getOrientation() == Orientation.PORTRAIT, t.getRenderX() * dpToPx, t.getRenderY() * dpToPx, t.getScaledContentWidth() * dpToPx, t.getScaledContentHeight() * dpToPx, t.getOriginalContentWidth() * dpToPx, t.getOriginalContentHeight() * dpToPx, contentViewport.height(), t.getClippedX() * dpToPx, t.getClippedY() * dpToPx, Math.min(t.getClippedWidth(), t.getScaledContentWidth()) * dpToPx, Math.min(t.getClippedHeight(), t.getScaledContentHeight()) * dpToPx, t.getTiltXPivotOffset() * dpToPx, t.getTiltYPivotOffset() * dpToPx, t.getTiltX(), t.getTiltY(), t.getAlpha(), t.getBorderAlpha() * decoration, t.getBorderInnerShadowAlpha() * decoration, decoration, t.getShadowOpacity() * decoration, t.getBorderCloseButtonAlpha() * decoration, LayoutTab.CLOSE_BUTTON_WIDTH_DP * dpToPx, t.getStaticToViewBlend(), t.getBorderScale(), t.getSaturation(), t.getBrightness(), t.showToolbar(), t.getToolbarBackgroundColor(), t.anonymizeToolbar(), R.drawable.textbox, t.getTextBoxBackgroundColor(), t.getTextBoxAlpha(), t.getToolbarAlpha(), t.getToolbarYOffset() * dpToPx, t.getSideBorderScale(), true, t.insetBorderVertical()); } nativeFinishBuildingFrame(mNativePtr); }
/** * Pushes all relevant {@link LayoutTab}s from a {@link Layout} to the CC Layer tree. This will * let them be rendered on the screen. This should only be called when the Compositor has * disabled ScheduleComposite calls as this will change the tree and could subsequently cause * unnecessary follow up renders. * @param context The {@link Context} to use to query device information. * @param layout The {@link Layout} to push to the screen. */
Pushes all relevant <code>LayoutTab</code>s from a <code>Layout</code> to the CC Layer tree. This will let them be rendered on the screen. This should only be called when the Compositor has disabled ScheduleComposite calls as this will change the tree and could subsequently cause unnecessary follow up renders
pushLayers
{ "repo_name": "axinging/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabListSceneLayer.java", "license": "bsd-3-clause", "size": 7565 }
[ "android.content.Context", "android.content.res.Resources", "android.graphics.Rect", "org.chromium.base.ApiCompatibilityUtils", "org.chromium.chrome.browser.compositor.LayerTitleCache", "org.chromium.chrome.browser.compositor.layouts.Layout", "org.chromium.chrome.browser.compositor.layouts.components.LayoutTab", "org.chromium.chrome.browser.compositor.layouts.content.TabContentManager", "org.chromium.ui.resources.ResourceManager" ]
import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.browser.compositor.LayerTitleCache; import org.chromium.chrome.browser.compositor.layouts.Layout; import org.chromium.chrome.browser.compositor.layouts.components.LayoutTab; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.ui.resources.ResourceManager;
import android.content.*; import android.content.res.*; import android.graphics.*; import org.chromium.base.*; import org.chromium.chrome.browser.compositor.*; import org.chromium.chrome.browser.compositor.layouts.*; import org.chromium.chrome.browser.compositor.layouts.components.*; import org.chromium.chrome.browser.compositor.layouts.content.*; import org.chromium.ui.resources.*;
[ "android.content", "android.graphics", "org.chromium.base", "org.chromium.chrome", "org.chromium.ui" ]
android.content; android.graphics; org.chromium.base; org.chromium.chrome; org.chromium.ui;
2,222,654
public boolean connect(IDocument document) { if (document == null) { Exception iae = new IllegalArgumentException("can not connect() without a document"); //$NON-NLS-1$ Logger.logException(iae); return false; } DocumentInfo info = (DocumentInfo) fDocumentMap.get(document); if (info == null) return false; ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); boolean isOK = true; try { if (info.buffer.getLocation() != null) { bufferManager.connect(info.buffer.getLocation(), info.locationKind, null); } else if (info.buffer.getFileStore() != null) { bufferManager.connectFileStore(info.buffer.getFileStore(), null); } } catch (CoreException e) { Logger.logException(e); isOK = false; } return isOK; }
boolean function(IDocument document) { if (document == null) { Exception iae = new IllegalArgumentException(STR); Logger.logException(iae); return false; } DocumentInfo info = (DocumentInfo) fDocumentMap.get(document); if (info == null) return false; ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); boolean isOK = true; try { if (info.buffer.getLocation() != null) { bufferManager.connect(info.buffer.getLocation(), info.locationKind, null); } else if (info.buffer.getFileStore() != null) { bufferManager.connectFileStore(info.buffer.getFileStore(), null); } } catch (CoreException e) { Logger.logException(e); isOK = false; } return isOK; }
/** * Registers "interest" in a document, or rather the file buffer that * backs it. Intentionally used to alter the reference count of the file * buffer so it is not accidentally disposed of while we have a model open * on top of it. */
Registers "interest" in a document, or rather the file buffer that backs it. Intentionally used to alter the reference count of the file buffer so it is not accidentally disposed of while we have a model open on top of it
connect
{ "repo_name": "ttimbul/eclipse.wst", "path": "bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java", "license": "epl-1.0", "size": 32736 }
[ "org.eclipse.core.filebuffers.FileBuffers", "org.eclipse.core.filebuffers.ITextFileBufferManager", "org.eclipse.core.runtime.CoreException", "org.eclipse.jface.text.IDocument" ]
import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.ITextFileBufferManager; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.IDocument;
import org.eclipse.core.filebuffers.*; import org.eclipse.core.runtime.*; import org.eclipse.jface.text.*;
[ "org.eclipse.core", "org.eclipse.jface" ]
org.eclipse.core; org.eclipse.jface;
1,617,997
public void setConfigurationSourceProvider(ConfigurationSourceProvider provider) { this.configurationSourceProvider = checkNotNull(provider); }
void function(ConfigurationSourceProvider provider) { this.configurationSourceProvider = checkNotNull(provider); }
/** * Sets the bootstrap's {@link ConfigurationSourceProvider}. */
Sets the bootstrap's <code>ConfigurationSourceProvider</code>
setConfigurationSourceProvider
{ "repo_name": "boundary/dropwizard", "path": "dropwizard-core/src/main/java/io/dropwizard/setup/Bootstrap.java", "license": "apache-2.0", "size": 6895 }
[ "com.google.common.base.Preconditions", "io.dropwizard.configuration.ConfigurationSourceProvider" ]
import com.google.common.base.Preconditions; import io.dropwizard.configuration.ConfigurationSourceProvider;
import com.google.common.base.*; import io.dropwizard.configuration.*;
[ "com.google.common", "io.dropwizard.configuration" ]
com.google.common; io.dropwizard.configuration;
260,328
@Test public void testPadToLengthStringIntChar() { final String padToLength = Text.padToLength("Stem", 5, '*'); log.debug("Text.padToLength('Stem', 5, '*') = |{}|", padToLength); assertEquals(5, padToLength.length()); assertEquals("Stem*", padToLength); }
void function() { final String padToLength = Text.padToLength("Stem", 5, '*'); log.debug(STR, padToLength); assertEquals(5, padToLength.length()); assertEquals("Stem*", padToLength); }
/** * Unit Test to pad a string to length with spaces character. */
Unit Test to pad a string to length with spaces character
testPadToLengthStringIntChar
{ "repo_name": "Martin-Spamer/java-coaching", "path": "src/test/java/coaching/text/TextTest.java", "license": "gpl-3.0", "size": 3788 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,994,687
public static void confirm( Context aContext, String aTitle, String aMessage, DialogInterface.OnClickListener aPositiveHandler, DialogInterface.OnClickListener aNegativeHandler ) { doConfirm( aContext, aTitle, aMessage, aPositiveHandler, aNegativeHandler ); }
static void function( Context aContext, String aTitle, String aMessage, DialogInterface.OnClickListener aPositiveHandler, DialogInterface.OnClickListener aNegativeHandler ) { doConfirm( aContext, aTitle, aMessage, aPositiveHandler, aNegativeHandler ); }
/** * show a confirmation window requesting user interaction * * @param aContext {Context} current application context, IMPORTANT: Google docs claim "getApplicationContext" * should suffice, while in reality MyActivity.this should be passed! * @param aTitle {String} title of the window * @param aMessage {String} message displayed in the window * @param aPositiveHandler {DialogInterface.OnClickListener} the handler when the user gives a positive answer * @param aNegativeHandler {DialogInterface.OnClickListener} the handler when the user gives a negative answer */
show a confirmation window requesting user interaction
confirm
{ "repo_name": "igorski/igorski-android-lib", "path": "src/main/nl/igorski/lib/utils/notifications/Confirm.java", "license": "mit", "size": 6057 }
[ "android.content.Context", "android.content.DialogInterface" ]
import android.content.Context; import android.content.DialogInterface;
import android.content.*;
[ "android.content" ]
android.content;
1,563,686
public void testRequestJavascriptResourceLongExpire() throws Exception { HttpGet get = obtainNoncedGetMethod(sampleJavascriptResourcePathWithNonce, false); HttpResponse response = perform(get); checkLongCache(response, "text/javascript"); assertDefaultAntiClickjacking(response, true, false); get.releaseConnection(); }
void function() throws Exception { HttpGet get = obtainNoncedGetMethod(sampleJavascriptResourcePathWithNonce, false); HttpResponse response = perform(get); checkLongCache(response, STR); assertDefaultAntiClickjacking(response, true, false); get.releaseConnection(); }
/** * Verify that AuraFrameworkServlet responds successfully to valid request for nonced aura js */
Verify that AuraFrameworkServlet responds successfully to valid request for nonced aura js
testRequestJavascriptResourceLongExpire
{ "repo_name": "igor-sfdc/aura", "path": "aura/src/test/java/org/auraframework/http/AuraFrameworkServletHttpTest.java", "license": "apache-2.0", "size": 19239 }
[ "org.apache.http.HttpResponse", "org.apache.http.client.methods.HttpGet" ]
import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet;
import org.apache.http.*; import org.apache.http.client.methods.*;
[ "org.apache.http" ]
org.apache.http;
90,860
public static void sendNPCChatTwoLines(Player player, DialogueListener listener, String firstText, String secondText, int npcID, int dialogueId, String npcName, HeadAnimations anim) { player.send(new SendNPCHeadEvent(4888, npcID)); player.send(new ChatHeadAnimationEvent(4888, Animation.create(anim.getAnim()))); player.send(new SetInterfaceTextEvent(4890, firstText)); player.send(new SetInterfaceTextEvent(4891, secondText)); player.send(new SetInterfaceTextEvent(4889, npcName)); player.getInterfaceSet().openDialogue(listener, 4887); player.setDialog(new Dialogue(4887, dialogueId, listener)); }
static void function(Player player, DialogueListener listener, String firstText, String secondText, int npcID, int dialogueId, String npcName, HeadAnimations anim) { player.send(new SendNPCHeadEvent(4888, npcID)); player.send(new ChatHeadAnimationEvent(4888, Animation.create(anim.getAnim()))); player.send(new SetInterfaceTextEvent(4890, firstText)); player.send(new SetInterfaceTextEvent(4891, secondText)); player.send(new SetInterfaceTextEvent(4889, npcName)); player.getInterfaceSet().openDialogue(listener, 4887); player.setDialog(new Dialogue(4887, dialogueId, listener)); }
/** * Sends an npc chat dialogue with only two lines to display. * * @param player * The player. * @param listener * The listener of the dialogue. * @param firstText * The first text to display. * @param secondText * The second text to display. * @param npcID * The npc id of the head to display (the npc chatting). * @param dialogueId * The dialogue id. * @param npcName * The npc name. * @param anim * The type of head animation to display. */
Sends an npc chat dialogue with only two lines to display
sendNPCChatTwoLines
{ "repo_name": "AWildridge/ProtoScape", "path": "src/org/apollo/game/model/inter/dialog/DialogueSender.java", "license": "isc", "size": 15757 }
[ "org.apollo.game.event.impl.ChatHeadAnimationEvent", "org.apollo.game.event.impl.SendNPCHeadEvent", "org.apollo.game.event.impl.SetInterfaceTextEvent", "org.apollo.game.model.Animation", "org.apollo.game.model.Player" ]
import org.apollo.game.event.impl.ChatHeadAnimationEvent; import org.apollo.game.event.impl.SendNPCHeadEvent; import org.apollo.game.event.impl.SetInterfaceTextEvent; import org.apollo.game.model.Animation; import org.apollo.game.model.Player;
import org.apollo.game.event.impl.*; import org.apollo.game.model.*;
[ "org.apollo.game" ]
org.apollo.game;
303,504
public boolean setBitmap(Bitmap b) { if (b != mBitmap){ mBitmap = b; invalidate(); return true; } return false; }
boolean function(Bitmap b) { if (b != mBitmap){ mBitmap = b; invalidate(); return true; } return false; }
/** * Applies the new bitmap. * @return true if the view was invalidated. */
Applies the new bitmap
setBitmap
{ "repo_name": "YAJATapps/FlickLauncher", "path": "src/com/android/launcher3/ClickShadowView.java", "license": "apache-2.0", "size": 4816 }
[ "android.graphics.Bitmap" ]
import android.graphics.Bitmap;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,090,147
protected void getAndProcessData() throws Exception { // For logging IntervalTimer timer = new IntervalTimer(); // Get from the AVL feed subclass the URL to use for this feed String fullUrl = getUrl(); // Log what is happening logger.warn("Getting data from feed using url=" + fullUrl); // Create the connection URL url = new URL(fullUrl); URLConnection con = url.openConnection(); // Set the timeout so don't wait forever int timeoutMsec = AvlConfig.getAvlFeedTimeoutInMSecs(); con.setConnectTimeout(timeoutMsec); con.setReadTimeout(timeoutMsec); // Request compressed data to reduce bandwidth used if (useCompression) con.setRequestProperty("Accept-Encoding", "gzip,deflate"); // If authentication being used then set user and password if (authenticationUser.getValue() != null && authenticationPassword.getValue() != null) { String authString = authenticationUser.getValue() + ":" + authenticationPassword.getValue(); byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); String authStringEnc = new String(authEncBytes); con.setRequestProperty("Authorization", "Basic " + authStringEnc); } // Set any additional AVL feed specific request headers setRequestHeaders(con); // Create appropriate input stream depending on whether content is // compressed or not InputStream in = con.getInputStream(); if ("gzip".equals(con.getContentEncoding())) { in = new GZIPInputStream(in); logger.debug("Returned data is compressed"); } else { logger.debug("Returned data is NOT compressed"); } // For debugging logger.warn("Time to access inputstream {} msec", timer.elapsedMsec()); // Call the abstract method to actually process the data timer.resetTimer(); Collection<AvlReport> avlReportsReadIn = processData(in); in.close(); logger.warn("Time to parse document {} msec", timer.elapsedMsec()); // Process all the reports read in if (shouldProcessAvl.getValue()) processAvlReports(avlReportsReadIn); }
void function() throws Exception { IntervalTimer timer = new IntervalTimer(); String fullUrl = getUrl(); logger.warn(STR + fullUrl); URL url = new URL(fullUrl); URLConnection con = url.openConnection(); int timeoutMsec = AvlConfig.getAvlFeedTimeoutInMSecs(); con.setConnectTimeout(timeoutMsec); con.setReadTimeout(timeoutMsec); if (useCompression) con.setRequestProperty(STR, STR); if (authenticationUser.getValue() != null && authenticationPassword.getValue() != null) { String authString = authenticationUser.getValue() + ":" + authenticationPassword.getValue(); byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); String authStringEnc = new String(authEncBytes); con.setRequestProperty(STR, STR + authStringEnc); } setRequestHeaders(con); InputStream in = con.getInputStream(); if ("gzip".equals(con.getContentEncoding())) { in = new GZIPInputStream(in); logger.debug(STR); } else { logger.debug(STR); } logger.warn(STR, timer.elapsedMsec()); timer.resetTimer(); Collection<AvlReport> avlReportsReadIn = processData(in); in.close(); logger.warn(STR, timer.elapsedMsec()); if (shouldProcessAvl.getValue()) processAvlReports(avlReportsReadIn); }
/** * Actually reads data from feed and processes it by opening up a URL * specified by getUrl() and then reading the contents. Calls the abstract * method processData() to actually process the input stream. * <p> * This method needs to be overwritten if not real data from a URL * * @throws Exception * Throws a generic exception since the processing is done in * the abstract method processData() and it could throw any type * of exception since we don't really know how the AVL feed will * be processed. */
Actually reads data from feed and processes it by opening up a URL specified by getUrl() and then reading the contents. Calls the abstract method processData() to actually process the input stream. This method needs to be overwritten if not real data from a URL
getAndProcessData
{ "repo_name": "sheldonabrown/core", "path": "transitime/src/main/java/org/transitime/avl/PollUrlAvlModule.java", "license": "gpl-3.0", "size": 9462 }
[ "java.io.InputStream", "java.net.URLConnection", "java.util.Collection", "java.util.zip.GZIPInputStream", "org.apache.commons.codec.binary.Base64", "org.transitime.configData.AvlConfig", "org.transitime.db.structs.AvlReport", "org.transitime.utils.IntervalTimer" ]
import java.io.InputStream; import java.net.URLConnection; import java.util.Collection; import java.util.zip.GZIPInputStream; import org.apache.commons.codec.binary.Base64; import org.transitime.configData.AvlConfig; import org.transitime.db.structs.AvlReport; import org.transitime.utils.IntervalTimer;
import java.io.*; import java.net.*; import java.util.*; import java.util.zip.*; import org.apache.commons.codec.binary.*; import org.transitime.*; import org.transitime.db.structs.*; import org.transitime.utils.*;
[ "java.io", "java.net", "java.util", "org.apache.commons", "org.transitime", "org.transitime.db", "org.transitime.utils" ]
java.io; java.net; java.util; org.apache.commons; org.transitime; org.transitime.db; org.transitime.utils;
2,399,950
public ServerConfiguration copy() throws IOException { ReadableByteArrayOutputStream out = new ReadableByteArrayOutputStream(); serialize(out); return new ServerConfigurationParser(out.toInputStream()).parse(); }
ServerConfiguration function() throws IOException { ReadableByteArrayOutputStream out = new ReadableByteArrayOutputStream(); serialize(out); return new ServerConfigurationParser(out.toInputStream()).parse(); }
/** * Make an exact copy of this ServerConfiguration. */
Make an exact copy of this ServerConfiguration
copy
{ "repo_name": "hbarnard/fcrepo-phaidra", "path": "fcrepo-server/src/main/java/org/fcrepo/server/config/ServerConfiguration.java", "license": "apache-2.0", "size": 10741 }
[ "java.io.IOException", "org.fcrepo.utilities.ReadableByteArrayOutputStream" ]
import java.io.IOException; import org.fcrepo.utilities.ReadableByteArrayOutputStream;
import java.io.*; import org.fcrepo.utilities.*;
[ "java.io", "org.fcrepo.utilities" ]
java.io; org.fcrepo.utilities;
1,761,335
@Override public ScheduledFuture<?> registerTimer(long timestamp, ProcessingTimeCallback callback) { // delay the firing of the timer by 1 ms to align the semantics with watermark. A watermark // T says we won't see elements in the future with a timestamp smaller or equal to T. // With processing time, we therefore need to delay firing the timer by one ms. long delay = Math.max(timestamp - getCurrentProcessingTime(), 0) + 1; // we directly try to register the timer and only react to the status on exception // that way we save unnecessary volatile accesses for each timer try { return timerService.schedule(wrapOnTimerCallback(callback, timestamp), delay, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { final int status = this.status.get(); if (status == STATUS_QUIESCED) { return new NeverCompleteFuture(delay); } else if (status == STATUS_SHUTDOWN) { throw new IllegalStateException("Timer service is shut down"); } else { // something else happened, so propagate the exception throw e; } } }
ScheduledFuture<?> function(long timestamp, ProcessingTimeCallback callback) { long delay = Math.max(timestamp - getCurrentProcessingTime(), 0) + 1; try { return timerService.schedule(wrapOnTimerCallback(callback, timestamp), delay, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { final int status = this.status.get(); if (status == STATUS_QUIESCED) { return new NeverCompleteFuture(delay); } else if (status == STATUS_SHUTDOWN) { throw new IllegalStateException(STR); } else { throw e; } } }
/** * Registers a task to be executed no sooner than time {@code timestamp}, but without strong * guarantees of order. * * @param timestamp Time when the task is to be enabled (in processing time) * @param callback The task to be executed * @return The future that represents the scheduled task. This always returns some future, * even if the timer was shut down */
Registers a task to be executed no sooner than time timestamp, but without strong guarantees of order
registerTimer
{ "repo_name": "mbode/flink", "path": "flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SystemProcessingTimeService.java", "license": "apache-2.0", "size": 9604 }
[ "java.util.concurrent.RejectedExecutionException", "java.util.concurrent.ScheduledFuture", "java.util.concurrent.TimeUnit", "org.apache.flink.util.concurrent.NeverCompleteFuture" ]
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import org.apache.flink.util.concurrent.NeverCompleteFuture;
import java.util.concurrent.*; import org.apache.flink.util.concurrent.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
1,200,205
public ServiceFuture<NetAppAccountInner> createOrUpdateAsync(String resourceGroupName, String accountName, NetAppAccountInner body, final ServiceCallback<NetAppAccountInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body), serviceCallback); }
ServiceFuture<NetAppAccountInner> function(String resourceGroupName, String accountName, NetAppAccountInner body, final ServiceCallback<NetAppAccountInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, body), serviceCallback); }
/** * Create or update a NetApp account. * Create or update the specified NetApp account within the resource group. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param body NetApp Account object supplied in the body of the operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Create or update a NetApp account. Create or update the specified NetApp account within the resource group
createOrUpdateAsync
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/netapp/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/netapp/v2019_07_01/implementation/AccountsInner.java", "license": "mit", "size": 40539 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,732,498
private String findConfigedHosts(ProtocolConfig protocolConfig, List<URL> registryURLs, Map<String, String> map) { boolean anyhost = false; String hostToBind = getValueFromConfig(protocolConfig, DUBBO_IP_TO_BIND); if (hostToBind != null && hostToBind.length() > 0 && isInvalidLocalHost(hostToBind)) { throw new IllegalArgumentException("Specified invalid bind ip from property:" + DUBBO_IP_TO_BIND + ", value:" + hostToBind); } // if bind ip is not found in environment, keep looking up if (StringUtils.isEmpty(hostToBind)) { hostToBind = protocolConfig.getHost(); if (provider != null && StringUtils.isEmpty(hostToBind)) { hostToBind = provider.getHost(); } if (isInvalidLocalHost(hostToBind)) { anyhost = true; logger.info("No valid ip found from environment, try to get local host."); hostToBind = getLocalHost(); } } map.put(BIND_IP_KEY, hostToBind); // registry ip is not used for bind ip by default String hostToRegistry = getValueFromConfig(protocolConfig, DUBBO_IP_TO_REGISTRY); if (hostToRegistry != null && hostToRegistry.length() > 0 && isInvalidLocalHost(hostToRegistry)) { throw new IllegalArgumentException( "Specified invalid registry ip from property:" + DUBBO_IP_TO_REGISTRY + ", value:" + hostToRegistry); } else if (StringUtils.isEmpty(hostToRegistry)) { // bind ip is used as registry ip by default hostToRegistry = hostToBind; } map.put(ANYHOST_KEY, String.valueOf(anyhost)); return hostToRegistry; }
String function(ProtocolConfig protocolConfig, List<URL> registryURLs, Map<String, String> map) { boolean anyhost = false; String hostToBind = getValueFromConfig(protocolConfig, DUBBO_IP_TO_BIND); if (hostToBind != null && hostToBind.length() > 0 && isInvalidLocalHost(hostToBind)) { throw new IllegalArgumentException(STR + DUBBO_IP_TO_BIND + STR + hostToBind); } if (StringUtils.isEmpty(hostToBind)) { hostToBind = protocolConfig.getHost(); if (provider != null && StringUtils.isEmpty(hostToBind)) { hostToBind = provider.getHost(); } if (isInvalidLocalHost(hostToBind)) { anyhost = true; logger.info(STR); hostToBind = getLocalHost(); } } map.put(BIND_IP_KEY, hostToBind); String hostToRegistry = getValueFromConfig(protocolConfig, DUBBO_IP_TO_REGISTRY); if (hostToRegistry != null && hostToRegistry.length() > 0 && isInvalidLocalHost(hostToRegistry)) { throw new IllegalArgumentException( STR + DUBBO_IP_TO_REGISTRY + STR + hostToRegistry); } else if (StringUtils.isEmpty(hostToRegistry)) { hostToRegistry = hostToBind; } map.put(ANYHOST_KEY, String.valueOf(anyhost)); return hostToRegistry; }
/** * Register & bind IP address for service provider, can be configured separately. * Configuration priority: environment variables -> java system properties -> host property in config file -> * /etc/hosts -> default network address -> first available network address * * @param protocolConfig * @param registryURLs * @param map * @return */
Register & bind IP address for service provider, can be configured separately. Configuration priority: environment variables -> java system properties -> host property in config file -> etc/hosts -> default network address -> first available network address
findConfigedHosts
{ "repo_name": "wuwen5/dubbo", "path": "dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java", "license": "apache-2.0", "size": 33137 }
[ "java.util.List", "java.util.Map", "org.apache.dubbo.common.utils.NetUtils", "org.apache.dubbo.common.utils.StringUtils" ]
import java.util.List; import java.util.Map; import org.apache.dubbo.common.utils.NetUtils; import org.apache.dubbo.common.utils.StringUtils;
import java.util.*; import org.apache.dubbo.common.utils.*;
[ "java.util", "org.apache.dubbo" ]
java.util; org.apache.dubbo;
2,067,011
public PactDslJsonArray date() { String pattern = DateFormatUtils.ISO_DATE_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_DATE_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateGenerator(pattern)); matchers.addRule(rootPath + appendArrayIndex(0), matchDate(pattern)); return this; }
PactDslJsonArray function() { String pattern = DateFormatUtils.ISO_DATE_FORMAT.getPattern(); body.put(DateFormatUtils.ISO_DATE_FORMAT.format(new Date(DATE_2000))); generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(0), new DateGenerator(pattern)); matchers.addRule(rootPath + appendArrayIndex(0), matchDate(pattern)); return this; }
/** * Element that must be formatted as an ISO date */
Element that must be formatted as an ISO date
date
{ "repo_name": "Fitzoh/pact-jvm", "path": "pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java", "license": "apache-2.0", "size": 35404 }
[ "au.com.dius.pact.model.generators.Category", "au.com.dius.pact.model.generators.DateGenerator", "java.util.Date", "org.apache.commons.lang3.time.DateFormatUtils" ]
import au.com.dius.pact.model.generators.Category; import au.com.dius.pact.model.generators.DateGenerator; import java.util.Date; import org.apache.commons.lang3.time.DateFormatUtils;
import au.com.dius.pact.model.generators.*; import java.util.*; import org.apache.commons.lang3.time.*;
[ "au.com.dius", "java.util", "org.apache.commons" ]
au.com.dius; java.util; org.apache.commons;
1,111,048
private static boolean matchesRegexConstraint(Object constraint, Object value, String options) throws ParseException { if (value == null || value == JSONObject.NULL) { return false; } if (options == null) { options = ""; } if (!options.matches("^[imxs]*$")) { throw new ParseException(ParseException.INVALID_QUERY, String.format( "Invalid regex options: %s", options)); } int flags = 0; if (options.contains("i")) { flags = flags | Pattern.CASE_INSENSITIVE; } if (options.contains("m")) { flags = flags | Pattern.MULTILINE; } if (options.contains("x")) { flags = flags | Pattern.COMMENTS; } if (options.contains("s")) { flags = flags | Pattern.DOTALL; } String regex = (String) constraint; Pattern pattern = Pattern.compile(regex, flags); Matcher matcher = pattern.matcher((String) value); return matcher.find(); }
static boolean function(Object constraint, Object value, String options) throws ParseException { if (value == null value == JSONObject.NULL) { return false; } if (options == null) { options = STR^[imxs]*$STRInvalid regex options: %sSTRiSTRmSTRxSTRs")) { flags = flags Pattern.DOTALL; } String regex = (String) constraint; Pattern pattern = Pattern.compile(regex, flags); Matcher matcher = pattern.matcher((String) value); return matcher.find(); }
/** * Matches $regex constraints. */
Matches $regex constraints
matchesRegexConstraint
{ "repo_name": "Milstein/Parse-SDK-Android", "path": "Parse/src/main/java/com/parse/OfflineQueryLogic.java", "license": "bsd-3-clause", "size": 35962 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern", "org.json.JSONObject" ]
import java.util.regex.Matcher; import java.util.regex.Pattern; import org.json.JSONObject;
import java.util.regex.*; import org.json.*;
[ "java.util", "org.json" ]
java.util; org.json;
1,740,391
public static TransportClient buildClient(String host, Integer port, String clusterName){ Settings settings = ImmutableSettings.settingsBuilder() .put("cluster.name", clusterName).build(); TransportClient client = new TransportClient(settings) .addTransportAddress(new InetSocketTransportAddress(host, port)); return client; }
static TransportClient function(String host, Integer port, String clusterName){ Settings settings = ImmutableSettings.settingsBuilder() .put(STR, clusterName).build(); TransportClient client = new TransportClient(settings) .addTransportAddress(new InetSocketTransportAddress(host, port)); return client; }
/** * Build single-host ElasticSearch client using a specific cluster name * @param host * @param port * @param clusterName * @return */
Build single-host ElasticSearch client using a specific cluster name
buildClient
{ "repo_name": "Canadensys/canadensys-data-access", "path": "src/main/java/net/canadensys/databaseutils/ElasticSearchUtils.java", "license": "mit", "size": 1309 }
[ "org.elasticsearch.client.transport.TransportClient", "org.elasticsearch.common.settings.ImmutableSettings", "org.elasticsearch.common.settings.Settings", "org.elasticsearch.common.transport.InetSocketTransportAddress" ]
import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.client.transport.*; import org.elasticsearch.common.settings.*; import org.elasticsearch.common.transport.*;
[ "org.elasticsearch.client", "org.elasticsearch.common" ]
org.elasticsearch.client; org.elasticsearch.common;
1,540,178
EAttribute getTelephoneType_Facsimile();
EAttribute getTelephoneType_Facsimile();
/** * Returns the meta object for the attribute '{@link net.opengis.ows20.TelephoneType#getFacsimile <em>Facsimile</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Facsimile</em>'. * @see net.opengis.ows20.TelephoneType#getFacsimile() * @see #getTelephoneType() * @generated */
Returns the meta object for the attribute '<code>net.opengis.ows20.TelephoneType#getFacsimile Facsimile</code>'.
getTelephoneType_Facsimile
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.ows/src/net/opengis/ows20/Ows20Package.java", "license": "lgpl-2.1", "size": 356067 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,706,453
@SuppressWarnings("unchecked") public List<SiteUpdateReportVo> retrieveSiteHistory(long site, int limit, int startMonth, int startYear, int endMonth, int endYear) { String sql = " SELECT site.site_id, site.site_name, version.region_name, version.fdb_id, version.is_successful," + " version.message, version.last_update_time, version.last_update_timezone, fdb.is_custom, fdb.version_number" + " FROM datup.fdb_site_update version, datup.fdb_version fdb, datup.site site" + " WHERE fdb.fdb_id = version.fdb_id AND site.site_id = version.site_id AND site.site_id = ?" + " AND fdb.when_created >= ? AND fdb.when_created <= ? " + " ORDER BY 10 DESC, 7 DESC"; int[] types = new int[] {Types.INTEGER, Types.TIMESTAMP, Types.TIMESTAMP}; Calendar startDate = new GregorianCalendar(startYear, startMonth, 1); startDate.set(Calendar.DAY_OF_MONTH, startDate.getMinimum(Calendar.DAY_OF_MONTH)); startDate.set(Calendar.HOUR_OF_DAY, startDate.getMinimum(Calendar.HOUR_OF_DAY)); startDate.set(Calendar.MINUTE, startDate.getMinimum(Calendar.MINUTE)); startDate.set(Calendar.SECOND, startDate.getMinimum(Calendar.SECOND)); Calendar endDate = new GregorianCalendar(endYear, endMonth, 1); endDate.set(Calendar.DAY_OF_MONTH, endDate.getMaximum(Calendar.DAY_OF_MONTH)); endDate.set(Calendar.HOUR_OF_DAY, endDate.getMaximum(Calendar.HOUR_OF_DAY)); endDate.set(Calendar.MINUTE, endDate.getMaximum(Calendar.MINUTE)); endDate.set(Calendar.SECOND, endDate.getMaximum(Calendar.SECOND)); jdbcTemplate.setMaxRows(limit); return jdbcTemplate.query(sql, new Object[] {site, startDate.getTime(), endDate.getTime()}, types, new SiteUpdateMapper()); }
@SuppressWarnings(STR) List<SiteUpdateReportVo> function(long site, int limit, int startMonth, int startYear, int endMonth, int endYear) { String sql = STR + STR + STR + STR + STR + STR; int[] types = new int[] {Types.INTEGER, Types.TIMESTAMP, Types.TIMESTAMP}; Calendar startDate = new GregorianCalendar(startYear, startMonth, 1); startDate.set(Calendar.DAY_OF_MONTH, startDate.getMinimum(Calendar.DAY_OF_MONTH)); startDate.set(Calendar.HOUR_OF_DAY, startDate.getMinimum(Calendar.HOUR_OF_DAY)); startDate.set(Calendar.MINUTE, startDate.getMinimum(Calendar.MINUTE)); startDate.set(Calendar.SECOND, startDate.getMinimum(Calendar.SECOND)); Calendar endDate = new GregorianCalendar(endYear, endMonth, 1); endDate.set(Calendar.DAY_OF_MONTH, endDate.getMaximum(Calendar.DAY_OF_MONTH)); endDate.set(Calendar.HOUR_OF_DAY, endDate.getMaximum(Calendar.HOUR_OF_DAY)); endDate.set(Calendar.MINUTE, endDate.getMaximum(Calendar.MINUTE)); endDate.set(Calendar.SECOND, endDate.getMaximum(Calendar.SECOND)); jdbcTemplate.setMaxRows(limit); return jdbcTemplate.query(sql, new Object[] {site, startDate.getTime(), endDate.getTime()}, types, new SiteUpdateMapper()); }
/** * Retrieve site update history. * * @param site site number * @param limit number of records * @param startMonth start month * @param startYear start year * @param endMonth end month * @param endYear end year * @return site history */
Retrieve site update history
retrieveSiteHistory
{ "repo_name": "OSEHRA-Sandbox/MOCHA", "path": "src/gov/va/med/pharmacy/peps/updater/common/database/SiteUpdate.java", "license": "apache-2.0", "size": 16411 }
[ "gov.va.med.pharmacy.peps.common.vo.SiteUpdateReportVo", "java.sql.Types", "java.util.Calendar", "java.util.GregorianCalendar", "java.util.List" ]
import gov.va.med.pharmacy.peps.common.vo.SiteUpdateReportVo; import java.sql.Types; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.List;
import gov.va.med.pharmacy.peps.common.vo.*; import java.sql.*; import java.util.*;
[ "gov.va.med", "java.sql", "java.util" ]
gov.va.med; java.sql; java.util;
2,605,480
public void purgeExceptionAndNull() { Iterator<E> it = this.memberList.iterator(); while (it.hasNext()) { E element = (E) it.next(); if ((element instanceof Throwable) || (element == null)) { it.remove(); } } }
void function() { Iterator<E> it = this.memberList.iterator(); while (it.hasNext()) { E element = (E) it.next(); if ((element instanceof Throwable) (element == null)) { it.remove(); } } }
/** * Removes all exceptions and null references contained in the Group. Exceptions (and null * references) appears with communication/program-level/runtime errors and are stored in the * Group. (After this operation the size of the Group decreases) */
Removes all exceptions and null references contained in the Group. Exceptions (and null references) appears with communication/program-level/runtime errors and are stored in the Group. (After this operation the size of the Group decreases)
purgeExceptionAndNull
{ "repo_name": "acontes/programming", "path": "src/Core/org/objectweb/proactive/core/group/ProxyForGroup.java", "license": "agpl-3.0", "size": 57805 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,480,471
public void createTopic(final String topic, final int partitions, final int replication) { createTopic(topic, partitions, replication, new Properties()); }
void function(final String topic, final int partitions, final int replication) { createTopic(topic, partitions, replication, new Properties()); }
/** * Create a Kafka topic with the given parameters. * * @param topic The name of the topic. * @param partitions The number of partitions for this topic. * @param replication The replication factor for (the partitions of) this topic. */
Create a Kafka topic with the given parameters
createTopic
{ "repo_name": "richhaase/kafka", "path": "streams/src/test/java/org/apache/kafka/streams/integration/utils/KafkaEmbedded.java", "license": "apache-2.0", "size": 9141 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
552,071
@IgniteInstanceResource private void injectResources(Ignite ignite) { if (ignite != null) { // Inject resources. igniteInstanceName = ignite.name(); locNodeId = ignite.configuration().getNodeId(); } else { // Cleanup resources. igniteInstanceName = null; locNodeId = null; } }
void function(Ignite ignite) { if (ignite != null) { igniteInstanceName = ignite.name(); locNodeId = ignite.configuration().getNodeId(); } else { igniteInstanceName = null; locNodeId = null; } }
/** * Injects resources. * * @param ignite Ignite */
Injects resources
injectResources
{ "repo_name": "nizhikov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java", "license": "apache-2.0", "size": 25938 }
[ "org.apache.ignite.Ignite" ]
import org.apache.ignite.Ignite;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
113,618
public static synchronized Groups getUserToGroupsMappingService( Configuration conf) { if(GROUPS == null) { if(LOG.isDebugEnabled()) { LOG.debug(" Creating new Groups object"); } GROUPS = new Groups(conf); } return GROUPS; }
static synchronized Groups function( Configuration conf) { if(GROUPS == null) { if(LOG.isDebugEnabled()) { LOG.debug(STR); } GROUPS = new Groups(conf); } return GROUPS; }
/** * Get the groups being used to map user-to-groups. * @param conf * @return the groups being used to map user-to-groups. */
Get the groups being used to map user-to-groups
getUserToGroupsMappingService
{ "repo_name": "robzor92/hops", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/Groups.java", "license": "apache-2.0", "size": 16253 }
[ "org.apache.hadoop.conf.Configuration" ]
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,881,916
public ItemLoadedFuture getThumbnail(Uri uri, final ItemLoadedCallback<ImageLoaded> callback) { return getThumbnail(uri, false, callback); }
ItemLoadedFuture function(Uri uri, final ItemLoadedCallback<ImageLoaded> callback) { return getThumbnail(uri, false, callback); }
/** * getThumbnail must be called on the same thread that created ThumbnailManager. This is * normally the UI thread. * @param uri the uri of the image * @param width the original full width of the image * @param height the original full height of the image * @param callback the callback to call when the thumbnail is fully loaded * @return */
getThumbnail must be called on the same thread that created ThumbnailManager. This is normally the UI thread
getThumbnail
{ "repo_name": "CommonQ/sms_DualCard", "path": "src/edu/bupt/mms/util/ThumbnailManager.java", "license": "apache-2.0", "size": 19499 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
1,338,050
public void removeAcl(Path path) throws IOException { throw new UnsupportedOperationException(getClass().getSimpleName() + " doesn't support removeAcl"); }
void function(Path path) throws IOException { throw new UnsupportedOperationException(getClass().getSimpleName() + STR); }
/** * Removes all but the base ACL entries of files and directories. The entries * for user, group, and others are retained for compatibility with permission * bits. * * @param path Path to modify * @throws IOException if an ACL could not be removed */
Removes all but the base ACL entries of files and directories. The entries for user, group, and others are retained for compatibility with permission bits
removeAcl
{ "repo_name": "Microsoft-CISL/hadoop-prototype", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java", "license": "apache-2.0", "size": 116772 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
215,873
public IgfsMode getDefaultMode() { return dfltMode; }
IgfsMode function() { return dfltMode; }
/** * Gets mode to specify how {@code IGFS} interacts with Hadoop file system, like {@code HDFS}. * Secondary Hadoop file system is provided for pass-through, write-through, and read-through * purposes. * <p> * Default mode is {@link org.apache.ignite.igfs.IgfsMode#DUAL_ASYNC}. If secondary Hadoop file system is * not configured, this mode will work just like {@link org.apache.ignite.igfs.IgfsMode#PRIMARY} mode. * * @return Mode to specify how IGFS interacts with secondary HDFS file system. */
Gets mode to specify how IGFS interacts with Hadoop file system, like HDFS. Secondary Hadoop file system is provided for pass-through, write-through, and read-through purposes. Default mode is <code>org.apache.ignite.igfs.IgfsMode#DUAL_ASYNC</code>. If secondary Hadoop file system is not configured, this mode will work just like <code>org.apache.ignite.igfs.IgfsMode#PRIMARY</code> mode
getDefaultMode
{ "repo_name": "dlnufox/ignite", "path": "modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java", "license": "apache-2.0", "size": 29112 }
[ "org.apache.ignite.igfs.IgfsMode" ]
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.igfs.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,707,367
public static ResourceBundle getExceptionResourceBundle() { if (exceptionResourceBundle.get() == null) { setExceptionResourceBundle(); } return exceptionResourceBundle.get(); }
static ResourceBundle function() { if (exceptionResourceBundle.get() == null) { setExceptionResourceBundle(); } return exceptionResourceBundle.get(); }
/** * Get exception resource bundle. * @return resource bundle. */
Get exception resource bundle
getExceptionResourceBundle
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/fxgutils/src/java/com/adobe/fxg/util/FXGLocalizationUtil.java", "license": "apache-2.0", "size": 8016 }
[ "java.util.ResourceBundle" ]
import java.util.ResourceBundle;
import java.util.*;
[ "java.util" ]
java.util;
2,353,230
private void pressDownUntilViewInFocus(View view, int maxKeyPress) { int count = 0; while(!view.hasFocus()) { sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); getInstrumentation().waitForIdleSync(); // just in case... if (++count > maxKeyPress) { fail("couldn't move down to bottom button within " + maxKeyPress + " key presses."); } } }
void function(View view, int maxKeyPress) { int count = 0; while(!view.hasFocus()) { sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); getInstrumentation().waitForIdleSync(); if (++count > maxKeyPress) { fail(STR + maxKeyPress + STR); } } }
/** * Press the down key until a particular view is in focus * @param view The view to get in focus. * @param maxKeyPress The maximum times to press down before failing. */
Press the down key until a particular view is in focus
pressDownUntilViewInFocus
{ "repo_name": "rex-xxx/mt6572_x201", "path": "mediatek/frameworks/base/tests/widget/src/com/mediatek/common/widget/tests/scroll/RequestRectangleVisibleTest.java", "license": "gpl-2.0", "size": 8627 }
[ "android.view.KeyEvent", "android.view.View" ]
import android.view.KeyEvent; import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,550,196
private static String toSource(Node root, Format outputFormat, CompilerOptions options, SourceMap sourceMap, boolean tagAsExterns, boolean tagAsStrict, boolean lineBreak, CodeGeneratorFactory codeGeneratorFactory) { checkState(options.sourceMapDetailLevel != null); boolean createSourceMap = (sourceMap != null); MappedCodePrinter mcp = outputFormat == Format.COMPACT ? new CompactCodePrinter( lineBreak, options.preferLineBreakAtEndOfFile, options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel) : new PrettyCodePrinter( options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel); CodeGenerator cg = codeGeneratorFactory.getCodeGenerator(outputFormat, mcp); if (tagAsExterns) { cg.tagAsExterns(); } if (tagAsStrict) { cg.tagAsStrict(); } cg.add(root); mcp.endFile(); String code = mcp.getCode(); if (createSourceMap) { mcp.generateSourceMap(code, sourceMap); } return code; }
static String function(Node root, Format outputFormat, CompilerOptions options, SourceMap sourceMap, boolean tagAsExterns, boolean tagAsStrict, boolean lineBreak, CodeGeneratorFactory codeGeneratorFactory) { checkState(options.sourceMapDetailLevel != null); boolean createSourceMap = (sourceMap != null); MappedCodePrinter mcp = outputFormat == Format.COMPACT ? new CompactCodePrinter( lineBreak, options.preferLineBreakAtEndOfFile, options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel) : new PrettyCodePrinter( options.lineLengthThreshold, createSourceMap, options.sourceMapDetailLevel); CodeGenerator cg = codeGeneratorFactory.getCodeGenerator(outputFormat, mcp); if (tagAsExterns) { cg.tagAsExterns(); } if (tagAsStrict) { cg.tagAsStrict(); } cg.add(root); mcp.endFile(); String code = mcp.getCode(); if (createSourceMap) { mcp.generateSourceMap(code, sourceMap); } return code; }
/** * Converts a tree to JS code */
Converts a tree to JS code
toSource
{ "repo_name": "GerHobbelt/closure-compiler", "path": "src/com/google/javascript/jscomp/CodePrinter.java", "license": "apache-2.0", "size": 27636 }
[ "com.google.common.base.Preconditions", "com.google.javascript.jscomp.CodePrinter", "com.google.javascript.rhino.Node" ]
import com.google.common.base.Preconditions; import com.google.javascript.jscomp.CodePrinter; import com.google.javascript.rhino.Node;
import com.google.common.base.*; import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
2,767,515
public Graph split_three(){ GraphImpl graph = new GraphImpl( "split_three", 1 ); Node fork = new AndFork( 1 ); Node node2 = createRecordPathNode( 2 ); Node node3 = createRecordPathNode( 3 ); Node node4 = createRecordPathNode( 4 ); graph.setStartNode( fork ); graph.addNode( node2 ); graph.addNode( node3 ); graph.addNode( node4 ); graph.addTransition( new TransitionImpl( "1_2", fork, node2 ) ); graph.addTransition( new TransitionImpl( "1_3", fork, node3 ) ); graph.addTransition( new TransitionImpl( "1_4", fork, node4 ) ); return graph; }
Graph function(){ GraphImpl graph = new GraphImpl( STR, 1 ); Node fork = new AndFork( 1 ); Node node2 = createRecordPathNode( 2 ); Node node3 = createRecordPathNode( 3 ); Node node4 = createRecordPathNode( 4 ); graph.setStartNode( fork ); graph.addNode( node2 ); graph.addNode( node3 ); graph.addNode( node4 ); graph.addTransition( new TransitionImpl( "1_2", fork, node2 ) ); graph.addTransition( new TransitionImpl( "1_3", fork, node3 ) ); graph.addTransition( new TransitionImpl( "1_4", fork, node4 ) ); return graph; }
/** * <pre> * +--[2] * [AND]--[3] * +--[4] * </pre> */
<code> +--[2] [AND]--[3] +--[4] </code>
split_three
{ "repo_name": "zutnop/telekom-workflow-engine", "path": "telekom-workflow-engine/src/test/java/ee/telekom/workflow/graph/GraphFactory.java", "license": "mit", "size": 74501 }
[ "ee.telekom.workflow.graph.core.GraphImpl", "ee.telekom.workflow.graph.core.TransitionImpl", "ee.telekom.workflow.graph.node.gateway.AndFork" ]
import ee.telekom.workflow.graph.core.GraphImpl; import ee.telekom.workflow.graph.core.TransitionImpl; import ee.telekom.workflow.graph.node.gateway.AndFork;
import ee.telekom.workflow.graph.core.*; import ee.telekom.workflow.graph.node.gateway.*;
[ "ee.telekom.workflow" ]
ee.telekom.workflow;
2,092,217
public final LongUpdater reserveLong() { if (this.ignoreWrites) return null; checkIfWritable(); ensureCapacity(8); LongUpdater result = new LongUpdater(this.buffer); buffer.putLong(0L); return result; } public static class LongUpdater { private final ByteBuffer bb; private final int pos; public LongUpdater(ByteBuffer bb) { this.bb = bb; this.pos = bb.position(); }
final LongUpdater function() { if (this.ignoreWrites) return null; checkIfWritable(); ensureCapacity(8); LongUpdater result = new LongUpdater(this.buffer); buffer.putLong(0L); return result; } public static class LongUpdater { private final ByteBuffer bb; private final int pos; public LongUpdater(ByteBuffer bb) { this.bb = bb; this.pos = bb.position(); }
/** * Reserves space in the output for a long * and returns a LongUpdater than can be used * to update this particular long. * @return the LongUpdater that allows the long to be updated */
Reserves space in the output for a long and returns a LongUpdater than can be used to update this particular long
reserveLong
{ "repo_name": "sshcherbakov/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/HeapDataOutputStream.java", "license": "apache-2.0", "size": 43910 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
1,761,188
private void queueToGrid(Candidate result) { if (queueSize == queue.length) { queue = Arrays.copyOf(queue, queueSize * 2); } queue[queueSize++] = result; }
void function(Candidate result) { if (queueSize == queue.length) { queue = Arrays.copyOf(queue, queueSize * 2); } queue[queueSize++] = result; }
/** * Queue to grid. * * <p>Used to add results to the grid for the current fit position. This prevents filtering * duplicates within the current fit results, only with all that has been fit before. * * @param result the result */
Queue to grid. Used to add results to the grid for the current fit position. This prevents filtering duplicates within the current fit results, only with all that has been fit before
queueToGrid
{ "repo_name": "aherbert/GDSC-SMLM", "path": "src/main/java/uk/ac/sussex/gdsc/smlm/engine/FitWorker.java", "license": "gpl-3.0", "size": 191121 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,729,547
public void write_string(final String s) { final int len = s.length(); switch (len) { case 0: write_nil(); break; default: if (len <= 65535 && is8bitString(s)) { // 8-bit string try { final byte[] bytebuf = s.getBytes("ISO-8859-1"); write1(OtpExternal.stringTag); write2BE(len); writeN(bytebuf); } catch (final UnsupportedEncodingException e) { write_nil(); // it should never ever get here... } } else { // unicode or longer, must code as list final char[] charbuf = s.toCharArray(); final int[] codePoints = OtpErlangString.stringToCodePoints(s); write_list_head(codePoints.length); for (final int codePoint : codePoints) { write_int(codePoint); } write_nil(); } } }
void function(final String s) { final int len = s.length(); switch (len) { case 0: write_nil(); break; default: if (len <= 65535 && is8bitString(s)) { try { final byte[] bytebuf = s.getBytes(STR); write1(OtpExternal.stringTag); write2BE(len); writeN(bytebuf); } catch (final UnsupportedEncodingException e) { write_nil(); } } else { final char[] charbuf = s.toCharArray(); final int[] codePoints = OtpErlangString.stringToCodePoints(s); write_list_head(codePoints.length); for (final int codePoint : codePoints) { write_int(codePoint); } write_nil(); } } }
/** * Write a string to the stream. * * @param s * the string to write. */
Write a string to the stream
write_string
{ "repo_name": "mosaic-cloud/mosaic-distribution-dependencies", "path": "dependencies/otp/17.1/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java", "license": "apache-2.0", "size": 27073 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
2,706,102
public synchronized final void assertFilesOfType( final IFileType... types) { final Collection<IFileType> coll; coll = this.getProducedFiles().values(); for (final IFileType type : types) { if (!(coll.contains(type))) { throw new AssertionError("No file of type '" //$NON-NLS-1$ + type + "' found."); //$NON-NLS-1$ } } }
synchronized final void function( final IFileType... types) { final Collection<IFileType> coll; coll = this.getProducedFiles().values(); for (final IFileType type : types) { if (!(coll.contains(type))) { throw new AssertionError(STR + type + STR); } } }
/** * Assert that files of the given types have been produced * * @param types * the file types */
Assert that files of the given types have been produced
assertFilesOfType
{ "repo_name": "optimizationBenchmarking/utils-base", "path": "src/test/java/shared/FileProducerCollector.java", "license": "gpl-3.0", "size": 921 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
489,627
public ModelMap toView(CSWOnlineResource res) { ModelMap obj = new ModelMap(); obj.put("url", res.getLinkage().toString()); obj.put("onlineResourceType", res.getType().name()); obj.put("name", res.getName()); obj.put("description", res.getDescription().toString()); return obj; }
ModelMap function(CSWOnlineResource res) { ModelMap obj = new ModelMap(); obj.put("url", res.getLinkage().toString()); obj.put(STR, res.getType().name()); obj.put("name", res.getName()); obj.put(STR, res.getDescription().toString()); return obj; }
/** * Converts a CSWOnlineResource to its view equivalent * @param res * @return */
Converts a CSWOnlineResource to its view equivalent
toView
{ "repo_name": "AuScope/GA-eResearch-Portal", "path": "src/main/java/org/auscope/portal/server/web/view/ViewCSWRecordFactory.java", "license": "gpl-3.0", "size": 4351 }
[ "org.auscope.portal.csw.record.CSWOnlineResource", "org.springframework.ui.ModelMap" ]
import org.auscope.portal.csw.record.CSWOnlineResource; import org.springframework.ui.ModelMap;
import org.auscope.portal.csw.record.*; import org.springframework.ui.*;
[ "org.auscope.portal", "org.springframework.ui" ]
org.auscope.portal; org.springframework.ui;
2,522,235
private int evaluateNext( int nextEventType ) throws XMLStreamException{ switch (nextEventType ){ case XMLStreamReader.START_ELEMENT: fDepth++; break; case XMLStreamReader.END_ELEMENT: fDepth--; break; } if( fDepth < 1){ // Advance the cursor to the next start element, but return that we're done fReader.nextTag(); return XMLStreamReader.END_DOCUMENT; } return nextEventType; }
int function( int nextEventType ) throws XMLStreamException{ switch (nextEventType ){ case XMLStreamReader.START_ELEMENT: fDepth++; break; case XMLStreamReader.END_ELEMENT: fDepth--; break; } if( fDepth < 1){ fReader.nextTag(); return XMLStreamReader.END_DOCUMENT; } return nextEventType; }
/** * Evaluates the event type returned by the underlying reader. * @param nextEventType * @return * @throws XMLStreamException */
Evaluates the event type returned by the underlying reader
evaluateNext
{ "repo_name": "open-adk/OpenADK-java", "path": "adk-library/src/main/java/openadk/util/XMLNodeReader.java", "license": "apache-2.0", "size": 9884 }
[ "javax.xml.stream.XMLStreamException", "javax.xml.stream.XMLStreamReader" ]
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.*;
[ "javax.xml" ]
javax.xml;
1,864,945
protected Object executeScript(ScriptSource scriptSource, Class<?> scriptClass) throws ScriptCompilationException { try { GroovyObject goo = (GroovyObject) ReflectionUtils.accessibleConstructor(scriptClass).newInstance(); if (this.groovyObjectCustomizer != null) { // Allow metaclass and other customization. this.groovyObjectCustomizer.customize(goo); } if (goo instanceof Script) { // A Groovy script, probably creating an instance: let's execute it. return ((Script) goo).run(); } else { // An instance of the scripted class: let's return it as-is. return goo; } } catch (NoSuchMethodException ex) { throw new ScriptCompilationException( "No default constructor on Groovy script class: " + scriptClass.getName(), ex); } catch (InstantiationException ex) { throw new ScriptCompilationException( scriptSource, "Unable to instantiate Groovy script class: " + scriptClass.getName(), ex); } catch (IllegalAccessException ex) { throw new ScriptCompilationException( scriptSource, "Could not access Groovy script constructor: " + scriptClass.getName(), ex); } catch (InvocationTargetException ex) { throw new ScriptCompilationException( "Failed to invoke Groovy script constructor: " + scriptClass.getName(), ex.getTargetException()); } }
Object function(ScriptSource scriptSource, Class<?> scriptClass) throws ScriptCompilationException { try { GroovyObject goo = (GroovyObject) ReflectionUtils.accessibleConstructor(scriptClass).newInstance(); if (this.groovyObjectCustomizer != null) { this.groovyObjectCustomizer.customize(goo); } if (goo instanceof Script) { return ((Script) goo).run(); } else { return goo; } } catch (NoSuchMethodException ex) { throw new ScriptCompilationException( STR + scriptClass.getName(), ex); } catch (InstantiationException ex) { throw new ScriptCompilationException( scriptSource, STR + scriptClass.getName(), ex); } catch (IllegalAccessException ex) { throw new ScriptCompilationException( scriptSource, STR + scriptClass.getName(), ex); } catch (InvocationTargetException ex) { throw new ScriptCompilationException( STR + scriptClass.getName(), ex.getTargetException()); } }
/** * Instantiate the given Groovy script class and run it if necessary. * @param scriptSource the source for the underlying script * @param scriptClass the Groovy script class * @return the result object (either an instance of the script class * or the result of running the script instance) * @throws ScriptCompilationException in case of instantiation failure */
Instantiate the given Groovy script class and run it if necessary
executeScript
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/src/main/spring.context/org/springframework/scripting/groovy/GroovyScriptFactory.java", "license": "mit", "size": 12395 }
[ "groovy.lang.GroovyObject", "groovy.lang.Script", "java.lang.reflect.InvocationTargetException", "org.springframework.scripting.ScriptCompilationException", "org.springframework.scripting.ScriptSource", "org.springframework.util.ReflectionUtils" ]
import groovy.lang.GroovyObject; import groovy.lang.Script; import java.lang.reflect.InvocationTargetException; import org.springframework.scripting.ScriptCompilationException; import org.springframework.scripting.ScriptSource; import org.springframework.util.ReflectionUtils;
import groovy.lang.*; import java.lang.reflect.*; import org.springframework.scripting.*; import org.springframework.util.*;
[ "groovy.lang", "java.lang", "org.springframework.scripting", "org.springframework.util" ]
groovy.lang; java.lang; org.springframework.scripting; org.springframework.util;
620,435
public static boolean containIdentity( List<? extends RexNode> exprs, RelDataType rowType, Litmus litmus) { final List<RelDataTypeField> fields = rowType.getFieldList(); if (exprs.size() < fields.size()) { return litmus.fail("exprs/rowType length mismatch"); } for (int i = 0; i < fields.size(); i++) { if (!(exprs.get(i) instanceof RexInputRef)) { return litmus.fail("expr[{}] is not a RexInputRef", i); } RexInputRef inputRef = (RexInputRef) exprs.get(i); if (inputRef.getIndex() != i) { return litmus.fail("expr[{}] has ordinal {}", i, inputRef.getIndex()); } if (!RelOptUtil.eq("type1", exprs.get(i).getType(), "type2", fields.get(i).getType(), litmus)) { return litmus.fail(null); } } return litmus.succeed(); }
static boolean function( List<? extends RexNode> exprs, RelDataType rowType, Litmus litmus) { final List<RelDataTypeField> fields = rowType.getFieldList(); if (exprs.size() < fields.size()) { return litmus.fail(STR); } for (int i = 0; i < fields.size(); i++) { if (!(exprs.get(i) instanceof RexInputRef)) { return litmus.fail(STR, i); } RexInputRef inputRef = (RexInputRef) exprs.get(i); if (inputRef.getIndex() != i) { return litmus.fail(STR, i, inputRef.getIndex()); } if (!RelOptUtil.eq("type1", exprs.get(i).getType(), "type2", fields.get(i).getType(), litmus)) { return litmus.fail(null); } } return litmus.succeed(); }
/** * Returns whether the leading edge of a given array of expressions is * wholly {@link RexInputRef} objects with types corresponding to the * underlying datatype. */
Returns whether the leading edge of a given array of expressions is wholly <code>RexInputRef</code> objects with types corresponding to the underlying datatype
containIdentity
{ "repo_name": "arina-ielchiieva/calcite", "path": "core/src/main/java/org/apache/calcite/rex/RexUtil.java", "license": "apache-2.0", "size": 85173 }
[ "java.util.List", "org.apache.calcite.plan.RelOptUtil", "org.apache.calcite.rel.type.RelDataType", "org.apache.calcite.rel.type.RelDataTypeField", "org.apache.calcite.util.Litmus" ]
import java.util.List; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.util.Litmus;
import java.util.*; import org.apache.calcite.plan.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.util.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
268,910
public void checkUsesDefaultCapabilities() throws ResourceNotFoundException { if (!usesDefaultCapabilities()) { throw new ResourceNotFoundException("Gerrit capabilities not used on this server"); } }
void function() throws ResourceNotFoundException { if (!usesDefaultCapabilities()) { throw new ResourceNotFoundException(STR); } }
/** * Throw {@link ResourceNotFoundException} if this backend does not use the default global * capabilities. */
Throw <code>ResourceNotFoundException</code> if this backend does not use the default global capabilities
checkUsesDefaultCapabilities
{ "repo_name": "qtproject/qtqa-gerrit", "path": "java/com/google/gerrit/server/permissions/PermissionBackend.java", "license": "apache-2.0", "size": 20968 }
[ "com.google.gerrit.extensions.restapi.ResourceNotFoundException" ]
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.*;
[ "com.google.gerrit" ]
com.google.gerrit;
2,125,438
try { return read(dataInput, dataInput.readInt()); } catch(final IOException e) { throw new UncheckedIOException(e); } } /** * Reads a {@link Circle2I} instance from {@code dataInput}. * <p> * Returns the {@code Circle2I} instance that was read. * <p> * If {@code dataInput} is {@code null}, a {@code NullPointerException} will be thrown. * <p> * If {@code id} is invalid, an {@code IllegalArgumentException} will be thrown. * <p> * If an I/O error occurs, an {@code UncheckedIOException} will be thrown. * <p> * The ID of the {@code Circle2I} instance to read has already been read from {@code dataInput} when this method is called. It is passed to this method as a parameter argument. * * @param dataInput the {@code DataInput} instance to read from * @param id the ID of the {@code Circle2I} to read * @return the {@code Circle2I} instance that was read * @throws IllegalArgumentException thrown if, and only if, {@code id} is invalid * @throws NullPointerException thrown if, and only if, {@code dataInput} is {@code null}
try { return read(dataInput, dataInput.readInt()); } catch(final IOException e) { throw new UncheckedIOException(e); } } /** * Reads a {@link Circle2I} instance from {@code dataInput}. * <p> * Returns the {@code Circle2I} instance that was read. * <p> * If {@code dataInput} is {@code null}, a {@code NullPointerException} will be thrown. * <p> * If {@code id} is invalid, an {@code IllegalArgumentException} will be thrown. * <p> * If an I/O error occurs, an {@code UncheckedIOException} will be thrown. * <p> * The ID of the {@code Circle2I} instance to read has already been read from {@code dataInput} when this method is called. It is passed to this method as a parameter argument. * * @param dataInput the {@code DataInput} instance to read from * @param id the ID of the {@code Circle2I} to read * @return the {@code Circle2I} instance that was read * @throws IllegalArgumentException thrown if, and only if, {@code id} is invalid * @throws NullPointerException thrown if, and only if, {@code dataInput} is {@code null}
/** * Reads a {@link Circle2I} instance from {@code dataInput}. * <p> * Returns the {@code Circle2I} instance that was read. * <p> * If {@code dataInput} is {@code null}, a {@code NullPointerException} will be thrown. * <p> * If the ID is invalid, an {@code IllegalArgumentException} will be thrown. * <p> * If an I/O error occurs, an {@code UncheckedIOException} will be thrown. * * @param dataInput the {@code DataInput} instance to read from * @return the {@code Circle2I} instance that was read * @throws IllegalArgumentException thrown if, and only if, the ID is invalid * @throws NullPointerException thrown if, and only if, {@code dataInput} is {@code null} * @throws UncheckedIOException thrown if, and only if, an I/O error occurs */
Reads a <code>Circle2I</code> instance from dataInput. Returns the Circle2I instance that was read. If dataInput is null, a NullPointerException will be thrown. If the ID is invalid, an IllegalArgumentException will be thrown. If an I/O error occurs, an UncheckedIOException will be thrown
read
{ "repo_name": "macroing/Dayflower", "path": "src/main/java/org/dayflower/geometry/shape/Circle2IReader.java", "license": "lgpl-3.0", "size": 4188 }
[ "java.io.DataInput", "java.io.IOException", "java.io.UncheckedIOException" ]
import java.io.DataInput; import java.io.IOException; import java.io.UncheckedIOException;
import java.io.*;
[ "java.io" ]
java.io;
2,541,116
public IssueAssert hasMessage(final String message) { isNotNull(); if (!Objects.equals(actual.getMessage(), message)) { failWithMessage(EXPECTED_BUT_WAS_MESSAGE, "message", actual, message, actual.getMessage()); } return this; }
IssueAssert function(final String message) { isNotNull(); if (!Objects.equals(actual.getMessage(), message)) { failWithMessage(EXPECTED_BUT_WAS_MESSAGE, STR, actual, message, actual.getMessage()); } return this; }
/** * Checks whether an Issue has a specific message. * * @param message String specifying message. * @return this */
Checks whether an Issue has a specific message
hasMessage
{ "repo_name": "whaph/analysis-model", "path": "src/test/java/edu/hm/hafner/analysis/assertj/IssueAssert.java", "license": "mit", "size": 7728 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
693,538
public void setExpandedState(Object elementOrTreePath, boolean expanded) { Assert.isNotNull(elementOrTreePath); if (checkBusy()) return; Widget item = internalExpand(elementOrTreePath, false); if (item instanceof Item) { if (expanded) { createChildren(item); } setExpanded((Item) item, expanded); } }
void function(Object elementOrTreePath, boolean expanded) { Assert.isNotNull(elementOrTreePath); if (checkBusy()) return; Widget item = internalExpand(elementOrTreePath, false); if (item instanceof Item) { if (expanded) { createChildren(item); } setExpanded((Item) item, expanded); } }
/** * Sets whether the node corresponding to the given element or tree path is * expanded or collapsed. * * @param elementOrTreePath * the element * @param expanded * <code>true</code> if the node is expanded, and * <code>false</code> if collapsed */
Sets whether the node corresponding to the given element or tree path is expanded or collapsed
setExpandedState
{ "repo_name": "neelance/jface4ruby", "path": "jface4ruby/src/org/eclipse/jface/viewers/AbstractTreeViewer.java", "license": "epl-1.0", "size": 91053 }
[ "org.eclipse.core.runtime.Assert", "org.eclipse.swt.widgets.Item", "org.eclipse.swt.widgets.Widget" ]
import org.eclipse.core.runtime.Assert; import org.eclipse.swt.widgets.Item; import org.eclipse.swt.widgets.Widget;
import org.eclipse.core.runtime.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.core", "org.eclipse.swt" ]
org.eclipse.core; org.eclipse.swt;
677,670
public StandardMBean getMbean() { return mbean; }
StandardMBean function() { return mbean; }
/** * Gets the <code>StandardMBean</code> managed by this handler when the backing service is available or null * * @see org.apache.aries.jmx.MBeanHandler#getMbean() */
Gets the <code>StandardMBean</code> managed by this handler when the backing service is available or null
getMbean
{ "repo_name": "MeiSheng/aries", "path": "jmx/jmx-core/src/main/java/org/apache/aries/jmx/AbstractCompendiumHandler.java", "license": "apache-2.0", "size": 6751 }
[ "javax.management.StandardMBean" ]
import javax.management.StandardMBean;
import javax.management.*;
[ "javax.management" ]
javax.management;
134,981
private Optional<Key> wrapMapKey(Key possibleMapKey, Class<?> wrappingClass) { if (MapType.isMap(possibleMapKey)) { MapType mapType = MapType.from(possibleMapKey); if (!mapType.isRawType() && !mapType.valuesAreTypeOf(wrappingClass)) { TypeElement wrappingElement = elements.getTypeElement(wrappingClass); if (wrappingElement == null) { // This target might not be compiled with Producers, so wrappingClass might not have an // associated element. return Optional.empty(); } DeclaredType wrappedValueType = types.getDeclaredType(wrappingElement, mapType.valueType()); return Optional.of( possibleMapKey.toBuilder() .type(fromJava(mapOf(mapType.keyType(), wrappedValueType))) .build()); } } return Optional.empty(); }
Optional<Key> function(Key possibleMapKey, Class<?> wrappingClass) { if (MapType.isMap(possibleMapKey)) { MapType mapType = MapType.from(possibleMapKey); if (!mapType.isRawType() && !mapType.valuesAreTypeOf(wrappingClass)) { TypeElement wrappingElement = elements.getTypeElement(wrappingClass); if (wrappingElement == null) { return Optional.empty(); } DeclaredType wrappedValueType = types.getDeclaredType(wrappingElement, mapType.valueType()); return Optional.of( possibleMapKey.toBuilder() .type(fromJava(mapOf(mapType.keyType(), wrappedValueType))) .build()); } } return Optional.empty(); }
/** * If {@code key}'s type is {@code Map<K, Foo>} and {@code Foo} is not {@code WrappingClass * <Bar>}, returns a key with type {@code Map<K, WrappingClass<Foo>>} with the same qualifier. * Otherwise returns {@link Optional#empty()}. * * <p>Returns {@link Optional#empty()} if {@code WrappingClass} is not in the classpath. */
If key's type is Map and Foo is not WrappingClass , returns a key with type Map> with the same qualifier. Otherwise returns <code>Optional#empty()</code>. Returns <code>Optional#empty()</code> if WrappingClass is not in the classpath
wrapMapKey
{ "repo_name": "dushmis/dagger", "path": "java/dagger/internal/codegen/binding/KeyFactory.java", "license": "apache-2.0", "size": 18630 }
[ "java.util.Optional", "javax.lang.model.element.TypeElement", "javax.lang.model.type.DeclaredType" ]
import java.util.Optional; import javax.lang.model.element.TypeElement; import javax.lang.model.type.DeclaredType;
import java.util.*; import javax.lang.model.element.*; import javax.lang.model.type.*;
[ "java.util", "javax.lang" ]
java.util; javax.lang;
2,059,718
public void testmillisToDate() { // Be careful here. The method tested works in the local time zone. String result = TimeHelpers.millisToDate(MAY18_152400); assertEquals("Fri, May 18, 2012", result); long temp = 1262235600000L; temp -= tZone.getOffset(temp); result = TimeHelpers.millisToDate(temp); assertEquals("Thu, Dec 31, 2009", result); result = TimeHelpers.millisToDate(JAN04_173012); assertEquals("Mon, Jan 4, 2010", result); temp = 1262667600000L; temp -= tZone.getOffset(temp); result = TimeHelpers.millisToDate(temp); assertEquals("Tue, Jan 5, 2010", result); }
void function() { String result = TimeHelpers.millisToDate(MAY18_152400); assertEquals(STR, result); long temp = 1262235600000L; temp -= tZone.getOffset(temp); result = TimeHelpers.millisToDate(temp); assertEquals(STR, result); result = TimeHelpers.millisToDate(JAN04_173012); assertEquals(STR, result); temp = 1262667600000L; temp -= tZone.getOffset(temp); result = TimeHelpers.millisToDate(temp); assertEquals(STR, result); }
/** * Test method for * {@link com.googlecode.iqapps.TimeHelpers#millisToDate(long)}. */
Test method for <code>com.googlecode.iqapps.TimeHelpers#millisToDate(long)</code>
testmillisToDate
{ "repo_name": "kronenpj/iqapps-broken", "path": "IQTimeSheet-it/src/main/java/com/googlecode/iqapps/IQTimeSheet/test/TimeHelpersTest.java", "license": "apache-2.0", "size": 17449 }
[ "com.googlecode.iqapps.TimeHelpers" ]
import com.googlecode.iqapps.TimeHelpers;
import com.googlecode.iqapps.*;
[ "com.googlecode.iqapps" ]
com.googlecode.iqapps;
1,501,531
private final RpcPacket procReadDirPlus(NFSSrvSession sess, RpcPacket rpc) { // Unpack the read directory arguments byte[] handle = new byte[NFS.FileHandleSize]; rpc.unpackByteArrayWithLength(handle); long cookie = rpc.unpackLong(); long cookieVerf = rpc.unpackLong(); int maxDir = rpc.unpackInt(); int maxCount = rpc.unpackInt(); // DEBUG if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln("ReadDir request from " + rpc.getClientDetails() + " handle=" + NFSHandle.asString(handle) + ", dir=" + maxDir + ", count=" + maxCount); // Check if this is a share handle int shareId = -1; String path = null; int errorSts = NFS.StsSuccess; // Call the disk share driver to get the file information for the path try { // Get the share id and path shareId = getShareIdFromHandle(handle); ShareDetails details = m_shareDetails.findDetails(shareId); TreeConnection conn = getTreeConnection(sess, shareId); // Check if the session has the required access to the shared filesystem if ( conn.hasReadAccess() == false) throw new AccessDeniedException(); // Get the disk interface from the disk driver DiskInterface disk = (DiskInterface) conn.getSharedDevice().getInterface(); // Get the path from the handle path = getPathForHandle(sess, handle, conn); // If the filesystem driver cannot convert file ids to relative paths we need to build a relative path for // every file and sub-directory in the search StringBuffer pathBuf = null; int pathLen = 0; FileIdCache fileCache = details.getFileIdCache(); if ( details.hasFileIdSupport() == false) { // Allocate the buffer for building the relative paths pathBuf = new StringBuffer(256); pathBuf.append(path); if ( path.endsWith("\\") == false) pathBuf.append("\\"); // Set the length of the search path portion of the string pathLen = pathBuf.length(); } // Build the response header rpc.buildResponseHeader(); rpc.packInt(NFS.StsSuccess); // Get the root directory information FileInfo dinfo = disk.getFileInformation(sess, conn, path); packPostOpAttr(sess, dinfo, shareId, rpc); // Generate the search path String searchPath = generatePath(path, "*.*"); // DEBUG if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln("ReadDirPlus searchPath=" + searchPath + ", cookie=" + cookie); // Check if this is the start of a search SearchContext search = null; long searchId = -1; if (cookie == 0L) { // Start a new search, allocate a search id search = disk.startSearch(sess, conn, searchPath, FileAttribute.Directory + FileAttribute.Normal); // Allocate a search id for the new search searchId = sess.allocateSearchSlot(search); // Set the cookie verifier cookieVerf = dinfo.getModifyDateTime(); // DEBUG if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln("ReadDirPlus allocated searchId=" + searchId); } else { // Check if the cookie verifier is valid, check reverse byte order if ( cookieVerf != 0L && cookieVerf != dinfo.getModifyDateTime() && Long.reverseBytes( cookieVerf) != dinfo.getModifyDateTime()) { sess.debugPrintln("Bad cookie verifier, verf=0x" + Long.toHexString(cookieVerf) + ", modTime=0x" + Long.toHexString(dinfo.getModifyDateTime())); throw new BadCookieException(); } // Retrieve the search from the active search cache searchId = (cookie & COOKIE_SEARCHID_MASK) >> COOKIE_SEARCHID_SHIFT; // Get the active search search = sess.getSearchContext((int) searchId); // Check if the search has been closed, if so then restart the search if ( search == null) { // Restart the search search = disk.startSearch(sess, conn, searchPath, FileAttribute.Directory + FileAttribute.Normal); // Allocate a search id for the new search searchId = sess.allocateSearchSlot(search); // Set the cookie verifier cookieVerf = dinfo.getModifyDateTime(); // DEBUG if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln("ReadDirPlus restarted search, searchId=" + searchId); } // Get the search resume id from the cookie int resumeId = (int) (cookie & COOKIE_RESUMEID_MASK); if ( search != null && search.getResumeId() != resumeId) search.restartAt(resumeId); } // Pack the cookie verifier rpc.packLong(cookieVerf); // Check if the search id is valid if (searchId == -1) throw new Exception("Bad search id"); // Search id is masked into the top of the file index to make the resume cookie long searchMask = ((long) searchId) << COOKIE_SEARCHID_SHIFT; // Build the return file list int entCnt = 0; // Loop until the return buffer is full or there are no more files FileInfo finfo = new FileInfo(); // Check if this is the start of a search, if so then add the '.' and '..' entries if ( cookie == 0) { // Add the search directory details, the '.' directory rpc.packInt(Rpc.True); rpc.packLong(dinfo.getFileIdLong() + FILE_ID_OFFSET); rpc.packString("."); rpc.packLong(COOKIE_DOT_DIRECTORY); // Fill in the file attributes rpc.packInt(Rpc.True); packAttributes3(rpc, dinfo, shareId); // Fill in the file handle packDirectoryHandle(shareId, dinfo.getFileId(), rpc); // Get the file information for the parent directory String parentPath = generatePath(path, ".."); FileInfo parentInfo = disk.getFileInformation(sess, conn, parentPath); // Add the parent of the search directory, the '..' directory rpc.packInt(Rpc.True); rpc.packLong(parentInfo.getFileIdLong() + FILE_ID_OFFSET); rpc.packString(".."); rpc.packLong(COOKIE_DOTDOT_DIRECTORY); // Fill in the file attributes rpc.packInt(Rpc.True); packAttributes3(rpc, parentInfo, shareId); // Fill in the file handle packDirectoryHandle(shareId, parentInfo.getFileId(), rpc); // Update the entry count and current used reply buffer count entCnt = 2; } // Pack the file entries boolean replyFull = false; while (entCnt++ < maxDir && replyFull == false && search.nextFileInfo(finfo)) { // Check if the new file entry will fit into the reply buffer without exceeding the clients maximum // reply size int entryLen = READDIRPLUS_ENTRY_LENGTH + (( finfo.getFileName().length() + 3) & 0xFFFFFFFC); if ( entryLen > rpc.getAvailableLength() || ( rpc.getPosition() + entryLen > maxCount)) { replyFull = true; // DEBUG if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln("ReadDirPlus response full, restart at=" + finfo.getFileName() + ", resumeId=" + search.getResumeId()); search.restartAt( finfo); break; } // Fill in the entry details rpc.packInt(Rpc.True); rpc.packLong(finfo.getFileIdLong() + FILE_ID_OFFSET); rpc.packUTF8String(finfo.getFileName()); rpc.packLong(search.getResumeId() + searchMask); // Fill in the file attributes rpc.packInt(Rpc.True); packAttributes3(rpc, finfo, shareId); // Fill in the file or directory handle if ( finfo.isDirectory()) packDirectoryHandle(shareId, finfo.getFileId(), rpc); else packFileHandle(shareId, dinfo.getFileId(), finfo.getFileId(), rpc); // Check if the relative path should be added to the file id cache if ( details.hasFileIdSupport() == false && fileCache.findPath(finfo.getFileId()) == null) { // Create a relative path for the current file/sub-directory and add to the file id cache pathBuf.setLength(pathLen); pathBuf.append(finfo.getFileName()); fileCache.addPath(finfo.getFileId(), pathBuf.toString()); } // Reset the file type finfo.setFileType( FileType.RegularFile); } // Indicate that there are no more file entries in this response rpc.packInt(Rpc.False); // Check if the search is complete if (search.hasMoreFiles()) { // Indicate that there are more files to be returned rpc.packInt(Rpc.False); } else { // Set the end of search flag rpc.packInt(Rpc.True); // Close the search, release the search slot search.closeSearch(); sess.deallocateSearchSlot((int) searchId); } // DEBUG if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln("ReadDirPlus return entries=" + (entCnt - 1) + ", eof=" + (search.hasMoreFiles() ? false : true)); } catch (BadHandleException ex) { errorSts = NFS.StsBadHandle; } catch (BadCookieException ex) { errorSts = NFS.StsBadCookie; } catch (AccessDeniedException ex) { errorSts = NFS.StsAccess; } catch (Exception ex) { errorSts = NFS.StsServerFault; // DEBUG if ( Debug.EnableError && hasDebugFlag(DBG_ERROR)) { sess.debugPrintln("ReadDirPlus Exception: " + ex.toString()); sess.debugPrintln(ex); } } // Check for an error status if ( errorSts != NFS.StsSuccess) { // Pack the error response rpc.buildErrorResponse(errorSts); packPostOpAttr(sess, null, shareId, rpc); // DEBUG if ( Debug.EnableInfo && hasDebugFlag(DBG_ERROR)) sess.debugPrintln("ReadDir error=" + NFS.getStatusString(errorSts)); } // Return the read directory plus response rpc.setLength(); return rpc; }
final RpcPacket function(NFSSrvSession sess, RpcPacket rpc) { byte[] handle = new byte[NFS.FileHandleSize]; rpc.unpackByteArrayWithLength(handle); long cookie = rpc.unpackLong(); long cookieVerf = rpc.unpackLong(); int maxDir = rpc.unpackInt(); int maxCount = rpc.unpackInt(); if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln(STR + rpc.getClientDetails() + STR + NFSHandle.asString(handle) + STR + maxDir + STR + maxCount); int shareId = -1; String path = null; int errorSts = NFS.StsSuccess; try { shareId = getShareIdFromHandle(handle); ShareDetails details = m_shareDetails.findDetails(shareId); TreeConnection conn = getTreeConnection(sess, shareId); if ( conn.hasReadAccess() == false) throw new AccessDeniedException(); DiskInterface disk = (DiskInterface) conn.getSharedDevice().getInterface(); path = getPathForHandle(sess, handle, conn); StringBuffer pathBuf = null; int pathLen = 0; FileIdCache fileCache = details.getFileIdCache(); if ( details.hasFileIdSupport() == false) { pathBuf = new StringBuffer(256); pathBuf.append(path); if ( path.endsWith("\\") == false) pathBuf.append("\\"); pathLen = pathBuf.length(); } rpc.buildResponseHeader(); rpc.packInt(NFS.StsSuccess); FileInfo dinfo = disk.getFileInformation(sess, conn, path); packPostOpAttr(sess, dinfo, shareId, rpc); String searchPath = generatePath(path, "*.*"); if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln(STR + searchPath + STR + cookie); SearchContext search = null; long searchId = -1; if (cookie == 0L) { search = disk.startSearch(sess, conn, searchPath, FileAttribute.Directory + FileAttribute.Normal); searchId = sess.allocateSearchSlot(search); cookieVerf = dinfo.getModifyDateTime(); if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln(STR + searchId); } else { if ( cookieVerf != 0L && cookieVerf != dinfo.getModifyDateTime() && Long.reverseBytes( cookieVerf) != dinfo.getModifyDateTime()) { sess.debugPrintln(STR + Long.toHexString(cookieVerf) + STR + Long.toHexString(dinfo.getModifyDateTime())); throw new BadCookieException(); } searchId = (cookie & COOKIE_SEARCHID_MASK) >> COOKIE_SEARCHID_SHIFT; search = sess.getSearchContext((int) searchId); if ( search == null) { search = disk.startSearch(sess, conn, searchPath, FileAttribute.Directory + FileAttribute.Normal); searchId = sess.allocateSearchSlot(search); cookieVerf = dinfo.getModifyDateTime(); if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln(STR + searchId); } int resumeId = (int) (cookie & COOKIE_RESUMEID_MASK); if ( search != null && search.getResumeId() != resumeId) search.restartAt(resumeId); } rpc.packLong(cookieVerf); if (searchId == -1) throw new Exception(STR); long searchMask = ((long) searchId) << COOKIE_SEARCHID_SHIFT; int entCnt = 0; FileInfo finfo = new FileInfo(); if ( cookie == 0) { rpc.packInt(Rpc.True); rpc.packLong(dinfo.getFileIdLong() + FILE_ID_OFFSET); rpc.packString("."); rpc.packLong(COOKIE_DOT_DIRECTORY); rpc.packInt(Rpc.True); packAttributes3(rpc, dinfo, shareId); packDirectoryHandle(shareId, dinfo.getFileId(), rpc); String parentPath = generatePath(path, ".."); FileInfo parentInfo = disk.getFileInformation(sess, conn, parentPath); rpc.packInt(Rpc.True); rpc.packLong(parentInfo.getFileIdLong() + FILE_ID_OFFSET); rpc.packString(".."); rpc.packLong(COOKIE_DOTDOT_DIRECTORY); rpc.packInt(Rpc.True); packAttributes3(rpc, parentInfo, shareId); packDirectoryHandle(shareId, parentInfo.getFileId(), rpc); entCnt = 2; } boolean replyFull = false; while (entCnt++ < maxDir && replyFull == false && search.nextFileInfo(finfo)) { int entryLen = READDIRPLUS_ENTRY_LENGTH + (( finfo.getFileName().length() + 3) & 0xFFFFFFFC); if ( entryLen > rpc.getAvailableLength() ( rpc.getPosition() + entryLen > maxCount)) { replyFull = true; if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln(STR + finfo.getFileName() + STR + search.getResumeId()); search.restartAt( finfo); break; } rpc.packInt(Rpc.True); rpc.packLong(finfo.getFileIdLong() + FILE_ID_OFFSET); rpc.packUTF8String(finfo.getFileName()); rpc.packLong(search.getResumeId() + searchMask); rpc.packInt(Rpc.True); packAttributes3(rpc, finfo, shareId); if ( finfo.isDirectory()) packDirectoryHandle(shareId, finfo.getFileId(), rpc); else packFileHandle(shareId, dinfo.getFileId(), finfo.getFileId(), rpc); if ( details.hasFileIdSupport() == false && fileCache.findPath(finfo.getFileId()) == null) { pathBuf.setLength(pathLen); pathBuf.append(finfo.getFileName()); fileCache.addPath(finfo.getFileId(), pathBuf.toString()); } finfo.setFileType( FileType.RegularFile); } rpc.packInt(Rpc.False); if (search.hasMoreFiles()) { rpc.packInt(Rpc.False); } else { rpc.packInt(Rpc.True); search.closeSearch(); sess.deallocateSearchSlot((int) searchId); } if (Debug.EnableInfo && hasDebugFlag(DBG_SEARCH)) sess.debugPrintln(STR + (entCnt - 1) + STR + (search.hasMoreFiles() ? false : true)); } catch (BadHandleException ex) { errorSts = NFS.StsBadHandle; } catch (BadCookieException ex) { errorSts = NFS.StsBadCookie; } catch (AccessDeniedException ex) { errorSts = NFS.StsAccess; } catch (Exception ex) { errorSts = NFS.StsServerFault; if ( Debug.EnableError && hasDebugFlag(DBG_ERROR)) { sess.debugPrintln(STR + ex.toString()); sess.debugPrintln(ex); } } if ( errorSts != NFS.StsSuccess) { rpc.buildErrorResponse(errorSts); packPostOpAttr(sess, null, shareId, rpc); if ( Debug.EnableInfo && hasDebugFlag(DBG_ERROR)) sess.debugPrintln(STR + NFS.getStatusString(errorSts)); } rpc.setLength(); return rpc; }
/** * Process the read directory plus request * * @param sess NFSSrvSession * @param rpc RpcPacket * @return RpcPacket */
Process the read directory plus request
procReadDirPlus
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/alfresco-jlan/source/java/org/alfresco/jlan/oncrpc/nfs/NFSServer.java", "license": "lgpl-3.0", "size": 140029 }
[ "org.alfresco.jlan.debug.Debug", "org.alfresco.jlan.oncrpc.Rpc", "org.alfresco.jlan.oncrpc.RpcPacket", "org.alfresco.jlan.server.filesys.AccessDeniedException", "org.alfresco.jlan.server.filesys.DiskInterface", "org.alfresco.jlan.server.filesys.FileAttribute", "org.alfresco.jlan.server.filesys.FileInfo", "org.alfresco.jlan.server.filesys.FileType", "org.alfresco.jlan.server.filesys.SearchContext", "org.alfresco.jlan.server.filesys.TreeConnection" ]
import org.alfresco.jlan.debug.Debug; import org.alfresco.jlan.oncrpc.Rpc; import org.alfresco.jlan.oncrpc.RpcPacket; import org.alfresco.jlan.server.filesys.AccessDeniedException; import org.alfresco.jlan.server.filesys.DiskInterface; import org.alfresco.jlan.server.filesys.FileAttribute; import org.alfresco.jlan.server.filesys.FileInfo; import org.alfresco.jlan.server.filesys.FileType; import org.alfresco.jlan.server.filesys.SearchContext; import org.alfresco.jlan.server.filesys.TreeConnection;
import org.alfresco.jlan.debug.*; import org.alfresco.jlan.oncrpc.*; import org.alfresco.jlan.server.filesys.*;
[ "org.alfresco.jlan" ]
org.alfresco.jlan;
1,629,314
@Override public void contributeToMenu(IMenuManager menuManager) { super.contributeToMenu(menuManager); IMenuManager submenuManager = new MenuManager(CityGMLEditorPlugin.INSTANCE.getString("_UI_XlinkEditor_menu"), "org.w3._1999.xlinkMenuID"); menuManager.insertAfter("additions", submenuManager); submenuManager.add(new Separator("settings")); submenuManager.add(new Separator("actions")); submenuManager.add(new Separator("additions")); submenuManager.add(new Separator("additions-end")); // Prepare for CreateChild item addition or removal. // createChildMenuManager = new MenuManager(CityGMLEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); submenuManager.insertBefore("additions", createChildMenuManager); // Prepare for CreateSibling item addition or removal. // createSiblingMenuManager = new MenuManager(CityGMLEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); submenuManager.insertBefore("additions", createSiblingMenuManager);
void function(IMenuManager menuManager) { super.contributeToMenu(menuManager); IMenuManager submenuManager = new MenuManager(CityGMLEditorPlugin.INSTANCE.getString(STR), STR); menuManager.insertAfter(STR, submenuManager); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.insertBefore(STR, createChildMenuManager); submenuManager.insertBefore(STR, createSiblingMenuManager);
/** * This adds to the menu bar a menu and some separators for editor additions, * as well as the sub-menus for object creation items. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds to the menu bar a menu and some separators for editor additions, as well as the sub-menus for object creation items.
contributeToMenu
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.editor/src/org/w3/_1999/xlink/presentation/XlinkActionBarContributor.java", "license": "apache-2.0", "size": 14063 }
[ "net.opengis.citygml.building.presentation.CityGMLEditorPlugin", "org.eclipse.jface.action.IMenuManager", "org.eclipse.jface.action.MenuManager", "org.eclipse.jface.action.Separator" ]
import net.opengis.citygml.building.presentation.CityGMLEditorPlugin; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator;
import net.opengis.citygml.building.presentation.*; import org.eclipse.jface.action.*;
[ "net.opengis.citygml", "org.eclipse.jface" ]
net.opengis.citygml; org.eclipse.jface;
1,994,926
public static void copyRecursively(JarFile base, JarEntry startingDir, File toDir) throws IOException { if (!startingDir.isDirectory()) { throw new IOException(String.format("Starting point %s is not a directory", startingDir)); } if (!toDir.exists()) { throw new IOException(String.format("Destination dir %s must exist", toDir)); } Enumeration<JarEntry> all = base.entries(); while (all.hasMoreElements()) { JarEntry file = all.nextElement(); // ensure that it matches starting dir if (file.isDirectory()) { copyRecursively(base, file, new File(toDir, file.getName())); } else { InputStream is = null; OutputStream os = null; try { is = base.getInputStream(file); os = new FileOutputStream(new File(toDir, file.getName())); copyFile(is, os, false); os.flush(); } finally { if (os != null) os.close(); if (is != null) is.close(); } } } }
static void function(JarFile base, JarEntry startingDir, File toDir) throws IOException { if (!startingDir.isDirectory()) { throw new IOException(String.format(STR, startingDir)); } if (!toDir.exists()) { throw new IOException(String.format(STR, toDir)); } Enumeration<JarEntry> all = base.entries(); while (all.hasMoreElements()) { JarEntry file = all.nextElement(); if (file.isDirectory()) { copyRecursively(base, file, new File(toDir, file.getName())); } else { InputStream is = null; OutputStream os = null; try { is = base.getInputStream(file); os = new FileOutputStream(new File(toDir, file.getName())); copyFile(is, os, false); os.flush(); } finally { if (os != null) os.close(); if (is != null) is.close(); } } } }
/** * copy a tree of files to directory, given file objects representing the files * * @param base * @param startingDir * @param toDir * @throws IOException */
copy a tree of files to directory, given file objects representing the files
copyRecursively
{ "repo_name": "grtlinux/TAIN_SYNKER", "path": "TAIN_SYNKER/src/tain/kr/com/proj/synker/v05/exec/FileIO.java", "license": "gpl-3.0", "size": 10694 }
[ "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream", "java.util.Enumeration", "java.util.jar.JarEntry", "java.util.jar.JarFile" ]
import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile;
import java.io.*; import java.util.*; import java.util.jar.*;
[ "java.io", "java.util" ]
java.io; java.util;
223,040
public static String getUserModulesPath() { return getUserDirectory().getAbsolutePath() + File.separator + "modules"; //NON-NLS }
static String function() { return getUserDirectory().getAbsolutePath() + File.separator + STR; }
/** * Get root path where the user modules are installed * * @return absolute path string to the install modules root dir, or null if * not found */
Get root path where the user modules are installed
getUserModulesPath
{ "repo_name": "esaunders/autopsy", "path": "Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java", "license": "apache-2.0", "size": 24555 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
681,217
public static String stripIndent(CharSequence self, int numChars) { String s = self.toString(); if (s.length() == 0 || numChars <= 0) return s; try { StringBuilder builder = new StringBuilder(); for (String line : readLines((CharSequence) s)) { // normalize an empty or whitespace line to \n // or strip the indent for lines containing non-space characters if (!isAllWhitespace((CharSequence) line)) { builder.append(stripIndentFromLine(line, numChars)); } builder.append("\n"); } // remove the normalized ending line ending if it was not present if (!s.endsWith("\n")) { builder.deleteCharAt(builder.length() - 1); } return builder.toString(); } catch (IOException e) { } return s; }
static String function(CharSequence self, int numChars) { String s = self.toString(); if (s.length() == 0 numChars <= 0) return s; try { StringBuilder builder = new StringBuilder(); for (String line : readLines((CharSequence) s)) { if (!isAllWhitespace((CharSequence) line)) { builder.append(stripIndentFromLine(line, numChars)); } builder.append("\n"); } if (!s.endsWith("\n")) { builder.deleteCharAt(builder.length() - 1); } return builder.toString(); } catch (IOException e) { } return s; }
/** * Strip <tt>numChar</tt> leading characters from * every line in a CharSequence. * <pre class="groovyTestCase"> * assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3) * </pre> * * @param self The CharSequence to strip the characters from * @param numChars The number of characters to strip * @return the stripped String * @since 1.8.2 */
Strip numChar leading characters from every line in a CharSequence. assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3) </code>
stripIndent
{ "repo_name": "pledbrook/incubator-groovy", "path": "src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java", "license": "apache-2.0", "size": 142054 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,893,637