repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java
NumbersAtRiskPanel.setKaplanMeierFigure
public void setKaplanMeierFigure(KaplanMeierFigure kmf) { this.kmf = kmf; int numRows = kmf.getSurvivalFitInfo().getStrataInfoHashMap().size(); int height = (numRows + 1) * getFontMetrics(getFont()).getHeight(); int width = kmf.getWidth(); setPreferredSize(new Dimension(width,height)); this.setSize(width, height); }
java
public void setKaplanMeierFigure(KaplanMeierFigure kmf) { this.kmf = kmf; int numRows = kmf.getSurvivalFitInfo().getStrataInfoHashMap().size(); int height = (numRows + 1) * getFontMetrics(getFont()).getHeight(); int width = kmf.getWidth(); setPreferredSize(new Dimension(width,height)); this.setSize(width, height); }
[ "public", "void", "setKaplanMeierFigure", "(", "KaplanMeierFigure", "kmf", ")", "{", "this", ".", "kmf", "=", "kmf", ";", "int", "numRows", "=", "kmf", ".", "getSurvivalFitInfo", "(", ")", ".", "getStrataInfoHashMap", "(", ")", ".", "size", "(", ")", ";", ...
Pick up needed info and details from the KM Figure @param kmf
[ "Pick", "up", "needed", "info", "and", "details", "from", "the", "KM", "Figure" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java#L52-L61
xcesco/kripton
kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/KriptonDatabaseWrapper.java
KriptonDatabaseWrapper.updateDelete
public static int updateDelete(SQLContext context, String sql, KriptonContentValues contentValues) { SQLiteStatement ps = context.database().compileStatement(sql); try { contentValues.bind(ps); return ps.executeUpdateDelete(); } finally { ps.close(); } }
java
public static int updateDelete(SQLContext context, String sql, KriptonContentValues contentValues) { SQLiteStatement ps = context.database().compileStatement(sql); try { contentValues.bind(ps); return ps.executeUpdateDelete(); } finally { ps.close(); } }
[ "public", "static", "int", "updateDelete", "(", "SQLContext", "context", ",", "String", "sql", ",", "KriptonContentValues", "contentValues", ")", "{", "SQLiteStatement", "ps", "=", "context", ".", "database", "(", ")", ".", "compileStatement", "(", "sql", ")", ...
Update delete. @param context the context @param sql the sql @param contentValues the content values @return the int
[ "Update", "delete", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/KriptonDatabaseWrapper.java#L92-L100
mikepenz/FastAdapter
app/src/main/java/com/mikepenz/fastadapter/app/helpers/HeaderPositionCalculator.java
HeaderPositionCalculator.hasNewHeader
public boolean hasNewHeader(int position, boolean isReverseLayout) { if (indexOutOfBounds(position)) { return false; } int originalPosition = moPubRecyclerAdapter.getOriginalPosition(position); if (originalPosition < 0) { return false; } long headerId = mAdapter.getHeaderId(originalPosition); if (headerId < 0) { return false; } long nextItemHeaderId = -1; int nextItemPosition = originalPosition + (isReverseLayout ? 1 : -1); if (!indexOutOfBounds(nextItemPosition)) { nextItemHeaderId = mAdapter.getHeaderId(nextItemPosition); } int firstItemPosition = isReverseLayout ? moPubRecyclerAdapter.getItemCount() - 1 : 0; return originalPosition == firstItemPosition || headerId != nextItemHeaderId; }
java
public boolean hasNewHeader(int position, boolean isReverseLayout) { if (indexOutOfBounds(position)) { return false; } int originalPosition = moPubRecyclerAdapter.getOriginalPosition(position); if (originalPosition < 0) { return false; } long headerId = mAdapter.getHeaderId(originalPosition); if (headerId < 0) { return false; } long nextItemHeaderId = -1; int nextItemPosition = originalPosition + (isReverseLayout ? 1 : -1); if (!indexOutOfBounds(nextItemPosition)) { nextItemHeaderId = mAdapter.getHeaderId(nextItemPosition); } int firstItemPosition = isReverseLayout ? moPubRecyclerAdapter.getItemCount() - 1 : 0; return originalPosition == firstItemPosition || headerId != nextItemHeaderId; }
[ "public", "boolean", "hasNewHeader", "(", "int", "position", ",", "boolean", "isReverseLayout", ")", "{", "if", "(", "indexOutOfBounds", "(", "position", ")", ")", "{", "return", "false", ";", "}", "int", "originalPosition", "=", "moPubRecyclerAdapter", ".", "...
Determines if an item in the list should have a header that is different than the item in the list that immediately precedes it. Items with no headers will always return false. @param position of the list item in questions @param isReverseLayout TRUE if layout manager has flag isReverseLayout @return true if this item has a different header than the previous item in the list @see {@link StickyRecyclerHeadersAdapter#getHeaderId(int)}
[ "Determines", "if", "an", "item", "in", "the", "list", "should", "have", "a", "header", "that", "is", "different", "than", "the", "item", "in", "the", "list", "that", "immediately", "precedes", "it", ".", "Items", "with", "no", "headers", "will", "always",...
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/helpers/HeaderPositionCalculator.java#L81-L105
JoeKerouac/utils
src/main/java/com/joe/utils/concurrent/ThreadUtil.java
ThreadUtil.getOrCreatePool
public static ExecutorService getOrCreatePool(PoolType type, String format) { ExecutorService service = cache.get(type); if (service == null || service.isTerminated() || service.isShutdown()) { //检查是否符合格式 String.format(format, 0); synchronized (cache) { if (service == null || service.isTerminated() || service.isShutdown()) { ThreadFactory factory = build(format); service = build(type, factory); cache.put(type, service); } } } return service; }
java
public static ExecutorService getOrCreatePool(PoolType type, String format) { ExecutorService service = cache.get(type); if (service == null || service.isTerminated() || service.isShutdown()) { //检查是否符合格式 String.format(format, 0); synchronized (cache) { if (service == null || service.isTerminated() || service.isShutdown()) { ThreadFactory factory = build(format); service = build(type, factory); cache.put(type, service); } } } return service; }
[ "public", "static", "ExecutorService", "getOrCreatePool", "(", "PoolType", "type", ",", "String", "format", ")", "{", "ExecutorService", "service", "=", "cache", ".", "get", "(", "type", ")", ";", "if", "(", "service", "==", "null", "||", "service", ".", "...
从缓存中查找指定类型的线程池,如果存在那么直接返回,如果不存在那么创建返回 @param type 线程池类型 @param format 线程名格式,格式为:format-%d,其中%d将被替换为从0开始的数字序列,不能为null @return 指定类型的线程池
[ "从缓存中查找指定类型的线程池,如果存在那么直接返回,如果不存在那么创建返回" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/concurrent/ThreadUtil.java#L67-L83
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.java
QuadBasedLineStripRenderer.renderLines
public void renderLines(float[] points, int count) { if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width+1f); } GL.glDisable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width); if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); } }
java
public void renderLines(float[] points, int count) { if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width+1f); } GL.glDisable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width); if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); } }
[ "public", "void", "renderLines", "(", "float", "[", "]", "points", ",", "int", "count", ")", "{", "if", "(", "antialias", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_POLYGON_SMOOTH", ")", ";", "renderLinesImpl", "(", "points", ",", "count", "...
Render the lines applying antialiasing if required @param points The points to be rendered as lines @param count The number of points to render
[ "Render", "the", "lines", "applying", "antialiasing", "if", "required" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.java#L119-L131
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java
DistortImageOps.boundBox
public static RectangleLength2D_I32 boundBox( int srcWidth , int srcHeight , int dstWidth , int dstHeight , Point2D_F32 work, PixelTransform<Point2D_F32> transform ) { RectangleLength2D_I32 ret = boundBox(srcWidth,srcHeight,work,transform); int x0 = ret.x0; int y0 = ret.y0; int x1 = ret.x0 + ret.width; int y1 = ret.y0 + ret.height; if( x0 < 0 ) x0 = 0; if( x1 > dstWidth) x1 = dstWidth; if( y0 < 0 ) y0 = 0; if( y1 > dstHeight) y1 = dstHeight; return new RectangleLength2D_I32(x0,y0,x1-x0,y1-y0); }
java
public static RectangleLength2D_I32 boundBox( int srcWidth , int srcHeight , int dstWidth , int dstHeight , Point2D_F32 work, PixelTransform<Point2D_F32> transform ) { RectangleLength2D_I32 ret = boundBox(srcWidth,srcHeight,work,transform); int x0 = ret.x0; int y0 = ret.y0; int x1 = ret.x0 + ret.width; int y1 = ret.y0 + ret.height; if( x0 < 0 ) x0 = 0; if( x1 > dstWidth) x1 = dstWidth; if( y0 < 0 ) y0 = 0; if( y1 > dstHeight) y1 = dstHeight; return new RectangleLength2D_I32(x0,y0,x1-x0,y1-y0); }
[ "public", "static", "RectangleLength2D_I32", "boundBox", "(", "int", "srcWidth", ",", "int", "srcHeight", ",", "int", "dstWidth", ",", "int", "dstHeight", ",", "Point2D_F32", "work", ",", "PixelTransform", "<", "Point2D_F32", ">", "transform", ")", "{", "Rectang...
Finds an axis-aligned bounding box which would contain a image after it has been transformed. A sanity check is done to made sure it is contained inside the destination image's bounds. If it is totally outside then a rectangle with negative width or height is returned. @param srcWidth Width of the source image @param srcHeight Height of the source image @param dstWidth Width of the destination image @param dstHeight Height of the destination image @param transform Transform being applied to the image @return Bounding box
[ "Finds", "an", "axis", "-", "aligned", "bounding", "box", "which", "would", "contain", "a", "image", "after", "it", "has", "been", "transformed", ".", "A", "sanity", "check", "is", "done", "to", "made", "sure", "it", "is", "contained", "inside", "the", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/DistortImageOps.java#L289-L307
j256/simplejmx
src/main/java/com/j256/simplejmx/client/JmxClient.java
JmxClient.getBeanNames
public Set<ObjectName> getBeanNames(String domain) throws JMException { checkClientConnected(); try { return mbeanConn.queryNames(ObjectName.getInstance(domain + ":*"), null); } catch (IOException e) { throw createJmException("Problems querying for jmx bean names: " + e, e); } }
java
public Set<ObjectName> getBeanNames(String domain) throws JMException { checkClientConnected(); try { return mbeanConn.queryNames(ObjectName.getInstance(domain + ":*"), null); } catch (IOException e) { throw createJmException("Problems querying for jmx bean names: " + e, e); } }
[ "public", "Set", "<", "ObjectName", ">", "getBeanNames", "(", "String", "domain", ")", "throws", "JMException", "{", "checkClientConnected", "(", ")", ";", "try", "{", "return", "mbeanConn", ".", "queryNames", "(", "ObjectName", ".", "getInstance", "(", "domai...
Return a set of the various bean ObjectName objects associated with the Jmx server.
[ "Return", "a", "set", "of", "the", "various", "bean", "ObjectName", "objects", "associated", "with", "the", "Jmx", "server", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L228-L235
EsotericSoftware/kryonet
src/com/esotericsoftware/kryonet/rmi/ObjectSpace.java
ObjectSpace.registerClasses
static public void registerClasses (final Kryo kryo) { kryo.register(Object[].class); kryo.register(InvokeMethod.class); FieldSerializer<InvokeMethodResult> resultSerializer = new FieldSerializer<InvokeMethodResult>(kryo, InvokeMethodResult.class) { public void write (Kryo kryo, Output output, InvokeMethodResult result) { super.write(kryo, output, result); output.writeInt(result.objectID, true); } public InvokeMethodResult read (Kryo kryo, Input input, Class<InvokeMethodResult> type) { InvokeMethodResult result = super.read(kryo, input, type); result.objectID = input.readInt(true); return result; } }; resultSerializer.removeField("objectID"); kryo.register(InvokeMethodResult.class, resultSerializer); kryo.register(InvocationHandler.class, new Serializer() { public void write (Kryo kryo, Output output, Object object) { RemoteInvocationHandler handler = (RemoteInvocationHandler)Proxy.getInvocationHandler(object); output.writeInt(handler.objectID, true); } public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); return object; } }); }
java
static public void registerClasses (final Kryo kryo) { kryo.register(Object[].class); kryo.register(InvokeMethod.class); FieldSerializer<InvokeMethodResult> resultSerializer = new FieldSerializer<InvokeMethodResult>(kryo, InvokeMethodResult.class) { public void write (Kryo kryo, Output output, InvokeMethodResult result) { super.write(kryo, output, result); output.writeInt(result.objectID, true); } public InvokeMethodResult read (Kryo kryo, Input input, Class<InvokeMethodResult> type) { InvokeMethodResult result = super.read(kryo, input, type); result.objectID = input.readInt(true); return result; } }; resultSerializer.removeField("objectID"); kryo.register(InvokeMethodResult.class, resultSerializer); kryo.register(InvocationHandler.class, new Serializer() { public void write (Kryo kryo, Output output, Object object) { RemoteInvocationHandler handler = (RemoteInvocationHandler)Proxy.getInvocationHandler(object); output.writeInt(handler.objectID, true); } public Object read (Kryo kryo, Input input, Class type) { int objectID = input.readInt(true); Connection connection = (Connection)kryo.getContext().get("connection"); Object object = getRegisteredObject(connection, objectID); if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection); return object; } }); }
[ "static", "public", "void", "registerClasses", "(", "final", "Kryo", "kryo", ")", "{", "kryo", ".", "register", "(", "Object", "[", "]", ".", "class", ")", ";", "kryo", ".", "register", "(", "InvokeMethod", ".", "class", ")", ";", "FieldSerializer", "<",...
Registers the classes needed to use ObjectSpaces. This should be called before any connections are opened. @see Kryo#register(Class, Serializer)
[ "Registers", "the", "classes", "needed", "to", "use", "ObjectSpaces", ".", "This", "should", "be", "called", "before", "any", "connections", "are", "opened", "." ]
train
https://github.com/EsotericSoftware/kryonet/blob/2ed19b4743667664d15e3778447e579855ba3a65/src/com/esotericsoftware/kryonet/rmi/ObjectSpace.java#L687-L721
apache/reef
lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/client/JavaDriverClientLauncher.java
JavaDriverClientLauncher.main
@SuppressWarnings("checkstyle:illegalcatch") public static void main(final String[] args) { LOG.log(Level.INFO, "Entering JavaDriverClientLauncher.main()."); LOG.log(Level.FINE, "JavaDriverClientLauncher started with user name [{0}]", System.getProperty("user.name")); LOG.log(Level.FINE, "JavaDriverClientLauncher started. Assertions are {0} in this process.", EnvironmentUtils.areAssertionsEnabled() ? "ENABLED" : "DISABLED"); if (args.length != 2) { final String message = "JavaDriverClientLauncher have two and only two arguments to specify the runtime clock " + "configuration path and driver service port"; throw fatal(message, new IllegalArgumentException(message)); } final JavaDriverClientLauncher launcher = getLauncher(args[0], Integer.parseInt(args[1])); Thread.setDefaultUncaughtExceptionHandler(new REEFUncaughtExceptionHandler(launcher.envConfig)); final Injector injector = TANG.newInjector(launcher.envConfig); try { final DriverServiceClient driverServiceClient = injector.getInstance(DriverServiceClient.class); try (final Clock reef = injector.getInstance(Clock.class)) { reef.run(); } catch (final InjectionException ex) { LOG.log(Level.SEVERE, "Unable to configure driver client."); driverServiceClient.onInitializationException(ex.getCause() != null ? ex.getCause() : ex); } catch (final Throwable t) { if (t.getCause() != null && t.getCause() instanceof InjectionException) { LOG.log(Level.SEVERE, "Unable to configure driver client."); final InjectionException ex = (InjectionException) t.getCause(); driverServiceClient.onInitializationException(ex.getCause() != null ? ex.getCause() : ex); } else { throw fatal("Unable run clock.", t); } } } catch (final InjectionException e) { throw fatal("Unable initialize driver service client.", e); } ThreadLogger.logThreads(LOG, Level.FINEST, "Threads running after Clock.close():"); LOG.log(Level.INFO, "Exiting REEFLauncher.main()"); System.exit(0); // TODO[REEF-1715]: Should be able to exit cleanly at the end of main() }
java
@SuppressWarnings("checkstyle:illegalcatch") public static void main(final String[] args) { LOG.log(Level.INFO, "Entering JavaDriverClientLauncher.main()."); LOG.log(Level.FINE, "JavaDriverClientLauncher started with user name [{0}]", System.getProperty("user.name")); LOG.log(Level.FINE, "JavaDriverClientLauncher started. Assertions are {0} in this process.", EnvironmentUtils.areAssertionsEnabled() ? "ENABLED" : "DISABLED"); if (args.length != 2) { final String message = "JavaDriverClientLauncher have two and only two arguments to specify the runtime clock " + "configuration path and driver service port"; throw fatal(message, new IllegalArgumentException(message)); } final JavaDriverClientLauncher launcher = getLauncher(args[0], Integer.parseInt(args[1])); Thread.setDefaultUncaughtExceptionHandler(new REEFUncaughtExceptionHandler(launcher.envConfig)); final Injector injector = TANG.newInjector(launcher.envConfig); try { final DriverServiceClient driverServiceClient = injector.getInstance(DriverServiceClient.class); try (final Clock reef = injector.getInstance(Clock.class)) { reef.run(); } catch (final InjectionException ex) { LOG.log(Level.SEVERE, "Unable to configure driver client."); driverServiceClient.onInitializationException(ex.getCause() != null ? ex.getCause() : ex); } catch (final Throwable t) { if (t.getCause() != null && t.getCause() instanceof InjectionException) { LOG.log(Level.SEVERE, "Unable to configure driver client."); final InjectionException ex = (InjectionException) t.getCause(); driverServiceClient.onInitializationException(ex.getCause() != null ? ex.getCause() : ex); } else { throw fatal("Unable run clock.", t); } } } catch (final InjectionException e) { throw fatal("Unable initialize driver service client.", e); } ThreadLogger.logThreads(LOG, Level.FINEST, "Threads running after Clock.close():"); LOG.log(Level.INFO, "Exiting REEFLauncher.main()"); System.exit(0); // TODO[REEF-1715]: Should be able to exit cleanly at the end of main() }
[ "@", "SuppressWarnings", "(", "\"checkstyle:illegalcatch\"", ")", "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "LOG", ".", "log", "(", "Level", ".", "INFO", ",", "\"Entering JavaDriverClientLauncher.main().\"", ")", ";"...
Launches a REEF client process (Driver or Evaluator). @param args Command-line arguments. Must be a single element containing local path to the configuration file.
[ "Launches", "a", "REEF", "client", "process", "(", "Driver", "or", "Evaluator", ")", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/client/JavaDriverClientLauncher.java#L169-L214
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/animation/ViewPosition.java
ViewPosition.apply
public static void apply(@NonNull ViewPosition pos, @NonNull Point point) { pos.view.set(point.x, point.y, point.x + 1, point.y + 1); pos.viewport.set(pos.view); pos.visible.set(pos.view); pos.image.set(pos.view); }
java
public static void apply(@NonNull ViewPosition pos, @NonNull Point point) { pos.view.set(point.x, point.y, point.x + 1, point.y + 1); pos.viewport.set(pos.view); pos.visible.set(pos.view); pos.image.set(pos.view); }
[ "public", "static", "void", "apply", "(", "@", "NonNull", "ViewPosition", "pos", ",", "@", "NonNull", "Point", "point", ")", "{", "pos", ".", "view", ".", "set", "(", "point", ".", "x", ",", "point", ".", "y", ",", "point", ".", "x", "+", "1", ",...
Computes minimal view position for given point. @param pos Output view position @param point Target point
[ "Computes", "minimal", "view", "position", "for", "given", "point", "." ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/animation/ViewPosition.java#L168-L173
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java
TypeUtil.getParamType
public static Type getParamType(Method method, int index) { Type[] types = getParamTypes(method); if (null != types && types.length > index) { return types[index]; } return null; }
java
public static Type getParamType(Method method, int index) { Type[] types = getParamTypes(method); if (null != types && types.length > index) { return types[index]; } return null; }
[ "public", "static", "Type", "getParamType", "(", "Method", "method", ",", "int", "index", ")", "{", "Type", "[", "]", "types", "=", "getParamTypes", "(", "method", ")", ";", "if", "(", "null", "!=", "types", "&&", "types", ".", "length", ">", "index", ...
获取方法的参数类型<br> 优先获取方法的GenericParameterTypes,如果获取不到,则获取ParameterTypes @param method 方法 @param index 第几个参数的索引,从0开始计数 @return {@link Type},可能为{@code null}
[ "获取方法的参数类型<br", ">", "优先获取方法的GenericParameterTypes,如果获取不到,则获取ParameterTypes" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L112-L118
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/query/TaskKvStateRegistry.java
TaskKvStateRegistry.registerKvState
public void registerKvState(KeyGroupRange keyGroupRange, String registrationName, InternalKvState<?, ?, ?> kvState) { KvStateID kvStateId = registry.registerKvState(jobId, jobVertexId, keyGroupRange, registrationName, kvState); registeredKvStates.add(new KvStateInfo(keyGroupRange, registrationName, kvStateId)); }
java
public void registerKvState(KeyGroupRange keyGroupRange, String registrationName, InternalKvState<?, ?, ?> kvState) { KvStateID kvStateId = registry.registerKvState(jobId, jobVertexId, keyGroupRange, registrationName, kvState); registeredKvStates.add(new KvStateInfo(keyGroupRange, registrationName, kvStateId)); }
[ "public", "void", "registerKvState", "(", "KeyGroupRange", "keyGroupRange", ",", "String", "registrationName", ",", "InternalKvState", "<", "?", ",", "?", ",", "?", ">", "kvState", ")", "{", "KvStateID", "kvStateId", "=", "registry", ".", "registerKvState", "(",...
Registers the KvState instance at the KvStateRegistry. @param keyGroupRange Key group range the KvState instance belongs to @param registrationName The registration name (not necessarily the same as the KvState name defined in the state descriptor used to create the KvState instance) @param kvState The
[ "Registers", "the", "KvState", "instance", "at", "the", "KvStateRegistry", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/TaskKvStateRegistry.java#L63-L66
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.spare_brands_GET
public ArrayList<String> spare_brands_GET() throws IOException { String qPath = "/telephony/spare/brands"; StringBuilder sb = path(qPath); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
java
public ArrayList<String> spare_brands_GET() throws IOException { String qPath = "/telephony/spare/brands"; StringBuilder sb = path(qPath); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "String", ">", "spare_brands_GET", "(", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/spare/brands\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "String", "resp", "=", "execN", "(", ...
Get all available spare brands REST: GET /telephony/spare/brands
[ "Get", "all", "available", "spare", "brands" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L9102-L9107
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.sendRequestBody
@Override public VirtualConnection sendRequestBody(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestBody(async)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent, then set for partial body transfer if (!headersSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body true"); } setPartialBody(true); } getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendOutgoing(body, getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestBody(async): " + vc); } return vc; }
java
@Override public VirtualConnection sendRequestBody(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestBody(async)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent, then set for partial body transfer if (!headersSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body true"); } setPartialBody(true); } getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendOutgoing(body, getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestBody(async): " + vc); } return vc; }
[ "@", "Override", "public", "VirtualConnection", "sendRequestBody", "(", "WsByteBuffer", "[", "]", "body", ",", "InterChannelCallback", "callback", ",", "boolean", "bForce", ")", "throws", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnab...
Send the given body buffers for the outgoing request asynchronously. If chunked encoding is set, then each call to this method will be considered a "chunk" and encoded as such. If the message is Content-Length defined, then the buffers will simply be sent out with no modifications. Note: if headers have not already been sent, then the first call to this method will send the headers. If the write can be done immediately, the VirtualConnection will be returned and the callback will not be used. The caller is responsible for handling that situation in their code. A null return code means that the async write is in progress. The boolean bForce parameter allows the caller to force the asynchronous action even if it could be handled immediately. The return code will always be null and the callback always used. @param body @param callback @param bForce @return VirtualConnection @throws MessageSentException -- if a finishMessage API was already used
[ "Send", "the", "given", "body", "buffers", "for", "the", "outgoing", "request", "asynchronously", ".", "If", "chunked", "encoding", "is", "set", "then", "each", "call", "to", "this", "method", "will", "be", "considered", "a", "chunk", "and", "encoded", "as",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1022-L1051
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GroupApi.java
GroupApi.deleteVariable
public void deleteVariable(Object groupIdOrPath, String key) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "variables", key); }
java
public void deleteVariable(Object groupIdOrPath, String key) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "variables", key); }
[ "public", "void", "deleteVariable", "(", "Object", "groupIdOrPath", ",", "String", "key", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"groups\"", ",", "getGroupIdOrPath", "(", "groupI...
Deletes a group variable. <pre><code>DELETE /groups/:id/variables/:key</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required @param key the key of an existing variable, required @throws GitLabApiException if any exception occurs
[ "Deletes", "a", "group", "variable", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L1133-L1135
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java
DirectoryServiceClient.unregisterServiceInstance
public void unregisterServiceInstance(String serviceName, String instanceId, final RegistrationCallback cb, Object context){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UnregisterServiceInstance); UnregisterServiceInstanceProtocol p = new UnregisterServiceInstanceProtocol(serviceName, instanceId); ProtocolCallback pcb = new ProtocolCallback(){ @Override public void call(boolean result, Response response, ErrorCode error, Object ctx) { cb.call(result, error, ctx); } }; connection.submitCallbackRequest(header, p, pcb, context); }
java
public void unregisterServiceInstance(String serviceName, String instanceId, final RegistrationCallback cb, Object context){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UnregisterServiceInstance); UnregisterServiceInstanceProtocol p = new UnregisterServiceInstanceProtocol(serviceName, instanceId); ProtocolCallback pcb = new ProtocolCallback(){ @Override public void call(boolean result, Response response, ErrorCode error, Object ctx) { cb.call(result, error, ctx); } }; connection.submitCallbackRequest(header, p, pcb, context); }
[ "public", "void", "unregisterServiceInstance", "(", "String", "serviceName", ",", "String", "instanceId", ",", "final", "RegistrationCallback", "cb", ",", "Object", "context", ")", "{", "ProtocolHeader", "header", "=", "new", "ProtocolHeader", "(", ")", ";", "head...
Unregister the ServiceInstance in Callback. @param serviceName the service name. @param instanceId the instanceId. @param cb the Callback. @param context the Callback context object.
[ "Unregister", "the", "ServiceInstance", "in", "Callback", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L659-L674
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java
DeployerResolverOverriderConverter.overrideDeployerDetails
private void overrideDeployerDetails(T overrider, Class overriderClass) { if (overrider instanceof DeployerOverrider) { try { Field deployerDetailsField = overriderClass.getDeclaredField("deployerDetails"); deployerDetailsField.setAccessible(true); Object deployerDetails = deployerDetailsField.get(overrider); if (deployerDetails == null) { Field oldDeployerDetailsField = overriderClass.getDeclaredField("details"); oldDeployerDetailsField.setAccessible(true); Object oldDeployerDetails = oldDeployerDetailsField.get(overrider); if (oldDeployerDetails != null) { ServerDetails deployerServerDetails = createInitialDeployDetailsFromOldDeployDetails((ServerDetails) oldDeployerDetails); deployerDetailsField.set(overrider, deployerServerDetails); } } } catch (NoSuchFieldException | IllegalAccessException e) { converterErrors.add(getConversionErrorMessage(overrider, e)); } } }
java
private void overrideDeployerDetails(T overrider, Class overriderClass) { if (overrider instanceof DeployerOverrider) { try { Field deployerDetailsField = overriderClass.getDeclaredField("deployerDetails"); deployerDetailsField.setAccessible(true); Object deployerDetails = deployerDetailsField.get(overrider); if (deployerDetails == null) { Field oldDeployerDetailsField = overriderClass.getDeclaredField("details"); oldDeployerDetailsField.setAccessible(true); Object oldDeployerDetails = oldDeployerDetailsField.get(overrider); if (oldDeployerDetails != null) { ServerDetails deployerServerDetails = createInitialDeployDetailsFromOldDeployDetails((ServerDetails) oldDeployerDetails); deployerDetailsField.set(overrider, deployerServerDetails); } } } catch (NoSuchFieldException | IllegalAccessException e) { converterErrors.add(getConversionErrorMessage(overrider, e)); } } }
[ "private", "void", "overrideDeployerDetails", "(", "T", "overrider", ",", "Class", "overriderClass", ")", "{", "if", "(", "overrider", "instanceof", "DeployerOverrider", ")", "{", "try", "{", "Field", "deployerDetailsField", "=", "overriderClass", ".", "getDeclaredF...
Convert the (ServerDetails)details to (ServerDetails)deployerDetails if it doesn't exists already This convertion comes after a name change (details -> deployerDetails)
[ "Convert", "the", "(", "ServerDetails", ")", "details", "to", "(", "ServerDetails", ")", "deployerDetails", "if", "it", "doesn", "t", "exists", "already", "This", "convertion", "comes", "after", "a", "name", "change", "(", "details", "-", ">", "deployerDetails...
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L156-L176
alkacon/opencms-core
src/org/opencms/report/CmsHtmlReport.java
CmsHtmlReport.getExceptionElement
private StringBuffer getExceptionElement(Throwable throwable) { StringBuffer buf = new StringBuffer(256); if (!m_writeHtml) { if (m_showExceptionStackTrace) { buf.append("aT('"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n"); while (tok.hasMoreTokens()) { excBuffer.append(tok.nextToken()); excBuffer.append(getLineBreak()); } buf.append(CmsStringUtil.escapeJavaScript(excBuffer.toString())); buf.append("'); "); } else { buf.append("aT('"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); buf.append(CmsStringUtil.escapeJavaScript(throwable.toString())); buf.append("'); "); } m_content.add(buf); } else { if (m_showExceptionStackTrace) { buf.append("<span class='throw'>"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n"); while (tok.hasMoreTokens()) { excBuffer.append(tok.nextToken()); excBuffer.append(getLineBreak()); } buf.append(excBuffer.toString()); buf.append("</span>"); } else { buf.append("<span class='throw'>"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); buf.append(throwable.toString()); buf.append("</span>"); buf.append(getLineBreak()); } } return buf; }
java
private StringBuffer getExceptionElement(Throwable throwable) { StringBuffer buf = new StringBuffer(256); if (!m_writeHtml) { if (m_showExceptionStackTrace) { buf.append("aT('"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n"); while (tok.hasMoreTokens()) { excBuffer.append(tok.nextToken()); excBuffer.append(getLineBreak()); } buf.append(CmsStringUtil.escapeJavaScript(excBuffer.toString())); buf.append("'); "); } else { buf.append("aT('"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); buf.append(CmsStringUtil.escapeJavaScript(throwable.toString())); buf.append("'); "); } m_content.add(buf); } else { if (m_showExceptionStackTrace) { buf.append("<span class='throw'>"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable)); StringBuffer excBuffer = new StringBuffer(exception.length() + 50); StringTokenizer tok = new StringTokenizer(exception, "\r\n"); while (tok.hasMoreTokens()) { excBuffer.append(tok.nextToken()); excBuffer.append(getLineBreak()); } buf.append(excBuffer.toString()); buf.append("</span>"); } else { buf.append("<span class='throw'>"); buf.append(getMessages().key(Messages.RPT_EXCEPTION_0)); buf.append(throwable.toString()); buf.append("</span>"); buf.append(getLineBreak()); } } return buf; }
[ "private", "StringBuffer", "getExceptionElement", "(", "Throwable", "throwable", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "256", ")", ";", "if", "(", "!", "m_writeHtml", ")", "{", "if", "(", "m_showExceptionStackTrace", ")", "{", "buf"...
Output helper method to format a reported {@link Throwable} element.<p> This method ensures that exception stack traces are properly escaped when they are added to the report.<p> There is a member variable {@link #m_showExceptionStackTrace} in this class that controls if the stack track is shown or not. In a later version this might be configurable on a per-user basis.<p> @param throwable the exception to format @return the formatted StringBuffer
[ "Output", "helper", "method", "to", "format", "a", "reported", "{", "@link", "Throwable", "}", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/report/CmsHtmlReport.java#L280-L326
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/ProjectManager.java
ProjectManager.getProjects
public List<Project> getProjects() throws RedmineException { try { return transport.getObjectsList(Project.class, new BasicNameValuePair("include", "trackers")); } catch (NotFoundException e) { throw new RedmineInternalError("NotFoundException received, which should never happen in this request"); } }
java
public List<Project> getProjects() throws RedmineException { try { return transport.getObjectsList(Project.class, new BasicNameValuePair("include", "trackers")); } catch (NotFoundException e) { throw new RedmineInternalError("NotFoundException received, which should never happen in this request"); } }
[ "public", "List", "<", "Project", ">", "getProjects", "(", ")", "throws", "RedmineException", "{", "try", "{", "return", "transport", ".", "getObjectsList", "(", "Project", ".", "class", ",", "new", "BasicNameValuePair", "(", "\"include\"", ",", "\"trackers\"", ...
Load the list of projects available to the user, which is represented by the API access key. <p> Redmine ignores "get trackers info" parameter for "get projects" request. see bug http://www.redmine.org/issues/8545 The field is already accessible for a specific project for a long time (GET /projects/:id) but in the projects list (GET /projects) it's only on the svn trunk for now (Sep 8, 2014). It will be included in Redmine 2.6.0 which isn't out yet. @return list of Project objects @throws RedmineAuthenticationException invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments. @throws RedmineException
[ "Load", "the", "list", "of", "projects", "available", "to", "the", "user", "which", "is", "represented", "by", "the", "API", "access", "key", ".", "<p", ">", "Redmine", "ignores", "get", "trackers", "info", "parameter", "for", "get", "projects", "request", ...
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/ProjectManager.java#L64-L71
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.findByUniqueTag
public DContact findByUniqueTag(Object parent, java.lang.String uniqueTag) { return queryUniqueByField(parent, DContactMapper.Field.UNIQUETAG.getFieldName(), uniqueTag); }
java
public DContact findByUniqueTag(Object parent, java.lang.String uniqueTag) { return queryUniqueByField(parent, DContactMapper.Field.UNIQUETAG.getFieldName(), uniqueTag); }
[ "public", "DContact", "findByUniqueTag", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "uniqueTag", ")", "{", "return", "queryUniqueByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "UNIQUETAG", ".", "getFieldName", "(", ")...
find-by method for unique field uniqueTag @param uniqueTag the unique attribute @return the unique DContact for the specified uniqueTag
[ "find", "-", "by", "method", "for", "unique", "field", "uniqueTag" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L286-L288
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/CommonUtils.java
CommonUtils.dateReservedMonth
public static Date dateReservedMonth(int year, int month, boolean is000) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); if (month <= 1) { calendar.set(Calendar.MONTH, Calendar.JANUARY); } else if (month >= 12) { calendar.set(Calendar.MONTH, Calendar.DECEMBER); } else { calendar.set(Calendar.MONTH, month - 1); } return is000 ? dateReservedMonth000(calendar) : dateReservedMonth999(calendar); }
java
public static Date dateReservedMonth(int year, int month, boolean is000) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); if (month <= 1) { calendar.set(Calendar.MONTH, Calendar.JANUARY); } else if (month >= 12) { calendar.set(Calendar.MONTH, Calendar.DECEMBER); } else { calendar.set(Calendar.MONTH, month - 1); } return is000 ? dateReservedMonth000(calendar) : dateReservedMonth999(calendar); }
[ "public", "static", "Date", "dateReservedMonth", "(", "int", "year", ",", "int", "month", ",", "boolean", "is000", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "YEAR", ...
将指定年月的日期的日,时,分,秒,毫秒调整为最小值或者最大值 @param year 指定年份 @param month 指定月份 @param is000 为true表示置为最小值,反之最大值 @return 被转化后的日期 @see #dateReservedMonth000(Date) @see #dateReservedMonth000(Calendar) @see #dateReservedMonth999(Date) @see #dateReservedMonth999(Calendar)
[ "将指定年月的日期的日", "时", "分", "秒", "毫秒调整为最小值或者最大值" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/CommonUtils.java#L450-L461
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.unaryNumericPromotion
@Nullable private static Type unaryNumericPromotion(Type type, VisitorState state) { Type unboxed = unboxAndEnsureNumeric(type, state); switch (unboxed.getTag()) { case BYTE: case SHORT: case CHAR: return state.getSymtab().intType; case INT: case LONG: case FLOAT: case DOUBLE: return unboxed; default: throw new AssertionError("Should not reach here: " + type); } }
java
@Nullable private static Type unaryNumericPromotion(Type type, VisitorState state) { Type unboxed = unboxAndEnsureNumeric(type, state); switch (unboxed.getTag()) { case BYTE: case SHORT: case CHAR: return state.getSymtab().intType; case INT: case LONG: case FLOAT: case DOUBLE: return unboxed; default: throw new AssertionError("Should not reach here: " + type); } }
[ "@", "Nullable", "private", "static", "Type", "unaryNumericPromotion", "(", "Type", "type", ",", "VisitorState", "state", ")", "{", "Type", "unboxed", "=", "unboxAndEnsureNumeric", "(", "type", ",", "state", ")", ";", "switch", "(", "unboxed", ".", "getTag", ...
Implementation of unary numeric promotion rules. <p><a href="https://docs.oracle.com/javase/specs/jls/se9/html/jls-5.html#jls-5.6.1">JLS §5.6.1</a>
[ "Implementation", "of", "unary", "numeric", "promotion", "rules", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L1248-L1264
gwtplus/google-gin
src/main/java/com/google/gwt/inject/client/multibindings/GinMultibinder.java
GinMultibinder.newSetBinder
public static <T> GinMultibinder<T> newSetBinder(GinBinder binder, TypeLiteral<T> type) { return newSetBinder(binder, type, Key.get(providerOf(type))); }
java
public static <T> GinMultibinder<T> newSetBinder(GinBinder binder, TypeLiteral<T> type) { return newSetBinder(binder, type, Key.get(providerOf(type))); }
[ "public", "static", "<", "T", ">", "GinMultibinder", "<", "T", ">", "newSetBinder", "(", "GinBinder", "binder", ",", "TypeLiteral", "<", "T", ">", "type", ")", "{", "return", "newSetBinder", "(", "binder", ",", "type", ",", "Key", ".", "get", "(", "pro...
Returns a new multibinder that collects instances of {@code type} in a {@link java.util.Set} that is itself bound with no binding annotation.
[ "Returns", "a", "new", "multibinder", "that", "collects", "instances", "of", "{" ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/client/multibindings/GinMultibinder.java#L57-L59
dhemery/hartley
src/main/java/com/dhemery/expressing/Expressive.java
Expressive.assertThat
public void assertThat(Ticker ticker, Sampler<Boolean> variable) { assertThat(variable, ticker, isQuietlyTrue()); }
java
public void assertThat(Ticker ticker, Sampler<Boolean> variable) { assertThat(variable, ticker, isQuietlyTrue()); }
[ "public", "void", "assertThat", "(", "Ticker", "ticker", ",", "Sampler", "<", "Boolean", ">", "variable", ")", "{", "assertThat", "(", "variable", ",", "ticker", ",", "isQuietlyTrue", "(", ")", ")", ";", "}" ]
Assert that a polled sample of the variable is {@code true}. <p>Example:</p> <pre> {@code Sampler<Boolean> theresAFlyInMySoup = ...; ... assertThat(eventually(), theresAFlyInMySoup); }
[ "Assert", "that", "a", "polled", "sample", "of", "the", "variable", "is", "{", "@code", "true", "}", ".", "<p", ">", "Example", ":", "<", "/", "p", ">", "<pre", ">", "{", "@code" ]
train
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L78-L80
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/EfficientCacheView.java
EfficientCacheView.clearViewCached
public void clearViewCached(int parentId, int viewId) { SparseArray<View> sparseArrayViewsParent = mSparseSparseArrayView.get(parentId); if (sparseArrayViewsParent != null) { sparseArrayViewsParent.remove(viewId); } }
java
public void clearViewCached(int parentId, int viewId) { SparseArray<View> sparseArrayViewsParent = mSparseSparseArrayView.get(parentId); if (sparseArrayViewsParent != null) { sparseArrayViewsParent.remove(viewId); } }
[ "public", "void", "clearViewCached", "(", "int", "parentId", ",", "int", "viewId", ")", "{", "SparseArray", "<", "View", ">", "sparseArrayViewsParent", "=", "mSparseSparseArrayView", ".", "get", "(", "parentId", ")", ";", "if", "(", "sparseArrayViewsParent", "!=...
Clear the cache for the view specify @param parentId the parent id of the view to remove (if the view was retrieve with this parent id) @param viewId id of the view to remove from the cache
[ "Clear", "the", "cache", "for", "the", "view", "specify" ]
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/EfficientCacheView.java#L43-L48
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.putThreadLocal
public synchronized final void putThreadLocal(Object key, Object value) { if (sealed) onSealedMutation(); if (threadLocalMap == null) threadLocalMap = new HashMap<Object,Object>(); threadLocalMap.put(key, value); }
java
public synchronized final void putThreadLocal(Object key, Object value) { if (sealed) onSealedMutation(); if (threadLocalMap == null) threadLocalMap = new HashMap<Object,Object>(); threadLocalMap.put(key, value); }
[ "public", "synchronized", "final", "void", "putThreadLocal", "(", "Object", "key", ",", "Object", "value", ")", "{", "if", "(", "sealed", ")", "onSealedMutation", "(", ")", ";", "if", "(", "threadLocalMap", "==", "null", ")", "threadLocalMap", "=", "new", ...
Put a value that can later be retrieved using a given key. <p> @param key the key used to index the value @param value the value to save
[ "Put", "a", "value", "that", "can", "later", "be", "retrieved", "using", "a", "given", "key", ".", "<p", ">" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L2193-L2199
LearnLib/learnlib
datastructures/pta/src/main/java/de/learnlib/datastructure/pta/pta/BasePTA.java
BasePTA.addSample
public void addSample(int[] sample, SP lastProperty) { S target = getOrCreateState(sample); if (!target.tryMergeStateProperty(lastProperty)) { throw new IllegalStateException(); } }
java
public void addSample(int[] sample, SP lastProperty) { S target = getOrCreateState(sample); if (!target.tryMergeStateProperty(lastProperty)) { throw new IllegalStateException(); } }
[ "public", "void", "addSample", "(", "int", "[", "]", "sample", ",", "SP", "lastProperty", ")", "{", "S", "target", "=", "getOrCreateState", "(", "sample", ")", ";", "if", "(", "!", "target", ".", "tryMergeStateProperty", "(", "lastProperty", ")", ")", "{...
Adds a sample to the PTA, and sets the property of the last reached (or inserted) state accordingly. @param sample the word to add to the PTA @param lastProperty the property of the last state to set
[ "Adds", "a", "sample", "to", "the", "PTA", "and", "sets", "the", "property", "of", "the", "last", "reached", "(", "or", "inserted", ")", "state", "accordingly", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/datastructures/pta/src/main/java/de/learnlib/datastructure/pta/pta/BasePTA.java#L112-L117
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java
SingleSessionIoHandlerDelegate.messageReceived
public void messageReceived(IoSession session, Object message) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session .getAttribute(HANDLER); handler.messageReceived(message); }
java
public void messageReceived(IoSession session, Object message) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session .getAttribute(HANDLER); handler.messageReceived(message); }
[ "public", "void", "messageReceived", "(", "IoSession", "session", ",", "Object", "message", ")", "throws", "Exception", "{", "SingleSessionIoHandler", "handler", "=", "(", "SingleSessionIoHandler", ")", "session", ".", "getAttribute", "(", "HANDLER", ")", ";", "ha...
Delegates the method call to the {@link SingleSessionIoHandler#messageReceived(Object)} method of the handler assigned to this session.
[ "Delegates", "the", "method", "call", "to", "the", "{" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java#L136-L141
Nexmo/nexmo-java
src/main/java/com/nexmo/client/redact/RedactClient.java
RedactClient.redactTransaction
public void redactTransaction(String id, RedactRequest.Product product, RedactRequest.Type type) throws IOException, NexmoClientException { RedactRequest request = new RedactRequest(id, product); request.setType(type); this.redactTransaction(request); }
java
public void redactTransaction(String id, RedactRequest.Product product, RedactRequest.Type type) throws IOException, NexmoClientException { RedactRequest request = new RedactRequest(id, product); request.setType(type); this.redactTransaction(request); }
[ "public", "void", "redactTransaction", "(", "String", "id", ",", "RedactRequest", ".", "Product", "product", ",", "RedactRequest", ".", "Type", "type", ")", "throws", "IOException", ",", "NexmoClientException", "{", "RedactRequest", "request", "=", "new", "RedactR...
Submit a request to the Redact API to redact a transaction. @param id The transaction id to redact. @param product The {@link com.nexmo.client.redact.RedactRequest.Product} which corresponds to the transaction. @param type The {@link com.nexmo.client.redact.RedactRequest.Type} which is required if redacting SMS data. @throws IOException if a network error occurred contacting the Nexmo Redact API. @throws NexmoClientException if there was a problem with the Nexmo request or response objects.
[ "Submit", "a", "request", "to", "the", "Redact", "API", "to", "redact", "a", "transaction", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/redact/RedactClient.java#L67-L72
JodaOrg/joda-time-jsptags
src/main/java/org/joda/time/contrib/jsptag/DateTimeZoneSupport.java
DateTimeZoneSupport.getDateTimeZone
static DateTimeZone getDateTimeZone(PageContext pc, Tag fromTag) { DateTimeZone tz = null; Tag t = findAncestorWithClass(fromTag, DateTimeZoneSupport.class); if (t != null) { // use time zone from parent <timeZone> tag DateTimeZoneSupport parent = (DateTimeZoneSupport) t; tz = parent.getDateTimeZone(); } else { // get time zone from configuration setting Object obj = Config.find(pc, FMT_TIME_ZONE); if (obj != null) { if (obj instanceof DateTimeZone) { tz = (DateTimeZone) obj; } else { try { tz = DateTimeZone.forID((String) obj); } catch (IllegalArgumentException iae) { tz = DateTimeZone.UTC; } } } } return tz; }
java
static DateTimeZone getDateTimeZone(PageContext pc, Tag fromTag) { DateTimeZone tz = null; Tag t = findAncestorWithClass(fromTag, DateTimeZoneSupport.class); if (t != null) { // use time zone from parent <timeZone> tag DateTimeZoneSupport parent = (DateTimeZoneSupport) t; tz = parent.getDateTimeZone(); } else { // get time zone from configuration setting Object obj = Config.find(pc, FMT_TIME_ZONE); if (obj != null) { if (obj instanceof DateTimeZone) { tz = (DateTimeZone) obj; } else { try { tz = DateTimeZone.forID((String) obj); } catch (IllegalArgumentException iae) { tz = DateTimeZone.UTC; } } } } return tz; }
[ "static", "DateTimeZone", "getDateTimeZone", "(", "PageContext", "pc", ",", "Tag", "fromTag", ")", "{", "DateTimeZone", "tz", "=", "null", ";", "Tag", "t", "=", "findAncestorWithClass", "(", "fromTag", ",", "DateTimeZoneSupport", ".", "class", ")", ";", "if", ...
Determines and returns the time zone to be used by the given action. <p> If the given action is nested inside a &lt;dateTimeZone&gt; action, the time zone is taken from the enclosing &lt;dateTimeZone&gt; action. <p> Otherwise, the time zone configuration setting <tt>org.joda.time.FMT_TIME_ZONE</tt> is used. @param pc the page containing the action for which the time zone needs to be determined @param fromTag the action for which the time zone needs to be determined @return the time zone, or <tt> null </tt> if the given action is not nested inside a &lt;dateTimeZone&gt; action and no time zone configuration setting exists
[ "Determines", "and", "returns", "the", "time", "zone", "to", "be", "used", "by", "the", "given", "action", ".", "<p", ">", "If", "the", "given", "action", "is", "nested", "inside", "a", "&lt", ";", "dateTimeZone&gt", ";", "action", "the", "time", "zone",...
train
https://github.com/JodaOrg/joda-time-jsptags/blob/69008a813568cb6f3e37ea7a80f8b1f2070edf14/src/main/java/org/joda/time/contrib/jsptag/DateTimeZoneSupport.java#L109-L134
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicatedCloud_serviceName_ip_duration_GET
public OvhOrder dedicatedCloud_serviceName_ip_duration_GET(String serviceName, String duration, OvhIpCountriesEnum country, String description, Long estimatedClientsNumber, String networkName, OvhOrderableIpBlockRangeEnum size, String usage) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/ip/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "country", country); query(sb, "description", description); query(sb, "estimatedClientsNumber", estimatedClientsNumber); query(sb, "networkName", networkName); query(sb, "size", size); query(sb, "usage", usage); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicatedCloud_serviceName_ip_duration_GET(String serviceName, String duration, OvhIpCountriesEnum country, String description, Long estimatedClientsNumber, String networkName, OvhOrderableIpBlockRangeEnum size, String usage) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/ip/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "country", country); query(sb, "description", description); query(sb, "estimatedClientsNumber", estimatedClientsNumber); query(sb, "networkName", networkName); query(sb, "size", size); query(sb, "usage", usage); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicatedCloud_serviceName_ip_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhIpCountriesEnum", "country", ",", "String", "description", ",", "Long", "estimatedClientsNumber", ",", "String", "networkName", ",", "OvhO...
Get prices and contracts information REST: GET /order/dedicatedCloud/{serviceName}/ip/{duration} @param size [required] The network ranges orderable @param usage [required] Basic information of how will this bloc be used (as "web","ssl","cloud" or other things) @param description [required] Information visible on whois (minimum 3 and maximum 250 alphanumeric characters) @param country [required] This Ip block country @param estimatedClientsNumber [required] How much clients would be hosted on those ips ? @param networkName [required] Information visible on whois (between 2 and maximum 20 alphanumeric characters) @param serviceName [required] @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5824-L5835
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/onesample/WilcoxonOneSample.java
WilcoxonOneSample.scoreToPvalue
private static double scoreToPvalue(double score, int n) { /* if(n<=20) { //calculate it from binomial distribution } */ double mean=n*(n+1.0)/4.0; double variable=n*(n+1.0)*(2.0*n+1.0)/24.0; double z=(score-mean)/Math.sqrt(variable); return ContinuousDistributions.gaussCdf(z); }
java
private static double scoreToPvalue(double score, int n) { /* if(n<=20) { //calculate it from binomial distribution } */ double mean=n*(n+1.0)/4.0; double variable=n*(n+1.0)*(2.0*n+1.0)/24.0; double z=(score-mean)/Math.sqrt(variable); return ContinuousDistributions.gaussCdf(z); }
[ "private", "static", "double", "scoreToPvalue", "(", "double", "score", ",", "int", "n", ")", "{", "/*\n if(n<=20) {\n //calculate it from binomial distribution\n }\n */", "double", "mean", "=", "n", "*", "(", "n", "+", "1.0", ")", "/", ...
Returns the Pvalue for a particular score @param score @param n @return
[ "Returns", "the", "Pvalue", "for", "a", "particular", "score" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/onesample/WilcoxonOneSample.java#L112-L125
geomajas/geomajas-project-client-gwt2
plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java
TileBasedLayerClient.createOsmLayer
public OsmLayer createOsmLayer(String id, int nrOfLevels, String url) { OsmLayer layer = new OsmLayer(id, createOsmTileConfiguration(nrOfLevels)); layer.addUrl(url); return layer; }
java
public OsmLayer createOsmLayer(String id, int nrOfLevels, String url) { OsmLayer layer = new OsmLayer(id, createOsmTileConfiguration(nrOfLevels)); layer.addUrl(url); return layer; }
[ "public", "OsmLayer", "createOsmLayer", "(", "String", "id", ",", "int", "nrOfLevels", ",", "String", "url", ")", "{", "OsmLayer", "layer", "=", "new", "OsmLayer", "(", "id", ",", "createOsmTileConfiguration", "(", "nrOfLevels", ")", ")", ";", "layer", ".", ...
Create a new OSM layer with an URL to an OSM tile service. <p/> The URL should have placeholders for the x- and y-coordinate and tile level in the form of {x}, {y}, {z}. The file extension of the tiles should be part of the URL. @param id The unique ID of the layer. @param conf The tile configuration. @param url The URL to the tile service. @return A new OSM layer. @since 2.2.1
[ "Create", "a", "new", "OSM", "layer", "with", "an", "URL", "to", "an", "OSM", "tile", "service", ".", "<p", "/", ">", "The", "URL", "should", "have", "placeholders", "for", "the", "x", "-", "and", "y", "-", "coordinate", "and", "tile", "level", "in",...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java#L151-L155
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupUI.java
CmsSetupUI.getSetupPage
public static Resource getSetupPage(I_SetupUiContext context, String name) { String path = CmsStringUtil.joinPaths(context.getSetupBean().getContextPath(), CmsSetupBean.FOLDER_SETUP, name); Resource resource = new ExternalResource(path); return resource; }
java
public static Resource getSetupPage(I_SetupUiContext context, String name) { String path = CmsStringUtil.joinPaths(context.getSetupBean().getContextPath(), CmsSetupBean.FOLDER_SETUP, name); Resource resource = new ExternalResource(path); return resource; }
[ "public", "static", "Resource", "getSetupPage", "(", "I_SetupUiContext", "context", ",", "String", "name", ")", "{", "String", "path", "=", "CmsStringUtil", ".", "joinPaths", "(", "context", ".", "getSetupBean", "(", ")", ".", "getContextPath", "(", ")", ",", ...
Gets external resource for an HTML page in the setup-resources folder. @param context the context @param name the file name @return the resource for the HTML page
[ "Gets", "external", "resource", "for", "an", "HTML", "page", "in", "the", "setup", "-", "resources", "folder", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupUI.java#L84-L89
OpenTSDB/opentsdb
src/core/Tags.java
Tags.splitString
public static String[] splitString(final String s, final char c) { final char[] chars = s.toCharArray(); int num_substrings = 1; for (final char x : chars) { if (x == c) { num_substrings++; } } final String[] result = new String[num_substrings]; final int len = chars.length; int start = 0; // starting index in chars of the current substring. int pos = 0; // current index in chars. int i = 0; // number of the current substring. for (; pos < len; pos++) { if (chars[pos] == c) { result[i++] = new String(chars, start, pos - start); start = pos + 1; } } result[i] = new String(chars, start, pos - start); return result; }
java
public static String[] splitString(final String s, final char c) { final char[] chars = s.toCharArray(); int num_substrings = 1; for (final char x : chars) { if (x == c) { num_substrings++; } } final String[] result = new String[num_substrings]; final int len = chars.length; int start = 0; // starting index in chars of the current substring. int pos = 0; // current index in chars. int i = 0; // number of the current substring. for (; pos < len; pos++) { if (chars[pos] == c) { result[i++] = new String(chars, start, pos - start); start = pos + 1; } } result[i] = new String(chars, start, pos - start); return result; }
[ "public", "static", "String", "[", "]", "splitString", "(", "final", "String", "s", ",", "final", "char", "c", ")", "{", "final", "char", "[", "]", "chars", "=", "s", ".", "toCharArray", "(", ")", ";", "int", "num_substrings", "=", "1", ";", "for", ...
Optimized version of {@code String#split} that doesn't use regexps. This function works in O(5n) where n is the length of the string to split. @param s The string to split. @param c The separator to use to split the string. @return A non-null, non-empty array.
[ "Optimized", "version", "of", "{" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Tags.java#L56-L77
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/IndexConverter.java
IndexConverter.setString
public int setString(String fieldPtr, boolean bDisplayOption, int moveMode) // init this field override for other value { int index = ((NumberField)this.getNextConverter()).convertStringToIndex(fieldPtr); return this.getNextConverter().setValue(index, bDisplayOption, moveMode); }
java
public int setString(String fieldPtr, boolean bDisplayOption, int moveMode) // init this field override for other value { int index = ((NumberField)this.getNextConverter()).convertStringToIndex(fieldPtr); return this.getNextConverter().setValue(index, bDisplayOption, moveMode); }
[ "public", "int", "setString", "(", "String", "fieldPtr", ",", "boolean", "bDisplayOption", ",", "int", "moveMode", ")", "// init this field override for other value", "{", "int", "index", "=", "(", "(", "NumberField", ")", "this", ".", "getNextConverter", "(", ")"...
Convert and move string to this field. Convert this string to an index and set the index value. Override this method to convert the String to the actual Physical Data Type. @param strString the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code (or NORMAL_RETURN).
[ "Convert", "and", "move", "string", "to", "this", "field", ".", "Convert", "this", "string", "to", "an", "index", "and", "set", "the", "index", "value", ".", "Override", "this", "method", "to", "convert", "the", "String", "to", "the", "actual", "Physical",...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/IndexConverter.java#L83-L87
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Disjoint.java
ST_Disjoint.geomDisjoint
public static Boolean geomDisjoint(Geometry a, Geometry b) { if(a==null || b==null) { return null; } return a.disjoint(b); }
java
public static Boolean geomDisjoint(Geometry a, Geometry b) { if(a==null || b==null) { return null; } return a.disjoint(b); }
[ "public", "static", "Boolean", "geomDisjoint", "(", "Geometry", "a", ",", "Geometry", "b", ")", "{", "if", "(", "a", "==", "null", "||", "b", "==", "null", ")", "{", "return", "null", ";", "}", "return", "a", ".", "disjoint", "(", "b", ")", ";", ...
Return true if the two Geometries are disjoint @param a Geometry Geometry. @param b Geometry instance @return true if the two Geometries are disjoint
[ "Return", "true", "if", "the", "two", "Geometries", "are", "disjoint" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Disjoint.java#L52-L57
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLClassAssertionAxiomImpl_CustomFieldSerializer.java
OWLClassAssertionAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLClassAssertionAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLClassAssertionAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLClassAssertionAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLClassAssertionAxiomImpl_CustomFieldSerializer.java#L76-L79
pwall567/jsonutil
src/main/java/net/pwall/json/JSON.java
JSON.parseArray
public static JSONArray parseArray(File f, Charset charSet) throws IOException { return (JSONArray)parse(f, charSet); }
java
public static JSONArray parseArray(File f, Charset charSet) throws IOException { return (JSONArray)parse(f, charSet); }
[ "public", "static", "JSONArray", "parseArray", "(", "File", "f", ",", "Charset", "charSet", ")", "throws", "IOException", "{", "return", "(", "JSONArray", ")", "parse", "(", "f", ",", "charSet", ")", ";", "}" ]
Parse the contents of a {@link File} as a JSON array, specifying the character set. @param f the {@link File} @param charSet the character set @return the JSON array @throws JSONException if the file does not contain a valid JSON value @throws IOException on any I/O errors @throws ClassCastException if the value is not an array
[ "Parse", "the", "contents", "of", "a", "{", "@link", "File", "}", "as", "a", "JSON", "array", "specifying", "the", "character", "set", "." ]
train
https://github.com/pwall567/jsonutil/blob/dd5960b9b0bcc9acfe6c52b884fffd9ee5f422fe/src/main/java/net/pwall/json/JSON.java#L246-L248
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java
HttpURLConnection.setRequestProperty
public void setRequestProperty(String pKey, String pValue) { if (connected) { throw new IllegalAccessError("Already connected"); } String oldValue = requestProperties.getProperty(pKey); if (oldValue == null) { requestProperties.setProperty(pKey, pValue); } else { requestProperties.setProperty(pKey, oldValue + ", " + pValue); } }
java
public void setRequestProperty(String pKey, String pValue) { if (connected) { throw new IllegalAccessError("Already connected"); } String oldValue = requestProperties.getProperty(pKey); if (oldValue == null) { requestProperties.setProperty(pKey, pValue); } else { requestProperties.setProperty(pKey, oldValue + ", " + pValue); } }
[ "public", "void", "setRequestProperty", "(", "String", "pKey", ",", "String", "pValue", ")", "{", "if", "(", "connected", ")", "{", "throw", "new", "IllegalAccessError", "(", "\"Already connected\"", ")", ";", "}", "String", "oldValue", "=", "requestProperties",...
Sets the general request property. If a property with the key already exists, overwrite its value with the new value. <p/> <p> NOTE: HTTP requires all request properties which can legally have multiple instances with the same key to use a comma-seperated list syntax which enables multiple properties to be appended into a single property. @param pKey the keyword by which the request is known (e.g., "{@code accept}"). @param pValue the value associated with it. @see #getRequestProperty(java.lang.String)
[ "Sets", "the", "general", "request", "property", ".", "If", "a", "property", "with", "the", "key", "already", "exists", "overwrite", "its", "value", "with", "the", "new", "value", ".", "<p", "/", ">", "<p", ">", "NOTE", ":", "HTTP", "requires", "all", ...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/HttpURLConnection.java#L132-L144
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/ChecksumFileSystem.java
ChecksumFileSystem.copyToLocalFile
public void copyToLocalFile(Path src, Path dst, boolean copyCrc) throws IOException { if (!fs.isDirectory(src)) { // source is a file fs.copyToLocalFile(src, dst); FileSystem localFs = getLocal(getConf()).getRawFileSystem(); if (localFs.isDirectory(dst)) { dst = new Path(dst, src.getName()); } dst = getChecksumFile(dst); if (localFs.exists(dst)) { //remove old local checksum file localFs.delete(dst, true); } Path checksumFile = getChecksumFile(src); if (copyCrc && fs.exists(checksumFile)) { //copy checksum file fs.copyToLocalFile(checksumFile, dst); } } else { FileStatus[] srcs = listStatus(src); for (FileStatus srcFile : srcs) { copyToLocalFile(srcFile.getPath(), new Path(dst, srcFile.getPath().getName()), copyCrc); } } }
java
public void copyToLocalFile(Path src, Path dst, boolean copyCrc) throws IOException { if (!fs.isDirectory(src)) { // source is a file fs.copyToLocalFile(src, dst); FileSystem localFs = getLocal(getConf()).getRawFileSystem(); if (localFs.isDirectory(dst)) { dst = new Path(dst, src.getName()); } dst = getChecksumFile(dst); if (localFs.exists(dst)) { //remove old local checksum file localFs.delete(dst, true); } Path checksumFile = getChecksumFile(src); if (copyCrc && fs.exists(checksumFile)) { //copy checksum file fs.copyToLocalFile(checksumFile, dst); } } else { FileStatus[] srcs = listStatus(src); for (FileStatus srcFile : srcs) { copyToLocalFile(srcFile.getPath(), new Path(dst, srcFile.getPath().getName()), copyCrc); } } }
[ "public", "void", "copyToLocalFile", "(", "Path", "src", ",", "Path", "dst", ",", "boolean", "copyCrc", ")", "throws", "IOException", "{", "if", "(", "!", "fs", ".", "isDirectory", "(", "src", ")", ")", "{", "// source is a file", "fs", ".", "copyToLocalFi...
The src file is under FS, and the dst is on the local disk. Copy it from FS control to the local dst name. If src and dst are directories, the copyCrc parameter determines whether to copy CRC files.
[ "The", "src", "file", "is", "under", "FS", "and", "the", "dst", "is", "on", "the", "local", "disk", ".", "Copy", "it", "from", "FS", "control", "to", "the", "local", "dst", "name", ".", "If", "src", "and", "dst", "are", "directories", "the", "copyCrc...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java#L547-L570
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java
AuditNotifier.getMetricUrl
protected String getMetricUrl(String metricToAnnotate, long triggerFiredTime) { long start = triggerFiredTime - (6L * DateTimeConstants.MILLIS_PER_HOUR); long end = Math.min(System.currentTimeMillis(), triggerFiredTime + (6L * DateTimeConstants.MILLIS_PER_HOUR)); String expression = MessageFormat.format("{0,number,#}:{1,number,#}:{2}", start, end, metricToAnnotate); return getExpressionUrl(expression); }
java
protected String getMetricUrl(String metricToAnnotate, long triggerFiredTime) { long start = triggerFiredTime - (6L * DateTimeConstants.MILLIS_PER_HOUR); long end = Math.min(System.currentTimeMillis(), triggerFiredTime + (6L * DateTimeConstants.MILLIS_PER_HOUR)); String expression = MessageFormat.format("{0,number,#}:{1,number,#}:{2}", start, end, metricToAnnotate); return getExpressionUrl(expression); }
[ "protected", "String", "getMetricUrl", "(", "String", "metricToAnnotate", ",", "long", "triggerFiredTime", ")", "{", "long", "start", "=", "triggerFiredTime", "-", "(", "6L", "*", "DateTimeConstants", ".", "MILLIS_PER_HOUR", ")", ";", "long", "end", "=", "Math",...
Returns the URL linking back to the metric for use in alert notification. @param metricToAnnotate The metric to annotate. @param triggerFiredTime The epoch timestamp when the corresponding trigger fired. @return The fully constructed URL for the metric.
[ "Returns", "the", "URL", "linking", "back", "to", "the", "metric", "for", "use", "in", "alert", "notification", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java#L217-L222
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/optimization/QNMinimizer.java
QNMinimizer.computeDir
private void computeDir(double[] dir, double[] fg, QNInfo qn) throws SurpriseConvergence { System.arraycopy(fg, 0, dir, 0, fg.length); int mmm = qn.size(); double[] as = new double[mmm]; for (int i = mmm - 1; i >= 0; i--) { as[i] = qn.getRho(i) * ArrayMath.innerProduct(qn.getS(i), dir); plusAndConstMult(dir, qn.getY(i), -as[i], dir); } // multiply by hessian approximation qn.applyInitialHessian(dir); for (int i = 0; i < mmm; i++) { double b = qn.getRho(i) * ArrayMath.innerProduct(qn.getY(i), dir); plusAndConstMult(dir, qn.getS(i), as[i] - b, dir); } ArrayMath.multiplyInPlace(dir, -1); }
java
private void computeDir(double[] dir, double[] fg, QNInfo qn) throws SurpriseConvergence { System.arraycopy(fg, 0, dir, 0, fg.length); int mmm = qn.size(); double[] as = new double[mmm]; for (int i = mmm - 1; i >= 0; i--) { as[i] = qn.getRho(i) * ArrayMath.innerProduct(qn.getS(i), dir); plusAndConstMult(dir, qn.getY(i), -as[i], dir); } // multiply by hessian approximation qn.applyInitialHessian(dir); for (int i = 0; i < mmm; i++) { double b = qn.getRho(i) * ArrayMath.innerProduct(qn.getY(i), dir); plusAndConstMult(dir, qn.getS(i), as[i] - b, dir); } ArrayMath.multiplyInPlace(dir, -1); }
[ "private", "void", "computeDir", "(", "double", "[", "]", "dir", ",", "double", "[", "]", "fg", ",", "QNInfo", "qn", ")", "throws", "SurpriseConvergence", "{", "System", ".", "arraycopy", "(", "fg", ",", "0", ",", "dir", ",", "0", ",", "fg", ".", "...
/* computeDir() This function will calculate an approximation of the inverse hessian based off the seen s,y vector pairs. This particular approximation uses the BFGS update.
[ "/", "*", "computeDir", "()" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/optimization/QNMinimizer.java#L771-L792
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxOfflineRouter.java
MapboxOfflineRouter.findRoute
public void findRoute(@NonNull OfflineRoute route, OnOfflineRouteFoundCallback callback) { offlineNavigator.retrieveRouteFor(route, callback); }
java
public void findRoute(@NonNull OfflineRoute route, OnOfflineRouteFoundCallback callback) { offlineNavigator.retrieveRouteFor(route, callback); }
[ "public", "void", "findRoute", "(", "@", "NonNull", "OfflineRoute", "route", ",", "OnOfflineRouteFoundCallback", "callback", ")", "{", "offlineNavigator", ".", "retrieveRouteFor", "(", "route", ",", "callback", ")", ";", "}" ]
Uses libvalhalla and local tile data to generate mapbox-directions-api-like JSON. @param route the {@link OfflineRoute} to get a {@link DirectionsRoute} from @param callback a callback to pass back the result
[ "Uses", "libvalhalla", "and", "local", "tile", "data", "to", "generate", "mapbox", "-", "directions", "-", "api", "-", "like", "JSON", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxOfflineRouter.java#L67-L69
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/GroovyRowResult.java
GroovyRowResult.getProperty
public Object getProperty(String property) { try { Object key = lookupKeyIgnoringCase(property); if (key != null) { return result.get(key); } throw new MissingPropertyException(property, GroovyRowResult.class); } catch (Exception e) { throw new MissingPropertyException(property, GroovyRowResult.class, e); } }
java
public Object getProperty(String property) { try { Object key = lookupKeyIgnoringCase(property); if (key != null) { return result.get(key); } throw new MissingPropertyException(property, GroovyRowResult.class); } catch (Exception e) { throw new MissingPropertyException(property, GroovyRowResult.class, e); } }
[ "public", "Object", "getProperty", "(", "String", "property", ")", "{", "try", "{", "Object", "key", "=", "lookupKeyIgnoringCase", "(", "property", ")", ";", "if", "(", "key", "!=", "null", ")", "{", "return", "result", ".", "get", "(", "key", ")", ";"...
Retrieve the value of the property by its (case-insensitive) name. @param property is the name of the property to look at @return the value of the property
[ "Retrieve", "the", "value", "of", "the", "property", "by", "its", "(", "case", "-", "insensitive", ")", "name", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/GroovyRowResult.java#L48-L59
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/RuntimeJobExecution.java
RuntimeJobExecution.publishEvent
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo) { if (getBatchEventsPublisher() != null) { getBatchEventsPublisher().publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId); } }
java
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo) { if (getBatchEventsPublisher() != null) { getBatchEventsPublisher().publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId); } }
[ "private", "void", "publishEvent", "(", "WSJobExecution", "objectToPublish", ",", "String", "eventToPublishTo", ")", "{", "if", "(", "getBatchEventsPublisher", "(", ")", "!=", "null", ")", "{", "getBatchEventsPublisher", "(", ")", ".", "publishJobExecutionEvent", "(...
Publish jms topic if batch jms event is available @param objectToPublish WSJobExecution @param eventToPublish
[ "Publish", "jms", "topic", "if", "batch", "jms", "event", "is", "available" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/execution/impl/RuntimeJobExecution.java#L163-L167
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.deleteResource
protected void deleteResource(final String uuid) throws FlexiantException { try { final Job job = this.getService().deleteResource(uuid, true, null); this.waitForJob(job); } catch (ExtilityException e) { throw new FlexiantException("Could not delete resource", e); } }
java
protected void deleteResource(final String uuid) throws FlexiantException { try { final Job job = this.getService().deleteResource(uuid, true, null); this.waitForJob(job); } catch (ExtilityException e) { throw new FlexiantException("Could not delete resource", e); } }
[ "protected", "void", "deleteResource", "(", "final", "String", "uuid", ")", "throws", "FlexiantException", "{", "try", "{", "final", "Job", "job", "=", "this", ".", "getService", "(", ")", ".", "deleteResource", "(", "uuid", ",", "true", ",", "null", ")", ...
Deletes a resource (and all related entities) identified by the given uuid. @param uuid of the resource. @throws FlexiantException if the resource can not be deleted.
[ "Deletes", "a", "resource", "(", "and", "all", "related", "entities", ")", "identified", "by", "the", "given", "uuid", "." ]
train
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L362-L369
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java
EJBJavaColonNamingHelper.processJavaColonGlobal
private Object processJavaColonGlobal(String name) throws NamingException { // Called to ensure that the java:global lookup code path // is coming from a Java EE thread. If not this will reject the // lookup with the correct Java EE error message. getComponentMetaData(JavaColonNamespace.GLOBAL, name); Lock readLock = javaColonLock.readLock(); readLock.lock(); EJBBinding binding; try { binding = javaColonGlobalBindings.lookup(name); } finally { readLock.unlock(); } return processJavaColon(binding, JavaColonNamespace.GLOBAL, name); }
java
private Object processJavaColonGlobal(String name) throws NamingException { // Called to ensure that the java:global lookup code path // is coming from a Java EE thread. If not this will reject the // lookup with the correct Java EE error message. getComponentMetaData(JavaColonNamespace.GLOBAL, name); Lock readLock = javaColonLock.readLock(); readLock.lock(); EJBBinding binding; try { binding = javaColonGlobalBindings.lookup(name); } finally { readLock.unlock(); } return processJavaColon(binding, JavaColonNamespace.GLOBAL, name); }
[ "private", "Object", "processJavaColonGlobal", "(", "String", "name", ")", "throws", "NamingException", "{", "// Called to ensure that the java:global lookup code path", "// is coming from a Java EE thread. If not this will reject the", "// lookup with the correct Java EE error message.", ...
This method process lookup requests for java:global. @param name @param cmd @return the EJB object instance. @throws NamingException
[ "This", "method", "process", "lookup", "requests", "for", "java", ":", "global", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L171-L187
lucasr/probe
library/src/main/java/org/lucasr/probe/Interceptor.java
Interceptor.invokeOnDraw
protected final void invokeOnDraw(View view, Canvas canvas) { final ViewProxy proxy = (ViewProxy) view; proxy.invokeOnDraw(canvas); }
java
protected final void invokeOnDraw(View view, Canvas canvas) { final ViewProxy proxy = (ViewProxy) view; proxy.invokeOnDraw(canvas); }
[ "protected", "final", "void", "invokeOnDraw", "(", "View", "view", ",", "Canvas", "canvas", ")", "{", "final", "ViewProxy", "proxy", "=", "(", "ViewProxy", ")", "view", ";", "proxy", ".", "invokeOnDraw", "(", "canvas", ")", ";", "}" ]
Performs an {@link View#onDraw(Canvas)} call on the given {@link View}.
[ "Performs", "an", "{" ]
train
https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/Interceptor.java#L107-L110
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java
JSONArray.optDouble
public double optDouble(int index, double fallback) { Object object = opt(index); Double result = JSON.toDouble(object); return result != null ? result : fallback; }
java
public double optDouble(int index, double fallback) { Object object = opt(index); Double result = JSON.toDouble(object); return result != null ? result : fallback; }
[ "public", "double", "optDouble", "(", "int", "index", ",", "double", "fallback", ")", "{", "Object", "object", "=", "opt", "(", "index", ")", ";", "Double", "result", "=", "JSON", ".", "toDouble", "(", "object", ")", ";", "return", "result", "!=", "nul...
Returns the value at {@code index} if it exists and is a double or can be coerced to a double. Returns {@code fallback} otherwise. @param index the index to get the value from @param fallback the fallback value @return the value at {@code index} of {@code fallback}
[ "Returns", "the", "value", "at", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L396-L400
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.newInstance
public static <T> T newInstance(final Class<T> clas, final Object... params) { try { final Class<?>[] paramClasses = JKObjectUtil.toClassesFromObjects(params); if (paramClasses.length == 0) { return clas.newInstance(); } return ConstructorUtils.invokeConstructor(clas, params); } catch (final Exception e) { throw new RuntimeException(e); } }
java
public static <T> T newInstance(final Class<T> clas, final Object... params) { try { final Class<?>[] paramClasses = JKObjectUtil.toClassesFromObjects(params); if (paramClasses.length == 0) { return clas.newInstance(); } return ConstructorUtils.invokeConstructor(clas, params); } catch (final Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "<", "T", ">", "T", "newInstance", "(", "final", "Class", "<", "T", ">", "clas", ",", "final", "Object", "...", "params", ")", "{", "try", "{", "final", "Class", "<", "?", ">", "[", "]", "paramClasses", "=", "JKObjectUtil", ".", ...
New instance. @param <T> the generic type @param clas the clas @param params the params @return the t
[ "New", "instance", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L224-L234
foundation-runtime/service-directory
2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java
HttpUtils.getJson
public static HttpResponse getJson(String urlStr) throws IOException { URL url = new URL(urlStr); HttpURLConnection urlConnection = (HttpURLConnection) url .openConnection(); urlConnection.addRequestProperty("Accept", "application/json"); BufferedReader in = null; try { int errorCode = urlConnection.getResponseCode(); if ((errorCode <= 202) && (errorCode >= 200)) { in = new BufferedReader(new InputStreamReader( urlConnection.getInputStream())); } else { InputStream error = urlConnection.getErrorStream(); if (error != null) { in = new BufferedReader(new InputStreamReader(error)); } } String json = null; if(in != null){ json = CharStreams.toString(in); } return new HttpResponse(errorCode, json); } finally { if(in != null){ in.close(); } } }
java
public static HttpResponse getJson(String urlStr) throws IOException { URL url = new URL(urlStr); HttpURLConnection urlConnection = (HttpURLConnection) url .openConnection(); urlConnection.addRequestProperty("Accept", "application/json"); BufferedReader in = null; try { int errorCode = urlConnection.getResponseCode(); if ((errorCode <= 202) && (errorCode >= 200)) { in = new BufferedReader(new InputStreamReader( urlConnection.getInputStream())); } else { InputStream error = urlConnection.getErrorStream(); if (error != null) { in = new BufferedReader(new InputStreamReader(error)); } } String json = null; if(in != null){ json = CharStreams.toString(in); } return new HttpResponse(errorCode, json); } finally { if(in != null){ in.close(); } } }
[ "public", "static", "HttpResponse", "getJson", "(", "String", "urlStr", ")", "throws", "IOException", "{", "URL", "url", "=", "new", "URL", "(", "urlStr", ")", ";", "HttpURLConnection", "urlConnection", "=", "(", "HttpURLConnection", ")", "url", ".", "openConn...
Invoke REST Service using GET method. @param urlStr the REST service URL String. @return the HttpResponse. @throws IOException
[ "Invoke", "REST", "Service", "using", "GET", "method", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java#L193-L222
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java
BigIntegerExtensions.operator_plus
@Inline(value="$1.add($2)") @Pure public static BigInteger operator_plus(BigInteger a, BigInteger b) { return a.add(b); }
java
@Inline(value="$1.add($2)") @Pure public static BigInteger operator_plus(BigInteger a, BigInteger b) { return a.add(b); }
[ "@", "Inline", "(", "value", "=", "\"$1.add($2)\"", ")", "@", "Pure", "public", "static", "BigInteger", "operator_plus", "(", "BigInteger", "a", ",", "BigInteger", "b", ")", "{", "return", "a", ".", "add", "(", "b", ")", ";", "}" ]
The binary <code>plus</code> operator. @param a a BigInteger. May not be <code>null</code>. @param b a BigInteger. May not be <code>null</code>. @return <code>a.add(b)</code> @throws NullPointerException if {@code a} or {@code b} is <code>null</code>.
[ "The", "binary", "<code", ">", "plus<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java#L48-L52
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAsymmetricObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAsymmetricObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLAsymmetricObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAsymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java#L94-L97
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableUtils.java
PortableUtils.getArrayLengthOfTheField
static int getArrayLengthOfTheField(FieldDefinition fd, BufferObjectDataInput in, int offset) throws IOException { int originalPos = in.position(); try { int pos = getStreamPositionOfTheField(fd, in, offset); in.position(pos); return in.readInt(); } finally { in.position(originalPos); } }
java
static int getArrayLengthOfTheField(FieldDefinition fd, BufferObjectDataInput in, int offset) throws IOException { int originalPos = in.position(); try { int pos = getStreamPositionOfTheField(fd, in, offset); in.position(pos); return in.readInt(); } finally { in.position(originalPos); } }
[ "static", "int", "getArrayLengthOfTheField", "(", "FieldDefinition", "fd", ",", "BufferObjectDataInput", "in", ",", "int", "offset", ")", "throws", "IOException", "{", "int", "originalPos", "=", "in", ".", "position", "(", ")", ";", "try", "{", "int", "pos", ...
Reads the length of the given array. It does not validate if the current position is actually an array - has to be taken care of by the caller. @param fd field of the array @param in data input stream @param offset offset to use while stream reading @return length of the array @throws IOException on any stream errors
[ "Reads", "the", "length", "of", "the", "given", "array", ".", "It", "does", "not", "validate", "if", "the", "current", "position", "is", "actually", "an", "array", "-", "has", "to", "be", "taken", "care", "of", "by", "the", "caller", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableUtils.java#L96-L105
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/AdjustedRangeInputStream.java
AdjustedRangeInputStream.initializeForRead
private void initializeForRead(long rangeBeginning, long rangeEnd) throws IOException { // To get to the left-most byte desired by a user, we must skip over the 16 bytes of the // preliminary cipher block, and then possibly skip a few more bytes into the next block // to where the the left-most byte is located. int numBytesToSkip; if(rangeBeginning < JceEncryptionConstants.SYMMETRIC_CIPHER_BLOCK_SIZE) { numBytesToSkip = (int)rangeBeginning; } else { int offsetIntoBlock = (int)(rangeBeginning % JceEncryptionConstants.SYMMETRIC_CIPHER_BLOCK_SIZE); numBytesToSkip = JceEncryptionConstants.SYMMETRIC_CIPHER_BLOCK_SIZE + offsetIntoBlock; } if(numBytesToSkip != 0) { // Skip to the left-most desired byte. The read() method is used instead of the skip() method // since the skip() method will not block if the underlying input stream is waiting for more input. while(numBytesToSkip > 0) { this.decryptedContents.read(); numBytesToSkip--; } } // The number of bytes the user may read is equal to the number of the bytes in the range. // Note that the range includes the endpoints. this.virtualAvailable = (rangeEnd - rangeBeginning) + 1; }
java
private void initializeForRead(long rangeBeginning, long rangeEnd) throws IOException { // To get to the left-most byte desired by a user, we must skip over the 16 bytes of the // preliminary cipher block, and then possibly skip a few more bytes into the next block // to where the the left-most byte is located. int numBytesToSkip; if(rangeBeginning < JceEncryptionConstants.SYMMETRIC_CIPHER_BLOCK_SIZE) { numBytesToSkip = (int)rangeBeginning; } else { int offsetIntoBlock = (int)(rangeBeginning % JceEncryptionConstants.SYMMETRIC_CIPHER_BLOCK_SIZE); numBytesToSkip = JceEncryptionConstants.SYMMETRIC_CIPHER_BLOCK_SIZE + offsetIntoBlock; } if(numBytesToSkip != 0) { // Skip to the left-most desired byte. The read() method is used instead of the skip() method // since the skip() method will not block if the underlying input stream is waiting for more input. while(numBytesToSkip > 0) { this.decryptedContents.read(); numBytesToSkip--; } } // The number of bytes the user may read is equal to the number of the bytes in the range. // Note that the range includes the endpoints. this.virtualAvailable = (rangeEnd - rangeBeginning) + 1; }
[ "private", "void", "initializeForRead", "(", "long", "rangeBeginning", ",", "long", "rangeEnd", ")", "throws", "IOException", "{", "// To get to the left-most byte desired by a user, we must skip over the 16 bytes of the", "// preliminary cipher block, and then possibly skip a few more b...
Skip to the start location of the range of bytes desired by the user.
[ "Skip", "to", "the", "start", "location", "of", "the", "range", "of", "bytes", "desired", "by", "the", "user", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/AdjustedRangeInputStream.java#L52-L74
stephenc/simple-java-mail
src/main/java/org/codemonkey/simplejavamail/Email.java
Email.setFromAddress
public void setFromAddress(final String name, final String fromAddress) { fromRecipient = new Recipient(name, fromAddress, null); }
java
public void setFromAddress(final String name, final String fromAddress) { fromRecipient = new Recipient(name, fromAddress, null); }
[ "public", "void", "setFromAddress", "(", "final", "String", "name", ",", "final", "String", "fromAddress", ")", "{", "fromRecipient", "=", "new", "Recipient", "(", "name", ",", "fromAddress", ",", "null", ")", ";", "}" ]
Sets the sender address. @param name The sender's name. @param fromAddress The sender's email address.
[ "Sets", "the", "sender", "address", "." ]
train
https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Email.java#L64-L66
jhalterman/failsafe
src/main/java/net/jodah/failsafe/FailsafeExecutor.java
FailsafeExecutor.getStageAsyncExecution
public <T extends R> CompletableFuture<T> getStageAsyncExecution( AsyncSupplier<? extends CompletionStage<T>> supplier) { return callAsync(execution -> Functions.asyncOfFutureExecution(supplier, execution), true); }
java
public <T extends R> CompletableFuture<T> getStageAsyncExecution( AsyncSupplier<? extends CompletionStage<T>> supplier) { return callAsync(execution -> Functions.asyncOfFutureExecution(supplier, execution), true); }
[ "public", "<", "T", "extends", "R", ">", "CompletableFuture", "<", "T", ">", "getStageAsyncExecution", "(", "AsyncSupplier", "<", "?", "extends", "CompletionStage", "<", "T", ">", ">", "supplier", ")", "{", "return", "callAsync", "(", "execution", "->", "Fun...
Executes the {@code supplier} asynchronously until the resulting future is successfully completed or the configured policies are exceeded. This method is intended for integration with asynchronous code. Retries must be manually scheduled via one of the {@code AsyncExecution.retry} methods. <p> If a configured circuit breaker is open, the resulting future is completed exceptionally with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code supplier} is null @throws RejectedExecutionException if the {@code supplier} cannot be scheduled for execution
[ "Executes", "the", "{", "@code", "supplier", "}", "asynchronously", "until", "the", "resulting", "future", "is", "successfully", "completed", "or", "the", "configured", "policies", "are", "exceeded", ".", "This", "method", "is", "intended", "for", "integration", ...
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L203-L206
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Header.java
Header.setPubTypeList
public void setPubTypeList(int i, PubType v) { if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_pubTypeList == null) jcasType.jcas.throwFeatMissing("pubTypeList", "de.julielab.jules.types.Header"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_pubTypeList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_pubTypeList), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setPubTypeList(int i, PubType v) { if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_pubTypeList == null) jcasType.jcas.throwFeatMissing("pubTypeList", "de.julielab.jules.types.Header"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_pubTypeList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_pubTypeList), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setPubTypeList", "(", "int", "i", ",", "PubType", "v", ")", "{", "if", "(", "Header_Type", ".", "featOkTst", "&&", "(", "(", "Header_Type", ")", "jcasType", ")", ".", "casFeat_pubTypeList", "==", "null", ")", "jcasType", ".", "jcas", "...
indexed setter for pubTypeList - sets an indexed value - The list of the publication types, O @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "pubTypeList", "-", "sets", "an", "indexed", "value", "-", "The", "list", "of", "the", "publication", "types", "O" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Header.java#L292-L296
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.listPoliciesAsync
public Observable<RegistryPoliciesInner> listPoliciesAsync(String resourceGroupName, String registryName) { return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1<ServiceResponse<RegistryPoliciesInner>, RegistryPoliciesInner>() { @Override public RegistryPoliciesInner call(ServiceResponse<RegistryPoliciesInner> response) { return response.body(); } }); }
java
public Observable<RegistryPoliciesInner> listPoliciesAsync(String resourceGroupName, String registryName) { return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1<ServiceResponse<RegistryPoliciesInner>, RegistryPoliciesInner>() { @Override public RegistryPoliciesInner call(ServiceResponse<RegistryPoliciesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RegistryPoliciesInner", ">", "listPoliciesAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ")", "{", "return", "listPoliciesWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ")", ".", "map", ...
Lists the policies for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegistryPoliciesInner object
[ "Lists", "the", "policies", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L1516-L1523
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.zremrangeByRank
@Override public Long zremrangeByRank(final byte[] key, final long start, final long stop) { checkIsInMultiOrPipeline(); client.zremrangeByRank(key, start, stop); return client.getIntegerReply(); }
java
@Override public Long zremrangeByRank(final byte[] key, final long start, final long stop) { checkIsInMultiOrPipeline(); client.zremrangeByRank(key, start, stop); return client.getIntegerReply(); }
[ "@", "Override", "public", "Long", "zremrangeByRank", "(", "final", "byte", "[", "]", "key", ",", "final", "long", "start", ",", "final", "long", "stop", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "zremrangeByRank", "(", "key", ","...
Remove all elements in the sorted set at key with rank between start and end. Start and end are 0-based with rank 0 being the element with the lowest score. Both start and end can be negative numbers, where they indicate offsets starting at the element with the highest rank. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth. <p> <b>Time complexity:</b> O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of elements removed by the operation @param key @param start @param stop @return
[ "Remove", "all", "elements", "in", "the", "sorted", "set", "at", "key", "with", "rank", "between", "start", "and", "end", ".", "Start", "and", "end", "are", "0", "-", "based", "with", "rank", "0", "being", "the", "element", "with", "the", "lowest", "sc...
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L2587-L2592
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceInfoMap.java
SourceInfoMap.parseVersionNumber
private static String parseVersionNumber(String line) { StringTokenizer tokenizer = new StringTokenizer(line, " \t"); if (!expect(tokenizer, "sourceInfo") || !expect(tokenizer, "version") || !tokenizer.hasMoreTokens()) { return null; } return tokenizer.nextToken(); }
java
private static String parseVersionNumber(String line) { StringTokenizer tokenizer = new StringTokenizer(line, " \t"); if (!expect(tokenizer, "sourceInfo") || !expect(tokenizer, "version") || !tokenizer.hasMoreTokens()) { return null; } return tokenizer.nextToken(); }
[ "private", "static", "String", "parseVersionNumber", "(", "String", "line", ")", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "line", ",", "\" \\t\"", ")", ";", "if", "(", "!", "expect", "(", "tokenizer", ",", "\"sourceInfo\"", ")",...
Parse the sourceInfo version string. @param line the first line of the sourceInfo file @return the version number constant, or null if the line does not appear to be a version string
[ "Parse", "the", "sourceInfo", "version", "string", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceInfoMap.java#L433-L441
CloudSlang/cs-actions
cs-couchbase/src/main/java/io/cloudslang/content/couchbase/utils/InputsUtil.java
InputsUtil.getEnforcedBooleanCondition
public static boolean getEnforcedBooleanCondition(String input, boolean enforcedBoolean) { return (enforcedBoolean) ? isValid(input) == parseBoolean(input) : parseBoolean(input); }
java
public static boolean getEnforcedBooleanCondition(String input, boolean enforcedBoolean) { return (enforcedBoolean) ? isValid(input) == parseBoolean(input) : parseBoolean(input); }
[ "public", "static", "boolean", "getEnforcedBooleanCondition", "(", "String", "input", ",", "boolean", "enforcedBoolean", ")", "{", "return", "(", "enforcedBoolean", ")", "?", "isValid", "(", "input", ")", "==", "parseBoolean", "(", "input", ")", ":", "parseBoole...
If enforcedBoolean is "true" and string input is: null, empty, many empty chars, TrUe, tRuE... but not "false" then returns "true". If enforcedBoolean is "false" and string input is: null, empty, many empty chars, FaLsE, fAlSe... but not "true" then returns "false" This behavior is needed for inputs like: "imageNoReboot" when we want them to be set to "true" disregarding the value provided (null, empty, many empty chars, TrUe, tRuE) except the case when is "false" @param input String to be evaluated. @param enforcedBoolean Enforcement boolean. @return A boolean according with above description.
[ "If", "enforcedBoolean", "is", "true", "and", "string", "input", "is", ":", "null", "empty", "many", "empty", "chars", "TrUe", "tRuE", "...", "but", "not", "false", "then", "returns", "true", ".", "If", "enforcedBoolean", "is", "false", "and", "string", "i...
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-couchbase/src/main/java/io/cloudslang/content/couchbase/utils/InputsUtil.java#L169-L171
uber/NullAway
nullaway/src/main/java/com/uber/nullaway/NullAway.java
NullAway.doUnboxingCheck
private Description doUnboxingCheck(VisitorState state, ExpressionTree... expressions) { for (ExpressionTree tree : expressions) { Type type = ASTHelpers.getType(tree); if (type == null) { throw new RuntimeException("was not expecting null type"); } if (!type.isPrimitive()) { if (mayBeNullExpr(state, tree)) { final ErrorMessage errorMessage = new ErrorMessage(MessageTypes.UNBOX_NULLABLE, "unboxing of a @Nullable value"); return errorBuilder.createErrorDescription( errorMessage, state.getPath(), buildDescription(tree)); } } } return Description.NO_MATCH; }
java
private Description doUnboxingCheck(VisitorState state, ExpressionTree... expressions) { for (ExpressionTree tree : expressions) { Type type = ASTHelpers.getType(tree); if (type == null) { throw new RuntimeException("was not expecting null type"); } if (!type.isPrimitive()) { if (mayBeNullExpr(state, tree)) { final ErrorMessage errorMessage = new ErrorMessage(MessageTypes.UNBOX_NULLABLE, "unboxing of a @Nullable value"); return errorBuilder.createErrorDescription( errorMessage, state.getPath(), buildDescription(tree)); } } } return Description.NO_MATCH; }
[ "private", "Description", "doUnboxingCheck", "(", "VisitorState", "state", ",", "ExpressionTree", "...", "expressions", ")", "{", "for", "(", "ExpressionTree", "tree", ":", "expressions", ")", "{", "Type", "type", "=", "ASTHelpers", ".", "getType", "(", "tree", ...
if any expression has non-primitive type, we should check that it can't be null as it is getting unboxed @param expressions expressions to check @return error Description if an error is found, otherwise NO_MATCH
[ "if", "any", "expression", "has", "non", "-", "primitive", "type", "we", "should", "check", "that", "it", "can", "t", "be", "null", "as", "it", "is", "getting", "unboxed" ]
train
https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/NullAway.java#L1247-L1263
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FirstNonNullHelper.java
FirstNonNullHelper.firstNonNull
public static <T, R> R firstNonNull(Function<T, R> function, Stream<T> values) { return values .map(function) .filter(Objects::nonNull) .findFirst() .orElse(null); }
java
public static <T, R> R firstNonNull(Function<T, R> function, Stream<T> values) { return values .map(function) .filter(Objects::nonNull) .findFirst() .orElse(null); }
[ "public", "static", "<", "T", ",", "R", ">", "R", "firstNonNull", "(", "Function", "<", "T", ",", "R", ">", "function", ",", "Stream", "<", "T", ">", "values", ")", "{", "return", "values", ".", "map", "(", "function", ")", ".", "filter", "(", "O...
Gets first element which is not null. @param <T> type of values. @param <R> element to return. @param function function to apply to each value. @param values all possible values. @return first result value which was not null, OR <code>null</code> if all values were <code>null</code>.
[ "Gets", "first", "element", "which", "is", "not", "null", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FirstNonNullHelper.java#L94-L100
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.drawImage
public void drawImage (final PDImageXObject image, final float x, final float y) throws IOException { drawImage (image, x, y, image.getWidth (), image.getHeight ()); }
java
public void drawImage (final PDImageXObject image, final float x, final float y) throws IOException { drawImage (image, x, y, image.getWidth (), image.getHeight ()); }
[ "public", "void", "drawImage", "(", "final", "PDImageXObject", "image", ",", "final", "float", "x", ",", "final", "float", "y", ")", "throws", "IOException", "{", "drawImage", "(", "image", ",", "x", ",", "y", ",", "image", ".", "getWidth", "(", ")", "...
Draw an image at the x,y coordinates, with the default size of the image. @param image The image to draw. @param x The x-coordinate to draw the image. @param y The y-coordinate to draw the image. @throws IOException If there is an error writing to the stream.
[ "Draw", "an", "image", "at", "the", "x", "y", "coordinates", "with", "the", "default", "size", "of", "the", "image", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L487-L490
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/impl/EntityKeyBuilder.java
EntityKeyBuilder.fromData
public static EntityKey fromData( EntityKeyMetadata entityKeyMetadata, GridType identifierGridType, final Serializable id, SharedSessionContractImplementor session) { Object[] values = LogicalPhysicalConverterHelper.getColumnsValuesFromObjectValue( id, identifierGridType, entityKeyMetadata.getColumnNames(), session ); return new EntityKey( entityKeyMetadata, values ); }
java
public static EntityKey fromData( EntityKeyMetadata entityKeyMetadata, GridType identifierGridType, final Serializable id, SharedSessionContractImplementor session) { Object[] values = LogicalPhysicalConverterHelper.getColumnsValuesFromObjectValue( id, identifierGridType, entityKeyMetadata.getColumnNames(), session ); return new EntityKey( entityKeyMetadata, values ); }
[ "public", "static", "EntityKey", "fromData", "(", "EntityKeyMetadata", "entityKeyMetadata", ",", "GridType", "identifierGridType", ",", "final", "Serializable", "id", ",", "SharedSessionContractImplementor", "session", ")", "{", "Object", "[", "]", "values", "=", "Log...
static method because the builder pattern version was showing up during profiling
[ "static", "method", "because", "the", "builder", "pattern", "version", "was", "showing", "up", "during", "profiling" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/impl/EntityKeyBuilder.java#L39-L51
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/FormImpl.java
FormImpl.initializeUrlEncodedOrTextPlain
private void initializeUrlEncodedOrTextPlain(PageContext pc, char delimiter, boolean scriptProteced) { BufferedReader reader = null; try { reader = pc.getHttpServletRequest().getReader(); raw = setFrom___(IOUtil.toString(reader, false), delimiter); fillDecoded(raw, encoding, scriptProteced, pc.getApplicationContext().getSameFieldAsArray(SCOPE_FORM)); } catch (Exception e) { Log log = ThreadLocalPageContext.getConfig(pc).getLog("application"); if (log != null) log.error("form.scope", e); fillDecodedEL(new URLItem[0], encoding, scriptProteced, pc.getApplicationContext().getSameFieldAsArray(SCOPE_FORM)); initException = e; } finally { IOUtil.closeEL(reader); } }
java
private void initializeUrlEncodedOrTextPlain(PageContext pc, char delimiter, boolean scriptProteced) { BufferedReader reader = null; try { reader = pc.getHttpServletRequest().getReader(); raw = setFrom___(IOUtil.toString(reader, false), delimiter); fillDecoded(raw, encoding, scriptProteced, pc.getApplicationContext().getSameFieldAsArray(SCOPE_FORM)); } catch (Exception e) { Log log = ThreadLocalPageContext.getConfig(pc).getLog("application"); if (log != null) log.error("form.scope", e); fillDecodedEL(new URLItem[0], encoding, scriptProteced, pc.getApplicationContext().getSameFieldAsArray(SCOPE_FORM)); initException = e; } finally { IOUtil.closeEL(reader); } }
[ "private", "void", "initializeUrlEncodedOrTextPlain", "(", "PageContext", "pc", ",", "char", "delimiter", ",", "boolean", "scriptProteced", ")", "{", "BufferedReader", "reader", "=", "null", ";", "try", "{", "reader", "=", "pc", ".", "getHttpServletRequest", "(", ...
/* private void initializeMultiPart(PageContext pc, boolean scriptProteced) { File tempDir=FileWrapper.toFile(pc.getConfig().getTempDirectory()); // Create a factory for disk-based file items DiskFileItemFactory factory = new DiskFileItemFactory(-1,tempDir); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); upload.setHeaderEncoding(getEncoding()); //FileUpload fileUpload=new FileUpload(new DiskFileItemFactory(0,tempDir)); java.util.List list; try { list = upload.parseRequest(pc.getHttpServletRequest()); raw=new ByteNameValuePair[list.size()]; for(int i=0;i<raw.length;i++) { DiskFileItem val=(DiskFileItem) list.get(i); if(val.isFormField()) { raw[i]=new ByteNameValuePair(getBytes(val.getFieldName()),val.get(),false); } else { print.out("-------------------------------"); print.out("fieldname:"+val.getFieldName()); print.out("name:"+val.getName()); print.out("formfield:"+val.isFormField()); print.out("memory:"+val.isInMemory()); print.out("exist:"+val.getStoreLocation().getCanonicalFile().exists()); fileItems.put(val.getFieldName().toLowerCase(),val); raw[i]=new ByteNameValuePair(getBytes(val.getFieldName()),val.getStoreLocation().getCanonicalFile().toString ().getBytes(),false); //raw.put(val.getFieldName(),val.getStoreLocation().getCanonicalFile().toString()); } } fillDecoded(raw,encoding,scriptProteced); } catch (Exception e) { //throw new PageRuntimeException(Caster.toPageException(e)); fillDecodedEL(new ByteNameValuePair[0],encoding,scriptProteced); initException=e; } }
[ "/", "*", "private", "void", "initializeMultiPart", "(", "PageContext", "pc", "boolean", "scriptProteced", ")", "{" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/FormImpl.java#L251-L267
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.updateMessageStatus
public Observable<ComapiResult<Void>> updateMessageStatus(@NonNull final String conversationId, @NonNull final List<MessageStatusUpdate> msgStatusList) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueUpdateMessageStatus(conversationId, msgStatusList); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doUpdateMessageStatus(token, conversationId, msgStatusList); } }
java
public Observable<ComapiResult<Void>> updateMessageStatus(@NonNull final String conversationId, @NonNull final List<MessageStatusUpdate> msgStatusList) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueUpdateMessageStatus(conversationId, msgStatusList); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doUpdateMessageStatus(token, conversationId, msgStatusList); } }
[ "public", "Observable", "<", "ComapiResult", "<", "Void", ">", ">", "updateMessageStatus", "(", "@", "NonNull", "final", "String", "conversationId", ",", "@", "NonNull", "final", "List", "<", "MessageStatusUpdate", ">", "msgStatusList", ")", "{", "final", "Strin...
Sets statuses for sets of messages. @param conversationId ID of a conversation to modify. @param msgStatusList List of status modifications. @return Observable to modify message statuses.
[ "Sets", "statuses", "for", "sets", "of", "messages", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L783-L794
JM-Lab/utils-java8
src/main/java/kr/jm/utils/datastructure/JMMap.java
JMMap.newFilteredChangedValueWithEntryMap
public static <K, V, NV> Map<K, NV> newFilteredChangedValueWithEntryMap( Map<K, V> map, Predicate<Entry<K, V>> filter, Function<Entry<K, V>, NV> changingValueFunction) { return getEntryStreamWithFilter(map, filter).collect( toMap(Entry::getKey, changingValueFunction::apply)); }
java
public static <K, V, NV> Map<K, NV> newFilteredChangedValueWithEntryMap( Map<K, V> map, Predicate<Entry<K, V>> filter, Function<Entry<K, V>, NV> changingValueFunction) { return getEntryStreamWithFilter(map, filter).collect( toMap(Entry::getKey, changingValueFunction::apply)); }
[ "public", "static", "<", "K", ",", "V", ",", "NV", ">", "Map", "<", "K", ",", "NV", ">", "newFilteredChangedValueWithEntryMap", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Predicate", "<", "Entry", "<", "K", ",", "V", ">", ">", "filter", ",...
New filtered changed value with entry map map. @param <K> the type parameter @param <V> the type parameter @param <NV> the type parameter @param map the map @param filter the filter @param changingValueFunction the changing value function @return the map
[ "New", "filtered", "changed", "value", "with", "entry", "map", "map", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/datastructure/JMMap.java#L286-L291
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.deleteAddOn
public void deleteAddOn(final String planCode, final String addOnCode) { doDELETE(Plan.PLANS_RESOURCE + "/" + planCode + AddOn.ADDONS_RESOURCE + "/" + addOnCode); }
java
public void deleteAddOn(final String planCode, final String addOnCode) { doDELETE(Plan.PLANS_RESOURCE + "/" + planCode + AddOn.ADDONS_RESOURCE + "/" + addOnCode); }
[ "public", "void", "deleteAddOn", "(", "final", "String", "planCode", ",", "final", "String", "addOnCode", ")", "{", "doDELETE", "(", "Plan", ".", "PLANS_RESOURCE", "+", "\"/\"", "+", "planCode", "+", "AddOn", ".", "ADDONS_RESOURCE", "+", "\"/\"", "+", "addOn...
Deletes an {@link AddOn} for a Plan <p> @param planCode The {@link Plan} object. @param addOnCode The {@link AddOn} object to delete.
[ "Deletes", "an", "{", "@link", "AddOn", "}", "for", "a", "Plan", "<p", ">" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1506-L1513
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setIcon
public static boolean setIcon(MarkerOptions markerOptions, IconRow icon, float density, IconCache iconCache) { boolean iconSet = false; if (icon != null) { Bitmap iconImage = createIcon(icon, density, iconCache); markerOptions.icon(BitmapDescriptorFactory .fromBitmap(iconImage)); iconSet = true; double anchorU = icon.getAnchorUOrDefault(); double anchorV = icon.getAnchorVOrDefault(); markerOptions.anchor((float) anchorU, (float) anchorV); } return iconSet; }
java
public static boolean setIcon(MarkerOptions markerOptions, IconRow icon, float density, IconCache iconCache) { boolean iconSet = false; if (icon != null) { Bitmap iconImage = createIcon(icon, density, iconCache); markerOptions.icon(BitmapDescriptorFactory .fromBitmap(iconImage)); iconSet = true; double anchorU = icon.getAnchorUOrDefault(); double anchorV = icon.getAnchorVOrDefault(); markerOptions.anchor((float) anchorU, (float) anchorV); } return iconSet; }
[ "public", "static", "boolean", "setIcon", "(", "MarkerOptions", "markerOptions", ",", "IconRow", "icon", ",", "float", "density", ",", "IconCache", "iconCache", ")", "{", "boolean", "iconSet", "=", "false", ";", "if", "(", "icon", "!=", "null", ")", "{", "...
Set the icon into the marker options @param markerOptions marker options @param icon icon row @param density display density: {@link android.util.DisplayMetrics#density} @param iconCache icon cache @return true if icon was set into the marker options
[ "Set", "the", "icon", "into", "the", "marker", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L264-L282
OpenLiberty/open-liberty
dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java
JSFUtils.createHttpUrlString
public static String createHttpUrlString(LibertyServer server, String contextRoot, String path) { StringBuilder sb = new StringBuilder(); sb.append("http://") .append(server.getHostname()) .append(":") .append(server.getHttpDefaultPort()) .append("/") .append(contextRoot) .append("/") .append(path); return sb.toString(); }
java
public static String createHttpUrlString(LibertyServer server, String contextRoot, String path) { StringBuilder sb = new StringBuilder(); sb.append("http://") .append(server.getHostname()) .append(":") .append(server.getHttpDefaultPort()) .append("/") .append(contextRoot) .append("/") .append(path); return sb.toString(); }
[ "public", "static", "String", "createHttpUrlString", "(", "LibertyServer", "server", ",", "String", "contextRoot", ",", "String", "path", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"http://\"", ")",...
Construct a URL for a test case so a request can be made. @param server - The server that is under test, this is used to get the port and host name. @param contextRoot - The context root of the application @param path - Additional path information for the request. @return - A fully formed URL string. @throws Exception
[ "Construct", "a", "URL", "for", "a", "test", "case", "so", "a", "request", "can", "be", "made", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java#L49-L62
yidongnan/grpc-spring-boot-starter
grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/security/CallCredentialsHelper.java
CallCredentialsHelper.encodeBasicAuth
public static String encodeBasicAuth(final String username, final String password) { requireNonNull(username, "username"); requireNonNull(password, "password"); final String auth = username + ':' + password; byte[] encoded; try { encoded = Base64.getEncoder().encode(auth.getBytes(UTF_8)); } catch (final IllegalArgumentException e) { throw new IllegalArgumentException("Failed to encode basic authentication token", e); } return BASIC_AUTH_PREFIX + new String(encoded, UTF_8); }
java
public static String encodeBasicAuth(final String username, final String password) { requireNonNull(username, "username"); requireNonNull(password, "password"); final String auth = username + ':' + password; byte[] encoded; try { encoded = Base64.getEncoder().encode(auth.getBytes(UTF_8)); } catch (final IllegalArgumentException e) { throw new IllegalArgumentException("Failed to encode basic authentication token", e); } return BASIC_AUTH_PREFIX + new String(encoded, UTF_8); }
[ "public", "static", "String", "encodeBasicAuth", "(", "final", "String", "username", ",", "final", "String", "password", ")", "{", "requireNonNull", "(", "username", ",", "\"username\"", ")", ";", "requireNonNull", "(", "password", ",", "\"password\"", ")", ";",...
Encodes the given username and password as basic auth. The header value will be encoded with {@link StandardCharsets#UTF_8 UTF_8}. @param username The username to use. @param password The password to use. @return The encoded basic auth header value.
[ "Encodes", "the", "given", "username", "and", "password", "as", "basic", "auth", ".", "The", "header", "value", "will", "be", "encoded", "with", "{", "@link", "StandardCharsets#UTF_8", "UTF_8", "}", "." ]
train
https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/security/CallCredentialsHelper.java#L201-L212
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.newObjectInputStream
public static ObjectInputStream newObjectInputStream(File file, final ClassLoader classLoader) throws IOException { return IOGroovyMethods.newObjectInputStream(new FileInputStream(file), classLoader); }
java
public static ObjectInputStream newObjectInputStream(File file, final ClassLoader classLoader) throws IOException { return IOGroovyMethods.newObjectInputStream(new FileInputStream(file), classLoader); }
[ "public", "static", "ObjectInputStream", "newObjectInputStream", "(", "File", "file", ",", "final", "ClassLoader", "classLoader", ")", "throws", "IOException", "{", "return", "IOGroovyMethods", ".", "newObjectInputStream", "(", "new", "FileInputStream", "(", "file", "...
Create an object input stream for this file using the given class loader. @param file a file @param classLoader the class loader to use when loading the class @return an object input stream @throws IOException if an IOException occurs. @since 1.5.0
[ "Create", "an", "object", "input", "stream", "for", "this", "file", "using", "the", "given", "class", "loader", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L174-L176
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/ReflectionUtil.java
ReflectionUtil.getAnnotation
public static <T extends Annotation> T getAnnotation(Method method, Class<T> type) { for (Annotation a : getAnnotations(method)) { if (type.isInstance(a)) { return type.cast(a); } } return null; }
java
public static <T extends Annotation> T getAnnotation(Method method, Class<T> type) { for (Annotation a : getAnnotations(method)) { if (type.isInstance(a)) { return type.cast(a); } } return null; }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "T", "getAnnotation", "(", "Method", "method", ",", "Class", "<", "T", ">", "type", ")", "{", "for", "(", "Annotation", "a", ":", "getAnnotations", "(", "method", ")", ")", "{", "if", "(", "...
Returns the first {@link Annotation} of the given type defined on the given {@link Method}. @param <T> the type @param method the method @param type the type of annotation @return the annotation or null
[ "Returns", "the", "first", "{", "@link", "Annotation", "}", "of", "the", "given", "type", "defined", "on", "the", "given", "{", "@link", "Method", "}", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/ReflectionUtil.java#L134-L141
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java
MultiPartFaxJob2HTTPRequestConverter.addAdditionalContentParts
protected void addAdditionalContentParts(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob,List<ContentPart<?>> contentList) { //empty hook for extending classes }
java
protected void addAdditionalContentParts(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob,List<ContentPart<?>> contentList) { //empty hook for extending classes }
[ "protected", "void", "addAdditionalContentParts", "(", "HTTPFaxClientSpi", "faxClientSpi", ",", "FaxActionType", "faxActionType", ",", "FaxJob", "faxJob", ",", "List", "<", "ContentPart", "<", "?", ">", ">", "contentList", ")", "{", "//empty hook for extending classes",...
This function enables extending classes to add additional content parts. @param faxClientSpi The HTTP fax client SPI @param faxActionType The fax action type @param faxJob The fax job object @param contentList The content list with all the created parts
[ "This", "function", "enables", "extending", "classes", "to", "add", "additional", "content", "parts", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/MultiPartFaxJob2HTTPRequestConverter.java#L566-L569
mgormley/pacaya
src/main/java/edu/jhu/pacaya/util/cli/ArgParser.java
ArgParser.addFlagFileOption
private void addFlagFileOption() { String name = "flagfile"; String shortName = getAndAddUniqueShortName(name); String description = "Special flag: file from which to read additional flags" + " (lines starting with # are ignored as comments," + " and these flags are always processed before those on the command line)."; flagfileOpt = new Option(shortName, name, true, description); flagfileOpt.setRequired(false); options.addOption(flagfileOpt); }
java
private void addFlagFileOption() { String name = "flagfile"; String shortName = getAndAddUniqueShortName(name); String description = "Special flag: file from which to read additional flags" + " (lines starting with # are ignored as comments," + " and these flags are always processed before those on the command line)."; flagfileOpt = new Option(shortName, name, true, description); flagfileOpt.setRequired(false); options.addOption(flagfileOpt); }
[ "private", "void", "addFlagFileOption", "(", ")", "{", "String", "name", "=", "\"flagfile\"", ";", "String", "shortName", "=", "getAndAddUniqueShortName", "(", "name", ")", ";", "String", "description", "=", "\"Special flag: file from which to read additional flags\"", ...
Adds a special option --flagfile (akin to gflags' flagfile option http://gflags.github.io/gflags/#special) that specifies a file from which to read additional flags.
[ "Adds", "a", "special", "option", "--", "flagfile", "(", "akin", "to", "gflags", "flagfile", "option", "http", ":", "//", "gflags", ".", "github", ".", "io", "/", "gflags", "/", "#special", ")", "that", "specifies", "a", "file", "from", "which", "to", ...
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/util/cli/ArgParser.java#L77-L86
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/database/DBAccessFactory.java
DBAccessFactory.createDBAccess
public static IDBAccess createDBAccess(DBType dbType, Properties properties, AuthToken authToken) { return createDBAccess(dbType, properties, null, null, authToken); }
java
public static IDBAccess createDBAccess(DBType dbType, Properties properties, AuthToken authToken) { return createDBAccess(dbType, properties, null, null, authToken); }
[ "public", "static", "IDBAccess", "createDBAccess", "(", "DBType", "dbType", ",", "Properties", "properties", ",", "AuthToken", "authToken", ")", "{", "return", "createDBAccess", "(", "dbType", ",", "properties", ",", "null", ",", "null", ",", "authToken", ")", ...
create an IDBAccess (an accessor) for a specific database, supports authentication. @param dbType the type of database to access. Can be <br/>DBType.REMOTE or DBType.EMBEDDED or DBType.IN_MEMORY @param properties to configure the database connection. <br/>The appropriate database access class will pick the properties it needs. <br/>See also: DBProperties interface for required and optional properties. @param authToken @return an instance of IDBAccess
[ "create", "an", "IDBAccess", "(", "an", "accessor", ")", "for", "a", "specific", "database", "supports", "authentication", "." ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/database/DBAccessFactory.java#L93-L96
tvesalainen/util
util/src/main/java/org/vesalainen/lang/Primitives.java
Primitives.writeLong
public static final void writeLong(long value, byte[] array, int offset) { if (array.length < offset + 8) { throw new IllegalArgumentException("no room in array"); } array[offset] = (byte) (value >> 56); array[offset + 1] = (byte) ((value >> 48) & 0xff); array[offset + 2] = (byte) ((value >> 40) & 0xff); array[offset + 3] = (byte) ((value >> 32) & 0xff); array[offset + 4] = (byte) ((value >> 24) & 0xff); array[offset + 5] = (byte) ((value >> 16) & 0xff); array[offset + 6] = (byte) ((value >> 8) & 0xff); array[offset + 7] = (byte) (value & 0xff); }
java
public static final void writeLong(long value, byte[] array, int offset) { if (array.length < offset + 8) { throw new IllegalArgumentException("no room in array"); } array[offset] = (byte) (value >> 56); array[offset + 1] = (byte) ((value >> 48) & 0xff); array[offset + 2] = (byte) ((value >> 40) & 0xff); array[offset + 3] = (byte) ((value >> 32) & 0xff); array[offset + 4] = (byte) ((value >> 24) & 0xff); array[offset + 5] = (byte) ((value >> 16) & 0xff); array[offset + 6] = (byte) ((value >> 8) & 0xff); array[offset + 7] = (byte) (value & 0xff); }
[ "public", "static", "final", "void", "writeLong", "(", "long", "value", ",", "byte", "[", "]", "array", ",", "int", "offset", ")", "{", "if", "(", "array", ".", "length", "<", "offset", "+", "8", ")", "{", "throw", "new", "IllegalArgumentException", "(...
Write value to byte array @param value @param array @param offset @see java.nio.ByteBuffer#putLong(long)
[ "Write", "value", "to", "byte", "array" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L253-L267
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GitLabApiForm.java
GitLabApiForm.withParam
public GitLabApiForm withParam(String name, Date date) throws IllegalArgumentException { return (withParam(name, date, false)); }
java
public GitLabApiForm withParam(String name, Date date) throws IllegalArgumentException { return (withParam(name, date, false)); }
[ "public", "GitLabApiForm", "withParam", "(", "String", "name", ",", "Date", "date", ")", "throws", "IllegalArgumentException", "{", "return", "(", "withParam", "(", "name", ",", "date", ",", "false", ")", ")", ";", "}" ]
Fluent method for adding Date query and form parameters to a get() or post() call. @param name the name of the field/attribute to add @param date the value of the field/attribute to add @return this GitLabAPiForm instance
[ "Fluent", "method", "for", "adding", "Date", "query", "and", "form", "parameters", "to", "a", "get", "()", "or", "post", "()", "call", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApiForm.java#L57-L59
kongchen/swagger-maven-plugin
src/main/java/com/github/kongchen/swagger/docgen/mavenplugin/SecurityDefinition.java
SecurityDefinition.tryFillNameField
private void tryFillNameField(SecuritySchemeDefinition ssd, String value) { if (ssd == null) { return; } Field nameField = FieldUtils.getField(ssd.getClass(), "name", true); try { if (nameField != null && nameField.get(ssd) == null) { nameField.set(ssd, value); } } catch (IllegalAccessException e) { // ignored } }
java
private void tryFillNameField(SecuritySchemeDefinition ssd, String value) { if (ssd == null) { return; } Field nameField = FieldUtils.getField(ssd.getClass(), "name", true); try { if (nameField != null && nameField.get(ssd) == null) { nameField.set(ssd, value); } } catch (IllegalAccessException e) { // ignored } }
[ "private", "void", "tryFillNameField", "(", "SecuritySchemeDefinition", "ssd", ",", "String", "value", ")", "{", "if", "(", "ssd", "==", "null", ")", "{", "return", ";", "}", "Field", "nameField", "=", "FieldUtils", ".", "getField", "(", "ssd", ".", "getCl...
<p>Try to fill the name property of some authentication definition, if no user defined value was set.</p> <p>If the current value of the name property is empty, this will fill it to be the same as the name of the security definition.</br> If no {@link Field} named "name" is found inside the given SecuritySchemeDefinition, no action will be taken. @param ssd security scheme @param value value to set the name to
[ "<p", ">", "Try", "to", "fill", "the", "name", "property", "of", "some", "authentication", "definition", "if", "no", "user", "defined", "value", "was", "set", ".", "<", "/", "p", ">", "<p", ">", "If", "the", "current", "value", "of", "the", "name", "...
train
https://github.com/kongchen/swagger-maven-plugin/blob/0709b035ef45e1cb13189cd7f949c52c10557747/src/main/java/com/github/kongchen/swagger/docgen/mavenplugin/SecurityDefinition.java#L67-L80
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayScriptInternal
private static String getDisplayScriptInternal(ULocale locale, ULocale displayLocale) { return LocaleDisplayNames.getInstance(displayLocale) .scriptDisplayName(locale.getScript()); }
java
private static String getDisplayScriptInternal(ULocale locale, ULocale displayLocale) { return LocaleDisplayNames.getInstance(displayLocale) .scriptDisplayName(locale.getScript()); }
[ "private", "static", "String", "getDisplayScriptInternal", "(", "ULocale", "locale", ",", "ULocale", "displayLocale", ")", "{", "return", "LocaleDisplayNames", ".", "getInstance", "(", "displayLocale", ")", ".", "scriptDisplayName", "(", "locale", ".", "getScript", ...
displayLocaleID is canonical, localeID need not be since parsing will fix this.
[ "displayLocaleID", "is", "canonical", "localeID", "need", "not", "be", "since", "parsing", "will", "fix", "this", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1552-L1555
mgormley/prim
src/main/java/edu/jhu/prim/vector/LongDoubleDenseVector.java
LongDoubleDenseVector.add
public void add(LongDoubleVector other) { if (other instanceof LongDoubleUnsortedVector) { LongDoubleUnsortedVector vec = (LongDoubleUnsortedVector) other; for (int i=0; i<vec.top; i++) { this.add(vec.idx[i], vec.vals[i]); } } else { // TODO: Add special case for LongDoubleDenseVector. other.iterate(new SparseBinaryOpApplier(this, new Lambda.DoubleAdd())); } }
java
public void add(LongDoubleVector other) { if (other instanceof LongDoubleUnsortedVector) { LongDoubleUnsortedVector vec = (LongDoubleUnsortedVector) other; for (int i=0; i<vec.top; i++) { this.add(vec.idx[i], vec.vals[i]); } } else { // TODO: Add special case for LongDoubleDenseVector. other.iterate(new SparseBinaryOpApplier(this, new Lambda.DoubleAdd())); } }
[ "public", "void", "add", "(", "LongDoubleVector", "other", ")", "{", "if", "(", "other", "instanceof", "LongDoubleUnsortedVector", ")", "{", "LongDoubleUnsortedVector", "vec", "=", "(", "LongDoubleUnsortedVector", ")", "other", ";", "for", "(", "int", "i", "=", ...
Updates this vector to be the entrywise sum of this vector with the other.
[ "Updates", "this", "vector", "to", "be", "the", "entrywise", "sum", "of", "this", "vector", "with", "the", "other", "." ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/vector/LongDoubleDenseVector.java#L143-L153
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/run/Cleaner.java
Cleaner.clearOne
public static void clearOne(String correlationId, Object component) throws ApplicationException { if (component instanceof ICleanable) ((ICleanable) component).clear(correlationId); }
java
public static void clearOne(String correlationId, Object component) throws ApplicationException { if (component instanceof ICleanable) ((ICleanable) component).clear(correlationId); }
[ "public", "static", "void", "clearOne", "(", "String", "correlationId", ",", "Object", "component", ")", "throws", "ApplicationException", "{", "if", "(", "component", "instanceof", "ICleanable", ")", "(", "(", "ICleanable", ")", "component", ")", ".", "clear", ...
Clears state of specific component. To be cleaned state components must implement ICleanable interface. If they don't the call to this method has no effect. @param correlationId (optional) transaction id to trace execution through call chain. @param component the component that is to be cleaned. @throws ApplicationException when errors occured. @see ICleanable
[ "Clears", "state", "of", "specific", "component", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/run/Cleaner.java#L24-L28
landawn/AbacusUtil
src/com/landawn/abacus/util/IOUtil.java
IOUtil.copyURLToFile
public static void copyURLToFile(final URL source, final File destination, final int connectionTimeout, final int readTimeout) throws UncheckedIOException { InputStream is = null; try { final URLConnection connection = source.openConnection(); connection.setConnectTimeout(connectionTimeout); connection.setReadTimeout(readTimeout); is = connection.getInputStream(); write(destination, is); } catch (IOException e) { throw new UncheckedIOException(e); } finally { close(is); } }
java
public static void copyURLToFile(final URL source, final File destination, final int connectionTimeout, final int readTimeout) throws UncheckedIOException { InputStream is = null; try { final URLConnection connection = source.openConnection(); connection.setConnectTimeout(connectionTimeout); connection.setReadTimeout(readTimeout); is = connection.getInputStream(); write(destination, is); } catch (IOException e) { throw new UncheckedIOException(e); } finally { close(is); } }
[ "public", "static", "void", "copyURLToFile", "(", "final", "URL", "source", ",", "final", "File", "destination", ",", "final", "int", "connectionTimeout", ",", "final", "int", "readTimeout", ")", "throws", "UncheckedIOException", "{", "InputStream", "is", "=", "...
Copies bytes from the URL <code>source</code> to a file <code>destination</code>. The directories up to <code>destination</code> will be created if they don't already exist. <code>destination</code> will be overwritten if it already exists. @param source the <code>URL</code> to copy bytes from, must not be {@code null} @param destination the non-directory <code>File</code> to write bytes to (possibly overwriting), must not be {@code null} @param connectionTimeout the number of milliseconds until this method will timeout if no connection could be established to the <code>source</code> @param readTimeout the number of milliseconds until this method will timeout if no data could be read from the <code>source</code> @throws UncheckedIOException if <code>source</code> URL cannot be opened @throws UncheckedIOException if <code>destination</code> is a directory @throws UncheckedIOException if <code>destination</code> cannot be written @throws UncheckedIOException if <code>destination</code> needs creating but can't be @throws UncheckedIOException if an IO error occurs during copying
[ "Copies", "bytes", "from", "the", "URL", "<code", ">", "source<", "/", "code", ">", "to", "a", "file", "<code", ">", "destination<", "/", "code", ">", ".", "The", "directories", "up", "to", "<code", ">", "destination<", "/", "code", ">", "will", "be", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L3026-L3040
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java
JMSService.createTextMessage
public Message createTextMessage(String text, String sender, String recipients) throws JMSException { return decorateMessage(getSession().createTextMessage(text), sender, recipients); }
java
public Message createTextMessage(String text, String sender, String recipients) throws JMSException { return decorateMessage(getSession().createTextMessage(text), sender, recipients); }
[ "public", "Message", "createTextMessage", "(", "String", "text", ",", "String", "sender", ",", "String", "recipients", ")", "throws", "JMSException", "{", "return", "decorateMessage", "(", "getSession", "(", ")", ".", "createTextMessage", "(", "text", ")", ",", ...
Creates a message. @param text text data @param sender Sender client ID. @param recipients Comma-delimited list of recipient client IDs @return Message @throws JMSException if error thrown from creation of object message
[ "Creates", "a", "message", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java#L210-L212
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java
DateFormat.getDateTimeInstance
public final static DateFormat getDateTimeInstance() { return get(DEFAULT, DEFAULT, ULocale.getDefault(Category.FORMAT), null); }
java
public final static DateFormat getDateTimeInstance() { return get(DEFAULT, DEFAULT, ULocale.getDefault(Category.FORMAT), null); }
[ "public", "final", "static", "DateFormat", "getDateTimeInstance", "(", ")", "{", "return", "get", "(", "DEFAULT", ",", "DEFAULT", ",", "ULocale", ".", "getDefault", "(", "Category", ".", "FORMAT", ")", ",", "null", ")", ";", "}" ]
Returns the date/time formatter with the default formatting style for the default <code>FORMAT</code> locale. @return a date/time formatter. @see Category#FORMAT
[ "Returns", "the", "date", "/", "time", "formatter", "with", "the", "default", "formatting", "style", "for", "the", "default", "<code", ">", "FORMAT<", "/", "code", ">", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1346-L1349
phax/ph-ebinterface
src/main/java/com/helger/ebinterface/visualization/VisualizationManager.java
VisualizationManager.visualizeToDOMDocument
@Nullable public static Document visualizeToDOMDocument (@Nonnull final EEbInterfaceVersion eVersion, @Nonnull final IReadableResource aResource) { return visualizeToDOMDocument (eVersion, TransformSourceFactory.create (aResource)); }
java
@Nullable public static Document visualizeToDOMDocument (@Nonnull final EEbInterfaceVersion eVersion, @Nonnull final IReadableResource aResource) { return visualizeToDOMDocument (eVersion, TransformSourceFactory.create (aResource)); }
[ "@", "Nullable", "public", "static", "Document", "visualizeToDOMDocument", "(", "@", "Nonnull", "final", "EEbInterfaceVersion", "eVersion", ",", "@", "Nonnull", "final", "IReadableResource", "aResource", ")", "{", "return", "visualizeToDOMDocument", "(", "eVersion", "...
Visualize a source to a DOM document for a certain ebInterface version. @param eVersion ebInterface version to use. May not be <code>null</code>. @param aResource Source resource. May not be <code>null</code>. @return <code>null</code> if the XSLT could not be applied.
[ "Visualize", "a", "source", "to", "a", "DOM", "document", "for", "a", "certain", "ebInterface", "version", "." ]
train
https://github.com/phax/ph-ebinterface/blob/e3d2381f25c2fdfcc98acff2509bf5f33752d087/src/main/java/com/helger/ebinterface/visualization/VisualizationManager.java#L166-L171
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java
ContainerAnalysisV1Beta1Client.updateScanConfig
public final ScanConfig updateScanConfig(String name, ScanConfig scanConfig) { UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder().setName(name).setScanConfig(scanConfig).build(); return updateScanConfig(request); }
java
public final ScanConfig updateScanConfig(String name, ScanConfig scanConfig) { UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder().setName(name).setScanConfig(scanConfig).build(); return updateScanConfig(request); }
[ "public", "final", "ScanConfig", "updateScanConfig", "(", "String", "name", ",", "ScanConfig", "scanConfig", ")", "{", "UpdateScanConfigRequest", "request", "=", "UpdateScanConfigRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ")", ".", "setSca...
Updates the specified scan configuration. <p>Sample code: <pre><code> try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) { ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); ScanConfig scanConfig = ScanConfig.newBuilder().build(); ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(name.toString(), scanConfig); } </code></pre> @param name The name of the scan configuration in the form of `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. @param scanConfig The updated scan configuration. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "the", "specified", "scan", "configuration", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java#L840-L845
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.presignedGetObject
public String presignedGetObject(String bucketName, String objectName, Integer expires) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException { return presignedGetObject(bucketName, objectName, expires, null); }
java
public String presignedGetObject(String bucketName, String objectName, Integer expires) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidExpiresRangeException { return presignedGetObject(bucketName, objectName, expires, null); }
[ "public", "String", "presignedGetObject", "(", "String", "bucketName", ",", "String", "objectName", ",", "Integer", "expires", ")", "throws", "InvalidBucketNameException", ",", "NoSuchAlgorithmException", ",", "InsufficientDataException", ",", "IOException", ",", "Invalid...
Returns an presigned URL to download the object in the bucket with given expiry time. </p><b>Example:</b><br> <pre>{@code String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24); System.out.println(url); }</pre> @param bucketName Bucket name. @param objectName Object name in the bucket. @param expires Expiration time in seconds of presigned URL. @return string contains URL to download the object. @throws InvalidBucketNameException upon invalid bucket name is given @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error @throws InvalidExpiresRangeException upon input expires is out of range
[ "Returns", "an", "presigned", "URL", "to", "download", "the", "object", "in", "the", "bucket", "with", "given", "expiry", "time", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2436-L2441
chen0040/java-genetic-programming
src/main/java/com/github/chen0040/gp/lgp/gp/PopulationInitialization.java
PopulationInitialization.initializeWithVariableLength
private static void initializeWithVariableLength(List<Program> programs, LGP manager, RandEngine randEngine) { int popSize = manager.getPopulationSize(); for(int i=0; i < popSize; ++i) { Program lgp= new Program(); initialize(lgp, manager, randEngine, randEngine.nextInt(manager.getPopInitMinProgramLength(), manager.getPopInitMaxProgramLength())); programs.add(lgp); } }
java
private static void initializeWithVariableLength(List<Program> programs, LGP manager, RandEngine randEngine) { int popSize = manager.getPopulationSize(); for(int i=0; i < popSize; ++i) { Program lgp= new Program(); initialize(lgp, manager, randEngine, randEngine.nextInt(manager.getPopInitMinProgramLength(), manager.getPopInitMaxProgramLength())); programs.add(lgp); } }
[ "private", "static", "void", "initializeWithVariableLength", "(", "List", "<", "Program", ">", "programs", ",", "LGP", "manager", ",", "RandEngine", "randEngine", ")", "{", "int", "popSize", "=", "manager", ".", "getPopulationSize", "(", ")", ";", "for", "(", ...
the program length is distributed uniformly between iMinProgLength and iMaxProgLength
[ "the", "program", "length", "is", "distributed", "uniformly", "between", "iMinProgLength", "and", "iMaxProgLength" ]
train
https://github.com/chen0040/java-genetic-programming/blob/498fc8f4407ea9d45f2e0ac797a8948da337c74f/src/main/java/com/github/chen0040/gp/lgp/gp/PopulationInitialization.java#L37-L45
UrielCh/ovh-java-sdk
ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java
ApiOvhAuth.currentCredential_GET
public OvhCredential currentCredential_GET() throws IOException { String qPath = "/auth/currentCredential"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCredential.class); }
java
public OvhCredential currentCredential_GET() throws IOException { String qPath = "/auth/currentCredential"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCredential.class); }
[ "public", "OvhCredential", "currentCredential_GET", "(", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/auth/currentCredential\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", ...
Get the current credential details REST: GET /auth/currentCredential
[ "Get", "the", "current", "credential", "details" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java#L25-L30
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java
EmulatedFields.put
public void put(String name, byte value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, byte.class); slot.fieldValue = Byte.valueOf(value); slot.defaulted = false; // No longer default value }
java
public void put(String name, byte value) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, byte.class); slot.fieldValue = Byte.valueOf(value); slot.defaulted = false; // No longer default value }
[ "public", "void", "put", "(", "String", "name", ",", "byte", "value", ")", "throws", "IllegalArgumentException", "{", "ObjectSlot", "slot", "=", "findMandatorySlot", "(", "name", ",", "byte", ".", "class", ")", ";", "slot", ".", "fieldValue", "=", "Byte", ...
Find and set the byte value of a given field named {@code name} in the receiver. @param name the name of the field to set. @param value new value for the field. @throws IllegalArgumentException if the corresponding field can not be found.
[ "Find", "and", "set", "the", "byte", "value", "of", "a", "given", "field", "named", "{", "@code", "name", "}", "in", "the", "receiver", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L385-L389
google/error-prone
check_api/src/main/java/com/google/errorprone/util/Signatures.java
Signatures.prettyMethodSignature
public static String prettyMethodSignature(ClassSymbol origin, MethodSymbol m) { StringBuilder sb = new StringBuilder(); if (m.isConstructor()) { Name name = m.owner.enclClass().getSimpleName(); if (name.isEmpty()) { // use the superclass name of anonymous classes name = m.owner.enclClass().getSuperclass().asElement().getSimpleName(); } sb.append(name); } else { if (!m.owner.equals(origin)) { sb.append(m.owner.getSimpleName()).append('.'); } sb.append(m.getSimpleName()); } sb.append( m.getParameters().stream() .map(v -> v.type.accept(PRETTY_TYPE_VISITOR, null)) .collect(joining(", ", "(", ")"))); return sb.toString(); }
java
public static String prettyMethodSignature(ClassSymbol origin, MethodSymbol m) { StringBuilder sb = new StringBuilder(); if (m.isConstructor()) { Name name = m.owner.enclClass().getSimpleName(); if (name.isEmpty()) { // use the superclass name of anonymous classes name = m.owner.enclClass().getSuperclass().asElement().getSimpleName(); } sb.append(name); } else { if (!m.owner.equals(origin)) { sb.append(m.owner.getSimpleName()).append('.'); } sb.append(m.getSimpleName()); } sb.append( m.getParameters().stream() .map(v -> v.type.accept(PRETTY_TYPE_VISITOR, null)) .collect(joining(", ", "(", ")"))); return sb.toString(); }
[ "public", "static", "String", "prettyMethodSignature", "(", "ClassSymbol", "origin", ",", "MethodSymbol", "m", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "m", ".", "isConstructor", "(", ")", ")", "{", "Name", "n...
Pretty-prints a method signature for use in diagnostics. <p>Uses simple names for declared types, and omitting formal type parameters and the return type since they do not affect overload resolution.
[ "Pretty", "-", "prints", "a", "method", "signature", "for", "use", "in", "diagnostics", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/Signatures.java#L88-L108
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
JaxbUtils.createXmlStreamReader
public static XMLStreamReader createXmlStreamReader(Reader reader, boolean namespaceAware) throws JAXBException { XMLInputFactory xif = getXmlInputFactory(namespaceAware); XMLStreamReader xsr = null; try { xsr = xif.createXMLStreamReader(reader); } catch (XMLStreamException e) { throw new JAXBException(e); } return xsr; }
java
public static XMLStreamReader createXmlStreamReader(Reader reader, boolean namespaceAware) throws JAXBException { XMLInputFactory xif = getXmlInputFactory(namespaceAware); XMLStreamReader xsr = null; try { xsr = xif.createXMLStreamReader(reader); } catch (XMLStreamException e) { throw new JAXBException(e); } return xsr; }
[ "public", "static", "XMLStreamReader", "createXmlStreamReader", "(", "Reader", "reader", ",", "boolean", "namespaceAware", ")", "throws", "JAXBException", "{", "XMLInputFactory", "xif", "=", "getXmlInputFactory", "(", "namespaceAware", ")", ";", "XMLStreamReader", "xsr"...
Creates an XMLStreamReader based on a Reader. @param reader Note that XMLStreamReader, despite the name, does not implement the Reader interface! @param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all XML elements @return platform-specific XMLStreamReader implementation @throws JAXBException if the XMLStreamReader could not be created
[ "Creates", "an", "XMLStreamReader", "based", "on", "a", "Reader", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L174-L184
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java
HttpHeaderMap.addLongHeader
public void addLongHeader (@Nonnull @Nonempty final String sName, final long nValue) { _addHeader (sName, Long.toString (nValue)); }
java
public void addLongHeader (@Nonnull @Nonempty final String sName, final long nValue) { _addHeader (sName, Long.toString (nValue)); }
[ "public", "void", "addLongHeader", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sName", ",", "final", "long", "nValue", ")", "{", "_addHeader", "(", "sName", ",", "Long", ".", "toString", "(", "nValue", ")", ")", ";", "}" ]
Add the passed header as a number. @param sName Header name. May neither be <code>null</code> nor empty. @param nValue The value to be set. May not be <code>null</code>.
[ "Add", "the", "passed", "header", "as", "a", "number", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L382-L385
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/util/PointReducer.java
PointReducer.orthogonalDistance
public static double orthogonalDistance(GeoPoint point, GeoPoint lineStart, GeoPoint lineEnd) { double area = Math.abs( ( lineStart.getLatitude() * lineEnd.getLongitude() + lineEnd.getLatitude() * point.getLongitude() + point.getLatitude() * lineStart.getLongitude() - lineEnd.getLatitude() * lineStart.getLongitude() - point.getLatitude() * lineEnd.getLongitude() - lineStart.getLatitude() * point.getLongitude() ) / 2.0 ); double bottom = Math.hypot( lineStart.getLatitude() - lineEnd.getLatitude(), lineStart.getLongitude() - lineEnd.getLongitude() ); return(area / bottom * 2.0); }
java
public static double orthogonalDistance(GeoPoint point, GeoPoint lineStart, GeoPoint lineEnd) { double area = Math.abs( ( lineStart.getLatitude() * lineEnd.getLongitude() + lineEnd.getLatitude() * point.getLongitude() + point.getLatitude() * lineStart.getLongitude() - lineEnd.getLatitude() * lineStart.getLongitude() - point.getLatitude() * lineEnd.getLongitude() - lineStart.getLatitude() * point.getLongitude() ) / 2.0 ); double bottom = Math.hypot( lineStart.getLatitude() - lineEnd.getLatitude(), lineStart.getLongitude() - lineEnd.getLongitude() ); return(area / bottom * 2.0); }
[ "public", "static", "double", "orthogonalDistance", "(", "GeoPoint", "point", ",", "GeoPoint", "lineStart", ",", "GeoPoint", "lineEnd", ")", "{", "double", "area", "=", "Math", ".", "abs", "(", "(", "lineStart", ".", "getLatitude", "(", ")", "*", "lineEnd", ...
Calculate the orthogonal distance from the line joining the lineStart and lineEnd points to point @param point The point the distance is being calculated for @param lineStart The point that starts the line @param lineEnd The point that ends the line @return The distance in points coordinate system
[ "Calculate", "the", "orthogonal", "distance", "from", "the", "line", "joining", "the", "lineStart", "and", "lineEnd", "points", "to", "point" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/PointReducer.java#L134-L153
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java
ICUResourceBundle.getWithFallback
public ICUResourceBundle getWithFallback(String path) throws MissingResourceException { ICUResourceBundle actualBundle = this; // now recurse to pick up sub levels of the items ICUResourceBundle result = findResourceWithFallback(path, actualBundle, null); if (result == null) { throw new MissingResourceException( "Can't find resource for bundle " + this.getClass().getName() + ", key " + getType(), path, getKey()); } if (result.getType() == STRING && result.getString().equals(NO_INHERITANCE_MARKER)) { throw new MissingResourceException("Encountered NO_INHERITANCE_MARKER", path, getKey()); } return result; }
java
public ICUResourceBundle getWithFallback(String path) throws MissingResourceException { ICUResourceBundle actualBundle = this; // now recurse to pick up sub levels of the items ICUResourceBundle result = findResourceWithFallback(path, actualBundle, null); if (result == null) { throw new MissingResourceException( "Can't find resource for bundle " + this.getClass().getName() + ", key " + getType(), path, getKey()); } if (result.getType() == STRING && result.getString().equals(NO_INHERITANCE_MARKER)) { throw new MissingResourceException("Encountered NO_INHERITANCE_MARKER", path, getKey()); } return result; }
[ "public", "ICUResourceBundle", "getWithFallback", "(", "String", "path", ")", "throws", "MissingResourceException", "{", "ICUResourceBundle", "actualBundle", "=", "this", ";", "// now recurse to pick up sub levels of the items", "ICUResourceBundle", "result", "=", "findResource...
This method performs multilevel fallback for fetching items from the bundle e.g: If resource is in the form de__PHONEBOOK{ collations{ default{ "phonebook"} } } If the value of "default" key needs to be accessed, then do: <code> UResourceBundle bundle = UResourceBundle.getBundleInstance("de__PHONEBOOK"); ICUResourceBundle result = null; if(bundle instanceof ICUResourceBundle){ result = ((ICUResourceBundle) bundle).getWithFallback("collations/default"); } </code> @param path The path to the required resource key @return resource represented by the key @exception MissingResourceException If a resource was not found.
[ "This", "method", "performs", "multilevel", "fallback", "for", "fetching", "items", "from", "the", "bundle", "e", ".", "g", ":", "If", "resource", "is", "in", "the", "form", "de__PHONEBOOK", "{", "collations", "{", "default", "{", "phonebook", "}", "}", "}...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L297-L315
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Completable.java
Completable.doFinally
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Completable doFinally(Action onFinally) { ObjectHelper.requireNonNull(onFinally, "onFinally is null"); return RxJavaPlugins.onAssembly(new CompletableDoFinally(this, onFinally)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Completable doFinally(Action onFinally) { ObjectHelper.requireNonNull(onFinally, "onFinally is null"); return RxJavaPlugins.onAssembly(new CompletableDoFinally(this, onFinally)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "Completable", "doFinally", "(", "Action", "onFinally", ")", "{", "ObjectHelper", ".", "requireNonNull", "(", "onFinally", ",", "\"onFinally is null\"", "...
Calls the specified action after this Completable signals onError or onComplete or gets disposed by the downstream. <p> <img width="640" height="331" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.doFinally.png" alt=""> <p> In case of a race between a terminal event and a dispose call, the provided {@code onFinally} action is executed once per subscription. <p> Note that the {@code onFinally} action is shared between subscriptions and as such should be thread-safe. <dl> <dt><b>Scheduler:</b></dt> <dd>{@code doFinally} does not operate by default on a particular {@link Scheduler}.</dd> </dl> <p>History: 2.0.1 - experimental @param onFinally the action called when this Completable terminates or gets disposed @return the new Completable instance @since 2.1
[ "Calls", "the", "specified", "action", "after", "this", "Completable", "signals", "onError", "or", "onComplete", "or", "gets", "disposed", "by", "the", "downstream", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "331", "src", "=", "https", ":...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L1592-L1597