method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
EList<HierarchicalElement> getChildren();
EList<HierarchicalElement> getChildren();
/** * Returns the value of the '<em><b>Children</b></em>' containment reference list. * The list contents are of type {@link org.topcased.requirement.HierarchicalElement}. * It is bidirectional and its opposite is '{@link org.topcased.requirement.HierarchicalElement#getParent <em>Parent</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Children</em>' containment reference list isn't clear, there really should be more of * a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Children</em>' containment reference list. * @see org.topcased.requirement.RequirementPackage#getHierarchicalElement_Children() * @see org.topcased.requirement.HierarchicalElement#getParent * @model opposite="parent" containment="true" resolveProxies="true" * @generated */
Returns the value of the 'Children' containment reference list. The list contents are of type <code>org.topcased.requirement.HierarchicalElement</code>. It is bidirectional and its opposite is '<code>org.topcased.requirement.HierarchicalElement#getParent Parent</code>'. If the meaning of the 'Children' containment reference list isn't clear, there really should be more of a description here...
getChildren
{ "repo_name": "pgaufillet/topcased-req", "path": "plugins/org.topcased.requirement/src/org/topcased/requirement/HierarchicalElement.java", "license": "epl-1.0", "size": 5820 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,618,010
public List<TrackPoint> getPoints() { return points; }
List<TrackPoint> function() { return points; }
/** * A list of the TrackPoints which comprise this track * * @return A list of the TrackPoints which comprise this track */
A list of the TrackPoints which comprise this track
getPoints
{ "repo_name": "spohnan/geowave", "path": "extensions/formats/stanag4676/format/src/main/java/org/locationtech/geowave/format/stanag4676/parser/model/Track.java", "license": "apache-2.0", "size": 5723 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,423,602
public MetaProperty<ObservableSource> observableSource() { return observableSource; }
MetaProperty<ObservableSource> function() { return observableSource; }
/** * The meta-property for the {@code observableSource} property. * @return the meta-property, not null */
The meta-property for the observableSource property
observableSource
{ "repo_name": "jmptrader/Strata", "path": "modules/market/src/main/java/com/opengamma/strata/market/observable/QuoteId.java", "license": "apache-2.0", "size": 15494 }
[ "com.opengamma.strata.data.ObservableSource", "org.joda.beans.MetaProperty" ]
import com.opengamma.strata.data.ObservableSource; import org.joda.beans.MetaProperty;
import com.opengamma.strata.data.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
2,676,282
public long numCqsOnRegion(String regionName){ GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); if (cache == null) { return 0; } LogWriterI18n logger = cache.getLoggerI18n(); DefaultQueryService queryService = (DefaultQueryService)cache.getQueryService(); CqService cqService = null; try { cqService = queryService.getCqService(); } catch (CqException e) { if (logger.fineEnabled()) { logger.fine("Failed to get CqService" + e.getLocalizedMessage()); } e.printStackTrace(); return -1; // We're confused } if (cqService.isServer()) { try { FilterProfile fp = cache.getFilterProfile(regionName); if (fp == null) { return 0; } return fp.getCqCount(); } catch (Exception ex) { if (logger.fineEnabled()) { logger.fine("Failed to get serverside CQ count for region:" + regionName + ex.getLocalizedMessage()); } } } else { try { CqQuery[] cqs = queryService.getCqs(regionName); if (cqs != null) { return cqs.length; } } catch(Exception ex) { // Dont do anything. } } return 0; }
long function(String regionName){ GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); if (cache == null) { return 0; } LogWriterI18n logger = cache.getLoggerI18n(); DefaultQueryService queryService = (DefaultQueryService)cache.getQueryService(); CqService cqService = null; try { cqService = queryService.getCqService(); } catch (CqException e) { if (logger.fineEnabled()) { logger.fine(STR + e.getLocalizedMessage()); } e.printStackTrace(); return -1; } if (cqService.isServer()) { try { FilterProfile fp = cache.getFilterProfile(regionName); if (fp == null) { return 0; } return fp.getCqCount(); } catch (Exception ex) { if (logger.fineEnabled()) { logger.fine(STR + regionName + ex.getLocalizedMessage()); } } } else { try { CqQuery[] cqs = queryService.getCqs(regionName); if (cqs != null) { return cqs.length; } } catch(Exception ex) { } } return 0; }
/** * This is a test method. It silently ignores exceptions and should not be * used outside of unit tests.<p> * Returns the number of CQs (active + suspended) on the given region. * @param regionName */
This is a test method. It silently ignores exceptions and should not be used outside of unit tests. Returns the number of CQs (active + suspended) on the given region
numCqsOnRegion
{ "repo_name": "papicella/snappy-store", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CqServiceVsdStats.java", "license": "apache-2.0", "size": 11927 }
[ "com.gemstone.gemfire.cache.query.CqException", "com.gemstone.gemfire.cache.query.CqQuery", "com.gemstone.gemfire.i18n.LogWriterI18n", "com.gemstone.gemfire.internal.cache.FilterProfile", "com.gemstone.gemfire.internal.cache.GemFireCacheImpl" ]
import com.gemstone.gemfire.cache.query.CqException; import com.gemstone.gemfire.cache.query.CqQuery; import com.gemstone.gemfire.i18n.LogWriterI18n; import com.gemstone.gemfire.internal.cache.FilterProfile; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.cache.query.*; import com.gemstone.gemfire.i18n.*; import com.gemstone.gemfire.internal.cache.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
160,926
@Test @Verifies(value = "should only allow one preferred name", method = "setPreferredName(ConceptName)") public void setPreferredName_shouldOnlyAllowOnePreferredName() throws Exception { Locale primaryLocale = Locale.US; Concept testConcept = createMockConcept(1, primaryLocale); ConceptName initialPreferred = createMockConceptName(3, primaryLocale, null, true); testConcept.addName(initialPreferred); Assert.assertEquals(true, initialPreferred.isLocalePreferred()); ConceptName newPreferredName = createMockConceptName(4, primaryLocale, null, false); testConcept.setPreferredName(newPreferredName); assertEquals(false, initialPreferred.isLocalePreferred()); assertEquals(true, newPreferredName.isLocalePreferred()); }
@Verifies(value = STR, method = STR) void function() throws Exception { Locale primaryLocale = Locale.US; Concept testConcept = createMockConcept(1, primaryLocale); ConceptName initialPreferred = createMockConceptName(3, primaryLocale, null, true); testConcept.addName(initialPreferred); Assert.assertEquals(true, initialPreferred.isLocalePreferred()); ConceptName newPreferredName = createMockConceptName(4, primaryLocale, null, false); testConcept.setPreferredName(newPreferredName); assertEquals(false, initialPreferred.isLocalePreferred()); assertEquals(true, newPreferredName.isLocalePreferred()); }
/** * The Concept should unmark the old conceptName as the locale preferred one to enforce the rule * that a each locale should have only one preferred name per concept * * @see Concept#setPreferredName(ConceptName) */
The Concept should unmark the old conceptName as the locale preferred one to enforce the rule that a each locale should have only one preferred name per concept
setPreferredName_shouldOnlyAllowOnePreferredName
{ "repo_name": "preethi29/openmrs-core", "path": "api/src/test/java/org/openmrs/ConceptTest.java", "license": "mpl-2.0", "size": 50207 }
[ "java.util.Locale", "org.junit.Assert", "org.openmrs.test.Verifies" ]
import java.util.Locale; import org.junit.Assert; import org.openmrs.test.Verifies;
import java.util.*; import org.junit.*; import org.openmrs.test.*;
[ "java.util", "org.junit", "org.openmrs.test" ]
java.util; org.junit; org.openmrs.test;
1,057,137
Collection<Result<T>> getResults();
Collection<Result<T>> getResults();
/** * Returns all available results. */
Returns all available results
getResults
{ "repo_name": "DECLARE-Project/fastpan", "path": "src/main/java/de/fakeller/performance/analysis/result/PerformanceResult.java", "license": "mit", "size": 1393 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
785,687
private String getFilterActualValueFromDictionaryValue( DimColumnResolvedFilterInfo dimColumnEvaluatorInfo, int dictionaryValue) throws IOException { String memberString; Dictionary forwardDictionary = FilterUtil .getForwardDictionaryCache(tableIdentifier, dimColumnEvaluatorInfo.getDimension()); memberString = forwardDictionary.getDictionaryValueForKey(dictionaryValue); if (null != memberString) { if (memberString.equals(CarbonCommonConstants.MEMBER_DEFAULT_VAL)) { memberString = null; } } return memberString; }
String function( DimColumnResolvedFilterInfo dimColumnEvaluatorInfo, int dictionaryValue) throws IOException { String memberString; Dictionary forwardDictionary = FilterUtil .getForwardDictionaryCache(tableIdentifier, dimColumnEvaluatorInfo.getDimension()); memberString = forwardDictionary.getDictionaryValueForKey(dictionaryValue); if (null != memberString) { if (memberString.equals(CarbonCommonConstants.MEMBER_DEFAULT_VAL)) { memberString = null; } } return memberString; }
/** * Read the actual filter member by passing the dictionary value from * the forward dictionary cache which which holds column wise cache * * @param dimColumnEvaluatorInfo * @param dictionaryValue * @return * @throws IOException */
Read the actual filter member by passing the dictionary value from the forward dictionary cache which which holds column wise cache
getFilterActualValueFromDictionaryValue
{ "repo_name": "ksimar/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java", "license": "apache-2.0", "size": 22353 }
[ "java.io.IOException", "org.apache.carbondata.core.cache.dictionary.Dictionary", "org.apache.carbondata.core.constants.CarbonCommonConstants", "org.apache.carbondata.core.scan.filter.FilterUtil", "org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo" ]
import java.io.IOException; import org.apache.carbondata.core.cache.dictionary.Dictionary; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.scan.filter.FilterUtil; import org.apache.carbondata.core.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
import java.io.*; import org.apache.carbondata.core.cache.dictionary.*; import org.apache.carbondata.core.constants.*; import org.apache.carbondata.core.scan.filter.*; import org.apache.carbondata.core.scan.filter.resolver.resolverinfo.*;
[ "java.io", "org.apache.carbondata" ]
java.io; org.apache.carbondata;
1,233,800
private void attachResource(ResourceInfo currentResource, ResourceInfo parentResource, Router router) throws ClassNotFoundException { String uriPattern = currentResource.getPath(); // If there is a parentResource, add its uriPattern to this one if (parentResource != null) { String parentUriPattern = parentResource.getPath(); if ((parentUriPattern.endsWith("/") == false) && (uriPattern.startsWith("/") == false)) { parentUriPattern += "/"; } uriPattern = parentUriPattern + uriPattern; currentResource.setPath(uriPattern); } else if (!uriPattern.startsWith("/")) { uriPattern = "/" + uriPattern; currentResource.setPath(uriPattern); } Finder finder = createFinder(router, uriPattern, currentResource); if (finder != null) { // Attach the resource itself router.attach(uriPattern, finder); } // Attach children of the resource for (ResourceInfo childResource : currentResource.getChildResources()) { attachResource(childResource, currentResource, router); } }
void function(ResourceInfo currentResource, ResourceInfo parentResource, Router router) throws ClassNotFoundException { String uriPattern = currentResource.getPath(); if (parentResource != null) { String parentUriPattern = parentResource.getPath(); if ((parentUriPattern.endsWith("/") == false) && (uriPattern.startsWith("/") == false)) { parentUriPattern += "/"; } uriPattern = parentUriPattern + uriPattern; currentResource.setPath(uriPattern); } else if (!uriPattern.startsWith("/")) { uriPattern = "/" + uriPattern; currentResource.setPath(uriPattern); } Finder finder = createFinder(router, uriPattern, currentResource); if (finder != null) { router.attach(uriPattern, finder); } for (ResourceInfo childResource : currentResource.getChildResources()) { attachResource(childResource, currentResource, router); } }
/** * Attaches a resource, as specified in a WADL document, to a specified * router, then recursively attaches its child resources. * * @param currentResource * The resource to attach. * @param parentResource * The parent resource. Needed to correctly resolve the "path" of * the resource. Should be null if the resource is root-level. * @param router * The router to which to attach the resource and its children. * @throws ClassNotFoundException * If the class name specified in the "id" attribute of the * resource does not exist, this exception will be thrown. */
Attaches a resource, as specified in a WADL document, to a specified router, then recursively attaches its child resources
attachResource
{ "repo_name": "theanuradha/debrief", "path": "org.mwc.asset.comms/docs/restlet_src/org.restlet.ext.wadl/org/restlet/ext/wadl/WadlApplication.java", "license": "epl-1.0", "size": 31844 }
[ "org.restlet.resource.Finder", "org.restlet.routing.Router" ]
import org.restlet.resource.Finder; import org.restlet.routing.Router;
import org.restlet.resource.*; import org.restlet.routing.*;
[ "org.restlet.resource", "org.restlet.routing" ]
org.restlet.resource; org.restlet.routing;
2,796,486
protected void processObjtAcctActual(Balance balance) { currentSfbl.setAccountActualExpenditureAmt(currentSfbl.getAccountActualExpenditureAmt().add(balance.getAccountLineAnnualBalanceAmount())); }
void function(Balance balance) { currentSfbl.setAccountActualExpenditureAmt(currentSfbl.getAccountActualExpenditureAmt().add(balance.getAccountLineAnnualBalanceAmount())); }
/** * Updates the current sufficient fund balance record with a non-cash actual balance * * @param balance the cash encumbrance balance to update the sufficient funds balance with */
Updates the current sufficient fund balance record with a non-cash actual balance
processObjtAcctActual
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-core/src/main/java/org/kuali/kfs/gl/batch/service/impl/SufficientFundsAccountUpdateServiceImpl.java", "license": "agpl-3.0", "size": 24295 }
[ "org.kuali.kfs.gl.businessobject.Balance" ]
import org.kuali.kfs.gl.businessobject.Balance;
import org.kuali.kfs.gl.businessobject.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
2,358,987
return e instanceof AmazonServiceException && parseOperationNotAllowedException((AmazonServiceException) e) != null; }
return e instanceof AmazonServiceException && parseOperationNotAllowedException((AmazonServiceException) e) != null; }
/** * Returns true if the given service exception indicates that the current * IAM user doesn't have sufficient permission to perform the operation. */
Returns true if the given service exception indicates that the current IAM user doesn't have sufficient permission to perform the operation
isOperationNotAllowedException
{ "repo_name": "zhangzhx/aws-toolkit-eclipse", "path": "bundles/com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/diagnostic/utils/ServiceExceptionParser.java", "license": "apache-2.0", "size": 2660 }
[ "com.amazonaws.AmazonServiceException" ]
import com.amazonaws.AmazonServiceException;
import com.amazonaws.*;
[ "com.amazonaws" ]
com.amazonaws;
493,105
public Collection<User> getAll();
Collection<User> function();
/** * Gets all Users from the store. * * @return All Users. * @throws Exception */
Gets all Users from the store
getAll
{ "repo_name": "rcassola/DigiCard", "path": "src/main/java/br/com/digicard/store/UserStore.java", "license": "apache-2.0", "size": 1363 }
[ "br.com.digicard.vo.User", "java.util.Collection" ]
import br.com.digicard.vo.User; import java.util.Collection;
import br.com.digicard.vo.*; import java.util.*;
[ "br.com.digicard", "java.util" ]
br.com.digicard; java.util;
1,490,734
public void property(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { // Unknown property return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); styleDeclaration.append(v, i, important); } } } protected class StyleSheetDocumentHandler extends DocumentAdapter implements ShorthandManager.PropertyHandler { public StyleSheet styleSheet; protected StyleRule styleRule; protected StyleDeclaration styleDeclaration;
void function(String name, LexicalUnit value, boolean important) throws CSSException { int i = getPropertyIndex(name); if (i == -1) { i = getShorthandIndex(name); if (i == -1) { return; } shorthandManagers[i].setValues(CSSEngine.this, this, value, important); } else { Value v = valueManagers[i].createValue(value, CSSEngine.this); styleDeclaration.append(v, i, important); } } } protected class StyleSheetDocumentHandler extends DocumentAdapter implements ShorthandManager.PropertyHandler { public StyleSheet styleSheet; protected StyleRule styleRule; protected StyleDeclaration styleDeclaration;
/** * <b>SAC</b>: Implements {@link * DocumentHandler#property(String,LexicalUnit,boolean)}. */
SAC: Implements <code>DocumentHandler#property(String,LexicalUnit,boolean)</code>
property
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/css/engine/CSSEngine.java", "license": "apache-2.0", "size": 91557 }
[ "org.apache.batik.css.engine.value.ShorthandManager", "org.apache.batik.css.engine.value.Value", "org.w3c.css.sac.CSSException", "org.w3c.css.sac.LexicalUnit" ]
import org.apache.batik.css.engine.value.ShorthandManager; import org.apache.batik.css.engine.value.Value; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.LexicalUnit;
import org.apache.batik.css.engine.value.*; import org.w3c.css.sac.*;
[ "org.apache.batik", "org.w3c.css" ]
org.apache.batik; org.w3c.css;
2,180,661
public void testFindDomainBounds() { XYSeriesCollection dataset = RendererXYPackageTests.createTestXYSeriesCollection(); JFreeChart chart = ChartFactory.createXYLineChart( "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); Range bounds = domainAxis.getRange(); assertFalse(bounds.contains(0.9)); assertTrue(bounds.contains(1.0)); assertTrue(bounds.contains(2.0)); assertFalse(bounds.contains(2.10)); }
void function() { XYSeriesCollection dataset = RendererXYPackageTests.createTestXYSeriesCollection(); JFreeChart chart = ChartFactory.createXYLineChart( STR, "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); Range bounds = domainAxis.getRange(); assertFalse(bounds.contains(0.9)); assertTrue(bounds.contains(1.0)); assertTrue(bounds.contains(2.0)); assertFalse(bounds.contains(2.10)); }
/** * Check that the renderer is calculating the domain bounds correctly. */
Check that the renderer is calculating the domain bounds correctly
testFindDomainBounds
{ "repo_name": "JSansalone/JFreeChart", "path": "tests/org/jfree/chart/renderer/xy/junit/XYLineAndShapeRendererTests.java", "license": "lgpl-2.1", "size": 11709 }
[ "org.jfree.chart.ChartFactory", "org.jfree.chart.JFreeChart", "org.jfree.chart.axis.NumberAxis", "org.jfree.chart.plot.PlotOrientation", "org.jfree.chart.plot.XYPlot", "org.jfree.data.Range", "org.jfree.data.xy.XYSeriesCollection" ]
import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.Range; import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.chart.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.data.*; import org.jfree.data.xy.*;
[ "org.jfree.chart", "org.jfree.data" ]
org.jfree.chart; org.jfree.data;
1,756,705
return SecurityContextHolder.getContext().getAuthentication() != null; }
return SecurityContextHolder.getContext().getAuthentication() != null; }
/** * Determine if the current thread is from servlet context. * * @return true if it's servlet context. */
Determine if the current thread is from servlet context
isAuthenticationContext
{ "repo_name": "naver/ngrinder", "path": "ngrinder-controller/src/main/java/org/ngrinder/infra/spring/SpringContext.java", "license": "apache-2.0", "size": 1398 }
[ "org.springframework.security.core.context.SecurityContextHolder" ]
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.*;
[ "org.springframework.security" ]
org.springframework.security;
559,841
@Override protected double doEvaluate(Instance inst) { double result; double width; double[][] intervals; try { intervals = ((IntervalEstimator) m_Classifier).predictIntervals(inst, m_ConfidenceLevel); width = calcAverageWidth(intervals); if (m_RelativeWidths) { if (inst.classValue() == 0) width = Double.MAX_VALUE; else width /= inst.classValue(); } if (width < m_MinWidth) { result = 1.0; } else if (width > m_MaxWidth) { // width = max => 0.5 // width >= 2*max => 1.0 width -= m_MaxWidth; if (width > m_MaxWidth) result = 0.0; else result = 0.5 - width / m_MaxWidth / 2; } else { // width = min => 1.0 // width = max => 0.5 result = 1 - (width - m_MinWidth) / (m_MaxWidth - m_MinWidth) / 2; } } catch (Exception e) { getLogger().log(Level.SEVERE, "Failed to evaluate", e); result = -1; } return result; }
double function(Instance inst) { double result; double width; double[][] intervals; try { intervals = ((IntervalEstimator) m_Classifier).predictIntervals(inst, m_ConfidenceLevel); width = calcAverageWidth(intervals); if (m_RelativeWidths) { if (inst.classValue() == 0) width = Double.MAX_VALUE; else width /= inst.classValue(); } if (width < m_MinWidth) { result = 1.0; } else if (width > m_MaxWidth) { width -= m_MaxWidth; if (width > m_MaxWidth) result = 0.0; else result = 0.5 - width / m_MaxWidth / 2; } else { result = 1 - (width - m_MinWidth) / (m_MaxWidth - m_MinWidth) / 2; } } catch (Exception e) { getLogger().log(Level.SEVERE, STR, e); result = -1; } return result; }
/** * Performs the actual evaluation. * * @param inst the instance to evaluate * @return evaluation range, between 0 and 1 (0 = bad, 1 = good, -1 = if unable to evaluate) */
Performs the actual evaluation
doEvaluate
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-weka/src/main/java/adams/data/weka/evaluator/IntervalEstimatorBased.java", "license": "gpl-3.0", "size": 13472 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
2,112,843
protected mxRectangle computeAspect(mxCellState state, mxRectangle bounds, String direction) { double x0 = bounds.getX(); double y0 = bounds.getY(); double sx = bounds.getWidth() / w0; double sy = bounds.getHeight() / h0; boolean inverse = (direction != null && (direction.equals("north") || direction .equals("south"))); if (inverse) { sy = bounds.getWidth() / h0; sx = bounds.getHeight() / w0; double delta = (bounds.getWidth() - bounds.getHeight()) / 2; x0 += delta; y0 -= delta; } if (aspect.equals("fixed")) { sy = Math.min(sx, sy); sx = sy; // Centers the shape inside the available space if (inverse) { x0 += (bounds.getHeight() - this.w0 * sx) / 2; y0 += (bounds.getWidth() - this.h0 * sy) / 2; } else { x0 += (bounds.getWidth() - this.w0 * sx) / 2; y0 += (bounds.getHeight() - this.h0 * sy) / 2; } } return new mxRectangle(x0, y0, sx, sy); }
mxRectangle function(mxCellState state, mxRectangle bounds, String direction) { double x0 = bounds.getX(); double y0 = bounds.getY(); double sx = bounds.getWidth() / w0; double sy = bounds.getHeight() / h0; boolean inverse = (direction != null && (direction.equals("north") direction .equals("south"))); if (inverse) { sy = bounds.getWidth() / h0; sx = bounds.getHeight() / w0; double delta = (bounds.getWidth() - bounds.getHeight()) / 2; x0 += delta; y0 -= delta; } if (aspect.equals("fixed")) { sy = Math.min(sx, sy); sx = sy; if (inverse) { x0 += (bounds.getHeight() - this.w0 * sx) / 2; y0 += (bounds.getWidth() - this.h0 * sy) / 2; } else { x0 += (bounds.getWidth() - this.w0 * sx) / 2; y0 += (bounds.getHeight() - this.h0 * sy) / 2; } } return new mxRectangle(x0, y0, sx, sy); }
/** * Returns a rectangle that contains the offset in x and y and the horizontal * and vertical scale in width and height used to draw this shape inside the * given rectangle. */
Returns a rectangle that contains the offset in x and y and the horizontal and vertical scale in width and height used to draw this shape inside the given rectangle
computeAspect
{ "repo_name": "md-k-sarker/OWLAx", "path": "src/main/java/com/mxgraph/shape/mxStencil.java", "license": "bsd-2-clause", "size": 17800 }
[ "com.mxgraph.util.mxRectangle" ]
import com.mxgraph.util.mxRectangle;
import com.mxgraph.util.*;
[ "com.mxgraph.util" ]
com.mxgraph.util;
2,337,493
public default List<Boolean> removeAll(Collection<T> elements) { return elements.stream().map(this::remove).collect(Collectors.toList()); }
default List<Boolean> function(Collection<T> elements) { return elements.stream().map(this::remove).collect(Collectors.toList()); }
/** * Removes the objects from the counting bloom filter. * * @param elements objects to be deleted * @return a list of booleans indicating for each element, whether it was removed */
Removes the objects from the counting bloom filter
removeAll
{ "repo_name": "haohailuo/Orestes-Bloomfilter", "path": "src/main/java/orestes/bloomfilter/CountingBloomFilter.java", "license": "mit", "size": 3668 }
[ "java.util.Collection", "java.util.List", "java.util.stream.Collectors" ]
import java.util.Collection; import java.util.List; import java.util.stream.Collectors;
import java.util.*; import java.util.stream.*;
[ "java.util" ]
java.util;
1,900,122
protected void doExecuteCommand() { if(!ValkyrieRepository.getInstance().getApplicationConfig().applicationSecurityManager().isSecuritySupported()) { return ; } CompositeDialogPage tabbedPage = new TabbedDialogPage( "loginForm" ); final LoginForm loginForm = createLoginForm(); tabbedPage.addForm( loginForm ); if( getDefaultUserName() != null ) { loginForm.setUserName( getDefaultUserName() ); }
void function() { if(!ValkyrieRepository.getInstance().getApplicationConfig().applicationSecurityManager().isSecuritySupported()) { return ; } CompositeDialogPage tabbedPage = new TabbedDialogPage( STR ); final LoginForm loginForm = createLoginForm(); tabbedPage.addForm( loginForm ); if( getDefaultUserName() != null ) { loginForm.setUserName( getDefaultUserName() ); }
/** * Execute the login command. Display the dialog and attempt authentication. */
Execute the login command. Display the dialog and attempt authentication
doExecuteCommand
{ "repo_name": "lievendoclo/Valkyrie-RCP", "path": "valkyrie-rcp-core/src/main/java/org/valkyriercp/security/LoginCommand.java", "license": "apache-2.0", "size": 6426 }
[ "org.valkyriercp.dialog.CompositeDialogPage", "org.valkyriercp.dialog.TabbedDialogPage", "org.valkyriercp.util.ValkyrieRepository" ]
import org.valkyriercp.dialog.CompositeDialogPage; import org.valkyriercp.dialog.TabbedDialogPage; import org.valkyriercp.util.ValkyrieRepository;
import org.valkyriercp.dialog.*; import org.valkyriercp.util.*;
[ "org.valkyriercp.dialog", "org.valkyriercp.util" ]
org.valkyriercp.dialog; org.valkyriercp.util;
958,840
public Integer validate(String value) { return (Integer)parse(value, (String)null, (Locale)null); }
Integer function(String value) { return (Integer)parse(value, (String)null, (Locale)null); }
/** * <p>Validate/convert an <code>Integer</code> using the default * <code>Locale</code>. * * @param value The value validation is being performed on. * @return The parsed <code>Integer</code> if valid or <code>null</code> * if invalid. */
Validate/convert an <code>Integer</code> using the default <code>Locale</code>
validate
{ "repo_name": "floscher/commons-validator", "path": "src/main/java/org/apache/commons/validator/routines/IntegerValidator.java", "license": "apache-2.0", "size": 9726 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,799,076
public static final void writeLongArrayXml(long[] val, String name, XmlSerializer out) throws XmlPullParserException, java.io.IOException { if (val == null) { out.startTag(null, "null"); out.endTag(null, "null"); return; } out.startTag(null, "long-array"); if (name != null) { out.attribute(null, "name", name); } final int n = val.length; out.attribute(null, "num", Integer.toString(n)); for (int i=0; i<n; i++) { out.startTag(null, "item"); out.attribute(null, "value", Long.toString(val[i])); out.endTag(null, "item"); } out.endTag(null, "long-array"); }
static final void function(long[] val, String name, XmlSerializer out) throws XmlPullParserException, java.io.IOException { if (val == null) { out.startTag(null, "null"); out.endTag(null, "null"); return; } out.startTag(null, STR); if (name != null) { out.attribute(null, "name", name); } final int n = val.length; out.attribute(null, "num", Integer.toString(n)); for (int i=0; i<n; i++) { out.startTag(null, "item"); out.attribute(null, "value", Long.toString(val[i])); out.endTag(null, "item"); } out.endTag(null, STR); }
/** * Flatten a long[] into an XmlSerializer. The list can later be read back * with readThisLongArrayXml(). * * @param val The long array to be flattened. * @param name Name attribute to include with this array's tag, or null for * none. * @param out XmlSerializer to write the array into. * * @see #writeMapXml * @see #writeValueXml * @see #readThisIntArrayXml */
Flatten a long[] into an XmlSerializer. The list can later be read back with readThisLongArrayXml()
writeLongArrayXml
{ "repo_name": "evernote/android-job", "path": "library/src/main/java/com/evernote/android/job/util/support/XmlUtils.java", "license": "apache-2.0", "size": 57300 }
[ "java.io.IOException", "org.xmlpull.v1.XmlPullParserException", "org.xmlpull.v1.XmlSerializer" ]
import java.io.IOException; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
348,295
static Class<?> mainClass() { for (Map.Entry<Thread, StackTraceElement[]> stackEntry : Thread.getAllStackTraces().entrySet()) { // thread must be called "main" if ("main".equals(stackEntry.getKey().getName())) { StackTraceElement[] stack = stackEntry.getValue(); StackTraceElement bottom = stack[stack.length - 1]; // method must be called main if ("main".equals(bottom.getMethodName())) { try { return Class.forName(bottom.getClassName()); } catch (ClassNotFoundException e) { // can't load class for some reason... return Bootique.class; } } else { // no other ideas where else to look for main... return Bootique.class; } } } // failover... return Bootique.class; }
static Class<?> mainClass() { for (Map.Entry<Thread, StackTraceElement[]> stackEntry : Thread.getAllStackTraces().entrySet()) { if ("main".equals(stackEntry.getKey().getName())) { StackTraceElement[] stack = stackEntry.getValue(); StackTraceElement bottom = stack[stack.length - 1]; if ("main".equals(bottom.getMethodName())) { try { return Class.forName(bottom.getClassName()); } catch (ClassNotFoundException e) { return Bootique.class; } } else { return Bootique.class; } } } return Bootique.class; }
/** * Returns the name of the app main class. If it can't be found, return 'io.bootique.Bootique'. * * @return the name of the app main class. */
Returns the name of the app main class. If it can't be found, return 'io.bootique.Bootique'
mainClass
{ "repo_name": "bootique/bootique", "path": "bootique/src/main/java/io/bootique/meta/application/ApplicationIntrospector.java", "license": "apache-2.0", "size": 3377 }
[ "io.bootique.Bootique", "java.util.Map" ]
import io.bootique.Bootique; import java.util.Map;
import io.bootique.*; import java.util.*;
[ "io.bootique", "java.util" ]
io.bootique; java.util;
412,515
public ActionForward startWizard(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward(KFSConstants.MAPPING_BASIC); }
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward(KFSConstants.MAPPING_BASIC); }
/** * This method is the starting point for the deposit document wizard. * * @param mapping * @param form * @param request * @param response * @return ActionForward * @throws Exception */
This method is the starting point for the deposit document wizard
startWizard
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-core/src/main/java/org/kuali/kfs/fp/document/web/struts/DepositWizardAction.java", "license": "agpl-3.0", "size": 49729 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.kuali.kfs.sys.KFSConstants" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.kfs.sys.KFSConstants;
import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kfs.sys.*;
[ "javax.servlet", "org.apache.struts", "org.kuali.kfs" ]
javax.servlet; org.apache.struts; org.kuali.kfs;
243,472
public void storeRevisionContent( Uri uri, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent) throws ServiceAccessException, RevisionNotFoundException { adapter.storeRevisionContent(getCurrentConnection(), uri, revisionDescriptor, revisionContent); }
void function( Uri uri, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent) throws ServiceAccessException, RevisionNotFoundException { adapter.storeRevisionContent(getCurrentConnection(), uri, revisionDescriptor, revisionContent); }
/** * Modify the latest revision of an object. * * @param uri Uri * @param revisionDescriptor Node revision descriptor * @param revisionContent Node revision content */
Modify the latest revision of an object
storeRevisionContent
{ "repo_name": "integrated/jakarta-slide-server", "path": "src/stores/org/apache/slide/store/impl/rdbms/AbstractRDBMSStore.java", "license": "apache-2.0", "size": 35108 }
[ "org.apache.slide.common.ServiceAccessException", "org.apache.slide.common.Uri", "org.apache.slide.content.NodeRevisionContent", "org.apache.slide.content.NodeRevisionDescriptor", "org.apache.slide.content.RevisionNotFoundException" ]
import org.apache.slide.common.ServiceAccessException; import org.apache.slide.common.Uri; import org.apache.slide.content.NodeRevisionContent; import org.apache.slide.content.NodeRevisionDescriptor; import org.apache.slide.content.RevisionNotFoundException;
import org.apache.slide.common.*; import org.apache.slide.content.*;
[ "org.apache.slide" ]
org.apache.slide;
198,546
static void testSortingConfiguration( I_CmsSearchConfigurationSorting expectedConfig, I_CmsSearchConfigurationSorting actualConfig) { if (null == expectedConfig) { assertNull(actualConfig); return; } assertNotNull(actualConfig); assertEquals(expectedConfig.getSortParam(), actualConfig.getSortParam()); assertEquals(expectedConfig.getSortOptions().size(), actualConfig.getSortOptions().size()); testSortOptionConfiguration(expectedConfig.getDefaultSortOption(), actualConfig.getDefaultSortOption()); Iterator<I_CmsSearchConfigurationSortOption> expectedIterator = expectedConfig.getSortOptions().iterator(); Iterator<I_CmsSearchConfigurationSortOption> actualIterator = actualConfig.getSortOptions().iterator(); while (expectedIterator.hasNext()) { testSortOptionConfiguration(expectedIterator.next(), actualIterator.next()); } }
static void testSortingConfiguration( I_CmsSearchConfigurationSorting expectedConfig, I_CmsSearchConfigurationSorting actualConfig) { if (null == expectedConfig) { assertNull(actualConfig); return; } assertNotNull(actualConfig); assertEquals(expectedConfig.getSortParam(), actualConfig.getSortParam()); assertEquals(expectedConfig.getSortOptions().size(), actualConfig.getSortOptions().size()); testSortOptionConfiguration(expectedConfig.getDefaultSortOption(), actualConfig.getDefaultSortOption()); Iterator<I_CmsSearchConfigurationSortOption> expectedIterator = expectedConfig.getSortOptions().iterator(); Iterator<I_CmsSearchConfigurationSortOption> actualIterator = actualConfig.getSortOptions().iterator(); while (expectedIterator.hasNext()) { testSortOptionConfiguration(expectedIterator.next(), actualIterator.next()); } }
/** * Tests if expected and actual configuration are identically. * @param expectedConfig the expected configuration * @param actualConfig the actual configuration */
Tests if expected and actual configuration are identically
testSortingConfiguration
{ "repo_name": "alkacon/opencms-core", "path": "test/org/opencms/jsp/search/config/parser/ConfigurationTester.java", "license": "lgpl-2.1", "size": 15912 }
[ "java.util.Iterator", "org.junit.Assert" ]
import java.util.Iterator; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
771,295
public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
GradientPaintTransformer function() { return this.gradientPaintTransformer; }
/** * Returns the gradient paint transformer. * * @return The gradient paint transformer (possibly <code>null</code>). */
Returns the gradient paint transformer
getGradientPaintTransformer
{ "repo_name": "oskopek/jfreechart-fse", "path": "src/main/java/org/jfree/chart/plot/IntervalMarker.java", "license": "lgpl-2.1", "size": 7597 }
[ "org.jfree.chart.ui.GradientPaintTransformer" ]
import org.jfree.chart.ui.GradientPaintTransformer;
import org.jfree.chart.ui.*;
[ "org.jfree.chart" ]
org.jfree.chart;
973,116
public com.squareup.okhttp.Call getSchoolForSectionAsync(String id, final ApiCallback<SchoolResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
com.squareup.okhttp.Call function(String id, final ApiCallback<SchoolResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
/** * (asynchronously) * Returns the school for a section * @param id (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */
(asynchronously) Returns the school for a section
getSchoolForSectionAsync
{ "repo_name": "bclemenzi/clever-java", "path": "src/main/java/io/swagger/client/api/SectionsApi.java", "license": "gpl-3.0", "size": 57148 }
[ "io.swagger.client.ApiCallback", "io.swagger.client.ApiException", "io.swagger.client.ProgressRequestBody", "io.swagger.client.ProgressResponseBody", "io.swagger.client.model.SchoolResponse" ]
import io.swagger.client.ApiCallback; import io.swagger.client.ApiException; import io.swagger.client.ProgressRequestBody; import io.swagger.client.ProgressResponseBody; import io.swagger.client.model.SchoolResponse;
import io.swagger.client.*; import io.swagger.client.model.*;
[ "io.swagger.client" ]
io.swagger.client;
133,191
private void removeRule(Device device, PacketRequest request) { if (!device.type().equals(Device.Type.SWITCH)) { return; }
void function(Device device, PacketRequest request) { if (!device.type().equals(Device.Type.SWITCH)) { return; }
/** * Removes packet intercept flow rules from the device. * * @param device the device to remove the rules deom * @param request the packet request */
Removes packet intercept flow rules from the device
removeRule
{ "repo_name": "wuwenbin2/onos_bgp_evpn", "path": "core/net/src/main/java/org/onosproject/net/packet/impl/PacketManager.java", "license": "apache-2.0", "size": 17325 }
[ "org.onosproject.net.Device", "org.onosproject.net.packet.PacketRequest" ]
import org.onosproject.net.Device; import org.onosproject.net.packet.PacketRequest;
import org.onosproject.net.*; import org.onosproject.net.packet.*;
[ "org.onosproject.net" ]
org.onosproject.net;
1,634,229
private void closeNetworkResources() { for (ResultPartitionWriter partitionWriter : consumableNotifyingPartitionWriters) { try { partitionWriter.close(); } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); LOG.error("Failed to release result partition for task {}.", taskNameWithSubtask, t); } } for (InputGate inputGate : inputGates) { try { inputGate.close(); } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); LOG.error("Failed to release input gate for task {}.", taskNameWithSubtask, t); } } }
void function() { for (ResultPartitionWriter partitionWriter : consumableNotifyingPartitionWriters) { try { partitionWriter.close(); } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); LOG.error(STR, taskNameWithSubtask, t); } } for (InputGate inputGate : inputGates) { try { inputGate.close(); } catch (Throwable t) { ExceptionUtils.rethrowIfFatalError(t); LOG.error(STR, taskNameWithSubtask, t); } } }
/** * There are two scenarios to close the network resources. One is from {@link TaskCanceler} to early * release partitions and gates. Another is from task thread during task exiting. */
There are two scenarios to close the network resources. One is from <code>TaskCanceler</code> to early release partitions and gates. Another is from task thread during task exiting
closeNetworkResources
{ "repo_name": "tzulitai/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java", "license": "apache-2.0", "size": 59010 }
[ "org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter", "org.apache.flink.runtime.io.network.partition.consumer.InputGate", "org.apache.flink.util.ExceptionUtils" ]
import org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter; import org.apache.flink.runtime.io.network.partition.consumer.InputGate; import org.apache.flink.util.ExceptionUtils;
import org.apache.flink.runtime.io.network.api.writer.*; import org.apache.flink.runtime.io.network.partition.consumer.*; import org.apache.flink.util.*;
[ "org.apache.flink" ]
org.apache.flink;
1,131,601
protected boolean handleDirtyConflict() { return MessageDialog.openQuestion (getSite().getShell(), getString("_UI_FileConflict_label"), getString("_WARN_FileConflict")); } public QasvariabilitymodelEditor() { super(); initializeEditingDomain(); }
boolean function() { return MessageDialog.openQuestion (getSite().getShell(), getString(STR), getString(STR)); } public QasvariabilitymodelEditor() { super(); initializeEditingDomain(); }
/** * Shows a dialog that asks if conflicting changes should be discarded. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Shows a dialog that asks if conflicting changes should be discarded.
handleDirtyConflict
{ "repo_name": "unicesi/QD-SPL", "path": "ToolSupport/co.edu.icesi.shift.qaconfig.editor/src/qasvariabilitymodel/presentation/QasvariabilitymodelEditor.java", "license": "lgpl-3.0", "size": 54313 }
[ "org.eclipse.jface.dialogs.MessageDialog" ]
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
86,428
GetMultipleDataResult search(String searchQuery, Map<String, String[]> filters, int from, int size);
GetMultipleDataResult search(String searchQuery, Map<String, String[]> filters, int from, int size);
/** * Search for groups. * * @param searchQuery the search query text. * @param filters filters to apply * @param from offset from the first result you want to fetch. * @param size maximum amount of {@link Group} to be returned. */
Search for groups
search
{ "repo_name": "igorng/alien4cloud", "path": "alien4cloud-security/src/main/java/alien4cloud/security/groups/IAlienGroupDao.java", "license": "apache-2.0", "size": 1696 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
177,927
protected SecretKey engineTranslateKey(SecretKey key) throws InvalidKeyException { try { if ((key != null) && (key.getAlgorithm().equalsIgnoreCase("DESede")) && (key.getFormat().equalsIgnoreCase("RAW"))) { // Check if key originates from this factory if (key instanceof com.sun.crypto.provider.DESedeKey) { return key; } // Convert key to spec DESedeKeySpec desEdeKeySpec = (DESedeKeySpec)engineGetKeySpec(key, DESedeKeySpec.class); // Create key from spec, and return it return engineGenerateSecret(desEdeKeySpec); } else { throw new InvalidKeyException ("Inappropriate key format/algorithm"); } } catch (InvalidKeySpecException e) { throw new InvalidKeyException("Cannot translate key"); } }
SecretKey function(SecretKey key) throws InvalidKeyException { try { if ((key != null) && (key.getAlgorithm().equalsIgnoreCase(STR)) && (key.getFormat().equalsIgnoreCase("RAW"))) { if (key instanceof com.sun.crypto.provider.DESedeKey) { return key; } DESedeKeySpec desEdeKeySpec = (DESedeKeySpec)engineGetKeySpec(key, DESedeKeySpec.class); return engineGenerateSecret(desEdeKeySpec); } else { throw new InvalidKeyException (STR); } } catch (InvalidKeySpecException e) { throw new InvalidKeyException(STR); } }
/** * Translates a <code>SecretKey</code> object, whose provider may be * unknown or potentially untrusted, into a corresponding * <code>SecretKey</code> object of this key factory. * * @param key the key whose provider is unknown or untrusted * * @return the translated key * * @exception InvalidKeyException if the given key cannot be processed by * this key factory. */
Translates a <code>SecretKey</code> object, whose provider may be unknown or potentially untrusted, into a corresponding <code>SecretKey</code> object of this key factory
engineTranslateKey
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk/jdk/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java", "license": "mit", "size": 5724 }
[ "java.security.InvalidKeyException", "java.security.spec.InvalidKeySpecException", "javax.crypto.SecretKey", "javax.crypto.spec.DESedeKeySpec" ]
import java.security.InvalidKeyException; import java.security.spec.InvalidKeySpecException; import javax.crypto.SecretKey; import javax.crypto.spec.DESedeKeySpec;
import java.security.*; import java.security.spec.*; import javax.crypto.*; import javax.crypto.spec.*;
[ "java.security", "javax.crypto" ]
java.security; javax.crypto;
1,340,973
protected void minimizeFrame(JInternalFrame f) { getDesktopManager().minimizeFrame(f); }
void function(JInternalFrame f) { getDesktopManager().minimizeFrame(f); }
/** * This is a convenience method that minimizes the JInternalFrame. * * @param f The JInternalFrame to minimize. */
This is a convenience method that minimizes the JInternalFrame
minimizeFrame
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java", "license": "gpl-2.0", "size": 49056 }
[ "javax.swing.JInternalFrame" ]
import javax.swing.JInternalFrame;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
612,544
public void testAddPrimaryKeyColumn() { final String MODEL1 = "<?xml version='1.0' encoding='ISO-8859-1'?>\n" + "<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='test'>\n" + " <table name='TableA'>\n" + " <column name='ColPK2' type='INTEGER' required='true'/>\n" + " </table>\n" + "</database>"; final String MODEL2 = "<?xml version='1.0' encoding='ISO-8859-1'?>\n" + "<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='test'>\n" + " <table name='TableA'>\n" + " <column name='ColPK1' type='INTEGER' primaryKey='true' required='true'/>\n" + " <column name='ColPK2' type='INTEGER' required='true'/>\n" + " </table>\n" + "</database>"; Database model1 = parseDatabaseFromString(MODEL1); Database model2 = parseDatabaseFromString(MODEL2); List changes = getPlatform(true).getChanges(model1, model2); assertEquals(2, changes.size()); AddColumnChange colChange = (AddColumnChange)changes.get(0); AddPrimaryKeyChange pkChange = (AddPrimaryKeyChange)changes.get(1); assertEquals("TableA", colChange.getChangedTable()); assertColumn("ColPK1", Types.INTEGER, null, null, false, true, false, colChange.getNewColumn()); assertNull(colChange.getPreviousColumn()); assertEquals("ColPK2", colChange.getNextColumn()); assertEquals("TableA", pkChange.getChangedTable()); assertEquals(1, pkChange.getPrimaryKeyColumns().length); assertEquals("ColPK1", pkChange.getPrimaryKeyColumns()[0]); }
void function() { final String MODEL1 = STR + STR + DatabaseIO.DDLUTILS_NAMESPACE + STR + STR + STR + STR + STR; final String MODEL2 = STR + STR + DatabaseIO.DDLUTILS_NAMESPACE + STR + STR + STR + STR + STR + STR; Database model1 = parseDatabaseFromString(MODEL1); Database model2 = parseDatabaseFromString(MODEL2); List changes = getPlatform(true).getChanges(model1, model2); assertEquals(2, changes.size()); AddColumnChange colChange = (AddColumnChange)changes.get(0); AddPrimaryKeyChange pkChange = (AddPrimaryKeyChange)changes.get(1); assertEquals(STR, colChange.getChangedTable()); assertColumn(STR, Types.INTEGER, null, null, false, true, false, colChange.getNewColumn()); assertNull(colChange.getPreviousColumn()); assertEquals(STR, colChange.getNextColumn()); assertEquals(STR, pkChange.getChangedTable()); assertEquals(1, pkChange.getPrimaryKeyColumns().length); assertEquals(STR, pkChange.getPrimaryKeyColumns()[0]); }
/** * Tests the addition of a column that is the primary key. */
Tests the addition of a column that is the primary key
testAddPrimaryKeyColumn
{ "repo_name": "qxo/ddlutils", "path": "src/test/java/org/apache/ddlutils/alteration/TestPrimaryKeyComparison.java", "license": "apache-2.0", "size": 24417 }
[ "java.sql.Types", "java.util.List", "org.apache.ddlutils.io.DatabaseIO", "org.apache.ddlutils.model.Database" ]
import java.sql.Types; import java.util.List; import org.apache.ddlutils.io.DatabaseIO; import org.apache.ddlutils.model.Database;
import java.sql.*; import java.util.*; import org.apache.ddlutils.io.*; import org.apache.ddlutils.model.*;
[ "java.sql", "java.util", "org.apache.ddlutils" ]
java.sql; java.util; org.apache.ddlutils;
91,502
@Nullable public static short[] optShortArray(@Nullable Bundle bundle, @Nullable String key) { return optShortArray(bundle, key, new short[0]); }
static short[] function(@Nullable Bundle bundle, @Nullable String key) { return optShortArray(bundle, key, new short[0]); }
/** * Returns a optional short array value. In other words, returns the value mapped by key if it exists and is a short array. * The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null. * @param bundle a bundle. If the bundle is null, this method will return null. * @param key a key for the value. * @return a short array value if exists, null otherwise. * @see android.os.Bundle#getShort(String, short) */
Returns a optional short array value. In other words, returns the value mapped by key if it exists and is a short array. The bundle argument is allowed to be null. If the bundle is null, this method returns null
optShortArray
{ "repo_name": "nohana/Amalgam", "path": "amalgam/src/main/java/com/amalgam/os/BundleUtils.java", "license": "apache-2.0", "size": 55053 }
[ "android.os.Bundle", "android.support.annotation.Nullable" ]
import android.os.Bundle; import android.support.annotation.Nullable;
import android.os.*; import android.support.annotation.*;
[ "android.os", "android.support" ]
android.os; android.support;
1,168,822
public void addbiboPresentedat( org.ontoware.rdf2go.model.node.Node value) { Base.add(this.model, this.getResource(), PRESENTEDAT, value); }
void function( org.ontoware.rdf2go.model.node.Node value) { Base.add(this.model, this.getResource(), PRESENTEDAT, value); }
/** * Adds a value to property Presentedat as an RDF2Go node * @param value the value to be added * * [Generated from RDFReactor template rule #add1dynamic] */
Adds a value to property Presentedat as an RDF2Go node
addbiboPresentedat
{ "repo_name": "alexgarciac/testbiotea", "path": "src/ws/biotea/ld2rdf/rdf/model/bibo/BiboEvent.java", "license": "apache-2.0", "size": 20852 }
[ "org.ontoware.rdfreactor.runtime.Base" ]
import org.ontoware.rdfreactor.runtime.Base;
import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.rdfreactor" ]
org.ontoware.rdfreactor;
1,725,734
try { out.startElement(ELEMENT_ROOT); out.println(); } catch(IOException e) {throw new CommandException(e);} }
try { out.startElement(ELEMENT_ROOT); out.println(); } catch(IOException e) {throw new CommandException(e);} }
/** * Opens the root XML element. */
Opens the root XML element
startBuilding
{ "repo_name": "raisercostin/mucommander-2", "path": "src/main/com/mucommander/command/AssociationWriter.java", "license": "gpl-3.0", "size": 5405 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,119,561
public void testNullSerializerConversion() { // SETUP String cacheName = "testName"; String key = "key"; String value = "value fdsadf dsafdsa fdsaf dsafdsaf dsafdsaf dsaf dsaf dsaf dsafa dsaf dsaf dsafdsaf"; IElementSerializer elementSerializer = null;// new StandardSerializer(); IElementAttributes attr = new ElementAttributes(); attr.setMaxLifeSeconds( 34 ); ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value ); before.setElementAttributes( attr ); // DO WORK try { SerializationConversionUtil.getSerializedCacheElement( before, elementSerializer ); // VERIFY fail( "We should have received an IOException." ); } catch ( IOException e ) { // expected } }
void function() { String cacheName = STR; String key = "key"; String value = STR; IElementSerializer elementSerializer = null; IElementAttributes attr = new ElementAttributes(); attr.setMaxLifeSeconds( 34 ); ICacheElement<String, String> before = new CacheElement<String, String>( cacheName, key, value ); before.setElementAttributes( attr ); try { SerializationConversionUtil.getSerializedCacheElement( before, elementSerializer ); fail( STR ); } catch ( IOException e ) { } }
/** * Verify that we get an IOException for a null serializer. */
Verify that we get an IOException for a null serializer
testNullSerializerConversion
{ "repo_name": "tikue/jcs2-snapshot", "path": "src/test/org/apache/commons/jcs/utils/serialization/SerializationConversionUtilUnitTest.java", "license": "apache-2.0", "size": 7281 }
[ "java.io.IOException", "org.apache.commons.jcs.engine.CacheElement", "org.apache.commons.jcs.engine.ElementAttributes", "org.apache.commons.jcs.engine.behavior.ICacheElement", "org.apache.commons.jcs.engine.behavior.IElementAttributes", "org.apache.commons.jcs.engine.behavior.IElementSerializer" ]
import java.io.IOException; import org.apache.commons.jcs.engine.CacheElement; import org.apache.commons.jcs.engine.ElementAttributes; import org.apache.commons.jcs.engine.behavior.ICacheElement; import org.apache.commons.jcs.engine.behavior.IElementAttributes; import org.apache.commons.jcs.engine.behavior.IElementSerializer;
import java.io.*; import org.apache.commons.jcs.engine.*; import org.apache.commons.jcs.engine.behavior.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
125,294
List<Balance> getBalanceForAccount(long account_id);
List<Balance> getBalanceForAccount(long account_id);
/** * Get Balance data * */
Get Balance data
getBalanceForAccount
{ "repo_name": "nasebanal/nb-finance", "path": "src/main/java/com/nasebanal/finance/repository/BalanceRepository.java", "license": "apache-2.0", "size": 672 }
[ "com.nasebanal.finance.entity.Balance", "java.util.List" ]
import com.nasebanal.finance.entity.Balance; import java.util.List;
import com.nasebanal.finance.entity.*; import java.util.*;
[ "com.nasebanal.finance", "java.util" ]
com.nasebanal.finance; java.util;
2,259,791
public void initializePort() throws SerialManagerException { String port = "COM" + MBB3Prefs.getComPort(); try { portId = CommPortIdentifier.getPortIdentifier(port); } catch (NoSuchPortException e) { portId = null; throw new SerialManagerException("No such port (" + port + ")."); } }
void function() throws SerialManagerException { String port = "COM" + MBB3Prefs.getComPort(); try { portId = CommPortIdentifier.getPortIdentifier(port); } catch (NoSuchPortException e) { portId = null; throw new SerialManagerException(STR + port + ")."); } }
/** * Initializes the desired COM port, will result in * an error if anything fails or is unruly. * * @throws SerialManagerException on failure */
Initializes the desired COM port, will result in an error if anything fails or is unruly
initializePort
{ "repo_name": "nickveys/mr-baybus-3", "path": "monitor/com/veys/mbb3mon/serial/SerialManager.java", "license": "mit", "size": 6543 }
[ "com.veys.mbb3mon.MBB3Prefs", "javax.comm.CommPortIdentifier", "javax.comm.NoSuchPortException" ]
import com.veys.mbb3mon.MBB3Prefs; import javax.comm.CommPortIdentifier; import javax.comm.NoSuchPortException;
import com.veys.mbb3mon.*; import javax.comm.*;
[ "com.veys.mbb3mon", "javax.comm" ]
com.veys.mbb3mon; javax.comm;
2,228,079
public void processData(HashMap<String, String> data); }; protected FlexTable table; protected Receiver receiver = null; protected HashMap<String, Widget> widgets; public SimpleUIBuilder() { final VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel); verticalPanel.setWidth("100%"); table = new FlexTable(); verticalPanel.add(table); final HorizontalPanel horizontalPanel = new HorizontalPanel(); verticalPanel.add(horizontalPanel);
void function(HashMap<String, String> data); }; protected FlexTable table; protected Receiver receiver = null; protected HashMap<String, Widget> widgets; public SimpleUIBuilder() { final VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel); verticalPanel.setWidth("100%"); table = new FlexTable(); verticalPanel.add(table); final HorizontalPanel horizontalPanel = new HorizontalPanel(); verticalPanel.add(horizontalPanel);
/** * Handle data. * * @param data */
Handle data
processData
{ "repo_name": "freemed/freemed", "path": "ui/gwt/src/main/java/org/freemedsoftware/gwt/client/widget/SimpleUIBuilder.java", "license": "gpl-2.0", "size": 12059 }
[ "com.google.gwt.user.client.ui.FlexTable", "com.google.gwt.user.client.ui.HorizontalPanel", "com.google.gwt.user.client.ui.VerticalPanel", "com.google.gwt.user.client.ui.Widget", "java.util.HashMap" ]
import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; import java.util.HashMap;
import com.google.gwt.user.client.ui.*; import java.util.*;
[ "com.google.gwt", "java.util" ]
com.google.gwt; java.util;
1,684,050
public boolean sampling(Boolean val) throws IgniteCheckedException { if (busyLock.enterBusy()) { try { validTxState(false); IgniteInternalTx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { Object prev = val != null ? metaCache.getAndPut(sampling, val) : metaCache.getAndRemove(sampling); tx.commit(); return !F.eq(prev, val); } finally { tx.close(); } } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to set sampling flag because Grid is stopping."); }
boolean function(Boolean val) throws IgniteCheckedException { if (busyLock.enterBusy()) { try { validTxState(false); IgniteInternalTx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { Object prev = val != null ? metaCache.getAndPut(sampling, val) : metaCache.getAndRemove(sampling); tx.commit(); return !F.eq(prev, val); } finally { tx.close(); } } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException(STR); }
/** * Set sampling flag. * * @param val Sampling flag state or {@code null} to clear sampling state and mark it as "not set". * @return {@code True} if sampling mode was actually changed by this call. * @throws IgniteCheckedException If failed. */
Set sampling flag
sampling
{ "repo_name": "zzcclp/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java", "license": "apache-2.0", "size": 123208 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx", "org.apache.ignite.internal.util.typedef.F" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.typedef.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,879,550
@Test public void testFloat2Short() { try { Message message = senderSession.createMessage(); // store a value that can't be converted to short message.setFloatProperty("prop", 127.0F); message.getShortProperty("prop"); Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n"); } catch (MessageFormatException e) { } catch (JMSException e) { fail(e); } }
void function() { try { Message message = senderSession.createMessage(); message.setFloatProperty("prop", 127.0F); message.getShortProperty("prop"); Assert.fail(STR); } catch (MessageFormatException e) { } catch (JMSException e) { fail(e); } }
/** * if a property is set as a <code>float</code>, * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>. */
if a property is set as a <code>float</code>, to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>
testFloat2Short
{ "repo_name": "cshannon/activemq-artemis", "path": "tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyConversionTest.java", "license": "apache-2.0", "size": 43771 }
[ "javax.jms.JMSException", "javax.jms.Message", "javax.jms.MessageFormatException", "org.junit.Assert" ]
import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageFormatException; import org.junit.Assert;
import javax.jms.*; import org.junit.*;
[ "javax.jms", "org.junit" ]
javax.jms; org.junit;
11,431
public static ErrorDTO getErrorDTO(String message, String code, String description) { ErrorDTO errorDTO = new ErrorDTO(); errorDTO.setCode(code); errorDTO.setMessage(message); errorDTO.setDescription(description); return errorDTO; }
static ErrorDTO function(String message, String code, String description) { ErrorDTO errorDTO = new ErrorDTO(); errorDTO.setCode(code); errorDTO.setMessage(message); errorDTO.setDescription(description); return errorDTO; }
/** * Returns a generic errorDTO * * @param message specifies the error message * @return A generic errorDTO with the specified details */
Returns a generic errorDTO
getErrorDTO
{ "repo_name": "IsuraD/identity-governance", "path": "components/org.wso2.carbon.identity.recovery.endpoint/src/main/java/org/wso2/carbon/identity/recovery/endpoint/Utils/RecoveryUtil.java", "license": "apache-2.0", "size": 20818 }
[ "org.wso2.carbon.identity.recovery.endpoint.dto.ErrorDTO" ]
import org.wso2.carbon.identity.recovery.endpoint.dto.ErrorDTO;
import org.wso2.carbon.identity.recovery.endpoint.dto.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,666,689
public void eraseToBegOfDisplay(boolean all) throws IOException;
void function(boolean all) throws IOException;
/** * Erases characters, starting from the current cursor position to the * beginning of the screen. * * @param all <code>true</code> to erase protected text; <code>false</code> * otherwise. */
Erases characters, starting from the current cursor position to the beginning of the screen
eraseToBegOfDisplay
{ "repo_name": "appnativa/rare", "path": "source/tenletd/com/appnativa/rare/terminal/iDisplay.java", "license": "gpl-3.0", "size": 15301 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,282,671
public static JButton createJButton(String label, Font font) { JButton result = new JButton(label); result.setFont(font); return result; }
static JButton function(String label, Font font) { JButton result = new JButton(label); result.setFont(font); return result; }
/** * Creates a {@link JButton}. * * @param label the label. * @param font the font. * * @return The button. */
Creates a <code>JButton</code>
createJButton
{ "repo_name": "linuxuser586/jfreechart", "path": "source/org/jfree/chart/util/RefineryUtilities.java", "license": "lgpl-2.1", "size": 10846 }
[ "java.awt.Font", "javax.swing.JButton" ]
import java.awt.Font; import javax.swing.JButton;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
531,763
public TreeNode getChild(int index) { Iterator<TreeNode> iterator = children.iterator(); for (int i = 0; i < index; i++) iterator.next(); return iterator.next(); }
TreeNode function(int index) { Iterator<TreeNode> iterator = children.iterator(); for (int i = 0; i < index; i++) iterator.next(); return iterator.next(); }
/** * Returns the child at given index. * * <em>Note:</em> The average time complexity of this method is O(n). * @param index the index, starting at 0 * @return the child node */
Returns the child at given index. Note: The average time complexity of this method is O(n)
getChild
{ "repo_name": "sulir/edigen", "path": "src/main/java/com/github/sulir/edigen/nodes/TreeNode.java", "license": "gpl-2.0", "size": 5373 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,565,782
public void dispatchEvent(IEvent event) { if (event instanceof IRTMPEvent && !closed) { switch (event.getType()) { case STREAM_CONTROL: case STREAM_DATA: // create the event IRTMPEvent rtmpEvent; try { rtmpEvent = (IRTMPEvent) event; } catch (ClassCastException e) { log.error("Class cast exception in event dispatch", e); return; } int eventTime = -1; if (log.isTraceEnabled()) { // If this is first packet save its timestamp; expect it is // absolute? no matter: it's never used! if (firstPacketTime == -1) { firstPacketTime = rtmpEvent.getTimestamp(); log.trace(String.format("CBS=@%08x: rtmpEvent=%s creation=%s firstPacketTime=%d", System.identityHashCode(this), rtmpEvent.getClass().getSimpleName(), creationTime, firstPacketTime)); } else { log.trace(String.format("CBS=@%08x: rtmpEvent=%s creation=%s firstPacketTime=%d timestamp=%d", System.identityHashCode(this), rtmpEvent.getClass() .getSimpleName(), creationTime, firstPacketTime, rtmpEvent.getTimestamp())); } } //get the buffer only once per call IoBuffer buf = null; if (rtmpEvent instanceof IStreamData && (buf = ((IStreamData<?>) rtmpEvent).getData()) != null) { bytesReceived += buf.limit(); } // get stream codec IStreamCodecInfo codecInfo = getCodecInfo(); StreamCodecInfo info = null; if (codecInfo instanceof StreamCodecInfo) { info = (StreamCodecInfo) codecInfo; } //log.trace("Stream codec info: {}", info); if (rtmpEvent instanceof AudioData) { IAudioStreamCodec audioStreamCodec = null; if (checkAudioCodec) { audioStreamCodec = AudioCodecFactory.getAudioCodec(buf); if (info != null) { info.setAudioCodec(audioStreamCodec); } checkAudioCodec = false; } else if (codecInfo != null) { audioStreamCodec = codecInfo.getAudioCodec(); } if (audioStreamCodec != null) { audioStreamCodec.addData(buf.asReadOnlyBuffer()); } if (info != null) { info.setHasAudio(true); } eventTime = rtmpEvent.getTimestamp(); log.trace("Audio: {}", eventTime); } else if (rtmpEvent instanceof VideoData) { IVideoStreamCodec videoStreamCodec = null; if (checkVideoCodec) { videoStreamCodec = VideoCodecFactory.getVideoCodec(buf); if (info != null) { info.setVideoCodec(videoStreamCodec); } checkVideoCodec = false; } else if (codecInfo != null) { videoStreamCodec = codecInfo.getVideoCodec(); } if (videoStreamCodec != null) { videoStreamCodec.addData(buf.asReadOnlyBuffer()); } if (info != null) { info.setHasVideo(true); } eventTime = rtmpEvent.getTimestamp(); log.trace("Video: {}", eventTime); } else if (rtmpEvent instanceof Invoke) { eventTime = rtmpEvent.getTimestamp(); //do we want to return from here? //event / stream listeners will not be notified of invokes return; } else if (rtmpEvent instanceof Notify) { // store the metadata Notify notifyEvent = (Notify) rtmpEvent; if (metaData == null && notifyEvent.getHeader().getDataType() == Notify.TYPE_STREAM_METADATA) { try { metaData = notifyEvent.duplicate(); } catch (Exception e) { log.warn("Metadata could not be duplicated for this stream", e); } } eventTime = rtmpEvent.getTimestamp(); } // update last event time if (eventTime > latestTimeStamp) { latestTimeStamp = eventTime; } // notify event listeners checkSendNotifications(event); // note this timestamp is set in event/body but not in the associated header try { // route to live if (livePipe != null) { // create new RTMP message, initialize it and push through pipe RTMPMessage msg = RTMPMessage.build(rtmpEvent, eventTime); livePipe.pushMessage(msg); } else { log.debug("Live pipe was null, message was not pushed"); } } catch (IOException err) { stop(); } // notify listeners about received packet if (rtmpEvent instanceof IStreamPacket) { for (IStreamListener listener : getStreamListeners()) { try { listener.packetReceived(this, (IStreamPacket) rtmpEvent); } catch (Exception e) { log.error("Error while notifying listener {}", listener, e); if (listener instanceof RecordingListener) { sendRecordFailedNotify(e.getMessage()); } } } } break; default: // ignored event log.debug("Ignoring event: {}", event.getType()); } } else { log.debug("Event was of wrong type or stream is closed ({})", closed); } }
void function(IEvent event) { if (event instanceof IRTMPEvent && !closed) { switch (event.getType()) { case STREAM_CONTROL: case STREAM_DATA: IRTMPEvent rtmpEvent; try { rtmpEvent = (IRTMPEvent) event; } catch (ClassCastException e) { log.error(STR, e); return; } int eventTime = -1; if (log.isTraceEnabled()) { if (firstPacketTime == -1) { firstPacketTime = rtmpEvent.getTimestamp(); log.trace(String.format(STR, System.identityHashCode(this), rtmpEvent.getClass().getSimpleName(), creationTime, firstPacketTime)); } else { log.trace(String.format(STR, System.identityHashCode(this), rtmpEvent.getClass() .getSimpleName(), creationTime, firstPacketTime, rtmpEvent.getTimestamp())); } } IoBuffer buf = null; if (rtmpEvent instanceof IStreamData && (buf = ((IStreamData<?>) rtmpEvent).getData()) != null) { bytesReceived += buf.limit(); } IStreamCodecInfo codecInfo = getCodecInfo(); StreamCodecInfo info = null; if (codecInfo instanceof StreamCodecInfo) { info = (StreamCodecInfo) codecInfo; } if (rtmpEvent instanceof AudioData) { IAudioStreamCodec audioStreamCodec = null; if (checkAudioCodec) { audioStreamCodec = AudioCodecFactory.getAudioCodec(buf); if (info != null) { info.setAudioCodec(audioStreamCodec); } checkAudioCodec = false; } else if (codecInfo != null) { audioStreamCodec = codecInfo.getAudioCodec(); } if (audioStreamCodec != null) { audioStreamCodec.addData(buf.asReadOnlyBuffer()); } if (info != null) { info.setHasAudio(true); } eventTime = rtmpEvent.getTimestamp(); log.trace(STR, eventTime); } else if (rtmpEvent instanceof VideoData) { IVideoStreamCodec videoStreamCodec = null; if (checkVideoCodec) { videoStreamCodec = VideoCodecFactory.getVideoCodec(buf); if (info != null) { info.setVideoCodec(videoStreamCodec); } checkVideoCodec = false; } else if (codecInfo != null) { videoStreamCodec = codecInfo.getVideoCodec(); } if (videoStreamCodec != null) { videoStreamCodec.addData(buf.asReadOnlyBuffer()); } if (info != null) { info.setHasVideo(true); } eventTime = rtmpEvent.getTimestamp(); log.trace(STR, eventTime); } else if (rtmpEvent instanceof Invoke) { eventTime = rtmpEvent.getTimestamp(); return; } else if (rtmpEvent instanceof Notify) { Notify notifyEvent = (Notify) rtmpEvent; if (metaData == null && notifyEvent.getHeader().getDataType() == Notify.TYPE_STREAM_METADATA) { try { metaData = notifyEvent.duplicate(); } catch (Exception e) { log.warn(STR, e); } } eventTime = rtmpEvent.getTimestamp(); } if (eventTime > latestTimeStamp) { latestTimeStamp = eventTime; } checkSendNotifications(event); try { if (livePipe != null) { RTMPMessage msg = RTMPMessage.build(rtmpEvent, eventTime); livePipe.pushMessage(msg); } else { log.debug(STR); } } catch (IOException err) { stop(); } if (rtmpEvent instanceof IStreamPacket) { for (IStreamListener listener : getStreamListeners()) { try { listener.packetReceived(this, (IStreamPacket) rtmpEvent); } catch (Exception e) { log.error(STR, listener, e); if (listener instanceof RecordingListener) { sendRecordFailedNotify(e.getMessage()); } } } } break; default: log.debug(STR, event.getType()); } } else { log.debug(STR, closed); } }
/** * Dispatches event * @param event Event to dispatch */
Dispatches event
dispatchEvent
{ "repo_name": "cwpenhale/red5-mobileconsole", "path": "red5_server/src/main/java/org/red5/server/stream/ClientBroadcastStream.java", "license": "apache-2.0", "size": 28857 }
[ "java.io.IOException", "org.apache.mina.core.buffer.IoBuffer", "org.red5.server.api.event.IEvent", "org.red5.server.api.stream.IAudioStreamCodec", "org.red5.server.api.stream.IStreamCodecInfo", "org.red5.server.api.stream.IStreamListener", "org.red5.server.api.stream.IStreamPacket", "org.red5.server.a...
import java.io.IOException; import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.api.event.IEvent; import org.red5.server.api.stream.IAudioStreamCodec; import org.red5.server.api.stream.IStreamCodecInfo; import org.red5.server.api.stream.IStreamListener; import org.red5.server.api.stream.IStreamPacket; import org.red5.server.api.stream.IVideoStreamCodec; import org.red5.server.net.rtmp.event.AudioData; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.event.Invoke; import org.red5.server.net.rtmp.event.Notify; import org.red5.server.net.rtmp.event.VideoData; import org.red5.server.stream.codec.StreamCodecInfo; import org.red5.server.stream.message.RTMPMessage;
import java.io.*; import org.apache.mina.core.buffer.*; import org.red5.server.api.event.*; import org.red5.server.api.stream.*; import org.red5.server.net.rtmp.event.*; import org.red5.server.stream.codec.*; import org.red5.server.stream.message.*;
[ "java.io", "org.apache.mina", "org.red5.server" ]
java.io; org.apache.mina; org.red5.server;
2,078,964
public void setSpecies(TreeSpecies species) { setData(species.getData()); }
void function(TreeSpecies species) { setData(species.getData()); }
/** * Sets the species of this leave * * @param species New species of this leave */
Sets the species of this leave
setSpecies
{ "repo_name": "Scrik/Cauldron-1", "path": "eclipse/cauldron/src/main/java/org/bukkit/material/Leaves.java", "license": "gpl-3.0", "size": 1475 }
[ "org.bukkit.TreeSpecies" ]
import org.bukkit.TreeSpecies;
import org.bukkit.*;
[ "org.bukkit" ]
org.bukkit;
34,396
long[] getHosts(long fragment) throws IOException;
long[] getHosts(long fragment) throws IOException;
/** * Answer the list of bundle ids of the bundles which host a fragment * * @param fragment the bundle id of the fragment * @return the array of bundle identifiers * @throws IOException if the operation fails * @throws IllegalArgumentException if the bundle indicated does not exist */
Answer the list of bundle ids of the bundles which host a fragment
getHosts
{ "repo_name": "eclipse/gemini.managment", "path": "org.eclipse.gemini.management/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java", "license": "apache-2.0", "size": 26526 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
616,607
protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
void function(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */
Set the range of pages from a Book to be printed. Both 'firstPage' and 'lastPage' are zero based page indices. If either parameter is less than zero then the page range is set to be from the first page to the last
setPageRange
{ "repo_name": "kgilmer/openjdk-7-mermaid", "path": "src/share/classes/sun/print/RasterPrinterJob.java", "license": "gpl-2.0", "size": 85672 }
[ "java.awt.print.Pageable" ]
import java.awt.print.Pageable;
import java.awt.print.*;
[ "java.awt" ]
java.awt;
1,381,027
@Override public AnomalyTimelinesView getTimeSeriesView(MetricTimeSeries timeSeries, long bucketMillis, String metric, long viewWindowStartTime, long viewWindowEndTime, List<MergedAnomalyResultDTO> knownAnomalies) { AnomalyTimelinesView anomalyTimelinesView = new AnomalyTimelinesView(); // Construct Week-over-Week AnomalyTimelinesView int bucketCount = (int) ((viewWindowEndTime - viewWindowStartTime) / bucketMillis); for (int i = 0; i < bucketCount; ++i) { long currentBucketMillis = viewWindowStartTime + i * bucketMillis; long baselineBucketMillis = currentBucketMillis - TimeUnit.DAYS.toMillis(7); TimeBucket timebucket = new TimeBucket(currentBucketMillis, currentBucketMillis + bucketMillis, baselineBucketMillis, baselineBucketMillis + bucketMillis); anomalyTimelinesView.addTimeBuckets(timebucket); anomalyTimelinesView.addCurrentValues(timeSeries.get(currentBucketMillis, metric).doubleValue()); anomalyTimelinesView.addBaselineValues(timeSeries.get(baselineBucketMillis, metric).doubleValue()); } return anomalyTimelinesView; }
AnomalyTimelinesView function(MetricTimeSeries timeSeries, long bucketMillis, String metric, long viewWindowStartTime, long viewWindowEndTime, List<MergedAnomalyResultDTO> knownAnomalies) { AnomalyTimelinesView anomalyTimelinesView = new AnomalyTimelinesView(); int bucketCount = (int) ((viewWindowEndTime - viewWindowStartTime) / bucketMillis); for (int i = 0; i < bucketCount; ++i) { long currentBucketMillis = viewWindowStartTime + i * bucketMillis; long baselineBucketMillis = currentBucketMillis - TimeUnit.DAYS.toMillis(7); TimeBucket timebucket = new TimeBucket(currentBucketMillis, currentBucketMillis + bucketMillis, baselineBucketMillis, baselineBucketMillis + bucketMillis); anomalyTimelinesView.addTimeBuckets(timebucket); anomalyTimelinesView.addCurrentValues(timeSeries.get(currentBucketMillis, metric).doubleValue()); anomalyTimelinesView.addBaselineValues(timeSeries.get(baselineBucketMillis, metric).doubleValue()); } return anomalyTimelinesView; }
/** * This method provides a view of current time series, i.e., no baseline time series. * * @param timeSeries the time series that contains the metric to be processed * @param bucketMillis the size of a bucket in milli-seconds * @param metric the metric name to retrieve the data from the given time series * @param viewWindowStartTime the start time bucket of current time series, inclusive * @param viewWindowEndTime the end time buckets of current time series, exclusive * @param knownAnomalies it is assumed to be null for presentational purpose. * @return */
This method provides a view of current time series, i.e., no baseline time series
getTimeSeriesView
{ "repo_name": "sajavadi/pinot", "path": "thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detector/function/BaseAnomalyFunction.java", "license": "apache-2.0", "size": 7008 }
[ "com.linkedin.thirdeye.anomaly.views.AnomalyTimelinesView", "com.linkedin.thirdeye.api.MetricTimeSeries", "com.linkedin.thirdeye.dashboard.views.TimeBucket", "com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO", "java.util.List", "java.util.concurrent.TimeUnit" ]
import com.linkedin.thirdeye.anomaly.views.AnomalyTimelinesView; import com.linkedin.thirdeye.api.MetricTimeSeries; import com.linkedin.thirdeye.dashboard.views.TimeBucket; import com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO; import java.util.List; import java.util.concurrent.TimeUnit;
import com.linkedin.thirdeye.anomaly.views.*; import com.linkedin.thirdeye.api.*; import com.linkedin.thirdeye.dashboard.views.*; import com.linkedin.thirdeye.datalayer.dto.*; import java.util.*; import java.util.concurrent.*;
[ "com.linkedin.thirdeye", "java.util" ]
com.linkedin.thirdeye; java.util;
2,283,265
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { if (DEBUG) Log.i(TAG, String.format("surfaceChanged() fmt=%d size=%dx%d", format, w, h)); mWidth = w; mHeight = h; if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && mWidth < mHeight) { return; } if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT && mWidth > mHeight) { return; } if (!mRunning) { mRunning = true; new Thread(this).start(); } else { mChanged = true; if (mStarted) { nativeExpose(); } } }
void function(SurfaceHolder holder, int format, int w, int h) { if (DEBUG) Log.i(TAG, String.format(STR, format, w, h)); mWidth = w; mHeight = h; if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && mWidth < mHeight) { return; } if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT && mWidth > mHeight) { return; } if (!mRunning) { mRunning = true; new Thread(this).start(); } else { mChanged = true; if (mStarted) { nativeExpose(); } } }
/** * This method is part of the SurfaceHolder.Callback interface, and is * not normally called or subclassed by clients of GLSurfaceView. */
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of GLSurfaceView
surfaceChanged
{ "repo_name": "Cheaterman/python-for-android", "path": "src/src/org/renpy/android/SDLSurfaceView.java", "license": "mit", "size": 51577 }
[ "android.content.pm.ActivityInfo", "android.util.Log", "android.view.SurfaceHolder" ]
import android.content.pm.ActivityInfo; import android.util.Log; import android.view.SurfaceHolder;
import android.content.pm.*; import android.util.*; import android.view.*;
[ "android.content", "android.util", "android.view" ]
android.content; android.util; android.view;
32,894
void createEntry(int hash, K key, V value, int bucketIndex) { MyHashMap7.Entry<K, V> old = table[bucketIndex]; Entry<K, V> e = new Entry<>(hash, key, value, old); table[bucketIndex] = e; e.addBefore(header); size++; } /** * Returns <tt>true</tt> if this map should remove its eldest entry. * This method is invoked by <tt>put</tt> and <tt>putAll</tt> after * inserting a new entry into the map. It provides the implementor * with the opportunity to remove the eldest entry each time a new one * is added. This is useful if the map represents a cache: it allows * the map to reduce memory consumption by deleting stale entries. * <p> * <p>Sample use: this override will allow the map to grow up to 100 * entries and then delete the eldest entry each time a new entry is * added, maintaining a steady state of 100 entries. * <pre> * private static final int MAX_ENTRIES = 100; * * protected boolean removeEldestEntry(Map.Entry eldest) { * return size() > MAX_ENTRIES; * }
void createEntry(int hash, K key, V value, int bucketIndex) { MyHashMap7.Entry<K, V> old = table[bucketIndex]; Entry<K, V> e = new Entry<>(hash, key, value, old); table[bucketIndex] = e; e.addBefore(header); size++; } /** * Returns <tt>true</tt> if this map should remove its eldest entry. * This method is invoked by <tt>put</tt> and <tt>putAll</tt> after * inserting a new entry into the map. It provides the implementor * with the opportunity to remove the eldest entry each time a new one * is added. This is useful if the map represents a cache: it allows * the map to reduce memory consumption by deleting stale entries. * <p> * <p>Sample use: this override will allow the map to grow up to 100 * entries and then delete the eldest entry each time a new entry is * added, maintaining a steady state of 100 entries. * <pre> * private static final int MAX_ENTRIES = 100; * * protected boolean removeEldestEntry(Map.Entry eldest) { * return size() > MAX_ENTRIES; * }
/** * This override differs from addEntry in that it doesn't resize the * table or remove the eldest entry. */
This override differs from addEntry in that it doesn't resize the table or remove the eldest entry
createEntry
{ "repo_name": "NorthFacing/step-by-Java", "path": "java-base/src/main/java/com/bob/jdk/java/util/MyLinkedHashMap7.java", "license": "gpl-2.0", "size": 11910 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,361,072
@XmlElement(name = "anon", required = false) public String getAnon() { return anon; }
@XmlElement(name = "anon", required = false) String function() { return anon; }
/** * Anonymous root user mapping e.g. "root", "nobody" or "anyUserName" * */
Anonymous root user mapping e.g. "root", "nobody" or "anyUserName"
getAnon
{ "repo_name": "emcvipr/controller-client-java", "path": "models/src/main/java/com/emc/storageos/model/file/ExportRule.java", "license": "apache-2.0", "size": 6440 }
[ "javax.xml.bind.annotation.XmlElement" ]
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.*;
[ "javax.xml" ]
javax.xml;
537,700
public static Collection<String> buildAttributeCollection(Collection<String> extendedFields) { Collection<String> attributeList = buildGroupByCollection(); attributeList.add(sum(KFSPropertyConstants.ACCOUNT_LINE_ANNUAL_BALANCE_AMOUNT)); attributeList.add(sum(KFSPropertyConstants.FINANCIAL_BEGINNING_BALANCE_LINE_AMOUNT)); attributeList.add(sum(KFSPropertyConstants.CONTRACTS_GRANTS_BEGINNING_BALANCE_AMOUNT)); // add the entended elements into the list attributeList.addAll(extendedFields); return attributeList; }
static Collection<String> function(Collection<String> extendedFields) { Collection<String> attributeList = buildGroupByCollection(); attributeList.add(sum(KFSPropertyConstants.ACCOUNT_LINE_ANNUAL_BALANCE_AMOUNT)); attributeList.add(sum(KFSPropertyConstants.FINANCIAL_BEGINNING_BALANCE_LINE_AMOUNT)); attributeList.add(sum(KFSPropertyConstants.CONTRACTS_GRANTS_BEGINNING_BALANCE_AMOUNT)); attributeList.addAll(extendedFields); return attributeList; }
/** * This method builds the atrribute list used by balance searching * * @param extendedFields extra fields * @return Collection an attribute list */
This method builds the atrribute list used by balance searching
buildAttributeCollection
{ "repo_name": "ua-eas/kfs-devops-automation-fork", "path": "kfs-ld/src/main/java/org/kuali/kfs/module/ld/util/ConsolidationUtil.java", "license": "agpl-3.0", "size": 10670 }
[ "java.util.Collection", "org.kuali.kfs.sys.KFSPropertyConstants" ]
import java.util.Collection; import org.kuali.kfs.sys.KFSPropertyConstants;
import java.util.*; import org.kuali.kfs.sys.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
1,210,897
public void setUp(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout; // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true);
void function(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout; mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true);
/** * Users of this fragment must call this method to set up the navigation drawer interactions. * * @param fragmentId The android:id of this fragment in its activity's layout. * @param drawerLayout The DrawerLayout containing this fragment's UI. */
Users of this fragment must call this method to set up the navigation drawer interactions
setUp
{ "repo_name": "TheFakeMontyOnTheRun/minha-parte-na-conta", "path": "trunk/minha-parte-na-conta/app/src/main/java/br/odb/myshare/NavigationDrawerFragment.java", "license": "bsd-2-clause", "size": 11019 }
[ "android.support.v4.view.GravityCompat", "android.support.v4.widget.DrawerLayout", "android.support.v7.app.ActionBar" ]
import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar;
import android.support.v4.view.*; import android.support.v4.widget.*; import android.support.v7.app.*;
[ "android.support" ]
android.support;
146,853
String uuid = UUID.randomUUID().toString(); uuid = uuid.replaceAll("\\-", ""); return uuid; }
String uuid = UUID.randomUUID().toString(); uuid = uuid.replaceAll("\\-", ""); return uuid; }
/** * get uuid and remove '-' * * @return */
get uuid and remove '-'
getUUID
{ "repo_name": "johnson1994/CommonWechatApi", "path": "utils/src/main/java/com/johnson/CommonWechatFrontAPi/utils/UuidUtil.java", "license": "mit", "size": 564 }
[ "java.util.UUID" ]
import java.util.UUID;
import java.util.*;
[ "java.util" ]
java.util;
1,360,635
@Test public void testConventionFromUnderlyingSecurityForCompoundingLeg() { final InMemoryConventionSource conventionSource = new InMemoryConventionSource(); // note that the convention refers to the security final CompoundingIborLegConvention compoundingLiborLegConvention = new CompoundingIborLegConvention("USD Compounding LIBOR Swap Leg", COMPOUNDING_LIBOR_LEG_CONVENTION_ID.toBundle(), LIBOR_SECURITY_ID, Tenor.ONE_YEAR, CompoundingType.COMPOUNDING, Tenor.SIX_MONTHS, StubType.NONE, 2, false, StubType.NONE, false, 0); conventionSource.addConvention(FIXED_LEG_CONVENTION.clone()); conventionSource.addConvention(compoundingLiborLegConvention); conventionSource.addConvention(LIBOR_CONVENTION.clone()); final InMemorySecuritySource securitySource = new InMemorySecuritySource(); securitySource.addSecurity(LIBOR_SECURITY.clone()); final SwapNode node = new SwapNode(Tenor.ONE_YEAR, Tenor.TEN_YEARS, FIXED_LEG_CONVENTION_ID, COMPOUNDING_LIBOR_LEG_CONVENTION_ID, CNIM_NAME); assertEquals(node.accept(new CurveNodeCurrencyVisitor(conventionSource, securitySource)), Sets.newHashSet(Currency.USD, Currency.EUR)); }
void function() { final InMemoryConventionSource conventionSource = new InMemoryConventionSource(); final CompoundingIborLegConvention compoundingLiborLegConvention = new CompoundingIborLegConvention(STR, COMPOUNDING_LIBOR_LEG_CONVENTION_ID.toBundle(), LIBOR_SECURITY_ID, Tenor.ONE_YEAR, CompoundingType.COMPOUNDING, Tenor.SIX_MONTHS, StubType.NONE, 2, false, StubType.NONE, false, 0); conventionSource.addConvention(FIXED_LEG_CONVENTION.clone()); conventionSource.addConvention(compoundingLiborLegConvention); conventionSource.addConvention(LIBOR_CONVENTION.clone()); final InMemorySecuritySource securitySource = new InMemorySecuritySource(); securitySource.addSecurity(LIBOR_SECURITY.clone()); final SwapNode node = new SwapNode(Tenor.ONE_YEAR, Tenor.TEN_YEARS, FIXED_LEG_CONVENTION_ID, COMPOUNDING_LIBOR_LEG_CONVENTION_ID, CNIM_NAME); assertEquals(node.accept(new CurveNodeCurrencyVisitor(conventionSource, securitySource)), Sets.newHashSet(Currency.USD, Currency.EUR)); }
/** * Tests that all currencies are returned if the convention from the underlying security is available. */
Tests that all currencies are returned if the convention from the underlying security is available
testConventionFromUnderlyingSecurityForCompoundingLeg
{ "repo_name": "McLeodMoores/starling", "path": "projects/financial/src/test/java/com/opengamma/financial/analytics/curve/SwapNodeCurrencyVisitorTest.java", "license": "apache-2.0", "size": 27347 }
[ "com.google.common.collect.Sets", "com.opengamma.analytics.financial.interestrate.CompoundingType", "com.opengamma.engine.InMemoryConventionSource", "com.opengamma.engine.InMemorySecuritySource", "com.opengamma.financial.analytics.ircurve.strips.SwapNode", "com.opengamma.financial.convention.CompoundingIb...
import com.google.common.collect.Sets; import com.opengamma.analytics.financial.interestrate.CompoundingType; import com.opengamma.engine.InMemoryConventionSource; import com.opengamma.engine.InMemorySecuritySource; import com.opengamma.financial.analytics.ircurve.strips.SwapNode; import com.opengamma.financial.convention.CompoundingIborLegConvention; import com.opengamma.financial.convention.StubType; import com.opengamma.util.money.Currency; import com.opengamma.util.time.Tenor; import org.testng.Assert;
import com.google.common.collect.*; import com.opengamma.analytics.financial.interestrate.*; import com.opengamma.engine.*; import com.opengamma.financial.analytics.ircurve.strips.*; import com.opengamma.financial.convention.*; import com.opengamma.util.money.*; import com.opengamma.util.time.*; import org.testng.*;
[ "com.google.common", "com.opengamma.analytics", "com.opengamma.engine", "com.opengamma.financial", "com.opengamma.util", "org.testng" ]
com.google.common; com.opengamma.analytics; com.opengamma.engine; com.opengamma.financial; com.opengamma.util; org.testng;
1,724,905
PlotPlayer wrapPlayer(final Object obj);
PlotPlayer wrapPlayer(final Object obj);
/** * Wrap a player into a PlotPlayer object * @param obj * @return */
Wrap a player into a PlotPlayer object
wrapPlayer
{ "repo_name": "Litss/PlotSquared", "path": "src/main/java/com/intellectualcrafters/plot/IPlotMain.java", "license": "gpl-3.0", "size": 5542 }
[ "com.intellectualcrafters.plot.object.PlotPlayer" ]
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.*;
[ "com.intellectualcrafters.plot" ]
com.intellectualcrafters.plot;
500,321
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>GET</code> method. * @param request servlet request * @param response servlet response */
Handles the HTTP <code>GET</code> method
doGet
{ "repo_name": "AsherBond/MondocosmOS", "path": "wonderland/web/front/src/java/org/jdesktop/wonderland/front/servlet/AdminServlet.java", "license": "agpl-3.0", "size": 7176 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
747,978
public DataDictionaryService getDataDictionaryService() { return dataDictionaryService; }
DataDictionaryService function() { return dataDictionaryService; }
/** * Gets the dataDictionaryService attribute. * @return Returns the dataDictionaryService. */
Gets the dataDictionaryService attribute
getDataDictionaryService
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/fp/document/validation/impl/JournalVoucherAccountingLineObjectTypeValueAllowedValidation.java", "license": "agpl-3.0", "size": 3360 }
[ "org.kuali.rice.kns.service.DataDictionaryService" ]
import org.kuali.rice.kns.service.DataDictionaryService;
import org.kuali.rice.kns.service.*;
[ "org.kuali.rice" ]
org.kuali.rice;
264,167
@Override public void contributeToMenu(IMenuManager menuManager) { super.contributeToMenu(menuManager); IMenuManager submenuManager = new MenuManager(DomainEditorPlugin.INSTANCE.getString("_UI_WorkerguidanceEditor_menu"), "de.dfki.iui.basys.model.domain.workerguidanceMenuID"); menuManager.insertAfter("additions", submenuManager); submenuManager.add(new Separator("settings")); submenuManager.add(new Separator("actions")); submenuManager.add(new Separator("additions")); submenuManager.add(new Separator("additions-end")); // Prepare for CreateChild item addition or removal. // createChildMenuManager = new MenuManager(DomainEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); submenuManager.insertBefore("additions", createChildMenuManager); // Prepare for CreateSibling item addition or removal. // createSiblingMenuManager = new MenuManager(DomainEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); submenuManager.insertBefore("additions", createSiblingMenuManager);
void function(IMenuManager menuManager) { super.contributeToMenu(menuManager); IMenuManager submenuManager = new MenuManager(DomainEditorPlugin.INSTANCE.getString(STR), STR); menuManager.insertAfter(STR, submenuManager); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); createChildMenuManager = new MenuManager(DomainEditorPlugin.INSTANCE.getString(STR)); submenuManager.insertBefore(STR, createChildMenuManager); createSiblingMenuManager = new MenuManager(DomainEditorPlugin.INSTANCE.getString(STR)); submenuManager.insertBefore(STR, createSiblingMenuManager);
/** * This adds to the menu bar a menu and some separators for editor additions, * as well as the sub-menus for object creation items. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds to the menu bar a menu and some separators for editor additions, as well as the sub-menus for object creation items.
contributeToMenu
{ "repo_name": "BaSys-PC1/models", "path": "de.dfki.iui.basys.model.domain.editor/src/de/dfki/iui/basys/model/domain/workerguidance/presentation/WorkerguidanceActionBarContributor.java", "license": "epl-1.0", "size": 14554 }
[ "de.dfki.iui.basys.model.domain.order.presentation.DomainEditorPlugin", "org.eclipse.jface.action.IMenuManager", "org.eclipse.jface.action.MenuManager", "org.eclipse.jface.action.Separator" ]
import de.dfki.iui.basys.model.domain.order.presentation.DomainEditorPlugin; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator;
import de.dfki.iui.basys.model.domain.order.presentation.*; import org.eclipse.jface.action.*;
[ "de.dfki.iui", "org.eclipse.jface" ]
de.dfki.iui; org.eclipse.jface;
1,736,144
@Test public void testGetIt() { String responseMsg = target.path("myresource").request().get(String.class); assertEquals("Got it!", responseMsg); }
void function() { String responseMsg = target.path(STR).request().get(String.class); assertEquals(STR, responseMsg); }
/** * Test to see that the message "Got it!" is sent in the response. */
Test to see that the message "Got it!" is sent in the response
testGetIt
{ "repo_name": "marti584/PhiSigJavaWebServer", "path": "phisig-service/src/test/java/com/PhiSig/MyResourceTest.java", "license": "gpl-2.0", "size": 1320 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
277,505
GeoFeaturesCollection getFeatures(File file) throws TigerToolsException;
GeoFeaturesCollection getFeatures(File file) throws TigerToolsException;
/** * Get a List<GeoFeature> from a given file * @param file * @return * @throws TigerToolsException */
Get a List from a given file
getFeatures
{ "repo_name": "dartmanx/TigerTools2", "path": "tigertools-core/src/main/java/org/jason/mapmaker/api/Importer.java", "license": "apache-2.0", "size": 1041 }
[ "java.io.File", "org.jason.mapmaker.model.GeoFeaturesCollection", "org.jason.mapmaker.util.TigerToolsException" ]
import java.io.File; import org.jason.mapmaker.model.GeoFeaturesCollection; import org.jason.mapmaker.util.TigerToolsException;
import java.io.*; import org.jason.mapmaker.model.*; import org.jason.mapmaker.util.*;
[ "java.io", "org.jason.mapmaker" ]
java.io; org.jason.mapmaker;
2,839,045
@Test public void testNotEqualNotTheSameMembersSecondMore() throws Exception { ECReports reportTwoTags = getECReports(ECREPORTS_NULLGROUP_TWOTAGS); ECReports reportOneTag = getECReports(ECREPORTS_NULLGROUP_ONETAG); ECReportOutputSpec outputSpec = EasyMock.createMock(ECReportOutputSpec.class); EasyMock.expect(outputSpec.isIncludeEPC()).andReturn(true); EasyMock.expect(outputSpec.isIncludeTag()).andReturn(true); EasyMock.expect(outputSpec.isIncludeRawHex()).andReturn(true); EasyMock.replay(outputSpec); ECReportSpec spec = EasyMock.createMock(ECReportSpec.class); EasyMock.expect(spec.getOutput()).andReturn(outputSpec).atLeastOnce(); EasyMock.replay(spec); ECReportsHelper helper = new ECReportsHelper(); Assert.assertFalse(invokeHelper(helper, reportOneTag, reportTwoTags, spec)); EasyMock.verify(spec); EasyMock.verify(outputSpec); }
void function() throws Exception { ECReports reportTwoTags = getECReports(ECREPORTS_NULLGROUP_TWOTAGS); ECReports reportOneTag = getECReports(ECREPORTS_NULLGROUP_ONETAG); ECReportOutputSpec outputSpec = EasyMock.createMock(ECReportOutputSpec.class); EasyMock.expect(outputSpec.isIncludeEPC()).andReturn(true); EasyMock.expect(outputSpec.isIncludeTag()).andReturn(true); EasyMock.expect(outputSpec.isIncludeRawHex()).andReturn(true); EasyMock.replay(outputSpec); ECReportSpec spec = EasyMock.createMock(ECReportSpec.class); EasyMock.expect(spec.getOutput()).andReturn(outputSpec).atLeastOnce(); EasyMock.replay(spec); ECReportsHelper helper = new ECReportsHelper(); Assert.assertFalse(invokeHelper(helper, reportOneTag, reportTwoTags, spec)); EasyMock.verify(spec); EasyMock.verify(outputSpec); }
/** * test equal reports - not the same members. * @throws Exception test failure. */
test equal reports - not the same members
testNotEqualNotTheSameMembersSecondMore
{ "repo_name": "tavlima/fosstrak-ale", "path": "fc-server/src/test/java/org/fosstrak/ale/server/util/test/ECReportsHelperTest.java", "license": "lgpl-2.1", "size": 10478 }
[ "junit.framework.Assert", "org.easymock.EasyMock", "org.fosstrak.ale.server.util.ECReportsHelper", "org.fosstrak.ale.xsd.ale.epcglobal.ECReportOutputSpec", "org.fosstrak.ale.xsd.ale.epcglobal.ECReportSpec", "org.fosstrak.ale.xsd.ale.epcglobal.ECReports" ]
import junit.framework.Assert; import org.easymock.EasyMock; import org.fosstrak.ale.server.util.ECReportsHelper; import org.fosstrak.ale.xsd.ale.epcglobal.ECReportOutputSpec; import org.fosstrak.ale.xsd.ale.epcglobal.ECReportSpec; import org.fosstrak.ale.xsd.ale.epcglobal.ECReports;
import junit.framework.*; import org.easymock.*; import org.fosstrak.ale.server.util.*; import org.fosstrak.ale.xsd.ale.epcglobal.*;
[ "junit.framework", "org.easymock", "org.fosstrak.ale" ]
junit.framework; org.easymock; org.fosstrak.ale;
1,617,616
public ControlSettings getControlSettings() { return controlSettings; }
ControlSettings function() { return controlSettings; }
/** * Return the current controls settings. * * @return * Current control settings. */
Return the current controls settings
getControlSettings
{ "repo_name": "vlabatut/totalboumboum", "path": "src/org/totalboumboum/engine/player/RemotePlayer.java", "license": "gpl-2.0", "size": 3470 }
[ "org.totalboumboum.configuration.controls.ControlSettings" ]
import org.totalboumboum.configuration.controls.ControlSettings;
import org.totalboumboum.configuration.controls.*;
[ "org.totalboumboum.configuration" ]
org.totalboumboum.configuration;
319,497
public void setTextAttributes(byte[] fields, Hashtable attrib) { for (int i = 0; i < fields.length; i++) { getFieldInfos(fields[i]).m_textAttributes = attrib; } notifyListeners(); } /** * Sets the font family of a field * * @param field * one of {@link ScoreElements} constants * @param fontFamilies * array of font names, e.g. {"Georgia", "Verdana"}
void function(byte[] fields, Hashtable attrib) { for (int i = 0; i < fields.length; i++) { getFieldInfos(fields[i]).m_textAttributes = attrib; } notifyListeners(); } /** * Sets the font family of a field * * @param field * one of {@link ScoreElements} constants * @param fontFamilies * array of font names, e.g. {STR, STR}
/** * Sets the text attributes of several fields * * @param field * one of {@link ScoreElements} constants * @param attrib * Map of attributes * @see java.awt.font.TextAttribute */
Sets the text attributes of several fields
setTextAttributes
{ "repo_name": "mwager/jAM", "path": "src/abc/ui/swing/ScoreTemplate.java", "license": "gpl-2.0", "size": 32549 }
[ "java.util.Hashtable" ]
import java.util.Hashtable;
import java.util.*;
[ "java.util" ]
java.util;
1,862,171
public Action getRandomAction() { return new Action(-1+ (int)(Math.random()*3), -1+ (int)(Math.random()*3)); } }
Action function() { return new Action(-1+ (int)(Math.random()*3), -1+ (int)(Math.random()*3)); } }
/** * Returns a random valid action * * @return The randomly chosen action to take */
Returns a random valid action
getRandomAction
{ "repo_name": "sagersmith8/racetrack_ai", "path": "src/main/java/com.ai/alg/QLearning.java", "license": "apache-2.0", "size": 6419 }
[ "com.ai.model.Action" ]
import com.ai.model.Action;
import com.ai.model.*;
[ "com.ai.model" ]
com.ai.model;
535,462
public static Map getLibraryOptions(Class type) { synchronized(libraries) { Class interfaceClass = findEnclosingLibraryClass(type); if (interfaceClass != null) loadLibraryInstance(interfaceClass); else interfaceClass = type; if (!options.containsKey(interfaceClass)) { try { Field field = interfaceClass.getField("OPTIONS"); field.setAccessible(true); options.put(interfaceClass, field.get(null)); } catch (NoSuchFieldException e) { } catch (Exception e) { throw new IllegalArgumentException("OPTIONS must be a public field of type java.util.Map (" + e + "): " + interfaceClass); } } return (Map)options.get(interfaceClass); } }
static Map function(Class type) { synchronized(libraries) { Class interfaceClass = findEnclosingLibraryClass(type); if (interfaceClass != null) loadLibraryInstance(interfaceClass); else interfaceClass = type; if (!options.containsKey(interfaceClass)) { try { Field field = interfaceClass.getField(STR); field.setAccessible(true); options.put(interfaceClass, field.get(null)); } catch (NoSuchFieldException e) { } catch (Exception e) { throw new IllegalArgumentException(STR + e + STR + interfaceClass); } } return (Map)options.get(interfaceClass); } }
/** Return the preferred native library configuration options for the given * class. * @see Library */
Return the preferred native library configuration options for the given class
getLibraryOptions
{ "repo_name": "jenkinsci/jna", "path": "src/com/sun/jna/Native.java", "license": "lgpl-2.1", "size": 67817 }
[ "java.lang.reflect.Field", "java.util.Map" ]
import java.lang.reflect.Field; import java.util.Map;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,327,626
public static <K, V> Map<K, V> wrap(final Multimap<K, V> source) { if (source != null && !source.isEmpty()) { val inner = source.asMap(); val map = new HashMap<Object, Object>(); inner.forEach((k, v) -> map.put(k, wrap(v))); return (Map) map; } return new HashMap<>(0); }
static <K, V> Map<K, V> function(final Multimap<K, V> source) { if (source != null && !source.isEmpty()) { val inner = source.asMap(); val map = new HashMap<Object, Object>(); inner.forEach((k, v) -> map.put(k, wrap(v))); return (Map) map; } return new HashMap<>(0); }
/** * Wrap map. * * @param <K> the type parameter * @param <V> the type parameter * @param source the source * @return the map */
Wrap map
wrap
{ "repo_name": "pdrados/cas", "path": "core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CollectionUtils.java", "license": "apache-2.0", "size": 19935 }
[ "com.google.common.collect.Multimap", "java.util.HashMap", "java.util.Map" ]
import com.google.common.collect.Multimap; import java.util.HashMap; import java.util.Map;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,699,024
public RenderingControl loadRenderingControl(SecurityContext ctx, long pixelsID) throws DSOutOfServiceException, DSAccessException, FSAccessException { RenderingControl proxy = PixelsServicesFactory.getRenderingControl(context, Long.valueOf(pixelsID), true); if (proxy == null) { UserCredentials uc = (UserCredentials) context.lookup(LookupNames.USER_CREDENTIALS); int compressionLevel; switch (uc.getSpeedLevel()) { case UserCredentials.MEDIUM: compressionLevel = RenderingControl.MEDIUM; break; case UserCredentials.LOW: compressionLevel = RenderingControl.LOW; break; default: compressionLevel = RenderingControl.UNCOMPRESSED; } ExperimenterData exp = (ExperimenterData) context.lookup( LookupNames.CURRENT_USER_DETAILS); RenderingEnginePrx re = gateway.createRenderingEngine(ctx, pixelsID); Pixels pixels = gateway.getPixels(ctx, pixelsID); if (pixels == null) return null; List<RndProxyDef> defs = gateway.getRenderingSettingsFor( ctx, pixelsID, exp.getId()); Collection l = pixels.copyChannels(); Iterator i = l.iterator(); List<ChannelData> m = new ArrayList<ChannelData>(l.size()); int index = 0; while (i.hasNext()) { m.add(new ChannelData(index, (Channel) i.next())); index++; } proxy = PixelsServicesFactory.createRenderingControl(context, ctx, re, pixels, m, compressionLevel, defs); } return proxy; }
RenderingControl function(SecurityContext ctx, long pixelsID) throws DSOutOfServiceException, DSAccessException, FSAccessException { RenderingControl proxy = PixelsServicesFactory.getRenderingControl(context, Long.valueOf(pixelsID), true); if (proxy == null) { UserCredentials uc = (UserCredentials) context.lookup(LookupNames.USER_CREDENTIALS); int compressionLevel; switch (uc.getSpeedLevel()) { case UserCredentials.MEDIUM: compressionLevel = RenderingControl.MEDIUM; break; case UserCredentials.LOW: compressionLevel = RenderingControl.LOW; break; default: compressionLevel = RenderingControl.UNCOMPRESSED; } ExperimenterData exp = (ExperimenterData) context.lookup( LookupNames.CURRENT_USER_DETAILS); RenderingEnginePrx re = gateway.createRenderingEngine(ctx, pixelsID); Pixels pixels = gateway.getPixels(ctx, pixelsID); if (pixels == null) return null; List<RndProxyDef> defs = gateway.getRenderingSettingsFor( ctx, pixelsID, exp.getId()); Collection l = pixels.copyChannels(); Iterator i = l.iterator(); List<ChannelData> m = new ArrayList<ChannelData>(l.size()); int index = 0; while (i.hasNext()) { m.add(new ChannelData(index, (Channel) i.next())); index++; } proxy = PixelsServicesFactory.createRenderingControl(context, ctx, re, pixels, m, compressionLevel, defs); } return proxy; }
/** * Implemented as specified by {@link OmeroImageService}. * @see OmeroImageService#loadRenderingControl(SecurityContext, long) */
Implemented as specified by <code>OmeroImageService</code>
loadRenderingControl
{ "repo_name": "hflynn/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OmeroImageServiceImpl.java", "license": "gpl-2.0", "size": 61419 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Iterator", "java.util.List", "org.openmicroscopy.shoola.env.LookupNames", "org.openmicroscopy.shoola.env.data.login.UserCredentials", "org.openmicroscopy.shoola.env.data.util.SecurityContext", "org.openmicroscopy.shoola.env.rnd.PixelsServicesFa...
import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import org.openmicroscopy.shoola.env.LookupNames; import org.openmicroscopy.shoola.env.data.login.UserCredentials; import org.openmicroscopy.shoola.env.data.util.SecurityContext; import org.openmicroscopy.shoola.env.rnd.PixelsServicesFactory; import org.openmicroscopy.shoola.env.rnd.RenderingControl; import org.openmicroscopy.shoola.env.rnd.RndProxyDef;
import java.util.*; import org.openmicroscopy.shoola.env.*; import org.openmicroscopy.shoola.env.data.login.*; import org.openmicroscopy.shoola.env.data.util.*; import org.openmicroscopy.shoola.env.rnd.*;
[ "java.util", "org.openmicroscopy.shoola" ]
java.util; org.openmicroscopy.shoola;
1,994,398
public void _loadModule() { log.println("Load module IGNORE_CASE"); oObj.loadModule(TransliterationModules.IGNORE_CASE, loc); String name = oObj.getName(); boolean res = name.equals("case ignore (generic)"); log.println("getName return: " + name); tRes.tested("loadModule()", res ); }
void function() { log.println(STR); oObj.loadModule(TransliterationModules.IGNORE_CASE, loc); String name = oObj.getName(); boolean res = name.equals(STR); log.println(STR + name); tRes.tested(STR, res ); }
/** * Calls the method for load IGNORE_CASE module and checks the name returned * by the method <code>getName</code>. <p> * Has <b>OK</b> status if the method <code>getName</code> returns the * string "case ignore (generic)". */
Calls the method for load IGNORE_CASE module and checks the name returned by the method <code>getName</code>. Has OK status if the method <code>getName</code> returns the string "case ignore (generic)"
_loadModule
{ "repo_name": "qt-haiku/LibreOffice", "path": "qadevOOo/tests/java/ifc/i18n/_XTransliteration.java", "license": "gpl-3.0", "size": 15552 }
[ "com.sun.star.i18n.TransliterationModules" ]
import com.sun.star.i18n.TransliterationModules;
import com.sun.star.i18n.*;
[ "com.sun.star" ]
com.sun.star;
763,811
public Observable<ServiceResponse<AzureFirewallInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String azureFirewallName, AzureFirewallInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (azureFirewallName == null) { throw new IllegalArgumentException("Parameter azureFirewallName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); }
Observable<ServiceResponse<AzureFirewallInner>> function(String resourceGroupName, String azureFirewallName, AzureFirewallInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (azureFirewallName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); }
/** * Creates or updates the specified Azure Firewall. * * @param resourceGroupName The name of the resource group. * @param azureFirewallName The name of the Azure Firewall. * @param parameters Parameters supplied to the create or update Azure Firewall operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AzureFirewallInner object */
Creates or updates the specified Azure Firewall
beginCreateOrUpdateWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_02_01/src/main/java/com/microsoft/azure/management/network/v2019_02_01/implementation/AzureFirewallsInner.java", "license": "mit", "size": 54268 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,216,086
public static String getString(JsonObject object, String field, String defaultValue) { final JsonValue value = object.get(field); if (value == null) { return defaultValue; } else { return value.asString(); } }
static String function(JsonObject object, String field, String defaultValue) { final JsonValue value = object.get(field); if (value == null) { return defaultValue; } else { return value.asString(); } }
/** * Returns a field in a Json object as a string. * * @param object the Json Object * @param field the field in the Json object to return * @param defaultValue a default value for the field if the field value is null * @return the Json field value as a string */
Returns a field in a Json object as a string
getString
{ "repo_name": "tombujok/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java", "license": "apache-2.0", "size": 9726 }
[ "com.eclipsesource.json.JsonObject", "com.eclipsesource.json.JsonValue" ]
import com.eclipsesource.json.JsonObject; import com.eclipsesource.json.JsonValue;
import com.eclipsesource.json.*;
[ "com.eclipsesource.json" ]
com.eclipsesource.json;
2,526,735
@Override public synchronized void prepareCommit() throws IOException { ensureOpen(); // LUCENE-4972: if we always call setCommitData, we create empty commits String epochStr = indexWriter.getCommitData().get(INDEX_EPOCH); if (epochStr == null || Long.parseLong(epochStr, 16) != indexEpoch) { indexWriter.setCommitData(combinedCommitData(indexWriter.getCommitData())); } indexWriter.prepareCommit(); }
synchronized void function() throws IOException { ensureOpen(); String epochStr = indexWriter.getCommitData().get(INDEX_EPOCH); if (epochStr == null Long.parseLong(epochStr, 16) != indexEpoch) { indexWriter.setCommitData(combinedCommitData(indexWriter.getCommitData())); } indexWriter.prepareCommit(); }
/** * prepare most of the work needed for a two-phase commit. * See {@link IndexWriter#prepareCommit}. */
prepare most of the work needed for a two-phase commit. See <code>IndexWriter#prepareCommit</code>
prepareCommit
{ "repo_name": "visouza/solr-5.0.0", "path": "lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyWriter.java", "license": "apache-2.0", "size": 37530 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,797,617
public LifecycleCallbackType<InterceptorType<T>> createPreDestroy() { return new LifecycleCallbackTypeImpl<InterceptorType<T>>(this, "pre-destroy", childNode); }
LifecycleCallbackType<InterceptorType<T>> function() { return new LifecycleCallbackTypeImpl<InterceptorType<T>>(this, STR, childNode); }
/** * Creates a new <code>pre-destroy</code> element * @return the new created instance of <code>LifecycleCallbackType<InterceptorType<T>></code> */
Creates a new <code>pre-destroy</code> element
createPreDestroy
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar32/InterceptorTypeImpl.java", "license": "epl-1.0", "size": 60039 }
[ "org.jboss.shrinkwrap.descriptor.api.ejbjar32.InterceptorType", "org.jboss.shrinkwrap.descriptor.api.javaee7.LifecycleCallbackType", "org.jboss.shrinkwrap.descriptor.impl.javaee7.LifecycleCallbackTypeImpl" ]
import org.jboss.shrinkwrap.descriptor.api.ejbjar32.InterceptorType; import org.jboss.shrinkwrap.descriptor.api.javaee7.LifecycleCallbackType; import org.jboss.shrinkwrap.descriptor.impl.javaee7.LifecycleCallbackTypeImpl;
import org.jboss.shrinkwrap.descriptor.api.ejbjar32.*; import org.jboss.shrinkwrap.descriptor.api.javaee7.*; import org.jboss.shrinkwrap.descriptor.impl.javaee7.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
2,413,898
public Session getSession() { return this.session; }
Session function() { return this.session; }
/** * Gets the session involved in this event. * * @return The event's session. */
Gets the session involved in this event
getSession
{ "repo_name": "Steveice10/PacketLib", "path": "src/main/java/com/github/steveice10/packetlib/event/server/SessionRemovedEvent.java", "license": "mit", "size": 1119 }
[ "com.github.steveice10.packetlib.Session" ]
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.*;
[ "com.github.steveice10" ]
com.github.steveice10;
1,258,428
private String checkDatabaseSafeStringToRecordValue(DataType dataType, String value) throws SQLException { ResultSet resultSet = mock(ResultSet.class); when(resultSet.getBigDecimal(anyInt())).thenReturn(value == null ? null : new BigDecimal(value)); if (value == null) { when(resultSet.wasNull()).thenReturn(true); } else { when(resultSet.getBoolean(anyInt())).thenReturn(value.equals("1")); } return testDialect.resultSetToRecord(resultSet, ImmutableList.of(column("a", dataType))).getString("a"); }
String function(DataType dataType, String value) throws SQLException { ResultSet resultSet = mock(ResultSet.class); when(resultSet.getBigDecimal(anyInt())).thenReturn(value == null ? null : new BigDecimal(value)); if (value == null) { when(resultSet.wasNull()).thenReturn(true); } else { when(resultSet.getBoolean(anyInt())).thenReturn(value.equals("1")); } return testDialect.resultSetToRecord(resultSet, ImmutableList.of(column("a", dataType))).getString("a"); }
/** * Format a value through the result set record for testing. * * @param value The value to format. * @return The formatted value. */
Format a value through the result set record for testing
checkDatabaseSafeStringToRecordValue
{ "repo_name": "badgerwithagun/morf", "path": "morf-testsupport/src/main/java/org/alfasoftware/morf/jdbc/AbstractSqlDialectTest.java", "license": "apache-2.0", "size": 201465 }
[ "com.google.common.collect.ImmutableList", "java.math.BigDecimal", "java.sql.ResultSet", "java.sql.SQLException", "org.alfasoftware.morf.metadata.DataType", "org.mockito.Mockito" ]
import com.google.common.collect.ImmutableList; import java.math.BigDecimal; import java.sql.ResultSet; import java.sql.SQLException; import org.alfasoftware.morf.metadata.DataType; import org.mockito.Mockito;
import com.google.common.collect.*; import java.math.*; import java.sql.*; import org.alfasoftware.morf.metadata.*; import org.mockito.*;
[ "com.google.common", "java.math", "java.sql", "org.alfasoftware.morf", "org.mockito" ]
com.google.common; java.math; java.sql; org.alfasoftware.morf; org.mockito;
2,713,448
public void importOrgUnitModel(final HttpServletRequest request, final HttpServletResponse response, final ServletExecutionContext context) throws Exception { runImport(new OrgUnitModelHandler(), request, response, context); }
void function(final HttpServletRequest request, final HttpServletResponse response, final ServletExecutionContext context) throws Exception { runImport(new OrgUnitModelHandler(), request, response, context); }
/** * import Orgunit Model * * @param request * @param response * @param context * @throws Exception */
import Orgunit Model
importOrgUnitModel
{ "repo_name": "Raphcal/sigmah", "path": "src/main/java/org/sigmah/server/servlet/ImportServlet.java", "license": "gpl-3.0", "size": 8986 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.sigmah.server.servlet.base.ServletExecutionContext", "org.sigmah.server.servlet.exporter.models.OrgUnitModelHandler" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.sigmah.server.servlet.base.ServletExecutionContext; import org.sigmah.server.servlet.exporter.models.OrgUnitModelHandler;
import javax.servlet.http.*; import org.sigmah.server.servlet.base.*; import org.sigmah.server.servlet.exporter.models.*;
[ "javax.servlet", "org.sigmah.server" ]
javax.servlet; org.sigmah.server;
1,818,836
public static byte[] toBytes(ByteBuffer buffer, int startPosition) { int originalPosition = buffer.position(); byte[] output = new byte[buffer.limit() - startPosition]; buffer.position(startPosition); buffer.get(output); buffer.position(originalPosition); return output; }
static byte[] function(ByteBuffer buffer, int startPosition) { int originalPosition = buffer.position(); byte[] output = new byte[buffer.limit() - startPosition]; buffer.position(startPosition); buffer.get(output); buffer.position(originalPosition); return output; }
/** * Copy the bytes from position to limit into a new byte[] of the exact length and sets the * position and limit back to their original values (though not thread safe). * @param buffer copy from here * @param startPosition put buffer.get(startPosition) into byte[0] * @return a new byte[] containing the bytes in the specified range */
Copy the bytes from position to limit into a new byte[] of the exact length and sets the position and limit back to their original values (though not thread safe)
toBytes
{ "repo_name": "tobegit3hub/hbase", "path": "hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java", "license": "apache-2.0", "size": 13483 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
2,355,998
public String getChangeNewValue() { String newValue = ((EntityChange)changesDataTable.getRowData()).getNewValue(); return getChangeValue(newValue); }
String function() { String newValue = ((EntityChange)changesDataTable.getRowData()).getNewValue(); return getChangeValue(newValue); }
/** * Returns the current change in changes data table "new value" * * @return */
Returns the current change in changes data table "new value"
getChangeNewValue
{ "repo_name": "autentia/TNTConcept", "path": "tntconcept-web/src/main/java/com/autentia/tnt/bean/contacts/ContactBean.java", "license": "gpl-3.0", "size": 31220 }
[ "com.autentia.tnt.tracking.EntityChange" ]
import com.autentia.tnt.tracking.EntityChange;
import com.autentia.tnt.tracking.*;
[ "com.autentia.tnt" ]
com.autentia.tnt;
1,776,348
public RequestDelete<SyncanoClass> deleteSyncanoClass(String name) { String url = String.format(Constants.CLASSES_DETAIL_URL, getNotEmptyInstanceName(), name); return new RequestDelete<>(SyncanoClass.class, url, this); }
RequestDelete<SyncanoClass> function(String name) { String url = String.format(Constants.CLASSES_DETAIL_URL, getNotEmptyInstanceName(), name); return new RequestDelete<>(SyncanoClass.class, url, this); }
/** * Delete a Class. * * @param name Class to delete. * @return RequestDelete<SyncanoClass> */
Delete a Class
deleteSyncanoClass
{ "repo_name": "Syncano/syncano-android", "path": "library/src/main/java/com/syncano/library/SyncanoDashboard.java", "license": "mit", "size": 24946 }
[ "com.syncano.library.api.RequestDelete", "com.syncano.library.data.SyncanoClass" ]
import com.syncano.library.api.RequestDelete; import com.syncano.library.data.SyncanoClass;
import com.syncano.library.api.*; import com.syncano.library.data.*;
[ "com.syncano.library" ]
com.syncano.library;
1,590,271
public TokenHolder exit() { currentHolderCheck("Cannot exit, no more TokenHolders!"); return current.pollLast(); }
TokenHolder function() { currentHolderCheck(STR); return current.pollLast(); }
/** * Exit current TokenHolder and return that. * * @return TokenHolder removed */
Exit current TokenHolder and return that
exit
{ "repo_name": "JonathanxD/TextLexer", "path": "src/main/java/com/github/jonathanxd/textlexer/ext/parser/structure/ParseSection.java", "license": "agpl-3.0", "size": 5565 }
[ "com.github.jonathanxd.textlexer.ext.parser.holder.TokenHolder" ]
import com.github.jonathanxd.textlexer.ext.parser.holder.TokenHolder;
import com.github.jonathanxd.textlexer.ext.parser.holder.*;
[ "com.github.jonathanxd" ]
com.github.jonathanxd;
523,167
// public Map<String, String> getSoftwareVersion(Connection c) throws BadServerResponse, XenAPIException, XmlRpcException { String method_call = "host.get_software_version"; String session = c.getSessionReference(); Object[] method_params = { Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref) }; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toMapOfStringString(result); }
Map<String, String> function(Connection c) throws BadServerResponse, XenAPIException, XmlRpcException { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = { Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref) }; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toMapOfStringString(result); }
/** * Get the software_version field of the given host. * * @return value of the field */
Get the software_version field of the given host
getSoftwareVersion
{ "repo_name": "Hearen/OnceServer", "path": "pool_management/bn-xend-core/src/main/java/com/beyondsphere/xenapi/Host.java", "license": "mit", "size": 128300 }
[ "com.beyondsphere.xenapi.Types", "java.util.Map", "org.apache.xmlrpc.XmlRpcException" ]
import com.beyondsphere.xenapi.Types; import java.util.Map; import org.apache.xmlrpc.XmlRpcException;
import com.beyondsphere.xenapi.*; import java.util.*; import org.apache.xmlrpc.*;
[ "com.beyondsphere.xenapi", "java.util", "org.apache.xmlrpc" ]
com.beyondsphere.xenapi; java.util; org.apache.xmlrpc;
1,405,245
@Override public void close() throws IOException { final boolean closed = finished.getAndSet(true); if (closed) { return; } // Close the stream IOException exc = null; try { super.close(); } catch (final IOException ioe) { exc = ioe; } // Notify that the stream has been closed try { onClose(); } catch (final IOException ioe) { exc = ioe; } if (exc != null) { throw exc; } }
void function() throws IOException { final boolean closed = finished.getAndSet(true); if (closed) { return; } IOException exc = null; try { super.close(); } catch (final IOException ioe) { exc = ioe; } try { onClose(); } catch (final IOException ioe) { exc = ioe; } if (exc != null) { throw exc; } }
/** * Closes this input stream and releases any system resources * associated with the stream. * @throws IOException if an error occurs. */
Closes this input stream and releases any system resources associated with the stream
close
{ "repo_name": "mohanaraosv/commons-vfs", "path": "core/src/main/java/org/apache/commons/vfs2/util/MonitorInputStream.java", "license": "apache-2.0", "size": 4293 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
267,256
public Date getDate() { if (this.date == null) { this.date = new Date(); } return this.date; }
Date function() { if (this.date == null) { this.date = new Date(); } return this.date; }
/** * Get Date * * @return Date */
Get Date
getDate
{ "repo_name": "thomazaudio/EstradaRealSeminovos", "path": "source/pagseguro-api/src/br/com/uol/pagseguro/domain/TransactionSummary.java", "license": "apache-2.0", "size": 7776 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,915,660
public String asPathString() { return directories.stream().map(File::getAbsolutePath).collect(Collectors.joining(File.pathSeparator)); }
String function() { return directories.stream().map(File::getAbsolutePath).collect(Collectors.joining(File.pathSeparator)); }
/** * Returns the path string. * @return the path string */
Returns the path string
asPathString
{ "repo_name": "asakusafw/asakusafw-m3bp", "path": "compiler/common/src/main/java/com/asakusafw/m3bp/compiler/common/CommandPath.java", "license": "apache-2.0", "size": 4084 }
[ "java.io.File", "java.util.stream.Collectors" ]
import java.io.File; import java.util.stream.Collectors;
import java.io.*; import java.util.stream.*;
[ "java.io", "java.util" ]
java.io; java.util;
305,071
@Override public void warning(final Marker marker, final Message message, final Throwable throwable) { logWrapper.logIfEnabled(loggerName, Level.WARN, marker, message, throwable); }
void function(final Marker marker, final Message message, final Throwable throwable) { logWrapper.logIfEnabled(loggerName, Level.WARN, marker, message, throwable); }
/** * Logs a message with the specific Marker at the {@code Level.WARN} level. * * @param marker the marker data specific to this log statement * @param message the message string to be logged * @param throwable A Throwable or null. */
Logs a message with the specific Marker at the Level.WARN level
warning
{ "repo_name": "PurelyApplied/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogWriterLogger.java", "license": "apache-2.0", "size": 56907 }
[ "org.apache.logging.log4j.Level", "org.apache.logging.log4j.Marker", "org.apache.logging.log4j.message.Message" ]
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.*; import org.apache.logging.log4j.message.*;
[ "org.apache.logging" ]
org.apache.logging;
2,215,550
protected void computerVerifyDataSSLv3(byte[] sender, byte[] buf) { MessageDigest md5; MessageDigest sha; try { md5 = MessageDigest.getInstance("MD5"); sha = MessageDigest.getInstance("SHA-1"); } catch (Exception e) { fatalAlert(AlertProtocol.INTERNAL_ERROR, "Could not initialize the Digest Algorithms.", e); return; } try { byte[] hanshake_messages = io_stream.getMessages(); md5.update(hanshake_messages); md5.update(sender); md5.update(session.master_secret); byte[] b = md5.digest(SSLv3Constants.MD5pad1); md5.update(session.master_secret); md5.update(SSLv3Constants.MD5pad2); System.arraycopy(md5.digest(b), 0, buf, 0, 16); sha.update(hanshake_messages); sha.update(sender); sha.update(session.master_secret); b = sha.digest(SSLv3Constants.SHApad1); sha.update(session.master_secret); sha.update(SSLv3Constants.SHApad2); System.arraycopy(sha.digest(b), 0, buf, 16, 20); } catch (Exception e) { fatalAlert(AlertProtocol.INTERNAL_ERROR, "INTERNAL ERROR", e); } }
void function(byte[] sender, byte[] buf) { MessageDigest md5; MessageDigest sha; try { md5 = MessageDigest.getInstance("MD5"); sha = MessageDigest.getInstance("SHA-1"); } catch (Exception e) { fatalAlert(AlertProtocol.INTERNAL_ERROR, STR, e); return; } try { byte[] hanshake_messages = io_stream.getMessages(); md5.update(hanshake_messages); md5.update(sender); md5.update(session.master_secret); byte[] b = md5.digest(SSLv3Constants.MD5pad1); md5.update(session.master_secret); md5.update(SSLv3Constants.MD5pad2); System.arraycopy(md5.digest(b), 0, buf, 0, 16); sha.update(hanshake_messages); sha.update(sender); sha.update(session.master_secret); b = sha.digest(SSLv3Constants.SHApad1); sha.update(session.master_secret); sha.update(SSLv3Constants.SHApad2); System.arraycopy(sha.digest(b), 0, buf, 16, 20); } catch (Exception e) { fatalAlert(AlertProtocol.INTERNAL_ERROR, STR, e); } }
/** * Computer SSLv3 verify_data * * @see SSLv3 spec. 7.6.9. Finished * @param label * @param buf */
Computer SSLv3 verify_data
computerVerifyDataSSLv3
{ "repo_name": "webos21/xi", "path": "java/jcl/src/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java", "license": "apache-2.0", "size": 13833 }
[ "java.security.MessageDigest" ]
import java.security.MessageDigest;
import java.security.*;
[ "java.security" ]
java.security;
1,007,053
public List<String> buildCommandLine( String command, NestedSetBuilder<Artifact> inputs, CommandConstructor constructor) { Pair<List<String>, Artifact> argvAndScriptFile = buildCommandLineMaybeWithScriptFile(ruleContext, command, constructor); if (argvAndScriptFile.second != null) { inputs.add(argvAndScriptFile.second); } return argvAndScriptFile.first; }
List<String> function( String command, NestedSetBuilder<Artifact> inputs, CommandConstructor constructor) { Pair<List<String>, Artifact> argvAndScriptFile = buildCommandLineMaybeWithScriptFile(ruleContext, command, constructor); if (argvAndScriptFile.second != null) { inputs.add(argvAndScriptFile.second); } return argvAndScriptFile.first; }
/** * Builds the set of command-line arguments using the specified shell path. Creates a bash script * if the command line is longer than the allowed maximum {@link #maxCommandLength}. Fixes up the * input artifact list with the created bash script when required. */
Builds the set of command-line arguments using the specified shell path. Creates a bash script if the command line is longer than the allowed maximum <code>#maxCommandLength</code>. Fixes up the input artifact list with the created bash script when required
buildCommandLine
{ "repo_name": "werkt/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java", "license": "apache-2.0", "size": 15132 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder", "com.google.devtools.build.lib.util.Pair", "java.util.List" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.util.Pair; import java.util.List;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.collect.nestedset.*; import com.google.devtools.build.lib.util.*; import java.util.*;
[ "com.google.devtools", "java.util" ]
com.google.devtools; java.util;
2,118,315
void enterArrayType(@NotNull GolangParser.ArrayTypeContext ctx); void exitArrayType(@NotNull GolangParser.ArrayTypeContext ctx);
void enterArrayType(@NotNull GolangParser.ArrayTypeContext ctx); void exitArrayType(@NotNull GolangParser.ArrayTypeContext ctx);
/** * Exit a parse tree produced by {@link GolangParser#arrayType}. * @param ctx the parse tree */
Exit a parse tree produced by <code>GolangParser#arrayType</code>
exitArrayType
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/GolangListener.java", "license": "gpl-3.0", "size": 35467 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,315,683
long getByteBufferHandler(long id, ByteBuffer buf);
long getByteBufferHandler(long id, ByteBuffer buf);
/** * get the handler of a nonvolatile bytebuffer * * @param id * the identifier of backed memory pool * * @param buf * the nonvolatile bytebuffer * * @return the handler of this specified nonvolatile bytebuffer * */
get the handler of a nonvolatile bytebuffer
getByteBufferHandler
{ "repo_name": "johnugeorge/incubator-mnemonic", "path": "mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/NonVolatileMemoryAllocatorService.java", "license": "apache-2.0", "size": 4128 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
352,511
private String timeAgo(Date date, boolean css) { if (isToday(date) || isYesterday(date)) { int mins = minutesAgo(date, true); if (mins >= 120) { if (css) { return "age1"; } int hours = hoursAgo(date, true); if (hours > 23) { return yesterday(); } else { return translate(hours, "gb.time.hoursAgo", "{0} hours ago"); } } if (css) { return "age0"; } if (mins > 2) { return translate(mins, "gb.time.minsAgo", "{0} mins ago"); } return translate("gb.time.justNow", "just now"); } else { int days = daysAgo(date); if (css) { if (days <= 7) { return "age2"; } if (days <= 30) { return "age3"; } else { return "age4"; } } if (days < 365) { if (days <= 30) { return translate(days, "gb.time.daysAgo", "{0} days ago"); } else if (days <= 90) { int weeks = days / 7; if (weeks == 12) { return translate(3, "gb.time.monthsAgo", "{0} months ago"); } else { return translate(weeks, "gb.time.weeksAgo", "{0} weeks ago"); } } int months = days / 30; int weeks = (days % 30) / 7; if (weeks >= 2) { months++; } return translate(months, "gb.time.monthsAgo", "{0} months ago"); } else if (days == 365) { return translate("gb.time.oneYearAgo", "1 year ago"); } else { int yr = days / 365; days = days % 365; int months = (yr * 12) + (days / 30); if (months > 23) { return translate(yr, "gb.time.yearsAgo", "{0} years ago"); } else { return translate(months, "gb.time.monthsAgo", "{0} months ago"); } } } }
String function(Date date, boolean css) { if (isToday(date) isYesterday(date)) { int mins = minutesAgo(date, true); if (mins >= 120) { if (css) { return "age1"; } int hours = hoursAgo(date, true); if (hours > 23) { return yesterday(); } else { return translate(hours, STR, STR); } } if (css) { return "age0"; } if (mins > 2) { return translate(mins, STR, STR); } return translate(STR, STR); } else { int days = daysAgo(date); if (css) { if (days <= 7) { return "age2"; } if (days <= 30) { return "age3"; } else { return "age4"; } } if (days < 365) { if (days <= 30) { return translate(days, STR, STR); } else if (days <= 90) { int weeks = days / 7; if (weeks == 12) { return translate(3, STR, STR); } else { return translate(weeks, STR, STR); } } int months = days / 30; int weeks = (days % 30) / 7; if (weeks >= 2) { months++; } return translate(months, STR, STR); } else if (days == 365) { return translate(STR, STR); } else { int yr = days / 365; days = days % 365; int months = (yr * 12) + (days / 30); if (months > 23) { return translate(yr, STR, STR); } else { return translate(months, STR, STR); } } } }
/** * Returns the string representation of the duration OR the css class for * the duration. * * @param date * @param css * @return the string representation of the duration OR the css class */
Returns the string representation of the duration OR the css class for the duration
timeAgo
{ "repo_name": "BullShark/IRCBlit", "path": "src/main/java/com/gitblit/utils/TimeUtils.java", "license": "apache-2.0", "size": 9118 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,900,017
@Override public java.util.Date getCreateDate() { return _newUserLog.getCreateDate(); }
java.util.Date function() { return _newUserLog.getCreateDate(); }
/** * Returns the create date of this new user log. * * @return the create date of this new user log */
Returns the create date of this new user log
getCreateDate
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-core-logging-portlet/docroot/WEB-INF/service/org/oep/core/logging/model/NewUserLogWrapper.java", "license": "apache-2.0", "size": 12023 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,009,393
public static void handleErrorViolations(Formatter formatter, long numErrors) { ExitCode exitCode = formatter.getExitStatus(numErrors); if (exitCode != ExitCode.SUCCESS) { System.exit(exitCode.ordinal()); } }
static void function(Formatter formatter, long numErrors) { ExitCode exitCode = formatter.getExitStatus(numErrors); if (exitCode != ExitCode.SUCCESS) { System.exit(exitCode.ordinal()); } }
/** * Non-zero exit status when any violation messages have Severity.ERROR, controlled by --max-severity */
Non-zero exit status when any violation messages have Severity.ERROR, controlled by --max-severity
handleErrorViolations
{ "repo_name": "sleekbyte/tailor", "path": "src/main/java/com/sleekbyte/tailor/Tailor.java", "license": "mit", "size": 16298 }
[ "com.sleekbyte.tailor.common.ExitCode", "com.sleekbyte.tailor.format.Formatter" ]
import com.sleekbyte.tailor.common.ExitCode; import com.sleekbyte.tailor.format.Formatter;
import com.sleekbyte.tailor.common.*; import com.sleekbyte.tailor.format.*;
[ "com.sleekbyte.tailor" ]
com.sleekbyte.tailor;
2,144,916
@javax.annotation.Nullable @ApiModelProperty(value = "") public V1ListMeta getMetadata() { return metadata; }
@javax.annotation.Nullable @ApiModelProperty(value = "") V1ListMeta function() { return metadata; }
/** * Get metadata * * @return metadata */
Get metadata
getMetadata
{ "repo_name": "kubernetes-client/java", "path": "kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1beta1CSIStorageCapacityList.java", "license": "apache-2.0", "size": 6284 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,430,193
public Map<String, Boolean> getNodeListWithStatus() { // create result hash map. Map<String, Boolean> result = new HashMap<String, Boolean>(); if ((nodePattern != null) && !nodePattern.isEmpty() && !nodePattern.equals(Constant.Strings.SPACE)) { // split the nodePattern on Comma String[] splittedNodeArray = this.nodePattern .split(Constant.Strings.SPACE); Boolean isReachable = false; for (String host : splittedNodeArray) { try { isReachable = InetAddress.getByName(host.trim()) .isReachable(3000); result.put(host.trim(), isReachable); } catch (Exception e) { logger.error(e.getMessage(), e); } } } return result; }
Map<String, Boolean> function() { Map<String, Boolean> result = new HashMap<String, Boolean>(); if ((nodePattern != null) && !nodePattern.isEmpty() && !nodePattern.equals(Constant.Strings.SPACE)) { String[] splittedNodeArray = this.nodePattern .split(Constant.Strings.SPACE); Boolean isReachable = false; for (String host : splittedNodeArray) { try { isReachable = InetAddress.getByName(host.trim()) .isReachable(3000); result.put(host.trim(), isReachable); } catch (Exception e) { logger.error(e.getMessage(), e); } } } return result; }
/** * Gets the node list with status. * * @return the node list with status */
Gets the node list with status
getNodeListWithStatus
{ "repo_name": "impetus-opensource/ankush", "path": "ankush/src/main/java/com/impetus/ankush/common/utils/NmapUtil.java", "license": "lgpl-3.0", "size": 6857 }
[ "com.impetus.ankush2.constant.Constant", "java.net.InetAddress", "java.util.HashMap", "java.util.Map" ]
import com.impetus.ankush2.constant.Constant; import java.net.InetAddress; import java.util.HashMap; import java.util.Map;
import com.impetus.ankush2.constant.*; import java.net.*; import java.util.*;
[ "com.impetus.ankush2", "java.net", "java.util" ]
com.impetus.ankush2; java.net; java.util;
40,587
@Override public void activateOptions() throws FlumeException { try { final Properties properties = getProperties(hosts, selector, maxBackoff, getTimeout()); rpcClient = RpcClientFactory.getInstance(properties); if (layout != null) { layout.activateOptions(); } configured = true; } catch (Exception e) { String errormsg = "RPC client creation failed! " + e.getMessage(); LogLog.error(errormsg); if (getUnsafeMode()) { return; } throw new FlumeException(e); } initializeClientAddress(); }
void function() throws FlumeException { try { final Properties properties = getProperties(hosts, selector, maxBackoff, getTimeout()); rpcClient = RpcClientFactory.getInstance(properties); if (layout != null) { layout.activateOptions(); } configured = true; } catch (Exception e) { String errormsg = STR + e.getMessage(); LogLog.error(errormsg); if (getUnsafeMode()) { return; } throw new FlumeException(e); } initializeClientAddress(); }
/** * Activate the options set using <tt>setHosts()</tt>, <tt>setSelector</tt> * and <tt>setMaxBackoff</tt> * * @throws FlumeException * if the LoadBalancingRpcClient cannot be instantiated. */
Activate the options set using setHosts(), setSelector and setMaxBackoff
activateOptions
{ "repo_name": "tmgstevens/flume", "path": "flume-ng-clients/flume-ng-log4jappender/src/main/java/org/apache/flume/clients/log4jappender/LoadBalancingLog4jAppender.java", "license": "apache-2.0", "size": 6347 }
[ "java.util.Properties", "org.apache.flume.FlumeException", "org.apache.flume.api.RpcClientFactory", "org.apache.log4j.helpers.LogLog" ]
import java.util.Properties; import org.apache.flume.FlumeException; import org.apache.flume.api.RpcClientFactory; import org.apache.log4j.helpers.LogLog;
import java.util.*; import org.apache.flume.*; import org.apache.flume.api.*; import org.apache.log4j.helpers.*;
[ "java.util", "org.apache.flume", "org.apache.log4j" ]
java.util; org.apache.flume; org.apache.log4j;
1,807,436
protected void createDictionary(BufferedReader in) throws IOException { String line = ""; while (line != null) { line = in.readLine(); if (line != null) { line = new String(line.toCharArray()); putWord(line); } } }
void function(BufferedReader in) throws IOException { String line = ""; while (line != null) { line = in.readLine(); if (line != null) { line = new String(line.toCharArray()); putWord(line); } } }
/** * Constructs the dictionary from a word list file. * <p> * Each word in the reader should be on a separate line. * <p> * This is a very slow function. On my machine it takes quite a while to * load the data in. I suspect that we could speed this up quite allot. */
Constructs the dictionary from a word list file. Each word in the reader should be on a separate line. This is a very slow function. On my machine it takes quite a while to load the data in. I suspect that we could speed this up quite allot
createDictionary
{ "repo_name": "Thecarisma/powertext", "path": "Power Text Spell Checker/src/com/power/text/spell/engine/GenericSpellDictionary.java", "license": "gpl-3.0", "size": 6784 }
[ "java.io.BufferedReader", "java.io.IOException" ]
import java.io.BufferedReader; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
268,230
public Date getSharedAccessStartTime() { return this.sharedAccessStartTime; }
Date function() { return this.sharedAccessStartTime; }
/** * Gets the start time for a shared access signature associated with this shared access policy. * * @return A <code>java.util.Date</code> object which contains the shared access signature start time. */
Gets the start time for a shared access signature associated with this shared access policy
getSharedAccessStartTime
{ "repo_name": "risezhang/azure-storage-cli", "path": "src/main/java/com/microsoft/azure/storage/SharedAccessPolicy.java", "license": "mit", "size": 3351 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
739,750