repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
jboss/jboss-jstl-api_spec
src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java
JstlBaseTLV.configure
private void configure(String info) { // construct our configuration map config = new HashMap(); // leave the map empty if we have nothing to configure if (info == null) { return; } // separate parameter into space-separated tokens and store them StringTokenizer st = new StringTokenizer(info); while (st.hasMoreTokens()) { String pair = st.nextToken(); StringTokenizer pairTokens = new StringTokenizer(pair, ":"); String element = pairTokens.nextToken(); String attribute = pairTokens.nextToken(); Object atts = config.get(element); if (atts == null) { atts = new HashSet(); config.put(element, atts); } ((Set) atts).add(attribute); } }
java
private void configure(String info) { // construct our configuration map config = new HashMap(); // leave the map empty if we have nothing to configure if (info == null) { return; } // separate parameter into space-separated tokens and store them StringTokenizer st = new StringTokenizer(info); while (st.hasMoreTokens()) { String pair = st.nextToken(); StringTokenizer pairTokens = new StringTokenizer(pair, ":"); String element = pairTokens.nextToken(); String attribute = pairTokens.nextToken(); Object atts = config.get(element); if (atts == null) { atts = new HashSet(); config.put(element, atts); } ((Set) atts).add(attribute); } }
[ "private", "void", "configure", "(", "String", "info", ")", "{", "// construct our configuration map", "config", "=", "new", "HashMap", "(", ")", ";", "// leave the map empty if we have nothing to configure", "if", "(", "info", "==", "null", ")", "{", "return", ";",...
parses our configuration parameter for element:attribute pairs
[ "parses", "our", "configuration", "parameter", "for", "element", ":", "attribute", "pairs" ]
train
https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java#L310-L333
apache/incubator-druid
services/src/main/java/org/apache/druid/cli/PullDependencies.java
PullDependencies.createExtensionDirectory
private void createExtensionDirectory(String coordinate, File atLocation) { if (atLocation.isDirectory()) { log.info("Directory [%s] already exists, skipping creating a directory", atLocation.getAbsolutePath()); return; } if (!atLocation.mkdir()) { throw new ISE( "Unable to create directory at [%s] for coordinate [%s]", atLocation.getAbsolutePath(), coordinate ); } }
java
private void createExtensionDirectory(String coordinate, File atLocation) { if (atLocation.isDirectory()) { log.info("Directory [%s] already exists, skipping creating a directory", atLocation.getAbsolutePath()); return; } if (!atLocation.mkdir()) { throw new ISE( "Unable to create directory at [%s] for coordinate [%s]", atLocation.getAbsolutePath(), coordinate ); } }
[ "private", "void", "createExtensionDirectory", "(", "String", "coordinate", ",", "File", "atLocation", ")", "{", "if", "(", "atLocation", ".", "isDirectory", "(", ")", ")", "{", "log", ".", "info", "(", "\"Directory [%s] already exists, skipping creating a directory\"...
Create the extension directory for a specific maven coordinate. The name of this directory should be the artifactId in the coordinate
[ "Create", "the", "extension", "directory", "for", "a", "specific", "maven", "coordinate", ".", "The", "name", "of", "this", "directory", "should", "be", "the", "artifactId", "in", "the", "coordinate" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/services/src/main/java/org/apache/druid/cli/PullDependencies.java#L545-L559
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.drawArrowOffset
public static void drawArrowOffset(Graphics g, Point from, Point to, int offsetFrom, int offsetTo, double weight){ double xk1,xk2,s,dx,dy,sinPhi,cosPhi; dx = to.x-from.x; dy = to.y-from.y; xk1=-offsetFrom/2; xk2=-offsetTo/2; s=Math.sqrt(dy*dy+dx*dx); sinPhi=dy/s; cosPhi=dx/s; drawArrow(g, from.getX()-xk1*cosPhi, from.getY()-xk1*sinPhi, to.getX()+xk2*cosPhi, to.getY()+xk2*sinPhi, weight); }
java
public static void drawArrowOffset(Graphics g, Point from, Point to, int offsetFrom, int offsetTo, double weight){ double xk1,xk2,s,dx,dy,sinPhi,cosPhi; dx = to.x-from.x; dy = to.y-from.y; xk1=-offsetFrom/2; xk2=-offsetTo/2; s=Math.sqrt(dy*dy+dx*dx); sinPhi=dy/s; cosPhi=dx/s; drawArrow(g, from.getX()-xk1*cosPhi, from.getY()-xk1*sinPhi, to.getX()+xk2*cosPhi, to.getY()+xk2*sinPhi, weight); }
[ "public", "static", "void", "drawArrowOffset", "(", "Graphics", "g", ",", "Point", "from", ",", "Point", "to", ",", "int", "offsetFrom", ",", "int", "offsetTo", ",", "double", "weight", ")", "{", "double", "xk1", ",", "xk2", ",", "s", ",", "dx", ",", ...
Draws an arrow between two given points using the specified weight and offsets.<br> The arrow lies on the line between point <code>from</code> to point <code>to</code> and points to point <code>to</code>. The distance between point <code>from</code> and the arrow start is defined by <code>offsetFrom</code>, respectively for the arrow end, <code>to</code> and <code>offsetTo</code>. @param g Graphics context @param from Basic arrow starting point @param to Basic arrow ending point @param offsetFrom Distance between <code>from</code> and arrow starting point @param offsetTo Distance between <code>to</code> and arrow ending point @param weight Arrow weight
[ "Draws", "an", "arrow", "between", "two", "given", "points", "using", "the", "specified", "weight", "and", "offsets", ".", "<br", ">", "The", "arrow", "lies", "on", "the", "line", "between", "point", "<code", ">", "from<", "/", "code", ">", "to", "point"...
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L166-L176
venkatramanm/common
src/main/java/com/venky/core/string/Inflector.java
Inflector.camelize
public static String camelize(String underscore, boolean capitalizeFirstChar){ String result = ""; StringTokenizer st = new StringTokenizer(LowerCaseStringCache.instance().get(underscore), "_"); while(st.hasMoreTokens()){ result += capitalize(st.nextToken()); } return capitalizeFirstChar? result :result.substring(0, 1).toLowerCase() + result.substring(1); }
java
public static String camelize(String underscore, boolean capitalizeFirstChar){ String result = ""; StringTokenizer st = new StringTokenizer(LowerCaseStringCache.instance().get(underscore), "_"); while(st.hasMoreTokens()){ result += capitalize(st.nextToken()); } return capitalizeFirstChar? result :result.substring(0, 1).toLowerCase() + result.substring(1); }
[ "public", "static", "String", "camelize", "(", "String", "underscore", ",", "boolean", "capitalizeFirstChar", ")", "{", "String", "result", "=", "\"\"", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "LowerCaseStringCache", ".", "instance", "(",...
Generates a camel case version of a phrase from underscore. @param underscore underscore version of a word to converted to camel case. @param capitalizeFirstChar set to true if first character needs to be capitalized, false if not. @return camel case version of underscore.
[ "Generates", "a", "camel", "case", "version", "of", "a", "phrase", "from", "underscore", "." ]
train
https://github.com/venkatramanm/common/blob/b89583efd674f73cf4c04927300a9ea6e49a3e9f/src/main/java/com/venky/core/string/Inflector.java#L202-L209
dlemmermann/CalendarFX
CalendarFXGoogle/src/main/java/com/calendarfx/google/service/GoogleConnector.java
GoogleConnector.getInstance
public static GoogleConnector getInstance() { if (instance == null) { try { instance = new GoogleConnector(); } catch (Exception e) { throw new RuntimeException("The GoogleConnector could not be instanced!", e); } } return instance; }
java
public static GoogleConnector getInstance() { if (instance == null) { try { instance = new GoogleConnector(); } catch (Exception e) { throw new RuntimeException("The GoogleConnector could not be instanced!", e); } } return instance; }
[ "public", "static", "GoogleConnector", "getInstance", "(", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "try", "{", "instance", "=", "new", "GoogleConnector", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Ru...
On demand instance creator method used to get the single instance of this google authenticator class. @return The single instance of this class, if the instance does not exist, this is immediately created.
[ "On", "demand", "instance", "creator", "method", "used", "to", "get", "the", "single", "instance", "of", "this", "google", "authenticator", "class", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXGoogle/src/main/java/com/calendarfx/google/service/GoogleConnector.java#L116-L125
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImpl_CustomFieldSerializer.java
OWLLiteralImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLLiteralImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLLiteralImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLLiteralImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImpl_CustomFieldSerializer.java#L89-L92
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.toStringIdOrIndex
static String toStringIdOrIndex(Context cx, Object id) { if (id instanceof Number) { double d = ((Number)id).doubleValue(); int index = (int)d; if (index == d) { storeIndexResult(cx, index); return null; } return toString(id); } String s; if (id instanceof String) { s = (String)id; } else { s = toString(id); } long indexTest = indexFromString(s); if (indexTest >= 0) { storeIndexResult(cx, (int)indexTest); return null; } return s; }
java
static String toStringIdOrIndex(Context cx, Object id) { if (id instanceof Number) { double d = ((Number)id).doubleValue(); int index = (int)d; if (index == d) { storeIndexResult(cx, index); return null; } return toString(id); } String s; if (id instanceof String) { s = (String)id; } else { s = toString(id); } long indexTest = indexFromString(s); if (indexTest >= 0) { storeIndexResult(cx, (int)indexTest); return null; } return s; }
[ "static", "String", "toStringIdOrIndex", "(", "Context", "cx", ",", "Object", "id", ")", "{", "if", "(", "id", "instanceof", "Number", ")", "{", "double", "d", "=", "(", "(", "Number", ")", "id", ")", ".", "doubleValue", "(", ")", ";", "int", "index"...
If toString(id) is a decimal presentation of int32 value, then id is index. In this case return null and make the index available as ScriptRuntime.lastIndexResult(cx). Otherwise return toString(id).
[ "If", "toString", "(", "id", ")", "is", "a", "decimal", "presentation", "of", "int32", "value", "then", "id", "is", "index", ".", "In", "this", "case", "return", "null", "and", "make", "the", "index", "available", "as", "ScriptRuntime", ".", "lastIndexResu...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1483-L1506
tencentyun/cos-java-sdk
src/main/java/com/qcloud/cos/common_utils/CommonParamCheckUtils.java
CommonParamCheckUtils.AssertSliceInRange
public static void AssertSliceInRange(int sliceSize) throws ParamException { int maxSliceSize = 10 * 1024 * 1024; // 10MB int minSliceSize = 64 * 1024; // 64KB if (sliceSize > maxSliceSize || sliceSize < minSliceSize) { throw new ParamException("sliceSize legal value is [64KB, 100MB]"); } }
java
public static void AssertSliceInRange(int sliceSize) throws ParamException { int maxSliceSize = 10 * 1024 * 1024; // 10MB int minSliceSize = 64 * 1024; // 64KB if (sliceSize > maxSliceSize || sliceSize < minSliceSize) { throw new ParamException("sliceSize legal value is [64KB, 100MB]"); } }
[ "public", "static", "void", "AssertSliceInRange", "(", "int", "sliceSize", ")", "throws", "ParamException", "{", "int", "maxSliceSize", "=", "10", "*", "1024", "*", "1024", ";", "// 10MB", "int", "minSliceSize", "=", "64", "*", "1024", ";", "// 64KB", "if", ...
判断分片尺寸是否在规定的范围内,抛出参数异常,目前的有效值为64KB ~ 10MB @param sliceSize 分片大小, 单位Byte @throws ParamException
[ "判断分片尺寸是否在规定的范围内,抛出参数异常,目前的有效值为64KB", "~", "10MB" ]
train
https://github.com/tencentyun/cos-java-sdk/blob/6709a48f67c1ea7b82a7215f5037d6ccf218b630/src/main/java/com/qcloud/cos/common_utils/CommonParamCheckUtils.java#L54-L60
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/server/JcrServiceImpl.java
JcrServiceImpl.getProperties
private Collection<JcrProperty> getProperties( String repository, String workspace, String path, Node node ) throws RepositoryException { ArrayList<PropertyDefinition> names = new ArrayList<>(); NodeType primaryType = node.getPrimaryNodeType(); PropertyDefinition[] defs = primaryType.getPropertyDefinitions(); names.addAll(Arrays.asList(defs)); NodeType[] mixinType = node.getMixinNodeTypes(); for (NodeType type : mixinType) { defs = type.getPropertyDefinitions(); names.addAll(Arrays.asList(defs)); } ArrayList<JcrProperty> list = new ArrayList<>(); for (PropertyDefinition def : names) { String name = def.getName(); String type = PropertyType.nameFromValue(def.getRequiredType()); Property p = null; try { p = node.getProperty(def.getName()); } catch (PathNotFoundException e) { } String display = values(def, p); String value = def.isMultiple() ? multiValue(p) : singleValue(p, def, repository, workspace, path); list.add(new JcrProperty(name, type, value, display)); } return list; }
java
private Collection<JcrProperty> getProperties( String repository, String workspace, String path, Node node ) throws RepositoryException { ArrayList<PropertyDefinition> names = new ArrayList<>(); NodeType primaryType = node.getPrimaryNodeType(); PropertyDefinition[] defs = primaryType.getPropertyDefinitions(); names.addAll(Arrays.asList(defs)); NodeType[] mixinType = node.getMixinNodeTypes(); for (NodeType type : mixinType) { defs = type.getPropertyDefinitions(); names.addAll(Arrays.asList(defs)); } ArrayList<JcrProperty> list = new ArrayList<>(); for (PropertyDefinition def : names) { String name = def.getName(); String type = PropertyType.nameFromValue(def.getRequiredType()); Property p = null; try { p = node.getProperty(def.getName()); } catch (PathNotFoundException e) { } String display = values(def, p); String value = def.isMultiple() ? multiValue(p) : singleValue(p, def, repository, workspace, path); list.add(new JcrProperty(name, type, value, display)); } return list; }
[ "private", "Collection", "<", "JcrProperty", ">", "getProperties", "(", "String", "repository", ",", "String", "workspace", ",", "String", "path", ",", "Node", "node", ")", "throws", "RepositoryException", "{", "ArrayList", "<", "PropertyDefinition", ">", "names",...
Reads properties of the given node. @param repository the repository name @param workspace the workspace name @param path the path to the node @param node the node instance @return list of node's properties. @throws RepositoryException
[ "Reads", "properties", "of", "the", "given", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/server/JcrServiceImpl.java#L361-L394
FINRAOS/JTAF-ExtWebDriver
src/main/java/org/finra/jtaf/ewd/widget/element/Element.java
Element.isWithinBoundsOfWindow
public boolean isWithinBoundsOfWindow() throws WidgetException { JavascriptExecutor js = ((JavascriptExecutor) getGUIDriver().getWrappedDriver()); // execute javascript to get scroll values Object top = js.executeScript("return document.body.scrollTop;"); Object left = js.executeScript("return document.body.scrollLeft;"); int scrollTop; int scrollLeft; try { scrollTop = Integer.parseInt(top+""); scrollLeft = Integer.parseInt(left+""); } catch(NumberFormatException e) { throw new WidgetException("There was an error parsing the scroll values from the page", getByLocator()); } // calculate bounds Dimension dim = getGUIDriver().getWrappedDriver().manage().window().getSize(); int windowWidth = dim.getWidth(); int windowHeight = dim.getHeight(); int x = ((Locatable)getWebElement()).getCoordinates().onPage().getX(); int y = ((Locatable)getWebElement()).getCoordinates().onPage().getY(); int relX = x - scrollLeft; int relY = y - scrollTop; return relX + findElement().getSize().getWidth() <= windowWidth && relY + findElement().getSize().getHeight() <= windowHeight && relX >= 0 && relY >= 0; }
java
public boolean isWithinBoundsOfWindow() throws WidgetException { JavascriptExecutor js = ((JavascriptExecutor) getGUIDriver().getWrappedDriver()); // execute javascript to get scroll values Object top = js.executeScript("return document.body.scrollTop;"); Object left = js.executeScript("return document.body.scrollLeft;"); int scrollTop; int scrollLeft; try { scrollTop = Integer.parseInt(top+""); scrollLeft = Integer.parseInt(left+""); } catch(NumberFormatException e) { throw new WidgetException("There was an error parsing the scroll values from the page", getByLocator()); } // calculate bounds Dimension dim = getGUIDriver().getWrappedDriver().manage().window().getSize(); int windowWidth = dim.getWidth(); int windowHeight = dim.getHeight(); int x = ((Locatable)getWebElement()).getCoordinates().onPage().getX(); int y = ((Locatable)getWebElement()).getCoordinates().onPage().getY(); int relX = x - scrollLeft; int relY = y - scrollTop; return relX + findElement().getSize().getWidth() <= windowWidth && relY + findElement().getSize().getHeight() <= windowHeight && relX >= 0 && relY >= 0; }
[ "public", "boolean", "isWithinBoundsOfWindow", "(", ")", "throws", "WidgetException", "{", "JavascriptExecutor", "js", "=", "(", "(", "JavascriptExecutor", ")", "getGUIDriver", "(", ")", ".", "getWrappedDriver", "(", ")", ")", ";", "// execute javascript to get scroll...
* Determine if the element is within the bounds of the window @return true or false @throws WidgetException
[ "*", "Determine", "if", "the", "element", "is", "within", "the", "bounds", "of", "the", "window" ]
train
https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/widget/element/Element.java#L253-L282
grails/grails-core
grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java
DefaultGrailsApplication.addOverridableArtefact
public GrailsClass addOverridableArtefact(String artefactType, @SuppressWarnings("rawtypes") Class artefactClass) { return addArtefact(artefactType, artefactClass, true); }
java
public GrailsClass addOverridableArtefact(String artefactType, @SuppressWarnings("rawtypes") Class artefactClass) { return addArtefact(artefactType, artefactClass, true); }
[ "public", "GrailsClass", "addOverridableArtefact", "(", "String", "artefactType", ",", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Class", "artefactClass", ")", "{", "return", "addArtefact", "(", "artefactType", ",", "artefactClass", ",", "true", ")", ";", ...
Adds an artefact of the given type for the given Class. @param artefactType The type of the artefact as defined by a ArtefactHandler instance @param artefactClass A Class instance that matches the type defined by the ArtefactHandler @return The GrailsClass if successful or null if it couldn't be added @throws GrailsConfigurationException If the specified Class is not the same as the type defined by the ArtefactHandler @see grails.core.ArtefactHandler
[ "Adds", "an", "artefact", "of", "the", "given", "type", "for", "the", "given", "Class", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java#L801-L803
copper-engine/copper-engine
projects/copper-coreengine/src/main/java/org/copperengine/core/persistent/MySqlDialect.java
MySqlDialect.doLock
@Override protected void doLock(Connection con, final String lockContext) throws SQLException { logger.debug("Trying to acquire db lock for '{}'", lockContext); PreparedStatement stmt = con.prepareStatement("select get_lock(?,?)"); stmt.setString(1, lockContext); stmt.setInt(2, ACQUIRE_BLOCKING_WAIT_SEC); try { final ResultSet rs = stmt.executeQuery(); while (rs.next()) { final int lockResult = rs.getInt(1); if (lockResult == 1) { // success return; } final String errorMsgPrefix = "error acquire lock(" + lockContext + "," + ACQUIRE_BLOCKING_WAIT_SEC + "): "; if (rs.wasNull()) { throw new SQLException(errorMsgPrefix + "unknown"); } else if (lockResult == 0) { // timeout throw new SQLException(errorMsgPrefix + "timeout"); } } // something else must be horribly wrong throw new SQLException("Please check your version of MySQL, to make sure it supports get_lock() & release_lock()"); } finally { JdbcUtils.closeStatement(stmt); } }
java
@Override protected void doLock(Connection con, final String lockContext) throws SQLException { logger.debug("Trying to acquire db lock for '{}'", lockContext); PreparedStatement stmt = con.prepareStatement("select get_lock(?,?)"); stmt.setString(1, lockContext); stmt.setInt(2, ACQUIRE_BLOCKING_WAIT_SEC); try { final ResultSet rs = stmt.executeQuery(); while (rs.next()) { final int lockResult = rs.getInt(1); if (lockResult == 1) { // success return; } final String errorMsgPrefix = "error acquire lock(" + lockContext + "," + ACQUIRE_BLOCKING_WAIT_SEC + "): "; if (rs.wasNull()) { throw new SQLException(errorMsgPrefix + "unknown"); } else if (lockResult == 0) { // timeout throw new SQLException(errorMsgPrefix + "timeout"); } } // something else must be horribly wrong throw new SQLException("Please check your version of MySQL, to make sure it supports get_lock() & release_lock()"); } finally { JdbcUtils.closeStatement(stmt); } }
[ "@", "Override", "protected", "void", "doLock", "(", "Connection", "con", ",", "final", "String", "lockContext", ")", "throws", "SQLException", "{", "logger", ".", "debug", "(", "\"Trying to acquire db lock for '{}'\"", ",", "lockContext", ")", ";", "PreparedStateme...
Note: For MySQL the advisory lock only applies to the current connection, if the connection terminates, it will release the lock automatically. If you try to lock multiple times on the same lockContext, for the same connection, you need to release multiple times, it won't deadlock since version 5.7.5, please consult: <a href="http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock"> http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock</a>
[ "Note", ":", "For", "MySQL", "the", "advisory", "lock", "only", "applies", "to", "the", "current", "connection", "if", "the", "connection", "terminates", "it", "will", "release", "the", "lock", "automatically", ".", "If", "you", "try", "to", "lock", "multipl...
train
https://github.com/copper-engine/copper-engine/blob/92acf748a1be3d2d49e86b04e180bd19b1745c15/projects/copper-coreengine/src/main/java/org/copperengine/core/persistent/MySqlDialect.java#L120-L148
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/XMLFactory.java
XMLFactory.newDocument
@Nonnull public static Document newDocument (@Nonnull final DocumentBuilder aDocBuilder, @Nullable final EXMLVersion eVersion) { ValueEnforcer.notNull (aDocBuilder, "DocBuilder"); final Document aDoc = aDocBuilder.newDocument (); aDoc.setXmlVersion ((eVersion != null ? eVersion : EXMLVersion.XML_10).getVersion ()); return aDoc; }
java
@Nonnull public static Document newDocument (@Nonnull final DocumentBuilder aDocBuilder, @Nullable final EXMLVersion eVersion) { ValueEnforcer.notNull (aDocBuilder, "DocBuilder"); final Document aDoc = aDocBuilder.newDocument (); aDoc.setXmlVersion ((eVersion != null ? eVersion : EXMLVersion.XML_10).getVersion ()); return aDoc; }
[ "@", "Nonnull", "public", "static", "Document", "newDocument", "(", "@", "Nonnull", "final", "DocumentBuilder", "aDocBuilder", ",", "@", "Nullable", "final", "EXMLVersion", "eVersion", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aDocBuilder", ",", "\"DocBuild...
Create a new XML document without document type using a custom document builder. @param aDocBuilder The document builder to use. May not be <code>null</code>. @param eVersion The XML version to use. If <code>null</code> is passed, {@link EXMLVersion#XML_10} will be used. @return The created document. Never <code>null</code>.
[ "Create", "a", "new", "XML", "document", "without", "document", "type", "using", "a", "custom", "document", "builder", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLFactory.java#L303-L311
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/GelfMessageBuilder.java
GelfMessageBuilder.withField
public GelfMessageBuilder withField(String key, String value) { this.additionalFields.put(key, value); return this; }
java
public GelfMessageBuilder withField(String key, String value) { this.additionalFields.put(key, value); return this; }
[ "public", "GelfMessageBuilder", "withField", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "additionalFields", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add an additional field. @param key the key @param value the value @return GelfMessageBuilder
[ "Add", "an", "additional", "field", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/GelfMessageBuilder.java#L145-L148
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java
CPOptionValuePersistenceImpl.findByGroupId
@Override public List<CPOptionValue> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CPOptionValue> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPOptionValue", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp option values where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of cp option values @param end the upper bound of the range of cp option values (not inclusive) @return the range of matching cp option values
[ "Returns", "a", "range", "of", "all", "the", "cp", "option", "values", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L1528-L1531
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java
CommonConfigUtils.getIntegerConfigAttribute
public int getIntegerConfigAttribute(Map<String, Object> props, String key, int defaultValue) { if (props.containsKey(key)) { return (Integer) props.get(key); } return defaultValue; }
java
public int getIntegerConfigAttribute(Map<String, Object> props, String key, int defaultValue) { if (props.containsKey(key)) { return (Integer) props.get(key); } return defaultValue; }
[ "public", "int", "getIntegerConfigAttribute", "(", "Map", "<", "String", ",", "Object", ">", "props", ",", "String", "key", ",", "int", "defaultValue", ")", "{", "if", "(", "props", ".", "containsKey", "(", "key", ")", ")", "{", "return", "(", "Integer",...
Returns the value for the configuration attribute matching the key provided. If the value does not exist or is empty, the provided default value will be returned.
[ "Returns", "the", "value", "for", "the", "configuration", "attribute", "matching", "the", "key", "provided", ".", "If", "the", "value", "does", "not", "exist", "or", "is", "empty", "the", "provided", "default", "value", "will", "be", "returned", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java#L141-L146
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getAndCheckEntityType
public static EntityType getAndCheckEntityType(EntityDataModel entityDataModel, Class<?> javaType) { return checkIsEntityType(getAndCheckType(entityDataModel, javaType)); }
java
public static EntityType getAndCheckEntityType(EntityDataModel entityDataModel, Class<?> javaType) { return checkIsEntityType(getAndCheckType(entityDataModel, javaType)); }
[ "public", "static", "EntityType", "getAndCheckEntityType", "(", "EntityDataModel", "entityDataModel", ",", "Class", "<", "?", ">", "javaType", ")", "{", "return", "checkIsEntityType", "(", "getAndCheckType", "(", "entityDataModel", ",", "javaType", ")", ")", ";", ...
Gets the OData type for a Java type and checks if the OData type is an entity type; throws an exception if the OData type is not an entity type. @param entityDataModel The entity data model. @param javaType The Java type. @return The OData entity type for the Java type. @throws ODataSystemException If there is no OData type for the specified Java type or if the OData type is not an entity type.
[ "Gets", "the", "OData", "type", "for", "a", "Java", "type", "and", "checks", "if", "the", "OData", "type", "is", "an", "entity", "type", ";", "throws", "an", "exception", "if", "the", "OData", "type", "is", "not", "an", "entity", "type", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L236-L238
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/EventReporter.java
EventReporter.getMetricName
protected String getMetricName(Map<String, String> metadata, String eventName) { return JOINER.join(METRIC_KEY_PREFIX, metadata.get(METADATA_JOB_ID), metadata.get(METADATA_TASK_ID), EVENTS_QUALIFIER, eventName); }
java
protected String getMetricName(Map<String, String> metadata, String eventName) { return JOINER.join(METRIC_KEY_PREFIX, metadata.get(METADATA_JOB_ID), metadata.get(METADATA_TASK_ID), EVENTS_QUALIFIER, eventName); }
[ "protected", "String", "getMetricName", "(", "Map", "<", "String", ",", "String", ">", "metadata", ",", "String", "eventName", ")", "{", "return", "JOINER", ".", "join", "(", "METRIC_KEY_PREFIX", ",", "metadata", ".", "get", "(", "METADATA_JOB_ID", ")", ",",...
Constructs the metric key to be emitted. The actual event name is enriched with the current job and task id to be able to keep track of its origin @param metadata metadata of the actual {@link GobblinTrackingEvent} @param eventName name of the actual {@link GobblinTrackingEvent} @return prefix of the metric key
[ "Constructs", "the", "metric", "key", "to", "be", "emitted", ".", "The", "actual", "event", "name", "is", "enriched", "with", "the", "current", "job", "and", "task", "id", "to", "be", "able", "to", "keep", "track", "of", "its", "origin" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/EventReporter.java#L168-L171
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByTimeZoneCanonicalId
public Iterable<DUser> queryByTimeZoneCanonicalId(java.lang.String timeZoneCanonicalId) { return queryByField(null, DUserMapper.Field.TIMEZONECANONICALID.getFieldName(), timeZoneCanonicalId); }
java
public Iterable<DUser> queryByTimeZoneCanonicalId(java.lang.String timeZoneCanonicalId) { return queryByField(null, DUserMapper.Field.TIMEZONECANONICALID.getFieldName(), timeZoneCanonicalId); }
[ "public", "Iterable", "<", "DUser", ">", "queryByTimeZoneCanonicalId", "(", "java", ".", "lang", ".", "String", "timeZoneCanonicalId", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "TIMEZONECANONICALID", ".", "getFieldName...
query-by method for field timeZoneCanonicalId @param timeZoneCanonicalId the specified attribute @return an Iterable of DUsers for the specified timeZoneCanonicalId
[ "query", "-", "by", "method", "for", "field", "timeZoneCanonicalId" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L250-L252
mapbox/mapbox-java
services-turf/src/main/java/com/mapbox/turf/TurfConversion.java
TurfConversion.convertLength
public static double convertLength(@FloatRange(from = 0) double distance, @NonNull @TurfUnitCriteria String originalUnit) { return convertLength(distance, originalUnit, TurfConstants.UNIT_DEFAULT); }
java
public static double convertLength(@FloatRange(from = 0) double distance, @NonNull @TurfUnitCriteria String originalUnit) { return convertLength(distance, originalUnit, TurfConstants.UNIT_DEFAULT); }
[ "public", "static", "double", "convertLength", "(", "@", "FloatRange", "(", "from", "=", "0", ")", "double", "distance", ",", "@", "NonNull", "@", "TurfUnitCriteria", "String", "originalUnit", ")", "{", "return", "convertLength", "(", "distance", ",", "origina...
Converts a distance to the default units. Use {@link TurfConversion#convertLength(double, String, String)} to specify a unit to convert to. @param distance double representing a distance value @param originalUnit of the distance, must be one of the units defined in {@link TurfUnitCriteria} @return converted distance in the default unit @since 2.2.0
[ "Converts", "a", "distance", "to", "the", "default", "units", ".", "Use", "{", "@link", "TurfConversion#convertLength", "(", "double", "String", "String", ")", "}", "to", "specify", "a", "unit", "to", "convert", "to", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfConversion.java#L143-L146
sothawo/mapjfx
src/main/java/com/sothawo/mapjfx/MapView.java
JavaConnector.contextClickAt
public void contextClickAt(double lat, double lon) { final Coordinate coordinate = new Coordinate(lat, lon); if (logger.isTraceEnabled()) { logger.trace("JS reports context click at {}", coordinate); } fireEvent(new MapViewEvent(MapViewEvent.MAP_RIGHTCLICKED, coordinate)); }
java
public void contextClickAt(double lat, double lon) { final Coordinate coordinate = new Coordinate(lat, lon); if (logger.isTraceEnabled()) { logger.trace("JS reports context click at {}", coordinate); } fireEvent(new MapViewEvent(MapViewEvent.MAP_RIGHTCLICKED, coordinate)); }
[ "public", "void", "contextClickAt", "(", "double", "lat", ",", "double", "lon", ")", "{", "final", "Coordinate", "coordinate", "=", "new", "Coordinate", "(", "lat", ",", "lon", ")", ";", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "...
called when the user has context-clicked in the map. the coordinates are EPSG:4326 (WGS) values. @param lat new latitude value @param lon new longitude value
[ "called", "when", "the", "user", "has", "context", "-", "clicked", "in", "the", "map", ".", "the", "coordinates", "are", "EPSG", ":", "4326", "(", "WGS", ")", "values", "." ]
train
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/MapView.java#L1388-L1394
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/subnet/SubnetClient.java
SubnetClient.listSubnets
public ListSubnetsResponse listSubnets(ListSubnetsRequest request) { checkNotNull(request, "request should not be null."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SUBNET_PREFIX); if (request.getMarker() != null) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxKeys() > 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } return invokeHttpClient(internalRequest, ListSubnetsResponse.class); }
java
public ListSubnetsResponse listSubnets(ListSubnetsRequest request) { checkNotNull(request, "request should not be null."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SUBNET_PREFIX); if (request.getMarker() != null) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxKeys() > 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } return invokeHttpClient(internalRequest, ListSubnetsResponse.class); }
[ "public", "ListSubnetsResponse", "listSubnets", "(", "ListSubnetsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "this", ".", "createRequest", "(", "request", ","...
Return a list of subnet owned by the authenticated user. @param request The request containing all options for listing own's subnet. @return The response containing a list of subnets owned by the authenticated user.
[ "Return", "a", "list", "of", "subnet", "owned", "by", "the", "authenticated", "user", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/subnet/SubnetClient.java#L212-L222
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java
VariantMetadataManager.addIndividual
public void addIndividual(org.opencb.biodata.models.metadata.Individual individual, String studyId) { // Sanity check if (individual == null || StringUtils.isEmpty(individual.getId())) { logger.error("Individual (or its ID) is null or empty."); return; } VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId); if (variantStudyMetadata == null) { logger.error("Study not found. Check your study ID: '{}'", studyId); return; } if (variantStudyMetadata.getIndividuals() == null) { variantStudyMetadata.setIndividuals(new ArrayList<>()); } for (org.opencb.biodata.models.metadata.Individual indi: variantStudyMetadata.getIndividuals()) { if (indi.getId() != null && indi.getId().equals(individual.getId())) { logger.error("Individual with id '{}' already exists in study '{}'", individual.getId(), studyId); return; } } variantStudyMetadata.getIndividuals().add(individual); }
java
public void addIndividual(org.opencb.biodata.models.metadata.Individual individual, String studyId) { // Sanity check if (individual == null || StringUtils.isEmpty(individual.getId())) { logger.error("Individual (or its ID) is null or empty."); return; } VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId); if (variantStudyMetadata == null) { logger.error("Study not found. Check your study ID: '{}'", studyId); return; } if (variantStudyMetadata.getIndividuals() == null) { variantStudyMetadata.setIndividuals(new ArrayList<>()); } for (org.opencb.biodata.models.metadata.Individual indi: variantStudyMetadata.getIndividuals()) { if (indi.getId() != null && indi.getId().equals(individual.getId())) { logger.error("Individual with id '{}' already exists in study '{}'", individual.getId(), studyId); return; } } variantStudyMetadata.getIndividuals().add(individual); }
[ "public", "void", "addIndividual", "(", "org", ".", "opencb", ".", "biodata", ".", "models", ".", "metadata", ".", "Individual", "individual", ",", "String", "studyId", ")", "{", "// Sanity check", "if", "(", "individual", "==", "null", "||", "StringUtils", ...
Add an individual to a given variant study metadata (from study ID). @param individual Individual to add @param studyId Study ID
[ "Add", "an", "individual", "to", "a", "given", "variant", "study", "metadata", "(", "from", "study", "ID", ")", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L326-L349
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setTime
public void setTime(final int parameterIndex, final Time x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.TIME); return; } setParameter(parameterIndex, new TimeParameter(x.getTime())); }
java
public void setTime(final int parameterIndex, final Time x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.TIME); return; } setParameter(parameterIndex, new TimeParameter(x.getTime())); }
[ "public", "void", "setTime", "(", "final", "int", "parameterIndex", ",", "final", "Time", "x", ")", "throws", "SQLException", "{", "if", "(", "x", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "TIME", ")", ";", "return", ...
Since Drizzle has no TIME datatype, time in milliseconds is stored in a packed integer @param parameterIndex the first parameter is 1, the second is 2, ... @param x the parameter value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> @see org.drizzle.jdbc.internal.common.Utils#packTime(long) @see org.drizzle.jdbc.internal.common.Utils#unpackTime(int) <p/> Sets the designated parameter to the given <code>java.sql.Time</code> value. The driver converts this to an SQL <code>TIME</code> value when it sends it to the database.
[ "Since", "Drizzle", "has", "no", "TIME", "datatype", "time", "in", "milliseconds", "is", "stored", "in", "a", "packed", "integer" ]
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1154-L1162
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java
CustomVisionPredictionManager.authenticate
public static PredictionEndpoint authenticate(RestClient restClient, final String apiKey) { return new PredictionEndpointImpl(restClient).withApiKey(apiKey); }
java
public static PredictionEndpoint authenticate(RestClient restClient, final String apiKey) { return new PredictionEndpointImpl(restClient).withApiKey(apiKey); }
[ "public", "static", "PredictionEndpoint", "authenticate", "(", "RestClient", "restClient", ",", "final", "String", "apiKey", ")", "{", "return", "new", "PredictionEndpointImpl", "(", "restClient", ")", ".", "withApiKey", "(", "apiKey", ")", ";", "}" ]
Initializes an instance of Custom Vision Prediction API client. @param restClient the REST client to connect to Azure. @param apiKey the Custom Vision Prediction API key @return the Custom Vision Prediction API client
[ "Initializes", "an", "instance", "of", "Custom", "Vision", "Prediction", "API", "client", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java#L74-L76
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowVersionsInner.java
WorkflowVersionsInner.getAsync
public Observable<WorkflowVersionInner> getAsync(String resourceGroupName, String workflowName, String versionId) { return getWithServiceResponseAsync(resourceGroupName, workflowName, versionId).map(new Func1<ServiceResponse<WorkflowVersionInner>, WorkflowVersionInner>() { @Override public WorkflowVersionInner call(ServiceResponse<WorkflowVersionInner> response) { return response.body(); } }); }
java
public Observable<WorkflowVersionInner> getAsync(String resourceGroupName, String workflowName, String versionId) { return getWithServiceResponseAsync(resourceGroupName, workflowName, versionId).map(new Func1<ServiceResponse<WorkflowVersionInner>, WorkflowVersionInner>() { @Override public WorkflowVersionInner call(ServiceResponse<WorkflowVersionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkflowVersionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "versionId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ",", ...
Gets a workflow version. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param versionId The workflow versionId. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowVersionInner object
[ "Gets", "a", "workflow", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowVersionsInner.java#L365-L372
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.boundingBox
public BoundingBox boundingBox() { BoundingBox boundingBox = new BoundingBox(Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); expandBoundingBox(boundingBox); return boundingBox; }
java
public BoundingBox boundingBox() { BoundingBox boundingBox = new BoundingBox(Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); expandBoundingBox(boundingBox); return boundingBox; }
[ "public", "BoundingBox", "boundingBox", "(", ")", "{", "BoundingBox", "boundingBox", "=", "new", "BoundingBox", "(", "Double", ".", "MAX_VALUE", ",", "Double", ".", "MAX_VALUE", ",", "-", "Double", ".", "MAX_VALUE", ",", "-", "Double", ".", "MAX_VALUE", ")",...
Get a bounding box that includes the shape @return bounding box
[ "Get", "a", "bounding", "box", "that", "includes", "the", "shape" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L363-L367
alipay/sofa-rpc
core-impl/codec/src/main/java/com/alipay/sofa/rpc/codec/snappy/SnappyDecompressor.java
SnappyDecompressor.incrementalCopy
private static void incrementalCopy(byte[] src, int srcIndex, byte[] op, int opIndex, int length) { do { op[opIndex++] = src[srcIndex++]; } while (--length > 0); }
java
private static void incrementalCopy(byte[] src, int srcIndex, byte[] op, int opIndex, int length) { do { op[opIndex++] = src[srcIndex++]; } while (--length > 0); }
[ "private", "static", "void", "incrementalCopy", "(", "byte", "[", "]", "src", ",", "int", "srcIndex", ",", "byte", "[", "]", "op", ",", "int", "opIndex", ",", "int", "length", ")", "{", "do", "{", "op", "[", "opIndex", "++", "]", "=", "src", "[", ...
Copy "len" bytes from "src" to "op", one byte at a time. Used for handling COPY operations where the input and output regions may overlap. For example, suppose: src == "ab" op == src + 2 len == 20 <p> After incrementalCopy, the result will have eleven copies of "ab" ababababababababababab Note that this does not match the semantics of either memcpy() or memmove().
[ "Copy", "len", "bytes", "from", "src", "to", "op", "one", "byte", "at", "a", "time", ".", "Used", "for", "handling", "COPY", "operations", "where", "the", "input", "and", "output", "regions", "may", "overlap", ".", "For", "example", "suppose", ":", "src"...
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/codec/src/main/java/com/alipay/sofa/rpc/codec/snappy/SnappyDecompressor.java#L317-L321
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.generateSecurityToken
public static String generateSecurityToken(int length, boolean urlSafe) { final byte[] bytes = new byte[length]; SecureRandom rand; try { rand = SecureRandom.getInstance("SHA1PRNG"); } catch (NoSuchAlgorithmException ex) { logger.error(null, ex); rand = new SecureRandom(); } rand.nextBytes(bytes); return urlSafe ? base64encURL(bytes) : base64enc(bytes); }
java
public static String generateSecurityToken(int length, boolean urlSafe) { final byte[] bytes = new byte[length]; SecureRandom rand; try { rand = SecureRandom.getInstance("SHA1PRNG"); } catch (NoSuchAlgorithmException ex) { logger.error(null, ex); rand = new SecureRandom(); } rand.nextBytes(bytes); return urlSafe ? base64encURL(bytes) : base64enc(bytes); }
[ "public", "static", "String", "generateSecurityToken", "(", "int", "length", ",", "boolean", "urlSafe", ")", "{", "final", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "length", "]", ";", "SecureRandom", "rand", ";", "try", "{", "rand", "=", "Secu...
Generates an authentication token - a random string encoded in Base64. @param length the length of the generated token @param urlSafe switches to a URL safe encoding @return a random string
[ "Generates", "an", "authentication", "token", "-", "a", "random", "string", "encoded", "in", "Base64", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L214-L225
fabiomaffioletti/jsondoc
jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java
AbstractJSONDocScanner.getJSONDoc
public JSONDoc getJSONDoc(String version, String basePath, List<String> packages, boolean playgroundEnabled, MethodDisplay displayMethodAs) { Set<URL> urls = new HashSet<URL>(); FilterBuilder filter = new FilterBuilder(); log.debug("Found " + packages.size() + " package(s) to scan..."); for (String pkg : packages) { log.debug("Adding package to JSONDoc recursive scan: " + pkg); urls.addAll(ClasspathHelper.forPackage(pkg)); filter.includePackage(pkg); } reflections = new Reflections(new ConfigurationBuilder().filterInputsBy(filter).setUrls(urls).addScanners(new MethodAnnotationsScanner())); JSONDoc jsondocDoc = new JSONDoc(version, basePath); jsondocDoc.setPlaygroundEnabled(playgroundEnabled); jsondocDoc.setDisplayMethodAs(displayMethodAs); jsondocControllers = jsondocControllers(); jsondocObjects = jsondocObjects(packages); jsondocFlows = jsondocFlows(); jsondocGlobal = jsondocGlobal(); jsondocChangelogs = jsondocChangelogs(); jsondocMigrations = jsondocMigrations(); for (Class<?> clazz : jsondocObjects) { jsondocTemplates.put(clazz, JSONDocTemplateBuilder.build(clazz, jsondocObjects)); } jsondocDoc.setApis(getApiDocsMap(jsondocControllers, displayMethodAs)); jsondocDoc.setObjects(getApiObjectsMap(jsondocObjects)); jsondocDoc.setFlows(getApiFlowDocsMap(jsondocFlows, allApiMethodDocs)); jsondocDoc.setGlobal(getApiGlobalDoc(jsondocGlobal, jsondocChangelogs, jsondocMigrations)); return jsondocDoc; }
java
public JSONDoc getJSONDoc(String version, String basePath, List<String> packages, boolean playgroundEnabled, MethodDisplay displayMethodAs) { Set<URL> urls = new HashSet<URL>(); FilterBuilder filter = new FilterBuilder(); log.debug("Found " + packages.size() + " package(s) to scan..."); for (String pkg : packages) { log.debug("Adding package to JSONDoc recursive scan: " + pkg); urls.addAll(ClasspathHelper.forPackage(pkg)); filter.includePackage(pkg); } reflections = new Reflections(new ConfigurationBuilder().filterInputsBy(filter).setUrls(urls).addScanners(new MethodAnnotationsScanner())); JSONDoc jsondocDoc = new JSONDoc(version, basePath); jsondocDoc.setPlaygroundEnabled(playgroundEnabled); jsondocDoc.setDisplayMethodAs(displayMethodAs); jsondocControllers = jsondocControllers(); jsondocObjects = jsondocObjects(packages); jsondocFlows = jsondocFlows(); jsondocGlobal = jsondocGlobal(); jsondocChangelogs = jsondocChangelogs(); jsondocMigrations = jsondocMigrations(); for (Class<?> clazz : jsondocObjects) { jsondocTemplates.put(clazz, JSONDocTemplateBuilder.build(clazz, jsondocObjects)); } jsondocDoc.setApis(getApiDocsMap(jsondocControllers, displayMethodAs)); jsondocDoc.setObjects(getApiObjectsMap(jsondocObjects)); jsondocDoc.setFlows(getApiFlowDocsMap(jsondocFlows, allApiMethodDocs)); jsondocDoc.setGlobal(getApiGlobalDoc(jsondocGlobal, jsondocChangelogs, jsondocMigrations)); return jsondocDoc; }
[ "public", "JSONDoc", "getJSONDoc", "(", "String", "version", ",", "String", "basePath", ",", "List", "<", "String", ">", "packages", ",", "boolean", "playgroundEnabled", ",", "MethodDisplay", "displayMethodAs", ")", "{", "Set", "<", "URL", ">", "urls", "=", ...
Returns the main <code>ApiDoc</code>, containing <code>ApiMethodDoc</code> and <code>ApiObjectDoc</code> objects @return An <code>ApiDoc</code> object
[ "Returns", "the", "main", "<code", ">", "ApiDoc<", "/", "code", ">", "containing", "<code", ">", "ApiMethodDoc<", "/", "code", ">", "and", "<code", ">", "ApiObjectDoc<", "/", "code", ">", "objects" ]
train
https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java#L78-L112
line/armeria
saml/src/main/java/com/linecorp/armeria/server/saml/HttpRedirectBindingUtil.java
HttpRedirectBindingUtil.toDeflatedBase64
static String toDeflatedBase64(SAMLObject message) { requireNonNull(message, "message"); final String messageStr; try { messageStr = nodeToString(XMLObjectSupport.marshall(message)); } catch (MarshallingException e) { throw new SamlException("failed to serialize a SAML message", e); } final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); try (DeflaterOutputStream deflaterStream = new DeflaterOutputStream(Base64.getEncoder().wrap(bytesOut), new Deflater(Deflater.DEFLATED, true))) { deflaterStream.write(messageStr.getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw new SamlException("failed to deflate a SAML message", e); } return bytesOut.toString(); }
java
static String toDeflatedBase64(SAMLObject message) { requireNonNull(message, "message"); final String messageStr; try { messageStr = nodeToString(XMLObjectSupport.marshall(message)); } catch (MarshallingException e) { throw new SamlException("failed to serialize a SAML message", e); } final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); try (DeflaterOutputStream deflaterStream = new DeflaterOutputStream(Base64.getEncoder().wrap(bytesOut), new Deflater(Deflater.DEFLATED, true))) { deflaterStream.write(messageStr.getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw new SamlException("failed to deflate a SAML message", e); } return bytesOut.toString(); }
[ "static", "String", "toDeflatedBase64", "(", "SAMLObject", "message", ")", "{", "requireNonNull", "(", "message", ",", "\"message\"", ")", ";", "final", "String", "messageStr", ";", "try", "{", "messageStr", "=", "nodeToString", "(", "XMLObjectSupport", ".", "ma...
Encodes the specified {@code message} into a deflated base64 string.
[ "Encodes", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/HttpRedirectBindingUtil.java#L186-L205
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java
TmdbEpisodes.getEpisodeImages
public ResultList<Artwork> getEpisodeImages(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.SEASON_NUMBER, seasonNumber); parameters.add(Param.EPISODE_NUMBER, episodeNumber); URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.IMAGES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); ResultList<Artwork> results = new ResultList<>(wrapper.getAll()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get images", url, ex); } }
java
public ResultList<Artwork> getEpisodeImages(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, tvID); parameters.add(Param.SEASON_NUMBER, seasonNumber); parameters.add(Param.EPISODE_NUMBER, episodeNumber); URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.IMAGES).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); ResultList<Artwork> results = new ResultList<>(wrapper.getAll()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get images", url, ex); } }
[ "public", "ResultList", "<", "Artwork", ">", "getEpisodeImages", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "int", "episodeNumber", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "pa...
Get the images (episode stills) for a TV episode by combination of a season and episode number. @param tvID @param seasonNumber @param episodeNumber @return @throws MovieDbException
[ "Get", "the", "images", "(", "episode", "stills", ")", "for", "a", "TV", "episode", "by", "combination", "of", "a", "season", "and", "episode", "number", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java#L201-L218
wildfly/wildfly-core
threads/src/main/java/org/jboss/as/threads/ThreadsParser.java
ThreadsParser.nextElement
private static Element nextElement(XMLExtendedStreamReader reader, String expectedNamespace) throws XMLStreamException { Element element = Element.forName(reader.getLocalName()); if (element == null) { return element; } else if (expectedNamespace.equals(reader.getNamespaceURI())) { return element; } throw unexpectedElement(reader); }
java
private static Element nextElement(XMLExtendedStreamReader reader, String expectedNamespace) throws XMLStreamException { Element element = Element.forName(reader.getLocalName()); if (element == null) { return element; } else if (expectedNamespace.equals(reader.getNamespaceURI())) { return element; } throw unexpectedElement(reader); }
[ "private", "static", "Element", "nextElement", "(", "XMLExtendedStreamReader", "reader", ",", "String", "expectedNamespace", ")", "throws", "XMLStreamException", "{", "Element", "element", "=", "Element", ".", "forName", "(", "reader", ".", "getLocalName", "(", ")",...
A variation of nextElement that verifies the nextElement is not in a different namespace. @param reader the XmlExtendedReader to read from. @param expectedNamespace the namespace expected. @return the element or null if the end is reached @throws XMLStreamException if the namespace is wrong or there is a problem accessing the reader
[ "A", "variation", "of", "nextElement", "that", "verifies", "the", "nextElement", "is", "not", "in", "a", "different", "namespace", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/threads/src/main/java/org/jboss/as/threads/ThreadsParser.java#L890-L900
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.rotateByAxis
public void rotateByAxis(float angle, float x, float y, float z) { getTransform().rotateByAxis(angle, x, y, z); if (mTransformCache.rotateByAxis(angle, x, y, z)) { onTransformChanged(); } }
java
public void rotateByAxis(float angle, float x, float y, float z) { getTransform().rotateByAxis(angle, x, y, z); if (mTransformCache.rotateByAxis(angle, x, y, z)) { onTransformChanged(); } }
[ "public", "void", "rotateByAxis", "(", "float", "angle", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "getTransform", "(", ")", ".", "rotateByAxis", "(", "angle", ",", "x", ",", "y", ",", "z", ")", ";", "if", "(", "mTransformC...
Modify the widget's current rotation in angle/axis terms. @param angle Angle of rotation in degrees. @param x 'X' component of the axis. @param y 'Y' component of the axis. @param z 'Z' component of the axis.
[ "Modify", "the", "widget", "s", "current", "rotation", "in", "angle", "/", "axis", "terms", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1638-L1643
codelibs/jcifs
src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java
NtlmPasswordAuthentication.E
private static void E( byte[] key, byte[] data, byte[] e ) { byte[] key7 = new byte[7]; byte[] e8 = new byte[8]; for( int i = 0; i < key.length / 7; i++ ) { System.arraycopy( key, i * 7, key7, 0, 7 ); DES des = new DES( key7 ); des.encrypt( data, e8 ); System.arraycopy( e8, 0, e, i * 8, 8 ); } }
java
private static void E( byte[] key, byte[] data, byte[] e ) { byte[] key7 = new byte[7]; byte[] e8 = new byte[8]; for( int i = 0; i < key.length / 7; i++ ) { System.arraycopy( key, i * 7, key7, 0, 7 ); DES des = new DES( key7 ); des.encrypt( data, e8 ); System.arraycopy( e8, 0, e, i * 8, 8 ); } }
[ "private", "static", "void", "E", "(", "byte", "[", "]", "key", ",", "byte", "[", "]", "data", ",", "byte", "[", "]", "e", ")", "{", "byte", "[", "]", "key7", "=", "new", "byte", "[", "7", "]", ";", "byte", "[", "]", "e8", "=", "new", "byte...
/* Accepts key multiple of 7 Returns enc multiple of 8 Multiple is the same like: 21 byte key gives 24 byte result
[ "/", "*", "Accepts", "key", "multiple", "of", "7", "Returns", "enc", "multiple", "of", "8", "Multiple", "is", "the", "same", "like", ":", "21", "byte", "key", "gives", "24", "byte", "result" ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java#L62-L72
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/TemplatesApi.java
TemplatesApi.updateRecipients
public RecipientsUpdateSummary updateRecipients(String accountId, String templateId, TemplateRecipients templateRecipients) throws ApiException { return updateRecipients(accountId, templateId, templateRecipients, null); }
java
public RecipientsUpdateSummary updateRecipients(String accountId, String templateId, TemplateRecipients templateRecipients) throws ApiException { return updateRecipients(accountId, templateId, templateRecipients, null); }
[ "public", "RecipientsUpdateSummary", "updateRecipients", "(", "String", "accountId", ",", "String", "templateId", ",", "TemplateRecipients", "templateRecipients", ")", "throws", "ApiException", "{", "return", "updateRecipients", "(", "accountId", ",", "templateId", ",", ...
Updates recipients in a template. Updates recipients in a template. You can edit the following properties: &#x60;email&#x60;, &#x60;userName&#x60;, &#x60;routingOrder&#x60;, &#x60;faxNumber&#x60;, &#x60;deliveryMethod&#x60;, &#x60;accessCode&#x60;, and &#x60;requireIdLookup&#x60;. @param accountId The external account number (int) or account ID Guid. (required) @param templateId The ID of the template being accessed. (required) @param templateRecipients (optional) @return RecipientsUpdateSummary
[ "Updates", "recipients", "in", "a", "template", ".", "Updates", "recipients", "in", "a", "template", ".", "You", "can", "edit", "the", "following", "properties", ":", "&#x60", ";", "email&#x60", ";", "&#x60", ";", "userName&#x60", ";", "&#x60", ";", "routing...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L3358-L3360
spring-projects/spring-retry
src/main/java/org/springframework/retry/support/RetrySimulator.java
RetrySimulator.executeSingleSimulation
public List<Long> executeSingleSimulation() { StealingSleeper stealingSleeper = new StealingSleeper(); SleepingBackOffPolicy<?> stealingBackoff = backOffPolicy .withSleeper(stealingSleeper); RetryTemplate template = new RetryTemplate(); template.setBackOffPolicy(stealingBackoff); template.setRetryPolicy(retryPolicy); try { template.execute(new FailingRetryCallback()); } catch (FailingRetryException e) { } catch (Throwable e) { throw new RuntimeException("Unexpected exception", e); } return stealingSleeper.getSleeps(); }
java
public List<Long> executeSingleSimulation() { StealingSleeper stealingSleeper = new StealingSleeper(); SleepingBackOffPolicy<?> stealingBackoff = backOffPolicy .withSleeper(stealingSleeper); RetryTemplate template = new RetryTemplate(); template.setBackOffPolicy(stealingBackoff); template.setRetryPolicy(retryPolicy); try { template.execute(new FailingRetryCallback()); } catch (FailingRetryException e) { } catch (Throwable e) { throw new RuntimeException("Unexpected exception", e); } return stealingSleeper.getSleeps(); }
[ "public", "List", "<", "Long", ">", "executeSingleSimulation", "(", ")", "{", "StealingSleeper", "stealingSleeper", "=", "new", "StealingSleeper", "(", ")", ";", "SleepingBackOffPolicy", "<", "?", ">", "stealingBackoff", "=", "backOffPolicy", ".", "withSleeper", "...
Execute a single simulation @return The sleeps which occurred within the single simulation.
[ "Execute", "a", "single", "simulation" ]
train
https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/retry/support/RetrySimulator.java#L79-L99
ineunetOS/knife-commons
knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java
StringUtils.ordinalIndexOf
public static int ordinalIndexOf(String str, String searchStr, int ordinal) { return ordinalIndexOf(str, searchStr, ordinal, false); }
java
public static int ordinalIndexOf(String str, String searchStr, int ordinal) { return ordinalIndexOf(str, searchStr, ordinal, false); }
[ "public", "static", "int", "ordinalIndexOf", "(", "String", "str", ",", "String", "searchStr", ",", "int", "ordinal", ")", "{", "return", "ordinalIndexOf", "(", "str", ",", "searchStr", ",", "ordinal", ",", "false", ")", ";", "}" ]
<p>Finds the n-th index within a String, handling <code>null</code>. This method uses {@link String#indexOf(String)}.</p> <p>A <code>null</code> String will return <code>-1</code>.</p> <pre> StringUtils.ordinalIndexOf(null, *, *) = -1 StringUtils.ordinalIndexOf(*, null, *) = -1 StringUtils.ordinalIndexOf("", "", *) = 0 StringUtils.ordinalIndexOf("aabaabaa", "a", 1) = 0 StringUtils.ordinalIndexOf("aabaabaa", "a", 2) = 1 StringUtils.ordinalIndexOf("aabaabaa", "b", 1) = 2 StringUtils.ordinalIndexOf("aabaabaa", "b", 2) = 5 StringUtils.ordinalIndexOf("aabaabaa", "ab", 1) = 1 StringUtils.ordinalIndexOf("aabaabaa", "ab", 2) = 4 StringUtils.ordinalIndexOf("aabaabaa", "", 1) = 0 StringUtils.ordinalIndexOf("aabaabaa", "", 2) = 0 </pre> <p>Note that 'head(String str, int n)' may be implemented as: </p> <pre> str.substring(0, lastOrdinalIndexOf(str, "\n", n)) </pre> @param str the String to check, may be null @param searchStr the String to find, may be null @param ordinal the n-th <code>searchStr</code> to find @return the n-th index of the search String, <code>-1</code> (<code>INDEX_NOT_FOUND</code>) if no match or <code>null</code> string input @since 2.1
[ "<p", ">", "Finds", "the", "n", "-", "th", "index", "within", "a", "String", "handling", "<code", ">", "null<", "/", "code", ">", ".", "This", "method", "uses", "{", "@link", "String#indexOf", "(", "String", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java#L779-L781
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.executeUpdate
public int executeUpdate(final String sql, final String[] columnNames) throws SQLException { return executeUpdate(sql, Statement.RETURN_GENERATED_KEYS); }
java
public int executeUpdate(final String sql, final String[] columnNames) throws SQLException { return executeUpdate(sql, Statement.RETURN_GENERATED_KEYS); }
[ "public", "int", "executeUpdate", "(", "final", "String", "sql", ",", "final", "String", "[", "]", "columnNames", ")", "throws", "SQLException", "{", "return", "executeUpdate", "(", "sql", ",", "Statement", ".", "RETURN_GENERATED_KEYS", ")", ";", "}" ]
Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the SQL statement is not an <code>INSERT</code> statement, or an SQL statement able to return auto-generated keys (the list of such statements is vendor-specific). @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or <code>DELETE</code>; or an SQL statement that returns nothing, such as a DDL statement. @param columnNames an array of the names of the columns that should be returned from the inserted row @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, or <code>DELETE</code> statements, or 0 for SQL statements that return nothing @throws SQLException if a database access error occurs, this method is called on a closed <code>Statement</code>, the SQL statement returns a <code>ResultSet</code> object, or the second argument supplied to this method is not a <code>String</code> array whose elements are valid column names
[ "Executes", "the", "given", "SQL", "statement", "and", "signals", "the", "driver", "that", "the", "auto", "-", "generated", "keys", "indicated", "in", "the", "given", "array", "should", "be", "made", "available", "for", "retrieval", ".", "This", "array", "co...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L604-L606
JoeKerouac/utils
src/main/java/com/joe/utils/secure/impl/SignatureUtilImpl.java
SignatureUtilImpl.buildInstance
public static SignatureUtil buildInstance(String privateKey, String publicKey, Algorithms algorithms) { return new SignatureUtilImpl(privateKey, publicKey, algorithms); }
java
public static SignatureUtil buildInstance(String privateKey, String publicKey, Algorithms algorithms) { return new SignatureUtilImpl(privateKey, publicKey, algorithms); }
[ "public", "static", "SignatureUtil", "buildInstance", "(", "String", "privateKey", ",", "String", "publicKey", ",", "Algorithms", "algorithms", ")", "{", "return", "new", "SignatureUtilImpl", "(", "privateKey", ",", "publicKey", ",", "algorithms", ")", ";", "}" ]
构建一个SignatureUtil @param privateKey PKCS8文件格式的私钥 @param publicKey X509格式的公钥 @param algorithms RSA加密类型 @return SignatureUtil
[ "构建一个SignatureUtil" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/secure/impl/SignatureUtilImpl.java#L67-L70
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/Months.java
Months.ofYears
public static Months ofYears(int years) { if (years == 0) { return ZERO; } return new Months(Math.multiplyExact(years, MONTHS_PER_YEAR)); }
java
public static Months ofYears(int years) { if (years == 0) { return ZERO; } return new Months(Math.multiplyExact(years, MONTHS_PER_YEAR)); }
[ "public", "static", "Months", "ofYears", "(", "int", "years", ")", "{", "if", "(", "years", "==", "0", ")", "{", "return", "ZERO", ";", "}", "return", "new", "Months", "(", "Math", ".", "multiplyExact", "(", "years", ",", "MONTHS_PER_YEAR", ")", ")", ...
Obtains a {@code Months} representing the number of months equivalent to a number of years. <p> The resulting amount will be month-based, with the number of months equal to the number of years multiplied by 12. @param years the number of years, positive or negative @return the amount with the input years converted to months, not null @throws ArithmeticException if numeric overflow occurs
[ "Obtains", "a", "{", "@code", "Months", "}", "representing", "the", "number", "of", "months", "equivalent", "to", "a", "number", "of", "years", ".", "<p", ">", "The", "resulting", "amount", "will", "be", "month", "-", "based", "with", "the", "number", "o...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/Months.java#L129-L134
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getDurationInSeconds
public long getDurationInSeconds(String name, long defaultValue) { TimeUnit timeUnit = extractTimeUnit(name, defaultValue + " SECONDS"); long duration = getLong(name, defaultValue); return timeUnit.toSeconds(duration); }
java
public long getDurationInSeconds(String name, long defaultValue) { TimeUnit timeUnit = extractTimeUnit(name, defaultValue + " SECONDS"); long duration = getLong(name, defaultValue); return timeUnit.toSeconds(duration); }
[ "public", "long", "getDurationInSeconds", "(", "String", "name", ",", "long", "defaultValue", ")", "{", "TimeUnit", "timeUnit", "=", "extractTimeUnit", "(", "name", ",", "defaultValue", "+", "\" SECONDS\"", ")", ";", "long", "duration", "=", "getLong", "(", "n...
Gets the duration setting and converts it to seconds. <p/> The setting must be use one of the following conventions: <ul> <li>n MILLISECONDS <li>n SECONDS <li>n MINUTES <li>n HOURS <li>n DAYS </ul> @param name @param defaultValue in seconds @return seconds
[ "Gets", "the", "duration", "setting", "and", "converts", "it", "to", "seconds", ".", "<p", "/", ">", "The", "setting", "must", "be", "use", "one", "of", "the", "following", "conventions", ":", "<ul", ">", "<li", ">", "n", "MILLISECONDS", "<li", ">", "n...
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L845-L850
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsDateTimeWithDefault
public ZonedDateTime getAsDateTimeWithDefault(String key, ZonedDateTime defaultValue) { Object value = getAsObject(key); return DateTimeConverter.toDateTimeWithDefault(value, defaultValue); }
java
public ZonedDateTime getAsDateTimeWithDefault(String key, ZonedDateTime defaultValue) { Object value = getAsObject(key); return DateTimeConverter.toDateTimeWithDefault(value, defaultValue); }
[ "public", "ZonedDateTime", "getAsDateTimeWithDefault", "(", "String", "key", ",", "ZonedDateTime", "defaultValue", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "DateTimeConverter", ".", "toDateTimeWithDefault", "(", "value", ",", ...
Converts map element into a Date or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return ZonedDateTime value of the element or default value if conversion is not supported. @see DateTimeConverter#toDateTimeWithDefault(Object, ZonedDateTime)
[ "Converts", "map", "element", "into", "a", "Date", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L419-L422
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java
Start.setOption
private void setOption(String opt, List<String> arguments) { String[] args = new String[arguments.length() + 1]; int k = 0; args[k++] = opt; for (List<String> i = arguments; i.nonEmpty(); i=i.tail) { args[k++] = i.head; } options.append(args); }
java
private void setOption(String opt, List<String> arguments) { String[] args = new String[arguments.length() + 1]; int k = 0; args[k++] = opt; for (List<String> i = arguments; i.nonEmpty(); i=i.tail) { args[k++] = i.head; } options.append(args); }
[ "private", "void", "setOption", "(", "String", "opt", ",", "List", "<", "String", ">", "arguments", ")", "{", "String", "[", "]", "args", "=", "new", "String", "[", "arguments", ".", "length", "(", ")", "+", "1", "]", ";", "int", "k", "=", "0", "...
indicate an option with the specified list of arguments was given.
[ "indicate", "an", "option", "with", "the", "specified", "list", "of", "arguments", "was", "given", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java#L561-L569
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java
SARLHoverSignatureProvider._signature
protected String _signature(XCastedExpression castExpression, boolean typeAtEnd) { if (castExpression instanceof SarlCastedExpression) { final JvmOperation delegate = ((SarlCastedExpression) castExpression).getFeature(); if (delegate != null) { return _signature(delegate, typeAtEnd); } } return MessageFormat.format(Messages.SARLHoverSignatureProvider_0, getTypeName(castExpression.getType())); }
java
protected String _signature(XCastedExpression castExpression, boolean typeAtEnd) { if (castExpression instanceof SarlCastedExpression) { final JvmOperation delegate = ((SarlCastedExpression) castExpression).getFeature(); if (delegate != null) { return _signature(delegate, typeAtEnd); } } return MessageFormat.format(Messages.SARLHoverSignatureProvider_0, getTypeName(castExpression.getType())); }
[ "protected", "String", "_signature", "(", "XCastedExpression", "castExpression", ",", "boolean", "typeAtEnd", ")", "{", "if", "(", "castExpression", "instanceof", "SarlCastedExpression", ")", "{", "final", "JvmOperation", "delegate", "=", "(", "(", "SarlCastedExpressi...
Replies the hover for a SARL casted expression. @param castExpression the casted expression. @param typeAtEnd indicates if the type should be put at end. @return the string representation into the hover.
[ "Replies", "the", "hover", "for", "a", "SARL", "casted", "expression", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/hover/SARLHoverSignatureProvider.java#L245-L254
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.resultSubtype
public boolean resultSubtype(Type t, Type s, Warner warner) { List<Type> tvars = t.getTypeArguments(); List<Type> svars = s.getTypeArguments(); Type tres = t.getReturnType(); Type sres = subst(s.getReturnType(), svars, tvars); return covariantReturnType(tres, sres, warner); }
java
public boolean resultSubtype(Type t, Type s, Warner warner) { List<Type> tvars = t.getTypeArguments(); List<Type> svars = s.getTypeArguments(); Type tres = t.getReturnType(); Type sres = subst(s.getReturnType(), svars, tvars); return covariantReturnType(tres, sres, warner); }
[ "public", "boolean", "resultSubtype", "(", "Type", "t", ",", "Type", "s", ",", "Warner", "warner", ")", "{", "List", "<", "Type", ">", "tvars", "=", "t", ".", "getTypeArguments", "(", ")", ";", "List", "<", "Type", ">", "svars", "=", "s", ".", "get...
Does t have a result that is a subtype of the result type of s, suitable for covariant returns? It is assumed that both types are (possibly polymorphic) method types. Monomorphic method types are handled in the obvious way. Polymorphic method types require renaming all type variables of one to corresponding type variables in the other, where correspondence is by position in the type parameter list.
[ "Does", "t", "have", "a", "result", "that", "is", "a", "subtype", "of", "the", "result", "type", "of", "s", "suitable", "for", "covariant", "returns?", "It", "is", "assumed", "that", "both", "types", "are", "(", "possibly", "polymorphic", ")", "method", ...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L3965-L3971
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/dragdrop/DragUtils.java
DragUtils.setDragData
public static void setDragData( Object source, Object data ) { DragUtils.source = source; DragUtils.data = data; }
java
public static void setDragData( Object source, Object data ) { DragUtils.source = source; DragUtils.data = data; }
[ "public", "static", "void", "setDragData", "(", "Object", "source", ",", "Object", "data", ")", "{", "DragUtils", ".", "source", "=", "source", ";", "DragUtils", ".", "data", "=", "data", ";", "}" ]
Sets the drag and drop data and its source @param source @param data
[ "Sets", "the", "drag", "and", "drop", "data", "and", "its", "source" ]
train
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/dragdrop/DragUtils.java#L30-L34
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfCopyForms.java
PdfCopyForms.setEncryption
public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, boolean strength128Bits) throws DocumentException { fc.setEncryption(userPassword, ownerPassword, permissions, strength128Bits ? PdfWriter.STANDARD_ENCRYPTION_128 : PdfWriter.STANDARD_ENCRYPTION_40); }
java
public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, boolean strength128Bits) throws DocumentException { fc.setEncryption(userPassword, ownerPassword, permissions, strength128Bits ? PdfWriter.STANDARD_ENCRYPTION_128 : PdfWriter.STANDARD_ENCRYPTION_40); }
[ "public", "void", "setEncryption", "(", "byte", "userPassword", "[", "]", ",", "byte", "ownerPassword", "[", "]", ",", "int", "permissions", ",", "boolean", "strength128Bits", ")", "throws", "DocumentException", "{", "fc", ".", "setEncryption", "(", "userPasswor...
Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them. @param userPassword the user password. Can be null or empty @param ownerPassword the owner password. Can be null or empty @param permissions the user permissions @param strength128Bits <code>true</code> for 128 bit key length, <code>false</code> for 40 bit key length @throws DocumentException if the document is already open
[ "Sets", "the", "encryption", "options", "for", "this", "document", ".", "The", "userPassword", "and", "the", "ownerPassword", "can", "be", "null", "or", "have", "zero", "length", ".", "In", "this", "case", "the", "ownerPassword", "is", "replaced", "by", "a",...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCopyForms.java#L137-L139
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/ColumnDefinition.java
ColumnDefinition.deleteFromSchema
public void deleteFromSchema(Mutation mutation, long timestamp) { ColumnFamily cf = mutation.addOrGet(CFMetaData.SchemaColumnsCf); int ldt = (int) (System.currentTimeMillis() / 1000); // Note: we do want to use name.toString(), not name.bytes directly for backward compatibility (For CQL3, this won't make a difference). Composite prefix = CFMetaData.SchemaColumnsCf.comparator.make(cfName, name.toString()); cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt)); }
java
public void deleteFromSchema(Mutation mutation, long timestamp) { ColumnFamily cf = mutation.addOrGet(CFMetaData.SchemaColumnsCf); int ldt = (int) (System.currentTimeMillis() / 1000); // Note: we do want to use name.toString(), not name.bytes directly for backward compatibility (For CQL3, this won't make a difference). Composite prefix = CFMetaData.SchemaColumnsCf.comparator.make(cfName, name.toString()); cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt)); }
[ "public", "void", "deleteFromSchema", "(", "Mutation", "mutation", ",", "long", "timestamp", ")", "{", "ColumnFamily", "cf", "=", "mutation", ".", "addOrGet", "(", "CFMetaData", ".", "SchemaColumnsCf", ")", ";", "int", "ldt", "=", "(", "int", ")", "(", "Sy...
Drop specified column from the schema using given mutation. @param mutation The schema mutation @param timestamp The timestamp to use for column modification
[ "Drop", "specified", "column", "from", "the", "schema", "using", "given", "mutation", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/ColumnDefinition.java#L316-L324
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/QueryFactory.java
QueryFactory.newReportQuery
public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, Criteria criteria, boolean distinct) { criteria = addCriteriaForOjbConcreteClasses(getRepository().getDescriptorFor(classToSearchFrom), criteria); return newReportQuery(classToSearchFrom, null, criteria, distinct); }
java
public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, Criteria criteria, boolean distinct) { criteria = addCriteriaForOjbConcreteClasses(getRepository().getDescriptorFor(classToSearchFrom), criteria); return newReportQuery(classToSearchFrom, null, criteria, distinct); }
[ "public", "static", "ReportQueryByCriteria", "newReportQuery", "(", "Class", "classToSearchFrom", ",", "Criteria", "criteria", ",", "boolean", "distinct", ")", "{", "criteria", "=", "addCriteriaForOjbConcreteClasses", "(", "getRepository", "(", ")", ".", "getDescriptorF...
create a new ReportQueryByCriteria @param classToSearchFrom @param criteria @param distinct @return ReportQueryByCriteria
[ "create", "a", "new", "ReportQueryByCriteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/QueryFactory.java#L59-L63
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java
RelatedTablesCoreExtension.addTilesRelationship
public ExtendedRelation addTilesRelationship(String baseTableName, TileTable tileTable, String mappingTableName) { return addRelationship(baseTableName, tileTable, mappingTableName); }
java
public ExtendedRelation addTilesRelationship(String baseTableName, TileTable tileTable, String mappingTableName) { return addRelationship(baseTableName, tileTable, mappingTableName); }
[ "public", "ExtendedRelation", "addTilesRelationship", "(", "String", "baseTableName", ",", "TileTable", "tileTable", ",", "String", "mappingTableName", ")", "{", "return", "addRelationship", "(", "baseTableName", ",", "tileTable", ",", "mappingTableName", ")", ";", "}...
Adds a tiles relationship between the base table and user tiles related table. Creates a default user mapping table and the tile table if needed. @param baseTableName base table name @param tileTable user tile table @param mappingTableName user mapping table name @return The relationship that was added @since 3.2.0
[ "Adds", "a", "tiles", "relationship", "between", "the", "base", "table", "and", "user", "tiles", "related", "table", ".", "Creates", "a", "default", "user", "mapping", "table", "and", "the", "tile", "table", "if", "needed", "." ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java#L716-L719
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/TaxonomiesParser.java
TaxonomiesParser.getTaxonomy
private JSONObject getTaxonomy(final JSONArray taxonomies, final int index) { JSONObject object = new JSONObject(); try { object = (JSONObject) taxonomies.get(index); } catch(JSONException e) { e.printStackTrace(); } return object; }
java
private JSONObject getTaxonomy(final JSONArray taxonomies, final int index) { JSONObject object = new JSONObject(); try { object = (JSONObject) taxonomies.get(index); } catch(JSONException e) { e.printStackTrace(); } return object; }
[ "private", "JSONObject", "getTaxonomy", "(", "final", "JSONArray", "taxonomies", ",", "final", "int", "index", ")", "{", "JSONObject", "object", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "object", "=", "(", "JSONObject", ")", "taxonomies", ".", ...
Return a json object from the provided array. Return an empty object if there is any problems fetching the taxonomy data. @param taxonomies array of taxonomy data @param index of the object to fetch @return json object from the provided array
[ "Return", "a", "json", "object", "from", "the", "provided", "array", ".", "Return", "an", "empty", "object", "if", "there", "is", "any", "problems", "fetching", "the", "taxonomy", "data", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/TaxonomiesParser.java#L61-L70
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.pixelXToLongitude
public static double pixelXToLongitude(double pixelX, long mapSize) { if (pixelX < 0 || pixelX > mapSize) { throw new IllegalArgumentException("invalid pixelX coordinate " + mapSize + ": " + pixelX); } return 360 * ((pixelX / mapSize) - 0.5); }
java
public static double pixelXToLongitude(double pixelX, long mapSize) { if (pixelX < 0 || pixelX > mapSize) { throw new IllegalArgumentException("invalid pixelX coordinate " + mapSize + ": " + pixelX); } return 360 * ((pixelX / mapSize) - 0.5); }
[ "public", "static", "double", "pixelXToLongitude", "(", "double", "pixelX", ",", "long", "mapSize", ")", "{", "if", "(", "pixelX", "<", "0", "||", "pixelX", ">", "mapSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"invalid pixelX coordinate \...
Converts a pixel X coordinate at a certain map size to a longitude coordinate. @param pixelX the pixel X coordinate that should be converted. @param mapSize precomputed size of map. @return the longitude value of the pixel X coordinate. @throws IllegalArgumentException if the given pixelX coordinate is invalid.
[ "Converts", "a", "pixel", "X", "coordinate", "at", "a", "certain", "map", "size", "to", "a", "longitude", "coordinate", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L353-L358
phoenixnap/springmvc-raml-plugin
src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java
RamlHelper.getFirstAuthorizationGrant
public static String getFirstAuthorizationGrant(RamlAction action, RamlRoot document) { List<String> grants = getAuthorizationGrants(action, document); if (grants.isEmpty()) { return null; } return grants.get(0); }
java
public static String getFirstAuthorizationGrant(RamlAction action, RamlRoot document) { List<String> grants = getAuthorizationGrants(action, document); if (grants.isEmpty()) { return null; } return grants.get(0); }
[ "public", "static", "String", "getFirstAuthorizationGrant", "(", "RamlAction", "action", ",", "RamlRoot", "document", ")", "{", "List", "<", "String", ">", "grants", "=", "getAuthorizationGrants", "(", "action", ",", "document", ")", ";", "if", "(", "grants", ...
Returns authorization grant for provided action. It searches for authorization grants defined for provided action, some of parent resources or the root of the document. If authorization grants found is a list - the method will return the first grant in the list. @param action action to find grant for @param document root raml document @return first grant found, null otherwise
[ "Returns", "authorization", "grant", "for", "provided", "action", ".", "It", "searches", "for", "authorization", "grants", "defined", "for", "provided", "action", "some", "of", "parent", "resources", "or", "the", "root", "of", "the", "document", ".", "If", "au...
train
https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlHelper.java#L63-L69
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/statistics/DefaultTierStatistics.java
DefaultTierStatistics.addIfPresent
private static <T extends Number> void addIfPresent(Map<String, ValueStatistic<?>> knownStatistics, String name, OperationStatistic<?> reference, Supplier<T> valueSupplier) { if(!(reference instanceof ZeroOperationStatistic)) { knownStatistics.put(name, counter(valueSupplier)); } }
java
private static <T extends Number> void addIfPresent(Map<String, ValueStatistic<?>> knownStatistics, String name, OperationStatistic<?> reference, Supplier<T> valueSupplier) { if(!(reference instanceof ZeroOperationStatistic)) { knownStatistics.put(name, counter(valueSupplier)); } }
[ "private", "static", "<", "T", "extends", "Number", ">", "void", "addIfPresent", "(", "Map", "<", "String", ",", "ValueStatistic", "<", "?", ">", ">", "knownStatistics", ",", "String", "name", ",", "OperationStatistic", "<", "?", ">", "reference", ",", "Su...
Add the statistic as a known statistic only if the reference statistic is available. We consider that the reference statistic can only be an instance of {@code ZeroOperationStatistic} when statistics are disabled. @param knownStatistics map of known statistics @param name the name of the statistic to add @param reference the reference statistic that should be available for the statistic to be added @param valueSupplier the supplier that will provide the current value for the statistic @param <T> type of the supplied value
[ "Add", "the", "statistic", "as", "a", "known", "statistic", "only", "if", "the", "reference", "statistic", "is", "available", ".", "We", "consider", "that", "the", "reference", "statistic", "can", "only", "be", "an", "instance", "of", "{", "@code", "ZeroOper...
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/statistics/DefaultTierStatistics.java#L114-L118
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionThresholdVerifier.java
CompactionThresholdVerifier.verify
public Result verify (FileSystemDataset dataset) { Map<String, Double> thresholdMap = RecompactionConditionBasedOnRatio. getDatasetRegexAndRecompactThreshold (state.getProp(MRCompactor.COMPACTION_LATEDATA_THRESHOLD_FOR_RECOMPACT_PER_DATASET, StringUtils.EMPTY)); CompactionPathParser.CompactionParserResult result = new CompactionPathParser(state).parse(dataset); double threshold = RecompactionConditionBasedOnRatio.getRatioThresholdByDatasetName(result.getDatasetName(), thresholdMap); log.debug ("Threshold is {} for dataset {}", threshold, result.getDatasetName()); InputRecordCountHelper helper = new InputRecordCountHelper(state); try { double newRecords = helper.calculateRecordCount (Lists.newArrayList(new Path(dataset.datasetURN()))); double oldRecords = helper.readRecordCount (new Path(result.getDstAbsoluteDir())); if (oldRecords == 0) { return new Result(true, ""); } if ((newRecords - oldRecords) / oldRecords > threshold) { log.debug ("Dataset {} records exceeded the threshold {}", dataset.datasetURN(), threshold); return new Result(true, ""); } return new Result(false, String.format("%s is failed for dataset %s. Prev=%f, Cur=%f, not reaching to threshold %f", this.getName(), result.getDatasetName(), oldRecords, newRecords, threshold)); } catch (IOException e) { return new Result(false, ExceptionUtils.getFullStackTrace(e)); } }
java
public Result verify (FileSystemDataset dataset) { Map<String, Double> thresholdMap = RecompactionConditionBasedOnRatio. getDatasetRegexAndRecompactThreshold (state.getProp(MRCompactor.COMPACTION_LATEDATA_THRESHOLD_FOR_RECOMPACT_PER_DATASET, StringUtils.EMPTY)); CompactionPathParser.CompactionParserResult result = new CompactionPathParser(state).parse(dataset); double threshold = RecompactionConditionBasedOnRatio.getRatioThresholdByDatasetName(result.getDatasetName(), thresholdMap); log.debug ("Threshold is {} for dataset {}", threshold, result.getDatasetName()); InputRecordCountHelper helper = new InputRecordCountHelper(state); try { double newRecords = helper.calculateRecordCount (Lists.newArrayList(new Path(dataset.datasetURN()))); double oldRecords = helper.readRecordCount (new Path(result.getDstAbsoluteDir())); if (oldRecords == 0) { return new Result(true, ""); } if ((newRecords - oldRecords) / oldRecords > threshold) { log.debug ("Dataset {} records exceeded the threshold {}", dataset.datasetURN(), threshold); return new Result(true, ""); } return new Result(false, String.format("%s is failed for dataset %s. Prev=%f, Cur=%f, not reaching to threshold %f", this.getName(), result.getDatasetName(), oldRecords, newRecords, threshold)); } catch (IOException e) { return new Result(false, ExceptionUtils.getFullStackTrace(e)); } }
[ "public", "Result", "verify", "(", "FileSystemDataset", "dataset", ")", "{", "Map", "<", "String", ",", "Double", ">", "thresholdMap", "=", "RecompactionConditionBasedOnRatio", ".", "getDatasetRegexAndRecompactThreshold", "(", "state", ".", "getProp", "(", "MRCompacto...
There are two record count we are comparing here 1) The new record count in the input folder 2) The record count we compacted previously from last run Calculate two numbers difference and compare with a predefined threshold. (Alternatively we can save the previous record count to a state store. However each input folder is a dataset. We may end up with loading too many redundant job level state for each dataset. To avoid scalability issue, we choose a stateless approach where each dataset tracks record count by themselves and persist it in the file system) @return true iff the difference exceeds the threshold or this is the first time compaction
[ "There", "are", "two", "record", "count", "we", "are", "comparing", "here", "1", ")", "The", "new", "record", "count", "in", "the", "input", "folder", "2", ")", "The", "record", "count", "we", "compacted", "previously", "from", "last", "run", "Calculate", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionThresholdVerifier.java#L64-L92
codegist/crest
integration/server/src/main/java/org/codegist/crest/server/utils/AuthException.java
AuthException.toResponse
public static Response toResponse(Response.Status status, String wwwAuthHeader) { Response.ResponseBuilder rb = Response.status(status); if (wwwAuthHeader != null) { rb.header("WWW-Authenticate", wwwAuthHeader); } return rb.build(); }
java
public static Response toResponse(Response.Status status, String wwwAuthHeader) { Response.ResponseBuilder rb = Response.status(status); if (wwwAuthHeader != null) { rb.header("WWW-Authenticate", wwwAuthHeader); } return rb.build(); }
[ "public", "static", "Response", "toResponse", "(", "Response", ".", "Status", "status", ",", "String", "wwwAuthHeader", ")", "{", "Response", ".", "ResponseBuilder", "rb", "=", "Response", ".", "status", "(", "status", ")", ";", "if", "(", "wwwAuthHeader", "...
Maps this exception to a response object. @return Response this exception maps to.
[ "Maps", "this", "exception", "to", "a", "response", "object", "." ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/integration/server/src/main/java/org/codegist/crest/server/utils/AuthException.java#L41-L47
ixa-ehu/ixa-pipe-nerc
src/main/java/eus/ixa/ixa/pipe/nerc/NERTaggerServer.java
NERTaggerServer.sendDataToClient
private void sendDataToClient(BufferedWriter outToClient, String kafToString) throws IOException { outToClient.write(kafToString); outToClient.close(); }
java
private void sendDataToClient(BufferedWriter outToClient, String kafToString) throws IOException { outToClient.write(kafToString); outToClient.close(); }
[ "private", "void", "sendDataToClient", "(", "BufferedWriter", "outToClient", ",", "String", "kafToString", ")", "throws", "IOException", "{", "outToClient", ".", "write", "(", "kafToString", ")", ";", "outToClient", ".", "close", "(", ")", ";", "}" ]
Send data back to server after annotation. @param outToClient the outputstream to the client @param kafToString the string to be processed @throws IOException if io error
[ "Send", "data", "back", "to", "server", "after", "annotation", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-nerc/blob/299cb49348eb7650fef2ae47c73f6d3384b43c34/src/main/java/eus/ixa/ixa/pipe/nerc/NERTaggerServer.java#L168-L172
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java
AbstractManagedType.isMapAttribute
private boolean isMapAttribute(PluralAttribute<? super X, ?, ?> attribute) { return attribute != null && attribute.getCollectionType().equals(CollectionType.MAP); }
java
private boolean isMapAttribute(PluralAttribute<? super X, ?, ?> attribute) { return attribute != null && attribute.getCollectionType().equals(CollectionType.MAP); }
[ "private", "boolean", "isMapAttribute", "(", "PluralAttribute", "<", "?", "super", "X", ",", "?", ",", "?", ">", "attribute", ")", "{", "return", "attribute", "!=", "null", "&&", "attribute", ".", "getCollectionType", "(", ")", ".", "equals", "(", "Collect...
Checks if is map attribute. @param attribute the attribute @return true, if is map attribute
[ "Checks", "if", "is", "map", "attribute", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1063-L1066
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/animation/transformation/SizeTransform.java
SizeTransform.doTransform
@Override protected void doTransform(Size<T> transformable, float comp) { int fromWidth = reversed ? this.toWidth : this.fromWidth; int toWidth = reversed ? this.fromWidth : this.toWidth; int fromHeight = reversed ? this.toHeight : this.fromHeight; int toHeight = reversed ? this.fromHeight : this.toHeight; transformable.setSize((int) (fromWidth + (toWidth - fromWidth) * comp), (int) (fromHeight + (toHeight - fromHeight) * comp)); }
java
@Override protected void doTransform(Size<T> transformable, float comp) { int fromWidth = reversed ? this.toWidth : this.fromWidth; int toWidth = reversed ? this.fromWidth : this.toWidth; int fromHeight = reversed ? this.toHeight : this.fromHeight; int toHeight = reversed ? this.fromHeight : this.toHeight; transformable.setSize((int) (fromWidth + (toWidth - fromWidth) * comp), (int) (fromHeight + (toHeight - fromHeight) * comp)); }
[ "@", "Override", "protected", "void", "doTransform", "(", "Size", "<", "T", ">", "transformable", ",", "float", "comp", ")", "{", "int", "fromWidth", "=", "reversed", "?", "this", ".", "toWidth", ":", "this", ".", "fromWidth", ";", "int", "toWidth", "=",...
Calculates the transformation @param transformable the transformable @param comp the comp
[ "Calculates", "the", "transformation" ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/SizeTransform.java#L111-L120
knightliao/disconf
disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java
StringUtil.defaultIfEmpty
public static String defaultIfEmpty(String str, String defaultStr) { return str == null || str.length() == 0 ? defaultStr : str; }
java
public static String defaultIfEmpty(String str, String defaultStr) { return str == null || str.length() == 0 ? defaultStr : str; }
[ "public", "static", "String", "defaultIfEmpty", "(", "String", "str", ",", "String", "defaultStr", ")", "{", "return", "str", "==", "null", "||", "str", ".", "length", "(", ")", "==", "0", "?", "defaultStr", ":", "str", ";", "}" ]
如果字符串是<code>null</code>或空字符串<code>""</code>,则返回指定默认字符串,否则返回字符串本身。 <p/> <p/> <pre> StringUtil.defaultIfEmpty(null, "default") = "default" StringUtil.defaultIfEmpty("", "default") = "default" StringUtil.defaultIfEmpty(" ", "default") = " " StringUtil.defaultIfEmpty("bat", "default") = "bat" </pre> @param str 要转换的字符串 @param defaultStr 默认字符串 @return 字符串本身或指定的默认字符串
[ "如果字符串是<code", ">", "null<", "/", "code", ">", "或空字符串<code", ">", "<", "/", "code", ">", ",则返回指定默认字符串,否则返回字符串本身。", "<p", "/", ">", "<p", "/", ">", "<pre", ">", "StringUtil", ".", "defaultIfEmpty", "(", "null", "default", ")", "=", "default", "StringUtil", ...
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java#L119-L121
datasift/datasift-java
src/main/java/com/datasift/client/accounts/DataSiftAccount.java
DataSiftAccount.listTokens
public FutureData<TokenList> listTokens(String identity, int page, int perPage) { if (identity == null) { throw new IllegalArgumentException("An identity is required"); } FutureData<TokenList> future = new FutureData<>(); ParamBuilder b = newParams(); if (page > 0) { b.put("page", page); } if (perPage > 0) { b.put("per_page", perPage); } URI uri = b.forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/token")); Request request = config.http(). GET(uri, new PageReader(newRequestCallback(future, new TokenList(), config))); performRequest(future, request); return future; }
java
public FutureData<TokenList> listTokens(String identity, int page, int perPage) { if (identity == null) { throw new IllegalArgumentException("An identity is required"); } FutureData<TokenList> future = new FutureData<>(); ParamBuilder b = newParams(); if (page > 0) { b.put("page", page); } if (perPage > 0) { b.put("per_page", perPage); } URI uri = b.forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/token")); Request request = config.http(). GET(uri, new PageReader(newRequestCallback(future, new TokenList(), config))); performRequest(future, request); return future; }
[ "public", "FutureData", "<", "TokenList", ">", "listTokens", "(", "String", "identity", ",", "int", "page", ",", "int", "perPage", ")", "{", "if", "(", "identity", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"An identity is requi...
/* List tokens associated with an identity @param identity which identity you want to list the tokens of @param page page number (can be 0) @param perPage items per page (can be 0) @return List of identities
[ "/", "*", "List", "tokens", "associated", "with", "an", "identity" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/accounts/DataSiftAccount.java#L183-L200
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_specifications_network_GET
public OvhNetworkSpecifications serviceName_specifications_network_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/specifications/network"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetworkSpecifications.class); }
java
public OvhNetworkSpecifications serviceName_specifications_network_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/specifications/network"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetworkSpecifications.class); }
[ "public", "OvhNetworkSpecifications", "serviceName_specifications_network_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/specifications/network\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
Retrieve network informations about this dedicated server REST: GET /dedicated/server/{serviceName}/specifications/network @param serviceName [required] The internal name of your dedicated server
[ "Retrieve", "network", "informations", "about", "this", "dedicated", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1729-L1734
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/pascal/AcronymModel.java
AcronymModel.computeProb
public double computeProb(PascalTemplate temp) { double prob = 1.0; String wsname = temp.getValue("workshopname"); String confname = temp.getValue("conferencename"); String wsacronym = temp.getValue("workshopacronym"); String confacronym = temp.getValue("conferenceacronym"); String wsurl = temp.getValue("workshophomepage"); String confurl = temp.getValue("conferencehomepage"); return computeProb(wsname, wsacronym,confname,confacronym, wsurl, confurl); }
java
public double computeProb(PascalTemplate temp) { double prob = 1.0; String wsname = temp.getValue("workshopname"); String confname = temp.getValue("conferencename"); String wsacronym = temp.getValue("workshopacronym"); String confacronym = temp.getValue("conferenceacronym"); String wsurl = temp.getValue("workshophomepage"); String confurl = temp.getValue("conferencehomepage"); return computeProb(wsname, wsacronym,confname,confacronym, wsurl, confurl); }
[ "public", "double", "computeProb", "(", "PascalTemplate", "temp", ")", "{", "double", "prob", "=", "1.0", ";", "String", "wsname", "=", "temp", ".", "getValue", "(", "\"workshopname\"", ")", ";", "String", "confname", "=", "temp", ".", "getValue", "(", "\"...
Scores the {@link PascalTemplate} using the fields it contains which are relevant to the score. (Ignores location and date fields.) @param temp the full {@link PascalTemplate} to be scored @return the model's score
[ "Scores", "the", "{" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/pascal/AcronymModel.java#L104-L114
linkhub-sdk/popbill.sdk.java
src/main/java/com/popbill/api/taxinvoice/TaxinvoiceServiceImp.java
TaxinvoiceServiceImp.sendFAX
@Override public Response sendFAX(String CorpNum, MgtKeyType KeyType, String MgtKey, String Sender, String Receiver) throws PopbillException { return sendFAX(CorpNum, KeyType, MgtKey, Sender, Receiver, null); }
java
@Override public Response sendFAX(String CorpNum, MgtKeyType KeyType, String MgtKey, String Sender, String Receiver) throws PopbillException { return sendFAX(CorpNum, KeyType, MgtKey, Sender, Receiver, null); }
[ "@", "Override", "public", "Response", "sendFAX", "(", "String", "CorpNum", ",", "MgtKeyType", "KeyType", ",", "String", "MgtKey", ",", "String", "Sender", ",", "String", "Receiver", ")", "throws", "PopbillException", "{", "return", "sendFAX", "(", "CorpNum", ...
/* (non-Javadoc) @see com.popbill.api.TaxinvoiceService#sendFAX(java.lang.String, com.popbill.api.taxinvoice.MgtKeyType, java.lang.String, java.lang.String, java.lang.String)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/taxinvoice/TaxinvoiceServiceImp.java#L599-L603
gwtbootstrap3/gwtbootstrap3
gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/Column.java
Column.setSize
public void setSize(final ColumnSize firstSize, final ColumnSize... otherSizes) { addEnumVarargsValues(new ColumnSize[]{firstSize}, ColumnSize.class, true); addEnumVarargsValues(otherSizes, ColumnSize.class, false); }
java
public void setSize(final ColumnSize firstSize, final ColumnSize... otherSizes) { addEnumVarargsValues(new ColumnSize[]{firstSize}, ColumnSize.class, true); addEnumVarargsValues(otherSizes, ColumnSize.class, false); }
[ "public", "void", "setSize", "(", "final", "ColumnSize", "firstSize", ",", "final", "ColumnSize", "...", "otherSizes", ")", "{", "addEnumVarargsValues", "(", "new", "ColumnSize", "[", "]", "{", "firstSize", "}", ",", "ColumnSize", ".", "class", ",", "true", ...
Adds one or more additional column sizes. @param firstSize Column size @param otherSizes Additional column sizes
[ "Adds", "one", "or", "more", "additional", "column", "sizes", "." ]
train
https://github.com/gwtbootstrap3/gwtbootstrap3/blob/54bdbd0b12ba7a436b278c007df960d1adf2e641/gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/Column.java#L98-L101
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
MapView.setSize
public void setSize(int newWidth, int newHeight) { saveState(); Bbox bbox = getBounds(); if (width != newWidth || height != newHeight) { this.width = newWidth; this.height = newHeight; if (viewState.getScale() < getMinimumScale()) { // The new scale is too low, re-apply old values: double scale = getBestScale(bbox); doSetScale(snapToResolution(scale, ZoomOption.LEVEL_FIT)); } // Use the same center point for the new bounds doSetOrigin(bbox.getCenterPoint()); fireEvent(true, null); } }
java
public void setSize(int newWidth, int newHeight) { saveState(); Bbox bbox = getBounds(); if (width != newWidth || height != newHeight) { this.width = newWidth; this.height = newHeight; if (viewState.getScale() < getMinimumScale()) { // The new scale is too low, re-apply old values: double scale = getBestScale(bbox); doSetScale(snapToResolution(scale, ZoomOption.LEVEL_FIT)); } // Use the same center point for the new bounds doSetOrigin(bbox.getCenterPoint()); fireEvent(true, null); } }
[ "public", "void", "setSize", "(", "int", "newWidth", ",", "int", "newHeight", ")", "{", "saveState", "(", ")", ";", "Bbox", "bbox", "=", "getBounds", "(", ")", ";", "if", "(", "width", "!=", "newWidth", "||", "height", "!=", "newHeight", ")", "{", "t...
Set the size of the map in pixels. @param newWidth The map's width. @param newHeight The map's height.
[ "Set", "the", "size", "of", "the", "map", "in", "pixels", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L306-L321
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/dest/table/AbstractTabularWriter.java
AbstractTabularWriter.writeValue
@Override public final void writeValue(Value inValue, Format inFormat) throws TabularWriterException { this.valueVisitor.setFormat(inFormat); inValue.accept(this.valueVisitor); TabularWriterException exception = this.valueVisitor.getException(); this.valueVisitor.clear(); if (exception != null) { throw exception; } }
java
@Override public final void writeValue(Value inValue, Format inFormat) throws TabularWriterException { this.valueVisitor.setFormat(inFormat); inValue.accept(this.valueVisitor); TabularWriterException exception = this.valueVisitor.getException(); this.valueVisitor.clear(); if (exception != null) { throw exception; } }
[ "@", "Override", "public", "final", "void", "writeValue", "(", "Value", "inValue", ",", "Format", "inFormat", ")", "throws", "TabularWriterException", "{", "this", ".", "valueVisitor", ".", "setFormat", "(", "inFormat", ")", ";", "inValue", ".", "accept", "(",...
Writes the provided value, taking into account the type of value that it is and the provided formatter. @param inValue the value to write. Cannot be <code>null</code>. @param inFormat the formatter to use. @throws TabularWriterException if an error occurs trying to write the value.
[ "Writes", "the", "provided", "value", "taking", "into", "account", "the", "type", "of", "value", "that", "it", "is", "and", "the", "provided", "formatter", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/dest/table/AbstractTabularWriter.java#L119-L128
akquinet/needle
src/main/java/de/akquinet/jbosscc/needle/db/operation/hsql/HSQLDeleteOperation.java
HSQLDeleteOperation.deleteContent
protected void deleteContent(final List<String> tables, final Statement statement) throws SQLException { final ArrayList<String> tempTables = new ArrayList<String>(tables); // Loop until all data is deleted: we don't know the correct DROP // order, so we have to retry upon failure while (!tempTables.isEmpty()) { final int sizeBefore = tempTables.size(); for (final ListIterator<String> iterator = tempTables.listIterator(); iterator.hasNext();) { final String table = iterator.next(); try { statement.executeUpdate("DELETE FROM " + table); iterator.remove(); } catch (final SQLException exc) { LOG.warn("Ignored exception: " + exc.getMessage() + ". WILL RETRY."); } } if (tempTables.size() == sizeBefore) { throw new AssertionError("unable to clean tables " + tempTables); } } }
java
protected void deleteContent(final List<String> tables, final Statement statement) throws SQLException { final ArrayList<String> tempTables = new ArrayList<String>(tables); // Loop until all data is deleted: we don't know the correct DROP // order, so we have to retry upon failure while (!tempTables.isEmpty()) { final int sizeBefore = tempTables.size(); for (final ListIterator<String> iterator = tempTables.listIterator(); iterator.hasNext();) { final String table = iterator.next(); try { statement.executeUpdate("DELETE FROM " + table); iterator.remove(); } catch (final SQLException exc) { LOG.warn("Ignored exception: " + exc.getMessage() + ". WILL RETRY."); } } if (tempTables.size() == sizeBefore) { throw new AssertionError("unable to clean tables " + tempTables); } } }
[ "protected", "void", "deleteContent", "(", "final", "List", "<", "String", ">", "tables", ",", "final", "Statement", "statement", ")", "throws", "SQLException", "{", "final", "ArrayList", "<", "String", ">", "tempTables", "=", "new", "ArrayList", "<", "String"...
Deletes all contents from the given tables. @param tables a {@link List} of table names who are to be deleted. @param statement the {@link Statement} to be used for executing a SQL statement. @throws SQLException - if a database access error occurs
[ "Deletes", "all", "contents", "from", "the", "given", "tables", "." ]
train
https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/db/operation/hsql/HSQLDeleteOperation.java#L123-L147
samskivert/pythagoras
src/main/java/pythagoras/f/Lines.java
Lines.pointLineDist
public static float pointLineDist (float px, float py, float x1, float y1, float x2, float y2) { return FloatMath.sqrt(pointLineDistSq(px, py, x1, y1, x2, y2)); }
java
public static float pointLineDist (float px, float py, float x1, float y1, float x2, float y2) { return FloatMath.sqrt(pointLineDistSq(px, py, x1, y1, x2, y2)); }
[ "public", "static", "float", "pointLineDist", "(", "float", "px", ",", "float", "py", ",", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ")", "{", "return", "FloatMath", ".", "sqrt", "(", "pointLineDistSq", "(", "px", ",", ...
Returns the distance from the specified point to the specified line.
[ "Returns", "the", "distance", "from", "the", "specified", "point", "to", "the", "specified", "line", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Lines.java#L83-L85
nulab/backlog4j
src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java
BacklogEndPointSupport.getPullRequestAttachmentEndpoint
public String getPullRequestAttachmentEndpoint(Object projectIdOrKey, Object repoIdOrName, Object number, Object attachmentId) { return buildEndpoint("projects/" + projectIdOrKey + "/git/repositories/" + repoIdOrName + "/pullRequests/" + number + "/attachments/" + attachmentId); }
java
public String getPullRequestAttachmentEndpoint(Object projectIdOrKey, Object repoIdOrName, Object number, Object attachmentId) { return buildEndpoint("projects/" + projectIdOrKey + "/git/repositories/" + repoIdOrName + "/pullRequests/" + number + "/attachments/" + attachmentId); }
[ "public", "String", "getPullRequestAttachmentEndpoint", "(", "Object", "projectIdOrKey", ",", "Object", "repoIdOrName", ",", "Object", "number", ",", "Object", "attachmentId", ")", "{", "return", "buildEndpoint", "(", "\"projects/\"", "+", "projectIdOrKey", "+", "\"/g...
Returns the endpoint of attachment file. @param projectIdOrKey the project identifier @param repoIdOrName the repository name @param number the pull request identifier @param attachmentId the pull request attachment identifier @return the endpoint
[ "Returns", "the", "endpoint", "of", "attachment", "file", "." ]
train
https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java#L95-L100
threerings/gwt-utils
src/main/java/com/threerings/gwt/util/ClickCallback.java
ClickCallback.showError
protected void showError (Throwable cause, Widget near) { if (near == null) { Popups.error(formatError(cause)); } else { Popups.errorBelow(formatError(cause), near); } }
java
protected void showError (Throwable cause, Widget near) { if (near == null) { Popups.error(formatError(cause)); } else { Popups.errorBelow(formatError(cause), near); } }
[ "protected", "void", "showError", "(", "Throwable", "cause", ",", "Widget", "near", ")", "{", "if", "(", "near", "==", "null", ")", "{", "Popups", ".", "error", "(", "formatError", "(", "cause", ")", ")", ";", "}", "else", "{", "Popups", ".", "errorB...
Displays a popup reporting the specified error, near the specified widget if it is non-null.
[ "Displays", "a", "popup", "reporting", "the", "specified", "error", "near", "the", "specified", "widget", "if", "it", "is", "non", "-", "null", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ClickCallback.java#L149-L156
icode/ameba
src/main/java/ameba/mvc/template/internal/AbstractTemplateProcessor.java
AbstractTemplateProcessor.getNearTemplateURL
protected URL getNearTemplateURL(String jarFile, String template) { if (jarFile != null) { Enumeration<URL> urls = IOUtils.getResources(template); while (urls.hasMoreElements()) { URL url = urls.nextElement(); if (url.getPath().startsWith(jarFile)) { return url; } } } return null; }
java
protected URL getNearTemplateURL(String jarFile, String template) { if (jarFile != null) { Enumeration<URL> urls = IOUtils.getResources(template); while (urls.hasMoreElements()) { URL url = urls.nextElement(); if (url.getPath().startsWith(jarFile)) { return url; } } } return null; }
[ "protected", "URL", "getNearTemplateURL", "(", "String", "jarFile", ",", "String", "template", ")", "{", "if", "(", "jarFile", "!=", "null", ")", "{", "Enumeration", "<", "URL", ">", "urls", "=", "IOUtils", ".", "getResources", "(", "template", ")", ";", ...
<p>getNearTemplateURL.</p> @param jarFile a {@link java.lang.String} object. @param template a {@link java.lang.String} object. @return a {@link java.net.URL} object.
[ "<p", ">", "getNearTemplateURL", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/AbstractTemplateProcessor.java#L225-L236
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/tiles/features/custom/NumberFeaturesTile.java
NumberFeaturesTile.drawTile
private BufferedImage drawTile(int tileWidth, int tileHeight, String text) { // Create the image and graphics BufferedImage image = new BufferedImage(tileWidth, tileHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = image.createGraphics(); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Draw the tile fill paint if (tileFillColor != null) { graphics.setColor(tileFillColor); graphics.fillRect(0, 0, tileWidth, tileHeight); } // Draw the tile border if (tileBorderColor != null) { graphics.setColor(tileBorderColor); graphics.setStroke(new BasicStroke(tileBorderStrokeWidth)); graphics.drawRect(0, 0, tileWidth, tileHeight); } // Determine the text bounds graphics.setFont(new Font(textFont, Font.PLAIN, textSize)); FontMetrics fontMetrics = graphics.getFontMetrics(); int textWidth = fontMetrics.stringWidth(text); int textHeight = fontMetrics.getAscent(); // Determine the center of the tile int centerX = (int) (image.getWidth() / 2.0f); int centerY = (int) (image.getHeight() / 2.0f); // Draw the circle if (circleColor != null || circleFillColor != null) { int diameter = Math.max(textWidth, textHeight); float radius = diameter / 2.0f; radius = radius + (diameter * circlePaddingPercentage); int paddedDiameter = Math.round(radius * 2); int circleX = Math.round(centerX - radius); int circleY = Math.round(centerY - radius); // Draw the filled circle if (circleFillColor != null) { graphics.setColor(circleFillColor); graphics.setStroke(new BasicStroke(circleStrokeWidth)); graphics.fillOval(circleX, circleY, paddedDiameter, paddedDiameter); } // Draw the circle if (circleColor != null) { graphics.setColor(circleColor); graphics.setStroke(new BasicStroke(circleStrokeWidth)); graphics.drawOval(circleX, circleY, paddedDiameter, paddedDiameter); } } // Draw the text float textX = centerX - (textWidth / 2.0f); float textY = centerY + (textHeight / 2.0f); graphics.setColor(textColor); graphics.drawString(text, textX, textY); return image; }
java
private BufferedImage drawTile(int tileWidth, int tileHeight, String text) { // Create the image and graphics BufferedImage image = new BufferedImage(tileWidth, tileHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = image.createGraphics(); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Draw the tile fill paint if (tileFillColor != null) { graphics.setColor(tileFillColor); graphics.fillRect(0, 0, tileWidth, tileHeight); } // Draw the tile border if (tileBorderColor != null) { graphics.setColor(tileBorderColor); graphics.setStroke(new BasicStroke(tileBorderStrokeWidth)); graphics.drawRect(0, 0, tileWidth, tileHeight); } // Determine the text bounds graphics.setFont(new Font(textFont, Font.PLAIN, textSize)); FontMetrics fontMetrics = graphics.getFontMetrics(); int textWidth = fontMetrics.stringWidth(text); int textHeight = fontMetrics.getAscent(); // Determine the center of the tile int centerX = (int) (image.getWidth() / 2.0f); int centerY = (int) (image.getHeight() / 2.0f); // Draw the circle if (circleColor != null || circleFillColor != null) { int diameter = Math.max(textWidth, textHeight); float radius = diameter / 2.0f; radius = radius + (diameter * circlePaddingPercentage); int paddedDiameter = Math.round(radius * 2); int circleX = Math.round(centerX - radius); int circleY = Math.round(centerY - radius); // Draw the filled circle if (circleFillColor != null) { graphics.setColor(circleFillColor); graphics.setStroke(new BasicStroke(circleStrokeWidth)); graphics.fillOval(circleX, circleY, paddedDiameter, paddedDiameter); } // Draw the circle if (circleColor != null) { graphics.setColor(circleColor); graphics.setStroke(new BasicStroke(circleStrokeWidth)); graphics.drawOval(circleX, circleY, paddedDiameter, paddedDiameter); } } // Draw the text float textX = centerX - (textWidth / 2.0f); float textY = centerY + (textHeight / 2.0f); graphics.setColor(textColor); graphics.drawString(text, textX, textY); return image; }
[ "private", "BufferedImage", "drawTile", "(", "int", "tileWidth", ",", "int", "tileHeight", ",", "String", "text", ")", "{", "// Create the image and graphics", "BufferedImage", "image", "=", "new", "BufferedImage", "(", "tileWidth", ",", "tileHeight", ",", "Buffered...
Draw a tile with the provided text label in the middle @param tileWidth @param tileHeight @param text @return
[ "Draw", "a", "tile", "with", "the", "provided", "text", "label", "in", "the", "middle" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/features/custom/NumberFeaturesTile.java#L394-L461
jbundle/jbundle
base/screen/view/data/src/main/java/org/jbundle/base/screen/view/data/DJnlpAccessScreen.java
DJnlpAccessScreen.sendData
public void sendData(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { // res.setContentType("application/x-java-jnlp-file"); //x PrintWriter out = new PrintWriter(res.getOutputStream()); // PrintWriter out = res.getWriter(); // this.printXML(req, out); // out.flush(); ClassService classService = ClassServiceUtility.getClassService(); if (classService == null) return; // Never ClassFinder classFinder = classService.getClassFinder(null); if (classFinder == null) return; HttpServiceTracker tracker = (HttpServiceTracker)classFinder.getClassBundleService(null, WEB_START_ACTIVATOR_CLASS, null, null, -1); if (tracker == null) return; Servlet servlet = tracker.getServlet(); if (servlet == null) return; servlet.service((HttpServletRequest)req, (HttpServletResponse)res); }
java
public void sendData(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { // res.setContentType("application/x-java-jnlp-file"); //x PrintWriter out = new PrintWriter(res.getOutputStream()); // PrintWriter out = res.getWriter(); // this.printXML(req, out); // out.flush(); ClassService classService = ClassServiceUtility.getClassService(); if (classService == null) return; // Never ClassFinder classFinder = classService.getClassFinder(null); if (classFinder == null) return; HttpServiceTracker tracker = (HttpServiceTracker)classFinder.getClassBundleService(null, WEB_START_ACTIVATOR_CLASS, null, null, -1); if (tracker == null) return; Servlet servlet = tracker.getServlet(); if (servlet == null) return; servlet.service((HttpServletRequest)req, (HttpServletResponse)res); }
[ "public", "void", "sendData", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "ServletException", ",", "IOException", "{", "// res.setContentType(\"application/x-java-jnlp-file\");", "//x PrintWriter out = new PrintWriter(res.getOutpu...
Process an HTML get or post. @param req The servlet request. @param res The servlet response object. @exception ServletException From inherited class. @exception IOException From inherited class.
[ "Process", "an", "HTML", "get", "or", "post", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/data/src/main/java/org/jbundle/base/screen/view/data/DJnlpAccessScreen.java#L77-L100
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/ConvexHull.java
ConvexHull.lineLineIntersect
public static Point2D lineLineIntersect(final Line2D lineA, final Line2D lineB) { return lineLineIntersect(lineA.getX1(), lineA.getY1(), lineA.getX2(), lineA.getY2(), lineB.getX1(), lineB.getY1(), lineB.getX2(), lineB.getY2()); }
java
public static Point2D lineLineIntersect(final Line2D lineA, final Line2D lineB) { return lineLineIntersect(lineA.getX1(), lineA.getY1(), lineA.getX2(), lineA.getY2(), lineB.getX1(), lineB.getY1(), lineB.getX2(), lineB.getY2()); }
[ "public", "static", "Point2D", "lineLineIntersect", "(", "final", "Line2D", "lineA", ",", "final", "Line2D", "lineB", ")", "{", "return", "lineLineIntersect", "(", "lineA", ".", "getX1", "(", ")", ",", "lineA", ".", "getY1", "(", ")", ",", "lineA", ".", ...
Calculate the intersection of two lines. @param lineA a line @param lineB another line @return the point where the two lines intersect (or null)
[ "Calculate", "the", "intersection", "of", "two", "lines", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/ConvexHull.java#L236-L240
twilliamson/mogwee-logging
src/main/java/com/mogwee/logging/Logger.java
Logger.infoDebug
public final void infoDebug(final Throwable cause, final String message) { logDebug(Level.INFO, cause, message); }
java
public final void infoDebug(final Throwable cause, final String message) { logDebug(Level.INFO, cause, message); }
[ "public", "final", "void", "infoDebug", "(", "final", "Throwable", "cause", ",", "final", "String", "message", ")", "{", "logDebug", "(", "Level", ".", "INFO", ",", "cause", ",", "message", ")", ";", "}" ]
Logs a message and stack trace if DEBUG logging is enabled or a formatted message and exception description if INFO logging is enabled. @param cause an exception to print stack trace of if DEBUG logging is enabled @param message a message
[ "Logs", "a", "message", "and", "stack", "trace", "if", "DEBUG", "logging", "is", "enabled", "or", "a", "formatted", "message", "and", "exception", "description", "if", "INFO", "logging", "is", "enabled", "." ]
train
https://github.com/twilliamson/mogwee-logging/blob/30b99c2649de455432d956a8f6a74316de4cd62c/src/main/java/com/mogwee/logging/Logger.java#L345-L348
graphhopper/graphhopper
core/src/main/java/com/graphhopper/storage/GraphBuilder.java
GraphBuilder.build
public GraphHopperStorage build() { Directory dir = mmap ? new MMapDirectory(location) : new RAMDirectory(location, store); GraphExtension graphExtension = encodingManager.needsTurnCostsSupport() ? new TurnCostExtension() : new TurnCostExtension.NoOpExtension(); return singleCHWeighting == null ? new GraphHopperStorage(dir, encodingManager, elevation, graphExtension) : edgeBasedCH ? new GraphHopperStorage(Collections.<Weighting>emptyList(), Arrays.asList(singleCHWeighting), dir, encodingManager, elevation, graphExtension) : new GraphHopperStorage(Arrays.asList(singleCHWeighting), Collections.<Weighting>emptyList(), dir, encodingManager, elevation, graphExtension); }
java
public GraphHopperStorage build() { Directory dir = mmap ? new MMapDirectory(location) : new RAMDirectory(location, store); GraphExtension graphExtension = encodingManager.needsTurnCostsSupport() ? new TurnCostExtension() : new TurnCostExtension.NoOpExtension(); return singleCHWeighting == null ? new GraphHopperStorage(dir, encodingManager, elevation, graphExtension) : edgeBasedCH ? new GraphHopperStorage(Collections.<Weighting>emptyList(), Arrays.asList(singleCHWeighting), dir, encodingManager, elevation, graphExtension) : new GraphHopperStorage(Arrays.asList(singleCHWeighting), Collections.<Weighting>emptyList(), dir, encodingManager, elevation, graphExtension); }
[ "public", "GraphHopperStorage", "build", "(", ")", "{", "Directory", "dir", "=", "mmap", "?", "new", "MMapDirectory", "(", "location", ")", ":", "new", "RAMDirectory", "(", "location", ",", "store", ")", ";", "GraphExtension", "graphExtension", "=", "encodingM...
Default graph is a {@link GraphHopperStorage} with an in memory directory and disabled storing on flush. Afterwards you'll need to call {@link GraphHopperStorage#create} to have a usable object. Better use {@link #create} directly.
[ "Default", "graph", "is", "a", "{" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/GraphBuilder.java#L100-L114
google/closure-compiler
src/com/google/javascript/jscomp/Es6RewriteClass.java
Es6RewriteClass.visitMethod
private void visitMethod(Node member, ClassDeclarationMetadata metadata) { Node qualifiedMemberAccess = getQualifiedMemberAccess(member, metadata); Node method = member.getLastChild().detach(); // Use the source info from the method (a FUNCTION) not the MEMBER_FUNCTION_DEF // because the MEMBER_FUNCTION_DEf source info only corresponds to the identifier Node assign = astFactory.createAssign(qualifiedMemberAccess, method).useSourceInfoIfMissingFrom(method); JSDocInfo info = member.getJSDocInfo(); if (member.isStaticMember() && NodeUtil.referencesThis(assign.getLastChild())) { JSDocInfoBuilder memberDoc = JSDocInfoBuilder.maybeCopyFrom(info); memberDoc.recordThisType( new JSTypeExpression(new Node(Token.BANG, new Node(Token.QMARK)), member.getSourceFileName())); info = memberDoc.build(); } if (info != null) { assign.setJSDocInfo(info); } Node newNode = NodeUtil.newExpr(assign); metadata.insertNodeAndAdvance(newNode); }
java
private void visitMethod(Node member, ClassDeclarationMetadata metadata) { Node qualifiedMemberAccess = getQualifiedMemberAccess(member, metadata); Node method = member.getLastChild().detach(); // Use the source info from the method (a FUNCTION) not the MEMBER_FUNCTION_DEF // because the MEMBER_FUNCTION_DEf source info only corresponds to the identifier Node assign = astFactory.createAssign(qualifiedMemberAccess, method).useSourceInfoIfMissingFrom(method); JSDocInfo info = member.getJSDocInfo(); if (member.isStaticMember() && NodeUtil.referencesThis(assign.getLastChild())) { JSDocInfoBuilder memberDoc = JSDocInfoBuilder.maybeCopyFrom(info); memberDoc.recordThisType( new JSTypeExpression(new Node(Token.BANG, new Node(Token.QMARK)), member.getSourceFileName())); info = memberDoc.build(); } if (info != null) { assign.setJSDocInfo(info); } Node newNode = NodeUtil.newExpr(assign); metadata.insertNodeAndAdvance(newNode); }
[ "private", "void", "visitMethod", "(", "Node", "member", ",", "ClassDeclarationMetadata", "metadata", ")", "{", "Node", "qualifiedMemberAccess", "=", "getQualifiedMemberAccess", "(", "member", ",", "metadata", ")", ";", "Node", "method", "=", "member", ".", "getLa...
Handles transpilation of a standard class member function. Getters, setters, and the constructor are not handled here.
[ "Handles", "transpilation", "of", "a", "standard", "class", "member", "function", ".", "Getters", "setters", "and", "the", "constructor", "are", "not", "handled", "here", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteClass.java#L500-L523
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ActionResponseBuilder.java
ActionResponseBuilder.build
public FbBotMillResponse build(MessageEnvelope envelope) { User recipient = getRecipient(envelope); return new FbBotMillActionResponse(recipient, action); }
java
public FbBotMillResponse build(MessageEnvelope envelope) { User recipient = getRecipient(envelope); return new FbBotMillActionResponse(recipient, action); }
[ "public", "FbBotMillResponse", "build", "(", "MessageEnvelope", "envelope", ")", "{", "User", "recipient", "=", "getRecipient", "(", "envelope", ")", ";", "return", "new", "FbBotMillActionResponse", "(", "recipient", ",", "action", ")", ";", "}" ]
{@inheritDoc} It returns a {@link FbBotMillActionResponse} with the {@link TypingAction} to perform.
[ "{" ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ActionResponseBuilder.java#L63-L66
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
JSONAssert.assertEquals
public static void assertEquals(String message, String expectedStr, JSONObject actual, JSONCompareMode compareMode) throws JSONException { Object expected = JSONParser.parseJSON(expectedStr); if (expected instanceof JSONObject) { assertEquals(message, (JSONObject)expected, actual, compareMode); } else { throw new AssertionError("Expecting a JSON array, but passing in a JSON object"); } }
java
public static void assertEquals(String message, String expectedStr, JSONObject actual, JSONCompareMode compareMode) throws JSONException { Object expected = JSONParser.parseJSON(expectedStr); if (expected instanceof JSONObject) { assertEquals(message, (JSONObject)expected, actual, compareMode); } else { throw new AssertionError("Expecting a JSON array, but passing in a JSON object"); } }
[ "public", "static", "void", "assertEquals", "(", "String", "message", ",", "String", "expectedStr", ",", "JSONObject", "actual", ",", "JSONCompareMode", "compareMode", ")", "throws", "JSONException", "{", "Object", "expected", "=", "JSONParser", ".", "parseJSON", ...
Asserts that the JSONObject provided matches the expected string. If it isn't it throws an {@link AssertionError}. @param message Error message to be displayed in case of assertion failure @param expectedStr Expected JSON string @param actual JSONObject to compare @param compareMode Specifies which comparison mode to use @throws JSONException JSON parsing error
[ "Asserts", "that", "the", "JSONObject", "provided", "matches", "the", "expected", "string", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L141-L150
matthewhorridge/owlapi-gwt
owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java
OWLAPIPreconditions.verifyNotNull
@Nonnull public static <T> T verifyNotNull(T object, @Nonnull String message) { if (object == null) { throw new IllegalStateException(message); } return object; }
java
@Nonnull public static <T> T verifyNotNull(T object, @Nonnull String message) { if (object == null) { throw new IllegalStateException(message); } return object; }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "T", "verifyNotNull", "(", "T", "object", ",", "@", "Nonnull", "String", "message", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "message", ")", ...
Check that the argument is not null; if the argument is null, throw an IllegalStateException. This method is meant to be used to verify conditions on member variables rather than input parameters. @param object reference to check @param message message to use for the error @param <T> reference type @return the input reference if not null @throws IllegalStateException if object is null
[ "Check", "that", "the", "argument", "is", "not", "null", ";", "if", "the", "argument", "is", "null", "throw", "an", "IllegalStateException", ".", "This", "method", "is", "meant", "to", "be", "used", "to", "verify", "conditions", "on", "member", "variables", ...
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java#L58-L64
tvesalainen/util
util/src/main/java/org/vesalainen/text/CamelCase.java
CamelCase.delimitedLower
public static final String delimitedLower(String text, String delim) { return stream(text).map((String s)->{return s.toLowerCase();}).collect(Collectors.joining(delim)); }
java
public static final String delimitedLower(String text, String delim) { return stream(text).map((String s)->{return s.toLowerCase();}).collect(Collectors.joining(delim)); }
[ "public", "static", "final", "String", "delimitedLower", "(", "String", "text", ",", "String", "delim", ")", "{", "return", "stream", "(", "text", ")", ".", "map", "(", "(", "String", "s", ")", "->", "{", "return", "s", ".", "toLowerCase", "(", ")", ...
Return camel-case if delim = '-' @param text @param delim @return
[ "Return", "camel", "-", "case", "if", "delim", "=", "-" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/text/CamelCase.java#L69-L72
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java
HystrixMetricsPublisherFactory.createOrRetrievePublisherForCommand
public static HystrixMetricsPublisherCommand createOrRetrievePublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { return SINGLETON.getPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties); }
java
public static HystrixMetricsPublisherCommand createOrRetrievePublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { return SINGLETON.getPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties); }
[ "public", "static", "HystrixMetricsPublisherCommand", "createOrRetrievePublisherForCommand", "(", "HystrixCommandKey", "commandKey", ",", "HystrixCommandGroupKey", "commandOwner", ",", "HystrixCommandMetrics", "metrics", ",", "HystrixCircuitBreaker", "circuitBreaker", ",", "Hystrix...
Get an instance of {@link HystrixMetricsPublisherCommand} with the given factory {@link HystrixMetricsPublisher} implementation for each {@link HystrixCommand} instance. @param commandKey Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCommand} implementation @param commandOwner Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCommand} implementation @param metrics Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCommand} implementation @param circuitBreaker Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCommand} implementation @param properties Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForCommand} implementation @return {@link HystrixMetricsPublisherCommand} instance
[ "Get", "an", "instance", "of", "{", "@link", "HystrixMetricsPublisherCommand", "}", "with", "the", "given", "factory", "{", "@link", "HystrixMetricsPublisher", "}", "implementation", "for", "each", "{", "@link", "HystrixCommand", "}", "instance", "." ]
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java#L82-L84
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/inf/BeliefPropagation.java
BeliefPropagation.calcProductAtVar
private void calcProductAtVar(int v, VarTensor prod, int excl1, int excl2) { for (int nb=0; nb<bg.numNbsT1(v); nb++) { if (nb == excl1 || nb == excl2) { // Don't include messages to these neighbors. continue; } // Get message from neighbor to this node. VarTensor nbMsg = msgs[bg.opposingT1(v, nb)]; // Since the node is a variable, this is an element-wise product. prod.elemMultiply(nbMsg); } }
java
private void calcProductAtVar(int v, VarTensor prod, int excl1, int excl2) { for (int nb=0; nb<bg.numNbsT1(v); nb++) { if (nb == excl1 || nb == excl2) { // Don't include messages to these neighbors. continue; } // Get message from neighbor to this node. VarTensor nbMsg = msgs[bg.opposingT1(v, nb)]; // Since the node is a variable, this is an element-wise product. prod.elemMultiply(nbMsg); } }
[ "private", "void", "calcProductAtVar", "(", "int", "v", ",", "VarTensor", "prod", ",", "int", "excl1", ",", "int", "excl2", ")", "{", "for", "(", "int", "nb", "=", "0", ";", "nb", "<", "bg", ".", "numNbsT1", "(", "v", ")", ";", "nb", "++", ")", ...
Computes the product of all messages being sent to a node, optionally excluding messages sent from another node or two. Upon completion, prod will be multiplied by the product of all incoming messages to node, except for the message from exclNode1 / exclNode2 if specified. @param node The node to which all the messages are being sent. @param prod An input / output tensor with which the product will (destructively) be taken. @param exclNode1 If non-null, any message sent from exclNode1 to node will be excluded from the product. @param exclNode2 If non-null, any message sent from exclNode2 to node will be excluded from the product.
[ "Computes", "the", "product", "of", "all", "messages", "being", "sent", "to", "a", "node", "optionally", "excluding", "messages", "sent", "from", "another", "node", "or", "two", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/inf/BeliefPropagation.java#L886-L897
VoltDB/voltdb
src/frontend/org/voltdb/iv2/InitiatorMailbox.java
InitiatorMailbox.updateReplicas
public synchronized long[] updateReplicas(List<Long> replicas, Map<Integer, Long> partitionMasters) { return updateReplicasInternal(replicas, partitionMasters, null); }
java
public synchronized long[] updateReplicas(List<Long> replicas, Map<Integer, Long> partitionMasters) { return updateReplicasInternal(replicas, partitionMasters, null); }
[ "public", "synchronized", "long", "[", "]", "updateReplicas", "(", "List", "<", "Long", ">", "replicas", ",", "Map", "<", "Integer", ",", "Long", ">", "partitionMasters", ")", "{", "return", "updateReplicasInternal", "(", "replicas", ",", "partitionMasters", "...
Change the replica set configuration (during or after promotion)
[ "Change", "the", "replica", "set", "configuration", "(", "during", "or", "after", "promotion", ")" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/InitiatorMailbox.java#L251-L253
treelogic-swe/aws-mock
example/java/simple/RunInstancesExample.java
RunInstancesExample.runInstances
public static List<Instance> runInstances(final String imageId, final int runCount) { // pass any credentials as aws-mock does not authenticate them at all AWSCredentials credentials = new BasicAWSCredentials("foo", "bar"); AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials); // the mock endpoint for ec2 which runs on your computer String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/"; amazonEC2Client.setEndpoint(ec2Endpoint); // instance type String instanceType = "m1.large"; // run 10 instances RunInstancesRequest request = new RunInstancesRequest(); final int minRunCount = runCount; final int maxRunCount = runCount; request.withImageId(imageId).withInstanceType(instanceType) .withMinCount(minRunCount).withMaxCount(maxRunCount); RunInstancesResult result = amazonEC2Client.runInstances(request); return result.getReservation().getInstances(); }
java
public static List<Instance> runInstances(final String imageId, final int runCount) { // pass any credentials as aws-mock does not authenticate them at all AWSCredentials credentials = new BasicAWSCredentials("foo", "bar"); AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials); // the mock endpoint for ec2 which runs on your computer String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/"; amazonEC2Client.setEndpoint(ec2Endpoint); // instance type String instanceType = "m1.large"; // run 10 instances RunInstancesRequest request = new RunInstancesRequest(); final int minRunCount = runCount; final int maxRunCount = runCount; request.withImageId(imageId).withInstanceType(instanceType) .withMinCount(minRunCount).withMaxCount(maxRunCount); RunInstancesResult result = amazonEC2Client.runInstances(request); return result.getReservation().getInstances(); }
[ "public", "static", "List", "<", "Instance", ">", "runInstances", "(", "final", "String", "imageId", ",", "final", "int", "runCount", ")", "{", "// pass any credentials as aws-mock does not authenticate them at all", "AWSCredentials", "credentials", "=", "new", "BasicAWSC...
Run some new ec2 instances. @param imageId AMI for running new instances from @param runCount count of instances to run @return a list of started instances
[ "Run", "some", "new", "ec2", "instances", "." ]
train
https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/example/java/simple/RunInstancesExample.java#L35-L56
maxirosson/jdroid-android
jdroid-android-core/src/main/java/com/jdroid/android/barcode/BarcodeUtils.java
BarcodeUtils.parseActivityResult
public static BarcodeIntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) { String contents = intent.getStringExtra(SCAN_RESULT); String formatName = intent.getStringExtra(SCAN_RESULT_FORMAT); return new BarcodeIntentResult(contents, formatName); } return null; }
java
public static BarcodeIntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) { String contents = intent.getStringExtra(SCAN_RESULT); String formatName = intent.getStringExtra(SCAN_RESULT_FORMAT); return new BarcodeIntentResult(contents, formatName); } return null; }
[ "public", "static", "BarcodeIntentResult", "parseActivityResult", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "intent", ")", "{", "if", "(", "requestCode", "==", "REQUEST_CODE", "&&", "resultCode", "==", "Activity", ".", "RESULT_OK", ")", ...
<p> Call this from your {@link Activity}'s {@link Activity#onActivityResult(int, int, Intent)} method. </p> @param requestCode @param resultCode @param intent @return null if the event handled here was not related to this class, or else an {@link BarcodeIntentResult} containing the result of the scan. If the user cancelled scanning, the fields will be null.
[ "<p", ">", "Call", "this", "from", "your", "{", "@link", "Activity", "}", "s", "{", "@link", "Activity#onActivityResult", "(", "int", "int", "Intent", ")", "}", "method", ".", "<", "/", "p", ">" ]
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/barcode/BarcodeUtils.java#L57-L64
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/paint/PainterExtensions.java
PainterExtensions.getCompoundPainter
@SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color matte, final Color gloss, final GlossPainter.GlossPosition position, final double angle, final Color pinstripe) { final MattePainter mp = new MattePainter(matte); final GlossPainter gp = new GlossPainter(gloss, position); final PinstripePainter pp = new PinstripePainter(pinstripe, angle); final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp); return compoundPainter; }
java
@SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color matte, final Color gloss, final GlossPainter.GlossPosition position, final double angle, final Color pinstripe) { final MattePainter mp = new MattePainter(matte); final GlossPainter gp = new GlossPainter(gloss, position); final PinstripePainter pp = new PinstripePainter(pinstripe, angle); final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp); return compoundPainter; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "CompoundPainter", "getCompoundPainter", "(", "final", "Color", "matte", ",", "final", "Color", "gloss", ",", "final", "GlossPainter", ".", "GlossPosition", "position", ",", "final", "double", ...
Gets a CompoundPainter object. @param matte the matte color @param gloss the gloss color @param position the position @param angle the angle @param pinstripe the pinstripe painter @return the CompoundPainter object.
[ "Gets", "a", "CompoundPainter", "object", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/paint/PainterExtensions.java#L56-L66
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java
PoolOperations.listPools
public PagedList<CloudPool> listPools(DetailLevel detailLevel) throws BatchErrorException, IOException { return listPools(detailLevel, null); }
java
public PagedList<CloudPool> listPools(DetailLevel detailLevel) throws BatchErrorException, IOException { return listPools(detailLevel, null); }
[ "public", "PagedList", "<", "CloudPool", ">", "listPools", "(", "DetailLevel", "detailLevel", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listPools", "(", "detailLevel", ",", "null", ")", ";", "}" ]
Lists the {@link CloudPool pools} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link CloudPool} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Lists", "the", "{", "@link", "CloudPool", "pools", "}", "in", "the", "Batch", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L120-L122
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/TaskClient.java
TaskClient.getPendingTaskForWorkflow
public Task getPendingTaskForWorkflow(String workflowId, String taskReferenceName) { Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(taskReferenceName), "Task reference name cannot be blank"); return getForEntity("tasks/in_progress/{workflowId}/{taskRefName}", null, Task.class, workflowId, taskReferenceName); }
java
public Task getPendingTaskForWorkflow(String workflowId, String taskReferenceName) { Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(taskReferenceName), "Task reference name cannot be blank"); return getForEntity("tasks/in_progress/{workflowId}/{taskRefName}", null, Task.class, workflowId, taskReferenceName); }
[ "public", "Task", "getPendingTaskForWorkflow", "(", "String", "workflowId", ",", "String", "taskReferenceName", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "workflowId", ")", ",", "\"Workflow id cannot be blank\"", ")", ...
Retrieve pending task identified by reference name for a workflow @param workflowId Workflow instance id @param taskReferenceName reference name of the task @return Returns the pending workflow task identified by the reference name
[ "Retrieve", "pending", "task", "identified", "by", "reference", "name", "for", "a", "workflow" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/TaskClient.java#L208-L213
saxsys/SynchronizeFX
transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatChannel.java
SynchronizeFXTomcatChannel.recivedMessage
void recivedMessage(final ByteBuffer message, final SynchronizeFXTomcatConnection sender) { if (LOG.isTraceEnabled()) { LOG.trace("Received a message in thread: id: " + Thread.currentThread().getName() + ", name: " + Thread.currentThread().getName()); } List<Command> commands; try { commands = serializer.deserialize(message.array()); } catch (final SynchronizeFXException e) { try { sender.getWsOutbound().close(0, null); } catch (final IOException e1) { callback.onClientConnectionError(sender, new SynchronizeFXException(e1)); } callback.onClientConnectionError(sender, e); return; } synchronized (callback) { callback.recive(commands, sender); } }
java
void recivedMessage(final ByteBuffer message, final SynchronizeFXTomcatConnection sender) { if (LOG.isTraceEnabled()) { LOG.trace("Received a message in thread: id: " + Thread.currentThread().getName() + ", name: " + Thread.currentThread().getName()); } List<Command> commands; try { commands = serializer.deserialize(message.array()); } catch (final SynchronizeFXException e) { try { sender.getWsOutbound().close(0, null); } catch (final IOException e1) { callback.onClientConnectionError(sender, new SynchronizeFXException(e1)); } callback.onClientConnectionError(sender, e); return; } synchronized (callback) { callback.recive(commands, sender); } }
[ "void", "recivedMessage", "(", "final", "ByteBuffer", "message", ",", "final", "SynchronizeFXTomcatConnection", "sender", ")", "{", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "{", "LOG", ".", "trace", "(", "\"Received a message in thread: id: \"", "+"...
Informs this {@link CommandTransferServer} that a client received a command. @param message The message containing the received command. @param sender The connection that received the message.
[ "Informs", "this", "{", "@link", "CommandTransferServer", "}", "that", "a", "client", "received", "a", "command", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/tomcat-transmitter/src/main/java/de/saxsys/synchronizefx/tomcat/SynchronizeFXTomcatChannel.java#L183-L203
ManfredTremmel/gwt-bean-validators
gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/StringUtils.java
StringUtils.applyRelativePath
public static String applyRelativePath(final String path, final String relativePath) { final int separatorIndex = path.lastIndexOf(StringUtils.FOLDER_SEPARATOR); if (separatorIndex != -1) { String newPath = path.substring(0, separatorIndex); if (!relativePath.startsWith(StringUtils.FOLDER_SEPARATOR)) { newPath += StringUtils.FOLDER_SEPARATOR; } return newPath + relativePath; } else { return relativePath; } }
java
public static String applyRelativePath(final String path, final String relativePath) { final int separatorIndex = path.lastIndexOf(StringUtils.FOLDER_SEPARATOR); if (separatorIndex != -1) { String newPath = path.substring(0, separatorIndex); if (!relativePath.startsWith(StringUtils.FOLDER_SEPARATOR)) { newPath += StringUtils.FOLDER_SEPARATOR; } return newPath + relativePath; } else { return relativePath; } }
[ "public", "static", "String", "applyRelativePath", "(", "final", "String", "path", ",", "final", "String", "relativePath", ")", "{", "final", "int", "separatorIndex", "=", "path", ".", "lastIndexOf", "(", "StringUtils", ".", "FOLDER_SEPARATOR", ")", ";", "if", ...
Apply the given relative path to the given Java resource path, assuming standard Java folder separation (i.e. "/" separators). @param path the path to start from (usually a full file path) @param relativePath the relative path to apply (relative to the full file path above) @return the full file path that results from applying the relative path
[ "Apply", "the", "given", "relative", "path", "to", "the", "given", "Java", "resource", "path", "assuming", "standard", "Java", "folder", "separation", "(", "i", ".", "e", ".", "/", "separators", ")", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/StringUtils.java#L649-L660
meertensinstituut/mtas
src/main/java/mtas/solr/handler/util/MtasSolrStatus.java
MtasSolrStatus.getInteger
private final Integer getInteger(NamedList<Object> response, String... args) { Object objectItem = response.findRecursive(args); if (objectItem != null && objectItem instanceof Integer) { return (Integer) objectItem; } else { return null; } }
java
private final Integer getInteger(NamedList<Object> response, String... args) { Object objectItem = response.findRecursive(args); if (objectItem != null && objectItem instanceof Integer) { return (Integer) objectItem; } else { return null; } }
[ "private", "final", "Integer", "getInteger", "(", "NamedList", "<", "Object", ">", "response", ",", "String", "...", "args", ")", "{", "Object", "objectItem", "=", "response", ".", "findRecursive", "(", "args", ")", ";", "if", "(", "objectItem", "!=", "nul...
Gets the integer. @param response the response @param args the args @return the integer
[ "Gets", "the", "integer", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/util/MtasSolrStatus.java#L552-L559
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.readX509Certificate
public static Certificate readX509Certificate(InputStream in, char[] password, String alias) { return KeyUtil.readX509Certificate(in, password, alias); }
java
public static Certificate readX509Certificate(InputStream in, char[] password, String alias) { return KeyUtil.readX509Certificate(in, password, alias); }
[ "public", "static", "Certificate", "readX509Certificate", "(", "InputStream", "in", ",", "char", "[", "]", "password", ",", "String", "alias", ")", "{", "return", "KeyUtil", ".", "readX509Certificate", "(", "in", ",", "password", ",", "alias", ")", ";", "}" ...
读取X.509 Certification文件<br> Certification为证书文件<br> see: http://snowolf.iteye.com/blog/391931 @param in {@link InputStream} 如果想从文件读取.cer文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @param password 密码 @param alias 别名 @return {@link KeyStore} @since 4.4.1
[ "读取X", ".", "509", "Certification文件<br", ">", "Certification为证书文件<br", ">", "see", ":", "http", ":", "//", "snowolf", ".", "iteye", ".", "com", "/", "blog", "/", "391931" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L335-L337
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.beginReimageAll
public OperationStatusResponseInner beginReimageAll(String resourceGroupName, String vmScaleSetName) { return beginReimageAllWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body(); }
java
public OperationStatusResponseInner beginReimageAll(String resourceGroupName, String vmScaleSetName) { return beginReimageAllWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body(); }
[ "public", "OperationStatusResponseInner", "beginReimageAll", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "beginReimageAllWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "toBlocking", "(", ")"...
Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatusResponseInner object if successful.
[ "Reimages", "all", "the", "disks", "(", "including", "data", "disks", ")", "in", "the", "virtual", "machines", "in", "a", "VM", "scale", "set", ".", "This", "operation", "is", "only", "supported", "for", "managed", "disks", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L3368-L3370
lucee/Lucee
core/src/main/java/lucee/runtime/instrumentation/InstrumentationFactory.java
InstrumentationFactory.loadAgent
private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) { try { // addAttach(config,log); // first obtain the PID of the currently-running process // ### this relies on the undocumented convention of the // RuntimeMXBean's // ### name starting with the PID, but there appears to be no other // ### way to obtain the current process' id, which we need for // ### the attach process RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String pid = runtime.getName(); if (pid.indexOf("@") != -1) pid = pid.substring(0, pid.indexOf("@")); log.info("Instrumentation", "pid:" + pid); // JDK1.6: now attach to the current VM so we can deploy a new agent // ### this is a Sun JVM specific feature; other JVMs may offer // ### this feature, but in an implementation-dependent way Object vm = vmClass.getMethod("attach", new Class<?>[] { String.class }).invoke(null, new Object[] { pid }); // now deploy the actual agent, which will wind up calling // agentmain() vmClass.getMethod("loadAgent", new Class[] { String.class }).invoke(vm, new Object[] { agentJar }); vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {}); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); // Log the message from the exception. Don't log the entire // stack as this is expected when running on a JDK that doesn't // support the Attach API. log.log(Log.LEVEL_INFO, "Instrumentation", t); } }
java
private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) { try { // addAttach(config,log); // first obtain the PID of the currently-running process // ### this relies on the undocumented convention of the // RuntimeMXBean's // ### name starting with the PID, but there appears to be no other // ### way to obtain the current process' id, which we need for // ### the attach process RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String pid = runtime.getName(); if (pid.indexOf("@") != -1) pid = pid.substring(0, pid.indexOf("@")); log.info("Instrumentation", "pid:" + pid); // JDK1.6: now attach to the current VM so we can deploy a new agent // ### this is a Sun JVM specific feature; other JVMs may offer // ### this feature, but in an implementation-dependent way Object vm = vmClass.getMethod("attach", new Class<?>[] { String.class }).invoke(null, new Object[] { pid }); // now deploy the actual agent, which will wind up calling // agentmain() vmClass.getMethod("loadAgent", new Class[] { String.class }).invoke(vm, new Object[] { agentJar }); vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {}); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); // Log the message from the exception. Don't log the entire // stack as this is expected when running on a JDK that doesn't // support the Attach API. log.log(Log.LEVEL_INFO, "Instrumentation", t); } }
[ "private", "static", "void", "loadAgent", "(", "Config", "config", ",", "Log", "log", ",", "String", "agentJar", ",", "Class", "<", "?", ">", "vmClass", ")", "{", "try", "{", "// addAttach(config,log);", "// first obtain the PID of the currently-running process", "/...
Attach and load an agent class. @param log Log used if the agent cannot be loaded. @param agentJar absolute path to the agent jar. @param vmClass VirtualMachine.class from tools.jar.
[ "Attach", "and", "load", "an", "agent", "class", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/instrumentation/InstrumentationFactory.java#L309-L341
jboss/jboss-jsp-api_spec
src/main/java/javax/servlet/jsp/tagext/TagSupport.java
TagSupport.setValue
public void setValue(String k, Object o) { if (values == null) { values = new Hashtable<String, Object>(); } values.put(k, o); }
java
public void setValue(String k, Object o) { if (values == null) { values = new Hashtable<String, Object>(); } values.put(k, o); }
[ "public", "void", "setValue", "(", "String", "k", ",", "Object", "o", ")", "{", "if", "(", "values", "==", "null", ")", "{", "values", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "}", "values", ".", "put", "(", "k",...
Associate a value with a String key. @param k The key String. @param o The value to associate.
[ "Associate", "a", "value", "with", "a", "String", "key", "." ]
train
https://github.com/jboss/jboss-jsp-api_spec/blob/da53166619f33a5134dc3315a3264990cc1f541f/src/main/java/javax/servlet/jsp/tagext/TagSupport.java#L267-L272
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java
BouncyCastleCertProcessingFactory.createCredential
public X509Credential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, GSIConstants.DelegationType delegType) throws GeneralSecurityException { return createCredential(certs, privateKey, bits, lifetime, delegType, (X509ExtensionSet) null, null); }
java
public X509Credential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, GSIConstants.DelegationType delegType) throws GeneralSecurityException { return createCredential(certs, privateKey, bits, lifetime, delegType, (X509ExtensionSet) null, null); }
[ "public", "X509Credential", "createCredential", "(", "X509Certificate", "[", "]", "certs", ",", "PrivateKey", "privateKey", ",", "int", "bits", ",", "int", "lifetime", ",", "GSIConstants", ".", "DelegationType", "delegType", ")", "throws", "GeneralSecurityException", ...
Creates a new proxy credential from the specified certificate chain and a private key, using the given delegation mode. @see #createCredential(X509Certificate[], PrivateKey, int, int, GSIConstants.CertificateType, X509ExtensionSet, String) createCredential
[ "Creates", "a", "new", "proxy", "credential", "from", "the", "specified", "certificate", "chain", "and", "a", "private", "key", "using", "the", "given", "delegation", "mode", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java#L672-L675
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/IntuitResponseDeserializer.java
IntuitResponseDeserializer.getAttachableResponse
private AttachableResponse getAttachableResponse(JsonNode jsonNode) throws IOException { ObjectMapper mapper = new ObjectMapper(); SimpleModule simpleModule = new SimpleModule("AttachableResponseDeserializer", new Version(1, 0, 0, null)); simpleModule.addDeserializer(AttachableResponse.class, new AttachableResponseDeserializer()); mapper.registerModule(simpleModule); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return mapper.treeToValue(jsonNode, AttachableResponse.class); }
java
private AttachableResponse getAttachableResponse(JsonNode jsonNode) throws IOException { ObjectMapper mapper = new ObjectMapper(); SimpleModule simpleModule = new SimpleModule("AttachableResponseDeserializer", new Version(1, 0, 0, null)); simpleModule.addDeserializer(AttachableResponse.class, new AttachableResponseDeserializer()); mapper.registerModule(simpleModule); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return mapper.treeToValue(jsonNode, AttachableResponse.class); }
[ "private", "AttachableResponse", "getAttachableResponse", "(", "JsonNode", "jsonNode", ")", "throws", "IOException", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "SimpleModule", "simpleModule", "=", "new", "SimpleModule", "(", "\"Attachabl...
Method to deserialize the QueryResponse object @param jsonNode @return QueryResponse
[ "Method", "to", "deserialize", "the", "QueryResponse", "object" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/IntuitResponseDeserializer.java#L372-L382