repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java
DriverFactory.createDriver
protected InternalDriver createDriver( SecurityPlan securityPlan, SessionFactory sessionFactory, MetricsProvider metricsProvider, Config config ) { """ Creates new {@link Driver}. <p> <b>This method is protected only for testing</b> """ return new InternalDriver( securityPlan, sessionFactory, metricsProvider, config.logging() ); }
java
protected InternalDriver createDriver( SecurityPlan securityPlan, SessionFactory sessionFactory, MetricsProvider metricsProvider, Config config ) { return new InternalDriver( securityPlan, sessionFactory, metricsProvider, config.logging() ); }
[ "protected", "InternalDriver", "createDriver", "(", "SecurityPlan", "securityPlan", ",", "SessionFactory", "sessionFactory", ",", "MetricsProvider", "metricsProvider", ",", "Config", "config", ")", "{", "return", "new", "InternalDriver", "(", "securityPlan", ",", "sessionFactory", ",", "metricsProvider", ",", "config", ".", "logging", "(", ")", ")", ";", "}" ]
Creates new {@link Driver}. <p> <b>This method is protected only for testing</b>
[ "Creates", "new", "{" ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java#L193-L196
JodaOrg/joda-convert
src/main/java/org/joda/convert/StringConvert.java
StringConvert.findFromStringConstructorByType
private <T> Constructor<T> findFromStringConstructorByType(Class<T> cls) { """ Finds the conversion method. @param <T> the type of the converter @param cls the class to find a method for, not null @return the method to call, null means use {@code toString} """ try { return cls.getDeclaredConstructor(String.class); } catch (NoSuchMethodException ex) { try { return cls.getDeclaredConstructor(CharSequence.class); } catch (NoSuchMethodException ex2) { throw new IllegalArgumentException("Constructor not found", ex2); } } }
java
private <T> Constructor<T> findFromStringConstructorByType(Class<T> cls) { try { return cls.getDeclaredConstructor(String.class); } catch (NoSuchMethodException ex) { try { return cls.getDeclaredConstructor(CharSequence.class); } catch (NoSuchMethodException ex2) { throw new IllegalArgumentException("Constructor not found", ex2); } } }
[ "private", "<", "T", ">", "Constructor", "<", "T", ">", "findFromStringConstructorByType", "(", "Class", "<", "T", ">", "cls", ")", "{", "try", "{", "return", "cls", ".", "getDeclaredConstructor", "(", "String", ".", "class", ")", ";", "}", "catch", "(", "NoSuchMethodException", "ex", ")", "{", "try", "{", "return", "cls", ".", "getDeclaredConstructor", "(", "CharSequence", ".", "class", ")", ";", "}", "catch", "(", "NoSuchMethodException", "ex2", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Constructor not found\"", ",", "ex2", ")", ";", "}", "}", "}" ]
Finds the conversion method. @param <T> the type of the converter @param cls the class to find a method for, not null @return the method to call, null means use {@code toString}
[ "Finds", "the", "conversion", "method", "." ]
train
https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/StringConvert.java#L840-L850
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.createStateModelBinding
public void createStateModelBinding(final TransitionableState state, final String modelName, final Class modelType) { """ Create state model binding. @param state the state @param modelName the model name @param modelType the model type """ state.getAttributes().put("model", createExpression(modelName, modelType)); }
java
public void createStateModelBinding(final TransitionableState state, final String modelName, final Class modelType) { state.getAttributes().put("model", createExpression(modelName, modelType)); }
[ "public", "void", "createStateModelBinding", "(", "final", "TransitionableState", "state", ",", "final", "String", "modelName", ",", "final", "Class", "modelType", ")", "{", "state", ".", "getAttributes", "(", ")", ".", "put", "(", "\"model\"", ",", "createExpression", "(", "modelName", ",", "modelType", ")", ")", ";", "}" ]
Create state model binding. @param state the state @param modelName the model name @param modelType the model type
[ "Create", "state", "model", "binding", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L620-L622
foundation-runtime/logging
logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationHierarchyEventListener.java
FoundationHierarchyEventListener.addAppenderEvent
public void addAppenderEvent(final Category cat, final Appender appender) { """ In this method perform the actual override in runtime. @see org.apache.log4j.spi.HierarchyEventListener#addAppenderEvent(org.apache.log4j.Category, org.apache.log4j.Appender) """ updateDefaultLayout(appender); if (appender instanceof FoundationFileRollingAppender) { final FoundationFileRollingAppender timeSizeRollingAppender = (FoundationFileRollingAppender) appender; // update the appender with default vales such as logging pattern, file size etc. //updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender); // read teh proeprties and determine if archiving should be enabled. updateArchivingSupport(timeSizeRollingAppender); // by default add the rolling file listener to enable application // state. timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName()); boolean rollOnStartup = true; if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) { rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())); } timeSizeRollingAppender.setRollOnStartup(rollOnStartup); // refresh the appender timeSizeRollingAppender.activateOptions(); // timeSizeRollingAppender.setOriginalLayout(); //So application state will not make any problems }else if(!(appender instanceof FoundationFileRollingAppender) && (appender instanceof TimeAndSizeRollingAppender)){ //TimeAndSizeRollingAppender final TimeAndSizeRollingAppender timeSizeRollingAppender = (TimeAndSizeRollingAppender) appender; // update the appender with default vales such as logging pattern, file size etc. updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender); // read teh proeprties and determine if archiving should be enabled. updateArchivingSupport(timeSizeRollingAppender); // by default add the rolling file listener to enable application // state. timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName()); boolean rollOnStartup = true; if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) { rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())); } timeSizeRollingAppender.setRollOnStartup(rollOnStartup); // refresh the appender timeSizeRollingAppender.activateOptions(); // timeSizeRollingAppender.setOriginalLayout(); } if ( ! (appender instanceof org.apache.log4j.AsyncAppender)) initiateAsyncSupport(appender); }
java
public void addAppenderEvent(final Category cat, final Appender appender) { updateDefaultLayout(appender); if (appender instanceof FoundationFileRollingAppender) { final FoundationFileRollingAppender timeSizeRollingAppender = (FoundationFileRollingAppender) appender; // update the appender with default vales such as logging pattern, file size etc. //updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender); // read teh proeprties and determine if archiving should be enabled. updateArchivingSupport(timeSizeRollingAppender); // by default add the rolling file listener to enable application // state. timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName()); boolean rollOnStartup = true; if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) { rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())); } timeSizeRollingAppender.setRollOnStartup(rollOnStartup); // refresh the appender timeSizeRollingAppender.activateOptions(); // timeSizeRollingAppender.setOriginalLayout(); //So application state will not make any problems }else if(!(appender instanceof FoundationFileRollingAppender) && (appender instanceof TimeAndSizeRollingAppender)){ //TimeAndSizeRollingAppender final TimeAndSizeRollingAppender timeSizeRollingAppender = (TimeAndSizeRollingAppender) appender; // update the appender with default vales such as logging pattern, file size etc. updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender); // read teh proeprties and determine if archiving should be enabled. updateArchivingSupport(timeSizeRollingAppender); // by default add the rolling file listener to enable application // state. timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName()); boolean rollOnStartup = true; if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) { rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())); } timeSizeRollingAppender.setRollOnStartup(rollOnStartup); // refresh the appender timeSizeRollingAppender.activateOptions(); // timeSizeRollingAppender.setOriginalLayout(); } if ( ! (appender instanceof org.apache.log4j.AsyncAppender)) initiateAsyncSupport(appender); }
[ "public", "void", "addAppenderEvent", "(", "final", "Category", "cat", ",", "final", "Appender", "appender", ")", "{", "updateDefaultLayout", "(", "appender", ")", ";", "if", "(", "appender", "instanceof", "FoundationFileRollingAppender", ")", "{", "final", "FoundationFileRollingAppender", "timeSizeRollingAppender", "=", "(", "FoundationFileRollingAppender", ")", "appender", ";", "// update the appender with default vales such as logging pattern, file size etc.", "//updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender);", "// read teh proeprties and determine if archiving should be enabled.", "updateArchivingSupport", "(", "timeSizeRollingAppender", ")", ";", "// by default add the rolling file listener to enable application", "// state.", "timeSizeRollingAppender", ".", "setFileRollEventListener", "(", "FoundationRollEventListener", ".", "class", ".", "getName", "(", ")", ")", ";", "boolean", "rollOnStartup", "=", "true", ";", "if", "(", "FoundationLogger", ".", "log4jConfigProps", "!=", "null", "&&", "FoundationLogger", ".", "log4jConfigProps", ".", "containsKey", "(", "FoundationLoggerConstants", ".", "Foundation_ROLL_ON_STARTUP", ".", "toString", "(", ")", ")", ")", "{", "rollOnStartup", "=", "Boolean", ".", "valueOf", "(", "FoundationLogger", ".", "log4jConfigProps", ".", "getProperty", "(", "FoundationLoggerConstants", ".", "Foundation_ROLL_ON_STARTUP", ".", "toString", "(", ")", ")", ")", ";", "}", "timeSizeRollingAppender", ".", "setRollOnStartup", "(", "rollOnStartup", ")", ";", "// refresh the appender", "timeSizeRollingAppender", ".", "activateOptions", "(", ")", ";", "//\ttimeSizeRollingAppender.setOriginalLayout(); //So application state will not make any problems", "}", "else", "if", "(", "!", "(", "appender", "instanceof", "FoundationFileRollingAppender", ")", "&&", "(", "appender", "instanceof", "TimeAndSizeRollingAppender", ")", ")", "{", "//TimeAndSizeRollingAppender", "final", "TimeAndSizeRollingAppender", "timeSizeRollingAppender", "=", "(", "TimeAndSizeRollingAppender", ")", "appender", ";", "// update the appender with default vales such as logging pattern, file size etc.", "updateDefaultTimeAndSizeRollingAppender", "(", "timeSizeRollingAppender", ")", ";", "// read teh proeprties and determine if archiving should be enabled.", "updateArchivingSupport", "(", "timeSizeRollingAppender", ")", ";", "// by default add the rolling file listener to enable application", "// state.", "timeSizeRollingAppender", ".", "setFileRollEventListener", "(", "FoundationRollEventListener", ".", "class", ".", "getName", "(", ")", ")", ";", "boolean", "rollOnStartup", "=", "true", ";", "if", "(", "FoundationLogger", ".", "log4jConfigProps", "!=", "null", "&&", "FoundationLogger", ".", "log4jConfigProps", ".", "containsKey", "(", "FoundationLoggerConstants", ".", "Foundation_ROLL_ON_STARTUP", ".", "toString", "(", ")", ")", ")", "{", "rollOnStartup", "=", "Boolean", ".", "valueOf", "(", "FoundationLogger", ".", "log4jConfigProps", ".", "getProperty", "(", "FoundationLoggerConstants", ".", "Foundation_ROLL_ON_STARTUP", ".", "toString", "(", ")", ")", ")", ";", "}", "timeSizeRollingAppender", ".", "setRollOnStartup", "(", "rollOnStartup", ")", ";", "// refresh the appender", "timeSizeRollingAppender", ".", "activateOptions", "(", ")", ";", "//\ttimeSizeRollingAppender.setOriginalLayout();", "}", "if", "(", "!", "(", "appender", "instanceof", "org", ".", "apache", ".", "log4j", ".", "AsyncAppender", ")", ")", "initiateAsyncSupport", "(", "appender", ")", ";", "}" ]
In this method perform the actual override in runtime. @see org.apache.log4j.spi.HierarchyEventListener#addAppenderEvent(org.apache.log4j.Category, org.apache.log4j.Appender)
[ "In", "this", "method", "perform", "the", "actual", "override", "in", "runtime", "." ]
train
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationHierarchyEventListener.java#L55-L116
apache/flink
flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/functions/PythonCoGroup.java
PythonCoGroup.coGroup
@Override public final void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<OUT> out) throws Exception { """ Calls the external python function. @param first @param second @param out collector @throws IOException """ streamer.streamBufferWithGroups(first.iterator(), second.iterator(), out); }
java
@Override public final void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<OUT> out) throws Exception { streamer.streamBufferWithGroups(first.iterator(), second.iterator(), out); }
[ "@", "Override", "public", "final", "void", "coGroup", "(", "Iterable", "<", "IN1", ">", "first", ",", "Iterable", "<", "IN2", ">", "second", ",", "Collector", "<", "OUT", ">", "out", ")", "throws", "Exception", "{", "streamer", ".", "streamBufferWithGroups", "(", "first", ".", "iterator", "(", ")", ",", "second", ".", "iterator", "(", ")", ",", "out", ")", ";", "}" ]
Calls the external python function. @param first @param second @param out collector @throws IOException
[ "Calls", "the", "external", "python", "function", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/functions/PythonCoGroup.java#L65-L68
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYLineChartBuilder.java
DJXYLineChartBuilder.addSerie
public DJXYLineChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { """ Adds the specified serie column to the dataset with custom label. @param column the serie column """ getDataset().addSerie(column, labelExpression); return this; }
java
public DJXYLineChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
[ "public", "DJXYLineChartBuilder", "addSerie", "(", "AbstractColumn", "column", ",", "StringExpression", "labelExpression", ")", "{", "getDataset", "(", ")", ".", "addSerie", "(", "column", ",", "labelExpression", ")", ";", "return", "this", ";", "}" ]
Adds the specified serie column to the dataset with custom label. @param column the serie column
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYLineChartBuilder.java#L384-L387
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/expression/NormalAnnotationExprMerger.java
NormalAnnotationExprMerger.doIsEquals
@Override public boolean doIsEquals(NormalAnnotationExpr first, NormalAnnotationExpr second) { """ 1. check the name 2. check the member including key and value if their size is not the same and the less one is all matched in the more one return true """ boolean equals = true; if (!first.getName().equals(second.getName())) equals = false; if (equals == true) { if (first.getPairs() == null) return second.getPairs() == null; if (!isSmallerHasEqualsInBigger(first.getPairs(), second.getPairs(), true)) return false; } return equals; }
java
@Override public boolean doIsEquals(NormalAnnotationExpr first, NormalAnnotationExpr second) { boolean equals = true; if (!first.getName().equals(second.getName())) equals = false; if (equals == true) { if (first.getPairs() == null) return second.getPairs() == null; if (!isSmallerHasEqualsInBigger(first.getPairs(), second.getPairs(), true)) return false; } return equals; }
[ "@", "Override", "public", "boolean", "doIsEquals", "(", "NormalAnnotationExpr", "first", ",", "NormalAnnotationExpr", "second", ")", "{", "boolean", "equals", "=", "true", ";", "if", "(", "!", "first", ".", "getName", "(", ")", ".", "equals", "(", "second", ".", "getName", "(", ")", ")", ")", "equals", "=", "false", ";", "if", "(", "equals", "==", "true", ")", "{", "if", "(", "first", ".", "getPairs", "(", ")", "==", "null", ")", "return", "second", ".", "getPairs", "(", ")", "==", "null", ";", "if", "(", "!", "isSmallerHasEqualsInBigger", "(", "first", ".", "getPairs", "(", ")", ",", "second", ".", "getPairs", "(", ")", ",", "true", ")", ")", "return", "false", ";", "}", "return", "equals", ";", "}" ]
1. check the name 2. check the member including key and value if their size is not the same and the less one is all matched in the more one return true
[ "1", ".", "check", "the", "name", "2", ".", "check", "the", "member", "including", "key", "and", "value", "if", "their", "size", "is", "not", "the", "same", "and", "the", "less", "one", "is", "all", "matched", "in", "the", "more", "one", "return", "true" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/expression/NormalAnnotationExprMerger.java#L29-L45
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitUnknownInlineTag
@Override public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) { """ {@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning """ return scan(node.getContent(), p); }
java
@Override public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) { return scan(node.getContent(), p); }
[ "@", "Override", "public", "R", "visitUnknownInlineTag", "(", "UnknownInlineTagTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getContent", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L485-L488
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java
KeyValueAuthHandler.handleListMechsResponse
private void handleListMechsResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception { """ Handles an incoming SASL list mechanisms response and dispatches the next SASL AUTH step. @param ctx the handler context. @param msg the incoming message to investigate. @throws Exception if something goes wrong during negotiation. """ String remote = ctx.channel().remoteAddress().toString(); String[] supportedMechanisms = msg.content().toString(CharsetUtil.UTF_8).split(" "); if (supportedMechanisms.length == 0) { throw new AuthenticationException("Received empty SASL mechanisms list from server: " + remote); } if (forceSaslPlain) { LOGGER.trace("Got SASL Mechs {} but forcing PLAIN due to config setting.", Arrays.asList(supportedMechanisms)); supportedMechanisms = new String[] { "PLAIN" }; } saslClient = Sasl.createSaslClient(supportedMechanisms, null, "couchbase", remote, null, this); selectedMechanism = saslClient.getMechanismName(); int mechanismLength = selectedMechanism.length(); byte[] bytePayload = saslClient.hasInitialResponse() ? saslClient.evaluateChallenge(new byte[]{}) : null; ByteBuf payload = bytePayload != null ? ctx.alloc().buffer().writeBytes(bytePayload) : Unpooled.EMPTY_BUFFER; FullBinaryMemcacheRequest initialRequest = new DefaultFullBinaryMemcacheRequest( selectedMechanism.getBytes(CharsetUtil.UTF_8), Unpooled.EMPTY_BUFFER, payload ); initialRequest .setOpcode(SASL_AUTH_OPCODE) .setKeyLength((short) mechanismLength) .setTotalBodyLength(mechanismLength + payload.readableBytes()); ChannelFuture future = ctx.writeAndFlush(initialRequest); future.addListener(new GenericFutureListener<Future<Void>>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (!future.isSuccess()) { LOGGER.warn("Error during SASL Auth negotiation phase.", future); } } }); }
java
private void handleListMechsResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception { String remote = ctx.channel().remoteAddress().toString(); String[] supportedMechanisms = msg.content().toString(CharsetUtil.UTF_8).split(" "); if (supportedMechanisms.length == 0) { throw new AuthenticationException("Received empty SASL mechanisms list from server: " + remote); } if (forceSaslPlain) { LOGGER.trace("Got SASL Mechs {} but forcing PLAIN due to config setting.", Arrays.asList(supportedMechanisms)); supportedMechanisms = new String[] { "PLAIN" }; } saslClient = Sasl.createSaslClient(supportedMechanisms, null, "couchbase", remote, null, this); selectedMechanism = saslClient.getMechanismName(); int mechanismLength = selectedMechanism.length(); byte[] bytePayload = saslClient.hasInitialResponse() ? saslClient.evaluateChallenge(new byte[]{}) : null; ByteBuf payload = bytePayload != null ? ctx.alloc().buffer().writeBytes(bytePayload) : Unpooled.EMPTY_BUFFER; FullBinaryMemcacheRequest initialRequest = new DefaultFullBinaryMemcacheRequest( selectedMechanism.getBytes(CharsetUtil.UTF_8), Unpooled.EMPTY_BUFFER, payload ); initialRequest .setOpcode(SASL_AUTH_OPCODE) .setKeyLength((short) mechanismLength) .setTotalBodyLength(mechanismLength + payload.readableBytes()); ChannelFuture future = ctx.writeAndFlush(initialRequest); future.addListener(new GenericFutureListener<Future<Void>>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (!future.isSuccess()) { LOGGER.warn("Error during SASL Auth negotiation phase.", future); } } }); }
[ "private", "void", "handleListMechsResponse", "(", "ChannelHandlerContext", "ctx", ",", "FullBinaryMemcacheResponse", "msg", ")", "throws", "Exception", "{", "String", "remote", "=", "ctx", ".", "channel", "(", ")", ".", "remoteAddress", "(", ")", ".", "toString", "(", ")", ";", "String", "[", "]", "supportedMechanisms", "=", "msg", ".", "content", "(", ")", ".", "toString", "(", "CharsetUtil", ".", "UTF_8", ")", ".", "split", "(", "\" \"", ")", ";", "if", "(", "supportedMechanisms", ".", "length", "==", "0", ")", "{", "throw", "new", "AuthenticationException", "(", "\"Received empty SASL mechanisms list from server: \"", "+", "remote", ")", ";", "}", "if", "(", "forceSaslPlain", ")", "{", "LOGGER", ".", "trace", "(", "\"Got SASL Mechs {} but forcing PLAIN due to config setting.\"", ",", "Arrays", ".", "asList", "(", "supportedMechanisms", ")", ")", ";", "supportedMechanisms", "=", "new", "String", "[", "]", "{", "\"PLAIN\"", "}", ";", "}", "saslClient", "=", "Sasl", ".", "createSaslClient", "(", "supportedMechanisms", ",", "null", ",", "\"couchbase\"", ",", "remote", ",", "null", ",", "this", ")", ";", "selectedMechanism", "=", "saslClient", ".", "getMechanismName", "(", ")", ";", "int", "mechanismLength", "=", "selectedMechanism", ".", "length", "(", ")", ";", "byte", "[", "]", "bytePayload", "=", "saslClient", ".", "hasInitialResponse", "(", ")", "?", "saslClient", ".", "evaluateChallenge", "(", "new", "byte", "[", "]", "{", "}", ")", ":", "null", ";", "ByteBuf", "payload", "=", "bytePayload", "!=", "null", "?", "ctx", ".", "alloc", "(", ")", ".", "buffer", "(", ")", ".", "writeBytes", "(", "bytePayload", ")", ":", "Unpooled", ".", "EMPTY_BUFFER", ";", "FullBinaryMemcacheRequest", "initialRequest", "=", "new", "DefaultFullBinaryMemcacheRequest", "(", "selectedMechanism", ".", "getBytes", "(", "CharsetUtil", ".", "UTF_8", ")", ",", "Unpooled", ".", "EMPTY_BUFFER", ",", "payload", ")", ";", "initialRequest", ".", "setOpcode", "(", "SASL_AUTH_OPCODE", ")", ".", "setKeyLength", "(", "(", "short", ")", "mechanismLength", ")", ".", "setTotalBodyLength", "(", "mechanismLength", "+", "payload", ".", "readableBytes", "(", ")", ")", ";", "ChannelFuture", "future", "=", "ctx", ".", "writeAndFlush", "(", "initialRequest", ")", ";", "future", ".", "addListener", "(", "new", "GenericFutureListener", "<", "Future", "<", "Void", ">", ">", "(", ")", "{", "@", "Override", "public", "void", "operationComplete", "(", "Future", "<", "Void", ">", "future", ")", "throws", "Exception", "{", "if", "(", "!", "future", ".", "isSuccess", "(", ")", ")", "{", "LOGGER", ".", "warn", "(", "\"Error during SASL Auth negotiation phase.\"", ",", "future", ")", ";", "}", "}", "}", ")", ";", "}" ]
Handles an incoming SASL list mechanisms response and dispatches the next SASL AUTH step. @param ctx the handler context. @param msg the incoming message to investigate. @throws Exception if something goes wrong during negotiation.
[ "Handles", "an", "incoming", "SASL", "list", "mechanisms", "response", "and", "dispatches", "the", "next", "SASL", "AUTH", "step", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java#L191-L227
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/octracker/OutboundConnectionTracker.java
OutboundConnectionTracker.purgeFromInvalidateImpl
public void purgeFromInvalidateImpl(OutboundConnection connection, boolean notifyPeer) { """ Purges a conneciton from the tracker. This is invoked when an error is detected on a connection and we do not want any further conversations to attempt to use it. @param connection The connection to purge @param notifyPeer Should we send notification to the connections peer that the purge is taking place? """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "purgeFromInvalidateImpl", new Object[] { connection, "" + notifyPeer }); connection.getConnectionData().getConnectionDataGroup().purgeFromInvalidateImpl(connection, notifyPeer); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "purgeFromInvalidateImpl"); }
java
public void purgeFromInvalidateImpl(OutboundConnection connection, boolean notifyPeer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "purgeFromInvalidateImpl", new Object[] { connection, "" + notifyPeer }); connection.getConnectionData().getConnectionDataGroup().purgeFromInvalidateImpl(connection, notifyPeer); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "purgeFromInvalidateImpl"); }
[ "public", "void", "purgeFromInvalidateImpl", "(", "OutboundConnection", "connection", ",", "boolean", "notifyPeer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"purgeFromInvalidateImpl\"", ",", "new", "Object", "[", "]", "{", "connection", ",", "\"\"", "+", "notifyPeer", "}", ")", ";", "connection", ".", "getConnectionData", "(", ")", ".", "getConnectionDataGroup", "(", ")", ".", "purgeFromInvalidateImpl", "(", "connection", ",", "notifyPeer", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"purgeFromInvalidateImpl\"", ")", ";", "}" ]
Purges a conneciton from the tracker. This is invoked when an error is detected on a connection and we do not want any further conversations to attempt to use it. @param connection The connection to purge @param notifyPeer Should we send notification to the connections peer that the purge is taking place?
[ "Purges", "a", "conneciton", "from", "the", "tracker", ".", "This", "is", "invoked", "when", "an", "error", "is", "detected", "on", "a", "connection", "and", "we", "do", "not", "want", "any", "further", "conversations", "to", "attempt", "to", "use", "it", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/octracker/OutboundConnectionTracker.java#L784-L791
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectionContainersInner.java
ProtectionContainersInner.registerAsync
public Observable<ProtectionContainerResourceInner> registerAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, ProtectionContainerResourceInner parameters) { """ Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of the operation. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated with the container. @param containerName Name of the container to be registered. @param parameters Request body for operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProtectionContainerResourceInner object """ return registerWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, parameters).map(new Func1<ServiceResponse<ProtectionContainerResourceInner>, ProtectionContainerResourceInner>() { @Override public ProtectionContainerResourceInner call(ServiceResponse<ProtectionContainerResourceInner> response) { return response.body(); } }); }
java
public Observable<ProtectionContainerResourceInner> registerAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, ProtectionContainerResourceInner parameters) { return registerWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, parameters).map(new Func1<ServiceResponse<ProtectionContainerResourceInner>, ProtectionContainerResourceInner>() { @Override public ProtectionContainerResourceInner call(ServiceResponse<ProtectionContainerResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProtectionContainerResourceInner", ">", "registerAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "fabricName", ",", "String", "containerName", ",", "ProtectionContainerResourceInner", "parameters", ")", "{", "return", "registerWithServiceResponseAsync", "(", "vaultName", ",", "resourceGroupName", ",", "fabricName", ",", "containerName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ProtectionContainerResourceInner", ">", ",", "ProtectionContainerResourceInner", ">", "(", ")", "{", "@", "Override", "public", "ProtectionContainerResourceInner", "call", "(", "ServiceResponse", "<", "ProtectionContainerResourceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of the operation. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated with the container. @param containerName Name of the container to be registered. @param parameters Request body for operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProtectionContainerResourceInner object
[ "Registers", "the", "container", "with", "Recovery", "Services", "vault", ".", "This", "is", "an", "asynchronous", "operation", ".", "To", "track", "the", "operation", "status", "use", "location", "header", "to", "call", "get", "latest", "status", "of", "the", "operation", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectionContainersInner.java#L228-L235
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ExamplesImpl.java
ExamplesImpl.addAsync
public Observable<LabelExampleResponse> addAsync(UUID appId, String versionId, ExampleLabelObject exampleLabelObject) { """ Adds a labeled example to the application. @param appId The application ID. @param versionId The version ID. @param exampleLabelObject An example label with the expected intent and entities. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LabelExampleResponse object """ return addWithServiceResponseAsync(appId, versionId, exampleLabelObject).map(new Func1<ServiceResponse<LabelExampleResponse>, LabelExampleResponse>() { @Override public LabelExampleResponse call(ServiceResponse<LabelExampleResponse> response) { return response.body(); } }); }
java
public Observable<LabelExampleResponse> addAsync(UUID appId, String versionId, ExampleLabelObject exampleLabelObject) { return addWithServiceResponseAsync(appId, versionId, exampleLabelObject).map(new Func1<ServiceResponse<LabelExampleResponse>, LabelExampleResponse>() { @Override public LabelExampleResponse call(ServiceResponse<LabelExampleResponse> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LabelExampleResponse", ">", "addAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "ExampleLabelObject", "exampleLabelObject", ")", "{", "return", "addWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "exampleLabelObject", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "LabelExampleResponse", ">", ",", "LabelExampleResponse", ">", "(", ")", "{", "@", "Override", "public", "LabelExampleResponse", "call", "(", "ServiceResponse", "<", "LabelExampleResponse", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Adds a labeled example to the application. @param appId The application ID. @param versionId The version ID. @param exampleLabelObject An example label with the expected intent and entities. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LabelExampleResponse object
[ "Adds", "a", "labeled", "example", "to", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ExamplesImpl.java#L124-L131
headius/invokebinder
src/main/java/com/headius/invokebinder/Signature.java
Signature.replaceArg
public Signature replaceArg(String oldName, String newName, Class<?> newType) { """ Replace the named argument with a new name and type. @param oldName the old name of the argument @param newName the new name of the argument; can be the same as old @param newType the new type of the argument; can be the same as old @return a new signature with the modified argument """ int offset = argOffset(oldName); String[] newArgNames = argNames; if (!oldName.equals(newName)) { newArgNames = Arrays.copyOf(argNames, argNames.length); newArgNames[offset] = newName; } Class<?> oldType = methodType.parameterType(offset); MethodType newMethodType = methodType; if (!oldType.equals(newType)) newMethodType = methodType.changeParameterType(offset, newType); return new Signature(newMethodType, newArgNames); }
java
public Signature replaceArg(String oldName, String newName, Class<?> newType) { int offset = argOffset(oldName); String[] newArgNames = argNames; if (!oldName.equals(newName)) { newArgNames = Arrays.copyOf(argNames, argNames.length); newArgNames[offset] = newName; } Class<?> oldType = methodType.parameterType(offset); MethodType newMethodType = methodType; if (!oldType.equals(newType)) newMethodType = methodType.changeParameterType(offset, newType); return new Signature(newMethodType, newArgNames); }
[ "public", "Signature", "replaceArg", "(", "String", "oldName", ",", "String", "newName", ",", "Class", "<", "?", ">", "newType", ")", "{", "int", "offset", "=", "argOffset", "(", "oldName", ")", ";", "String", "[", "]", "newArgNames", "=", "argNames", ";", "if", "(", "!", "oldName", ".", "equals", "(", "newName", ")", ")", "{", "newArgNames", "=", "Arrays", ".", "copyOf", "(", "argNames", ",", "argNames", ".", "length", ")", ";", "newArgNames", "[", "offset", "]", "=", "newName", ";", "}", "Class", "<", "?", ">", "oldType", "=", "methodType", ".", "parameterType", "(", "offset", ")", ";", "MethodType", "newMethodType", "=", "methodType", ";", "if", "(", "!", "oldType", ".", "equals", "(", "newType", ")", ")", "newMethodType", "=", "methodType", ".", "changeParameterType", "(", "offset", ",", "newType", ")", ";", "return", "new", "Signature", "(", "newMethodType", ",", "newArgNames", ")", ";", "}" ]
Replace the named argument with a new name and type. @param oldName the old name of the argument @param newName the new name of the argument; can be the same as old @param newType the new type of the argument; can be the same as old @return a new signature with the modified argument
[ "Replace", "the", "named", "argument", "with", "a", "new", "name", "and", "type", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L397-L412
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java
ModelUtils.findAnnotationMirror
public static Optional<AnnotationMirror> findAnnotationMirror( Element element, Class<? extends Annotation> annotationClass) { """ Returns an {@link AnnotationMirror} for the annotation of type {@code annotationClass} on {@code element}, or {@link Optional#empty()} if no such annotation exists. """ return findAnnotationMirror(element, Shading.unshadedName(annotationClass.getName())); }
java
public static Optional<AnnotationMirror> findAnnotationMirror( Element element, Class<? extends Annotation> annotationClass) { return findAnnotationMirror(element, Shading.unshadedName(annotationClass.getName())); }
[ "public", "static", "Optional", "<", "AnnotationMirror", ">", "findAnnotationMirror", "(", "Element", "element", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ")", "{", "return", "findAnnotationMirror", "(", "element", ",", "Shading", ".", "unshadedName", "(", "annotationClass", ".", "getName", "(", ")", ")", ")", ";", "}" ]
Returns an {@link AnnotationMirror} for the annotation of type {@code annotationClass} on {@code element}, or {@link Optional#empty()} if no such annotation exists.
[ "Returns", "an", "{" ]
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java#L58-L61
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/core/registration/ColumnsGroupVariablesRegistrationManager.java
ColumnsGroupVariablesRegistrationManager.registerValueFormatter
protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) { """ Registers the parameter for the value formatter for the given variable and puts it's implementation in the parameters map. @param djVariable @param variableName """ if ( djVariable.getValueFormatter() == null){ return; } JRDesignParameter dparam = new JRDesignParameter(); dparam.setName(variableName + "_vf"); //value formater suffix dparam.setValueClassName(DJValueFormatter.class.getName()); log.debug("Registering value formatter parameter for property " + dparam.getName() ); try { getDjd().addParameter(dparam); } catch (JRException e) { throw new EntitiesRegistrationException(e.getMessage(),e); } getDjd().getParametersWithValues().put(dparam.getName(), djVariable.getValueFormatter()); }
java
protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) { if ( djVariable.getValueFormatter() == null){ return; } JRDesignParameter dparam = new JRDesignParameter(); dparam.setName(variableName + "_vf"); //value formater suffix dparam.setValueClassName(DJValueFormatter.class.getName()); log.debug("Registering value formatter parameter for property " + dparam.getName() ); try { getDjd().addParameter(dparam); } catch (JRException e) { throw new EntitiesRegistrationException(e.getMessage(),e); } getDjd().getParametersWithValues().put(dparam.getName(), djVariable.getValueFormatter()); }
[ "protected", "void", "registerValueFormatter", "(", "DJGroupVariable", "djVariable", ",", "String", "variableName", ")", "{", "if", "(", "djVariable", ".", "getValueFormatter", "(", ")", "==", "null", ")", "{", "return", ";", "}", "JRDesignParameter", "dparam", "=", "new", "JRDesignParameter", "(", ")", ";", "dparam", ".", "setName", "(", "variableName", "+", "\"_vf\"", ")", ";", "//value formater suffix", "dparam", ".", "setValueClassName", "(", "DJValueFormatter", ".", "class", ".", "getName", "(", ")", ")", ";", "log", ".", "debug", "(", "\"Registering value formatter parameter for property \"", "+", "dparam", ".", "getName", "(", ")", ")", ";", "try", "{", "getDjd", "(", ")", ".", "addParameter", "(", "dparam", ")", ";", "}", "catch", "(", "JRException", "e", ")", "{", "throw", "new", "EntitiesRegistrationException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "getDjd", "(", ")", ".", "getParametersWithValues", "(", ")", ".", "put", "(", "dparam", ".", "getName", "(", ")", ",", "djVariable", ".", "getValueFormatter", "(", ")", ")", ";", "}" ]
Registers the parameter for the value formatter for the given variable and puts it's implementation in the parameters map. @param djVariable @param variableName
[ "Registers", "the", "parameter", "for", "the", "value", "formatter", "for", "the", "given", "variable", "and", "puts", "it", "s", "implementation", "in", "the", "parameters", "map", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/registration/ColumnsGroupVariablesRegistrationManager.java#L114-L130
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigWebUtil.java
ConfigWebUtil.getExistingResource
public static Resource getExistingResource(ServletContext sc, String strDir, String defaultDir, Resource configDir, short type, Config config) { """ get only a existing file, dont create it @param sc @param strDir @param defaultDir @param configDir @param type @param config @return existing file """ // ARP strDir = replacePlaceholder(strDir, config); if (strDir != null && strDir.trim().length() > 0) { Resource res = sc == null ? null : _getExistingFile(config.getResource(ResourceUtil.merge(ReqRspUtil.getRootPath(sc), strDir)), type); if (res != null) return res; res = _getExistingFile(config.getResource(strDir), type); if (res != null) return res; } if (defaultDir == null) return null; return _getExistingFile(configDir.getRealResource(defaultDir), type); }
java
public static Resource getExistingResource(ServletContext sc, String strDir, String defaultDir, Resource configDir, short type, Config config) { // ARP strDir = replacePlaceholder(strDir, config); if (strDir != null && strDir.trim().length() > 0) { Resource res = sc == null ? null : _getExistingFile(config.getResource(ResourceUtil.merge(ReqRspUtil.getRootPath(sc), strDir)), type); if (res != null) return res; res = _getExistingFile(config.getResource(strDir), type); if (res != null) return res; } if (defaultDir == null) return null; return _getExistingFile(configDir.getRealResource(defaultDir), type); }
[ "public", "static", "Resource", "getExistingResource", "(", "ServletContext", "sc", ",", "String", "strDir", ",", "String", "defaultDir", ",", "Resource", "configDir", ",", "short", "type", ",", "Config", "config", ")", "{", "// ARP", "strDir", "=", "replacePlaceholder", "(", "strDir", ",", "config", ")", ";", "if", "(", "strDir", "!=", "null", "&&", "strDir", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "Resource", "res", "=", "sc", "==", "null", "?", "null", ":", "_getExistingFile", "(", "config", ".", "getResource", "(", "ResourceUtil", ".", "merge", "(", "ReqRspUtil", ".", "getRootPath", "(", "sc", ")", ",", "strDir", ")", ")", ",", "type", ")", ";", "if", "(", "res", "!=", "null", ")", "return", "res", ";", "res", "=", "_getExistingFile", "(", "config", ".", "getResource", "(", "strDir", ")", ",", "type", ")", ";", "if", "(", "res", "!=", "null", ")", "return", "res", ";", "}", "if", "(", "defaultDir", "==", "null", ")", "return", "null", ";", "return", "_getExistingFile", "(", "configDir", ".", "getRealResource", "(", "defaultDir", ")", ",", "type", ")", ";", "}" ]
get only a existing file, dont create it @param sc @param strDir @param defaultDir @param configDir @param type @param config @return existing file
[ "get", "only", "a", "existing", "file", "dont", "create", "it" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigWebUtil.java#L361-L375
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/predefined/RequestOrientedStats.java
RequestOrientedStats.getAverageRequestDuration
public double getAverageRequestDuration(String intervalName, TimeUnit unit) { """ Returns the average request duration for the given interval and converted to the given timeunit. @param intervalName name of the interval. @param unit timeunit. @return """ return unit.transformNanos(totalTime.getValueAsLong(intervalName)) / totalRequests.getValueAsDouble(intervalName); }
java
public double getAverageRequestDuration(String intervalName, TimeUnit unit) { return unit.transformNanos(totalTime.getValueAsLong(intervalName)) / totalRequests.getValueAsDouble(intervalName); }
[ "public", "double", "getAverageRequestDuration", "(", "String", "intervalName", ",", "TimeUnit", "unit", ")", "{", "return", "unit", ".", "transformNanos", "(", "totalTime", ".", "getValueAsLong", "(", "intervalName", ")", ")", "/", "totalRequests", ".", "getValueAsDouble", "(", "intervalName", ")", ";", "}" ]
Returns the average request duration for the given interval and converted to the given timeunit. @param intervalName name of the interval. @param unit timeunit. @return
[ "Returns", "the", "average", "request", "duration", "for", "the", "given", "interval", "and", "converted", "to", "the", "given", "timeunit", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/RequestOrientedStats.java#L240-L242
cdapio/tigon
tigon-yarn/src/main/java/co/cask/tigon/conf/Configuration.java
Configuration.getBoolean
public boolean getBoolean(String name, boolean defaultValue) { """ Get the value of the <code>name</code> property as a <code>boolean</code>. If no such property is specified, or if the specified value is not a valid <code>boolean</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as a <code>boolean</code>, or <code>defaultValue</code>. """ String valueString = getTrimmed(name); if (null == valueString || "".equals(valueString)) { return defaultValue; } valueString = valueString.toLowerCase(); if ("true".equals(valueString)) { return true; } else if ("false".equals(valueString)) { return false; } else { return defaultValue; } }
java
public boolean getBoolean(String name, boolean defaultValue) { String valueString = getTrimmed(name); if (null == valueString || "".equals(valueString)) { return defaultValue; } valueString = valueString.toLowerCase(); if ("true".equals(valueString)) { return true; } else if ("false".equals(valueString)) { return false; } else { return defaultValue; } }
[ "public", "boolean", "getBoolean", "(", "String", "name", ",", "boolean", "defaultValue", ")", "{", "String", "valueString", "=", "getTrimmed", "(", "name", ")", ";", "if", "(", "null", "==", "valueString", "||", "\"\"", ".", "equals", "(", "valueString", ")", ")", "{", "return", "defaultValue", ";", "}", "valueString", "=", "valueString", ".", "toLowerCase", "(", ")", ";", "if", "(", "\"true\"", ".", "equals", "(", "valueString", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "\"false\"", ".", "equals", "(", "valueString", ")", ")", "{", "return", "false", ";", "}", "else", "{", "return", "defaultValue", ";", "}", "}" ]
Get the value of the <code>name</code> property as a <code>boolean</code>. If no such property is specified, or if the specified value is not a valid <code>boolean</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as a <code>boolean</code>, or <code>defaultValue</code>.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "<code", ">", "boolean<", "/", "code", ">", ".", "If", "no", "such", "property", "is", "specified", "or", "if", "the", "specified", "value", "is", "not", "a", "valid", "<code", ">", "boolean<", "/", "code", ">", "then", "<code", ">", "defaultValue<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/conf/Configuration.java#L857-L872
craftercms/commons
utilities/src/main/java/org/craftercms/commons/i10n/I10nUtils.java
I10nUtils.getLocalizedMessage
public static String getLocalizedMessage(ResourceBundle bundle, String key, Object... args) { """ Returns a formatted, localized message according to the specified resource bundle and key. @param bundle the resource bundle where the message format should be @param key the key of the message format @param args the args of the message format @return the formatted, localized message """ String pattern; try { pattern = bundle.getString(key); } catch (MissingResourceException e) { pattern = key; } if (ArrayUtils.isNotEmpty(args)) { return MessageFormat.format(pattern, args); } else { return pattern; } }
java
public static String getLocalizedMessage(ResourceBundle bundle, String key, Object... args) { String pattern; try { pattern = bundle.getString(key); } catch (MissingResourceException e) { pattern = key; } if (ArrayUtils.isNotEmpty(args)) { return MessageFormat.format(pattern, args); } else { return pattern; } }
[ "public", "static", "String", "getLocalizedMessage", "(", "ResourceBundle", "bundle", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "String", "pattern", ";", "try", "{", "pattern", "=", "bundle", ".", "getString", "(", "key", ")", ";", "}", "catch", "(", "MissingResourceException", "e", ")", "{", "pattern", "=", "key", ";", "}", "if", "(", "ArrayUtils", ".", "isNotEmpty", "(", "args", ")", ")", "{", "return", "MessageFormat", ".", "format", "(", "pattern", ",", "args", ")", ";", "}", "else", "{", "return", "pattern", ";", "}", "}" ]
Returns a formatted, localized message according to the specified resource bundle and key. @param bundle the resource bundle where the message format should be @param key the key of the message format @param args the args of the message format @return the formatted, localized message
[ "Returns", "a", "formatted", "localized", "message", "according", "to", "the", "specified", "resource", "bundle", "and", "key", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/i10n/I10nUtils.java#L58-L71
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/dao/Results.java
Results.addStats
public void addStats(long updateCount, long insertId, boolean moreResultAvailable) { """ Add execution statistics. @param updateCount number of updated rows @param insertId primary key @param moreResultAvailable is there additional packet """ if (cmdInformation == null) { if (batch) { cmdInformation = new CmdInformationBatch(expectedSize, autoIncrement); } else if (moreResultAvailable) { cmdInformation = new CmdInformationMultiple(expectedSize, autoIncrement); } else { cmdInformation = new CmdInformationSingle(insertId, updateCount, autoIncrement); return; } } cmdInformation.addSuccessStat(updateCount, insertId); }
java
public void addStats(long updateCount, long insertId, boolean moreResultAvailable) { if (cmdInformation == null) { if (batch) { cmdInformation = new CmdInformationBatch(expectedSize, autoIncrement); } else if (moreResultAvailable) { cmdInformation = new CmdInformationMultiple(expectedSize, autoIncrement); } else { cmdInformation = new CmdInformationSingle(insertId, updateCount, autoIncrement); return; } } cmdInformation.addSuccessStat(updateCount, insertId); }
[ "public", "void", "addStats", "(", "long", "updateCount", ",", "long", "insertId", ",", "boolean", "moreResultAvailable", ")", "{", "if", "(", "cmdInformation", "==", "null", ")", "{", "if", "(", "batch", ")", "{", "cmdInformation", "=", "new", "CmdInformationBatch", "(", "expectedSize", ",", "autoIncrement", ")", ";", "}", "else", "if", "(", "moreResultAvailable", ")", "{", "cmdInformation", "=", "new", "CmdInformationMultiple", "(", "expectedSize", ",", "autoIncrement", ")", ";", "}", "else", "{", "cmdInformation", "=", "new", "CmdInformationSingle", "(", "insertId", ",", "updateCount", ",", "autoIncrement", ")", ";", "return", ";", "}", "}", "cmdInformation", ".", "addSuccessStat", "(", "updateCount", ",", "insertId", ")", ";", "}" ]
Add execution statistics. @param updateCount number of updated rows @param insertId primary key @param moreResultAvailable is there additional packet
[ "Add", "execution", "statistics", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/dao/Results.java#L174-L186
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/ConcurrentMapWrapper.java
ConcurrentMapWrapper.putIfAbsent
@Override public V putIfAbsent(K key, final V value) { """ We cannot use {@link Cache#putIfAbsent(Object, Object)} since the map returns the value. """ return cache.invoke(key, new EntryProcessor<K, V, V>() { @Override public V process(MutableCacheEntry<K, V> e) { if (!e.exists()) { e.setValue(value); return null; } return e.getValue(); } }); }
java
@Override public V putIfAbsent(K key, final V value) { return cache.invoke(key, new EntryProcessor<K, V, V>() { @Override public V process(MutableCacheEntry<K, V> e) { if (!e.exists()) { e.setValue(value); return null; } return e.getValue(); } }); }
[ "@", "Override", "public", "V", "putIfAbsent", "(", "K", "key", ",", "final", "V", "value", ")", "{", "return", "cache", ".", "invoke", "(", "key", ",", "new", "EntryProcessor", "<", "K", ",", "V", ",", "V", ">", "(", ")", "{", "@", "Override", "public", "V", "process", "(", "MutableCacheEntry", "<", "K", ",", "V", ">", "e", ")", "{", "if", "(", "!", "e", ".", "exists", "(", ")", ")", "{", "e", ".", "setValue", "(", "value", ")", ";", "return", "null", ";", "}", "return", "e", ".", "getValue", "(", ")", ";", "}", "}", ")", ";", "}" ]
We cannot use {@link Cache#putIfAbsent(Object, Object)} since the map returns the value.
[ "We", "cannot", "use", "{" ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/ConcurrentMapWrapper.java#L59-L71
apache/reef
lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/FileSet.java
FileSet.addNamesTo
ConfigurationModule addNamesTo(final ConfigurationModule input, final OptionalParameter<String> field) { """ Adds the file names of this FileSet to the given field of the given ConfigurationModule. @param input the ConfigurationModule to fill out @param field the field to add the files in this set to. @return the filled out ConfigurationModule """ ConfigurationModule result = input; for (final String fileName : this.fileNames()) { result = result.set(field, fileName); } return result; }
java
ConfigurationModule addNamesTo(final ConfigurationModule input, final OptionalParameter<String> field) { ConfigurationModule result = input; for (final String fileName : this.fileNames()) { result = result.set(field, fileName); } return result; }
[ "ConfigurationModule", "addNamesTo", "(", "final", "ConfigurationModule", "input", ",", "final", "OptionalParameter", "<", "String", ">", "field", ")", "{", "ConfigurationModule", "result", "=", "input", ";", "for", "(", "final", "String", "fileName", ":", "this", ".", "fileNames", "(", ")", ")", "{", "result", "=", "result", ".", "set", "(", "field", ",", "fileName", ")", ";", "}", "return", "result", ";", "}" ]
Adds the file names of this FileSet to the given field of the given ConfigurationModule. @param input the ConfigurationModule to fill out @param field the field to add the files in this set to. @return the filled out ConfigurationModule
[ "Adds", "the", "file", "names", "of", "this", "FileSet", "to", "the", "given", "field", "of", "the", "given", "ConfigurationModule", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/FileSet.java#L106-L112
authorjapps/zerocode
core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java
BasicHttpClient.createFileUploadRequestBuilder
public RequestBuilder createFileUploadRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) throws IOException { """ This is the http request builder for file uploads, using Apache Http Client. In case you want to build or prepare the requests differently, you can override this method. Note- With file uploads you can send more headers too from the testcase to the server, except "Content-Type" because this is reserved for "multipart/form-data" which the client sends to server during the file uploads. You can also send more request-params and "boundary" from the test cases if needed. The boundary defaults to an unique string of local-date-time-stamp if not provided in the request. You can override this method via @UseHttpClient(YourCustomHttpClient.class) @param httpUrl @param methodName @param reqBodyAsString @return @throws IOException """ Map<String, Object> fileFieldNameValueMap = getFileFieldNameValue(reqBodyAsString); List<String> fileFieldsList = (List<String>) fileFieldNameValueMap.get(FILES_FIELD); MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); /* * Allow fileFieldsList to be null. * fileFieldsList can be null if multipart/form-data is sent without any files * Refer Issue #168 - Raised and fixed by santhoshTpixler */ if(fileFieldsList != null) { buildAllFilesToUpload(fileFieldsList, multipartEntityBuilder); } buildOtherRequestParams(fileFieldNameValueMap, multipartEntityBuilder); buildMultiPartBoundary(fileFieldNameValueMap, multipartEntityBuilder); return createUploadRequestBuilder(httpUrl, methodName, multipartEntityBuilder); }
java
public RequestBuilder createFileUploadRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) throws IOException { Map<String, Object> fileFieldNameValueMap = getFileFieldNameValue(reqBodyAsString); List<String> fileFieldsList = (List<String>) fileFieldNameValueMap.get(FILES_FIELD); MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); /* * Allow fileFieldsList to be null. * fileFieldsList can be null if multipart/form-data is sent without any files * Refer Issue #168 - Raised and fixed by santhoshTpixler */ if(fileFieldsList != null) { buildAllFilesToUpload(fileFieldsList, multipartEntityBuilder); } buildOtherRequestParams(fileFieldNameValueMap, multipartEntityBuilder); buildMultiPartBoundary(fileFieldNameValueMap, multipartEntityBuilder); return createUploadRequestBuilder(httpUrl, methodName, multipartEntityBuilder); }
[ "public", "RequestBuilder", "createFileUploadRequestBuilder", "(", "String", "httpUrl", ",", "String", "methodName", ",", "String", "reqBodyAsString", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Object", ">", "fileFieldNameValueMap", "=", "getFileFieldNameValue", "(", "reqBodyAsString", ")", ";", "List", "<", "String", ">", "fileFieldsList", "=", "(", "List", "<", "String", ">", ")", "fileFieldNameValueMap", ".", "get", "(", "FILES_FIELD", ")", ";", "MultipartEntityBuilder", "multipartEntityBuilder", "=", "MultipartEntityBuilder", ".", "create", "(", ")", ";", "/*\n\t * Allow fileFieldsList to be null.\n\t * fileFieldsList can be null if multipart/form-data is sent without any files\n\t * Refer Issue #168 - Raised and fixed by santhoshTpixler\n\t */", "if", "(", "fileFieldsList", "!=", "null", ")", "{", "buildAllFilesToUpload", "(", "fileFieldsList", ",", "multipartEntityBuilder", ")", ";", "}", "buildOtherRequestParams", "(", "fileFieldNameValueMap", ",", "multipartEntityBuilder", ")", ";", "buildMultiPartBoundary", "(", "fileFieldNameValueMap", ",", "multipartEntityBuilder", ")", ";", "return", "createUploadRequestBuilder", "(", "httpUrl", ",", "methodName", ",", "multipartEntityBuilder", ")", ";", "}" ]
This is the http request builder for file uploads, using Apache Http Client. In case you want to build or prepare the requests differently, you can override this method. Note- With file uploads you can send more headers too from the testcase to the server, except "Content-Type" because this is reserved for "multipart/form-data" which the client sends to server during the file uploads. You can also send more request-params and "boundary" from the test cases if needed. The boundary defaults to an unique string of local-date-time-stamp if not provided in the request. You can override this method via @UseHttpClient(YourCustomHttpClient.class) @param httpUrl @param methodName @param reqBodyAsString @return @throws IOException
[ "This", "is", "the", "http", "request", "builder", "for", "file", "uploads", "using", "Apache", "Http", "Client", ".", "In", "case", "you", "want", "to", "build", "or", "prepare", "the", "requests", "differently", "you", "can", "override", "this", "method", "." ]
train
https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L340-L361
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/IO.java
IO.copyAndCloseOutput
public static int copyAndCloseOutput(Reader input, Writer output) throws IOException { """ Copy input to output and close the output stream before returning """ try { return copy(input, output); } finally { output.close(); } }
java
public static int copyAndCloseOutput(Reader input, Writer output) throws IOException { try { return copy(input, output); } finally { output.close(); } }
[ "public", "static", "int", "copyAndCloseOutput", "(", "Reader", "input", ",", "Writer", "output", ")", "throws", "IOException", "{", "try", "{", "return", "copy", "(", "input", ",", "output", ")", ";", "}", "finally", "{", "output", ".", "close", "(", ")", ";", "}", "}" ]
Copy input to output and close the output stream before returning
[ "Copy", "input", "to", "output", "and", "close", "the", "output", "stream", "before", "returning" ]
train
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L96-L103
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java
XMLConfigAdmin.updateJavaCFX
public void updateJavaCFX(String name, ClassDefinition cd) throws PageException { """ insert or update a Java CFX Tag @param name @param strClass @throws PageException """ checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CFX_SETTING); if (!hasAccess) throw new SecurityException("no access to change cfx settings"); if (name == null || name.length() == 0) throw new ExpressionException("class name can't be a empty value"); renameOldstyleCFX(); Element tags = _getRootElement("ext-tags"); // Update Element[] children = XMLConfigWebFactory.getChildren(tags, "ext-tag"); for (int i = 0; i < children.length; i++) { String n = children[i].getAttribute("name"); if (n != null && n.equalsIgnoreCase(name)) { Element el = children[i]; if (!"java".equalsIgnoreCase(el.getAttribute("type"))) throw new ExpressionException("there is already a c++ cfx tag with this name"); setClass(el, CustomTag.class, "", cd); el.setAttribute("type", "java"); return; } } // Insert Element el = doc.createElement("ext-tag"); tags.appendChild(el); setClass(el, CustomTag.class, "", cd); el.setAttribute("name", name); el.setAttribute("type", "java"); }
java
public void updateJavaCFX(String name, ClassDefinition cd) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CFX_SETTING); if (!hasAccess) throw new SecurityException("no access to change cfx settings"); if (name == null || name.length() == 0) throw new ExpressionException("class name can't be a empty value"); renameOldstyleCFX(); Element tags = _getRootElement("ext-tags"); // Update Element[] children = XMLConfigWebFactory.getChildren(tags, "ext-tag"); for (int i = 0; i < children.length; i++) { String n = children[i].getAttribute("name"); if (n != null && n.equalsIgnoreCase(name)) { Element el = children[i]; if (!"java".equalsIgnoreCase(el.getAttribute("type"))) throw new ExpressionException("there is already a c++ cfx tag with this name"); setClass(el, CustomTag.class, "", cd); el.setAttribute("type", "java"); return; } } // Insert Element el = doc.createElement("ext-tag"); tags.appendChild(el); setClass(el, CustomTag.class, "", cd); el.setAttribute("name", name); el.setAttribute("type", "java"); }
[ "public", "void", "updateJavaCFX", "(", "String", "name", ",", "ClassDefinition", "cd", ")", "throws", "PageException", "{", "checkWriteAccess", "(", ")", ";", "boolean", "hasAccess", "=", "ConfigWebUtil", ".", "hasAccess", "(", "config", ",", "SecurityManager", ".", "TYPE_CFX_SETTING", ")", ";", "if", "(", "!", "hasAccess", ")", "throw", "new", "SecurityException", "(", "\"no access to change cfx settings\"", ")", ";", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "ExpressionException", "(", "\"class name can't be a empty value\"", ")", ";", "renameOldstyleCFX", "(", ")", ";", "Element", "tags", "=", "_getRootElement", "(", "\"ext-tags\"", ")", ";", "// Update", "Element", "[", "]", "children", "=", "XMLConfigWebFactory", ".", "getChildren", "(", "tags", ",", "\"ext-tag\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "String", "n", "=", "children", "[", "i", "]", ".", "getAttribute", "(", "\"name\"", ")", ";", "if", "(", "n", "!=", "null", "&&", "n", ".", "equalsIgnoreCase", "(", "name", ")", ")", "{", "Element", "el", "=", "children", "[", "i", "]", ";", "if", "(", "!", "\"java\"", ".", "equalsIgnoreCase", "(", "el", ".", "getAttribute", "(", "\"type\"", ")", ")", ")", "throw", "new", "ExpressionException", "(", "\"there is already a c++ cfx tag with this name\"", ")", ";", "setClass", "(", "el", ",", "CustomTag", ".", "class", ",", "\"\"", ",", "cd", ")", ";", "el", ".", "setAttribute", "(", "\"type\"", ",", "\"java\"", ")", ";", "return", ";", "}", "}", "// Insert", "Element", "el", "=", "doc", ".", "createElement", "(", "\"ext-tag\"", ")", ";", "tags", ".", "appendChild", "(", "el", ")", ";", "setClass", "(", "el", ",", "CustomTag", ".", "class", ",", "\"\"", ",", "cd", ")", ";", "el", ".", "setAttribute", "(", "\"name\"", ",", "name", ")", ";", "el", ".", "setAttribute", "(", "\"type\"", ",", "\"java\"", ")", ";", "}" ]
insert or update a Java CFX Tag @param name @param strClass @throws PageException
[ "insert", "or", "update", "a", "Java", "CFX", "Tag" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L1134-L1167
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.roundHalfUp
public static double roundHalfUp(double d, int scale) { """ Round up a double using the "half up" method. @param d a double @param scale the scale @return a double """ return BigDecimal.valueOf(d).setScale(scale, RoundingMode.HALF_UP).doubleValue(); }
java
public static double roundHalfUp(double d, int scale) { return BigDecimal.valueOf(d).setScale(scale, RoundingMode.HALF_UP).doubleValue(); }
[ "public", "static", "double", "roundHalfUp", "(", "double", "d", ",", "int", "scale", ")", "{", "return", "BigDecimal", ".", "valueOf", "(", "d", ")", ".", "setScale", "(", "scale", ",", "RoundingMode", ".", "HALF_UP", ")", ".", "doubleValue", "(", ")", ";", "}" ]
Round up a double using the "half up" method. @param d a double @param scale the scale @return a double
[ "Round", "up", "a", "double", "using", "the", "half", "up", "method", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L550-L552
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/cal/JCalendarDualField.java
JCalendarDualField.init
public void init(Convert converter, boolean bAddCalendarButton, boolean bAddTimeButton) { """ Creates new JCalendarDualField. @param The field this component is tied to. """ m_converter = converter; this.setBorder(null); this.setOpaque(false); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); String strDefault = null; int iColumns = 15; if (m_converter != null) { strDefault = m_converter.getString(); iColumns = m_converter.getMaxLength(); } m_tf = new JTextField(strDefault, iColumns); this.add(m_tf); BaseApplet applet = BaseApplet.getSharedInstance(); if (bAddCalendarButton) { m_button = new JButton(applet.loadImageIcon(JCalendarPopup.CALENDAR_ICON)); m_button.setMargin(JCalendarPopup.NO_INSETS); m_button.setOpaque(false); this.add(m_button); m_button.addActionListener(this); } if (bAddTimeButton) { m_buttonTime = new JButton(applet.loadImageIcon(JTimePopup.TIME_ICON)); m_buttonTime.setMargin(JCalendarPopup.NO_INSETS); m_buttonTime.setOpaque(false); this.add(m_buttonTime); m_buttonTime.addActionListener(this); } }
java
public void init(Convert converter, boolean bAddCalendarButton, boolean bAddTimeButton) { m_converter = converter; this.setBorder(null); this.setOpaque(false); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); String strDefault = null; int iColumns = 15; if (m_converter != null) { strDefault = m_converter.getString(); iColumns = m_converter.getMaxLength(); } m_tf = new JTextField(strDefault, iColumns); this.add(m_tf); BaseApplet applet = BaseApplet.getSharedInstance(); if (bAddCalendarButton) { m_button = new JButton(applet.loadImageIcon(JCalendarPopup.CALENDAR_ICON)); m_button.setMargin(JCalendarPopup.NO_INSETS); m_button.setOpaque(false); this.add(m_button); m_button.addActionListener(this); } if (bAddTimeButton) { m_buttonTime = new JButton(applet.loadImageIcon(JTimePopup.TIME_ICON)); m_buttonTime.setMargin(JCalendarPopup.NO_INSETS); m_buttonTime.setOpaque(false); this.add(m_buttonTime); m_buttonTime.addActionListener(this); } }
[ "public", "void", "init", "(", "Convert", "converter", ",", "boolean", "bAddCalendarButton", ",", "boolean", "bAddTimeButton", ")", "{", "m_converter", "=", "converter", ";", "this", ".", "setBorder", "(", "null", ")", ";", "this", ".", "setOpaque", "(", "false", ")", ";", "this", ".", "setLayout", "(", "new", "BoxLayout", "(", "this", ",", "BoxLayout", ".", "X_AXIS", ")", ")", ";", "String", "strDefault", "=", "null", ";", "int", "iColumns", "=", "15", ";", "if", "(", "m_converter", "!=", "null", ")", "{", "strDefault", "=", "m_converter", ".", "getString", "(", ")", ";", "iColumns", "=", "m_converter", ".", "getMaxLength", "(", ")", ";", "}", "m_tf", "=", "new", "JTextField", "(", "strDefault", ",", "iColumns", ")", ";", "this", ".", "add", "(", "m_tf", ")", ";", "BaseApplet", "applet", "=", "BaseApplet", ".", "getSharedInstance", "(", ")", ";", "if", "(", "bAddCalendarButton", ")", "{", "m_button", "=", "new", "JButton", "(", "applet", ".", "loadImageIcon", "(", "JCalendarPopup", ".", "CALENDAR_ICON", ")", ")", ";", "m_button", ".", "setMargin", "(", "JCalendarPopup", ".", "NO_INSETS", ")", ";", "m_button", ".", "setOpaque", "(", "false", ")", ";", "this", ".", "add", "(", "m_button", ")", ";", "m_button", ".", "addActionListener", "(", "this", ")", ";", "}", "if", "(", "bAddTimeButton", ")", "{", "m_buttonTime", "=", "new", "JButton", "(", "applet", ".", "loadImageIcon", "(", "JTimePopup", ".", "TIME_ICON", ")", ")", ";", "m_buttonTime", ".", "setMargin", "(", "JCalendarPopup", ".", "NO_INSETS", ")", ";", "m_buttonTime", ".", "setOpaque", "(", "false", ")", ";", "this", ".", "add", "(", "m_buttonTime", ")", ";", "m_buttonTime", ".", "addActionListener", "(", "this", ")", ";", "}", "}" ]
Creates new JCalendarDualField. @param The field this component is tied to.
[ "Creates", "new", "JCalendarDualField", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/cal/JCalendarDualField.java#L97-L131
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java
LayerImpl.getLastModified
protected long getLastModified(IAggregator aggregator, ModuleList modules) { """ Returns the newest last modified time of the files in the list @param aggregator @param modules The list of ModuleFile objects @return The newest last modified time of all the files in the list """ long result = 0L; for (ModuleList.ModuleListEntry entry : modules) { IResource resource = entry.getModule().getResource(aggregator); long lastMod = resource.lastModified(); result = Math.max(result, lastMod); } return result; }
java
protected long getLastModified(IAggregator aggregator, ModuleList modules) { long result = 0L; for (ModuleList.ModuleListEntry entry : modules) { IResource resource = entry.getModule().getResource(aggregator); long lastMod = resource.lastModified(); result = Math.max(result, lastMod); } return result; }
[ "protected", "long", "getLastModified", "(", "IAggregator", "aggregator", ",", "ModuleList", "modules", ")", "{", "long", "result", "=", "0L", ";", "for", "(", "ModuleList", ".", "ModuleListEntry", "entry", ":", "modules", ")", "{", "IResource", "resource", "=", "entry", ".", "getModule", "(", ")", ".", "getResource", "(", "aggregator", ")", ";", "long", "lastMod", "=", "resource", ".", "lastModified", "(", ")", ";", "result", "=", "Math", ".", "max", "(", "result", ",", "lastMod", ")", ";", "}", "return", "result", ";", "}" ]
Returns the newest last modified time of the files in the list @param aggregator @param modules The list of ModuleFile objects @return The newest last modified time of all the files in the list
[ "Returns", "the", "newest", "last", "modified", "time", "of", "the", "files", "in", "the", "list" ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java#L1031-L1039
mozilla/rhino
src/org/mozilla/javascript/Context.java
Context.decompileFunction
public final String decompileFunction(Function fun, int indent) { """ Decompile a JavaScript Function. <p> Decompiles a previously compiled JavaScript function object to canonical source. <p> Returns function body of '[native code]' if no decompilation information is available. @param fun the JavaScript function to decompile @param indent the number of spaces to indent the result @return a string representing the function source """ if (fun instanceof BaseFunction) return ((BaseFunction)fun).decompile(indent, 0); return "function " + fun.getClassName() + "() {\n\t[native code]\n}\n"; }
java
public final String decompileFunction(Function fun, int indent) { if (fun instanceof BaseFunction) return ((BaseFunction)fun).decompile(indent, 0); return "function " + fun.getClassName() + "() {\n\t[native code]\n}\n"; }
[ "public", "final", "String", "decompileFunction", "(", "Function", "fun", ",", "int", "indent", ")", "{", "if", "(", "fun", "instanceof", "BaseFunction", ")", "return", "(", "(", "BaseFunction", ")", "fun", ")", ".", "decompile", "(", "indent", ",", "0", ")", ";", "return", "\"function \"", "+", "fun", ".", "getClassName", "(", ")", "+", "\"() {\\n\\t[native code]\\n}\\n\"", ";", "}" ]
Decompile a JavaScript Function. <p> Decompiles a previously compiled JavaScript function object to canonical source. <p> Returns function body of '[native code]' if no decompilation information is available. @param fun the JavaScript function to decompile @param indent the number of spaces to indent the result @return a string representing the function source
[ "Decompile", "a", "JavaScript", "Function", ".", "<p", ">", "Decompiles", "a", "previously", "compiled", "JavaScript", "function", "object", "to", "canonical", "source", ".", "<p", ">", "Returns", "function", "body", "of", "[", "native", "code", "]", "if", "no", "decompilation", "information", "is", "available", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1599-L1605
headius/invokebinder
src/main/java/com/headius/invokebinder/Binder.java
Binder.setFieldQuiet
public MethodHandle setFieldQuiet(MethodHandles.Lookup lookup, String name) { """ Apply the chain of transforms and bind them to an object field assignment specified using the end signature plus the given class and name. The end signature must take the target class or a subclass and the field's type as its arguments, and its return type must be compatible with void. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted. This version is "quiet" in that it throws an unchecked InvalidTransformException if the target method does not exist or is inaccessible. @param lookup the MethodHandles.Lookup to use to look up the field @param name the field's name @return the full handle chain, bound to the given field assignment """ try { return setField(lookup, name); } catch (IllegalAccessException | NoSuchFieldException e) { throw new InvalidTransformException(e); } }
java
public MethodHandle setFieldQuiet(MethodHandles.Lookup lookup, String name) { try { return setField(lookup, name); } catch (IllegalAccessException | NoSuchFieldException e) { throw new InvalidTransformException(e); } }
[ "public", "MethodHandle", "setFieldQuiet", "(", "MethodHandles", ".", "Lookup", "lookup", ",", "String", "name", ")", "{", "try", "{", "return", "setField", "(", "lookup", ",", "name", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "NoSuchFieldException", "e", ")", "{", "throw", "new", "InvalidTransformException", "(", "e", ")", ";", "}", "}" ]
Apply the chain of transforms and bind them to an object field assignment specified using the end signature plus the given class and name. The end signature must take the target class or a subclass and the field's type as its arguments, and its return type must be compatible with void. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted. This version is "quiet" in that it throws an unchecked InvalidTransformException if the target method does not exist or is inaccessible. @param lookup the MethodHandles.Lookup to use to look up the field @param name the field's name @return the full handle chain, bound to the given field assignment
[ "Apply", "the", "chain", "of", "transforms", "and", "bind", "them", "to", "an", "object", "field", "assignment", "specified", "using", "the", "end", "signature", "plus", "the", "given", "class", "and", "name", ".", "The", "end", "signature", "must", "take", "the", "target", "class", "or", "a", "subclass", "and", "the", "field", "s", "type", "as", "its", "arguments", "and", "its", "return", "type", "must", "be", "compatible", "with", "void", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1495-L1501
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java
FileUtilsV2_2.openOutputStream
public static FileOutputStream openOutputStream(File file, boolean append) throws IOException { """ Opens a {@link FileOutputStream} for the specified file, checking and creating the parent directory if it does not exist. <p> At the end of the method either the stream will be successfully opened, or an exception will have been thrown. <p> The parent directory will be created if it does not exist. The file will be created if it does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be written to. An exception is thrown if the parent directory cannot be created. @param file the file to open for output, must not be <code>null</code> @param append if <code>true</code>, then bytes will be added to the end of the file rather than overwriting @return a new {@link FileOutputStream} for the specified file @throws IOException if the file object is a directory @throws IOException if the file cannot be written to @throws IOException if a parent directory needs creating but that fails @since 2.1 """ if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); } if (file.canWrite() == false) { throw new IOException("File '" + file + "' cannot be written to"); } } else { File parent = file.getParentFile(); if (parent != null) { if (!parent.mkdirs() && !parent.isDirectory()) { throw new IOException("Directory '" + parent + "' could not be created"); } } } return new FileOutputStream(file, append); }
java
public static FileOutputStream openOutputStream(File file, boolean append) throws IOException { if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); } if (file.canWrite() == false) { throw new IOException("File '" + file + "' cannot be written to"); } } else { File parent = file.getParentFile(); if (parent != null) { if (!parent.mkdirs() && !parent.isDirectory()) { throw new IOException("Directory '" + parent + "' could not be created"); } } } return new FileOutputStream(file, append); }
[ "public", "static", "FileOutputStream", "openOutputStream", "(", "File", "file", ",", "boolean", "append", ")", "throws", "IOException", "{", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"File '\"", "+", "file", "+", "\"' exists but is a directory\"", ")", ";", "}", "if", "(", "file", ".", "canWrite", "(", ")", "==", "false", ")", "{", "throw", "new", "IOException", "(", "\"File '\"", "+", "file", "+", "\"' cannot be written to\"", ")", ";", "}", "}", "else", "{", "File", "parent", "=", "file", ".", "getParentFile", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "if", "(", "!", "parent", ".", "mkdirs", "(", ")", "&&", "!", "parent", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Directory '\"", "+", "parent", "+", "\"' could not be created\"", ")", ";", "}", "}", "}", "return", "new", "FileOutputStream", "(", "file", ",", "append", ")", ";", "}" ]
Opens a {@link FileOutputStream} for the specified file, checking and creating the parent directory if it does not exist. <p> At the end of the method either the stream will be successfully opened, or an exception will have been thrown. <p> The parent directory will be created if it does not exist. The file will be created if it does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be written to. An exception is thrown if the parent directory cannot be created. @param file the file to open for output, must not be <code>null</code> @param append if <code>true</code>, then bytes will be added to the end of the file rather than overwriting @return a new {@link FileOutputStream} for the specified file @throws IOException if the file object is a directory @throws IOException if the file cannot be written to @throws IOException if a parent directory needs creating but that fails @since 2.1
[ "Opens", "a", "{", "@link", "FileOutputStream", "}", "for", "the", "specified", "file", "checking", "and", "creating", "the", "parent", "directory", "if", "it", "does", "not", "exist", ".", "<p", ">", "At", "the", "end", "of", "the", "method", "either", "the", "stream", "will", "be", "successfully", "opened", "or", "an", "exception", "will", "have", "been", "thrown", ".", "<p", ">", "The", "parent", "directory", "will", "be", "created", "if", "it", "does", "not", "exist", ".", "The", "file", "will", "be", "created", "if", "it", "does", "not", "exist", ".", "An", "exception", "is", "thrown", "if", "the", "file", "object", "exists", "but", "is", "a", "directory", ".", "An", "exception", "is", "thrown", "if", "the", "file", "exists", "but", "cannot", "be", "written", "to", ".", "An", "exception", "is", "thrown", "if", "the", "parent", "directory", "cannot", "be", "created", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/FileUtilsV2_2.java#L195-L212
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/RegionMap.java
RegionMap.toSubRegion
public RegionMap toSubRegion( double n, double s, double w, double e ) { """ Creates a new {@link RegionMap} cropped on the new bounds and snapped on the original grid. <p><b>The supplied bounds are contained in the resulting region.</b></p> @param n the new north. @param s the new south. @param w the new west. @param e the new east. @return the new {@link RegionMap}. """ double originalXres = getXres(); double originalYres = getYres(); double originalWest = getWest(); double originalSouth = getSouth(); double envWest = w; double deltaX = (envWest - originalWest) % originalXres; double newWest = envWest - deltaX; double envSouth = s; double deltaY = (envSouth - originalSouth) % originalYres; double newSouth = envSouth - deltaY; double newWidth = e - w; double deltaW = newWidth % originalXres; newWidth = newWidth - deltaW + originalXres; double newHeight = n - s; double deltaH = newHeight % originalYres; newHeight = newHeight - deltaH + originalYres; double newNorth = newSouth + newHeight; double newEast = newWest + newWidth; int rows = (int) ((newHeight) / originalYres); int cols = (int) ((newWidth) / originalXres); double newXres = (newWidth) / cols; double newYres = (newHeight) / rows; RegionMap regionMap = CoverageUtilities.makeRegionParamsMap(newNorth, newSouth, newWest, newEast, newXres, newYres, cols, rows); return regionMap; }
java
public RegionMap toSubRegion( double n, double s, double w, double e ) { double originalXres = getXres(); double originalYres = getYres(); double originalWest = getWest(); double originalSouth = getSouth(); double envWest = w; double deltaX = (envWest - originalWest) % originalXres; double newWest = envWest - deltaX; double envSouth = s; double deltaY = (envSouth - originalSouth) % originalYres; double newSouth = envSouth - deltaY; double newWidth = e - w; double deltaW = newWidth % originalXres; newWidth = newWidth - deltaW + originalXres; double newHeight = n - s; double deltaH = newHeight % originalYres; newHeight = newHeight - deltaH + originalYres; double newNorth = newSouth + newHeight; double newEast = newWest + newWidth; int rows = (int) ((newHeight) / originalYres); int cols = (int) ((newWidth) / originalXres); double newXres = (newWidth) / cols; double newYres = (newHeight) / rows; RegionMap regionMap = CoverageUtilities.makeRegionParamsMap(newNorth, newSouth, newWest, newEast, newXres, newYres, cols, rows); return regionMap; }
[ "public", "RegionMap", "toSubRegion", "(", "double", "n", ",", "double", "s", ",", "double", "w", ",", "double", "e", ")", "{", "double", "originalXres", "=", "getXres", "(", ")", ";", "double", "originalYres", "=", "getYres", "(", ")", ";", "double", "originalWest", "=", "getWest", "(", ")", ";", "double", "originalSouth", "=", "getSouth", "(", ")", ";", "double", "envWest", "=", "w", ";", "double", "deltaX", "=", "(", "envWest", "-", "originalWest", ")", "%", "originalXres", ";", "double", "newWest", "=", "envWest", "-", "deltaX", ";", "double", "envSouth", "=", "s", ";", "double", "deltaY", "=", "(", "envSouth", "-", "originalSouth", ")", "%", "originalYres", ";", "double", "newSouth", "=", "envSouth", "-", "deltaY", ";", "double", "newWidth", "=", "e", "-", "w", ";", "double", "deltaW", "=", "newWidth", "%", "originalXres", ";", "newWidth", "=", "newWidth", "-", "deltaW", "+", "originalXres", ";", "double", "newHeight", "=", "n", "-", "s", ";", "double", "deltaH", "=", "newHeight", "%", "originalYres", ";", "newHeight", "=", "newHeight", "-", "deltaH", "+", "originalYres", ";", "double", "newNorth", "=", "newSouth", "+", "newHeight", ";", "double", "newEast", "=", "newWest", "+", "newWidth", ";", "int", "rows", "=", "(", "int", ")", "(", "(", "newHeight", ")", "/", "originalYres", ")", ";", "int", "cols", "=", "(", "int", ")", "(", "(", "newWidth", ")", "/", "originalXres", ")", ";", "double", "newXres", "=", "(", "newWidth", ")", "/", "cols", ";", "double", "newYres", "=", "(", "newHeight", ")", "/", "rows", ";", "RegionMap", "regionMap", "=", "CoverageUtilities", ".", "makeRegionParamsMap", "(", "newNorth", ",", "newSouth", ",", "newWest", ",", "newEast", ",", "newXres", ",", "newYres", ",", "cols", ",", "rows", ")", ";", "return", "regionMap", ";", "}" ]
Creates a new {@link RegionMap} cropped on the new bounds and snapped on the original grid. <p><b>The supplied bounds are contained in the resulting region.</b></p> @param n the new north. @param s the new south. @param w the new west. @param e the new east. @return the new {@link RegionMap}.
[ "Creates", "a", "new", "{", "@link", "RegionMap", "}", "cropped", "on", "the", "new", "bounds", "and", "snapped", "on", "the", "original", "grid", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/RegionMap.java#L214-L248
EdwardRaff/JSAT
JSAT/src/jsat/utils/IntSortedSet.java
IntSortedSet.batch_insert
private void batch_insert(Collection<Integer> set, boolean parallel) { """ more efficient insertion of many items by placing them all into the backing store, and then doing one large sort. @param set @param parallel """ for(int i : set) store[size++] = i; if(parallel) Arrays.parallelSort(store, 0, size); else Arrays.sort(store, 0, size); }
java
private void batch_insert(Collection<Integer> set, boolean parallel) { for(int i : set) store[size++] = i; if(parallel) Arrays.parallelSort(store, 0, size); else Arrays.sort(store, 0, size); }
[ "private", "void", "batch_insert", "(", "Collection", "<", "Integer", ">", "set", ",", "boolean", "parallel", ")", "{", "for", "(", "int", "i", ":", "set", ")", "store", "[", "size", "++", "]", "=", "i", ";", "if", "(", "parallel", ")", "Arrays", ".", "parallelSort", "(", "store", ",", "0", ",", "size", ")", ";", "else", "Arrays", ".", "sort", "(", "store", ",", "0", ",", "size", ")", ";", "}" ]
more efficient insertion of many items by placing them all into the backing store, and then doing one large sort. @param set @param parallel
[ "more", "efficient", "insertion", "of", "many", "items", "by", "placing", "them", "all", "into", "the", "backing", "store", "and", "then", "doing", "one", "large", "sort", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/IntSortedSet.java#L71-L79
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setBaselineBudgetCost
public void setBaselineBudgetCost(int baselineNumber, Number value) { """ Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value """ set(selectField(AssignmentFieldLists.BASELINE_BUDGET_COSTS, baselineNumber), value); }
java
public void setBaselineBudgetCost(int baselineNumber, Number value) { set(selectField(AssignmentFieldLists.BASELINE_BUDGET_COSTS, baselineNumber), value); }
[ "public", "void", "setBaselineBudgetCost", "(", "int", "baselineNumber", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "BASELINE_BUDGET_COSTS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1474-L1477
alkacon/opencms-core
src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
CmsDefaultXmlContentHandler.initFields
protected void initFields(Element parent, CmsXmlContentDefinition contentDef) throws CmsXmlException { """ Processes all field declarations in the schema.<p> @param parent the parent element @param contentDef the content definition @throws CmsXmlException if something goes wrong """ for (Element fieldElem : parent.elements(N_SETTING)) { initField(fieldElem, contentDef); } }
java
protected void initFields(Element parent, CmsXmlContentDefinition contentDef) throws CmsXmlException { for (Element fieldElem : parent.elements(N_SETTING)) { initField(fieldElem, contentDef); } }
[ "protected", "void", "initFields", "(", "Element", "parent", ",", "CmsXmlContentDefinition", "contentDef", ")", "throws", "CmsXmlException", "{", "for", "(", "Element", "fieldElem", ":", "parent", ".", "elements", "(", "N_SETTING", ")", ")", "{", "initField", "(", "fieldElem", ",", "contentDef", ")", ";", "}", "}" ]
Processes all field declarations in the schema.<p> @param parent the parent element @param contentDef the content definition @throws CmsXmlException if something goes wrong
[ "Processes", "all", "field", "declarations", "in", "the", "schema", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L2612-L2617
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesByteArrayImpl.java
DoublesByteArrayImpl.convertToByteArray
private static byte[] convertToByteArray(final DoublesSketch sketch, final int flags, final boolean ordered, final boolean compact) { """ Returns a byte array, including preamble, min, max and data extracted from the sketch. @param sketch the given DoublesSketch @param flags the Flags field @param ordered true if the desired form of the resulting array has the base buffer sorted. @param compact true if the desired form of the resulting array is in compact form. @return a byte array, including preamble, min, max and data extracted from the Combined Buffer. """ final int preLongs = 2; final int extra = 2; // extra space for min and max values final int prePlusExtraBytes = (preLongs + extra) << 3; final int k = sketch.getK(); final long n = sketch.getN(); // If not-compact, have accessor always report full levels. Then use level size to determine // whether to copy data out. final DoublesSketchAccessor dsa = DoublesSketchAccessor.wrap(sketch, !compact); final int outBytes = (compact ? sketch.getCompactStorageBytes() : sketch.getUpdatableStorageBytes()); final byte[] outByteArr = new byte[outBytes]; final WritableMemory memOut = WritableMemory.wrap(outByteArr); //insert preamble-0, N, min, max insertPre0(memOut, preLongs, flags, k); if (sketch.isEmpty()) { return outByteArr; } insertN(memOut, n); insertMinDouble(memOut, sketch.getMinValue()); insertMaxDouble(memOut, sketch.getMaxValue()); long memOffsetBytes = prePlusExtraBytes; // might need to sort base buffer but don't want to change input sketch final int bbCnt = Util.computeBaseBufferItems(k, n); if (bbCnt > 0) { //Base buffer items only final double[] bbItemsArr = dsa.getArray(0, bbCnt); if (ordered) { Arrays.sort(bbItemsArr); } memOut.putDoubleArray(memOffsetBytes, bbItemsArr, 0, bbCnt); } // If n < 2k, totalLevels == 0 so ok to overshoot the offset update memOffsetBytes += (compact ? bbCnt : 2 * k) << 3; // If serializing from a compact sketch to a non-compact form, we may end up copying data for a // higher level one or more times into an unused level. A bit wasteful, but not incorrect. final int totalLevels = Util.computeTotalLevels(sketch.getBitPattern()); for (int lvl = 0; lvl < totalLevels; ++lvl) { dsa.setLevel(lvl); if (dsa.numItems() > 0) { assert dsa.numItems() == k; memOut.putDoubleArray(memOffsetBytes, dsa.getArray(0, k), 0, k); memOffsetBytes += (k << 3); } } return outByteArr; }
java
private static byte[] convertToByteArray(final DoublesSketch sketch, final int flags, final boolean ordered, final boolean compact) { final int preLongs = 2; final int extra = 2; // extra space for min and max values final int prePlusExtraBytes = (preLongs + extra) << 3; final int k = sketch.getK(); final long n = sketch.getN(); // If not-compact, have accessor always report full levels. Then use level size to determine // whether to copy data out. final DoublesSketchAccessor dsa = DoublesSketchAccessor.wrap(sketch, !compact); final int outBytes = (compact ? sketch.getCompactStorageBytes() : sketch.getUpdatableStorageBytes()); final byte[] outByteArr = new byte[outBytes]; final WritableMemory memOut = WritableMemory.wrap(outByteArr); //insert preamble-0, N, min, max insertPre0(memOut, preLongs, flags, k); if (sketch.isEmpty()) { return outByteArr; } insertN(memOut, n); insertMinDouble(memOut, sketch.getMinValue()); insertMaxDouble(memOut, sketch.getMaxValue()); long memOffsetBytes = prePlusExtraBytes; // might need to sort base buffer but don't want to change input sketch final int bbCnt = Util.computeBaseBufferItems(k, n); if (bbCnt > 0) { //Base buffer items only final double[] bbItemsArr = dsa.getArray(0, bbCnt); if (ordered) { Arrays.sort(bbItemsArr); } memOut.putDoubleArray(memOffsetBytes, bbItemsArr, 0, bbCnt); } // If n < 2k, totalLevels == 0 so ok to overshoot the offset update memOffsetBytes += (compact ? bbCnt : 2 * k) << 3; // If serializing from a compact sketch to a non-compact form, we may end up copying data for a // higher level one or more times into an unused level. A bit wasteful, but not incorrect. final int totalLevels = Util.computeTotalLevels(sketch.getBitPattern()); for (int lvl = 0; lvl < totalLevels; ++lvl) { dsa.setLevel(lvl); if (dsa.numItems() > 0) { assert dsa.numItems() == k; memOut.putDoubleArray(memOffsetBytes, dsa.getArray(0, k), 0, k); memOffsetBytes += (k << 3); } } return outByteArr; }
[ "private", "static", "byte", "[", "]", "convertToByteArray", "(", "final", "DoublesSketch", "sketch", ",", "final", "int", "flags", ",", "final", "boolean", "ordered", ",", "final", "boolean", "compact", ")", "{", "final", "int", "preLongs", "=", "2", ";", "final", "int", "extra", "=", "2", ";", "// extra space for min and max values", "final", "int", "prePlusExtraBytes", "=", "(", "preLongs", "+", "extra", ")", "<<", "3", ";", "final", "int", "k", "=", "sketch", ".", "getK", "(", ")", ";", "final", "long", "n", "=", "sketch", ".", "getN", "(", ")", ";", "// If not-compact, have accessor always report full levels. Then use level size to determine", "// whether to copy data out.", "final", "DoublesSketchAccessor", "dsa", "=", "DoublesSketchAccessor", ".", "wrap", "(", "sketch", ",", "!", "compact", ")", ";", "final", "int", "outBytes", "=", "(", "compact", "?", "sketch", ".", "getCompactStorageBytes", "(", ")", ":", "sketch", ".", "getUpdatableStorageBytes", "(", ")", ")", ";", "final", "byte", "[", "]", "outByteArr", "=", "new", "byte", "[", "outBytes", "]", ";", "final", "WritableMemory", "memOut", "=", "WritableMemory", ".", "wrap", "(", "outByteArr", ")", ";", "//insert preamble-0, N, min, max", "insertPre0", "(", "memOut", ",", "preLongs", ",", "flags", ",", "k", ")", ";", "if", "(", "sketch", ".", "isEmpty", "(", ")", ")", "{", "return", "outByteArr", ";", "}", "insertN", "(", "memOut", ",", "n", ")", ";", "insertMinDouble", "(", "memOut", ",", "sketch", ".", "getMinValue", "(", ")", ")", ";", "insertMaxDouble", "(", "memOut", ",", "sketch", ".", "getMaxValue", "(", ")", ")", ";", "long", "memOffsetBytes", "=", "prePlusExtraBytes", ";", "// might need to sort base buffer but don't want to change input sketch", "final", "int", "bbCnt", "=", "Util", ".", "computeBaseBufferItems", "(", "k", ",", "n", ")", ";", "if", "(", "bbCnt", ">", "0", ")", "{", "//Base buffer items only", "final", "double", "[", "]", "bbItemsArr", "=", "dsa", ".", "getArray", "(", "0", ",", "bbCnt", ")", ";", "if", "(", "ordered", ")", "{", "Arrays", ".", "sort", "(", "bbItemsArr", ")", ";", "}", "memOut", ".", "putDoubleArray", "(", "memOffsetBytes", ",", "bbItemsArr", ",", "0", ",", "bbCnt", ")", ";", "}", "// If n < 2k, totalLevels == 0 so ok to overshoot the offset update", "memOffsetBytes", "+=", "(", "compact", "?", "bbCnt", ":", "2", "*", "k", ")", "<<", "3", ";", "// If serializing from a compact sketch to a non-compact form, we may end up copying data for a", "// higher level one or more times into an unused level. A bit wasteful, but not incorrect.", "final", "int", "totalLevels", "=", "Util", ".", "computeTotalLevels", "(", "sketch", ".", "getBitPattern", "(", ")", ")", ";", "for", "(", "int", "lvl", "=", "0", ";", "lvl", "<", "totalLevels", ";", "++", "lvl", ")", "{", "dsa", ".", "setLevel", "(", "lvl", ")", ";", "if", "(", "dsa", ".", "numItems", "(", ")", ">", "0", ")", "{", "assert", "dsa", ".", "numItems", "(", ")", "==", "k", ";", "memOut", ".", "putDoubleArray", "(", "memOffsetBytes", ",", "dsa", ".", "getArray", "(", "0", ",", "k", ")", ",", "0", ",", "k", ")", ";", "memOffsetBytes", "+=", "(", "k", "<<", "3", ")", ";", "}", "}", "return", "outByteArr", ";", "}" ]
Returns a byte array, including preamble, min, max and data extracted from the sketch. @param sketch the given DoublesSketch @param flags the Flags field @param ordered true if the desired form of the resulting array has the base buffer sorted. @param compact true if the desired form of the resulting array is in compact form. @return a byte array, including preamble, min, max and data extracted from the Combined Buffer.
[ "Returns", "a", "byte", "array", "including", "preamble", "min", "max", "and", "data", "extracted", "from", "the", "sketch", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesByteArrayImpl.java#L64-L114
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java
AmazonDynamoDBClient.deleteTable
public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) throws AmazonServiceException, AmazonClientException { """ <p> Deletes a table and all of its items. </p> <p> If the table is in the <code>ACTIVE</code> state, you can delete it. If a table is in <code>CREATING</code> or <code>UPDATING</code> states then Amazon DynamoDB returns a <code>ResourceInUseException</code> . If the specified table does not exist, Amazon DynamoDB returns a <code>ResourceNotFoundException</code> . </p> @param deleteTableRequest Container for the necessary parameters to execute the DeleteTable service method on AmazonDynamoDB. @return The response from the DeleteTable service method, as returned by AmazonDynamoDB. @throws ResourceInUseException @throws LimitExceededException @throws InternalServerErrorException @throws ResourceNotFoundException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonDynamoDB indicating either a problem with the data in the request, or a server side issue. """ ExecutionContext executionContext = createExecutionContext(deleteTableRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<DeleteTableRequest> request = marshall(deleteTableRequest, new DeleteTableRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<DeleteTableResult, JsonUnmarshallerContext> unmarshaller = new DeleteTableResultJsonUnmarshaller(); JsonResponseHandler<DeleteTableResult> responseHandler = new JsonResponseHandler<DeleteTableResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
java
public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) throws AmazonServiceException, AmazonClientException { ExecutionContext executionContext = createExecutionContext(deleteTableRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<DeleteTableRequest> request = marshall(deleteTableRequest, new DeleteTableRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<DeleteTableResult, JsonUnmarshallerContext> unmarshaller = new DeleteTableResultJsonUnmarshaller(); JsonResponseHandler<DeleteTableResult> responseHandler = new JsonResponseHandler<DeleteTableResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
[ "public", "DeleteTableResult", "deleteTable", "(", "DeleteTableRequest", "deleteTableRequest", ")", "throws", "AmazonServiceException", ",", "AmazonClientException", "{", "ExecutionContext", "executionContext", "=", "createExecutionContext", "(", "deleteTableRequest", ")", ";", "AWSRequestMetrics", "awsRequestMetrics", "=", "executionContext", ".", "getAwsRequestMetrics", "(", ")", ";", "Request", "<", "DeleteTableRequest", ">", "request", "=", "marshall", "(", "deleteTableRequest", ",", "new", "DeleteTableRequestMarshaller", "(", ")", ",", "executionContext", ".", "getAwsRequestMetrics", "(", ")", ")", ";", "// Binds the request metrics to the current request.", "request", ".", "setAWSRequestMetrics", "(", "awsRequestMetrics", ")", ";", "Unmarshaller", "<", "DeleteTableResult", ",", "JsonUnmarshallerContext", ">", "unmarshaller", "=", "new", "DeleteTableResultJsonUnmarshaller", "(", ")", ";", "JsonResponseHandler", "<", "DeleteTableResult", ">", "responseHandler", "=", "new", "JsonResponseHandler", "<", "DeleteTableResult", ">", "(", "unmarshaller", ")", ";", "return", "invoke", "(", "request", ",", "responseHandler", ",", "executionContext", ")", ";", "}" ]
<p> Deletes a table and all of its items. </p> <p> If the table is in the <code>ACTIVE</code> state, you can delete it. If a table is in <code>CREATING</code> or <code>UPDATING</code> states then Amazon DynamoDB returns a <code>ResourceInUseException</code> . If the specified table does not exist, Amazon DynamoDB returns a <code>ResourceNotFoundException</code> . </p> @param deleteTableRequest Container for the necessary parameters to execute the DeleteTable service method on AmazonDynamoDB. @return The response from the DeleteTable service method, as returned by AmazonDynamoDB. @throws ResourceInUseException @throws LimitExceededException @throws InternalServerErrorException @throws ResourceNotFoundException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonDynamoDB indicating either a problem with the data in the request, or a server side issue.
[ "<p", ">", "Deletes", "a", "table", "and", "all", "of", "its", "items", ".", "<", "/", "p", ">", "<p", ">", "If", "the", "table", "is", "in", "the", "<code", ">", "ACTIVE<", "/", "code", ">", "state", "you", "can", "delete", "it", ".", "If", "a", "table", "is", "in", "<code", ">", "CREATING<", "/", "code", ">", "or", "<code", ">", "UPDATING<", "/", "code", ">", "states", "then", "Amazon", "DynamoDB", "returns", "a", "<code", ">", "ResourceInUseException<", "/", "code", ">", ".", "If", "the", "specified", "table", "does", "not", "exist", "Amazon", "DynamoDB", "returns", "a", "<code", ">", "ResourceNotFoundException<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L766-L778
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java
TopicsInner.regenerateKey
public TopicSharedAccessKeysInner regenerateKey(String resourceGroupName, String topicName, String keyName) { """ Regenerate key for a topic. Regenerate a shared access key for a topic. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @param keyName Key name to regenerate key1 or key2 @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 TopicSharedAccessKeysInner object if successful. """ return regenerateKeyWithServiceResponseAsync(resourceGroupName, topicName, keyName).toBlocking().single().body(); }
java
public TopicSharedAccessKeysInner regenerateKey(String resourceGroupName, String topicName, String keyName) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, topicName, keyName).toBlocking().single().body(); }
[ "public", "TopicSharedAccessKeysInner", "regenerateKey", "(", "String", "resourceGroupName", ",", "String", "topicName", ",", "String", "keyName", ")", "{", "return", "regenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "topicName", ",", "keyName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Regenerate key for a topic. Regenerate a shared access key for a topic. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @param keyName Key name to regenerate key1 or key2 @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 TopicSharedAccessKeysInner object if successful.
[ "Regenerate", "key", "for", "a", "topic", ".", "Regenerate", "a", "shared", "access", "key", "for", "a", "topic", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L1167-L1169
Erudika/para
para-server/src/main/java/com/erudika/para/utils/GZipResponseUtil.java
GZipResponseUtil.shouldGzippedBodyBeZero
public static boolean shouldGzippedBodyBeZero(byte[] compressedBytes, HttpServletRequest request) { """ Checks whether a gzipped body is actually empty and should just be zero. When the compressedBytes is {@link #EMPTY_GZIPPED_CONTENT_SIZE} it should be zero. @param compressedBytes the gzipped response body @param request the client HTTP request @return true if the response should be 0, even if it is isn't. """ //Check for 0 length body if (compressedBytes.length == EMPTY_GZIPPED_CONTENT_SIZE) { if (log.isTraceEnabled()) { log.trace("{} resulted in an empty response.", request.getRequestURL()); } return true; } else { return false; } }
java
public static boolean shouldGzippedBodyBeZero(byte[] compressedBytes, HttpServletRequest request) { //Check for 0 length body if (compressedBytes.length == EMPTY_GZIPPED_CONTENT_SIZE) { if (log.isTraceEnabled()) { log.trace("{} resulted in an empty response.", request.getRequestURL()); } return true; } else { return false; } }
[ "public", "static", "boolean", "shouldGzippedBodyBeZero", "(", "byte", "[", "]", "compressedBytes", ",", "HttpServletRequest", "request", ")", "{", "//Check for 0 length body", "if", "(", "compressedBytes", ".", "length", "==", "EMPTY_GZIPPED_CONTENT_SIZE", ")", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "log", ".", "trace", "(", "\"{} resulted in an empty response.\"", ",", "request", ".", "getRequestURL", "(", ")", ")", ";", "}", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Checks whether a gzipped body is actually empty and should just be zero. When the compressedBytes is {@link #EMPTY_GZIPPED_CONTENT_SIZE} it should be zero. @param compressedBytes the gzipped response body @param request the client HTTP request @return true if the response should be 0, even if it is isn't.
[ "Checks", "whether", "a", "gzipped", "body", "is", "actually", "empty", "and", "should", "just", "be", "zero", ".", "When", "the", "compressedBytes", "is", "{" ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/utils/GZipResponseUtil.java#L56-L67
aws/aws-sdk-java
aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/message/SignatureVerifier.java
SignatureVerifier.downloadCert
private String downloadCert(URI certUrl) { """ Downloads the certificate from the provided URL. Asserts that the endpoint is an SNS endpoint and that the certificate is vended over HTTPs. @param certUrl URL to download certificate from. @return String contents of certificate. @throws SdkClientException If certificate cannot be downloaded or URL is invalid. """ try { signingCertUrlVerifier.verifyCertUrl(certUrl); HttpResponse response = client.execute(new HttpGet(certUrl)); if (ApacheUtils.isRequestSuccessful(response)) { try { return IOUtils.toString(response.getEntity().getContent()); } finally { response.getEntity().getContent().close(); } } else { throw new HttpException("Could not download the certificate from SNS", response); } } catch (IOException e) { throw new SdkClientException("Unable to download SNS certificate from " + certUrl.toString(), e); } }
java
private String downloadCert(URI certUrl) { try { signingCertUrlVerifier.verifyCertUrl(certUrl); HttpResponse response = client.execute(new HttpGet(certUrl)); if (ApacheUtils.isRequestSuccessful(response)) { try { return IOUtils.toString(response.getEntity().getContent()); } finally { response.getEntity().getContent().close(); } } else { throw new HttpException("Could not download the certificate from SNS", response); } } catch (IOException e) { throw new SdkClientException("Unable to download SNS certificate from " + certUrl.toString(), e); } }
[ "private", "String", "downloadCert", "(", "URI", "certUrl", ")", "{", "try", "{", "signingCertUrlVerifier", ".", "verifyCertUrl", "(", "certUrl", ")", ";", "HttpResponse", "response", "=", "client", ".", "execute", "(", "new", "HttpGet", "(", "certUrl", ")", ")", ";", "if", "(", "ApacheUtils", ".", "isRequestSuccessful", "(", "response", ")", ")", "{", "try", "{", "return", "IOUtils", ".", "toString", "(", "response", ".", "getEntity", "(", ")", ".", "getContent", "(", ")", ")", ";", "}", "finally", "{", "response", ".", "getEntity", "(", ")", ".", "getContent", "(", ")", ".", "close", "(", ")", ";", "}", "}", "else", "{", "throw", "new", "HttpException", "(", "\"Could not download the certificate from SNS\"", ",", "response", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "SdkClientException", "(", "\"Unable to download SNS certificate from \"", "+", "certUrl", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "}" ]
Downloads the certificate from the provided URL. Asserts that the endpoint is an SNS endpoint and that the certificate is vended over HTTPs. @param certUrl URL to download certificate from. @return String contents of certificate. @throws SdkClientException If certificate cannot be downloaded or URL is invalid.
[ "Downloads", "the", "certificate", "from", "the", "provided", "URL", ".", "Asserts", "that", "the", "endpoint", "is", "an", "SNS", "endpoint", "and", "that", "the", "certificate", "is", "vended", "over", "HTTPs", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/message/SignatureVerifier.java#L156-L172
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibServlet.java
ClientlibServlet.makePath
public static String makePath(String path, Clientlib.Type type, boolean minified, String hash) { """ Creates an path that is rendered by this servlet containing the given parameters. """ StringBuilder builder = new StringBuilder(path); if (minified) builder.append(".min"); if (!path.endsWith("." + type.name()) && type != Clientlib.Type.img && type != Clientlib.Type.link) { builder.append('.').append(type.name()); // relevant for categories } return appendHashSuffix(builder.toString(), hash); }
java
public static String makePath(String path, Clientlib.Type type, boolean minified, String hash) { StringBuilder builder = new StringBuilder(path); if (minified) builder.append(".min"); if (!path.endsWith("." + type.name()) && type != Clientlib.Type.img && type != Clientlib.Type.link) { builder.append('.').append(type.name()); // relevant for categories } return appendHashSuffix(builder.toString(), hash); }
[ "public", "static", "String", "makePath", "(", "String", "path", ",", "Clientlib", ".", "Type", "type", ",", "boolean", "minified", ",", "String", "hash", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "path", ")", ";", "if", "(", "minified", ")", "builder", ".", "append", "(", "\".min\"", ")", ";", "if", "(", "!", "path", ".", "endsWith", "(", "\".\"", "+", "type", ".", "name", "(", ")", ")", "&&", "type", "!=", "Clientlib", ".", "Type", ".", "img", "&&", "type", "!=", "Clientlib", ".", "Type", ".", "link", ")", "{", "builder", ".", "append", "(", "'", "'", ")", ".", "append", "(", "type", ".", "name", "(", ")", ")", ";", "// relevant for categories", "}", "return", "appendHashSuffix", "(", "builder", ".", "toString", "(", ")", ",", "hash", ")", ";", "}" ]
Creates an path that is rendered by this servlet containing the given parameters.
[ "Creates", "an", "path", "that", "is", "rendered", "by", "this", "servlet", "containing", "the", "given", "parameters", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibServlet.java#L64-L71
tango-controls/JTango
client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java
InsertExtractUtils.extractRead
public static Object extractRead(final DeviceAttribute da, final AttrDataFormat format) throws DevFailed { """ Extract read values to an object for SCALAR, SPECTRUM and IMAGE @param da @return single value for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE @throws DevFailed """ if (da == null) { throw DevFailedUtils.newDevFailed(ERROR_MSG_DA); } return InsertExtractFactory.getAttributeExtractor(da.getType()).extractRead(da, format); }
java
public static Object extractRead(final DeviceAttribute da, final AttrDataFormat format) throws DevFailed { if (da == null) { throw DevFailedUtils.newDevFailed(ERROR_MSG_DA); } return InsertExtractFactory.getAttributeExtractor(da.getType()).extractRead(da, format); }
[ "public", "static", "Object", "extractRead", "(", "final", "DeviceAttribute", "da", ",", "final", "AttrDataFormat", "format", ")", "throws", "DevFailed", "{", "if", "(", "da", "==", "null", ")", "{", "throw", "DevFailedUtils", ".", "newDevFailed", "(", "ERROR_MSG_DA", ")", ";", "}", "return", "InsertExtractFactory", ".", "getAttributeExtractor", "(", "da", ".", "getType", "(", ")", ")", ".", "extractRead", "(", "da", ",", "format", ")", ";", "}" ]
Extract read values to an object for SCALAR, SPECTRUM and IMAGE @param da @return single value for SCALAR, array of primitives for SPECTRUM, 2D array of primitives for IMAGE @throws DevFailed
[ "Extract", "read", "values", "to", "an", "object", "for", "SCALAR", "SPECTRUM", "and", "IMAGE" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/InsertExtractUtils.java#L44-L49
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java
RedisCommandFactory.getCommands
public <T extends Commands> T getCommands(Class<T> commandInterface) { """ Returns a Redis Commands interface instance for the given interface. @param commandInterface must not be {@literal null}. @param <T> command interface type. @return the implemented Redis Commands interface. """ LettuceAssert.notNull(commandInterface, "Redis Command Interface must not be null"); RedisCommandsMetadata metadata = new DefaultRedisCommandsMetadata(commandInterface); InvocationProxyFactory factory = new InvocationProxyFactory(); factory.addInterface(commandInterface); BatchAwareCommandLookupStrategy lookupStrategy = new BatchAwareCommandLookupStrategy( new CompositeCommandLookupStrategy(), metadata); factory.addInterceptor(new DefaultMethodInvokingInterceptor()); factory.addInterceptor(new CommandFactoryExecutorMethodInterceptor(metadata, lookupStrategy)); return factory.createProxy(commandInterface.getClassLoader()); }
java
public <T extends Commands> T getCommands(Class<T> commandInterface) { LettuceAssert.notNull(commandInterface, "Redis Command Interface must not be null"); RedisCommandsMetadata metadata = new DefaultRedisCommandsMetadata(commandInterface); InvocationProxyFactory factory = new InvocationProxyFactory(); factory.addInterface(commandInterface); BatchAwareCommandLookupStrategy lookupStrategy = new BatchAwareCommandLookupStrategy( new CompositeCommandLookupStrategy(), metadata); factory.addInterceptor(new DefaultMethodInvokingInterceptor()); factory.addInterceptor(new CommandFactoryExecutorMethodInterceptor(metadata, lookupStrategy)); return factory.createProxy(commandInterface.getClassLoader()); }
[ "public", "<", "T", "extends", "Commands", ">", "T", "getCommands", "(", "Class", "<", "T", ">", "commandInterface", ")", "{", "LettuceAssert", ".", "notNull", "(", "commandInterface", ",", "\"Redis Command Interface must not be null\"", ")", ";", "RedisCommandsMetadata", "metadata", "=", "new", "DefaultRedisCommandsMetadata", "(", "commandInterface", ")", ";", "InvocationProxyFactory", "factory", "=", "new", "InvocationProxyFactory", "(", ")", ";", "factory", ".", "addInterface", "(", "commandInterface", ")", ";", "BatchAwareCommandLookupStrategy", "lookupStrategy", "=", "new", "BatchAwareCommandLookupStrategy", "(", "new", "CompositeCommandLookupStrategy", "(", ")", ",", "metadata", ")", ";", "factory", ".", "addInterceptor", "(", "new", "DefaultMethodInvokingInterceptor", "(", ")", ")", ";", "factory", ".", "addInterceptor", "(", "new", "CommandFactoryExecutorMethodInterceptor", "(", "metadata", ",", "lookupStrategy", ")", ")", ";", "return", "factory", ".", "createProxy", "(", "commandInterface", ".", "getClassLoader", "(", ")", ")", ";", "}" ]
Returns a Redis Commands interface instance for the given interface. @param commandInterface must not be {@literal null}. @param <T> command interface type. @return the implemented Redis Commands interface.
[ "Returns", "a", "Redis", "Commands", "interface", "instance", "for", "the", "given", "interface", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java#L179-L195
JetBrains/xodus
vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java
VirtualFileSystem.touchFile
public void touchFile(@NotNull final Transaction txn, @NotNull final File file) { """ Touches the specified {@linkplain File}, i.e. sets its {@linkplain File#getLastModified() last modified time} to current time. @param txn {@linkplain Transaction} instance @param file {@linkplain File} instance @see #readFile(Transaction, File) @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, File) @see #writeFile(Transaction, long) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #appendFile(Transaction, File) @see File#getLastModified() """ new LastModifiedTrigger(txn, file, pathnames).run(); }
java
public void touchFile(@NotNull final Transaction txn, @NotNull final File file) { new LastModifiedTrigger(txn, file, pathnames).run(); }
[ "public", "void", "touchFile", "(", "@", "NotNull", "final", "Transaction", "txn", ",", "@", "NotNull", "final", "File", "file", ")", "{", "new", "LastModifiedTrigger", "(", "txn", ",", "file", ",", "pathnames", ")", ".", "run", "(", ")", ";", "}" ]
Touches the specified {@linkplain File}, i.e. sets its {@linkplain File#getLastModified() last modified time} to current time. @param txn {@linkplain Transaction} instance @param file {@linkplain File} instance @see #readFile(Transaction, File) @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, File) @see #writeFile(Transaction, long) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #appendFile(Transaction, File) @see File#getLastModified()
[ "Touches", "the", "specified", "{", "@linkplain", "File", "}", "i", ".", "e", ".", "sets", "its", "{", "@linkplain", "File#getLastModified", "()", "last", "modified", "time", "}", "to", "current", "time", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L475-L477
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.setScheduler
protected void setScheduler(CFMLEngine engine, Resource scheduleDirectory) throws PageException { """ sets the Schedule Directory @param scheduleDirectory sets the schedule Directory @param logger @throws PageException """ if (scheduleDirectory == null) { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, "<?xml version=\"1.0\"?>\n<schedule></schedule>", this); return; } if (!isDirectory(scheduleDirectory)) throw new ExpressionException("schedule task directory " + scheduleDirectory + " doesn't exist or is not a directory"); try { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, this, scheduleDirectory, SystemUtil.getCharset().name()); } catch (Exception e) { throw Caster.toPageException(e); } }
java
protected void setScheduler(CFMLEngine engine, Resource scheduleDirectory) throws PageException { if (scheduleDirectory == null) { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, "<?xml version=\"1.0\"?>\n<schedule></schedule>", this); return; } if (!isDirectory(scheduleDirectory)) throw new ExpressionException("schedule task directory " + scheduleDirectory + " doesn't exist or is not a directory"); try { if (this.scheduler == null) this.scheduler = new SchedulerImpl(engine, this, scheduleDirectory, SystemUtil.getCharset().name()); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "protected", "void", "setScheduler", "(", "CFMLEngine", "engine", ",", "Resource", "scheduleDirectory", ")", "throws", "PageException", "{", "if", "(", "scheduleDirectory", "==", "null", ")", "{", "if", "(", "this", ".", "scheduler", "==", "null", ")", "this", ".", "scheduler", "=", "new", "SchedulerImpl", "(", "engine", ",", "\"<?xml version=\\\"1.0\\\"?>\\n<schedule></schedule>\"", ",", "this", ")", ";", "return", ";", "}", "if", "(", "!", "isDirectory", "(", "scheduleDirectory", ")", ")", "throw", "new", "ExpressionException", "(", "\"schedule task directory \"", "+", "scheduleDirectory", "+", "\" doesn't exist or is not a directory\"", ")", ";", "try", "{", "if", "(", "this", ".", "scheduler", "==", "null", ")", "this", ".", "scheduler", "=", "new", "SchedulerImpl", "(", "engine", ",", "this", ",", "scheduleDirectory", ",", "SystemUtil", ".", "getCharset", "(", ")", ".", "name", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "Caster", ".", "toPageException", "(", "e", ")", ";", "}", "}" ]
sets the Schedule Directory @param scheduleDirectory sets the schedule Directory @param logger @throws PageException
[ "sets", "the", "Schedule", "Directory" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1654-L1667
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java
NetworkProfilesInner.getByResourceGroup
public NetworkProfileInner getByResourceGroup(String resourceGroupName, String networkProfileName) { """ Gets the specified network profile in a specified resource group. @param resourceGroupName The name of the resource group. @param networkProfileName The name of the PublicIPPrefx. @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 NetworkProfileInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkProfileName).toBlocking().single().body(); }
java
public NetworkProfileInner getByResourceGroup(String resourceGroupName, String networkProfileName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkProfileName).toBlocking().single().body(); }
[ "public", "NetworkProfileInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "networkProfileName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkProfileName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets the specified network profile in a specified resource group. @param resourceGroupName The name of the resource group. @param networkProfileName The name of the PublicIPPrefx. @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 NetworkProfileInner object if successful.
[ "Gets", "the", "specified", "network", "profile", "in", "a", "specified", "resource", "group", "." ]
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/NetworkProfilesInner.java#L180-L182
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/spatial/SpatialUtil.java
SpatialUtil.volumeScaled
public static double volumeScaled(SpatialComparable box, double scale) { """ Computes the volume of this SpatialComparable. @param box Box @param scale Scaling factor @return the volume of this SpatialComparable """ final int dim = box.getDimensionality(); double vol = 1.; for(int i = 0; i < dim; i++) { double delta = box.getMax(i) - box.getMin(i); if(delta == 0.) { return 0.; } vol *= delta * scale; } return vol; }
java
public static double volumeScaled(SpatialComparable box, double scale) { final int dim = box.getDimensionality(); double vol = 1.; for(int i = 0; i < dim; i++) { double delta = box.getMax(i) - box.getMin(i); if(delta == 0.) { return 0.; } vol *= delta * scale; } return vol; }
[ "public", "static", "double", "volumeScaled", "(", "SpatialComparable", "box", ",", "double", "scale", ")", "{", "final", "int", "dim", "=", "box", ".", "getDimensionality", "(", ")", ";", "double", "vol", "=", "1.", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dim", ";", "i", "++", ")", "{", "double", "delta", "=", "box", ".", "getMax", "(", "i", ")", "-", "box", ".", "getMin", "(", "i", ")", ";", "if", "(", "delta", "==", "0.", ")", "{", "return", "0.", ";", "}", "vol", "*=", "delta", "*", "scale", ";", "}", "return", "vol", ";", "}" ]
Computes the volume of this SpatialComparable. @param box Box @param scale Scaling factor @return the volume of this SpatialComparable
[ "Computes", "the", "volume", "of", "this", "SpatialComparable", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/spatial/SpatialUtil.java#L196-L207
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java
BouncyCastleCertProcessingFactory.createCertificate
public X509Certificate createCertificate(InputStream certRequestInputStream, X509Certificate cert, PrivateKey privateKey, int lifetime, int delegationMode, X509ExtensionSet extSet) throws IOException, GeneralSecurityException { """ Creates a proxy certificate from the certificate request. @see #createCertificate(InputStream, X509Certificate, PrivateKey, int, int, X509ExtensionSet, String) createCertificate @deprecated """ return createCertificate(certRequestInputStream, cert, privateKey, lifetime, delegationMode, extSet, null); }
java
public X509Certificate createCertificate(InputStream certRequestInputStream, X509Certificate cert, PrivateKey privateKey, int lifetime, int delegationMode, X509ExtensionSet extSet) throws IOException, GeneralSecurityException { return createCertificate(certRequestInputStream, cert, privateKey, lifetime, delegationMode, extSet, null); }
[ "public", "X509Certificate", "createCertificate", "(", "InputStream", "certRequestInputStream", ",", "X509Certificate", "cert", ",", "PrivateKey", "privateKey", ",", "int", "lifetime", ",", "int", "delegationMode", ",", "X509ExtensionSet", "extSet", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "return", "createCertificate", "(", "certRequestInputStream", ",", "cert", ",", "privateKey", ",", "lifetime", ",", "delegationMode", ",", "extSet", ",", "null", ")", ";", "}" ]
Creates a proxy certificate from the certificate request. @see #createCertificate(InputStream, X509Certificate, PrivateKey, int, int, X509ExtensionSet, String) createCertificate @deprecated
[ "Creates", "a", "proxy", "certificate", "from", "the", "certificate", "request", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java#L108-L112
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Clicker.java
Clicker.clickOnText
public void clickOnText(String regex, boolean longClick, int match, boolean scroll, int time) { """ Clicks on a specific {@link TextView} displaying a given text. @param regex the text that should be clicked on. The parameter <strong>will</strong> be interpreted as a regular expression. @param longClick {@code true} if the click should be a long click @param match the regex match that should be clicked on @param scroll true if scrolling should be performed @param time the amount of time to long click """ TextView textToClick = waiter.waitForText(regex, match, Timeout.getSmallTimeout(), scroll, true, false); if (textToClick != null) { clickOnScreen(textToClick, longClick, time); } else { if(match > 1){ Assert.fail(match + " matches of text string: '" + regex + "' are not found!"); } else{ ArrayList<TextView> allTextViews = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(TextView.class, true)); allTextViews.addAll((Collection<? extends TextView>) webUtils.getTextViewsFromWebView()); for (TextView textView : allTextViews) { Log.d(LOG_TAG, "'" + regex + "' not found. Have found: '" + textView.getText() + "'"); } allTextViews = null; Assert.fail("Text string: '" + regex + "' is not found!"); } } }
java
public void clickOnText(String regex, boolean longClick, int match, boolean scroll, int time) { TextView textToClick = waiter.waitForText(regex, match, Timeout.getSmallTimeout(), scroll, true, false); if (textToClick != null) { clickOnScreen(textToClick, longClick, time); } else { if(match > 1){ Assert.fail(match + " matches of text string: '" + regex + "' are not found!"); } else{ ArrayList<TextView> allTextViews = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(TextView.class, true)); allTextViews.addAll((Collection<? extends TextView>) webUtils.getTextViewsFromWebView()); for (TextView textView : allTextViews) { Log.d(LOG_TAG, "'" + regex + "' not found. Have found: '" + textView.getText() + "'"); } allTextViews = null; Assert.fail("Text string: '" + regex + "' is not found!"); } } }
[ "public", "void", "clickOnText", "(", "String", "regex", ",", "boolean", "longClick", ",", "int", "match", ",", "boolean", "scroll", ",", "int", "time", ")", "{", "TextView", "textToClick", "=", "waiter", ".", "waitForText", "(", "regex", ",", "match", ",", "Timeout", ".", "getSmallTimeout", "(", ")", ",", "scroll", ",", "true", ",", "false", ")", ";", "if", "(", "textToClick", "!=", "null", ")", "{", "clickOnScreen", "(", "textToClick", ",", "longClick", ",", "time", ")", ";", "}", "else", "{", "if", "(", "match", ">", "1", ")", "{", "Assert", ".", "fail", "(", "match", "+", "\" matches of text string: '\"", "+", "regex", "+", "\"' are not found!\"", ")", ";", "}", "else", "{", "ArrayList", "<", "TextView", ">", "allTextViews", "=", "RobotiumUtils", ".", "removeInvisibleViews", "(", "viewFetcher", ".", "getCurrentViews", "(", "TextView", ".", "class", ",", "true", ")", ")", ";", "allTextViews", ".", "addAll", "(", "(", "Collection", "<", "?", "extends", "TextView", ">", ")", "webUtils", ".", "getTextViewsFromWebView", "(", ")", ")", ";", "for", "(", "TextView", "textView", ":", "allTextViews", ")", "{", "Log", ".", "d", "(", "LOG_TAG", ",", "\"'\"", "+", "regex", "+", "\"' not found. Have found: '\"", "+", "textView", ".", "getText", "(", ")", "+", "\"'\"", ")", ";", "}", "allTextViews", "=", "null", ";", "Assert", ".", "fail", "(", "\"Text string: '\"", "+", "regex", "+", "\"' is not found!\"", ")", ";", "}", "}", "}" ]
Clicks on a specific {@link TextView} displaying a given text. @param regex the text that should be clicked on. The parameter <strong>will</strong> be interpreted as a regular expression. @param longClick {@code true} if the click should be a long click @param match the regex match that should be clicked on @param scroll true if scrolling should be performed @param time the amount of time to long click
[ "Clicks", "on", "a", "specific", "{", "@link", "TextView", "}", "displaying", "a", "given", "text", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L438-L462
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java
BetterRecyclerAdapter.onItemLongClick
protected void onItemLongClick(View view, int position) { """ Call this to trigger the user set item long click lisetner @param view the view that was clicked @param position the position that was clicked """ if(itemLongClickListener != null) itemLongClickListener.onItemLongClick(view, getItem(position), position); }
java
protected void onItemLongClick(View view, int position){ if(itemLongClickListener != null) itemLongClickListener.onItemLongClick(view, getItem(position), position); }
[ "protected", "void", "onItemLongClick", "(", "View", "view", ",", "int", "position", ")", "{", "if", "(", "itemLongClickListener", "!=", "null", ")", "itemLongClickListener", ".", "onItemLongClick", "(", "view", ",", "getItem", "(", "position", ")", ",", "position", ")", ";", "}" ]
Call this to trigger the user set item long click lisetner @param view the view that was clicked @param position the position that was clicked
[ "Call", "this", "to", "trigger", "the", "user", "set", "item", "long", "click", "lisetner" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/adapter/BetterRecyclerAdapter.java#L84-L86
strator-dev/greenpepper-open
extensions-external/ognl/src/main/java/com/greenpepper/extensions/ognl/OgnlSupport.java
OgnlSupport.getFixture
public Fixture getFixture( String name, String... params ) throws Throwable { """ <p>getFixture.</p> @param name a {@link java.lang.String} object. @param params a {@link java.lang.String} object. @return a {@link com.greenpepper.reflect.Fixture} object. @throws java.lang.Throwable if any. """ return new OgnlFixture( systemUnderDevelopment.getFixture( name, params ) ); }
java
public Fixture getFixture( String name, String... params ) throws Throwable { return new OgnlFixture( systemUnderDevelopment.getFixture( name, params ) ); }
[ "public", "Fixture", "getFixture", "(", "String", "name", ",", "String", "...", "params", ")", "throws", "Throwable", "{", "return", "new", "OgnlFixture", "(", "systemUnderDevelopment", ".", "getFixture", "(", "name", ",", "params", ")", ")", ";", "}" ]
<p>getFixture.</p> @param name a {@link java.lang.String} object. @param params a {@link java.lang.String} object. @return a {@link com.greenpepper.reflect.Fixture} object. @throws java.lang.Throwable if any.
[ "<p", ">", "getFixture", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/ognl/src/main/java/com/greenpepper/extensions/ognl/OgnlSupport.java#L50-L53
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/ComputePoliciesInner.java
ComputePoliciesInner.listByAccountAsync
public Observable<Page<ComputePolicyInner>> listByAccountAsync(final String resourceGroupName, final String accountName) { """ Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ComputePolicyInner&gt; object """ return listByAccountWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<ComputePolicyInner>>, Page<ComputePolicyInner>>() { @Override public Page<ComputePolicyInner> call(ServiceResponse<Page<ComputePolicyInner>> response) { return response.body(); } }); }
java
public Observable<Page<ComputePolicyInner>> listByAccountAsync(final String resourceGroupName, final String accountName) { return listByAccountWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<ComputePolicyInner>>, Page<ComputePolicyInner>>() { @Override public Page<ComputePolicyInner> call(ServiceResponse<Page<ComputePolicyInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ComputePolicyInner", ">", ">", "listByAccountAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listByAccountWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ComputePolicyInner", ">", ">", ",", "Page", "<", "ComputePolicyInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ComputePolicyInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ComputePolicyInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ComputePolicyInner&gt; object
[ "Lists", "the", "Data", "Lake", "Analytics", "compute", "policies", "within", "the", "specified", "Data", "Lake", "Analytics", "account", ".", "An", "account", "supports", "at", "most", "50", "policies", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/ComputePoliciesInner.java#L142-L150
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getCDSExonRanges
public static List<Range<Integer>> getCDSExonRanges(GeneChromosomePosition chromPos) { """ Extracts the exon boundaries in CDS coordinates. (needs to be divided by 3 to get AA positions) @param chromPos @return """ if ( chromPos.getOrientation() == '+') return getCDSExonRangesForward(chromPos,CDS); return getCDSExonRangesReverse(chromPos,CDS); }
java
public static List<Range<Integer>> getCDSExonRanges(GeneChromosomePosition chromPos){ if ( chromPos.getOrientation() == '+') return getCDSExonRangesForward(chromPos,CDS); return getCDSExonRangesReverse(chromPos,CDS); }
[ "public", "static", "List", "<", "Range", "<", "Integer", ">", ">", "getCDSExonRanges", "(", "GeneChromosomePosition", "chromPos", ")", "{", "if", "(", "chromPos", ".", "getOrientation", "(", ")", "==", "'", "'", ")", "return", "getCDSExonRangesForward", "(", "chromPos", ",", "CDS", ")", ";", "return", "getCDSExonRangesReverse", "(", "chromPos", ",", "CDS", ")", ";", "}" ]
Extracts the exon boundaries in CDS coordinates. (needs to be divided by 3 to get AA positions) @param chromPos @return
[ "Extracts", "the", "exon", "boundaries", "in", "CDS", "coordinates", ".", "(", "needs", "to", "be", "divided", "by", "3", "to", "get", "AA", "positions", ")" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L577-L581
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java
NodeImpl.setPropertyValue
public static NodeImpl setPropertyValue(final NodeImpl node, final Object value) { """ set property value to a copied node. @param node node to build @param value value to set @return new created node implementation """ return new NodeImpl( // node.name, // node.parent, // node.isIterableValue, // node.index, // node.key, // node.kind, // node.parameterTypes, // node.parameterIndex, // value, // node.containerClass, // node.typeArgumentIndex // ); }
java
public static NodeImpl setPropertyValue(final NodeImpl node, final Object value) { return new NodeImpl( // node.name, // node.parent, // node.isIterableValue, // node.index, // node.key, // node.kind, // node.parameterTypes, // node.parameterIndex, // value, // node.containerClass, // node.typeArgumentIndex // ); }
[ "public", "static", "NodeImpl", "setPropertyValue", "(", "final", "NodeImpl", "node", ",", "final", "Object", "value", ")", "{", "return", "new", "NodeImpl", "(", "//", "node", ".", "name", ",", "//", "node", ".", "parent", ",", "//", "node", ".", "isIterableValue", ",", "//", "node", ".", "index", ",", "//", "node", ".", "key", ",", "//", "node", ".", "kind", ",", "//", "node", ".", "parameterTypes", ",", "//", "node", ".", "parameterIndex", ",", "//", "value", ",", "//", "node", ".", "containerClass", ",", "//", "node", ".", "typeArgumentIndex", "//", ")", ";", "}" ]
set property value to a copied node. @param node node to build @param value value to set @return new created node implementation
[ "set", "property", "value", "to", "a", "copied", "node", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java#L357-L371
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VTimeZone.java
VTimeZone.writeZonePropsByDOW_GEQ_DOM
private static void writeZonePropsByDOW_GEQ_DOM(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int dayOfMonth, int dayOfWeek, long startTime, long untilTime) throws IOException { """ /* Write start times defined by a DOW_GEQ_DOM rule using VTIMEZONE RRULE """ // Check if this rule can be converted to DOW rule if (dayOfMonth%7 == 1) { // Can be represented by DOW rule writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, (dayOfMonth + 6)/7, dayOfWeek, startTime, untilTime); } else if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - dayOfMonth)%7 == 6) { // Can be represented by DOW rule with negative week number writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, -1*((MONTHLENGTH[month] - dayOfMonth + 1)/7), dayOfWeek, startTime, untilTime); } else { // Otherwise, use BYMONTHDAY to include all possible dates beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, startTime); // Check if all days are in the same month int startDay = dayOfMonth; int currentMonthDays = 7; if (dayOfMonth <= 0) { // The start day is in previous month int prevMonthDays = 1 - dayOfMonth; currentMonthDays -= prevMonthDays; int prevMonth = (month - 1) < 0 ? 11 : month - 1; // Note: When a rule is separated into two, UNTIL attribute needs to be // calculated for each of them. For now, we skip this, because we basically use this method // only for final rules, which does not have the UNTIL attribute writeZonePropsByDOW_GEQ_DOM_sub(writer, prevMonth, -prevMonthDays, dayOfWeek, prevMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); // Start from 1 for the rest startDay = 1; } else if (dayOfMonth + 6 > MONTHLENGTH[month]) { // Note: This code does not actually work well in February. For now, days in month in // non-leap year. int nextMonthDays = dayOfMonth + 6 - MONTHLENGTH[month]; currentMonthDays -= nextMonthDays; int nextMonth = (month + 1) > 11 ? 0 : month + 1; writeZonePropsByDOW_GEQ_DOM_sub(writer, nextMonth, 1, dayOfWeek, nextMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); } writeZonePropsByDOW_GEQ_DOM_sub(writer, month, startDay, dayOfWeek, currentMonthDays, untilTime, fromOffset); endZoneProps(writer, isDst); } }
java
private static void writeZonePropsByDOW_GEQ_DOM(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int dayOfMonth, int dayOfWeek, long startTime, long untilTime) throws IOException { // Check if this rule can be converted to DOW rule if (dayOfMonth%7 == 1) { // Can be represented by DOW rule writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, (dayOfMonth + 6)/7, dayOfWeek, startTime, untilTime); } else if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - dayOfMonth)%7 == 6) { // Can be represented by DOW rule with negative week number writeZonePropsByDOW(writer, isDst, tzname, fromOffset, toOffset, month, -1*((MONTHLENGTH[month] - dayOfMonth + 1)/7), dayOfWeek, startTime, untilTime); } else { // Otherwise, use BYMONTHDAY to include all possible dates beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, startTime); // Check if all days are in the same month int startDay = dayOfMonth; int currentMonthDays = 7; if (dayOfMonth <= 0) { // The start day is in previous month int prevMonthDays = 1 - dayOfMonth; currentMonthDays -= prevMonthDays; int prevMonth = (month - 1) < 0 ? 11 : month - 1; // Note: When a rule is separated into two, UNTIL attribute needs to be // calculated for each of them. For now, we skip this, because we basically use this method // only for final rules, which does not have the UNTIL attribute writeZonePropsByDOW_GEQ_DOM_sub(writer, prevMonth, -prevMonthDays, dayOfWeek, prevMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); // Start from 1 for the rest startDay = 1; } else if (dayOfMonth + 6 > MONTHLENGTH[month]) { // Note: This code does not actually work well in February. For now, days in month in // non-leap year. int nextMonthDays = dayOfMonth + 6 - MONTHLENGTH[month]; currentMonthDays -= nextMonthDays; int nextMonth = (month + 1) > 11 ? 0 : month + 1; writeZonePropsByDOW_GEQ_DOM_sub(writer, nextMonth, 1, dayOfWeek, nextMonthDays, MAX_TIME /* Do not use UNTIL */, fromOffset); } writeZonePropsByDOW_GEQ_DOM_sub(writer, month, startDay, dayOfWeek, currentMonthDays, untilTime, fromOffset); endZoneProps(writer, isDst); } }
[ "private", "static", "void", "writeZonePropsByDOW_GEQ_DOM", "(", "Writer", "writer", ",", "boolean", "isDst", ",", "String", "tzname", ",", "int", "fromOffset", ",", "int", "toOffset", ",", "int", "month", ",", "int", "dayOfMonth", ",", "int", "dayOfWeek", ",", "long", "startTime", ",", "long", "untilTime", ")", "throws", "IOException", "{", "// Check if this rule can be converted to DOW rule", "if", "(", "dayOfMonth", "%", "7", "==", "1", ")", "{", "// Can be represented by DOW rule", "writeZonePropsByDOW", "(", "writer", ",", "isDst", ",", "tzname", ",", "fromOffset", ",", "toOffset", ",", "month", ",", "(", "dayOfMonth", "+", "6", ")", "/", "7", ",", "dayOfWeek", ",", "startTime", ",", "untilTime", ")", ";", "}", "else", "if", "(", "month", "!=", "Calendar", ".", "FEBRUARY", "&&", "(", "MONTHLENGTH", "[", "month", "]", "-", "dayOfMonth", ")", "%", "7", "==", "6", ")", "{", "// Can be represented by DOW rule with negative week number", "writeZonePropsByDOW", "(", "writer", ",", "isDst", ",", "tzname", ",", "fromOffset", ",", "toOffset", ",", "month", ",", "-", "1", "*", "(", "(", "MONTHLENGTH", "[", "month", "]", "-", "dayOfMonth", "+", "1", ")", "/", "7", ")", ",", "dayOfWeek", ",", "startTime", ",", "untilTime", ")", ";", "}", "else", "{", "// Otherwise, use BYMONTHDAY to include all possible dates", "beginZoneProps", "(", "writer", ",", "isDst", ",", "tzname", ",", "fromOffset", ",", "toOffset", ",", "startTime", ")", ";", "// Check if all days are in the same month", "int", "startDay", "=", "dayOfMonth", ";", "int", "currentMonthDays", "=", "7", ";", "if", "(", "dayOfMonth", "<=", "0", ")", "{", "// The start day is in previous month", "int", "prevMonthDays", "=", "1", "-", "dayOfMonth", ";", "currentMonthDays", "-=", "prevMonthDays", ";", "int", "prevMonth", "=", "(", "month", "-", "1", ")", "<", "0", "?", "11", ":", "month", "-", "1", ";", "// Note: When a rule is separated into two, UNTIL attribute needs to be", "// calculated for each of them. For now, we skip this, because we basically use this method", "// only for final rules, which does not have the UNTIL attribute", "writeZonePropsByDOW_GEQ_DOM_sub", "(", "writer", ",", "prevMonth", ",", "-", "prevMonthDays", ",", "dayOfWeek", ",", "prevMonthDays", ",", "MAX_TIME", "/* Do not use UNTIL */", ",", "fromOffset", ")", ";", "// Start from 1 for the rest", "startDay", "=", "1", ";", "}", "else", "if", "(", "dayOfMonth", "+", "6", ">", "MONTHLENGTH", "[", "month", "]", ")", "{", "// Note: This code does not actually work well in February. For now, days in month in", "// non-leap year.", "int", "nextMonthDays", "=", "dayOfMonth", "+", "6", "-", "MONTHLENGTH", "[", "month", "]", ";", "currentMonthDays", "-=", "nextMonthDays", ";", "int", "nextMonth", "=", "(", "month", "+", "1", ")", ">", "11", "?", "0", ":", "month", "+", "1", ";", "writeZonePropsByDOW_GEQ_DOM_sub", "(", "writer", ",", "nextMonth", ",", "1", ",", "dayOfWeek", ",", "nextMonthDays", ",", "MAX_TIME", "/* Do not use UNTIL */", ",", "fromOffset", ")", ";", "}", "writeZonePropsByDOW_GEQ_DOM_sub", "(", "writer", ",", "month", ",", "startDay", ",", "dayOfWeek", ",", "currentMonthDays", ",", "untilTime", ",", "fromOffset", ")", ";", "endZoneProps", "(", "writer", ",", "isDst", ")", ";", "}", "}" ]
/* Write start times defined by a DOW_GEQ_DOM rule using VTIMEZONE RRULE
[ "/", "*", "Write", "start", "times", "defined", "by", "a", "DOW_GEQ_DOM", "rule", "using", "VTIMEZONE", "RRULE" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VTimeZone.java#L1553-L1599
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java
ChannelUpgradeHandler.addProtocol
public void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener) { """ Add a protocol to this handler. @param productString the product string to match @param openListener the open listener to call """ addProtocol(productString, openListener, null); }
java
public void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener) { addProtocol(productString, openListener, null); }
[ "public", "void", "addProtocol", "(", "String", "productString", ",", "ChannelListener", "<", "?", "super", "StreamConnection", ">", "openListener", ")", "{", "addProtocol", "(", "productString", ",", "openListener", ",", "null", ")", ";", "}" ]
Add a protocol to this handler. @param productString the product string to match @param openListener the open listener to call
[ "Add", "a", "protocol", "to", "this", "handler", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/ChannelUpgradeHandler.java#L97-L99
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java
PluginAdapterUtility.configureProperties
public static Map<String, Object> configureProperties(final PropertyResolver resolver, final Object object) { """ Set field values on a plugin object by using annotated field values to create a Description, and setting field values to resolved property values. Any resolved properties that are not mapped to a field will be included in the return result. @param resolver property resolver @param object plugin object @return Map of resolved properties that were not configured in the object's fields """ //use a default scope of InstanceOnly if the Property doesn't specify it return configureProperties(resolver, buildDescription(object, DescriptionBuilder.builder()), object, PropertyScope.InstanceOnly); }
java
public static Map<String, Object> configureProperties(final PropertyResolver resolver, final Object object) { //use a default scope of InstanceOnly if the Property doesn't specify it return configureProperties(resolver, buildDescription(object, DescriptionBuilder.builder()), object, PropertyScope.InstanceOnly); }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "configureProperties", "(", "final", "PropertyResolver", "resolver", ",", "final", "Object", "object", ")", "{", "//use a default scope of InstanceOnly if the Property doesn't specify it", "return", "configureProperties", "(", "resolver", ",", "buildDescription", "(", "object", ",", "DescriptionBuilder", ".", "builder", "(", ")", ")", ",", "object", ",", "PropertyScope", ".", "InstanceOnly", ")", ";", "}" ]
Set field values on a plugin object by using annotated field values to create a Description, and setting field values to resolved property values. Any resolved properties that are not mapped to a field will be included in the return result. @param resolver property resolver @param object plugin object @return Map of resolved properties that were not configured in the object's fields
[ "Set", "field", "values", "on", "a", "plugin", "object", "by", "using", "annotated", "field", "values", "to", "create", "a", "Description", "and", "setting", "field", "values", "to", "resolved", "property", "values", ".", "Any", "resolved", "properties", "that", "are", "not", "mapped", "to", "a", "field", "will", "be", "included", "in", "the", "return", "result", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java#L337-L342
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java
SnapshotsInner.createOrUpdate
public SnapshotInner createOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { """ Creates or updates a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @param snapshot Snapshot object supplied in the body of the Put disk 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 SnapshotInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).toBlocking().last().body(); }
java
public SnapshotInner createOrUpdate(String resourceGroupName, String snapshotName, SnapshotInner snapshot) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).toBlocking().last().body(); }
[ "public", "SnapshotInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "snapshotName", ",", "SnapshotInner", "snapshot", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "snapshotName", ",", "snapshot", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @param snapshot Snapshot object supplied in the body of the Put disk 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 SnapshotInner object if successful.
[ "Creates", "or", "updates", "a", "snapshot", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L144-L146
tminglei/form-binder-java
src/main/java/com/github/tminglei/bind/FrameworkUtils.java
FrameworkUtils.workObject
static Object workObject(Map<String, Object> workList, String name, boolean isArray) { """ find work object specified by name, create and attach it if not exists """ logger.trace("get working object for {}", name); if (workList.get(name) != null) return workList.get(name); else { String[] parts = splitName(name); // parts: (parent, name, isArray) Map<String, Object> parentObj = (Map<String, Object>) workObject(workList, parts[0], false); Object theObj = isArray ? new ArrayList<String>() : new HashMap<String, Object>(); parentObj.put(parts[1], theObj); workList.put(name, theObj); return theObj; } }
java
static Object workObject(Map<String, Object> workList, String name, boolean isArray) { logger.trace("get working object for {}", name); if (workList.get(name) != null) return workList.get(name); else { String[] parts = splitName(name); // parts: (parent, name, isArray) Map<String, Object> parentObj = (Map<String, Object>) workObject(workList, parts[0], false); Object theObj = isArray ? new ArrayList<String>() : new HashMap<String, Object>(); parentObj.put(parts[1], theObj); workList.put(name, theObj); return theObj; } }
[ "static", "Object", "workObject", "(", "Map", "<", "String", ",", "Object", ">", "workList", ",", "String", "name", ",", "boolean", "isArray", ")", "{", "logger", ".", "trace", "(", "\"get working object for {}\"", ",", "name", ")", ";", "if", "(", "workList", ".", "get", "(", "name", ")", "!=", "null", ")", "return", "workList", ".", "get", "(", "name", ")", ";", "else", "{", "String", "[", "]", "parts", "=", "splitName", "(", "name", ")", ";", "// parts: (parent, name, isArray)", "Map", "<", "String", ",", "Object", ">", "parentObj", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "workObject", "(", "workList", ",", "parts", "[", "0", "]", ",", "false", ")", ";", "Object", "theObj", "=", "isArray", "?", "new", "ArrayList", "<", "String", ">", "(", ")", ":", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parentObj", ".", "put", "(", "parts", "[", "1", "]", ",", "theObj", ")", ";", "workList", ".", "put", "(", "name", ",", "theObj", ")", ";", "return", "theObj", ";", "}", "}" ]
find work object specified by name, create and attach it if not exists
[ "find", "work", "object", "specified", "by", "name", "create", "and", "attach", "it", "if", "not", "exists" ]
train
https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/FrameworkUtils.java#L97-L111
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUData.java
ICUData.getStream
public static InputStream getStream(Class<?> root, String resourceName) { """ Convenience override that calls getStream(root, resourceName, false); Returns null if the resource could not be found. """ return getStream(root, resourceName, false); }
java
public static InputStream getStream(Class<?> root, String resourceName) { return getStream(root, resourceName, false); }
[ "public", "static", "InputStream", "getStream", "(", "Class", "<", "?", ">", "root", ",", "String", "resourceName", ")", "{", "return", "getStream", "(", "root", ",", "resourceName", ",", "false", ")", ";", "}" ]
Convenience override that calls getStream(root, resourceName, false); Returns null if the resource could not be found.
[ "Convenience", "override", "that", "calls", "getStream", "(", "root", "resourceName", "false", ")", ";", "Returns", "null", "if", "the", "resource", "could", "not", "be", "found", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUData.java#L213-L215
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processTask
private void processTask(ChildTaskContainer parent, MapRow row) throws IOException { """ Extract data for a single task. @param parent task parent @param row Synchro task data """ Task task = parent.addTask(); task.setName(row.getString("NAME")); task.setGUID(row.getUUID("UUID")); task.setText(1, row.getString("ID")); task.setDuration(row.getDuration("PLANNED_DURATION")); task.setRemainingDuration(row.getDuration("REMAINING_DURATION")); task.setHyperlink(row.getString("URL")); task.setPercentageComplete(row.getDouble("PERCENT_COMPLETE")); task.setNotes(getNotes(row.getRows("COMMENTARY"))); task.setMilestone(task.getDuration().getDuration() == 0); ProjectCalendar calendar = m_calendarMap.get(row.getUUID("CALENDAR_UUID")); if (calendar != m_project.getDefaultCalendar()) { task.setCalendar(calendar); } switch (row.getInteger("STATUS").intValue()) { case 1: // Planned { task.setStart(row.getDate("PLANNED_START")); task.setFinish(task.getEffectiveCalendar().getDate(task.getStart(), task.getDuration(), false)); break; } case 2: // Started { task.setActualStart(row.getDate("ACTUAL_START")); task.setStart(task.getActualStart()); task.setFinish(row.getDate("ESTIMATED_FINISH")); if (task.getFinish() == null) { task.setFinish(row.getDate("PLANNED_FINISH")); } break; } case 3: // Finished { task.setActualStart(row.getDate("ACTUAL_START")); task.setActualFinish(row.getDate("ACTUAL_FINISH")); task.setPercentageComplete(Double.valueOf(100.0)); task.setStart(task.getActualStart()); task.setFinish(task.getActualFinish()); break; } } setConstraints(task, row); processChildTasks(task, row); m_taskMap.put(task.getGUID(), task); List<MapRow> predecessors = row.getRows("PREDECESSORS"); if (predecessors != null && !predecessors.isEmpty()) { m_predecessorMap.put(task, predecessors); } List<MapRow> resourceAssignmnets = row.getRows("RESOURCE_ASSIGNMENTS"); if (resourceAssignmnets != null && !resourceAssignmnets.isEmpty()) { processResourceAssignments(task, resourceAssignmnets); } }
java
private void processTask(ChildTaskContainer parent, MapRow row) throws IOException { Task task = parent.addTask(); task.setName(row.getString("NAME")); task.setGUID(row.getUUID("UUID")); task.setText(1, row.getString("ID")); task.setDuration(row.getDuration("PLANNED_DURATION")); task.setRemainingDuration(row.getDuration("REMAINING_DURATION")); task.setHyperlink(row.getString("URL")); task.setPercentageComplete(row.getDouble("PERCENT_COMPLETE")); task.setNotes(getNotes(row.getRows("COMMENTARY"))); task.setMilestone(task.getDuration().getDuration() == 0); ProjectCalendar calendar = m_calendarMap.get(row.getUUID("CALENDAR_UUID")); if (calendar != m_project.getDefaultCalendar()) { task.setCalendar(calendar); } switch (row.getInteger("STATUS").intValue()) { case 1: // Planned { task.setStart(row.getDate("PLANNED_START")); task.setFinish(task.getEffectiveCalendar().getDate(task.getStart(), task.getDuration(), false)); break; } case 2: // Started { task.setActualStart(row.getDate("ACTUAL_START")); task.setStart(task.getActualStart()); task.setFinish(row.getDate("ESTIMATED_FINISH")); if (task.getFinish() == null) { task.setFinish(row.getDate("PLANNED_FINISH")); } break; } case 3: // Finished { task.setActualStart(row.getDate("ACTUAL_START")); task.setActualFinish(row.getDate("ACTUAL_FINISH")); task.setPercentageComplete(Double.valueOf(100.0)); task.setStart(task.getActualStart()); task.setFinish(task.getActualFinish()); break; } } setConstraints(task, row); processChildTasks(task, row); m_taskMap.put(task.getGUID(), task); List<MapRow> predecessors = row.getRows("PREDECESSORS"); if (predecessors != null && !predecessors.isEmpty()) { m_predecessorMap.put(task, predecessors); } List<MapRow> resourceAssignmnets = row.getRows("RESOURCE_ASSIGNMENTS"); if (resourceAssignmnets != null && !resourceAssignmnets.isEmpty()) { processResourceAssignments(task, resourceAssignmnets); } }
[ "private", "void", "processTask", "(", "ChildTaskContainer", "parent", ",", "MapRow", "row", ")", "throws", "IOException", "{", "Task", "task", "=", "parent", ".", "addTask", "(", ")", ";", "task", ".", "setName", "(", "row", ".", "getString", "(", "\"NAME\"", ")", ")", ";", "task", ".", "setGUID", "(", "row", ".", "getUUID", "(", "\"UUID\"", ")", ")", ";", "task", ".", "setText", "(", "1", ",", "row", ".", "getString", "(", "\"ID\"", ")", ")", ";", "task", ".", "setDuration", "(", "row", ".", "getDuration", "(", "\"PLANNED_DURATION\"", ")", ")", ";", "task", ".", "setRemainingDuration", "(", "row", ".", "getDuration", "(", "\"REMAINING_DURATION\"", ")", ")", ";", "task", ".", "setHyperlink", "(", "row", ".", "getString", "(", "\"URL\"", ")", ")", ";", "task", ".", "setPercentageComplete", "(", "row", ".", "getDouble", "(", "\"PERCENT_COMPLETE\"", ")", ")", ";", "task", ".", "setNotes", "(", "getNotes", "(", "row", ".", "getRows", "(", "\"COMMENTARY\"", ")", ")", ")", ";", "task", ".", "setMilestone", "(", "task", ".", "getDuration", "(", ")", ".", "getDuration", "(", ")", "==", "0", ")", ";", "ProjectCalendar", "calendar", "=", "m_calendarMap", ".", "get", "(", "row", ".", "getUUID", "(", "\"CALENDAR_UUID\"", ")", ")", ";", "if", "(", "calendar", "!=", "m_project", ".", "getDefaultCalendar", "(", ")", ")", "{", "task", ".", "setCalendar", "(", "calendar", ")", ";", "}", "switch", "(", "row", ".", "getInteger", "(", "\"STATUS\"", ")", ".", "intValue", "(", ")", ")", "{", "case", "1", ":", "// Planned", "{", "task", ".", "setStart", "(", "row", ".", "getDate", "(", "\"PLANNED_START\"", ")", ")", ";", "task", ".", "setFinish", "(", "task", ".", "getEffectiveCalendar", "(", ")", ".", "getDate", "(", "task", ".", "getStart", "(", ")", ",", "task", ".", "getDuration", "(", ")", ",", "false", ")", ")", ";", "break", ";", "}", "case", "2", ":", "// Started", "{", "task", ".", "setActualStart", "(", "row", ".", "getDate", "(", "\"ACTUAL_START\"", ")", ")", ";", "task", ".", "setStart", "(", "task", ".", "getActualStart", "(", ")", ")", ";", "task", ".", "setFinish", "(", "row", ".", "getDate", "(", "\"ESTIMATED_FINISH\"", ")", ")", ";", "if", "(", "task", ".", "getFinish", "(", ")", "==", "null", ")", "{", "task", ".", "setFinish", "(", "row", ".", "getDate", "(", "\"PLANNED_FINISH\"", ")", ")", ";", "}", "break", ";", "}", "case", "3", ":", "// Finished", "{", "task", ".", "setActualStart", "(", "row", ".", "getDate", "(", "\"ACTUAL_START\"", ")", ")", ";", "task", ".", "setActualFinish", "(", "row", ".", "getDate", "(", "\"ACTUAL_FINISH\"", ")", ")", ";", "task", ".", "setPercentageComplete", "(", "Double", ".", "valueOf", "(", "100.0", ")", ")", ";", "task", ".", "setStart", "(", "task", ".", "getActualStart", "(", ")", ")", ";", "task", ".", "setFinish", "(", "task", ".", "getActualFinish", "(", ")", ")", ";", "break", ";", "}", "}", "setConstraints", "(", "task", ",", "row", ")", ";", "processChildTasks", "(", "task", ",", "row", ")", ";", "m_taskMap", ".", "put", "(", "task", ".", "getGUID", "(", ")", ",", "task", ")", ";", "List", "<", "MapRow", ">", "predecessors", "=", "row", ".", "getRows", "(", "\"PREDECESSORS\"", ")", ";", "if", "(", "predecessors", "!=", "null", "&&", "!", "predecessors", ".", "isEmpty", "(", ")", ")", "{", "m_predecessorMap", ".", "put", "(", "task", ",", "predecessors", ")", ";", "}", "List", "<", "MapRow", ">", "resourceAssignmnets", "=", "row", ".", "getRows", "(", "\"RESOURCE_ASSIGNMENTS\"", ")", ";", "if", "(", "resourceAssignmnets", "!=", "null", "&&", "!", "resourceAssignmnets", ".", "isEmpty", "(", ")", ")", "{", "processResourceAssignments", "(", "task", ",", "resourceAssignmnets", ")", ";", "}", "}" ]
Extract data for a single task. @param parent task parent @param row Synchro task data
[ "Extract", "data", "for", "a", "single", "task", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L286-L354
azkaban/azkaban
azkaban-common/src/main/java/azkaban/sla/SlaOption.java
SlaOption.toObject
public Map<String, Object> toObject() { """ Convert the SLA option to the original JSON format, used by {@link SlaOptionDeprecated}. @return the JSON format for {@link SlaOptionDeprecated}. """ final List<String> slaActions = new ArrayList<>(); final Map<String, Object> slaInfo = new HashMap<>(); slaInfo.put(SlaOptionDeprecated.INFO_FLOW_NAME, this.flowName); if (hasAlert()) { slaActions.add(SlaOptionDeprecated.ACTION_ALERT); slaInfo.put(SlaOptionDeprecated.ALERT_TYPE, ALERT_TYPE_EMAIL); } if (hasKill()) { if (this.type.getComponent() == ComponentType.FLOW) { slaActions.add(SlaOptionDeprecated.ACTION_CANCEL_FLOW); } else { // JOB slaActions.add(SlaOptionDeprecated.ACTION_KILL_JOB); } } if (this.type.getComponent() == ComponentType.JOB) { slaInfo.put(SlaOptionDeprecated.INFO_JOB_NAME, this.jobName); } String slaType; switch (this.type) { case FLOW_FINISH: slaType = SlaOptionDeprecated.TYPE_FLOW_FINISH; break; case FLOW_SUCCEED: slaType = SlaOptionDeprecated.TYPE_FLOW_SUCCEED; break; case JOB_FINISH: slaType = SlaOptionDeprecated.TYPE_JOB_FINISH; break; case JOB_SUCCEED: slaType = SlaOptionDeprecated.TYPE_JOB_SUCCEED; break; default: throw new IllegalStateException("unsupported SLA type " + this.type.getName()); } slaInfo.put(SlaOptionDeprecated.INFO_DURATION, durationToString(this.duration)); slaInfo.put(SlaOptionDeprecated.INFO_EMAIL_LIST, emails); SlaOptionDeprecated slaOption = new SlaOptionDeprecated(slaType, slaActions, slaInfo); return slaOption.toObject(); }
java
public Map<String, Object> toObject() { final List<String> slaActions = new ArrayList<>(); final Map<String, Object> slaInfo = new HashMap<>(); slaInfo.put(SlaOptionDeprecated.INFO_FLOW_NAME, this.flowName); if (hasAlert()) { slaActions.add(SlaOptionDeprecated.ACTION_ALERT); slaInfo.put(SlaOptionDeprecated.ALERT_TYPE, ALERT_TYPE_EMAIL); } if (hasKill()) { if (this.type.getComponent() == ComponentType.FLOW) { slaActions.add(SlaOptionDeprecated.ACTION_CANCEL_FLOW); } else { // JOB slaActions.add(SlaOptionDeprecated.ACTION_KILL_JOB); } } if (this.type.getComponent() == ComponentType.JOB) { slaInfo.put(SlaOptionDeprecated.INFO_JOB_NAME, this.jobName); } String slaType; switch (this.type) { case FLOW_FINISH: slaType = SlaOptionDeprecated.TYPE_FLOW_FINISH; break; case FLOW_SUCCEED: slaType = SlaOptionDeprecated.TYPE_FLOW_SUCCEED; break; case JOB_FINISH: slaType = SlaOptionDeprecated.TYPE_JOB_FINISH; break; case JOB_SUCCEED: slaType = SlaOptionDeprecated.TYPE_JOB_SUCCEED; break; default: throw new IllegalStateException("unsupported SLA type " + this.type.getName()); } slaInfo.put(SlaOptionDeprecated.INFO_DURATION, durationToString(this.duration)); slaInfo.put(SlaOptionDeprecated.INFO_EMAIL_LIST, emails); SlaOptionDeprecated slaOption = new SlaOptionDeprecated(slaType, slaActions, slaInfo); return slaOption.toObject(); }
[ "public", "Map", "<", "String", ",", "Object", ">", "toObject", "(", ")", "{", "final", "List", "<", "String", ">", "slaActions", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "Map", "<", "String", ",", "Object", ">", "slaInfo", "=", "new", "HashMap", "<>", "(", ")", ";", "slaInfo", ".", "put", "(", "SlaOptionDeprecated", ".", "INFO_FLOW_NAME", ",", "this", ".", "flowName", ")", ";", "if", "(", "hasAlert", "(", ")", ")", "{", "slaActions", ".", "add", "(", "SlaOptionDeprecated", ".", "ACTION_ALERT", ")", ";", "slaInfo", ".", "put", "(", "SlaOptionDeprecated", ".", "ALERT_TYPE", ",", "ALERT_TYPE_EMAIL", ")", ";", "}", "if", "(", "hasKill", "(", ")", ")", "{", "if", "(", "this", ".", "type", ".", "getComponent", "(", ")", "==", "ComponentType", ".", "FLOW", ")", "{", "slaActions", ".", "add", "(", "SlaOptionDeprecated", ".", "ACTION_CANCEL_FLOW", ")", ";", "}", "else", "{", "// JOB", "slaActions", ".", "add", "(", "SlaOptionDeprecated", ".", "ACTION_KILL_JOB", ")", ";", "}", "}", "if", "(", "this", ".", "type", ".", "getComponent", "(", ")", "==", "ComponentType", ".", "JOB", ")", "{", "slaInfo", ".", "put", "(", "SlaOptionDeprecated", ".", "INFO_JOB_NAME", ",", "this", ".", "jobName", ")", ";", "}", "String", "slaType", ";", "switch", "(", "this", ".", "type", ")", "{", "case", "FLOW_FINISH", ":", "slaType", "=", "SlaOptionDeprecated", ".", "TYPE_FLOW_FINISH", ";", "break", ";", "case", "FLOW_SUCCEED", ":", "slaType", "=", "SlaOptionDeprecated", ".", "TYPE_FLOW_SUCCEED", ";", "break", ";", "case", "JOB_FINISH", ":", "slaType", "=", "SlaOptionDeprecated", ".", "TYPE_JOB_FINISH", ";", "break", ";", "case", "JOB_SUCCEED", ":", "slaType", "=", "SlaOptionDeprecated", ".", "TYPE_JOB_SUCCEED", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"unsupported SLA type \"", "+", "this", ".", "type", ".", "getName", "(", ")", ")", ";", "}", "slaInfo", ".", "put", "(", "SlaOptionDeprecated", ".", "INFO_DURATION", ",", "durationToString", "(", "this", ".", "duration", ")", ")", ";", "slaInfo", ".", "put", "(", "SlaOptionDeprecated", ".", "INFO_EMAIL_LIST", ",", "emails", ")", ";", "SlaOptionDeprecated", "slaOption", "=", "new", "SlaOptionDeprecated", "(", "slaType", ",", "slaActions", ",", "slaInfo", ")", ";", "return", "slaOption", ".", "toObject", "(", ")", ";", "}" ]
Convert the SLA option to the original JSON format, used by {@link SlaOptionDeprecated}. @return the JSON format for {@link SlaOptionDeprecated}.
[ "Convert", "the", "SLA", "option", "to", "the", "original", "JSON", "format", "used", "by", "{", "@link", "SlaOptionDeprecated", "}", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/sla/SlaOption.java#L212-L256
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java
VelocityUtil.toFile
public static void toFile(String templateFileName, VelocityContext context, String destPath) { """ 生成文件,使用默认引擎 @param templateFileName 模板文件名 @param context 模板上下文 @param destPath 目标路径(绝对) """ assertInit(); toFile(Velocity.getTemplate(templateFileName), context, destPath); }
java
public static void toFile(String templateFileName, VelocityContext context, String destPath) { assertInit(); toFile(Velocity.getTemplate(templateFileName), context, destPath); }
[ "public", "static", "void", "toFile", "(", "String", "templateFileName", ",", "VelocityContext", "context", ",", "String", "destPath", ")", "{", "assertInit", "(", ")", ";", "toFile", "(", "Velocity", ".", "getTemplate", "(", "templateFileName", ")", ",", "context", ",", "destPath", ")", ";", "}" ]
生成文件,使用默认引擎 @param templateFileName 模板文件名 @param context 模板上下文 @param destPath 目标路径(绝对)
[ "生成文件,使用默认引擎" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L152-L156
foundation-runtime/logging
logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/FileRollEvent.java
FileRollEvent.dispatchToAppender
final void dispatchToAppender(final LoggingEvent customLoggingEvent) { """ Convenience method dispatches the specified event to the source appender, which will result in the custom event data being appended to the new file. @param customLoggingEvent The custom Log4J event to be appended. """ // wrap the LoggingEvent in a FileRollEvent to prevent recursion bug final FoundationFileRollingAppender appender = this.getSource(); if (appender != null) { appender.append(new FileRollEvent(customLoggingEvent, this)); } }
java
final void dispatchToAppender(final LoggingEvent customLoggingEvent) { // wrap the LoggingEvent in a FileRollEvent to prevent recursion bug final FoundationFileRollingAppender appender = this.getSource(); if (appender != null) { appender.append(new FileRollEvent(customLoggingEvent, this)); } }
[ "final", "void", "dispatchToAppender", "(", "final", "LoggingEvent", "customLoggingEvent", ")", "{", "// wrap the LoggingEvent in a FileRollEvent to prevent recursion bug", "final", "FoundationFileRollingAppender", "appender", "=", "this", ".", "getSource", "(", ")", ";", "if", "(", "appender", "!=", "null", ")", "{", "appender", ".", "append", "(", "new", "FileRollEvent", "(", "customLoggingEvent", ",", "this", ")", ")", ";", "}", "}" ]
Convenience method dispatches the specified event to the source appender, which will result in the custom event data being appended to the new file. @param customLoggingEvent The custom Log4J event to be appended.
[ "Convenience", "method", "dispatches", "the", "specified", "event", "to", "the", "source", "appender", "which", "will", "result", "in", "the", "custom", "event", "data", "being", "appended", "to", "the", "new", "file", "." ]
train
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/FileRollEvent.java#L150-L156
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java
MonitoringProxyActivator.createDirectoryEntries
public void createDirectoryEntries(JarOutputStream jarStream, String packageName) throws IOException { """ Create the jar directory entries corresponding to the specified package name. @param jarStream the target jar's output stream @param packageName the target package name @throws IOException if an IO exception raised while creating the entries """ StringBuilder entryName = new StringBuilder(packageName.length()); for (String str : packageName.split("\\.")) { entryName.append(str).append("/"); JarEntry jarEntry = new JarEntry(entryName.toString()); jarStream.putNextEntry(jarEntry); } }
java
public void createDirectoryEntries(JarOutputStream jarStream, String packageName) throws IOException { StringBuilder entryName = new StringBuilder(packageName.length()); for (String str : packageName.split("\\.")) { entryName.append(str).append("/"); JarEntry jarEntry = new JarEntry(entryName.toString()); jarStream.putNextEntry(jarEntry); } }
[ "public", "void", "createDirectoryEntries", "(", "JarOutputStream", "jarStream", ",", "String", "packageName", ")", "throws", "IOException", "{", "StringBuilder", "entryName", "=", "new", "StringBuilder", "(", "packageName", ".", "length", "(", ")", ")", ";", "for", "(", "String", "str", ":", "packageName", ".", "split", "(", "\"\\\\.\"", ")", ")", "{", "entryName", ".", "append", "(", "str", ")", ".", "append", "(", "\"/\"", ")", ";", "JarEntry", "jarEntry", "=", "new", "JarEntry", "(", "entryName", ".", "toString", "(", ")", ")", ";", "jarStream", ".", "putNextEntry", "(", "jarEntry", ")", ";", "}", "}" ]
Create the jar directory entries corresponding to the specified package name. @param jarStream the target jar's output stream @param packageName the target package name @throws IOException if an IO exception raised while creating the entries
[ "Create", "the", "jar", "directory", "entries", "corresponding", "to", "the", "specified", "package", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java#L272-L279
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.stopStream
private void stopStream(User user, Stream stream, final KickflipCallback cb) { """ Stop a Stream owned by the given Kickflip User. @param cb This callback will receive a Stream subclass in #onSuccess(response) depending on the Kickflip account type. Implementors should check if the response is instanceof HlsStream, etc. """ checkNotNull(stream); // TODO: Add start / stop lat lon to Stream? GenericData data = new GenericData(); data.put("stream_id", stream.getStreamId()); data.put("uuid", user.getUUID()); if (stream.getLatitude() != 0) { data.put("lat", stream.getLatitude()); } if (stream.getLongitude() != 0) { data.put("lon", stream.getLongitude()); } post(STOP_STREAM, new UrlEncodedContent(data), HlsStream.class, cb); }
java
private void stopStream(User user, Stream stream, final KickflipCallback cb) { checkNotNull(stream); // TODO: Add start / stop lat lon to Stream? GenericData data = new GenericData(); data.put("stream_id", stream.getStreamId()); data.put("uuid", user.getUUID()); if (stream.getLatitude() != 0) { data.put("lat", stream.getLatitude()); } if (stream.getLongitude() != 0) { data.put("lon", stream.getLongitude()); } post(STOP_STREAM, new UrlEncodedContent(data), HlsStream.class, cb); }
[ "private", "void", "stopStream", "(", "User", "user", ",", "Stream", "stream", ",", "final", "KickflipCallback", "cb", ")", "{", "checkNotNull", "(", "stream", ")", ";", "// TODO: Add start / stop lat lon to Stream?", "GenericData", "data", "=", "new", "GenericData", "(", ")", ";", "data", ".", "put", "(", "\"stream_id\"", ",", "stream", ".", "getStreamId", "(", ")", ")", ";", "data", ".", "put", "(", "\"uuid\"", ",", "user", ".", "getUUID", "(", ")", ")", ";", "if", "(", "stream", ".", "getLatitude", "(", ")", "!=", "0", ")", "{", "data", ".", "put", "(", "\"lat\"", ",", "stream", ".", "getLatitude", "(", ")", ")", ";", "}", "if", "(", "stream", ".", "getLongitude", "(", ")", "!=", "0", ")", "{", "data", ".", "put", "(", "\"lon\"", ",", "stream", ".", "getLongitude", "(", ")", ")", ";", "}", "post", "(", "STOP_STREAM", ",", "new", "UrlEncodedContent", "(", "data", ")", ",", "HlsStream", ".", "class", ",", "cb", ")", ";", "}" ]
Stop a Stream owned by the given Kickflip User. @param cb This callback will receive a Stream subclass in #onSuccess(response) depending on the Kickflip account type. Implementors should check if the response is instanceof HlsStream, etc.
[ "Stop", "a", "Stream", "owned", "by", "the", "given", "Kickflip", "User", "." ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L370-L383
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java
ComparableExtensions.operator_spaceship
@Pure /* not guaranteed, since compareTo() is invoked */ @Inline("($1.compareTo($2))") public static <C> int operator_spaceship(Comparable<? super C> left, C right) { """ The spaceship operator <code>&lt;=&gt;</code>. @param left a comparable @param right the value to compare with @return <code>left.compareTo(right)</code> @since 2.4 """ return left.compareTo(right); }
java
@Pure /* not guaranteed, since compareTo() is invoked */ @Inline("($1.compareTo($2))") public static <C> int operator_spaceship(Comparable<? super C> left, C right) { return left.compareTo(right); }
[ "@", "Pure", "/* not guaranteed, since compareTo() is invoked */", "@", "Inline", "(", "\"($1.compareTo($2))\"", ")", "public", "static", "<", "C", ">", "int", "operator_spaceship", "(", "Comparable", "<", "?", "super", "C", ">", "left", ",", "C", "right", ")", "{", "return", "left", ".", "compareTo", "(", "right", ")", ";", "}" ]
The spaceship operator <code>&lt;=&gt;</code>. @param left a comparable @param right the value to compare with @return <code>left.compareTo(right)</code> @since 2.4
[ "The", "spaceship", "operator", "<code", ">", "&lt", ";", "=", "&gt", ";", "<", "/", "code", ">", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java#L90-L94
atomix/catalyst
serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java
SerializerRegistry.registerAbstract
public SerializerRegistry registerAbstract(Class<?> abstractType, int id, TypeSerializerFactory factory) { """ Registers the given class as an abstract serializer for the given abstract type. @param abstractType The abstract type for which to register the serializer. @param id The serializable type ID. @param factory The serializer factory. @return The serializer registry. """ abstractFactories.put(abstractType, factory); types.put(id, abstractType); ids.put(abstractType, id); return this; }
java
public SerializerRegistry registerAbstract(Class<?> abstractType, int id, TypeSerializerFactory factory) { abstractFactories.put(abstractType, factory); types.put(id, abstractType); ids.put(abstractType, id); return this; }
[ "public", "SerializerRegistry", "registerAbstract", "(", "Class", "<", "?", ">", "abstractType", ",", "int", "id", ",", "TypeSerializerFactory", "factory", ")", "{", "abstractFactories", ".", "put", "(", "abstractType", ",", "factory", ")", ";", "types", ".", "put", "(", "id", ",", "abstractType", ")", ";", "ids", ".", "put", "(", "abstractType", ",", "id", ")", ";", "return", "this", ";", "}" ]
Registers the given class as an abstract serializer for the given abstract type. @param abstractType The abstract type for which to register the serializer. @param id The serializable type ID. @param factory The serializer factory. @return The serializer registry.
[ "Registers", "the", "given", "class", "as", "an", "abstract", "serializer", "for", "the", "given", "abstract", "type", "." ]
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java#L243-L248
google/closure-templates
java/src/com/google/template/soy/data/ordainers/GsonOrdainer.java
GsonOrdainer.serializeObject
public static SanitizedContent serializeObject(Gson gson, Object obj) { """ Generate sanitized js content with provided Gson serializer. @param gson A Gson serializer. @param obj The object to render as gson. @return SanitizedContent containing the object rendered as a json string. """ return ordainJson(gson.toJson(obj)); }
java
public static SanitizedContent serializeObject(Gson gson, Object obj) { return ordainJson(gson.toJson(obj)); }
[ "public", "static", "SanitizedContent", "serializeObject", "(", "Gson", "gson", ",", "Object", "obj", ")", "{", "return", "ordainJson", "(", "gson", ".", "toJson", "(", "obj", ")", ")", ";", "}" ]
Generate sanitized js content with provided Gson serializer. @param gson A Gson serializer. @param obj The object to render as gson. @return SanitizedContent containing the object rendered as a json string.
[ "Generate", "sanitized", "js", "content", "with", "provided", "Gson", "serializer", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/ordainers/GsonOrdainer.java#L58-L60
lindar-open/well-rested-client
src/main/java/com/lindar/wellrested/WellRestedRequestBuilder.java
WellRestedRequestBuilder.globalHeaders
public WellRestedRequestBuilder globalHeaders(Map<String, String> globalHeaders) { """ Use this method to add some global headers to the WellRestedRequest object. These headers are going to be added on every request you make. <br/> A good use for this method is setting a global authentication header or a content type header. """ this.globalHeaders = WellRestedUtil.buildHeaders(globalHeaders); return this; }
java
public WellRestedRequestBuilder globalHeaders(Map<String, String> globalHeaders) { this.globalHeaders = WellRestedUtil.buildHeaders(globalHeaders); return this; }
[ "public", "WellRestedRequestBuilder", "globalHeaders", "(", "Map", "<", "String", ",", "String", ">", "globalHeaders", ")", "{", "this", ".", "globalHeaders", "=", "WellRestedUtil", ".", "buildHeaders", "(", "globalHeaders", ")", ";", "return", "this", ";", "}" ]
Use this method to add some global headers to the WellRestedRequest object. These headers are going to be added on every request you make. <br/> A good use for this method is setting a global authentication header or a content type header.
[ "Use", "this", "method", "to", "add", "some", "global", "headers", "to", "the", "WellRestedRequest", "object", ".", "These", "headers", "are", "going", "to", "be", "added", "on", "every", "request", "you", "make", ".", "<br", "/", ">", "A", "good", "use", "for", "this", "method", "is", "setting", "a", "global", "authentication", "header", "or", "a", "content", "type", "header", "." ]
train
https://github.com/lindar-open/well-rested-client/blob/d87542f747cd624e3ce0cdc8230f51836326596b/src/main/java/com/lindar/wellrested/WellRestedRequestBuilder.java#L155-L158
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java
CDKMCS.getIsomorphAtomsMap
public static List<CDKRMap> getIsomorphAtomsMap(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { """ Returns the first isomorph 'atom mapping' found for targetGraph in sourceGraph. @param sourceGraph first molecule. Must not be an IQueryAtomContainer. @param targetGraph second molecule. May be an IQueryAtomContainer. @param shouldMatchBonds @return the first isomorph atom mapping found projected on sourceGraph. This is atom List of CDKRMap objects containing Ids of matching atoms. @throws org.openscience.cdk.exception.CDKException if the first molecules is not an instance of {@link org.openscience.cdk.isomorphism.matchers.IQueryAtomContainer} """ if (sourceGraph instanceof IQueryAtomContainer) { throw new CDKException("The first IAtomContainer must not be an IQueryAtomContainer"); } List<CDKRMap> list = checkSingleAtomCases(sourceGraph, targetGraph); if (list == null) { return makeAtomsMapOfBondsMap(CDKMCS.getIsomorphMap(sourceGraph, targetGraph, shouldMatchBonds), sourceGraph, targetGraph); } else if (list.isEmpty()) { return null; } else { return list; } }
java
public static List<CDKRMap> getIsomorphAtomsMap(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { if (sourceGraph instanceof IQueryAtomContainer) { throw new CDKException("The first IAtomContainer must not be an IQueryAtomContainer"); } List<CDKRMap> list = checkSingleAtomCases(sourceGraph, targetGraph); if (list == null) { return makeAtomsMapOfBondsMap(CDKMCS.getIsomorphMap(sourceGraph, targetGraph, shouldMatchBonds), sourceGraph, targetGraph); } else if (list.isEmpty()) { return null; } else { return list; } }
[ "public", "static", "List", "<", "CDKRMap", ">", "getIsomorphAtomsMap", "(", "IAtomContainer", "sourceGraph", ",", "IAtomContainer", "targetGraph", ",", "boolean", "shouldMatchBonds", ")", "throws", "CDKException", "{", "if", "(", "sourceGraph", "instanceof", "IQueryAtomContainer", ")", "{", "throw", "new", "CDKException", "(", "\"The first IAtomContainer must not be an IQueryAtomContainer\"", ")", ";", "}", "List", "<", "CDKRMap", ">", "list", "=", "checkSingleAtomCases", "(", "sourceGraph", ",", "targetGraph", ")", ";", "if", "(", "list", "==", "null", ")", "{", "return", "makeAtomsMapOfBondsMap", "(", "CDKMCS", ".", "getIsomorphMap", "(", "sourceGraph", ",", "targetGraph", ",", "shouldMatchBonds", ")", ",", "sourceGraph", ",", "targetGraph", ")", ";", "}", "else", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "list", ";", "}", "}" ]
Returns the first isomorph 'atom mapping' found for targetGraph in sourceGraph. @param sourceGraph first molecule. Must not be an IQueryAtomContainer. @param targetGraph second molecule. May be an IQueryAtomContainer. @param shouldMatchBonds @return the first isomorph atom mapping found projected on sourceGraph. This is atom List of CDKRMap objects containing Ids of matching atoms. @throws org.openscience.cdk.exception.CDKException if the first molecules is not an instance of {@link org.openscience.cdk.isomorphism.matchers.IQueryAtomContainer}
[ "Returns", "the", "first", "isomorph", "atom", "mapping", "found", "for", "targetGraph", "in", "sourceGraph", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L221-L236
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcEditService.java
CmsUgcEditService.handleUpload
protected void handleUpload(HttpServletRequest request, HttpServletResponse response) { """ Handles all multipart requests.<p> @param request the request @param response the response """ String sessionIdStr = request.getParameter(CmsUgcConstants.PARAM_SESSION_ID); CmsUUID sessionId = new CmsUUID(sessionIdStr); CmsUgcSession session = CmsUgcSessionFactory.getInstance().getSession(request, sessionId); session.getFormUploadHelper().processFormSubmitRequest(request); }
java
protected void handleUpload(HttpServletRequest request, HttpServletResponse response) { String sessionIdStr = request.getParameter(CmsUgcConstants.PARAM_SESSION_ID); CmsUUID sessionId = new CmsUUID(sessionIdStr); CmsUgcSession session = CmsUgcSessionFactory.getInstance().getSession(request, sessionId); session.getFormUploadHelper().processFormSubmitRequest(request); }
[ "protected", "void", "handleUpload", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "String", "sessionIdStr", "=", "request", ".", "getParameter", "(", "CmsUgcConstants", ".", "PARAM_SESSION_ID", ")", ";", "CmsUUID", "sessionId", "=", "new", "CmsUUID", "(", "sessionIdStr", ")", ";", "CmsUgcSession", "session", "=", "CmsUgcSessionFactory", ".", "getInstance", "(", ")", ".", "getSession", "(", "request", ",", "sessionId", ")", ";", "session", ".", "getFormUploadHelper", "(", ")", ".", "processFormSubmitRequest", "(", "request", ")", ";", "}" ]
Handles all multipart requests.<p> @param request the request @param response the response
[ "Handles", "all", "multipart", "requests", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcEditService.java#L227-L233
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java
JaxWsUtils.getPortQName
private static QName getPortQName(ClassInfo classInfo, String namespace, String wsName, String wsPortName, String suffix) { """ Get portName. 1.declared portName in web service annotation 2.name in web service annotation + Port 3.service class name + Port. From specification: The portName element of the WebService annotation, if present, MUST be used to derive the port name to use in WSDL. In the absence of a portName element, an implementation MUST use the value of the name element of the WebService annotation, if present, suffixed with “Port”. Otherwise, an implementation MUST use the simple name of the class annotated with WebService suffixed with “Port”. @param classInfo @param namespace @param wsPortName @param suffix @return """ String portName; if (wsPortName != null && !wsPortName.isEmpty()) { portName = wsPortName.trim(); } else { if (wsName != null && !wsName.isEmpty()) { portName = wsName.trim(); } else { String qualifiedName = classInfo.getQualifiedName(); int lastDotIndex = qualifiedName.lastIndexOf("."); portName = (lastDotIndex == -1 ? qualifiedName : qualifiedName.substring(lastDotIndex + 1)); } portName = portName + suffix; } return new QName(namespace, portName); }
java
private static QName getPortQName(ClassInfo classInfo, String namespace, String wsName, String wsPortName, String suffix) { String portName; if (wsPortName != null && !wsPortName.isEmpty()) { portName = wsPortName.trim(); } else { if (wsName != null && !wsName.isEmpty()) { portName = wsName.trim(); } else { String qualifiedName = classInfo.getQualifiedName(); int lastDotIndex = qualifiedName.lastIndexOf("."); portName = (lastDotIndex == -1 ? qualifiedName : qualifiedName.substring(lastDotIndex + 1)); } portName = portName + suffix; } return new QName(namespace, portName); }
[ "private", "static", "QName", "getPortQName", "(", "ClassInfo", "classInfo", ",", "String", "namespace", ",", "String", "wsName", ",", "String", "wsPortName", ",", "String", "suffix", ")", "{", "String", "portName", ";", "if", "(", "wsPortName", "!=", "null", "&&", "!", "wsPortName", ".", "isEmpty", "(", ")", ")", "{", "portName", "=", "wsPortName", ".", "trim", "(", ")", ";", "}", "else", "{", "if", "(", "wsName", "!=", "null", "&&", "!", "wsName", ".", "isEmpty", "(", ")", ")", "{", "portName", "=", "wsName", ".", "trim", "(", ")", ";", "}", "else", "{", "String", "qualifiedName", "=", "classInfo", ".", "getQualifiedName", "(", ")", ";", "int", "lastDotIndex", "=", "qualifiedName", ".", "lastIndexOf", "(", "\".\"", ")", ";", "portName", "=", "(", "lastDotIndex", "==", "-", "1", "?", "qualifiedName", ":", "qualifiedName", ".", "substring", "(", "lastDotIndex", "+", "1", ")", ")", ";", "}", "portName", "=", "portName", "+", "suffix", ";", "}", "return", "new", "QName", "(", "namespace", ",", "portName", ")", ";", "}" ]
Get portName. 1.declared portName in web service annotation 2.name in web service annotation + Port 3.service class name + Port. From specification: The portName element of the WebService annotation, if present, MUST be used to derive the port name to use in WSDL. In the absence of a portName element, an implementation MUST use the value of the name element of the WebService annotation, if present, suffixed with “Port”. Otherwise, an implementation MUST use the simple name of the class annotated with WebService suffixed with “Port”. @param classInfo @param namespace @param wsPortName @param suffix @return
[ "Get", "portName", ".", "1", ".", "declared", "portName", "in", "web", "service", "annotation", "2", ".", "name", "in", "web", "service", "annotation", "+", "Port", "3", ".", "service", "class", "name", "+", "Port", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java#L407-L422
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfImportedPage.java
PdfImportedPage.addImage
public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException { """ Always throws an error. This operation is not allowed. @param image dummy @param a dummy @param b dummy @param c dummy @param d dummy @param e dummy @param f dummy @throws DocumentException dummy """ throwError(); }
java
public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException { throwError(); }
[ "public", "void", "addImage", "(", "Image", "image", ",", "float", "a", ",", "float", "b", ",", "float", "c", ",", "float", "d", ",", "float", "e", ",", "float", "f", ")", "throws", "DocumentException", "{", "throwError", "(", ")", ";", "}" ]
Always throws an error. This operation is not allowed. @param image dummy @param a dummy @param b dummy @param c dummy @param d dummy @param e dummy @param f dummy @throws DocumentException dummy
[ "Always", "throws", "an", "error", ".", "This", "operation", "is", "not", "allowed", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfImportedPage.java#L97-L99
looly/hutool
hutool-db/src/main/java/cn/hutool/db/StatementUtil.java
StatementUtil.prepareCall
public static CallableStatement prepareCall(Connection conn, String sql, Object... params) throws SQLException { """ 创建{@link CallableStatement} @param conn 数据库连接 @param sql SQL语句,使用"?"做为占位符 @param params "?"对应参数列表 @return {@link CallableStatement} @throws SQLException SQL异常 @since 4.1.13 """ Assert.notBlank(sql, "Sql String must be not blank!"); sql = sql.trim(); SqlLog.INSTASNCE.log(sql, params); final CallableStatement call = conn.prepareCall(sql); fillParams(call, params); return call; }
java
public static CallableStatement prepareCall(Connection conn, String sql, Object... params) throws SQLException { Assert.notBlank(sql, "Sql String must be not blank!"); sql = sql.trim(); SqlLog.INSTASNCE.log(sql, params); final CallableStatement call = conn.prepareCall(sql); fillParams(call, params); return call; }
[ "public", "static", "CallableStatement", "prepareCall", "(", "Connection", "conn", ",", "String", "sql", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "Assert", ".", "notBlank", "(", "sql", ",", "\"Sql String must be not blank!\"", ")", ";", "sql", "=", "sql", ".", "trim", "(", ")", ";", "SqlLog", ".", "INSTASNCE", ".", "log", "(", "sql", ",", "params", ")", ";", "final", "CallableStatement", "call", "=", "conn", ".", "prepareCall", "(", "sql", ")", ";", "fillParams", "(", "call", ",", "params", ")", ";", "return", "call", ";", "}" ]
创建{@link CallableStatement} @param conn 数据库连接 @param sql SQL语句,使用"?"做为占位符 @param params "?"对应参数列表 @return {@link CallableStatement} @throws SQLException SQL异常 @since 4.1.13
[ "创建", "{", "@link", "CallableStatement", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L200-L208
E7du/jfinal-ext3
src/main/java/com/jfinal/ext/kit/SqlpKit.java
SqlpKit.selectOne
public static SqlPara selectOne(ModelExt<?> model, String... columns) { """ make SqlPara use the model with attr datas. @param model @columns fetch columns """ return SqlpKit.select(model, FLAG.ONE, columns); }
java
public static SqlPara selectOne(ModelExt<?> model, String... columns) { return SqlpKit.select(model, FLAG.ONE, columns); }
[ "public", "static", "SqlPara", "selectOne", "(", "ModelExt", "<", "?", ">", "model", ",", "String", "...", "columns", ")", "{", "return", "SqlpKit", ".", "select", "(", "model", ",", "FLAG", ".", "ONE", ",", "columns", ")", ";", "}" ]
make SqlPara use the model with attr datas. @param model @columns fetch columns
[ "make", "SqlPara", "use", "the", "model", "with", "attr", "datas", "." ]
train
https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/SqlpKit.java#L124-L126
alipay/sofa-rpc
extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java
ProtobufHelper.getResClass
public Class getResClass(String service, String methodName) { """ 从缓存中获取返回值类 @param service 接口名 @param methodName 方法名 @return 请求参数类 """ String key = service + "#" + methodName; Class reqClass = responseClassCache.get(key); if (reqClass == null) { // 读取接口里的方法参数和返回值 String interfaceClass = ConfigUniqueNameGenerator.getInterfaceName(service); Class clazz = ClassUtils.forName(interfaceClass, true); loadProtoClassToCache(key, clazz, methodName); } return responseClassCache.get(key); }
java
public Class getResClass(String service, String methodName) { String key = service + "#" + methodName; Class reqClass = responseClassCache.get(key); if (reqClass == null) { // 读取接口里的方法参数和返回值 String interfaceClass = ConfigUniqueNameGenerator.getInterfaceName(service); Class clazz = ClassUtils.forName(interfaceClass, true); loadProtoClassToCache(key, clazz, methodName); } return responseClassCache.get(key); }
[ "public", "Class", "getResClass", "(", "String", "service", ",", "String", "methodName", ")", "{", "String", "key", "=", "service", "+", "\"#\"", "+", "methodName", ";", "Class", "reqClass", "=", "responseClassCache", ".", "get", "(", "key", ")", ";", "if", "(", "reqClass", "==", "null", ")", "{", "// 读取接口里的方法参数和返回值", "String", "interfaceClass", "=", "ConfigUniqueNameGenerator", ".", "getInterfaceName", "(", "service", ")", ";", "Class", "clazz", "=", "ClassUtils", ".", "forName", "(", "interfaceClass", ",", "true", ")", ";", "loadProtoClassToCache", "(", "key", ",", "clazz", ",", "methodName", ")", ";", "}", "return", "responseClassCache", ".", "get", "(", "key", ")", ";", "}" ]
从缓存中获取返回值类 @param service 接口名 @param methodName 方法名 @return 请求参数类
[ "从缓存中获取返回值类" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java#L88-L98
vladmihalcea/db-util
src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java
SQLStatementCountValidator.assertUpdateCount
public static void assertUpdateCount(long expectedUpdateCount) { """ Assert update statement count @param expectedUpdateCount expected update statement count """ QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedUpdateCount = queryCount.getUpdate(); if (expectedUpdateCount != recordedUpdateCount) { throw new SQLUpdateCountMismatchException(expectedUpdateCount, recordedUpdateCount); } }
java
public static void assertUpdateCount(long expectedUpdateCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedUpdateCount = queryCount.getUpdate(); if (expectedUpdateCount != recordedUpdateCount) { throw new SQLUpdateCountMismatchException(expectedUpdateCount, recordedUpdateCount); } }
[ "public", "static", "void", "assertUpdateCount", "(", "long", "expectedUpdateCount", ")", "{", "QueryCount", "queryCount", "=", "QueryCountHolder", ".", "getGrandTotal", "(", ")", ";", "long", "recordedUpdateCount", "=", "queryCount", ".", "getUpdate", "(", ")", ";", "if", "(", "expectedUpdateCount", "!=", "recordedUpdateCount", ")", "{", "throw", "new", "SQLUpdateCountMismatchException", "(", "expectedUpdateCount", ",", "recordedUpdateCount", ")", ";", "}", "}" ]
Assert update statement count @param expectedUpdateCount expected update statement count
[ "Assert", "update", "statement", "count" ]
train
https://github.com/vladmihalcea/db-util/blob/81c8c8421253c9869db1d4e221668d7afbd69fd0/src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java#L105-L111
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java
BaseTraceFormatter.consoleLogFormat
public String consoleLogFormat(LogRecord logRecord, String txt) { """ The console log is not structured, and relies on already formatted/translated messages @param logRecord @param txt the result of {@link #formatMessage} @return Formatted string for the console """ StringBuilder sb = new StringBuilder(256); sb.append(BaseTraceFormatter.levelToString(logRecord.getLevel())); sb.append(txt); Throwable t = logRecord.getThrown(); if (t != null) { String s = t.getLocalizedMessage(); if (s == null) s = t.toString(); sb.append(LoggingConstants.nl).append(s); } return sb.toString(); }
java
public String consoleLogFormat(LogRecord logRecord, String txt) { StringBuilder sb = new StringBuilder(256); sb.append(BaseTraceFormatter.levelToString(logRecord.getLevel())); sb.append(txt); Throwable t = logRecord.getThrown(); if (t != null) { String s = t.getLocalizedMessage(); if (s == null) s = t.toString(); sb.append(LoggingConstants.nl).append(s); } return sb.toString(); }
[ "public", "String", "consoleLogFormat", "(", "LogRecord", "logRecord", ",", "String", "txt", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "256", ")", ";", "sb", ".", "append", "(", "BaseTraceFormatter", ".", "levelToString", "(", "logRecord", ".", "getLevel", "(", ")", ")", ")", ";", "sb", ".", "append", "(", "txt", ")", ";", "Throwable", "t", "=", "logRecord", ".", "getThrown", "(", ")", ";", "if", "(", "t", "!=", "null", ")", "{", "String", "s", "=", "t", ".", "getLocalizedMessage", "(", ")", ";", "if", "(", "s", "==", "null", ")", "s", "=", "t", ".", "toString", "(", ")", ";", "sb", ".", "append", "(", "LoggingConstants", ".", "nl", ")", ".", "append", "(", "s", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
The console log is not structured, and relies on already formatted/translated messages @param logRecord @param txt the result of {@link #formatMessage} @return Formatted string for the console
[ "The", "console", "log", "is", "not", "structured", "and", "relies", "on", "already", "formatted", "/", "translated", "messages" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java#L394-L407
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/ExpectSteps.java
ExpectSteps.expectText
@Conditioned @Et("Je m'attends à avoir '(.*)-(.*)' avec le texte '(.*)'[\\.|\\?]") @And("I expect to have '(.*)-(.*)' with the text '(.*)'[\\.|\\?]") public void expectText(String page, String elementName, String textOrKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { """ Checks if an html element contains expected value. @param page The concerned page of elementName @param elementName The key of the PageElement to check @param textOrKey Is the new data (text or text in context (after a save)) @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error. @throws FailureException if the scenario encounters a functional error """ expectText(Page.getInstance(page).getPageElementByKey('-' + elementName), textOrKey); }
java
@Conditioned @Et("Je m'attends à avoir '(.*)-(.*)' avec le texte '(.*)'[\\.|\\?]") @And("I expect to have '(.*)-(.*)' with the text '(.*)'[\\.|\\?]") public void expectText(String page, String elementName, String textOrKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { expectText(Page.getInstance(page).getPageElementByKey('-' + elementName), textOrKey); }
[ "@", "Conditioned", "@", "Et", "(", "\"Je m'attends à avoir '(.*)-(.*)' avec le texte '(.*)'[\\\\.|\\\\?]\")", "", "@", "And", "(", "\"I expect to have '(.*)-(.*)' with the text '(.*)'[\\\\.|\\\\?]\"", ")", "public", "void", "expectText", "(", "String", "page", ",", "String", "elementName", ",", "String", "textOrKey", ",", "List", "<", "GherkinStepCondition", ">", "conditions", ")", "throws", "FailureException", ",", "TechnicalException", "{", "expectText", "(", "Page", ".", "getInstance", "(", "page", ")", ".", "getPageElementByKey", "(", "'", "'", "+", "elementName", ")", ",", "textOrKey", ")", ";", "}" ]
Checks if an html element contains expected value. @param page The concerned page of elementName @param elementName The key of the PageElement to check @param textOrKey Is the new data (text or text in context (after a save)) @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error. @throws FailureException if the scenario encounters a functional error
[ "Checks", "if", "an", "html", "element", "contains", "expected", "value", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/ExpectSteps.java#L51-L56
ontop/ontop
engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/impl/OneShotSQLGeneratorEngine.java
OneShotSQLGeneratorEngine.getTypeColumnForSELECT
private String getTypeColumnForSELECT(Term ht, AliasIndex index, Optional<TermType> optionalTermType) { """ Infers the type of a projected term. Note this type may differ from the one used for casting the main column (in some special cases). This type will appear as the RDF datatype. @param ht @param index Used when the term correspond to a column name @param optionalTermType """ if (ht instanceof Variable) { // Such variable does not hold this information, so we have to look // at the database metadata. return index.getTypeColumn((Variable) ht) .map(QualifiedAttributeID::getSQLRendering) // By default, we assume that the variable is an IRI. .orElseGet(() -> String.valueOf(OBJECT.getQuestCode())); } else { COL_TYPE colType = optionalTermType .flatMap(this::extractColType) // By default, we apply the "most" general COL_TYPE .orElse(STRING); return String.valueOf(colType.getQuestCode()); } }
java
private String getTypeColumnForSELECT(Term ht, AliasIndex index, Optional<TermType> optionalTermType) { if (ht instanceof Variable) { // Such variable does not hold this information, so we have to look // at the database metadata. return index.getTypeColumn((Variable) ht) .map(QualifiedAttributeID::getSQLRendering) // By default, we assume that the variable is an IRI. .orElseGet(() -> String.valueOf(OBJECT.getQuestCode())); } else { COL_TYPE colType = optionalTermType .flatMap(this::extractColType) // By default, we apply the "most" general COL_TYPE .orElse(STRING); return String.valueOf(colType.getQuestCode()); } }
[ "private", "String", "getTypeColumnForSELECT", "(", "Term", "ht", ",", "AliasIndex", "index", ",", "Optional", "<", "TermType", ">", "optionalTermType", ")", "{", "if", "(", "ht", "instanceof", "Variable", ")", "{", "// Such variable does not hold this information, so we have to look", "// at the database metadata.", "return", "index", ".", "getTypeColumn", "(", "(", "Variable", ")", "ht", ")", ".", "map", "(", "QualifiedAttributeID", "::", "getSQLRendering", ")", "// By default, we assume that the variable is an IRI.", ".", "orElseGet", "(", "(", ")", "->", "String", ".", "valueOf", "(", "OBJECT", ".", "getQuestCode", "(", ")", ")", ")", ";", "}", "else", "{", "COL_TYPE", "colType", "=", "optionalTermType", ".", "flatMap", "(", "this", "::", "extractColType", ")", "// By default, we apply the \"most\" general COL_TYPE", ".", "orElse", "(", "STRING", ")", ";", "return", "String", ".", "valueOf", "(", "colType", ".", "getQuestCode", "(", ")", ")", ";", "}", "}" ]
Infers the type of a projected term. Note this type may differ from the one used for casting the main column (in some special cases). This type will appear as the RDF datatype. @param ht @param index Used when the term correspond to a column name @param optionalTermType
[ "Infers", "the", "type", "of", "a", "projected", "term", "." ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/impl/OneShotSQLGeneratorEngine.java#L1038-L1056
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.setOverrideRepeatCount
public boolean setOverrideRepeatCount(String pathName, String methodName, Integer ordinal, Integer repeatCount) { """ Set the repeat count of an override at ordinal index @param pathName Path name @param methodName Fully qualified method name @param ordinal 1-based index of the override within the overrides of type methodName @param repeatCount new repeat count to set @return true if success, false otherwise """ try { String methodId = getOverrideIdForMethodName(methodName).toString(); BasicNameValuePair[] params = { new BasicNameValuePair("profileIdentifier", this._profileName), new BasicNameValuePair("ordinal", ordinal.toString()), new BasicNameValuePair("repeatNumber", repeatCount.toString()) }; JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName) + "/" + methodId, params)); return true; } catch (Exception e) { e.printStackTrace(); } return false; }
java
public boolean setOverrideRepeatCount(String pathName, String methodName, Integer ordinal, Integer repeatCount) { try { String methodId = getOverrideIdForMethodName(methodName).toString(); BasicNameValuePair[] params = { new BasicNameValuePair("profileIdentifier", this._profileName), new BasicNameValuePair("ordinal", ordinal.toString()), new BasicNameValuePair("repeatNumber", repeatCount.toString()) }; JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName) + "/" + methodId, params)); return true; } catch (Exception e) { e.printStackTrace(); } return false; }
[ "public", "boolean", "setOverrideRepeatCount", "(", "String", "pathName", ",", "String", "methodName", ",", "Integer", "ordinal", ",", "Integer", "repeatCount", ")", "{", "try", "{", "String", "methodId", "=", "getOverrideIdForMethodName", "(", "methodName", ")", ".", "toString", "(", ")", ";", "BasicNameValuePair", "[", "]", "params", "=", "{", "new", "BasicNameValuePair", "(", "\"profileIdentifier\"", ",", "this", ".", "_profileName", ")", ",", "new", "BasicNameValuePair", "(", "\"ordinal\"", ",", "ordinal", ".", "toString", "(", ")", ")", ",", "new", "BasicNameValuePair", "(", "\"repeatNumber\"", ",", "repeatCount", ".", "toString", "(", ")", ")", "}", ";", "JSONObject", "response", "=", "new", "JSONObject", "(", "doPost", "(", "BASE_PATH", "+", "uriEncode", "(", "pathName", ")", "+", "\"/\"", "+", "methodId", ",", "params", ")", ")", ";", "return", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}" ]
Set the repeat count of an override at ordinal index @param pathName Path name @param methodName Fully qualified method name @param ordinal 1-based index of the override within the overrides of type methodName @param repeatCount new repeat count to set @return true if success, false otherwise
[ "Set", "the", "repeat", "count", "of", "an", "override", "at", "ordinal", "index" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L652-L667
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectRaySphere
public static boolean intersectRaySphere(Rayf ray, Spheref sphere, Vector2f result) { """ Test whether the given ray intersects the given sphere, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a> @param ray the ray @param sphere the sphere @param result a vector that will contain the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the sphere @return <code>true</code> if the ray intersects the sphere; <code>false</code> otherwise """ return intersectRaySphere(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, sphere.x, sphere.y, sphere.z, sphere.r*sphere.r, result); }
java
public static boolean intersectRaySphere(Rayf ray, Spheref sphere, Vector2f result) { return intersectRaySphere(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, sphere.x, sphere.y, sphere.z, sphere.r*sphere.r, result); }
[ "public", "static", "boolean", "intersectRaySphere", "(", "Rayf", "ray", ",", "Spheref", "sphere", ",", "Vector2f", "result", ")", "{", "return", "intersectRaySphere", "(", "ray", ".", "oX", ",", "ray", ".", "oY", ",", "ray", ".", "oZ", ",", "ray", ".", "dX", ",", "ray", ".", "dY", ",", "ray", ".", "dZ", ",", "sphere", ".", "x", ",", "sphere", ".", "y", ",", "sphere", ".", "z", ",", "sphere", ".", "r", "*", "sphere", ".", "r", ",", "result", ")", ";", "}" ]
Test whether the given ray intersects the given sphere, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a> @param ray the ray @param sphere the sphere @param result a vector that will contain the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the sphere @return <code>true</code> if the ray intersects the sphere; <code>false</code> otherwise
[ "Test", "whether", "the", "given", "ray", "intersects", "the", "given", "sphere", "and", "store", "the", "values", "of", "the", "parameter", "<i", ">", "t<", "/", "i", ">", "in", "the", "ray", "equation", "<i", ">", "p", "(", "t", ")", "=", "origin", "+", "t", "*", "dir<", "/", "i", ">", "for", "both", "points", "(", "near", "and", "far", ")", "of", "intersections", "into", "the", "given", "<code", ">", "result<", "/", "code", ">", "vector", ".", "<p", ">", "This", "method", "returns", "<code", ">", "true<", "/", "code", ">", "for", "a", "ray", "whose", "origin", "lies", "inside", "the", "sphere", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "scratchapixel", ".", "com", "/", "lessons", "/", "3d", "-", "basic", "-", "rendering", "/", "minimal", "-", "ray", "-", "tracer", "-", "rendering", "-", "simple", "-", "shapes", "/", "ray", "-", "sphere", "-", "intersection", ">", "http", ":", "//", "www", ".", "scratchapixel", ".", "com", "/", "<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L2134-L2136
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_feature_duration_GET
public OvhOrder dedicated_server_serviceName_feature_duration_GET(String serviceName, String duration, OvhOrderableSysFeatureEnum feature) throws IOException { """ Get prices and contracts information REST: GET /order/dedicated/server/{serviceName}/feature/{duration} @param feature [required] the feature @param serviceName [required] The internal name of your dedicated server @param duration [required] Duration """ String qPath = "/order/dedicated/server/{serviceName}/feature/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "feature", feature); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicated_server_serviceName_feature_duration_GET(String serviceName, String duration, OvhOrderableSysFeatureEnum feature) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/feature/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "feature", feature); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicated_server_serviceName_feature_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhOrderableSysFeatureEnum", "feature", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/feature/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"feature\"", ",", "feature", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/dedicated/server/{serviceName}/feature/{duration} @param feature [required] the feature @param serviceName [required] The internal name of your dedicated server @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2209-L2215
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java
SoundStore.getAIF
public Audio getAIF(String ref) throws IOException { """ Get the Sound based on a specified AIF file @param ref The reference to the AIF file in the classpath @return The Sound read from the AIF file @throws IOException Indicates a failure to load the AIF """ return getAIF(ref, ResourceLoader.getResourceAsStream(ref)); }
java
public Audio getAIF(String ref) throws IOException { return getAIF(ref, ResourceLoader.getResourceAsStream(ref)); }
[ "public", "Audio", "getAIF", "(", "String", "ref", ")", "throws", "IOException", "{", "return", "getAIF", "(", "ref", ",", "ResourceLoader", ".", "getResourceAsStream", "(", "ref", ")", ")", ";", "}" ]
Get the Sound based on a specified AIF file @param ref The reference to the AIF file in the classpath @return The Sound read from the AIF file @throws IOException Indicates a failure to load the AIF
[ "Get", "the", "Sound", "based", "on", "a", "specified", "AIF", "file" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java#L595-L597
trellis-ldp-archive/trellis-http
src/main/java/org/trellisldp/http/impl/RdfUtils.java
RdfUtils.getDefaultProfile
public static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier) { """ Get a default profile IRI from the syntax and/or identifier @param syntax the RDF syntax @param identifier the resource identifier @return a profile IRI usable by the output streamer """ return getDefaultProfile(syntax, rdf.createIRI(identifier)); }
java
public static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier) { return getDefaultProfile(syntax, rdf.createIRI(identifier)); }
[ "public", "static", "IRI", "getDefaultProfile", "(", "final", "RDFSyntax", "syntax", ",", "final", "String", "identifier", ")", "{", "return", "getDefaultProfile", "(", "syntax", ",", "rdf", ".", "createIRI", "(", "identifier", ")", ")", ";", "}" ]
Get a default profile IRI from the syntax and/or identifier @param syntax the RDF syntax @param identifier the resource identifier @return a profile IRI usable by the output streamer
[ "Get", "a", "default", "profile", "IRI", "from", "the", "syntax", "and", "/", "or", "identifier" ]
train
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L230-L232
darylteo/directory-watcher
src/main/java/com/darylteo/nio/AbstractDirectoryWatchService.java
AbstractDirectoryWatchService.newWatcher
public DirectoryWatcher newWatcher(Path dir, String separator) throws IOException { """ <p> Instantiates a new DirectoryWatcher for the path given. </p> @param dir the path to watch for events. @param separator the file path separator for this watcher @return a DirectoryWatcher for this path (and all child paths) @throws IOException """ DirectoryWatcher watcher = new DirectoryWatcher(this.watchService, dir, separator); addWatcher(watcher); return watcher; }
java
public DirectoryWatcher newWatcher(Path dir, String separator) throws IOException { DirectoryWatcher watcher = new DirectoryWatcher(this.watchService, dir, separator); addWatcher(watcher); return watcher; }
[ "public", "DirectoryWatcher", "newWatcher", "(", "Path", "dir", ",", "String", "separator", ")", "throws", "IOException", "{", "DirectoryWatcher", "watcher", "=", "new", "DirectoryWatcher", "(", "this", ".", "watchService", ",", "dir", ",", "separator", ")", ";", "addWatcher", "(", "watcher", ")", ";", "return", "watcher", ";", "}" ]
<p> Instantiates a new DirectoryWatcher for the path given. </p> @param dir the path to watch for events. @param separator the file path separator for this watcher @return a DirectoryWatcher for this path (and all child paths) @throws IOException
[ "<p", ">", "Instantiates", "a", "new", "DirectoryWatcher", "for", "the", "path", "given", ".", "<", "/", "p", ">" ]
train
https://github.com/darylteo/directory-watcher/blob/c1144366dcf58443073c0a67d1a5f6535ac5e8d8/src/main/java/com/darylteo/nio/AbstractDirectoryWatchService.java#L93-L98
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskLog.java
TaskLog.addCommand
public static String addCommand(List<String> cmd, boolean isExecutable) throws IOException { """ Add quotes to each of the command strings and return as a single string @param cmd The command to be quoted @param isExecutable makes shell path if the first argument is executable @return returns The quoted string. @throws IOException """ StringBuffer command = new StringBuffer(); for(String s: cmd) { command.append('\''); if (isExecutable) { // the executable name needs to be expressed as a shell path for the // shell to find it. command.append(FileUtil.makeShellPath(new File(s))); isExecutable = false; } else { command.append(s); } command.append('\''); command.append(" "); } return command.toString(); }
java
public static String addCommand(List<String> cmd, boolean isExecutable) throws IOException { StringBuffer command = new StringBuffer(); for(String s: cmd) { command.append('\''); if (isExecutable) { // the executable name needs to be expressed as a shell path for the // shell to find it. command.append(FileUtil.makeShellPath(new File(s))); isExecutable = false; } else { command.append(s); } command.append('\''); command.append(" "); } return command.toString(); }
[ "public", "static", "String", "addCommand", "(", "List", "<", "String", ">", "cmd", ",", "boolean", "isExecutable", ")", "throws", "IOException", "{", "StringBuffer", "command", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "String", "s", ":", "cmd", ")", "{", "command", ".", "append", "(", "'", "'", ")", ";", "if", "(", "isExecutable", ")", "{", "// the executable name needs to be expressed as a shell path for the ", "// shell to find it.", "command", ".", "append", "(", "FileUtil", ".", "makeShellPath", "(", "new", "File", "(", "s", ")", ")", ")", ";", "isExecutable", "=", "false", ";", "}", "else", "{", "command", ".", "append", "(", "s", ")", ";", "}", "command", ".", "append", "(", "'", "'", ")", ";", "command", ".", "append", "(", "\" \"", ")", ";", "}", "return", "command", ".", "toString", "(", ")", ";", "}" ]
Add quotes to each of the command strings and return as a single string @param cmd The command to be quoted @param isExecutable makes shell path if the first argument is executable @return returns The quoted string. @throws IOException
[ "Add", "quotes", "to", "each", "of", "the", "command", "strings", "and", "return", "as", "a", "single", "string" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskLog.java#L685-L702
sannies/mp4parser
streaming/src/main/java/org/mp4parser/streaming/output/mp4/StandardMp4Writer.java
StandardMp4Writer.isChunkReady
protected boolean isChunkReady(StreamingTrack streamingTrack, StreamingSample next) { """ Tests if the currently received samples for a given track are already a 'chunk' as we want to have it. The next sample will not be part of the chunk will be added to the fragment buffer later. @param streamingTrack track to test @param next the lastest samples @return true if a chunk is to b e created. """ long ts = nextSampleStartTime.get(streamingTrack); long cfst = nextChunkCreateStartTime.get(streamingTrack); return (ts >= cfst + 2 * streamingTrack.getTimescale()); // chunk interleave of 2 seconds }
java
protected boolean isChunkReady(StreamingTrack streamingTrack, StreamingSample next) { long ts = nextSampleStartTime.get(streamingTrack); long cfst = nextChunkCreateStartTime.get(streamingTrack); return (ts >= cfst + 2 * streamingTrack.getTimescale()); // chunk interleave of 2 seconds }
[ "protected", "boolean", "isChunkReady", "(", "StreamingTrack", "streamingTrack", ",", "StreamingSample", "next", ")", "{", "long", "ts", "=", "nextSampleStartTime", ".", "get", "(", "streamingTrack", ")", ";", "long", "cfst", "=", "nextChunkCreateStartTime", ".", "get", "(", "streamingTrack", ")", ";", "return", "(", "ts", ">=", "cfst", "+", "2", "*", "streamingTrack", ".", "getTimescale", "(", ")", ")", ";", "// chunk interleave of 2 seconds", "}" ]
Tests if the currently received samples for a given track are already a 'chunk' as we want to have it. The next sample will not be part of the chunk will be added to the fragment buffer later. @param streamingTrack track to test @param next the lastest samples @return true if a chunk is to b e created.
[ "Tests", "if", "the", "currently", "received", "samples", "for", "a", "given", "track", "are", "already", "a", "chunk", "as", "we", "want", "to", "have", "it", ".", "The", "next", "sample", "will", "not", "be", "part", "of", "the", "chunk", "will", "be", "added", "to", "the", "fragment", "buffer", "later", "." ]
train
https://github.com/sannies/mp4parser/blob/3382ff5d489363900f352a8da0f794a20ad3b063/streaming/src/main/java/org/mp4parser/streaming/output/mp4/StandardMp4Writer.java#L181-L187
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/MessagingJBossASClient.java
MessagingJBossASClient.createNewQueueRequest
public ModelNode createNewQueueRequest(String name, Boolean durable, List<String> entryNames) { """ Returns a ModelNode that can be used to create a queue. Callers are free to tweak the queue request that is returned, if they so choose, before asking the client to execute the request. @param name the queue name @param durable if null, default is "true" @param entryNames the jndiNames, each is prefixed with 'java:/'. Only supports one entry currently. @return the request that can be used to create the queue """ String dmrTemplate = "" // + "{" // + "\"durable\" => \"%s\", " // + "\"entries\" => [\"%s\"] " // + "}"; String dmr = String.format(dmrTemplate, ((null == durable) ? "true" : durable.toString()), entryNames.get(0)); Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE, name); final ModelNode request = ModelNode.fromString(dmr); request.get(OPERATION).set(ADD); request.get(ADDRESS).set(addr.getAddressNode()); return request; }
java
public ModelNode createNewQueueRequest(String name, Boolean durable, List<String> entryNames) { String dmrTemplate = "" // + "{" // + "\"durable\" => \"%s\", " // + "\"entries\" => [\"%s\"] " // + "}"; String dmr = String.format(dmrTemplate, ((null == durable) ? "true" : durable.toString()), entryNames.get(0)); Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE, name); final ModelNode request = ModelNode.fromString(dmr); request.get(OPERATION).set(ADD); request.get(ADDRESS).set(addr.getAddressNode()); return request; }
[ "public", "ModelNode", "createNewQueueRequest", "(", "String", "name", ",", "Boolean", "durable", ",", "List", "<", "String", ">", "entryNames", ")", "{", "String", "dmrTemplate", "=", "\"\"", "//", "+", "\"{\"", "//", "+", "\"\\\"durable\\\" => \\\"%s\\\", \"", "//", "+", "\"\\\"entries\\\" => [\\\"%s\\\"] \"", "//", "+", "\"}\"", ";", "String", "dmr", "=", "String", ".", "format", "(", "dmrTemplate", ",", "(", "(", "null", "==", "durable", ")", "?", "\"true\"", ":", "durable", ".", "toString", "(", ")", ")", ",", "entryNames", ".", "get", "(", "0", ")", ")", ";", "Address", "addr", "=", "Address", ".", "root", "(", ")", ".", "add", "(", "SUBSYSTEM", ",", "SUBSYSTEM_MESSAGING", ",", "HORNETQ_SERVER", ",", "\"default\"", ",", "JMS_QUEUE", ",", "name", ")", ";", "final", "ModelNode", "request", "=", "ModelNode", ".", "fromString", "(", "dmr", ")", ";", "request", ".", "get", "(", "OPERATION", ")", ".", "set", "(", "ADD", ")", ";", "request", ".", "get", "(", "ADDRESS", ")", ".", "set", "(", "addr", ".", "getAddressNode", "(", ")", ")", ";", "return", "request", ";", "}" ]
Returns a ModelNode that can be used to create a queue. Callers are free to tweak the queue request that is returned, if they so choose, before asking the client to execute the request. @param name the queue name @param durable if null, default is "true" @param entryNames the jndiNames, each is prefixed with 'java:/'. Only supports one entry currently. @return the request that can be used to create the queue
[ "Returns", "a", "ModelNode", "that", "can", "be", "used", "to", "create", "a", "queue", ".", "Callers", "are", "free", "to", "tweak", "the", "queue", "request", "that", "is", "returned", "if", "they", "so", "choose", "before", "asking", "the", "client", "to", "execute", "the", "request", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/MessagingJBossASClient.java#L64-L80
UrielCh/ovh-java-sdk
ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java
ApiOvhNewAccount.creationRules_GET
public OvhCreationRules creationRules_GET(OvhCountryEnum country, OvhLegalFormEnum legalform, OvhOvhCompanyEnum ovhCompany, OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException { """ Give all the rules to follow in order to create an OVH identifier REST: GET /newAccount/creationRules @param legalform [required] @param ovhCompany [required] @param ovhSubsidiary [required] @param country [required] """ String qPath = "/newAccount/creationRules"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "legalform", legalform); query(sb, "ovhCompany", ovhCompany); query(sb, "ovhSubsidiary", ovhSubsidiary); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCreationRules.class); }
java
public OvhCreationRules creationRules_GET(OvhCountryEnum country, OvhLegalFormEnum legalform, OvhOvhCompanyEnum ovhCompany, OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException { String qPath = "/newAccount/creationRules"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "legalform", legalform); query(sb, "ovhCompany", ovhCompany); query(sb, "ovhSubsidiary", ovhSubsidiary); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCreationRules.class); }
[ "public", "OvhCreationRules", "creationRules_GET", "(", "OvhCountryEnum", "country", ",", "OvhLegalFormEnum", "legalform", ",", "OvhOvhCompanyEnum", "ovhCompany", ",", "OvhOvhSubsidiaryEnum", "ovhSubsidiary", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/newAccount/creationRules\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"country\"", ",", "country", ")", ";", "query", "(", "sb", ",", "\"legalform\"", ",", "legalform", ")", ";", "query", "(", "sb", ",", "\"ovhCompany\"", ",", "ovhCompany", ")", ";", "query", "(", "sb", ",", "\"ovhSubsidiary\"", ",", "ovhSubsidiary", ")", ";", "String", "resp", "=", "execN", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhCreationRules", ".", "class", ")", ";", "}" ]
Give all the rules to follow in order to create an OVH identifier REST: GET /newAccount/creationRules @param legalform [required] @param ovhCompany [required] @param ovhSubsidiary [required] @param country [required]
[ "Give", "all", "the", "rules", "to", "follow", "in", "order", "to", "create", "an", "OVH", "identifier" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java#L167-L176
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.setScratchData
public void setScratchData(ScratchBank bank, byte[] data) { """ Set a scratch bank data value with raw bytes. @param bank The {@link com.punchthrough.bean.sdk.message.ScratchBank} being set @param data The bytes to write into the scratch bank """ ScratchData sd = ScratchData.create(bank, data); sendMessage(BeanMessageID.BT_SET_SCRATCH, sd); }
java
public void setScratchData(ScratchBank bank, byte[] data) { ScratchData sd = ScratchData.create(bank, data); sendMessage(BeanMessageID.BT_SET_SCRATCH, sd); }
[ "public", "void", "setScratchData", "(", "ScratchBank", "bank", ",", "byte", "[", "]", "data", ")", "{", "ScratchData", "sd", "=", "ScratchData", ".", "create", "(", "bank", ",", "data", ")", ";", "sendMessage", "(", "BeanMessageID", ".", "BT_SET_SCRATCH", ",", "sd", ")", ";", "}" ]
Set a scratch bank data value with raw bytes. @param bank The {@link com.punchthrough.bean.sdk.message.ScratchBank} being set @param data The bytes to write into the scratch bank
[ "Set", "a", "scratch", "bank", "data", "value", "with", "raw", "bytes", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L926-L929
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_exchangeLite_options_isEmailAvailable_GET
public Boolean packName_exchangeLite_options_isEmailAvailable_GET(String packName, String email) throws IOException { """ Check if the email address is available for service creation REST: GET /pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable @param email [required] Email @param packName [required] The internal name of your pack """ String qPath = "/pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable"; StringBuilder sb = path(qPath, packName); query(sb, "email", email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, Boolean.class); }
java
public Boolean packName_exchangeLite_options_isEmailAvailable_GET(String packName, String email) throws IOException { String qPath = "/pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable"; StringBuilder sb = path(qPath, packName); query(sb, "email", email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, Boolean.class); }
[ "public", "Boolean", "packName_exchangeLite_options_isEmailAvailable_GET", "(", "String", "packName", ",", "String", "email", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "query", "(", "sb", ",", "\"email\"", ",", "email", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "Boolean", ".", "class", ")", ";", "}" ]
Check if the email address is available for service creation REST: GET /pack/xdsl/{packName}/exchangeLite/options/isEmailAvailable @param email [required] Email @param packName [required] The internal name of your pack
[ "Check", "if", "the", "email", "address", "is", "available", "for", "service", "creation" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L604-L610
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.buildCoverage
public static GridCoverage2D buildCoverage( String name, WritableRaster writableRaster, HashMap<String, Double> envelopeParams, CoordinateReferenceSystem crs ) { """ Creates a {@link GridCoverage2D coverage} from the {@link WritableRaster writable raster} and the necessary geographic Information. @param name the name of the coverage. @param writableRaster the raster containing the data. @param envelopeParams the map of boundary parameters. @param crs the {@link CoordinateReferenceSystem}. @return the {@link GridCoverage2D coverage}. """ if (writableRaster instanceof GrassLegacyWritableRaster) { GrassLegacyWritableRaster wRaster = (GrassLegacyWritableRaster) writableRaster; double west = envelopeParams.get(WEST); double south = envelopeParams.get(SOUTH); double east = envelopeParams.get(EAST); double north = envelopeParams.get(NORTH); int rows = envelopeParams.get(ROWS).intValue(); int cols = envelopeParams.get(COLS).intValue(); Window window = new Window(west, east, south, north, rows, cols); GrassLegacyGridCoverage2D coverage2D = new GrassLegacyGridCoverage2D(window, wRaster.getData(), crs); return coverage2D; } else { double west = envelopeParams.get(WEST); double south = envelopeParams.get(SOUTH); double east = envelopeParams.get(EAST); double north = envelopeParams.get(NORTH); Envelope2D writeEnvelope = new Envelope2D(crs, west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create(name, writableRaster, writeEnvelope); return coverage2D; } }
java
public static GridCoverage2D buildCoverage( String name, WritableRaster writableRaster, HashMap<String, Double> envelopeParams, CoordinateReferenceSystem crs ) { if (writableRaster instanceof GrassLegacyWritableRaster) { GrassLegacyWritableRaster wRaster = (GrassLegacyWritableRaster) writableRaster; double west = envelopeParams.get(WEST); double south = envelopeParams.get(SOUTH); double east = envelopeParams.get(EAST); double north = envelopeParams.get(NORTH); int rows = envelopeParams.get(ROWS).intValue(); int cols = envelopeParams.get(COLS).intValue(); Window window = new Window(west, east, south, north, rows, cols); GrassLegacyGridCoverage2D coverage2D = new GrassLegacyGridCoverage2D(window, wRaster.getData(), crs); return coverage2D; } else { double west = envelopeParams.get(WEST); double south = envelopeParams.get(SOUTH); double east = envelopeParams.get(EAST); double north = envelopeParams.get(NORTH); Envelope2D writeEnvelope = new Envelope2D(crs, west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create(name, writableRaster, writeEnvelope); return coverage2D; } }
[ "public", "static", "GridCoverage2D", "buildCoverage", "(", "String", "name", ",", "WritableRaster", "writableRaster", ",", "HashMap", "<", "String", ",", "Double", ">", "envelopeParams", ",", "CoordinateReferenceSystem", "crs", ")", "{", "if", "(", "writableRaster", "instanceof", "GrassLegacyWritableRaster", ")", "{", "GrassLegacyWritableRaster", "wRaster", "=", "(", "GrassLegacyWritableRaster", ")", "writableRaster", ";", "double", "west", "=", "envelopeParams", ".", "get", "(", "WEST", ")", ";", "double", "south", "=", "envelopeParams", ".", "get", "(", "SOUTH", ")", ";", "double", "east", "=", "envelopeParams", ".", "get", "(", "EAST", ")", ";", "double", "north", "=", "envelopeParams", ".", "get", "(", "NORTH", ")", ";", "int", "rows", "=", "envelopeParams", ".", "get", "(", "ROWS", ")", ".", "intValue", "(", ")", ";", "int", "cols", "=", "envelopeParams", ".", "get", "(", "COLS", ")", ".", "intValue", "(", ")", ";", "Window", "window", "=", "new", "Window", "(", "west", ",", "east", ",", "south", ",", "north", ",", "rows", ",", "cols", ")", ";", "GrassLegacyGridCoverage2D", "coverage2D", "=", "new", "GrassLegacyGridCoverage2D", "(", "window", ",", "wRaster", ".", "getData", "(", ")", ",", "crs", ")", ";", "return", "coverage2D", ";", "}", "else", "{", "double", "west", "=", "envelopeParams", ".", "get", "(", "WEST", ")", ";", "double", "south", "=", "envelopeParams", ".", "get", "(", "SOUTH", ")", ";", "double", "east", "=", "envelopeParams", ".", "get", "(", "EAST", ")", ";", "double", "north", "=", "envelopeParams", ".", "get", "(", "NORTH", ")", ";", "Envelope2D", "writeEnvelope", "=", "new", "Envelope2D", "(", "crs", ",", "west", ",", "south", ",", "east", "-", "west", ",", "north", "-", "south", ")", ";", "GridCoverageFactory", "factory", "=", "CoverageFactoryFinder", ".", "getGridCoverageFactory", "(", "null", ")", ";", "GridCoverage2D", "coverage2D", "=", "factory", ".", "create", "(", "name", ",", "writableRaster", ",", "writeEnvelope", ")", ";", "return", "coverage2D", ";", "}", "}" ]
Creates a {@link GridCoverage2D coverage} from the {@link WritableRaster writable raster} and the necessary geographic Information. @param name the name of the coverage. @param writableRaster the raster containing the data. @param envelopeParams the map of boundary parameters. @param crs the {@link CoordinateReferenceSystem}. @return the {@link GridCoverage2D coverage}.
[ "Creates", "a", "{", "@link", "GridCoverage2D", "coverage", "}", "from", "the", "{", "@link", "WritableRaster", "writable", "raster", "}", "and", "the", "necessary", "geographic", "Information", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L885-L909
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/Link.java
Link.fromSpanContext
public static Link fromSpanContext(SpanContext context, Type type) { """ Returns a new {@code Link}. @param context the context of the linked {@code Span}. @param type the type of the relationship with the linked {@code Span}. @return a new {@code Link}. @since 0.5 """ return new AutoValue_Link(context.getTraceId(), context.getSpanId(), type, EMPTY_ATTRIBUTES); }
java
public static Link fromSpanContext(SpanContext context, Type type) { return new AutoValue_Link(context.getTraceId(), context.getSpanId(), type, EMPTY_ATTRIBUTES); }
[ "public", "static", "Link", "fromSpanContext", "(", "SpanContext", "context", ",", "Type", "type", ")", "{", "return", "new", "AutoValue_Link", "(", "context", ".", "getTraceId", "(", ")", ",", "context", ".", "getSpanId", "(", ")", ",", "type", ",", "EMPTY_ATTRIBUTES", ")", ";", "}" ]
Returns a new {@code Link}. @param context the context of the linked {@code Span}. @param type the type of the relationship with the linked {@code Span}. @return a new {@code Link}. @since 0.5
[ "Returns", "a", "new", "{", "@code", "Link", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/Link.java#L69-L71
apache/incubator-zipkin
zipkin-collector/core/src/main/java/zipkin2/collector/CollectorSampler.java
CollectorSampler.isSampled
public boolean isSampled(String hexTraceId, boolean debug) { """ Returns true if spans with this trace ID should be recorded to storage. <p>Zipkin v1 allows storage-layer sampling, which can help prevent spikes in traffic from overloading the system. Debug spans are always stored. <p>This uses only the lower 64 bits of the trace ID as instrumentation still send mixed trace ID width. @param hexTraceId the lower 64 bits of the span's trace ID are checked against the boundary @param debug when true, always passes sampling """ if (Boolean.TRUE.equals(debug)) return true; long traceId = HexCodec.lowerHexToUnsignedLong(hexTraceId); // The absolute value of Long.MIN_VALUE is larger than a long, so Math.abs returns identity. // This converts to MAX_VALUE to avoid always dropping when traceId == Long.MIN_VALUE long t = traceId == Long.MIN_VALUE ? Long.MAX_VALUE : Math.abs(traceId); return t <= boundary(); }
java
public boolean isSampled(String hexTraceId, boolean debug) { if (Boolean.TRUE.equals(debug)) return true; long traceId = HexCodec.lowerHexToUnsignedLong(hexTraceId); // The absolute value of Long.MIN_VALUE is larger than a long, so Math.abs returns identity. // This converts to MAX_VALUE to avoid always dropping when traceId == Long.MIN_VALUE long t = traceId == Long.MIN_VALUE ? Long.MAX_VALUE : Math.abs(traceId); return t <= boundary(); }
[ "public", "boolean", "isSampled", "(", "String", "hexTraceId", ",", "boolean", "debug", ")", "{", "if", "(", "Boolean", ".", "TRUE", ".", "equals", "(", "debug", ")", ")", "return", "true", ";", "long", "traceId", "=", "HexCodec", ".", "lowerHexToUnsignedLong", "(", "hexTraceId", ")", ";", "// The absolute value of Long.MIN_VALUE is larger than a long, so Math.abs returns identity.", "// This converts to MAX_VALUE to avoid always dropping when traceId == Long.MIN_VALUE", "long", "t", "=", "traceId", "==", "Long", ".", "MIN_VALUE", "?", "Long", ".", "MAX_VALUE", ":", "Math", ".", "abs", "(", "traceId", ")", ";", "return", "t", "<=", "boundary", "(", ")", ";", "}" ]
Returns true if spans with this trace ID should be recorded to storage. <p>Zipkin v1 allows storage-layer sampling, which can help prevent spikes in traffic from overloading the system. Debug spans are always stored. <p>This uses only the lower 64 bits of the trace ID as instrumentation still send mixed trace ID width. @param hexTraceId the lower 64 bits of the span's trace ID are checked against the boundary @param debug when true, always passes sampling
[ "Returns", "true", "if", "spans", "with", "this", "trace", "ID", "should", "be", "recorded", "to", "storage", "." ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-collector/core/src/main/java/zipkin2/collector/CollectorSampler.java#L66-L73
zeroturnaround/zt-exec
src/main/java/org/zeroturnaround/exec/ProcessExecutor.java
ProcessExecutor.wrapTask
protected <T> Callable<T> wrapTask(Callable<T> task) { """ Override this to customize how the background task is created. @param <T> the type of the Task @param task the Task to be wrapped @return the wrapped task """ // Preserve the MDC context of the caller thread. Map contextMap = MDC.getCopyOfContextMap(); if (contextMap != null) { return new MDCCallableAdapter(task, contextMap); } return task; }
java
protected <T> Callable<T> wrapTask(Callable<T> task) { // Preserve the MDC context of the caller thread. Map contextMap = MDC.getCopyOfContextMap(); if (contextMap != null) { return new MDCCallableAdapter(task, contextMap); } return task; }
[ "protected", "<", "T", ">", "Callable", "<", "T", ">", "wrapTask", "(", "Callable", "<", "T", ">", "task", ")", "{", "// Preserve the MDC context of the caller thread.", "Map", "contextMap", "=", "MDC", ".", "getCopyOfContextMap", "(", ")", ";", "if", "(", "contextMap", "!=", "null", ")", "{", "return", "new", "MDCCallableAdapter", "(", "task", ",", "contextMap", ")", ";", "}", "return", "task", ";", "}" ]
Override this to customize how the background task is created. @param <T> the type of the Task @param task the Task to be wrapped @return the wrapped task
[ "Override", "this", "to", "customize", "how", "the", "background", "task", "is", "created", "." ]
train
https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/ProcessExecutor.java#L1179-L1186
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/URI.java
URI.setFragment
public void setFragment(String p_fragment) throws MalformedURIException { """ Set the fragment for this URI. A non-null value is valid only if this is a URI conforming to the generic URI syntax and the path value is not null. @param p_fragment the fragment for this URI @throws MalformedURIException if p_fragment is not null and this URI does not conform to the generic URI syntax or if the path is null """ if (p_fragment == null) { m_fragment = null; } else if (!isGenericURI()) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be set for a generic URI!"); } else if (getPath() == null) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_WHEN_PATH_NULL, null)); //"Fragment cannot be set when path is null!"); } else if (!isURIString(p_fragment)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_INVALID_CHAR, null)); //"Fragment contains invalid character!"); } else { m_fragment = p_fragment; } }
java
public void setFragment(String p_fragment) throws MalformedURIException { if (p_fragment == null) { m_fragment = null; } else if (!isGenericURI()) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be set for a generic URI!"); } else if (getPath() == null) { throw new MalformedURIException( XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_WHEN_PATH_NULL, null)); //"Fragment cannot be set when path is null!"); } else if (!isURIString(p_fragment)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_INVALID_CHAR, null)); //"Fragment contains invalid character!"); } else { m_fragment = p_fragment; } }
[ "public", "void", "setFragment", "(", "String", "p_fragment", ")", "throws", "MalformedURIException", "{", "if", "(", "p_fragment", "==", "null", ")", "{", "m_fragment", "=", "null", ";", "}", "else", "if", "(", "!", "isGenericURI", "(", ")", ")", "{", "throw", "new", "MalformedURIException", "(", "XMLMessages", ".", "createXMLMessage", "(", "XMLErrorResources", ".", "ER_FRAG_FOR_GENERIC_URI", ",", "null", ")", ")", ";", "//\"Fragment can only be set for a generic URI!\");", "}", "else", "if", "(", "getPath", "(", ")", "==", "null", ")", "{", "throw", "new", "MalformedURIException", "(", "XMLMessages", ".", "createXMLMessage", "(", "XMLErrorResources", ".", "ER_FRAG_WHEN_PATH_NULL", ",", "null", ")", ")", ";", "//\"Fragment cannot be set when path is null!\");", "}", "else", "if", "(", "!", "isURIString", "(", "p_fragment", ")", ")", "{", "throw", "new", "MalformedURIException", "(", "XMLMessages", ".", "createXMLMessage", "(", "XMLErrorResources", ".", "ER_FRAG_INVALID_CHAR", ",", "null", ")", ")", ";", "//\"Fragment contains invalid character!\");", "}", "else", "{", "m_fragment", "=", "p_fragment", ";", "}", "}" ]
Set the fragment for this URI. A non-null value is valid only if this is a URI conforming to the generic URI syntax and the path value is not null. @param p_fragment the fragment for this URI @throws MalformedURIException if p_fragment is not null and this URI does not conform to the generic URI syntax or if the path is null
[ "Set", "the", "fragment", "for", "this", "URI", ".", "A", "non", "-", "null", "value", "is", "valid", "only", "if", "this", "is", "a", "URI", "conforming", "to", "the", "generic", "URI", "syntax", "and", "the", "path", "value", "is", "not", "null", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/URI.java#L1306-L1331
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java
CommonOps_DDF3.elementDiv
public static void elementDiv( DMatrix3 a , DMatrix3 b) { """ <p>Performs an element by element division operation:<br> <br> a<sub>i</sub> = a<sub>i</sub> / b<sub>i</sub> <br> </p> @param a The left vector in the division operation. Modified. @param b The right vector in the division operation. Not modified. """ a.a1 /= b.a1; a.a2 /= b.a2; a.a3 /= b.a3; }
java
public static void elementDiv( DMatrix3 a , DMatrix3 b) { a.a1 /= b.a1; a.a2 /= b.a2; a.a3 /= b.a3; }
[ "public", "static", "void", "elementDiv", "(", "DMatrix3", "a", ",", "DMatrix3", "b", ")", "{", "a", ".", "a1", "/=", "b", ".", "a1", ";", "a", ".", "a2", "/=", "b", ".", "a2", ";", "a", ".", "a3", "/=", "b", ".", "a3", ";", "}" ]
<p>Performs an element by element division operation:<br> <br> a<sub>i</sub> = a<sub>i</sub> / b<sub>i</sub> <br> </p> @param a The left vector in the division operation. Modified. @param b The right vector in the division operation. Not modified.
[ "<p", ">", "Performs", "an", "element", "by", "element", "division", "operation", ":", "<br", ">", "<br", ">", "a<sub", ">", "i<", "/", "sub", ">", "=", "a<sub", ">", "i<", "/", "sub", ">", "/", "b<sub", ">", "i<", "/", "sub", ">", "<br", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java#L1111-L1115
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isConstructorCall
public static boolean isConstructorCall(Expression expression, String classNamePattern) { """ Return true if the expression is a constructor call on a class that matches the supplied. @param expression - the expression @param classNamePattern - the possible List of class names @return as described """ return expression instanceof ConstructorCallExpression && expression.getType().getName().matches(classNamePattern); }
java
public static boolean isConstructorCall(Expression expression, String classNamePattern) { return expression instanceof ConstructorCallExpression && expression.getType().getName().matches(classNamePattern); }
[ "public", "static", "boolean", "isConstructorCall", "(", "Expression", "expression", ",", "String", "classNamePattern", ")", "{", "return", "expression", "instanceof", "ConstructorCallExpression", "&&", "expression", ".", "getType", "(", ")", ".", "getName", "(", ")", ".", "matches", "(", "classNamePattern", ")", ";", "}" ]
Return true if the expression is a constructor call on a class that matches the supplied. @param expression - the expression @param classNamePattern - the possible List of class names @return as described
[ "Return", "true", "if", "the", "expression", "is", "a", "constructor", "call", "on", "a", "class", "that", "matches", "the", "supplied", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L462-L464