repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java
HBasePanel.printDataStartForm
public void printDataStartForm(PrintWriter out, int iPrintOptions) { if ((iPrintOptions & HtmlConstants.MAIN_SCREEN) == HtmlConstants.MAIN_SCREEN) { } else if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } else if ((iPrintOptions & HtmlConstants.HEADING_SCREEN) == HtmlConstants.HEADING_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } else if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } else out.println("<table border=\"0\">"); // First time }
java
public void printDataStartForm(PrintWriter out, int iPrintOptions) { if ((iPrintOptions & HtmlConstants.MAIN_SCREEN) == HtmlConstants.MAIN_SCREEN) { } else if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } else if ((iPrintOptions & HtmlConstants.HEADING_SCREEN) == HtmlConstants.HEADING_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } else if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) { out.println("<tr>\n<td colspan=\"20\">"); } else out.println("<table border=\"0\">"); // First time }
[ "public", "void", "printDataStartForm", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "if", "(", "(", "iPrintOptions", "&", "HtmlConstants", ".", "MAIN_SCREEN", ")", "==", "HtmlConstants", ".", "MAIN_SCREEN", ")", "{", "}", "else", "if", ...
Display the start form in input format. @param out The out stream. @param iPrintOptions The view specific attributes.
[ "Display", "the", "start", "form", "in", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L524-L543
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java
CustomFieldValueReader9.populateContainer
private void populateContainer(FieldType field, List<Pair<String, String>> items) { CustomField config = m_container.getCustomField(field); CustomFieldLookupTable table = config.getLookupTable(); for (Pair<String, String> pair : items) { CustomFieldValueItem item = new CustomFieldValueItem(Integer.valueOf(0)); item.setValue(pair.getFirst()); item.setDescription(pair.getSecond()); table.add(item); } }
java
private void populateContainer(FieldType field, List<Pair<String, String>> items) { CustomField config = m_container.getCustomField(field); CustomFieldLookupTable table = config.getLookupTable(); for (Pair<String, String> pair : items) { CustomFieldValueItem item = new CustomFieldValueItem(Integer.valueOf(0)); item.setValue(pair.getFirst()); item.setDescription(pair.getSecond()); table.add(item); } }
[ "private", "void", "populateContainer", "(", "FieldType", "field", ",", "List", "<", "Pair", "<", "String", ",", "String", ">", ">", "items", ")", "{", "CustomField", "config", "=", "m_container", ".", "getCustomField", "(", "field", ")", ";", "CustomFieldLo...
Populate the container from outline code data. @param field field type @param items pairs of values and descriptions
[ "Populate", "the", "container", "from", "outline", "code", "data", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java#L229-L241
fuinorg/event-store-commons
spi/src/main/java/org/fuin/esc/spi/EscSpiUtils.java
EscSpiUtils.mimeType
public static EnhancedMimeType mimeType(@NotNull final SerializerRegistry registry, @NotNull final List<CommonEvent> commonEvents) { Contract.requireArgNotNull("registry", registry); Contract.requireArgNotNull("commonEvents", commonEvents); EnhancedMimeType mimeType = null; for (final CommonEvent commonEvent : commonEvents) { final Serializer serializer = registry.getSerializer(new SerializedDataType(commonEvent.getDataType().asBaseType())); if (mimeType == null) { mimeType = serializer.getMimeType(); } else { if (!mimeType.equals(serializer.getMimeType())) { return null; } } } return mimeType; }
java
public static EnhancedMimeType mimeType(@NotNull final SerializerRegistry registry, @NotNull final List<CommonEvent> commonEvents) { Contract.requireArgNotNull("registry", registry); Contract.requireArgNotNull("commonEvents", commonEvents); EnhancedMimeType mimeType = null; for (final CommonEvent commonEvent : commonEvents) { final Serializer serializer = registry.getSerializer(new SerializedDataType(commonEvent.getDataType().asBaseType())); if (mimeType == null) { mimeType = serializer.getMimeType(); } else { if (!mimeType.equals(serializer.getMimeType())) { return null; } } } return mimeType; }
[ "public", "static", "EnhancedMimeType", "mimeType", "(", "@", "NotNull", "final", "SerializerRegistry", "registry", ",", "@", "NotNull", "final", "List", "<", "CommonEvent", ">", "commonEvents", ")", "{", "Contract", ".", "requireArgNotNull", "(", "\"registry\"", ...
Returns the mime types shared by all events in the list. @param registry Registry used to peek the mime type used to serialize the event. @param commonEvents List to test. @return Mime type if all events share the same type or <code>null</code> if there are events with different mime types.
[ "Returns", "the", "mime", "types", "shared", "by", "all", "events", "in", "the", "list", "." ]
train
https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/EscSpiUtils.java#L111-L128
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/ringbuffer/impl/ReadResultSetImpl.java
ReadResultSetImpl.addItem
public void addItem(long seq, Object item) { assert size < maxSize; readCount++; Data resultItem; if (filter != null || predicate != null || projection != null) { final O objectItem = serializationService.toObject(item); final boolean passesFilter = filter == null || filter.apply(objectItem); final boolean passesPredicate = predicate == null || predicate.test(objectItem); if (!passesFilter || !passesPredicate) { return; } if (projection != null) { resultItem = serializationService.toData(projection.transform(objectItem)); } else { resultItem = serializationService.toData(item); } } else { resultItem = serializationService.toData(item); } items[size] = resultItem; seqs[size] = seq; size++; }
java
public void addItem(long seq, Object item) { assert size < maxSize; readCount++; Data resultItem; if (filter != null || predicate != null || projection != null) { final O objectItem = serializationService.toObject(item); final boolean passesFilter = filter == null || filter.apply(objectItem); final boolean passesPredicate = predicate == null || predicate.test(objectItem); if (!passesFilter || !passesPredicate) { return; } if (projection != null) { resultItem = serializationService.toData(projection.transform(objectItem)); } else { resultItem = serializationService.toData(item); } } else { resultItem = serializationService.toData(item); } items[size] = resultItem; seqs[size] = seq; size++; }
[ "public", "void", "addItem", "(", "long", "seq", ",", "Object", "item", ")", "{", "assert", "size", "<", "maxSize", ";", "readCount", "++", ";", "Data", "resultItem", ";", "if", "(", "filter", "!=", "null", "||", "predicate", "!=", "null", "||", "proje...
Applies the {@link Projection} and adds an item to this {@link ReadResultSetImpl} if it passes the {@link Predicate} and {@link IFunction} with which it was constructed. The {@code item} may be in serialized or deserialized format as this method will adapt the parameter if necessary before providing it to the predicate and projection. <p> If the {@code item} is in {@link Data} format and there is no filter, predicate or projection, the item is added to the set without any additional serialization or deserialization. @param seq the sequence ID of the item @param item the item to add to the result set
[ "Applies", "the", "{", "@link", "Projection", "}", "and", "adds", "an", "item", "to", "this", "{", "@link", "ReadResultSetImpl", "}", "if", "it", "passes", "the", "{", "@link", "Predicate", "}", "and", "{", "@link", "IFunction", "}", "with", "which", "it...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/ringbuffer/impl/ReadResultSetImpl.java#L151-L175
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.setPerspectiveOffCenter
public Matrix4f setPerspectiveOffCenter(float fovy, float offAngleX, float offAngleY, float aspect, float zNear, float zFar) { return setPerspectiveOffCenter(fovy, offAngleX, offAngleY, aspect, zNear, zFar, false); }
java
public Matrix4f setPerspectiveOffCenter(float fovy, float offAngleX, float offAngleY, float aspect, float zNear, float zFar) { return setPerspectiveOffCenter(fovy, offAngleX, offAngleY, aspect, zNear, zFar, false); }
[ "public", "Matrix4f", "setPerspectiveOffCenter", "(", "float", "fovy", ",", "float", "offAngleX", ",", "float", "offAngleY", ",", "float", "aspect", ",", "float", "zNear", ",", "float", "zFar", ")", "{", "return", "setPerspectiveOffCenter", "(", "fovy", ",", "...
Set this matrix to be an asymmetric off-center perspective projection frustum transformation for a right-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> The given angles <code>offAngleX</code> and <code>offAngleY</code> are the horizontal and vertical angles between the line of sight and the line given by the center of the near and far frustum planes. So, when <code>offAngleY</code> is just <code>fovy/2</code> then the projection frustum is rotated towards +Y and the bottom frustum plane is parallel to the XZ-plane. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveOffCenter(float, float, float, float, float, float) perspectiveOffCenter()}. @see #perspectiveOffCenter(float, float, float, float, float, float) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param offAngleX the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes @param offAngleY the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @return this
[ "Set", "this", "matrix", "to", "be", "an", "asymmetric", "off", "-", "center", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", "...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9966-L9969
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/MethodUtils.java
MethodUtils.getAccessibleMethod
public static Method getAccessibleMethod(Class<?> clazz, String methodName, Class<?>[] paramTypes) { MethodDescriptor md = new MethodDescriptor(clazz, methodName, paramTypes, true); Method[] result = cache.get(md); if (result == null) { try { Method method = getAccessibleMethod(clazz.getMethod(methodName, paramTypes)); result = new Method[] { method }; } catch (NoSuchMethodException e) { result = NO_METHODS; } cache.put(md, result); } return (result.length > 0 ? result[0] : null); }
java
public static Method getAccessibleMethod(Class<?> clazz, String methodName, Class<?>[] paramTypes) { MethodDescriptor md = new MethodDescriptor(clazz, methodName, paramTypes, true); Method[] result = cache.get(md); if (result == null) { try { Method method = getAccessibleMethod(clazz.getMethod(methodName, paramTypes)); result = new Method[] { method }; } catch (NoSuchMethodException e) { result = NO_METHODS; } cache.put(md, result); } return (result.length > 0 ? result[0] : null); }
[ "public", "static", "Method", "getAccessibleMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "paramTypes", ")", "{", "MethodDescriptor", "md", "=", "new", "MethodDescriptor", "(", "clazz", "...
<p>Return an accessible method (that is, one that can be invoked via reflection) with given name and parameters. If no such method can be found, return {@code null}. This is just a convenient wrapper for {@link #getAccessibleMethod(Method method)}.</p> @param clazz get method from this class @param methodName get method with this name @param paramTypes with these parameters types @return the accessible method
[ "<p", ">", "Return", "an", "accessible", "method", "(", "that", "is", "one", "that", "can", "be", "invoked", "via", "reflection", ")", "with", "given", "name", "and", "parameters", ".", "If", "no", "such", "method", "can", "be", "found", "return", "{", ...
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L640-L653
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ElevationUtil.java
ElevationUtil.getCornerBounds
private static RectF getCornerBounds(@NonNull final Orientation orientation, final int size) { switch (orientation) { case TOP_LEFT: return new RectF(0, 0, 2 * size, 2 * size); case TOP_RIGHT: return new RectF(-size, 0, size, 2 * size); case BOTTOM_LEFT: return new RectF(0, -size, 2 * size, size); case BOTTOM_RIGHT: return new RectF(-size, -size, size, size); default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } }
java
private static RectF getCornerBounds(@NonNull final Orientation orientation, final int size) { switch (orientation) { case TOP_LEFT: return new RectF(0, 0, 2 * size, 2 * size); case TOP_RIGHT: return new RectF(-size, 0, size, 2 * size); case BOTTOM_LEFT: return new RectF(0, -size, 2 * size, size); case BOTTOM_RIGHT: return new RectF(-size, -size, size, size); default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } }
[ "private", "static", "RectF", "getCornerBounds", "(", "@", "NonNull", "final", "Orientation", "orientation", ",", "final", "int", "size", ")", "{", "switch", "(", "orientation", ")", "{", "case", "TOP_LEFT", ":", "return", "new", "RectF", "(", "0", ",", "0...
Returns the bounds, which should be used to draw a shadow, which is located at a corner of an elevated view. @param orientation The orientation of the shadow in relation to the elevated view as a value of the enum {@link Orientation}. The orientation may either be <code>TOP_LEFT</code>, <code>TOP_RIGHT</code>, <code>BOTTOM_LEFT</code> or <code>BOTTOM_RIGHT</code> @param size The size of the bitmap, which is used to draw the shadow, in pixels as an {@link Integer} value @return The bounds, which should be used to draw the shadow, as an instance of the class {@link RectF}
[ "Returns", "the", "bounds", "which", "should", "be", "used", "to", "draw", "a", "shadow", "which", "is", "located", "at", "a", "corner", "of", "an", "elevated", "view", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ElevationUtil.java#L387-L400
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayVariant
public static String getDisplayVariant(String localeID, String displayLocaleID){ return getDisplayVariantInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
java
public static String getDisplayVariant(String localeID, String displayLocaleID){ return getDisplayVariantInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
[ "public", "static", "String", "getDisplayVariant", "(", "String", "localeID", ",", "String", "displayLocaleID", ")", "{", "return", "getDisplayVariantInternal", "(", "new", "ULocale", "(", "localeID", ")", ",", "new", "ULocale", "(", "displayLocaleID", ")", ")", ...
<strong>[icu]</strong> Returns a locale's variant localized for display in the provided locale. This is a cover for the ICU4C API. @param localeID the id of the locale whose variant will be displayed @param displayLocaleID the id of the locale in which to display the name. @return the localized variant name.
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "a", "locale", "s", "variant", "localized", "for", "display", "in", "the", "provided", "locale", ".", "This", "is", "a", "cover", "for", "the", "ICU4C", "API", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1641-L1643
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java
DependencyBundlingAnalyzer.vulnerabilitiesMatch
private boolean vulnerabilitiesMatch(Dependency dependency1, Dependency dependency2) { final Set<Vulnerability> one = dependency1.getVulnerabilities(); final Set<Vulnerability> two = dependency2.getVulnerabilities(); return one != null && two != null && one.size() == two.size() && one.containsAll(two); }
java
private boolean vulnerabilitiesMatch(Dependency dependency1, Dependency dependency2) { final Set<Vulnerability> one = dependency1.getVulnerabilities(); final Set<Vulnerability> two = dependency2.getVulnerabilities(); return one != null && two != null && one.size() == two.size() && one.containsAll(two); }
[ "private", "boolean", "vulnerabilitiesMatch", "(", "Dependency", "dependency1", ",", "Dependency", "dependency2", ")", "{", "final", "Set", "<", "Vulnerability", ">", "one", "=", "dependency1", ".", "getVulnerabilities", "(", ")", ";", "final", "Set", "<", "Vuln...
Returns true if the two dependencies have the same vulnerabilities. @param dependency1 a dependency2 to compare @param dependency2 a dependency2 to compare @return true if the two dependencies have the same vulnerabilities
[ "Returns", "true", "if", "the", "two", "dependencies", "have", "the", "same", "vulnerabilities", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L285-L291
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java
Comment.inlineTagFound
private static int inlineTagFound(DocImpl holder, String inlinetext, int start) { DocEnv docenv = holder.env; int linkstart = inlinetext.indexOf("{@", start); if (start == inlinetext.length() || linkstart == -1) { return -1; } else if (inlinetext.indexOf('}', linkstart) == -1) { //Missing '}'. docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag", inlinetext.substring(linkstart, inlinetext.length())); return -1; } else { return linkstart; } }
java
private static int inlineTagFound(DocImpl holder, String inlinetext, int start) { DocEnv docenv = holder.env; int linkstart = inlinetext.indexOf("{@", start); if (start == inlinetext.length() || linkstart == -1) { return -1; } else if (inlinetext.indexOf('}', linkstart) == -1) { //Missing '}'. docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag", inlinetext.substring(linkstart, inlinetext.length())); return -1; } else { return linkstart; } }
[ "private", "static", "int", "inlineTagFound", "(", "DocImpl", "holder", ",", "String", "inlinetext", ",", "int", "start", ")", "{", "DocEnv", "docenv", "=", "holder", ".", "env", ";", "int", "linkstart", "=", "inlinetext", ".", "indexOf", "(", "\"{@\"", ",...
Recursively search for the characters '{', '@', followed by name of inline tag and white space, if found return the index of the text following the white space. else return -1.
[ "Recursively", "search", "for", "the", "characters", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java#L429-L442
netplex/json-smart-v2
accessors-smart/src/main/java/net/minidev/asm/DynamicClassLoader.java
DynamicClassLoader.defineClass
Class<?> defineClass(String name, byte[] bytes) throws ClassFormatError { try { // Attempt to load the access class in the same loader, which makes // protected and default access members accessible. Method method = ClassLoader.class.getDeclaredMethod("defineClass", DEF_CLASS_SIG); method.setAccessible(true); return (Class<?>) method.invoke(getParent(), new Object[] { name, bytes, Integer.valueOf(0), Integer.valueOf(bytes.length) }); } catch (Exception ignored) { } return defineClass(name, bytes, 0, bytes.length); }
java
Class<?> defineClass(String name, byte[] bytes) throws ClassFormatError { try { // Attempt to load the access class in the same loader, which makes // protected and default access members accessible. Method method = ClassLoader.class.getDeclaredMethod("defineClass", DEF_CLASS_SIG); method.setAccessible(true); return (Class<?>) method.invoke(getParent(), new Object[] { name, bytes, Integer.valueOf(0), Integer.valueOf(bytes.length) }); } catch (Exception ignored) { } return defineClass(name, bytes, 0, bytes.length); }
[ "Class", "<", "?", ">", "defineClass", "(", "String", "name", ",", "byte", "[", "]", "bytes", ")", "throws", "ClassFormatError", "{", "try", "{", "// Attempt to load the access class in the same loader, which makes", "// protected and default access members accessible.", "M...
Call defineClass into the parent classLoader using the method.setAccessible(boolean) hack @see ClassLoader#defineClass(String, byte[], int, int)
[ "Call", "defineClass", "into", "the", "parent", "classLoader", "using", "the", "method", ".", "setAccessible", "(", "boolean", ")", "hack" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/accessors-smart/src/main/java/net/minidev/asm/DynamicClassLoader.java#L77-L87
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/style/stylers/Image.java
Image.draw
@Override protected final void draw(PdfContentByte canvas, float x, float y, float width, float height, String genericTag) throws VectorPrintException { com.itextpdf.text.Image img; try { img = createImage(canvas, getData(), getValue((isDrawShadow()) ? SHADOWOPACITY : OPACITY, Float.class)); applySettings(img); } catch (BadElementException ex) { throw new VectorPrintException(ex); } img.setAbsolutePosition(x, y); try { addToCanvas(getValue(TRANSFORM, float[].class), img, canvas); } catch (DocumentException ex) { throw new VectorPrintRuntimeException(ex); } }
java
@Override protected final void draw(PdfContentByte canvas, float x, float y, float width, float height, String genericTag) throws VectorPrintException { com.itextpdf.text.Image img; try { img = createImage(canvas, getData(), getValue((isDrawShadow()) ? SHADOWOPACITY : OPACITY, Float.class)); applySettings(img); } catch (BadElementException ex) { throw new VectorPrintException(ex); } img.setAbsolutePosition(x, y); try { addToCanvas(getValue(TRANSFORM, float[].class), img, canvas); } catch (DocumentException ex) { throw new VectorPrintRuntimeException(ex); } }
[ "@", "Override", "protected", "final", "void", "draw", "(", "PdfContentByte", "canvas", ",", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ",", "String", "genericTag", ")", "throws", "VectorPrintException", "{", "com", ".", ...
Calls {@link #createImage(com.itextpdf.text.pdf.PdfContentByte, java.lang.Object, float) }, {@link #applySettings(com.itextpdf.text.Image) }, {@link com.itextpdf.text.Image#setAbsolutePosition(float, float) } and {@link #addToCanvas(float[], com.itextpdf.text.Image, com.itextpdf.text.pdf.PdfContentByte) }. @param canvas @param x @param y @param width @param height @param genericTag the value of genericTag @throws VectorPrintException
[ "Calls", "{", "@link", "#createImage", "(", "com", ".", "itextpdf", ".", "text", ".", "pdf", ".", "PdfContentByte", "java", ".", "lang", ".", "Object", "float", ")", "}", "{", "@link", "#applySettings", "(", "com", ".", "itextpdf", ".", "text", ".", "I...
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/Image.java#L106-L123
alkacon/opencms-core
src/org/opencms/ui/apps/A_CmsWorkplaceApp.java
A_CmsWorkplaceApp.getParamFromState
public static String getParamFromState(String state, String paramName) { String prefix = PARAM_SEPARATOR + paramName + PARAM_ASSIGN; if (state.contains(prefix)) { String result = state.substring(state.indexOf(prefix) + prefix.length()); if (result.contains(PARAM_SEPARATOR)) { result = result.substring(0, result.indexOf(PARAM_SEPARATOR)); } return CmsEncoder.decode(result, CmsEncoder.ENCODING_UTF_8); } return null; }
java
public static String getParamFromState(String state, String paramName) { String prefix = PARAM_SEPARATOR + paramName + PARAM_ASSIGN; if (state.contains(prefix)) { String result = state.substring(state.indexOf(prefix) + prefix.length()); if (result.contains(PARAM_SEPARATOR)) { result = result.substring(0, result.indexOf(PARAM_SEPARATOR)); } return CmsEncoder.decode(result, CmsEncoder.ENCODING_UTF_8); } return null; }
[ "public", "static", "String", "getParamFromState", "(", "String", "state", ",", "String", "paramName", ")", "{", "String", "prefix", "=", "PARAM_SEPARATOR", "+", "paramName", "+", "PARAM_ASSIGN", ";", "if", "(", "state", ".", "contains", "(", "prefix", ")", ...
Parses the requested parameter from the given state.<p> @param state the state @param paramName the parameter name @return the parameter value
[ "Parses", "the", "requested", "parameter", "from", "the", "given", "state", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/A_CmsWorkplaceApp.java#L183-L194
elki-project/elki
addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/uncertain/RepresentativeUncertainClustering.java
RepresentativeUncertainClustering.runClusteringAlgorithm
protected Clustering<?> runClusteringAlgorithm(ResultHierarchy hierarchy, Result parent, DBIDs ids, DataStore<DoubleVector> store, int dim, String title) { SimpleTypeInformation<DoubleVector> t = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); Relation<DoubleVector> sample = new MaterializedRelation<>(t, ids, title, store); ProxyDatabase d = new ProxyDatabase(ids, sample); Clustering<?> clusterResult = samplesAlgorithm.run(d); d.getHierarchy().remove(sample); d.getHierarchy().remove(clusterResult); hierarchy.add(parent, sample); hierarchy.add(sample, clusterResult); return clusterResult; }
java
protected Clustering<?> runClusteringAlgorithm(ResultHierarchy hierarchy, Result parent, DBIDs ids, DataStore<DoubleVector> store, int dim, String title) { SimpleTypeInformation<DoubleVector> t = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); Relation<DoubleVector> sample = new MaterializedRelation<>(t, ids, title, store); ProxyDatabase d = new ProxyDatabase(ids, sample); Clustering<?> clusterResult = samplesAlgorithm.run(d); d.getHierarchy().remove(sample); d.getHierarchy().remove(clusterResult); hierarchy.add(parent, sample); hierarchy.add(sample, clusterResult); return clusterResult; }
[ "protected", "Clustering", "<", "?", ">", "runClusteringAlgorithm", "(", "ResultHierarchy", "hierarchy", ",", "Result", "parent", ",", "DBIDs", "ids", ",", "DataStore", "<", "DoubleVector", ">", "store", ",", "int", "dim", ",", "String", "title", ")", "{", "...
Run a clustering algorithm on a single instance. @param parent Parent result to attach to @param ids Object IDs to process @param store Input data @param dim Dimensionality @param title Title of relation @return Clustering result
[ "Run", "a", "clustering", "algorithm", "on", "a", "single", "instance", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/uncertain/RepresentativeUncertainClustering.java#L310-L320
lastaflute/lastaflute
src/main/java/org/lastaflute/web/hook/GodHandEpilogue.java
GodHandEpilogue.handleTooManySqlExecution
protected void handleTooManySqlExecution(ActionRuntime runtime, ExecutedSqlCounter sqlCounter, int sqlExecutionCountLimit) { final int totalCountOfSql = sqlCounter.getTotalCountOfSql(); final String actionDisp = buildActionDisp(runtime); logger.warn("*Too many SQL executions: {}/{} in {}", totalCountOfSql, sqlExecutionCountLimit, actionDisp); }
java
protected void handleTooManySqlExecution(ActionRuntime runtime, ExecutedSqlCounter sqlCounter, int sqlExecutionCountLimit) { final int totalCountOfSql = sqlCounter.getTotalCountOfSql(); final String actionDisp = buildActionDisp(runtime); logger.warn("*Too many SQL executions: {}/{} in {}", totalCountOfSql, sqlExecutionCountLimit, actionDisp); }
[ "protected", "void", "handleTooManySqlExecution", "(", "ActionRuntime", "runtime", ",", "ExecutedSqlCounter", "sqlCounter", ",", "int", "sqlExecutionCountLimit", ")", "{", "final", "int", "totalCountOfSql", "=", "sqlCounter", ".", "getTotalCountOfSql", "(", ")", ";", ...
Handle too many SQL executions. @param runtime The runtime meta of action execute. (NotNull) @param sqlCounter The counter object for SQL executions. (NotNull) @param sqlExecutionCountLimit The limit of SQL execution count for the action execute. (NotMinus: already checked here)
[ "Handle", "too", "many", "SQL", "executions", "." ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/hook/GodHandEpilogue.java#L114-L118
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDynacache.java
HTODDynacache.readTemplatesByRange
public Result readTemplatesByRange(int index, int length) { Result result = getFromResultPool(); if (!this.disableDependencyId) { Result other = readByRange(TEMPLATE_ID_DATA, index, length, !CHECK_EXPIRED, !FILTER); result.copy(other); returnToResultPool(other); } return result; }
java
public Result readTemplatesByRange(int index, int length) { Result result = getFromResultPool(); if (!this.disableDependencyId) { Result other = readByRange(TEMPLATE_ID_DATA, index, length, !CHECK_EXPIRED, !FILTER); result.copy(other); returnToResultPool(other); } return result; }
[ "public", "Result", "readTemplatesByRange", "(", "int", "index", ",", "int", "length", ")", "{", "Result", "result", "=", "getFromResultPool", "(", ")", ";", "if", "(", "!", "this", ".", "disableDependencyId", ")", "{", "Result", "other", "=", "readByRange",...
*********************************************************************** readTemplatesByRange() This method is used by CacheMonitor to retrive the templates from the disk. If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". The length of the max number of templates to be read. If length = -1, it reads all templates until the end. ***********************************************************************
[ "***********************************************************************", "readTemplatesByRange", "()", "This", "method", "is", "used", "by", "CacheMonitor", "to", "retrive", "the", "templates", "from", "the", "disk", ".", "If", "index", "=", "0", "it", "starts", "the"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDynacache.java#L1401-L1409
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricBuilder.java
MetricBuilder.withMaxValue
public MetricBuilder withMaxValue(Number value, String prettyPrintFormat) { max = new MetricValue(value.toString(), prettyPrintFormat); return this; }
java
public MetricBuilder withMaxValue(Number value, String prettyPrintFormat) { max = new MetricValue(value.toString(), prettyPrintFormat); return this; }
[ "public", "MetricBuilder", "withMaxValue", "(", "Number", "value", ",", "String", "prettyPrintFormat", ")", "{", "max", "=", "new", "MetricValue", "(", "value", ".", "toString", "(", ")", ",", "prettyPrintFormat", ")", ";", "return", "this", ";", "}" ]
Sets the maximum value of the metric to be built. @param value the maximum value of the metric @param prettyPrintFormat the format of the output (@see {@link DecimalFormat}) @return this
[ "Sets", "the", "maximum", "value", "of", "the", "metric", "to", "be", "built", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricBuilder.java#L127-L130
morimekta/utils
io-util/src/main/java/net/morimekta/util/Slice.java
Slice.strEquals
public final boolean strEquals(byte[] a, int aOff, int aLen) { if (aLen != len) { return false; } for (int i = 0; i < len; ++i) { if (a[aOff + i] != fb[off + i]) { return false; } } return true; }
java
public final boolean strEquals(byte[] a, int aOff, int aLen) { if (aLen != len) { return false; } for (int i = 0; i < len; ++i) { if (a[aOff + i] != fb[off + i]) { return false; } } return true; }
[ "public", "final", "boolean", "strEquals", "(", "byte", "[", "]", "a", ",", "int", "aOff", ",", "int", "aLen", ")", "{", "if", "(", "aLen", "!=", "len", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "...
Checks if the slice is equal to a portion of a given byte array. @param a The array to compare with. @param aOff The offset to compare with in the array. @param aLen The length to compare with. @return True if equal.
[ "Checks", "if", "the", "slice", "is", "equal", "to", "a", "portion", "of", "a", "given", "byte", "array", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/Slice.java#L173-L183
dkpro/dkpro-argumentation
dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java
JCasUtil2.haveSameSpan
public static boolean haveSameSpan(final Annotation anno1, final Annotation anno2) { return anno1.getBegin() == anno2.getBegin() && anno1.getEnd() == anno2.getEnd(); }
java
public static boolean haveSameSpan(final Annotation anno1, final Annotation anno2) { return anno1.getBegin() == anno2.getBegin() && anno1.getEnd() == anno2.getEnd(); }
[ "public", "static", "boolean", "haveSameSpan", "(", "final", "Annotation", "anno1", ",", "final", "Annotation", "anno2", ")", "{", "return", "anno1", ".", "getBegin", "(", ")", "==", "anno2", ".", "getBegin", "(", ")", "&&", "anno1", ".", "getEnd", "(", ...
Returns whether two annotations share the same span <p> The method checks the spans based on the begin and end indices and not based on the covered text. </p> @param anno1 first annotation @param anno2 second annotation @return whether the spans are identical
[ "Returns", "whether", "two", "annotations", "share", "the", "same", "span" ]
train
https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L199-L202
mnlipp/jgrapes
org.jgrapes.http/src/org/jgrapes/http/HttpConnector.java
HttpConnector.onInput
@Handler(channels = NetworkChannel.class) public void onInput(Input<ByteBuffer> event, TcpChannel netConnChannel) throws InterruptedException, ProtocolException { Optional<WebAppMsgChannel> appChannel = netConnChannel.associated(WebAppMsgChannel.class); if (appChannel.isPresent()) { appChannel.get().handleNetInput(event, netConnChannel); } }
java
@Handler(channels = NetworkChannel.class) public void onInput(Input<ByteBuffer> event, TcpChannel netConnChannel) throws InterruptedException, ProtocolException { Optional<WebAppMsgChannel> appChannel = netConnChannel.associated(WebAppMsgChannel.class); if (appChannel.isPresent()) { appChannel.get().handleNetInput(event, netConnChannel); } }
[ "@", "Handler", "(", "channels", "=", "NetworkChannel", ".", "class", ")", "public", "void", "onInput", "(", "Input", "<", "ByteBuffer", ">", "event", ",", "TcpChannel", "netConnChannel", ")", "throws", "InterruptedException", ",", "ProtocolException", "{", "Opt...
Processes any input from the network layer. @param event the event @param netConnChannel the network layer channel @throws InterruptedException if the thread is interrupted @throws ProtocolException if the protocol is violated
[ "Processes", "any", "input", "from", "the", "network", "layer", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpConnector.java#L239-L247
derari/cthul
strings/src/main/java/org/cthul/strings/JavaNames.java
JavaNames.UNDER_SCORE
public static StringBuilder UNDER_SCORE(final StringBuilder sb, final String... tokens) { return Strings.join(sb, "_", allToUpper(tokens)); }
java
public static StringBuilder UNDER_SCORE(final StringBuilder sb, final String... tokens) { return Strings.join(sb, "_", allToUpper(tokens)); }
[ "public", "static", "StringBuilder", "UNDER_SCORE", "(", "final", "StringBuilder", "sb", ",", "final", "String", "...", "tokens", ")", "{", "return", "Strings", ".", "join", "(", "sb", ",", "\"_\"", ",", "allToUpper", "(", "tokens", ")", ")", ";", "}" ]
Appends {@code tokens} to {@code target}, all upper case, separated by under_scores. @param tokens @param sb
[ "Appends", "{" ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/JavaNames.java#L168-L170
alkacon/opencms-core
src/org/opencms/ui/CmsUserIconHelper.java
CmsUserIconHelper.getSmallIconPath
public String getSmallIconPath(CmsObject cms, CmsUser user) { return getIconPath(cms, user, IconSize.Small); }
java
public String getSmallIconPath(CmsObject cms, CmsUser user) { return getIconPath(cms, user, IconSize.Small); }
[ "public", "String", "getSmallIconPath", "(", "CmsObject", "cms", ",", "CmsUser", "user", ")", "{", "return", "getIconPath", "(", "cms", ",", "user", ",", "IconSize", ".", "Small", ")", ";", "}" ]
Returns the small ident-icon path for the given user.<p> @param cms the cms context @param user the user @return the icon path
[ "Returns", "the", "small", "ident", "-", "icon", "path", "for", "the", "given", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsUserIconHelper.java#L231-L234
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java
UsersInner.listAsync
public Observable<Page<UserInner>> listAsync(final String resourceGroupName, final String labAccountName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { return listWithServiceResponseAsync(resourceGroupName, labAccountName, labName, expand, filter, top, orderby) .map(new Func1<ServiceResponse<Page<UserInner>>, Page<UserInner>>() { @Override public Page<UserInner> call(ServiceResponse<Page<UserInner>> response) { return response.body(); } }); }
java
public Observable<Page<UserInner>> listAsync(final String resourceGroupName, final String labAccountName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { return listWithServiceResponseAsync(resourceGroupName, labAccountName, labName, expand, filter, top, orderby) .map(new Func1<ServiceResponse<Page<UserInner>>, Page<UserInner>>() { @Override public Page<UserInner> call(ServiceResponse<Page<UserInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "UserInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "labAccountName", ",", "final", "String", "labName", ",", "final", "String", "expand", ",", "final", "String", "f...
List users in a given lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param expand Specify the $expand query. Example: 'properties($select=email)' @param filter The filter to apply to the operation. @param top The maximum number of resources to return from the operation. @param orderby The ordering expression for the results, using OData notation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UserInner&gt; object
[ "List", "users", "in", "a", "given", "lab", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java#L288-L296
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java
PublisherFlexible.getWrappedPublisher
private T getWrappedPublisher(Publisher flexiblePublisher, Class<T> type) { if (!(flexiblePublisher instanceof FlexiblePublisher)) { throw new IllegalArgumentException(String.format("Publisher should be of type: '%s'. Found type: '%s'", FlexiblePublisher.class, flexiblePublisher.getClass())); } List<ConditionalPublisher> conditions = ((FlexiblePublisher) flexiblePublisher).getPublishers(); for (ConditionalPublisher condition : conditions) { if (type.isInstance(condition.getPublisher())) { return type.cast(condition.getPublisher()); } } return null; }
java
private T getWrappedPublisher(Publisher flexiblePublisher, Class<T> type) { if (!(flexiblePublisher instanceof FlexiblePublisher)) { throw new IllegalArgumentException(String.format("Publisher should be of type: '%s'. Found type: '%s'", FlexiblePublisher.class, flexiblePublisher.getClass())); } List<ConditionalPublisher> conditions = ((FlexiblePublisher) flexiblePublisher).getPublishers(); for (ConditionalPublisher condition : conditions) { if (type.isInstance(condition.getPublisher())) { return type.cast(condition.getPublisher()); } } return null; }
[ "private", "T", "getWrappedPublisher", "(", "Publisher", "flexiblePublisher", ",", "Class", "<", "T", ">", "type", ")", "{", "if", "(", "!", "(", "flexiblePublisher", "instanceof", "FlexiblePublisher", ")", ")", "{", "throw", "new", "IllegalArgumentException", "...
Gets the publisher wrapped by the specofoed FlexiblePublisher. @param publisher The FlexiblePublisher wrapping the publisher. @param type The type of the publisher wrapped by the FlexiblePublisher. @return The publisher object wrapped by the FlexiblePublisher. Null is returned if the FlexiblePublisher does not wrap a publisher of the specified type. @throws IllegalArgumentException In case publisher is not of type {@link org.jenkins_ci.plugins.flexible_publish.FlexiblePublisher}
[ "Gets", "the", "publisher", "wrapped", "by", "the", "specofoed", "FlexiblePublisher", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java#L29-L43
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java
VpnGatewaysInner.getByResourceGroupAsync
public Observable<VpnGatewayInner> getByResourceGroupAsync(String resourceGroupName, String gatewayName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<VpnGatewayInner>, VpnGatewayInner>() { @Override public VpnGatewayInner call(ServiceResponse<VpnGatewayInner> response) { return response.body(); } }); }
java
public Observable<VpnGatewayInner> getByResourceGroupAsync(String resourceGroupName, String gatewayName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<VpnGatewayInner>, VpnGatewayInner>() { @Override public VpnGatewayInner call(ServiceResponse<VpnGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnGatewayInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ")", ".", "map...
Retrieves the details of a virtual wan vpn gateway. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnGatewayInner object
[ "Retrieves", "the", "details", "of", "a", "virtual", "wan", "vpn", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java#L151-L158
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java
Journal.copyMetaFilesForUpgrade
private synchronized void copyMetaFilesForUpgrade() throws IOException { Configuration conf = new Configuration(); File currentDir = journalStorage.getSingularStorageDir().getCurrentDir(); File prevDir = journalStorage.getSingularStorageDir().getPreviousTmp(); FileSystem fs = FileSystem.getLocal(conf).getRaw(); FileUtil.copy(new File(prevDir, LAST_PROMISED_FILENAME), fs, new File( currentDir, LAST_PROMISED_FILENAME), false, conf); FileUtil.copy(new File(prevDir, LAST_WRITER_EPOCH), fs, new File( currentDir, LAST_WRITER_EPOCH), false, conf); FileUtil.copy(new File(prevDir, COMMITTED_TXID_FILENAME), fs, new File( currentDir, COMMITTED_TXID_FILENAME), false, conf); FileUtil.copy(new File(prevDir, JNStorage.PAXOS_DIR), fs, new File( currentDir, JNStorage.PAXOS_DIR), false, conf); }
java
private synchronized void copyMetaFilesForUpgrade() throws IOException { Configuration conf = new Configuration(); File currentDir = journalStorage.getSingularStorageDir().getCurrentDir(); File prevDir = journalStorage.getSingularStorageDir().getPreviousTmp(); FileSystem fs = FileSystem.getLocal(conf).getRaw(); FileUtil.copy(new File(prevDir, LAST_PROMISED_FILENAME), fs, new File( currentDir, LAST_PROMISED_FILENAME), false, conf); FileUtil.copy(new File(prevDir, LAST_WRITER_EPOCH), fs, new File( currentDir, LAST_WRITER_EPOCH), false, conf); FileUtil.copy(new File(prevDir, COMMITTED_TXID_FILENAME), fs, new File( currentDir, COMMITTED_TXID_FILENAME), false, conf); FileUtil.copy(new File(prevDir, JNStorage.PAXOS_DIR), fs, new File( currentDir, JNStorage.PAXOS_DIR), false, conf); }
[ "private", "synchronized", "void", "copyMetaFilesForUpgrade", "(", ")", "throws", "IOException", "{", "Configuration", "conf", "=", "new", "Configuration", "(", ")", ";", "File", "currentDir", "=", "journalStorage", ".", "getSingularStorageDir", "(", ")", ".", "ge...
After an upgrade we must ensure that the current directory still holds all epoch, committed txid and paxos files that it had before we did the upgrade.
[ "After", "an", "upgrade", "we", "must", "ensure", "that", "the", "current", "directory", "still", "holds", "all", "epoch", "committed", "txid", "and", "paxos", "files", "that", "it", "had", "before", "we", "did", "the", "upgrade", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L212-L226
OpenTSDB/opentsdb
src/query/expression/Expressions.java
Expressions.parseExpressions
public static List<ExpressionTree> parseExpressions( final List<String> expressions, final TSQuery ts_query, final List<String> metric_queries) { final List<ExpressionTree> trees = new ArrayList<ExpressionTree>(expressions.size()); for (final String expr: expressions) { final SyntaxChecker checker = new SyntaxChecker(new StringReader(expr)); checker.setMetricQueries(metric_queries); checker.setTSQuery(ts_query); try { trees.add(checker.EXPRESSION()); } catch (ParseException e) { throw new IllegalArgumentException("Failed to parse " + expr, e); } } return trees; }
java
public static List<ExpressionTree> parseExpressions( final List<String> expressions, final TSQuery ts_query, final List<String> metric_queries) { final List<ExpressionTree> trees = new ArrayList<ExpressionTree>(expressions.size()); for (final String expr: expressions) { final SyntaxChecker checker = new SyntaxChecker(new StringReader(expr)); checker.setMetricQueries(metric_queries); checker.setTSQuery(ts_query); try { trees.add(checker.EXPRESSION()); } catch (ParseException e) { throw new IllegalArgumentException("Failed to parse " + expr, e); } } return trees; }
[ "public", "static", "List", "<", "ExpressionTree", ">", "parseExpressions", "(", "final", "List", "<", "String", ">", "expressions", ",", "final", "TSQuery", "ts_query", ",", "final", "List", "<", "String", ">", "metric_queries", ")", "{", "final", "List", "...
Parses a list of string expressions into the proper trees, adding the metrics to the {@code metric_queries} list. @param expressions A list of zero or more expressions (if empty, you get an empty tree list back) @param ts_query The original query with timestamps @param metric_queries The list to fill with metrics to fetch
[ "Parses", "a", "list", "of", "string", "expressions", "into", "the", "proper", "trees", "adding", "the", "metrics", "to", "the", "{" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/expression/Expressions.java#L79-L96
SeaCloudsEU/SeaCloudsPlatform
sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRest.java
TemplateRest.updateTemplate
@PUT @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response updateTemplate(@Context HttpHeaders hh, String payload){ logger.debug("Insert /templates"); try{ TemplateHelper templateRestService = getTemplateHelper(); String serializedTemplate = templateRestService.updateTemplate(hh, payload); if (serializedTemplate !=null) return buildResponse(500, printError(500, "Error updating template the SLA Repository Database")); else return buildResponse(200, serializedTemplate); } catch (HelperException e) { logger.info("updateTemplate exception:"+e.getMessage()); return buildResponse(e); } }
java
@PUT @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response updateTemplate(@Context HttpHeaders hh, String payload){ logger.debug("Insert /templates"); try{ TemplateHelper templateRestService = getTemplateHelper(); String serializedTemplate = templateRestService.updateTemplate(hh, payload); if (serializedTemplate !=null) return buildResponse(500, printError(500, "Error updating template the SLA Repository Database")); else return buildResponse(200, serializedTemplate); } catch (HelperException e) { logger.info("updateTemplate exception:"+e.getMessage()); return buildResponse(e); } }
[ "@", "PUT", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_XML", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_XML", ")", "public", "Response", "updateTemplate", "(", "@", "Context", "HttpHeaders", "hh", ",", "String", "payload", ")", "{", ...
Updates the information of an specific template If the template it is not in the database, it returns 404 with empty payload <pre> PUT /templates Request: POST /templates HTTP/1.1 Accept: application/xml Response: {@code <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <message code="204" message="The template with uuid:contract-template-2007-12-04 was updated successfully"/> } </pre> Example: <li>curl -H "Content-type: application/xml" -X PUT -d @template01.xml localhost:8080/sla-service/templates</li> @return XML information that the template has been updated successfully
[ "Updates", "the", "information", "of", "an", "specific", "template", "If", "the", "template", "it", "is", "not", "in", "the", "database", "it", "returns", "404", "with", "empty", "payload" ]
train
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRest.java#L351-L367
auth0/jwks-rsa-java
src/main/java/com/auth0/jwk/JwkProviderBuilder.java
JwkProviderBuilder.build
public JwkProvider build() { JwkProvider urlProvider = new UrlJwkProvider(url); if (this.rateLimited) { urlProvider = new RateLimitedJwkProvider(urlProvider, bucket); } if (this.cached) { urlProvider = new GuavaCachedJwkProvider(urlProvider, cacheSize, expiresIn, expiresUnit); } return urlProvider; }
java
public JwkProvider build() { JwkProvider urlProvider = new UrlJwkProvider(url); if (this.rateLimited) { urlProvider = new RateLimitedJwkProvider(urlProvider, bucket); } if (this.cached) { urlProvider = new GuavaCachedJwkProvider(urlProvider, cacheSize, expiresIn, expiresUnit); } return urlProvider; }
[ "public", "JwkProvider", "build", "(", ")", "{", "JwkProvider", "urlProvider", "=", "new", "UrlJwkProvider", "(", "url", ")", ";", "if", "(", "this", ".", "rateLimited", ")", "{", "urlProvider", "=", "new", "RateLimitedJwkProvider", "(", "urlProvider", ",", ...
Creates a {@link JwkProvider} @return a newly created {@link JwkProvider}
[ "Creates", "a", "{", "@link", "JwkProvider", "}" ]
train
https://github.com/auth0/jwks-rsa-java/blob/9deba212be4278e50ae75a54b3bc6c96359b7e69/src/main/java/com/auth0/jwk/JwkProviderBuilder.java#L120-L129
netty/netty
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java
SpdySessionHandler.issueSessionError
private void issueSessionError( ChannelHandlerContext ctx, SpdySessionStatus status) { sendGoAwayFrame(ctx, status).addListener(new ClosingChannelFutureListener(ctx, ctx.newPromise())); }
java
private void issueSessionError( ChannelHandlerContext ctx, SpdySessionStatus status) { sendGoAwayFrame(ctx, status).addListener(new ClosingChannelFutureListener(ctx, ctx.newPromise())); }
[ "private", "void", "issueSessionError", "(", "ChannelHandlerContext", "ctx", ",", "SpdySessionStatus", "status", ")", "{", "sendGoAwayFrame", "(", "ctx", ",", "status", ")", ".", "addListener", "(", "new", "ClosingChannelFutureListener", "(", "ctx", ",", "ctx", "....
/* SPDY Session Error Handling: When a session error occurs, the endpoint encountering the error must first send a GOAWAY frame with the Stream-ID of the most recently received stream from the remote endpoint, and the error code for why the session is terminating. After sending the GOAWAY frame, the endpoint must close the TCP connection.
[ "/", "*", "SPDY", "Session", "Error", "Handling", ":" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java#L660-L664
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/util/Geometry.java
Geometry.getClockwiseAngleBetweenThreePoints
public static double getClockwiseAngleBetweenThreePoints(final Point2D p0, final Point2D c, final Point2D p1) { final Point2D a = c.sub(p1); final Point2D b = c.sub(p0); return Math.atan2(a.getY(), a.getX()) - Math.atan2(b.getY(), b.getX()); }
java
public static double getClockwiseAngleBetweenThreePoints(final Point2D p0, final Point2D c, final Point2D p1) { final Point2D a = c.sub(p1); final Point2D b = c.sub(p0); return Math.atan2(a.getY(), a.getX()) - Math.atan2(b.getY(), b.getX()); }
[ "public", "static", "double", "getClockwiseAngleBetweenThreePoints", "(", "final", "Point2D", "p0", ",", "final", "Point2D", "c", ",", "final", "Point2D", "p1", ")", "{", "final", "Point2D", "a", "=", "c", ".", "sub", "(", "p1", ")", ";", "final", "Point2D...
Returns the clockwise angle between three points. It starts at p0, that goes clock-wise around c until it reaches p1 @param p0 @param c @param p1 @return
[ "Returns", "the", "clockwise", "angle", "between", "three", "points", ".", "It", "starts", "at", "p0", "that", "goes", "clock", "-", "wise", "around", "c", "until", "it", "reaches", "p1" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/util/Geometry.java#L627-L634
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateEmpty
public static <T> T validateEmpty(T value, String errorMsg) throws ValidateException { if (isNotEmpty(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T> T validateEmpty(T value, String errorMsg) throws ValidateException { if (isNotEmpty(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", ">", "T", "validateEmpty", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "isNotEmpty", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsg", ")",...
验证是否为空,非空时抛出异常<br> 对于String类型判定是否为empty(null 或 "")<br> @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值,验证通过返回此值,空值 @throws ValidateException 验证异常
[ "验证是否为空,非空时抛出异常<br", ">", "对于String类型判定是否为empty", "(", "null", "或", ")", "<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L204-L209
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/network/BranchRemoteInterface.java
BranchRemoteInterface.make_restful_get
public final ServerResponse make_restful_get(String url, JSONObject params, String tag, String branchKey) { String modifiedUrl = url; params = params != null ? params : new JSONObject(); if (addCommonParams(params, branchKey)) { modifiedUrl += this.convertJSONtoString(params); } else { return new ServerResponse(tag, BranchError.ERR_BRANCH_KEY_INVALID); } long reqStartTime = System.currentTimeMillis(); PrefHelper.Debug("getting " + modifiedUrl); try { BranchResponse response = doRestfulGet(modifiedUrl); return processEntityForJSON(response.responseData, response.responseCode, tag); } catch (BranchRemoteException branchError) { if (branchError.branchErrorCode == BranchError.ERR_BRANCH_REQ_TIMED_OUT) { return new ServerResponse(tag, BranchError.ERR_BRANCH_REQ_TIMED_OUT); } else { // All other errors are considered as connectivity error return new ServerResponse(tag, BranchError.ERR_BRANCH_NO_CONNECTIVITY); } } finally { // Add total round trip time if (Branch.getInstance() != null) { int brttVal = (int) (System.currentTimeMillis() - reqStartTime); Branch.getInstance().addExtraInstrumentationData(tag + "-" + Defines.Jsonkey.Branch_Round_Trip_Time.getKey(), String.valueOf(brttVal)); } } }
java
public final ServerResponse make_restful_get(String url, JSONObject params, String tag, String branchKey) { String modifiedUrl = url; params = params != null ? params : new JSONObject(); if (addCommonParams(params, branchKey)) { modifiedUrl += this.convertJSONtoString(params); } else { return new ServerResponse(tag, BranchError.ERR_BRANCH_KEY_INVALID); } long reqStartTime = System.currentTimeMillis(); PrefHelper.Debug("getting " + modifiedUrl); try { BranchResponse response = doRestfulGet(modifiedUrl); return processEntityForJSON(response.responseData, response.responseCode, tag); } catch (BranchRemoteException branchError) { if (branchError.branchErrorCode == BranchError.ERR_BRANCH_REQ_TIMED_OUT) { return new ServerResponse(tag, BranchError.ERR_BRANCH_REQ_TIMED_OUT); } else { // All other errors are considered as connectivity error return new ServerResponse(tag, BranchError.ERR_BRANCH_NO_CONNECTIVITY); } } finally { // Add total round trip time if (Branch.getInstance() != null) { int brttVal = (int) (System.currentTimeMillis() - reqStartTime); Branch.getInstance().addExtraInstrumentationData(tag + "-" + Defines.Jsonkey.Branch_Round_Trip_Time.getKey(), String.valueOf(brttVal)); } } }
[ "public", "final", "ServerResponse", "make_restful_get", "(", "String", "url", ",", "JSONObject", "params", ",", "String", "tag", ",", "String", "branchKey", ")", "{", "String", "modifiedUrl", "=", "url", ";", "params", "=", "params", "!=", "null", "?", "par...
Method for handling the RESTful POST operations to Branch Servers. Internally calls abstract method {@link #doRestfulGet(String)} @param url The url end point @param params {@link JSONObject with parameters to the GET call} @param tag {@link String} Tag for identifying the request for analytical or debugging purpose @param branchKey {@link String} Branch key @return {@link ServerResponse} object representing the result of RESTful GET to Branch Server
[ "Method", "for", "handling", "the", "RESTful", "POST", "operations", "to", "Branch", "Servers", ".", "Internally", "calls", "abstract", "method", "{", "@link", "#doRestfulGet", "(", "String", ")", "}" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/network/BranchRemoteInterface.java#L86-L114
cojen/Cojen
src/main/java/org/cojen/classfile/ClassFile.java
ClassFile.addConstructor
public MethodInfo addConstructor(Modifiers modifiers, TypeDesc[] params) { MethodDesc md = MethodDesc.forArguments(null, params); MethodInfo mi = new MethodInfo(this, modifiers, "<init>", md); mMethods.add(mi); return mi; }
java
public MethodInfo addConstructor(Modifiers modifiers, TypeDesc[] params) { MethodDesc md = MethodDesc.forArguments(null, params); MethodInfo mi = new MethodInfo(this, modifiers, "<init>", md); mMethods.add(mi); return mi; }
[ "public", "MethodInfo", "addConstructor", "(", "Modifiers", "modifiers", ",", "TypeDesc", "[", "]", "params", ")", "{", "MethodDesc", "md", "=", "MethodDesc", ".", "forArguments", "(", "null", ",", "params", ")", ";", "MethodInfo", "mi", "=", "new", "MethodI...
Add a constructor to this class. @param params May be null if constructor accepts no parameters.
[ "Add", "a", "constructor", "to", "this", "class", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ClassFile.java#L799-L805
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java
SpecializedOps_DDRM.splitIntoVectors
public static DMatrixRMaj[] splitIntoVectors(DMatrix1Row A , boolean column ) { int w = column ? A.numCols : A.numRows; int M = column ? A.numRows : 1; int N = column ? 1 : A.numCols; int o = Math.max(M,N); DMatrixRMaj[] ret = new DMatrixRMaj[w]; for( int i = 0; i < w; i++ ) { DMatrixRMaj a = new DMatrixRMaj(M,N); if( column ) subvector(A,0,i,o,false,0,a); else subvector(A,i,0,o,true,0,a); ret[i] = a; } return ret; }
java
public static DMatrixRMaj[] splitIntoVectors(DMatrix1Row A , boolean column ) { int w = column ? A.numCols : A.numRows; int M = column ? A.numRows : 1; int N = column ? 1 : A.numCols; int o = Math.max(M,N); DMatrixRMaj[] ret = new DMatrixRMaj[w]; for( int i = 0; i < w; i++ ) { DMatrixRMaj a = new DMatrixRMaj(M,N); if( column ) subvector(A,0,i,o,false,0,a); else subvector(A,i,0,o,true,0,a); ret[i] = a; } return ret; }
[ "public", "static", "DMatrixRMaj", "[", "]", "splitIntoVectors", "(", "DMatrix1Row", "A", ",", "boolean", "column", ")", "{", "int", "w", "=", "column", "?", "A", ".", "numCols", ":", "A", ".", "numRows", ";", "int", "M", "=", "column", "?", "A", "."...
Takes a matrix and splits it into a set of row or column vectors. @param A original matrix. @param column If true then column vectors will be created. @return Set of vectors.
[ "Takes", "a", "matrix", "and", "splits", "it", "into", "a", "set", "of", "row", "or", "column", "vectors", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java#L339-L362
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jaas.common/src/com/ibm/ws/security/jaas/common/JAASConfigurationFactory.java
JAASConfigurationFactory.installJAASConfiguration
public synchronized void installJAASConfiguration(ConcurrentServiceReferenceMap<String, JAASLoginContextEntry> jaasLoginContextEntries) { jaasConfiguration = jaasConfigurationRef.getServiceWithException(); jaasConfiguration.setJaasLoginContextEntries(jaasLoginContextEntries); Map<String, List<AppConfigurationEntry>> jaasConfigurationEntries = jaasConfiguration.getEntries(); if (jaasSecurityConfiguration == null) { jaasSecurityConfiguration = new JAASSecurityConfiguration(); Configuration.setConfiguration(jaasSecurityConfiguration); } if (jaasConfigurationEntriesFromJaasConfig != null) { checkForDuplicateEntries(jaasConfigurationEntries); } jaasSecurityConfiguration.setAppConfigurationEntries(jaasConfigurationEntries); }
java
public synchronized void installJAASConfiguration(ConcurrentServiceReferenceMap<String, JAASLoginContextEntry> jaasLoginContextEntries) { jaasConfiguration = jaasConfigurationRef.getServiceWithException(); jaasConfiguration.setJaasLoginContextEntries(jaasLoginContextEntries); Map<String, List<AppConfigurationEntry>> jaasConfigurationEntries = jaasConfiguration.getEntries(); if (jaasSecurityConfiguration == null) { jaasSecurityConfiguration = new JAASSecurityConfiguration(); Configuration.setConfiguration(jaasSecurityConfiguration); } if (jaasConfigurationEntriesFromJaasConfig != null) { checkForDuplicateEntries(jaasConfigurationEntries); } jaasSecurityConfiguration.setAppConfigurationEntries(jaasConfigurationEntries); }
[ "public", "synchronized", "void", "installJAASConfiguration", "(", "ConcurrentServiceReferenceMap", "<", "String", ",", "JAASLoginContextEntry", ">", "jaasLoginContextEntries", ")", "{", "jaasConfiguration", "=", "jaasConfigurationRef", ".", "getServiceWithException", "(", ")...
This method install the JAAS configuration that specified in the server.xml/client.xml file
[ "This", "method", "install", "the", "JAAS", "configuration", "that", "specified", "in", "the", "server", ".", "xml", "/", "client", ".", "xml", "file" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaas.common/src/com/ibm/ws/security/jaas/common/JAASConfigurationFactory.java#L98-L111
fracpete/multisearch-weka-package
src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java
AbstractSearch.addPerformance
public void addPerformance(Performance performance, int folds) { m_Performances.add(performance); m_Cache.add(folds, performance); m_Trace.add(new AbstractMap.SimpleEntry<Integer, Performance>(folds, performance)); }
java
public void addPerformance(Performance performance, int folds) { m_Performances.add(performance); m_Cache.add(folds, performance); m_Trace.add(new AbstractMap.SimpleEntry<Integer, Performance>(folds, performance)); }
[ "public", "void", "addPerformance", "(", "Performance", "performance", ",", "int", "folds", ")", "{", "m_Performances", ".", "add", "(", "performance", ")", ";", "m_Cache", ".", "add", "(", "folds", ",", "performance", ")", ";", "m_Trace", ".", "add", "(",...
Adds the performance to the cache and the current list of performances. @param performance the performance to add @param folds the number of folds
[ "Adds", "the", "performance", "to", "the", "cache", "and", "the", "current", "list", "of", "performances", "." ]
train
https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L283-L288
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/MetricDto.java
MetricDto.transformToDto
public static List<MetricDto> transformToDto(List<Metric> metrics) { if (metrics == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } List<MetricDto> result = new ArrayList<>(); for (Metric metric : metrics) { result.add(transformToDto(metric)); } return result; }
java
public static List<MetricDto> transformToDto(List<Metric> metrics) { if (metrics == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } List<MetricDto> result = new ArrayList<>(); for (Metric metric : metrics) { result.add(transformToDto(metric)); } return result; }
[ "public", "static", "List", "<", "MetricDto", ">", "transformToDto", "(", "List", "<", "Metric", ">", "metrics", ")", "{", "if", "(", "metrics", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Null entity object cannot be converted to Dt...
Converts list of alert entity objects to list of alertDto objects. @param metrics List of alert entities. Cannot be null. @return List of alertDto objects. @throws WebApplicationException If an error occurs.
[ "Converts", "list", "of", "alert", "entity", "objects", "to", "list", "of", "alertDto", "objects", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/MetricDto.java#L91-L102
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfo.java
JSDocInfo.declareTypeTransformation
boolean declareTypeTransformation(String newName, Node expr) { lazyInitInfo(); if (isTemplateTypeName(newName)) { return false; } if (info.typeTransformations == null){ // A LinkedHashMap is used to keep the insertion order. The type // transformation expressions will be evaluated in this order. info.typeTransformations = new LinkedHashMap<>(); } else if (info.typeTransformations.containsKey(newName)) { return false; } info.typeTransformations.put(newName, expr); return true; }
java
boolean declareTypeTransformation(String newName, Node expr) { lazyInitInfo(); if (isTemplateTypeName(newName)) { return false; } if (info.typeTransformations == null){ // A LinkedHashMap is used to keep the insertion order. The type // transformation expressions will be evaluated in this order. info.typeTransformations = new LinkedHashMap<>(); } else if (info.typeTransformations.containsKey(newName)) { return false; } info.typeTransformations.put(newName, expr); return true; }
[ "boolean", "declareTypeTransformation", "(", "String", "newName", ",", "Node", "expr", ")", "{", "lazyInitInfo", "(", ")", ";", "if", "(", "isTemplateTypeName", "(", "newName", ")", ")", "{", "return", "false", ";", "}", "if", "(", "info", ".", "typeTransf...
Declares a type transformation expression. These expressions are described using a {@code @template} annotation of the form {@code @template T := TTL-Expr =:} @param newName The name associated to the type transformation. @param expr The type transformation expression.
[ "Declares", "a", "type", "transformation", "expression", ".", "These", "expressions", "are", "described", "using", "a", "{", "@code", "@template", "}", "annotation", "of", "the", "form", "{", "@code", "@template", "T", ":", "=", "TTL", "-", "Expr", "=", ":...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1440-L1455
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java
ReflectionUtils.doWithFields
public static void doWithFields(Class<?> clazz, FieldCallback fc) throws IllegalArgumentException { doWithFields(clazz, fc, null); }
java
public static void doWithFields(Class<?> clazz, FieldCallback fc) throws IllegalArgumentException { doWithFields(clazz, fc, null); }
[ "public", "static", "void", "doWithFields", "(", "Class", "<", "?", ">", "clazz", ",", "FieldCallback", "fc", ")", "throws", "IllegalArgumentException", "{", "doWithFields", "(", "clazz", ",", "fc", ",", "null", ")", ";", "}" ]
Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields. @param clazz the target class to analyze @param fc the callback to invoke for each field
[ "Invoke", "the", "given", "callback", "on", "all", "fields", "in", "the", "target", "class", "going", "up", "the", "class", "hierarchy", "to", "get", "all", "declared", "fields", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java#L556-L558
nextreports/nextreports-server
src/ro/nextreports/server/util/StringUtil.java
StringUtil.replaceString
public static ReplacedString replaceString(String s, String find, String replace) { if (replace == null) replace = "-"; int index = -1; int l = find.length(); boolean replaced = false; do { index = s.indexOf(find, index); if (index >= 0) { replaced = true; s = s.substring(0, index) + replace + s.substring(index + l); } } while (index >= 0); return new ReplacedString(s, replaced); }
java
public static ReplacedString replaceString(String s, String find, String replace) { if (replace == null) replace = "-"; int index = -1; int l = find.length(); boolean replaced = false; do { index = s.indexOf(find, index); if (index >= 0) { replaced = true; s = s.substring(0, index) + replace + s.substring(index + l); } } while (index >= 0); return new ReplacedString(s, replaced); }
[ "public", "static", "ReplacedString", "replaceString", "(", "String", "s", ",", "String", "find", ",", "String", "replace", ")", "{", "if", "(", "replace", "==", "null", ")", "replace", "=", "\"-\"", ";", "int", "index", "=", "-", "1", ";", "int", "l",...
Replace a string with another @param s string to replace into @param find string to be replaced @param replace new string @return the string with replacements
[ "Replace", "a", "string", "with", "another" ]
train
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/util/StringUtil.java#L40-L53
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.addBusHalt
public BusItineraryHalt addBusHalt(UUID id, String name, BusItineraryHaltType type) { return this.addBusHalt(id, name, type, -1); }
java
public BusItineraryHalt addBusHalt(UUID id, String name, BusItineraryHaltType type) { return this.addBusHalt(id, name, type, -1); }
[ "public", "BusItineraryHalt", "addBusHalt", "(", "UUID", "id", ",", "String", "name", ",", "BusItineraryHaltType", "type", ")", "{", "return", "this", ".", "addBusHalt", "(", "id", ",", "name", ",", "type", ",", "-", "1", ")", ";", "}" ]
Add a bus halt inside the bus itinerary. <p>The insertion index is computed automatically @param id is the identifier of the bus halt. @param name is the name of the bus halt @param type is the type of the bus halt. @return the added bus halt, otherwise <code>null</code>
[ "Add", "a", "bus", "halt", "inside", "the", "bus", "itinerary", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1077-L1079
youseries/urule
urule-console/src/main/java/com/bstek/urule/console/repository/database/journal/DatabaseJournal.java
DatabaseJournal.createCheckSchemaOperation
protected CheckSchemaOperation createCheckSchemaOperation() { InputStream in = org.apache.jackrabbit.core.journal.DatabaseJournal.class.getResourceAsStream(databaseType + ".ddl"); return new CheckSchemaOperation(conHelper, in, schemaObjectPrefix + DEFAULT_JOURNAL_TABLE).addVariableReplacement( CheckSchemaOperation.SCHEMA_OBJECT_PREFIX_VARIABLE, schemaObjectPrefix); }
java
protected CheckSchemaOperation createCheckSchemaOperation() { InputStream in = org.apache.jackrabbit.core.journal.DatabaseJournal.class.getResourceAsStream(databaseType + ".ddl"); return new CheckSchemaOperation(conHelper, in, schemaObjectPrefix + DEFAULT_JOURNAL_TABLE).addVariableReplacement( CheckSchemaOperation.SCHEMA_OBJECT_PREFIX_VARIABLE, schemaObjectPrefix); }
[ "protected", "CheckSchemaOperation", "createCheckSchemaOperation", "(", ")", "{", "InputStream", "in", "=", "org", ".", "apache", ".", "jackrabbit", ".", "core", ".", "journal", ".", "DatabaseJournal", ".", "class", ".", "getResourceAsStream", "(", "databaseType", ...
This method is called from {@link #init(String, NamespaceResolver)} after the {@link #createConnectionHelper(DataSource)} method, and returns a default {@link CheckSchemaOperation}. Subclasses can overrride this implementation to get a customized implementation. @return a new {@link CheckSchemaOperation} instance
[ "This", "method", "is", "called", "from", "{", "@link", "#init", "(", "String", "NamespaceResolver", ")", "}", "after", "the", "{", "@link", "#createConnectionHelper", "(", "DataSource", ")", "}", "method", "and", "returns", "a", "default", "{", "@link", "Ch...
train
https://github.com/youseries/urule/blob/3fa0eb4439e97aa292e744bcbd88a9faa36661d8/urule-console/src/main/java/com/bstek/urule/console/repository/database/journal/DatabaseJournal.java#L283-L287
threerings/nenya
core/src/main/java/com/threerings/media/tile/TileManager.java
TileManager.getTile
public Tile getTile (int fqTileId, TileSet.Colorizer rizer) throws NoSuchTileSetException { return getTile(TileUtil.getTileSetId(fqTileId), TileUtil.getTileIndex(fqTileId), rizer); }
java
public Tile getTile (int fqTileId, TileSet.Colorizer rizer) throws NoSuchTileSetException { return getTile(TileUtil.getTileSetId(fqTileId), TileUtil.getTileIndex(fqTileId), rizer); }
[ "public", "Tile", "getTile", "(", "int", "fqTileId", ",", "TileSet", ".", "Colorizer", "rizer", ")", "throws", "NoSuchTileSetException", "{", "return", "getTile", "(", "TileUtil", ".", "getTileSetId", "(", "fqTileId", ")", ",", "TileUtil", ".", "getTileIndex", ...
Returns the {@link Tile} object with the specified fully qualified tile id. The supplied colorizer will be used to recolor the tile. @see TileUtil#getFQTileId
[ "Returns", "the", "{", "@link", "Tile", "}", "object", "with", "the", "specified", "fully", "qualified", "tile", "id", ".", "The", "supplied", "colorizer", "will", "be", "used", "to", "recolor", "the", "tile", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileManager.java#L205-L209
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java
BouncyCastleCertProcessingFactory.createCredential
public GlobusCredential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, int delegationMode) throws GeneralSecurityException { return createCredential(certs, privateKey, bits, lifetime, delegationMode, (X509ExtensionSet) null, null); }
java
public GlobusCredential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, int delegationMode) throws GeneralSecurityException { return createCredential(certs, privateKey, bits, lifetime, delegationMode, (X509ExtensionSet) null, null); }
[ "public", "GlobusCredential", "createCredential", "(", "X509Certificate", "[", "]", "certs", ",", "PrivateKey", "privateKey", ",", "int", "bits", ",", "int", "lifetime", ",", "int", "delegationMode", ")", "throws", "GeneralSecurityException", "{", "return", "createC...
Creates a new proxy credential from the specified certificate chain and a private key. @see #createCredential(X509Certificate[], PrivateKey, int, int, int, X509ExtensionSet, String) createCredential @deprecated
[ "Creates", "a", "new", "proxy", "credential", "from", "the", "specified", "certificate", "chain", "and", "a", "private", "key", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java#L174-L177
Alfresco/alfresco-sdk
plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AbstractRefreshWebappMojo.java
AbstractRefreshWebappMojo.makePostCall
private void makePostCall(URL alfrescoTomcatUrl, List<NameValuePair> postData, String operation) { CloseableHttpClient client = null; CloseableHttpResponse response = null; try { // Set up a HTTP POST request to the Alfresco Webapp we are targeting HttpHost targetHost = new HttpHost( alfrescoTomcatUrl.getHost(), alfrescoTomcatUrl.getPort(), alfrescoTomcatUrl.getProtocol()); // Set up authentication parameters CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials(refreshUsername, refreshPassword)); // Create the HTTP Client we will use to make the call client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); // Create AuthCache instance AuthCache authCache = new BasicAuthCache(); // Generate BASIC scheme object and add it to the local auth cache BasicScheme basicAuth = new BasicScheme(); authCache.put(targetHost, basicAuth); // Add AuthCache to the execution context HttpClientContext localContext = HttpClientContext.create(); localContext.setAuthCache(authCache); // Make the call to Refresh the Alfresco Webapp HttpPost httpPost = new HttpPost(alfrescoTomcatUrl.toURI()); response = client.execute(httpPost); if (postData != null) { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postData, "UTF-8"); httpPost.setEntity(entity); } httpPost.setHeader("Accept-Charset", "iso-8859-1,utf-8"); httpPost.setHeader("Accept-Language", "en-us"); response = client.execute(httpPost); // If no response, no method has been passed if (response == null) { getLog().error("POST request failed to " + alfrescoTomcatUrl.toString() + ", " + getAbortedMsg()); return; } // Check if we got a successful response or not int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK) { getLog().info("Successfull " + operation + " for " + refreshWebappName); } else { String reasonPhrase = response.getStatusLine().getReasonPhrase(); getLog().warn("Failed to " + operation + " for " + refreshWebappName + ". Response status: " + statusCode + ", message: " + reasonPhrase); } } catch (Exception ex) { getLog().error("POST request failed to " + alfrescoTomcatUrl.toString() + ", " + getAbortedMsg()); getLog().error("Exception Msg: " + ex.getMessage()); } finally { closeQuietly(response); closeQuietly(client); } }
java
private void makePostCall(URL alfrescoTomcatUrl, List<NameValuePair> postData, String operation) { CloseableHttpClient client = null; CloseableHttpResponse response = null; try { // Set up a HTTP POST request to the Alfresco Webapp we are targeting HttpHost targetHost = new HttpHost( alfrescoTomcatUrl.getHost(), alfrescoTomcatUrl.getPort(), alfrescoTomcatUrl.getProtocol()); // Set up authentication parameters CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials(refreshUsername, refreshPassword)); // Create the HTTP Client we will use to make the call client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); // Create AuthCache instance AuthCache authCache = new BasicAuthCache(); // Generate BASIC scheme object and add it to the local auth cache BasicScheme basicAuth = new BasicScheme(); authCache.put(targetHost, basicAuth); // Add AuthCache to the execution context HttpClientContext localContext = HttpClientContext.create(); localContext.setAuthCache(authCache); // Make the call to Refresh the Alfresco Webapp HttpPost httpPost = new HttpPost(alfrescoTomcatUrl.toURI()); response = client.execute(httpPost); if (postData != null) { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postData, "UTF-8"); httpPost.setEntity(entity); } httpPost.setHeader("Accept-Charset", "iso-8859-1,utf-8"); httpPost.setHeader("Accept-Language", "en-us"); response = client.execute(httpPost); // If no response, no method has been passed if (response == null) { getLog().error("POST request failed to " + alfrescoTomcatUrl.toString() + ", " + getAbortedMsg()); return; } // Check if we got a successful response or not int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK) { getLog().info("Successfull " + operation + " for " + refreshWebappName); } else { String reasonPhrase = response.getStatusLine().getReasonPhrase(); getLog().warn("Failed to " + operation + " for " + refreshWebappName + ". Response status: " + statusCode + ", message: " + reasonPhrase); } } catch (Exception ex) { getLog().error("POST request failed to " + alfrescoTomcatUrl.toString() + ", " + getAbortedMsg()); getLog().error("Exception Msg: " + ex.getMessage()); } finally { closeQuietly(response); closeQuietly(client); } }
[ "private", "void", "makePostCall", "(", "URL", "alfrescoTomcatUrl", ",", "List", "<", "NameValuePair", ">", "postData", ",", "String", "operation", ")", "{", "CloseableHttpClient", "client", "=", "null", ";", "CloseableHttpResponse", "response", "=", "null", ";", ...
Helper method to make a POST request to the Alfresco Webapp @param alfrescoTomcatUrl the URL for the webapp we want to post to @param postData the POST data that should be sent @param operation information about the operation we are performing
[ "Helper", "method", "to", "make", "a", "POST", "request", "to", "the", "Alfresco", "Webapp" ]
train
https://github.com/Alfresco/alfresco-sdk/blob/7f861a96726edb776293e2363ee85ef05643368b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AbstractRefreshWebappMojo.java#L211-L271
chr78rm/tracelogger
src/main/java/de/christofreichardt/diagnosis/file/FileTracerLog4jTee.java
FileTracerLog4jTee.adapt
@Override protected void adapt(LogLevel logLevel, Throwable throwable, Class clazz) { Logger logger = Logger.getLogger(clazz); Level level = convertToLog4jLevel(logLevel); logger.log(DebugLogTee.class.getName(), level, throwable.getMessage(), throwable); }
java
@Override protected void adapt(LogLevel logLevel, Throwable throwable, Class clazz) { Logger logger = Logger.getLogger(clazz); Level level = convertToLog4jLevel(logLevel); logger.log(DebugLogTee.class.getName(), level, throwable.getMessage(), throwable); }
[ "@", "Override", "protected", "void", "adapt", "(", "LogLevel", "logLevel", ",", "Throwable", "throwable", ",", "Class", "clazz", ")", "{", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "clazz", ")", ";", "Level", "level", "=", "convertToLog4jLev...
Routes the given information to the log4j system. @param logLevel {@inheritDoc} @param throwable {@inheritDoc} @param clazz {@inheritDoc}
[ "Routes", "the", "given", "information", "to", "the", "log4j", "system", "." ]
train
https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/file/FileTracerLog4jTee.java#L77-L83
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/handlers/BaseOperationCommand.java
BaseOperationCommand.addRequiredPath
protected void addRequiredPath(OperationRequestAddress requiredPath) { if(requiredPath == null) { throw new IllegalArgumentException("Required path can't be null."); } // there perhaps could be more but for now only one is allowed if(requiredAddress != null) { throw new IllegalStateException("Only one required address is allowed, atm."); } requiredAddress = requiredPath; final Iterator<Node> iterator = requiredAddress.iterator(); if(iterator.hasNext()) { final String firstType = iterator.next().getType(); dependsOnProfile = Util.SUBSYSTEM.equals(firstType) || Util.PROFILE.equals(firstType); } if(requiredAddress.endsOnType()) { requiredType = requiredAddress.toParentNode().getType(); } }
java
protected void addRequiredPath(OperationRequestAddress requiredPath) { if(requiredPath == null) { throw new IllegalArgumentException("Required path can't be null."); } // there perhaps could be more but for now only one is allowed if(requiredAddress != null) { throw new IllegalStateException("Only one required address is allowed, atm."); } requiredAddress = requiredPath; final Iterator<Node> iterator = requiredAddress.iterator(); if(iterator.hasNext()) { final String firstType = iterator.next().getType(); dependsOnProfile = Util.SUBSYSTEM.equals(firstType) || Util.PROFILE.equals(firstType); } if(requiredAddress.endsOnType()) { requiredType = requiredAddress.toParentNode().getType(); } }
[ "protected", "void", "addRequiredPath", "(", "OperationRequestAddress", "requiredPath", ")", "{", "if", "(", "requiredPath", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Required path can't be null.\"", ")", ";", "}", "// there perhaps cou...
Adds a node path which is required to exist before the command can be used. @param requiredPath node path which is required to exist before the command can be used.
[ "Adds", "a", "node", "path", "which", "is", "required", "to", "exist", "before", "the", "command", "can", "be", "used", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/BaseOperationCommand.java#L118-L136
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/crypto/totp/TOTPBuilder.java
TOTPBuilder.computeHmacSha
private byte[] computeHmacSha(byte[] keyBytes, byte[] text) { try { Mac hmac = Mac.getInstance("HmacSHA512"); SecretKeySpec macKey = new SecretKeySpec(keyBytes, "RAW"); hmac.init(macKey); return hmac.doFinal(text); } catch (GeneralSecurityException gse) { throw new UndeclaredThrowableException(gse); } }
java
private byte[] computeHmacSha(byte[] keyBytes, byte[] text) { try { Mac hmac = Mac.getInstance("HmacSHA512"); SecretKeySpec macKey = new SecretKeySpec(keyBytes, "RAW"); hmac.init(macKey); return hmac.doFinal(text); } catch (GeneralSecurityException gse) { throw new UndeclaredThrowableException(gse); } }
[ "private", "byte", "[", "]", "computeHmacSha", "(", "byte", "[", "]", "keyBytes", ",", "byte", "[", "]", "text", ")", "{", "try", "{", "Mac", "hmac", "=", "Mac", ".", "getInstance", "(", "\"HmacSHA512\"", ")", ";", "SecretKeySpec", "macKey", "=", "new"...
Returns the HMAC-SHA hash with {@code keyBytes} as the key, and {@code text} as the message. @param keyBytes the bytes to use for the HMAC key @param text the message or text to be authenticated @return the HMAC-SHA hash with {@code keyBytes} as the key, and {@code text} as the message.
[ "Returns", "the", "HMAC", "-", "SHA", "hash", "with", "{", "@code", "keyBytes", "}", "as", "the", "key", "and", "{", "@code", "text", "}", "as", "the", "message", "." ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/totp/TOTPBuilder.java#L243-L252
bmwcarit/joynr
java/javaapi/src/main/java/io/joynr/dispatcher/rpc/ReflectionUtils.java
ReflectionUtils.areMethodNameAndParameterTypesEqual
private static boolean areMethodNameAndParameterTypesEqual(Method methodA, Method methodB) { if (!methodA.getName().equals(methodB.getName())) { return false; } Class<?>[] methodAParameterTypes = methodA.getParameterTypes(); Class<?>[] methodBParameterTypes = methodB.getParameterTypes(); if (methodAParameterTypes.length != methodBParameterTypes.length) { return false; } for (int i = 0; i < methodAParameterTypes.length; i++) { if (!methodAParameterTypes[i].equals(methodBParameterTypes[i])) { return false; } } return true; }
java
private static boolean areMethodNameAndParameterTypesEqual(Method methodA, Method methodB) { if (!methodA.getName().equals(methodB.getName())) { return false; } Class<?>[] methodAParameterTypes = methodA.getParameterTypes(); Class<?>[] methodBParameterTypes = methodB.getParameterTypes(); if (methodAParameterTypes.length != methodBParameterTypes.length) { return false; } for (int i = 0; i < methodAParameterTypes.length; i++) { if (!methodAParameterTypes[i].equals(methodBParameterTypes[i])) { return false; } } return true; }
[ "private", "static", "boolean", "areMethodNameAndParameterTypesEqual", "(", "Method", "methodA", ",", "Method", "methodB", ")", "{", "if", "(", "!", "methodA", ".", "getName", "(", ")", ".", "equals", "(", "methodB", ".", "getName", "(", ")", ")", ")", "{"...
Compares to methods for equality based on name and parameter types.
[ "Compares", "to", "methods", "for", "equality", "based", "on", "name", "and", "parameter", "types", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/dispatcher/rpc/ReflectionUtils.java#L174-L190
code4everything/util
src/main/java/com/zhazhapan/util/dialog/Alerts.java
Alerts.getAlert
public static Alert getAlert(String title, String header, String content, AlertType alertType) { return getAlert(title, header, content, alertType, Modality.APPLICATION_MODAL, null, StageStyle.DECORATED); }
java
public static Alert getAlert(String title, String header, String content, AlertType alertType) { return getAlert(title, header, content, alertType, Modality.APPLICATION_MODAL, null, StageStyle.DECORATED); }
[ "public", "static", "Alert", "getAlert", "(", "String", "title", ",", "String", "header", ",", "String", "content", ",", "AlertType", "alertType", ")", "{", "return", "getAlert", "(", "title", ",", "header", ",", "content", ",", "alertType", ",", "Modality",...
获取{@link Alert}对象,modality默认为{@link Modality#APPLICATION_MODAL},window默认为null,style默认为{@link StageStyle#DECORATED} @param title 标题 @param header 信息头 @param content 内容 @param alertType {@link AlertType} @return {@link Alert}
[ "获取", "{", "@link", "Alert", "}", "对象,modality默认为", "{", "@link", "Modality#APPLICATION_MODAL", "}", ",window默认为null,style默认为", "{", "@link", "StageStyle#DECORATED", "}" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Alerts.java#L266-L268
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipSession.java
SipSession.sendRequestWithTransaction
public SipTransaction sendRequestWithTransaction(Request request, boolean viaProxy, Dialog dialog) { return sendRequestWithTransaction(request, viaProxy, dialog, null); }
java
public SipTransaction sendRequestWithTransaction(Request request, boolean viaProxy, Dialog dialog) { return sendRequestWithTransaction(request, viaProxy, dialog, null); }
[ "public", "SipTransaction", "sendRequestWithTransaction", "(", "Request", "request", ",", "boolean", "viaProxy", ",", "Dialog", "dialog", ")", "{", "return", "sendRequestWithTransaction", "(", "request", ",", "viaProxy", ",", "dialog", ",", "null", ")", ";", "}" ]
This basic method sends out a request message as part of a transaction. A test program should use this method when a response to a request is expected. The Request object passed in must be a fully formed Request with all required content, EXCEPT for the Via header branch parameter, which cannot be filled in until a client transaction is obtained. That happens in this method. If the Via branch value is set in the request parameter passed to this method, it is nulled out by this method so that a new client transaction can be created by the stack. This method returns when the request message has been sent out. The calling program must subsequently call the waitResponse() method to wait for the result (response, timeout, etc.). @param request The request to be sent out. @param viaProxy If true, send the message to the proxy. In this case a Route header is added by this method. Else send the message as is. In this case, for an INVITE request, a route header must have been added by the caller for the request routing to complete. @param dialog If not null, send the request via the given dialog. Else send it outside of any dialog. @return A SipTransaction object if the message was sent successfully, null otherwise. The calling program doesn't need to do anything with the returned SipTransaction other than pass it in to a subsequent call to waitResponse().
[ "This", "basic", "method", "sends", "out", "a", "request", "message", "as", "part", "of", "a", "transaction", ".", "A", "test", "program", "should", "use", "this", "method", "when", "a", "response", "to", "a", "request", "is", "expected", ".", "The", "Re...
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L935-L938
ontop/ontop
core/model/src/main/java/it/unibz/inf/ontop/iq/node/impl/OrderByNodeImpl.java
OrderByNodeImpl.liftChildConstructionNode
private IQTree liftChildConstructionNode(ConstructionNode newChildRoot, UnaryIQTree newChild, IQProperties liftedProperties) { UnaryIQTree newOrderByTree = iqFactory.createUnaryIQTree( applySubstitution(newChildRoot.getSubstitution()), newChild.getChild(), liftedProperties); return iqFactory.createUnaryIQTree(newChildRoot, newOrderByTree, liftedProperties); }
java
private IQTree liftChildConstructionNode(ConstructionNode newChildRoot, UnaryIQTree newChild, IQProperties liftedProperties) { UnaryIQTree newOrderByTree = iqFactory.createUnaryIQTree( applySubstitution(newChildRoot.getSubstitution()), newChild.getChild(), liftedProperties); return iqFactory.createUnaryIQTree(newChildRoot, newOrderByTree, liftedProperties); }
[ "private", "IQTree", "liftChildConstructionNode", "(", "ConstructionNode", "newChildRoot", ",", "UnaryIQTree", "newChild", ",", "IQProperties", "liftedProperties", ")", "{", "UnaryIQTree", "newOrderByTree", "=", "iqFactory", ".", "createUnaryIQTree", "(", "applySubstitution...
Lifts the construction node above and updates the order comparators
[ "Lifts", "the", "construction", "node", "above", "and", "updates", "the", "order", "comparators" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/iq/node/impl/OrderByNodeImpl.java#L69-L77
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzleStatement.java
DrizzleStatement.getGeneratedKeys
public ResultSet getGeneratedKeys() throws SQLException { if (queryResult != null && queryResult.getResultSetType() == ResultSetType.MODIFY) { final QueryResult genRes = ((ModifyQueryResult) queryResult).getGeneratedKeysResult(); return new DrizzleResultSet(genRes, this, getProtocol()); } return DrizzleResultSet.EMPTY; }
java
public ResultSet getGeneratedKeys() throws SQLException { if (queryResult != null && queryResult.getResultSetType() == ResultSetType.MODIFY) { final QueryResult genRes = ((ModifyQueryResult) queryResult).getGeneratedKeysResult(); return new DrizzleResultSet(genRes, this, getProtocol()); } return DrizzleResultSet.EMPTY; }
[ "public", "ResultSet", "getGeneratedKeys", "(", ")", "throws", "SQLException", "{", "if", "(", "queryResult", "!=", "null", "&&", "queryResult", ".", "getResultSetType", "(", ")", "==", "ResultSetType", ".", "MODIFY", ")", "{", "final", "QueryResult", "genRes", ...
Retrieves any auto-generated keys created as a result of executing this <code>Statement</code> object. If this <code>Statement</code> object did not generate any keys, an empty <code>ResultSet</code> object is returned. <p/> <p><B>Note:</B>If the columns which represent the auto-generated keys were not specified, the JDBC driver implementation will determine the columns which best represent the auto-generated keys. @return a <code>ResultSet</code> object containing the auto-generated key(s) generated by the execution of this <code>Statement</code> object @throws java.sql.SQLException if a database access error occurs or this method is called on a closed <code>Statement</code> @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.4
[ "Retrieves", "any", "auto", "-", "generated", "keys", "created", "as", "a", "result", "of", "executing", "this", "<code", ">", "Statement<", "/", "code", ">", "object", ".", "If", "this", "<code", ">", "Statement<", "/", "code", ">", "object", "did", "no...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleStatement.java#L481-L487
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.isPrimitiveOrVoidType
public static <T extends Tree> Matcher<T> isPrimitiveOrVoidType() { return new Matcher<T>() { @Override public boolean matches(T t, VisitorState state) { Type type = getType(t); return type != null && type.isPrimitiveOrVoid(); } }; }
java
public static <T extends Tree> Matcher<T> isPrimitiveOrVoidType() { return new Matcher<T>() { @Override public boolean matches(T t, VisitorState state) { Type type = getType(t); return type != null && type.isPrimitiveOrVoid(); } }; }
[ "public", "static", "<", "T", "extends", "Tree", ">", "Matcher", "<", "T", ">", "isPrimitiveOrVoidType", "(", ")", "{", "return", "new", "Matcher", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "T", "t", ",", "Vi...
Matches an AST node if its type is either a primitive type or a {@code void} type.
[ "Matches", "an", "AST", "node", "if", "its", "type", "is", "either", "a", "primitive", "type", "or", "a", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L486-L494
BioPAX/Paxtools
paxtools-core/src/main/java/org/biopax/paxtools/controller/EditorMapImpl.java
EditorMapImpl.registerEditorsWithSubClasses
protected void registerEditorsWithSubClasses(PropertyEditor editor, Class<? extends BioPAXElement> domain) { for (Class<? extends BioPAXElement> c : classToEditorMap.keySet()) { if (domain.isAssignableFrom(c)) { //workaround for participants - can be replaced w/ a general // annotation based system. For the time being, I am just handling it //as a special case if ((editor.getProperty().equals("PARTICIPANTS") && (conversion.class.isAssignableFrom(c) || control.class.isAssignableFrom(c))) || (editor.getProperty().equals("participant") && (Conversion.class.isAssignableFrom(c) || Control.class.isAssignableFrom(c)))) { if (log.isDebugEnabled()) { log.debug("skipping restricted participant property"); } } else { classToEditorMap.get(c).put(editor.getProperty(), editor); } } } if (editor instanceof ObjectPropertyEditor) { registerInverseEditors((ObjectPropertyEditor) editor); } }
java
protected void registerEditorsWithSubClasses(PropertyEditor editor, Class<? extends BioPAXElement> domain) { for (Class<? extends BioPAXElement> c : classToEditorMap.keySet()) { if (domain.isAssignableFrom(c)) { //workaround for participants - can be replaced w/ a general // annotation based system. For the time being, I am just handling it //as a special case if ((editor.getProperty().equals("PARTICIPANTS") && (conversion.class.isAssignableFrom(c) || control.class.isAssignableFrom(c))) || (editor.getProperty().equals("participant") && (Conversion.class.isAssignableFrom(c) || Control.class.isAssignableFrom(c)))) { if (log.isDebugEnabled()) { log.debug("skipping restricted participant property"); } } else { classToEditorMap.get(c).put(editor.getProperty(), editor); } } } if (editor instanceof ObjectPropertyEditor) { registerInverseEditors((ObjectPropertyEditor) editor); } }
[ "protected", "void", "registerEditorsWithSubClasses", "(", "PropertyEditor", "editor", ",", "Class", "<", "?", "extends", "BioPAXElement", ">", "domain", ")", "{", "for", "(", "Class", "<", "?", "extends", "BioPAXElement", ">", "c", ":", "classToEditorMap", ".",...
This method registers an editor with sub classes - i.e. inserts the editor to the proper value in editor maps. @param editor to be registered @param domain a subclass of the editor's original domain.
[ "This", "method", "registers", "an", "editor", "with", "sub", "classes", "-", "i", ".", "e", ".", "inserts", "the", "editor", "to", "the", "proper", "value", "in", "editor", "maps", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/EditorMapImpl.java#L145-L170
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java
DBaseFileAttributePool.getCollection
@Pure public static DBaseFileAttributeCollection getCollection(String resource, int recordNumber) { final DBaseFileAttributePool pool = getPool(resource); if (pool != null) { final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber); if (accessor != null) { return new DBaseFileAttributeCollection(accessor); } } return null; }
java
@Pure public static DBaseFileAttributeCollection getCollection(String resource, int recordNumber) { final DBaseFileAttributePool pool = getPool(resource); if (pool != null) { final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber); if (accessor != null) { return new DBaseFileAttributeCollection(accessor); } } return null; }
[ "@", "Pure", "public", "static", "DBaseFileAttributeCollection", "getCollection", "(", "String", "resource", ",", "int", "recordNumber", ")", "{", "final", "DBaseFileAttributePool", "pool", "=", "getPool", "(", "resource", ")", ";", "if", "(", "pool", "!=", "nul...
Get an attribute container that corresponds to the specified file <p>The resource should be located according to the {@link Class#getResource(String)} or {@link Class#getResourceAsStream(String)} functions. @param resource is the resource to read @param recordNumber is the index of the record inside the file ({@code 0..size-1}). @return a container or <code>null</code> on error
[ "Get", "an", "attribute", "container", "that", "corresponds", "to", "the", "specified", "file" ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L299-L309
OpenLiberty/open-liberty
dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Group.java
Group.setExtendedProperty
private void setExtendedProperty(String property, Object value) { String dataType = extendedPropertiesDataType.get(property); String valueClass = value.getClass().getSimpleName(); if (dataType.equals(valueClass) && !extendedMultiValuedProperties.contains(property)) { extendedPropertiesValue.put(property, value); } else if (dataType.equals(valueClass) && extendedMultiValuedProperties.contains(property)) { if (value instanceof List) { extendedPropertiesValue.put(property, value); } else { List<Object> values = (List<Object>) extendedPropertiesValue.get(property); if (values == null) { values = new ArrayList<Object>(); extendedPropertiesValue.put(property, values); } values.add(value); } } else { String type = value == null ? "null" : value.getClass().getName(); String msg = "Could not set extended property for Group property '" + property + "'. " + type + " is incompatible with " + dataType; throw new ClassCastException(msg); } }
java
private void setExtendedProperty(String property, Object value) { String dataType = extendedPropertiesDataType.get(property); String valueClass = value.getClass().getSimpleName(); if (dataType.equals(valueClass) && !extendedMultiValuedProperties.contains(property)) { extendedPropertiesValue.put(property, value); } else if (dataType.equals(valueClass) && extendedMultiValuedProperties.contains(property)) { if (value instanceof List) { extendedPropertiesValue.put(property, value); } else { List<Object> values = (List<Object>) extendedPropertiesValue.get(property); if (values == null) { values = new ArrayList<Object>(); extendedPropertiesValue.put(property, values); } values.add(value); } } else { String type = value == null ? "null" : value.getClass().getName(); String msg = "Could not set extended property for Group property '" + property + "'. " + type + " is incompatible with " + dataType; throw new ClassCastException(msg); } }
[ "private", "void", "setExtendedProperty", "(", "String", "property", ",", "Object", "value", ")", "{", "String", "dataType", "=", "extendedPropertiesDataType", ".", "get", "(", "property", ")", ";", "String", "valueClass", "=", "value", ".", "getClass", "(", "...
Set an extended property's value. @param property The property to set. @param value The value to set. @throws ClassCastException If the value was not of the correct data type.
[ "Set", "an", "extended", "property", "s", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security.wim.base/src/com/ibm/wsspi/security/wim/model/Group.java#L790-L812
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ws/ffdc/FFDCFilter.java
FFDCFilter.processException
public static void processException(Throwable th, String sourceId, String probeId, Object callerThis) { FFDCConfigurator.getDelegate().processException(th, sourceId, probeId, callerThis); }
java
public static void processException(Throwable th, String sourceId, String probeId, Object callerThis) { FFDCConfigurator.getDelegate().processException(th, sourceId, probeId, callerThis); }
[ "public", "static", "void", "processException", "(", "Throwable", "th", ",", "String", "sourceId", ",", "String", "probeId", ",", "Object", "callerThis", ")", "{", "FFDCConfigurator", ".", "getDelegate", "(", ")", ".", "processException", "(", "th", ",", "sour...
Write a first failure data capture record for the provided throwable @param th The throwable @param sourceId An identifier for the source of this record, for example the package and class name @param probeId A unique identifier within the source of this record, for example the source file line number @param callerThis The object making this call, which will be introspected for inclusion in the FFDC record
[ "Write", "a", "first", "failure", "data", "capture", "record", "for", "the", "provided", "throwable" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/ffdc/FFDCFilter.java#L59-L61
ontop/ontop
engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/TreeWitnessRewriter.java
TreeWitnessRewriter.isContainedIn
private static boolean isContainedIn(CQIE cq1, CQIE cq2) { if (!cq2.getHead().equals(cq1.getHead())) return false; for (Function atom : cq2.getBody()) if (!cq1.getBody().contains(atom)) return false; return true; }
java
private static boolean isContainedIn(CQIE cq1, CQIE cq2) { if (!cq2.getHead().equals(cq1.getHead())) return false; for (Function atom : cq2.getBody()) if (!cq1.getBody().contains(atom)) return false; return true; }
[ "private", "static", "boolean", "isContainedIn", "(", "CQIE", "cq1", ",", "CQIE", "cq2", ")", "{", "if", "(", "!", "cq2", ".", "getHead", "(", ")", ".", "equals", "(", "cq1", ".", "getHead", "(", ")", ")", ")", "return", "false", ";", "for", "(", ...
Check if query cq1 is contained in cq2, syntactically. That is, if the head of cq1 and cq2 are equal according to toString().equals and each atom in cq2 is also in the body of cq1 (also by means of toString().equals().
[ "Check", "if", "query", "cq1", "is", "contained", "in", "cq2", "syntactically", ".", "That", "is", "if", "the", "head", "of", "cq1", "and", "cq2", "are", "equal", "according", "to", "toString", "()", ".", "equals", "and", "each", "atom", "in", "cq2", "...
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/TreeWitnessRewriter.java#L566-L575
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/SortedCellTable.java
SortedCellTable.setList
public void setList(List<T> list) { dataProvider.getList().clear(); if (list != null) { for (T t : list) { dataProvider.getList().add(t); } } // Do a first-time sort based on which column was set in // setInitialSortColumn() if (initialSortColumn != null) { Collections.sort(dataProvider.getList(), new Comparator<T>() { @Override public int compare(T o1, T o2) { return (defaultSortOrderMap.get(initialSortColumn) ? 1 : -1) * comparators.get(initialSortColumn) .compare(o1, o2); } }); // Might as well get the little arrow on the header to make it // official getColumnSortList().push( new ColumnSortList.ColumnSortInfo(initialSortColumn, defaultSortOrderMap .get(initialSortColumn))); currentlySortedColumn = initialSortColumn; } }
java
public void setList(List<T> list) { dataProvider.getList().clear(); if (list != null) { for (T t : list) { dataProvider.getList().add(t); } } // Do a first-time sort based on which column was set in // setInitialSortColumn() if (initialSortColumn != null) { Collections.sort(dataProvider.getList(), new Comparator<T>() { @Override public int compare(T o1, T o2) { return (defaultSortOrderMap.get(initialSortColumn) ? 1 : -1) * comparators.get(initialSortColumn) .compare(o1, o2); } }); // Might as well get the little arrow on the header to make it // official getColumnSortList().push( new ColumnSortList.ColumnSortInfo(initialSortColumn, defaultSortOrderMap .get(initialSortColumn))); currentlySortedColumn = initialSortColumn; } }
[ "public", "void", "setList", "(", "List", "<", "T", ">", "list", ")", "{", "dataProvider", ".", "getList", "(", ")", ".", "clear", "(", ")", ";", "if", "(", "list", "!=", "null", ")", "{", "for", "(", "T", "t", ":", "list", ")", "{", "dataProvi...
Sets the table's data provider list and sorts the table based on the column given in {@link SortedCellTable#setInitialSortColumn(Column)} @param list
[ "Sets", "the", "table", "s", "data", "provider", "list", "and", "sorts", "the", "table", "based", "on", "the", "column", "given", "in", "{", "@link", "SortedCellTable#setInitialSortColumn", "(", "Column", ")", "}" ]
train
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/SortedCellTable.java#L195-L223
vanilladb/vanillacore
src/main/java/org/vanilladb/core/sql/predicate/Predicate.java
Predicate.joinPredicate
public Predicate joinPredicate(Schema sch1, Schema sch2) { Predicate result = new Predicate(); Schema newsch = new Schema(); newsch.addAll(sch1); newsch.addAll(sch2); for (Term t : terms) if (!t.isApplicableTo(sch1) && !t.isApplicableTo(sch2) && t.isApplicableTo(newsch)) result.terms.add(t); return result.terms.size() == 0 ? null : result; }
java
public Predicate joinPredicate(Schema sch1, Schema sch2) { Predicate result = new Predicate(); Schema newsch = new Schema(); newsch.addAll(sch1); newsch.addAll(sch2); for (Term t : terms) if (!t.isApplicableTo(sch1) && !t.isApplicableTo(sch2) && t.isApplicableTo(newsch)) result.terms.add(t); return result.terms.size() == 0 ? null : result; }
[ "public", "Predicate", "joinPredicate", "(", "Schema", "sch1", ",", "Schema", "sch2", ")", "{", "Predicate", "result", "=", "new", "Predicate", "(", ")", ";", "Schema", "newsch", "=", "new", "Schema", "(", ")", ";", "newsch", ".", "addAll", "(", "sch1", ...
Returns the sub-predicate consisting of terms that applies to the union of the two specified schemas, but not to either schema separately. @param sch1 the first schema @param sch2 the second schema @return the sub-predicate whose terms apply to the union of the two schemas but not either schema separately.
[ "Returns", "the", "sub", "-", "predicate", "consisting", "of", "terms", "that", "applies", "to", "the", "union", "of", "the", "two", "specified", "schemas", "but", "not", "to", "either", "schema", "separately", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/predicate/Predicate.java#L115-L125
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java
ObjectUtils.mapObjectOnFormModel
public static void mapObjectOnFormModel(FormModel formModel, Object objectToMap) { BeanWrapper beanWrapper = new BeanWrapperImpl(objectToMap); for (String fieldName : (Set<String>) formModel.getFieldNames()) { try { formModel.getValueModel(fieldName).setValue(beanWrapper.getPropertyValue(fieldName)); } catch (BeansException be) { // silently ignoring, just mapping values, so if there's one missing, don't bother } } }
java
public static void mapObjectOnFormModel(FormModel formModel, Object objectToMap) { BeanWrapper beanWrapper = new BeanWrapperImpl(objectToMap); for (String fieldName : (Set<String>) formModel.getFieldNames()) { try { formModel.getValueModel(fieldName).setValue(beanWrapper.getPropertyValue(fieldName)); } catch (BeansException be) { // silently ignoring, just mapping values, so if there's one missing, don't bother } } }
[ "public", "static", "void", "mapObjectOnFormModel", "(", "FormModel", "formModel", ",", "Object", "objectToMap", ")", "{", "BeanWrapper", "beanWrapper", "=", "new", "BeanWrapperImpl", "(", "objectToMap", ")", ";", "for", "(", "String", "fieldName", ":", "(", "Se...
This method tries to map the values of the given object on the valueModels of the formModel. Instead of setting the object as a backing object, all valueModels are processed one by one and the corresponding property value is fetched from the objectToMap and set on that valueModel. This triggers the usual buffering etc. just as if the user entered the values. @param formModel @param objectToMap
[ "This", "method", "tries", "to", "map", "the", "values", "of", "the", "given", "object", "on", "the", "valueModels", "of", "the", "formModel", ".", "Instead", "of", "setting", "the", "object", "as", "a", "backing", "object", "all", "valueModels", "are", "p...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L327-L341
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/RedmineManagerFactory.java
RedmineManagerFactory.createWithUserAuth
public static RedmineManager createWithUserAuth(String uri, String login, String password, HttpClient httpClient) { final Transport transport = new Transport( new URIConfigurator(uri, null), httpClient); transport.setCredentials(login, password); return new RedmineManager(transport); }
java
public static RedmineManager createWithUserAuth(String uri, String login, String password, HttpClient httpClient) { final Transport transport = new Transport( new URIConfigurator(uri, null), httpClient); transport.setCredentials(login, password); return new RedmineManager(transport); }
[ "public", "static", "RedmineManager", "createWithUserAuth", "(", "String", "uri", ",", "String", "login", ",", "String", "password", ",", "HttpClient", "httpClient", ")", "{", "final", "Transport", "transport", "=", "new", "Transport", "(", "new", "URIConfigurator...
Creates a new redmine managen with user-based authentication. @param uri redmine manager URI. @param login user's name. @param password user's password. @param httpClient you can provide your own pre-configured HttpClient if you want to control connection pooling, manage connections eviction, closing, etc.
[ "Creates", "a", "new", "redmine", "managen", "with", "user", "-", "based", "authentication", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/RedmineManagerFactory.java#L140-L146
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.batchSynonyms
public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, boolean replaceExistingSynonyms, RequestOptions requestOptions) throws AlgoliaException { JSONArray array = new JSONArray(); for (JSONObject obj : objects) { array.put(obj); } return client.postRequest("/1/indexes/" + encodedIndexName + "/synonyms/batch?forwardToReplicas=" + forwardToReplicas + "&replaceExistingSynonyms=" + replaceExistingSynonyms, array.toString(), true, false, requestOptions); }
java
public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, boolean replaceExistingSynonyms, RequestOptions requestOptions) throws AlgoliaException { JSONArray array = new JSONArray(); for (JSONObject obj : objects) { array.put(obj); } return client.postRequest("/1/indexes/" + encodedIndexName + "/synonyms/batch?forwardToReplicas=" + forwardToReplicas + "&replaceExistingSynonyms=" + replaceExistingSynonyms, array.toString(), true, false, requestOptions); }
[ "public", "JSONObject", "batchSynonyms", "(", "List", "<", "JSONObject", ">", "objects", ",", "boolean", "forwardToReplicas", ",", "boolean", "replaceExistingSynonyms", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "JSONArray", "array"...
Add or Replace a list of synonyms @param objects List of synonyms @param forwardToReplicas Forward the operation to the replica indices @param replaceExistingSynonyms Replace the existing synonyms with this batch @param requestOptions Options to pass to this request
[ "Add", "or", "Replace", "a", "list", "of", "synonyms" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1583-L1590
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Times.java
Times.isSameDay
public static boolean isSameDay(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE); }
java
public static boolean isSameDay(final Date date1, final Date date2) { final Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE); }
[ "public", "static", "boolean", "isSameDay", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "final", "Calendar", "cal1", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal1", ".", "setTime", "(", "date1", ")", ";", "final", ...
Determines whether the specified date1 is the same day with the specified date2. @param date1 the specified date1 @param date2 the specified date2 @return {@code true} if it is the same day, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "date1", "is", "the", "same", "day", "with", "the", "specified", "date2", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Times.java#L126-L133
alkacon/opencms-core
src/org/opencms/db/CmsUserSettings.java
CmsUserSettings.getAdditionalPreference
public static String getAdditionalPreference(CmsObject cms, String key, boolean useDefault) { CmsUser user = cms.getRequestContext().getCurrentUser(); CmsUserSettings settings = new CmsUserSettings(user); return settings.getAdditionalPreference(key, useDefault); }
java
public static String getAdditionalPreference(CmsObject cms, String key, boolean useDefault) { CmsUser user = cms.getRequestContext().getCurrentUser(); CmsUserSettings settings = new CmsUserSettings(user); return settings.getAdditionalPreference(key, useDefault); }
[ "public", "static", "String", "getAdditionalPreference", "(", "CmsObject", "cms", ",", "String", "key", ",", "boolean", "useDefault", ")", "{", "CmsUser", "user", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ";", "CmsUserSet...
Gets a configured preference.<p> @param cms the cms context @param key the settings key @param useDefault true if we want the default value if no value is configured @return the preference value
[ "Gets", "a", "configured", "preference", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L455-L460
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryInstantiatedChaincodes
public List<ChaincodeInfo> queryInstantiatedChaincodes(Peer peer) throws InvalidArgumentException, ProposalException { return queryInstantiatedChaincodes(peer, client.getUserContext()); }
java
public List<ChaincodeInfo> queryInstantiatedChaincodes(Peer peer) throws InvalidArgumentException, ProposalException { return queryInstantiatedChaincodes(peer, client.getUserContext()); }
[ "public", "List", "<", "ChaincodeInfo", ">", "queryInstantiatedChaincodes", "(", "Peer", "peer", ")", "throws", "InvalidArgumentException", ",", "ProposalException", "{", "return", "queryInstantiatedChaincodes", "(", "peer", ",", "client", ".", "getUserContext", "(", ...
Query peer for chaincode that has been instantiated <STRONG>This method may not be thread safe if client context is changed!</STRONG> @param peer The peer to query. @return A list of ChaincodeInfo @see {@link ChaincodeInfo} @throws InvalidArgumentException @throws ProposalException
[ "Query", "peer", "for", "chaincode", "that", "has", "been", "instantiated" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3868-L3871
geomajas/geomajas-project-server
plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayerUtil.java
HibernateLayerUtil.getPropertyClass
protected Class<?> getPropertyClass(ClassMetadata meta, String propertyName) throws HibernateLayerException { // try to assure the correct separator is used propertyName = propertyName.replace(XPATH_SEPARATOR, SEPARATOR); if (propertyName.contains(SEPARATOR)) { String directProperty = propertyName.substring(0, propertyName.indexOf(SEPARATOR)); try { Type prop = meta.getPropertyType(directProperty); if (prop.isCollectionType()) { CollectionType coll = (CollectionType) prop; prop = coll.getElementType((SessionFactoryImplementor) sessionFactory); } ClassMetadata propMeta = sessionFactory.getClassMetadata(prop.getReturnedClass()); return getPropertyClass(propMeta, propertyName.substring(propertyName.indexOf(SEPARATOR) + 1)); } catch (HibernateException e) { throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_COULD_NOT_RESOLVE, propertyName, meta.getEntityName()); } } else { try { return meta.getPropertyType(propertyName).getReturnedClass(); } catch (HibernateException e) { throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_COULD_NOT_RESOLVE, propertyName, meta.getEntityName()); } } }
java
protected Class<?> getPropertyClass(ClassMetadata meta, String propertyName) throws HibernateLayerException { // try to assure the correct separator is used propertyName = propertyName.replace(XPATH_SEPARATOR, SEPARATOR); if (propertyName.contains(SEPARATOR)) { String directProperty = propertyName.substring(0, propertyName.indexOf(SEPARATOR)); try { Type prop = meta.getPropertyType(directProperty); if (prop.isCollectionType()) { CollectionType coll = (CollectionType) prop; prop = coll.getElementType((SessionFactoryImplementor) sessionFactory); } ClassMetadata propMeta = sessionFactory.getClassMetadata(prop.getReturnedClass()); return getPropertyClass(propMeta, propertyName.substring(propertyName.indexOf(SEPARATOR) + 1)); } catch (HibernateException e) { throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_COULD_NOT_RESOLVE, propertyName, meta.getEntityName()); } } else { try { return meta.getPropertyType(propertyName).getReturnedClass(); } catch (HibernateException e) { throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_COULD_NOT_RESOLVE, propertyName, meta.getEntityName()); } } }
[ "protected", "Class", "<", "?", ">", "getPropertyClass", "(", "ClassMetadata", "meta", ",", "String", "propertyName", ")", "throws", "HibernateLayerException", "{", "// try to assure the correct separator is used", "propertyName", "=", "propertyName", ".", "replace", "(",...
Return the class of one of the properties of another class from which the Hibernate metadata is given. @param meta The parent class to search a property in. @param propertyName The name of the property in the parent class (provided by meta) @return Returns the class of the property in question. @throws HibernateLayerException Throws an exception if the property name could not be retrieved.
[ "Return", "the", "class", "of", "one", "of", "the", "properties", "of", "another", "class", "from", "which", "the", "Hibernate", "metadata", "is", "given", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayerUtil.java#L102-L128
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Crypts.java
Crypts.signHmacSHA1
public static String signHmacSHA1(final String source, final String secret) { try { final Mac mac = Mac.getInstance("HmacSHA1"); mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA1")); final byte[] signData = mac.doFinal(source.getBytes("UTF-8")); return new String(Base64.encodeBase64(signData), "UTF-8"); } catch (final Exception e) { throw new RuntimeException("HMAC-SHA1 sign failed", e); } }
java
public static String signHmacSHA1(final String source, final String secret) { try { final Mac mac = Mac.getInstance("HmacSHA1"); mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA1")); final byte[] signData = mac.doFinal(source.getBytes("UTF-8")); return new String(Base64.encodeBase64(signData), "UTF-8"); } catch (final Exception e) { throw new RuntimeException("HMAC-SHA1 sign failed", e); } }
[ "public", "static", "String", "signHmacSHA1", "(", "final", "String", "source", ",", "final", "String", "secret", ")", "{", "try", "{", "final", "Mac", "mac", "=", "Mac", ".", "getInstance", "(", "\"HmacSHA1\"", ")", ";", "mac", ".", "init", "(", "new", ...
Signs the specified source string using the specified secret. @param source the specified source string @param secret the specified secret @return signed string
[ "Signs", "the", "specified", "source", "string", "using", "the", "specified", "secret", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Crypts.java#L46-L56
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryDetectPoint.java
FactoryDetectPoint.createKitRos
public static <T extends ImageGray<T>, D extends ImageGray<D>> GeneralFeatureDetector<T, D> createKitRos(@Nullable ConfigGeneralDetector configDetector, Class<D> derivType) { if( configDetector == null) configDetector = new ConfigGeneralDetector(); GeneralFeatureIntensity<T, D> intensity = new WrapperKitRosCornerIntensity<>(derivType); return createGeneral(intensity, configDetector); }
java
public static <T extends ImageGray<T>, D extends ImageGray<D>> GeneralFeatureDetector<T, D> createKitRos(@Nullable ConfigGeneralDetector configDetector, Class<D> derivType) { if( configDetector == null) configDetector = new ConfigGeneralDetector(); GeneralFeatureIntensity<T, D> intensity = new WrapperKitRosCornerIntensity<>(derivType); return createGeneral(intensity, configDetector); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "D", "extends", "ImageGray", "<", "D", ">", ">", "GeneralFeatureDetector", "<", "T", ",", "D", ">", "createKitRos", "(", "@", "Nullable", "ConfigGeneralDetector", "configDetector", ","...
Detects Kitchen and Rosenfeld corners. @param configDetector Configuration for feature detector. @param derivType Type of derivative image. @see boofcv.alg.feature.detect.intensity.KitRosCornerIntensity
[ "Detects", "Kitchen", "and", "Rosenfeld", "corners", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryDetectPoint.java#L110-L117
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java
TmdbGenres.getGenreList
private ResultList<Genre> getGenreList(String language, MethodSub sub) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.GENRE).subMethod(sub).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperGenres wrapper = MAPPER.readValue(webpage, WrapperGenres.class); ResultList<Genre> results = new ResultList<>(wrapper.getGenres()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get genre " + sub.toString(), url, ex); } }
java
private ResultList<Genre> getGenreList(String language, MethodSub sub) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.GENRE).subMethod(sub).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperGenres wrapper = MAPPER.readValue(webpage, WrapperGenres.class); ResultList<Genre> results = new ResultList<>(wrapper.getGenres()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get genre " + sub.toString(), url, ex); } }
[ "private", "ResultList", "<", "Genre", ">", "getGenreList", "(", "String", "language", ",", "MethodSub", "sub", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", ...
Get the list of genres for movies or TV @param language @param sub @return @throws MovieDbException
[ "Get", "the", "list", "of", "genres", "for", "movies", "or", "TV" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java#L85-L100
Stratio/stratio-cassandra
src/java/org/apache/cassandra/auth/Auth.java
Auth.setupTable
public static void setupTable(String name, String cql) { if (Schema.instance.getCFMetaData(AUTH_KS, name) == null) { try { CFStatement parsed = (CFStatement)QueryProcessor.parseStatement(cql); parsed.prepareKeyspace(AUTH_KS); CreateTableStatement statement = (CreateTableStatement) parsed.prepare().statement; CFMetaData cfm = statement.getCFMetaData().copy(CFMetaData.generateLegacyCfId(AUTH_KS, name)); assert cfm.cfName.equals(name); MigrationManager.announceNewColumnFamily(cfm); } catch (Exception e) { throw new AssertionError(e); } } }
java
public static void setupTable(String name, String cql) { if (Schema.instance.getCFMetaData(AUTH_KS, name) == null) { try { CFStatement parsed = (CFStatement)QueryProcessor.parseStatement(cql); parsed.prepareKeyspace(AUTH_KS); CreateTableStatement statement = (CreateTableStatement) parsed.prepare().statement; CFMetaData cfm = statement.getCFMetaData().copy(CFMetaData.generateLegacyCfId(AUTH_KS, name)); assert cfm.cfName.equals(name); MigrationManager.announceNewColumnFamily(cfm); } catch (Exception e) { throw new AssertionError(e); } } }
[ "public", "static", "void", "setupTable", "(", "String", "name", ",", "String", "cql", ")", "{", "if", "(", "Schema", ".", "instance", ".", "getCFMetaData", "(", "AUTH_KS", ",", "name", ")", "==", "null", ")", "{", "try", "{", "CFStatement", "parsed", ...
Set up table from given CREATE TABLE statement under system_auth keyspace, if not already done so. @param name name of the table @param cql CREATE TABLE statement
[ "Set", "up", "table", "from", "given", "CREATE", "TABLE", "statement", "under", "system_auth", "keyspace", "if", "not", "already", "done", "so", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/auth/Auth.java#L203-L221
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java
ComponentFactory.newFragment
public static Fragment newFragment(final String id, final String markupId, final MarkupContainer markupProvider) { return newFragment(id, markupId, markupProvider, null); }
java
public static Fragment newFragment(final String id, final String markupId, final MarkupContainer markupProvider) { return newFragment(id, markupId, markupProvider, null); }
[ "public", "static", "Fragment", "newFragment", "(", "final", "String", "id", ",", "final", "String", "markupId", ",", "final", "MarkupContainer", "markupProvider", ")", "{", "return", "newFragment", "(", "id", ",", "markupId", ",", "markupProvider", ",", "null",...
Factory method for create a new {@link Fragment}. @param id the id @param markupId The associated id of the associated markup fragment @param markupProvider The component whose markup contains the fragment's markup @return The new {@link Fragment}.
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "Fragment", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L315-L319
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/detect/BadSyntaxForRegularExpression.java
BadSyntaxForRegularExpression.getIntValue
private int getIntValue(int stackDepth, int defaultValue) { if (stack.getStackDepth() < stackDepth) { return defaultValue; } OpcodeStack.Item it = stack.getStackItem(stackDepth); Object value = it.getConstant(); if (!(value instanceof Integer)) { return defaultValue; } return ((Number) value).intValue(); }
java
private int getIntValue(int stackDepth, int defaultValue) { if (stack.getStackDepth() < stackDepth) { return defaultValue; } OpcodeStack.Item it = stack.getStackItem(stackDepth); Object value = it.getConstant(); if (!(value instanceof Integer)) { return defaultValue; } return ((Number) value).intValue(); }
[ "private", "int", "getIntValue", "(", "int", "stackDepth", ",", "int", "defaultValue", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<", "stackDepth", ")", "{", "return", "defaultValue", ";", "}", "OpcodeStack", ".", "Item", "it", "=", "...
return an int on the stack, or 'defaultValue' if can't determine
[ "return", "an", "int", "on", "the", "stack", "or", "defaultValue", "if", "can", "t", "determine" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/detect/BadSyntaxForRegularExpression.java#L119-L129
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getAccountAdjustments
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type, final Adjustments.AdjustmentState state) { return getAccountAdjustments(accountCode, type, state, new QueryParams()); }
java
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type, final Adjustments.AdjustmentState state) { return getAccountAdjustments(accountCode, type, state, new QueryParams()); }
[ "public", "Adjustments", "getAccountAdjustments", "(", "final", "String", "accountCode", ",", "final", "Adjustments", ".", "AdjustmentType", "type", ",", "final", "Adjustments", ".", "AdjustmentState", "state", ")", "{", "return", "getAccountAdjustments", "(", "accoun...
Get Account Adjustments <p> @param accountCode recurly account id @param type {@link com.ning.billing.recurly.model.Adjustments.AdjustmentType} @param state {@link com.ning.billing.recurly.model.Adjustments.AdjustmentState} @return the adjustments on the account
[ "Get", "Account", "Adjustments", "<p", ">" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L400-L402
j-a-w-r/jawr-main-repo
jawr-tools/jawr-bundle-processor/src/main/java/net/jawr/web/bundle/processor/BundleProcessor.java
BundleProcessor.createBinaryBundle
protected void createBinaryBundle(HttpServlet servlet, BinaryResourcesHandler binaryRsHandler, String destDirPath, ServletConfig servletConfig, boolean keepUrlMapping) throws IOException, ServletException { Map<String, String> bundleImgMap = binaryRsHandler.getBinaryPathMap(); Iterator<String> bundleIterator = bundleImgMap.values().iterator(); MockServletResponse response = new MockServletResponse(); MockServletRequest request = new MockServletRequest( JAWR_BUNDLE_PROCESSOR_CONTEXT_PATH); String jawrServletMapping = servletConfig .getInitParameter(JawrConstant.SERVLET_MAPPING_PROPERTY_NAME); if (jawrServletMapping == null) { jawrServletMapping = ""; } String servletMapping = servletConfig .getInitParameter(JawrConstant.SPRING_SERVLET_MAPPING_PROPERTY_NAME); if (servletMapping == null) { servletMapping = jawrServletMapping; } // For the list of bundle defines, create the file associated while (bundleIterator.hasNext()) { String path = (String) bundleIterator.next(); String binaryFinalPath = null; if (keepUrlMapping) { binaryFinalPath = path; } else { binaryFinalPath = getImageFinalPath(path, binaryRsHandler.getConfig()); } File destFile = new File(destDirPath, binaryFinalPath); Map<String, String> variantMap = new HashMap<String, String>(); setRequestUrl(request, variantMap , path, binaryRsHandler.getConfig()); // Update the bundle mapping path = PathNormalizer.concatWebPath( PathNormalizer.asDirPath(jawrServletMapping), path); createBundleFile(servlet, response, request, path, destFile, servletMapping); } }
java
protected void createBinaryBundle(HttpServlet servlet, BinaryResourcesHandler binaryRsHandler, String destDirPath, ServletConfig servletConfig, boolean keepUrlMapping) throws IOException, ServletException { Map<String, String> bundleImgMap = binaryRsHandler.getBinaryPathMap(); Iterator<String> bundleIterator = bundleImgMap.values().iterator(); MockServletResponse response = new MockServletResponse(); MockServletRequest request = new MockServletRequest( JAWR_BUNDLE_PROCESSOR_CONTEXT_PATH); String jawrServletMapping = servletConfig .getInitParameter(JawrConstant.SERVLET_MAPPING_PROPERTY_NAME); if (jawrServletMapping == null) { jawrServletMapping = ""; } String servletMapping = servletConfig .getInitParameter(JawrConstant.SPRING_SERVLET_MAPPING_PROPERTY_NAME); if (servletMapping == null) { servletMapping = jawrServletMapping; } // For the list of bundle defines, create the file associated while (bundleIterator.hasNext()) { String path = (String) bundleIterator.next(); String binaryFinalPath = null; if (keepUrlMapping) { binaryFinalPath = path; } else { binaryFinalPath = getImageFinalPath(path, binaryRsHandler.getConfig()); } File destFile = new File(destDirPath, binaryFinalPath); Map<String, String> variantMap = new HashMap<String, String>(); setRequestUrl(request, variantMap , path, binaryRsHandler.getConfig()); // Update the bundle mapping path = PathNormalizer.concatWebPath( PathNormalizer.asDirPath(jawrServletMapping), path); createBundleFile(servlet, response, request, path, destFile, servletMapping); } }
[ "protected", "void", "createBinaryBundle", "(", "HttpServlet", "servlet", ",", "BinaryResourcesHandler", "binaryRsHandler", ",", "String", "destDirPath", ",", "ServletConfig", "servletConfig", ",", "boolean", "keepUrlMapping", ")", "throws", "IOException", ",", "ServletEx...
Create the image bundle @param servlet the servlet @param binaryRsHandler the binary resource handler @param destDirPath the destination directory path @param servletMapping the mapping @param keepUrlMapping = the flag indicating if we must keep the url mapping @throws IOException if an IOExceptin occurs @throws ServletException if an exception occurs
[ "Create", "the", "image", "bundle" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr-tools/jawr-bundle-processor/src/main/java/net/jawr/web/bundle/processor/BundleProcessor.java#L1013-L1060
knowm/XChange
xchange-coingi/src/main/java/org/knowm/xchange/coingi/service/CoingiAccountService.java
CoingiAccountService.requestDepositAddress
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { try { CoingiDepositWalletRequest request = new CoingiDepositWalletRequest().setCurrency(currency.getCurrencyCode().toUpperCase()); return depositWallet(request).getAddress(); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
java
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { try { CoingiDepositWalletRequest request = new CoingiDepositWalletRequest().setCurrency(currency.getCurrencyCode().toUpperCase()); return depositWallet(request).getAddress(); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
[ "@", "Override", "public", "String", "requestDepositAddress", "(", "Currency", "currency", ",", "String", "...", "arguments", ")", "throws", "IOException", "{", "try", "{", "CoingiDepositWalletRequest", "request", "=", "new", "CoingiDepositWalletRequest", "(", ")", ...
This returns the current deposit address. It does not generate a new one! Repeated calls will return the same.
[ "This", "returns", "the", "current", "deposit", "address", ".", "It", "does", "not", "generate", "a", "new", "one!", "Repeated", "calls", "will", "return", "the", "same", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coingi/src/main/java/org/knowm/xchange/coingi/service/CoingiAccountService.java#L76-L85
apereo/cas
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/MultifactorAuthenticationUtils.java
MultifactorAuthenticationUtils.validateEventIdForMatchingTransitionInContext
public static Event validateEventIdForMatchingTransitionInContext(final String eventId, final Optional<RequestContext> context, final Map<String, Object> attributes) { val attributesMap = new LocalAttributeMap<Object>(attributes); val event = new Event(eventId, eventId, attributesMap); return context.map(ctx -> { val def = ctx.getMatchingTransition(event.getId()); if (def == null) { throw new AuthenticationException("Transition definition cannot be found for event " + event.getId()); } return event; }).orElse(event); }
java
public static Event validateEventIdForMatchingTransitionInContext(final String eventId, final Optional<RequestContext> context, final Map<String, Object> attributes) { val attributesMap = new LocalAttributeMap<Object>(attributes); val event = new Event(eventId, eventId, attributesMap); return context.map(ctx -> { val def = ctx.getMatchingTransition(event.getId()); if (def == null) { throw new AuthenticationException("Transition definition cannot be found for event " + event.getId()); } return event; }).orElse(event); }
[ "public", "static", "Event", "validateEventIdForMatchingTransitionInContext", "(", "final", "String", "eventId", ",", "final", "Optional", "<", "RequestContext", ">", "context", ",", "final", "Map", "<", "String", ",", "Object", ">", "attributes", ")", "{", "val",...
Validate event id for matching transition in context event. @param eventId the event id @param context the context @param attributes the attributes @return the event
[ "Validate", "event", "id", "for", "matching", "transition", "in", "context", "event", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/MultifactorAuthenticationUtils.java#L64-L77
google/closure-templates
java/src/com/google/template/soy/data/SanitizedContents.java
SanitizedContents.constantAttributes
public static SanitizedContent constantAttributes(@CompileTimeConstant final String constant) { return fromConstant(constant, ContentKind.ATTRIBUTES, Dir.LTR); }
java
public static SanitizedContent constantAttributes(@CompileTimeConstant final String constant) { return fromConstant(constant, ContentKind.ATTRIBUTES, Dir.LTR); }
[ "public", "static", "SanitizedContent", "constantAttributes", "(", "@", "CompileTimeConstant", "final", "String", "constant", ")", "{", "return", "fromConstant", "(", "constant", ",", "ContentKind", ".", "ATTRIBUTES", ",", "Dir", ".", "LTR", ")", ";", "}" ]
Wraps an assumed-safe constant string that specifies an attribute. <p>This only accepts compile-time constants, based on the assumption that attributes that are controlled by the application (and not user input) are considered safe.
[ "Wraps", "an", "assumed", "-", "safe", "constant", "string", "that", "specifies", "an", "attribute", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L208-L210
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/share.java
share.sendEmail
public static void sendEmail(String email, String subject, String emailBody) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("message/rfc822"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{email}); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody); emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { QuickUtils.getContext().startActivity(emailIntent); } catch (android.content.ActivityNotFoundException ex) { QuickUtils.system.toast("There are no email clients installed."); } }
java
public static void sendEmail(String email, String subject, String emailBody) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("message/rfc822"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{email}); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody); emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { QuickUtils.getContext().startActivity(emailIntent); } catch (android.content.ActivityNotFoundException ex) { QuickUtils.system.toast("There are no email clients installed."); } }
[ "public", "static", "void", "sendEmail", "(", "String", "email", ",", "String", "subject", ",", "String", "emailBody", ")", "{", "Intent", "emailIntent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_SEND", ")", ";", "emailIntent", ".", "setType", "(", ...
Share via Email @param email destination email (e.g. support@company.com) @param subject email subject @param emailBody email body
[ "Share", "via", "Email" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/share.java#L22-L36
m-m-m/util
nls/src/main/java/net/sf/mmm/util/nls/impl/DefaultNlsTemplateResolver.java
DefaultNlsTemplateResolver.initTemplatesForResourceBundles
protected void initTemplatesForResourceBundles(Map<String, NlsTemplate> map) { List<ResourceBundle> bundles = this.resourceBundleLocator.findBundles(); for (ResourceBundle resourceBundle : bundles) { String name = resourceBundle.getBaseBundleName(); if (name == null) { name = resourceBundle.getClass().getName(); } Enumeration<String> keyEnum = resourceBundle.getKeys(); while (keyEnum.hasMoreElements()) { String key = keyEnum.nextElement(); String message = resourceBundle.getString(key); NlsTemplateImplWithMessage template = new NlsTemplateImplWithMessage(name, key, message); map.put(message, template); } } }
java
protected void initTemplatesForResourceBundles(Map<String, NlsTemplate> map) { List<ResourceBundle> bundles = this.resourceBundleLocator.findBundles(); for (ResourceBundle resourceBundle : bundles) { String name = resourceBundle.getBaseBundleName(); if (name == null) { name = resourceBundle.getClass().getName(); } Enumeration<String> keyEnum = resourceBundle.getKeys(); while (keyEnum.hasMoreElements()) { String key = keyEnum.nextElement(); String message = resourceBundle.getString(key); NlsTemplateImplWithMessage template = new NlsTemplateImplWithMessage(name, key, message); map.put(message, template); } } }
[ "protected", "void", "initTemplatesForResourceBundles", "(", "Map", "<", "String", ",", "NlsTemplate", ">", "map", ")", "{", "List", "<", "ResourceBundle", ">", "bundles", "=", "this", ".", "resourceBundleLocator", ".", "findBundles", "(", ")", ";", "for", "("...
This method initializes the {@link NlsTemplate}s for reverse lookup for {@link ResourceBundle}s. @param map the {@link Map} where to {@link Map#put(Object, Object) register} the {@link NlsTemplate}s by their {@link net.sf.mmm.util.nls.api.NlsMessage#getInternationalizedMessage() i18n message}.
[ "This", "method", "initializes", "the", "{", "@link", "NlsTemplate", "}", "s", "for", "reverse", "lookup", "for", "{", "@link", "ResourceBundle", "}", "s", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/nls/src/main/java/net/sf/mmm/util/nls/impl/DefaultNlsTemplateResolver.java#L97-L113
looly/hutool
hutool-system/src/main/java/cn/hutool/system/SystemUtil.java
SystemUtil.append
protected static void append(StringBuilder builder, String caption, Object value) { builder.append(caption).append(StrUtil.nullToDefault(Convert.toStr(value), "[n/a]")).append("\n"); }
java
protected static void append(StringBuilder builder, String caption, Object value) { builder.append(caption).append(StrUtil.nullToDefault(Convert.toStr(value), "[n/a]")).append("\n"); }
[ "protected", "static", "void", "append", "(", "StringBuilder", "builder", ",", "String", "caption", ",", "Object", "value", ")", "{", "builder", ".", "append", "(", "caption", ")", ".", "append", "(", "StrUtil", ".", "nullToDefault", "(", "Convert", ".", "...
输出到<code>StringBuilder</code>。 @param builder <code>StringBuilder</code>对象 @param caption 标题 @param value 值
[ "输出到<code", ">", "StringBuilder<", "/", "code", ">", "。" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/SystemUtil.java#L469-L471
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.executeGitCommandExitCode
private CommandResult executeGitCommandExitCode(final String... args) throws CommandLineException, MojoFailureException { return executeCommand(cmdGit, false, null, args); }
java
private CommandResult executeGitCommandExitCode(final String... args) throws CommandLineException, MojoFailureException { return executeCommand(cmdGit, false, null, args); }
[ "private", "CommandResult", "executeGitCommandExitCode", "(", "final", "String", "...", "args", ")", "throws", "CommandLineException", ",", "MojoFailureException", "{", "return", "executeCommand", "(", "cmdGit", ",", "false", ",", "null", ",", "args", ")", ";", "}...
Executes Git command without failing on non successful exit code. @param args Git command line arguments. @return Command result. @throws CommandLineException @throws MojoFailureException
[ "Executes", "Git", "command", "without", "failing", "on", "non", "successful", "exit", "code", "." ]
train
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1022-L1025
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
EqualsBuilder.appendArray
@GwtIncompatible("incompatible method") private void appendArray(final Object lhs, final Object rhs) { // First we compare different dimensions, for example: a boolean[][] to a boolean[] // then we 'Switch' on type of array, to dispatch to the correct handler // This handles multi dimensional arrays of the same depth if (lhs.getClass() != rhs.getClass()) { this.setEquals(false); } else if (lhs instanceof long[]) { append((long[]) lhs, (long[]) rhs); }
java
@GwtIncompatible("incompatible method") private void appendArray(final Object lhs, final Object rhs) { // First we compare different dimensions, for example: a boolean[][] to a boolean[] // then we 'Switch' on type of array, to dispatch to the correct handler // This handles multi dimensional arrays of the same depth if (lhs.getClass() != rhs.getClass()) { this.setEquals(false); } else if (lhs instanceof long[]) { append((long[]) lhs, (long[]) rhs); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "private", "void", "appendArray", "(", "final", "Object", "lhs", ",", "final", "Object", "rhs", ")", "{", "// First we compare different dimensions, for example: a boolean[][] to a boolean[]", "// then we 'Switch' on ...
<p>Test if an <code>Object</code> is equal to an array.</p> @param lhs the left hand object, an array @param rhs the right hand object
[ "<p", ">", "Test", "if", "an", "<code", ">", "Object<", "/", "code", ">", "is", "equal", "to", "an", "array", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java#L644-L653
wisdom-framework/wisdom
core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Socket.java
Socket.publish
public void publish(byte[] message, EventBus bus) { bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message)); }
java
public void publish(byte[] message, EventBus bus) { bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message)); }
[ "public", "void", "publish", "(", "byte", "[", "]", "message", ",", "EventBus", "bus", ")", "{", "bus", ".", "publish", "(", "getBinaryWriteHandlerId", "(", ")", ",", "Buffer", ".", "buffer", "(", "message", ")", ")", ";", "}" ]
Sends a binary frame on the socket. @param message the message @param bus the Vert.x event bus.
[ "Sends", "a", "binary", "frame", "on", "the", "socket", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Socket.java#L95-L97
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.resolveClassLoaderForBeanProxy
public static ClassLoader resolveClassLoaderForBeanProxy(String contextId, Class<?> proxiedType, TypeInfo typeInfo, ProxyServices proxyServices) { Class<?> superClass = typeInfo.getSuperClass(); if (superClass.getName().startsWith(JAVA)) { ClassLoader cl = proxyServices.getClassLoader(proxiedType); if (cl == null) { cl = Thread.currentThread().getContextClassLoader(); } return cl; } return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass); }
java
public static ClassLoader resolveClassLoaderForBeanProxy(String contextId, Class<?> proxiedType, TypeInfo typeInfo, ProxyServices proxyServices) { Class<?> superClass = typeInfo.getSuperClass(); if (superClass.getName().startsWith(JAVA)) { ClassLoader cl = proxyServices.getClassLoader(proxiedType); if (cl == null) { cl = Thread.currentThread().getContextClassLoader(); } return cl; } return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass); }
[ "public", "static", "ClassLoader", "resolveClassLoaderForBeanProxy", "(", "String", "contextId", ",", "Class", "<", "?", ">", "proxiedType", ",", "TypeInfo", "typeInfo", ",", "ProxyServices", "proxyServices", ")", "{", "Class", "<", "?", ">", "superClass", "=", ...
Figures out the correct class loader to use for a proxy for a given bean
[ "Figures", "out", "the", "correct", "class", "loader", "to", "use", "for", "a", "proxy", "for", "a", "given", "bean" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L902-L912
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Covers.java
ST_Covers.covers
public static Boolean covers(Geometry geomA, Geometry geomB) { if(geomA == null||geomB == null){ return null; } return geomA.covers(geomB); }
java
public static Boolean covers(Geometry geomA, Geometry geomB) { if(geomA == null||geomB == null){ return null; } return geomA.covers(geomB); }
[ "public", "static", "Boolean", "covers", "(", "Geometry", "geomA", ",", "Geometry", "geomB", ")", "{", "if", "(", "geomA", "==", "null", "||", "geomB", "==", "null", ")", "{", "return", "null", ";", "}", "return", "geomA", ".", "covers", "(", "geomB", ...
Returns true if no point in geometry B is outside geometry A. @param geomA Geometry A @param geomB Geometry B @return True if no point in geometry B is outside geometry A
[ "Returns", "true", "if", "no", "point", "in", "geometry", "B", "is", "outside", "geometry", "A", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Covers.java#L50-L55
finmath/finmath-lib
src/main/java/net/finmath/time/SchedulePrototype.java
SchedulePrototype.generateScheduleDescriptor
public ScheduleDescriptor generateScheduleDescriptor(LocalDate startDate, LocalDate endDate) { return new ScheduleDescriptor(startDate, endDate, getFrequency(), getDaycountConvention(), getShortPeriodConvention(), getDateRollConvention(), getBusinessdayCalendar(), getFixingOffsetDays(), getPaymentOffsetDays(), isUseEndOfMonth()); }
java
public ScheduleDescriptor generateScheduleDescriptor(LocalDate startDate, LocalDate endDate) { return new ScheduleDescriptor(startDate, endDate, getFrequency(), getDaycountConvention(), getShortPeriodConvention(), getDateRollConvention(), getBusinessdayCalendar(), getFixingOffsetDays(), getPaymentOffsetDays(), isUseEndOfMonth()); }
[ "public", "ScheduleDescriptor", "generateScheduleDescriptor", "(", "LocalDate", "startDate", ",", "LocalDate", "endDate", ")", "{", "return", "new", "ScheduleDescriptor", "(", "startDate", ",", "endDate", ",", "getFrequency", "(", ")", ",", "getDaycountConvention", "(...
Generate a schedule descriptor for the given start and end date. @param startDate The start date. @param endDate The end date. @return The schedule descriptor
[ "Generate", "a", "schedule", "descriptor", "for", "the", "given", "start", "and", "end", "date", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/SchedulePrototype.java#L126-L129
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/BasePrepareStatement.java
BasePrepareStatement.setCharacterStream
public void setCharacterStream(final int parameterIndex, final Reader reader, final int length) throws SQLException { if (reader == null) { setNull(parameterIndex, ColumnType.BLOB); return; } setParameter(parameterIndex, new ReaderParameter(reader, length, noBackslashEscapes)); hasLongData = true; }
java
public void setCharacterStream(final int parameterIndex, final Reader reader, final int length) throws SQLException { if (reader == null) { setNull(parameterIndex, ColumnType.BLOB); return; } setParameter(parameterIndex, new ReaderParameter(reader, length, noBackslashEscapes)); hasLongData = true; }
[ "public", "void", "setCharacterStream", "(", "final", "int", "parameterIndex", ",", "final", "Reader", "reader", ",", "final", "int", "length", ")", "throws", "SQLException", "{", "if", "(", "reader", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ...
Sets the designated parameter to the given <code>Reader</code> object, which is the given number of characters long. When a very large UNICODE value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.Reader</code> object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format. <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.</P> @param parameterIndex the first parameter is 1, the second is 2, ... @param reader the <code>java.io.Reader</code> object that contains the Unicode data @param length the number of characters in the stream @throws SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "Reader<", "/", "code", ">", "object", "which", "is", "the", "given", "number", "of", "characters", "long", ".", "When", "a", "very", "large", "UNICODE", "value", "is", "input", ...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/BasePrepareStatement.java#L207-L215
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedField.java
MappedField.getFirstFieldName
public String getFirstFieldName(final DBObject dbObj) { String fieldName = getNameToStore(); boolean foundField = false; for (final String n : getLoadNames()) { if (dbObj.containsField(n)) { if (!foundField) { foundField = true; fieldName = n; } else { throw new MappingException(format("Found more than one field from @AlsoLoad %s", getLoadNames())); } } } return fieldName; }
java
public String getFirstFieldName(final DBObject dbObj) { String fieldName = getNameToStore(); boolean foundField = false; for (final String n : getLoadNames()) { if (dbObj.containsField(n)) { if (!foundField) { foundField = true; fieldName = n; } else { throw new MappingException(format("Found more than one field from @AlsoLoad %s", getLoadNames())); } } } return fieldName; }
[ "public", "String", "getFirstFieldName", "(", "final", "DBObject", "dbObj", ")", "{", "String", "fieldName", "=", "getNameToStore", "(", ")", ";", "boolean", "foundField", "=", "false", ";", "for", "(", "final", "String", "n", ":", "getLoadNames", "(", ")", ...
Gets the field name to use when converting from a DBObject @param dbObj the DBObject to scan for alternate names @return the value of this field mapped from the DBObject @see AlsoLoad
[ "Gets", "the", "field", "name", "to", "use", "when", "converting", "from", "a", "DBObject" ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedField.java#L258-L272
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java
UtilReflection.getField
public static <T> T getField(Object object, String name) { Check.notNull(object); Check.notNull(name); try { final Class<?> clazz = getClass(object); final Field field = getDeclaredFieldSuper(clazz, name); setAccessible(field, true); @SuppressWarnings("unchecked") final T value = (T) field.get(object); return value; } catch (final NoSuchFieldException | IllegalAccessException exception) { throw new LionEngineException(exception, ERROR_FIELD + name); } }
java
public static <T> T getField(Object object, String name) { Check.notNull(object); Check.notNull(name); try { final Class<?> clazz = getClass(object); final Field field = getDeclaredFieldSuper(clazz, name); setAccessible(field, true); @SuppressWarnings("unchecked") final T value = (T) field.get(object); return value; } catch (final NoSuchFieldException | IllegalAccessException exception) { throw new LionEngineException(exception, ERROR_FIELD + name); } }
[ "public", "static", "<", "T", ">", "T", "getField", "(", "Object", "object", ",", "String", "name", ")", "{", "Check", ".", "notNull", "(", "object", ")", ";", "Check", ".", "notNull", "(", "name", ")", ";", "try", "{", "final", "Class", "<", "?", ...
Get the field by reflection. @param <T> The field type. @param object The object to use (must not be <code>null</code>). @param name The field name (must not be <code>null</code>). @return The field found. @throws LionEngineException If invalid parameters or field not found.
[ "Get", "the", "field", "by", "reflection", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L254-L272
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java
MiscUtil.startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String name, Iterable<String> patterns) { String nameUpper = name.toUpperCase(); for (String pattern : patterns) { String patternUpper = pattern.toUpperCase(); if (nameUpper.equals(patternUpper) || nameUpper.startsWith(patternUpper)) { return true; } } return false; }
java
public static boolean startsWithIgnoreCase(String name, Iterable<String> patterns) { String nameUpper = name.toUpperCase(); for (String pattern : patterns) { String patternUpper = pattern.toUpperCase(); if (nameUpper.equals(patternUpper) || nameUpper.startsWith(patternUpper)) { return true; } } return false; }
[ "public", "static", "boolean", "startsWithIgnoreCase", "(", "String", "name", ",", "Iterable", "<", "String", ">", "patterns", ")", "{", "String", "nameUpper", "=", "name", ".", "toUpperCase", "(", ")", ";", "for", "(", "String", "pattern", ":", "patterns", ...
Does the given column name starts with one of pattern given in parameter Not case sensitive
[ "Does", "the", "given", "column", "name", "starts", "with", "one", "of", "pattern", "given", "in", "parameter", "Not", "case", "sensitive" ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java#L177-L187
wdtinc/mapbox-vector-tile-java
src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java
JtsAdapter.createTileGeom
public static TileGeomResult createTileGeom(List<Geometry> g, Envelope tileEnvelope, GeometryFactory geomFactory, MvtLayerParams mvtLayerParams, IGeometryFilter filter) { return createTileGeom(g, tileEnvelope, tileEnvelope, geomFactory, mvtLayerParams, filter); }
java
public static TileGeomResult createTileGeom(List<Geometry> g, Envelope tileEnvelope, GeometryFactory geomFactory, MvtLayerParams mvtLayerParams, IGeometryFilter filter) { return createTileGeom(g, tileEnvelope, tileEnvelope, geomFactory, mvtLayerParams, filter); }
[ "public", "static", "TileGeomResult", "createTileGeom", "(", "List", "<", "Geometry", ">", "g", ",", "Envelope", "tileEnvelope", ",", "GeometryFactory", "geomFactory", ",", "MvtLayerParams", "mvtLayerParams", ",", "IGeometryFilter", "filter", ")", "{", "return", "cr...
<p>Create geometry clipped and then converted to MVT 'extent' coordinates. Result contains both clipped geometry (intersection) and transformed geometry for encoding to MVT.</p> <p>Uses the same tile and clipping coordinates. May cause rendering issues on boundaries for polygons or line geometry depending on styling.</p> @param g original 'source' geometry, passed through {@link #flatFeatureList(Geometry)} @param tileEnvelope world coordinate bounds for tile @param geomFactory creates a geometry for the tile envelope @param mvtLayerParams specifies vector tile properties @param filter geometry values that fail filter after transforms are removed @return tile geometry result @see TileGeomResult
[ "<p", ">", "Create", "geometry", "clipped", "and", "then", "converted", "to", "MVT", "extent", "coordinates", ".", "Result", "contains", "both", "clipped", "geometry", "(", "intersection", ")", "and", "transformed", "geometry", "for", "encoding", "to", "MVT", ...
train
https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java#L63-L69
alkacon/opencms-core
src/org/opencms/xml/A_CmsXmlDocument.java
A_CmsXmlDocument.createDeepElementCopy
protected Element createDeepElementCopy(Element element, Set<String> copyElements) { return createDeepElementCopyInternal(null, null, element, copyElements); }
java
protected Element createDeepElementCopy(Element element, Set<String> copyElements) { return createDeepElementCopyInternal(null, null, element, copyElements); }
[ "protected", "Element", "createDeepElementCopy", "(", "Element", "element", ",", "Set", "<", "String", ">", "copyElements", ")", "{", "return", "createDeepElementCopyInternal", "(", "null", ",", "null", ",", "element", ",", "copyElements", ")", ";", "}" ]
Creates a partial deep element copy according to the set of element paths.<p> Only elements contained in that set will be copied. @param element the element to copy @param copyElements the set of paths for elements to copy @return a partial deep copy of <code>element</code>
[ "Creates", "a", "partial", "deep", "element", "copy", "according", "to", "the", "set", "of", "element", "paths", ".", "<p", ">", "Only", "elements", "contained", "in", "that", "set", "will", "be", "copied", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/A_CmsXmlDocument.java#L778-L781
alkacon/opencms-core
src/org/opencms/ade/containerpage/inherited/CmsInheritanceReferenceParser.java
CmsInheritanceReferenceParser.parseReference
protected CmsInheritanceReference parseReference(I_CmsXmlContentLocation location, Locale locale) { I_CmsXmlContentValueLocation nameLocation = location.getSubValue("ConfigName"); if (nameLocation == null) { return null; } String configName = nameLocation.asString(m_cms); if (CmsStringUtil.isEmptyOrWhitespaceOnly(configName)) { return null; } configName = configName.trim(); I_CmsXmlContentValueLocation titleLocation = location.getSubValue("Title"); String title = null; if (titleLocation != null) { title = titleLocation.asString(m_cms); } I_CmsXmlContentValueLocation descriptionLocation = location.getSubValue("Description"); String description = null; if (descriptionLocation != null) { description = descriptionLocation.asString(m_cms); } return new CmsInheritanceReference(configName, title, description, m_resource, locale); }
java
protected CmsInheritanceReference parseReference(I_CmsXmlContentLocation location, Locale locale) { I_CmsXmlContentValueLocation nameLocation = location.getSubValue("ConfigName"); if (nameLocation == null) { return null; } String configName = nameLocation.asString(m_cms); if (CmsStringUtil.isEmptyOrWhitespaceOnly(configName)) { return null; } configName = configName.trim(); I_CmsXmlContentValueLocation titleLocation = location.getSubValue("Title"); String title = null; if (titleLocation != null) { title = titleLocation.asString(m_cms); } I_CmsXmlContentValueLocation descriptionLocation = location.getSubValue("Description"); String description = null; if (descriptionLocation != null) { description = descriptionLocation.asString(m_cms); } return new CmsInheritanceReference(configName, title, description, m_resource, locale); }
[ "protected", "CmsInheritanceReference", "parseReference", "(", "I_CmsXmlContentLocation", "location", ",", "Locale", "locale", ")", "{", "I_CmsXmlContentValueLocation", "nameLocation", "=", "location", ".", "getSubValue", "(", "\"ConfigName\"", ")", ";", "if", "(", "nam...
Extracts a single inheritance reference from a location in the XML content.<p> This method may return null if the given location doesn't contain a valid inheritance container reference.<p> @param location the location from which to parse the inheritance reference @param locale the locale from which to parse the inheritance reference @return the parsed inheritance reference, or null
[ "Extracts", "a", "single", "inheritance", "reference", "from", "a", "location", "in", "the", "XML", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsInheritanceReferenceParser.java#L133-L155
box/box-java-sdk
src/main/java/com/box/sdk/BoxFile.java
BoxFile.addTask
public BoxTask.Info addTask(BoxTask.Action action, String message, Date dueAt) { JsonObject itemJSON = new JsonObject(); itemJSON.add("type", "file"); itemJSON.add("id", this.getID()); JsonObject requestJSON = new JsonObject(); requestJSON.add("item", itemJSON); requestJSON.add("action", action.toJSONString()); if (message != null && !message.isEmpty()) { requestJSON.add("message", message); } if (dueAt != null) { requestJSON.add("due_at", BoxDateFormat.format(dueAt)); } URL url = ADD_TASK_URL_TEMPLATE.build(this.getAPI().getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxTask addedTask = new BoxTask(this.getAPI(), responseJSON.get("id").asString()); return addedTask.new Info(responseJSON); }
java
public BoxTask.Info addTask(BoxTask.Action action, String message, Date dueAt) { JsonObject itemJSON = new JsonObject(); itemJSON.add("type", "file"); itemJSON.add("id", this.getID()); JsonObject requestJSON = new JsonObject(); requestJSON.add("item", itemJSON); requestJSON.add("action", action.toJSONString()); if (message != null && !message.isEmpty()) { requestJSON.add("message", message); } if (dueAt != null) { requestJSON.add("due_at", BoxDateFormat.format(dueAt)); } URL url = ADD_TASK_URL_TEMPLATE.build(this.getAPI().getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxTask addedTask = new BoxTask(this.getAPI(), responseJSON.get("id").asString()); return addedTask.new Info(responseJSON); }
[ "public", "BoxTask", ".", "Info", "addTask", "(", "BoxTask", ".", "Action", "action", ",", "String", "message", ",", "Date", "dueAt", ")", "{", "JsonObject", "itemJSON", "=", "new", "JsonObject", "(", ")", ";", "itemJSON", ".", "add", "(", "\"type\"", ",...
Adds a new task to this file. The task can have an optional message to include, and a due date. @param action the action the task assignee will be prompted to do. @param message an optional message to include with the task. @param dueAt the day at which this task is due. @return information about the newly added task.
[ "Adds", "a", "new", "task", "to", "this", "file", ".", "The", "task", "can", "have", "an", "optional", "message", "to", "include", "and", "a", "due", "date", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L233-L258
apache/groovy
src/main/groovy/groovy/lang/ExpandoMetaClass.java
ExpandoMetaClass.getProperty
public Object getProperty(Object object, String name) { if (hasOverrideGetProperty(name) && getJavaClass().isInstance(object)) { return getPropertyMethod.invoke(object, new Object[]{name}); } return super.getProperty(object, name); }
java
public Object getProperty(Object object, String name) { if (hasOverrideGetProperty(name) && getJavaClass().isInstance(object)) { return getPropertyMethod.invoke(object, new Object[]{name}); } return super.getProperty(object, name); }
[ "public", "Object", "getProperty", "(", "Object", "object", ",", "String", "name", ")", "{", "if", "(", "hasOverrideGetProperty", "(", "name", ")", "&&", "getJavaClass", "(", ")", ".", "isInstance", "(", "object", ")", ")", "{", "return", "getPropertyMethod"...
Overrides default implementation just in case getProperty method has been overridden by ExpandoMetaClass @see MetaClassImpl#getProperty(Object, String)
[ "Overrides", "default", "implementation", "just", "in", "case", "getProperty", "method", "has", "been", "overridden", "by", "ExpandoMetaClass" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ExpandoMetaClass.java#L1163-L1168
voldemort/voldemort
src/java/voldemort/client/ClientConfig.java
ClientConfig.setIdleConnectionTimeout
public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) { if (idleConnectionTimeout <= 0) { this.idleConnectionTimeoutMs = -1; } else { if(unit.toMinutes(idleConnectionTimeout) < 10) { throw new IllegalArgumentException("idleConnectionTimeout should be minimum of 10 minutes"); } this.idleConnectionTimeoutMs = unit.toMillis(idleConnectionTimeout); } return this; }
java
public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) { if (idleConnectionTimeout <= 0) { this.idleConnectionTimeoutMs = -1; } else { if(unit.toMinutes(idleConnectionTimeout) < 10) { throw new IllegalArgumentException("idleConnectionTimeout should be minimum of 10 minutes"); } this.idleConnectionTimeoutMs = unit.toMillis(idleConnectionTimeout); } return this; }
[ "public", "ClientConfig", "setIdleConnectionTimeout", "(", "long", "idleConnectionTimeout", ",", "TimeUnit", "unit", ")", "{", "if", "(", "idleConnectionTimeout", "<=", "0", ")", "{", "this", ".", "idleConnectionTimeoutMs", "=", "-", "1", ";", "}", "else", "{", ...
Set the timeout for idle connections. Voldemort client caches all connections to the Voldemort server. This setting allows the a connection to be dropped, if it is idle for more than this time. This could be useful in the following cases 1) Voldemort client is not directly connected to the server and is connected via a proxy or firewall. The Proxy or firewall could drop the connection silently. If the connection is dropped, then client will see operations fail with a timeout. Setting this property enables the Voldemort client to tear down the connection before a firewall could drop it. 2) Voldemort server caches the connection and each connection has an associated memory cost. Setting this property on all clients, enable the clients to prune the connections and there by freeing up the server connections. throws IllegalArgumentException if the timeout is less than 10 minutes. Currently it can't be set below 10 minutes to avoid the racing risk of contention between connection checkout and selector trying to close it. This is intended for low throughput scenarios. @param idleConnectionTimeout zero or negative number to disable the feature ( default -1) timeout @param unit {@link TimeUnit} @return ClientConfig object for chained set throws {@link IllegalArgumentException} if the timeout is greater than 0, but less than 10 minutes.
[ "Set", "the", "timeout", "for", "idle", "connections", ".", "Voldemort", "client", "caches", "all", "connections", "to", "the", "Voldemort", "server", ".", "This", "setting", "allows", "the", "a", "connection", "to", "be", "dropped", "if", "it", "is", "idle"...
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/ClientConfig.java#L617-L627
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java
CharOperation.occurencesOf
public static final int occurencesOf(char toBeFound, char[] array) { int count = 0; for (int i = 0; i < array.length; i++) { if (toBeFound == array[i]) { count++; } } return count; }
java
public static final int occurencesOf(char toBeFound, char[] array) { int count = 0; for (int i = 0; i < array.length; i++) { if (toBeFound == array[i]) { count++; } } return count; }
[ "public", "static", "final", "int", "occurencesOf", "(", "char", "toBeFound", ",", "char", "[", "]", "array", ")", "{", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", ...
Answers the number of occurrences of the given character in the given array, 0 if any. <br> <br> For example: <ol> <li> <pre> toBeFound = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result =&gt; 3 </pre> </li> <li> <pre> toBeFound = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result =&gt; 0 </pre> </li> </ol> @param toBeFound the given character @param array the given array @return the number of occurrences of the given character in the given array, 0 if any @throws NullPointerException if array is null
[ "Answers", "the", "number", "of", "occurrences", "of", "the", "given", "character", "in", "the", "given", "array", "0", "if", "any", ".", "<br", ">", "<br", ">", "For", "example", ":", "<ol", ">", "<li", ">" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L3052-L3063