repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
rjstanford/protea-http
src/main/java/cc/protea/util/http/Request.java
Request.addQueryParameter
public Request addQueryParameter(final String name, final String value) { this.query.put(name, value); return this; }
java
public Request addQueryParameter(final String name, final String value) { this.query.put(name, value); return this; }
[ "public", "Request", "addQueryParameter", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "this", ".", "query", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a Query Parameter to a list. The list is converted to a String and appended to the URL when the Request is submitted. @param name The Query Parameter's name @param value The Query Parameter's value @return this Request, to support chained method calls
[ "Adds", "a", "Query", "Parameter", "to", "a", "list", ".", "The", "list", "is", "converted", "to", "a", "String", "and", "appended", "to", "the", "URL", "when", "the", "Request", "is", "submitted", "." ]
train
https://github.com/rjstanford/protea-http/blob/4d4a18805639181a738faff199e39d58337169ea/src/main/java/cc/protea/util/http/Request.java#L78-L81
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/base/BaseDesktopMenu.java
BaseDesktopMenu.newLookAndFeelMenu
protected JMenu newLookAndFeelMenu(final ActionListener listener) { final JMenu menuLookAndFeel = new JMenu("Look and Feel"); menuLookAndFeel.setMnemonic('L'); // Look and Feel JMenuItems // GTK JMenuItem jmiPlafGTK; jmiPlafGTK = new JMenuItem("GTK", 'g'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafGTK, 'G'); jmiPlafGTK.addActionListener(new LookAndFeelGTKAction("GTK", this.applicationFrame)); menuLookAndFeel.add(jmiPlafGTK); // Metal default Metal theme JMenuItem jmiPlafMetal; jmiPlafMetal = new JMenuItem("Metal", 'm'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafMetal, 'M'); jmiPlafMetal.addActionListener(new LookAndFeelMetalAction("Metal", this.applicationFrame)); menuLookAndFeel.add(jmiPlafMetal); // Metal Ocean theme JMenuItem jmiPlafOcean; jmiPlafOcean = new JMenuItem("Ocean", 'o'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafOcean, 'O'); jmiPlafOcean.addActionListener(new LookAndFeelMetalAction("Ocean", this.applicationFrame)); menuLookAndFeel.add(jmiPlafOcean); // Motif JMenuItem jmiPlafMotiv; jmiPlafMotiv = new JMenuItem("Motif", 't'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafMotiv, 'T'); jmiPlafMotiv.addActionListener(new LookAndFeelMotifAction("Motif", this.applicationFrame)); menuLookAndFeel.add(jmiPlafMotiv); // Nimbus JMenuItem jmiPlafNimbus; jmiPlafNimbus = new JMenuItem("Nimbus", 'n'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafNimbus, 'N'); jmiPlafNimbus .addActionListener(new LookAndFeelNimbusAction("Nimbus", this.applicationFrame)); menuLookAndFeel.add(jmiPlafNimbus); // Windows JMenuItem jmiPlafSystem; jmiPlafSystem = new JMenuItem("System", 'd'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafSystem, 'W'); jmiPlafSystem .addActionListener(new LookAndFeelSystemAction("System", this.applicationFrame)); menuLookAndFeel.add(jmiPlafSystem); return menuLookAndFeel; }
java
protected JMenu newLookAndFeelMenu(final ActionListener listener) { final JMenu menuLookAndFeel = new JMenu("Look and Feel"); menuLookAndFeel.setMnemonic('L'); // Look and Feel JMenuItems // GTK JMenuItem jmiPlafGTK; jmiPlafGTK = new JMenuItem("GTK", 'g'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafGTK, 'G'); jmiPlafGTK.addActionListener(new LookAndFeelGTKAction("GTK", this.applicationFrame)); menuLookAndFeel.add(jmiPlafGTK); // Metal default Metal theme JMenuItem jmiPlafMetal; jmiPlafMetal = new JMenuItem("Metal", 'm'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafMetal, 'M'); jmiPlafMetal.addActionListener(new LookAndFeelMetalAction("Metal", this.applicationFrame)); menuLookAndFeel.add(jmiPlafMetal); // Metal Ocean theme JMenuItem jmiPlafOcean; jmiPlafOcean = new JMenuItem("Ocean", 'o'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafOcean, 'O'); jmiPlafOcean.addActionListener(new LookAndFeelMetalAction("Ocean", this.applicationFrame)); menuLookAndFeel.add(jmiPlafOcean); // Motif JMenuItem jmiPlafMotiv; jmiPlafMotiv = new JMenuItem("Motif", 't'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafMotiv, 'T'); jmiPlafMotiv.addActionListener(new LookAndFeelMotifAction("Motif", this.applicationFrame)); menuLookAndFeel.add(jmiPlafMotiv); // Nimbus JMenuItem jmiPlafNimbus; jmiPlafNimbus = new JMenuItem("Nimbus", 'n'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafNimbus, 'N'); jmiPlafNimbus .addActionListener(new LookAndFeelNimbusAction("Nimbus", this.applicationFrame)); menuLookAndFeel.add(jmiPlafNimbus); // Windows JMenuItem jmiPlafSystem; jmiPlafSystem = new JMenuItem("System", 'd'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerator(jmiPlafSystem, 'W'); jmiPlafSystem .addActionListener(new LookAndFeelSystemAction("System", this.applicationFrame)); menuLookAndFeel.add(jmiPlafSystem); return menuLookAndFeel; }
[ "protected", "JMenu", "newLookAndFeelMenu", "(", "final", "ActionListener", "listener", ")", "{", "final", "JMenu", "menuLookAndFeel", "=", "new", "JMenu", "(", "\"Look and Feel\"", ")", ";", "menuLookAndFeel", ".", "setMnemonic", "(", "'", "'", ")", ";", "// Lo...
Creates the look and feel menu. @param listener the listener @return the j menu
[ "Creates", "the", "look", "and", "feel", "menu", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/base/BaseDesktopMenu.java#L357-L405
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.arrayJoin
public static String arrayJoin(List<String> arr, String separator) { return (arr == null || separator == null) ? "" : StringUtils.join(arr, separator); }
java
public static String arrayJoin(List<String> arr, String separator) { return (arr == null || separator == null) ? "" : StringUtils.join(arr, separator); }
[ "public", "static", "String", "arrayJoin", "(", "List", "<", "String", ">", "arr", ",", "String", "separator", ")", "{", "return", "(", "arr", "==", "null", "||", "separator", "==", "null", ")", "?", "\"\"", ":", "StringUtils", ".", "join", "(", "arr",...
Joins a list of strings to String using a separator. @param arr a list of strings @param separator a separator string @return a string
[ "Joins", "a", "list", "of", "strings", "to", "String", "using", "a", "separator", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L317-L319
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Waiter.java
Waiter.waitForViews
public <T extends View> boolean waitForViews(boolean scrollMethod, Class<? extends T>... classes) { final long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout(); while (SystemClock.uptimeMillis() < endTime) { for (Class<? extends T> classToWaitFor : classes) { if (waitForView(classToWaitFor, 0, false, false)) { return true; } } if(scrollMethod){ scroller.scroll(Scroller.DOWN); } else { scroller.scrollDown(); } sleeper.sleep(); } return false; }
java
public <T extends View> boolean waitForViews(boolean scrollMethod, Class<? extends T>... classes) { final long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout(); while (SystemClock.uptimeMillis() < endTime) { for (Class<? extends T> classToWaitFor : classes) { if (waitForView(classToWaitFor, 0, false, false)) { return true; } } if(scrollMethod){ scroller.scroll(Scroller.DOWN); } else { scroller.scrollDown(); } sleeper.sleep(); } return false; }
[ "public", "<", "T", "extends", "View", ">", "boolean", "waitForViews", "(", "boolean", "scrollMethod", ",", "Class", "<", "?", "extends", "T", ">", "...", "classes", ")", "{", "final", "long", "endTime", "=", "SystemClock", ".", "uptimeMillis", "(", ")", ...
Waits for two views to be shown. @param scrollMethod {@code true} if it's a method used for scrolling @param classes the classes to wait for @return {@code true} if any of the views are shown and {@code false} if none of the views are shown before the timeout
[ "Waits", "for", "two", "views", "to", "be", "shown", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L273-L292
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java
JBlinkLabel.addIcon
public void addIcon(Object icon, int iIndex) { if (m_rgIcons == null) { m_rgIcons = new ImageIcon[MAX_ICONS]; m_timer = new javax.swing.Timer(500, this); // Remind me to change graphics every 1/2 second m_timer.start(); } if (iIndex < MAX_ICONS) if (icon instanceof ImageIcon) // Always m_rgIcons[iIndex] = (ImageIcon)icon; }
java
public void addIcon(Object icon, int iIndex) { if (m_rgIcons == null) { m_rgIcons = new ImageIcon[MAX_ICONS]; m_timer = new javax.swing.Timer(500, this); // Remind me to change graphics every 1/2 second m_timer.start(); } if (iIndex < MAX_ICONS) if (icon instanceof ImageIcon) // Always m_rgIcons[iIndex] = (ImageIcon)icon; }
[ "public", "void", "addIcon", "(", "Object", "icon", ",", "int", "iIndex", ")", "{", "if", "(", "m_rgIcons", "==", "null", ")", "{", "m_rgIcons", "=", "new", "ImageIcon", "[", "MAX_ICONS", "]", ";", "m_timer", "=", "new", "javax", ".", "swing", ".", "...
Add this icon to the list of icons alternating for this label. @param icon The icon to add. @param iIndex The index for this icon.
[ "Add", "this", "icon", "to", "the", "list", "of", "icons", "alternating", "for", "this", "label", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java#L208-L219
sebastiangraf/jSCSI
bundles/initiator/src/main/java/org/jscsi/initiator/LinkFactory.java
LinkFactory.getConnection
public final Connection getConnection (final Session session, final Configuration initConfiguration, final InetSocketAddress inetAddress, final short initConnectionID) { try { final Connection newConnection = new Connection(session, initConfiguration, inetAddress, initConnectionID); return newConnection; } catch (Exception e) { LOGGER.error("This exception is thrown: " + e); e.printStackTrace(); return null; } }
java
public final Connection getConnection (final Session session, final Configuration initConfiguration, final InetSocketAddress inetAddress, final short initConnectionID) { try { final Connection newConnection = new Connection(session, initConfiguration, inetAddress, initConnectionID); return newConnection; } catch (Exception e) { LOGGER.error("This exception is thrown: " + e); e.printStackTrace(); return null; } }
[ "public", "final", "Connection", "getConnection", "(", "final", "Session", "session", ",", "final", "Configuration", "initConfiguration", ",", "final", "InetSocketAddress", "inetAddress", ",", "final", "short", "initConnectionID", ")", "{", "try", "{", "final", "Con...
Method to create and return a new, empty <code>Connection</code> object with the configured layer of threading. @param session Reference to the <code>AbsSession</code> object, which contains this connection. @param initConfiguration The configuration to use within this connection. @param inetAddress The <code>InetSocketAddress</code> to which this connection should established. @param initConnectionID The ID of this connection. @return AbsConnection The Connection Object.
[ "Method", "to", "create", "and", "return", "a", "new", "empty", "<code", ">", "Connection<", "/", "code", ">", "object", "with", "the", "configured", "layer", "of", "threading", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/initiator/src/main/java/org/jscsi/initiator/LinkFactory.java#L97-L107
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryManagerImpl.java
LogRepositoryManagerImpl.calculateLogFile
private File calculateLogFile(long timestamp) { if (ivSubDirectory == null) getControllingProcessDirectory(timestamp, svPid) ; return getLogFile(ivSubDirectory, timestamp); }
java
private File calculateLogFile(long timestamp) { if (ivSubDirectory == null) getControllingProcessDirectory(timestamp, svPid) ; return getLogFile(ivSubDirectory, timestamp); }
[ "private", "File", "calculateLogFile", "(", "long", "timestamp", ")", "{", "if", "(", "ivSubDirectory", "==", "null", ")", "getControllingProcessDirectory", "(", "timestamp", ",", "svPid", ")", ";", "return", "getLogFile", "(", "ivSubDirectory", ",", "timestamp", ...
/* Calculates location of the new file with provided timestamp. It should be called with the instance lock taken.
[ "/", "*", "Calculates", "location", "of", "the", "new", "file", "with", "provided", "timestamp", ".", "It", "should", "be", "called", "with", "the", "instance", "lock", "taken", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryManagerImpl.java#L520-L525
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/util/UIUtils.java
UIUtils.setFlag
public static void setFlag(Activity activity, final int bits, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); }
java
public static void setFlag(Activity activity, final int bits, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); }
[ "public", "static", "void", "setFlag", "(", "Activity", "activity", ",", "final", "int", "bits", ",", "boolean", "on", ")", "{", "Window", "win", "=", "activity", ".", "getWindow", "(", ")", ";", "WindowManager", ".", "LayoutParams", "winParams", "=", "win...
helper method to activate or deactivate a specific flag @param bits @param on
[ "helper", "method", "to", "activate", "or", "deactivate", "a", "specific", "flag" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L223-L232
taimos/dvalin
jaxrs/src/main/java/de/taimos/dvalin/jaxrs/providers/AuthorizationProvider.java
AuthorizationProvider.createSC
protected static SecurityContext createSC(String user, String... roles) { final Subject subject = new Subject(); final Principal principal = new SimplePrincipal(user); subject.getPrincipals().add(principal); if (roles != null) { for (final String role : roles) { subject.getPrincipals().add(new SimplePrincipal(role)); } } return new DefaultSecurityContext(principal, subject); }
java
protected static SecurityContext createSC(String user, String... roles) { final Subject subject = new Subject(); final Principal principal = new SimplePrincipal(user); subject.getPrincipals().add(principal); if (roles != null) { for (final String role : roles) { subject.getPrincipals().add(new SimplePrincipal(role)); } } return new DefaultSecurityContext(principal, subject); }
[ "protected", "static", "SecurityContext", "createSC", "(", "String", "user", ",", "String", "...", "roles", ")", "{", "final", "Subject", "subject", "=", "new", "Subject", "(", ")", ";", "final", "Principal", "principal", "=", "new", "SimplePrincipal", "(", ...
Create a {@link SecurityContext} to return to the provider @param user the user principal @param roles the roles of the user @return the {@link SecurityContext}
[ "Create", "a", "{", "@link", "SecurityContext", "}", "to", "return", "to", "the", "provider" ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/jaxrs/src/main/java/de/taimos/dvalin/jaxrs/providers/AuthorizationProvider.java#L144-L156
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java
EventServiceImpl.getSegment
public EventServiceSegment getSegment(String service, boolean forceCreate) { EventServiceSegment segment = segments.get(service); if (segment == null && forceCreate) { // we can't make use of the ConcurrentUtil; we need to register the segment to the metricsRegistry in case of creation EventServiceSegment newSegment = new EventServiceSegment(service, nodeEngine.getService(service)); EventServiceSegment existingSegment = segments.putIfAbsent(service, newSegment); if (existingSegment == null) { segment = newSegment; nodeEngine.getMetricsRegistry().scanAndRegister(newSegment, "event.[" + service + "]"); } else { segment = existingSegment; } } return segment; }
java
public EventServiceSegment getSegment(String service, boolean forceCreate) { EventServiceSegment segment = segments.get(service); if (segment == null && forceCreate) { // we can't make use of the ConcurrentUtil; we need to register the segment to the metricsRegistry in case of creation EventServiceSegment newSegment = new EventServiceSegment(service, nodeEngine.getService(service)); EventServiceSegment existingSegment = segments.putIfAbsent(service, newSegment); if (existingSegment == null) { segment = newSegment; nodeEngine.getMetricsRegistry().scanAndRegister(newSegment, "event.[" + service + "]"); } else { segment = existingSegment; } } return segment; }
[ "public", "EventServiceSegment", "getSegment", "(", "String", "service", ",", "boolean", "forceCreate", ")", "{", "EventServiceSegment", "segment", "=", "segments", ".", "get", "(", "service", ")", ";", "if", "(", "segment", "==", "null", "&&", "forceCreate", ...
Returns the {@link EventServiceSegment} for the {@code service}. If the segment is {@code null} and {@code forceCreate} is {@code true}, the segment is created and registered with the {@link MetricsRegistry}. @param service the service of the segment @param forceCreate whether the segment should be created in case there is no segment @return the segment for the service or null if there is no segment and {@code forceCreate} is {@code false}
[ "Returns", "the", "{", "@link", "EventServiceSegment", "}", "for", "the", "{", "@code", "service", "}", ".", "If", "the", "segment", "is", "{", "@code", "null", "}", "and", "{", "@code", "forceCreate", "}", "is", "{", "@code", "true", "}", "the", "segm...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java#L539-L553
intel/jndn-utils
src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
DefaultSegmentedClient.replaceFinalComponent
protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) { Interest copied = new Interest(interest); Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker); Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker)) ? copied.getName().getPrefix(-1) : new Name(copied.getName()); copied.setName(newName.append(lastComponent)); return copied; }
java
protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) { Interest copied = new Interest(interest); Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker); Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker)) ? copied.getName().getPrefix(-1) : new Name(copied.getName()); copied.setName(newName.append(lastComponent)); return copied; }
[ "protected", "Interest", "replaceFinalComponent", "(", "Interest", "interest", ",", "long", "segmentNumber", ",", "byte", "marker", ")", "{", "Interest", "copied", "=", "new", "Interest", "(", "interest", ")", ";", "Component", "lastComponent", "=", "Component", ...
Replace the final component of an interest name with a segmented component; if the interest name does not have a segmented component, this will add one. @param interest the request @param segmentNumber a segment number @param marker a marker to use for segmenting the packet @return a segmented interest (a copy of the passed interest)
[ "Replace", "the", "final", "component", "of", "an", "interest", "name", "with", "a", "segmented", "component", ";", "if", "the", "interest", "name", "does", "not", "have", "a", "segmented", "component", "this", "will", "add", "one", "." ]
train
https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java#L81-L89
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/PagedTable.java
PagedTable.addRow
protected static boolean addRow (SmartTable table, List<Widget> widgets) { if (widgets == null) { return false; } int row = table.getRowCount(); for (int col=0; col<widgets.size(); ++col) { table.setWidget(row, col, widgets.get(col)); table.getFlexCellFormatter().setStyleName(row, col, "col"+col); } return true; }
java
protected static boolean addRow (SmartTable table, List<Widget> widgets) { if (widgets == null) { return false; } int row = table.getRowCount(); for (int col=0; col<widgets.size(); ++col) { table.setWidget(row, col, widgets.get(col)); table.getFlexCellFormatter().setStyleName(row, col, "col"+col); } return true; }
[ "protected", "static", "boolean", "addRow", "(", "SmartTable", "table", ",", "List", "<", "Widget", ">", "widgets", ")", "{", "if", "(", "widgets", "==", "null", ")", "{", "return", "false", ";", "}", "int", "row", "=", "table", ".", "getRowCount", "("...
Convenience function to append a list of widgets to a table as a new row.
[ "Convenience", "function", "to", "append", "a", "list", "of", "widgets", "to", "a", "table", "as", "a", "new", "row", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/PagedTable.java#L68-L79
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.throwMojoExecutionException
protected static void throwMojoExecutionException(Object mojo, String message, Exception cause) throws Exception { Class<?> clz = mojo.getClass().getClassLoader().loadClass(MavenNames.MOJO_EXECUTION_EXCEPTION_BIN); Constructor<?> con = clz.getConstructor(String.class, Exception.class); Exception ex = (Exception) con.newInstance(message, cause); throw ex; }
java
protected static void throwMojoExecutionException(Object mojo, String message, Exception cause) throws Exception { Class<?> clz = mojo.getClass().getClassLoader().loadClass(MavenNames.MOJO_EXECUTION_EXCEPTION_BIN); Constructor<?> con = clz.getConstructor(String.class, Exception.class); Exception ex = (Exception) con.newInstance(message, cause); throw ex; }
[ "protected", "static", "void", "throwMojoExecutionException", "(", "Object", "mojo", ",", "String", "message", ",", "Exception", "cause", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "clz", "=", "mojo", ".", "getClass", "(", ")", ".", "getClassLo...
Throws MojoExecutionException. @param mojo Surefire plugin @param message Message for the exception @param cause The actual exception @throws Exception MojoExecutionException
[ "Throws", "MojoExecutionException", "." ]
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L80-L85
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.translateContinue
private Context translateContinue(WyilFile.Stmt.Continue stmt, Context context) { LoopScope enclosingLoop = context.getEnclosingLoopScope(); enclosingLoop.addContinueContext(context); return null; }
java
private Context translateContinue(WyilFile.Stmt.Continue stmt, Context context) { LoopScope enclosingLoop = context.getEnclosingLoopScope(); enclosingLoop.addContinueContext(context); return null; }
[ "private", "Context", "translateContinue", "(", "WyilFile", ".", "Stmt", ".", "Continue", "stmt", ",", "Context", "context", ")", "{", "LoopScope", "enclosingLoop", "=", "context", ".", "getEnclosingLoopScope", "(", ")", ";", "enclosingLoop", ".", "addContinueCont...
Translate a continue statement. This takes the current context and pushes it into the enclosing loop scope. It will then be extracted later and used. @param stmt @param wyalFile
[ "Translate", "a", "continue", "statement", ".", "This", "takes", "the", "current", "context", "and", "pushes", "it", "into", "the", "enclosing", "loop", "scope", ".", "It", "will", "then", "be", "extracted", "later", "and", "used", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L757-L761
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArrayFor
public static <T> Level0ArrayOperator<Double[],Double> onArrayFor(final Double... elements) { return onArrayOf(Types.DOUBLE, VarArgsUtil.asRequiredObjectArray(elements)); }
java
public static <T> Level0ArrayOperator<Double[],Double> onArrayFor(final Double... elements) { return onArrayOf(Types.DOUBLE, VarArgsUtil.asRequiredObjectArray(elements)); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "Double", "[", "]", ",", "Double", ">", "onArrayFor", "(", "final", "Double", "...", "elements", ")", "{", "return", "onArrayOf", "(", "Types", ".", "DOUBLE", ",", "VarArgsUtil", ".", "asRequir...
<p> Creates an array with the specified elements and an <i>operation expression</i> on it. </p> @param elements the elements of the array being created @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "array", "with", "the", "specified", "elements", "and", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "it", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L945-L947
ontop/ontop
client/protege/src/main/java/it/unibz/inf/ontop/protege/gui/treemodels/ResultSetTableModel.java
ResultSetTableModel.getValueAt
@Override public Object getValueAt(int row, int column) { Vector<String> aux = results.get(row); return aux.get(column); }
java
@Override public Object getValueAt(int row, int column) { Vector<String> aux = results.get(row); return aux.get(column); }
[ "@", "Override", "public", "Object", "getValueAt", "(", "int", "row", ",", "int", "column", ")", "{", "Vector", "<", "String", ">", "aux", "=", "results", ".", "get", "(", "row", ")", ";", "return", "aux", ".", "get", "(", "column", ")", ";", "}" ]
This is the key method of TableModel: it returns the value at each cell of the table. We use strings in this case. If anything goes wrong, we return the exception as a string, so it will be displayed in the table. Note that SQL row and column numbers start at 1, but TableModel column numbers start at 0.
[ "This", "is", "the", "key", "method", "of", "TableModel", ":", "it", "returns", "the", "value", "at", "each", "cell", "of", "the", "table", ".", "We", "use", "strings", "in", "this", "case", ".", "If", "anything", "goes", "wrong", "we", "return", "the"...
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/client/protege/src/main/java/it/unibz/inf/ontop/protege/gui/treemodels/ResultSetTableModel.java#L138-L142
korpling/ANNIS
annis-service/src/main/java/annis/security/ANNISUserConfigurationManager.java
ANNISUserConfigurationManager.deleteUser
public boolean deleteUser(String userName) { // load user info from file if (resourcePath != null) { lock.writeLock().lock(); try { File userDir = new File(resourcePath, "users"); if (userDir.isDirectory()) { // get the file which corresponds to the user File userFile = new File(userDir.getAbsolutePath(), userName); return userFile.delete(); } } finally { lock.writeLock().unlock(); } } // end if resourcePath not null return false; }
java
public boolean deleteUser(String userName) { // load user info from file if (resourcePath != null) { lock.writeLock().lock(); try { File userDir = new File(resourcePath, "users"); if (userDir.isDirectory()) { // get the file which corresponds to the user File userFile = new File(userDir.getAbsolutePath(), userName); return userFile.delete(); } } finally { lock.writeLock().unlock(); } } // end if resourcePath not null return false; }
[ "public", "boolean", "deleteUser", "(", "String", "userName", ")", "{", "// load user info from file", "if", "(", "resourcePath", "!=", "null", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "File", "userDir", "=", ...
Deletes the user from the disk @param userName @return True if successful.
[ "Deletes", "the", "user", "from", "the", "disk" ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/security/ANNISUserConfigurationManager.java#L204-L221
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java
PublicIPPrefixesInner.updateTags
public PublicIPPrefixInner updateTags(String resourceGroupName, String publicIpPrefixName) { return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().last().body(); }
java
public PublicIPPrefixInner updateTags(String resourceGroupName, String publicIpPrefixName) { return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().last().body(); }
[ "public", "PublicIPPrefixInner", "updateTags", "(", "String", "resourceGroupName", ",", "String", "publicIpPrefixName", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "publicIpPrefixName", ")", ".", "toBlocking", "(", ")", ".", ...
Updates public IP prefix tags. @param resourceGroupName The name of the resource group. @param publicIpPrefixName The name of the public IP prefix. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PublicIPPrefixInner object if successful.
[ "Updates", "public", "IP", "prefix", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java#L611-L613
E7du/jfinal-ext3
src/main/java/com/jfinal/ext/core/ControllerExt.java
ControllerExt.getParaToBigInteger
public BigInteger getParaToBigInteger(String name,BigInteger defaultValue){ return this.toBigInteger(getPara(name), defaultValue); }
java
public BigInteger getParaToBigInteger(String name,BigInteger defaultValue){ return this.toBigInteger(getPara(name), defaultValue); }
[ "public", "BigInteger", "getParaToBigInteger", "(", "String", "name", ",", "BigInteger", "defaultValue", ")", "{", "return", "this", ".", "toBigInteger", "(", "getPara", "(", "name", ")", ",", "defaultValue", ")", ";", "}" ]
Returns the value of a request parameter and convert to BigInteger with a default value if it is null. @param name a String specifying the name of the parameter @return a BigInteger representing the single value of the parameter
[ "Returns", "the", "value", "of", "a", "request", "parameter", "and", "convert", "to", "BigInteger", "with", "a", "default", "value", "if", "it", "is", "null", "." ]
train
https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/core/ControllerExt.java#L101-L103
javagl/ND
nd-arrays/src/main/java/de/javagl/nd/arrays/j/LongArraysND.java
LongArraysND.wrap
public static MutableLongArrayND wrap( MutableLongTuple t, IntTuple size) { Objects.requireNonNull(t, "The tuple is null"); Objects.requireNonNull(size, "The size is null"); int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b); if (t.getSize() != totalSize) { throw new IllegalArgumentException( "The tuple has a size of " + t.getSize() + ", the expected " + "array size is " + size + " (total: " + totalSize + ")"); } return new MutableTupleLongArrayND(t, size); }
java
public static MutableLongArrayND wrap( MutableLongTuple t, IntTuple size) { Objects.requireNonNull(t, "The tuple is null"); Objects.requireNonNull(size, "The size is null"); int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b); if (t.getSize() != totalSize) { throw new IllegalArgumentException( "The tuple has a size of " + t.getSize() + ", the expected " + "array size is " + size + " (total: " + totalSize + ")"); } return new MutableTupleLongArrayND(t, size); }
[ "public", "static", "MutableLongArrayND", "wrap", "(", "MutableLongTuple", "t", ",", "IntTuple", "size", ")", "{", "Objects", ".", "requireNonNull", "(", "t", ",", "\"The tuple is null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "size", ",", "\"The size...
Creates a <i>view</i> on the given tuple as a {@link LongArrayND}. Changes in the given tuple will be visible in the returned array, and vice versa. @param t The tuple @param size The size of the array @return The view on the tuple @throws NullPointerException If any argument is <code>null</code> @throws IllegalArgumentException If the {@link LongTuple#getSize() size} of the tuple does not match the given array size (that is, the product of all elements of the given tuple).
[ "Creates", "a", "<i", ">", "view<", "/", "i", ">", "on", "the", "given", "tuple", "as", "a", "{", "@link", "LongArrayND", "}", ".", "Changes", "in", "the", "given", "tuple", "will", "be", "visible", "in", "the", "returned", "array", "and", "vice", "v...
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-arrays/src/main/java/de/javagl/nd/arrays/j/LongArraysND.java#L141-L154
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java
BuildTasksInner.beginCreate
public BuildTaskInner beginCreate(String resourceGroupName, String registryName, String buildTaskName, BuildTaskInner buildTaskCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters).toBlocking().single().body(); }
java
public BuildTaskInner beginCreate(String resourceGroupName, String registryName, String buildTaskName, BuildTaskInner buildTaskCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, buildTaskCreateParameters).toBlocking().single().body(); }
[ "public", "BuildTaskInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ",", "BuildTaskInner", "buildTaskCreateParameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName...
Creates a build task for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param buildTaskCreateParameters The parameters for creating a build task. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the BuildTaskInner object if successful.
[ "Creates", "a", "build", "task", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java#L541-L543
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security.feature/src/com/ibm/ws/webcontainer/security/feature/internal/FeatureAuthorizationTable.java
FeatureAuthorizationTable.processConfigProps
private void processConfigProps(Map<String, Object> props) { if (props == null || props.isEmpty()) return; id = (String) props.get(CFG_KEY_ID); if (id == null) { Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL"); return; } rolePids = (String[]) props.get(CFG_KEY_ROLE); // if (rolePids == null || rolePids.length < 1) // return; processRolePids(); }
java
private void processConfigProps(Map<String, Object> props) { if (props == null || props.isEmpty()) return; id = (String) props.get(CFG_KEY_ID); if (id == null) { Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL"); return; } rolePids = (String[]) props.get(CFG_KEY_ROLE); // if (rolePids == null || rolePids.length < 1) // return; processRolePids(); }
[ "private", "void", "processConfigProps", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "props", "==", "null", "||", "props", ".", "isEmpty", "(", ")", ")", "return", ";", "id", "=", "(", "String", ")", "props", ".", "...
Process the sytemRole properties from the server.xml. @param props
[ "Process", "the", "sytemRole", "properties", "from", "the", "server", ".", "xml", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security.feature/src/com/ibm/ws/webcontainer/security/feature/internal/FeatureAuthorizationTable.java#L107-L119
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java
JsonFactory.fromReader
public final <T> T fromReader(Reader reader, Class<T> destinationClass) throws IOException { return createJsonParser(reader).parseAndClose(destinationClass); }
java
public final <T> T fromReader(Reader reader, Class<T> destinationClass) throws IOException { return createJsonParser(reader).parseAndClose(destinationClass); }
[ "public", "final", "<", "T", ">", "T", "fromReader", "(", "Reader", "reader", ",", "Class", "<", "T", ">", "destinationClass", ")", "throws", "IOException", "{", "return", "createJsonParser", "(", "reader", ")", ".", "parseAndClose", "(", "destinationClass", ...
Parse and close a reader as a JSON object, array, or value into a new instance of the given destination class using {@link JsonParser#parseAndClose(Class)}. @param reader JSON value in a reader @param destinationClass destination class that has an accessible default constructor to use to create a new instance @return new instance of the parsed destination class @since 1.7
[ "Parse", "and", "close", "a", "reader", "as", "a", "JSON", "object", "array", "or", "value", "into", "a", "new", "instance", "of", "the", "given", "destination", "class", "using", "{", "@link", "JsonParser#parseAndClose", "(", "Class", ")", "}", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java#L228-L230
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java
OpPredicate.classEquals
public static OpPredicate classEquals(final Class<?> c){ return new OpPredicate() { @Override public boolean matches(SameDiff sameDiff, DifferentialFunction function) { return function.getClass() == c; } }; }
java
public static OpPredicate classEquals(final Class<?> c){ return new OpPredicate() { @Override public boolean matches(SameDiff sameDiff, DifferentialFunction function) { return function.getClass() == c; } }; }
[ "public", "static", "OpPredicate", "classEquals", "(", "final", "Class", "<", "?", ">", "c", ")", "{", "return", "new", "OpPredicate", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "SameDiff", "sameDiff", ",", "DifferentialFunction", "...
Return true if the operation class is equal to the specified class
[ "Return", "true", "if", "the", "operation", "class", "is", "equal", "to", "the", "specified", "class" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java#L90-L97
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java
ZScreenField.addHiddenParam
public void addHiddenParam(PrintWriter out, String strParam, String strValue) { // Override this (if you don't want straight XML written) out.print("<param name=\"" + strParam + "\">"); if (strValue != null) out.print(strValue); out.println(Utility.endTag("param")); }
java
public void addHiddenParam(PrintWriter out, String strParam, String strValue) { // Override this (if you don't want straight XML written) out.print("<param name=\"" + strParam + "\">"); if (strValue != null) out.print(strValue); out.println(Utility.endTag("param")); }
[ "public", "void", "addHiddenParam", "(", "PrintWriter", "out", ",", "String", "strParam", ",", "String", "strValue", ")", "{", "// Override this (if you don't want straight XML written)", "out", ".", "print", "(", "\"<param name=\\\"\"", "+", "strParam", "+", "\"\\\">\"...
Add this hidden param to the output stream. @param out The html output stream. @param strParam The parameter. @param strValue The param's value.
[ "Add", "this", "hidden", "param", "to", "the", "output", "stream", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java#L346-L353
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java
Excel07SaxReader.read
public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException { InputStream sheetInputStream = null; try { final XSSFReader xssfReader = new XSSFReader(opcPackage); // 获取共享样式表 stylesTable = xssfReader.getStylesTable(); // 获取共享字符串表 this.sharedStringsTable = xssfReader.getSharedStringsTable(); if (sheetIndex > -1) { this.sheetIndex = sheetIndex; // 根据 rId# 或 rSheet# 查找sheet sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1)); parse(sheetInputStream); } else { this.sheetIndex = -1; // 遍历所有sheet final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData(); while (sheetInputStreams.hasNext()) { // 重新读取一个sheet时行归零 curRow = 0; this.sheetIndex++; sheetInputStream = sheetInputStreams.next(); parse(sheetInputStream); } } } catch (DependencyException e) { throw e; } catch (Exception e) { throw ExceptionUtil.wrap(e, POIException.class); } finally { IoUtil.close(sheetInputStream); } return this; }
java
public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException { InputStream sheetInputStream = null; try { final XSSFReader xssfReader = new XSSFReader(opcPackage); // 获取共享样式表 stylesTable = xssfReader.getStylesTable(); // 获取共享字符串表 this.sharedStringsTable = xssfReader.getSharedStringsTable(); if (sheetIndex > -1) { this.sheetIndex = sheetIndex; // 根据 rId# 或 rSheet# 查找sheet sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1)); parse(sheetInputStream); } else { this.sheetIndex = -1; // 遍历所有sheet final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData(); while (sheetInputStreams.hasNext()) { // 重新读取一个sheet时行归零 curRow = 0; this.sheetIndex++; sheetInputStream = sheetInputStreams.next(); parse(sheetInputStream); } } } catch (DependencyException e) { throw e; } catch (Exception e) { throw ExceptionUtil.wrap(e, POIException.class); } finally { IoUtil.close(sheetInputStream); } return this; }
[ "public", "Excel07SaxReader", "read", "(", "OPCPackage", "opcPackage", ",", "int", "sheetIndex", ")", "throws", "POIException", "{", "InputStream", "sheetInputStream", "=", "null", ";", "try", "{", "final", "XSSFReader", "xssfReader", "=", "new", "XSSFReader", "("...
开始读取Excel,Sheet编号从0开始计数 @param opcPackage {@link OPCPackage},Excel包 @param sheetIndex Excel中的sheet编号,如果为-1处理所有编号的sheet @return this @throws POIException POI异常
[ "开始读取Excel,Sheet编号从0开始计数" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java#L138-L173
alkacon/opencms-core
src/org/opencms/xml/content/CmsMappingResolutionContext.java
CmsMappingResolutionContext.addUrlNameMapping
void addUrlNameMapping(String name, Locale locale, CmsUUID structureId) { m_urlNameMappingEntries.add(new InternalUrlNameMappingEntry(structureId, name, locale)); }
java
void addUrlNameMapping(String name, Locale locale, CmsUUID structureId) { m_urlNameMappingEntries.add(new InternalUrlNameMappingEntry(structureId, name, locale)); }
[ "void", "addUrlNameMapping", "(", "String", "name", ",", "Locale", "locale", ",", "CmsUUID", "structureId", ")", "{", "m_urlNameMappingEntries", ".", "add", "(", "new", "InternalUrlNameMappingEntry", "(", "structureId", ",", "name", ",", "locale", ")", ")", ";",...
Adds an URL name mapping which should be written to the database later.<p> @param name the mapping name @param locale the locale @param structureId the structure ID
[ "Adds", "an", "URL", "name", "mapping", "which", "should", "be", "written", "to", "the", "database", "later", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsMappingResolutionContext.java#L201-L204
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.ovhAccount_ovhAccountId_GET
public OvhOvhAccount ovhAccount_ovhAccountId_GET(String ovhAccountId) throws IOException { String qPath = "/me/ovhAccount/{ovhAccountId}"; StringBuilder sb = path(qPath, ovhAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhAccount.class); }
java
public OvhOvhAccount ovhAccount_ovhAccountId_GET(String ovhAccountId) throws IOException { String qPath = "/me/ovhAccount/{ovhAccountId}"; StringBuilder sb = path(qPath, ovhAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhAccount.class); }
[ "public", "OvhOvhAccount", "ovhAccount_ovhAccountId_GET", "(", "String", "ovhAccountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/ovhAccount/{ovhAccountId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ovhAccountId", ")", ";...
Get this object properties REST: GET /me/ovhAccount/{ovhAccountId} @param ovhAccountId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3378-L3383
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.copyAccessControlEntries
public void copyAccessControlEntries(CmsRequestContext context, CmsResource source, CmsResource destination) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); checkPermissions(dbc, destination, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL); m_driverManager.copyAccessControlEntries(dbc, source, destination, true); } catch (Exception e) { CmsRequestContext rc = context; dbc.report( null, Messages.get().container( Messages.ERR_COPY_ACE_2, rc.removeSiteRoot(source.getRootPath()), rc.removeSiteRoot(destination.getRootPath())), e); } finally { dbc.clear(); } }
java
public void copyAccessControlEntries(CmsRequestContext context, CmsResource source, CmsResource destination) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, source, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); checkPermissions(dbc, destination, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL); m_driverManager.copyAccessControlEntries(dbc, source, destination, true); } catch (Exception e) { CmsRequestContext rc = context; dbc.report( null, Messages.get().container( Messages.ERR_COPY_ACE_2, rc.removeSiteRoot(source.getRootPath()), rc.removeSiteRoot(destination.getRootPath())), e); } finally { dbc.clear(); } }
[ "public", "void", "copyAccessControlEntries", "(", "CmsRequestContext", "context", ",", "CmsResource", "source", ",", "CmsResource", "destination", ")", "throws", "CmsException", ",", "CmsSecurityException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "g...
Copies the access control entries of a given resource to a destination resource.<p> Already existing access control entries of the destination resource are removed.<p> @param context the current request context @param source the resource to copy the access control entries from @param destination the resource to which the access control entries are copied @throws CmsException if something goes wrong @throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_CONTROL} required)
[ "Copies", "the", "access", "control", "entries", "of", "a", "given", "resource", "to", "a", "destination", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L723-L744
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.containsProperties
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final boolean containsProperties(BeanResolutionContext resolutionContext, BeanContext context) { return containsProperties(resolutionContext, context, null); }
java
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final boolean containsProperties(BeanResolutionContext resolutionContext, BeanContext context) { return containsProperties(resolutionContext, context, null); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "@", "Internal", "@", "UsedByGeneratedCode", "protected", "final", "boolean", "containsProperties", "(", "BeanResolutionContext", "resolutionContext", ",", "BeanContext", "context", ")", "{", "return", "containsProperties",...
If this bean is a {@link ConfigurationProperties} bean return whether any properties for it are configured within the context. @param resolutionContext the resolution context @param context The context @return True if it does
[ "If", "this", "bean", "is", "a", "{", "@link", "ConfigurationProperties", "}", "bean", "return", "whether", "any", "properties", "for", "it", "are", "configured", "within", "the", "context", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1270-L1275
javalite/activeweb
activeweb/src/main/java/org/javalite/activeweb/Router.java
Router.findControllerNamePart
protected static String findControllerNamePart(String pack, String uri) { String temp = uri.startsWith("/") ? uri.substring(1) : uri; temp = temp.replace("/", "."); if (temp.length() > pack.length()) temp = temp.substring(pack.length() + 1); if (temp.equals("") ) throw new ControllerException("You defined a controller package '" + pack + "', but did not specify controller name"); return temp.split("\\.")[0]; }
java
protected static String findControllerNamePart(String pack, String uri) { String temp = uri.startsWith("/") ? uri.substring(1) : uri; temp = temp.replace("/", "."); if (temp.length() > pack.length()) temp = temp.substring(pack.length() + 1); if (temp.equals("") ) throw new ControllerException("You defined a controller package '" + pack + "', but did not specify controller name"); return temp.split("\\.")[0]; }
[ "protected", "static", "String", "findControllerNamePart", "(", "String", "pack", ",", "String", "uri", ")", "{", "String", "temp", "=", "uri", ".", "startsWith", "(", "\"/\"", ")", "?", "uri", ".", "substring", "(", "1", ")", ":", "uri", ";", "temp", ...
Now that we know that this controller is under a package, need to find the controller short name. @param pack part of the package of the controller, taken from URI: value between "app.controllers" and controller name. @param uri uri from request @return controller name
[ "Now", "that", "we", "know", "that", "this", "controller", "is", "under", "a", "package", "need", "to", "find", "the", "controller", "short", "name", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/Router.java#L388-L398
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/DateUtils.java
DateUtils.parseDate
public static Date parseDate(String str, Locale locale, String... parsePatterns) throws ParseException { return parseDateWithLeniency(str, locale, parsePatterns, true); }
java
public static Date parseDate(String str, Locale locale, String... parsePatterns) throws ParseException { return parseDateWithLeniency(str, locale, parsePatterns, true); }
[ "public", "static", "Date", "parseDate", "(", "String", "str", ",", "Locale", "locale", ",", "String", "...", "parsePatterns", ")", "throws", "ParseException", "{", "return", "parseDateWithLeniency", "(", "str", ",", "locale", ",", "parsePatterns", ",", "true", ...
<p>Parses a string representing a date by trying a variety of different parsers, using the default date format symbols for the given locale.</p> <p/> <p>The parse will try each parse pattern in turn. A parse is only deemed successful if it parses the whole of the input string. If no parse patterns match, a ParseException is thrown.</p> The parser will be lenient toward the parsed date. @param str the date to parse, not null @param locale the locale whose date format symbols should be used. If <code>null</code>, the system locale is used (as per {@link #parseDate(String, String...)}). @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null @return the parsed date @throws IllegalArgumentException if the date string or pattern array is null @throws ParseException if none of the date patterns were suitable (or there were none) @since 3.2
[ "<p", ">", "Parses", "a", "string", "representing", "a", "date", "by", "trying", "a", "variety", "of", "different", "parsers", "using", "the", "default", "date", "format", "symbols", "for", "the", "given", "locale", ".", "<", "/", "p", ">", "<p", "/", ...
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DateUtils.java#L73-L75
alkacon/opencms-core
src/org/opencms/ade/containerpage/inherited/CmsInheritedContainerState.java
CmsInheritedContainerState.computeVisibility
void computeVisibility(List<Boolean> visibilities, CmsInheritanceInfo info) { boolean visible = true; boolean inherited = true; boolean parentVisible = true; for (Boolean visibility : visibilities) { parentVisible = visible; if (visibility == Boolean.TRUE) { visible = true; inherited = false; } else if (visibility == Boolean.FALSE) { visible = false; inherited = false; } else { inherited = true; } } info.setVisible(visible); info.setVisibilityInherited(inherited); info.setParentVisible(parentVisible); }
java
void computeVisibility(List<Boolean> visibilities, CmsInheritanceInfo info) { boolean visible = true; boolean inherited = true; boolean parentVisible = true; for (Boolean visibility : visibilities) { parentVisible = visible; if (visibility == Boolean.TRUE) { visible = true; inherited = false; } else if (visibility == Boolean.FALSE) { visible = false; inherited = false; } else { inherited = true; } } info.setVisible(visible); info.setVisibilityInherited(inherited); info.setParentVisible(parentVisible); }
[ "void", "computeVisibility", "(", "List", "<", "Boolean", ">", "visibilities", ",", "CmsInheritanceInfo", "info", ")", "{", "boolean", "visible", "=", "true", ";", "boolean", "inherited", "=", "true", ";", "boolean", "parentVisible", "=", "true", ";", "for", ...
Computes the visibility for an element.<p> @param visibilities the visibilities for the element in the sequence of parent configurations.<p> @param info the object in which the visibility should be stored
[ "Computes", "the", "visibility", "for", "an", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/inherited/CmsInheritedContainerState.java#L262-L282
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/juel/TreeValueExpression.java
TreeValueExpression.setValue
@Override public void setValue(ELContext context, Object value) throws ELException { node.setValue(bindings, context, value); }
java
@Override public void setValue(ELContext context, Object value) throws ELException { node.setValue(bindings, context, value); }
[ "@", "Override", "public", "void", "setValue", "(", "ELContext", "context", ",", "Object", "value", ")", "throws", "ELException", "{", "node", ".", "setValue", "(", "bindings", ",", "context", ",", "value", ")", ";", "}" ]
Evaluates the expression as an lvalue and assigns the given value. @param context used to resolve properties (<code>base.property</code> and <code>base[property]</code>) and to perform the assignment to the last base/property pair @throws ELException if evaluation fails (e.g. property not found, type conversion failed, assignment failed...)
[ "Evaluates", "the", "expression", "as", "an", "lvalue", "and", "assigns", "the", "given", "value", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/juel/TreeValueExpression.java#L136-L139
azkaban/azkaban
azkaban-common/src/main/java/azkaban/server/HttpRequestUtils.java
HttpRequestUtils.filterAdminOnlyFlowParams
public static void filterAdminOnlyFlowParams(final UserManager userManager, final ExecutionOptions options, final User user) throws ExecutorManagerException { if (options == null || options.getFlowParameters() == null) { return; } final Map<String, String> params = options.getFlowParameters(); // is azkaban Admin if (!hasPermission(userManager, user, Type.ADMIN)) { params.remove(ExecutionOptions.FLOW_PRIORITY); params.remove(ExecutionOptions.USE_EXECUTOR); } else { validateIntegerParam(params, ExecutionOptions.FLOW_PRIORITY); validateIntegerParam(params, ExecutionOptions.USE_EXECUTOR); } }
java
public static void filterAdminOnlyFlowParams(final UserManager userManager, final ExecutionOptions options, final User user) throws ExecutorManagerException { if (options == null || options.getFlowParameters() == null) { return; } final Map<String, String> params = options.getFlowParameters(); // is azkaban Admin if (!hasPermission(userManager, user, Type.ADMIN)) { params.remove(ExecutionOptions.FLOW_PRIORITY); params.remove(ExecutionOptions.USE_EXECUTOR); } else { validateIntegerParam(params, ExecutionOptions.FLOW_PRIORITY); validateIntegerParam(params, ExecutionOptions.USE_EXECUTOR); } }
[ "public", "static", "void", "filterAdminOnlyFlowParams", "(", "final", "UserManager", "userManager", ",", "final", "ExecutionOptions", "options", ",", "final", "User", "user", ")", "throws", "ExecutorManagerException", "{", "if", "(", "options", "==", "null", "||", ...
<pre> Remove following flow param if submitting user is not an Azkaban admin FLOW_PRIORITY USE_EXECUTOR @param userManager @param options @param user </pre>
[ "<pre", ">", "Remove", "following", "flow", "param", "if", "submitting", "user", "is", "not", "an", "Azkaban", "admin", "FLOW_PRIORITY", "USE_EXECUTOR" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/server/HttpRequestUtils.java#L131-L146
btaz/data-util
src/main/java/com/btaz/util/collections/Sets.java
Sets.symmetricDifference
public static <T> Set<T> symmetricDifference(Set<T> setA, Set<T> setB) { Set<T> union = union(setA, setB); Set<T> intersection = intersection(setA, setB); return difference(union, intersection); }
java
public static <T> Set<T> symmetricDifference(Set<T> setA, Set<T> setB) { Set<T> union = union(setA, setB); Set<T> intersection = intersection(setA, setB); return difference(union, intersection); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "symmetricDifference", "(", "Set", "<", "T", ">", "setA", ",", "Set", "<", "T", ">", "setB", ")", "{", "Set", "<", "T", ">", "union", "=", "union", "(", "setA", ",", "setB", ")", ";", "...
This method finds the symmetric difference between set A and set B i.e. which items does not exist in either set A or set B. This is the opposite of the intersect of set A and set B. @param setA set A @param setB set B @param <T> type @return a new set containing the symmetric difference
[ "This", "method", "finds", "the", "symmetric", "difference", "between", "set", "A", "and", "set", "B", "i", ".", "e", ".", "which", "items", "does", "not", "exist", "in", "either", "set", "A", "or", "set", "B", ".", "This", "is", "the", "opposite", "...
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L81-L85
TheHortonMachine/hortonmachine
gui/src/main/java/org/hortonmachine/gui/spatialtoolbox/core/ModuleDescription.java
ModuleDescription.addInput
public void addInput( String fieldName, String type, String description, String defaultValue, String uiHint ) { if (fieldName == null) { throw new IllegalArgumentException("field name is mandatory"); } if (type == null) { throw new IllegalArgumentException("field type is mandatory"); } if (description == null) { description = "No description available"; } FieldData fieldData = new FieldData(); fieldData.isIn = true; fieldData.fieldName = fieldName; fieldData.fieldType = type; fieldData.fieldDescription = description; fieldData.fieldValue = defaultValue; fieldData.guiHints = uiHint; if (!inputsList.contains(fieldData)) { inputsList.add(fieldData); } else { throw new IllegalArgumentException("Duplicated field: " + fieldName); } }
java
public void addInput( String fieldName, String type, String description, String defaultValue, String uiHint ) { if (fieldName == null) { throw new IllegalArgumentException("field name is mandatory"); } if (type == null) { throw new IllegalArgumentException("field type is mandatory"); } if (description == null) { description = "No description available"; } FieldData fieldData = new FieldData(); fieldData.isIn = true; fieldData.fieldName = fieldName; fieldData.fieldType = type; fieldData.fieldDescription = description; fieldData.fieldValue = defaultValue; fieldData.guiHints = uiHint; if (!inputsList.contains(fieldData)) { inputsList.add(fieldData); } else { throw new IllegalArgumentException("Duplicated field: " + fieldName); } }
[ "public", "void", "addInput", "(", "String", "fieldName", ",", "String", "type", ",", "String", "description", ",", "String", "defaultValue", ",", "String", "uiHint", ")", "{", "if", "(", "fieldName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentE...
Adds an input field to the module. @param fieldName the name of the field (accessed through reflection). @param type the chanonical name of the class of the field. @param description a description of the field. @param defaultValue a default value or <code>null</code>. @param uiHint
[ "Adds", "an", "input", "field", "to", "the", "module", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/spatialtoolbox/core/ModuleDescription.java#L118-L142
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java
DefaultDatastoreReader.loadByKey
public <E> List<E> loadByKey(Class<E> entityClass, List<DatastoreKey> keys) { Key[] nativeKeys = DatastoreUtils.toNativeKeys(keys); return fetch(entityClass, nativeKeys); }
java
public <E> List<E> loadByKey(Class<E> entityClass, List<DatastoreKey> keys) { Key[] nativeKeys = DatastoreUtils.toNativeKeys(keys); return fetch(entityClass, nativeKeys); }
[ "public", "<", "E", ">", "List", "<", "E", ">", "loadByKey", "(", "Class", "<", "E", ">", "entityClass", ",", "List", "<", "DatastoreKey", ">", "keys", ")", "{", "Key", "[", "]", "nativeKeys", "=", "DatastoreUtils", ".", "toNativeKeys", "(", "keys", ...
Retrieves and returns the entities for the given keys. @param entityClass the expected result type @param keys the entity keys @return the entities for the given keys. If one or more requested keys do not exist in the Cloud Datastore, the corresponding item in the returned list be <code>null</code>. @throws EntityManagerException if any error occurs while accessing the Datastore.
[ "Retrieves", "and", "returns", "the", "entities", "for", "the", "given", "keys", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L246-L249
oasp/oasp4j
modules/json/src/main/java/io/oasp/module/json/common/base/ObjectMapperFactory.java
ObjectMapperFactory.getExtensionModule
public SimpleModule getExtensionModule() { if (this.extensionModule == null) { this.extensionModule = new SimpleModule("oasp.ExtensionModule", new Version(1, 0, 0, null, GROUP_ID, ARTIFACT_ID)); } return this.extensionModule; }
java
public SimpleModule getExtensionModule() { if (this.extensionModule == null) { this.extensionModule = new SimpleModule("oasp.ExtensionModule", new Version(1, 0, 0, null, GROUP_ID, ARTIFACT_ID)); } return this.extensionModule; }
[ "public", "SimpleModule", "getExtensionModule", "(", ")", "{", "if", "(", "this", ".", "extensionModule", "==", "null", ")", "{", "this", ".", "extensionModule", "=", "new", "SimpleModule", "(", "\"oasp.ExtensionModule\"", ",", "new", "Version", "(", "1", ",",...
Gets access to a generic extension {@link SimpleModule module} for customizations to Jackson JSON mapping. @see SimpleModule#addSerializer(Class, com.fasterxml.jackson.databind.JsonSerializer) @see SimpleModule#addDeserializer(Class, com.fasterxml.jackson.databind.JsonDeserializer) @return extensionModule
[ "Gets", "access", "to", "a", "generic", "extension", "{", "@link", "SimpleModule", "module", "}", "for", "customizations", "to", "Jackson", "JSON", "mapping", "." ]
train
https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/json/src/main/java/io/oasp/module/json/common/base/ObjectMapperFactory.java#L50-L57
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_traffic_duration_POST
public OvhOrder dedicated_server_serviceName_traffic_duration_POST(String serviceName, String duration, OvhTrafficOrderEnum traffic) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/traffic/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "traffic", traffic); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder dedicated_server_serviceName_traffic_duration_POST(String serviceName, String duration, OvhTrafficOrderEnum traffic) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/traffic/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "traffic", traffic); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "dedicated_server_serviceName_traffic_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhTrafficOrderEnum", "traffic", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/traffi...
Create order REST: POST /order/dedicated/server/{serviceName}/traffic/{duration} @param traffic [required] amount of traffic to allocate @param serviceName [required] The internal name of your dedicated server @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2273-L2280
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java
TimeFinder.addTrackPositionListener
public void addTrackPositionListener(int player, TrackPositionListener listener) { listenerPlayerNumbers.put(listener, player); TrackPositionUpdate currentPosition = positions.get(player); if (currentPosition != null) { listener.movementChanged(currentPosition); trackPositionListeners.put(listener, currentPosition); } else { trackPositionListeners.put(listener, NO_INFORMATION); } }
java
public void addTrackPositionListener(int player, TrackPositionListener listener) { listenerPlayerNumbers.put(listener, player); TrackPositionUpdate currentPosition = positions.get(player); if (currentPosition != null) { listener.movementChanged(currentPosition); trackPositionListeners.put(listener, currentPosition); } else { trackPositionListeners.put(listener, NO_INFORMATION); } }
[ "public", "void", "addTrackPositionListener", "(", "int", "player", ",", "TrackPositionListener", "listener", ")", "{", "listenerPlayerNumbers", ".", "put", "(", "listener", ",", "player", ")", ";", "TrackPositionUpdate", "currentPosition", "=", "positions", ".", "g...
Add a listener that wants to closely follow track playback for a particular player. The listener will be called as soon as there is an initial {@link TrackPositionUpdate} for the specified player, and whenever there is an unexpected change in playback position, speed, or state on that player. @param player the player number that the listener is interested in @param listener the interface that will be called when there are changes in track playback on the player
[ "Add", "a", "listener", "that", "wants", "to", "closely", "follow", "track", "playback", "for", "a", "particular", "player", ".", "The", "listener", "will", "be", "called", "as", "soon", "as", "there", "is", "an", "initial", "{", "@link", "TrackPositionUpdat...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L302-L311
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java
WSKeyStore.openKeyStore
public static InputStream openKeyStore(String fileName) throws MalformedURLException, IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "openKeyStore: " + fileName); URL urlFile = null; // Check if the filename exists as a File. File kfile = new File(fileName); if (kfile.exists() && kfile.length() == 0) { throw new IOException("Keystore file exists, but is empty: " + fileName); } else if (!kfile.exists()) { urlFile = new URL(fileName); } else { // kfile exists urlFile = new URL("file:" + kfile.getCanonicalPath()); } // Finally open the file. InputStream fis = urlFile.openStream(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "openKeyStore: " + (null != fis)); return fis; }
java
public static InputStream openKeyStore(String fileName) throws MalformedURLException, IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "openKeyStore: " + fileName); URL urlFile = null; // Check if the filename exists as a File. File kfile = new File(fileName); if (kfile.exists() && kfile.length() == 0) { throw new IOException("Keystore file exists, but is empty: " + fileName); } else if (!kfile.exists()) { urlFile = new URL(fileName); } else { // kfile exists urlFile = new URL("file:" + kfile.getCanonicalPath()); } // Finally open the file. InputStream fis = urlFile.openStream(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "openKeyStore: " + (null != fis)); return fis; }
[ "public", "static", "InputStream", "openKeyStore", "(", "String", "fileName", ")", "throws", "MalformedURLException", ",", "IOException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "T...
The purpose of this method is to open the passed in file which represents the key store. @param fileName @return InputStream @throws MalformedURLException @throws IOException
[ "The", "purpose", "of", "this", "method", "is", "to", "open", "the", "passed", "in", "file", "which", "represents", "the", "key", "store", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java#L1126-L1150
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/html/HTMLUtils.java
HTMLUtils.stripFirstElementInside
public static void stripFirstElementInside(Document document, String parentTagName, String elementTagName) { NodeList parentNodes = document.getElementsByTagName(parentTagName); if (parentNodes.getLength() > 0) { Node parentNode = parentNodes.item(0); // Look for a p element below the first parent element Node pNode = parentNode.getFirstChild(); if (elementTagName.equalsIgnoreCase(pNode.getNodeName())) { // Move all children of p node under the root element NodeList pChildrenNodes = pNode.getChildNodes(); while (pChildrenNodes.getLength() > 0) { parentNode.insertBefore(pChildrenNodes.item(0), null); } parentNode.removeChild(pNode); } } }
java
public static void stripFirstElementInside(Document document, String parentTagName, String elementTagName) { NodeList parentNodes = document.getElementsByTagName(parentTagName); if (parentNodes.getLength() > 0) { Node parentNode = parentNodes.item(0); // Look for a p element below the first parent element Node pNode = parentNode.getFirstChild(); if (elementTagName.equalsIgnoreCase(pNode.getNodeName())) { // Move all children of p node under the root element NodeList pChildrenNodes = pNode.getChildNodes(); while (pChildrenNodes.getLength() > 0) { parentNode.insertBefore(pChildrenNodes.item(0), null); } parentNode.removeChild(pNode); } } }
[ "public", "static", "void", "stripFirstElementInside", "(", "Document", "document", ",", "String", "parentTagName", ",", "String", "elementTagName", ")", "{", "NodeList", "parentNodes", "=", "document", ".", "getElementsByTagName", "(", "parentTagName", ")", ";", "i...
Remove the first element inside a parent element and copy the element's children in the parent. @param document the w3c document from which to remove the top level paragraph @param parentTagName the name of the parent tag to look under @param elementTagName the name of the first element to remove
[ "Remove", "the", "first", "element", "inside", "a", "parent", "element", "and", "copy", "the", "element", "s", "children", "in", "the", "parent", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/html/HTMLUtils.java#L308-L324
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/Node.java
Node.getParentNode
@Override public Node getParentNode(String parentNodeId) { NodeLink link = new NodeLink(parentNodeId, getNodeId()); if (this.parents == null) { return null; } else { return this.parents.get(link); } }
java
@Override public Node getParentNode(String parentNodeId) { NodeLink link = new NodeLink(parentNodeId, getNodeId()); if (this.parents == null) { return null; } else { return this.parents.get(link); } }
[ "@", "Override", "public", "Node", "getParentNode", "(", "String", "parentNodeId", ")", "{", "NodeLink", "link", "=", "new", "NodeLink", "(", "parentNodeId", ",", "getNodeId", "(", ")", ")", ";", "if", "(", "this", ".", "parents", "==", "null", ")", "{",...
Retrieves parent node of this node for a given parent node ID
[ "Retrieves", "parent", "node", "of", "this", "node", "for", "a", "given", "parent", "node", "ID" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/Node.java#L281-L294
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/CertifyingSigner.java
CertifyingSigner.getInstance
public static CertifyingSigner getInstance(boolean forSigning, CertifiedKeyPair certifier, SignerFactory factory) { return new CertifyingSigner(certifier.getCertificate(), factory.getInstance(forSigning, certifier.getPrivateKey())); }
java
public static CertifyingSigner getInstance(boolean forSigning, CertifiedKeyPair certifier, SignerFactory factory) { return new CertifyingSigner(certifier.getCertificate(), factory.getInstance(forSigning, certifier.getPrivateKey())); }
[ "public", "static", "CertifyingSigner", "getInstance", "(", "boolean", "forSigning", ",", "CertifiedKeyPair", "certifier", ",", "SignerFactory", "factory", ")", "{", "return", "new", "CertifyingSigner", "(", "certifier", ".", "getCertificate", "(", ")", ",", "factor...
Get a certifying signer instance from the given signer factory for a given certifier. @param forSigning true for signing, and false for verifying. @param certifier the certified key pair of the certifier. @param factory a signer factory to create the signer. @return a certifying signer.
[ "Get", "a", "certifying", "signer", "instance", "from", "the", "given", "signer", "factory", "for", "a", "given", "certifier", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/CertifyingSigner.java#L67-L71
hankcs/HanLP
src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java
Trie.getState
private static State getState(State currentState, Character character) { State newCurrentState = currentState.nextState(character); // 先按success跳转 while (newCurrentState == null) // 跳转失败的话,按failure跳转 { currentState = currentState.failure(); newCurrentState = currentState.nextState(character); } return newCurrentState; }
java
private static State getState(State currentState, Character character) { State newCurrentState = currentState.nextState(character); // 先按success跳转 while (newCurrentState == null) // 跳转失败的话,按failure跳转 { currentState = currentState.failure(); newCurrentState = currentState.nextState(character); } return newCurrentState; }
[ "private", "static", "State", "getState", "(", "State", "currentState", ",", "Character", "character", ")", "{", "State", "newCurrentState", "=", "currentState", ".", "nextState", "(", "character", ")", ";", "// 先按success跳转", "while", "(", "newCurrentState", "==",...
跳转到下一个状态 @param currentState 当前状态 @param character 接受字符 @return 跳转结果
[ "跳转到下一个状态" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java#L208-L217
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java
Jsr250Utils.preDestroyQuietly
public static void preDestroyQuietly(Object obj, Logger log) { try { preDestroy(obj, log); } catch( Throwable t ) { log.warn("Could not @PreDestroy object", t); } }
java
public static void preDestroyQuietly(Object obj, Logger log) { try { preDestroy(obj, log); } catch( Throwable t ) { log.warn("Could not @PreDestroy object", t); } }
[ "public", "static", "void", "preDestroyQuietly", "(", "Object", "obj", ",", "Logger", "log", ")", "{", "try", "{", "preDestroy", "(", "obj", ",", "log", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "log", ".", "warn", "(", "\"Could not @Pre...
Calls preDestroy with the same arguments, logging any exceptions that are thrown at the level warn.
[ "Calls", "preDestroy", "with", "the", "same", "arguments", "logging", "any", "exceptions", "that", "are", "thrown", "at", "the", "level", "warn", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L96-L103
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/BeanUtil.java
BeanUtil.getSetterMethod
public static Method getSetterMethod(Class<?> beanClass, String property, Class propertyType){ try{ return beanClass.getMethod(SET+getMethodSuffix(property), propertyType); } catch(NoSuchMethodException ex){ return null; } }
java
public static Method getSetterMethod(Class<?> beanClass, String property, Class propertyType){ try{ return beanClass.getMethod(SET+getMethodSuffix(property), propertyType); } catch(NoSuchMethodException ex){ return null; } }
[ "public", "static", "Method", "getSetterMethod", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "property", ",", "Class", "propertyType", ")", "{", "try", "{", "return", "beanClass", ".", "getMethod", "(", "SET", "+", "getMethodSuffix", "(", "prope...
Returns setter method for <code>property</code> in specified <code>beanClass</code> @param beanClass bean class @param property name of the property @param propertyType type of the property. This is used to compute setter method name. @return setter method. null if <code>property</code> is not found, or it is readonly property @see #getSetterMethod(Class, String)
[ "Returns", "setter", "method", "for", "<code", ">", "property<", "/", "code", ">", "in", "specified", "<code", ">", "beanClass<", "/", "code", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/BeanUtil.java#L168-L174
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java
PrivateDataManager.getPrivateData
public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Create an IQ packet to get the private data. IQ privateDataGet = new PrivateDataIQ(elementName, namespace); PrivateDataIQ response = connection().createStanzaCollectorAndSend( privateDataGet).nextResultOrThrow(); return response.getPrivateData(); }
java
public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Create an IQ packet to get the private data. IQ privateDataGet = new PrivateDataIQ(elementName, namespace); PrivateDataIQ response = connection().createStanzaCollectorAndSend( privateDataGet).nextResultOrThrow(); return response.getPrivateData(); }
[ "public", "PrivateData", "getPrivateData", "(", "final", "String", "elementName", ",", "final", "String", "namespace", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "// Create an IQ packet to...
Returns the private data specified by the given element name and namespace. Each chunk of private data is uniquely identified by an element name and namespace pair.<p> If a PrivateDataProvider is registered for the specified element name/namespace pair then that provider will determine the specific object type that is returned. If no provider is registered, a {@link DefaultPrivateData} instance will be returned. @param elementName the element name. @param namespace the namespace. @return the private data. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Returns", "the", "private", "data", "specified", "by", "the", "given", "element", "name", "and", "namespace", ".", "Each", "chunk", "of", "private", "data", "is", "uniquely", "identified", "by", "an", "element", "name", "and", "namespace", "pair", ".", "<p"...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java#L161-L168
knowm/XChange
xchange-coingi/src/main/java/org/knowm/xchange/coingi/CoingiAdapters.java
CoingiAdapters.adaptTrade
public static Trade adaptTrade( CoingiUserTransaction tx, CurrencyPair currencyPair, int timeScale) { OrderType orderType = tx.getType() == 0 ? OrderType.BID : OrderType.ASK; final String tradeId = tx.getId(); Date date = DateUtils.fromMillisUtc( tx.getTimestamp() * timeScale); // polled order books provide a timestamp in seconds, stream in ms return new Trade(orderType, tx.getBaseAmount(), currencyPair, tx.getPrice(), date, tradeId); }
java
public static Trade adaptTrade( CoingiUserTransaction tx, CurrencyPair currencyPair, int timeScale) { OrderType orderType = tx.getType() == 0 ? OrderType.BID : OrderType.ASK; final String tradeId = tx.getId(); Date date = DateUtils.fromMillisUtc( tx.getTimestamp() * timeScale); // polled order books provide a timestamp in seconds, stream in ms return new Trade(orderType, tx.getBaseAmount(), currencyPair, tx.getPrice(), date, tradeId); }
[ "public", "static", "Trade", "adaptTrade", "(", "CoingiUserTransaction", "tx", ",", "CurrencyPair", "currencyPair", ",", "int", "timeScale", ")", "{", "OrderType", "orderType", "=", "tx", ".", "getType", "(", ")", "==", "0", "?", "OrderType", ".", "BID", ":"...
Adapts a Transaction to a Trade Object @param tx The Coingi transaction @param currencyPair (e.g. BTC/USD) @param timeScale polled order books provide a timestamp in seconds, stream in ms @return The XChange Trade
[ "Adapts", "a", "Transaction", "to", "a", "Trade", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coingi/src/main/java/org/knowm/xchange/coingi/CoingiAdapters.java#L160-L170
Cleveroad/LoopBar
LoopBar-widget/src/main/java/com/cleveroad/loopbar/widget/LoopBarView.java
LoopBarView.selectItem
@SuppressWarnings("unused") public void selectItem(int position, boolean invokeListeners) { IOperationItem item = mOuterAdapter.getItem(position); IOperationItem oldHidedItem = mOuterAdapter.getItem(mRealHidedPosition); int realPosition = mOuterAdapter.normalizePosition(position); //do nothing if position not changed if (realPosition == mCurrentItemPosition) { return; } int itemToShowAdapterPosition = position - realPosition + mRealHidedPosition; item.setVisible(false); startSelectedViewOutAnimation(position); mOuterAdapter.notifyRealItemChanged(position); mRealHidedPosition = realPosition; oldHidedItem.setVisible(true); mFlContainerSelected.requestLayout(); mOuterAdapter.notifyRealItemChanged(itemToShowAdapterPosition); mCurrentItemPosition = realPosition; if (invokeListeners) { notifyItemClickListeners(realPosition); } if (BuildConfig.DEBUG) { Log.i(TAG, "clicked on position =" + position); } }
java
@SuppressWarnings("unused") public void selectItem(int position, boolean invokeListeners) { IOperationItem item = mOuterAdapter.getItem(position); IOperationItem oldHidedItem = mOuterAdapter.getItem(mRealHidedPosition); int realPosition = mOuterAdapter.normalizePosition(position); //do nothing if position not changed if (realPosition == mCurrentItemPosition) { return; } int itemToShowAdapterPosition = position - realPosition + mRealHidedPosition; item.setVisible(false); startSelectedViewOutAnimation(position); mOuterAdapter.notifyRealItemChanged(position); mRealHidedPosition = realPosition; oldHidedItem.setVisible(true); mFlContainerSelected.requestLayout(); mOuterAdapter.notifyRealItemChanged(itemToShowAdapterPosition); mCurrentItemPosition = realPosition; if (invokeListeners) { notifyItemClickListeners(realPosition); } if (BuildConfig.DEBUG) { Log.i(TAG, "clicked on position =" + position); } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "void", "selectItem", "(", "int", "position", ",", "boolean", "invokeListeners", ")", "{", "IOperationItem", "item", "=", "mOuterAdapter", ".", "getItem", "(", "position", ")", ";", "IOperationItem", "ol...
Select item by it's position @param position int value of item position to select @param invokeListeners boolean value for invoking listeners
[ "Select", "item", "by", "it", "s", "position" ]
train
https://github.com/Cleveroad/LoopBar/blob/6ff5e0b35e637202202f9b4ca141195bdcfd5697/LoopBar-widget/src/main/java/com/cleveroad/loopbar/widget/LoopBarView.java#L778-L810
orbisgis/h2gis
h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java
SFSUtilities.getTableEnvelope
public static Envelope getTableEnvelope(Connection connection, TableLocation location, String geometryField) throws SQLException { if(geometryField==null || geometryField.isEmpty()) { List<String> geometryFields = getGeometryFields(connection, location); if(geometryFields.isEmpty()) { throw new SQLException("The table "+location+" does not contain a Geometry field, then the extent " + "cannot be computed"); } geometryField = geometryFields.get(0); } ResultSet rs = connection.createStatement().executeQuery("SELECT ST_Extent("+ TableLocation.quoteIdentifier(geometryField)+") ext FROM "+location); if(rs.next()) { // Todo under postgis it is a BOX type return ((Geometry)rs.getObject(1)).getEnvelopeInternal(); } throw new SQLException("Unable to get the table extent it may be empty"); }
java
public static Envelope getTableEnvelope(Connection connection, TableLocation location, String geometryField) throws SQLException { if(geometryField==null || geometryField.isEmpty()) { List<String> geometryFields = getGeometryFields(connection, location); if(geometryFields.isEmpty()) { throw new SQLException("The table "+location+" does not contain a Geometry field, then the extent " + "cannot be computed"); } geometryField = geometryFields.get(0); } ResultSet rs = connection.createStatement().executeQuery("SELECT ST_Extent("+ TableLocation.quoteIdentifier(geometryField)+") ext FROM "+location); if(rs.next()) { // Todo under postgis it is a BOX type return ((Geometry)rs.getObject(1)).getEnvelopeInternal(); } throw new SQLException("Unable to get the table extent it may be empty"); }
[ "public", "static", "Envelope", "getTableEnvelope", "(", "Connection", "connection", ",", "TableLocation", "location", ",", "String", "geometryField", ")", "throws", "SQLException", "{", "if", "(", "geometryField", "==", "null", "||", "geometryField", ".", "isEmpty"...
Merge the bounding box of all geometries inside the provided table. @param connection Active connection (not closed by this function) @param location Location of the table @param geometryField Geometry field or empty string (take the first geometry field) @return Envelope of the table @throws SQLException If the table not exists, empty or does not contain a geometry field.
[ "Merge", "the", "bounding", "box", "of", "all", "geometries", "inside", "the", "provided", "table", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L212-L229
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java
OutputsInner.listByStreamingJobAsync
public Observable<Page<OutputInner>> listByStreamingJobAsync(final String resourceGroupName, final String jobName) { return listByStreamingJobWithServiceResponseAsync(resourceGroupName, jobName) .map(new Func1<ServiceResponse<Page<OutputInner>>, Page<OutputInner>>() { @Override public Page<OutputInner> call(ServiceResponse<Page<OutputInner>> response) { return response.body(); } }); }
java
public Observable<Page<OutputInner>> listByStreamingJobAsync(final String resourceGroupName, final String jobName) { return listByStreamingJobWithServiceResponseAsync(resourceGroupName, jobName) .map(new Func1<ServiceResponse<Page<OutputInner>>, Page<OutputInner>>() { @Override public Page<OutputInner> call(ServiceResponse<Page<OutputInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "OutputInner", ">", ">", "listByStreamingJobAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "jobName", ")", "{", "return", "listByStreamingJobWithServiceResponseAsync", "(", "resourceGroupName", ",",...
Lists all of the outputs under the specified streaming job. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;OutputInner&gt; object
[ "Lists", "all", "of", "the", "outputs", "under", "the", "specified", "streaming", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java#L745-L753
kite-sdk/kite
kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/HBaseUtils.java
HBaseUtils.mergePuts
public static Put mergePuts(byte[] keyBytes, List<Put> putList) { Put put = new Put(keyBytes); for (Put putToMerge : putList) { Map<byte[], List<KeyValue>> familyMap = (Map<byte[], List<KeyValue>>) GET_FAMILY_MAP_METHOD.invoke(putToMerge); for (List<KeyValue> keyValueList : familyMap.values()) { for (KeyValue keyValue : keyValueList) { // don't use put.add(KeyValue) since it doesn't work with HBase 0.96 onwards put.add(keyValue.getFamily(), keyValue.getQualifier(), keyValue.getTimestamp(), keyValue.getValue()); } } } return put; }
java
public static Put mergePuts(byte[] keyBytes, List<Put> putList) { Put put = new Put(keyBytes); for (Put putToMerge : putList) { Map<byte[], List<KeyValue>> familyMap = (Map<byte[], List<KeyValue>>) GET_FAMILY_MAP_METHOD.invoke(putToMerge); for (List<KeyValue> keyValueList : familyMap.values()) { for (KeyValue keyValue : keyValueList) { // don't use put.add(KeyValue) since it doesn't work with HBase 0.96 onwards put.add(keyValue.getFamily(), keyValue.getQualifier(), keyValue.getTimestamp(), keyValue.getValue()); } } } return put; }
[ "public", "static", "Put", "mergePuts", "(", "byte", "[", "]", "keyBytes", ",", "List", "<", "Put", ">", "putList", ")", "{", "Put", "put", "=", "new", "Put", "(", "keyBytes", ")", ";", "for", "(", "Put", "putToMerge", ":", "putList", ")", "{", "Ma...
Given a list of puts, create a new put with the values in each put merged together. It is expected that no puts have a value for the same fully qualified column. Return the new put. @param key The key of the new put. @param putList The list of puts to merge @return the new Put instance
[ "Given", "a", "list", "of", "puts", "create", "a", "new", "put", "with", "the", "values", "in", "each", "put", "merged", "together", ".", "It", "is", "expected", "that", "no", "puts", "have", "a", "value", "for", "the", "same", "fully", "qualified", "c...
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/HBaseUtils.java#L65-L80
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.createAnchor
public Anchor createAnchor(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException { return initTextElementArray(styleHelper.style(new Anchor(Float.NaN), data, stylers), data, stylers); }
java
public Anchor createAnchor(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException { return initTextElementArray(styleHelper.style(new Anchor(Float.NaN), data, stylers), data, stylers); }
[ "public", "Anchor", "createAnchor", "(", "Object", "data", ",", "Collection", "<", "?", "extends", "BaseStyler", ">", "stylers", ")", "throws", "VectorPrintException", "{", "return", "initTextElementArray", "(", "styleHelper", ".", "style", "(", "new", "Anchor", ...
Create a Anchor, style it and add the data @param data @param stylers @return @throws VectorPrintException
[ "Create", "a", "Anchor", "style", "it", "and", "add", "the", "data" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L237-L239
d-sauer/JCalcAPI
src/main/java/org/jdice/calc/Properties.java
Properties.getInheritedScale
public static int getInheritedScale(AbstractCalculator calc, Num value) { if (value.getScale() == null) { if (calc != null && calc.getScale() != null) return calc.getScale(); else return Properties.DEFAULT_SCALE; } else return value.getScale(); }
java
public static int getInheritedScale(AbstractCalculator calc, Num value) { if (value.getScale() == null) { if (calc != null && calc.getScale() != null) return calc.getScale(); else return Properties.DEFAULT_SCALE; } else return value.getScale(); }
[ "public", "static", "int", "getInheritedScale", "(", "AbstractCalculator", "calc", ",", "Num", "value", ")", "{", "if", "(", "value", ".", "getScale", "(", ")", "==", "null", ")", "{", "if", "(", "calc", "!=", "null", "&&", "calc", ".", "getScale", "("...
If {@link Num} don't define scale then use scale from {@link AbstractCalculator} instance. Othervise use default scale {@link Properties#DEFAULT_SCALE} @param calc @param value
[ "If", "{", "@link", "Num", "}", "don", "t", "define", "scale", "then", "use", "scale", "from", "{", "@link", "AbstractCalculator", "}", "instance", ".", "Othervise", "use", "default", "scale", "{", "@link", "Properties#DEFAULT_SCALE", "}" ]
train
https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/Properties.java#L435-L444
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/XmlUtils.java
XmlUtils.validateXml
public static void validateXml(Node doc, File schemaFile) throws AlipayApiException { validateXml(doc, getInputStream(schemaFile)); }
java
public static void validateXml(Node doc, File schemaFile) throws AlipayApiException { validateXml(doc, getInputStream(schemaFile)); }
[ "public", "static", "void", "validateXml", "(", "Node", "doc", ",", "File", "schemaFile", ")", "throws", "AlipayApiException", "{", "validateXml", "(", "doc", ",", "getInputStream", "(", "schemaFile", ")", ")", ";", "}" ]
Validates the element tree context via given XML schema file. @param doc the XML document to validate @param schemaFile the XML schema file instance @throws ApiException error occurs if the schema file not exists
[ "Validates", "the", "element", "tree", "context", "via", "given", "XML", "schema", "file", "." ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L524-L527
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/TransferListener.java
TransferListener.getInstance
public static TransferListener getInstance(String xferId, AsperaTransaction transaction) { if(instance == null) { instance = new TransferListener(); } if(transactions.get(xferId) != null) { transactions.get(xferId).add(transaction); } else { List<AsperaTransaction> transferTransactions = new ArrayList<AsperaTransaction>(); transferTransactions.add(transaction); transactions.put(xferId, transferTransactions); } return instance; }
java
public static TransferListener getInstance(String xferId, AsperaTransaction transaction) { if(instance == null) { instance = new TransferListener(); } if(transactions.get(xferId) != null) { transactions.get(xferId).add(transaction); } else { List<AsperaTransaction> transferTransactions = new ArrayList<AsperaTransaction>(); transferTransactions.add(transaction); transactions.put(xferId, transferTransactions); } return instance; }
[ "public", "static", "TransferListener", "getInstance", "(", "String", "xferId", ",", "AsperaTransaction", "transaction", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "new", "TransferListener", "(", ")", ";", "}", "if", "(", "tran...
Returns TransferListener instance and associates an AsperaTransaction with a Transfer ID. On change of transfer status or bytes transferred the TransferLsitener will fire a progress change event to all progress listeners attached to the AsperaTransaction. @param xferId @param transaction @return
[ "Returns", "TransferListener", "instance", "and", "associates", "an", "AsperaTransaction", "with", "a", "Transfer", "ID", ".", "On", "change", "of", "transfer", "status", "or", "bytes", "transferred", "the", "TransferLsitener", "will", "fire", "a", "progress", "ch...
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/TransferListener.java#L80-L94
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java
LiveMeasureDao.sumNclocOfBiggestLongLivingBranch
public long sumNclocOfBiggestLongLivingBranch(DbSession dbSession, SumNclocDbQuery dbQuery) { Long ncloc = mapper(dbSession).sumNclocOfBiggestLongLivingBranch( NCLOC_KEY, KeyType.BRANCH, BranchType.LONG, dbQuery.getOrganizationUuid(), dbQuery.getOnlyPrivateProjects(), dbQuery.getProjectUuidToExclude()); return ncloc == null ? 0L : ncloc; }
java
public long sumNclocOfBiggestLongLivingBranch(DbSession dbSession, SumNclocDbQuery dbQuery) { Long ncloc = mapper(dbSession).sumNclocOfBiggestLongLivingBranch( NCLOC_KEY, KeyType.BRANCH, BranchType.LONG, dbQuery.getOrganizationUuid(), dbQuery.getOnlyPrivateProjects(), dbQuery.getProjectUuidToExclude()); return ncloc == null ? 0L : ncloc; }
[ "public", "long", "sumNclocOfBiggestLongLivingBranch", "(", "DbSession", "dbSession", ",", "SumNclocDbQuery", "dbQuery", ")", "{", "Long", "ncloc", "=", "mapper", "(", "dbSession", ")", ".", "sumNclocOfBiggestLongLivingBranch", "(", "NCLOC_KEY", ",", "KeyType", ".", ...
Example: If Main Branch = 0 LOCs (provisioned but never analyzed) and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120. If Main Branch = 100 LOCs and the "largest long-lived branch" is 120 LOCs, I'm expecting to consider the value 120. If Main Branch = 100 LOCs and the "largest long-lived branch" is 80 LOCs, I'm expecting to consider the value 100.
[ "Example", ":", "If", "Main", "Branch", "=", "0", "LOCs", "(", "provisioned", "but", "never", "analyzed", ")", "and", "the", "largest", "long", "-", "lived", "branch", "is", "120", "LOCs", "I", "m", "expecting", "to", "consider", "the", "value", "120", ...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LiveMeasureDao.java#L105-L109
igniterealtime/Smack
smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java
AgentSession.setStatus
public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (!online) { throw new IllegalStateException("Cannot set status when the agent is not online."); } if (presenceMode == null) { presenceMode = Presence.Mode.available; } this.presenceMode = presenceMode; Presence presence = new Presence(Presence.Type.available); presence.setMode(presenceMode); presence.setTo(this.getWorkgroupJID()); if (status != null) { presence.setStatus(status); } presence.addExtension(new MetaData(this.metaData)); StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); collector.nextResultOrThrow(); }
java
public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (!online) { throw new IllegalStateException("Cannot set status when the agent is not online."); } if (presenceMode == null) { presenceMode = Presence.Mode.available; } this.presenceMode = presenceMode; Presence presence = new Presence(Presence.Type.available); presence.setMode(presenceMode); presence.setTo(this.getWorkgroupJID()); if (status != null) { presence.setStatus(status); } presence.addExtension(new MetaData(this.metaData)); StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); collector.nextResultOrThrow(); }
[ "public", "void", "setStatus", "(", "Presence", ".", "Mode", "presenceMode", ",", "String", "status", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "if", "(", "!", "online", ")", "{...
Sets the agent's current status with the workgroup. The presence mode affects how offers are routed to the agent. The possible presence modes with their meanings are as follows:<ul> <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats (equivalent to Presence.Mode.CHAT). <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed. However, special case, or extreme urgency chats may still be offered to the agent. <li>Presence.Mode.AWAY -- the agent is not available and should not have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul> @param presenceMode the presence mode of the agent. @param status sets the status message of the presence update. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException @throws IllegalStateException if the agent is not online with the workgroup.
[ "Sets", "the", "agent", "s", "current", "status", "with", "the", "workgroup", ".", "The", "presence", "mode", "affects", "how", "offers", "are", "routed", "to", "the", "agent", ".", "The", "possible", "presence", "modes", "with", "their", "meanings", "are", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L471-L494
threerings/narya
core/src/main/java/com/threerings/presents/peer/server/PeerManager.java
PeerManager.peerReleasingLock
protected void peerReleasingLock (PeerNode peer, NodeObject.Lock lock) { // refuse to ratify if we don't believe they own the lock String owner = queryLock(lock); if (!peer.getNodeName().equals(owner)) { log.warning("Refusing to ratify lock release.", "lock", lock, "node", peer.getNodeName(), "owner", owner); return; } // check for an existing handler LockHandler handler = _locks.get(lock); if (handler == null) { createLockHandler(peer, lock, false); } else { log.warning("Received request to release resolving lock", "node", peer.getNodeName(), "handler", handler); } }
java
protected void peerReleasingLock (PeerNode peer, NodeObject.Lock lock) { // refuse to ratify if we don't believe they own the lock String owner = queryLock(lock); if (!peer.getNodeName().equals(owner)) { log.warning("Refusing to ratify lock release.", "lock", lock, "node", peer.getNodeName(), "owner", owner); return; } // check for an existing handler LockHandler handler = _locks.get(lock); if (handler == null) { createLockHandler(peer, lock, false); } else { log.warning("Received request to release resolving lock", "node", peer.getNodeName(), "handler", handler); } }
[ "protected", "void", "peerReleasingLock", "(", "PeerNode", "peer", ",", "NodeObject", ".", "Lock", "lock", ")", "{", "// refuse to ratify if we don't believe they own the lock", "String", "owner", "=", "queryLock", "(", "lock", ")", ";", "if", "(", "!", "peer", "....
Called when a peer announces its intention to release a lock.
[ "Called", "when", "a", "peer", "announces", "its", "intention", "to", "release", "a", "lock", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1447-L1465
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/cs/csvserver_stats.java
csvserver_stats.get
public static csvserver_stats get(nitro_service service, String name) throws Exception{ csvserver_stats obj = new csvserver_stats(); obj.set_name(name); csvserver_stats response = (csvserver_stats) obj.stat_resource(service); return response; }
java
public static csvserver_stats get(nitro_service service, String name) throws Exception{ csvserver_stats obj = new csvserver_stats(); obj.set_name(name); csvserver_stats response = (csvserver_stats) obj.stat_resource(service); return response; }
[ "public", "static", "csvserver_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "csvserver_stats", "obj", "=", "new", "csvserver_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "csv...
Use this API to fetch statistics of csvserver_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "csvserver_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cs/csvserver_stats.java#L419-L424
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java
CalligraphyFactory.resolveFontPath
private String resolveFontPath(Context context, AttributeSet attrs) { // Try view xml attributes String textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mAttributeId); // Try view style attributes if (TextUtils.isEmpty(textViewFont)) { textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mAttributeId); } // Try View TextAppearance if (TextUtils.isEmpty(textViewFont)) { textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mAttributeId); } return textViewFont; }
java
private String resolveFontPath(Context context, AttributeSet attrs) { // Try view xml attributes String textViewFont = CalligraphyUtils.pullFontPathFromView(context, attrs, mAttributeId); // Try view style attributes if (TextUtils.isEmpty(textViewFont)) { textViewFont = CalligraphyUtils.pullFontPathFromStyle(context, attrs, mAttributeId); } // Try View TextAppearance if (TextUtils.isEmpty(textViewFont)) { textViewFont = CalligraphyUtils.pullFontPathFromTextAppearance(context, attrs, mAttributeId); } return textViewFont; }
[ "private", "String", "resolveFontPath", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "// Try view xml attributes", "String", "textViewFont", "=", "CalligraphyUtils", ".", "pullFontPathFromView", "(", "context", ",", "attrs", ",", "mAttributeId", ...
Resolving font path from xml attrs, style attrs or text appearance
[ "Resolving", "font", "path", "from", "xml", "attrs", "style", "attrs", "or", "text", "appearance" ]
train
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L181-L196
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java
ElementScanner7.visitVariable
@Override public R visitVariable(VariableElement e, P p) { return scan(e.getEnclosedElements(), p); }
java
@Override public R visitVariable(VariableElement e, P p) { return scan(e.getEnclosedElements(), p); }
[ "@", "Override", "public", "R", "visitVariable", "(", "VariableElement", "e", ",", "P", "p", ")", "{", "return", "scan", "(", "e", ".", "getEnclosedElements", "(", ")", ",", "p", ")", ";", "}" ]
This implementation scans the enclosed elements. @param e {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "This", "implementation", "scans", "the", "enclosed", "elements", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java#L121-L124
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java
ObjectEnvelopeOrdering.containsObject
private static boolean containsObject(Object searchFor, Object[] searchIn) { for (int i = 0; i < searchIn.length; i++) { if (searchFor == searchIn[i]) { return true; } } return false; }
java
private static boolean containsObject(Object searchFor, Object[] searchIn) { for (int i = 0; i < searchIn.length; i++) { if (searchFor == searchIn[i]) { return true; } } return false; }
[ "private", "static", "boolean", "containsObject", "(", "Object", "searchFor", ",", "Object", "[", "]", "searchIn", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "searchIn", ".", "length", ";", "i", "++", ")", "{", "if", "(", "searchFor",...
Helper method that searches an object array for the occurence of a specific object based on reference equality @param searchFor the object to search for @param searchIn the array to search in @return true if the object is found, otherwise false
[ "Helper", "method", "that", "searches", "an", "object", "array", "for", "the", "occurence", "of", "a", "specific", "object", "based", "on", "reference", "equality" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java#L389-L399
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java
GlobalUsersInner.listEnvironments
public ListEnvironmentsResponseInner listEnvironments(String userName, String labId) { return listEnvironmentsWithServiceResponseAsync(userName, labId).toBlocking().single().body(); }
java
public ListEnvironmentsResponseInner listEnvironments(String userName, String labId) { return listEnvironmentsWithServiceResponseAsync(userName, labId).toBlocking().single().body(); }
[ "public", "ListEnvironmentsResponseInner", "listEnvironments", "(", "String", "userName", ",", "String", "labId", ")", "{", "return", "listEnvironmentsWithServiceResponseAsync", "(", "userName", ",", "labId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")"...
List Environments for the user. @param userName The name of the user. @param labId The resource Id of the lab @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ListEnvironmentsResponseInner object if successful.
[ "List", "Environments", "for", "the", "user", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L623-L625
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_screenListConditions_PUT
public void billingAccount_easyHunting_serviceName_screenListConditions_PUT(String billingAccount, String serviceName, OvhEasyHuntingScreenListsConditionsSettings body) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_easyHunting_serviceName_screenListConditions_PUT(String billingAccount, String serviceName, OvhEasyHuntingScreenListsConditionsSettings body) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_easyHunting_serviceName_screenListConditions_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhEasyHuntingScreenListsConditionsSettings", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telepho...
Alter this object properties REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3311-L3315
pravega/pravega
common/src/main/java/io/pravega/common/util/btree/UpdateablePageCollection.java
UpdateablePageCollection.collectPages
synchronized void collectPages(Collection<Long> offsets, Collection<PageWrapper> target) { offsets.forEach(offset -> { PageWrapper p = this.pageByOffset.getOrDefault(offset, null); if (p != null) { target.add(p); } }); }
java
synchronized void collectPages(Collection<Long> offsets, Collection<PageWrapper> target) { offsets.forEach(offset -> { PageWrapper p = this.pageByOffset.getOrDefault(offset, null); if (p != null) { target.add(p); } }); }
[ "synchronized", "void", "collectPages", "(", "Collection", "<", "Long", ">", "offsets", ",", "Collection", "<", "PageWrapper", ">", "target", ")", "{", "offsets", ".", "forEach", "(", "offset", "->", "{", "PageWrapper", "p", "=", "this", ".", "pageByOffset",...
Collects the PageWrappers with given offsets into the given Collection. @param offsets A Collection of offsets to collect PageWrappers for. @param target The Collection to collect into.
[ "Collects", "the", "PageWrappers", "with", "given", "offsets", "into", "the", "given", "Collection", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/UpdateablePageCollection.java#L131-L138
hector-client/hector
core/src/main/java/me/prettyprint/cassandra/service/template/AbstractColumnFamilyTemplate.java
AbstractColumnFamilyTemplate.deleteColumn
public void deleteColumn(Mutator<K> mutator, K key, N columnName) { mutator.addDeletion(key, columnFamily, columnName, topSerializer); executeIfNotBatched(mutator); }
java
public void deleteColumn(Mutator<K> mutator, K key, N columnName) { mutator.addDeletion(key, columnFamily, columnName, topSerializer); executeIfNotBatched(mutator); }
[ "public", "void", "deleteColumn", "(", "Mutator", "<", "K", ">", "mutator", ",", "K", "key", ",", "N", "columnName", ")", "{", "mutator", ".", "addDeletion", "(", "key", ",", "columnFamily", ",", "columnName", ",", "topSerializer", ")", ";", "executeIfNotB...
Stage this column deletion into the pending mutator. Calls {@linkplain #executeIfNotBatched(Mutator)} @param mutator @param key @param columnName
[ "Stage", "this", "column", "deletion", "into", "the", "pending", "mutator", ".", "Calls", "{" ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/service/template/AbstractColumnFamilyTemplate.java#L201-L204
probedock/probedock-java
src/main/java/io/probedock/client/core/filters/FilterUtils.java
FilterUtils.isRunnable
@SuppressWarnings("unchecked") public static boolean isRunnable(Class cl, String methodName, List<FilterDefinition> filters) { try { Method method = cl.getMethod(methodName); return isRunnable(cl, method, filters); } catch (NoSuchMethodException | SecurityException e) { return true; } }
java
@SuppressWarnings("unchecked") public static boolean isRunnable(Class cl, String methodName, List<FilterDefinition> filters) { try { Method method = cl.getMethod(methodName); return isRunnable(cl, method, filters); } catch (NoSuchMethodException | SecurityException e) { return true; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "boolean", "isRunnable", "(", "Class", "cl", ",", "String", "methodName", ",", "List", "<", "FilterDefinition", ">", "filters", ")", "{", "try", "{", "Method", "method", "=", "cl", ".", ...
Define if a test is runnable or not based on a method name and class @param cl Class @param methodName The method name @param filters The filters to apply @return True if the test can be run
[ "Define", "if", "a", "test", "is", "runnable", "or", "not", "based", "on", "a", "method", "name", "and", "class" ]
train
https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/core/filters/FilterUtils.java#L25-L34
walkmod/walkmod-core
src/main/java/org/walkmod/WalkModFacade.java
WalkModFacade.removeModules
public void removeModules(List<String> modules) throws Exception { long startTime = System.currentTimeMillis(); Exception exception = null; if (!cfg.exists()) { init(); } userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider(); cfgProvider.removeModules(modules); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } }
java
public void removeModules(List<String> modules) throws Exception { long startTime = System.currentTimeMillis(); Exception exception = null; if (!cfg.exists()) { init(); } userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider(); cfgProvider.removeModules(modules); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } }
[ "public", "void", "removeModules", "(", "List", "<", "String", ">", "modules", ")", "throws", "Exception", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Exception", "exception", "=", "null", ";", "if", "(", "!", "cfg", ...
Removes the module list from the configuration file @param modules Module names to remove @throws Exception if the walkmod configuration file can't be read.
[ "Removes", "the", "module", "list", "from", "the", "configuration", "file" ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L870-L889
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java
MappingUtils.objectAssignableTo
public static boolean objectAssignableTo(Object object, String className) throws MjdbcException { AssertUtils.assertNotNull(object); boolean result = false; Class clazz = null; try { clazz = Class.forName(className); } catch (ClassNotFoundException ex) { throw new MjdbcException(ex); } result = clazz.isAssignableFrom(object.getClass()); return result; }
java
public static boolean objectAssignableTo(Object object, String className) throws MjdbcException { AssertUtils.assertNotNull(object); boolean result = false; Class clazz = null; try { clazz = Class.forName(className); } catch (ClassNotFoundException ex) { throw new MjdbcException(ex); } result = clazz.isAssignableFrom(object.getClass()); return result; }
[ "public", "static", "boolean", "objectAssignableTo", "(", "Object", "object", ",", "String", "className", ")", "throws", "MjdbcException", "{", "AssertUtils", ".", "assertNotNull", "(", "object", ")", ";", "boolean", "result", "=", "false", ";", "Class", "clazz"...
Checks if instance can be cast to specified Class @param object Instance which would be checked @param className Class name with which it would be checked @return true if Instance can be cast to specified class @throws org.midao.jdbc.core.exception.MjdbcException
[ "Checks", "if", "instance", "can", "be", "cast", "to", "specified", "Class" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L400-L415
morimekta/providence
providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java
Any.wrapMessage
public static <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField> Any wrapMessage(@javax.annotation.Nonnull M message) { return wrapMessage(message, new net.morimekta.providence.serializer.BinarySerializer()); }
java
public static <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField> Any wrapMessage(@javax.annotation.Nonnull M message) { return wrapMessage(message, new net.morimekta.providence.serializer.BinarySerializer()); }
[ "public", "static", "<", "M", "extends", "net", ".", "morimekta", ".", "providence", ".", "PMessage", "<", "M", ",", "F", ">", ",", "F", "extends", "net", ".", "morimekta", ".", "providence", ".", "descriptor", ".", "PField", ">", "Any", "wrapMessage", ...
Wrap a message into an <code>Any</code> wrapper message. This will serialize the message using the default binary serializer. @param message Wrap this message. @param <M> The message type @param <F> The message field type @return The wrapped message.
[ "Wrap", "a", "message", "into", "an", "<code", ">", "Any<", "/", "code", ">", "wrapper", "message", ".", "This", "will", "serialize", "the", "message", "using", "the", "default", "binary", "serializer", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java#L530-L533
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalWriter.java
JournalWriter.writeFileArgument
private void writeFileArgument(String key, File file, XMLEventWriter writer) throws XMLStreamException, JournalException { try { putStartTag(writer, QNAME_TAG_ARGUMENT); putAttribute(writer, QNAME_ATTR_NAME, key); putAttribute(writer, QNAME_ATTR_TYPE, ARGUMENT_TYPE_STREAM); EncodingBase64InputStream encoder = new EncodingBase64InputStream(new BufferedInputStream(new FileInputStream(file))); String encodedChunk; while (null != (encodedChunk = encoder.read(1000))) { putCharacters(writer, encodedChunk); } encoder.close(); putEndTag(writer, QNAME_TAG_ARGUMENT); } catch (IOException e) { throw new JournalException("IO Exception on temp file", e); } }
java
private void writeFileArgument(String key, File file, XMLEventWriter writer) throws XMLStreamException, JournalException { try { putStartTag(writer, QNAME_TAG_ARGUMENT); putAttribute(writer, QNAME_ATTR_NAME, key); putAttribute(writer, QNAME_ATTR_TYPE, ARGUMENT_TYPE_STREAM); EncodingBase64InputStream encoder = new EncodingBase64InputStream(new BufferedInputStream(new FileInputStream(file))); String encodedChunk; while (null != (encodedChunk = encoder.read(1000))) { putCharacters(writer, encodedChunk); } encoder.close(); putEndTag(writer, QNAME_TAG_ARGUMENT); } catch (IOException e) { throw new JournalException("IO Exception on temp file", e); } }
[ "private", "void", "writeFileArgument", "(", "String", "key", ",", "File", "file", ",", "XMLEventWriter", "writer", ")", "throws", "XMLStreamException", ",", "JournalException", "{", "try", "{", "putStartTag", "(", "writer", ",", "QNAME_TAG_ARGUMENT", ")", ";", ...
An InputStream argument must be written as a Base64-encoded String. It is read from the temp file in segments. Each segment is encoded and written to the XML writer as a series of character events.
[ "An", "InputStream", "argument", "must", "be", "written", "as", "a", "Base64", "-", "encoded", "String", ".", "It", "is", "read", "from", "the", "temp", "file", "in", "segments", ".", "Each", "segment", "is", "encoded", "and", "written", "to", "the", "XM...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalWriter.java#L327-L345
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
ProfileSummaryBuilder.buildPackageSummary
public void buildPackageSummary(XMLNode node, Content summaryContentTree) { PackageDoc[] packages = configuration.profilePackages.get(profile.name); for (int i = 0; i < packages.length; i++) { this.pkg = packages[i]; Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg); buildChildren(node, packageSummaryContentTree); summaryContentTree.addContent(profileWriter.getPackageSummaryTree( packageSummaryContentTree)); } }
java
public void buildPackageSummary(XMLNode node, Content summaryContentTree) { PackageDoc[] packages = configuration.profilePackages.get(profile.name); for (int i = 0; i < packages.length; i++) { this.pkg = packages[i]; Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg); buildChildren(node, packageSummaryContentTree); summaryContentTree.addContent(profileWriter.getPackageSummaryTree( packageSummaryContentTree)); } }
[ "public", "void", "buildPackageSummary", "(", "XMLNode", "node", ",", "Content", "summaryContentTree", ")", "{", "PackageDoc", "[", "]", "packages", "=", "configuration", ".", "profilePackages", ".", "get", "(", "profile", ".", "name", ")", ";", "for", "(", ...
Build the profile package summary. @param node the XML element that specifies which components to document @param summaryContentTree the content tree to which the summaries will be added
[ "Build", "the", "profile", "package", "summary", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java#L167-L176
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java
MarkLogicClientImpl.performGraphQuery
public InputStream performGraphQuery(String queryString, SPARQLQueryBindingSet bindings, Transaction tx, boolean includeInferred, String baseURI) throws JsonProcessingException { return performGraphQuery(queryString, bindings, new InputStreamHandle(), tx, includeInferred, baseURI); }
java
public InputStream performGraphQuery(String queryString, SPARQLQueryBindingSet bindings, Transaction tx, boolean includeInferred, String baseURI) throws JsonProcessingException { return performGraphQuery(queryString, bindings, new InputStreamHandle(), tx, includeInferred, baseURI); }
[ "public", "InputStream", "performGraphQuery", "(", "String", "queryString", ",", "SPARQLQueryBindingSet", "bindings", ",", "Transaction", "tx", ",", "boolean", "includeInferred", ",", "String", "baseURI", ")", "throws", "JsonProcessingException", "{", "return", "perform...
executes GraphQuery @param queryString @param bindings @param tx @param includeInferred @param baseURI @return @throws JsonProcessingException
[ "executes", "GraphQuery" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L185-L187
aws/aws-sdk-java
aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformEndpointRequest.java
CreatePlatformEndpointRequest.getAttributes
public java.util.Map<String, String> getAttributes() { if (attributes == null) { attributes = new com.amazonaws.internal.SdkInternalMap<String, String>(); } return attributes; }
java
public java.util.Map<String, String> getAttributes() { if (attributes == null) { attributes = new com.amazonaws.internal.SdkInternalMap<String, String>(); } return attributes; }
[ "public", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "getAttributes", "(", ")", "{", "if", "(", "attributes", "==", "null", ")", "{", "attributes", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalMap", "<...
<p> For a list of attributes, see <a href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>. </p> @return For a list of attributes, see <a href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html" >SetEndpointAttributes</a>.
[ "<p", ">", "For", "a", "list", "of", "attributes", "see", "<a", "href", "=", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "sns", "/", "latest", "/", "api", "/", "API_SetEndpointAttributes", ".", "html", ">", "SetEndpointAttri...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/CreatePlatformEndpointRequest.java#L216-L221
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendNullCriteria
private void appendNullCriteria(TableAlias alias, PathInfo pathInfo, NullCriteria c, StringBuffer buf) { appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); }
java
private void appendNullCriteria(TableAlias alias, PathInfo pathInfo, NullCriteria c, StringBuffer buf) { appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); }
[ "private", "void", "appendNullCriteria", "(", "TableAlias", "alias", ",", "PathInfo", "pathInfo", ",", "NullCriteria", "c", ",", "StringBuffer", "buf", ")", "{", "appendColName", "(", "alias", ",", "pathInfo", ",", "c", ".", "isTranslateAttribute", "(", ")", "...
Answer the SQL-Clause for a NullCriteria @param alias @param pathInfo @param c NullCriteria @param buf
[ "Answer", "the", "SQL", "-", "Clause", "for", "a", "NullCriteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L799-L803
undera/jmeter-plugins
plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java
CaseFormat.changeCase
protected String changeCase(String originalString, String mode) { String targetString = originalString; // mode is case insensitive, allow upper for example CaseFormatMode changeCaseMode = CaseFormatMode.get(mode.toUpperCase()); if (changeCaseMode != null) { switch (changeCaseMode) { case LOWER_CAMEL_CASE: targetString = camelFormat(originalString, false); break; case UPPER_CAMEL_CASE: targetString = camelFormat(originalString, true); break; case SNAKE_CASE: case LOWER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, false, true); break; case KEBAB_CASE: case LISP_CASE: case SPINAL_CASE: case LOWER_HYPHEN: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, false, true); break; case TRAIN_CASE: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, true, false); break; case UPPER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, true, false); break; default: // default not doing nothing to originalString } } else { LOGGER.error("Unknown mode {}, returning {} unchanged", mode, targetString); } return targetString; }
java
protected String changeCase(String originalString, String mode) { String targetString = originalString; // mode is case insensitive, allow upper for example CaseFormatMode changeCaseMode = CaseFormatMode.get(mode.toUpperCase()); if (changeCaseMode != null) { switch (changeCaseMode) { case LOWER_CAMEL_CASE: targetString = camelFormat(originalString, false); break; case UPPER_CAMEL_CASE: targetString = camelFormat(originalString, true); break; case SNAKE_CASE: case LOWER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, false, true); break; case KEBAB_CASE: case LISP_CASE: case SPINAL_CASE: case LOWER_HYPHEN: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, false, true); break; case TRAIN_CASE: targetString = caseFormatWithDelimiter(originalString, HYPHEN_MINUS, true, false); break; case UPPER_UNDERSCORE: targetString = caseFormatWithDelimiter(originalString, UNDERSCORE, true, false); break; default: // default not doing nothing to originalString } } else { LOGGER.error("Unknown mode {}, returning {} unchanged", mode, targetString); } return targetString; }
[ "protected", "String", "changeCase", "(", "String", "originalString", ",", "String", "mode", ")", "{", "String", "targetString", "=", "originalString", ";", "// mode is case insensitive, allow upper for example", "CaseFormatMode", "changeCaseMode", "=", "CaseFormatMode", "....
Change case options @param originalString @param mode @return string after change case
[ "Change", "case", "options" ]
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java#L95-L130
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/util/ModelGuesser.java
ModelGuesser.loadModelGuess
public static Model loadModelGuess(InputStream stream, File tempDirectory) throws Exception { //Currently (Nov 2017): KerasModelImport doesn't support loading from input streams //Simplest solution here: write to a temporary file File f; if(tempDirectory == null){ f = DL4JFileUtils.createTempFile("loadModelGuess",".bin"); } else { f = File.createTempFile("loadModelGuess", ".bin", tempDirectory); } f.deleteOnExit(); try (OutputStream os = new BufferedOutputStream(new FileOutputStream(f))) { IOUtils.copy(stream, os); os.flush(); return loadModelGuess(f.getAbsolutePath()); } catch (ModelGuesserException e){ throw new ModelGuesserException("Unable to load model from input stream (invalid model file not a known model type)"); } finally { f.delete(); } }
java
public static Model loadModelGuess(InputStream stream, File tempDirectory) throws Exception { //Currently (Nov 2017): KerasModelImport doesn't support loading from input streams //Simplest solution here: write to a temporary file File f; if(tempDirectory == null){ f = DL4JFileUtils.createTempFile("loadModelGuess",".bin"); } else { f = File.createTempFile("loadModelGuess", ".bin", tempDirectory); } f.deleteOnExit(); try (OutputStream os = new BufferedOutputStream(new FileOutputStream(f))) { IOUtils.copy(stream, os); os.flush(); return loadModelGuess(f.getAbsolutePath()); } catch (ModelGuesserException e){ throw new ModelGuesserException("Unable to load model from input stream (invalid model file not a known model type)"); } finally { f.delete(); } }
[ "public", "static", "Model", "loadModelGuess", "(", "InputStream", "stream", ",", "File", "tempDirectory", ")", "throws", "Exception", "{", "//Currently (Nov 2017): KerasModelImport doesn't support loading from input streams", "//Simplest solution here: write to a temporary file", "F...
As per {@link #loadModelGuess(InputStream)} but (optionally) allows copying to the specified temporary directory @param stream Stream of the model file @param tempDirectory Temporary/working directory. May be null.
[ "As", "per", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/util/ModelGuesser.java#L188-L209
Erudika/para
para-core/src/main/java/com/erudika/para/core/App.java
App.addDatatype
public void addDatatype(String pluralDatatype, String datatype) { pluralDatatype = Utils.noSpaces(Utils.stripAndTrim(pluralDatatype, " "), "-"); datatype = Utils.noSpaces(Utils.stripAndTrim(datatype, " "), "-"); if (StringUtils.isBlank(pluralDatatype) || StringUtils.isBlank(datatype)) { return; } if (getDatatypes().size() >= Config.MAX_DATATYPES_PER_APP) { LoggerFactory.getLogger(App.class).warn("Maximum number of types per app reached - {}.", Config.MAX_DATATYPES_PER_APP); return; } if (!getDatatypes().containsKey(pluralDatatype) && !getDatatypes().containsValue(datatype) && !ParaObjectUtils.getCoreTypes().containsKey(pluralDatatype)) { getDatatypes().put(pluralDatatype, datatype); } }
java
public void addDatatype(String pluralDatatype, String datatype) { pluralDatatype = Utils.noSpaces(Utils.stripAndTrim(pluralDatatype, " "), "-"); datatype = Utils.noSpaces(Utils.stripAndTrim(datatype, " "), "-"); if (StringUtils.isBlank(pluralDatatype) || StringUtils.isBlank(datatype)) { return; } if (getDatatypes().size() >= Config.MAX_DATATYPES_PER_APP) { LoggerFactory.getLogger(App.class).warn("Maximum number of types per app reached - {}.", Config.MAX_DATATYPES_PER_APP); return; } if (!getDatatypes().containsKey(pluralDatatype) && !getDatatypes().containsValue(datatype) && !ParaObjectUtils.getCoreTypes().containsKey(pluralDatatype)) { getDatatypes().put(pluralDatatype, datatype); } }
[ "public", "void", "addDatatype", "(", "String", "pluralDatatype", ",", "String", "datatype", ")", "{", "pluralDatatype", "=", "Utils", ".", "noSpaces", "(", "Utils", ".", "stripAndTrim", "(", "pluralDatatype", ",", "\" \"", ")", ",", "\"-\"", ")", ";", "data...
Adds a user-defined data type to the types map. @param pluralDatatype the plural form of the type @param datatype a datatype, must not be null or empty
[ "Adds", "a", "user", "-", "defined", "data", "type", "to", "the", "types", "map", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/App.java#L878-L893
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
BaseTable.unlockIfLocked
public boolean unlockIfLocked(Record record, Object bookmark) throws DBException { if (record != null) { // unlock record BaseApplication app = null; org.jbundle.model.Task task = null; if (record.getRecordOwner() != null) task = record.getRecordOwner().getTask(); if (task != null) app = (BaseApplication)record.getRecordOwner().getTask().getApplication(); Environment env = null; if (app != null) env = app.getEnvironment(); else env = Environment.getEnvironment(null); return env.getLockManager().unlockThisRecord(task, record.getDatabaseName(), record.getTableNames(false), bookmark); } return true; }
java
public boolean unlockIfLocked(Record record, Object bookmark) throws DBException { if (record != null) { // unlock record BaseApplication app = null; org.jbundle.model.Task task = null; if (record.getRecordOwner() != null) task = record.getRecordOwner().getTask(); if (task != null) app = (BaseApplication)record.getRecordOwner().getTask().getApplication(); Environment env = null; if (app != null) env = app.getEnvironment(); else env = Environment.getEnvironment(null); return env.getLockManager().unlockThisRecord(task, record.getDatabaseName(), record.getTableNames(false), bookmark); } return true; }
[ "public", "boolean", "unlockIfLocked", "(", "Record", "record", ",", "Object", "bookmark", ")", "throws", "DBException", "{", "if", "(", "record", "!=", "null", ")", "{", "// unlock record", "BaseApplication", "app", "=", "null", ";", "org", ".", "jbundle", ...
Unlock this record if it is locked. @param record The record to unlock. @param The bookmark to unlock (all if null). @return true if successful (it is usually okay to ignore this return).
[ "Unlock", "this", "record", "if", "it", "is", "locked", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1561-L1579
Netflix/conductor
core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java
DeciderService.updateWorkflowOutput
void updateWorkflowOutput(final Workflow workflow, @Nullable Task task) { List<Task> allTasks = workflow.getTasks(); if (allTasks.isEmpty()) { return; } Task last = Optional.ofNullable(task).orElse(allTasks.get(allTasks.size() - 1)); WorkflowDef workflowDef = workflow.getWorkflowDefinition(); Map<String, Object> output; if (workflowDef.getOutputParameters() != null && !workflowDef.getOutputParameters().isEmpty()) { Workflow workflowInstance = populateWorkflowAndTaskData(workflow); output = parametersUtils.getTaskInput(workflowDef.getOutputParameters(), workflowInstance, null, null); } else if (StringUtils.isNotBlank(last.getExternalOutputPayloadStoragePath())) { output = externalPayloadStorageUtils.downloadPayload(last.getExternalOutputPayloadStoragePath()); Monitors.recordExternalPayloadStorageUsage(last.getTaskDefName(), ExternalPayloadStorage.Operation.READ.toString(), ExternalPayloadStorage.PayloadType.TASK_OUTPUT.toString()); } else { output = last.getOutputData(); } workflow.setOutput(output); externalPayloadStorageUtils.verifyAndUpload(workflow, ExternalPayloadStorage.PayloadType.WORKFLOW_OUTPUT); }
java
void updateWorkflowOutput(final Workflow workflow, @Nullable Task task) { List<Task> allTasks = workflow.getTasks(); if (allTasks.isEmpty()) { return; } Task last = Optional.ofNullable(task).orElse(allTasks.get(allTasks.size() - 1)); WorkflowDef workflowDef = workflow.getWorkflowDefinition(); Map<String, Object> output; if (workflowDef.getOutputParameters() != null && !workflowDef.getOutputParameters().isEmpty()) { Workflow workflowInstance = populateWorkflowAndTaskData(workflow); output = parametersUtils.getTaskInput(workflowDef.getOutputParameters(), workflowInstance, null, null); } else if (StringUtils.isNotBlank(last.getExternalOutputPayloadStoragePath())) { output = externalPayloadStorageUtils.downloadPayload(last.getExternalOutputPayloadStoragePath()); Monitors.recordExternalPayloadStorageUsage(last.getTaskDefName(), ExternalPayloadStorage.Operation.READ.toString(), ExternalPayloadStorage.PayloadType.TASK_OUTPUT.toString()); } else { output = last.getOutputData(); } workflow.setOutput(output); externalPayloadStorageUtils.verifyAndUpload(workflow, ExternalPayloadStorage.PayloadType.WORKFLOW_OUTPUT); }
[ "void", "updateWorkflowOutput", "(", "final", "Workflow", "workflow", ",", "@", "Nullable", "Task", "task", ")", "{", "List", "<", "Task", ">", "allTasks", "=", "workflow", ".", "getTasks", "(", ")", ";", "if", "(", "allTasks", ".", "isEmpty", "(", ")", ...
Updates the workflow output. @param workflow the workflow instance @param task if not null, the output of this task will be copied to workflow output if no output parameters are specified in the workflow defintion if null, the output of the last task in the workflow will be copied to workflow output of no output parameters are specified in the workflow definition
[ "Updates", "the", "workflow", "output", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java#L269-L291
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/scheduler/multitenant/IsolatedPool.java
IsolatedPool.getNodesForIsolatedTop
private int getNodesForIsolatedTop(TopologyDetails td, Set<Node> allNodes, NodePool[] lesserPools, int nodesRequested) { String topId = td.getId(); LOG.debug("Topology {} is isolated", topId); int nodesFromUsAvailable = nodesAvailable(); int nodesFromOthersAvailable = NodePool.nodesAvailable(lesserPools); int nodesUsed = _topologyIdToNodes.get(topId).size(); int nodesNeeded = nodesRequested - nodesUsed; LOG.debug("Nodes... requested {} used {} available from us {} " + "avail from other {} needed {}", new Object[]{nodesRequested, nodesUsed, nodesFromUsAvailable, nodesFromOthersAvailable, nodesNeeded}); if ((nodesNeeded - nodesFromUsAvailable) > (_maxNodes - _usedNodes)) { _cluster.setStatus(topId, "Max Nodes(" + _maxNodes + ") for this user would be exceeded. " + ((nodesNeeded - nodesFromUsAvailable) - (_maxNodes - _usedNodes)) + " more nodes needed to run topology."); return 0; } // In order to avoid going over _maxNodes I may need to steal from // myself even though other pools have free nodes. so figure out how // much each group should provide int nodesNeededFromOthers = Math.min(Math.min(_maxNodes - _usedNodes, nodesFromOthersAvailable), nodesNeeded); int nodesNeededFromUs = nodesNeeded - nodesNeededFromOthers; LOG.debug("Nodes... needed from us {} needed from others {}", nodesNeededFromUs, nodesNeededFromOthers); if (nodesNeededFromUs > nodesFromUsAvailable) { _cluster.setStatus(topId, "Not Enough Nodes Available to Schedule Topology"); return 0; } // Get the nodes Collection<Node> found = NodePool.takeNodes(nodesNeededFromOthers, lesserPools); _usedNodes += found.size(); allNodes.addAll(found); Collection<Node> foundMore = takeNodes(nodesNeededFromUs); _usedNodes += foundMore.size(); allNodes.addAll(foundMore); int totalTasks = td.getExecutors().size(); int origRequest = td.getNumWorkers(); int slotsRequested = Math.min(totalTasks, origRequest); int slotsUsed = Node.countSlotsUsed(allNodes); int slotsFree = Node.countFreeSlotsAlive(allNodes); int slotsToUse = Math.min(slotsRequested - slotsUsed, slotsFree); if (slotsToUse <= 0) { _cluster.setStatus(topId, "Node has partially crashed, if this situation persists rebalance the topology."); } return slotsToUse; }
java
private int getNodesForIsolatedTop(TopologyDetails td, Set<Node> allNodes, NodePool[] lesserPools, int nodesRequested) { String topId = td.getId(); LOG.debug("Topology {} is isolated", topId); int nodesFromUsAvailable = nodesAvailable(); int nodesFromOthersAvailable = NodePool.nodesAvailable(lesserPools); int nodesUsed = _topologyIdToNodes.get(topId).size(); int nodesNeeded = nodesRequested - nodesUsed; LOG.debug("Nodes... requested {} used {} available from us {} " + "avail from other {} needed {}", new Object[]{nodesRequested, nodesUsed, nodesFromUsAvailable, nodesFromOthersAvailable, nodesNeeded}); if ((nodesNeeded - nodesFromUsAvailable) > (_maxNodes - _usedNodes)) { _cluster.setStatus(topId, "Max Nodes(" + _maxNodes + ") for this user would be exceeded. " + ((nodesNeeded - nodesFromUsAvailable) - (_maxNodes - _usedNodes)) + " more nodes needed to run topology."); return 0; } // In order to avoid going over _maxNodes I may need to steal from // myself even though other pools have free nodes. so figure out how // much each group should provide int nodesNeededFromOthers = Math.min(Math.min(_maxNodes - _usedNodes, nodesFromOthersAvailable), nodesNeeded); int nodesNeededFromUs = nodesNeeded - nodesNeededFromOthers; LOG.debug("Nodes... needed from us {} needed from others {}", nodesNeededFromUs, nodesNeededFromOthers); if (nodesNeededFromUs > nodesFromUsAvailable) { _cluster.setStatus(topId, "Not Enough Nodes Available to Schedule Topology"); return 0; } // Get the nodes Collection<Node> found = NodePool.takeNodes(nodesNeededFromOthers, lesserPools); _usedNodes += found.size(); allNodes.addAll(found); Collection<Node> foundMore = takeNodes(nodesNeededFromUs); _usedNodes += foundMore.size(); allNodes.addAll(foundMore); int totalTasks = td.getExecutors().size(); int origRequest = td.getNumWorkers(); int slotsRequested = Math.min(totalTasks, origRequest); int slotsUsed = Node.countSlotsUsed(allNodes); int slotsFree = Node.countFreeSlotsAlive(allNodes); int slotsToUse = Math.min(slotsRequested - slotsUsed, slotsFree); if (slotsToUse <= 0) { _cluster.setStatus(topId, "Node has partially crashed, if this situation persists rebalance the topology."); } return slotsToUse; }
[ "private", "int", "getNodesForIsolatedTop", "(", "TopologyDetails", "td", ",", "Set", "<", "Node", ">", "allNodes", ",", "NodePool", "[", "]", "lesserPools", ",", "int", "nodesRequested", ")", "{", "String", "topId", "=", "td", ".", "getId", "(", ")", ";",...
Get the nodes needed to schedule an isolated topology. @param td the topology to be scheduled @param allNodes the nodes already scheduled for this topology. This will be updated to include new nodes if needed. @param lesserPools node pools we can steal nodes from @return the number of additional slots that should be used for scheduling.
[ "Get", "the", "nodes", "needed", "to", "schedule", "an", "isolated", "topology", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/scheduler/multitenant/IsolatedPool.java#L146-L192
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java
ElementFilter.requiresIn
public static List<RequiresDirective> requiresIn(Iterable<? extends Directive> directives) { return listFilter(directives, DirectiveKind.REQUIRES, RequiresDirective.class); }
java
public static List<RequiresDirective> requiresIn(Iterable<? extends Directive> directives) { return listFilter(directives, DirectiveKind.REQUIRES, RequiresDirective.class); }
[ "public", "static", "List", "<", "RequiresDirective", ">", "requiresIn", "(", "Iterable", "<", "?", "extends", "Directive", ">", "directives", ")", "{", "return", "listFilter", "(", "directives", ",", "DirectiveKind", ".", "REQUIRES", ",", "RequiresDirective", "...
Returns a list of {@code requires} directives in {@code directives}. @return a list of {@code requires} directives in {@code directives} @param directives the directives to filter @since 9 @spec JPMS
[ "Returns", "a", "list", "of", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L278-L281
opentable/otj-jaxrs
client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java
JaxRsClientFactory.addFeatureToGroup
public synchronized JaxRsClientFactory addFeatureToGroup(JaxRsFeatureGroup group, Feature... features) { Preconditions.checkState(!started, "Already started building clients"); featureMap.putAll(group, Arrays.asList(features)); LOG.trace("Group {} registers features {}", group, features); return this; }
java
public synchronized JaxRsClientFactory addFeatureToGroup(JaxRsFeatureGroup group, Feature... features) { Preconditions.checkState(!started, "Already started building clients"); featureMap.putAll(group, Arrays.asList(features)); LOG.trace("Group {} registers features {}", group, features); return this; }
[ "public", "synchronized", "JaxRsClientFactory", "addFeatureToGroup", "(", "JaxRsFeatureGroup", "group", ",", "Feature", "...", "features", ")", "{", "Preconditions", ".", "checkState", "(", "!", "started", ",", "\"Already started building clients\"", ")", ";", "featureM...
Register a list of features to all clients marked with the given group.
[ "Register", "a", "list", "of", "features", "to", "all", "clients", "marked", "with", "the", "given", "group", "." ]
train
https://github.com/opentable/otj-jaxrs/blob/384e7094fe5a56d41b2a9970bfd783fa85cbbcb8/client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java#L141-L146
paymill/paymill-java
src/main/java/com/paymill/services/SubscriptionService.java
SubscriptionService.changeAmount
public Subscription changeAmount( Subscription subscription, Integer amount, String currency, Interval.PeriodWithChargeDay interval ) { return changeAmount( subscription, amount, 1, currency, interval ); }
java
public Subscription changeAmount( Subscription subscription, Integer amount, String currency, Interval.PeriodWithChargeDay interval ) { return changeAmount( subscription, amount, 1, currency, interval ); }
[ "public", "Subscription", "changeAmount", "(", "Subscription", "subscription", ",", "Integer", "amount", ",", "String", "currency", ",", "Interval", ".", "PeriodWithChargeDay", "interval", ")", "{", "return", "changeAmount", "(", "subscription", ",", "amount", ",", ...
Changes the amount of a subscription.<br> <br> The new amount is valid until the end of the subscription. If you want to set a temporary one-time amount use {@link SubscriptionService#changeAmountTemporary(String, Integer)} @param subscription the subscription. @param amount the new amount. @param currency optionally, a new currency or <code>null</code>. @param interval optionally, a new interval or <code>null</code>. @return the updated subscription.
[ "Changes", "the", "amount", "of", "a", "subscription", ".", "<br", ">", "<br", ">", "The", "new", "amount", "is", "valid", "until", "the", "end", "of", "the", "subscription", ".", "If", "you", "want", "to", "set", "a", "temporary", "one", "-", "time", ...
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L339-L341
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java
IndexElasticsearchUpdater.updateIndexWithSettingsInElasticsearch
private static void updateIndexWithSettingsInElasticsearch(RestClient client, String index, String settings) throws Exception { logger.trace("updateIndex([{}])", index); assert client != null; assert index != null; if (settings != null) { logger.trace("Found update settings for index [{}]: [{}]", index, settings); logger.debug("updating settings for index [{}]", index); Request request = new Request("PUT", "/" + index + "/_settings"); request.setJsonEntity(settings); client.performRequest(request); } logger.trace("/updateIndex([{}])", index); }
java
private static void updateIndexWithSettingsInElasticsearch(RestClient client, String index, String settings) throws Exception { logger.trace("updateIndex([{}])", index); assert client != null; assert index != null; if (settings != null) { logger.trace("Found update settings for index [{}]: [{}]", index, settings); logger.debug("updating settings for index [{}]", index); Request request = new Request("PUT", "/" + index + "/_settings"); request.setJsonEntity(settings); client.performRequest(request); } logger.trace("/updateIndex([{}])", index); }
[ "private", "static", "void", "updateIndexWithSettingsInElasticsearch", "(", "RestClient", "client", ",", "String", "index", ",", "String", "settings", ")", "throws", "Exception", "{", "logger", ".", "trace", "(", "\"updateIndex([{}])\"", ",", "index", ")", ";", "a...
Update settings in Elasticsearch @param client Elasticsearch client @param index Index name @param settings Settings if any, null if no update settings @throws Exception if the elasticsearch API call is failing
[ "Update", "settings", "in", "Elasticsearch" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L306-L322
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.lookAlong
public Matrix3d lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this); }
java
public Matrix3d lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this); }
[ "public", "Matrix3d", "lookAlong", "(", "double", "dirX", ",", "double", "dirY", ",", "double", "dirZ", ",", "double", "upX", ",", "double", "upY", ",", "double", "upZ", ")", "{", "return", "lookAlong", "(", "dirX", ",", "dirY", ",", "dirZ", ",", "upX"...
Apply a rotation transformation to this matrix to make <code>-z</code> point along <code>dir</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookalong rotation matrix, then the new matrix will be <code>M * L</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the lookalong rotation transformation will be applied first! <p> In order to set the matrix to a lookalong transformation without post-multiplying it, use {@link #setLookAlong(double, double, double, double, double, double) setLookAlong()} @see #setLookAlong(double, double, double, double, double, double) @param dirX the x-coordinate of the direction to look along @param dirY the y-coordinate of the direction to look along @param dirZ the z-coordinate of the direction to look along @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @return this
[ "Apply", "a", "rotation", "transformation", "to", "this", "matrix", "to", "make", "<code", ">", "-", "z<", "/", "code", ">", "point", "along", "<code", ">", "dir<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L3964-L3967
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java
NwwPanel.goTo
public void goTo( Sector sector, boolean animate ) { View view = getWwd().getView(); view.stopAnimations(); view.stopMovement(); if (sector == null) { return; } // Create a bounding box for the specified sector in order to estimate // its size in model coordinates. Box extent = Sector.computeBoundingBox(getWwd().getModel().getGlobe(), getWwd().getSceneController().getVerticalExaggeration(), sector); // Estimate the distance between the center position and the eye // position that is necessary to cause the sector to // fill a viewport with the specified field of view. Note that we change // the distance between the center and eye // position here, and leave the field of view constant. Angle fov = view.getFieldOfView(); double zoom = extent.getRadius() / fov.cosHalfAngle() / fov.tanHalfAngle(); // Configure OrbitView to look at the center of the sector from our // estimated distance. This causes OrbitView to // animate to the specified position over several seconds. To affect // this change immediately use the following: if (animate) { view.goTo(new Position(sector.getCentroid(), 0d), zoom); } else { ((OrbitView) wwd.getView()).setCenterPosition(new Position(sector.getCentroid(), 0d)); ((OrbitView) wwd.getView()).setZoom(zoom); } }
java
public void goTo( Sector sector, boolean animate ) { View view = getWwd().getView(); view.stopAnimations(); view.stopMovement(); if (sector == null) { return; } // Create a bounding box for the specified sector in order to estimate // its size in model coordinates. Box extent = Sector.computeBoundingBox(getWwd().getModel().getGlobe(), getWwd().getSceneController().getVerticalExaggeration(), sector); // Estimate the distance between the center position and the eye // position that is necessary to cause the sector to // fill a viewport with the specified field of view. Note that we change // the distance between the center and eye // position here, and leave the field of view constant. Angle fov = view.getFieldOfView(); double zoom = extent.getRadius() / fov.cosHalfAngle() / fov.tanHalfAngle(); // Configure OrbitView to look at the center of the sector from our // estimated distance. This causes OrbitView to // animate to the specified position over several seconds. To affect // this change immediately use the following: if (animate) { view.goTo(new Position(sector.getCentroid(), 0d), zoom); } else { ((OrbitView) wwd.getView()).setCenterPosition(new Position(sector.getCentroid(), 0d)); ((OrbitView) wwd.getView()).setZoom(zoom); } }
[ "public", "void", "goTo", "(", "Sector", "sector", ",", "boolean", "animate", ")", "{", "View", "view", "=", "getWwd", "(", ")", ".", "getView", "(", ")", ";", "view", ".", "stopAnimations", "(", ")", ";", "view", ".", "stopMovement", "(", ")", ";", ...
Move to see a given sector. @param sector the sector to go to. @param animate if <code>true</code>, it animates to the position.
[ "Move", "to", "see", "a", "given", "sector", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/gui/NwwPanel.java#L257-L288
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java
UtilColor.multiplyRgb
public static int multiplyRgb(int rgb, double fr, double fg, double fb) { if (rgb == 0) { return rgb; } final int a = rgb >> Constant.BYTE_4 & 0xFF; final int r = (int) UtilMath.clamp((rgb >> Constant.BYTE_3 & 0xFF) * fr, 0, 255); final int g = (int) UtilMath.clamp((rgb >> Constant.BYTE_2 & 0xFF) * fg, 0, 255); final int b = (int) UtilMath.clamp((rgb >> Constant.BYTE_1 & 0xFF) * fb, 0, 255); // CHECKSTYLE IGNORE LINE: BooleanExpressionComplexity|TrailingComment return (a & 0xFF) << Constant.BYTE_4 | (r & 0xFF) << Constant.BYTE_3 | (g & 0xFF) << Constant.BYTE_2 | (b & 0xFF) << Constant.BYTE_1; }
java
public static int multiplyRgb(int rgb, double fr, double fg, double fb) { if (rgb == 0) { return rgb; } final int a = rgb >> Constant.BYTE_4 & 0xFF; final int r = (int) UtilMath.clamp((rgb >> Constant.BYTE_3 & 0xFF) * fr, 0, 255); final int g = (int) UtilMath.clamp((rgb >> Constant.BYTE_2 & 0xFF) * fg, 0, 255); final int b = (int) UtilMath.clamp((rgb >> Constant.BYTE_1 & 0xFF) * fb, 0, 255); // CHECKSTYLE IGNORE LINE: BooleanExpressionComplexity|TrailingComment return (a & 0xFF) << Constant.BYTE_4 | (r & 0xFF) << Constant.BYTE_3 | (g & 0xFF) << Constant.BYTE_2 | (b & 0xFF) << Constant.BYTE_1; }
[ "public", "static", "int", "multiplyRgb", "(", "int", "rgb", ",", "double", "fr", ",", "double", "fg", ",", "double", "fb", ")", "{", "if", "(", "rgb", "==", "0", ")", "{", "return", "rgb", ";", "}", "final", "int", "a", "=", "rgb", ">>", "Consta...
Apply an rgb factor. @param rgb The original rgb. @param fr The red factor. @param fg The green factor. @param fb The blue factor. @return The multiplied rgb.
[ "Apply", "an", "rgb", "factor", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java#L42-L59
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java
Context2.declarePrefix
void declarePrefix (String prefix, String uri) { // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new Vector(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.addElement(prefix); }
java
void declarePrefix (String prefix, String uri) { // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new Vector(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.addElement(prefix); }
[ "void", "declarePrefix", "(", "String", "prefix", ",", "String", "uri", ")", "{", "// Lazy processing...", "if", "(", "!", "tablesDirty", ")", "{", "copyTables", "(", ")", ";", "}", "if", "(", "declarations", "==", "null", ")", "{", "declarations", "=", ...
Declare a Namespace prefix for this context. @param prefix The prefix to declare. @param uri The associated Namespace URI. @see org.xml.sax.helpers.NamespaceSupport2#declarePrefix
[ "Declare", "a", "Namespace", "prefix", "for", "this", "context", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L535-L558
Ecwid/ecwid-mailchimp
src/main/java/com/ecwid/mailchimp/MailChimpObject.java
MailChimpObject.fromJson
public static <T extends MailChimpObject> T fromJson(String json, Class<T> clazz) { try { return MailChimpGsonFactory.createGson().fromJson(json, clazz); } catch(JsonParseException e) { throw new IllegalArgumentException(e); } }
java
public static <T extends MailChimpObject> T fromJson(String json, Class<T> clazz) { try { return MailChimpGsonFactory.createGson().fromJson(json, clazz); } catch(JsonParseException e) { throw new IllegalArgumentException(e); } }
[ "public", "static", "<", "T", "extends", "MailChimpObject", ">", "T", "fromJson", "(", "String", "json", ",", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "return", "MailChimpGsonFactory", ".", "createGson", "(", ")", ".", "fromJson", "(", "jso...
Deserializes an object from JSON. @throws IllegalArgumentException if <code>json</code> cannot be deserialized to an object of class <code>clazz</code>.
[ "Deserializes", "an", "object", "from", "JSON", "." ]
train
https://github.com/Ecwid/ecwid-mailchimp/blob/8acb37d7677bd494879d4db11f3c42ba4c85eb36/src/main/java/com/ecwid/mailchimp/MailChimpObject.java#L383-L389
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/DbPro.java
DbPro.deleteById
public boolean deleteById(String tableName, Object idValue) { return deleteByIds(tableName, config.dialect.getDefaultPrimaryKey(), idValue); }
java
public boolean deleteById(String tableName, Object idValue) { return deleteByIds(tableName, config.dialect.getDefaultPrimaryKey(), idValue); }
[ "public", "boolean", "deleteById", "(", "String", "tableName", ",", "Object", "idValue", ")", "{", "return", "deleteByIds", "(", "tableName", ",", "config", ".", "dialect", ".", "getDefaultPrimaryKey", "(", ")", ",", "idValue", ")", ";", "}" ]
Delete record by id with default primary key. <pre> Example: Db.use().deleteById("user", 15); </pre> @param tableName the table name of the table @param idValue the id value of the record @return true if delete succeed otherwise false
[ "Delete", "record", "by", "id", "with", "default", "primary", "key", ".", "<pre", ">", "Example", ":", "Db", ".", "use", "()", ".", "deleteById", "(", "user", "15", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/DbPro.java#L415-L417
citrusframework/citrus
modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java
JmsSyncProducer.createMessageConsumer
private MessageConsumer createMessageConsumer(Destination replyToDestination, String messageId) throws JMSException { MessageConsumer messageConsumer; if (replyToDestination instanceof Queue) { messageConsumer = session.createConsumer(replyToDestination, "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'"); } else { messageConsumer = session.createDurableSubscriber((Topic)replyToDestination, getName(), "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'", false); } return messageConsumer; }
java
private MessageConsumer createMessageConsumer(Destination replyToDestination, String messageId) throws JMSException { MessageConsumer messageConsumer; if (replyToDestination instanceof Queue) { messageConsumer = session.createConsumer(replyToDestination, "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'"); } else { messageConsumer = session.createDurableSubscriber((Topic)replyToDestination, getName(), "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'", false); } return messageConsumer; }
[ "private", "MessageConsumer", "createMessageConsumer", "(", "Destination", "replyToDestination", ",", "String", "messageId", ")", "throws", "JMSException", "{", "MessageConsumer", "messageConsumer", ";", "if", "(", "replyToDestination", "instanceof", "Queue", ")", "{", ...
Creates a message consumer on temporary/durable queue or topic. Durable queue/topic destinations require a message selector to be set. @param replyToDestination the reply destination. @param messageId the messageId used for optional message selector. @return @throws JMSException
[ "Creates", "a", "message", "consumer", "on", "temporary", "/", "durable", "queue", "or", "topic", ".", "Durable", "queue", "/", "topic", "destinations", "require", "a", "message", "selector", "to", "be", "set", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java#L236-L248
icode/ameba-utils
src/main/java/ameba/util/Assert.java
Assert.notEmpty
public static void notEmpty(Map map, String message) { if (MapUtils.isEmpty(map)) { throw new IllegalArgumentException(message); } }
java
public static void notEmpty(Map map, String message) { if (MapUtils.isEmpty(map)) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "notEmpty", "(", "Map", "map", ",", "String", "message", ")", "{", "if", "(", "MapUtils", ".", "isEmpty", "(", "map", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that a Map has entries; that is, it must not be {@code null} and must have at least one entry. <pre class="code">Assert.notEmpty(map, "Map must have entries");</pre> @param map the map to check @param message the exception message to use if the assertion fails @throws java.lang.IllegalArgumentException if the map is {@code null} or has no entries
[ "Assert", "that", "a", "Map", "has", "entries", ";", "that", "is", "it", "must", "not", "be", "{", "@code", "null", "}", "and", "must", "have", "at", "least", "one", "entry", ".", "<pre", "class", "=", "code", ">", "Assert", ".", "notEmpty", "(", "...
train
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/Assert.java#L298-L302
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
FieldInfo.setValue
public void setValue(Object obj, Object value) { if (setters.length > 0) { for (Method method : setters) { if (value == null || method.getParameterTypes()[0].isAssignableFrom(value.getClass())) { try { method.invoke(obj, value); return; } catch (IllegalAccessException | InvocationTargetException e) { // try to set field directly } } } } setFieldValue(field, obj, value); }
java
public void setValue(Object obj, Object value) { if (setters.length > 0) { for (Method method : setters) { if (value == null || method.getParameterTypes()[0].isAssignableFrom(value.getClass())) { try { method.invoke(obj, value); return; } catch (IllegalAccessException | InvocationTargetException e) { // try to set field directly } } } } setFieldValue(field, obj, value); }
[ "public", "void", "setValue", "(", "Object", "obj", ",", "Object", "value", ")", "{", "if", "(", "setters", ".", "length", ">", "0", ")", "{", "for", "(", "Method", "method", ":", "setters", ")", "{", "if", "(", "value", "==", "null", "||", "method...
Sets this field in the given object to the given value using reflection. <p>If the field is final, it checks that the value being set is identical to the existing value.
[ "Sets", "this", "field", "in", "the", "given", "object", "to", "the", "given", "value", "using", "reflection", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java#L219-L233
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/producible/ProducibleConfig.java
ProducibleConfig.imports
public static ProducibleConfig imports(Xml root) { Check.notNull(root); final Xml node = root.getChild(NODE_PRODUCIBLE); final SizeConfig size = SizeConfig.imports(root); final int time = node.readInteger(ATT_STEPS); return new ProducibleConfig(time, size.getWidth(), size.getHeight()); }
java
public static ProducibleConfig imports(Xml root) { Check.notNull(root); final Xml node = root.getChild(NODE_PRODUCIBLE); final SizeConfig size = SizeConfig.imports(root); final int time = node.readInteger(ATT_STEPS); return new ProducibleConfig(time, size.getWidth(), size.getHeight()); }
[ "public", "static", "ProducibleConfig", "imports", "(", "Xml", "root", ")", "{", "Check", ".", "notNull", "(", "root", ")", ";", "final", "Xml", "node", "=", "root", ".", "getChild", "(", "NODE_PRODUCIBLE", ")", ";", "final", "SizeConfig", "size", "=", "...
Create the producible data from node. @param root The root reference (must not be <code>null</code>). @return The producible data. @throws LionEngineException If unable to read node.
[ "Create", "the", "producible", "data", "from", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/producible/ProducibleConfig.java#L63-L72
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setColor
public void setColor(int n, int color) { int firstColor = map[0]; int lastColor = map[256-1]; if (n > 0) for (int i = 0; i < n; i++) map[i] = ImageMath.mixColors((float)i/n, firstColor, color); if (n < 256-1) for (int i = n; i < 256; i++) map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, lastColor); }
java
public void setColor(int n, int color) { int firstColor = map[0]; int lastColor = map[256-1]; if (n > 0) for (int i = 0; i < n; i++) map[i] = ImageMath.mixColors((float)i/n, firstColor, color); if (n < 256-1) for (int i = n; i < 256; i++) map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, lastColor); }
[ "public", "void", "setColor", "(", "int", "n", ",", "int", "color", ")", "{", "int", "firstColor", "=", "map", "[", "0", "]", ";", "int", "lastColor", "=", "map", "[", "256", "-", "1", "]", ";", "if", "(", "n", ">", "0", ")", "for", "(", "int...
Set a knot color. @param n the knot index @param color the color
[ "Set", "a", "knot", "color", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L151-L160
aehrc/snorocket
snorocket-core/src/main/java/au/csiro/snorocket/core/R.java
R1.getB
protected IConceptSet getB(int A, int r) { if (A >= CONCEPTS) { resizeConcepts(A); } if (r >= ROLES) { resizeRoles(r); } final int index = indexOf(A, r); if (null == data[index]) { data[index] = new SparseConceptSet(); addRole(r); if (null != base && index < base.length && null != base[index]) { data[index].addAll(base[index]); } } return data[index]; }
java
protected IConceptSet getB(int A, int r) { if (A >= CONCEPTS) { resizeConcepts(A); } if (r >= ROLES) { resizeRoles(r); } final int index = indexOf(A, r); if (null == data[index]) { data[index] = new SparseConceptSet(); addRole(r); if (null != base && index < base.length && null != base[index]) { data[index].addAll(base[index]); } } return data[index]; }
[ "protected", "IConceptSet", "getB", "(", "int", "A", ",", "int", "r", ")", "{", "if", "(", "A", ">=", "CONCEPTS", ")", "{", "resizeConcepts", "(", "A", ")", ";", "}", "if", "(", "r", ">=", "ROLES", ")", "{", "resizeRoles", "(", "r", ")", ";", "...
Returns {B | A [ r.B} or {B | (A,B) in R(r)} @param A @param r @return
[ "Returns", "{", "B", "|", "A", "[", "r", ".", "B", "}", "or", "{", "B", "|", "(", "A", "B", ")", "in", "R", "(", "r", ")", "}" ]
train
https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/R.java#L143-L160