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
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractInput.java
AbstractInput.createMandatoryDiagnostic
protected Diagnostic createMandatoryDiagnostic() { String errorMessage = getComponentModel().errorMessage; String msg = errorMessage == null ? InternalMessages.DEFAULT_VALIDATION_ERROR_MANDATORY : errorMessage; return createErrorDiagnostic(msg, this); }
java
protected Diagnostic createMandatoryDiagnostic() { String errorMessage = getComponentModel().errorMessage; String msg = errorMessage == null ? InternalMessages.DEFAULT_VALIDATION_ERROR_MANDATORY : errorMessage; return createErrorDiagnostic(msg, this); }
[ "protected", "Diagnostic", "createMandatoryDiagnostic", "(", ")", "{", "String", "errorMessage", "=", "getComponentModel", "(", ")", ".", "errorMessage", ";", "String", "msg", "=", "errorMessage", "==", "null", "?", "InternalMessages", ".", "DEFAULT_VALIDATION_ERROR_M...
<p> This method is called by validateComponent to create the mandatory diagnostic error message if the mandatory validation check does not pass. </p> <p> Subclasses may override this method to customise the message, however in most cases it is easier to supply a custom error message pattern to the setMandatory method. </p> @return a new diagnostic for when mandatory validation fails.
[ "<p", ">", "This", "method", "is", "called", "by", "validateComponent", "to", "create", "the", "mandatory", "diagnostic", "error", "message", "if", "the", "mandatory", "validation", "check", "does", "not", "pass", ".", "<", "/", "p", ">", "<p", ">", "Subcl...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractInput.java#L96-L100
sagiegurari/fax4j
src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java
AbstractFaxClientSpi.fireFaxEvent
protected void fireFaxEvent(FaxClientActionEventID id,FaxJob faxJob) { //create new fax event FaxClientActionEvent event=new FaxClientActionEvent(id,faxJob); //get listeners FaxClientActionEventListener[] listeners=null; synchronized(this.faxClientActionEventListeners) { listeners=this.faxClientActionEventListeners.toArray(new FaxClientActionEventListener[this.faxClientActionEventListeners.size()]); } int amount=listeners.length; FaxClientActionEventListener listener=null; for(int index=0;index<amount;index++) { //get next element listener=listeners[index]; //fire event if(listener!=null) { switch(id) { case CREATE_FAX_JOB: listener.faxJobCreated(event); break; case SUBMIT_FAX_JOB: listener.faxJobSubmitted(event); break; case SUSPEND_FAX_JOB: listener.faxJobSuspended(event); break; case RESUME_FAX_JOB: listener.faxJobResumed(event); break; case CANCEL_FAX_JOB: listener.faxJobCancelled(event); break; default: throw new FaxException("Unable to support fax event, for event ID: "+id); } } } }
java
protected void fireFaxEvent(FaxClientActionEventID id,FaxJob faxJob) { //create new fax event FaxClientActionEvent event=new FaxClientActionEvent(id,faxJob); //get listeners FaxClientActionEventListener[] listeners=null; synchronized(this.faxClientActionEventListeners) { listeners=this.faxClientActionEventListeners.toArray(new FaxClientActionEventListener[this.faxClientActionEventListeners.size()]); } int amount=listeners.length; FaxClientActionEventListener listener=null; for(int index=0;index<amount;index++) { //get next element listener=listeners[index]; //fire event if(listener!=null) { switch(id) { case CREATE_FAX_JOB: listener.faxJobCreated(event); break; case SUBMIT_FAX_JOB: listener.faxJobSubmitted(event); break; case SUSPEND_FAX_JOB: listener.faxJobSuspended(event); break; case RESUME_FAX_JOB: listener.faxJobResumed(event); break; case CANCEL_FAX_JOB: listener.faxJobCancelled(event); break; default: throw new FaxException("Unable to support fax event, for event ID: "+id); } } } }
[ "protected", "void", "fireFaxEvent", "(", "FaxClientActionEventID", "id", ",", "FaxJob", "faxJob", ")", "{", "//create new fax event", "FaxClientActionEvent", "event", "=", "new", "FaxClientActionEvent", "(", "id", ",", "faxJob", ")", ";", "//get listeners", "FaxClien...
This function fires a new fax event. @param id The fax event ID @param faxJob The fax job
[ "This", "function", "fires", "a", "new", "fax", "event", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java#L529-L573
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java
Word07Writer.addText
public Word07Writer addText(ParagraphAlignment align, Font font, String... texts) { final XWPFParagraph p = this.doc.createParagraph(); if (null != align) { p.setAlignment(align); } if (ArrayUtil.isNotEmpty(texts)) { XWPFRun run; for (String text : texts) { run = p.createRun(); run.setText(text); if (null != font) { run.setFontFamily(font.getFamily()); run.setFontSize(font.getSize()); run.setBold(font.isBold()); run.setItalic(font.isItalic()); } } } return this; }
java
public Word07Writer addText(ParagraphAlignment align, Font font, String... texts) { final XWPFParagraph p = this.doc.createParagraph(); if (null != align) { p.setAlignment(align); } if (ArrayUtil.isNotEmpty(texts)) { XWPFRun run; for (String text : texts) { run = p.createRun(); run.setText(text); if (null != font) { run.setFontFamily(font.getFamily()); run.setFontSize(font.getSize()); run.setBold(font.isBold()); run.setItalic(font.isItalic()); } } } return this; }
[ "public", "Word07Writer", "addText", "(", "ParagraphAlignment", "align", ",", "Font", "font", ",", "String", "...", "texts", ")", "{", "final", "XWPFParagraph", "p", "=", "this", ".", "doc", ".", "createParagraph", "(", ")", ";", "if", "(", "null", "!=", ...
增加一个段落 @param align 段落对齐方式{@link ParagraphAlignment} @param font 字体信息{@link Font} @param texts 段落中的文本,支持多个文本作为一个段落 @return this
[ "增加一个段落" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java#L109-L128
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/listener/lifecycle/JdbcLifecycleEventListenerUtils.java
JdbcLifecycleEventListenerUtils.getListenerMethod
public static Method getListenerMethod(String invokedMethodName, boolean isBefore) { if (isBefore) { return beforeLifecycleMethodsByMethodName.get(invokedMethodName); } else { return afterLifecycleMethodsByMethodName.get(invokedMethodName); } }
java
public static Method getListenerMethod(String invokedMethodName, boolean isBefore) { if (isBefore) { return beforeLifecycleMethodsByMethodName.get(invokedMethodName); } else { return afterLifecycleMethodsByMethodName.get(invokedMethodName); } }
[ "public", "static", "Method", "getListenerMethod", "(", "String", "invokedMethodName", ",", "boolean", "isBefore", ")", "{", "if", "(", "isBefore", ")", "{", "return", "beforeLifecycleMethodsByMethodName", ".", "get", "(", "invokedMethodName", ")", ";", "}", "else...
Find corresponding callback method on {@link JdbcLifecycleEventListener}. @param invokedMethodName invoked method name @param isBefore before method or not @return corresponding callback method or {@code null} if not found. (e.g.: toString, hashCode)
[ "Find", "corresponding", "callback", "method", "on", "{", "@link", "JdbcLifecycleEventListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/lifecycle/JdbcLifecycleEventListenerUtils.java#L94-L100
tminglei/form-binder-java
src/main/java/com/github/tminglei/bind/Mappings.java
Mappings.longv
public static Mapping<Long> longv(Constraint... constraints) { return new FieldMapping( InputMode.SINGLE, mkSimpleConverter(s -> isEmptyStr(s) ? 0l : Long.parseLong(s) ), new MappingMeta(MAPPING_LONG, Long.class) ).constraint(checking(Long::parseLong, "error.long", true)) .constraint(constraints); }
java
public static Mapping<Long> longv(Constraint... constraints) { return new FieldMapping( InputMode.SINGLE, mkSimpleConverter(s -> isEmptyStr(s) ? 0l : Long.parseLong(s) ), new MappingMeta(MAPPING_LONG, Long.class) ).constraint(checking(Long::parseLong, "error.long", true)) .constraint(constraints); }
[ "public", "static", "Mapping", "<", "Long", ">", "longv", "(", "Constraint", "...", "constraints", ")", "{", "return", "new", "FieldMapping", "(", "InputMode", ".", "SINGLE", ",", "mkSimpleConverter", "(", "s", "->", "isEmptyStr", "(", "s", ")", "?", "0l",...
(convert to Long) mapping @param constraints constraints @return new created mapping
[ "(", "convert", "to", "Long", ")", "mapping" ]
train
https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/Mappings.java#L107-L115
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java
CUtil.formatScopedName
public static String formatScopedName(final CharSequence[] scope, final String value) { return String.join("_", scope).toLowerCase() + "_" + formatName(value); }
java
public static String formatScopedName(final CharSequence[] scope, final String value) { return String.join("_", scope).toLowerCase() + "_" + formatName(value); }
[ "public", "static", "String", "formatScopedName", "(", "final", "CharSequence", "[", "]", "scope", ",", "final", "String", "value", ")", "{", "return", "String", ".", "join", "(", "\"_\"", ",", "scope", ")", ".", "toLowerCase", "(", ")", "+", "\"_\"", "+...
Format a String as a struct name prepended with a scope. @param scope to be prepended. @param value to be formatted. @return the string formatted as a struct name.
[ "Format", "a", "String", "as", "a", "struct", "name", "prepended", "with", "a", "scope", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java#L125-L128
super-csv/super-csv
super-csv/src/main/java/org/supercsv/util/ReflectionUtils.java
ReflectionUtils.findGetter
public static Method findGetter(final Object object, final String fieldName) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } final Class<?> clazz = object.getClass(); // find a standard getter final String standardGetterName = getMethodNameForField(GET_PREFIX, fieldName); Method getter = findGetterWithCompatibleReturnType(standardGetterName, clazz, false); // if that fails, try for an isX() style boolean getter if( getter == null ) { final String booleanGetterName = getMethodNameForField(IS_PREFIX, fieldName); getter = findGetterWithCompatibleReturnType(booleanGetterName, clazz, true); } if( getter == null ) { throw new SuperCsvReflectionException( String .format( "unable to find getter for field %s in class %s - check that the corresponding nameMapping element matches the field name in the bean", fieldName, clazz.getName())); } return getter; }
java
public static Method findGetter(final Object object, final String fieldName) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } final Class<?> clazz = object.getClass(); // find a standard getter final String standardGetterName = getMethodNameForField(GET_PREFIX, fieldName); Method getter = findGetterWithCompatibleReturnType(standardGetterName, clazz, false); // if that fails, try for an isX() style boolean getter if( getter == null ) { final String booleanGetterName = getMethodNameForField(IS_PREFIX, fieldName); getter = findGetterWithCompatibleReturnType(booleanGetterName, clazz, true); } if( getter == null ) { throw new SuperCsvReflectionException( String .format( "unable to find getter for field %s in class %s - check that the corresponding nameMapping element matches the field name in the bean", fieldName, clazz.getName())); } return getter; }
[ "public", "static", "Method", "findGetter", "(", "final", "Object", "object", ",", "final", "String", "fieldName", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"object should not be null\"", ")", ";", "}...
Returns the getter method associated with the object's field. @param object the object @param fieldName the name of the field @return the getter method @throws NullPointerException if object or fieldName is null @throws SuperCsvReflectionException if the getter doesn't exist or is not visible
[ "Returns", "the", "getter", "method", "associated", "with", "the", "object", "s", "field", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/ReflectionUtils.java#L77-L105
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Statement.java
JDBC4Statement.executeBatch
@Override public int[] executeBatch() throws SQLException { checkClosed(); closeCurrentResult(); if (batch == null || batch.size() == 0) { return new int[0]; } int[] updateCounts = new int[batch.size()]; // keep a running total of update counts int runningUpdateCount = 0; int i = 0; try { for (; i < batch.size(); i++) { setCurrentResult( null, (int) batch.get(i).execute( sourceConnection.NativeConnection, this.m_timeout, sourceConnection.queryTimeOutUnit)[0].fetchRow( 0).getLong(0)); updateCounts[i] = this.lastUpdateCount; runningUpdateCount += this.lastUpdateCount; } } catch (SQLException x) { updateCounts[i] = EXECUTE_FAILED; throw new BatchUpdateException(Arrays.copyOf(updateCounts, i + 1), x); } finally { clearBatch(); } // replace the update count from the last statement with the update count // from the last batch. this.lastUpdateCount = runningUpdateCount; return updateCounts; }
java
@Override public int[] executeBatch() throws SQLException { checkClosed(); closeCurrentResult(); if (batch == null || batch.size() == 0) { return new int[0]; } int[] updateCounts = new int[batch.size()]; // keep a running total of update counts int runningUpdateCount = 0; int i = 0; try { for (; i < batch.size(); i++) { setCurrentResult( null, (int) batch.get(i).execute( sourceConnection.NativeConnection, this.m_timeout, sourceConnection.queryTimeOutUnit)[0].fetchRow( 0).getLong(0)); updateCounts[i] = this.lastUpdateCount; runningUpdateCount += this.lastUpdateCount; } } catch (SQLException x) { updateCounts[i] = EXECUTE_FAILED; throw new BatchUpdateException(Arrays.copyOf(updateCounts, i + 1), x); } finally { clearBatch(); } // replace the update count from the last statement with the update count // from the last batch. this.lastUpdateCount = runningUpdateCount; return updateCounts; }
[ "@", "Override", "public", "int", "[", "]", "executeBatch", "(", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "closeCurrentResult", "(", ")", ";", "if", "(", "batch", "==", "null", "||", "batch", ".", "size", "(", ")", "==", "0", ...
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
[ "Submits", "a", "batch", "of", "commands", "to", "the", "database", "for", "execution", "and", "if", "all", "commands", "execute", "successfully", "returns", "an", "array", "of", "update", "counts", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Statement.java#L415-L454
Ordinastie/MalisisCore
src/main/java/net/malisis/core/block/component/DirectionalComponent.java
DirectionalComponent.getDirection
public static EnumFacing getDirection(IBlockAccess world, BlockPos pos) { return world != null && pos != null ? getDirection(world.getBlockState(pos)) : EnumFacing.SOUTH; }
java
public static EnumFacing getDirection(IBlockAccess world, BlockPos pos) { return world != null && pos != null ? getDirection(world.getBlockState(pos)) : EnumFacing.SOUTH; }
[ "public", "static", "EnumFacing", "getDirection", "(", "IBlockAccess", "world", ",", "BlockPos", "pos", ")", "{", "return", "world", "!=", "null", "&&", "pos", "!=", "null", "?", "getDirection", "(", "world", ".", "getBlockState", "(", "pos", ")", ")", ":"...
Gets the {@link EnumFacing direction} for the {@link Block} at world coords. @param world the world @param pos the pos @return the EnumFacing, null if the block is not {@link DirectionalComponent}
[ "Gets", "the", "{", "@link", "EnumFacing", "direction", "}", "for", "the", "{", "@link", "Block", "}", "at", "world", "coords", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/DirectionalComponent.java#L190-L193
apache/groovy
subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java
GPathResult.getAt
public Object getAt(final int index) { if (index < 0) { // calculate whole list in this case // recommend avoiding -ve's as this is obviously not as efficient List list = list(); int adjustedIndex = index + list.size(); if (adjustedIndex >= 0 && adjustedIndex < list.size()) return list.get(adjustedIndex); } else { final Iterator iter = iterator(); int count = 0; while (iter.hasNext()) { if (count++ == index) { return iter.next(); } else { iter.next(); } } } return new NoChildren(this, this.name, this.namespaceTagHints); }
java
public Object getAt(final int index) { if (index < 0) { // calculate whole list in this case // recommend avoiding -ve's as this is obviously not as efficient List list = list(); int adjustedIndex = index + list.size(); if (adjustedIndex >= 0 && adjustedIndex < list.size()) return list.get(adjustedIndex); } else { final Iterator iter = iterator(); int count = 0; while (iter.hasNext()) { if (count++ == index) { return iter.next(); } else { iter.next(); } } } return new NoChildren(this, this.name, this.namespaceTagHints); }
[ "public", "Object", "getAt", "(", "final", "int", "index", ")", "{", "if", "(", "index", "<", "0", ")", "{", "// calculate whole list in this case", "// recommend avoiding -ve's as this is obviously not as efficient", "List", "list", "=", "list", "(", ")", ";", "int...
Supports the subscript operator for a GPathResult. <pre class="groovyTestCase"> import groovy.util.slurpersupport.* def text = """ &lt;characterList&gt; &lt;character/&gt; &lt;character&gt; &lt;name&gt;Gromit&lt;/name&gt; &lt;/character&gt; &lt;/characterList&gt;""" GPathResult characterList = new XmlSlurper().parseText(text) assert characterList.character[1].name == 'Gromit' </pre> @param index an index @return the value at the given index
[ "Supports", "the", "subscript", "operator", "for", "a", "GPathResult", ".", "<pre", "class", "=", "groovyTestCase", ">", "import", "groovy", ".", "util", ".", "slurpersupport", ".", "*", "def", "text", "=", "&lt", ";", "characterList&gt", ";", "&lt", ";", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java#L426-L448
tsweets/jdefault
src/main/java/org/beer30/jdefault/JDefaultNumber.java
JDefaultNumber.randomIntBetweenTwoNumbers
public static int randomIntBetweenTwoNumbers(int min, int max) { int number = RandomUtils.nextInt(max - min); return number + min; }
java
public static int randomIntBetweenTwoNumbers(int min, int max) { int number = RandomUtils.nextInt(max - min); return number + min; }
[ "public", "static", "int", "randomIntBetweenTwoNumbers", "(", "int", "min", ",", "int", "max", ")", "{", "int", "number", "=", "RandomUtils", ".", "nextInt", "(", "max", "-", "min", ")", ";", "return", "number", "+", "min", ";", "}" ]
generate a random number between 2 numbers - inclusive @param min lowest number to generate @param max max number to generate @return random number string
[ "generate", "a", "random", "number", "between", "2", "numbers", "-", "inclusive" ]
train
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultNumber.java#L83-L86
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java
AbstractRouter.getReverseRouteFor
@Override public String getReverseRouteFor(Controller controller, String method) { return getReverseRouteFor(controller.getClass(), method, null); }
java
@Override public String getReverseRouteFor(Controller controller, String method) { return getReverseRouteFor(controller.getClass(), method, null); }
[ "@", "Override", "public", "String", "getReverseRouteFor", "(", "Controller", "controller", ",", "String", "method", ")", "{", "return", "getReverseRouteFor", "(", "controller", ".", "getClass", "(", ")", ",", "method", ",", "null", ")", ";", "}" ]
Gets the url of the route handled by the specified action method. The action does not takes parameters. @param controller the controller object @param method the controller method @return the url, {@literal null} if the action method is not found
[ "Gets", "the", "url", "of", "the", "route", "handled", "by", "the", "specified", "action", "method", ".", "The", "action", "does", "not", "takes", "parameters", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java#L140-L143
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.isMatchingCurrentSite
public boolean isMatchingCurrentSite(CmsObject cms, CmsSiteMatcher matcher) { return m_siteMatcherSites.get(matcher) == getCurrentSite(cms); }
java
public boolean isMatchingCurrentSite(CmsObject cms, CmsSiteMatcher matcher) { return m_siteMatcherSites.get(matcher) == getCurrentSite(cms); }
[ "public", "boolean", "isMatchingCurrentSite", "(", "CmsObject", "cms", ",", "CmsSiteMatcher", "matcher", ")", "{", "return", "m_siteMatcherSites", ".", "get", "(", "matcher", ")", "==", "getCurrentSite", "(", "cms", ")", ";", "}" ]
Returns <code>true</code> if the given site matcher matches the current site.<p> @param cms the current OpenCms user context @param matcher the site matcher to match the site with @return <code>true</code> if the matcher matches the current site
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "given", "site", "matcher", "matches", "the", "current", "site", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1238-L1241
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.putFloatBE
public static void putFloatBE(final byte[] array, final int offset, final float value) { putIntBE(array, offset, Float.floatToRawIntBits(value)); }
java
public static void putFloatBE(final byte[] array, final int offset, final float value) { putIntBE(array, offset, Float.floatToRawIntBits(value)); }
[ "public", "static", "void", "putFloatBE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ",", "final", "float", "value", ")", "{", "putIntBE", "(", "array", ",", "offset", ",", "Float", ".", "floatToRawIntBits", "(", "value", ")"...
Put the source <i>float</i> into the destination byte array starting at the given offset in big endian order. There is no bounds checking. @param array destination byte array @param offset destination offset @param value source <i>float</i>
[ "Put", "the", "source", "<i", ">", "float<", "/", "i", ">", "into", "the", "destination", "byte", "array", "starting", "at", "the", "given", "offset", "in", "big", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L237-L239
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.messageFormatInstance
public static MessageFormat messageFormatInstance(final String pattern, final Locale locale) { return withinLocale(new Callable<MessageFormat>() { public MessageFormat call() throws Exception { return messageFormatInstance(pattern); } }, locale); }
java
public static MessageFormat messageFormatInstance(final String pattern, final Locale locale) { return withinLocale(new Callable<MessageFormat>() { public MessageFormat call() throws Exception { return messageFormatInstance(pattern); } }, locale); }
[ "public", "static", "MessageFormat", "messageFormatInstance", "(", "final", "String", "pattern", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "MessageFormat", ">", "(", ")", "{", "public", "MessageFormat", "c...
<p> Same as {@link #messageFormatInstance(String) messageFormatInstance} for the specified locale. </p> @param locale Target locale @param pattern Format pattern that follows the conventions of {@link com.ibm.icu.text.MessageFormat MessageFormat} @return a MessageFormat instance for the current thread
[ "<p", ">", "Same", "as", "{", "@link", "#messageFormatInstance", "(", "String", ")", "messageFormatInstance", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L1232-L1241
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java
DestinationManager.getTopicSpaceMapping
public String getTopicSpaceMapping(String busName, SIBUuid12 topicSpace) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getTopicSpaceMapping", new Object[] { busName, topicSpace }); VirtualLinkDefinition linkDef = getLinkDefinition(busName); //this is only called internally so we shall include invisible dests in the lookup String topicSpaceName = getDestinationInternal(topicSpace, true).getName(); String mapping = null; if (linkDef != null && linkDef.getTopicSpaceMappings() != null) mapping = (String) linkDef.getTopicSpaceMappings().get(topicSpaceName); else // Local ME mapping = topicSpaceName; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getTopicSpaceMapping", mapping); return mapping; }
java
public String getTopicSpaceMapping(String busName, SIBUuid12 topicSpace) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getTopicSpaceMapping", new Object[] { busName, topicSpace }); VirtualLinkDefinition linkDef = getLinkDefinition(busName); //this is only called internally so we shall include invisible dests in the lookup String topicSpaceName = getDestinationInternal(topicSpace, true).getName(); String mapping = null; if (linkDef != null && linkDef.getTopicSpaceMappings() != null) mapping = (String) linkDef.getTopicSpaceMappings().get(topicSpaceName); else // Local ME mapping = topicSpaceName; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getTopicSpaceMapping", mapping); return mapping; }
[ "public", "String", "getTopicSpaceMapping", "(", "String", "busName", ",", "SIBUuid12", "topicSpace", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "...
Returns the topicSpaceName of the foreign topicSpace @param String The busname of the foreign TS @param SIBUuid12 The uuid of the TS on this bus @return String The foreign TS name
[ "Returns", "the", "topicSpaceName", "of", "the", "foreign", "topicSpace" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1854-L1873
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java
DatatypeConverter.parseDurationInFractionsOfMinutes
private static final Duration parseDurationInFractionsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit, int factor) { Duration result = null; if (value != null) { result = Duration.getInstance(value.intValue() / factor, TimeUnit.MINUTES); if (targetTimeUnit != result.getUnits()) { result = result.convertUnits(targetTimeUnit, properties); } } return (result); }
java
private static final Duration parseDurationInFractionsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit, int factor) { Duration result = null; if (value != null) { result = Duration.getInstance(value.intValue() / factor, TimeUnit.MINUTES); if (targetTimeUnit != result.getUnits()) { result = result.convertUnits(targetTimeUnit, properties); } } return (result); }
[ "private", "static", "final", "Duration", "parseDurationInFractionsOfMinutes", "(", "ProjectProperties", "properties", ",", "Number", "value", ",", "TimeUnit", "targetTimeUnit", ",", "int", "factor", ")", "{", "Duration", "result", "=", "null", ";", "if", "(", "va...
Parse duration represented as an arbitrary fraction of minutes. @param properties project properties @param value duration value @param targetTimeUnit required output time units @param factor required fraction of a minute @return Duration instance
[ "Parse", "duration", "represented", "as", "an", "arbitrary", "fraction", "of", "minutes", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L1408-L1422
taimos/dvalin
mongodb/src/main/java/de/taimos/dvalin/mongo/ChangelogUtil.java
ChangelogUtil.addTTLIndex
public static void addTTLIndex(DBCollection collection, String field, int ttl) { if (ttl <= 0) { throw new IllegalArgumentException("TTL must be positive"); } collection.createIndex(new BasicDBObject(field, 1), new BasicDBObject("expireAfterSeconds", ttl)); }
java
public static void addTTLIndex(DBCollection collection, String field, int ttl) { if (ttl <= 0) { throw new IllegalArgumentException("TTL must be positive"); } collection.createIndex(new BasicDBObject(field, 1), new BasicDBObject("expireAfterSeconds", ttl)); }
[ "public", "static", "void", "addTTLIndex", "(", "DBCollection", "collection", ",", "String", "field", ",", "int", "ttl", ")", "{", "if", "(", "ttl", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"TTL must be positive\"", ")", ";", "...
adds a TTL index to the given collection. The TTL must be a positive integer. @param collection the collection to use for the TTL index @param field the field to use for the TTL index @param ttl the TTL to set on the given field @throws IllegalArgumentException if the TTL is less or equal 0
[ "adds", "a", "TTL", "index", "to", "the", "given", "collection", ".", "The", "TTL", "must", "be", "a", "positive", "integer", "." ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/mongodb/src/main/java/de/taimos/dvalin/mongo/ChangelogUtil.java#L47-L52
Alluxio/alluxio
job/client/src/main/java/alluxio/client/job/JobGrpcClientUtils.java
JobGrpcClientUtils.createProgressThread
public static Thread createProgressThread(final long intervalMs, final PrintStream stream) { Thread thread = new Thread(new Runnable() { @Override public void run() { while (true) { CommonUtils.sleepMs(intervalMs); if (Thread.interrupted()) { return; } stream.print("."); } } }); thread.setDaemon(true); return thread; }
java
public static Thread createProgressThread(final long intervalMs, final PrintStream stream) { Thread thread = new Thread(new Runnable() { @Override public void run() { while (true) { CommonUtils.sleepMs(intervalMs); if (Thread.interrupted()) { return; } stream.print("."); } } }); thread.setDaemon(true); return thread; }
[ "public", "static", "Thread", "createProgressThread", "(", "final", "long", "intervalMs", ",", "final", "PrintStream", "stream", ")", "{", "Thread", "thread", "=", "new", "Thread", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "ru...
Creates a thread which will write "." to the given print stream at the given interval. The created thread is not started by this method. The created thread will be daemonic and will halt when interrupted. @param intervalMs the time interval in milliseconds between writes @param stream the print stream to write to @return the thread
[ "Creates", "a", "thread", "which", "will", "write", ".", "to", "the", "given", "print", "stream", "at", "the", "given", "interval", ".", "The", "created", "thread", "is", "not", "started", "by", "this", "method", ".", "The", "created", "thread", "will", ...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/client/src/main/java/alluxio/client/job/JobGrpcClientUtils.java#L97-L112
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.notEmpty
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends CharSequence> void notEmpty(final boolean condition, @Nonnull final T chars) { if (condition) { Check.notEmpty(chars); } }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends CharSequence> void notEmpty(final boolean condition, @Nonnull final T chars) { if (condition) { Check.notEmpty(chars); } }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalEmptyArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "CharSequence", ">", "void", "notEmpty", "(", "final", "boolean",...
Ensures that a passed string as a parameter of the calling method is not empty. <p> We recommend to use the overloaded method {@link Check#notEmpty(CharSequence, String)} and pass as second argument the name of the parameter to enhance the exception message. @param condition condition must be {@code true}^ so that the check will be performed @param chars a readable sequence of {@code char} values which should not be empty @throws IllegalNullArgumentException if the given argument {@code reference} is {@code null} @throws IllegalEmptyArgumentException if the given argument {@code reference} is empty
[ "Ensures", "that", "a", "passed", "string", "as", "a", "parameter", "of", "the", "calling", "method", "is", "not", "empty", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L1208-L1214
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addClassAndMethod
@Nonnull public BugInstance addClassAndMethod(JavaClass javaClass, Method method) { addClass(javaClass.getClassName()); addMethod(javaClass, method); if (!MemberUtils.isUserGenerated(method)) { foundInAutogeneratedMethod(); } return this; }
java
@Nonnull public BugInstance addClassAndMethod(JavaClass javaClass, Method method) { addClass(javaClass.getClassName()); addMethod(javaClass, method); if (!MemberUtils.isUserGenerated(method)) { foundInAutogeneratedMethod(); } return this; }
[ "@", "Nonnull", "public", "BugInstance", "addClassAndMethod", "(", "JavaClass", "javaClass", ",", "Method", "method", ")", "{", "addClass", "(", "javaClass", ".", "getClassName", "(", ")", ")", ";", "addMethod", "(", "javaClass", ",", "method", ")", ";", "if...
Add class and method annotations for given class and method. @param javaClass the class @param method the method @return this object
[ "Add", "class", "and", "method", "annotations", "for", "given", "class", "and", "method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L903-L912
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCALKCardinalityNetwork.java
CCALKCardinalityNetwork.buildForIncremental
void buildForIncremental(final EncodingResult result, final Variable[] vars, int rhs) { cardinalityNetwork.buildALKForIncremental(result, vars, rhs); }
java
void buildForIncremental(final EncodingResult result, final Variable[] vars, int rhs) { cardinalityNetwork.buildALKForIncremental(result, vars, rhs); }
[ "void", "buildForIncremental", "(", "final", "EncodingResult", "result", ",", "final", "Variable", "[", "]", "vars", ",", "int", "rhs", ")", "{", "cardinalityNetwork", ".", "buildALKForIncremental", "(", "result", ",", "vars", ",", "rhs", ")", ";", "}" ]
Builds the constraint for incremental usage. @param result the result @param vars the variables @param rhs the right-hand side
[ "Builds", "the", "constraint", "for", "incremental", "usage", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCALKCardinalityNetwork.java#L67-L69
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/FrameDataflowAnalysis.java
FrameDataflowAnalysis.getFactAtPC
public FrameType getFactAtPC(CFG cfg, int pc) throws DataflowAnalysisException { FrameType result = createFact(); makeFactTop(result); for (Location l : cfg.locations()) { if (l.getHandle().getPosition() == pc) { FrameType fact = getFactAtLocation(l); if (isFactValid(fact)) { mergeInto(fact, result); } } } return result; }
java
public FrameType getFactAtPC(CFG cfg, int pc) throws DataflowAnalysisException { FrameType result = createFact(); makeFactTop(result); for (Location l : cfg.locations()) { if (l.getHandle().getPosition() == pc) { FrameType fact = getFactAtLocation(l); if (isFactValid(fact)) { mergeInto(fact, result); } } } return result; }
[ "public", "FrameType", "getFactAtPC", "(", "CFG", "cfg", ",", "int", "pc", ")", "throws", "DataflowAnalysisException", "{", "FrameType", "result", "=", "createFact", "(", ")", ";", "makeFactTop", "(", "result", ")", ";", "for", "(", "Location", "l", ":", "...
Get the dataflow fact representing the point just before given Location. Note "before" is meant in the logical sense, so for backward analyses, before means after the location in the control flow sense. @return the fact at the point just before the location
[ "Get", "the", "dataflow", "fact", "representing", "the", "point", "just", "before", "given", "Location", ".", "Note", "before", "is", "meant", "in", "the", "logical", "sense", "so", "for", "backward", "analyses", "before", "means", "after", "the", "location", ...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/FrameDataflowAnalysis.java#L68-L81
square/flow
flow/src/main/java/flow/Traversal.java
Traversal.createContext
@NonNull public Context createContext(@NonNull Object key, @NonNull Context baseContext) { return new FlowContextWrapper(keyManager.findServices(key), baseContext); }
java
@NonNull public Context createContext(@NonNull Object key, @NonNull Context baseContext) { return new FlowContextWrapper(keyManager.findServices(key), baseContext); }
[ "@", "NonNull", "public", "Context", "createContext", "(", "@", "NonNull", "Object", "key", ",", "@", "NonNull", "Context", "baseContext", ")", "{", "return", "new", "FlowContextWrapper", "(", "keyManager", ".", "findServices", "(", "key", ")", ",", "baseConte...
Creates a Context for the given key. Contexts can be created only for keys at the top of the origin and destination Histories.
[ "Creates", "a", "Context", "for", "the", "given", "key", "." ]
train
https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow/src/main/java/flow/Traversal.java#L43-L45
OpenLiberty/open-liberty
dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/DeferrableScheduledExecutorImpl.java
DeferrableScheduledExecutorImpl.roundUpDelay
static long roundUpDelay(long delay, TimeUnit unit, long now) { if (delay < 0) { // Negative is treated as 0. delay = 0; } long target = now + unit.toMillis(delay); if (target < now) { // We can't add the delay to the current time without overflow. // Return the delay unaltered. return delay; } long remainder = target % PERIOD_MILLISECONDS; if (remainder == 0) { // Already rounded. return delay; } long extra = PERIOD_MILLISECONDS - remainder; long newDelay = delay + unit.convert(extra, TimeUnit.MILLISECONDS); if (newDelay < delay) { // We can't round up without overflow. Return the delay unaltered. return delay; } return newDelay; }
java
static long roundUpDelay(long delay, TimeUnit unit, long now) { if (delay < 0) { // Negative is treated as 0. delay = 0; } long target = now + unit.toMillis(delay); if (target < now) { // We can't add the delay to the current time without overflow. // Return the delay unaltered. return delay; } long remainder = target % PERIOD_MILLISECONDS; if (remainder == 0) { // Already rounded. return delay; } long extra = PERIOD_MILLISECONDS - remainder; long newDelay = delay + unit.convert(extra, TimeUnit.MILLISECONDS); if (newDelay < delay) { // We can't round up without overflow. Return the delay unaltered. return delay; } return newDelay; }
[ "static", "long", "roundUpDelay", "(", "long", "delay", ",", "TimeUnit", "unit", ",", "long", "now", ")", "{", "if", "(", "delay", "<", "0", ")", "{", "// Negative is treated as 0.", "delay", "=", "0", ";", "}", "long", "target", "=", "now", "+", "unit...
Round up delays so that all tasks fire at approximately with approximately the same 15s period.
[ "Round", "up", "delays", "so", "that", "all", "tasks", "fire", "at", "approximately", "with", "approximately", "the", "same", "15s", "period", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/DeferrableScheduledExecutorImpl.java#L32-L60
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java
ThreeViewEstimateMetricScene.process
public boolean process(List<AssociatedTriple> associated , int width , int height ) { init(width, height); // Fit a trifocal tensor to the input observations if (!robustFitTrifocal(associated) ) return false; // estimate the scene's structure if( !estimateProjectiveScene()) return false; if( !projectiveToMetric() ) return false; // Run bundle adjustment while make sure a valid solution is found setupMetricBundleAdjustment(inliers); bundleAdjustment = FactoryMultiView.bundleSparseMetric(configSBA); findBestValidSolution(bundleAdjustment); // Prune outliers and run bundle adjustment one last time pruneOutliers(bundleAdjustment); return true; }
java
public boolean process(List<AssociatedTriple> associated , int width , int height ) { init(width, height); // Fit a trifocal tensor to the input observations if (!robustFitTrifocal(associated) ) return false; // estimate the scene's structure if( !estimateProjectiveScene()) return false; if( !projectiveToMetric() ) return false; // Run bundle adjustment while make sure a valid solution is found setupMetricBundleAdjustment(inliers); bundleAdjustment = FactoryMultiView.bundleSparseMetric(configSBA); findBestValidSolution(bundleAdjustment); // Prune outliers and run bundle adjustment one last time pruneOutliers(bundleAdjustment); return true; }
[ "public", "boolean", "process", "(", "List", "<", "AssociatedTriple", ">", "associated", ",", "int", "width", ",", "int", "height", ")", "{", "init", "(", "width", ",", "height", ")", ";", "// Fit a trifocal tensor to the input observations", "if", "(", "!", "...
Determines the metric scene. The principle point is assumed to be zero in the passed in pixel coordinates. Typically this is done by subtracting the image center from each pixel coordinate for each view. @param associated List of associated features from 3 views. pixels @param width width of all images @param height height of all images @return true if successful or false if it failed
[ "Determines", "the", "metric", "scene", ".", "The", "principle", "point", "is", "assumed", "to", "be", "zero", "in", "the", "passed", "in", "pixel", "coordinates", ".", "Typically", "this", "is", "done", "by", "subtracting", "the", "image", "center", "from",...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java#L157-L181
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java
Normalizer2Impl.getCanonStartSet
public boolean getCanonStartSet(int c, UnicodeSet set) { int canonValue=canonIterData.get(c)&~CANON_NOT_SEGMENT_STARTER; if(canonValue==0) { return false; } set.clear(); int value=canonValue&CANON_VALUE_MASK; if((canonValue&CANON_HAS_SET)!=0) { set.addAll(canonStartSets.get(value)); } else if(value!=0) { set.add(value); } if((canonValue&CANON_HAS_COMPOSITIONS)!=0) { int norm16=getNorm16(c); if(norm16==JAMO_L) { int syllable=Hangul.HANGUL_BASE+(c-Hangul.JAMO_L_BASE)*Hangul.JAMO_VT_COUNT; set.add(syllable, syllable+Hangul.JAMO_VT_COUNT-1); } else { addComposites(getCompositionsList(norm16), set); } } return true; }
java
public boolean getCanonStartSet(int c, UnicodeSet set) { int canonValue=canonIterData.get(c)&~CANON_NOT_SEGMENT_STARTER; if(canonValue==0) { return false; } set.clear(); int value=canonValue&CANON_VALUE_MASK; if((canonValue&CANON_HAS_SET)!=0) { set.addAll(canonStartSets.get(value)); } else if(value!=0) { set.add(value); } if((canonValue&CANON_HAS_COMPOSITIONS)!=0) { int norm16=getNorm16(c); if(norm16==JAMO_L) { int syllable=Hangul.HANGUL_BASE+(c-Hangul.JAMO_L_BASE)*Hangul.JAMO_VT_COUNT; set.add(syllable, syllable+Hangul.JAMO_VT_COUNT-1); } else { addComposites(getCompositionsList(norm16), set); } } return true; }
[ "public", "boolean", "getCanonStartSet", "(", "int", "c", ",", "UnicodeSet", "set", ")", "{", "int", "canonValue", "=", "canonIterData", ".", "get", "(", "c", ")", "&", "~", "CANON_NOT_SEGMENT_STARTER", ";", "if", "(", "canonValue", "==", "0", ")", "{", ...
Returns true if there are characters whose decomposition starts with c. If so, then the set is cleared and then filled with those characters. <b>{@link #ensureCanonIterData()} must have been called before this method, or else this method will crash.</b> @param c A Unicode code point. @param set A UnicodeSet to receive the characters whose decompositions start with c, if there are any. @return true if there are characters whose decomposition starts with c.
[ "Returns", "true", "if", "there", "are", "characters", "whose", "decomposition", "starts", "with", "c", ".", "If", "so", "then", "the", "set", "is", "cleared", "and", "then", "filled", "with", "those", "characters", ".", "<b", ">", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L859-L881
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.registerBlockListener
public String registerBlockListener(BlockingQueue<QueuedBlockEvent> blockEventQueue) throws InvalidArgumentException { if (shutdown) { throw new InvalidArgumentException(format("Channel %s has been shutdown.", name)); } if (null == blockEventQueue) { throw new InvalidArgumentException("BlockEventQueue parameter is null."); } String handle = new BL(blockEventQueue, -1L, null).getHandle(); logger.trace(format("Register QueuedBlockEvent listener %s", handle)); return handle; }
java
public String registerBlockListener(BlockingQueue<QueuedBlockEvent> blockEventQueue) throws InvalidArgumentException { if (shutdown) { throw new InvalidArgumentException(format("Channel %s has been shutdown.", name)); } if (null == blockEventQueue) { throw new InvalidArgumentException("BlockEventQueue parameter is null."); } String handle = new BL(blockEventQueue, -1L, null).getHandle(); logger.trace(format("Register QueuedBlockEvent listener %s", handle)); return handle; }
[ "public", "String", "registerBlockListener", "(", "BlockingQueue", "<", "QueuedBlockEvent", ">", "blockEventQueue", ")", "throws", "InvalidArgumentException", "{", "if", "(", "shutdown", ")", "{", "throw", "new", "InvalidArgumentException", "(", "format", "(", "\"Chan...
Register a Queued block listener. This queue should never block insertion of events. @param blockEventQueue the queue @return return a handle to ungregister the handler. @throws InvalidArgumentException
[ "Register", "a", "Queued", "block", "listener", ".", "This", "queue", "should", "never", "block", "insertion", "of", "events", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L5515-L5531
FitLayout/segmentation
src/main/java/org/fit/segm/grouping/AreaUtils.java
AreaUtils.isOnSameLine
public static boolean isOnSameLine(Area a1, Area a2, int threshold) { final Rectangular gp1 = a1.getBounds(); final Rectangular gp2 = a2.getBounds(); return (Math.abs(gp1.getY1() - gp2.getY1()) <= threshold && Math.abs(gp1.getY2() - gp2.getY2()) <= threshold); }
java
public static boolean isOnSameLine(Area a1, Area a2, int threshold) { final Rectangular gp1 = a1.getBounds(); final Rectangular gp2 = a2.getBounds(); return (Math.abs(gp1.getY1() - gp2.getY1()) <= threshold && Math.abs(gp1.getY2() - gp2.getY2()) <= threshold); }
[ "public", "static", "boolean", "isOnSameLine", "(", "Area", "a1", ",", "Area", "a2", ",", "int", "threshold", ")", "{", "final", "Rectangular", "gp1", "=", "a1", ".", "getBounds", "(", ")", ";", "final", "Rectangular", "gp2", "=", "a2", ".", "getBounds",...
Checks if the given areas are on the same line. @param a1 @param a2 @return
[ "Checks", "if", "the", "given", "areas", "are", "on", "the", "same", "line", "." ]
train
https://github.com/FitLayout/segmentation/blob/12998087d576640c2f2a6360cf6088af95eea5f4/src/main/java/org/fit/segm/grouping/AreaUtils.java#L59-L65
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java
CheckClassAdapter.verify
public static void verify(final ClassReader cr, final ClassLoader loader, final boolean dump, final PrintWriter pw) { ClassNode cn = new ClassNode(); cr.accept(new CheckClassAdapter(cn, false), ClassReader.SKIP_DEBUG); Type syperType = cn.superName == null ? null : Type .getObjectType(cn.superName); List<MethodNode> methods = cn.methods; List<Type> interfaces = new ArrayList<Type>(); for (Iterator<String> i = cn.interfaces.iterator(); i.hasNext();) { interfaces.add(Type.getObjectType(i.next())); } for (int i = 0; i < methods.size(); ++i) { MethodNode method = methods.get(i); SimpleVerifier verifier = new SimpleVerifier( Type.getObjectType(cn.name), syperType, interfaces, (cn.access & Opcodes.ACC_INTERFACE) != 0); Analyzer<BasicValue> a = new Analyzer<BasicValue>(verifier); if (loader != null) { verifier.setClassLoader(loader); } try { a.analyze(cn.name, method); if (!dump) { continue; } } catch (Exception e) { e.printStackTrace(pw); } printAnalyzerResult(method, a, pw); } pw.flush(); }
java
public static void verify(final ClassReader cr, final ClassLoader loader, final boolean dump, final PrintWriter pw) { ClassNode cn = new ClassNode(); cr.accept(new CheckClassAdapter(cn, false), ClassReader.SKIP_DEBUG); Type syperType = cn.superName == null ? null : Type .getObjectType(cn.superName); List<MethodNode> methods = cn.methods; List<Type> interfaces = new ArrayList<Type>(); for (Iterator<String> i = cn.interfaces.iterator(); i.hasNext();) { interfaces.add(Type.getObjectType(i.next())); } for (int i = 0; i < methods.size(); ++i) { MethodNode method = methods.get(i); SimpleVerifier verifier = new SimpleVerifier( Type.getObjectType(cn.name), syperType, interfaces, (cn.access & Opcodes.ACC_INTERFACE) != 0); Analyzer<BasicValue> a = new Analyzer<BasicValue>(verifier); if (loader != null) { verifier.setClassLoader(loader); } try { a.analyze(cn.name, method); if (!dump) { continue; } } catch (Exception e) { e.printStackTrace(pw); } printAnalyzerResult(method, a, pw); } pw.flush(); }
[ "public", "static", "void", "verify", "(", "final", "ClassReader", "cr", ",", "final", "ClassLoader", "loader", ",", "final", "boolean", "dump", ",", "final", "PrintWriter", "pw", ")", "{", "ClassNode", "cn", "=", "new", "ClassNode", "(", ")", ";", "cr", ...
Checks a given class. @param cr a <code>ClassReader</code> that contains bytecode for the analysis. @param loader a <code>ClassLoader</code> which will be used to load referenced classes. This is useful if you are verifiying multiple interdependent classes. @param dump true if bytecode should be printed out not only when errors are found. @param pw write where results going to be printed
[ "Checks", "a", "given", "class", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L209-L243
TDC-Netdesign/ManagedProperties
managedproperties-service/src/main/java/dk/netdesign/common/osgi/config/service/ManagedPropertiesFactory.java
ManagedPropertiesFactory.getInvocationHandler
protected static <E> ManagedPropertiesController getInvocationHandler(Class<? super E> type, E defaults, List<Class<? extends TypeFilter>> defaultFilters) throws InvalidTypeException, TypeFilterException, DoubleIDException, InvalidMethodException { return new ManagedPropertiesController(type, defaults, defaultFilters); }
java
protected static <E> ManagedPropertiesController getInvocationHandler(Class<? super E> type, E defaults, List<Class<? extends TypeFilter>> defaultFilters) throws InvalidTypeException, TypeFilterException, DoubleIDException, InvalidMethodException { return new ManagedPropertiesController(type, defaults, defaultFilters); }
[ "protected", "static", "<", "E", ">", "ManagedPropertiesController", "getInvocationHandler", "(", "Class", "<", "?", "super", "E", ">", "type", ",", "E", "defaults", ",", "List", "<", "Class", "<", "?", "extends", "TypeFilter", ">", ">", "defaultFilters", ")...
Builds the ManagedProperties object for use as an invocation handler in the {@link Proxy proxy}. @param <E> The return type of the invocation handler. @param type The interface used to create the ManagedProperties object. This Interface must at least be annotated with the {@link dk.netdesign.common.osgi.config.annotation.PropertyDefinition PropertyDefinition} and have one method annotated with the {@link dk.netdesign.common.osgi.config.annotation.Property Property}. The interface will be parsed in order to build the configuration metadata. @param defaults The defaults to use for the ManagedProperties object. Can be null. The defaults must implement the same interface as used in {@code type}. @return The finished ManagedProperties object @throws InvalidTypeException If a method/configuration item mapping uses an invalid type. @throws TypeFilterException If a method/configuration item mapping uses an invalid TypeMapper. @throws DoubleIDException If a method/configuration item mapping uses an ID that is already defined. @throws InvalidMethodException If a method/configuration violates any restriction not defined in the other exceptions.
[ "Builds", "the", "ManagedProperties", "object", "for", "use", "as", "an", "invocation", "handler", "in", "the", "{" ]
train
https://github.com/TDC-Netdesign/ManagedProperties/blob/35a43ab5ea943d595788e13f19fe5b3fa8ba45d8/managedproperties-service/src/main/java/dk/netdesign/common/osgi/config/service/ManagedPropertiesFactory.java#L149-L151
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/AnnotationDto.java
AnnotationDto.transformToDto
public static List<AnnotationDto> transformToDto(List<Annotation> annotations) { if (annotations == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } List<AnnotationDto> result = new ArrayList<>(); for (Annotation annotation : annotations) { result.add(transformToDto(annotation)); } return result; }
java
public static List<AnnotationDto> transformToDto(List<Annotation> annotations) { if (annotations == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } List<AnnotationDto> result = new ArrayList<>(); for (Annotation annotation : annotations) { result.add(transformToDto(annotation)); } return result; }
[ "public", "static", "List", "<", "AnnotationDto", ">", "transformToDto", "(", "List", "<", "Annotation", ">", "annotations", ")", "{", "if", "(", "annotations", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Null entity object cannot be...
Converts list of alert entity objects to list of alertDto objects. @param annotations 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/AnnotationDto.java#L87-L98
calimero-project/calimero-core
src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java
KNXNetworkLinkIP.sendRequest
@Override public void sendRequest(final KNXAddress dst, final Priority p, final byte[] nsdu) throws KNXLinkClosedException, KNXTimeoutException { final int mc = mode == TUNNELING ? CEMILData.MC_LDATA_REQ : CEMILData.MC_LDATA_IND; send(mc, dst, p, nsdu, false); }
java
@Override public void sendRequest(final KNXAddress dst, final Priority p, final byte[] nsdu) throws KNXLinkClosedException, KNXTimeoutException { final int mc = mode == TUNNELING ? CEMILData.MC_LDATA_REQ : CEMILData.MC_LDATA_IND; send(mc, dst, p, nsdu, false); }
[ "@", "Override", "public", "void", "sendRequest", "(", "final", "KNXAddress", "dst", ",", "final", "Priority", "p", ",", "final", "byte", "[", "]", "nsdu", ")", "throws", "KNXLinkClosedException", ",", "KNXTimeoutException", "{", "final", "int", "mc", "=", "...
{@inheritDoc} When communicating with a KNX network which uses open medium, messages are broadcasted within domain (as opposite to system broadcast) by default. Specify <code>dst = null</code> for system broadcast.
[ "{" ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java#L255-L261
realtime-framework/RealtimeMessaging-Android
library/src/main/java/ibt/ortc/api/Balancer.java
Balancer.getServerFromBalancer
public static String getServerFromBalancer(String balancerUrl,String applicationKey) throws IOException, InvalidBalancerServerException { Matcher protocolMatcher = urlProtocolPattern.matcher(balancerUrl); String protocol = protocolMatcher.matches() ? "" : protocolMatcher.group(1); String parsedUrl = String.format("%s%s", protocol, balancerUrl); if(!Strings.isNullOrEmpty(applicationKey)){ // CAUSE: Prefer String.format to + parsedUrl += String.format("?appkey=%s", applicationKey); } URL url = new URL(parsedUrl); // CAUSE: Unused assignment String clusterServer; clusterServer = unsecureRequest(url); return clusterServer; }
java
public static String getServerFromBalancer(String balancerUrl,String applicationKey) throws IOException, InvalidBalancerServerException { Matcher protocolMatcher = urlProtocolPattern.matcher(balancerUrl); String protocol = protocolMatcher.matches() ? "" : protocolMatcher.group(1); String parsedUrl = String.format("%s%s", protocol, balancerUrl); if(!Strings.isNullOrEmpty(applicationKey)){ // CAUSE: Prefer String.format to + parsedUrl += String.format("?appkey=%s", applicationKey); } URL url = new URL(parsedUrl); // CAUSE: Unused assignment String clusterServer; clusterServer = unsecureRequest(url); return clusterServer; }
[ "public", "static", "String", "getServerFromBalancer", "(", "String", "balancerUrl", ",", "String", "applicationKey", ")", "throws", "IOException", ",", "InvalidBalancerServerException", "{", "Matcher", "protocolMatcher", "=", "urlProtocolPattern", ".", "matcher", "(", ...
Retrieves an Ortc Server url from the Ortc Balancer @param balancerUrl The Ortc Balancer url @return An Ortc Server url @throws java.io.IOException @throws InvalidBalancerServerException
[ "Retrieves", "an", "Ortc", "Server", "url", "from", "the", "Ortc", "Balancer" ]
train
https://github.com/realtime-framework/RealtimeMessaging-Android/blob/f0d87b92ed7c591bcfe2b9cf45b947865570e061/library/src/main/java/ibt/ortc/api/Balancer.java#L93-L113
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagContentLoad.java
CmsJspTagContentLoad.doLoadNextFile
protected void doLoadNextFile() throws CmsException { super.doLoadNextResource(); if (m_resource == null) { return; } // upgrade the resource to a file CmsFile file = m_cms.readFile(m_resource); // unmarshal the XML content from the resource, don't use unmarshal(CmsObject, CmsResource) // as no support for getting the historic version that has been cached by a CmsHistoryResourceHandler // will come from there! m_content = CmsXmlContentFactory.unmarshal(m_cms, file, pageContext.getRequest()); // check if locale is available m_contentLocale = m_locale; if (!m_content.hasLocale(m_contentLocale)) { Iterator<Locale> it = OpenCms.getLocaleManager().getDefaultLocales().iterator(); while (it.hasNext()) { Locale locale = it.next(); if (m_content.hasLocale(locale)) { // found a matching locale m_contentLocale = locale; break; } } } }
java
protected void doLoadNextFile() throws CmsException { super.doLoadNextResource(); if (m_resource == null) { return; } // upgrade the resource to a file CmsFile file = m_cms.readFile(m_resource); // unmarshal the XML content from the resource, don't use unmarshal(CmsObject, CmsResource) // as no support for getting the historic version that has been cached by a CmsHistoryResourceHandler // will come from there! m_content = CmsXmlContentFactory.unmarshal(m_cms, file, pageContext.getRequest()); // check if locale is available m_contentLocale = m_locale; if (!m_content.hasLocale(m_contentLocale)) { Iterator<Locale> it = OpenCms.getLocaleManager().getDefaultLocales().iterator(); while (it.hasNext()) { Locale locale = it.next(); if (m_content.hasLocale(locale)) { // found a matching locale m_contentLocale = locale; break; } } } }
[ "protected", "void", "doLoadNextFile", "(", ")", "throws", "CmsException", "{", "super", ".", "doLoadNextResource", "(", ")", ";", "if", "(", "m_resource", "==", "null", ")", "{", "return", ";", "}", "// upgrade the resource to a file", "CmsFile", "file", "=", ...
Load the next file name from the initialized list of file names.<p> @throws CmsException if something goes wrong
[ "Load", "the", "next", "file", "name", "from", "the", "initialized", "list", "of", "file", "names", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagContentLoad.java#L458-L486
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLEquivalentDataPropertiesAxiomImpl_CustomFieldSerializer.java
OWLEquivalentDataPropertiesAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLEquivalentDataPropertiesAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLEquivalentDataPropertiesAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLEquivalentDataPropertiesAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLEquivalentDataPropertiesAxiomImpl_CustomFieldSerializer.java#L95-L98
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java
Sample.getCubicInterpolated
private int getCubicInterpolated(final int currentSamplePos, final int currentTuningPos) { final int poslo = (currentTuningPos >> CubicSpline.SPLINE_FRACSHIFT) & CubicSpline.SPLINE_FRACMASK; final long v1 = (((currentSamplePos-1)<0)?0L: (long)CubicSpline.lut[poslo ]*(long)sample[currentSamplePos-1]) + ( (long)CubicSpline.lut[poslo+1]*(long)sample[currentSamplePos ]) + ( (long)CubicSpline.lut[poslo+2]*(long)sample[currentSamplePos+1]) + ( (long)CubicSpline.lut[poslo+3]*(long)sample[currentSamplePos+2]); return (int)(v1 >> CubicSpline.SPLINE_QUANTBITS); }
java
private int getCubicInterpolated(final int currentSamplePos, final int currentTuningPos) { final int poslo = (currentTuningPos >> CubicSpline.SPLINE_FRACSHIFT) & CubicSpline.SPLINE_FRACMASK; final long v1 = (((currentSamplePos-1)<0)?0L: (long)CubicSpline.lut[poslo ]*(long)sample[currentSamplePos-1]) + ( (long)CubicSpline.lut[poslo+1]*(long)sample[currentSamplePos ]) + ( (long)CubicSpline.lut[poslo+2]*(long)sample[currentSamplePos+1]) + ( (long)CubicSpline.lut[poslo+3]*(long)sample[currentSamplePos+2]); return (int)(v1 >> CubicSpline.SPLINE_QUANTBITS); }
[ "private", "int", "getCubicInterpolated", "(", "final", "int", "currentSamplePos", ",", "final", "int", "currentTuningPos", ")", "{", "final", "int", "poslo", "=", "(", "currentTuningPos", ">>", "CubicSpline", ".", "SPLINE_FRACSHIFT", ")", "&", "CubicSpline", ".",...
does cubic interpolation with the next sample @since 06.06.2006 @param currentTuningPos @return
[ "does", "cubic", "interpolation", "with", "the", "next", "sample" ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java#L150-L160
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuParamSetTexRef
@Deprecated public static int cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) { return checkResult(cuParamSetTexRefNative(hfunc, texunit, hTexRef)); }
java
@Deprecated public static int cuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef) { return checkResult(cuParamSetTexRefNative(hfunc, texunit, hTexRef)); }
[ "@", "Deprecated", "public", "static", "int", "cuParamSetTexRef", "(", "CUfunction", "hfunc", ",", "int", "texunit", ",", "CUtexref", "hTexRef", ")", "{", "return", "checkResult", "(", "cuParamSetTexRefNative", "(", "hfunc", ",", "texunit", ",", "hTexRef", ")", ...
Adds a texture-reference to the function's argument list. <pre> CUresult cuParamSetTexRef ( CUfunction hfunc, int texunit, CUtexref hTexRef ) </pre> <div> <p>Adds a texture-reference to the function's argument list. Deprecated Makes the CUDA array or linear memory bound to the texture reference <tt>hTexRef</tt> available to a device program as a texture. In this version of CUDA, the texture-reference must be obtained via cuModuleGetTexRef() and the <tt>texunit</tt> parameter must be set to CU_PARAM_TR_DEFAULT. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param hfunc Kernel to add texture-reference to @param texunit Texture unit (must be CU_PARAM_TR_DEFAULT) @param hTexRef Texture-reference to add to argument list @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE @deprecated Deprecated in CUDA
[ "Adds", "a", "texture", "-", "reference", "to", "the", "function", "s", "argument", "list", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L11944-L11948
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyImpl_CustomFieldSerializer.java
OWLObjectPropertyImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectProperty instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectProperty instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectProperty", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyImpl_CustomFieldSerializer.java#L84-L87
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java
EncodedElement.addLong
public EncodedElement addLong(long input, int bitCount) { if(next != null) { EncodedElement end = EncodedElement.getEnd_S(next); return end.addLong(input, bitCount); } else if(data.length*8 <= usableBits+bitCount) { //create child and attach to next. //Set child's offset appropriately(i.e, manually set usable bits) int tOff = usableBits %8; int size = data.length/2+1; //guarantee that our new element can store our given value if(size < bitCount) size = bitCount*10; next = new EncodedElement(size, tOff); //add int to child return next.addLong(input, bitCount); } //At this point, we have the space, and we are the end of the chain. int startPos = this.usableBits; byte[] dest = this.data; EncodedElement.addLong(input, bitCount, startPos, dest); usableBits += bitCount; return this; }
java
public EncodedElement addLong(long input, int bitCount) { if(next != null) { EncodedElement end = EncodedElement.getEnd_S(next); return end.addLong(input, bitCount); } else if(data.length*8 <= usableBits+bitCount) { //create child and attach to next. //Set child's offset appropriately(i.e, manually set usable bits) int tOff = usableBits %8; int size = data.length/2+1; //guarantee that our new element can store our given value if(size < bitCount) size = bitCount*10; next = new EncodedElement(size, tOff); //add int to child return next.addLong(input, bitCount); } //At this point, we have the space, and we are the end of the chain. int startPos = this.usableBits; byte[] dest = this.data; EncodedElement.addLong(input, bitCount, startPos, dest); usableBits += bitCount; return this; }
[ "public", "EncodedElement", "addLong", "(", "long", "input", ",", "int", "bitCount", ")", "{", "if", "(", "next", "!=", "null", ")", "{", "EncodedElement", "end", "=", "EncodedElement", ".", "getEnd_S", "(", "next", ")", ";", "return", "end", ".", "addLo...
Add a number of bits from a long to the end of this list's data. Will add a new element if necessary. The bits stored are taken from the lower- order of input. @param input Long containing bits to append to end. @param bitCount Number of bits to append. @return EncodedElement which actually contains the appended value.
[ "Add", "a", "number", "of", "bits", "from", "a", "long", "to", "the", "end", "of", "this", "list", "s", "data", ".", "Will", "add", "a", "new", "element", "if", "necessary", ".", "The", "bits", "stored", "are", "taken", "from", "the", "lower", "-", ...
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java#L293-L315
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/ocsp/OCSPVerifier.java
OCSPVerifier.generateOCSPRequest
public static OCSPReq generateOCSPRequest(X509Certificate issuerCert, BigInteger serialNumber) throws CertificateVerificationException { //Programatically adding Bouncy Castle as the security provider. So no need to manually set. Once the programme // is over security provider will also be removed. Security.addProvider(new BouncyCastleProvider()); try { byte[] issuerCertEnc = issuerCert.getEncoded(); X509CertificateHolder certificateHolder = new X509CertificateHolder(issuerCertEnc); DigestCalculatorProvider digCalcProv = new JcaDigestCalculatorProviderBuilder() .setProvider(Constants.BOUNCY_CASTLE_PROVIDER).build(); // CertID structure is used to uniquely identify certificates that are the subject of // an OCSP request or response and has an ASN.1 definition. CertID structure is defined in RFC 2560. CertificateID id = new CertificateID(digCalcProv.get(CertificateID.HASH_SHA1), certificateHolder, serialNumber); // basic request generation with nonce. OCSPReqBuilder builder = new OCSPReqBuilder(); builder.addRequest(id); // create details for nonce extension. The nonce extension is used to bind // a request to a response to prevent re-play attacks. As the name implies, // the nonce value is something that the client should only use once during a reasonably small period. BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis()); //to create the request Extension builder.setRequestExtensions(new Extensions(new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, new DEROctetString(nonce.toByteArray())))); return builder.build(); } catch (OCSPException | OperatorCreationException | IOException | CertificateEncodingException e) { throw new CertificateVerificationException("Cannot generate OCSP Request with the given certificate", e); } }
java
public static OCSPReq generateOCSPRequest(X509Certificate issuerCert, BigInteger serialNumber) throws CertificateVerificationException { //Programatically adding Bouncy Castle as the security provider. So no need to manually set. Once the programme // is over security provider will also be removed. Security.addProvider(new BouncyCastleProvider()); try { byte[] issuerCertEnc = issuerCert.getEncoded(); X509CertificateHolder certificateHolder = new X509CertificateHolder(issuerCertEnc); DigestCalculatorProvider digCalcProv = new JcaDigestCalculatorProviderBuilder() .setProvider(Constants.BOUNCY_CASTLE_PROVIDER).build(); // CertID structure is used to uniquely identify certificates that are the subject of // an OCSP request or response and has an ASN.1 definition. CertID structure is defined in RFC 2560. CertificateID id = new CertificateID(digCalcProv.get(CertificateID.HASH_SHA1), certificateHolder, serialNumber); // basic request generation with nonce. OCSPReqBuilder builder = new OCSPReqBuilder(); builder.addRequest(id); // create details for nonce extension. The nonce extension is used to bind // a request to a response to prevent re-play attacks. As the name implies, // the nonce value is something that the client should only use once during a reasonably small period. BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis()); //to create the request Extension builder.setRequestExtensions(new Extensions(new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, new DEROctetString(nonce.toByteArray())))); return builder.build(); } catch (OCSPException | OperatorCreationException | IOException | CertificateEncodingException e) { throw new CertificateVerificationException("Cannot generate OCSP Request with the given certificate", e); } }
[ "public", "static", "OCSPReq", "generateOCSPRequest", "(", "X509Certificate", "issuerCert", ",", "BigInteger", "serialNumber", ")", "throws", "CertificateVerificationException", "{", "//Programatically adding Bouncy Castle as the security provider. So no need to manually set. Once the pr...
This method generates an OCSP Request to be sent to an OCSP authority access endpoint. @param issuerCert the Issuer's certificate of the peer certificate we are interested in. @param serialNumber of the peer certificate. @return generated OCSP request. @throws CertificateVerificationException if any error occurs while generating ocsp request.
[ "This", "method", "generates", "an", "OCSP", "Request", "to", "be", "sent", "to", "an", "OCSP", "authority", "access", "endpoint", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/ocsp/OCSPVerifier.java#L199-L235
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/cdn/CdnClient.java
CdnClient.setHttpsConfig
public void setHttpsConfig(String domain, HttpsConfig https) { SetHttpsConfigRequest request = new SetHttpsConfigRequest() .withDomain(domain) .withHttps(https); setHttpsConfig(request); }
java
public void setHttpsConfig(String domain, HttpsConfig https) { SetHttpsConfigRequest request = new SetHttpsConfigRequest() .withDomain(domain) .withHttps(https); setHttpsConfig(request); }
[ "public", "void", "setHttpsConfig", "(", "String", "domain", ",", "HttpsConfig", "https", ")", "{", "SetHttpsConfigRequest", "request", "=", "new", "SetHttpsConfigRequest", "(", ")", ".", "withDomain", "(", "domain", ")", ".", "withHttps", "(", "https", ")", "...
Set HTTPS with certain configuration. @param domain Name of the domain. @param https The configuration of HTTPS.
[ "Set", "HTTPS", "with", "certain", "configuration", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L453-L458
zxing/zxing
javase/src/main/java/com/google/zxing/client/j2se/MatrixToImageWriter.java
MatrixToImageWriter.toBufferedImage
public static BufferedImage toBufferedImage(BitMatrix matrix, MatrixToImageConfig config) { int width = matrix.getWidth(); int height = matrix.getHeight(); BufferedImage image = new BufferedImage(width, height, config.getBufferedImageColorModel()); int onColor = config.getPixelOnColor(); int offColor = config.getPixelOffColor(); int[] rowPixels = new int[width]; BitArray row = new BitArray(width); for (int y = 0; y < height; y++) { row = matrix.getRow(y, row); for (int x = 0; x < width; x++) { rowPixels[x] = row.get(x) ? onColor : offColor; } image.setRGB(0, y, width, 1, rowPixels, 0, width); } return image; }
java
public static BufferedImage toBufferedImage(BitMatrix matrix, MatrixToImageConfig config) { int width = matrix.getWidth(); int height = matrix.getHeight(); BufferedImage image = new BufferedImage(width, height, config.getBufferedImageColorModel()); int onColor = config.getPixelOnColor(); int offColor = config.getPixelOffColor(); int[] rowPixels = new int[width]; BitArray row = new BitArray(width); for (int y = 0; y < height; y++) { row = matrix.getRow(y, row); for (int x = 0; x < width; x++) { rowPixels[x] = row.get(x) ? onColor : offColor; } image.setRGB(0, y, width, 1, rowPixels, 0, width); } return image; }
[ "public", "static", "BufferedImage", "toBufferedImage", "(", "BitMatrix", "matrix", ",", "MatrixToImageConfig", "config", ")", "{", "int", "width", "=", "matrix", ".", "getWidth", "(", ")", ";", "int", "height", "=", "matrix", ".", "getHeight", "(", ")", ";"...
As {@link #toBufferedImage(BitMatrix)}, but allows customization of the output. @param matrix {@link BitMatrix} to write @param config output configuration @return {@link BufferedImage} representation of the input
[ "As", "{", "@link", "#toBufferedImage", "(", "BitMatrix", ")", "}", "but", "allows", "customization", "of", "the", "output", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/javase/src/main/java/com/google/zxing/client/j2se/MatrixToImageWriter.java#L60-L76
eserating/siren4j
src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java
BaseBuilder.addStep
protected void addStep(String methodName, Object[] args) { if(StringUtils.isBlank(methodName)) { throw new IllegalArgumentException("methodName cannot be null or empty."); } addStep(methodName, args, false); }
java
protected void addStep(String methodName, Object[] args) { if(StringUtils.isBlank(methodName)) { throw new IllegalArgumentException("methodName cannot be null or empty."); } addStep(methodName, args, false); }
[ "protected", "void", "addStep", "(", "String", "methodName", ",", "Object", "[", "]", "args", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "methodName", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"methodName cannot be null or e...
Adds a builder step for this builder, upon build these steps will be called in the same order they came in on. @param methodName cannot be <code>null</code> or empty. @param args may be <code>null</code> or empty.
[ "Adds", "a", "builder", "step", "for", "this", "builder", "upon", "build", "these", "steps", "will", "be", "called", "in", "the", "same", "order", "they", "came", "in", "on", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/BaseBuilder.java#L139-L144
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.validIndex
public static <T extends CharSequence> T validIndex(final T chars, final int index, final String message, final Object... values) { Validate.notNull(chars); if (index < 0 || index >= chars.length()) { throw new IndexOutOfBoundsException(StringUtils.simpleFormat(message, values)); } return chars; }
java
public static <T extends CharSequence> T validIndex(final T chars, final int index, final String message, final Object... values) { Validate.notNull(chars); if (index < 0 || index >= chars.length()) { throw new IndexOutOfBoundsException(StringUtils.simpleFormat(message, values)); } return chars; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validIndex", "(", "final", "T", "chars", ",", "final", "int", "index", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "Validate", ".", "notNull", "...
<p>Validates that the index is within the bounds of the argument character sequence; otherwise throwing an exception with the specified message.</p> <pre>Validate.validIndex(myStr, 2, "The string index is invalid: ");</pre> <p>If the character sequence is {@code null}, then the message of the exception is &quot;The validated object is null&quot;.</p> @param <T> the character sequence type @param chars the character sequence to check, validated not null by this method @param index the index to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated character sequence (never {@code null} for method chaining) @throws NullPointerException if the character sequence is {@code null} @throws IndexOutOfBoundsException if the index is invalid @see #validIndex(CharSequence, int) @since 3.0
[ "<p", ">", "Validates", "that", "the", "index", "is", "within", "the", "bounds", "of", "the", "argument", "character", "sequence", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L753-L759
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/jgroups/JGroupsTransport.java
JGroupsTransport.join
public void join(org.ironjacamar.core.spi.workmanager.Address logicalAddress, org.jgroups.Address address) { super.join(logicalAddress, address); }
java
public void join(org.ironjacamar.core.spi.workmanager.Address logicalAddress, org.jgroups.Address address) { super.join(logicalAddress, address); }
[ "public", "void", "join", "(", "org", ".", "ironjacamar", ".", "core", ".", "spi", ".", "workmanager", ".", "Address", "logicalAddress", ",", "org", ".", "jgroups", ".", "Address", "address", ")", "{", "super", ".", "join", "(", "logicalAddress", ",", "a...
Delegator @param logicalAddress The logical address @param address The address
[ "Delegator" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/jgroups/JGroupsTransport.java#L270-L273
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java
PrimitiveUtils.readFloat
public static Float readFloat(String value, Float defaultValue) { if (!StringUtils.hasText(value)) return defaultValue; return Float.valueOf(value); }
java
public static Float readFloat(String value, Float defaultValue) { if (!StringUtils.hasText(value)) return defaultValue; return Float.valueOf(value); }
[ "public", "static", "Float", "readFloat", "(", "String", "value", ",", "Float", "defaultValue", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "value", ")", ")", "return", "defaultValue", ";", "return", "Float", ".", "valueOf", "(", "value",...
Read float. @param value the value @param defaultValue the default value @return the float
[ "Read", "float", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java#L176-L180
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java
TabbedPaneTabCloseButtonPainter.drawEnabledGraphic
private void drawEnabledGraphic(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4); g.setPaint(createGraphicInnerShadowGradient(s)); g.fill(s); }
java
private void drawEnabledGraphic(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4); g.setPaint(createGraphicInnerShadowGradient(s)); g.fill(s); }
[ "private", "void", "drawEnabledGraphic", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "shapeGenerator", ".", "createTabCloseIcon", "(", "2", ",", "2", ",", "width", "-", "4", ",", "height", "-", "4", "...
Draw the "close" graphic for the simple enabled state. @param g the Graphic context. @param width the width of the graphic. @param height the height of the graphic.
[ "Draw", "the", "close", "graphic", "for", "the", "simple", "enabled", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java#L140-L145
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/IntStream.java
IntStream.mapToDouble
@NotNull public DoubleStream mapToDouble(@NotNull final IntToDoubleFunction mapper) { return new DoubleStream(params, new IntMapToDouble(iterator, mapper)); }
java
@NotNull public DoubleStream mapToDouble(@NotNull final IntToDoubleFunction mapper) { return new DoubleStream(params, new IntMapToDouble(iterator, mapper)); }
[ "@", "NotNull", "public", "DoubleStream", "mapToDouble", "(", "@", "NotNull", "final", "IntToDoubleFunction", "mapper", ")", "{", "return", "new", "DoubleStream", "(", "params", ",", "new", "IntMapToDouble", "(", "iterator", ",", "mapper", ")", ")", ";", "}" ]
Returns a {@code DoubleStream} consisting of the results of applying the given function to the elements of this stream. <p> This is an intermediate operation. @param mapper the mapper function used to apply to each element @return the new {@code DoubleStream} @since 1.1.4 @see #flatMap(com.annimon.stream.function.IntFunction)
[ "Returns", "a", "{", "@code", "DoubleStream", "}", "consisting", "of", "the", "results", "of", "applying", "the", "given", "function", "to", "the", "elements", "of", "this", "stream", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L558-L561
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java
ClassPathResource.getReaderNoCache
@Nullable public Reader getReaderNoCache (@Nonnull final ClassLoader aClassLoader, @Nonnull final Charset aCharset) { return StreamHelper.createReader (getInputStreamNoCache (aClassLoader), aCharset); }
java
@Nullable public Reader getReaderNoCache (@Nonnull final ClassLoader aClassLoader, @Nonnull final Charset aCharset) { return StreamHelper.createReader (getInputStreamNoCache (aClassLoader), aCharset); }
[ "@", "Nullable", "public", "Reader", "getReaderNoCache", "(", "@", "Nonnull", "final", "ClassLoader", "aClassLoader", ",", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "return", "StreamHelper", ".", "createReader", "(", "getInputStreamNoCache", "(", "...
Create a {@link Reader} of this resource, using the specified class loader only. @param aClassLoader The class loader to be used. May not be <code>null</code>. @param aCharset The charset to be used for the {@link Reader}. May not be <code>null</code>. @return <code>null</code> if the path could not be resolved.
[ "Create", "a", "{", "@link", "Reader", "}", "of", "this", "resource", "using", "the", "specified", "class", "loader", "only", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/resource/ClassPathResource.java#L308-L312
vst/commons-math-extensions
src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java
DMatrixUtils._ttbdInner
private static double[] _ttbdInner (double target, double[] lower, double[] upper, RandomGenerator randomGenerator) { // Initialize the return value: final double[] retval = new double[lower.length]; // Iterate over the retval and simulate: for (int i = 0; i < retval.length; i++) { if (lower[i] == upper[i]) { retval[i] = lower[i]; } else { retval[i] = new UniformRealDistribution(randomGenerator, lower[i], upper[i]).sample(); } } // Compute the gap of simulated total and target total: double gap = target - DMatrixUtils.sum(retval); // Iterate over the return values and adjust as per gap: for (int i = 0; i < retval.length; i++) { // If there is no gap, return the retval: if (gap == 0.0) { return retval; } // Calculate the distances to limits: final double distanceToLower = lower[i] - retval[i]; final double distanceToUpper = upper[i] - retval[i]; // Compute the permissible shift: final double shift = gap > 0 ? Math.min(distanceToUpper, gap) : Math.max(distanceToLower, gap); // Apply the shift: retval[i] += shift; // Update gap: gap -= shift; } // Done, return: return retval; }
java
private static double[] _ttbdInner (double target, double[] lower, double[] upper, RandomGenerator randomGenerator) { // Initialize the return value: final double[] retval = new double[lower.length]; // Iterate over the retval and simulate: for (int i = 0; i < retval.length; i++) { if (lower[i] == upper[i]) { retval[i] = lower[i]; } else { retval[i] = new UniformRealDistribution(randomGenerator, lower[i], upper[i]).sample(); } } // Compute the gap of simulated total and target total: double gap = target - DMatrixUtils.sum(retval); // Iterate over the return values and adjust as per gap: for (int i = 0; i < retval.length; i++) { // If there is no gap, return the retval: if (gap == 0.0) { return retval; } // Calculate the distances to limits: final double distanceToLower = lower[i] - retval[i]; final double distanceToUpper = upper[i] - retval[i]; // Compute the permissible shift: final double shift = gap > 0 ? Math.min(distanceToUpper, gap) : Math.max(distanceToLower, gap); // Apply the shift: retval[i] += shift; // Update gap: gap -= shift; } // Done, return: return retval; }
[ "private", "static", "double", "[", "]", "_ttbdInner", "(", "double", "target", ",", "double", "[", "]", "lower", ",", "double", "[", "]", "upper", ",", "RandomGenerator", "randomGenerator", ")", "{", "// Initialize the return value:", "final", "double", "[", ...
Returns a target-total bounded distribution sample. @param target The target total value. @param lower Lower limits. @param upper Upper limits. @param randomGenerator The random generator. @return A vector of target-total bounded sample.
[ "Returns", "a", "target", "-", "total", "bounded", "distribution", "sample", "." ]
train
https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/DMatrixUtils.java#L582-L622
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.localSeo_visibilityCheckResult_GET
public ArrayList<OvhVisibilityCheckResultResponse> localSeo_visibilityCheckResult_GET(String directory, Long id, String token) throws IOException { String qPath = "/hosting/web/localSeo/visibilityCheckResult"; StringBuilder sb = path(qPath); query(sb, "directory", directory); query(sb, "id", id); query(sb, "token", token); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t12); }
java
public ArrayList<OvhVisibilityCheckResultResponse> localSeo_visibilityCheckResult_GET(String directory, Long id, String token) throws IOException { String qPath = "/hosting/web/localSeo/visibilityCheckResult"; StringBuilder sb = path(qPath); query(sb, "directory", directory); query(sb, "id", id); query(sb, "token", token); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t12); }
[ "public", "ArrayList", "<", "OvhVisibilityCheckResultResponse", ">", "localSeo_visibilityCheckResult_GET", "(", "String", "directory", ",", "Long", "id", ",", "String", "token", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/localSeo/visibility...
Get the result of a visibility check REST: GET /hosting/web/localSeo/visibilityCheckResult @param directory [required] Get the result only for one directory @param token [required] Token received when requesting the check @param id [required] Id of the check
[ "Get", "the", "result", "of", "a", "visibility", "check" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2247-L2255
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/MemoryEntityLockStore.java
MemoryEntityLockStore.update
@Override public void update(IEntityLock lock, java.util.Date newExpiration, Integer newLockType) throws LockingException { if (find(lock) == null) { throw new LockingException("Problem updating " + lock + " : not found in store."); } primAdd(lock, newExpiration); }
java
@Override public void update(IEntityLock lock, java.util.Date newExpiration, Integer newLockType) throws LockingException { if (find(lock) == null) { throw new LockingException("Problem updating " + lock + " : not found in store."); } primAdd(lock, newExpiration); }
[ "@", "Override", "public", "void", "update", "(", "IEntityLock", "lock", ",", "java", ".", "util", ".", "Date", "newExpiration", ",", "Integer", "newLockType", ")", "throws", "LockingException", "{", "if", "(", "find", "(", "lock", ")", "==", "null", ")", ...
Make sure the store has a reference to the lock, and then add the lock to refresh the SmartCache wrapper. @param lock org.apereo.portal.concurrency.locking.IEntityLock @param newExpiration java.util.Date @param newLockType Integer
[ "Make", "sure", "the", "store", "has", "a", "reference", "to", "the", "lock", "and", "then", "add", "the", "lock", "to", "refresh", "the", "SmartCache", "wrapper", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/MemoryEntityLockStore.java#L257-L264
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.addCache
protected void addCache(Class cls, String pkgname, List<String> classnames, List<Class> classes) { m_CacheNames.put(cls.getName() + "-" + pkgname, classnames); m_CacheClasses.put(cls.getName() + "-" + pkgname, classes); }
java
protected void addCache(Class cls, String pkgname, List<String> classnames, List<Class> classes) { m_CacheNames.put(cls.getName() + "-" + pkgname, classnames); m_CacheClasses.put(cls.getName() + "-" + pkgname, classes); }
[ "protected", "void", "addCache", "(", "Class", "cls", ",", "String", "pkgname", ",", "List", "<", "String", ">", "classnames", ",", "List", "<", "Class", ">", "classes", ")", "{", "m_CacheNames", ".", "put", "(", "cls", ".", "getName", "(", ")", "+", ...
adds the list of classnames to the cache. @param cls the class to cache the classnames for @param pkgname the package name the classes were found in @param classnames the list of classnames to cache
[ "adds", "the", "list", "of", "classnames", "to", "the", "cache", "." ]
train
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L496-L499
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java
ExportConfigurationsInner.getAsync
public Observable<ApplicationInsightsComponentExportConfigurationInner> getAsync(String resourceGroupName, String resourceName, String exportId) { return getWithServiceResponseAsync(resourceGroupName, resourceName, exportId).map(new Func1<ServiceResponse<ApplicationInsightsComponentExportConfigurationInner>, ApplicationInsightsComponentExportConfigurationInner>() { @Override public ApplicationInsightsComponentExportConfigurationInner call(ServiceResponse<ApplicationInsightsComponentExportConfigurationInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInsightsComponentExportConfigurationInner> getAsync(String resourceGroupName, String resourceName, String exportId) { return getWithServiceResponseAsync(resourceGroupName, resourceName, exportId).map(new Func1<ServiceResponse<ApplicationInsightsComponentExportConfigurationInner>, ApplicationInsightsComponentExportConfigurationInner>() { @Override public ApplicationInsightsComponentExportConfigurationInner call(ServiceResponse<ApplicationInsightsComponentExportConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInsightsComponentExportConfigurationInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "exportId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", "...
Get the Continuous Export configuration for this export id. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param exportId The Continuous Export configuration ID. This is unique within a Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentExportConfigurationInner object
[ "Get", "the", "Continuous", "Export", "configuration", "for", "this", "export", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java#L394-L401
mangstadt/biweekly
src/main/java/biweekly/io/WriteContext.java
WriteContext.addDate
public void addDate(ICalDate date, boolean floating, TimeZone tz) { if (date != null && date.hasTime() && !floating && tz != null) { dates.add(date); } }
java
public void addDate(ICalDate date, boolean floating, TimeZone tz) { if (date != null && date.hasTime() && !floating && tz != null) { dates.add(date); } }
[ "public", "void", "addDate", "(", "ICalDate", "date", ",", "boolean", "floating", ",", "TimeZone", "tz", ")", "{", "if", "(", "date", "!=", "null", "&&", "date", ".", "hasTime", "(", ")", "&&", "!", "floating", "&&", "tz", "!=", "null", ")", "{", "...
Records the timezoned date-time values that are being written. This is used to generate a DAYLIGHT property for vCalendar objects. @param floating true if the date is floating, false if not @param tz the timezone to format the date in or null for UTC @param date the date value
[ "Records", "the", "timezoned", "date", "-", "time", "values", "that", "are", "being", "written", ".", "This", "is", "used", "to", "generate", "a", "DAYLIGHT", "property", "for", "vCalendar", "objects", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/WriteContext.java#L112-L116
quattor/pan
panc/src/main/java/org/quattor/ant/PanCheckSyntaxTask.java
PanCheckSyntaxTask.addFiles
private void addFiles(FileSet fs) { // Get the files included in the fileset. DirectoryScanner ds = fs.getDirectoryScanner(getProject()); // The base directory for all files. File basedir = ds.getBasedir(); // Loop over each file creating a File object. for (String f : ds.getIncludedFiles()) { if (SourceType.hasSourceFileExtension(f)) { sourceFiles.add(new File(basedir, f)); } } }
java
private void addFiles(FileSet fs) { // Get the files included in the fileset. DirectoryScanner ds = fs.getDirectoryScanner(getProject()); // The base directory for all files. File basedir = ds.getBasedir(); // Loop over each file creating a File object. for (String f : ds.getIncludedFiles()) { if (SourceType.hasSourceFileExtension(f)) { sourceFiles.add(new File(basedir, f)); } } }
[ "private", "void", "addFiles", "(", "FileSet", "fs", ")", "{", "// Get the files included in the fileset.", "DirectoryScanner", "ds", "=", "fs", ".", "getDirectoryScanner", "(", "getProject", "(", ")", ")", ";", "// The base directory for all files.", "File", "basedir",...
Utility method that adds all of the files in a fileset to the list of files to be processed. Duplicate files appear only once in the final list. Files not ending with a valid source file extension are ignored. @param fs FileSet from which to get the file names
[ "Utility", "method", "that", "adds", "all", "of", "the", "files", "in", "a", "fileset", "to", "the", "list", "of", "files", "to", "be", "processed", ".", "Duplicate", "files", "appear", "only", "once", "in", "the", "final", "list", ".", "Files", "not", ...
train
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/ant/PanCheckSyntaxTask.java#L83-L97
alipay/sofa-rpc
extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java
SofaRegistry.addAttributes
private void addAttributes(PublisherRegistration publisherRegistration, String group) { // if group == null; group = "DEFAULT_GROUP" if (StringUtils.isNotEmpty(group)) { publisherRegistration.setGroup(group); } }
java
private void addAttributes(PublisherRegistration publisherRegistration, String group) { // if group == null; group = "DEFAULT_GROUP" if (StringUtils.isNotEmpty(group)) { publisherRegistration.setGroup(group); } }
[ "private", "void", "addAttributes", "(", "PublisherRegistration", "publisherRegistration", ",", "String", "group", ")", "{", "// if group == null; group = \"DEFAULT_GROUP\"", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "group", ")", ")", "{", "publisherRegistration"...
添加额外的属性 @param publisherRegistration 注册或者订阅对象 @param group 分组
[ "添加额外的属性" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java#L305-L311
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
ReflectionToStringBuilder.toStringExclude
public static String toStringExclude(final Object object, final String... excludeFieldNames) { return new ReflectionToStringBuilder(object).setExcludeFieldNames(excludeFieldNames).toString(); }
java
public static String toStringExclude(final Object object, final String... excludeFieldNames) { return new ReflectionToStringBuilder(object).setExcludeFieldNames(excludeFieldNames).toString(); }
[ "public", "static", "String", "toStringExclude", "(", "final", "Object", "object", ",", "final", "String", "...", "excludeFieldNames", ")", "{", "return", "new", "ReflectionToStringBuilder", "(", "object", ")", ".", "setExcludeFieldNames", "(", "excludeFieldNames", ...
Builds a String for a toString method excluding the given field names. @param object The object to "toString". @param excludeFieldNames The field names to exclude @return The toString value.
[ "Builds", "a", "String", "for", "a", "toString", "method", "excluding", "the", "given", "field", "names", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java#L424-L426
SUSE/salt-netapi-client
src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java
HttpAsyncClientImpl.prepareRequest
private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) { HttpUriRequest httpRequest; if (jsonData != null) { // POST data HttpPost httpPost = new HttpPost(uri); httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICATION_JSON)); httpRequest = httpPost; } else { // GET request httpRequest = new HttpGet(uri); } httpRequest.addHeader(HttpHeaders.ACCEPT, "application/json"); headers.forEach(httpRequest::addHeader); return httpRequest; }
java
private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) { HttpUriRequest httpRequest; if (jsonData != null) { // POST data HttpPost httpPost = new HttpPost(uri); httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICATION_JSON)); httpRequest = httpPost; } else { // GET request httpRequest = new HttpGet(uri); } httpRequest.addHeader(HttpHeaders.ACCEPT, "application/json"); headers.forEach(httpRequest::addHeader); return httpRequest; }
[ "private", "<", "T", ">", "HttpUriRequest", "prepareRequest", "(", "URI", "uri", ",", "Map", "<", "String", ",", "String", ">", "headers", ",", "String", "jsonData", ")", "{", "HttpUriRequest", "httpRequest", ";", "if", "(", "jsonData", "!=", "null", ")", ...
Prepares the HTTP request object creating a POST or GET request depending on if data is supplied or not. @param jsonData json POST data, will use GET if null @return HttpUriRequest object the prepared request
[ "Prepares", "the", "HTTP", "request", "object", "creating", "a", "POST", "or", "GET", "request", "depending", "on", "if", "data", "is", "supplied", "or", "not", "." ]
train
https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/client/impl/HttpAsyncClientImpl.java#L74-L89
jkrasnay/sqlbuilder
src/main/java/ca/krasnay/sqlbuilder/orm/Mapping.java
Mapping.deleteById
public void deleteById(Object id) { int count = beginDelete().whereEquals(idColumn.getColumnName(), id).delete(); if (count == 0) { throw new RowNotFoundException(table, id); } }
java
public void deleteById(Object id) { int count = beginDelete().whereEquals(idColumn.getColumnName(), id).delete(); if (count == 0) { throw new RowNotFoundException(table, id); } }
[ "public", "void", "deleteById", "(", "Object", "id", ")", "{", "int", "count", "=", "beginDelete", "(", ")", ".", "whereEquals", "(", "idColumn", ".", "getColumnName", "(", ")", ",", "id", ")", ".", "delete", "(", ")", ";", "if", "(", "count", "==", ...
Deletes an entity by its primary key. @param id Primary key of the entity.
[ "Deletes", "an", "entity", "by", "its", "primary", "key", "." ]
train
https://github.com/jkrasnay/sqlbuilder/blob/8e6acedc51cfad0527263376af51e1ef052f7147/src/main/java/ca/krasnay/sqlbuilder/orm/Mapping.java#L363-L370
phax/ph-commons
ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java
KeyStoreHelper.loadKeyStore
@Nonnull public static LoadedKeyStore loadKeyStore (@Nonnull final IKeyStoreType aKeyStoreType, @Nullable final String sKeyStorePath, @Nullable final String sKeyStorePassword) { ValueEnforcer.notNull (aKeyStoreType, "KeyStoreType"); // Get the parameters for the key store if (StringHelper.hasNoText (sKeyStorePath)) return new LoadedKeyStore (null, EKeyStoreLoadError.KEYSTORE_NO_PATH); KeyStore aKeyStore = null; // Try to load key store try { aKeyStore = loadKeyStoreDirect (aKeyStoreType, sKeyStorePath, sKeyStorePassword); } catch (final IllegalArgumentException ex) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("No such key store '" + sKeyStorePath + "': " + ex.getMessage (), ex.getCause ()); return new LoadedKeyStore (null, EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_NON_EXISTING, sKeyStorePath, ex.getMessage ()); } catch (final Exception ex) { final boolean bInvalidPW = ex instanceof IOException && ex.getCause () instanceof UnrecoverableKeyException; if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Failed to load key store '" + sKeyStorePath + "': " + ex.getMessage (), bInvalidPW ? null : ex.getCause ()); return new LoadedKeyStore (null, bInvalidPW ? EKeyStoreLoadError.KEYSTORE_INVALID_PASSWORD : EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_FORMAT_ERROR, sKeyStorePath, ex.getMessage ()); } // Finally success return new LoadedKeyStore (aKeyStore, null); }
java
@Nonnull public static LoadedKeyStore loadKeyStore (@Nonnull final IKeyStoreType aKeyStoreType, @Nullable final String sKeyStorePath, @Nullable final String sKeyStorePassword) { ValueEnforcer.notNull (aKeyStoreType, "KeyStoreType"); // Get the parameters for the key store if (StringHelper.hasNoText (sKeyStorePath)) return new LoadedKeyStore (null, EKeyStoreLoadError.KEYSTORE_NO_PATH); KeyStore aKeyStore = null; // Try to load key store try { aKeyStore = loadKeyStoreDirect (aKeyStoreType, sKeyStorePath, sKeyStorePassword); } catch (final IllegalArgumentException ex) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("No such key store '" + sKeyStorePath + "': " + ex.getMessage (), ex.getCause ()); return new LoadedKeyStore (null, EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_NON_EXISTING, sKeyStorePath, ex.getMessage ()); } catch (final Exception ex) { final boolean bInvalidPW = ex instanceof IOException && ex.getCause () instanceof UnrecoverableKeyException; if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Failed to load key store '" + sKeyStorePath + "': " + ex.getMessage (), bInvalidPW ? null : ex.getCause ()); return new LoadedKeyStore (null, bInvalidPW ? EKeyStoreLoadError.KEYSTORE_INVALID_PASSWORD : EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_FORMAT_ERROR, sKeyStorePath, ex.getMessage ()); } // Finally success return new LoadedKeyStore (aKeyStore, null); }
[ "@", "Nonnull", "public", "static", "LoadedKeyStore", "loadKeyStore", "(", "@", "Nonnull", "final", "IKeyStoreType", "aKeyStoreType", ",", "@", "Nullable", "final", "String", "sKeyStorePath", ",", "@", "Nullable", "final", "String", "sKeyStorePassword", ")", "{", ...
Load the provided key store in a safe manner. @param aKeyStoreType Type of key store. May not be <code>null</code>. @param sKeyStorePath Path to the key store. May not be <code>null</code> to succeed. @param sKeyStorePassword Password for the key store. May not be <code>null</code> to succeed. @return The key store loading result. Never <code>null</code>.
[ "Load", "the", "provided", "key", "store", "in", "a", "safe", "manner", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java#L214-L258
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsCategoriesTab.java
CmsCategoriesTab.updateContentList
public void updateContentList(List<CmsCategoryBean> categoriesBeans, List<String> selectedCategories) { clearList(); if (m_categories == null) { m_categories = new HashMap<String, CmsCategoryBean>(); } if ((categoriesBeans != null) && !categoriesBeans.isEmpty()) { for (CmsCategoryBean categoryBean : categoriesBeans) { m_categories.put(categoryBean.getPath(), categoryBean); // set the list item widget CmsDataValue dataValue = new CmsDataValue( 600, 3, CmsCategoryBean.SMALL_ICON_CLASSES, categoryBean.getTitle(), CmsStringUtil.isNotEmptyOrWhitespaceOnly(categoryBean.getDescription()) ? categoryBean.getDescription() : categoryBean.getPath()); // the checkbox CmsCheckBox checkBox = new CmsCheckBox(); if ((selectedCategories != null) && selectedCategories.contains(categoryBean.getPath())) { checkBox.setChecked(true); } SelectionHandler selectionHandler = new SelectionHandler(categoryBean.getPath(), checkBox); checkBox.addClickHandler(selectionHandler); dataValue.addClickHandler(selectionHandler); dataValue.setUnselectable(); // set the category list item and add to list CmsTreeItem listItem = new CmsTreeItem(false, checkBox, dataValue); listItem.setSmallView(true); listItem.setId(categoryBean.getPath()); addWidgetToList(listItem); } } else { showIsEmptyLabel(); } }
java
public void updateContentList(List<CmsCategoryBean> categoriesBeans, List<String> selectedCategories) { clearList(); if (m_categories == null) { m_categories = new HashMap<String, CmsCategoryBean>(); } if ((categoriesBeans != null) && !categoriesBeans.isEmpty()) { for (CmsCategoryBean categoryBean : categoriesBeans) { m_categories.put(categoryBean.getPath(), categoryBean); // set the list item widget CmsDataValue dataValue = new CmsDataValue( 600, 3, CmsCategoryBean.SMALL_ICON_CLASSES, categoryBean.getTitle(), CmsStringUtil.isNotEmptyOrWhitespaceOnly(categoryBean.getDescription()) ? categoryBean.getDescription() : categoryBean.getPath()); // the checkbox CmsCheckBox checkBox = new CmsCheckBox(); if ((selectedCategories != null) && selectedCategories.contains(categoryBean.getPath())) { checkBox.setChecked(true); } SelectionHandler selectionHandler = new SelectionHandler(categoryBean.getPath(), checkBox); checkBox.addClickHandler(selectionHandler); dataValue.addClickHandler(selectionHandler); dataValue.setUnselectable(); // set the category list item and add to list CmsTreeItem listItem = new CmsTreeItem(false, checkBox, dataValue); listItem.setSmallView(true); listItem.setId(categoryBean.getPath()); addWidgetToList(listItem); } } else { showIsEmptyLabel(); } }
[ "public", "void", "updateContentList", "(", "List", "<", "CmsCategoryBean", ">", "categoriesBeans", ",", "List", "<", "String", ">", "selectedCategories", ")", "{", "clearList", "(", ")", ";", "if", "(", "m_categories", "==", "null", ")", "{", "m_categories", ...
Updates the content of the categories list.<p> @param categoriesBeans the updates list of categories tree item beans @param selectedCategories the categories to select in the list by update
[ "Updates", "the", "content", "of", "the", "categories", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsCategoriesTab.java#L211-L247
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieUtils.java
CookieUtils.maybeQuote
private static void maybeQuote(StringBuilder buff, String value) { // PK48169 - handle a null value as well as an empty one if (null == value || 0 == value.length()) { buff.append("\"\""); } else if (needsQuote(value)) { buff.append('"'); buff.append(value); buff.append('"'); } else { buff.append(value); } }
java
private static void maybeQuote(StringBuilder buff, String value) { // PK48169 - handle a null value as well as an empty one if (null == value || 0 == value.length()) { buff.append("\"\""); } else if (needsQuote(value)) { buff.append('"'); buff.append(value); buff.append('"'); } else { buff.append(value); } }
[ "private", "static", "void", "maybeQuote", "(", "StringBuilder", "buff", ",", "String", "value", ")", "{", "// PK48169 - handle a null value as well as an empty one", "if", "(", "null", "==", "value", "||", "0", "==", "value", ".", "length", "(", ")", ")", "{", ...
Append the input value string to the given buffer, wrapping it with quotes if need be. @param buff @param value
[ "Append", "the", "input", "value", "string", "to", "the", "given", "buffer", "wrapping", "it", "with", "quotes", "if", "need", "be", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieUtils.java#L169-L180
facebookarchive/hive-dwrf
hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java
Slice.setByte
public void setByte(int index, int value) { checkIndexLength(index, SizeOf.SIZE_OF_BYTE); unsafe.putByte(base, address + index, (byte) (value & 0xFF)); }
java
public void setByte(int index, int value) { checkIndexLength(index, SizeOf.SIZE_OF_BYTE); unsafe.putByte(base, address + index, (byte) (value & 0xFF)); }
[ "public", "void", "setByte", "(", "int", "index", ",", "int", "value", ")", "{", "checkIndexLength", "(", "index", ",", "SizeOf", ".", "SIZE_OF_BYTE", ")", ";", "unsafe", ".", "putByte", "(", "base", ",", "address", "+", "index", ",", "(", "byte", ")",...
Sets the specified byte at the specified absolute {@code index} in this buffer. The 24 high-order bits of the specified value are ignored. @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or {@code index + 1} is greater than {@code this.length()}
[ "Sets", "the", "specified", "byte", "at", "the", "specified", "absolute", "{", "@code", "index", "}", "in", "this", "buffer", ".", "The", "24", "high", "-", "order", "bits", "of", "the", "specified", "value", "are", "ignored", "." ]
train
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L406-L410
dnsjava/dnsjava
org/xbill/DNS/Cache.java
Cache.addRRset
public synchronized void addRRset(RRset rrset, int cred) { long ttl = rrset.getTTL(); Name name = rrset.getName(); int type = rrset.getType(); Element element = findElement(name, type, 0); if (ttl == 0) { if (element != null && element.compareCredibility(cred) <= 0) removeElement(name, type); } else { if (element != null && element.compareCredibility(cred) <= 0) element = null; if (element == null) { CacheRRset crrset; if (rrset instanceof CacheRRset) crrset = (CacheRRset) rrset; else crrset = new CacheRRset(rrset, cred, maxcache); addElement(name, crrset); } } }
java
public synchronized void addRRset(RRset rrset, int cred) { long ttl = rrset.getTTL(); Name name = rrset.getName(); int type = rrset.getType(); Element element = findElement(name, type, 0); if (ttl == 0) { if (element != null && element.compareCredibility(cred) <= 0) removeElement(name, type); } else { if (element != null && element.compareCredibility(cred) <= 0) element = null; if (element == null) { CacheRRset crrset; if (rrset instanceof CacheRRset) crrset = (CacheRRset) rrset; else crrset = new CacheRRset(rrset, cred, maxcache); addElement(name, crrset); } } }
[ "public", "synchronized", "void", "addRRset", "(", "RRset", "rrset", ",", "int", "cred", ")", "{", "long", "ttl", "=", "rrset", ".", "getTTL", "(", ")", ";", "Name", "name", "=", "rrset", ".", "getName", "(", ")", ";", "int", "type", "=", "rrset", ...
Adds an RRset to the Cache. @param rrset The RRset to be added @param cred The credibility of these records @see RRset
[ "Adds", "an", "RRset", "to", "the", "Cache", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Cache.java#L350-L371
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/mq/kafka/Consumer.java
Consumer._startStreamingMessages
private void _startStreamingMessages(String topic, List<KafkaStream<byte[], byte[]>> streams) { ExecutorService executorService = _topics.get(topic).getStreamExecutorService(); for (final KafkaStream<byte[], byte[]> stream : streams) { executorService.submit(new KafkaConsumer(stream)); } }
java
private void _startStreamingMessages(String topic, List<KafkaStream<byte[], byte[]>> streams) { ExecutorService executorService = _topics.get(topic).getStreamExecutorService(); for (final KafkaStream<byte[], byte[]> stream : streams) { executorService.submit(new KafkaConsumer(stream)); } }
[ "private", "void", "_startStreamingMessages", "(", "String", "topic", ",", "List", "<", "KafkaStream", "<", "byte", "[", "]", ",", "byte", "[", "]", ">", ">", "streams", ")", "{", "ExecutorService", "executorService", "=", "_topics", ".", "get", "(", "topi...
Retrieves the executor service for the given topic from the map of topics and submits a KafkaConsumer task for each stream in the list of streams. @param topic The topic to start streaming messages from. @param streams The streams for those messages.
[ "Retrieves", "the", "executor", "service", "for", "the", "given", "topic", "from", "the", "map", "of", "topics", "and", "submits", "a", "KafkaConsumer", "task", "for", "each", "stream", "in", "the", "list", "of", "streams", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/mq/kafka/Consumer.java#L145-L151
cdapio/tigon
tigon-sql/src/main/java/co/cask/tigon/sql/io/GDATEncoder.java
GDATEncoder.writeLengthToStream
private void writeLengthToStream(int length, OutputStream out) throws IOException { sharedByteBuffer.clear(); sharedByteBuffer.order(ByteOrder.BIG_ENDIAN).putInt(length); sharedByteBuffer.flip(); out.write(sharedByteBuffer.array(), 0, Ints.BYTES); sharedByteBuffer.order(byteOrder); }
java
private void writeLengthToStream(int length, OutputStream out) throws IOException { sharedByteBuffer.clear(); sharedByteBuffer.order(ByteOrder.BIG_ENDIAN).putInt(length); sharedByteBuffer.flip(); out.write(sharedByteBuffer.array(), 0, Ints.BYTES); sharedByteBuffer.order(byteOrder); }
[ "private", "void", "writeLengthToStream", "(", "int", "length", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "sharedByteBuffer", ".", "clear", "(", ")", ";", "sharedByteBuffer", ".", "order", "(", "ByteOrder", ".", "BIG_ENDIAN", ")", ".", "pu...
Write Length in Big Endian Order as per GDAT format specification.
[ "Write", "Length", "in", "Big", "Endian", "Order", "as", "per", "GDAT", "format", "specification", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-sql/src/main/java/co/cask/tigon/sql/io/GDATEncoder.java#L75-L81
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.writerTo
public static BitWriter writerTo(byte[] bytes, long size) { if (bytes == null) throw new IllegalArgumentException("null bytes"); checkSize(size, ((long) bytes.length) << 3); return new ByteArrayBitWriter(bytes, size); }
java
public static BitWriter writerTo(byte[] bytes, long size) { if (bytes == null) throw new IllegalArgumentException("null bytes"); checkSize(size, ((long) bytes.length) << 3); return new ByteArrayBitWriter(bytes, size); }
[ "public", "static", "BitWriter", "writerTo", "(", "byte", "[", "]", "bytes", ",", "long", "size", ")", "{", "if", "(", "bytes", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null bytes\"", ")", ";", "checkSize", "(", "size", ",", ...
A {@link BitWriter} that writes its bits to an array of bytes. Bits are written to the byte array starting at index zero. Within each byte, the most significant bits is written to first. @param bytes the array of bytes @param size the number of bits that may be written, not negative and no greater than the number of bits supplied by the array @return a writer that writes bits to the supplied array
[ "A", "{", "@link", "BitWriter", "}", "that", "writes", "its", "bits", "to", "an", "array", "of", "bytes", ".", "Bits", "are", "written", "to", "the", "byte", "array", "starting", "at", "index", "zero", ".", "Within", "each", "byte", "the", "most", "sig...
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L843-L847
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/TypeSystem.java
TypeSystem.withOppositeComparator
public static <T> TypeFactory<T> withOppositeComparator( final TypeFactory<T> original ) { final Comparator<T> comparator = original.getComparator(); final Comparator<T> inverted = new SerializableComparator<T>() { private static final long serialVersionUID = 1L; @Override public int compare( T arg0, T arg1 ) { return comparator.compare(arg1, arg0); } }; return withComparator(original, inverted); }
java
public static <T> TypeFactory<T> withOppositeComparator( final TypeFactory<T> original ) { final Comparator<T> comparator = original.getComparator(); final Comparator<T> inverted = new SerializableComparator<T>() { private static final long serialVersionUID = 1L; @Override public int compare( T arg0, T arg1 ) { return comparator.compare(arg1, arg0); } }; return withComparator(original, inverted); }
[ "public", "static", "<", "T", ">", "TypeFactory", "<", "T", ">", "withOppositeComparator", "(", "final", "TypeFactory", "<", "T", ">", "original", ")", "{", "final", "Comparator", "<", "T", ">", "comparator", "=", "original", ".", "getComparator", "(", ")"...
Return a new type factory that has a comparator that inverts the normal comparison. @param original the original type factory; may not be null @return the new type factory; never null
[ "Return", "a", "new", "type", "factory", "that", "has", "a", "comparator", "that", "inverts", "the", "normal", "comparison", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/TypeSystem.java#L319-L331
datacleaner/AnalyzerBeans
components/pattern-finder/src/main/java/org/eobjects/analyzer/beans/stringpattern/TokenizerConfiguration.java
TokenizerConfiguration.setDistriminateTokenLength
public void setDistriminateTokenLength(TokenType tokenType, boolean discriminateTokenLength) { _discriminateTokenLength.put(tokenType, Boolean.valueOf(discriminateTokenLength)); }
java
public void setDistriminateTokenLength(TokenType tokenType, boolean discriminateTokenLength) { _discriminateTokenLength.put(tokenType, Boolean.valueOf(discriminateTokenLength)); }
[ "public", "void", "setDistriminateTokenLength", "(", "TokenType", "tokenType", ",", "boolean", "discriminateTokenLength", ")", "{", "_discriminateTokenLength", ".", "put", "(", "tokenType", ",", "Boolean", ".", "valueOf", "(", "discriminateTokenLength", ")", ")", ";",...
Sets which tokens should be discriminated (when matching) based on length. For example, if "hello" and "hi" should be matched, then length discrimination should be false. If only "hello" and "world", but not "hi" should be matched then length discrimination should be true.
[ "Sets", "which", "tokens", "should", "be", "discriminated", "(", "when", "matching", ")", "based", "on", "length", ".", "For", "example", "if", "hello", "and", "hi", "should", "be", "matched", "then", "length", "discrimination", "should", "be", "false", ".",...
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/components/pattern-finder/src/main/java/org/eobjects/analyzer/beans/stringpattern/TokenizerConfiguration.java#L140-L142
aws/aws-sdk-java
aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateFleetResult.java
CreateFleetResult.withTags
public CreateFleetResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateFleetResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateFleetResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The list of all tags added to the fleet. </p> @param tags The list of all tags added to the fleet. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "list", "of", "all", "tags", "added", "to", "the", "fleet", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateFleetResult.java#L206-L209
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion7.java
CmsImportVersion7.addResourceRelationRules
protected void addResourceRelationRules(Digester digester, String xpath) { String xp_rels = xpath + N_RELATIONS + "/" + N_RELATION; digester.addCallMethod(xp_rels, "addRelation"); digester.addCallMethod(xp_rels + "/" + N_ID, "setRelationId", 0); digester.addCallMethod(xp_rels + "/" + N_PATH, "setRelationPath", 0); digester.addCallMethod(xp_rels + "/" + N_TYPE, "setRelationType", 0); }
java
protected void addResourceRelationRules(Digester digester, String xpath) { String xp_rels = xpath + N_RELATIONS + "/" + N_RELATION; digester.addCallMethod(xp_rels, "addRelation"); digester.addCallMethod(xp_rels + "/" + N_ID, "setRelationId", 0); digester.addCallMethod(xp_rels + "/" + N_PATH, "setRelationPath", 0); digester.addCallMethod(xp_rels + "/" + N_TYPE, "setRelationType", 0); }
[ "protected", "void", "addResourceRelationRules", "(", "Digester", "digester", ",", "String", "xpath", ")", "{", "String", "xp_rels", "=", "xpath", "+", "N_RELATIONS", "+", "\"/\"", "+", "N_RELATION", ";", "digester", ".", "addCallMethod", "(", "xp_rels", ",", ...
Adds the XML digester rules for resource relations.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules
[ "Adds", "the", "XML", "digester", "rules", "for", "resource", "relations", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion7.java#L3112-L3119
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GroupApi.java
GroupApi.addGroup
public Group addGroup(String name, String path) throws GitLabApiException { Form formData = new Form(); formData.param("name", name); formData.param("path", path); Response response = post(Response.Status.CREATED, formData, "groups"); return (response.readEntity(Group.class)); }
java
public Group addGroup(String name, String path) throws GitLabApiException { Form formData = new Form(); formData.param("name", name); formData.param("path", path); Response response = post(Response.Status.CREATED, formData, "groups"); return (response.readEntity(Group.class)); }
[ "public", "Group", "addGroup", "(", "String", "name", ",", "String", "path", ")", "throws", "GitLabApiException", "{", "Form", "formData", "=", "new", "Form", "(", ")", ";", "formData", ".", "param", "(", "\"name\"", ",", "name", ")", ";", "formData", "....
Creates a new project group. Available only for users who can create groups. <pre><code>GitLab Endpoint: POST /groups</code></pre> @param name the name of the group to add @param path the path for the group @return the created Group instance @throws GitLabApiException if any exception occurs
[ "Creates", "a", "new", "project", "group", ".", "Available", "only", "for", "users", "who", "can", "create", "groups", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L468-L475
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.Bhattacharyya
public static double Bhattacharyya(double[] histogram1, double[] histogram2) { int bins = histogram1.length; // histogram bins double b = 0; // Bhattacharyya's coefficient for (int i = 0; i < bins; i++) b += Math.sqrt(histogram1[i]) * Math.sqrt(histogram2[i]); // Bhattacharyya distance between the two distributions return Math.sqrt(1.0 - b); }
java
public static double Bhattacharyya(double[] histogram1, double[] histogram2) { int bins = histogram1.length; // histogram bins double b = 0; // Bhattacharyya's coefficient for (int i = 0; i < bins; i++) b += Math.sqrt(histogram1[i]) * Math.sqrt(histogram2[i]); // Bhattacharyya distance between the two distributions return Math.sqrt(1.0 - b); }
[ "public", "static", "double", "Bhattacharyya", "(", "double", "[", "]", "histogram1", ",", "double", "[", "]", "histogram2", ")", "{", "int", "bins", "=", "histogram1", ".", "length", ";", "// histogram bins", "double", "b", "=", "0", ";", "// Bhattacharyya'...
Bhattacharyya distance between two normalized histograms. @param histogram1 Normalized histogram. @param histogram2 Normalized histogram. @return The Bhattacharyya distance between the two histograms.
[ "Bhattacharyya", "distance", "between", "two", "normalized", "histograms", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L68-L77
jroyalty/jglm
src/main/java/com/hackoeur/jglm/support/FastMathCalc.java
FastMathCalc.splitAdd
private static void splitAdd(final double a[], final double b[], final double ans[]) { ans[0] = a[0] + b[0]; ans[1] = a[1] + b[1]; resplit(ans); }
java
private static void splitAdd(final double a[], final double b[], final double ans[]) { ans[0] = a[0] + b[0]; ans[1] = a[1] + b[1]; resplit(ans); }
[ "private", "static", "void", "splitAdd", "(", "final", "double", "a", "[", "]", ",", "final", "double", "b", "[", "]", ",", "final", "double", "ans", "[", "]", ")", "{", "ans", "[", "0", "]", "=", "a", "[", "0", "]", "+", "b", "[", "0", "]", ...
Add two numbers in split form. @param a first term of addition @param b second term of addition @param ans placeholder where to put the result
[ "Add", "two", "numbers", "in", "split", "form", "." ]
train
https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L376-L381
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java
MessagingSecurityUtility.createAuthenticationData
public static AuthenticationData createAuthenticationData(String userName, UserRegistry userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", userName); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) { userName = ""; } String realm = getDefaultRealm(userRegistry); authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.REALM, realm); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
java
public static AuthenticationData createAuthenticationData(String userName, UserRegistry userRegistry) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", userName); } AuthenticationData authData = new WSAuthenticationData(); if (userName == null) { userName = ""; } String realm = getDefaultRealm(userRegistry); authData.set(AuthenticationData.USERNAME, userName); authData.set(AuthenticationData.REALM, realm); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData); } return authData; }
[ "public", "static", "AuthenticationData", "createAuthenticationData", "(", "String", "userName", ",", "UserRegistry", "userRegistry", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{"...
Create the AuthenticationData from the UserName @param userName @return
[ "Create", "the", "AuthenticationData", "from", "the", "UserName" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/utility/MessagingSecurityUtility.java#L64-L79
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java
RDBMEntityLockStore.deleteExpired
public void deleteExpired(Date expiration, Class entityType, String entityKey) throws LockingException { Connection conn = null; try { conn = RDBMServices.getConnection(); primDeleteExpired(expiration, entityType, entityKey, conn); } catch (SQLException sqle) { throw new LockingException("Problem deleting expired locks", sqle); } finally { RDBMServices.releaseConnection(conn); } }
java
public void deleteExpired(Date expiration, Class entityType, String entityKey) throws LockingException { Connection conn = null; try { conn = RDBMServices.getConnection(); primDeleteExpired(expiration, entityType, entityKey, conn); } catch (SQLException sqle) { throw new LockingException("Problem deleting expired locks", sqle); } finally { RDBMServices.releaseConnection(conn); } }
[ "public", "void", "deleteExpired", "(", "Date", "expiration", ",", "Class", "entityType", ",", "String", "entityKey", ")", "throws", "LockingException", "{", "Connection", "conn", "=", "null", ";", "try", "{", "conn", "=", "RDBMServices", ".", "getConnection", ...
Delete IEntityLocks from the underlying store that have expired as of <code>expiration</code> . Params <code>entityType</code> and <code>entityKey</code> are optional. @param expiration java.util.Date @param entityType Class @param entityKey String
[ "Delete", "IEntityLocks", "from", "the", "underlying", "store", "that", "have", "expired", "as", "of", "<code", ">", "expiration<", "/", "code", ">", ".", "Params", "<code", ">", "entityType<", "/", "code", ">", "and", "<code", ">", "entityKey<", "/", "cod...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java#L151-L162
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listWorkerPoolInstanceMetricsWithServiceResponseAsync
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listWorkerPoolInstanceMetricsWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance, final Boolean details, final String filter) { return listWorkerPoolInstanceMetricsSinglePageAsync(resourceGroupName, name, workerPoolName, instance, details, filter) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWorkerPoolInstanceMetricsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listWorkerPoolInstanceMetricsWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance, final Boolean details, final String filter) { return listWorkerPoolInstanceMetricsSinglePageAsync(resourceGroupName, name, workerPoolName, instance, details, filter) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWorkerPoolInstanceMetricsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricInner", ">", ">", ">", "listWorkerPoolInstanceMetricsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "workerP...
Get metrics for a specific instance of a worker pool of an App Service Environment. Get metrics for a specific instance of a worker pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @param instance Name of the instance in the worker pool. @param details Specify &lt;code&gt;true&lt;/code&gt; to include instance details. The default is &lt;code&gt;false&lt;/code&gt;. @param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object
[ "Get", "metrics", "for", "a", "specific", "instance", "of", "a", "worker", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "metrics", "for", "a", "specific", "instance", "of", "a", "worker", "pool", "of", "an", "App", "Service", "Environme...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5853-L5865
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkInterfaceTapConfigurationsInner.java
NetworkInterfaceTapConfigurationsInner.beginCreateOrUpdate
public NetworkInterfaceTapConfigurationInner beginCreateOrUpdate(String resourceGroupName, String networkInterfaceName, String tapConfigurationName, NetworkInterfaceTapConfigurationInner tapConfigurationParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters).toBlocking().single().body(); }
java
public NetworkInterfaceTapConfigurationInner beginCreateOrUpdate(String resourceGroupName, String networkInterfaceName, String tapConfigurationName, NetworkInterfaceTapConfigurationInner tapConfigurationParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters).toBlocking().single().body(); }
[ "public", "NetworkInterfaceTapConfigurationInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ",", "String", "tapConfigurationName", ",", "NetworkInterfaceTapConfigurationInner", "tapConfigurationParameters", ")", "{", "return"...
Creates or updates a Tap configuration in the specified NetworkInterface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @param tapConfigurationName The name of the tap configuration. @param tapConfigurationParameters Parameters supplied to the create or update tap configuration operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the NetworkInterfaceTapConfigurationInner object if successful.
[ "Creates", "or", "updates", "a", "Tap", "configuration", "in", "the", "specified", "NetworkInterface", "." ]
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/NetworkInterfaceTapConfigurationsInner.java#L444-L446
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/OrientedRectangle2dfx.java
OrientedRectangle2dfx.secondAxisProperty
@Pure public ReadOnlyUnitVectorProperty secondAxisProperty() { if (this.saxis == null) { this.saxis = new ReadOnlyUnitVectorWrapper(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory()); this.saxis.bind(Bindings.createObjectBinding(() -> { final Vector2dfx firstAxis = firstAxisProperty().get(); return firstAxis.toOrthogonalVector(); }, firstAxisProperty())); } return this.saxis.getReadOnlyProperty(); }
java
@Pure public ReadOnlyUnitVectorProperty secondAxisProperty() { if (this.saxis == null) { this.saxis = new ReadOnlyUnitVectorWrapper(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory()); this.saxis.bind(Bindings.createObjectBinding(() -> { final Vector2dfx firstAxis = firstAxisProperty().get(); return firstAxis.toOrthogonalVector(); }, firstAxisProperty())); } return this.saxis.getReadOnlyProperty(); }
[ "@", "Pure", "public", "ReadOnlyUnitVectorProperty", "secondAxisProperty", "(", ")", "{", "if", "(", "this", ".", "saxis", "==", "null", ")", "{", "this", ".", "saxis", "=", "new", "ReadOnlyUnitVectorWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "SE...
Replies the property for the second rectangle axis. @return the secondAxis property.
[ "Replies", "the", "property", "for", "the", "second", "rectangle", "axis", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/OrientedRectangle2dfx.java#L283-L294
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/gdbscan/COPACNeighborPredicate.java
COPACNeighborPredicate.computeLocalModel
protected COPACModel computeLocalModel(DBIDRef id, DoubleDBIDList knnneighbors, Relation<V> relation) { PCAResult epairs = settings.pca.processIds(knnneighbors, relation); int pdim = settings.filter.filter(epairs.getEigenvalues()); PCAFilteredResult pcares = new PCAFilteredResult(epairs.getEigenPairs(), pdim, 1., 0.); double[][] mat = pcares.similarityMatrix(); double[] vecP = relation.get(id).toArray(); if(pdim == vecP.length) { // Full dimensional - noise! return new COPACModel(pdim, DBIDUtil.EMPTYDBIDS); } // Check which neighbors survive HashSetModifiableDBIDs survivors = DBIDUtil.newHashSet(); for(DBIDIter neighbor = relation.iterDBIDs(); neighbor.valid(); neighbor.advance()) { double[] diff = minusEquals(relation.get(neighbor).toArray(), vecP); double cdistP = transposeTimesTimes(diff, mat, diff); if(cdistP <= epsilonsq) { survivors.add(neighbor); } } return new COPACModel(pdim, survivors); }
java
protected COPACModel computeLocalModel(DBIDRef id, DoubleDBIDList knnneighbors, Relation<V> relation) { PCAResult epairs = settings.pca.processIds(knnneighbors, relation); int pdim = settings.filter.filter(epairs.getEigenvalues()); PCAFilteredResult pcares = new PCAFilteredResult(epairs.getEigenPairs(), pdim, 1., 0.); double[][] mat = pcares.similarityMatrix(); double[] vecP = relation.get(id).toArray(); if(pdim == vecP.length) { // Full dimensional - noise! return new COPACModel(pdim, DBIDUtil.EMPTYDBIDS); } // Check which neighbors survive HashSetModifiableDBIDs survivors = DBIDUtil.newHashSet(); for(DBIDIter neighbor = relation.iterDBIDs(); neighbor.valid(); neighbor.advance()) { double[] diff = minusEquals(relation.get(neighbor).toArray(), vecP); double cdistP = transposeTimesTimes(diff, mat, diff); if(cdistP <= epsilonsq) { survivors.add(neighbor); } } return new COPACModel(pdim, survivors); }
[ "protected", "COPACModel", "computeLocalModel", "(", "DBIDRef", "id", ",", "DoubleDBIDList", "knnneighbors", ",", "Relation", "<", "V", ">", "relation", ")", "{", "PCAResult", "epairs", "=", "settings", ".", "pca", ".", "processIds", "(", "knnneighbors", ",", ...
COPAC model computation @param id Query object @param knnneighbors k nearest neighbors @param relation Data relation @return COPAC object model
[ "COPAC", "model", "computation" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/gdbscan/COPACNeighborPredicate.java#L141-L163
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ItemStream.java
ItemStream.addReferenceStream
public void addReferenceStream(final ReferenceStream referenceStream, final Transaction transaction) throws ProtocolException, OutOfCacheSpace, StreamIsFull, TransactionException, PersistenceException, SevereMessageStoreException { addReferenceStream(referenceStream, NO_LOCK_ID, transaction); }
java
public void addReferenceStream(final ReferenceStream referenceStream, final Transaction transaction) throws ProtocolException, OutOfCacheSpace, StreamIsFull, TransactionException, PersistenceException, SevereMessageStoreException { addReferenceStream(referenceStream, NO_LOCK_ID, transaction); }
[ "public", "void", "addReferenceStream", "(", "final", "ReferenceStream", "referenceStream", ",", "final", "Transaction", "transaction", ")", "throws", "ProtocolException", ",", "OutOfCacheSpace", ",", "StreamIsFull", ",", "TransactionException", ",", "PersistenceException",...
Add an {@link ReferenceStream} to an item stream under a transaction. A ReferenceStream can only be added onto one stream at a time. . <p>This method can be overridden by subclass implementors in order to customize the behaviour of the stream. Any override should call the superclass implementation to maintain correct behaviour.</p> @param referenceStream @param transaction @throws SevereMessageStoreException @throws {@link OutOfCacheSpace} if there is not enough space in the unstoredCache and the storage strategy is {@link AbstractItem#STORE_NEVER}. @throws {@link StreamIsFull} if the size of the stream would exceed the maximum permissable size if an add were performed. @throws {@ProtocolException} Thrown if an add is attempted when the transaction cannot allow any further work to be added i.e. after completion of the transaction. @throws {@TransactionException} Thrown if an unexpected error occurs. @throws {@PersistenceException} Thrown if a database error occurs.
[ "Add", "an", "{", "@link", "ReferenceStream", "}", "to", "an", "item", "stream", "under", "a", "transaction", ".", "A", "ReferenceStream", "can", "only", "be", "added", "onto", "one", "stream", "at", "a", "time", ".", ".", "<p", ">", "This", "method", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/msgstore/ItemStream.java#L300-L304
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getCurrentGameBuild
public GameBuild getCurrentGameBuild() throws GuildWars2Exception { try { Response<GameBuild> response = gw2API.getCurrentGameBuild().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public GameBuild getCurrentGameBuild() throws GuildWars2Exception { try { Response<GameBuild> response = gw2API.getCurrentGameBuild().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "GameBuild", "getCurrentGameBuild", "(", ")", "throws", "GuildWars2Exception", "{", "try", "{", "Response", "<", "GameBuild", ">", "response", "=", "gw2API", ".", "getCurrentGameBuild", "(", ")", ".", "execute", "(", ")", ";", "if", "(", "!", "resp...
For more info on build API go <a href="https://wiki.guildwars2.com/wiki/API:2/build">here</a><br/> get current game bild @return current game build @throws GuildWars2Exception see {@link ErrorCode} for detail @see GameBuild game build info
[ "For", "more", "info", "on", "build", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "build", ">", "here<", "/", "a", ">", "<br", "/", ">", "get", "current", "g...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L838-L846
apache/incubator-shardingsphere
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/result/insert/InsertOptimizeResult.java
InsertOptimizeResult.addUnit
public void addUnit(final SQLExpression[] columnValues, final Object[] columnParameters) { if (type == InsertType.VALUES) { this.units.add(new ColumnValueOptimizeResult(columnNames, columnValues, columnParameters)); } else { this.units.add(new SetAssignmentOptimizeResult(columnNames, columnValues, columnParameters)); } }
java
public void addUnit(final SQLExpression[] columnValues, final Object[] columnParameters) { if (type == InsertType.VALUES) { this.units.add(new ColumnValueOptimizeResult(columnNames, columnValues, columnParameters)); } else { this.units.add(new SetAssignmentOptimizeResult(columnNames, columnValues, columnParameters)); } }
[ "public", "void", "addUnit", "(", "final", "SQLExpression", "[", "]", "columnValues", ",", "final", "Object", "[", "]", "columnParameters", ")", "{", "if", "(", "type", "==", "InsertType", ".", "VALUES", ")", "{", "this", ".", "units", ".", "add", "(", ...
Add insert optimize result uint. @param columnValues column values @param columnParameters column parameters
[ "Add", "insert", "optimize", "result", "uint", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/result/insert/InsertOptimizeResult.java#L53-L59
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/StatementManager.java
StatementManager.bindStatement
private int bindStatement(PreparedStatement stmt, int index, SelectionCriteria crit, ClassDescriptor cld) throws SQLException { return bindStatementValue(stmt, index, crit.getAttribute(), crit.getValue(), cld); }
java
private int bindStatement(PreparedStatement stmt, int index, SelectionCriteria crit, ClassDescriptor cld) throws SQLException { return bindStatementValue(stmt, index, crit.getAttribute(), crit.getValue(), cld); }
[ "private", "int", "bindStatement", "(", "PreparedStatement", "stmt", ",", "int", "index", ",", "SelectionCriteria", "crit", ",", "ClassDescriptor", "cld", ")", "throws", "SQLException", "{", "return", "bindStatementValue", "(", "stmt", ",", "index", ",", "crit", ...
bind SelectionCriteria @param stmt the PreparedStatement @param index the position of the parameter to bind @param crit the Criteria containing the parameter @param cld the ClassDescriptor @return next index for PreparedStatement
[ "bind", "SelectionCriteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L246-L249
deeplearning4j/deeplearning4j
rl4j/rl4j-malmo/src/main/java/org/deeplearning4j/malmo/MalmoEnv.java
MalmoEnv.loadMissionXML
public static MissionSpec loadMissionXML(String filename) { MissionSpec mission = null; try { String xml = new String(Files.readAllBytes(Paths.get(filename))); mission = new MissionSpec(xml, true); } catch (Exception e) { //e.printStackTrace(); throw new RuntimeException( e ); } return mission; }
java
public static MissionSpec loadMissionXML(String filename) { MissionSpec mission = null; try { String xml = new String(Files.readAllBytes(Paths.get(filename))); mission = new MissionSpec(xml, true); } catch (Exception e) { //e.printStackTrace(); throw new RuntimeException( e ); } return mission; }
[ "public", "static", "MissionSpec", "loadMissionXML", "(", "String", "filename", ")", "{", "MissionSpec", "mission", "=", "null", ";", "try", "{", "String", "xml", "=", "new", "String", "(", "Files", ".", "readAllBytes", "(", "Paths", ".", "get", "(", "file...
Convenience method to load a Malmo mission specification from an XML-file @param filename name of XML file @return Mission specification loaded from XML-file
[ "Convenience", "method", "to", "load", "a", "Malmo", "mission", "specification", "from", "an", "XML", "-", "file" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/rl4j/rl4j-malmo/src/main/java/org/deeplearning4j/malmo/MalmoEnv.java#L140-L151
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
FieldDescriptorConstraints.checkReadonlyAccessForNativePKs
private void checkReadonlyAccessForNativePKs(FieldDescriptorDef fieldDef, String checkLevel) { if (CHECKLEVEL_NONE.equals(checkLevel)) { return; } String access = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS); String autoInc = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_AUTOINCREMENT); if ("database".equals(autoInc) && !"readonly".equals(access)) { LogHelper.warn(true, FieldDescriptorConstraints.class, "checkAccess", "The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" is set to database auto-increment. Therefore the field's access is set to 'readonly'."); fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_ACCESS, "readonly"); } }
java
private void checkReadonlyAccessForNativePKs(FieldDescriptorDef fieldDef, String checkLevel) { if (CHECKLEVEL_NONE.equals(checkLevel)) { return; } String access = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS); String autoInc = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_AUTOINCREMENT); if ("database".equals(autoInc) && !"readonly".equals(access)) { LogHelper.warn(true, FieldDescriptorConstraints.class, "checkAccess", "The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" is set to database auto-increment. Therefore the field's access is set to 'readonly'."); fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_ACCESS, "readonly"); } }
[ "private", "void", "checkReadonlyAccessForNativePKs", "(", "FieldDescriptorDef", "fieldDef", ",", "String", "checkLevel", ")", "{", "if", "(", "CHECKLEVEL_NONE", ".", "equals", "(", "checkLevel", ")", ")", "{", "return", ";", "}", "String", "access", "=", "field...
Checks that native primarykey fields have readonly access, and warns if not. @param fieldDef The field descriptor @param checkLevel The current check level (this constraint is checked in basic and strict)
[ "Checks", "that", "native", "primarykey", "fields", "have", "readonly", "access", "and", "warns", "if", "not", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java#L393-L411
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/products/Swaption.java
Swaption.getValue
public double getValue(ForwardCurveInterface forwardCurve, double swaprateVolatility) { double swaprate = swaprates[0]; for (double swaprate1 : swaprates) { if (swaprate1 != swaprate) { throw new RuntimeException("Uneven swaprates not allows for analytical pricing."); } } double[] swapTenor = new double[fixingDates.length+1]; System.arraycopy(fixingDates, 0, swapTenor, 0, fixingDates.length); swapTenor[swapTenor.length-1] = paymentDates[paymentDates.length-1]; double forwardSwapRate = Swap.getForwardSwapRate(new TimeDiscretization(swapTenor), new TimeDiscretization(swapTenor), forwardCurve); double swapAnnuity = SwapAnnuity.getSwapAnnuity(new TimeDiscretization(swapTenor), forwardCurve); return AnalyticFormulas.blackModelSwaptionValue(forwardSwapRate, swaprateVolatility, exerciseDate, swaprate, swapAnnuity); }
java
public double getValue(ForwardCurveInterface forwardCurve, double swaprateVolatility) { double swaprate = swaprates[0]; for (double swaprate1 : swaprates) { if (swaprate1 != swaprate) { throw new RuntimeException("Uneven swaprates not allows for analytical pricing."); } } double[] swapTenor = new double[fixingDates.length+1]; System.arraycopy(fixingDates, 0, swapTenor, 0, fixingDates.length); swapTenor[swapTenor.length-1] = paymentDates[paymentDates.length-1]; double forwardSwapRate = Swap.getForwardSwapRate(new TimeDiscretization(swapTenor), new TimeDiscretization(swapTenor), forwardCurve); double swapAnnuity = SwapAnnuity.getSwapAnnuity(new TimeDiscretization(swapTenor), forwardCurve); return AnalyticFormulas.blackModelSwaptionValue(forwardSwapRate, swaprateVolatility, exerciseDate, swaprate, swapAnnuity); }
[ "public", "double", "getValue", "(", "ForwardCurveInterface", "forwardCurve", ",", "double", "swaprateVolatility", ")", "{", "double", "swaprate", "=", "swaprates", "[", "0", "]", ";", "for", "(", "double", "swaprate1", ":", "swaprates", ")", "{", "if", "(", ...
This method returns the value of the product using a Black-Scholes model for the swap rate The model is determined by a discount factor curve and a swap rate volatility. @param forwardCurve The forward curve on which to value the swap. @param swaprateVolatility The Black volatility. @return Value of this product
[ "This", "method", "returns", "the", "value", "of", "the", "product", "using", "a", "Black", "-", "Scholes", "model", "for", "the", "swap", "rate", "The", "model", "is", "determined", "by", "a", "discount", "factor", "curve", "and", "a", "swap", "rate", "...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/products/Swaption.java#L189-L205
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java
ClassUtils.isAProperty
public static boolean isAProperty(Class theClass, String propertyName) { if (theClass == null) throw new IllegalArgumentException("theClass == null"); if (propertyName == null) throw new IllegalArgumentException("propertyName == null"); if (getReadMethod(theClass, propertyName) != null) return true; if (getWriteMethod(theClass, propertyName) != null) return true; return false; }
java
public static boolean isAProperty(Class theClass, String propertyName) { if (theClass == null) throw new IllegalArgumentException("theClass == null"); if (propertyName == null) throw new IllegalArgumentException("propertyName == null"); if (getReadMethod(theClass, propertyName) != null) return true; if (getWriteMethod(theClass, propertyName) != null) return true; return false; }
[ "public", "static", "boolean", "isAProperty", "(", "Class", "theClass", ",", "String", "propertyName", ")", "{", "if", "(", "theClass", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"theClass == null\"", ")", ";", "if", "(", "propertyName...
Is the given name a property in the class? In other words, does it have a setter and/or a getter method? @param theClass the class to look for the property in @param propertyName the name of the property @return true if there is either a setter or a getter for the property @throws IllegalArgumentException if either argument is null
[ "Is", "the", "given", "name", "a", "property", "in", "the", "class?", "In", "other", "words", "does", "it", "have", "a", "setter", "and", "/", "or", "a", "getter", "method?" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java#L343-L354
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.zipDir
public static void zipDir(final File srcDir, final FileFilter filter, final String destPath, final File destFile) throws IOException { Utils4J.checkNotNull("srcDir", srcDir); Utils4J.checkValidDir(srcDir); Utils4J.checkNotNull("destFile", destFile); try (final ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destFile)))) { zipDir(srcDir, filter, destPath, out); } }
java
public static void zipDir(final File srcDir, final FileFilter filter, final String destPath, final File destFile) throws IOException { Utils4J.checkNotNull("srcDir", srcDir); Utils4J.checkValidDir(srcDir); Utils4J.checkNotNull("destFile", destFile); try (final ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destFile)))) { zipDir(srcDir, filter, destPath, out); } }
[ "public", "static", "void", "zipDir", "(", "final", "File", "srcDir", ",", "final", "FileFilter", "filter", ",", "final", "String", "destPath", ",", "final", "File", "destFile", ")", "throws", "IOException", "{", "Utils4J", ".", "checkNotNull", "(", "\"srcDir\...
Creates a ZIP file and adds all files in a directory and all it's sub directories to the archive. Only entries are added that comply to the file filter. @param srcDir Directory to add - Cannot be <code>null</code> and must be a valid directory. @param filter Filter or <code>null</code> for all files/directories. @param destPath Path to use for the ZIP archive - May be <code>null</code> or an empyt string. @param destFile Target ZIP file - Cannot be <code>null</code>. @throws IOException Error writing to the output stream.
[ "Creates", "a", "ZIP", "file", "and", "adds", "all", "files", "in", "a", "directory", "and", "all", "it", "s", "sub", "directories", "to", "the", "archive", ".", "Only", "entries", "are", "added", "that", "comply", "to", "the", "file", "filter", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1379-L1389
kaazing/gateway
service/spi/src/main/java/org/kaazing/gateway/service/util/ServiceUtils.java
ServiceUtils.getOptionalDataSizeProperty
public static int getOptionalDataSizeProperty(ServiceProperties properties, String propertyName, int defaultValue) { String value = getOptionalProperty(properties, propertyName, Integer.toString(defaultValue)); return Utils.parseDataSize(value); }
java
public static int getOptionalDataSizeProperty(ServiceProperties properties, String propertyName, int defaultValue) { String value = getOptionalProperty(properties, propertyName, Integer.toString(defaultValue)); return Utils.parseDataSize(value); }
[ "public", "static", "int", "getOptionalDataSizeProperty", "(", "ServiceProperties", "properties", ",", "String", "propertyName", ",", "int", "defaultValue", ")", "{", "String", "value", "=", "getOptionalProperty", "(", "properties", ",", "propertyName", ",", "Integer"...
Get a property which is a number of bytes expressed either as an integer (number of bytes) or an integer followed by K (number of kilobytes) or an integer followed by M (for megabytes). Examples: 1048, 64k, 10M
[ "Get", "a", "property", "which", "is", "a", "number", "of", "bytes", "expressed", "either", "as", "an", "integer", "(", "number", "of", "bytes", ")", "or", "an", "integer", "followed", "by", "K", "(", "number", "of", "kilobytes", ")", "or", "an", "inte...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/spi/src/main/java/org/kaazing/gateway/service/util/ServiceUtils.java#L65-L68
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/domainquery/QueryLoader.java
QueryLoader.loadMemento
public QueryMemento loadMemento() { IDBAccess dbAccess = ((IIntDomainAccess)this.domainAccess).getInternalDomainAccess().getDBAccess(); String qLabel = ((IIntDomainAccess)this.domainAccess).getInternalDomainAccess().getDomainLabel() .concat(QueryPersistor.Q_LABEL_POSTFIX); JcNode n = new JcNode("n"); IClause[] clauses = new IClause[] { MATCH.node(n).label(qLabel).property(QueryPersistor.PROP_NAME).value(queryName), RETURN.value(n) }; JcQuery q = new JcQuery(); q.setClauses(clauses); JcQueryResult result = dbAccess.execute(q); if (result.hasErrors()) { StringBuilder sb = new StringBuilder(); Util.appendErrorList(Util.collectErrors(result), sb); throw new RuntimeException(sb.toString()); } List<GrNode> lgn = result.resultOf(n); if (lgn.size() > 0) { GrNode gn = lgn.get(0); String qJava = gn.getProperty(QueryPersistor.PROP_Q_JAVA).getValue().toString(); String qJSON = gn.getProperty(QueryPersistor.PROP_Q_JSON).getValue().toString(); QueryMemento qm = new QueryMemento(qJava, qJSON); return qm; } return null; }
java
public QueryMemento loadMemento() { IDBAccess dbAccess = ((IIntDomainAccess)this.domainAccess).getInternalDomainAccess().getDBAccess(); String qLabel = ((IIntDomainAccess)this.domainAccess).getInternalDomainAccess().getDomainLabel() .concat(QueryPersistor.Q_LABEL_POSTFIX); JcNode n = new JcNode("n"); IClause[] clauses = new IClause[] { MATCH.node(n).label(qLabel).property(QueryPersistor.PROP_NAME).value(queryName), RETURN.value(n) }; JcQuery q = new JcQuery(); q.setClauses(clauses); JcQueryResult result = dbAccess.execute(q); if (result.hasErrors()) { StringBuilder sb = new StringBuilder(); Util.appendErrorList(Util.collectErrors(result), sb); throw new RuntimeException(sb.toString()); } List<GrNode> lgn = result.resultOf(n); if (lgn.size() > 0) { GrNode gn = lgn.get(0); String qJava = gn.getProperty(QueryPersistor.PROP_Q_JAVA).getValue().toString(); String qJSON = gn.getProperty(QueryPersistor.PROP_Q_JSON).getValue().toString(); QueryMemento qm = new QueryMemento(qJava, qJSON); return qm; } return null; }
[ "public", "QueryMemento", "loadMemento", "(", ")", "{", "IDBAccess", "dbAccess", "=", "(", "(", "IIntDomainAccess", ")", "this", ".", "domainAccess", ")", ".", "getInternalDomainAccess", "(", ")", ".", "getDBAccess", "(", ")", ";", "String", "qLabel", "=", "...
The memento contains a JSON representation of the query as well as a Java-DSL like string representation. @return
[ "The", "memento", "contains", "a", "JSON", "representation", "of", "the", "query", "as", "well", "as", "a", "Java", "-", "DSL", "like", "string", "representation", "." ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domainquery/QueryLoader.java#L79-L106
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java
Utils.qualifiedNameEquals
public static boolean qualifiedNameEquals(String s1, String s2) { if (isNullOrEmpty(s1)) { return isNullOrEmpty(s2); } if (!s1.equals(s2)) { final String simple1 = simpleName(s1); final String simple2 = simpleName(s2); return simpleNameEquals(simple1, simple2); } return true; }
java
public static boolean qualifiedNameEquals(String s1, String s2) { if (isNullOrEmpty(s1)) { return isNullOrEmpty(s2); } if (!s1.equals(s2)) { final String simple1 = simpleName(s1); final String simple2 = simpleName(s2); return simpleNameEquals(simple1, simple2); } return true; }
[ "public", "static", "boolean", "qualifiedNameEquals", "(", "String", "s1", ",", "String", "s2", ")", "{", "if", "(", "isNullOrEmpty", "(", "s1", ")", ")", "{", "return", "isNullOrEmpty", "(", "s2", ")", ";", "}", "if", "(", "!", "s1", ".", "equals", ...
Replies if the given qualified names are equal. <p>Because the Javadoc tool cannot create the fully qualified name, this function also test simple names. @param s1 the first string. @param s2 the first string. @return {@code true} if the strings are equal.
[ "Replies", "if", "the", "given", "qualified", "names", "are", "equal", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L344-L354
contentful/contentful.java
src/main/java/com/contentful/java/cda/rich/RichTextFactory.java
RichTextFactory.resolveRichTextField
public static void resolveRichTextField(ArrayResource array, CDAClient client) { for (CDAEntry entry : array.entries().values()) { ensureContentType(entry, client); for (CDAField field : entry.contentType().fields()) { if ("RichText".equals(field.type())) { resolveRichDocument(entry, field); resolveRichLink(array, entry, field); } } } }
java
public static void resolveRichTextField(ArrayResource array, CDAClient client) { for (CDAEntry entry : array.entries().values()) { ensureContentType(entry, client); for (CDAField field : entry.contentType().fields()) { if ("RichText".equals(field.type())) { resolveRichDocument(entry, field); resolveRichLink(array, entry, field); } } } }
[ "public", "static", "void", "resolveRichTextField", "(", "ArrayResource", "array", ",", "CDAClient", "client", ")", "{", "for", "(", "CDAEntry", "entry", ":", "array", ".", "entries", "(", ")", ".", "values", "(", ")", ")", "{", "ensureContentType", "(", "...
Walk through the given array and resolve all rich text fields. @param array the array to be walked. @param client the client to be used if updating of types is needed.
[ "Walk", "through", "the", "given", "array", "and", "resolve", "all", "rich", "text", "fields", "." ]
train
https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/rich/RichTextFactory.java#L267-L277
jiaqi/jcli
src/main/java/org/cyclopsgroup/jcli/spi/CommandLineBuilder.java
CommandLineBuilder.withShortOption
public CommandLineBuilder withShortOption(String name, String value) { cl.addOptionValue(name, value, true); return this; }
java
public CommandLineBuilder withShortOption(String name, String value) { cl.addOptionValue(name, value, true); return this; }
[ "public", "CommandLineBuilder", "withShortOption", "(", "String", "name", ",", "String", "value", ")", "{", "cl", ".", "addOptionValue", "(", "name", ",", "value", ",", "true", ")", ";", "return", "this", ";", "}" ]
Add an option with its short name @param name Short name of the option to add @param value Value of option to add @return Builder itself
[ "Add", "an", "option", "with", "its", "short", "name" ]
train
https://github.com/jiaqi/jcli/blob/3854b3bb3c26bbe7407bf1b6600d8b25592d398e/src/main/java/org/cyclopsgroup/jcli/spi/CommandLineBuilder.java#L83-L86
korpling/ANNIS
annis-interfaces/src/main/java/annis/service/objects/CorpusConfig.java
CorpusConfig.setConfig
public void setConfig(String configName, String configValue) { if (config == null) { config = new Properties(); } if(configValue == null) { config.remove(configName); } else { config.setProperty(configName, configValue); } }
java
public void setConfig(String configName, String configValue) { if (config == null) { config = new Properties(); } if(configValue == null) { config.remove(configName); } else { config.setProperty(configName, configValue); } }
[ "public", "void", "setConfig", "(", "String", "configName", ",", "String", "configValue", ")", "{", "if", "(", "config", "==", "null", ")", "{", "config", "=", "new", "Properties", "(", ")", ";", "}", "if", "(", "configValue", "==", "null", ")", "{", ...
Add a new configuration. If the config name already exists, the config value is overwritten. @param configName The key of the config. @param configValue The value of the new config.
[ "Add", "a", "new", "configuration", ".", "If", "the", "config", "name", "already", "exists", "the", "config", "value", "is", "overwritten", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-interfaces/src/main/java/annis/service/objects/CorpusConfig.java#L62-L77
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.translate
public void translate(float x, float y, float z) { getTransform().translate(x, y, z); if (mTransformCache.translate(x, y, z)) { onTransformChanged(); } }
java
public void translate(float x, float y, float z) { getTransform().translate(x, y, z); if (mTransformCache.translate(x, y, z)) { onTransformChanged(); } }
[ "public", "void", "translate", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "getTransform", "(", ")", ".", "translate", "(", "x", ",", "y", ",", "z", ")", ";", "if", "(", "mTransformCache", ".", "translate", "(", "x", ",", "...
Move the object, relative to its current position. Modify the tranform's current translation by applying translations on all 3 axes. @param x 'X' delta @param y 'Y' delta @param z 'Z' delta
[ "Move", "the", "object", "relative", "to", "its", "current", "position", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1545-L1550
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/StreamSourceFrameChannel.java
StreamSourceFrameChannel.afterRead
protected void afterRead(ByteBuffer buffer, int position, int length) throws IOException { try { for (ChannelFunction func : functions) { func.afterRead(buffer, position, length); } if (isComplete()) { checkComplete(); } } catch (UnsupportedEncodingException e) { getFramedChannel().markReadsBroken(e); throw e; } }
java
protected void afterRead(ByteBuffer buffer, int position, int length) throws IOException { try { for (ChannelFunction func : functions) { func.afterRead(buffer, position, length); } if (isComplete()) { checkComplete(); } } catch (UnsupportedEncodingException e) { getFramedChannel().markReadsBroken(e); throw e; } }
[ "protected", "void", "afterRead", "(", "ByteBuffer", "buffer", ",", "int", "position", ",", "int", "length", ")", "throws", "IOException", "{", "try", "{", "for", "(", "ChannelFunction", "func", ":", "functions", ")", "{", "func", ".", "afterRead", "(", "b...
Called after data was read into the {@link ByteBuffer} @param buffer the {@link ByteBuffer} into which the data was read @param position the position it was written to @param length the number of bytes there were written @throws IOException thrown if an error occurs
[ "Called", "after", "data", "was", "read", "into", "the", "{", "@link", "ByteBuffer", "}" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/StreamSourceFrameChannel.java#L210-L222
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.addShortcut
private static void addShortcut(StringBuilder sb, Set<String> shortcuts) { if (sb.length() > 0) { String shortcut = validateShortcut(sb.toString()); if (shortcut != null) { shortcuts.add(shortcut); } sb.delete(0, sb.length()); } }
java
private static void addShortcut(StringBuilder sb, Set<String> shortcuts) { if (sb.length() > 0) { String shortcut = validateShortcut(sb.toString()); if (shortcut != null) { shortcuts.add(shortcut); } sb.delete(0, sb.length()); } }
[ "private", "static", "void", "addShortcut", "(", "StringBuilder", "sb", ",", "Set", "<", "String", ">", "shortcuts", ")", "{", "if", "(", "sb", ".", "length", "(", ")", ">", "0", ")", "{", "String", "shortcut", "=", "validateShortcut", "(", "sb", ".", ...
Adds a parsed shortcut to the set of shortcuts. Only valid shortcuts are added. @param sb String builder containing a parsed shortcut. @param shortcuts Set to receive parsed shortcut.
[ "Adds", "a", "parsed", "shortcut", "to", "the", "set", "of", "shortcuts", ".", "Only", "valid", "shortcuts", "are", "added", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L246-L256