repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/lang/Date.java
Date.convertDate
public static java.sql.Date convertDate(String date, Locale locale) { SimpleDateFormat df; java.util.Date dbDate = null; java.sql.Date sqldate = null; try { if (date == null || date.equals("")) { return null; } df = (SimpleDateFormat) DateFormat.getDateInstance(dateStyle, locale); SimpleDateFormat sdf = new SimpleDateFormat(df.toPattern()); java.text.ParsePosition pos = new java.text.ParsePosition(0); sdf.setLenient(false); dbDate = sdf.parse(date, pos); return new java.sql.Date(dbDate.getTime()); } catch (Exception e) { return null; } }
java
public static java.sql.Date convertDate(String date, Locale locale) { SimpleDateFormat df; java.util.Date dbDate = null; java.sql.Date sqldate = null; try { if (date == null || date.equals("")) { return null; } df = (SimpleDateFormat) DateFormat.getDateInstance(dateStyle, locale); SimpleDateFormat sdf = new SimpleDateFormat(df.toPattern()); java.text.ParsePosition pos = new java.text.ParsePosition(0); sdf.setLenient(false); dbDate = sdf.parse(date, pos); return new java.sql.Date(dbDate.getTime()); } catch (Exception e) { return null; } }
[ "public", "static", "java", ".", "sql", ".", "Date", "convertDate", "(", "String", "date", ",", "Locale", "locale", ")", "{", "SimpleDateFormat", "df", ";", "java", ".", "util", ".", "Date", "dbDate", "=", "null", ";", "java", ".", "sql", ".", "Date", ...
Converts the users input date value to java.sql.Date @param date Date to convert @return The converted date in java.sql.date format
[ "Converts", "the", "users", "input", "date", "value", "to", "java", ".", "sql", ".", "Date" ]
train
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/Date.java#L116-L136
samskivert/samskivert
src/main/java/com/samskivert/swing/util/TaskMaster.java
TaskMaster.invokeTask
public static void invokeTask (String name, Task task, TaskObserver observer) { // create a task runner and stick it in our task table TaskRunner runner = new TaskRunner(name, task, observer); _tasks.put(name, runner); // then start the runner up runner.start(); }
java
public static void invokeTask (String name, Task task, TaskObserver observer) { // create a task runner and stick it in our task table TaskRunner runner = new TaskRunner(name, task, observer); _tasks.put(name, runner); // then start the runner up runner.start(); }
[ "public", "static", "void", "invokeTask", "(", "String", "name", ",", "Task", "task", ",", "TaskObserver", "observer", ")", "{", "// create a task runner and stick it in our task table", "TaskRunner", "runner", "=", "new", "TaskRunner", "(", "name", ",", "task", ","...
Instructs the task master to run the supplied task. The task is given the supplied name and can be referenced by that name in subsequent dealings with the task master. The supplied observer (if non-null) will be notified when the task has completed.
[ "Instructs", "the", "task", "master", "to", "run", "the", "supplied", "task", ".", "The", "task", "is", "given", "the", "supplied", "name", "and", "can", "be", "referenced", "by", "that", "name", "in", "subsequent", "dealings", "with", "the", "task", "mast...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/TaskMaster.java#L35-L42
rometools/rome
rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java
MediaModuleGenerator.generatePrices
private void generatePrices(final Metadata m, final Element e) { for (final Price price : m.getPrices()) { if (price == null) { continue; } final Element priceElement = new Element("price", NS); if (price.getType() != null) { priceElement.setAttribute("type", price.getType().name().toLowerCase()); } addNotNullAttribute(priceElement, "info", price.getInfo()); addNotNullAttribute(priceElement, "price", price.getPrice()); addNotNullAttribute(priceElement, "currency", price.getCurrency()); if (priceElement.hasAttributes()) { e.addContent(priceElement); } } }
java
private void generatePrices(final Metadata m, final Element e) { for (final Price price : m.getPrices()) { if (price == null) { continue; } final Element priceElement = new Element("price", NS); if (price.getType() != null) { priceElement.setAttribute("type", price.getType().name().toLowerCase()); } addNotNullAttribute(priceElement, "info", price.getInfo()); addNotNullAttribute(priceElement, "price", price.getPrice()); addNotNullAttribute(priceElement, "currency", price.getCurrency()); if (priceElement.hasAttributes()) { e.addContent(priceElement); } } }
[ "private", "void", "generatePrices", "(", "final", "Metadata", "m", ",", "final", "Element", "e", ")", "{", "for", "(", "final", "Price", "price", ":", "m", ".", "getPrices", "(", ")", ")", "{", "if", "(", "price", "==", "null", ")", "{", "continue",...
Generation of backLinks tag. @param m source @param e element to attach new element to
[ "Generation", "of", "backLinks", "tag", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java#L469-L485
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/widget/FacebookDialog.java
FacebookDialog.canPresentMessageDialog
public static boolean canPresentMessageDialog(Context context, MessageDialogFeature... features) { return handleCanPresent(context, EnumSet.of(MessageDialogFeature.MESSAGE_DIALOG, features)); }
java
public static boolean canPresentMessageDialog(Context context, MessageDialogFeature... features) { return handleCanPresent(context, EnumSet.of(MessageDialogFeature.MESSAGE_DIALOG, features)); }
[ "public", "static", "boolean", "canPresentMessageDialog", "(", "Context", "context", ",", "MessageDialogFeature", "...", "features", ")", "{", "return", "handleCanPresent", "(", "context", ",", "EnumSet", ".", "of", "(", "MessageDialogFeature", ".", "MESSAGE_DIALOG", ...
Determines whether the version of the Facebook application installed on the user's device is recent enough to support specific features of the native Message dialog, which in turn may be used to determine which UI, etc., to present to the user. @param context the calling Context @param features zero or more features to check for; {@link com.facebook.widget.FacebookDialog.MessageDialogFeature#MESSAGE_DIALOG} is implicitly checked if not explicitly specified @return true if all of the specified features are supported by the currently installed version of the Facebook application; false if any of the features are not supported
[ "Determines", "whether", "the", "version", "of", "the", "Facebook", "application", "installed", "on", "the", "user", "s", "device", "is", "recent", "enough", "to", "support", "specific", "features", "of", "the", "native", "Message", "dialog", "which", "in", "t...
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/widget/FacebookDialog.java#L384-L386
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/AdapterUtil.java
AdapterUtil.translateSQLException
public static ResourceException translateSQLException( SQLException se, Object mapper, boolean sendEvent, Class<?> caller) { return (ResourceException) mapException( new DataStoreAdapterException("DSA_ERROR", se, caller, se.getMessage()), null, mapper, sendEvent); }
java
public static ResourceException translateSQLException( SQLException se, Object mapper, boolean sendEvent, Class<?> caller) { return (ResourceException) mapException( new DataStoreAdapterException("DSA_ERROR", se, caller, se.getMessage()), null, mapper, sendEvent); }
[ "public", "static", "ResourceException", "translateSQLException", "(", "SQLException", "se", ",", "Object", "mapper", ",", "boolean", "sendEvent", ",", "Class", "<", "?", ">", "caller", ")", "{", "return", "(", "ResourceException", ")", "mapException", "(", "new...
Translates a SQLException from the database. The exception mapping methods have been rewritten to account for the error detection model and to consolidate the RRA exception mapping routines into a single place. See the AdapterUtil.mapException method. @param SQLException se - the SQLException from the database @param mapper a managed connection or managed connection factory capable of mapping the exception. If NULL is provided, the exception cannot be mapped. If stale statement handling or connection error handling is required then a managed connection must be provided. @param boolean sendEvent - if true, throw an exception if the SQLException is a connectionError event @return ResourceException - the translated SQLException wrapped in a ResourceException
[ "Translates", "a", "SQLException", "from", "the", "database", ".", "The", "exception", "mapping", "methods", "have", "been", "rewritten", "to", "account", "for", "the", "error", "detection", "model", "and", "to", "consolidate", "the", "RRA", "exception", "mappin...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/AdapterUtil.java#L768-L778
appium/java-client
src/main/java/io/appium/java_client/pagefactory/AppiumElementLocator.java
AppiumElementLocator.getBy
private static By getBy(By currentBy, SearchContext currentContent) { if (!ContentMappedBy.class.isAssignableFrom(currentBy.getClass())) { return currentBy; } return ContentMappedBy.class.cast(currentBy) .useContent(getCurrentContentType(currentContent)); }
java
private static By getBy(By currentBy, SearchContext currentContent) { if (!ContentMappedBy.class.isAssignableFrom(currentBy.getClass())) { return currentBy; } return ContentMappedBy.class.cast(currentBy) .useContent(getCurrentContentType(currentContent)); }
[ "private", "static", "By", "getBy", "(", "By", "currentBy", ",", "SearchContext", "currentContent", ")", "{", "if", "(", "!", "ContentMappedBy", ".", "class", ".", "isAssignableFrom", "(", "currentBy", ".", "getClass", "(", ")", ")", ")", "{", "return", "c...
This methods makes sets some settings of the {@link By} according to the given instance of {@link SearchContext}. If there is some {@link ContentMappedBy} then it is switched to the searching for some html or native mobile element. Otherwise nothing happens there. @param currentBy is some locator strategy @param currentContent is an instance of some subclass of the {@link SearchContext}. @return the corrected {@link By} for the further searching
[ "This", "methods", "makes", "sets", "some", "settings", "of", "the", "{", "@link", "By", "}", "according", "to", "the", "given", "instance", "of", "{", "@link", "SearchContext", "}", ".", "If", "there", "is", "some", "{", "@link", "ContentMappedBy", "}", ...
train
https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocator.java#L84-L91
whitesource/agents
wss-agent-report/src/main/java/org/whitesource/agent/report/FileUtils.java
FileUtils.copyResource
public static void copyResource(String resource, File destination) throws IOException { InputStream is = null; FileOutputStream fos = null; try { is = FileUtils.class.getResourceAsStream("/" + resource); fos = new FileOutputStream(destination); final byte[] buffer = new byte[10 * 1024]; int len; while ((len = is.read(buffer)) > 0) { fos.write(buffer, 0, len); } } finally { close(is); close(fos); } }
java
public static void copyResource(String resource, File destination) throws IOException { InputStream is = null; FileOutputStream fos = null; try { is = FileUtils.class.getResourceAsStream("/" + resource); fos = new FileOutputStream(destination); final byte[] buffer = new byte[10 * 1024]; int len; while ((len = is.read(buffer)) > 0) { fos.write(buffer, 0, len); } } finally { close(is); close(fos); } }
[ "public", "static", "void", "copyResource", "(", "String", "resource", ",", "File", "destination", ")", "throws", "IOException", "{", "InputStream", "is", "=", "null", ";", "FileOutputStream", "fos", "=", "null", ";", "try", "{", "is", "=", "FileUtils", ".",...
Copy a classpath resource to a destination file. @param resource Path to resource to copy. @param destination File to copy resource to. @throws IOException exception2
[ "Copy", "a", "classpath", "resource", "to", "a", "destination", "file", "." ]
train
https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-report/src/main/java/org/whitesource/agent/report/FileUtils.java#L38-L56
javalite/activeweb
activeweb/src/main/java/org/javalite/activeweb/Captcha.java
Captcha.generateImage
public static byte[] generateImage(String text) { int w = 180, h = 40; BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g.setColor(Color.white); g.fillRect(0, 0, w, h); g.setFont(new Font("Serif", Font.PLAIN, 26)); g.setColor(Color.blue); int start = 10; byte[] bytes = text.getBytes(); Random random = new Random(); for (int i = 0; i < bytes.length; i++) { g.setColor( new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255))); g.drawString(new String(new byte[]{bytes[i]}), start + (i * 20), (int) (Math.random() * 20 + 20)); } g.setColor(Color.white); for (int i = 0; i < 8; i++) { g.drawOval((int) (Math.random() * 160), (int) (Math.random() * 10), 30, 30); } g.dispose(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { ImageIO.write(image, "png", bout); } catch (Exception e) { throw new RuntimeException(e); } return bout.toByteArray(); }
java
public static byte[] generateImage(String text) { int w = 180, h = 40; BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g.setColor(Color.white); g.fillRect(0, 0, w, h); g.setFont(new Font("Serif", Font.PLAIN, 26)); g.setColor(Color.blue); int start = 10; byte[] bytes = text.getBytes(); Random random = new Random(); for (int i = 0; i < bytes.length; i++) { g.setColor( new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255))); g.drawString(new String(new byte[]{bytes[i]}), start + (i * 20), (int) (Math.random() * 20 + 20)); } g.setColor(Color.white); for (int i = 0; i < 8; i++) { g.drawOval((int) (Math.random() * 160), (int) (Math.random() * 10), 30, 30); } g.dispose(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { ImageIO.write(image, "png", bout); } catch (Exception e) { throw new RuntimeException(e); } return bout.toByteArray(); }
[ "public", "static", "byte", "[", "]", "generateImage", "(", "String", "text", ")", "{", "int", "w", "=", "180", ",", "h", "=", "40", ";", "BufferedImage", "image", "=", "new", "BufferedImage", "(", "w", ",", "h", ",", "BufferedImage", ".", "TYPE_INT_RG...
Generates a PNG image of text 180 pixels wide, 40 pixels high with white background. @param text expects string size eight (8) characters. @return byte array that is a PNG image generated with text displayed.
[ "Generates", "a", "PNG", "image", "of", "text", "180", "pixels", "wide", "40", "pixels", "high", "with", "white", "background", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/Captcha.java#L50-L81
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyCollection.java
PropertyCollection.getValue
public int getValue(String name, int dflt) { try { return Integer.parseInt(getValue(name, Integer.toString(dflt))); } catch (Exception e) { return dflt; } }
java
public int getValue(String name, int dflt) { try { return Integer.parseInt(getValue(name, Integer.toString(dflt))); } catch (Exception e) { return dflt; } }
[ "public", "int", "getValue", "(", "String", "name", ",", "int", "dflt", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "getValue", "(", "name", ",", "Integer", ".", "toString", "(", "dflt", ")", ")", ")", ";", "}", "catch", "(", "...
Returns an integer property value. @param name Property name. @param dflt Default value if a property value is not found. @return Property value or default value if property value not found.
[ "Returns", "an", "integer", "property", "value", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyCollection.java#L162-L168
alkacon/opencms-core
src/org/opencms/main/OpenCmsCore.java
OpenCmsCore.updateContext
protected CmsObject updateContext(HttpServletRequest request, CmsObject cms) throws CmsException { // get the right site for the request String siteRoot = null; boolean isWorkplace = cms.getRequestContext().getUri().startsWith("/system/workplace/") || request.getRequestURI().startsWith(OpenCms.getSystemInfo().getWorkplaceContext()); if (isWorkplace && getRoleManager().hasRole(cms, CmsRole.ELEMENT_AUTHOR)) { // keep the site root for workplace requests siteRoot = cms.getRequestContext().getSiteRoot(); } else { CmsSite site = OpenCms.getSiteManager().matchRequest(request); siteRoot = site.getSiteRoot(); } return initCmsObject( request, cms.getRequestContext().getCurrentUser(), siteRoot, cms.getRequestContext().getCurrentProject().getUuid(), cms.getRequestContext().getOuFqn()); }
java
protected CmsObject updateContext(HttpServletRequest request, CmsObject cms) throws CmsException { // get the right site for the request String siteRoot = null; boolean isWorkplace = cms.getRequestContext().getUri().startsWith("/system/workplace/") || request.getRequestURI().startsWith(OpenCms.getSystemInfo().getWorkplaceContext()); if (isWorkplace && getRoleManager().hasRole(cms, CmsRole.ELEMENT_AUTHOR)) { // keep the site root for workplace requests siteRoot = cms.getRequestContext().getSiteRoot(); } else { CmsSite site = OpenCms.getSiteManager().matchRequest(request); siteRoot = site.getSiteRoot(); } return initCmsObject( request, cms.getRequestContext().getCurrentUser(), siteRoot, cms.getRequestContext().getCurrentProject().getUuid(), cms.getRequestContext().getOuFqn()); }
[ "protected", "CmsObject", "updateContext", "(", "HttpServletRequest", "request", ",", "CmsObject", "cms", ")", "throws", "CmsException", "{", "// get the right site for the request", "String", "siteRoot", "=", "null", ";", "boolean", "isWorkplace", "=", "cms", ".", "g...
This method updates the request context information.<p> The update information is:<br> <ul> <li>Requested Url</li> <li>Locale</li> <li>Encoding</li> <li>Remote Address</li> <li>Request Time</li> </ul> @param request the current request @param cms the cms object to update the request context for @return a new updated cms context @throws CmsException if something goes wrong
[ "This", "method", "updates", "the", "request", "context", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L2253-L2272
spacecowboy/NoNonsense-FilePicker
library/src/main/java/com/nononsenseapps/filepicker/FilePickerFragment.java
FilePickerFragment.compareFiles
protected int compareFiles(@NonNull File lhs, @NonNull File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } else { return lhs.getName().compareToIgnoreCase(rhs.getName()); } }
java
protected int compareFiles(@NonNull File lhs, @NonNull File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } else { return lhs.getName().compareToIgnoreCase(rhs.getName()); } }
[ "protected", "int", "compareFiles", "(", "@", "NonNull", "File", "lhs", ",", "@", "NonNull", "File", "rhs", ")", "{", "if", "(", "lhs", ".", "isDirectory", "(", ")", "&&", "!", "rhs", ".", "isDirectory", "(", ")", ")", "{", "return", "-", "1", ";",...
Compare two files to determine their relative sort order. This follows the usual comparison interface. Override to determine your own custom sort order. <p/> Default behaviour is to place directories before files, but sort them alphabetically otherwise. @param lhs File on the "left-hand side" @param rhs File on the "right-hand side" @return -1 if if lhs should be placed before rhs, 0 if they are equal, and 1 if rhs should be placed before lhs
[ "Compare", "two", "files", "to", "determine", "their", "relative", "sort", "order", ".", "This", "follows", "the", "usual", "comparison", "interface", ".", "Override", "to", "determine", "your", "own", "custom", "sort", "order", ".", "<p", "/", ">", "Default...
train
https://github.com/spacecowboy/NoNonsense-FilePicker/blob/396ef7fa5e87791170791f9d94c78f6e42a7679a/library/src/main/java/com/nononsenseapps/filepicker/FilePickerFragment.java#L346-L354
litsec/eidas-opensaml
opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java
AttributeUtils.createAttribute
public static Attribute createAttribute(String name, String friendlyName) { return createAttribute(name, friendlyName, Attribute.URI_REFERENCE); }
java
public static Attribute createAttribute(String name, String friendlyName) { return createAttribute(name, friendlyName, Attribute.URI_REFERENCE); }
[ "public", "static", "Attribute", "createAttribute", "(", "String", "name", ",", "String", "friendlyName", ")", "{", "return", "createAttribute", "(", "name", ",", "friendlyName", ",", "Attribute", ".", "URI_REFERENCE", ")", ";", "}" ]
Creates an {@code Attribute} with the given name (and friendly name) and with a name format of {@value Attribute#URI_REFERENCE}. @param name the attribute name @param friendlyName the attribute friendly name (may be {@code null}) @return an {@code Attribute} object @see #createAttribute(String, String, String)
[ "Creates", "an", "{", "@code", "Attribute", "}", "with", "the", "given", "name", "(", "and", "friendly", "name", ")", "and", "with", "a", "name", "format", "of", "{", "@value", "Attribute#URI_REFERENCE", "}", "." ]
train
https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java#L71-L73
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/widgets/properties/PropertyWidgetCollection.java
PropertyWidgetCollection.registerWidget
public void registerWidget(final ConfiguredPropertyDescriptor propertyDescriptor, final PropertyWidget<?> widget) { if (widget == null) { _widgets.remove(propertyDescriptor); } else { _widgets.put(propertyDescriptor, widget); @SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget; final Object value = _componentBuilder.getConfiguredProperty(objectWidget.getPropertyDescriptor()); objectWidget.initialize(value); } }
java
public void registerWidget(final ConfiguredPropertyDescriptor propertyDescriptor, final PropertyWidget<?> widget) { if (widget == null) { _widgets.remove(propertyDescriptor); } else { _widgets.put(propertyDescriptor, widget); @SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget; final Object value = _componentBuilder.getConfiguredProperty(objectWidget.getPropertyDescriptor()); objectWidget.initialize(value); } }
[ "public", "void", "registerWidget", "(", "final", "ConfiguredPropertyDescriptor", "propertyDescriptor", ",", "final", "PropertyWidget", "<", "?", ">", "widget", ")", "{", "if", "(", "widget", "==", "null", ")", "{", "_widgets", ".", "remove", "(", "propertyDescr...
Registers a widget in this factory in rare cases when the factory is not used to actually instantiate the widget, but it is still needed to register the widget for compliancy with eg. the onConfigurationChanged() behaviour. @param propertyDescriptor @param widget
[ "Registers", "a", "widget", "in", "this", "factory", "in", "rare", "cases", "when", "the", "factory", "is", "not", "used", "to", "actually", "instantiate", "the", "widget", "but", "it", "is", "still", "needed", "to", "register", "the", "widget", "for", "co...
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/properties/PropertyWidgetCollection.java#L84-L93
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/Utils.java
Utils.matches
public static boolean matches(final String text1, final String text2, final Configuration config){ if(config.isRegexLabelText() && text2.startsWith("/") && text2.endsWith("/")){ return normalize(text1, config).matches(text2.substring(1, text2.length() - 1)); } else { return normalize(text1, config).equals(normalize(text2, config)); // return normalize(text1, config).equals(text2); } }
java
public static boolean matches(final String text1, final String text2, final Configuration config){ if(config.isRegexLabelText() && text2.startsWith("/") && text2.endsWith("/")){ return normalize(text1, config).matches(text2.substring(1, text2.length() - 1)); } else { return normalize(text1, config).equals(normalize(text2, config)); // return normalize(text1, config).equals(text2); } }
[ "public", "static", "boolean", "matches", "(", "final", "String", "text1", ",", "final", "String", "text2", ",", "final", "Configuration", "config", ")", "{", "if", "(", "config", ".", "isRegexLabelText", "(", ")", "&&", "text2", ".", "startsWith", "(", "\...
システム設定に従いラベルを比較する。 <p>正規表現や正規化を行い指定する。 @since 1.1 @param text1 セルのラベル @param text2 アノテーションに指定されているラベル。 {@literal /<ラベル>/}と指定する場合、正規表現による比較を行う。 @param config システム設定 @return true:ラベルが一致する。
[ "システム設定に従いラベルを比較する。", "<p", ">", "正規表現や正規化を行い指定する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/Utils.java#L240-L247
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_serviceMonitoring_monitoringId_GET
public OvhServiceMonitoring serviceName_serviceMonitoring_monitoringId_GET(String serviceName, Long monitoringId) throws IOException { String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}"; StringBuilder sb = path(qPath, serviceName, monitoringId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhServiceMonitoring.class); }
java
public OvhServiceMonitoring serviceName_serviceMonitoring_monitoringId_GET(String serviceName, Long monitoringId) throws IOException { String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}"; StringBuilder sb = path(qPath, serviceName, monitoringId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhServiceMonitoring.class); }
[ "public", "OvhServiceMonitoring", "serviceName_serviceMonitoring_monitoringId_GET", "(", "String", "serviceName", ",", "Long", "monitoringId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}\"", ";", "...
Get this object properties REST: GET /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId} @param serviceName [required] The internal name of your dedicated server @param monitoringId [required] This monitoring id
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2268-L2273
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java
RemoteResourceFileLocationDB.addNameUrl
public void addNameUrl(final String name, final String url) throws IOException { doPostMethod(ResourceFileLocationDBServlet.ADD_OPERATION, name, url); }
java
public void addNameUrl(final String name, final String url) throws IOException { doPostMethod(ResourceFileLocationDBServlet.ADD_OPERATION, name, url); }
[ "public", "void", "addNameUrl", "(", "final", "String", "name", ",", "final", "String", "url", ")", "throws", "IOException", "{", "doPostMethod", "(", "ResourceFileLocationDBServlet", ".", "ADD_OPERATION", ",", "name", ",", "url", ")", ";", "}" ]
add an Url location for an arcName, unless it already exists @param name @param url @throws IOException
[ "add", "an", "Url", "location", "for", "an", "arcName", "unless", "it", "already", "exists" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java#L137-L140
srikalyc/Sql4D
Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/OverlordAccessor.java
OverlordAccessor.fireTask
public String fireTask(CrudStatementMeta meta, Map<String, String> reqHeaders, boolean wait) { CloseableHttpResponse resp = null; String url = format(overlordUrl, overlordHost, overlordPort); try { resp = postJson(url, meta.toString(), reqHeaders); if (resp.getStatusLine().getStatusCode() == 500) { return "Task failed with server error, " + IOUtils.toString(resp.getEntity().getContent()); } //TODO: Check for nulls in the following. String strResp = IOUtils.toString(resp.getEntity().getContent()); JSONObject respJson = new JSONObject(strResp); if (wait) { if (waitForTask(respJson.getString("task"), reqHeaders, TWO_HOURS_IN_MILLIS)) { return "Task completed successfully , task Id " + respJson; } return "Task failed/still running, task Id " + respJson; } else { String taskId = respJson.optString("task"); if (StringUtils.isBlank(taskId)) { log.error("Response has no taskId, Response body : {}", respJson); return null; } return respJson.getString("task"); } } catch (IOException | IllegalStateException | JSONException ex) { log.error("Error when firing task to overlord {}", ExceptionUtils.getStackTrace(ex)); return format("Http %s \n", ex); } finally { returnClient(resp); } }
java
public String fireTask(CrudStatementMeta meta, Map<String, String> reqHeaders, boolean wait) { CloseableHttpResponse resp = null; String url = format(overlordUrl, overlordHost, overlordPort); try { resp = postJson(url, meta.toString(), reqHeaders); if (resp.getStatusLine().getStatusCode() == 500) { return "Task failed with server error, " + IOUtils.toString(resp.getEntity().getContent()); } //TODO: Check for nulls in the following. String strResp = IOUtils.toString(resp.getEntity().getContent()); JSONObject respJson = new JSONObject(strResp); if (wait) { if (waitForTask(respJson.getString("task"), reqHeaders, TWO_HOURS_IN_MILLIS)) { return "Task completed successfully , task Id " + respJson; } return "Task failed/still running, task Id " + respJson; } else { String taskId = respJson.optString("task"); if (StringUtils.isBlank(taskId)) { log.error("Response has no taskId, Response body : {}", respJson); return null; } return respJson.getString("task"); } } catch (IOException | IllegalStateException | JSONException ex) { log.error("Error when firing task to overlord {}", ExceptionUtils.getStackTrace(ex)); return format("Http %s \n", ex); } finally { returnClient(resp); } }
[ "public", "String", "fireTask", "(", "CrudStatementMeta", "meta", ",", "Map", "<", "String", ",", "String", ">", "reqHeaders", ",", "boolean", "wait", ")", "{", "CloseableHttpResponse", "resp", "=", "null", ";", "String", "url", "=", "format", "(", "overlord...
Task means an indexer task(goes straight to overlord). @param meta @param reqHeaders @param wait @return
[ "Task", "means", "an", "indexer", "task", "(", "goes", "straight", "to", "overlord", ")", "." ]
train
https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/OverlordAccessor.java#L51-L81
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java
ns_conf_download_policy.update
public static ns_conf_download_policy update(nitro_service client, ns_conf_download_policy resource) throws Exception { resource.validate("modify"); return ((ns_conf_download_policy[]) resource.update_resource(client))[0]; }
java
public static ns_conf_download_policy update(nitro_service client, ns_conf_download_policy resource) throws Exception { resource.validate("modify"); return ((ns_conf_download_policy[]) resource.update_resource(client))[0]; }
[ "public", "static", "ns_conf_download_policy", "update", "(", "nitro_service", "client", ",", "ns_conf_download_policy", "resource", ")", "throws", "Exception", "{", "resource", ".", "validate", "(", "\"modify\"", ")", ";", "return", "(", "(", "ns_conf_download_policy...
<pre> Use this operation to set the polling frequency of the Netscaler configuration file. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "set", "the", "polling", "frequency", "of", "the", "Netscaler", "configuration", "file", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java#L126-L130
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java
LayerDrawable.setLayerInset
public void setLayerInset(int index, int l, int t, int r, int b) { setLayerInsetInternal(index, l, t, r, b, UNDEFINED_INSET, UNDEFINED_INSET); }
java
public void setLayerInset(int index, int l, int t, int r, int b) { setLayerInsetInternal(index, l, t, r, b, UNDEFINED_INSET, UNDEFINED_INSET); }
[ "public", "void", "setLayerInset", "(", "int", "index", ",", "int", "l", ",", "int", "t", ",", "int", "r", ",", "int", "b", ")", "{", "setLayerInsetInternal", "(", "index", ",", "l", ",", "t", ",", "r", ",", "b", ",", "UNDEFINED_INSET", ",", "UNDEF...
Specifies the insets in pixels for the drawable at the specified index. @param index the index of the drawable to adjust @param l number of pixels to add to the left bound @param t number of pixels to add to the top bound @param r number of pixels to subtract from the right bound @param b number of pixels to subtract from the bottom bound @attr ref android.R.styleable#LayerDrawableItem_left @attr ref android.R.styleable#LayerDrawableItem_top @attr ref android.R.styleable#LayerDrawableItem_right @attr ref android.R.styleable#LayerDrawableItem_bottom
[ "Specifies", "the", "insets", "in", "pixels", "for", "the", "drawable", "at", "the", "specified", "index", "." ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L671-L673
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/SessionProxy.java
SessionProxy.getRemoteTable
public RemoteTable getRemoteTable(String strRecordName) throws RemoteException { BaseTransport transport = this.createProxyTransport(GET_REMOTE_TABLE); transport.addParam(NAME, strRecordName); String strTableID = (String)transport.sendMessageAndGetReply(); // See if I have this one already TableProxy tableProxy = (TableProxy)this.getChildList().get(strTableID); if (tableProxy == null) tableProxy = new TableProxy(this, strTableID); // This will add it to my list return tableProxy; }
java
public RemoteTable getRemoteTable(String strRecordName) throws RemoteException { BaseTransport transport = this.createProxyTransport(GET_REMOTE_TABLE); transport.addParam(NAME, strRecordName); String strTableID = (String)transport.sendMessageAndGetReply(); // See if I have this one already TableProxy tableProxy = (TableProxy)this.getChildList().get(strTableID); if (tableProxy == null) tableProxy = new TableProxy(this, strTableID); // This will add it to my list return tableProxy; }
[ "public", "RemoteTable", "getRemoteTable", "(", "String", "strRecordName", ")", "throws", "RemoteException", "{", "BaseTransport", "transport", "=", "this", ".", "createProxyTransport", "(", "GET_REMOTE_TABLE", ")", ";", "transport", ".", "addParam", "(", "NAME", ",...
Get this table for this session. @param strRecordName Table Name or Class Name of the record to find
[ "Get", "this", "table", "for", "this", "session", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/SessionProxy.java#L60-L70
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/PathUtils.java
PathUtils.checkCase
public static boolean checkCase(final File file, String pathToTest) { if (pathToTest == null || pathToTest.isEmpty()) { return true; } if (IS_OS_CASE_SENSITIVE) { // It is assumed that the file exists. Therefore, its case must // match if we know that the file system is case sensitive. return true; } try { // This will handle the case where the file system is not case sensitive, but // doesn't support symbolic links. A canonical file path will handle this case. if (checkCaseCanonical(file, pathToTest)) { return true; } // We didn't know for sure that the file system is case sensitive and a // canonical check didn't pass. Try to handle both symbolic links and case // insensitive files together. return checkCaseSymlink(file, pathToTest); } catch (PrivilegedActionException e) { // We couldn't access the file system to test the path so must have failed return false; } }
java
public static boolean checkCase(final File file, String pathToTest) { if (pathToTest == null || pathToTest.isEmpty()) { return true; } if (IS_OS_CASE_SENSITIVE) { // It is assumed that the file exists. Therefore, its case must // match if we know that the file system is case sensitive. return true; } try { // This will handle the case where the file system is not case sensitive, but // doesn't support symbolic links. A canonical file path will handle this case. if (checkCaseCanonical(file, pathToTest)) { return true; } // We didn't know for sure that the file system is case sensitive and a // canonical check didn't pass. Try to handle both symbolic links and case // insensitive files together. return checkCaseSymlink(file, pathToTest); } catch (PrivilegedActionException e) { // We couldn't access the file system to test the path so must have failed return false; } }
[ "public", "static", "boolean", "checkCase", "(", "final", "File", "file", ",", "String", "pathToTest", ")", "{", "if", "(", "pathToTest", "==", "null", "||", "pathToTest", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "IS_O...
The artifact API is case sensitive even on a file system that is not case sensitive. This method will test that the case of the supplied <em>existing</em> file matches the case in the pathToTest. It is assumed that you already tested that the file exists using the pathToTest. Therefore, on a case sensitive files system, the case must match and true is returned without doing any further testing. In other words, the check for file existence is sufficient on a case sensitive file system, and there is no reason to call this checkCase method. If the file system is not case sensitive, then a test for file existence will pass even when the case does not match. So this method will do further testing to ensure the case matches. It assumes that the final part of the file's path will be equal to the whole of the pathToTest. The path to test should be a unix style path with "/" as the separator character, regardless of the operating system. If the file is a directory then a trailing slash or the absence thereof will not affect whether the case matches since the trailing slash on a directory is optional. If you call checkCase(...) with a file that does NOT exist: On case sensitive file system: Always returns true On case insensitive file system: It compares the pathToTest to the file path of the java.io.File that you passed in rather than the file on disk (since it doesn't exist). file.getCanonicalFile() returns the path using the case of the file on disk, if it exists. If the file doesn't exist then it returns the path using the case of the java.io.File itself. @param file The existing file to compare against @param pathToTest The path to test if it is the same @return <code>true</code> if the case is the same in the file and the pathToTest
[ "The", "artifact", "API", "is", "case", "sensitive", "even", "on", "a", "file", "system", "that", "is", "not", "case", "sensitive", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/PathUtils.java#L1252-L1279
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.getFlakeIdGeneratorConfig
public FlakeIdGeneratorConfig getFlakeIdGeneratorConfig(String name) { return ConfigUtils.getConfig(configPatternMatcher, flakeIdGeneratorConfigMap, name, FlakeIdGeneratorConfig.class, new BiConsumer<FlakeIdGeneratorConfig, String>() { @Override public void accept(FlakeIdGeneratorConfig flakeIdGeneratorConfig, String name) { flakeIdGeneratorConfig.setName(name); } }); }
java
public FlakeIdGeneratorConfig getFlakeIdGeneratorConfig(String name) { return ConfigUtils.getConfig(configPatternMatcher, flakeIdGeneratorConfigMap, name, FlakeIdGeneratorConfig.class, new BiConsumer<FlakeIdGeneratorConfig, String>() { @Override public void accept(FlakeIdGeneratorConfig flakeIdGeneratorConfig, String name) { flakeIdGeneratorConfig.setName(name); } }); }
[ "public", "FlakeIdGeneratorConfig", "getFlakeIdGeneratorConfig", "(", "String", "name", ")", "{", "return", "ConfigUtils", ".", "getConfig", "(", "configPatternMatcher", ",", "flakeIdGeneratorConfigMap", ",", "name", ",", "FlakeIdGeneratorConfig", ".", "class", ",", "ne...
Returns the {@link FlakeIdGeneratorConfig} for the given name, creating one if necessary and adding it to the collection of known configurations. <p> The configuration is found by matching the configuration name pattern to the provided {@code name} without the partition qualifier (the part of the name after {@code '@'}). If no configuration matches, it will create one by cloning the {@code "default"} configuration and add it to the configuration collection. <p> This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking {@link #addFlakeIdGeneratorConfig(FlakeIdGeneratorConfig)}. <p> Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored. @param name name of the flake ID generator config @return the cache configuration @throws ConfigurationException if ambiguous configurations are found @see com.hazelcast.partition.strategy.StringPartitioningStrategy#getBaseName(java.lang.String) @see #setConfigPatternMatcher(ConfigPatternMatcher) @see #getConfigPatternMatcher()
[ "Returns", "the", "{", "@link", "FlakeIdGeneratorConfig", "}", "for", "the", "given", "name", "creating", "one", "if", "necessary", "and", "adding", "it", "to", "the", "collection", "of", "known", "configurations", ".", "<p", ">", "The", "configuration", "is",...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3052-L3060
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java
CommonOps_DSCC.symmLowerToFull
public static void symmLowerToFull( DMatrixSparseCSC A , DMatrixSparseCSC B , @Nullable IGrowArray gw ) { ImplCommonOps_DSCC.symmLowerToFull(A, B, gw); }
java
public static void symmLowerToFull( DMatrixSparseCSC A , DMatrixSparseCSC B , @Nullable IGrowArray gw ) { ImplCommonOps_DSCC.symmLowerToFull(A, B, gw); }
[ "public", "static", "void", "symmLowerToFull", "(", "DMatrixSparseCSC", "A", ",", "DMatrixSparseCSC", "B", ",", "@", "Nullable", "IGrowArray", "gw", ")", "{", "ImplCommonOps_DSCC", ".", "symmLowerToFull", "(", "A", ",", "B", ",", "gw", ")", ";", "}" ]
Given a symmetric matrix, which is represented by a lower triangular matrix, convert it back into a full symmetric matrix @param A (Input) Lower triangular matrix @param B (Output) Symmetric matrix. @param gw (Optional) Workspace. Can be null.
[ "Given", "a", "symmetric", "matrix", "which", "is", "represented", "by", "a", "lower", "triangular", "matrix", "convert", "it", "back", "into", "a", "full", "symmetric", "matrix" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L323-L326
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java
AbstractHttp2ConnectionHandlerBuilder.codec
protected B codec(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder) { enforceConstraint("codec", "server", isServer); enforceConstraint("codec", "maxReservedStreams", maxReservedStreams); enforceConstraint("codec", "connection", connection); enforceConstraint("codec", "frameLogger", frameLogger); enforceConstraint("codec", "validateHeaders", validateHeaders); enforceConstraint("codec", "headerSensitivityDetector", headerSensitivityDetector); enforceConstraint("codec", "encoderEnforceMaxConcurrentStreams", encoderEnforceMaxConcurrentStreams); checkNotNull(decoder, "decoder"); checkNotNull(encoder, "encoder"); if (decoder.connection() != encoder.connection()) { throw new IllegalArgumentException("The specified encoder and decoder have different connections."); } this.decoder = decoder; this.encoder = encoder; return self(); }
java
protected B codec(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder) { enforceConstraint("codec", "server", isServer); enforceConstraint("codec", "maxReservedStreams", maxReservedStreams); enforceConstraint("codec", "connection", connection); enforceConstraint("codec", "frameLogger", frameLogger); enforceConstraint("codec", "validateHeaders", validateHeaders); enforceConstraint("codec", "headerSensitivityDetector", headerSensitivityDetector); enforceConstraint("codec", "encoderEnforceMaxConcurrentStreams", encoderEnforceMaxConcurrentStreams); checkNotNull(decoder, "decoder"); checkNotNull(encoder, "encoder"); if (decoder.connection() != encoder.connection()) { throw new IllegalArgumentException("The specified encoder and decoder have different connections."); } this.decoder = decoder; this.encoder = encoder; return self(); }
[ "protected", "B", "codec", "(", "Http2ConnectionDecoder", "decoder", ",", "Http2ConnectionEncoder", "encoder", ")", "{", "enforceConstraint", "(", "\"codec\"", ",", "\"server\"", ",", "isServer", ")", ";", "enforceConstraint", "(", "\"codec\"", ",", "\"maxReservedStre...
Sets the {@link Http2ConnectionDecoder} and {@link Http2ConnectionEncoder} to use.
[ "Sets", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java#L254-L274
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java
DirectoryServiceClient.updateServiceInstanceInternalStatus
public void updateServiceInstanceInternalStatus(String serviceName, String instanceId, OperationalStatus status){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UpdateServiceInstanceInternalStatus); UpdateServiceInstanceInternalStatusProtocol protocol = new UpdateServiceInstanceInternalStatusProtocol(serviceName, instanceId, status); connection.submitRequest(header, protocol, null); }
java
public void updateServiceInstanceInternalStatus(String serviceName, String instanceId, OperationalStatus status){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UpdateServiceInstanceInternalStatus); UpdateServiceInstanceInternalStatusProtocol protocol = new UpdateServiceInstanceInternalStatusProtocol(serviceName, instanceId, status); connection.submitRequest(header, protocol, null); }
[ "public", "void", "updateServiceInstanceInternalStatus", "(", "String", "serviceName", ",", "String", "instanceId", ",", "OperationalStatus", "status", ")", "{", "ProtocolHeader", "header", "=", "new", "ProtocolHeader", "(", ")", ";", "header", ".", "setType", "(", ...
Update ServiceInstance internal status. @param serviceName the service name. @param instanceId the instanceId. @param status the OeperationalStatus.
[ "Update", "ServiceInstance", "internal", "status", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L452-L458
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.getKey
public final Key getKey(String alias, char[] password) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } return keyStoreSpi.engineGetKey(alias, password); }
java
public final Key getKey(String alias, char[] password) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } return keyStoreSpi.engineGetKey(alias, password); }
[ "public", "final", "Key", "getKey", "(", "String", "alias", ",", "char", "[", "]", "password", ")", "throws", "KeyStoreException", ",", "NoSuchAlgorithmException", ",", "UnrecoverableKeyException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new", ...
Returns the key associated with the given alias, using the given password to recover it. The key must have been associated with the alias by a call to <code>setKeyEntry</code>, or by a call to <code>setEntry</code> with a <code>PrivateKeyEntry</code> or <code>SecretKeyEntry</code>. @param alias the alias name @param password the password for recovering the key @return the requested key, or null if the given alias does not exist or does not identify a key-related entry. @exception KeyStoreException if the keystore has not been initialized (loaded). @exception NoSuchAlgorithmException if the algorithm for recovering the key cannot be found @exception UnrecoverableKeyException if the key cannot be recovered (e.g., the given password is wrong).
[ "Returns", "the", "key", "associated", "with", "the", "given", "alias", "using", "the", "given", "password", "to", "recover", "it", ".", "The", "key", "must", "have", "been", "associated", "with", "the", "alias", "by", "a", "call", "to", "<code", ">", "s...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L827-L835
arquillian/arquillian-extension-warp
impl/src/main/java/org/jboss/arquillian/warp/impl/client/execution/SecurityActions.java
SecurityActions.newInstance
static <T> T newInstance(final String className, final Class<?>[] argumentTypes, final Object[] arguments, final Class<T> expectedType) { if (className == null) { throw new IllegalArgumentException("ClassName must be specified"); } if (argumentTypes == null) { throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments"); } if (arguments == null) { throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments"); } final Object obj; try { final ClassLoader tccl = getThreadContextClassLoader(); final Class<?> implClass = Class.forName(className, false, tccl); Constructor<?> constructor = getConstructor(implClass, argumentTypes); obj = constructor.newInstance(arguments); } catch (Exception e) { throw new RuntimeException( "Could not create new instance of " + className + ", missing package from classpath?", e); } // Cast try { return expectedType.cast(obj); } catch (final ClassCastException cce) { // Reconstruct so we get some useful information throw new ClassCastException("Incorrect expected type, " + expectedType.getName() + ", defined for " + obj.getClass().getName()); } }
java
static <T> T newInstance(final String className, final Class<?>[] argumentTypes, final Object[] arguments, final Class<T> expectedType) { if (className == null) { throw new IllegalArgumentException("ClassName must be specified"); } if (argumentTypes == null) { throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments"); } if (arguments == null) { throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments"); } final Object obj; try { final ClassLoader tccl = getThreadContextClassLoader(); final Class<?> implClass = Class.forName(className, false, tccl); Constructor<?> constructor = getConstructor(implClass, argumentTypes); obj = constructor.newInstance(arguments); } catch (Exception e) { throw new RuntimeException( "Could not create new instance of " + className + ", missing package from classpath?", e); } // Cast try { return expectedType.cast(obj); } catch (final ClassCastException cce) { // Reconstruct so we get some useful information throw new ClassCastException("Incorrect expected type, " + expectedType.getName() + ", defined for " + obj.getClass().getName()); } }
[ "static", "<", "T", ">", "T", "newInstance", "(", "final", "String", "className", ",", "final", "Class", "<", "?", ">", "[", "]", "argumentTypes", ",", "final", "Object", "[", "]", "arguments", ",", "final", "Class", "<", "T", ">", "expectedType", ")",...
Create a new instance by finding a constructor that matches the argumentTypes signature using the arguments for instantiation. @param className Full classname of class to create @param argumentTypes The constructor argument types @param arguments The constructor arguments @return a new instance @throws IllegalArgumentException if className, argumentTypes, or arguments are null @throws RuntimeException if any exceptions during creation @author <a href="mailto:aslak@conduct.no">Aslak Knutsen</a> @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
[ "Create", "a", "new", "instance", "by", "finding", "a", "constructor", "that", "matches", "the", "argumentTypes", "signature", "using", "the", "arguments", "for", "instantiation", "." ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/client/execution/SecurityActions.java#L120-L150
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.getObjectMetadata
public ObjectMetadata getObjectMetadata(String bucketName, String key) { return this.getObjectMetadata(new GetObjectMetadataRequest(bucketName, key)); }
java
public ObjectMetadata getObjectMetadata(String bucketName, String key) { return this.getObjectMetadata(new GetObjectMetadataRequest(bucketName, key)); }
[ "public", "ObjectMetadata", "getObjectMetadata", "(", "String", "bucketName", ",", "String", "key", ")", "{", "return", "this", ".", "getObjectMetadata", "(", "new", "GetObjectMetadataRequest", "(", "bucketName", ",", "key", ")", ")", ";", "}" ]
Gets the metadata for the specified Bos object without actually fetching the object itself. This is useful in obtaining only the object metadata, and avoids wasting bandwidth on fetching the object data. <p> The object metadata contains information such as content type, content disposition, etc., as well as custom user metadata that can be associated with an object in Bos. @param bucketName The name of the bucket containing the object's whose metadata is being retrieved. @param key The key of the object whose metadata is being retrieved. @return All Bos object metadata for the specified object.
[ "Gets", "the", "metadata", "for", "the", "specified", "Bos", "object", "without", "actually", "fetching", "the", "object", "itself", ".", "This", "is", "useful", "in", "obtaining", "only", "the", "object", "metadata", "and", "avoids", "wasting", "bandwidth", "...
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L757-L759
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzleResultSet.java
DrizzleResultSet.getDate
public Date getDate(final int columnIndex, final Calendar cal) throws SQLException { try { return getValueObject(columnIndex).getDate(cal); } catch (ParseException e) { throw SQLExceptionMapper.getSQLException("Could not parse as date"); } }
java
public Date getDate(final int columnIndex, final Calendar cal) throws SQLException { try { return getValueObject(columnIndex).getDate(cal); } catch (ParseException e) { throw SQLExceptionMapper.getSQLException("Could not parse as date"); } }
[ "public", "Date", "getDate", "(", "final", "int", "columnIndex", ",", "final", "Calendar", "cal", ")", "throws", "SQLException", "{", "try", "{", "return", "getValueObject", "(", "columnIndex", ")", ".", "getDate", "(", "cal", ")", ";", "}", "catch", "(", ...
Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object as a <code>java.sql.Date</code> object in the Java programming language. This method uses the given calendar to construct an appropriate millisecond value for the date if the underlying database does not store timezone information. @param columnIndex the first column is 1, the second is 2, ... @param cal the <code>java.util.Calendar</code> object to use in constructing the date @return the column value as a <code>java.sql.Date</code> object; if the value is SQL <code>NULL</code>, the value returned is <code>null</code> in the Java programming language @throws java.sql.SQLException if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set @since 1.2
[ "Retrieves", "the", "value", "of", "the", "designated", "column", "in", "the", "current", "row", "of", "this", "<code", ">", "ResultSet<", "/", "code", ">", "object", "as", "a", "<code", ">", "java", ".", "sql", ".", "Date<", "/", "code", ">", "object"...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleResultSet.java#L2078-L2084
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunActionRepetitionsInner.java
WorkflowRunActionRepetitionsInner.listAsync
public Observable<List<WorkflowRunActionRepetitionDefinitionInner>> listAsync(String resourceGroupName, String workflowName, String runName, String actionName) { return listWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName).map(new Func1<ServiceResponse<List<WorkflowRunActionRepetitionDefinitionInner>>, List<WorkflowRunActionRepetitionDefinitionInner>>() { @Override public List<WorkflowRunActionRepetitionDefinitionInner> call(ServiceResponse<List<WorkflowRunActionRepetitionDefinitionInner>> response) { return response.body(); } }); }
java
public Observable<List<WorkflowRunActionRepetitionDefinitionInner>> listAsync(String resourceGroupName, String workflowName, String runName, String actionName) { return listWithServiceResponseAsync(resourceGroupName, workflowName, runName, actionName).map(new Func1<ServiceResponse<List<WorkflowRunActionRepetitionDefinitionInner>>, List<WorkflowRunActionRepetitionDefinitionInner>>() { @Override public List<WorkflowRunActionRepetitionDefinitionInner> call(ServiceResponse<List<WorkflowRunActionRepetitionDefinitionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "WorkflowRunActionRepetitionDefinitionInner", ">", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "runName", ",", "String", "actionName", ")", "{", "return", "listWithServic...
Get all of a workflow run action repetitions. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param runName The workflow run name. @param actionName The workflow action name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;WorkflowRunActionRepetitionDefinitionInner&gt; object
[ "Get", "all", "of", "a", "workflow", "run", "action", "repetitions", "." ]
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/WorkflowRunActionRepetitionsInner.java#L111-L118
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java
WorkManagerImpl.checkAndVerifyWork
private void checkAndVerifyWork(Work work, ExecutionContext executionContext) throws WorkException { if (specCompliant) { verifyWork(work); } if (work instanceof WorkContextProvider && executionContext != null) { //Implements WorkContextProvider and not-null ExecutionContext throw new WorkRejectedException(bundle.workExecutionContextMustNullImplementsWorkContextProvider()); } }
java
private void checkAndVerifyWork(Work work, ExecutionContext executionContext) throws WorkException { if (specCompliant) { verifyWork(work); } if (work instanceof WorkContextProvider && executionContext != null) { //Implements WorkContextProvider and not-null ExecutionContext throw new WorkRejectedException(bundle.workExecutionContextMustNullImplementsWorkContextProvider()); } }
[ "private", "void", "checkAndVerifyWork", "(", "Work", "work", ",", "ExecutionContext", "executionContext", ")", "throws", "WorkException", "{", "if", "(", "specCompliant", ")", "{", "verifyWork", "(", "work", ")", ";", "}", "if", "(", "work", "instanceof", "Wo...
Check and verify work before submitting. @param work the work instance @param executionContext any execution context that is passed by apadater @throws WorkException if any exception occurs
[ "Check", "and", "verify", "work", "before", "submitting", "." ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java#L1060-L1072
alkacon/opencms-core
src/org/opencms/gwt/CmsGwtActionElement.java
CmsGwtActionElement.exportCommon
public static String exportCommon(CmsObject cms, CmsCoreData coreData) throws Exception { // determine the workplace locale String wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms).getLanguage(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(wpLocale)) { // if no locale was found, take English as locale wpLocale = Locale.ENGLISH.getLanguage(); } StringBuffer sb = new StringBuffer(); // append meta tag to set the IE to standard document mode sb.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n"); sb.append( "<script type=\"text/javascript\" src=\"" + OpenCms.getStaticExportManager().getVfsPrefix() + "/" + CmsMessagesService.class.getName() + ".gwt?" + CmsLocaleManager.PARAMETER_LOCALE + "=" + wpLocale + "\"></script>\n"); // print out the missing permutation message to be used from the nocache.js generated by custom linker // see org.opencms.gwt.linker.CmsIFrameLinker sb.append( wrapScript( "var ", CMS_NO_PERMUTATION_MESSAGE, "='", Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.ERR_NO_PERMUTATION_AVAILABLE_0), "';\n")); String prefetchedData = exportDictionary( CmsCoreData.DICT_NAME, I_CmsCoreService.class.getMethod("prefetch"), coreData); sb.append(prefetchedData); // sb.append(ClientMessages.get().export(wpLocale)); sb.append("<style type=\"text/css\">\n @import url(\"").append(iconCssLink(cms)).append("\");\n </style>\n"); // append additional style sheets Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets(); for (String stylesheet : stylesheets) { sb.append("<style type=\"text/css\">\n @import url(\"").append(stylesheet).append("\");\n </style>\n"); } // append the workplace locale information sb.append("<meta name=\"gwt:property\" content=\"locale=").append(wpLocale).append("\" />\n"); return sb.toString(); }
java
public static String exportCommon(CmsObject cms, CmsCoreData coreData) throws Exception { // determine the workplace locale String wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms).getLanguage(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(wpLocale)) { // if no locale was found, take English as locale wpLocale = Locale.ENGLISH.getLanguage(); } StringBuffer sb = new StringBuffer(); // append meta tag to set the IE to standard document mode sb.append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n"); sb.append( "<script type=\"text/javascript\" src=\"" + OpenCms.getStaticExportManager().getVfsPrefix() + "/" + CmsMessagesService.class.getName() + ".gwt?" + CmsLocaleManager.PARAMETER_LOCALE + "=" + wpLocale + "\"></script>\n"); // print out the missing permutation message to be used from the nocache.js generated by custom linker // see org.opencms.gwt.linker.CmsIFrameLinker sb.append( wrapScript( "var ", CMS_NO_PERMUTATION_MESSAGE, "='", Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key( Messages.ERR_NO_PERMUTATION_AVAILABLE_0), "';\n")); String prefetchedData = exportDictionary( CmsCoreData.DICT_NAME, I_CmsCoreService.class.getMethod("prefetch"), coreData); sb.append(prefetchedData); // sb.append(ClientMessages.get().export(wpLocale)); sb.append("<style type=\"text/css\">\n @import url(\"").append(iconCssLink(cms)).append("\");\n </style>\n"); // append additional style sheets Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets(); for (String stylesheet : stylesheets) { sb.append("<style type=\"text/css\">\n @import url(\"").append(stylesheet).append("\");\n </style>\n"); } // append the workplace locale information sb.append("<meta name=\"gwt:property\" content=\"locale=").append(wpLocale).append("\" />\n"); return sb.toString(); }
[ "public", "static", "String", "exportCommon", "(", "CmsObject", "cms", ",", "CmsCoreData", "coreData", ")", "throws", "Exception", "{", "// determine the workplace locale", "String", "wpLocale", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getWorkplaceL...
Returns the serialized data for the core provider wrapped into a script tag.<p> @param cms the CMS context @param coreData the core data to write into the page @return the data @throws Exception if something goes wrong
[ "Returns", "the", "serialized", "data", "for", "the", "core", "provider", "wrapped", "into", "a", "script", "tag", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsGwtActionElement.java#L117-L167
tvesalainen/util
util/src/main/java/org/vesalainen/code/TransactionalSetter.java
TransactionalSetter.getInstance
public static <T extends TransactionalSetter> T getInstance(Class<T> cls, Object intf) { Class<?>[] interfaces = cls.getInterfaces(); if (interfaces.length != 1) { throw new IllegalArgumentException(cls+" should implement exactly one interface"); } boolean ok = false; if (!interfaces[0].isAssignableFrom(intf.getClass())) { throw new IllegalArgumentException(cls+" doesn't implement "+intf); } try { TransactionalSetterClass annotation = cls.getAnnotation(TransactionalSetterClass.class); if (annotation == null) { throw new IllegalArgumentException("@"+TransactionalSetterClass.class.getSimpleName()+" missing in cls"); } Class<?> c = Class.forName(annotation.value()); T t =(T) c.newInstance(); t.intf = intf; return t; } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) { throw new IllegalArgumentException(ex); } }
java
public static <T extends TransactionalSetter> T getInstance(Class<T> cls, Object intf) { Class<?>[] interfaces = cls.getInterfaces(); if (interfaces.length != 1) { throw new IllegalArgumentException(cls+" should implement exactly one interface"); } boolean ok = false; if (!interfaces[0].isAssignableFrom(intf.getClass())) { throw new IllegalArgumentException(cls+" doesn't implement "+intf); } try { TransactionalSetterClass annotation = cls.getAnnotation(TransactionalSetterClass.class); if (annotation == null) { throw new IllegalArgumentException("@"+TransactionalSetterClass.class.getSimpleName()+" missing in cls"); } Class<?> c = Class.forName(annotation.value()); T t =(T) c.newInstance(); t.intf = intf; return t; } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) { throw new IllegalArgumentException(ex); } }
[ "public", "static", "<", "T", "extends", "TransactionalSetter", ">", "T", "getInstance", "(", "Class", "<", "T", ">", "cls", ",", "Object", "intf", ")", "{", "Class", "<", "?", ">", "[", "]", "interfaces", "=", "cls", ".", "getInterfaces", "(", ")", ...
Creates a instance of a class TransactionalSetter subclass. @param <T> Type of TransactionalSetter subclass @param cls TransactionalSetter subclass class @param intf Interface implemented by TransactionalSetter subclass @return
[ "Creates", "a", "instance", "of", "a", "class", "TransactionalSetter", "subclass", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/code/TransactionalSetter.java#L75-L103
diegocarloslima/ByakuGallery
ByakuGallery/src/com/diegocarloslima/byakugallery/lib/TouchImageView.java
TouchImageView.computeTranslation
private static float computeTranslation(float viewSize, float drawableSize, float currentTranslation, float delta) { final float sideFreeSpace = (viewSize - drawableSize) / 2F; if(sideFreeSpace > 0) { return sideFreeSpace - currentTranslation; } else if(currentTranslation + delta > 0) { return -currentTranslation; } else if(currentTranslation + delta < viewSize - drawableSize) { return viewSize - drawableSize - currentTranslation; } return delta; }
java
private static float computeTranslation(float viewSize, float drawableSize, float currentTranslation, float delta) { final float sideFreeSpace = (viewSize - drawableSize) / 2F; if(sideFreeSpace > 0) { return sideFreeSpace - currentTranslation; } else if(currentTranslation + delta > 0) { return -currentTranslation; } else if(currentTranslation + delta < viewSize - drawableSize) { return viewSize - drawableSize - currentTranslation; } return delta; }
[ "private", "static", "float", "computeTranslation", "(", "float", "viewSize", ",", "float", "drawableSize", ",", "float", "currentTranslation", ",", "float", "delta", ")", "{", "final", "float", "sideFreeSpace", "=", "(", "viewSize", "-", "drawableSize", ")", "/...
The translation values must be in [0, viewSize - drawableSize], except if we have free space. In that case we will translate to half of the free space
[ "The", "translation", "values", "must", "be", "in", "[", "0", "viewSize", "-", "drawableSize", "]", "except", "if", "we", "have", "free", "space", ".", "In", "that", "case", "we", "will", "translate", "to", "half", "of", "the", "free", "space" ]
train
https://github.com/diegocarloslima/ByakuGallery/blob/a0472e8c9f79184b6b83351da06a5544e4dc1be4/ByakuGallery/src/com/diegocarloslima/byakugallery/lib/TouchImageView.java#L342-L354
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/XmlWriter.java
XmlWriter.appendEscapedString
private void appendEscapedString(String s, StringBuilder builder) { if (s == null) s = ""; int pos; int start = 0; int len = s.length(); for (pos = 0; pos < len; pos++) { char ch = s.charAt(pos); String escape; switch (ch) { case '\t': escape = "&#9;"; break; case '\n': escape = "&#10;"; break; case '\r': escape = "&#13;"; break; case '&': escape = "&amp;"; break; case '"': escape = "&quot;"; break; case '<': escape = "&lt;"; break; case '>': escape = "&gt;"; break; default: escape = null; break; } // If we found an escape character, write all the characters up to that // character, then write the escaped char and get back to scanning if (escape != null) { if (start < pos) builder.append(s, start, pos); sb.append(escape); start = pos + 1; } } // Write anything that's left if (start < pos) sb.append(s, start, pos); }
java
private void appendEscapedString(String s, StringBuilder builder) { if (s == null) s = ""; int pos; int start = 0; int len = s.length(); for (pos = 0; pos < len; pos++) { char ch = s.charAt(pos); String escape; switch (ch) { case '\t': escape = "&#9;"; break; case '\n': escape = "&#10;"; break; case '\r': escape = "&#13;"; break; case '&': escape = "&amp;"; break; case '"': escape = "&quot;"; break; case '<': escape = "&lt;"; break; case '>': escape = "&gt;"; break; default: escape = null; break; } // If we found an escape character, write all the characters up to that // character, then write the escaped char and get back to scanning if (escape != null) { if (start < pos) builder.append(s, start, pos); sb.append(escape); start = pos + 1; } } // Write anything that's left if (start < pos) sb.append(s, start, pos); }
[ "private", "void", "appendEscapedString", "(", "String", "s", ",", "StringBuilder", "builder", ")", "{", "if", "(", "s", "==", "null", ")", "s", "=", "\"\"", ";", "int", "pos", ";", "int", "start", "=", "0", ";", "int", "len", "=", "s", ".", "lengt...
Appends the specified string (with any non-XML-compatible characters replaced with the corresponding escape code) to the specified StringBuilder. @param s The string to escape and append to the specified StringBuilder. @param builder The StringBuilder to which the escaped string should be appened.
[ "Appends", "the", "specified", "string", "(", "with", "any", "non", "-", "XML", "-", "compatible", "characters", "replaced", "with", "the", "corresponding", "escape", "code", ")", "to", "the", "specified", "StringBuilder", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/XmlWriter.java#L105-L153
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_database_name_request_POST
public OvhTask serviceName_database_name_request_POST(String serviceName, String name, net.minidev.ovh.api.hosting.web.database.OvhRequestActionEnum action) throws IOException { String qPath = "/hosting/web/{serviceName}/database/{name}/request"; StringBuilder sb = path(qPath, serviceName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_database_name_request_POST(String serviceName, String name, net.minidev.ovh.api.hosting.web.database.OvhRequestActionEnum action) throws IOException { String qPath = "/hosting/web/{serviceName}/database/{name}/request"; StringBuilder sb = path(qPath, serviceName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_database_name_request_POST", "(", "String", "serviceName", ",", "String", "name", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "hosting", ".", "web", ".", "database", ".", "OvhRequestActionEnum", "action", ")", "thro...
Request specific operation for your database REST: POST /hosting/web/{serviceName}/database/{name}/request @param action [required] Action you want to request @param serviceName [required] The internal name of your hosting @param name [required] Database name (like mydb.mysql.db or mydb.postgres.db)
[ "Request", "specific", "operation", "for", "your", "database" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1160-L1167
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTreeIndex.java
MkTabTreeIndex.createNewLeafEntry
protected MkTabEntry createNewLeafEntry(DBID id, O object, double parentDistance) { return new MkTabLeafEntry(id, parentDistance, knnDistances(object)); }
java
protected MkTabEntry createNewLeafEntry(DBID id, O object, double parentDistance) { return new MkTabLeafEntry(id, parentDistance, knnDistances(object)); }
[ "protected", "MkTabEntry", "createNewLeafEntry", "(", "DBID", "id", ",", "O", "object", ",", "double", "parentDistance", ")", "{", "return", "new", "MkTabLeafEntry", "(", "id", ",", "parentDistance", ",", "knnDistances", "(", "object", ")", ")", ";", "}" ]
Creates a new leaf entry representing the specified data object in the specified subtree. @param object the data object to be represented by the new entry @param parentDistance the distance from the object to the routing object of the parent node
[ "Creates", "a", "new", "leaf", "entry", "representing", "the", "specified", "data", "object", "in", "the", "specified", "subtree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mktab/MkTabTreeIndex.java#L76-L78
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java
Item.withBigInteger
public Item withBigInteger(String attrName, BigInteger val) { checkInvalidAttrName(attrName); return withNumber(attrName, val); }
java
public Item withBigInteger(String attrName, BigInteger val) { checkInvalidAttrName(attrName); return withNumber(attrName, val); }
[ "public", "Item", "withBigInteger", "(", "String", "attrName", ",", "BigInteger", "val", ")", "{", "checkInvalidAttrName", "(", "attrName", ")", ";", "return", "withNumber", "(", "attrName", ",", "val", ")", ";", "}" ]
Sets the value of the specified attribute in the current item to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "attribute", "in", "the", "current", "item", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java#L296-L299
liferay/com-liferay-commerce
commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java
CommerceCurrencyPersistenceImpl.findByG_C
@Override public CommerceCurrency findByG_C(long groupId, String code) throws NoSuchCurrencyException { CommerceCurrency commerceCurrency = fetchByG_C(groupId, code); if (commerceCurrency == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", code="); msg.append(code); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCurrencyException(msg.toString()); } return commerceCurrency; }
java
@Override public CommerceCurrency findByG_C(long groupId, String code) throws NoSuchCurrencyException { CommerceCurrency commerceCurrency = fetchByG_C(groupId, code); if (commerceCurrency == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", code="); msg.append(code); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCurrencyException(msg.toString()); } return commerceCurrency; }
[ "@", "Override", "public", "CommerceCurrency", "findByG_C", "(", "long", "groupId", ",", "String", "code", ")", "throws", "NoSuchCurrencyException", "{", "CommerceCurrency", "commerceCurrency", "=", "fetchByG_C", "(", "groupId", ",", "code", ")", ";", "if", "(", ...
Returns the commerce currency where groupId = &#63; and code = &#63; or throws a {@link NoSuchCurrencyException} if it could not be found. @param groupId the group ID @param code the code @return the matching commerce currency @throws NoSuchCurrencyException if a matching commerce currency could not be found
[ "Returns", "the", "commerce", "currency", "where", "groupId", "=", "&#63", ";", "and", "code", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCurrencyException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L2011-L2037
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.homographyStereo2Lines
public static DMatrixRMaj homographyStereo2Lines( DMatrixRMaj F , PairLineNorm line0, PairLineNorm line1) { HomographyInducedStereo2Line alg = new HomographyInducedStereo2Line(); alg.setFundamental(F,null); if( !alg.process(line0,line1) ) return null; return alg.getHomography(); }
java
public static DMatrixRMaj homographyStereo2Lines( DMatrixRMaj F , PairLineNorm line0, PairLineNorm line1) { HomographyInducedStereo2Line alg = new HomographyInducedStereo2Line(); alg.setFundamental(F,null); if( !alg.process(line0,line1) ) return null; return alg.getHomography(); }
[ "public", "static", "DMatrixRMaj", "homographyStereo2Lines", "(", "DMatrixRMaj", "F", ",", "PairLineNorm", "line0", ",", "PairLineNorm", "line1", ")", "{", "HomographyInducedStereo2Line", "alg", "=", "new", "HomographyInducedStereo2Line", "(", ")", ";", "alg", ".", ...
Computes the homography induced from a planar surface when viewed from two views using correspondences of two lines. Observations must be on the planar surface. @see HomographyInducedStereo2Line @param F Fundamental matrix @param line0 Line on the plane @param line1 Line on the plane @return The homography from view 1 to view 2 or null if it fails
[ "Computes", "the", "homography", "induced", "from", "a", "planar", "surface", "when", "viewed", "from", "two", "views", "using", "correspondences", "of", "two", "lines", ".", "Observations", "must", "be", "on", "the", "planar", "surface", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L573-L580
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java
SimpleBitfinexApiBroker.authenticateAndWait
private void authenticateAndWait(final CountDownLatch latch) throws InterruptedException, BitfinexClientException { if (authenticated) { return; } sendCommand(new AuthCommand(configuration.getAuthNonceProducer())); logger.debug("Waiting for connection ready events"); latch.await(10, TimeUnit.SECONDS); if (!authenticated) { throw new BitfinexClientException("Unable to perform authentication, permissions are: " + permissions); } }
java
private void authenticateAndWait(final CountDownLatch latch) throws InterruptedException, BitfinexClientException { if (authenticated) { return; } sendCommand(new AuthCommand(configuration.getAuthNonceProducer())); logger.debug("Waiting for connection ready events"); latch.await(10, TimeUnit.SECONDS); if (!authenticated) { throw new BitfinexClientException("Unable to perform authentication, permissions are: " + permissions); } }
[ "private", "void", "authenticateAndWait", "(", "final", "CountDownLatch", "latch", ")", "throws", "InterruptedException", ",", "BitfinexClientException", "{", "if", "(", "authenticated", ")", "{", "return", ";", "}", "sendCommand", "(", "new", "AuthCommand", "(", ...
Execute the authentication and wait until the socket is ready @throws InterruptedException @throws BitfinexClientException
[ "Execute", "the", "authentication", "and", "wait", "until", "the", "socket", "is", "ready" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L502-L513
marvinlabs/android-slideshow-widget
library/src/main/java/com/marvinlabs/widget/slideshow/SlideShowView.java
SlideShowView.displaySlide
private void displaySlide(final int currentPosition, final int previousPosition) { Log.v("SlideShowView", "Displaying slide at position: " + currentPosition); // Hide the progress indicator hideProgressIndicator(); // Add the slide view to our hierarchy final View inView = getSlideView(currentPosition); inView.setVisibility(View.INVISIBLE); addView(inView); // Notify that the slide is about to be shown notifyBeforeSlideShown(currentPosition); // Transition between current and new slide final TransitionFactory tf = getTransitionFactory(); final Animator inAnimator = tf.getInAnimator(inView, this, previousPosition, currentPosition); if (inAnimator != null) { inAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { inView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animation) { notifySlideShown(currentPosition); } }); inAnimator.start(); } else { inView.setVisibility(View.VISIBLE); notifySlideShown(currentPosition); } int childCount = getChildCount(); if (childCount > 1) { notifyBeforeSlideHidden(previousPosition); final View outView = getChildAt(0); final Animator outAnimator = tf.getOutAnimator(outView, this, previousPosition, currentPosition); if (outAnimator != null) { outAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { outView.setVisibility(View.INVISIBLE); notifySlideHidden(previousPosition); recyclePreviousSlideView(previousPosition, outView); } }); outAnimator.start(); } else { outView.setVisibility(View.INVISIBLE); notifySlideHidden(previousPosition); recyclePreviousSlideView(previousPosition, outView); } } }
java
private void displaySlide(final int currentPosition, final int previousPosition) { Log.v("SlideShowView", "Displaying slide at position: " + currentPosition); // Hide the progress indicator hideProgressIndicator(); // Add the slide view to our hierarchy final View inView = getSlideView(currentPosition); inView.setVisibility(View.INVISIBLE); addView(inView); // Notify that the slide is about to be shown notifyBeforeSlideShown(currentPosition); // Transition between current and new slide final TransitionFactory tf = getTransitionFactory(); final Animator inAnimator = tf.getInAnimator(inView, this, previousPosition, currentPosition); if (inAnimator != null) { inAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { inView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animation) { notifySlideShown(currentPosition); } }); inAnimator.start(); } else { inView.setVisibility(View.VISIBLE); notifySlideShown(currentPosition); } int childCount = getChildCount(); if (childCount > 1) { notifyBeforeSlideHidden(previousPosition); final View outView = getChildAt(0); final Animator outAnimator = tf.getOutAnimator(outView, this, previousPosition, currentPosition); if (outAnimator != null) { outAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { outView.setVisibility(View.INVISIBLE); notifySlideHidden(previousPosition); recyclePreviousSlideView(previousPosition, outView); } }); outAnimator.start(); } else { outView.setVisibility(View.INVISIBLE); notifySlideHidden(previousPosition); recyclePreviousSlideView(previousPosition, outView); } } }
[ "private", "void", "displaySlide", "(", "final", "int", "currentPosition", ",", "final", "int", "previousPosition", ")", "{", "Log", ".", "v", "(", "\"SlideShowView\"", ",", "\"Displaying slide at position: \"", "+", "currentPosition", ")", ";", "// Hide the progress ...
Display the view for the given slide, launching the appropriate transitions if available
[ "Display", "the", "view", "for", "the", "given", "slide", "launching", "the", "appropriate", "transitions", "if", "available" ]
train
https://github.com/marvinlabs/android-slideshow-widget/blob/0d8ddca9a8f62787d78b5eb7f184cabfee569d8d/library/src/main/java/com/marvinlabs/widget/slideshow/SlideShowView.java#L590-L649
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java
XMLAssert.assertXMLValid
public static void assertXMLValid(InputSource xml, String systemId) throws SAXException, ConfigurationException { assertXMLValid(new Validator(xml, systemId)); }
java
public static void assertXMLValid(InputSource xml, String systemId) throws SAXException, ConfigurationException { assertXMLValid(new Validator(xml, systemId)); }
[ "public", "static", "void", "assertXMLValid", "(", "InputSource", "xml", ",", "String", "systemId", ")", "throws", "SAXException", ",", "ConfigurationException", "{", "assertXMLValid", "(", "new", "Validator", "(", "xml", ",", "systemId", ")", ")", ";", "}" ]
Assert that an InputSource containing XML contains valid XML: the document must contain a DOCTYPE to be validated, but the validation will use the systemId to obtain the DTD @param xml @param systemId @throws SAXException @throws ConfigurationException if validation could not be turned on @see Validator
[ "Assert", "that", "an", "InputSource", "containing", "XML", "contains", "valid", "XML", ":", "the", "document", "must", "contain", "a", "DOCTYPE", "to", "be", "validated", "but", "the", "validation", "will", "use", "the", "systemId", "to", "obtain", "the", "...
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L1052-L1055
kubernetes-client/java
kubernetes/src/main/java/io/kubernetes/client/ApiClient.java
ApiClient.buildRequestBodyMultipart
public RequestBody buildRequestBodyMultipart(Map<String, Object> formParams) { MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); for (Entry<String, Object> param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); } else { Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); } } return mpBuilder.build(); }
java
public RequestBody buildRequestBodyMultipart(Map<String, Object> formParams) { MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); for (Entry<String, Object> param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); } else { Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); } } return mpBuilder.build(); }
[ "public", "RequestBody", "buildRequestBodyMultipart", "(", "Map", "<", "String", ",", "Object", ">", "formParams", ")", "{", "MultipartBuilder", "mpBuilder", "=", "new", "MultipartBuilder", "(", ")", ".", "type", "(", "MultipartBuilder", ".", "FORM", ")", ";", ...
Build a multipart (file uploading) request body with the given form parameters, which could contain text fields and file fields. @param formParams Form parameters in the form of Map @return RequestBody
[ "Build", "a", "multipart", "(", "file", "uploading", ")", "request", "body", "with", "the", "given", "form", "parameters", "which", "could", "contain", "text", "fields", "and", "file", "fields", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L1072-L1086
dain/leveldb
leveldb/src/main/java/org/iq80/leveldb/util/SliceInput.java
SliceInput.readBytes
public int readBytes(GatheringByteChannel out, int length) throws IOException { int readBytes = slice.getBytes(position, out, length); position += readBytes; return readBytes; }
java
public int readBytes(GatheringByteChannel out, int length) throws IOException { int readBytes = slice.getBytes(position, out, length); position += readBytes; return readBytes; }
[ "public", "int", "readBytes", "(", "GatheringByteChannel", "out", ",", "int", "length", ")", "throws", "IOException", "{", "int", "readBytes", "=", "slice", ".", "getBytes", "(", "position", ",", "out", ",", "length", ")", ";", "position", "+=", "readBytes",...
Transfers this buffer's data to the specified stream starting at the current {@code position}. @param length the maximum number of bytes to transfer @return the actual number of bytes written out to the specified channel @throws IndexOutOfBoundsException if {@code length} is greater than {@code this.available()} @throws java.io.IOException if the specified channel threw an exception during I/O
[ "Transfers", "this", "buffer", "s", "data", "to", "the", "specified", "stream", "starting", "at", "the", "current", "{", "@code", "position", "}", "." ]
train
https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/SliceInput.java#L349-L355
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java
TermOfUsePanel.newRightsAndDutiesPanel
protected Component newRightsAndDutiesPanel(final String id, final IModel<RightsAndDutiesModelBean> model) { return new RightsAndDutiesPanel(id, model); }
java
protected Component newRightsAndDutiesPanel(final String id, final IModel<RightsAndDutiesModelBean> model) { return new RightsAndDutiesPanel(id, model); }
[ "protected", "Component", "newRightsAndDutiesPanel", "(", "final", "String", "id", ",", "final", "IModel", "<", "RightsAndDutiesModelBean", ">", "model", ")", "{", "return", "new", "RightsAndDutiesPanel", "(", "id", ",", "model", ")", ";", "}" ]
Factory method for creating the new {@link Component} for the rights and duties. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the rights and duties. @param id the id @param model the model @return the new {@link Component} for the rights and duties
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "for", "the", "rights", "and", "duties", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "ove...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L347-L351
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/RabbitMqQueue.java
RabbitMqQueue.putToQueue
protected boolean putToQueue(IQueueMessage<ID, DATA> msg) { try { byte[] msgData = serialize(msg); getProducerChannel().basicPublish("", queueName, null, msgData); return true; } catch (Exception e) { throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
java
protected boolean putToQueue(IQueueMessage<ID, DATA> msg) { try { byte[] msgData = serialize(msg); getProducerChannel().basicPublish("", queueName, null, msgData); return true; } catch (Exception e) { throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
[ "protected", "boolean", "putToQueue", "(", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ")", "{", "try", "{", "byte", "[", "]", "msgData", "=", "serialize", "(", "msg", ")", ";", "getProducerChannel", "(", ")", ".", "basicPublish", "(", "\"\"", ...
Puts a message to Kafka queue, partitioning message by {@link IQueueMessage#qId()} @param msg @return
[ "Puts", "a", "message", "to", "Kafka", "queue", "partitioning", "message", "by", "{", "@link", "IQueueMessage#qId", "()", "}" ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/RabbitMqQueue.java#L237-L245
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.scaling
public Matrix3d scaling(double x, double y, double z) { m00 = x; m01 = 0.0; m02 = 0.0; m10 = 0.0; m11 = y; m12 = 0.0; m20 = 0.0; m21 = 0.0; m22 = z; return this; }
java
public Matrix3d scaling(double x, double y, double z) { m00 = x; m01 = 0.0; m02 = 0.0; m10 = 0.0; m11 = y; m12 = 0.0; m20 = 0.0; m21 = 0.0; m22 = z; return this; }
[ "public", "Matrix3d", "scaling", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "m00", "=", "x", ";", "m01", "=", "0.0", ";", "m02", "=", "0.0", ";", "m10", "=", "0.0", ";", "m11", "=", "y", ";", "m12", "=", "0.0", ";",...
Set this matrix to be a simple scale matrix. @param x the scale in x @param y the scale in y @param z the scale in z @return this
[ "Set", "this", "matrix", "to", "be", "a", "simple", "scale", "matrix", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L1357-L1368
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java
RolloutStatusCache.putRolloutStatus
public void putRolloutStatus(final Map<Long, List<TotalTargetCountActionStatus>> put) { final Cache cache = cacheManager.getCache(CACHE_RO_NAME); putIntoCache(put, cache); }
java
public void putRolloutStatus(final Map<Long, List<TotalTargetCountActionStatus>> put) { final Cache cache = cacheManager.getCache(CACHE_RO_NAME); putIntoCache(put, cache); }
[ "public", "void", "putRolloutStatus", "(", "final", "Map", "<", "Long", ",", "List", "<", "TotalTargetCountActionStatus", ">", ">", "put", ")", "{", "final", "Cache", "cache", "=", "cacheManager", ".", "getCache", "(", "CACHE_RO_NAME", ")", ";", "putIntoCache"...
Put map of {@link TotalTargetCountActionStatus} for multiple {@link Rollout}s into cache. @param put map of cached entries
[ "Put", "map", "of", "{", "@link", "TotalTargetCountActionStatus", "}", "for", "multiple", "{", "@link", "Rollout", "}", "s", "into", "cache", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java#L130-L133
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java
CloudMe.rawCreateFolder
private CMFolder rawCreateFolder( CMFolder cmParentFolder, String name ) { StringBuilder innerXml = new StringBuilder(); innerXml.append( "<folder id='" ).append( cmParentFolder.getId() ).append( "'/>" ); innerXml.append( "<childFolder>" ).append( XmlUtils.escape( name ) ).append( "</childFolder>" ); HttpPost request = buildSoapRequest( "newFolder", innerXml.toString() ); CResponse response = retryStrategy.invokeRetry( getApiRequestInvoker( request, null ) ); Document dom = response.asDom(); String newFolderId = dom.getElementsByTagNameNS( "*", "newFolderId" ).item( 0 ).getTextContent(); return cmParentFolder.addChild( newFolderId, name ); }
java
private CMFolder rawCreateFolder( CMFolder cmParentFolder, String name ) { StringBuilder innerXml = new StringBuilder(); innerXml.append( "<folder id='" ).append( cmParentFolder.getId() ).append( "'/>" ); innerXml.append( "<childFolder>" ).append( XmlUtils.escape( name ) ).append( "</childFolder>" ); HttpPost request = buildSoapRequest( "newFolder", innerXml.toString() ); CResponse response = retryStrategy.invokeRetry( getApiRequestInvoker( request, null ) ); Document dom = response.asDom(); String newFolderId = dom.getElementsByTagNameNS( "*", "newFolderId" ).item( 0 ).getTextContent(); return cmParentFolder.addChild( newFolderId, name ); }
[ "private", "CMFolder", "rawCreateFolder", "(", "CMFolder", "cmParentFolder", ",", "String", "name", ")", "{", "StringBuilder", "innerXml", "=", "new", "StringBuilder", "(", ")", ";", "innerXml", ".", "append", "(", "\"<folder id='\"", ")", ".", "append", "(", ...
Issue request to create a folder with given parent folder and name. <p/> No checks are performed before request. @param cmParentFolder folder of the container @param name base name of the folder to be created @return the new CloudMe folder
[ "Issue", "request", "to", "create", "a", "folder", "with", "given", "parent", "folder", "and", "name", ".", "<p", "/", ">", "No", "checks", "are", "performed", "before", "request", "." ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java#L476-L489
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/client/WorldState.java
WorldState.addState
public void addState(final String id, final Collection<Attribute> attributes) { this.stateMap.put(id, attributes); }
java
public void addState(final String id, final Collection<Attribute> attributes) { this.stateMap.put(id, attributes); }
[ "public", "void", "addState", "(", "final", "String", "id", ",", "final", "Collection", "<", "Attribute", ">", "attributes", ")", "{", "this", ".", "stateMap", ".", "put", "(", "id", ",", "attributes", ")", ";", "}" ]
Binds a set of Attribute values to an identifier. @param id the identifier @param attributes the set of attributes.
[ "Binds", "a", "set", "of", "Attribute", "values", "to", "an", "identifier", "." ]
train
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/WorldState.java#L50-L52
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.vps_serviceName_plesk_duration_GET
public OvhOrder vps_serviceName_plesk_duration_GET(String serviceName, String duration, OvhPleskLicenseDomainNumberEnum domainNumber) throws IOException { String qPath = "/order/vps/{serviceName}/plesk/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "domainNumber", domainNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder vps_serviceName_plesk_duration_GET(String serviceName, String duration, OvhPleskLicenseDomainNumberEnum domainNumber) throws IOException { String qPath = "/order/vps/{serviceName}/plesk/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "domainNumber", domainNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "vps_serviceName_plesk_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhPleskLicenseDomainNumberEnum", "domainNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/vps/{serviceName}/plesk/{duration}\"...
Get prices and contracts information REST: GET /order/vps/{serviceName}/plesk/{duration} @param domainNumber [required] Domain number you want to order a licence for @param serviceName [required] The internal name of your VPS offer @param duration [required] Duration @deprecated
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3325-L3331
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.readContentAsString
public static String readContentAsString(File file, String encoding) { try { return readContentAsString(new FileInputStream(file), encoding); } catch (FileNotFoundException e) { throw E.ioException(e); } }
java
public static String readContentAsString(File file, String encoding) { try { return readContentAsString(new FileInputStream(file), encoding); } catch (FileNotFoundException e) { throw E.ioException(e); } }
[ "public", "static", "String", "readContentAsString", "(", "File", "file", ",", "String", "encoding", ")", "{", "try", "{", "return", "readContentAsString", "(", "new", "FileInputStream", "(", "file", ")", ",", "encoding", ")", ";", "}", "catch", "(", "FileNo...
Read file content to a String @param file The file to read @param encoding encoding used to read the file into string content @return The String content
[ "Read", "file", "content", "to", "a", "String" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L1553-L1559
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.tagImage
public TagResult tagImage(String url, TagImageOptionalParameter tagImageOptionalParameter) { return tagImageWithServiceResponseAsync(url, tagImageOptionalParameter).toBlocking().single().body(); }
java
public TagResult tagImage(String url, TagImageOptionalParameter tagImageOptionalParameter) { return tagImageWithServiceResponseAsync(url, tagImageOptionalParameter).toBlocking().single().body(); }
[ "public", "TagResult", "tagImage", "(", "String", "url", ",", "TagImageOptionalParameter", "tagImageOptionalParameter", ")", "{", "return", "tagImageWithServiceResponseAsync", "(", "url", ",", "tagImageOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single",...
This operation generates a list of words, or tags, that are relevant to the content of the supplied image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image content. Tags may contain hints to avoid ambiguity or provide context, for example the tag 'cello' may be accompanied by the hint 'musical instrument'. All tags are in English. @param url Publicly reachable URL of an image @param tagImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ComputerVisionErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the TagResult object if successful.
[ "This", "operation", "generates", "a", "list", "of", "words", "or", "tags", "that", "are", "relevant", "to", "the", "content", "of", "the", "supplied", "image", ".", "The", "Computer", "Vision", "API", "can", "return", "tags", "based", "on", "objects", "li...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1584-L1586
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
JpaControllerManagement.isUpdatingActionStatusAllowed
private boolean isUpdatingActionStatusAllowed(final JpaAction action, final JpaActionStatus actionStatus) { final boolean isIntermediateFeedback = !FINISHED.equals(actionStatus.getStatus()) && !Status.ERROR.equals(actionStatus.getStatus()); final boolean isAllowedByRepositoryConfiguration = !repositoryProperties.isRejectActionStatusForClosedAction() && isIntermediateFeedback; final boolean isAllowedForDownloadOnlyActions = isDownloadOnly(action) && !isIntermediateFeedback; return action.isActive() || isAllowedByRepositoryConfiguration || isAllowedForDownloadOnlyActions; }
java
private boolean isUpdatingActionStatusAllowed(final JpaAction action, final JpaActionStatus actionStatus) { final boolean isIntermediateFeedback = !FINISHED.equals(actionStatus.getStatus()) && !Status.ERROR.equals(actionStatus.getStatus()); final boolean isAllowedByRepositoryConfiguration = !repositoryProperties.isRejectActionStatusForClosedAction() && isIntermediateFeedback; final boolean isAllowedForDownloadOnlyActions = isDownloadOnly(action) && !isIntermediateFeedback; return action.isActive() || isAllowedByRepositoryConfiguration || isAllowedForDownloadOnlyActions; }
[ "private", "boolean", "isUpdatingActionStatusAllowed", "(", "final", "JpaAction", "action", ",", "final", "JpaActionStatus", "actionStatus", ")", "{", "final", "boolean", "isIntermediateFeedback", "=", "!", "FINISHED", ".", "equals", "(", "actionStatus", ".", "getStat...
ActionStatus updates are allowed mainly if the action is active. If the action is not active we accept further status updates if permitted so by repository configuration. In this case, only the values: Status.ERROR and Status.FINISHED are allowed. In the case of a DOWNLOAD_ONLY action, we accept status updates only once.
[ "ActionStatus", "updates", "are", "allowed", "mainly", "if", "the", "action", "is", "active", ".", "If", "the", "action", "is", "not", "active", "we", "accept", "further", "status", "updates", "if", "permitted", "so", "by", "repository", "configuration", ".", ...
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java#L589-L600
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/PagedGrid.java
PagedGrid.formatCell
protected void formatCell (HTMLTable.CellFormatter formatter, int row, int col, int limit) { formatter.setHorizontalAlignment(row, col, _cellHorizAlign); formatter.setVerticalAlignment(row, col, _cellVertAlign); formatter.setStyleName(row, col, "Cell"); if (row == (limit-1)/_cols) { formatter.addStyleName(row, col, "BottomCell"); } else if (row == 0) { formatter.addStyleName(row, col, "TopCell"); } else { formatter.addStyleName(row, col, "MiddleCell"); } }
java
protected void formatCell (HTMLTable.CellFormatter formatter, int row, int col, int limit) { formatter.setHorizontalAlignment(row, col, _cellHorizAlign); formatter.setVerticalAlignment(row, col, _cellVertAlign); formatter.setStyleName(row, col, "Cell"); if (row == (limit-1)/_cols) { formatter.addStyleName(row, col, "BottomCell"); } else if (row == 0) { formatter.addStyleName(row, col, "TopCell"); } else { formatter.addStyleName(row, col, "MiddleCell"); } }
[ "protected", "void", "formatCell", "(", "HTMLTable", ".", "CellFormatter", "formatter", ",", "int", "row", ",", "int", "col", ",", "int", "limit", ")", "{", "formatter", ".", "setHorizontalAlignment", "(", "row", ",", "col", ",", "_cellHorizAlign", ")", ";",...
Configures the formatting for a particular cell based on its location in the grid.
[ "Configures", "the", "formatting", "for", "a", "particular", "cell", "based", "on", "its", "location", "in", "the", "grid", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/PagedGrid.java#L99-L111
geomajas/geomajas-project-client-gwt2
server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java
GeomajasServerExtension.initializeMap
public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id) { initializeMap(mapPresenter, applicationId, id, new DefaultMapWidget[] { DefaultMapWidget.ZOOM_CONTROL, DefaultMapWidget.ZOOM_TO_RECTANGLE_CONTROL, DefaultMapWidget.SCALEBAR }); }
java
public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id) { initializeMap(mapPresenter, applicationId, id, new DefaultMapWidget[] { DefaultMapWidget.ZOOM_CONTROL, DefaultMapWidget.ZOOM_TO_RECTANGLE_CONTROL, DefaultMapWidget.SCALEBAR }); }
[ "public", "void", "initializeMap", "(", "final", "MapPresenter", "mapPresenter", ",", "String", "applicationId", ",", "String", "id", ")", "{", "initializeMap", "(", "mapPresenter", ",", "applicationId", ",", "id", ",", "new", "DefaultMapWidget", "[", "]", "{", ...
Initialize the map by fetching a configuration on the server. This method will create a map and add the default map widgets (zoom in/out, zoom to rectangle and scale bar). @param mapPresenter The map to initialize. @param applicationId The application ID in the backend configuration. @param id The map ID in the backend configuration.
[ "Initialize", "the", "map", "by", "fetching", "a", "configuration", "on", "the", "server", ".", "This", "method", "will", "create", "a", "map", "and", "add", "the", "default", "map", "widgets", "(", "zoom", "in", "/", "out", "zoom", "to", "rectangle", "a...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java#L146-L149
Netflix/zeno
src/examples/java/com/netflix/zeno/examples/framework/IntSumFrameworkSerializer.java
IntSumFrameworkSerializer.serializePrimitive
@Override public void serializePrimitive(IntSumRecord rec, String fieldName, Object value) { /// only interested in int values. if(value instanceof Integer) { rec.addValue(((Integer) value).intValue()); } }
java
@Override public void serializePrimitive(IntSumRecord rec, String fieldName, Object value) { /// only interested in int values. if(value instanceof Integer) { rec.addValue(((Integer) value).intValue()); } }
[ "@", "Override", "public", "void", "serializePrimitive", "(", "IntSumRecord", "rec", ",", "String", "fieldName", ",", "Object", "value", ")", "{", "/// only interested in int values.", "if", "(", "value", "instanceof", "Integer", ")", "{", "rec", ".", "addValue", ...
We need to implement serializePrimitive to describe what happens when we encounter one of the following types: Integer, Long, Float, Double, Boolean, String.
[ "We", "need", "to", "implement", "serializePrimitive", "to", "describe", "what", "happens", "when", "we", "encounter", "one", "of", "the", "following", "types", ":", "Integer", "Long", "Float", "Double", "Boolean", "String", "." ]
train
https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/examples/java/com/netflix/zeno/examples/framework/IntSumFrameworkSerializer.java#L43-L49
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java
AptControlImplementation.getControlInterface
public AptControlInterface getControlInterface() { if ( _implDecl == null || _implDecl.getSuperinterfaces() == null ) return null; Collection<InterfaceType> superInterfaces = _implDecl.getSuperinterfaces(); for (InterfaceType intfType : superInterfaces) { InterfaceDeclaration intfDecl = intfType.getDeclaration(); if (intfDecl != null && intfDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlInterface.class) != null) return new AptControlInterface(intfDecl, _ap); } return null; }
java
public AptControlInterface getControlInterface() { if ( _implDecl == null || _implDecl.getSuperinterfaces() == null ) return null; Collection<InterfaceType> superInterfaces = _implDecl.getSuperinterfaces(); for (InterfaceType intfType : superInterfaces) { InterfaceDeclaration intfDecl = intfType.getDeclaration(); if (intfDecl != null && intfDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlInterface.class) != null) return new AptControlInterface(intfDecl, _ap); } return null; }
[ "public", "AptControlInterface", "getControlInterface", "(", ")", "{", "if", "(", "_implDecl", "==", "null", "||", "_implDecl", ".", "getSuperinterfaces", "(", ")", "==", "null", ")", "return", "null", ";", "Collection", "<", "InterfaceType", ">", "superInterfac...
Returns the ControlInterface implemented by this ControlImpl.
[ "Returns", "the", "ControlInterface", "implemented", "by", "this", "ControlImpl", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java#L283-L298
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java
CPDisplayLayoutPersistenceImpl.findByC_C
@Override public CPDisplayLayout findByC_C(long classNameId, long classPK) throws NoSuchCPDisplayLayoutException { CPDisplayLayout cpDisplayLayout = fetchByC_C(classNameId, classPK); if (cpDisplayLayout == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("classNameId="); msg.append(classNameId); msg.append(", classPK="); msg.append(classPK); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDisplayLayoutException(msg.toString()); } return cpDisplayLayout; }
java
@Override public CPDisplayLayout findByC_C(long classNameId, long classPK) throws NoSuchCPDisplayLayoutException { CPDisplayLayout cpDisplayLayout = fetchByC_C(classNameId, classPK); if (cpDisplayLayout == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("classNameId="); msg.append(classNameId); msg.append(", classPK="); msg.append(classPK); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPDisplayLayoutException(msg.toString()); } return cpDisplayLayout; }
[ "@", "Override", "public", "CPDisplayLayout", "findByC_C", "(", "long", "classNameId", ",", "long", "classPK", ")", "throws", "NoSuchCPDisplayLayoutException", "{", "CPDisplayLayout", "cpDisplayLayout", "=", "fetchByC_C", "(", "classNameId", ",", "classPK", ")", ";", ...
Returns the cp display layout where classNameId = &#63; and classPK = &#63; or throws a {@link NoSuchCPDisplayLayoutException} if it could not be found. @param classNameId the class name ID @param classPK the class pk @return the matching cp display layout @throws NoSuchCPDisplayLayoutException if a matching cp display layout could not be found
[ "Returns", "the", "cp", "display", "layout", "where", "classNameId", "=", "&#63", ";", "and", "classPK", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPDisplayLayoutException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L1501-L1527
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.VarArray
public JBBPDslBuilder VarArray(final String name, final int size) { return this.VarArray(name, arraySizeToString(size), null); }
java
public JBBPDslBuilder VarArray(final String name, final int size) { return this.VarArray(name, arraySizeToString(size), null); }
[ "public", "JBBPDslBuilder", "VarArray", "(", "final", "String", "name", ",", "final", "int", "size", ")", "{", "return", "this", ".", "VarArray", "(", "name", ",", "arraySizeToString", "(", "size", ")", ",", "null", ")", ";", "}" ]
Create named var array with fixed size. @param size size of the array, if negative then read till end of stream. @return the builder instance, must not be null
[ "Create", "named", "var", "array", "with", "fixed", "size", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L439-L441
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java
DiscreteDistributions.hypergeometricCdf
public static double hypergeometricCdf(int k, int n, int Kp, int Np) { if(k<0 || n<0 || Kp<0 || Np<0) { throw new IllegalArgumentException("All the parameters must be positive."); } Kp = Math.max(k, Kp); Np = Math.max(n, Np); /* //slow! $probabilitySum=0; for($i=0;$i<=$k;++$i) { $probabilitySum+=self::hypergeometric($i,$n,$Kp,$Np); } */ //fast and can handle large numbers //Cdf(k)-Cdf(k-1) double probabilitySum = approxHypergeometricCdf(k,n,Kp,Np); return probabilitySum; }
java
public static double hypergeometricCdf(int k, int n, int Kp, int Np) { if(k<0 || n<0 || Kp<0 || Np<0) { throw new IllegalArgumentException("All the parameters must be positive."); } Kp = Math.max(k, Kp); Np = Math.max(n, Np); /* //slow! $probabilitySum=0; for($i=0;$i<=$k;++$i) { $probabilitySum+=self::hypergeometric($i,$n,$Kp,$Np); } */ //fast and can handle large numbers //Cdf(k)-Cdf(k-1) double probabilitySum = approxHypergeometricCdf(k,n,Kp,Np); return probabilitySum; }
[ "public", "static", "double", "hypergeometricCdf", "(", "int", "k", ",", "int", "n", ",", "int", "Kp", ",", "int", "Np", ")", "{", "if", "(", "k", "<", "0", "||", "n", "<", "0", "||", "Kp", "<", "0", "||", "Np", "<", "0", ")", "{", "throw", ...
Returns the cumulative probability of hypergeometric @param k @param n @param Kp @param Np @return
[ "Returns", "the", "cumulative", "probability", "of", "hypergeometric" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L300-L320
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java
ZipChemCompProvider.addToZipFileSystem
private synchronized boolean addToZipFileSystem(Path zipFile, File[] files, Path pathWithinArchive) { boolean ret = false; /* URIs in Java 7 cannot have spaces, must use Path instead * and so, cannot use the properties map to describe need to create * a new zip archive. ZipChemCompProvider.initilizeZip to creates the * missing zip file */ /* // convert the filename to a URI String uriString = "jar:file:" + zipFile.toUri().getPath(); final URI uri = URI.create(uriString); // if filesystem doesn't exist, create one. final Map<String, String> env = new HashMap<>(); // Create a new zip if one isn't present. if (!zipFile.toFile().exists()) { System.out.println("Need to create " + zipFile.toString()); } env.put("create", String.valueOf(!zipFile.toFile().exists())); // Specify the encoding as UTF -8 env.put("encoding", "UTF-8"); */ // Copy in each file. try (FileSystem zipfs = FileSystems.newFileSystem(zipFile, null)) { Files.createDirectories(pathWithinArchive); for (File f : files) { if (!f.isDirectory() && f.exists()) { Path externalFile = f.toPath(); Path pathInZipFile = zipfs.getPath(pathWithinArchive.resolve(f.getName()).toString()); Files.copy(externalFile, pathInZipFile, StandardCopyOption.REPLACE_EXISTING); } } ret = true; } catch (IOException ex) { s_logger.error("Unable to add entries to Chemical Component zip archive : " + ex.getMessage()); ret = false; } return ret; }
java
private synchronized boolean addToZipFileSystem(Path zipFile, File[] files, Path pathWithinArchive) { boolean ret = false; /* URIs in Java 7 cannot have spaces, must use Path instead * and so, cannot use the properties map to describe need to create * a new zip archive. ZipChemCompProvider.initilizeZip to creates the * missing zip file */ /* // convert the filename to a URI String uriString = "jar:file:" + zipFile.toUri().getPath(); final URI uri = URI.create(uriString); // if filesystem doesn't exist, create one. final Map<String, String> env = new HashMap<>(); // Create a new zip if one isn't present. if (!zipFile.toFile().exists()) { System.out.println("Need to create " + zipFile.toString()); } env.put("create", String.valueOf(!zipFile.toFile().exists())); // Specify the encoding as UTF -8 env.put("encoding", "UTF-8"); */ // Copy in each file. try (FileSystem zipfs = FileSystems.newFileSystem(zipFile, null)) { Files.createDirectories(pathWithinArchive); for (File f : files) { if (!f.isDirectory() && f.exists()) { Path externalFile = f.toPath(); Path pathInZipFile = zipfs.getPath(pathWithinArchive.resolve(f.getName()).toString()); Files.copy(externalFile, pathInZipFile, StandardCopyOption.REPLACE_EXISTING); } } ret = true; } catch (IOException ex) { s_logger.error("Unable to add entries to Chemical Component zip archive : " + ex.getMessage()); ret = false; } return ret; }
[ "private", "synchronized", "boolean", "addToZipFileSystem", "(", "Path", "zipFile", ",", "File", "[", "]", "files", ",", "Path", "pathWithinArchive", ")", "{", "boolean", "ret", "=", "false", ";", "/* URIs in Java 7 cannot have spaces, must use Path instead\n\t\t * and so...
Add an array of files to a zip archive. Synchronized to prevent simultaneous reading/writing. @param zipFile is a destination zip archive @param files is an array of files to be added @param pathWithinArchive is the path within the archive to add files to @return true if successfully appended these files.
[ "Add", "an", "array", "of", "files", "to", "a", "zip", "archive", ".", "Synchronized", "to", "prevent", "simultaneous", "reading", "/", "writing", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java#L271-L312
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java
SipServletMessageImpl.isSystemHeaderAndNotGruu
public static boolean isSystemHeaderAndNotGruu(ModifiableRule modifiableRule, Parameterable parameterable) { boolean isSettingGruu = false; if(modifiableRule == ModifiableRule.ContactSystem && (parameterable.getParameter("gruu") != null || parameterable.getParameter("gr") != null)) { isSettingGruu = true; if (logger.isDebugEnabled()) logger.debug("Setting gruu so modifying contact header address is allowed"); } return !isSettingGruu && isSystemHeader(modifiableRule); }
java
public static boolean isSystemHeaderAndNotGruu(ModifiableRule modifiableRule, Parameterable parameterable) { boolean isSettingGruu = false; if(modifiableRule == ModifiableRule.ContactSystem && (parameterable.getParameter("gruu") != null || parameterable.getParameter("gr") != null)) { isSettingGruu = true; if (logger.isDebugEnabled()) logger.debug("Setting gruu so modifying contact header address is allowed"); } return !isSettingGruu && isSystemHeader(modifiableRule); }
[ "public", "static", "boolean", "isSystemHeaderAndNotGruu", "(", "ModifiableRule", "modifiableRule", ",", "Parameterable", "parameterable", ")", "{", "boolean", "isSettingGruu", "=", "false", ";", "if", "(", "modifiableRule", "==", "ModifiableRule", ".", "ContactSystem",...
Support for GRUU https://github.com/Mobicents/sip-servlets/issues/51 if the header contains one of the gruu, gr, temp-gruu or pub-gruu, it is allowed to set the Contact Header as per RFC 5627
[ "Support", "for", "GRUU", "https", ":", "//", "github", ".", "com", "/", "Mobicents", "/", "sip", "-", "servlets", "/", "issues", "/", "51", "if", "the", "header", "contains", "one", "of", "the", "gruu", "gr", "temp", "-", "gruu", "or", "pub", "-", ...
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java#L1800-L1810
icode/ameba-utils
src/main/java/ameba/captcha/audio/Sample.java
Sample.getStereoSamples
public void getStereoSamples(double[] leftSamples, double[] rightSamples) throws IOException { long sampleCount = getSampleCount(); double[] interleavedSamples = new double[(int) sampleCount * 2]; getInterleavedSamples(0, sampleCount, interleavedSamples); for (int i = 0; i < leftSamples.length; i++) { leftSamples[i] = interleavedSamples[2 * i]; rightSamples[i] = interleavedSamples[2 * i + 1]; } }
java
public void getStereoSamples(double[] leftSamples, double[] rightSamples) throws IOException { long sampleCount = getSampleCount(); double[] interleavedSamples = new double[(int) sampleCount * 2]; getInterleavedSamples(0, sampleCount, interleavedSamples); for (int i = 0; i < leftSamples.length; i++) { leftSamples[i] = interleavedSamples[2 * i]; rightSamples[i] = interleavedSamples[2 * i + 1]; } }
[ "public", "void", "getStereoSamples", "(", "double", "[", "]", "leftSamples", ",", "double", "[", "]", "rightSamples", ")", "throws", "IOException", "{", "long", "sampleCount", "=", "getSampleCount", "(", ")", ";", "double", "[", "]", "interleavedSamples", "="...
Convenience method. Extract left and right channels for common stereo files. leftSamples and rightSamples must be of size getSampleCount() @param leftSamples leftSamples @param rightSamples rightSamples @throws java.io.IOException java.io.IOException
[ "Convenience", "method", ".", "Extract", "left", "and", "right", "channels", "for", "common", "stereo", "files", ".", "leftSamples", "and", "rightSamples", "must", "be", "of", "size", "getSampleCount", "()" ]
train
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/captcha/audio/Sample.java#L204-L213
actframework/actframework
src/main/java/act/event/EventBus.java
EventBus.emitSync
public EventBus emitSync(EventObject event, Object... args) { return _emitWithOnceBus(eventContextSync(event, args)); }
java
public EventBus emitSync(EventObject event, Object... args) { return _emitWithOnceBus(eventContextSync(event, args)); }
[ "public", "EventBus", "emitSync", "(", "EventObject", "event", ",", "Object", "...", "args", ")", "{", "return", "_emitWithOnceBus", "(", "eventContextSync", "(", "event", ",", "args", ")", ")", ";", "}" ]
Emit a event object with parameters and force all listeners to be called synchronously. @param event the target event @param args the arguments passed in @see #emit(EventObject, Object...)
[ "Emit", "a", "event", "object", "with", "parameters", "and", "force", "all", "listeners", "to", "be", "called", "synchronously", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1105-L1107
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Searcher.java
Searcher.addViewsToList
private void addViewsToList(List<WebElement> allWebElements, List<WebElement> webElementsOnScreen){ int[] xyViewFromSet = new int[2]; int[] xyViewFromScreen = new int[2]; for(WebElement textFromScreen : webElementsOnScreen){ boolean foundView = false; textFromScreen.getLocationOnScreen(xyViewFromScreen); for(WebElement textFromList : allWebElements){ textFromList.getLocationOnScreen(xyViewFromSet); if(textFromScreen.getText().equals(textFromList.getText()) && xyViewFromScreen[0] == xyViewFromSet[0] && xyViewFromScreen[1] == xyViewFromSet[1]) { foundView = true; } } if(!foundView){ allWebElements.add(textFromScreen); } } }
java
private void addViewsToList(List<WebElement> allWebElements, List<WebElement> webElementsOnScreen){ int[] xyViewFromSet = new int[2]; int[] xyViewFromScreen = new int[2]; for(WebElement textFromScreen : webElementsOnScreen){ boolean foundView = false; textFromScreen.getLocationOnScreen(xyViewFromScreen); for(WebElement textFromList : allWebElements){ textFromList.getLocationOnScreen(xyViewFromSet); if(textFromScreen.getText().equals(textFromList.getText()) && xyViewFromScreen[0] == xyViewFromSet[0] && xyViewFromScreen[1] == xyViewFromSet[1]) { foundView = true; } } if(!foundView){ allWebElements.add(textFromScreen); } } }
[ "private", "void", "addViewsToList", "(", "List", "<", "WebElement", ">", "allWebElements", ",", "List", "<", "WebElement", ">", "webElementsOnScreen", ")", "{", "int", "[", "]", "xyViewFromSet", "=", "new", "int", "[", "2", "]", ";", "int", "[", "]", "x...
Adds views to a given list. @param allWebElements the list of all views @param webTextViewsOnScreen the list of views shown on screen
[ "Adds", "views", "to", "a", "given", "list", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L250-L272
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.expectAtMostOnce
@Deprecated public C expectAtMostOnce(Threads threadMatcher, Query query) { return expect(SqlQueries.atMostOneQuery().threads(threadMatcher).type(adapter(query))); }
java
@Deprecated public C expectAtMostOnce(Threads threadMatcher, Query query) { return expect(SqlQueries.atMostOneQuery().threads(threadMatcher).type(adapter(query))); }
[ "@", "Deprecated", "public", "C", "expectAtMostOnce", "(", "Threads", "threadMatcher", ",", "Query", "query", ")", "{", "return", "expect", "(", "SqlQueries", ".", "atMostOneQuery", "(", ")", ".", "threads", "(", "threadMatcher", ")", ".", "type", "(", "adap...
Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments 0, 1, {@code threads}, {@code queryType} @since 2.2
[ "Alias", "for", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L244-L247
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MatchAllScorer.java
MatchAllScorer.calculateDocFilter
private void calculateDocFilter() throws IOException { PerQueryCache cache = PerQueryCache.getInstance(); @SuppressWarnings("unchecked") Map<String, BitSet> readerCache = (Map<String, BitSet>)cache.get(MatchAllScorer.class, reader); if (readerCache == null) { readerCache = new HashMap<String, BitSet>(); cache.put(MatchAllScorer.class, reader, readerCache); } // get BitSet for field docFilter = (BitSet)readerCache.get(field); if (docFilter != null) { // use cached BitSet; return; } // otherwise calculate new docFilter = new BitSet(reader.maxDoc()); // we match all terms String namedValue = FieldNames.createNamedValue(field, ""); TermEnum terms = reader.terms(new Term(FieldNames.PROPERTIES, namedValue)); try { TermDocs docs = reader.termDocs(); try { while (terms.term() != null && terms.term().field() == FieldNames.PROPERTIES && terms.term().text().startsWith(namedValue)) { docs.seek(terms); while (docs.next()) { docFilter.set(docs.doc()); } terms.next(); } } finally { docs.close(); } } finally { terms.close(); } // put BitSet into cache readerCache.put(field, docFilter); }
java
private void calculateDocFilter() throws IOException { PerQueryCache cache = PerQueryCache.getInstance(); @SuppressWarnings("unchecked") Map<String, BitSet> readerCache = (Map<String, BitSet>)cache.get(MatchAllScorer.class, reader); if (readerCache == null) { readerCache = new HashMap<String, BitSet>(); cache.put(MatchAllScorer.class, reader, readerCache); } // get BitSet for field docFilter = (BitSet)readerCache.get(field); if (docFilter != null) { // use cached BitSet; return; } // otherwise calculate new docFilter = new BitSet(reader.maxDoc()); // we match all terms String namedValue = FieldNames.createNamedValue(field, ""); TermEnum terms = reader.terms(new Term(FieldNames.PROPERTIES, namedValue)); try { TermDocs docs = reader.termDocs(); try { while (terms.term() != null && terms.term().field() == FieldNames.PROPERTIES && terms.term().text().startsWith(namedValue)) { docs.seek(terms); while (docs.next()) { docFilter.set(docs.doc()); } terms.next(); } } finally { docs.close(); } } finally { terms.close(); } // put BitSet into cache readerCache.put(field, docFilter); }
[ "private", "void", "calculateDocFilter", "(", ")", "throws", "IOException", "{", "PerQueryCache", "cache", "=", "PerQueryCache", ".", "getInstance", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Map", "<", "String", ",", "BitSet", ">", "r...
Calculates a BitSet filter that includes all the nodes that have content in properties according to the field name passed in the constructor of this MatchAllScorer. @throws IOException if an error occurs while reading from the search index.
[ "Calculates", "a", "BitSet", "filter", "that", "includes", "all", "the", "nodes", "that", "have", "content", "in", "properties", "according", "to", "the", "field", "name", "passed", "in", "the", "constructor", "of", "this", "MatchAllScorer", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MatchAllScorer.java#L148-L201
JM-Lab/utils-java8
src/main/java/kr/jm/utils/JMProgressiveManager.java
JMProgressiveManager.registerCountChangeListener
public JMProgressiveManager<T, R> registerCountChangeListener(Consumer<Number> countChangeListener) { return registerListener(progressiveCount, countChangeListener); }
java
public JMProgressiveManager<T, R> registerCountChangeListener(Consumer<Number> countChangeListener) { return registerListener(progressiveCount, countChangeListener); }
[ "public", "JMProgressiveManager", "<", "T", ",", "R", ">", "registerCountChangeListener", "(", "Consumer", "<", "Number", ">", "countChangeListener", ")", "{", "return", "registerListener", "(", "progressiveCount", ",", "countChangeListener", ")", ";", "}" ]
Register count change listener jm progressive manager. @param countChangeListener the count change listener @return the jm progressive manager
[ "Register", "count", "change", "listener", "jm", "progressive", "manager", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMProgressiveManager.java#L248-L251
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.restoreKeyAsync
public Observable<KeyBundle> restoreKeyAsync(String vaultBaseUrl, byte[] keyBundleBackup) { return restoreKeyWithServiceResponseAsync(vaultBaseUrl, keyBundleBackup).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
java
public Observable<KeyBundle> restoreKeyAsync(String vaultBaseUrl, byte[] keyBundleBackup) { return restoreKeyWithServiceResponseAsync(vaultBaseUrl, keyBundleBackup).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "KeyBundle", ">", "restoreKeyAsync", "(", "String", "vaultBaseUrl", ",", "byte", "[", "]", "keyBundleBackup", ")", "{", "return", "restoreKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyBundleBackup", ")", ".", "map", "(", ...
Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission in the target Key Vault. This operation requires the keys/restore permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyBundleBackup The backup blob associated with a key bundle. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the KeyBundle object
[ "Restores", "a", "backed", "up", "key", "to", "a", "vault", ".", "Imports", "a", "previously", "backed", "up", "key", "into", "Azure", "Key", "Vault", "restoring", "the", "key", "its", "key", "identifier", "attributes", "and", "access", "control", "policies"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2080-L2087
bazaarvoice/emodb
common/zookeeper/src/main/java/com/bazaarvoice/emodb/common/zookeeper/Sync.java
Sync.synchronousSync
public static boolean synchronousSync(CuratorFramework curator, Duration timeout) { try { // Curator sync() is always a background operation. Use a latch to block until it finishes. final CountDownLatch latch = new CountDownLatch(1); curator.sync().inBackground(new BackgroundCallback() { @Override public void processResult(CuratorFramework curator, CuratorEvent event) throws Exception { if (event.getType() == CuratorEventType.SYNC) { latch.countDown(); } } }).forPath(curator.getNamespace().isEmpty() ? "/" : ""); // Wait for sync to complete. return latch.await(timeout.toMillis(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return false; } catch (Exception e) { throw Throwables.propagate(e); } }
java
public static boolean synchronousSync(CuratorFramework curator, Duration timeout) { try { // Curator sync() is always a background operation. Use a latch to block until it finishes. final CountDownLatch latch = new CountDownLatch(1); curator.sync().inBackground(new BackgroundCallback() { @Override public void processResult(CuratorFramework curator, CuratorEvent event) throws Exception { if (event.getType() == CuratorEventType.SYNC) { latch.countDown(); } } }).forPath(curator.getNamespace().isEmpty() ? "/" : ""); // Wait for sync to complete. return latch.await(timeout.toMillis(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return false; } catch (Exception e) { throw Throwables.propagate(e); } }
[ "public", "static", "boolean", "synchronousSync", "(", "CuratorFramework", "curator", ",", "Duration", "timeout", ")", "{", "try", "{", "// Curator sync() is always a background operation. Use a latch to block until it finishes.", "final", "CountDownLatch", "latch", "=", "new"...
Performs a blocking sync operation. Returns true if the sync completed normally, false if it timed out or was interrupted.
[ "Performs", "a", "blocking", "sync", "operation", ".", "Returns", "true", "if", "the", "sync", "completed", "normally", "false", "if", "it", "timed", "out", "or", "was", "interrupted", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/zookeeper/src/main/java/com/bazaarvoice/emodb/common/zookeeper/Sync.java#L18-L38
infinispan/infinispan
core/src/main/java/org/infinispan/xsite/BackupReceiverRepositoryImpl.java
BackupReceiverRepositoryImpl.getBackupReceiver
@Override public BackupReceiver getBackupReceiver(String remoteSite, String remoteCache) { SiteCachePair toLookFor = new SiteCachePair(remoteCache, remoteSite); BackupReceiver backupManager = backupReceivers.get(toLookFor); if (backupManager != null) return backupManager; //check the default cache first Configuration dcc = cacheManager.getDefaultCacheConfiguration(); if (dcc != null && isBackupForRemoteCache(remoteSite, remoteCache, dcc, EmbeddedCacheManager.DEFAULT_CACHE_NAME)) { Cache<Object, Object> cache = cacheManager.getCache(); backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache)); toLookFor.setLocalCacheName(EmbeddedCacheManager.DEFAULT_CACHE_NAME); return backupReceivers.get(toLookFor); } Set<String> cacheNames = cacheManager.getCacheNames(); for (String name : cacheNames) { Configuration cacheConfiguration = cacheManager.getCacheConfiguration(name); if (cacheConfiguration != null && isBackupForRemoteCache(remoteSite, remoteCache, cacheConfiguration, name)) { Cache<Object, Object> cache = cacheManager.getCache(name); toLookFor.setLocalCacheName(name); backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache)); return backupReceivers.get(toLookFor); } } log.debugf("Did not find any backup explicitly configured backup cache for remote cache/site: %s/%s. Using %s", remoteSite, remoteCache, remoteCache); Cache<Object, Object> cache = cacheManager.getCache(remoteCache); backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache)); toLookFor.setLocalCacheName(cache.getName()); return backupReceivers.get(toLookFor); }
java
@Override public BackupReceiver getBackupReceiver(String remoteSite, String remoteCache) { SiteCachePair toLookFor = new SiteCachePair(remoteCache, remoteSite); BackupReceiver backupManager = backupReceivers.get(toLookFor); if (backupManager != null) return backupManager; //check the default cache first Configuration dcc = cacheManager.getDefaultCacheConfiguration(); if (dcc != null && isBackupForRemoteCache(remoteSite, remoteCache, dcc, EmbeddedCacheManager.DEFAULT_CACHE_NAME)) { Cache<Object, Object> cache = cacheManager.getCache(); backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache)); toLookFor.setLocalCacheName(EmbeddedCacheManager.DEFAULT_CACHE_NAME); return backupReceivers.get(toLookFor); } Set<String> cacheNames = cacheManager.getCacheNames(); for (String name : cacheNames) { Configuration cacheConfiguration = cacheManager.getCacheConfiguration(name); if (cacheConfiguration != null && isBackupForRemoteCache(remoteSite, remoteCache, cacheConfiguration, name)) { Cache<Object, Object> cache = cacheManager.getCache(name); toLookFor.setLocalCacheName(name); backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache)); return backupReceivers.get(toLookFor); } } log.debugf("Did not find any backup explicitly configured backup cache for remote cache/site: %s/%s. Using %s", remoteSite, remoteCache, remoteCache); Cache<Object, Object> cache = cacheManager.getCache(remoteCache); backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache)); toLookFor.setLocalCacheName(cache.getName()); return backupReceivers.get(toLookFor); }
[ "@", "Override", "public", "BackupReceiver", "getBackupReceiver", "(", "String", "remoteSite", ",", "String", "remoteCache", ")", "{", "SiteCachePair", "toLookFor", "=", "new", "SiteCachePair", "(", "remoteCache", ",", "remoteSite", ")", ";", "BackupReceiver", "back...
Returns the local cache defined as backup for the provided remote (site, cache) combo, or throws an exception if no such site is defined. <p/> Also starts the cache if not already started; that is because the cache is needed for update after this method is invoked.
[ "Returns", "the", "local", "cache", "defined", "as", "backup", "for", "the", "provided", "remote", "(", "site", "cache", ")", "combo", "or", "throws", "an", "exception", "if", "no", "such", "site", "is", "defined", ".", "<p", "/", ">", "Also", "starts", ...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/xsite/BackupReceiverRepositoryImpl.java#L63-L95
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.addToTimeLimitDaemon
@Override public void addToTimeLimitDaemon(Object id, long expirationTime, int inactivity) { final String methodName = "addToTimeLimitDaemon()"; if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called"); } }
java
@Override public void addToTimeLimitDaemon(Object id, long expirationTime, int inactivity) { final String methodName = "addToTimeLimitDaemon()"; if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called"); } }
[ "@", "Override", "public", "void", "addToTimeLimitDaemon", "(", "Object", "id", ",", "long", "expirationTime", ",", "int", "inactivity", ")", "{", "final", "String", "methodName", "=", "\"addToTimeLimitDaemon()\"", ";", "if", "(", "tc", ".", "isDebugEnabled", "(...
This method is used only by default cache provider (cache.java). Do nothing.
[ "This", "method", "is", "used", "only", "by", "default", "cache", "provider", "(", "cache", ".", "java", ")", ".", "Do", "nothing", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1528-L1534
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java
CouchClient.getDocRevisions
public DocumentRevs getDocRevisions(String id, String rev) { return getDocRevisions(id, rev, new CouchClientTypeReference<DocumentRevs>(DocumentRevs.class)); }
java
public DocumentRevs getDocRevisions(String id, String rev) { return getDocRevisions(id, rev, new CouchClientTypeReference<DocumentRevs>(DocumentRevs.class)); }
[ "public", "DocumentRevs", "getDocRevisions", "(", "String", "id", ",", "String", "rev", ")", "{", "return", "getDocRevisions", "(", "id", ",", "rev", ",", "new", "CouchClientTypeReference", "<", "DocumentRevs", ">", "(", "DocumentRevs", ".", "class", ")", ")",...
Get document along with its revision history, and the result is converted to a <code>DocumentRevs</code> object. @see <code>DocumentRevs</code>
[ "Get", "document", "along", "with", "its", "revision", "history", "and", "the", "result", "is", "converted", "to", "a", "<code", ">", "DocumentRevs<", "/", "code", ">", "object", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L721-L724
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java
ThreadPool.executeOnDaemon
public void executeOnDaemon(Runnable command) { int id = 0; final Runnable commandToRun = command; synchronized (this) { this.daemonId++; id = this.daemonId; } final String runId = name + " : DMN" + id; // d185137.2 Thread t = (Thread) AccessController.doPrivileged(new PrivilegedAction() { // d185137.2 public Object run() { // return new Thread(commandToRun); // d185137.2 Thread temp = new Thread(commandToRun, runId); // d185137.2 temp.setDaemon(true); return temp; } }); t.start(); }
java
public void executeOnDaemon(Runnable command) { int id = 0; final Runnable commandToRun = command; synchronized (this) { this.daemonId++; id = this.daemonId; } final String runId = name + " : DMN" + id; // d185137.2 Thread t = (Thread) AccessController.doPrivileged(new PrivilegedAction() { // d185137.2 public Object run() { // return new Thread(commandToRun); // d185137.2 Thread temp = new Thread(commandToRun, runId); // d185137.2 temp.setDaemon(true); return temp; } }); t.start(); }
[ "public", "void", "executeOnDaemon", "(", "Runnable", "command", ")", "{", "int", "id", "=", "0", ";", "final", "Runnable", "commandToRun", "=", "command", ";", "synchronized", "(", "this", ")", "{", "this", ".", "daemonId", "++", ";", "id", "=", "this",...
Dispatch work on a daemon thread. This thread is not accounted for in the pool. There are no corresponding ThreadPoolListener events. There is no MonitorPlugin support.
[ "Dispatch", "work", "on", "a", "daemon", "thread", ".", "This", "thread", "is", "not", "accounted", "for", "in", "the", "pool", ".", "There", "are", "no", "corresponding", "ThreadPoolListener", "events", ".", "There", "is", "no", "MonitorPlugin", "support", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1066-L1089
google/closure-compiler
src/com/google/javascript/jscomp/CollapseProperties.java
CollapseProperties.flattenSimpleStubDeclaration
private void flattenSimpleStubDeclaration(Name name, String alias) { Ref ref = Iterables.getOnlyElement(name.getRefs()); Node nameNode = NodeUtil.newName(compiler, alias, ref.getNode(), name.getFullName()); Node varNode = IR.var(nameNode).useSourceInfoIfMissingFrom(nameNode); checkState(ref.getNode().getParent().isExprResult()); Node parent = ref.getNode().getParent(); Node grandparent = parent.getParent(); grandparent.replaceChild(parent, varNode); compiler.reportChangeToEnclosingScope(varNode); }
java
private void flattenSimpleStubDeclaration(Name name, String alias) { Ref ref = Iterables.getOnlyElement(name.getRefs()); Node nameNode = NodeUtil.newName(compiler, alias, ref.getNode(), name.getFullName()); Node varNode = IR.var(nameNode).useSourceInfoIfMissingFrom(nameNode); checkState(ref.getNode().getParent().isExprResult()); Node parent = ref.getNode().getParent(); Node grandparent = parent.getParent(); grandparent.replaceChild(parent, varNode); compiler.reportChangeToEnclosingScope(varNode); }
[ "private", "void", "flattenSimpleStubDeclaration", "(", "Name", "name", ",", "String", "alias", ")", "{", "Ref", "ref", "=", "Iterables", ".", "getOnlyElement", "(", "name", ".", "getRefs", "(", ")", ")", ";", "Node", "nameNode", "=", "NodeUtil", ".", "new...
Flattens a stub declaration. This is mostly a hack to support legacy users.
[ "Flattens", "a", "stub", "declaration", ".", "This", "is", "mostly", "a", "hack", "to", "support", "legacy", "users", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L274-L284
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/ram/RamResourceProviderOld.java
RamResourceProviderOld.createCore
RamResourceCore createCore(String path, int type) throws IOException { String[] names = ListUtil.listToStringArray(path, '/'); RamResourceCore rrc = root; for (int i = 0; i < names.length - 1; i++) { rrc = rrc.getChild(names[i], caseSensitive); if (rrc == null) throw new IOException("can't create resource " + path + ", missing parent resource"); } rrc = new RamResourceCore(rrc, type, names[names.length - 1]); return rrc; }
java
RamResourceCore createCore(String path, int type) throws IOException { String[] names = ListUtil.listToStringArray(path, '/'); RamResourceCore rrc = root; for (int i = 0; i < names.length - 1; i++) { rrc = rrc.getChild(names[i], caseSensitive); if (rrc == null) throw new IOException("can't create resource " + path + ", missing parent resource"); } rrc = new RamResourceCore(rrc, type, names[names.length - 1]); return rrc; }
[ "RamResourceCore", "createCore", "(", "String", "path", ",", "int", "type", ")", "throws", "IOException", "{", "String", "[", "]", "names", "=", "ListUtil", ".", "listToStringArray", "(", "path", ",", "'", "'", ")", ";", "RamResourceCore", "rrc", "=", "roo...
create a new core @param path @param type @return created core @throws IOException
[ "create", "a", "new", "core" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/ram/RamResourceProviderOld.java#L110-L119
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java
RoadNetworkLayerConstants.setPreferredRoadColor
public static void setPreferredRoadColor(RoadType roadType, Integer color) { final RoadType rt = roadType == null ? RoadType.OTHER : roadType; final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class); if (prefs != null) { if (color == null || color.intValue() == DEFAULT_ROAD_COLORS[rt.ordinal() * 2]) { prefs.remove("ROAD_COLOR_" + rt.name().toUpperCase()); //$NON-NLS-1$ } else { prefs.put("ROAD_COLOR_" + rt.name().toUpperCase(), Integer.toString(color.intValue())); //$NON-NLS-1$ } try { prefs.flush(); } catch (BackingStoreException exception) { // } } }
java
public static void setPreferredRoadColor(RoadType roadType, Integer color) { final RoadType rt = roadType == null ? RoadType.OTHER : roadType; final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class); if (prefs != null) { if (color == null || color.intValue() == DEFAULT_ROAD_COLORS[rt.ordinal() * 2]) { prefs.remove("ROAD_COLOR_" + rt.name().toUpperCase()); //$NON-NLS-1$ } else { prefs.put("ROAD_COLOR_" + rt.name().toUpperCase(), Integer.toString(color.intValue())); //$NON-NLS-1$ } try { prefs.flush(); } catch (BackingStoreException exception) { // } } }
[ "public", "static", "void", "setPreferredRoadColor", "(", "RoadType", "roadType", ",", "Integer", "color", ")", "{", "final", "RoadType", "rt", "=", "roadType", "==", "null", "?", "RoadType", ".", "OTHER", ":", "roadType", ";", "final", "Preferences", "prefs",...
Set the preferred color to draw the content of the roads of the given type. @param roadType is the type of road for which the color should be replied. @param color is the color or <code>null</code> to restore the default value.
[ "Set", "the", "preferred", "color", "to", "draw", "the", "content", "of", "the", "roads", "of", "the", "given", "type", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L195-L210
UrielCh/ovh-java-sdk
ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java
ApiOvhEmailmxplan.service_domain_domainName_disclaimer_POST
public OvhTask service_domain_domainName_disclaimer_POST(String service, String domainName, String content, Boolean outsideOnly) throws IOException { String qPath = "/email/mxplan/{service}/domain/{domainName}/disclaimer"; StringBuilder sb = path(qPath, service, domainName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "content", content); addBody(o, "outsideOnly", outsideOnly); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask service_domain_domainName_disclaimer_POST(String service, String domainName, String content, Boolean outsideOnly) throws IOException { String qPath = "/email/mxplan/{service}/domain/{domainName}/disclaimer"; StringBuilder sb = path(qPath, service, domainName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "content", content); addBody(o, "outsideOnly", outsideOnly); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "service_domain_domainName_disclaimer_POST", "(", "String", "service", ",", "String", "domainName", ",", "String", "content", ",", "Boolean", "outsideOnly", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/mxplan/{service}/domain/{...
Create organization disclaimer of each email REST: POST /email/mxplan/{service}/domain/{domainName}/disclaimer @param content [required] Signature, added at the bottom of your organization emails @param outsideOnly [required] Activate the disclaimer only for external emails @param service [required] The internal name of your mxplan organization @param domainName [required] Domain name API beta
[ "Create", "organization", "disclaimer", "of", "each", "email" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java#L702-L710
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
Instance.setMetadata
public Operation setMetadata(Map<String, String> metadata, OperationOption... options) { return setMetadata(getMetadata().toBuilder().setValues(metadata).build(), options); }
java
public Operation setMetadata(Map<String, String> metadata, OperationOption... options) { return setMetadata(getMetadata().toBuilder().setValues(metadata).build(), options); }
[ "public", "Operation", "setMetadata", "(", "Map", "<", "String", ",", "String", ">", "metadata", ",", "OperationOption", "...", "options", ")", "{", "return", "setMetadata", "(", "getMetadata", "(", ")", ".", "toBuilder", "(", ")", ".", "setValues", "(", "...
Sets the metadata for this instance, fingerprint value is taken from this instance's {@code tags().fingerprint()}. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure
[ "Sets", "the", "metadata", "for", "this", "instance", "fingerprint", "value", "is", "taken", "from", "this", "instance", "s", "{", "@code", "tags", "()", ".", "fingerprint", "()", "}", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L371-L373
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.createFundamental
public static DMatrixRMaj createFundamental(DMatrixRMaj E, DMatrixRMaj K) { DMatrixRMaj K_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K,K_inv); DMatrixRMaj F = new DMatrixRMaj(3,3); PerspectiveOps.multTranA(K_inv,E,K_inv,F); return F; }
java
public static DMatrixRMaj createFundamental(DMatrixRMaj E, DMatrixRMaj K) { DMatrixRMaj K_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K,K_inv); DMatrixRMaj F = new DMatrixRMaj(3,3); PerspectiveOps.multTranA(K_inv,E,K_inv,F); return F; }
[ "public", "static", "DMatrixRMaj", "createFundamental", "(", "DMatrixRMaj", "E", ",", "DMatrixRMaj", "K", ")", "{", "DMatrixRMaj", "K_inv", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "CommonOps_DDRM", ".", "invert", "(", "K", ",", "K_inv", ")...
Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K<sup>-1</sup>)<sup>T</sup>*E*K<sup>-1</sup> @param E Essential matrix @param K Intrinsic camera calibration matrix @return Fundamental matrix
[ "Computes", "a", "Fundamental", "matrix", "given", "an", "Essential", "matrix", "and", "the", "camera", "calibration", "matrix", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L687-L695
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/fastagi/AbstractAgiServer.java
AbstractAgiServer.createPool
protected ThreadPoolExecutor createPool() { return new ThreadPoolExecutor(poolSize, (maximumPoolSize < poolSize) ? poolSize : maximumPoolSize, 50000L, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new DaemonThreadFactory()); }
java
protected ThreadPoolExecutor createPool() { return new ThreadPoolExecutor(poolSize, (maximumPoolSize < poolSize) ? poolSize : maximumPoolSize, 50000L, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new DaemonThreadFactory()); }
[ "protected", "ThreadPoolExecutor", "createPool", "(", ")", "{", "return", "new", "ThreadPoolExecutor", "(", "poolSize", ",", "(", "maximumPoolSize", "<", "poolSize", ")", "?", "poolSize", ":", "maximumPoolSize", ",", "50000L", ",", "TimeUnit", ".", "MILLISECONDS",...
Creates a new ThreadPoolExecutor to serve the AGI requests. The nature of this pool defines how many concurrent requests can be handled. The default implementation returns a dynamic thread pool defined by the poolSize and maximumPoolSize properties. <p> You can override this method to change this behavior. For example you can use a cached pool with <pre> return Executors.newCachedThreadPool(new DaemonThreadFactory()); </pre> @return the ThreadPoolExecutor to use for serving AGI requests. @see #setPoolSize(int) @see #setMaximumPoolSize(int)
[ "Creates", "a", "new", "ThreadPoolExecutor", "to", "serve", "the", "AGI", "requests", ".", "The", "nature", "of", "this", "pool", "defines", "how", "many", "concurrent", "requests", "can", "be", "handled", ".", "The", "default", "implementation", "returns", "a...
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/fastagi/AbstractAgiServer.java#L293-L297
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java
ColumnList.getAlias
private String getAlias(String schema, String table, String column, int stepDepth) { //PropertyType is not part of equals or hashCode so not needed for the lookup. Column c = new Column(schema, table, column, null, stepDepth); return columns.get(c); }
java
private String getAlias(String schema, String table, String column, int stepDepth) { //PropertyType is not part of equals or hashCode so not needed for the lookup. Column c = new Column(schema, table, column, null, stepDepth); return columns.get(c); }
[ "private", "String", "getAlias", "(", "String", "schema", ",", "String", "table", ",", "String", "column", ",", "int", "stepDepth", ")", "{", "//PropertyType is not part of equals or hashCode so not needed for the lookup.", "Column", "c", "=", "new", "Column", "(", "s...
get an alias if the column is already in the list @param schema @param table @param column @return
[ "get", "an", "alias", "if", "the", "column", "is", "already", "in", "the", "list" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java#L152-L156
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLock.java
RaftLock.acquire
AcquireResult acquire(LockInvocationKey key, boolean wait) { LockEndpoint endpoint = key.endpoint(); UUID invocationUid = key.invocationUid(); RaftLockOwnershipState memorized = ownerInvocationRefUids.get(Tuple2.of(endpoint, invocationUid)); if (memorized != null) { AcquireStatus status = memorized.isLocked() ? SUCCESSFUL : FAILED; return new AcquireResult(status, memorized.getFence(), Collections.<LockInvocationKey>emptyList()); } if (owner == null) { owner = key; } if (endpoint.equals(owner.endpoint())) { if (lockCount == lockCountLimit) { ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), NOT_LOCKED); return AcquireResult.failed(Collections.<LockInvocationKey>emptyList()); } lockCount++; ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), lockOwnershipState()); return AcquireResult.acquired(owner.commitIndex()); } // we must cancel waits keys of previous invocation of the endpoint // before adding a new wait key or even if we will not wait Collection<LockInvocationKey> cancelledWaitKeys = cancelWaitKeys(endpoint, invocationUid); if (wait) { addWaitKey(endpoint, key); return AcquireResult.waitKeyAdded(cancelledWaitKeys); } return AcquireResult.failed(cancelledWaitKeys); }
java
AcquireResult acquire(LockInvocationKey key, boolean wait) { LockEndpoint endpoint = key.endpoint(); UUID invocationUid = key.invocationUid(); RaftLockOwnershipState memorized = ownerInvocationRefUids.get(Tuple2.of(endpoint, invocationUid)); if (memorized != null) { AcquireStatus status = memorized.isLocked() ? SUCCESSFUL : FAILED; return new AcquireResult(status, memorized.getFence(), Collections.<LockInvocationKey>emptyList()); } if (owner == null) { owner = key; } if (endpoint.equals(owner.endpoint())) { if (lockCount == lockCountLimit) { ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), NOT_LOCKED); return AcquireResult.failed(Collections.<LockInvocationKey>emptyList()); } lockCount++; ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), lockOwnershipState()); return AcquireResult.acquired(owner.commitIndex()); } // we must cancel waits keys of previous invocation of the endpoint // before adding a new wait key or even if we will not wait Collection<LockInvocationKey> cancelledWaitKeys = cancelWaitKeys(endpoint, invocationUid); if (wait) { addWaitKey(endpoint, key); return AcquireResult.waitKeyAdded(cancelledWaitKeys); } return AcquireResult.failed(cancelledWaitKeys); }
[ "AcquireResult", "acquire", "(", "LockInvocationKey", "key", ",", "boolean", "wait", ")", "{", "LockEndpoint", "endpoint", "=", "key", ".", "endpoint", "(", ")", ";", "UUID", "invocationUid", "=", "key", ".", "invocationUid", "(", ")", ";", "RaftLockOwnershipS...
Assigns the lock to the endpoint, if the lock is not held. Lock count is incremented if the endpoint already holds the lock. If some other endpoint holds the lock and the second argument is true, a wait key is created and added to the wait queue. Lock count is not incremented if the lock request is a retry of the lock holder. If the lock request is a retry of a lock endpoint that resides in the wait queue with the same invocation uid, a retry wait key wait key is attached to the original wait key. If the lock request is a new request of a lock endpoint that resides in the wait queue with a different invocation uid, the existing wait key is cancelled because it means the caller has stopped waiting for response of the previous invocation. If the invocation uid is same with one of the previous invocations of the current lock owner, memorized result of the previous invocation is returned.
[ "Assigns", "the", "lock", "to", "the", "endpoint", "if", "the", "lock", "is", "not", "held", ".", "Lock", "count", "is", "incremented", "if", "the", "endpoint", "already", "holds", "the", "lock", ".", "If", "some", "other", "endpoint", "holds", "the", "l...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLock.java#L95-L129
jMotif/SAX
src/main/java/net/seninp/util/UCRUtils.java
UCRUtils.datasetStats
public static String datasetStats(Map<String, List<double[]>> data, String name) { int globalMinLength = Integer.MAX_VALUE; int globalMaxLength = Integer.MIN_VALUE; double globalMinValue = Double.MAX_VALUE; double globalMaxValue = Double.MIN_VALUE; for (Entry<String, List<double[]>> e : data.entrySet()) { for (double[] dataEntry : e.getValue()) { globalMaxLength = (dataEntry.length > globalMaxLength) ? dataEntry.length : globalMaxLength; globalMinLength = (dataEntry.length < globalMinLength) ? dataEntry.length : globalMinLength; for (double value : dataEntry) { globalMaxValue = (value > globalMaxValue) ? value : globalMaxValue; globalMinValue = (value < globalMinValue) ? value : globalMinValue; } } } StringBuffer sb = new StringBuffer(); sb.append(name).append("classes: ").append(data.size()); sb.append(", series length min: ").append(globalMinLength); sb.append(", max: ").append(globalMaxLength); sb.append(", min value: ").append(globalMinValue); sb.append(", max value: ").append(globalMaxValue).append(";"); for (Entry<String, List<double[]>> e : data.entrySet()) { sb.append(name).append(" class: ").append(e.getKey()); sb.append(" series: ").append(e.getValue().size()).append(";"); } return sb.delete(sb.length() - 1, sb.length()).toString(); }
java
public static String datasetStats(Map<String, List<double[]>> data, String name) { int globalMinLength = Integer.MAX_VALUE; int globalMaxLength = Integer.MIN_VALUE; double globalMinValue = Double.MAX_VALUE; double globalMaxValue = Double.MIN_VALUE; for (Entry<String, List<double[]>> e : data.entrySet()) { for (double[] dataEntry : e.getValue()) { globalMaxLength = (dataEntry.length > globalMaxLength) ? dataEntry.length : globalMaxLength; globalMinLength = (dataEntry.length < globalMinLength) ? dataEntry.length : globalMinLength; for (double value : dataEntry) { globalMaxValue = (value > globalMaxValue) ? value : globalMaxValue; globalMinValue = (value < globalMinValue) ? value : globalMinValue; } } } StringBuffer sb = new StringBuffer(); sb.append(name).append("classes: ").append(data.size()); sb.append(", series length min: ").append(globalMinLength); sb.append(", max: ").append(globalMaxLength); sb.append(", min value: ").append(globalMinValue); sb.append(", max value: ").append(globalMaxValue).append(";"); for (Entry<String, List<double[]>> e : data.entrySet()) { sb.append(name).append(" class: ").append(e.getKey()); sb.append(" series: ").append(e.getValue().size()).append(";"); } return sb.delete(sb.length() - 1, sb.length()).toString(); }
[ "public", "static", "String", "datasetStats", "(", "Map", "<", "String", ",", "List", "<", "double", "[", "]", ">", ">", "data", ",", "String", "name", ")", "{", "int", "globalMinLength", "=", "Integer", ".", "MAX_VALUE", ";", "int", "globalMaxLength", "...
Prints the dataset statistics. @param data the UCRdataset. @param name the dataset name to use. @return stats.
[ "Prints", "the", "dataset", "statistics", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/UCRUtils.java#L78-L112
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/Script.java
Script.getSigOpCount
private static int getSigOpCount(List<ScriptChunk> chunks, boolean accurate) throws ScriptException { int sigOps = 0; int lastOpCode = OP_INVALIDOPCODE; for (ScriptChunk chunk : chunks) { if (chunk.isOpCode()) { switch (chunk.opcode) { case OP_CHECKSIG: case OP_CHECKSIGVERIFY: sigOps++; break; case OP_CHECKMULTISIG: case OP_CHECKMULTISIGVERIFY: if (accurate && lastOpCode >= OP_1 && lastOpCode <= OP_16) sigOps += decodeFromOpN(lastOpCode); else sigOps += 20; break; default: break; } lastOpCode = chunk.opcode; } } return sigOps; }
java
private static int getSigOpCount(List<ScriptChunk> chunks, boolean accurate) throws ScriptException { int sigOps = 0; int lastOpCode = OP_INVALIDOPCODE; for (ScriptChunk chunk : chunks) { if (chunk.isOpCode()) { switch (chunk.opcode) { case OP_CHECKSIG: case OP_CHECKSIGVERIFY: sigOps++; break; case OP_CHECKMULTISIG: case OP_CHECKMULTISIGVERIFY: if (accurate && lastOpCode >= OP_1 && lastOpCode <= OP_16) sigOps += decodeFromOpN(lastOpCode); else sigOps += 20; break; default: break; } lastOpCode = chunk.opcode; } } return sigOps; }
[ "private", "static", "int", "getSigOpCount", "(", "List", "<", "ScriptChunk", ">", "chunks", ",", "boolean", "accurate", ")", "throws", "ScriptException", "{", "int", "sigOps", "=", "0", ";", "int", "lastOpCode", "=", "OP_INVALIDOPCODE", ";", "for", "(", "Sc...
//////////////////// Interface used during verification of transactions/blocks ////////////////////////////////
[ "////////////////////", "Interface", "used", "during", "verification", "of", "transactions", "/", "blocks", "////////////////////////////////" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L510-L534
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java
MapDotApi.dotGetNullableOptional
public static <T> Optional<T> dotGetNullableOptional( final Map map, final String pathString, final Class<T> clazz ) { return dotGetNullable(map, Optional.class, pathString); }
java
public static <T> Optional<T> dotGetNullableOptional( final Map map, final String pathString, final Class<T> clazz ) { return dotGetNullable(map, Optional.class, pathString); }
[ "public", "static", "<", "T", ">", "Optional", "<", "T", ">", "dotGetNullableOptional", "(", "final", "Map", "map", ",", "final", "String", "pathString", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "return", "dotGetNullable", "(", "map", ","...
Get optional value by path. @param <T> optional value type @param clazz type of value @param map subject @param pathString nodes to walk in map @return value
[ "Get", "optional", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L254-L258
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCSSGenerator.java
AbstractCSSGenerator.generateResourceForDebug
protected Reader generateResourceForDebug(Reader rd, GeneratorContext context) { // Rewrite the image URL StringWriter writer = new StringWriter(); try { IOUtils.copy(rd, writer); String content = rewriteUrl(context, writer.toString()); rd = new StringReader(content); } catch (IOException e) { throw new BundlingProcessException(e); } return rd; }
java
protected Reader generateResourceForDebug(Reader rd, GeneratorContext context) { // Rewrite the image URL StringWriter writer = new StringWriter(); try { IOUtils.copy(rd, writer); String content = rewriteUrl(context, writer.toString()); rd = new StringReader(content); } catch (IOException e) { throw new BundlingProcessException(e); } return rd; }
[ "protected", "Reader", "generateResourceForDebug", "(", "Reader", "rd", ",", "GeneratorContext", "context", ")", "{", "// Rewrite the image URL", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "IOUtils", ".", "copy", "(", "rd", ...
Returns the resource in debug mode. Here an extra step is used to rewrite the URL in debug mode @param reader the reader @param context the generator context @return the reader
[ "Returns", "the", "resource", "in", "debug", "mode", ".", "Here", "an", "extra", "step", "is", "used", "to", "rewrite", "the", "URL", "in", "debug", "mode" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCSSGenerator.java#L76-L89
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_PUT
public OvhOperation serviceName_PUT(String serviceName, String displayName, Boolean isCapped) throws IOException { String qPath = "/dbaas/logs/{serviceName}"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "isCapped", isCapped); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_PUT(String serviceName, String displayName, Boolean isCapped) throws IOException { String qPath = "/dbaas/logs/{serviceName}"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "isCapped", isCapped); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_PUT", "(", "String", "serviceName", ",", "String", "displayName", ",", "Boolean", "isCapped", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}\"", ";", "StringBuilder", "sb", "=", "path", ...
Update the service properties REST: PUT /dbaas/logs/{serviceName} @param serviceName [required] Service name @param displayName [required] Service custom name @param isCapped [required] If set, block indexation when plan's limit is reached
[ "Update", "the", "service", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1011-L1019
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java
MolgenisMenuController.forwardMenuPlugin
@SuppressWarnings("squid:S3752") // multiple methods required @RequestMapping( method = {RequestMethod.GET, RequestMethod.POST}, value = "/{menuId}/{pluginId}/**") public String forwardMenuPlugin( HttpServletRequest request, @Valid @NotNull @PathVariable String menuId, @Valid @NotNull @PathVariable String pluginId, Model model) { String contextUri = URI + '/' + menuId + '/' + pluginId; String mappingUri = (String) (request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)); String remainder = mappingUri.substring(contextUri.length()); model.addAttribute(KEY_MENU_ID, menuId); addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId, remainder); }
java
@SuppressWarnings("squid:S3752") // multiple methods required @RequestMapping( method = {RequestMethod.GET, RequestMethod.POST}, value = "/{menuId}/{pluginId}/**") public String forwardMenuPlugin( HttpServletRequest request, @Valid @NotNull @PathVariable String menuId, @Valid @NotNull @PathVariable String pluginId, Model model) { String contextUri = URI + '/' + menuId + '/' + pluginId; String mappingUri = (String) (request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE)); String remainder = mappingUri.substring(contextUri.length()); model.addAttribute(KEY_MENU_ID, menuId); addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId, remainder); }
[ "@", "SuppressWarnings", "(", "\"squid:S3752\"", ")", "// multiple methods required", "@", "RequestMapping", "(", "method", "=", "{", "RequestMethod", ".", "GET", ",", "RequestMethod", ".", "POST", "}", ",", "value", "=", "\"/{menuId}/{pluginId}/**\"", ")", "public"...
Forwards to the specified plugin in the specified menu. This may be a submenu. Only the last two levels of the possibly very deep menu tree are used to construct the URL. @param menuId ID of the menu parent of the pluginID @param pluginId ID of the plugin
[ "Forwards", "to", "the", "specified", "plugin", "in", "the", "specified", "menu", ".", "This", "may", "be", "a", "submenu", ".", "Only", "the", "last", "two", "levels", "of", "the", "possibly", "very", "deep", "menu", "tree", "are", "used", "to", "constr...
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisMenuController.java#L153-L170
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.getOffsetUnsafe
public static long getOffsetUnsafe(DataBuffer shapeInformation, int row, int col) { long offset = 0; int size_0 = sizeUnsafe(shapeInformation, 0); int size_1 = sizeUnsafe(shapeInformation, 1); if (row >= size_0 || col >= size_1) throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += row * strideUnsafe(shapeInformation, 0, 2); if (size_1 != 1) offset += col * strideUnsafe(shapeInformation, 1, 2); return offset; }
java
public static long getOffsetUnsafe(DataBuffer shapeInformation, int row, int col) { long offset = 0; int size_0 = sizeUnsafe(shapeInformation, 0); int size_1 = sizeUnsafe(shapeInformation, 1); if (row >= size_0 || col >= size_1) throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += row * strideUnsafe(shapeInformation, 0, 2); if (size_1 != 1) offset += col * strideUnsafe(shapeInformation, 1, 2); return offset; }
[ "public", "static", "long", "getOffsetUnsafe", "(", "DataBuffer", "shapeInformation", ",", "int", "row", ",", "int", "col", ")", "{", "long", "offset", "=", "0", ";", "int", "size_0", "=", "sizeUnsafe", "(", "shapeInformation", ",", "0", ")", ";", "int", ...
Identical to {@link Shape#getOffset(DataBuffer, int, int)} but without input validation on array rank
[ "Identical", "to", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1002-L1016
dkmfbk/knowledgestore
ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/HBaseUtils.java
HBaseUtils.count
@Override public long count(String tableName, String familyName, XPath condition) throws IOException { logger.debug("NATIVE Begin count"); // clone the current conf org.apache.hadoop.conf.Configuration customConf = new org.apache.hadoop.conf.Configuration(super.getHbcfg()); // Increase RPC timeout, in case of a slow computation customConf.setLong("hbase.rpc.timeout", 600000); // Default is 1, set to a higher value for faster scanner.next(..) customConf.setLong("hbase.client.scanner.caching", 1000); /* System.out.println("HBaseUtils begin of |customConf|"); Configuration.dumpConfiguration(customConf, new PrintWriter(System.out)); System.out.println("\nHBaseUtils end of |customConf|"); */ AggregationClient agClient = new AggregationClient(customConf); long rowCount = 0; byte[] tName = Bytes.toBytes(tableName); try { Scan scan = getScan(tableName, familyName); rowCount = agClient.rowCount(tName, null, scan); } catch (Throwable e) { throw new IOException(e.toString()); } return rowCount; }
java
@Override public long count(String tableName, String familyName, XPath condition) throws IOException { logger.debug("NATIVE Begin count"); // clone the current conf org.apache.hadoop.conf.Configuration customConf = new org.apache.hadoop.conf.Configuration(super.getHbcfg()); // Increase RPC timeout, in case of a slow computation customConf.setLong("hbase.rpc.timeout", 600000); // Default is 1, set to a higher value for faster scanner.next(..) customConf.setLong("hbase.client.scanner.caching", 1000); /* System.out.println("HBaseUtils begin of |customConf|"); Configuration.dumpConfiguration(customConf, new PrintWriter(System.out)); System.out.println("\nHBaseUtils end of |customConf|"); */ AggregationClient agClient = new AggregationClient(customConf); long rowCount = 0; byte[] tName = Bytes.toBytes(tableName); try { Scan scan = getScan(tableName, familyName); rowCount = agClient.rowCount(tName, null, scan); } catch (Throwable e) { throw new IOException(e.toString()); } return rowCount; }
[ "@", "Override", "public", "long", "count", "(", "String", "tableName", ",", "String", "familyName", ",", "XPath", "condition", ")", "throws", "IOException", "{", "logger", ".", "debug", "(", "\"NATIVE Begin count\"", ")", ";", "// clone the current conf", "org", ...
Gets a number of record of tableName matching condition @param tableName the table name @param familyName the family @param condition to match @throws IOException
[ "Gets", "a", "number", "of", "record", "of", "tableName", "matching", "condition" ]
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server-hbase/src/main/java/eu/fbk/knowledgestore/datastore/hbase/utils/HBaseUtils.java#L246-L272
samskivert/pythagoras
src/main/java/pythagoras/d/Box.java
Box.intersectionX
protected double intersectionX (IRay3 ray, double x) { IVector3 origin = ray.origin(), dir = ray.direction(); double t = (x - origin.x()) / dir.x(); if (t < 0f) { return Float.MAX_VALUE; } double iy = origin.y() + t*dir.y(), iz = origin.z() + t*dir.z(); return (iy >= _minExtent.y && iy <= _maxExtent.y && iz >= _minExtent.z && iz <= _maxExtent.z) ? t : Float.MAX_VALUE; }
java
protected double intersectionX (IRay3 ray, double x) { IVector3 origin = ray.origin(), dir = ray.direction(); double t = (x - origin.x()) / dir.x(); if (t < 0f) { return Float.MAX_VALUE; } double iy = origin.y() + t*dir.y(), iz = origin.z() + t*dir.z(); return (iy >= _minExtent.y && iy <= _maxExtent.y && iz >= _minExtent.z && iz <= _maxExtent.z) ? t : Float.MAX_VALUE; }
[ "protected", "double", "intersectionX", "(", "IRay3", "ray", ",", "double", "x", ")", "{", "IVector3", "origin", "=", "ray", ".", "origin", "(", ")", ",", "dir", "=", "ray", ".", "direction", "(", ")", ";", "double", "t", "=", "(", "x", "-", "origi...
Helper method for {@link #intersection}. Finds the <code>t</code> value where the ray intersects the box at the plane where x equals the value specified, or returns {@link Float#MAX_VALUE} if there is no such intersection.
[ "Helper", "method", "for", "{" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Box.java#L480-L489
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getResourceAsFile
public static File getResourceAsFile(String name) { URL resourceURL = getResource(name); if(resourceURL == null) { throw new NoSuchBeingException("Resource |%s| not found.", name); } String protocol = resourceURL.getProtocol(); if("file".equals(protocol)) try { return new File(resourceURL.toURI()); } catch(URISyntaxException e) { throw new BugError("Invalid syntax on URL returned by getResource."); } throw new UnsupportedOperationException("Can't get a file for a resource using protocol" + protocol); }
java
public static File getResourceAsFile(String name) { URL resourceURL = getResource(name); if(resourceURL == null) { throw new NoSuchBeingException("Resource |%s| not found.", name); } String protocol = resourceURL.getProtocol(); if("file".equals(protocol)) try { return new File(resourceURL.toURI()); } catch(URISyntaxException e) { throw new BugError("Invalid syntax on URL returned by getResource."); } throw new UnsupportedOperationException("Can't get a file for a resource using protocol" + protocol); }
[ "public", "static", "File", "getResourceAsFile", "(", "String", "name", ")", "{", "URL", "resourceURL", "=", "getResource", "(", "name", ")", ";", "if", "(", "resourceURL", "==", "null", ")", "{", "throw", "new", "NoSuchBeingException", "(", "\"Resource |%s| n...
Get file resource, that is, resource with <em>file</em> protocol. Try to load resource throwing exception if not found. If resource protocol is <em>file</em> returns it as {@link java.io.File} otherwise throws unsupported operation. @param name resource name. @return resource file. @throws NoSuchBeingException if named resource can't be loaded. @throws UnsupportedOperationException if named resource protocol is not <em>file</em>.
[ "Get", "file", "resource", "that", "is", "resource", "with", "<em", ">", "file<", "/", "em", ">", "protocol", ".", "Try", "to", "load", "resource", "throwing", "exception", "if", "not", "found", ".", "If", "resource", "protocol", "is", "<em", ">", "file<...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1090-L1104
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XConstructorCall expression, ISideEffectContext context) { for (final XExpression ex : expression.getArguments()) { if (hasSideEffects(ex, context)) { return true; } } return false; }
java
protected Boolean _hasSideEffects(XConstructorCall expression, ISideEffectContext context) { for (final XExpression ex : expression.getArguments()) { if (hasSideEffects(ex, context)) { return true; } } return false; }
[ "protected", "Boolean", "_hasSideEffects", "(", "XConstructorCall", "expression", ",", "ISideEffectContext", "context", ")", "{", "for", "(", "final", "XExpression", "ex", ":", "expression", ".", "getArguments", "(", ")", ")", "{", "if", "(", "hasSideEffects", "...
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L481-L488
VoltDB/voltdb
src/frontend/org/voltdb/NonVoltDBBackend.java
NonVoltDBBackend.isBigintColumn
private boolean isBigintColumn(String columnName, List<String> tableNames, boolean debugPrint) { List<String> bigintColumnTypes = Arrays.asList("BIGINT"); return isColumnType(bigintColumnTypes, columnName, tableNames, debugPrint); }
java
private boolean isBigintColumn(String columnName, List<String> tableNames, boolean debugPrint) { List<String> bigintColumnTypes = Arrays.asList("BIGINT"); return isColumnType(bigintColumnTypes, columnName, tableNames, debugPrint); }
[ "private", "boolean", "isBigintColumn", "(", "String", "columnName", ",", "List", "<", "String", ">", "tableNames", ",", "boolean", "debugPrint", ")", "{", "List", "<", "String", ">", "bigintColumnTypes", "=", "Arrays", ".", "asList", "(", "\"BIGINT\"", ")", ...
Returns true if the <i>columnName</i> is of column type BIGINT, or equivalents in a comparison, non-VoltDB database; false otherwise.
[ "Returns", "true", "if", "the", "<i", ">", "columnName<", "/", "i", ">", "is", "of", "column", "type", "BIGINT", "or", "equivalents", "in", "a", "comparison", "non", "-", "VoltDB", "database", ";", "false", "otherwise", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/NonVoltDBBackend.java#L570-L573
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.getObjectIndex
@Deprecated public static Object getObjectIndex(Object obj, double dblIndex, Context cx) { return getObjectIndex(obj, dblIndex, cx, getTopCallScope(cx)); }
java
@Deprecated public static Object getObjectIndex(Object obj, double dblIndex, Context cx) { return getObjectIndex(obj, dblIndex, cx, getTopCallScope(cx)); }
[ "@", "Deprecated", "public", "static", "Object", "getObjectIndex", "(", "Object", "obj", ",", "double", "dblIndex", ",", "Context", "cx", ")", "{", "return", "getObjectIndex", "(", "obj", ",", "dblIndex", ",", "cx", ",", "getTopCallScope", "(", "cx", ")", ...
A cheaper and less general version of the above for well-known argument types. @deprecated Use {@link #getObjectIndex(Object, double, Context, Scriptable)} instead
[ "A", "cheaper", "and", "less", "general", "version", "of", "the", "above", "for", "well", "-", "known", "argument", "types", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1631-L1636
twilio/authy-java
src/main/java/com/authy/api/Users.java
Users.requestSms
public Hash requestSms(int userId, Map<String, String> options) throws AuthyException { MapToResponse opt = new MapToResponse(options); final Response response = this.get(SMS_PATH + Integer.toString(userId), opt); return instanceFromJson(response.getStatus(), response.getBody()); }
java
public Hash requestSms(int userId, Map<String, String> options) throws AuthyException { MapToResponse opt = new MapToResponse(options); final Response response = this.get(SMS_PATH + Integer.toString(userId), opt); return instanceFromJson(response.getStatus(), response.getBody()); }
[ "public", "Hash", "requestSms", "(", "int", "userId", ",", "Map", "<", "String", ",", "String", ">", "options", ")", "throws", "AuthyException", "{", "MapToResponse", "opt", "=", "new", "MapToResponse", "(", "options", ")", ";", "final", "Response", "respons...
Send token via sms to a user with some options defined. @param userId @param options @return Hash instance with API's response.
[ "Send", "token", "via", "sms", "to", "a", "user", "with", "some", "options", "defined", "." ]
train
https://github.com/twilio/authy-java/blob/55e3a5ff57a93b3eb36f5b59e8824e60af2b8b91/src/main/java/com/authy/api/Users.java#L80-L84
op4j/op4j
src/main/java/org/op4j/functions/Call.java
Call.setOf
public static <R> Function<Object,Set<R>> setOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) { return methodForSetOf(resultType, methodName, optionalParameters); }
java
public static <R> Function<Object,Set<R>> setOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) { return methodForSetOf(resultType, methodName, optionalParameters); }
[ "public", "static", "<", "R", ">", "Function", "<", "Object", ",", "Set", "<", "R", ">", ">", "setOf", "(", "final", "Type", "<", "R", ">", "resultType", ",", "final", "String", "methodName", ",", "final", "Object", "...", "optionalParameters", ")", "{...
<p> Abbreviation for {{@link #methodForSetOf(Type, String, Object...)}. </p> @since 1.1 @param methodName the name of the method @param optionalParameters the (optional) parameters of the method. @return the result of the method execution
[ "<p", ">", "Abbreviation", "for", "{{", "@link", "#methodForSetOf", "(", "Type", "String", "Object", "...", ")", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L676-L678