repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ContentBasedLocalBundleRepository.java
ContentBasedLocalBundleRepository.selectBundle
public File selectBundle(String baseLocation, final String symbolicName, final VersionRange versionRange) { readCache(); return selectResource(baseLocation, symbolicName, versionRange); }
java
public File selectBundle(String baseLocation, final String symbolicName, final VersionRange versionRange) { readCache(); return selectResource(baseLocation, symbolicName, versionRange); }
[ "public", "File", "selectBundle", "(", "String", "baseLocation", ",", "final", "String", "symbolicName", ",", "final", "VersionRange", "versionRange", ")", "{", "readCache", "(", ")", ";", "return", "selectResource", "(", "baseLocation", ",", "symbolicName", ",", ...
This method selects bundles based on the input criteria. The first parameter is the baseLocation. This can be null, the empty string, a directory, a comma separated list of directories, or a file path relative to the install. If it is a file path then that exact bundle is returned irrespective of other selection parameters. If it is null or the empty string it is assumed to be a bundle in lib dir. If it is a directory, or a comma separated directory then the subsequent matching rules will be used to choose a matching bundle in the specified directories. <p>Assuming a baseLocation of "dev/,lib/" a symbolic name of "a.b" and a version range of "[1,1.0.100)" then all bundles in dev and lib will be searched looking for the highest versioned bundle with a symbolic name of a.b. Note highest versioned excludes iFixes where the iFix base version is not located. So given identified bundles: <ol> <li>a.b/1.0.0</li> <li>a.b/1.0.1.v1</li> <li>a.b/1.0.2.v2</li> </ol> The middle bundle will be chosen. </p> @param baseLocation The base location. @param symbolicName The desired symbolic name. @param versionRange The range of versions that can be selected. @return The file representing the chosen bundle.
[ "This", "method", "selects", "bundles", "based", "on", "the", "input", "criteria", ".", "The", "first", "parameter", "is", "the", "baseLocation", ".", "This", "can", "be", "null", "the", "empty", "string", "a", "directory", "a", "comma", "separated", "list",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/ContentBasedLocalBundleRepository.java#L326-L329
allengeorge/libraft
libraft-agent/src/main/java/io/libraft/agent/protocol/RaftRPC.java
RaftRPC.setupJacksonAnnotatedCommandSerializationAndDeserialization
public static <T extends Command> void setupJacksonAnnotatedCommandSerializationAndDeserialization(ObjectMapper mapper, Class<T> commandSubclassKlass) { SimpleModule module = new SimpleModule("raftrpc-jackson-command-module", new Version(0, 0, 0, "inline", "io.libraft", "raftrpc-jackson-command-module")); module.addAbstractTypeMapping(Command.class, commandSubclassKlass); module.addDeserializer(commandSubclassKlass, new RaftRPCCommand.PassThroughDeserializer<T>(commandSubclassKlass)); mapper.registerModule(module); }
java
public static <T extends Command> void setupJacksonAnnotatedCommandSerializationAndDeserialization(ObjectMapper mapper, Class<T> commandSubclassKlass) { SimpleModule module = new SimpleModule("raftrpc-jackson-command-module", new Version(0, 0, 0, "inline", "io.libraft", "raftrpc-jackson-command-module")); module.addAbstractTypeMapping(Command.class, commandSubclassKlass); module.addDeserializer(commandSubclassKlass, new RaftRPCCommand.PassThroughDeserializer<T>(commandSubclassKlass)); mapper.registerModule(module); }
[ "public", "static", "<", "T", "extends", "Command", ">", "void", "setupJacksonAnnotatedCommandSerializationAndDeserialization", "(", "ObjectMapper", "mapper", ",", "Class", "<", "T", ">", "commandSubclassKlass", ")", "{", "SimpleModule", "module", "=", "new", "SimpleM...
Setup serialization and deserialization for Jackson-annotated {@link Command} subclasses. All Jackson-annotated {@code Command} subclasses <strong>must</strong> derive from a single base class. <p/> The following <strong>is</strong> supported: <pre> Object +-- CMD_BASE +-- CMD_0 +-- CMD_1 </pre> And the following is <strong>not</strong> supported: <pre> Object +-- CMD_0 +-- CMD_1 </pre> See {@code RaftAgent} for more on which {@code Command} types are supported. @param mapper instance of {@code ObjectMapper} with which the serialization/deserialization mapping is registered @param commandSubclassKlass the base class of all the Jackson-annotated {@code Command} classes @see io.libraft.agent.RaftAgent
[ "Setup", "serialization", "and", "deserialization", "for", "Jackson", "-", "annotated", "{", "@link", "Command", "}", "subclasses", ".", "All", "Jackson", "-", "annotated", "{", "@code", "Command", "}", "subclasses", "<strong", ">", "must<", "/", "strong", ">"...
train
https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/protocol/RaftRPC.java#L93-L100
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/validation/repeater/RepeaterExample.java
RepeaterExample.preparePaintComponent
@Override protected void preparePaintComponent(final Request request) { if (!isInitialised()) { MyDataBean myBean = new MyDataBean(); myBean.setName("My Bean"); myBean.addBean(new SomeDataBean("blah", "more blah")); myBean.addBean(new SomeDataBean()); repeaterFields.setData(myBean); setInitialised(true); } }
java
@Override protected void preparePaintComponent(final Request request) { if (!isInitialised()) { MyDataBean myBean = new MyDataBean(); myBean.setName("My Bean"); myBean.addBean(new SomeDataBean("blah", "more blah")); myBean.addBean(new SomeDataBean()); repeaterFields.setData(myBean); setInitialised(true); } }
[ "@", "Override", "protected", "void", "preparePaintComponent", "(", "final", "Request", "request", ")", "{", "if", "(", "!", "isInitialised", "(", ")", ")", "{", "MyDataBean", "myBean", "=", "new", "MyDataBean", "(", ")", ";", "myBean", ".", "setName", "("...
Override preparepaint to initialise the data on first acecss by a user. @param request the request being responded to.
[ "Override", "preparepaint", "to", "initialise", "the", "data", "on", "first", "acecss", "by", "a", "user", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/validation/repeater/RepeaterExample.java#L90-L103
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java
KMLWriterDriver.getKMLType
private static String getKMLType(int sqlTypeId, String sqlTypeName) throws SQLException { switch (sqlTypeId) { case Types.BOOLEAN: return "bool"; case Types.DOUBLE: return "double"; case Types.FLOAT: return "float"; case Types.INTEGER: case Types.BIGINT: return "int"; case Types.SMALLINT: return "short"; case Types.DATE: case Types.VARCHAR: case Types.NCHAR: case Types.CHAR: return "string"; default: throw new SQLException("Field type not supported by KML : " + sqlTypeName); } }
java
private static String getKMLType(int sqlTypeId, String sqlTypeName) throws SQLException { switch (sqlTypeId) { case Types.BOOLEAN: return "bool"; case Types.DOUBLE: return "double"; case Types.FLOAT: return "float"; case Types.INTEGER: case Types.BIGINT: return "int"; case Types.SMALLINT: return "short"; case Types.DATE: case Types.VARCHAR: case Types.NCHAR: case Types.CHAR: return "string"; default: throw new SQLException("Field type not supported by KML : " + sqlTypeName); } }
[ "private", "static", "String", "getKMLType", "(", "int", "sqlTypeId", ",", "String", "sqlTypeName", ")", "throws", "SQLException", "{", "switch", "(", "sqlTypeId", ")", "{", "case", "Types", ".", "BOOLEAN", ":", "return", "\"bool\"", ";", "case", "Types", "....
Return the kml type representation from SQL data type @param sqlTypeId @param sqlTypeName @return @throws SQLException
[ "Return", "the", "kml", "type", "representation", "from", "SQL", "data", "type" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java#L377-L398
galan/verjson
src/main/java/de/galan/verjson/util/Transformations.java
Transformations.getArrayAndRemove
public static ArrayNode getArrayAndRemove(ObjectNode obj, String fieldName) { ArrayNode result = null; if (obj != null) { result = array(remove(obj, fieldName)); } return result; }
java
public static ArrayNode getArrayAndRemove(ObjectNode obj, String fieldName) { ArrayNode result = null; if (obj != null) { result = array(remove(obj, fieldName)); } return result; }
[ "public", "static", "ArrayNode", "getArrayAndRemove", "(", "ObjectNode", "obj", ",", "String", "fieldName", ")", "{", "ArrayNode", "result", "=", "null", ";", "if", "(", "obj", "!=", "null", ")", "{", "result", "=", "array", "(", "remove", "(", "obj", ",...
Removes the field from a ObjectNode and returns it as ArrayNode
[ "Removes", "the", "field", "from", "a", "ObjectNode", "and", "returns", "it", "as", "ArrayNode" ]
train
https://github.com/galan/verjson/blob/4db610fb5198fde913114ed628234f957e1c19d5/src/main/java/de/galan/verjson/util/Transformations.java#L80-L86
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java
BitSet.valueOf
public static BitSet valueOf(long[] longs) { int n; for (n = longs.length; n > 0 && longs[n - 1] == 0; n--) ; return new BitSet(Arrays.copyOf(longs, n)); }
java
public static BitSet valueOf(long[] longs) { int n; for (n = longs.length; n > 0 && longs[n - 1] == 0; n--) ; return new BitSet(Arrays.copyOf(longs, n)); }
[ "public", "static", "BitSet", "valueOf", "(", "long", "[", "]", "longs", ")", "{", "int", "n", ";", "for", "(", "n", "=", "longs", ".", "length", ";", "n", ">", "0", "&&", "longs", "[", "n", "-", "1", "]", "==", "0", ";", "n", "--", ")", ";...
Returns a new bit set containing all the bits in the given long array. <p>More precisely, <br>{@code BitSet.valueOf(longs).get(n) == ((longs[n/64] & (1L<<(n%64))) != 0)} <br>for all {@code n < 64 * longs.length}. <p>This method is equivalent to {@code BitSet.valueOf(LongBuffer.wrap(longs))}. @param longs a long array containing a little-endian representation of a sequence of bits to be used as the initial bits of the new bit set @return a {@code BitSet} containing all the bits in the long array @since 1.7
[ "Returns", "a", "new", "bit", "set", "containing", "all", "the", "bits", "in", "the", "given", "long", "array", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java#L195-L200
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java
DateFormatSymbols.setZodiacNames
public void setZodiacNames(String[] zodiacNames, int context, int width) { if (context == FORMAT && width == ABBREVIATED) { shortZodiacNames = duplicate(zodiacNames); } }
java
public void setZodiacNames(String[] zodiacNames, int context, int width) { if (context == FORMAT && width == ABBREVIATED) { shortZodiacNames = duplicate(zodiacNames); } }
[ "public", "void", "setZodiacNames", "(", "String", "[", "]", "zodiacNames", ",", "int", "context", ",", "int", "width", ")", "{", "if", "(", "context", "==", "FORMAT", "&&", "width", "==", "ABBREVIATED", ")", "{", "shortZodiacNames", "=", "duplicate", "(",...
Sets calendar zodiac name strings, for example: "Rat", "Ox", "Tiger", etc. @param zodiacNames The new zodiac name strings. @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported).
[ "Sets", "calendar", "zodiac", "name", "strings", "for", "example", ":", "Rat", "Ox", "Tiger", "etc", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L1148-L1152
revelytix/spark
spark-http-client/src/main/java/spark/protocol/parser/XMLResultsParser.java
XMLResultsParser.parseBooleanResult
static private Result parseBooleanResult(Command cmd, XMLStreamReader rdr, List<String> metadata) throws XMLStreamException, SparqlException { if (rdr.next() != CHARACTERS) { throw new SparqlException("Unexpected data in Boolean result: " + rdr.getEventType()); } boolean result = Boolean.parseBoolean(rdr.getText()); testClose(rdr, rdr.nextTag(), BOOLEAN, "Bad close of boolean element"); cleanup(rdr); return new ProtocolBooleanResult(cmd, result, metadata); }
java
static private Result parseBooleanResult(Command cmd, XMLStreamReader rdr, List<String> metadata) throws XMLStreamException, SparqlException { if (rdr.next() != CHARACTERS) { throw new SparqlException("Unexpected data in Boolean result: " + rdr.getEventType()); } boolean result = Boolean.parseBoolean(rdr.getText()); testClose(rdr, rdr.nextTag(), BOOLEAN, "Bad close of boolean element"); cleanup(rdr); return new ProtocolBooleanResult(cmd, result, metadata); }
[ "static", "private", "Result", "parseBooleanResult", "(", "Command", "cmd", ",", "XMLStreamReader", "rdr", ",", "List", "<", "String", ">", "metadata", ")", "throws", "XMLStreamException", ",", "SparqlException", "{", "if", "(", "rdr", ".", "next", "(", ")", ...
Parses a boolean result from the reader. The reader is expected to be on the START_ELEMENT event for the opening <boolean> tag. @param cmd The command to associate with the result. @param rdr The XML reader from which to read the result. @param metadata The metadata to include in the result. @return The parsed result.
[ "Parses", "a", "boolean", "result", "from", "the", "reader", ".", "The", "reader", "is", "expected", "to", "be", "on", "the", "START_ELEMENT", "event", "for", "the", "opening", "<boolean", ">", "tag", "." ]
train
https://github.com/revelytix/spark/blob/d777d40c962bc66fdc04b7c3a66d20b777ff6fb4/spark-http-client/src/main/java/spark/protocol/parser/XMLResultsParser.java#L174-L183
windup/windup
rules-xml/api/src/main/java/org/jboss/windup/rules/apps/xml/service/XmlFileService.java
XmlFileService.loadDocument
public Document loadDocument(GraphRewrite event, EvaluationContext context, XmlFileModel model) throws WindupException { if (model.asFile().length() == 0) { final String msg = "Failed to parse, XML file is empty: " + model.getFilePath(); LOG.log(Level.WARNING, msg); model.setParseError(msg); throw new WindupException(msg); } ClassificationService classificationService = new ClassificationService(getGraphContext()); XMLDocumentCache.Result cacheResult = XMLDocumentCache.get(model); if (cacheResult.isParseFailure()) { final String msg = "Not loading XML file '" + model.getFilePath() + "' due to previous parse failure: " + model.getParseError(); LOG.log(Level.FINE, msg); //model.setParseError(msg); throw new WindupException(msg); } Document document = cacheResult.getDocument(); if (document != null) return document; // Not yet cached - load, store in cache and return. try (InputStream is = model.asInputStream()) { document = LocationAwareXmlReader.readXML(is); XMLDocumentCache.cache(model, document); } catch (SAXException | IOException e) { XMLDocumentCache.cacheParseFailure(model); document = null; final String message = "Failed to parse XML file: " + model.getFilePath() + ", due to: " + e.getMessage(); LOG.log(Level.WARNING, message); classificationService.attachClassification(event, context, model, UNPARSEABLE_XML_CLASSIFICATION, UNPARSEABLE_XML_DESCRIPTION); model.setParseError(message); throw new WindupException(message, e); } return document; }
java
public Document loadDocument(GraphRewrite event, EvaluationContext context, XmlFileModel model) throws WindupException { if (model.asFile().length() == 0) { final String msg = "Failed to parse, XML file is empty: " + model.getFilePath(); LOG.log(Level.WARNING, msg); model.setParseError(msg); throw new WindupException(msg); } ClassificationService classificationService = new ClassificationService(getGraphContext()); XMLDocumentCache.Result cacheResult = XMLDocumentCache.get(model); if (cacheResult.isParseFailure()) { final String msg = "Not loading XML file '" + model.getFilePath() + "' due to previous parse failure: " + model.getParseError(); LOG.log(Level.FINE, msg); //model.setParseError(msg); throw new WindupException(msg); } Document document = cacheResult.getDocument(); if (document != null) return document; // Not yet cached - load, store in cache and return. try (InputStream is = model.asInputStream()) { document = LocationAwareXmlReader.readXML(is); XMLDocumentCache.cache(model, document); } catch (SAXException | IOException e) { XMLDocumentCache.cacheParseFailure(model); document = null; final String message = "Failed to parse XML file: " + model.getFilePath() + ", due to: " + e.getMessage(); LOG.log(Level.WARNING, message); classificationService.attachClassification(event, context, model, UNPARSEABLE_XML_CLASSIFICATION, UNPARSEABLE_XML_DESCRIPTION); model.setParseError(message); throw new WindupException(message, e); } return document; }
[ "public", "Document", "loadDocument", "(", "GraphRewrite", "event", ",", "EvaluationContext", "context", ",", "XmlFileModel", "model", ")", "throws", "WindupException", "{", "if", "(", "model", ".", "asFile", "(", ")", ".", "length", "(", ")", "==", "0", ")"...
Loads and parses the provided XML file. This will quietly fail (not throwing an {@link Exception}) and return null if it is unable to parse the provided {@link XmlFileModel}. A {@link ClassificationModel} will be created to indicate that this file failed to parse. @return Returns either the parsed {@link Document} or null if the {@link Document} could not be parsed
[ "Loads", "and", "parses", "the", "provided", "XML", "file", ".", "This", "will", "quietly", "fail", "(", "not", "throwing", "an", "{", "@link", "Exception", "}", ")", "and", "return", "null", "if", "it", "is", "unable", "to", "parse", "the", "provided", ...
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-xml/api/src/main/java/org/jboss/windup/rules/apps/xml/service/XmlFileService.java#L66-L109
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.unregisterTopicSession
@Override public int unregisterTopicSession(String topic, Session session) { if (isInconsistenceContext(topic, session)) { return 0; } logger.debug("'{}' unsubscribe to '{}'", session.getId(), topic); if (Constants.Topic.ALL.equals(topic)) { for (Map.Entry<String, Collection<Session>> entry : map.entrySet()) { Collection<Session> sessions = entry.getValue(); removeSessionToSessions(session, sessions); if (sessions.isEmpty()) { map.remove(entry.getKey()); } } } else { Collection<Session> sessions = map.get(topic); removeSessionToSessions(session, sessions); if (sessions==null || sessions.isEmpty()) { map.remove(topic); } } return getNumberSubscribers(topic); }
java
@Override public int unregisterTopicSession(String topic, Session session) { if (isInconsistenceContext(topic, session)) { return 0; } logger.debug("'{}' unsubscribe to '{}'", session.getId(), topic); if (Constants.Topic.ALL.equals(topic)) { for (Map.Entry<String, Collection<Session>> entry : map.entrySet()) { Collection<Session> sessions = entry.getValue(); removeSessionToSessions(session, sessions); if (sessions.isEmpty()) { map.remove(entry.getKey()); } } } else { Collection<Session> sessions = map.get(topic); removeSessionToSessions(session, sessions); if (sessions==null || sessions.isEmpty()) { map.remove(topic); } } return getNumberSubscribers(topic); }
[ "@", "Override", "public", "int", "unregisterTopicSession", "(", "String", "topic", ",", "Session", "session", ")", "{", "if", "(", "isInconsistenceContext", "(", "topic", ",", "session", ")", ")", "{", "return", "0", ";", "}", "logger", ".", "debug", "(",...
Unregister session for topic. topic 'ALL' remove session for all topics @param topic @param session @return int : number subscribers remaining
[ "Unregister", "session", "for", "topic", ".", "topic", "ALL", "remove", "session", "for", "all", "topics" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L88-L110
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java
SchemaBuilder.createType
@NonNull public static CreateTypeStart createType( @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier typeName) { return new DefaultCreateType(keyspace, typeName); }
java
@NonNull public static CreateTypeStart createType( @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier typeName) { return new DefaultCreateType(keyspace, typeName); }
[ "@", "NonNull", "public", "static", "CreateTypeStart", "createType", "(", "@", "Nullable", "CqlIdentifier", "keyspace", ",", "@", "NonNull", "CqlIdentifier", "typeName", ")", "{", "return", "new", "DefaultCreateType", "(", "keyspace", ",", "typeName", ")", ";", ...
Starts a CREATE TYPE query with the given type name for the given keyspace name.
[ "Starts", "a", "CREATE", "TYPE", "query", "with", "the", "given", "type", "name", "for", "the", "given", "keyspace", "name", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L330-L334
VoltDB/voltdb
src/frontend/org/voltdb/jni/ExecutionEngine.java
ExecutionEngine.endStatsCollection
protected void endStatsCollection(long cacheSize, CacheUse cacheUse) { if (m_plannerStats != null) { m_plannerStats.endStatsCollection(cacheSize, 0, cacheUse, m_partitionId); } }
java
protected void endStatsCollection(long cacheSize, CacheUse cacheUse) { if (m_plannerStats != null) { m_plannerStats.endStatsCollection(cacheSize, 0, cacheUse, m_partitionId); } }
[ "protected", "void", "endStatsCollection", "(", "long", "cacheSize", ",", "CacheUse", "cacheUse", ")", "{", "if", "(", "m_plannerStats", "!=", "null", ")", "{", "m_plannerStats", ".", "endStatsCollection", "(", "cacheSize", ",", "0", ",", "cacheUse", ",", "m_p...
Finalize collected statistics (stops timer and supplies cache statistics). @param cacheSize size of cache @param cacheUse where the plan came from
[ "Finalize", "collected", "statistics", "(", "stops", "timer", "and", "supplies", "cache", "statistics", ")", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jni/ExecutionEngine.java#L1253-L1257
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsm.java
XsdAsm.generateAttributes
private void generateAttributes(List<XsdAttribute> attributeVariations, String apiName) { attributeVariations.forEach(attributeVariation -> generateAttribute(attributeVariation, apiName)); }
java
private void generateAttributes(List<XsdAttribute> attributeVariations, String apiName) { attributeVariations.forEach(attributeVariation -> generateAttribute(attributeVariation, apiName)); }
[ "private", "void", "generateAttributes", "(", "List", "<", "XsdAttribute", ">", "attributeVariations", ",", "String", "apiName", ")", "{", "attributeVariations", ".", "forEach", "(", "attributeVariation", "->", "generateAttribute", "(", "attributeVariation", ",", "api...
Generates attribute classes based on the received {@link List} of {@link XsdAttribute}. @param attributeVariations The {@link List} of {@link XsdAttribute} objects that serve as a base to class creation. @param apiName The name of the resulting fluent interface.
[ "Generates", "attribute", "classes", "based", "on", "the", "received", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsm.java#L65-L67
stratosphere/stratosphere
stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java
GlobalConfiguration.getBooleanInternal
private boolean getBooleanInternal(final String key, final boolean defaultValue) { boolean retVal = defaultValue; synchronized (this.confData) { final String value = this.confData.get(key); if (value != null) { retVal = Boolean.parseBoolean(value); } } return retVal; }
java
private boolean getBooleanInternal(final String key, final boolean defaultValue) { boolean retVal = defaultValue; synchronized (this.confData) { final String value = this.confData.get(key); if (value != null) { retVal = Boolean.parseBoolean(value); } } return retVal; }
[ "private", "boolean", "getBooleanInternal", "(", "final", "String", "key", ",", "final", "boolean", "defaultValue", ")", "{", "boolean", "retVal", "=", "defaultValue", ";", "synchronized", "(", "this", ".", "confData", ")", "{", "final", "String", "value", "="...
Returns the value associated with the given key as a boolean. @param key the key pointing to the associated value @param defaultValue the default value which is returned in case there is no value associated with the given key @return the (default) value associated with the given key
[ "Returns", "the", "value", "associated", "with", "the", "given", "key", "as", "a", "boolean", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java#L279-L292
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java
DTMDocumentImpl.appendTextChild
void appendTextChild(int m_char_current_start,int contentLength) { // create a Text Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = TEXT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; }
java
void appendTextChild(int m_char_current_start,int contentLength) { // create a Text Node // %TBD% may be possible to combine with appendNode()to replace the next chunk of code int w0 = TEXT_NODE; // W1: Parent int w1 = currentParent; // W2: Start position within m_char int w2 = m_char_current_start; // W3: Length of the full string int w3 = contentLength; int ourslot = appendNode(w0, w1, w2, w3); previousSibling = ourslot; }
[ "void", "appendTextChild", "(", "int", "m_char_current_start", ",", "int", "contentLength", ")", "{", "// create a Text Node", "// %TBD% may be possible to combine with appendNode()to replace the next chunk of code", "int", "w0", "=", "TEXT_NODE", ";", "// W1: Parent", "int", "...
Append a text child at the current insertion point. Assumes that the actual content of the text has previously been appended to the m_char buffer (shared with the builder). @param m_char_current_start int Starting offset of node's content in m_char. @param contentLength int Length of node's content in m_char.
[ "Append", "a", "text", "child", "at", "the", "current", "insertion", "point", ".", "Assumes", "that", "the", "actual", "content", "of", "the", "text", "has", "previously", "been", "appended", "to", "the", "m_char", "buffer", "(", "shared", "with", "the", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L2091-L2105
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/context/CounterContext.java
CounterContext.findPositionOf
@VisibleForTesting public int findPositionOf(ByteBuffer context, CounterId id) { int headerLength = headerLength(context); int offset = context.position() + headerLength; int left = 0; int right = (context.remaining() - headerLength) / STEP_LENGTH - 1; while (right >= left) { int middle = (left + right) / 2; int cmp = compareId(context, offset + middle * STEP_LENGTH, id.bytes(), id.bytes().position()); if (cmp == -1) left = middle + 1; else if (cmp == 0) return offset + middle * STEP_LENGTH; else right = middle - 1; } return -1; // position not found }
java
@VisibleForTesting public int findPositionOf(ByteBuffer context, CounterId id) { int headerLength = headerLength(context); int offset = context.position() + headerLength; int left = 0; int right = (context.remaining() - headerLength) / STEP_LENGTH - 1; while (right >= left) { int middle = (left + right) / 2; int cmp = compareId(context, offset + middle * STEP_LENGTH, id.bytes(), id.bytes().position()); if (cmp == -1) left = middle + 1; else if (cmp == 0) return offset + middle * STEP_LENGTH; else right = middle - 1; } return -1; // position not found }
[ "@", "VisibleForTesting", "public", "int", "findPositionOf", "(", "ByteBuffer", "context", ",", "CounterId", "id", ")", "{", "int", "headerLength", "=", "headerLength", "(", "context", ")", ";", "int", "offset", "=", "context", ".", "position", "(", ")", "+"...
Finds the position of a shard with the given id within the context (via binary search).
[ "Finds", "the", "position", "of", "a", "shard", "with", "the", "given", "id", "within", "the", "context", "(", "via", "binary", "search", ")", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/context/CounterContext.java#L689-L712
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.createNewGallery
public void createNewGallery(final CmsUUID parentId, final int galleryTypeId, final String title) { final String parentFolder = parentId != null ? getEntryById(parentId).getSitePath() : CmsStringUtil.joinPaths(m_data.getRoot().getSitePath(), m_data.getDefaultGalleryFolder()); CmsRpcAction<CmsGalleryFolderEntry> action = new CmsRpcAction<CmsGalleryFolderEntry>() { @Override public void execute() { getService().createNewGalleryFolder(parentFolder, title, galleryTypeId, this); } @Override protected void onResponse(CmsGalleryFolderEntry result) { CmsSitemapView.getInstance().displayNewGallery(result); } }; action.execute(); }
java
public void createNewGallery(final CmsUUID parentId, final int galleryTypeId, final String title) { final String parentFolder = parentId != null ? getEntryById(parentId).getSitePath() : CmsStringUtil.joinPaths(m_data.getRoot().getSitePath(), m_data.getDefaultGalleryFolder()); CmsRpcAction<CmsGalleryFolderEntry> action = new CmsRpcAction<CmsGalleryFolderEntry>() { @Override public void execute() { getService().createNewGalleryFolder(parentFolder, title, galleryTypeId, this); } @Override protected void onResponse(CmsGalleryFolderEntry result) { CmsSitemapView.getInstance().displayNewGallery(result); } }; action.execute(); }
[ "public", "void", "createNewGallery", "(", "final", "CmsUUID", "parentId", ",", "final", "int", "galleryTypeId", ",", "final", "String", "title", ")", "{", "final", "String", "parentFolder", "=", "parentId", "!=", "null", "?", "getEntryById", "(", "parentId", ...
Creates a new gallery folder of the given type.<p> @param parentId the parent folder id @param galleryTypeId the folder type id @param title the folder title
[ "Creates", "a", "new", "gallery", "folder", "of", "the", "given", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L511-L533
dropwizard/metrics
metrics-jersey2/src/main/java/com/codahale/metrics/jersey2/MetricsFeature.java
MetricsFeature.configure
@Override public boolean configure(FeatureContext context) { context.register(new InstrumentedResourceMethodApplicationListener(registry, clock, trackFilters)); return true; }
java
@Override public boolean configure(FeatureContext context) { context.register(new InstrumentedResourceMethodApplicationListener(registry, clock, trackFilters)); return true; }
[ "@", "Override", "public", "boolean", "configure", "(", "FeatureContext", "context", ")", "{", "context", ".", "register", "(", "new", "InstrumentedResourceMethodApplicationListener", "(", "registry", ",", "clock", ",", "trackFilters", ")", ")", ";", "return", "tr...
A call-back method called when the feature is to be enabled in a given runtime configuration scope. <p> The responsibility of the feature is to properly update the supplied runtime configuration context and return {@code true} if the feature was successfully enabled or {@code false} otherwise. <p> Note that under some circumstances the feature may decide not to enable itself, which is indicated by returning {@code false}. In such case the configuration context does not add the feature to the collection of enabled features and a subsequent call to {@link javax.ws.rs.core.Configuration#isEnabled(javax.ws.rs.core.Feature)} or {@link javax.ws.rs.core.Configuration#isEnabled(Class)} method would return {@code false}. <p> @param context configurable context in which the feature should be enabled. @return {@code true} if the feature was successfully enabled, {@code false} otherwise.
[ "A", "call", "-", "back", "method", "called", "when", "the", "feature", "is", "to", "be", "enabled", "in", "a", "given", "runtime", "configuration", "scope", ".", "<p", ">", "The", "responsibility", "of", "the", "feature", "is", "to", "properly", "update",...
train
https://github.com/dropwizard/metrics/blob/3c6105a0b9b4416c59e16b6b841b123052d6f57d/metrics-jersey2/src/main/java/com/codahale/metrics/jersey2/MetricsFeature.java#L57-L61
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java
ArtifactResource.updateDownloadUrl
@POST @Path("/{gavc}" + ServerAPI.GET_DOWNLOAD_URL) public Response updateDownloadUrl(@Auth final DbCredential credential, @PathParam("gavc") final String gavc, @QueryParam(ServerAPI.URL_PARAM) final String downLoadUrl){ if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } if(LOG.isInfoEnabled()) { LOG.info(String.format("Got an update downloadUrl request [%s] [%s]", gavc, downLoadUrl)); } if(gavc == null || downLoadUrl == null){ return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build(); } getArtifactHandler().updateDownLoadUrl(gavc, downLoadUrl); return Response.ok("done").build(); }
java
@POST @Path("/{gavc}" + ServerAPI.GET_DOWNLOAD_URL) public Response updateDownloadUrl(@Auth final DbCredential credential, @PathParam("gavc") final String gavc, @QueryParam(ServerAPI.URL_PARAM) final String downLoadUrl){ if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } if(LOG.isInfoEnabled()) { LOG.info(String.format("Got an update downloadUrl request [%s] [%s]", gavc, downLoadUrl)); } if(gavc == null || downLoadUrl == null){ return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build(); } getArtifactHandler().updateDownLoadUrl(gavc, downLoadUrl); return Response.ok("done").build(); }
[ "@", "POST", "@", "Path", "(", "\"/{gavc}\"", "+", "ServerAPI", ".", "GET_DOWNLOAD_URL", ")", "public", "Response", "updateDownloadUrl", "(", "@", "Auth", "final", "DbCredential", "credential", ",", "@", "PathParam", "(", "\"gavc\"", ")", "final", "String", "g...
Update an artifact download url. This method is call via GET <grapes_url>/artifact/<gavc>/downloadurl?url=<targetUrl> @param credential DbCredential @param gavc String @param downLoadUrl String @return Response
[ "Update", "an", "artifact", "download", "url", ".", "This", "method", "is", "call", "via", "GET", "<grapes_url", ">", "/", "artifact", "/", "<gavc", ">", "/", "downloadurl?url", "=", "<targetUrl", ">" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java#L329-L347
spotify/apollo
examples/spotify-api-example/src/main/java/com/spotify/apollo/example/ArtistResource.java
ArtistResource.parseTopTracks
private ArrayList<Track> parseTopTracks(String json) { ArrayList<Track> tracks = new ArrayList<>(); try { JsonNode jsonNode = this.objectMapper.readTree(json); for (JsonNode trackNode : jsonNode.get("tracks")) { JsonNode albumNode = trackNode.get("album"); String albumName = albumNode.get("name").asText(); String artistName = trackNode.get("artists").get(0).get("name").asText(); String trackName = trackNode.get("name").asText(); tracks.add(new Track(trackName, new Album(albumName, new Artist(artistName)))); } } catch (IOException e) { throw new RuntimeException("Failed to parse JSON", e); } return tracks; }
java
private ArrayList<Track> parseTopTracks(String json) { ArrayList<Track> tracks = new ArrayList<>(); try { JsonNode jsonNode = this.objectMapper.readTree(json); for (JsonNode trackNode : jsonNode.get("tracks")) { JsonNode albumNode = trackNode.get("album"); String albumName = albumNode.get("name").asText(); String artistName = trackNode.get("artists").get(0).get("name").asText(); String trackName = trackNode.get("name").asText(); tracks.add(new Track(trackName, new Album(albumName, new Artist(artistName)))); } } catch (IOException e) { throw new RuntimeException("Failed to parse JSON", e); } return tracks; }
[ "private", "ArrayList", "<", "Track", ">", "parseTopTracks", "(", "String", "json", ")", "{", "ArrayList", "<", "Track", ">", "tracks", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "JsonNode", "jsonNode", "=", "this", ".", "objectMapper", "....
Parses an artist top tracks response from the <a href="https://developer.spotify.com/web-api/get-artists-top-tracks/">Spotify API</a> @param json The json response @return A list of top tracks
[ "Parses", "an", "artist", "top", "tracks", "response", "from", "the", "<a", "href", "=", "https", ":", "//", "developer", ".", "spotify", ".", "com", "/", "web", "-", "api", "/", "get", "-", "artists", "-", "top", "-", "tracks", "/", ">", "Spotify", ...
train
https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/examples/spotify-api-example/src/main/java/com/spotify/apollo/example/ArtistResource.java#L87-L103
jenkinsci/jenkins
core/src/main/java/hudson/util/spring/BeanBuilder.java
BeanBuilder.manageMapIfNecessary
private Object manageMapIfNecessary(Map<Object, Object> value) { boolean containsRuntimeRefs = false; for (Entry<Object, Object> e : value.entrySet()) { Object v = e.getValue(); if (v instanceof RuntimeBeanReference) { containsRuntimeRefs = true; } if (v instanceof BeanConfiguration) { BeanConfiguration c = (BeanConfiguration) v; e.setValue(c.getBeanDefinition()); containsRuntimeRefs = true; } } if(containsRuntimeRefs) { // return new ManagedMap(map); ManagedMap m = new ManagedMap(); m.putAll(value); return m; } return value; }
java
private Object manageMapIfNecessary(Map<Object, Object> value) { boolean containsRuntimeRefs = false; for (Entry<Object, Object> e : value.entrySet()) { Object v = e.getValue(); if (v instanceof RuntimeBeanReference) { containsRuntimeRefs = true; } if (v instanceof BeanConfiguration) { BeanConfiguration c = (BeanConfiguration) v; e.setValue(c.getBeanDefinition()); containsRuntimeRefs = true; } } if(containsRuntimeRefs) { // return new ManagedMap(map); ManagedMap m = new ManagedMap(); m.putAll(value); return m; } return value; }
[ "private", "Object", "manageMapIfNecessary", "(", "Map", "<", "Object", ",", "Object", ">", "value", ")", "{", "boolean", "containsRuntimeRefs", "=", "false", ";", "for", "(", "Entry", "<", "Object", ",", "Object", ">", "e", ":", "value", ".", "entrySet", ...
Checks whether there are any runtime refs inside a Map and converts it to a ManagedMap if necessary @param value The current map @return A ManagedMap or a normal map
[ "Checks", "whether", "there", "are", "any", "runtime", "refs", "inside", "a", "Map", "and", "converts", "it", "to", "a", "ManagedMap", "if", "necessary" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/spring/BeanBuilder.java#L564-L584
keenon/loglinear
src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java
GraphicalModel.addFactor
public VectorFactor addFactor(ConcatVectorTable featureTable, int[] neighborIndices) { assert (featureTable.getDimensions().length == neighborIndices.length); VectorFactor factor = new VectorFactor(featureTable, neighborIndices); factors.add(factor); return factor; }
java
public VectorFactor addFactor(ConcatVectorTable featureTable, int[] neighborIndices) { assert (featureTable.getDimensions().length == neighborIndices.length); VectorFactor factor = new VectorFactor(featureTable, neighborIndices); factors.add(factor); return factor; }
[ "public", "VectorFactor", "addFactor", "(", "ConcatVectorTable", "featureTable", ",", "int", "[", "]", "neighborIndices", ")", "{", "assert", "(", "featureTable", ".", "getDimensions", "(", ")", ".", "length", "==", "neighborIndices", ".", "length", ")", ";", ...
Creates an instantiated factor in this graph, with neighborIndices representing the neighbor variables by integer index. @param featureTable the feature table to use to drive the value of the factor @param neighborIndices the indices of the neighboring variables, in order @return a reference to the created factor. This can be safely ignored, as the factor is already saved in the model
[ "Creates", "an", "instantiated", "factor", "in", "this", "graph", "with", "neighborIndices", "representing", "the", "neighbor", "variables", "by", "integer", "index", "." ]
train
https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L520-L525
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java
AnnotationUtils.isAnnotationInherited
public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) { Assert.notNull(annotationType, "Annotation type must not be null"); Assert.notNull(clazz, "Class must not be null"); return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz)); }
java
public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) { Assert.notNull(annotationType, "Annotation type must not be null"); Assert.notNull(clazz, "Class must not be null"); return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz)); }
[ "public", "static", "boolean", "isAnnotationInherited", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ",", "Class", "<", "?", ">", "clazz", ")", "{", "Assert", ".", "notNull", "(", "annotationType", ",", "\"Annotation type must not be nul...
Determine whether an annotation for the specified {@code annotationType} is present on the supplied {@code clazz} and is {@linkplain java.lang.annotation.Inherited inherited} (i.e., not declared locally for the class). <p>If the supplied {@code clazz} is an interface, only the interface itself will be checked. In accordance with standard meta-annotation semantics, the inheritance hierarchy for interfaces will not be traversed. See the {@linkplain java.lang.annotation.Inherited Javadoc} for the {@code @Inherited} meta-annotation for further details regarding annotation inheritance. @param annotationType the Class object corresponding to the annotation type @param clazz the Class object corresponding to the class on which to check for the annotation @return {@code true} if an annotation for the specified {@code annotationType} is present on the supplied {@code clazz} and is <em>inherited</em> @see Class#isAnnotationPresent(Class) @see #isAnnotationDeclaredLocally(Class, Class)
[ "Determine", "whether", "an", "annotation", "for", "the", "specified", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L505-L509
kiegroup/jbpmmigration
src/main/java/org/jbpm/migration/XmlUtils.java
XmlUtils.writeFile
public static void writeFile(final Document input, final File output) { final StreamResult result = new StreamResult(new StringWriter()); format(new DOMSource(input), result); try { new FileWriter(output).write(result.getWriter().toString()); } catch (final IOException ioEx) { LOGGER.error("Problem writing XML to file.", ioEx); } }
java
public static void writeFile(final Document input, final File output) { final StreamResult result = new StreamResult(new StringWriter()); format(new DOMSource(input), result); try { new FileWriter(output).write(result.getWriter().toString()); } catch (final IOException ioEx) { LOGGER.error("Problem writing XML to file.", ioEx); } }
[ "public", "static", "void", "writeFile", "(", "final", "Document", "input", ",", "final", "File", "output", ")", "{", "final", "StreamResult", "result", "=", "new", "StreamResult", "(", "new", "StringWriter", "(", ")", ")", ";", "format", "(", "new", "DOMS...
Write an XML document (formatted) to a given <code>File</code>. @param input The input XML document. @param output The intended <code>File</code>.
[ "Write", "an", "XML", "document", "(", "formatted", ")", "to", "a", "given", "<code", ">", "File<", "/", "code", ">", "." ]
train
https://github.com/kiegroup/jbpmmigration/blob/5e133e2824aa38f316a2eb061123313a7276aba0/src/main/java/org/jbpm/migration/XmlUtils.java#L144-L154
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
HtmlTextareaRendererBase.renderTextAreaValue
protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException { ResponseWriter writer = facesContext.getResponseWriter(); Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR); if (addNewLineAtStart != null) { boolean addNewLineAtStartBoolean = false; if (addNewLineAtStart instanceof String) { addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart); } else if (addNewLineAtStart instanceof Boolean) { addNewLineAtStartBoolean = (Boolean) addNewLineAtStart; } if (addNewLineAtStartBoolean) { writer.writeText("\n", null); } } String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent); if (strValue != null) { writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR); } }
java
protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException { ResponseWriter writer = facesContext.getResponseWriter(); Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR); if (addNewLineAtStart != null) { boolean addNewLineAtStartBoolean = false; if (addNewLineAtStart instanceof String) { addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart); } else if (addNewLineAtStart instanceof Boolean) { addNewLineAtStartBoolean = (Boolean) addNewLineAtStart; } if (addNewLineAtStartBoolean) { writer.writeText("\n", null); } } String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent); if (strValue != null) { writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR); } }
[ "protected", "void", "renderTextAreaValue", "(", "FacesContext", "facesContext", ",", "UIComponent", "uiComponent", ")", "throws", "IOException", "{", "ResponseWriter", "writer", "=", "facesContext", ".", "getResponseWriter", "(", ")", ";", "Object", "addNewLineAtStart"...
Subclasses can override the writing of the "text" value of the textarea
[ "Subclasses", "can", "override", "the", "writing", "of", "the", "text", "value", "of", "the", "textarea" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java#L162-L189
LearnLib/automatalib
visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java
DOT.runDOT
public static void runDOT(File dotFile, String format, File out) throws IOException { runDOT(IOUtil.asBufferedUTF8Reader(dotFile), format, out); }
java
public static void runDOT(File dotFile, String format, File out) throws IOException { runDOT(IOUtil.asBufferedUTF8Reader(dotFile), format, out); }
[ "public", "static", "void", "runDOT", "(", "File", "dotFile", ",", "String", "format", ",", "File", "out", ")", "throws", "IOException", "{", "runDOT", "(", "IOUtil", ".", "asBufferedUTF8Reader", "(", "dotFile", ")", ",", "format", ",", "out", ")", ";", ...
Invokes the DOT utility on a file, producing an output file. Convenience method, see {@link #runDOT(Reader, String, File)}.
[ "Invokes", "the", "DOT", "utility", "on", "a", "file", "producing", "an", "output", "file", ".", "Convenience", "method", "see", "{" ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L188-L190
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java
CacheConfigurationBuilder.withSizeOfMaxObjectGraph
public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectGraph(long size) { return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing) .map(e -> new DefaultSizeOfEngineConfiguration(e.getMaxObjectSize(), e.getUnit(), size)) .orElse(new DefaultSizeOfEngineConfiguration(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_UNIT, size))); }
java
public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectGraph(long size) { return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing) .map(e -> new DefaultSizeOfEngineConfiguration(e.getMaxObjectSize(), e.getUnit(), size)) .orElse(new DefaultSizeOfEngineConfiguration(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_UNIT, size))); }
[ "public", "CacheConfigurationBuilder", "<", "K", ",", "V", ">", "withSizeOfMaxObjectGraph", "(", "long", "size", ")", "{", "return", "mapServiceConfiguration", "(", "DefaultSizeOfEngineConfiguration", ".", "class", ",", "existing", "->", "ofNullable", "(", "existing",...
Adds or updates the {@link DefaultSizeOfEngineConfiguration} with the specified object graph maximum size to the configured builder. <p> {@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}. @param size the maximum graph size @return a new builder with the added / updated configuration
[ "Adds", "or", "updates", "the", "{", "@link", "DefaultSizeOfEngineConfiguration", "}", "with", "the", "specified", "object", "graph", "maximum", "size", "to", "the", "configured", "builder", ".", "<p", ">", "{", "@link", "SizeOfEngine", "}", "is", "what", "ena...
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L539-L543
EXIficient/exificient-core
src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java
QNameUtilities.getClassName
public static String getClassName(QName qname) { try { StringBuilder className = new StringBuilder(); // e.g., {http://www.w3.org/2001/XMLSchema}decimal StringTokenizer st1 = new StringTokenizer(qname.getNamespaceURI(), "/"); // --> "http:" -> "www.w3.org" --> "2001" -> "XMLSchema" st1.nextToken(); // protocol, e.g. "http:" String domain = st1.nextToken(); // "www.w3.org" StringTokenizer st2 = new StringTokenizer(domain, "."); List<String> lDomain = new ArrayList<String>(); while (st2.hasMoreTokens()) { lDomain.add(st2.nextToken()); } assert (lDomain.size() >= 2); className.append(lDomain.get(lDomain.size() - 1)); // "org" className.append('.'); className.append(lDomain.get(lDomain.size() - 2)); // "w3" while (st1.hasMoreTokens()) { className.append('.'); className.append(st1.nextToken()); } className.append('.'); className.append(qname.getLocalPart()); return className.toString(); } catch (Exception e) { return null; } }
java
public static String getClassName(QName qname) { try { StringBuilder className = new StringBuilder(); // e.g., {http://www.w3.org/2001/XMLSchema}decimal StringTokenizer st1 = new StringTokenizer(qname.getNamespaceURI(), "/"); // --> "http:" -> "www.w3.org" --> "2001" -> "XMLSchema" st1.nextToken(); // protocol, e.g. "http:" String domain = st1.nextToken(); // "www.w3.org" StringTokenizer st2 = new StringTokenizer(domain, "."); List<String> lDomain = new ArrayList<String>(); while (st2.hasMoreTokens()) { lDomain.add(st2.nextToken()); } assert (lDomain.size() >= 2); className.append(lDomain.get(lDomain.size() - 1)); // "org" className.append('.'); className.append(lDomain.get(lDomain.size() - 2)); // "w3" while (st1.hasMoreTokens()) { className.append('.'); className.append(st1.nextToken()); } className.append('.'); className.append(qname.getLocalPart()); return className.toString(); } catch (Exception e) { return null; } }
[ "public", "static", "String", "getClassName", "(", "QName", "qname", ")", "{", "try", "{", "StringBuilder", "className", "=", "new", "StringBuilder", "(", ")", ";", "// e.g., {http://www.w3.org/2001/XMLSchema}decimal", "StringTokenizer", "st1", "=", "new", "StringToke...
Returns the className for a given qname e.g., {http://www.w3.org/2001/XMLSchema}decimal &rarr; org.w3.2001.XMLSchema.decimal @param qname qualified name @return className or null if converting is not possible
[ "Returns", "the", "className", "for", "a", "given", "qname", "e", ".", "g", ".", "{", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "2001", "/", "XMLSchema", "}", "decimal", "&rarr", ";", "org", ".", "w3", ".", "2001", ".", "XMLSchema", "...
train
https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java#L100-L133
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java
WaveformPreviewComponent.setWaveformPreview
public void setWaveformPreview(WaveformPreview preview, TrackMetadata metadata) { updateWaveform(preview); this.duration.set(metadata.getDuration()); this.cueList.set(metadata.getCueList()); clearPlaybackState(); repaint(); }
java
public void setWaveformPreview(WaveformPreview preview, TrackMetadata metadata) { updateWaveform(preview); this.duration.set(metadata.getDuration()); this.cueList.set(metadata.getCueList()); clearPlaybackState(); repaint(); }
[ "public", "void", "setWaveformPreview", "(", "WaveformPreview", "preview", ",", "TrackMetadata", "metadata", ")", "{", "updateWaveform", "(", "preview", ")", ";", "this", ".", "duration", ".", "set", "(", "metadata", ".", "getDuration", "(", ")", ")", ";", "...
Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but can be used in other contexts. @param preview the waveform preview to display @param metadata information about the track whose waveform we are drawing, so we can translate times into positions and display hot cues and memory points
[ "Change", "the", "waveform", "preview", "being", "drawn", ".", "This", "will", "be", "quickly", "overruled", "if", "a", "player", "is", "being", "monitored", "but", "can", "be", "used", "in", "other", "contexts", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L449-L455
lucee/Lucee
core/src/main/java/lucee/runtime/converter/XMLConverter.java
XMLConverter._serializeQuery
private String _serializeQuery(Query query, Map<Object, String> done, String id) throws ConverterException { /* * <QUERY ID="1"> <COLUMNNAMES> <COLUMN NAME="a"></COLUMN> <COLUMN NAME="b"></COLUMN> </COLUMNNAMES> * * <ROWS> <ROW> <COLUMN TYPE="STRING">a1</COLUMN> <COLUMN TYPE="STRING">b1</COLUMN> </ROW> <ROW> * <COLUMN TYPE="STRING">a2</COLUMN> <COLUMN TYPE="STRING">b2</COLUMN> </ROW> </ROWS> </QUERY> */ Collection.Key[] keys = CollectionUtil.keys(query); StringBuilder sb = new StringBuilder(goIn() + "<QUERY ID=\"" + id + "\">"); // columns sb.append(goIn() + "<COLUMNNAMES>"); for (int i = 0; i < keys.length; i++) { sb.append(goIn() + "<COLUMN NAME=\"" + keys[i].getString() + "\"></COLUMN>"); } sb.append(goIn() + "</COLUMNNAMES>"); String value; deep++; sb.append(goIn() + "<ROWS>"); int len = query.getRecordcount(); for (int row = 1; row <= len; row++) { sb.append(goIn() + "<ROW>"); for (int col = 0; col < keys.length; col++) { try { value = _serialize(query.getAt(keys[col], row), done); } catch (PageException e) { value = _serialize(e.getMessage(), done); } sb.append("<COLUMN TYPE=\"" + type + "\">" + value + "</COLUMN>"); } sb.append(goIn() + "</ROW>"); } sb.append(goIn() + "</ROWS>"); deep--; sb.append(goIn() + "</QUERY>"); type = "QUERY"; return sb.toString(); }
java
private String _serializeQuery(Query query, Map<Object, String> done, String id) throws ConverterException { /* * <QUERY ID="1"> <COLUMNNAMES> <COLUMN NAME="a"></COLUMN> <COLUMN NAME="b"></COLUMN> </COLUMNNAMES> * * <ROWS> <ROW> <COLUMN TYPE="STRING">a1</COLUMN> <COLUMN TYPE="STRING">b1</COLUMN> </ROW> <ROW> * <COLUMN TYPE="STRING">a2</COLUMN> <COLUMN TYPE="STRING">b2</COLUMN> </ROW> </ROWS> </QUERY> */ Collection.Key[] keys = CollectionUtil.keys(query); StringBuilder sb = new StringBuilder(goIn() + "<QUERY ID=\"" + id + "\">"); // columns sb.append(goIn() + "<COLUMNNAMES>"); for (int i = 0; i < keys.length; i++) { sb.append(goIn() + "<COLUMN NAME=\"" + keys[i].getString() + "\"></COLUMN>"); } sb.append(goIn() + "</COLUMNNAMES>"); String value; deep++; sb.append(goIn() + "<ROWS>"); int len = query.getRecordcount(); for (int row = 1; row <= len; row++) { sb.append(goIn() + "<ROW>"); for (int col = 0; col < keys.length; col++) { try { value = _serialize(query.getAt(keys[col], row), done); } catch (PageException e) { value = _serialize(e.getMessage(), done); } sb.append("<COLUMN TYPE=\"" + type + "\">" + value + "</COLUMN>"); } sb.append(goIn() + "</ROW>"); } sb.append(goIn() + "</ROWS>"); deep--; sb.append(goIn() + "</QUERY>"); type = "QUERY"; return sb.toString(); }
[ "private", "String", "_serializeQuery", "(", "Query", "query", ",", "Map", "<", "Object", ",", "String", ">", "done", ",", "String", "id", ")", "throws", "ConverterException", "{", "/*\n\t * <QUERY ID=\"1\"> <COLUMNNAMES> <COLUMN NAME=\"a\"></COLUMN> <COLUMN NAME=\"b\"></CO...
serialize a Query @param query Query to serialize @param done @return serialized query @throws ConverterException
[ "serialize", "a", "Query" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/XMLConverter.java#L292-L334
google/error-prone
check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java
SuggestedFixes.removeModifiers
public static Optional<SuggestedFix> removeModifiers( Tree tree, VisitorState state, Modifier... modifiers) { Set<Modifier> toRemove = ImmutableSet.copyOf(modifiers); ModifiersTree originalModifiers = getModifiers(tree); if (originalModifiers == null) { return Optional.empty(); } return removeModifiers(originalModifiers, state, toRemove); }
java
public static Optional<SuggestedFix> removeModifiers( Tree tree, VisitorState state, Modifier... modifiers) { Set<Modifier> toRemove = ImmutableSet.copyOf(modifiers); ModifiersTree originalModifiers = getModifiers(tree); if (originalModifiers == null) { return Optional.empty(); } return removeModifiers(originalModifiers, state, toRemove); }
[ "public", "static", "Optional", "<", "SuggestedFix", ">", "removeModifiers", "(", "Tree", "tree", ",", "VisitorState", "state", ",", "Modifier", "...", "modifiers", ")", "{", "Set", "<", "Modifier", ">", "toRemove", "=", "ImmutableSet", ".", "copyOf", "(", "...
Remove modifiers from the given class, method, or field declaration.
[ "Remove", "modifiers", "from", "the", "given", "class", "method", "or", "field", "declaration", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java#L229-L237
hawkular/hawkular-apm
api/src/main/java/org/hawkular/apm/api/utils/EndpointUtil.java
EndpointUtil.decodeEndpointOperation
public static String decodeEndpointOperation(String endpoint, boolean stripped) { int ind=endpoint.indexOf('['); if (ind != -1) { if (stripped) { return endpoint.substring(ind+1, endpoint.length()-1); } return endpoint.substring(ind); } return null; }
java
public static String decodeEndpointOperation(String endpoint, boolean stripped) { int ind=endpoint.indexOf('['); if (ind != -1) { if (stripped) { return endpoint.substring(ind+1, endpoint.length()-1); } return endpoint.substring(ind); } return null; }
[ "public", "static", "String", "decodeEndpointOperation", "(", "String", "endpoint", ",", "boolean", "stripped", ")", "{", "int", "ind", "=", "endpoint", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "ind", "!=", "-", "1", ")", "{", "if", "(", "...
This method returns the operation part of the supplied endpoint. @param endpoint The endpoint @param stripped Whether brackets should be stripped @return The operation
[ "This", "method", "returns", "the", "operation", "part", "of", "the", "supplied", "endpoint", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/utils/EndpointUtil.java#L76-L85
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/WhitelistingApi.java
WhitelistingApi.getRejectedRowList
public RejectedCSVRowsEnvelope getRejectedRowList(String dtid, String uploadId, Integer count, Integer offset) throws ApiException { ApiResponse<RejectedCSVRowsEnvelope> resp = getRejectedRowListWithHttpInfo(dtid, uploadId, count, offset); return resp.getData(); }
java
public RejectedCSVRowsEnvelope getRejectedRowList(String dtid, String uploadId, Integer count, Integer offset) throws ApiException { ApiResponse<RejectedCSVRowsEnvelope> resp = getRejectedRowListWithHttpInfo(dtid, uploadId, count, offset); return resp.getData(); }
[ "public", "RejectedCSVRowsEnvelope", "getRejectedRowList", "(", "String", "dtid", ",", "String", "uploadId", ",", "Integer", "count", ",", "Integer", "offset", ")", "throws", "ApiException", "{", "ApiResponse", "<", "RejectedCSVRowsEnvelope", ">", "resp", "=", "getR...
Get the list of rejected rows for an uploaded CSV file. Get the list of rejected rows for an uploaded CSV file. @param dtid Device type id related to the uploaded CSV file. (required) @param uploadId Upload id related to the uploaded CSV file. (required) @param count Max results count. (optional) @param offset Result starting offset. (optional) @return RejectedCSVRowsEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "the", "list", "of", "rejected", "rows", "for", "an", "uploaded", "CSV", "file", ".", "Get", "the", "list", "of", "rejected", "rows", "for", "an", "uploaded", "CSV", "file", "." ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/WhitelistingApi.java#L526-L529
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuItem.java
MenuItem.parseLocation
public void parseLocation(String location, String value) { setLocationValue(value); setLocation(PresentationManager.getPm().getLocation(location)); }
java
public void parseLocation(String location, String value) { setLocationValue(value); setLocation(PresentationManager.getPm().getLocation(location)); }
[ "public", "void", "parseLocation", "(", "String", "location", ",", "String", "value", ")", "{", "setLocationValue", "(", "value", ")", ";", "setLocation", "(", "PresentationManager", ".", "getPm", "(", ")", ".", "getLocation", "(", "location", ")", ")", ";",...
Recover from the service the location object and set it and the value to this item. @param location The id to look into the conficuration file pm.locations.xml @param value The location value
[ "Recover", "from", "the", "service", "the", "location", "object", "and", "set", "it", "and", "the", "value", "to", "this", "item", "." ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuItem.java#L60-L63
gallandarakhneorg/afc
advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java
ZoomableGraphicsContext.bezierCurveTo
public void bezierCurveTo(double xc1, double yc1, double xc2, double yc2, double x1, double y1) { this.gc.bezierCurveTo( doc2fxX(xc1), doc2fxY(yc1), doc2fxX(xc2), doc2fxY(yc2), doc2fxX(x1), doc2fxY(y1)); }
java
public void bezierCurveTo(double xc1, double yc1, double xc2, double yc2, double x1, double y1) { this.gc.bezierCurveTo( doc2fxX(xc1), doc2fxY(yc1), doc2fxX(xc2), doc2fxY(yc2), doc2fxX(x1), doc2fxY(y1)); }
[ "public", "void", "bezierCurveTo", "(", "double", "xc1", ",", "double", "yc1", ",", "double", "xc2", ",", "double", "yc2", ",", "double", "x1", ",", "double", "y1", ")", "{", "this", ".", "gc", ".", "bezierCurveTo", "(", "doc2fxX", "(", "xc1", ")", "...
Adds segments to the current path to make a cubic Bezier curve. The coordinates are transformed by the current transform as they are added to the path and unaffected by subsequent changes to the transform. The current path is a path attribute used for any of the path methods as specified in the Rendering Attributes Table of {@link GraphicsContext} and <b>is not affected</b> by the {@link #save()} and {@link #restore()} operations. @param xc1 the X coordinate of first Bezier control point. @param yc1 the Y coordinate of the first Bezier control point. @param xc2 the X coordinate of the second Bezier control point. @param yc2 the Y coordinate of the second Bezier control point. @param x1 the X coordinate of the end point. @param y1 the Y coordinate of the end point.
[ "Adds", "segments", "to", "the", "current", "path", "to", "make", "a", "cubic", "Bezier", "curve", ".", "The", "coordinates", "are", "transformed", "by", "the", "current", "transform", "as", "they", "are", "added", "to", "the", "path", "and", "unaffected", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1271-L1276
VoltDB/voltdb
src/frontend/org/voltdb/LightweightNTClientResponseAdapter.java
LightweightNTClientResponseAdapter.callProcedure
public void callProcedure(AuthUser user, boolean isAdmin, int timeout, ProcedureCallback cb, String procName, Object[] args) { // since we know the caller, this is safe assert(cb != null); StoredProcedureInvocation task = new StoredProcedureInvocation(); task.setProcName(procName); task.setParams(args); if (timeout != BatchTimeoutOverrideType.NO_TIMEOUT) { task.setBatchTimeout(timeout); } InternalAdapterTaskAttributes kattrs = new InternalAdapterTaskAttributes( DEFAULT_INTERNAL_ADAPTER_NAME, isAdmin, connectionId()); assert(m_dispatcher != null); // JHH: I have no idea why we need to do this, but CL crashes if we don't. Sigh. try { task = MiscUtils.roundTripForCL(task); } catch (Exception e) { String msg = String.format("Cannot invoke procedure %s. failed to create task: %s", procName, e.getMessage()); m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, msg); ClientResponseImpl cri = new ClientResponseImpl(ClientResponse.UNEXPECTED_FAILURE, new VoltTable[0], msg); try { cb.clientCallback(cri); } catch (Exception e1) { throw new IllegalStateException(e1); } } createTransaction(kattrs, cb, task, user); }
java
public void callProcedure(AuthUser user, boolean isAdmin, int timeout, ProcedureCallback cb, String procName, Object[] args) { // since we know the caller, this is safe assert(cb != null); StoredProcedureInvocation task = new StoredProcedureInvocation(); task.setProcName(procName); task.setParams(args); if (timeout != BatchTimeoutOverrideType.NO_TIMEOUT) { task.setBatchTimeout(timeout); } InternalAdapterTaskAttributes kattrs = new InternalAdapterTaskAttributes( DEFAULT_INTERNAL_ADAPTER_NAME, isAdmin, connectionId()); assert(m_dispatcher != null); // JHH: I have no idea why we need to do this, but CL crashes if we don't. Sigh. try { task = MiscUtils.roundTripForCL(task); } catch (Exception e) { String msg = String.format("Cannot invoke procedure %s. failed to create task: %s", procName, e.getMessage()); m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.ERROR, null, msg); ClientResponseImpl cri = new ClientResponseImpl(ClientResponse.UNEXPECTED_FAILURE, new VoltTable[0], msg); try { cb.clientCallback(cri); } catch (Exception e1) { throw new IllegalStateException(e1); } } createTransaction(kattrs, cb, task, user); }
[ "public", "void", "callProcedure", "(", "AuthUser", "user", ",", "boolean", "isAdmin", ",", "int", "timeout", ",", "ProcedureCallback", "cb", ",", "String", "procName", ",", "Object", "[", "]", "args", ")", "{", "// since we know the caller, this is safe", "assert...
Used to call a procedure from NTPRocedureRunner Calls createTransaction with the proper params
[ "Used", "to", "call", "a", "procedure", "from", "NTPRocedureRunner", "Calls", "createTransaction", "with", "the", "proper", "params" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/LightweightNTClientResponseAdapter.java#L277-L315
lightblueseas/jcommons-lang
src/main/java/de/alpharogroup/lang/AnnotationExtensions.java
AnnotationExtensions.getAllClasses
public static Set<Class<?>> getAllClasses(final String packagePath, final Set<Class<? extends Annotation>> annotationClasses) throws ClassNotFoundException, IOException, URISyntaxException { return getAllAnnotatedClassesFromSet(packagePath, annotationClasses); }
java
public static Set<Class<?>> getAllClasses(final String packagePath, final Set<Class<? extends Annotation>> annotationClasses) throws ClassNotFoundException, IOException, URISyntaxException { return getAllAnnotatedClassesFromSet(packagePath, annotationClasses); }
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "getAllClasses", "(", "final", "String", "packagePath", ",", "final", "Set", "<", "Class", "<", "?", "extends", "Annotation", ">", ">", "annotationClasses", ")", "throws", "ClassNotFoundException", ...
Gets all the classes from the class loader that belongs to the given package path. @param packagePath the package path @param annotationClasses the annotation classes @return the all classes @throws ClassNotFoundException occurs if a given class cannot be located by the specified class loader @throws IOException Signals that an I/O exception has occurred. @throws URISyntaxException is thrown if a string could not be parsed as a URI reference.
[ "Gets", "all", "the", "classes", "from", "the", "class", "loader", "that", "belongs", "to", "the", "given", "package", "path", "." ]
train
https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/lang/AnnotationExtensions.java#L156-L161
JDBDT/jdbdt
src/main/java/org/jdbdt/DBAssert.java
DBAssert.stateAssertion
static void stateAssertion(CallInfo callInfo, DataSet expected) { DataSource source = expected.getSource(); source.setDirtyStatus(true); dataSetAssertion(callInfo, expected, source.executeQuery(callInfo, false)); }
java
static void stateAssertion(CallInfo callInfo, DataSet expected) { DataSource source = expected.getSource(); source.setDirtyStatus(true); dataSetAssertion(callInfo, expected, source.executeQuery(callInfo, false)); }
[ "static", "void", "stateAssertion", "(", "CallInfo", "callInfo", ",", "DataSet", "expected", ")", "{", "DataSource", "source", "=", "expected", ".", "getSource", "(", ")", ";", "source", ".", "setDirtyStatus", "(", "true", ")", ";", "dataSetAssertion", "(", ...
Perform a database state assertion. @param callInfo Call info. @param expected Expected data. @throws DBAssertionError If the assertion fails. @throws InvalidOperationException If the arguments are invalid.
[ "Perform", "a", "database", "state", "assertion", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBAssert.java#L96-L102
rhuss/jolokia
agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java
AbstractServerDetector.getAttributeValue
protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor,String pMBean,String pAttribute) { try { ObjectName oName = new ObjectName(pMBean); return getAttributeValue(pMBeanServerExecutor,oName,pAttribute); } catch (MalformedObjectNameException e) { return null; } }
java
protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor,String pMBean,String pAttribute) { try { ObjectName oName = new ObjectName(pMBean); return getAttributeValue(pMBeanServerExecutor,oName,pAttribute); } catch (MalformedObjectNameException e) { return null; } }
[ "protected", "String", "getAttributeValue", "(", "MBeanServerExecutor", "pMBeanServerExecutor", ",", "String", "pMBean", ",", "String", "pAttribute", ")", "{", "try", "{", "ObjectName", "oName", "=", "new", "ObjectName", "(", "pMBean", ")", ";", "return", "getAttr...
Get the string representation of an attribute @param pMBeanServerExecutor set of MBeanServers to query. The first one wins. @param pMBean object name of MBean to lookup @param pAttribute attribute to lookup @return string value of attribute or <code>null</code> if the attribute could not be fetched
[ "Get", "the", "string", "representation", "of", "an", "attribute" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java#L74-L81
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixDiscouragedAnnotationUse
@Fix(io.sarl.lang.validation.IssueCodes.USED_RESERVED_SARL_ANNOTATION) public void fixDiscouragedAnnotationUse(final Issue issue, IssueResolutionAcceptor acceptor) { AnnotationRemoveModification.accept(this, issue, acceptor); }
java
@Fix(io.sarl.lang.validation.IssueCodes.USED_RESERVED_SARL_ANNOTATION) public void fixDiscouragedAnnotationUse(final Issue issue, IssueResolutionAcceptor acceptor) { AnnotationRemoveModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "io", ".", "sarl", ".", "lang", ".", "validation", ".", "IssueCodes", ".", "USED_RESERVED_SARL_ANNOTATION", ")", "public", "void", "fixDiscouragedAnnotationUse", "(", "final", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")", "{",...
Quick fix for the discouraged annotation uses. @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "the", "discouraged", "annotation", "uses", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L974-L977
gocd/gocd
base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java
DirectoryScanner.accountForIncludedFile
private void accountForIncludedFile(String name, File file) { processIncluded(name, file, filesIncluded, filesExcluded, filesDeselected); }
java
private void accountForIncludedFile(String name, File file) { processIncluded(name, file, filesIncluded, filesExcluded, filesDeselected); }
[ "private", "void", "accountForIncludedFile", "(", "String", "name", ",", "File", "file", ")", "{", "processIncluded", "(", "name", ",", "file", ",", "filesIncluded", ",", "filesExcluded", ",", "filesDeselected", ")", ";", "}" ]
Process included file. @param name path of the file relative to the directory of the FileSet. @param file included File.
[ "Process", "included", "file", "." ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1128-L1130
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.beginUpdateTagsAsync
public Observable<ApplicationGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() { @Override public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) { return response.body(); } }); }
java
public Observable<ApplicationGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() { @Override public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationGatewayInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateTagsWithServiceRespon...
Updates the specified application gateway tags. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationGatewayInner object
[ "Updates", "the", "specified", "application", "gateway", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L824-L831
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java
AssetsInner.getAsync
public Observable<AssetInner> getAsync(String resourceGroupName, String accountName, String assetName) { return getWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<AssetInner>, AssetInner>() { @Override public AssetInner call(ServiceResponse<AssetInner> response) { return response.body(); } }); }
java
public Observable<AssetInner> getAsync(String resourceGroupName, String accountName, String assetName) { return getWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<AssetInner>, AssetInner>() { @Override public AssetInner call(ServiceResponse<AssetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AssetInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "assetName",...
Get an Asset. Get the details of an Asset in the Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetInner object
[ "Get", "an", "Asset", ".", "Get", "the", "details", "of", "an", "Asset", "in", "the", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/AssetsInner.java#L409-L416
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsScrollBar.java
CmsScrollBar.adjustKnobHeight
private void adjustKnobHeight(int outerHeight, int innerHeight) { int result = (int)((1.0 * outerHeight * outerHeight) / innerHeight); result = result > (outerHeight - 5) ? 5 : (result < 8 ? 8 : result); m_positionValueRatio = (1.0 * (outerHeight - result)) / (innerHeight - outerHeight); m_knobHeight = result - (2 * SCROLL_KNOB_OFFSET); m_knobHeight = m_knobHeight < SCROLL_KNOB_MIN_HEIGHT ? SCROLL_KNOB_MIN_HEIGHT : m_knobHeight; m_knob.getStyle().setHeight(m_knobHeight, Unit.PX); }
java
private void adjustKnobHeight(int outerHeight, int innerHeight) { int result = (int)((1.0 * outerHeight * outerHeight) / innerHeight); result = result > (outerHeight - 5) ? 5 : (result < 8 ? 8 : result); m_positionValueRatio = (1.0 * (outerHeight - result)) / (innerHeight - outerHeight); m_knobHeight = result - (2 * SCROLL_KNOB_OFFSET); m_knobHeight = m_knobHeight < SCROLL_KNOB_MIN_HEIGHT ? SCROLL_KNOB_MIN_HEIGHT : m_knobHeight; m_knob.getStyle().setHeight(m_knobHeight, Unit.PX); }
[ "private", "void", "adjustKnobHeight", "(", "int", "outerHeight", ",", "int", "innerHeight", ")", "{", "int", "result", "=", "(", "int", ")", "(", "(", "1.0", "*", "outerHeight", "*", "outerHeight", ")", "/", "innerHeight", ")", ";", "result", "=", "resu...
Calculates the scroll knob height.<p> @param outerHeight the height of the scrollable element @param innerHeight the height of the scroll content
[ "Calculates", "the", "scroll", "knob", "height", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsScrollBar.java#L549-L557
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
ServletUtil.write
public static void write(HttpServletResponse response, InputStream in, String contentType, String fileName) { final String charset = ObjectUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.UTF_8); response.setHeader("Content-Disposition", StrUtil.format("attachment;filename={}", URLUtil.encode(fileName, charset))); response.setContentType(contentType); write(response, in); }
java
public static void write(HttpServletResponse response, InputStream in, String contentType, String fileName) { final String charset = ObjectUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.UTF_8); response.setHeader("Content-Disposition", StrUtil.format("attachment;filename={}", URLUtil.encode(fileName, charset))); response.setContentType(contentType); write(response, in); }
[ "public", "static", "void", "write", "(", "HttpServletResponse", "response", ",", "InputStream", "in", ",", "String", "contentType", ",", "String", "fileName", ")", "{", "final", "String", "charset", "=", "ObjectUtil", ".", "defaultIfNull", "(", "response", ".",...
返回数据给客户端 @param response 响应对象{@link HttpServletResponse} @param in 需要返回客户端的内容 @param contentType 返回的类型 @param fileName 文件名 @since 4.1.15
[ "返回数据给客户端" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L522-L527
cycorp/api-suite
core-api/src/main/java/com/cyc/session/exception/SessionRuntimeException.java
SessionRuntimeException.fromThrowable
public static SessionRuntimeException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionRuntimeException && Objects.equals(message, cause.getMessage())) ? (SessionRuntimeException) cause : new SessionRuntimeException(message, cause); }
java
public static SessionRuntimeException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionRuntimeException && Objects.equals(message, cause.getMessage())) ? (SessionRuntimeException) cause : new SessionRuntimeException(message, cause); }
[ "public", "static", "SessionRuntimeException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "SessionRuntimeException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getM...
Converts a Throwable to a SessionRuntimeException with the specified detail message. If the Throwable is a SessionRuntimeException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionRuntimeException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a SessionRuntimeException
[ "Converts", "a", "Throwable", "to", "a", "SessionRuntimeException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "SessionRuntimeException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "t...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionRuntimeException.java#L66-L70
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java
Scheduler.durationHours
public static long durationHours(LocalDateTime start,LocalDateTime end) { if(start == null || end == null) return ZERO; return Duration.between(start, end).toHours(); }
java
public static long durationHours(LocalDateTime start,LocalDateTime end) { if(start == null || end == null) return ZERO; return Duration.between(start, end).toHours(); }
[ "public", "static", "long", "durationHours", "(", "LocalDateTime", "start", ",", "LocalDateTime", "end", ")", "{", "if", "(", "start", "==", "null", "||", "end", "==", "null", ")", "return", "ZERO", ";", "return", "Duration", ".", "between", "(", "start", ...
1 Hours = 60 minutes @param start between time @param end finish time @return duration in hours
[ "1", "Hours", "=", "60", "minutes" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L121-L127
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
DefaultMetadataService.addTrait
@Override public void addTrait(String guid, String traitInstanceDefinition) throws AtlasException { guid = ParamChecker.notEmpty(guid, "entity id"); traitInstanceDefinition = ParamChecker.notEmpty(traitInstanceDefinition, "trait instance definition"); ITypedStruct traitInstance = deserializeTraitInstance(traitInstanceDefinition); addTrait(guid, traitInstance); }
java
@Override public void addTrait(String guid, String traitInstanceDefinition) throws AtlasException { guid = ParamChecker.notEmpty(guid, "entity id"); traitInstanceDefinition = ParamChecker.notEmpty(traitInstanceDefinition, "trait instance definition"); ITypedStruct traitInstance = deserializeTraitInstance(traitInstanceDefinition); addTrait(guid, traitInstance); }
[ "@", "Override", "public", "void", "addTrait", "(", "String", "guid", ",", "String", "traitInstanceDefinition", ")", "throws", "AtlasException", "{", "guid", "=", "ParamChecker", ".", "notEmpty", "(", "guid", ",", "\"entity id\"", ")", ";", "traitInstanceDefinitio...
Adds a new trait to an existing entity represented by a guid. @param guid globally unique identifier for the entity @param traitInstanceDefinition trait instance json that needs to be added to entity @throws AtlasException
[ "Adds", "a", "new", "trait", "to", "an", "existing", "entity", "represented", "by", "a", "guid", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java#L600-L607
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/module/EMFModule.java
EMFModule.setupDefaultMapper
public static ObjectMapper setupDefaultMapper(JsonFactory factory) { final ObjectMapper mapper = new ObjectMapper(factory); // same as emf final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); dateFormat.setTimeZone(TimeZone.getDefault()); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); mapper.setDateFormat(dateFormat); mapper.setTimeZone(TimeZone.getDefault()); mapper.registerModule(new EMFModule()); return mapper; }
java
public static ObjectMapper setupDefaultMapper(JsonFactory factory) { final ObjectMapper mapper = new ObjectMapper(factory); // same as emf final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH); dateFormat.setTimeZone(TimeZone.getDefault()); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); mapper.setDateFormat(dateFormat); mapper.setTimeZone(TimeZone.getDefault()); mapper.registerModule(new EMFModule()); return mapper; }
[ "public", "static", "ObjectMapper", "setupDefaultMapper", "(", "JsonFactory", "factory", ")", "{", "final", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", "factory", ")", ";", "// same as emf", "final", "SimpleDateFormat", "dateFormat", "=", "new", "Simp...
Returns a pre configured mapper using the EMF module and the specified jackson factory. This method can be used to work with formats others than JSON (such as YAML). @param factory @return mapper
[ "Returns", "a", "pre", "configured", "mapper", "using", "the", "EMF", "module", "and", "the", "specified", "jackson", "factory", ".", "This", "method", "can", "be", "used", "to", "work", "with", "formats", "others", "than", "JSON", "(", "such", "as", "YAML...
train
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/module/EMFModule.java#L158-L170
finmath/finmath-lib
src/main/java6/net/finmath/functions/AnalyticFormulas.java
AnalyticFormulas.sabrNormalVolatilityCurvatureApproximation
public static double sabrNormalVolatilityCurvatureApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double maturity) { double sigma = sabrBerestyckiNormalVolatilityApproximation(alpha, beta, rho, nu, displacement, underlying, underlying, maturity); // Apply displacement. Displaced model is just a shift on underlying and strike. underlying += displacement; /* double d1xdz1 = 1.0; double d2xdz2 = rho; double d3xdz3 = 3.0*rho*rho-1.0; double d1zdK1 = -nu/alpha * Math.pow(underlying, -beta); double d2zdK2 = + nu/alpha * beta * Math.pow(underlying, -beta-1.0); double d3zdK3 = - nu/alpha * beta * (1.0+beta) * Math.pow(underlying, -beta-2.0); double d1xdK1 = d1xdz1*d1zdK1; double d2xdK2 = d2xdz2*d1zdK1*d1zdK1 + d1xdz1*d2zdK2; double d3xdK3 = d3xdz3*d1zdK1*d1zdK1*d1zdK1 + 3.0*d2xdz2*d2zdK2*d1zdK1 + d1xdz1*d3zdK3; double term1 = alpha * Math.pow(underlying, beta) / nu; */ double d2Part1dK2 = nu * ((1.0/3.0 - 1.0/2.0 * rho * rho) * nu/alpha * Math.pow(underlying, -beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * alpha/nu*Math.pow(underlying, beta-2)); double d0BdK0 = (-1.0/24.0 *beta*(2-beta)*alpha*alpha*Math.pow(underlying, 2*beta-2) + 1.0/4.0 * beta*alpha*rho*nu*Math.pow(underlying, beta-1.0) + (2.0 -3.0*rho*rho)*nu*nu/24); double d1BdK1 = (-1.0/48.0 *beta*(2-beta)*(2*beta-2)*alpha*alpha*Math.pow(underlying, 2*beta-3) + 1.0/8.0 * beta*(beta-1.0)*alpha*rho*nu*Math.pow(underlying, beta-2)); double d2BdK2 = (-1.0/96.0 *beta*(2-beta)*(2*beta-2)*(2*beta-3)*alpha*alpha*Math.pow(underlying, 2*beta-4) + 1.0/16.0 * beta*(beta-1)*(beta-2)*alpha*rho*nu*Math.pow(underlying, beta-3)); double curvatureApproximation = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta)); double curvaturePart1 = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * sigma*alpha/nu*Math.pow(underlying, -2)); double curvatureMaturityPart = (rho*nu + alpha*beta*Math.pow(underlying, beta-1))*d1BdK1 + alpha*Math.pow(underlying, beta)*d2BdK2; return (curvaturePart1 + maturity * curvatureMaturityPart); }
java
public static double sabrNormalVolatilityCurvatureApproximation(double alpha, double beta, double rho, double nu, double displacement, double underlying, double maturity) { double sigma = sabrBerestyckiNormalVolatilityApproximation(alpha, beta, rho, nu, displacement, underlying, underlying, maturity); // Apply displacement. Displaced model is just a shift on underlying and strike. underlying += displacement; /* double d1xdz1 = 1.0; double d2xdz2 = rho; double d3xdz3 = 3.0*rho*rho-1.0; double d1zdK1 = -nu/alpha * Math.pow(underlying, -beta); double d2zdK2 = + nu/alpha * beta * Math.pow(underlying, -beta-1.0); double d3zdK3 = - nu/alpha * beta * (1.0+beta) * Math.pow(underlying, -beta-2.0); double d1xdK1 = d1xdz1*d1zdK1; double d2xdK2 = d2xdz2*d1zdK1*d1zdK1 + d1xdz1*d2zdK2; double d3xdK3 = d3xdz3*d1zdK1*d1zdK1*d1zdK1 + 3.0*d2xdz2*d2zdK2*d1zdK1 + d1xdz1*d3zdK3; double term1 = alpha * Math.pow(underlying, beta) / nu; */ double d2Part1dK2 = nu * ((1.0/3.0 - 1.0/2.0 * rho * rho) * nu/alpha * Math.pow(underlying, -beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * alpha/nu*Math.pow(underlying, beta-2)); double d0BdK0 = (-1.0/24.0 *beta*(2-beta)*alpha*alpha*Math.pow(underlying, 2*beta-2) + 1.0/4.0 * beta*alpha*rho*nu*Math.pow(underlying, beta-1.0) + (2.0 -3.0*rho*rho)*nu*nu/24); double d1BdK1 = (-1.0/48.0 *beta*(2-beta)*(2*beta-2)*alpha*alpha*Math.pow(underlying, 2*beta-3) + 1.0/8.0 * beta*(beta-1.0)*alpha*rho*nu*Math.pow(underlying, beta-2)); double d2BdK2 = (-1.0/96.0 *beta*(2-beta)*(2*beta-2)*(2*beta-3)*alpha*alpha*Math.pow(underlying, 2*beta-4) + 1.0/16.0 * beta*(beta-1)*(beta-2)*alpha*rho*nu*Math.pow(underlying, beta-3)); double curvatureApproximation = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta)); double curvaturePart1 = nu/alpha * ((1.0/3.0 - 1.0/2.0 * rho * rho) * sigma*nu/alpha * Math.pow(underlying, -2*beta) + (1.0/6.0 * beta*beta - 2.0/6.0 * beta) * sigma*alpha/nu*Math.pow(underlying, -2)); double curvatureMaturityPart = (rho*nu + alpha*beta*Math.pow(underlying, beta-1))*d1BdK1 + alpha*Math.pow(underlying, beta)*d2BdK2; return (curvaturePart1 + maturity * curvatureMaturityPart); }
[ "public", "static", "double", "sabrNormalVolatilityCurvatureApproximation", "(", "double", "alpha", ",", "double", "beta", ",", "double", "rho", ",", "double", "nu", ",", "double", "displacement", ",", "double", "underlying", ",", "double", "maturity", ")", "{", ...
Return the curvature of the implied normal volatility (Bachelier volatility) under a SABR model using the approximation of Berestycki. The curvatures is the second derivative of the implied vol w.r.t. the strike, evaluated at the money. @param alpha initial value of the stochastic volatility process of the SABR model. @param beta CEV parameter of the SABR model. @param rho Correlation (leverages) of the stochastic volatility. @param nu Volatility of the stochastic volatility (vol-of-vol). @param displacement The displacement parameter d. @param underlying Underlying (spot) value. @param maturity Maturity. @return The curvature of the implied normal volatility (Bachelier volatility)
[ "Return", "the", "curvature", "of", "the", "implied", "normal", "volatility", "(", "Bachelier", "volatility", ")", "under", "a", "SABR", "model", "using", "the", "approximation", "of", "Berestycki", ".", "The", "curvatures", "is", "the", "second", "derivative", ...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L1256-L1289
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeRepositoryDecorator.java
EntityTypeRepositoryDecorator.removeMappedByAttributes
private void removeMappedByAttributes(Map<String, EntityType> resolvedEntityTypes) { resolvedEntityTypes .values() .stream() .flatMap(EntityType::getMappedByAttributes) .filter(attribute -> resolvedEntityTypes.containsKey(attribute.getEntity().getId())) .forEach(attribute -> dataService.delete(ATTRIBUTE_META_DATA, attribute)); }
java
private void removeMappedByAttributes(Map<String, EntityType> resolvedEntityTypes) { resolvedEntityTypes .values() .stream() .flatMap(EntityType::getMappedByAttributes) .filter(attribute -> resolvedEntityTypes.containsKey(attribute.getEntity().getId())) .forEach(attribute -> dataService.delete(ATTRIBUTE_META_DATA, attribute)); }
[ "private", "void", "removeMappedByAttributes", "(", "Map", "<", "String", ",", "EntityType", ">", "resolvedEntityTypes", ")", "{", "resolvedEntityTypes", ".", "values", "(", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "EntityType", "::", "getMappedByAttri...
Removes the mappedBy attributes of each OneToMany pair in the supplied map of EntityTypes
[ "Removes", "the", "mappedBy", "attributes", "of", "each", "OneToMany", "pair", "in", "the", "supplied", "map", "of", "EntityTypes" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/EntityTypeRepositoryDecorator.java#L210-L217
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java
BeetlUtil.createFileGroupTemplate
public static GroupTemplate createFileGroupTemplate(String dir, Charset charset) { return createGroupTemplate(new FileResourceLoader(dir, charset.name())); }
java
public static GroupTemplate createFileGroupTemplate(String dir, Charset charset) { return createGroupTemplate(new FileResourceLoader(dir, charset.name())); }
[ "public", "static", "GroupTemplate", "createFileGroupTemplate", "(", "String", "dir", ",", "Charset", "charset", ")", "{", "return", "createGroupTemplate", "(", "new", "FileResourceLoader", "(", "dir", ",", "charset", ".", "name", "(", ")", ")", ")", ";", "}" ...
创建文件目录的模板组 {@link GroupTemplate},配置文件使用全局默认<br> 此时自定义的配置文件可在ClassPath中放入beetl.properties配置 @param dir 目录路径(绝对路径) @param charset 读取模板文件的编码 @return {@link GroupTemplate} @since 3.2.0
[ "创建文件目录的模板组", "{", "@link", "GroupTemplate", "}", ",配置文件使用全局默认<br", ">", "此时自定义的配置文件可在ClassPath中放入beetl", ".", "properties配置" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L96-L98
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/teamservice/GetAllTeams.java
GetAllTeams.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the TeamService. TeamServiceInterface teamService = adManagerServices.get(session, TeamServiceInterface.class); // Create a statement to select all teams. StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get teams by statement. TeamPage page = teamService.getTeamsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (Team team : page.getResults()) { System.out.printf( "%d) Team with ID %d and name '%s' was found.%n", i++, team.getId(), team.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the TeamService. TeamServiceInterface teamService = adManagerServices.get(session, TeamServiceInterface.class); // Create a statement to select all teams. StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get teams by statement. TeamPage page = teamService.getTeamsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (Team team : page.getResults()) { System.out.printf( "%d) Team with ID %d and name '%s' was found.%n", i++, team.getId(), team.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the TeamService.", "TeamServiceInterface", "teamService", "=", "adManagerServices", ".", "get", "(", ...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/teamservice/GetAllTeams.java#L51-L80
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/Context.java
Context.getUserAttributes
public UserAttributesSet getUserAttributes() throws EFapsException { if (containsSessionAttribute(UserAttributesSet.CONTEXTMAPKEY)) { return (UserAttributesSet) getSessionAttribute(UserAttributesSet.CONTEXTMAPKEY); } else { throw new EFapsException(Context.class, "getUserAttributes.NoSessionAttribute"); } }
java
public UserAttributesSet getUserAttributes() throws EFapsException { if (containsSessionAttribute(UserAttributesSet.CONTEXTMAPKEY)) { return (UserAttributesSet) getSessionAttribute(UserAttributesSet.CONTEXTMAPKEY); } else { throw new EFapsException(Context.class, "getUserAttributes.NoSessionAttribute"); } }
[ "public", "UserAttributesSet", "getUserAttributes", "(", ")", "throws", "EFapsException", "{", "if", "(", "containsSessionAttribute", "(", "UserAttributesSet", ".", "CONTEXTMAPKEY", ")", ")", "{", "return", "(", "UserAttributesSet", ")", "getSessionAttribute", "(", "U...
Method to get the UserAttributesSet of the user of this context. @return UserAttributesSet @throws EFapsException on error
[ "Method", "to", "get", "the", "UserAttributesSet", "of", "the", "user", "of", "this", "context", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L703-L711
LearnLib/automatalib
incremental/src/main/java/net/automatalib/incremental/dfa/dag/AbstractIncrementalDFADAGBuilder.java
AbstractIncrementalDFADAGBuilder.updateSignature
protected State updateSignature(State state, Acceptance acc) { assert (state != init); StateSignature sig = state.getSignature(); if (sig.acceptance == acc) { return state; } register.remove(sig); sig.acceptance = acc; sig.updateHashCode(); return replaceOrRegister(state); }
java
protected State updateSignature(State state, Acceptance acc) { assert (state != init); StateSignature sig = state.getSignature(); if (sig.acceptance == acc) { return state; } register.remove(sig); sig.acceptance = acc; sig.updateHashCode(); return replaceOrRegister(state); }
[ "protected", "State", "updateSignature", "(", "State", "state", ",", "Acceptance", "acc", ")", "{", "assert", "(", "state", "!=", "init", ")", ";", "StateSignature", "sig", "=", "state", ".", "getSignature", "(", ")", ";", "if", "(", "sig", ".", "accepta...
Updates the signature for a given state. @param state the state @param acc the new acceptance value @return the canonical state for the updated signature
[ "Updates", "the", "signature", "for", "a", "given", "state", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/incremental/src/main/java/net/automatalib/incremental/dfa/dag/AbstractIncrementalDFADAGBuilder.java#L246-L256
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java
Dynamic.ofInvocation
public static Dynamic ofInvocation(MethodDescription.InDefinedShape methodDescription, Object... rawArgument) { return ofInvocation(methodDescription, Arrays.asList(rawArgument)); }
java
public static Dynamic ofInvocation(MethodDescription.InDefinedShape methodDescription, Object... rawArgument) { return ofInvocation(methodDescription, Arrays.asList(rawArgument)); }
[ "public", "static", "Dynamic", "ofInvocation", "(", "MethodDescription", ".", "InDefinedShape", "methodDescription", ",", "Object", "...", "rawArgument", ")", "{", "return", "ofInvocation", "(", "methodDescription", ",", "Arrays", ".", "asList", "(", "rawArgument", ...
Represents a constant that is resolved by invoking a {@code static} factory method or a constructor. @param methodDescription The method or constructor to invoke to create the represented constant value. @param rawArgument The method's or constructor's constant arguments. @return A dynamic constant that is resolved by the supplied factory method or constructor.
[ "Represents", "a", "constant", "that", "is", "resolved", "by", "invoking", "a", "{", "@code", "static", "}", "factory", "method", "or", "a", "constructor", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java#L1564-L1566
Alluxio/alluxio
underfs/wasb/src/main/java/alluxio/underfs/wasb/WasbUnderFileSystem.java
WasbUnderFileSystem.createInstance
public static WasbUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf, AlluxioConfiguration alluxioConf) { Configuration wasbConf = createConfiguration(conf); return new WasbUnderFileSystem(uri, conf, wasbConf, alluxioConf); }
java
public static WasbUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf, AlluxioConfiguration alluxioConf) { Configuration wasbConf = createConfiguration(conf); return new WasbUnderFileSystem(uri, conf, wasbConf, alluxioConf); }
[ "public", "static", "WasbUnderFileSystem", "createInstance", "(", "AlluxioURI", "uri", ",", "UnderFileSystemConfiguration", "conf", ",", "AlluxioConfiguration", "alluxioConf", ")", "{", "Configuration", "wasbConf", "=", "createConfiguration", "(", "conf", ")", ";", "ret...
Factory method to construct a new Wasb {@link UnderFileSystem}. @param uri the {@link AlluxioURI} for this UFS @param conf the configuration for this UFS @param alluxioConf Alluxio configuration @return a new Wasb {@link UnderFileSystem} instance
[ "Factory", "method", "to", "construct", "a", "new", "Wasb", "{", "@link", "UnderFileSystem", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/wasb/src/main/java/alluxio/underfs/wasb/WasbUnderFileSystem.java#L70-L74
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java
BytecodeUtils.newLinkedHashMap
public static Expression newLinkedHashMap( Iterable<? extends Expression> keys, Iterable<? extends Expression> values) { return newMap(keys, values, ConstructorRef.LINKED_HASH_MAP_CAPACITY, LINKED_HASH_MAP_TYPE); }
java
public static Expression newLinkedHashMap( Iterable<? extends Expression> keys, Iterable<? extends Expression> values) { return newMap(keys, values, ConstructorRef.LINKED_HASH_MAP_CAPACITY, LINKED_HASH_MAP_TYPE); }
[ "public", "static", "Expression", "newLinkedHashMap", "(", "Iterable", "<", "?", "extends", "Expression", ">", "keys", ",", "Iterable", "<", "?", "extends", "Expression", ">", "values", ")", "{", "return", "newMap", "(", "keys", ",", "values", ",", "Construc...
Returns an expression that returns a new {@link LinkedHashMap} containing all the given entries.
[ "Returns", "an", "expression", "that", "returns", "a", "new", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L907-L910
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java
BuildTasksInner.beginUpdateAsync
public Observable<BuildTaskInner> beginUpdateAsync(String resourceGroupName, String registryName, String buildTaskName, BuildTaskUpdateParameters buildTaskUpdateParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters).map(new Func1<ServiceResponse<BuildTaskInner>, BuildTaskInner>() { @Override public BuildTaskInner call(ServiceResponse<BuildTaskInner> response) { return response.body(); } }); }
java
public Observable<BuildTaskInner> beginUpdateAsync(String resourceGroupName, String registryName, String buildTaskName, BuildTaskUpdateParameters buildTaskUpdateParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskUpdateParameters).map(new Func1<ServiceResponse<BuildTaskInner>, BuildTaskInner>() { @Override public BuildTaskInner call(ServiceResponse<BuildTaskInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BuildTaskInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ",", "BuildTaskUpdateParameters", "buildTaskUpdateParameters", ")", "{", "return", "beginUpdateWithServ...
Updates a build task with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param buildTaskUpdateParameters The parameters for updating a build task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BuildTaskInner object
[ "Updates", "a", "build", "task", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java#L917-L924
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/ProtoEdgeTable.java
ProtoEdgeTable.addEdges
public void addEdges(final Integer stmt, final TableProtoEdge... newEdges) { if (stmt == null) { throw new InvalidArgument("stmt", stmt); } if (newEdges == null || newEdges.length <= 0) { throw new InvalidArgument("newEdges", newEdges); } Set<Integer> edges = stmtEdges.get(stmt); if (edges == null) { edges = new HashSet<Integer>(); stmtEdges.put(stmt, edges); } for (final TableProtoEdge newEdge : newEdges) { int idx = protoEdges.size(); protoEdges.add(newEdge); Integer existingEdge = visited.get(newEdge); if (existingEdge != null) { getEquivalences().put(idx, existingEdge); } else { visited.put(newEdge, idx); getEquivalences().put(idx, getEquivalences().size()); } edges.add(idx); Set<Integer> stmts = new LinkedHashSet<Integer>(); stmts.add(stmt); edgeStmts.put(idx, stmts); } }
java
public void addEdges(final Integer stmt, final TableProtoEdge... newEdges) { if (stmt == null) { throw new InvalidArgument("stmt", stmt); } if (newEdges == null || newEdges.length <= 0) { throw new InvalidArgument("newEdges", newEdges); } Set<Integer> edges = stmtEdges.get(stmt); if (edges == null) { edges = new HashSet<Integer>(); stmtEdges.put(stmt, edges); } for (final TableProtoEdge newEdge : newEdges) { int idx = protoEdges.size(); protoEdges.add(newEdge); Integer existingEdge = visited.get(newEdge); if (existingEdge != null) { getEquivalences().put(idx, existingEdge); } else { visited.put(newEdge, idx); getEquivalences().put(idx, getEquivalences().size()); } edges.add(idx); Set<Integer> stmts = new LinkedHashSet<Integer>(); stmts.add(stmt); edgeStmts.put(idx, stmts); } }
[ "public", "void", "addEdges", "(", "final", "Integer", "stmt", ",", "final", "TableProtoEdge", "...", "newEdges", ")", "{", "if", "(", "stmt", "==", "null", ")", "{", "throw", "new", "InvalidArgument", "(", "\"stmt\"", ",", "stmt", ")", ";", "}", "if", ...
Adds 1 or more {@link TableProtoEdge proto edges} to the table and associates them with the supporting {@link TableStatement statement} index. <p> There must be at least one {@link TableProtoEdge proto edge} to associate to a statement otherwise an exception is thrown. </p> @param stmt the {@link TableStatement statement} index to associate the {@link TableProtoEdge proto edges} to, which cannot be null @param newEdges the {@link TableProtoEdge proto edges} array to add to the table, which cannot be null or have a length less than 1 @throws InvalidArgument May be thrown if <tt>stmt</tt> is <tt>null</tt>, <tt>newEdges</tt> is null, or <tt>newEdges</tt> is <tt> <= 0</tt>
[ "Adds", "1", "or", "more", "{", "@link", "TableProtoEdge", "proto", "edges", "}", "to", "the", "table", "and", "associates", "them", "with", "the", "supporting", "{", "@link", "TableStatement", "statement", "}", "index", ".", "<p", ">", "There", "must", "b...
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/ProtoEdgeTable.java#L127-L159
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.oCRFileInputWithServiceResponseAsync
public Observable<ServiceResponse<OCR>> oCRFileInputWithServiceResponseAsync(String language, byte[] imageStream, OCRFileInputOptionalParameter oCRFileInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (language == null) { throw new IllegalArgumentException("Parameter language is required and cannot be null."); } if (imageStream == null) { throw new IllegalArgumentException("Parameter imageStream is required and cannot be null."); } final Boolean cacheImage = oCRFileInputOptionalParameter != null ? oCRFileInputOptionalParameter.cacheImage() : null; final Boolean enhanced = oCRFileInputOptionalParameter != null ? oCRFileInputOptionalParameter.enhanced() : null; return oCRFileInputWithServiceResponseAsync(language, imageStream, cacheImage, enhanced); }
java
public Observable<ServiceResponse<OCR>> oCRFileInputWithServiceResponseAsync(String language, byte[] imageStream, OCRFileInputOptionalParameter oCRFileInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (language == null) { throw new IllegalArgumentException("Parameter language is required and cannot be null."); } if (imageStream == null) { throw new IllegalArgumentException("Parameter imageStream is required and cannot be null."); } final Boolean cacheImage = oCRFileInputOptionalParameter != null ? oCRFileInputOptionalParameter.cacheImage() : null; final Boolean enhanced = oCRFileInputOptionalParameter != null ? oCRFileInputOptionalParameter.enhanced() : null; return oCRFileInputWithServiceResponseAsync(language, imageStream, cacheImage, enhanced); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OCR", ">", ">", "oCRFileInputWithServiceResponseAsync", "(", "String", "language", ",", "byte", "[", "]", "imageStream", ",", "OCRFileInputOptionalParameter", "oCRFileInputOptionalParameter", ")", "{", "if", "(", "...
Returns any text found in the image for the language specified. If no language is specified in input then the detection defaults to English. @param language Language of the terms. @param imageStream The image file. @param oCRFileInputOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OCR object
[ "Returns", "any", "text", "found", "in", "the", "image", "for", "the", "language", "specified", ".", "If", "no", "language", "is", "specified", "in", "input", "then", "the", "detection", "defaults", "to", "English", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1291-L1305
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/ConvertBitmap.java
ConvertBitmap.bitmapToBoof
public static <T extends ImageBase<T>> void bitmapToBoof( Bitmap input , T output , byte[] storage) { if( BOverrideConvertAndroid.invokeBitmapToBoof(input,output,storage)) return; switch( output.getImageType().getFamily() ) { case GRAY: { if( output.getClass() == GrayF32.class ) bitmapToGray(input, (GrayF32) output, storage); else if( output.getClass() == GrayU8.class ) bitmapToGray(input,(GrayU8)output,storage); else throw new IllegalArgumentException("Unsupported BoofCV Image Type"); } break; case PLANAR: Planar pl = (Planar)output; bitmapToPlanar(input,pl,pl.getBandType(),storage); break; default: throw new IllegalArgumentException("Unsupported BoofCV Image Type"); } }
java
public static <T extends ImageBase<T>> void bitmapToBoof( Bitmap input , T output , byte[] storage) { if( BOverrideConvertAndroid.invokeBitmapToBoof(input,output,storage)) return; switch( output.getImageType().getFamily() ) { case GRAY: { if( output.getClass() == GrayF32.class ) bitmapToGray(input, (GrayF32) output, storage); else if( output.getClass() == GrayU8.class ) bitmapToGray(input,(GrayU8)output,storage); else throw new IllegalArgumentException("Unsupported BoofCV Image Type"); } break; case PLANAR: Planar pl = (Planar)output; bitmapToPlanar(input,pl,pl.getBandType(),storage); break; default: throw new IllegalArgumentException("Unsupported BoofCV Image Type"); } }
[ "public", "static", "<", "T", "extends", "ImageBase", "<", "T", ">", ">", "void", "bitmapToBoof", "(", "Bitmap", "input", ",", "T", "output", ",", "byte", "[", "]", "storage", ")", "{", "if", "(", "BOverrideConvertAndroid", ".", "invokeBitmapToBoof", "(", ...
Converts a {@link Bitmap} into a BoofCV image. Type is determined at runtime. @param input Bitmap image. @param output Output image. Automatically resized to match input shape. @param storage Byte array used for internal storage. If null it will be declared internally.
[ "Converts", "a", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/ConvertBitmap.java#L61-L85
rythmengine/spring-rythm
src/main/java/org/rythmengine/spring/RythmEngineFactory.java
RythmEngineFactory.setEngineConfigMap
public void setEngineConfigMap(Map<String, Object> engineConfigMap) { if (engineConfigMap != null) { this.engineConfig.putAll(engineConfigMap); } }
java
public void setEngineConfigMap(Map<String, Object> engineConfigMap) { if (engineConfigMap != null) { this.engineConfig.putAll(engineConfigMap); } }
[ "public", "void", "setEngineConfigMap", "(", "Map", "<", "String", ",", "Object", ">", "engineConfigMap", ")", "{", "if", "(", "engineConfigMap", "!=", "null", ")", "{", "this", ".", "engineConfig", ".", "putAll", "(", "engineConfigMap", ")", ";", "}", "}"...
Set Rythm properties as Map, to allow for non-String values like "ds.resource.loader.instance". @see #setEngineConfig
[ "Set", "Rythm", "properties", "as", "Map", "to", "allow", "for", "non", "-", "String", "values", "like", "ds", ".", "resource", ".", "loader", ".", "instance", "." ]
train
https://github.com/rythmengine/spring-rythm/blob/a654016371c72dabaea50ac9a57626da7614d236/src/main/java/org/rythmengine/spring/RythmEngineFactory.java#L115-L119
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java
AbstractCasView.getErrorDescriptionFrom
protected String getErrorDescriptionFrom(final Map<String, Object> model) { return model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_ERROR_DESCRIPTION).toString(); }
java
protected String getErrorDescriptionFrom(final Map<String, Object> model) { return model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_ERROR_DESCRIPTION).toString(); }
[ "protected", "String", "getErrorDescriptionFrom", "(", "final", "Map", "<", "String", ",", "Object", ">", "model", ")", "{", "return", "model", ".", "get", "(", "CasViewConstants", ".", "MODEL_ATTRIBUTE_NAME_ERROR_DESCRIPTION", ")", ".", "toString", "(", ")", ";...
Gets error description from. @param model the model @return the error description from
[ "Gets", "error", "description", "from", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java#L96-L98
lucee/Lucee
core/src/main/java/lucee/commons/collection/HashMapPro.java
HashMapPro.put
@Override public V put(K key, V value) { if (key == null) return putForNullKey(value); int hash = hash(key); int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { Object k; if (e.hash == hash && ((k = e.key) == key || key.equals(k))) { V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, key, value, i); return null; }
java
@Override public V put(K key, V value) { if (key == null) return putForNullKey(value); int hash = hash(key); int i = indexFor(hash, table.length); for (Entry<K, V> e = table[i]; e != null; e = e.next) { Object k; if (e.hash == hash && ((k = e.key) == key || key.equals(k))) { V oldValue = e.value; e.value = value; e.recordAccess(this); return oldValue; } } modCount++; addEntry(hash, key, value, i); return null; }
[ "@", "Override", "public", "V", "put", "(", "K", "key", ",", "V", "value", ")", "{", "if", "(", "key", "==", "null", ")", "return", "putForNullKey", "(", "value", ")", ";", "int", "hash", "=", "hash", "(", "key", ")", ";", "int", "i", "=", "ind...
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced. @param key key with which the specified value is to be associated @param value value to be associated with the specified key @return the previous value associated with <tt>key</tt>, or <tt>null</tt> if there was no mapping for <tt>key</tt>. (A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with <tt>key</tt>.)
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "this", "map", ".", "If", "the", "map", "previously", "contained", "a", "mapping", "for", "the", "key", "the", "old", "value", "is", "replaced", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/collection/HashMapPro.java#L460-L478
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java
AbstractBundleLinkRenderer.performGlobalBundleLinksRendering
protected void performGlobalBundleLinksRendering(BundleRendererContext ctx, Writer out, boolean debugOn) throws IOException { ResourceBundlePathsIterator resourceBundleIterator = bundler.getGlobalResourceBundlePaths(getDebugMode(debugOn), new ConditionalCommentRenderer(out), ctx.getVariants()); renderBundleLinks(resourceBundleIterator, ctx, debugOn, out); }
java
protected void performGlobalBundleLinksRendering(BundleRendererContext ctx, Writer out, boolean debugOn) throws IOException { ResourceBundlePathsIterator resourceBundleIterator = bundler.getGlobalResourceBundlePaths(getDebugMode(debugOn), new ConditionalCommentRenderer(out), ctx.getVariants()); renderBundleLinks(resourceBundleIterator, ctx, debugOn, out); }
[ "protected", "void", "performGlobalBundleLinksRendering", "(", "BundleRendererContext", "ctx", ",", "Writer", "out", ",", "boolean", "debugOn", ")", "throws", "IOException", "{", "ResourceBundlePathsIterator", "resourceBundleIterator", "=", "bundler", ".", "getGlobalResourc...
Performs the global bundle rendering @param ctx the context @param out the writer @param debugOn the flag indicating if we are in debug mode or not @throws IOException if an IO exception occurs
[ "Performs", "the", "global", "bundle", "rendering" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java#L221-L227
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.onSelectionChanged
protected void onSelectionChanged(int selStart, int selEnd) { if(mInputView == null) return; if(mInputView instanceof InternalEditText) ((InternalEditText)mInputView).superOnSelectionChanged(selStart, selEnd); else if(mInputView instanceof InternalAutoCompleteTextView) ((InternalAutoCompleteTextView)mInputView).superOnSelectionChanged(selStart, selEnd); else ((InternalMultiAutoCompleteTextView)mInputView).superOnSelectionChanged(selStart, selEnd); if(mOnSelectionChangedListener != null) mOnSelectionChangedListener.onSelectionChanged(this, selStart, selEnd); }
java
protected void onSelectionChanged(int selStart, int selEnd) { if(mInputView == null) return; if(mInputView instanceof InternalEditText) ((InternalEditText)mInputView).superOnSelectionChanged(selStart, selEnd); else if(mInputView instanceof InternalAutoCompleteTextView) ((InternalAutoCompleteTextView)mInputView).superOnSelectionChanged(selStart, selEnd); else ((InternalMultiAutoCompleteTextView)mInputView).superOnSelectionChanged(selStart, selEnd); if(mOnSelectionChangedListener != null) mOnSelectionChangedListener.onSelectionChanged(this, selStart, selEnd); }
[ "protected", "void", "onSelectionChanged", "(", "int", "selStart", ",", "int", "selEnd", ")", "{", "if", "(", "mInputView", "==", "null", ")", "return", ";", "if", "(", "mInputView", "instanceof", "InternalEditText", ")", "(", "(", "InternalEditText", ")", "...
This method is called when the selection has changed, in case any subclasses would like to know. @param selStart The new selection start location. @param selEnd The new selection end location.
[ "This", "method", "is", "called", "when", "the", "selection", "has", "changed", "in", "case", "any", "subclasses", "would", "like", "to", "know", "." ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2609-L2622
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/MailApi.java
MailApi.postCharactersCharacterIdMail
public Integer postCharactersCharacterIdMail(Integer characterId, String datasource, String token, Mail mail) throws ApiException { ApiResponse<Integer> resp = postCharactersCharacterIdMailWithHttpInfo(characterId, datasource, token, mail); return resp.getData(); }
java
public Integer postCharactersCharacterIdMail(Integer characterId, String datasource, String token, Mail mail) throws ApiException { ApiResponse<Integer> resp = postCharactersCharacterIdMailWithHttpInfo(characterId, datasource, token, mail); return resp.getData(); }
[ "public", "Integer", "postCharactersCharacterIdMail", "(", "Integer", "characterId", ",", "String", "datasource", ",", "String", "token", ",", "Mail", "mail", ")", "throws", "ApiException", "{", "ApiResponse", "<", "Integer", ">", "resp", "=", "postCharactersCharact...
Send a new mail Create and send a new mail --- SSO Scope: esi-mail.send_mail.v1 @param characterId An EVE character ID (required) @param datasource The server name you would like data from (optional, default to tranquility) @param token Access token to use if unable to set a header (optional) @param mail (optional) @return Integer @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Send", "a", "new", "mail", "Create", "and", "send", "a", "new", "mail", "---", "SSO", "Scope", ":", "esi", "-", "mail", ".", "send_mail", ".", "v1" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/MailApi.java#L1175-L1179
Cleveroad/AdaptiveTableLayout
library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableManager.java
AdaptiveTableManager.getColumnByXWithShift
int getColumnByXWithShift(int x, int shiftEveryStep) { checkForInit(); int sum = 0; // header offset int tempX = x - mHeaderRowWidth; if (tempX <= sum) { return 0; } for (int count = mColumnWidths.length, i = 0; i < count; i++) { int nextSum = sum + mColumnWidths[i] + shiftEveryStep; if (tempX > sum && tempX < nextSum) { return i; } else if (tempX < nextSum) { return i - 1; } sum = nextSum; } return mColumnWidths.length - 1; }
java
int getColumnByXWithShift(int x, int shiftEveryStep) { checkForInit(); int sum = 0; // header offset int tempX = x - mHeaderRowWidth; if (tempX <= sum) { return 0; } for (int count = mColumnWidths.length, i = 0; i < count; i++) { int nextSum = sum + mColumnWidths[i] + shiftEveryStep; if (tempX > sum && tempX < nextSum) { return i; } else if (tempX < nextSum) { return i - 1; } sum = nextSum; } return mColumnWidths.length - 1; }
[ "int", "getColumnByXWithShift", "(", "int", "x", ",", "int", "shiftEveryStep", ")", "{", "checkForInit", "(", ")", ";", "int", "sum", "=", "0", ";", "// header offset", "int", "tempX", "=", "x", "-", "mHeaderRowWidth", ";", "if", "(", "tempX", "<=", "sum...
Return column number which bounds contains X @param x coordinate @return column number
[ "Return", "column", "number", "which", "bounds", "contains", "X" ]
train
https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableManager.java#L224-L242
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java
SensitiveWordClient.updateSensitiveWord
public ResponseWrapper updateSensitiveWord(String newWord, String oldWord) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(newWord.length() <= 10, "one word's max length is 10"); Preconditions.checkArgument(oldWord.length() <= 10, "one word's max length is 10"); JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("new_word", newWord); jsonObject.addProperty("old_word", oldWord); return _httpClient.sendPut(_baseUrl + sensitiveWordPath, jsonObject.toString()); }
java
public ResponseWrapper updateSensitiveWord(String newWord, String oldWord) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(newWord.length() <= 10, "one word's max length is 10"); Preconditions.checkArgument(oldWord.length() <= 10, "one word's max length is 10"); JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("new_word", newWord); jsonObject.addProperty("old_word", oldWord); return _httpClient.sendPut(_baseUrl + sensitiveWordPath, jsonObject.toString()); }
[ "public", "ResponseWrapper", "updateSensitiveWord", "(", "String", "newWord", ",", "String", "oldWord", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "Preconditions", ".", "checkArgument", "(", "newWord", ".", "length", "(", ")", "<=", "1...
Update sensitive word @param newWord new word @param oldWord old word @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Update", "sensitive", "word" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/sensitiveword/SensitiveWordClient.java#L77-L85
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitReturn
@Override public R visitReturn(ReturnTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitReturn(ReturnTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitReturn", "(", "ReturnTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L321-L324
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecutionMetadata.java
AutomationExecutionMetadata.withTargetMaps
public AutomationExecutionMetadata withTargetMaps(java.util.Collection<java.util.Map<String, java.util.List<String>>> targetMaps) { setTargetMaps(targetMaps); return this; }
java
public AutomationExecutionMetadata withTargetMaps(java.util.Collection<java.util.Map<String, java.util.List<String>>> targetMaps) { setTargetMaps(targetMaps); return this; }
[ "public", "AutomationExecutionMetadata", "withTargetMaps", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", ">", "targetMaps", ")", "{", "set...
<p> The specified key-value mapping of document parameters to target resources. </p> @param targetMaps The specified key-value mapping of document parameters to target resources. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "specified", "key", "-", "value", "mapping", "of", "document", "parameters", "to", "target", "resources", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecutionMetadata.java#L995-L998
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java
DateTimeUtils.addMinutes
public static Calendar addMinutes(Calendar origin, int value) { Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.MINUTE, value); return sync(cal); }
java
public static Calendar addMinutes(Calendar origin, int value) { Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.MINUTE, value); return sync(cal); }
[ "public", "static", "Calendar", "addMinutes", "(", "Calendar", "origin", ",", "int", "value", ")", "{", "Calendar", "cal", "=", "sync", "(", "(", "Calendar", ")", "origin", ".", "clone", "(", ")", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "M...
Add/Subtract the specified amount of minutes to the given {@link Calendar}. <p> The returned {@link Calendar} has its fields synced. </p> @param origin @param value @return @since 0.9.2
[ "Add", "/", "Subtract", "the", "specified", "amount", "of", "minutes", "to", "the", "given", "{", "@link", "Calendar", "}", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java#L319-L323
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java
MoveOnEventHandler.init
public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { m_fldDest = fldDest; m_fldSource = fldSource; m_convCheckMark = convCheckMark; m_strSource = strSource; m_bMoveOnNew = bMoveOnNew; m_bMoveOnValid = bMoveOnValid; m_bMoveOnSelect = bMoveOnSelect; m_bMoveOnAdd = bMoveOnAdd; m_bMoveOnUpdate = bMoveOnUpdate; m_bDontMoveNullSource = bDontMoveNullSource; super.init(record); }
java
public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { m_fldDest = fldDest; m_fldSource = fldSource; m_convCheckMark = convCheckMark; m_strSource = strSource; m_bMoveOnNew = bMoveOnNew; m_bMoveOnValid = bMoveOnValid; m_bMoveOnSelect = bMoveOnSelect; m_bMoveOnAdd = bMoveOnAdd; m_bMoveOnUpdate = bMoveOnUpdate; m_bDontMoveNullSource = bDontMoveNullSource; super.init(record); }
[ "public", "void", "init", "(", "Record", "record", ",", "BaseField", "fldDest", ",", "BaseField", "fldSource", ",", "Converter", "convCheckMark", ",", "boolean", "bMoveOnNew", ",", "boolean", "bMoveOnValid", ",", "boolean", "bMoveOnSelect", ",", "boolean", "bMoveO...
Constructor. @param pfldDest tour.field.BaseField The destination field. @param fldSource The source field. @param pCheckMark If is field if false, don't move the data. @param bMoveOnNew If true, move on new also. @param bMoveOnValid If true, move on valid also.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java#L103-L116
kevinherron/opc-ua-stack
stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateValidationUtil.java
CertificateValidationUtil.validateHostnameOrIpAddress
public static void validateHostnameOrIpAddress(X509Certificate certificate, String hostname) throws UaException { boolean dnsNameMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_DNS_NAME, hostname::equals); boolean ipAddressMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_IP_ADDRESS, hostname::equals); if (!(dnsNameMatches || ipAddressMatches)) { throw new UaException(StatusCodes.Bad_CertificateHostNameInvalid); } }
java
public static void validateHostnameOrIpAddress(X509Certificate certificate, String hostname) throws UaException { boolean dnsNameMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_DNS_NAME, hostname::equals); boolean ipAddressMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_IP_ADDRESS, hostname::equals); if (!(dnsNameMatches || ipAddressMatches)) { throw new UaException(StatusCodes.Bad_CertificateHostNameInvalid); } }
[ "public", "static", "void", "validateHostnameOrIpAddress", "(", "X509Certificate", "certificate", ",", "String", "hostname", ")", "throws", "UaException", "{", "boolean", "dnsNameMatches", "=", "validateSubjectAltNameField", "(", "certificate", ",", "SUBJECT_ALT_NAME_DNS_NA...
Validate that the hostname used in the endpoint URL matches either the SubjectAltName DNSName or IPAddress in the given certificate. @param certificate the certificate to validate against. @param hostname the hostname used in the endpoint URL. @throws UaException if there is no matching DNSName or IPAddress entry.
[ "Validate", "that", "the", "hostname", "used", "in", "the", "endpoint", "URL", "matches", "either", "the", "SubjectAltName", "DNSName", "or", "IPAddress", "in", "the", "given", "certificate", "." ]
train
https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateValidationUtil.java#L111-L121
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/impl/AbstractKieServicesClientImpl.java
AbstractKieServicesClientImpl.makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse
protected <T> ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(String uri, Object body, Class<T> resultType, Map<String, String> headers) { logger.debug("About to send POST request to '{}' with payload '{}'", uri, body); KieServerHttpRequest request = newRequest( uri ).headers(headers).body(serialize( body )).post(); KieServerHttpResponse response = request.response(); owner.setConversationId(response.header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER)); if ( response.code() == Response.Status.OK.getStatusCode() ) { ServiceResponse serviceResponse = deserialize( response.body(), ServiceResponse.class ); // serialize it back to string to make it backward compatible serviceResponse.setResult(serialize(serviceResponse.getResult())); checkResultType(serviceResponse, resultType); return serviceResponse; } else { throw createExceptionForUnexpectedResponseCode( request, response ); } }
java
protected <T> ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(String uri, Object body, Class<T> resultType, Map<String, String> headers) { logger.debug("About to send POST request to '{}' with payload '{}'", uri, body); KieServerHttpRequest request = newRequest( uri ).headers(headers).body(serialize( body )).post(); KieServerHttpResponse response = request.response(); owner.setConversationId(response.header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER)); if ( response.code() == Response.Status.OK.getStatusCode() ) { ServiceResponse serviceResponse = deserialize( response.body(), ServiceResponse.class ); // serialize it back to string to make it backward compatible serviceResponse.setResult(serialize(serviceResponse.getResult())); checkResultType(serviceResponse, resultType); return serviceResponse; } else { throw createExceptionForUnexpectedResponseCode( request, response ); } }
[ "protected", "<", "T", ">", "ServiceResponse", "<", "T", ">", "makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse", "(", "String", "uri", ",", "Object", "body", ",", "Class", "<", "T", ">", "resultType", ",", "Map", "<", "String", ",", "String", ">", ...
/* override of the regular method to allow backward compatibility for string based result of ServiceResponse
[ "/", "*", "override", "of", "the", "regular", "method", "to", "allow", "backward", "compatibility", "for", "string", "based", "result", "of", "ServiceResponse" ]
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/impl/AbstractKieServicesClientImpl.java#L758-L774
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
DistributedQueue.flushPuts
@Override public boolean flushPuts(long waitTime, TimeUnit timeUnit) throws InterruptedException { long msWaitRemaining = TimeUnit.MILLISECONDS.convert(waitTime, timeUnit); synchronized(putCount) { while ( putCount.get() > 0 ) { if ( msWaitRemaining <= 0 ) { return false; } long startMs = System.currentTimeMillis(); putCount.wait(msWaitRemaining); long elapsedMs = System.currentTimeMillis() - startMs; msWaitRemaining -= elapsedMs; } } return true; }
java
@Override public boolean flushPuts(long waitTime, TimeUnit timeUnit) throws InterruptedException { long msWaitRemaining = TimeUnit.MILLISECONDS.convert(waitTime, timeUnit); synchronized(putCount) { while ( putCount.get() > 0 ) { if ( msWaitRemaining <= 0 ) { return false; } long startMs = System.currentTimeMillis(); putCount.wait(msWaitRemaining); long elapsedMs = System.currentTimeMillis() - startMs; msWaitRemaining -= elapsedMs; } } return true; }
[ "@", "Override", "public", "boolean", "flushPuts", "(", "long", "waitTime", ",", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", "{", "long", "msWaitRemaining", "=", "TimeUnit", ".", "MILLISECONDS", ".", "convert", "(", "waitTime", ",", "timeUnit", ...
Wait until any pending puts are committed @param waitTime max wait time @param timeUnit time unit @return true if the flush was successful, false if it timed out first @throws InterruptedException if thread was interrupted
[ "Wait", "until", "any", "pending", "puts", "are", "committed" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java#L268-L290
wkgcass/Style
src/main/java/net/cassite/style/SwitchBlock.java
SwitchBlock.Case
public SwitchBlock<T, R> Case(T ca, RFunc0<R> func) { return Case(ca, $(func)); }
java
public SwitchBlock<T, R> Case(T ca, RFunc0<R> func) { return Case(ca, $(func)); }
[ "public", "SwitchBlock", "<", "T", ",", "R", ">", "Case", "(", "T", "ca", ",", "RFunc0", "<", "R", ">", "func", ")", "{", "return", "Case", "(", "ca", ",", "$", "(", "func", ")", ")", ";", "}" ]
add a Case block to the expression @param ca the object for switch-expression to match @param func function to apply when matches and return a result for expression to return @return <code>this</code>
[ "add", "a", "Case", "block", "to", "the", "expression" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/SwitchBlock.java#L77-L79
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java
ArgUtils.notEmpty
public static void notEmpty(final String arg, final String name) { if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } if(arg.isEmpty()) { throw new IllegalArgumentException(String.format("%s should not be empty.", name)); } }
java
public static void notEmpty(final String arg, final String name) { if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } if(arg.isEmpty()) { throw new IllegalArgumentException(String.format("%s should not be empty.", name)); } }
[ "public", "static", "void", "notEmpty", "(", "final", "String", "arg", ",", "final", "String", "name", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "String", ".", "format", "(", "\"%s should not be null.\""...
文字列が空 or nullでないかどうか検証する。 @param arg 検証対象の値 @param name 検証対象の引数の名前 @throws NullPointerException {@literal arg == null} @throws IllegalArgumentException {@literal arg.isEmpty() == true}
[ "文字列が空", "or", "nullでないかどうか検証する。" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java#L34-L42
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java
JacksonUtils.getDate
public static Date getDate(JsonNode node, String dPath, String dateTimeFormat) { return DPathUtils.getDate(node, dPath, dateTimeFormat); }
java
public static Date getDate(JsonNode node, String dPath, String dateTimeFormat) { return DPathUtils.getDate(node, dPath, dateTimeFormat); }
[ "public", "static", "Date", "getDate", "(", "JsonNode", "node", ",", "String", "dPath", ",", "String", "dateTimeFormat", ")", "{", "return", "DPathUtils", ".", "getDate", "(", "node", ",", "dPath", ",", "dateTimeFormat", ")", ";", "}" ]
Extract a date value from the target {@link JsonNode} using DPath expression. If the extracted value is a string, parse it as a {@link Date} using the specified date-time format. @param node @param dPath @param dateTimeFormat see {@link SimpleDateFormat} @return @see DPathUtils
[ "Extract", "a", "date", "value", "from", "the", "target", "{", "@link", "JsonNode", "}", "using", "DPath", "expression", ".", "If", "the", "extracted", "value", "is", "a", "string", "parse", "it", "as", "a", "{", "@link", "Date", "}", "using", "the", "...
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L220-L222
Whiley/WhileyCompiler
src/main/java/wyil/type/binding/RelaxedTypeResolver.java
RelaxedTypeResolver.selectCallableCandidate
private Binding selectCallableCandidate(Name name, List<Binding> candidates, LifetimeRelation lifetimes) { Binding best = null; Type.Callable bestType = null; boolean bestValidWinner = false; // for (int i = 0; i != candidates.size(); ++i) { Binding candidate = candidates.get(i); Type.Callable candidateType = candidate.getConcreteType(); if (best == null) { // No other candidates are applicable so far. Hence, this // one is automatically promoted to the best seen so far. best = candidate; bestType = candidateType; bestValidWinner = true; } else { boolean csubb = isSubtype(bestType, candidateType, lifetimes); boolean bsubc = isSubtype(candidateType, bestType, lifetimes); // if (csubb && !bsubc) { // This candidate is a subtype of the best seen so far. Hence, it is now the // best seen so far. best = candidate; bestType = candidate.getConcreteType(); bestValidWinner = true; } else if (bsubc && !csubb) { // This best so far is a subtype of this candidate. Therefore, we can simply // discard this candidate from consideration since it's definitely not the best. } else if (!csubb && !bsubc) { // This is the awkward case. Neither the best so far, nor the candidate, are // subtypes of each other. In this case, we report an error. NOTE: must perform // an explicit equality check above due to the present of type invariants. // Specifically, without this check, the system will treat two declarations with // identical raw types (though non-identical actual types) as the same. return null; } else { // This is a tricky case. We have two types after instantiation which are // considered identical under the raw subtype test. As such, they may not be // actually identical (e.g. if one has a type invariant). Furthermore, we cannot // stop at this stage as, in principle, we could still find an outright winner. bestValidWinner = false; } } } return bestValidWinner ? best : null; }
java
private Binding selectCallableCandidate(Name name, List<Binding> candidates, LifetimeRelation lifetimes) { Binding best = null; Type.Callable bestType = null; boolean bestValidWinner = false; // for (int i = 0; i != candidates.size(); ++i) { Binding candidate = candidates.get(i); Type.Callable candidateType = candidate.getConcreteType(); if (best == null) { // No other candidates are applicable so far. Hence, this // one is automatically promoted to the best seen so far. best = candidate; bestType = candidateType; bestValidWinner = true; } else { boolean csubb = isSubtype(bestType, candidateType, lifetimes); boolean bsubc = isSubtype(candidateType, bestType, lifetimes); // if (csubb && !bsubc) { // This candidate is a subtype of the best seen so far. Hence, it is now the // best seen so far. best = candidate; bestType = candidate.getConcreteType(); bestValidWinner = true; } else if (bsubc && !csubb) { // This best so far is a subtype of this candidate. Therefore, we can simply // discard this candidate from consideration since it's definitely not the best. } else if (!csubb && !bsubc) { // This is the awkward case. Neither the best so far, nor the candidate, are // subtypes of each other. In this case, we report an error. NOTE: must perform // an explicit equality check above due to the present of type invariants. // Specifically, without this check, the system will treat two declarations with // identical raw types (though non-identical actual types) as the same. return null; } else { // This is a tricky case. We have two types after instantiation which are // considered identical under the raw subtype test. As such, they may not be // actually identical (e.g. if one has a type invariant). Furthermore, we cannot // stop at this stage as, in principle, we could still find an outright winner. bestValidWinner = false; } } } return bestValidWinner ? best : null; }
[ "private", "Binding", "selectCallableCandidate", "(", "Name", "name", ",", "List", "<", "Binding", ">", "candidates", ",", "LifetimeRelation", "lifetimes", ")", "{", "Binding", "best", "=", "null", ";", "Type", ".", "Callable", "bestType", "=", "null", ";", ...
Given a list of candidate function or method declarations, determine the most precise match for the supplied argument types. The given argument types must be applicable to this function or macro declaration, and it must be a subtype of all other applicable candidates. @param candidates @param args @return
[ "Given", "a", "list", "of", "candidate", "function", "or", "method", "declarations", "determine", "the", "most", "precise", "match", "for", "the", "supplied", "argument", "types", ".", "The", "given", "argument", "types", "must", "be", "applicable", "to", "thi...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/binding/RelaxedTypeResolver.java#L507-L551
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedPriorityQueue.java
DistributedPriorityQueue.putMulti
public void putMulti(MultiItem<T> items, int priority) throws Exception { putMulti(items, priority, 0, null); }
java
public void putMulti(MultiItem<T> items, int priority) throws Exception { putMulti(items, priority, 0, null); }
[ "public", "void", "putMulti", "(", "MultiItem", "<", "T", ">", "items", ",", "int", "priority", ")", "throws", "Exception", "{", "putMulti", "(", "items", ",", "priority", ",", "0", ",", "null", ")", ";", "}" ]
Add a set of items with the same priority into the queue. Adding is done in the background - thus, this method will return quickly.<br><br> NOTE: if an upper bound was set via {@link QueueBuilder#maxItems}, this method will block until there is available space in the queue. @param items items to add @param priority item priority - lower numbers come out of the queue first @throws Exception connection issues
[ "Add", "a", "set", "of", "items", "with", "the", "same", "priority", "into", "the", "queue", ".", "Adding", "is", "done", "in", "the", "background", "-", "thus", "this", "method", "will", "return", "quickly", ".", "<br", ">", "<br", ">", "NOTE", ":", ...
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedPriorityQueue.java#L137-L140
groovy/groovy-core
subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java
JsonOutput.writeCharSequence
private static void writeCharSequence(CharSequence seq, CharBuf buffer) { if (seq.length() > 0) { buffer.addJsonEscapedString(seq.toString()); } else { buffer.addChars(EMPTY_STRING_CHARS); } }
java
private static void writeCharSequence(CharSequence seq, CharBuf buffer) { if (seq.length() > 0) { buffer.addJsonEscapedString(seq.toString()); } else { buffer.addChars(EMPTY_STRING_CHARS); } }
[ "private", "static", "void", "writeCharSequence", "(", "CharSequence", "seq", ",", "CharBuf", "buffer", ")", "{", "if", "(", "seq", ".", "length", "(", ")", ">", "0", ")", "{", "buffer", ".", "addJsonEscapedString", "(", "seq", ".", "toString", "(", ")",...
Serializes any char sequence and writes it into specified buffer.
[ "Serializes", "any", "char", "sequence", "and", "writes", "it", "into", "specified", "buffer", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonOutput.java#L304-L310
stripe/stripe-android
stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.java
CardMultilineWidget.getCard
@Nullable public Card getCard() { if (validateAllFields()) { String cardNumber = mCardNumberEditText.getCardNumber(); int[] cardDate = mExpiryDateEditText.getValidDateFields(); String cvcValue = mCvcEditText.getText().toString(); Card card = new Card(cardNumber, cardDate[0], cardDate[1], cvcValue); if (mShouldShowPostalCode) { card.setAddressZip(mPostalCodeEditText.getText().toString()); } return card.addLoggingToken(CARD_MULTILINE_TOKEN); } return null; }
java
@Nullable public Card getCard() { if (validateAllFields()) { String cardNumber = mCardNumberEditText.getCardNumber(); int[] cardDate = mExpiryDateEditText.getValidDateFields(); String cvcValue = mCvcEditText.getText().toString(); Card card = new Card(cardNumber, cardDate[0], cardDate[1], cvcValue); if (mShouldShowPostalCode) { card.setAddressZip(mPostalCodeEditText.getText().toString()); } return card.addLoggingToken(CARD_MULTILINE_TOKEN); } return null; }
[ "@", "Nullable", "public", "Card", "getCard", "(", ")", "{", "if", "(", "validateAllFields", "(", ")", ")", "{", "String", "cardNumber", "=", "mCardNumberEditText", ".", "getCardNumber", "(", ")", ";", "int", "[", "]", "cardDate", "=", "mExpiryDateEditText",...
Gets a {@link Card} object from the user input, if all fields are valid. If not, returns {@code null}. @return a valid {@link Card} object based on user input, or {@code null} if any field is invalid
[ "Gets", "a", "{", "@link", "Card", "}", "object", "from", "the", "user", "input", "if", "all", "fields", "are", "valid", ".", "If", "not", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/CardMultilineWidget.java#L121-L136
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.getAt
public static CharSequence getAt(CharSequence text, IntRange range) { return getAt(text, (Range) range); }
java
public static CharSequence getAt(CharSequence text, IntRange range) { return getAt(text, (Range) range); }
[ "public", "static", "CharSequence", "getAt", "(", "CharSequence", "text", ",", "IntRange", "range", ")", "{", "return", "getAt", "(", "text", ",", "(", "Range", ")", "range", ")", ";", "}" ]
Support the range subscript operator for CharSequence with IntRange @param text a CharSequence @param range an IntRange @return the subsequence CharSequence @since 1.0
[ "Support", "the", "range", "subscript", "operator", "for", "CharSequence", "with", "IntRange" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1265-L1267
redfish4ktc/maven-soapui-extension-plugin
src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIExtensionMockAsWarGenerator.java
SoapUIExtensionMockAsWarGenerator.runRunner
@Override protected boolean runRunner() throws Exception { WsdlProject project = (WsdlProject) ProjectFactoryRegistry.getProjectFactory("wsdl").createNew( getProjectFile(), getProjectPassword()); String pFile = getProjectFile(); project.getSettings().setString(ProjectSettings.SHADOW_PASSWORD, null); File tmpProjectFile = new File(System.getProperty("java.io.tmpdir")); tmpProjectFile = new File(tmpProjectFile, project.getName() + "-project.xml"); project.beforeSave(); project.saveIn(tmpProjectFile); pFile = tmpProjectFile.getAbsolutePath(); String endpoint = (StringUtils.hasContent(this.getLocalEndpoint())) ? this.getLocalEndpoint() : project .getName(); this.log.info("Creating WAR file with endpoint [" + endpoint + "]"); // TODO the temporary file should be removed at the end of the process MockAsWarExtension mockAsWar = new MockAsWarExtension(pFile, getSettingsFile(), getOutputFolder(), this.getWarFile(), this.isIncludeLibraries(), this.isIncludeActions(), this.isIncludeListeners(), endpoint, this.isEnableWebUI()); mockAsWar.createMockAsWarArchive(); this.log.info("WAR Generation complete"); return true; }
java
@Override protected boolean runRunner() throws Exception { WsdlProject project = (WsdlProject) ProjectFactoryRegistry.getProjectFactory("wsdl").createNew( getProjectFile(), getProjectPassword()); String pFile = getProjectFile(); project.getSettings().setString(ProjectSettings.SHADOW_PASSWORD, null); File tmpProjectFile = new File(System.getProperty("java.io.tmpdir")); tmpProjectFile = new File(tmpProjectFile, project.getName() + "-project.xml"); project.beforeSave(); project.saveIn(tmpProjectFile); pFile = tmpProjectFile.getAbsolutePath(); String endpoint = (StringUtils.hasContent(this.getLocalEndpoint())) ? this.getLocalEndpoint() : project .getName(); this.log.info("Creating WAR file with endpoint [" + endpoint + "]"); // TODO the temporary file should be removed at the end of the process MockAsWarExtension mockAsWar = new MockAsWarExtension(pFile, getSettingsFile(), getOutputFolder(), this.getWarFile(), this.isIncludeLibraries(), this.isIncludeActions(), this.isIncludeListeners(), endpoint, this.isEnableWebUI()); mockAsWar.createMockAsWarArchive(); this.log.info("WAR Generation complete"); return true; }
[ "@", "Override", "protected", "boolean", "runRunner", "(", ")", "throws", "Exception", "{", "WsdlProject", "project", "=", "(", "WsdlProject", ")", "ProjectFactoryRegistry", ".", "getProjectFactory", "(", "\"wsdl\"", ")", ".", "createNew", "(", "getProjectFile", "...
we should provide a PR to let us inject implementation of the MockAsWar
[ "we", "should", "provide", "a", "PR", "to", "let", "us", "inject", "implementation", "of", "the", "MockAsWar" ]
train
https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/556f0e6b2bd1db82feae0e3523a1eb0873fafebd/src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIExtensionMockAsWarGenerator.java#L40-L70
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.clearEvidence
public static void clearEvidence(ProbabilisticNetwork bn, String nodeName) throws ShanksException { ProbabilisticNode node = (ProbabilisticNode) bn.getNode(nodeName); ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node); }
java
public static void clearEvidence(ProbabilisticNetwork bn, String nodeName) throws ShanksException { ProbabilisticNode node = (ProbabilisticNode) bn.getNode(nodeName); ShanksAgentBayesianReasoningCapability.clearEvidence(bn, node); }
[ "public", "static", "void", "clearEvidence", "(", "ProbabilisticNetwork", "bn", ",", "String", "nodeName", ")", "throws", "ShanksException", "{", "ProbabilisticNode", "node", "=", "(", "ProbabilisticNode", ")", "bn", ".", "getNode", "(", "nodeName", ")", ";", "S...
Clear a hard evidence fixed in a given node /** @param bn @param nodeName @throws ShanksException
[ "Clear", "a", "hard", "evidence", "fixed", "in", "a", "given", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java#L327-L331
phax/ph-css
ph-css/src/main/java/com/helger/css/utils/CSSDataURL.java
CSSDataURL.getContentAsString
@Nonnull public String getContentAsString (@Nonnull final Charset aCharset) { if (m_aCharset.equals (aCharset)) { // Potentially return cached version return getContentAsString (); } return new String (m_aContent, aCharset); }
java
@Nonnull public String getContentAsString (@Nonnull final Charset aCharset) { if (m_aCharset.equals (aCharset)) { // Potentially return cached version return getContentAsString (); } return new String (m_aContent, aCharset); }
[ "@", "Nonnull", "public", "String", "getContentAsString", "(", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "if", "(", "m_aCharset", ".", "equals", "(", "aCharset", ")", ")", "{", "// Potentially return cached version", "return", "getContentAsString", ...
Get the data content of this Data URL as String in the specified charset. No Base64 encoding is performed in this method. @param aCharset The charset to be used. May not be <code>null</code>. @return The content in a String representation using the provided charset. Never <code>null</code>.
[ "Get", "the", "data", "content", "of", "this", "Data", "URL", "as", "String", "in", "the", "specified", "charset", ".", "No", "Base64", "encoding", "is", "performed", "in", "this", "method", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSDataURL.java#L304-L313
springfox/springfox
springfox-spring-webmvc/src/main/java/springfox/documentation/spring/web/WebMvcPropertySourcedRequestMappingHandlerMapping.java
WebMvcPropertySourcedRequestMappingHandlerMapping.lookupHandlerMethod
@Override protected HandlerMethod lookupHandlerMethod(String urlPath, HttpServletRequest request) { logger.debug("looking up handler for path: " + urlPath); HandlerMethod handlerMethod = handlerMethods.get(urlPath); if (handlerMethod != null) { return handlerMethod; } for (String path : handlerMethods.keySet()) { UriTemplate template = new UriTemplate(path); if (template.matches(urlPath)) { request.setAttribute( HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, template.match(urlPath)); return handlerMethods.get(path); } } return null; }
java
@Override protected HandlerMethod lookupHandlerMethod(String urlPath, HttpServletRequest request) { logger.debug("looking up handler for path: " + urlPath); HandlerMethod handlerMethod = handlerMethods.get(urlPath); if (handlerMethod != null) { return handlerMethod; } for (String path : handlerMethods.keySet()) { UriTemplate template = new UriTemplate(path); if (template.matches(urlPath)) { request.setAttribute( HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, template.match(urlPath)); return handlerMethods.get(path); } } return null; }
[ "@", "Override", "protected", "HandlerMethod", "lookupHandlerMethod", "(", "String", "urlPath", ",", "HttpServletRequest", "request", ")", "{", "logger", ".", "debug", "(", "\"looking up handler for path: \"", "+", "urlPath", ")", ";", "HandlerMethod", "handlerMethod", ...
The lookup handler method, maps the SEOMapper method to the request URL. <p>If no mapping is found, or if the URL is disabled, it will simply drop through to the standard 404 handling.</p> @param urlPath the path to match. @param request the http servlet request. @return The HandlerMethod if one was found.
[ "The", "lookup", "handler", "method", "maps", "the", "SEOMapper", "method", "to", "the", "request", "URL", ".", "<p", ">", "If", "no", "mapping", "is", "found", "or", "if", "the", "URL", "is", "disabled", "it", "will", "simply", "drop", "through", "to", ...
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-spring-webmvc/src/main/java/springfox/documentation/spring/web/WebMvcPropertySourcedRequestMappingHandlerMapping.java#L101-L118
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java
NIOFileUtil.mergeInto
static void mergeInto(List<Path> parts, OutputStream out) throws IOException { for (final Path part : parts) { Files.copy(part, out); Files.delete(part); } }
java
static void mergeInto(List<Path> parts, OutputStream out) throws IOException { for (final Path part : parts) { Files.copy(part, out); Files.delete(part); } }
[ "static", "void", "mergeInto", "(", "List", "<", "Path", ">", "parts", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "for", "(", "final", "Path", "part", ":", "parts", ")", "{", "Files", ".", "copy", "(", "part", ",", "out", ")", ";"...
Merge the given part files in order into an output stream. This deletes the parts. @param parts the part files to merge @param out the stream to write each file into, in order @throws IOException
[ "Merge", "the", "given", "part", "files", "in", "order", "into", "an", "output", "stream", ".", "This", "deletes", "the", "parts", "." ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java#L106-L112
stratosphere/stratosphere
stratosphere-clients/src/main/java/eu/stratosphere/client/CliFrontend.java
CliFrontend.buildProgram
protected PackagedProgram buildProgram(CommandLine line) { String[] programArgs = line.hasOption(ARGS_OPTION.getOpt()) ? line.getOptionValues(ARGS_OPTION.getOpt()) : line.getArgs(); // take the jar file from the option, or as the first trailing parameter (if available) String jarFilePath = null; if (line.hasOption(JAR_OPTION.getOpt())) { jarFilePath = line.getOptionValue(JAR_OPTION.getOpt()); } else if (programArgs.length > 0) { jarFilePath = programArgs[0]; programArgs = Arrays.copyOfRange(programArgs, 1, programArgs.length); } else { System.out.println("Error: Jar file is not set."); return null; } File jarFile = new File(jarFilePath); // Check if JAR file exists if (!jarFile.exists()) { System.out.println("Error: Jar file does not exist."); return null; } else if (!jarFile.isFile()) { System.out.println("Error: Jar file is not a file."); return null; } // Get assembler class String entryPointClass = line.hasOption(CLASS_OPTION.getOpt()) ? line.getOptionValue(CLASS_OPTION.getOpt()) : null; try { return entryPointClass == null ? new PackagedProgram(jarFile, programArgs) : new PackagedProgram(jarFile, entryPointClass, programArgs); } catch (ProgramInvocationException e) { handleError(e); return null; } }
java
protected PackagedProgram buildProgram(CommandLine line) { String[] programArgs = line.hasOption(ARGS_OPTION.getOpt()) ? line.getOptionValues(ARGS_OPTION.getOpt()) : line.getArgs(); // take the jar file from the option, or as the first trailing parameter (if available) String jarFilePath = null; if (line.hasOption(JAR_OPTION.getOpt())) { jarFilePath = line.getOptionValue(JAR_OPTION.getOpt()); } else if (programArgs.length > 0) { jarFilePath = programArgs[0]; programArgs = Arrays.copyOfRange(programArgs, 1, programArgs.length); } else { System.out.println("Error: Jar file is not set."); return null; } File jarFile = new File(jarFilePath); // Check if JAR file exists if (!jarFile.exists()) { System.out.println("Error: Jar file does not exist."); return null; } else if (!jarFile.isFile()) { System.out.println("Error: Jar file is not a file."); return null; } // Get assembler class String entryPointClass = line.hasOption(CLASS_OPTION.getOpt()) ? line.getOptionValue(CLASS_OPTION.getOpt()) : null; try { return entryPointClass == null ? new PackagedProgram(jarFile, programArgs) : new PackagedProgram(jarFile, entryPointClass, programArgs); } catch (ProgramInvocationException e) { handleError(e); return null; } }
[ "protected", "PackagedProgram", "buildProgram", "(", "CommandLine", "line", ")", "{", "String", "[", "]", "programArgs", "=", "line", ".", "hasOption", "(", "ARGS_OPTION", ".", "getOpt", "(", ")", ")", "?", "line", ".", "getOptionValues", "(", "ARGS_OPTION", ...
@param line @return Either a PackagedProgram (upon success), or null;
[ "@param", "line" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-clients/src/main/java/eu/stratosphere/client/CliFrontend.java#L660-L704
r0adkll/PostOffice
library/src/main/java/com/r0adkll/postoffice/styles/EditTextStyle.java
EditTextStyle.onButtonClicked
@Override public void onButtonClicked(int which, DialogInterface dialogInterface) { switch (which){ case Dialog.BUTTON_POSITIVE: if(mListener != null) mListener.onAccepted(getText()); break; case Dialog.BUTTON_NEGATIVE: // Do nothing for the negative click break; } }
java
@Override public void onButtonClicked(int which, DialogInterface dialogInterface) { switch (which){ case Dialog.BUTTON_POSITIVE: if(mListener != null) mListener.onAccepted(getText()); break; case Dialog.BUTTON_NEGATIVE: // Do nothing for the negative click break; } }
[ "@", "Override", "public", "void", "onButtonClicked", "(", "int", "which", ",", "DialogInterface", "dialogInterface", ")", "{", "switch", "(", "which", ")", "{", "case", "Dialog", ".", "BUTTON_POSITIVE", ":", "if", "(", "mListener", "!=", "null", ")", "mList...
Called when one of the three available buttons are clicked so that this style can perform a special action such as calling a content delivery callback. @param which which button was pressed @param dialogInterface
[ "Called", "when", "one", "of", "the", "three", "available", "buttons", "are", "clicked", "so", "that", "this", "style", "can", "perform", "a", "special", "action", "such", "as", "calling", "a", "content", "delivery", "callback", "." ]
train
https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/styles/EditTextStyle.java#L92-L102
reactor/reactor-netty
src/main/java/reactor/netty/udp/UdpServer.java
UdpServer.doOnUnbound
public final UdpServer doOnUnbound(Consumer<? super Connection> doOnUnbound) { Objects.requireNonNull(doOnUnbound, "doOnUnbound"); return new UdpServerDoOn(this, null, null, doOnUnbound); }
java
public final UdpServer doOnUnbound(Consumer<? super Connection> doOnUnbound) { Objects.requireNonNull(doOnUnbound, "doOnUnbound"); return new UdpServerDoOn(this, null, null, doOnUnbound); }
[ "public", "final", "UdpServer", "doOnUnbound", "(", "Consumer", "<", "?", "super", "Connection", ">", "doOnUnbound", ")", "{", "Objects", ".", "requireNonNull", "(", "doOnUnbound", ",", "\"doOnUnbound\"", ")", ";", "return", "new", "UdpServerDoOn", "(", "this", ...
Setup a callback called when {@link io.netty.channel.Channel} is unbound. @param doOnUnbound a consumer observing server stop event @return a new {@link UdpServer}
[ "Setup", "a", "callback", "called", "when", "{", "@link", "io", ".", "netty", ".", "channel", ".", "Channel", "}", "is", "unbound", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/udp/UdpServer.java#L207-L210
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/image.java
image.getBitmapByImageURL
public static void getBitmapByImageURL(String imageURL, final OnEventListener callback) { new DownloadImageTask<Bitmap>(imageURL, new OnEventListener<Bitmap>() { @Override public void onSuccess(Bitmap bitmap) { callback.onSuccess(bitmap); } @Override public void onFailure(Exception e) { callback.onFailure(e); } }).execute(); }
java
public static void getBitmapByImageURL(String imageURL, final OnEventListener callback) { new DownloadImageTask<Bitmap>(imageURL, new OnEventListener<Bitmap>() { @Override public void onSuccess(Bitmap bitmap) { callback.onSuccess(bitmap); } @Override public void onFailure(Exception e) { callback.onFailure(e); } }).execute(); }
[ "public", "static", "void", "getBitmapByImageURL", "(", "String", "imageURL", ",", "final", "OnEventListener", "callback", ")", "{", "new", "DownloadImageTask", "<", "Bitmap", ">", "(", "imageURL", ",", "new", "OnEventListener", "<", "Bitmap", ">", "(", ")", "...
Get a bitmap by a given URL @param imageURL given URL @param callback callback
[ "Get", "a", "bitmap", "by", "a", "given", "URL" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/image.java#L77-L92
bmwcarit/joynr
java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java
LongPollingMessagingDelegate.createChannel
public String createChannel(String ccid, String atmosphereTrackingId) { throwExceptionIfTrackingIdnotSet(atmosphereTrackingId); log.info("CREATE channel for cluster controller: {} trackingId: {} ", ccid, atmosphereTrackingId); Broadcaster broadcaster = null; // look for an existing broadcaster BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory.getDefault(); if (defaultBroadcasterFactory == null) { throw new JoynrHttpException(500, 10009, "broadcaster was null"); } broadcaster = defaultBroadcasterFactory.lookup(Broadcaster.class, ccid, false); // create a new one if none already exists if (broadcaster == null) { broadcaster = defaultBroadcasterFactory.get(BounceProxyBroadcaster.class, ccid); } // avoids error where previous long poll from browser got message // destined for new long poll // especially as seen in js, where every second refresh caused a fail for (AtmosphereResource resource : broadcaster.getAtmosphereResources()) { if (resource.uuid() != null && resource.uuid().equals(atmosphereTrackingId)) { resource.resume(); } } UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) broadcaster.getBroadcasterConfig() .getBroadcasterCache(); broadcasterCache.activeClients().put(atmosphereTrackingId, System.currentTimeMillis()); // BroadcasterCacheInspector is not implemented corrected in Atmosphere // 1.1.0RC4 // broadcasterCache.inspector(new MessageExpirationInspector()); return "/channels/" + ccid + "/"; }
java
public String createChannel(String ccid, String atmosphereTrackingId) { throwExceptionIfTrackingIdnotSet(atmosphereTrackingId); log.info("CREATE channel for cluster controller: {} trackingId: {} ", ccid, atmosphereTrackingId); Broadcaster broadcaster = null; // look for an existing broadcaster BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory.getDefault(); if (defaultBroadcasterFactory == null) { throw new JoynrHttpException(500, 10009, "broadcaster was null"); } broadcaster = defaultBroadcasterFactory.lookup(Broadcaster.class, ccid, false); // create a new one if none already exists if (broadcaster == null) { broadcaster = defaultBroadcasterFactory.get(BounceProxyBroadcaster.class, ccid); } // avoids error where previous long poll from browser got message // destined for new long poll // especially as seen in js, where every second refresh caused a fail for (AtmosphereResource resource : broadcaster.getAtmosphereResources()) { if (resource.uuid() != null && resource.uuid().equals(atmosphereTrackingId)) { resource.resume(); } } UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) broadcaster.getBroadcasterConfig() .getBroadcasterCache(); broadcasterCache.activeClients().put(atmosphereTrackingId, System.currentTimeMillis()); // BroadcasterCacheInspector is not implemented corrected in Atmosphere // 1.1.0RC4 // broadcasterCache.inspector(new MessageExpirationInspector()); return "/channels/" + ccid + "/"; }
[ "public", "String", "createChannel", "(", "String", "ccid", ",", "String", "atmosphereTrackingId", ")", "{", "throwExceptionIfTrackingIdnotSet", "(", "atmosphereTrackingId", ")", ";", "log", ".", "info", "(", "\"CREATE channel for cluster controller: {} trackingId: {} \"", ...
Creates a long polling channel. @param ccid the identifier of the channel @param atmosphereTrackingId the tracking ID of the channel @return the path segment for the channel. The path, appended to the base URI of the channel service, can be used to post messages to the channel.
[ "Creates", "a", "long", "polling", "channel", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L95-L133
Devskiller/jfairy
src/main/java/com/devskiller/jfairy/Bootstrap.java
Bootstrap.getFairyModuleForLocale
private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) { LanguageCode code; try { code = LanguageCode.valueOf(locale.getLanguage().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Uknown locale " + locale); code = LanguageCode.EN; } switch (code) { case PL: return new PlFairyModule(dataMaster, randomGenerator); case EN: return new EnFairyModule(dataMaster, randomGenerator); case ES: return new EsFairyModule(dataMaster, randomGenerator); case FR: return new EsFairyModule(dataMaster, randomGenerator); case SV: return new SvFairyModule(dataMaster, randomGenerator); case ZH: return new ZhFairyModule(dataMaster, randomGenerator); case DE: return new DeFairyModule(dataMaster, randomGenerator); case KA: return new KaFairyModule(dataMaster, randomGenerator); default: LOG.info("No data for your language - using EN"); return new EnFairyModule(dataMaster, randomGenerator); } }
java
private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) { LanguageCode code; try { code = LanguageCode.valueOf(locale.getLanguage().toUpperCase()); } catch (IllegalArgumentException e) { LOG.warn("Uknown locale " + locale); code = LanguageCode.EN; } switch (code) { case PL: return new PlFairyModule(dataMaster, randomGenerator); case EN: return new EnFairyModule(dataMaster, randomGenerator); case ES: return new EsFairyModule(dataMaster, randomGenerator); case FR: return new EsFairyModule(dataMaster, randomGenerator); case SV: return new SvFairyModule(dataMaster, randomGenerator); case ZH: return new ZhFairyModule(dataMaster, randomGenerator); case DE: return new DeFairyModule(dataMaster, randomGenerator); case KA: return new KaFairyModule(dataMaster, randomGenerator); default: LOG.info("No data for your language - using EN"); return new EnFairyModule(dataMaster, randomGenerator); } }
[ "private", "static", "FairyModule", "getFairyModuleForLocale", "(", "DataMaster", "dataMaster", ",", "Locale", "locale", ",", "RandomGenerator", "randomGenerator", ")", "{", "LanguageCode", "code", ";", "try", "{", "code", "=", "LanguageCode", ".", "valueOf", "(", ...
Support customized language config @param dataMaster master of the config @param locale The Locale to set. @param randomGenerator specific random generator @return FariyModule instance in accordance with locale
[ "Support", "customized", "language", "config" ]
train
https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/Bootstrap.java#L121-L152
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java
PersistenceController.updateStoreWithNewMessage
public Observable<Boolean> updateStoreWithNewMessage(final ChatMessage message, final ChatController.NoConversationListener noConversationListener) { return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { boolean isSuccessful = true; store.beginTransaction(); ChatConversationBase conversation = store.getConversation(message.getConversationId()); String tempId = (String) (message.getMetadata() != null ? message.getMetadata().get(MESSAGE_METADATA_TEMP_ID) : null); if (!TextUtils.isEmpty(tempId)) { store.deleteMessage(message.getConversationId(), tempId); } if (message.getSentEventId() == null) { message.setSentEventId(-1L); } if (message.getSentEventId() == -1L) { if (conversation != null && conversation.getLastLocalEventId() != -1L) { message.setSentEventId(conversation.getLastLocalEventId() + 1); } message.addStatusUpdate(ChatMessageStatus.builder().populate(message.getConversationId(), message.getMessageId(), message.getFromWhom().getId(), LocalMessageStatus.sent, System.currentTimeMillis(), null).build()); isSuccessful = store.upsert(message); } else { isSuccessful = store.upsert(message); } if (!doUpdateConversationFromEvent(store, message.getConversationId(), message.getSentEventId(), message.getSentOn()) && noConversationListener != null) { noConversationListener.getConversation(message.getConversationId()); } store.endTransaction(); emitter.onNext(isSuccessful); emitter.onCompleted(); } }); }
java
public Observable<Boolean> updateStoreWithNewMessage(final ChatMessage message, final ChatController.NoConversationListener noConversationListener) { return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { boolean isSuccessful = true; store.beginTransaction(); ChatConversationBase conversation = store.getConversation(message.getConversationId()); String tempId = (String) (message.getMetadata() != null ? message.getMetadata().get(MESSAGE_METADATA_TEMP_ID) : null); if (!TextUtils.isEmpty(tempId)) { store.deleteMessage(message.getConversationId(), tempId); } if (message.getSentEventId() == null) { message.setSentEventId(-1L); } if (message.getSentEventId() == -1L) { if (conversation != null && conversation.getLastLocalEventId() != -1L) { message.setSentEventId(conversation.getLastLocalEventId() + 1); } message.addStatusUpdate(ChatMessageStatus.builder().populate(message.getConversationId(), message.getMessageId(), message.getFromWhom().getId(), LocalMessageStatus.sent, System.currentTimeMillis(), null).build()); isSuccessful = store.upsert(message); } else { isSuccessful = store.upsert(message); } if (!doUpdateConversationFromEvent(store, message.getConversationId(), message.getSentEventId(), message.getSentOn()) && noConversationListener != null) { noConversationListener.getConversation(message.getConversationId()); } store.endTransaction(); emitter.onNext(isSuccessful); emitter.onCompleted(); } }); }
[ "public", "Observable", "<", "Boolean", ">", "updateStoreWithNewMessage", "(", "final", "ChatMessage", "message", ",", "final", "ChatController", ".", "NoConversationListener", "noConversationListener", ")", "{", "return", "asObservable", "(", "new", "Executor", "<", ...
Deletes temporary message and inserts provided one. If no associated conversation exists will trigger GET from server. @param message Message to save. @param noConversationListener Listener for the chat controller to get conversation if no local copy is present. @return Observable emitting result.
[ "Deletes", "temporary", "message", "and", "inserts", "provided", "one", ".", "If", "no", "associated", "conversation", "exists", "will", "trigger", "GET", "from", "server", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java#L254-L295
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/SqlExecutor.java
SqlExecutor.getSingleResult
public <T> T getSingleResult(Class<T> clazz, String sql, Object[] params) { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = connectionProvider.getConnection().prepareStatement(sql); setParameters(stmt, params); if (logger.isDebugEnabled()) { printSql(sql); printParameters(params); } rs = stmt.executeQuery(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); if(rs.next()){ T entity = entityOperator.createEntity(clazz, rs, meta, columnCount, beanDesc, dialect, valueTypes, nameConverter); return entity; } return null; } catch (SQLException ex) { throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
java
public <T> T getSingleResult(Class<T> clazz, String sql, Object[] params) { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = connectionProvider.getConnection().prepareStatement(sql); setParameters(stmt, params); if (logger.isDebugEnabled()) { printSql(sql); printParameters(params); } rs = stmt.executeQuery(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); if(rs.next()){ T entity = entityOperator.createEntity(clazz, rs, meta, columnCount, beanDesc, dialect, valueTypes, nameConverter); return entity; } return null; } catch (SQLException ex) { throw new SQLRuntimeException(ex); } finally { JdbcUtil.close(rs); JdbcUtil.close(stmt); } }
[ "public", "<", "T", ">", "T", "getSingleResult", "(", "Class", "<", "T", ">", "clazz", ",", "String", "sql", ",", "Object", "[", "]", "params", ")", "{", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", ...
Returns a single entity from the first row of an SQL. @param <T> the entity type @param clazz the class of the entity @param sql the SQL to execute @param params the parameters to execute the SQL @return the entity from the result set. @throws SQLRuntimeException if a database access error occurs
[ "Returns", "a", "single", "entity", "from", "the", "first", "row", "of", "an", "SQL", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L228-L261
apache/incubator-atlas
common/src/main/java/org/apache/atlas/utils/ParamChecker.java
ParamChecker.notEmptyIfNotNull
public static String notEmptyIfNotNull(String value, String name, String info) { if (value == null) { return value; } if (value.trim().length() == 0) { throw new IllegalArgumentException(name + " cannot be empty" + (info == null ? "" : ", " + info)); } return value.trim(); }
java
public static String notEmptyIfNotNull(String value, String name, String info) { if (value == null) { return value; } if (value.trim().length() == 0) { throw new IllegalArgumentException(name + " cannot be empty" + (info == null ? "" : ", " + info)); } return value.trim(); }
[ "public", "static", "String", "notEmptyIfNotNull", "(", "String", "value", ",", "String", "name", ",", "String", "info", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "value", ";", "}", "if", "(", "value", ".", "trim", "(", ")", "."...
Check that a string is not empty if its not null. @param value value. @param name parameter name for the exception message. @return the given value.
[ "Check", "that", "a", "string", "is", "not", "empty", "if", "its", "not", "null", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/common/src/main/java/org/apache/atlas/utils/ParamChecker.java#L115-L124
real-logic/agrona
agrona/src/main/java/org/agrona/IoUtil.java
IoUtil.mapExistingFile
public static MappedByteBuffer mapExistingFile( final File location, final String descriptionLabel, final long offset, final long length) { return mapExistingFile(location, READ_WRITE, descriptionLabel, offset, length); }
java
public static MappedByteBuffer mapExistingFile( final File location, final String descriptionLabel, final long offset, final long length) { return mapExistingFile(location, READ_WRITE, descriptionLabel, offset, length); }
[ "public", "static", "MappedByteBuffer", "mapExistingFile", "(", "final", "File", "location", ",", "final", "String", "descriptionLabel", ",", "final", "long", "offset", ",", "final", "long", "length", ")", "{", "return", "mapExistingFile", "(", "location", ",", ...
Check that file exists, open file, and return MappedByteBuffer for only region specified as {@link java.nio.channels.FileChannel.MapMode#READ_WRITE}. <p> The file itself will be closed, but the mapping will persist. @param location of the file to map @param descriptionLabel to be associated for an exceptions @param offset offset to start mapping at @param length length to map region @return {@link java.nio.MappedByteBuffer} for the file
[ "Check", "that", "file", "exists", "open", "file", "and", "return", "MappedByteBuffer", "for", "only", "region", "specified", "as", "{", "@link", "java", ".", "nio", ".", "channels", ".", "FileChannel", ".", "MapMode#READ_WRITE", "}", ".", "<p", ">", "The", ...
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/IoUtil.java#L297-L301