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
|
---|---|---|---|---|---|---|---|---|---|---|---|
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
defaultValue = "false")
@SimpleProperty
public void AllowCookies(boolean allowCookies) {
this.allowCookies = allowCookies;
if (allowCookies && cookieHandler == null) {
form.dispatchErrorOccurredEvent(this, "AllowCookies",
ErrorMessages.ERROR_FUNCTIONALITY_NOT_SUPPORTED_WEB_COOKIES);
}
} | @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "false") void function(boolean allowCookies) { this.allowCookies = allowCookies; if (allowCookies && cookieHandler == null) { form.dispatchErrorOccurredEvent(this, STR, ErrorMessages.ERROR_FUNCTIONALITY_NOT_SUPPORTED_WEB_COOKIES); } } | /**
* Specifies whether cookies should be allowed
*/ | Specifies whether cookies should be allowed | AllowCookies | {
"repo_name": "farxinu/appinventor-sources",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/Web.java",
"license": "apache-2.0",
"size": 46122
} | [
"com.google.appinventor.components.annotations.DesignerProperty",
"com.google.appinventor.components.common.PropertyTypeConstants",
"com.google.appinventor.components.runtime.util.ErrorMessages"
] | import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants; import com.google.appinventor.components.runtime.util.ErrorMessages; | import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*; import com.google.appinventor.components.runtime.util.*; | [
"com.google.appinventor"
] | com.google.appinventor; | 1,756,316 |
EClass getGuardToLongMap(); | EClass getGuardToLongMap(); | /**
* Returns the meta object for class '{@link java.util.Map.Entry <em>Guard To Long Map</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Guard To Long Map</em>'.
* @see java.util.Map.Entry
* @model keyType="turnus.model.dataflow.Guard"
* valueDataType="org.eclipse.emf.ecore.ELongObject"
* @generated
*/ | Returns the meta object for class '<code>java.util.Map.Entry Guard To Long Map</code>'. | getGuardToLongMap | {
"repo_name": "turnus/turnus",
"path": "turnus.model/src/turnus/model/analysis/map/MapPackage.java",
"license": "gpl-3.0",
"size": 77072
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,533,990 |
protected ParseMessage parse() {
if (!tablesLoaded) {
return ParseMessage.NOT_LOADED_ERROR;
}
Token read;
ParseMessage parseMessage = ParseMessage.UNDEFINED;
// Loop until a breakable event
boolean done = false;
while (!done) {
if (inputTokens.size() == 0) {
read = nextToken();
inputTokens.push(read);
// Handle the case where an unterminated comment block consumes the entire program
if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) {
// Runaway group
parseMessage = ParseMessage.GROUP_ERROR;
} else {
// A good token was read
parseMessage = ParseMessage.TOKEN_READ;
}
done = true;
} else {
read = inputTokens.peek();
currentPosition.set(read.getPosition()); // Update current position
if (SymbolType.NOISE.equals(read.getType())) {
// Discard token - these tokens were already reported to the user
inputTokens.pop();
} else if (SymbolType.ERROR.equals(read.getType())) {
parseMessage = ParseMessage.LEXICAL_ERROR;
done = true;
} else if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) {
// Runaway group
parseMessage = ParseMessage.GROUP_ERROR;
done = true;
} else {
ParseResult parseResult = parseLALR(read); // Same method as v1
switch (parseResult) {
case ACCEPT:
parseMessage = ParseMessage.ACCEPT;
done = true;
break;
case INTERNAL_ERROR:
parseMessage = ParseMessage.INTERNAL_ERROR;
done = true;
break;
case REDUCE_NORMAL:
parseMessage = ParseMessage.REDUCTION;
done = true;
break;
case SHIFT:
// ParseToken() shifted the token on the front of the Token-Queue. It
// now exists on the Token-Stack and must be eliminated from the queue.
inputTokens.remove(0);
break;
case SYNTAX_ERROR:
parseMessage = ParseMessage.SYNTAX_ERROR;
done = true;
break;
case REDUCE_ELIMINATED: // fall through intended
case UNDEFINED:
// do nothing
break;
}
}
}
}
return parseMessage;
} | ParseMessage function() { if (!tablesLoaded) { return ParseMessage.NOT_LOADED_ERROR; } Token read; ParseMessage parseMessage = ParseMessage.UNDEFINED; boolean done = false; while (!done) { if (inputTokens.size() == 0) { read = nextToken(); inputTokens.push(read); if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) { parseMessage = ParseMessage.GROUP_ERROR; } else { parseMessage = ParseMessage.TOKEN_READ; } done = true; } else { read = inputTokens.peek(); currentPosition.set(read.getPosition()); if (SymbolType.NOISE.equals(read.getType())) { inputTokens.pop(); } else if (SymbolType.ERROR.equals(read.getType())) { parseMessage = ParseMessage.LEXICAL_ERROR; done = true; } else if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) { parseMessage = ParseMessage.GROUP_ERROR; done = true; } else { ParseResult parseResult = parseLALR(read); switch (parseResult) { case ACCEPT: parseMessage = ParseMessage.ACCEPT; done = true; break; case INTERNAL_ERROR: parseMessage = ParseMessage.INTERNAL_ERROR; done = true; break; case REDUCE_NORMAL: parseMessage = ParseMessage.REDUCTION; done = true; break; case SHIFT: inputTokens.remove(0); break; case SYNTAX_ERROR: parseMessage = ParseMessage.SYNTAX_ERROR; done = true; break; case REDUCE_ELIMINATED: case UNDEFINED: break; } } } } return parseMessage; } | /**
* Performs a parse action on the input stream. This method is typically used in a loop until
* either the grammar is accepted or an error occurs.
* @return ParseMessage
*/ | Performs a parse action on the input stream. This method is typically used in a loop until either the grammar is accepted or an error occurs | parse | {
"repo_name": "Epi-Info/Epi-Info-Android",
"path": "src/main/java/com/creativewidgetworks/goldparser/engine/Parser.java",
"license": "apache-2.0",
"size": 41820
} | [
"com.creativewidgetworks.goldparser.engine.enums.ParseMessage",
"com.creativewidgetworks.goldparser.engine.enums.ParseResult",
"com.creativewidgetworks.goldparser.engine.enums.SymbolType"
] | import com.creativewidgetworks.goldparser.engine.enums.ParseMessage; import com.creativewidgetworks.goldparser.engine.enums.ParseResult; import com.creativewidgetworks.goldparser.engine.enums.SymbolType; | import com.creativewidgetworks.goldparser.engine.enums.*; | [
"com.creativewidgetworks.goldparser"
] | com.creativewidgetworks.goldparser; | 1,252,836 |
public void removeTitle(Thing value) {
Base.remove(this.model, this.getResource(), TITLE, value);
} | void function(Thing value) { Base.remove(this.model, this.getResource(), TITLE, value); } | /**
* Removes a value of property Title given as an instance of Thing
*
* @param value
* the value to be removed
*
* [Generated from RDFReactor template rule #remove4dynamic]
*/ | Removes a value of property Title given as an instance of Thing | removeTitle | {
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-sioc/src/main/java/org/rdfs/sioc/Thing.java",
"license": "mit",
"size": 317844
} | [
"org.ontoware.rdfreactor.runtime.Base"
] | import org.ontoware.rdfreactor.runtime.Base; | import org.ontoware.rdfreactor.runtime.*; | [
"org.ontoware.rdfreactor"
] | org.ontoware.rdfreactor; | 1,084,078 |
public void testSingleGcn() {
Collection<DrugInfoVo> gcnSeqNos = new ArrayList<DrugInfoVo>();
DrugInfoVo one = new DrugInfoVo();
one.setGcnSeqNo("12000");
gcnSeqNos.add(one);
DrugInfoResultsVo results = capability.processDrugInfoRequest(gcnSeqNos);
System.out.println(results);
assertEquals("Incorrect number of drugs returned", 1, results.getDrugs().size());
assertEquals("All drugs should be found", 0, results.getDrugsNotFound().size());
for (DrugInfoVo drugInfoVo : results.getDrugs()) {
assertEquals("Incorrect number of routes for 12000", 1, drugInfoVo.getDoseRoutes().size());
assertEquals("Incorrect number of types for 12000", 2, drugInfoVo.getDoseTypes().size());
}
} | void function() { Collection<DrugInfoVo> gcnSeqNos = new ArrayList<DrugInfoVo>(); DrugInfoVo one = new DrugInfoVo(); one.setGcnSeqNo("12000"); gcnSeqNos.add(one); DrugInfoResultsVo results = capability.processDrugInfoRequest(gcnSeqNos); System.out.println(results); assertEquals(STR, 1, results.getDrugs().size()); assertEquals(STR, 0, results.getDrugsNotFound().size()); for (DrugInfoVo drugInfoVo : results.getDrugs()) { assertEquals(STR, 1, drugInfoVo.getDoseRoutes().size()); assertEquals(STR, 2, drugInfoVo.getDoseTypes().size()); } } | /**
* Test retrieving dose routes and types for one GCN sequence number
*/ | Test retrieving dose routes and types for one GCN sequence number | testSingleGcn | {
"repo_name": "OSEHRA-Sandbox/MOCHA",
"path": "test/gov/va/med/pharmacy/peps/external/common/drugdatavendor/capability/test/DrugInfoCapabilityTest.java",
"license": "apache-2.0",
"size": 5432
} | [
"gov.va.med.pharmacy.peps.common.vo.DrugInfoResultsVo",
"gov.va.med.pharmacy.peps.common.vo.DrugInfoVo",
"java.util.ArrayList",
"java.util.Collection"
] | import gov.va.med.pharmacy.peps.common.vo.DrugInfoResultsVo; import gov.va.med.pharmacy.peps.common.vo.DrugInfoVo; import java.util.ArrayList; import java.util.Collection; | import gov.va.med.pharmacy.peps.common.vo.*; import java.util.*; | [
"gov.va.med",
"java.util"
] | gov.va.med; java.util; | 810,321 |
public String toJson() {
try {
return new ObjectMapper().writeValueAsString(this);
} catch (IOException e) {
log.error("IOException serializing FsWriterMetrics as JSON! Returning no metrics", e);
return "{}";
}
} | String function() { try { return new ObjectMapper().writeValueAsString(this); } catch (IOException e) { log.error(STR, e); return "{}"; } } | /**
* Serialize this class to Json
*/ | Serialize this class to Json | toJson | {
"repo_name": "jinhyukchang/gobblin",
"path": "gobblin-api/src/main/java/org/apache/gobblin/writer/FsWriterMetrics.java",
"license": "apache-2.0",
"size": 2141
} | [
"java.io.IOException",
"org.codehaus.jackson.map.ObjectMapper"
] | import java.io.IOException; import org.codehaus.jackson.map.ObjectMapper; | import java.io.*; import org.codehaus.jackson.map.*; | [
"java.io",
"org.codehaus.jackson"
] | java.io; org.codehaus.jackson; | 2,377,866 |
public void testAddAllCollection() {
try {
range.addAll(new ArrayList());
fail("added values to empty range");
} catch (UnsupportedOperationException e) {
assertTrue("expected exception thrown", true);
}
} | void function() { try { range.addAll(new ArrayList()); fail(STR); } catch (UnsupportedOperationException e) { assertTrue(STR, true); } } | /**
* Test method for {@link groovy.lang.EmptyRange#addAll(java.util.Collection)}.
*/ | Test method for <code>groovy.lang.EmptyRange#addAll(java.util.Collection)</code> | testAddAllCollection | {
"repo_name": "fpavageau/groovy",
"path": "src/test/groovy/lang/EmptyRangeTest.java",
"license": "apache-2.0",
"size": 12119
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,029,269 |
public List<RelationTableView> getRelationTables() {
return relationTables;
}
| List<RelationTableView> function() { return relationTables; } | /**
* get the relationTables
*
* @return the relationTables
*/ | get the relationTables | getRelationTables | {
"repo_name": "qqming113/bi-platform",
"path": "designer/src/main/java/com/baidu/rigel/biplatform/ma/resource/view/DimBindConfigView.java",
"license": "apache-2.0",
"size": 3118
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,006,260 |
public static int compareNatural(Collator collator, String s, String t) {
return compareNatural(s, t, true, collator);
} | static int function(Collator collator, String s, String t) { return compareNatural(s, t, true, collator); } | /**
* <p>Compares two strings using the given collator and comparing contained numbers based on their numeric
* values.</p>
*
* @param s first string
* @param t second string
* @return zero iff <code>s</code> and <code>t</code> are equal,
* a value less than zero iff <code>s</code> lexicographically precedes <code>t</code>
* and a value larger than zero iff <code>s</code> lexicographically follows <code>t</code>
*/ | Compares two strings using the given collator and comparing contained numbers based on their numeric values | compareNatural | {
"repo_name": "daveallie/tnoodle-scrambles",
"path": "src/main/java/net/gnehzr/tnoodle/utils/Strings.java",
"license": "gpl-3.0",
"size": 15878
} | [
"java.text.Collator"
] | import java.text.Collator; | import java.text.*; | [
"java.text"
] | java.text; | 83,246 |
void process(Context context, BatchReference source) throws IOException;
public interface Context extends ExtensionContainer { | void process(Context context, BatchReference source) throws IOException; public interface Context extends ExtensionContainer { | /**
* Processes the batch.
* @param context the build context
* @param source the target batch
* @throws IOException if build was failed by I/O error
* @throws DiagnosticException if build was failed with diagnostics
*/ | Processes the batch | process | {
"repo_name": "ashigeru/asakusafw-compiler",
"path": "compiler-project/api/src/main/java/com/asakusafw/lang/compiler/api/BatchProcessor.java",
"license": "apache-2.0",
"size": 2866
} | [
"com.asakusafw.lang.compiler.api.reference.BatchReference",
"com.asakusafw.lang.compiler.common.ExtensionContainer",
"java.io.IOException"
] | import com.asakusafw.lang.compiler.api.reference.BatchReference; import com.asakusafw.lang.compiler.common.ExtensionContainer; import java.io.IOException; | import com.asakusafw.lang.compiler.api.reference.*; import com.asakusafw.lang.compiler.common.*; import java.io.*; | [
"com.asakusafw.lang",
"java.io"
] | com.asakusafw.lang; java.io; | 2,008,180 |
public Reader getReader() throws IOException {
if(bytes != null) {
return new InputStreamReader(new ByteArrayInputStream(bytes));
} else {
return new FileReader(file);
}
}
| Reader function() throws IOException { if(bytes != null) { return new InputStreamReader(new ByteArrayInputStream(bytes)); } else { return new FileReader(file); } } | /**
* Creates a <CODE>Reader</CODE> that can be used to read the
* contents of the uploaded file.
*
* @return a <CODE>Reader</CODE> for the contents
*/ | Creates a <code>Reader</code> that can be used to read the contents of the uploaded file | getReader | {
"repo_name": "social-computing/jmi-server",
"path": "jmi-server/src/main/java/com/socialcomputing/utils/servlet/UploadedFile.java",
"license": "gpl-3.0",
"size": 5721
} | [
"java.io.ByteArrayInputStream",
"java.io.FileReader",
"java.io.IOException",
"java.io.InputStreamReader",
"java.io.Reader"
] | import java.io.ByteArrayInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 523,050 |
public static String convertMapToString(Map<String, String> map,
String nvSep, String entrySep) {
StringBuffer sb = new StringBuffer();
if (map != null) {
for (Entry<String, String> entry : map.entrySet()) {
String el = entry.getKey();
sb.append(convertEntryToString(el, map.get(el), nvSep)).append(
entrySep);
}
}
String repr = sb.toString();
int pos = repr.lastIndexOf(entrySep);
return repr.substring(0, pos);
}
| static String function(Map<String, String> map, String nvSep, String entrySep) { StringBuffer sb = new StringBuffer(); if (map != null) { for (Entry<String, String> entry : map.entrySet()) { String el = entry.getKey(); sb.append(convertEntryToString(el, map.get(el), nvSep)).append( entrySep); } } String repr = sb.toString(); int pos = repr.lastIndexOf(entrySep); return repr.substring(0, pos); } | /**
* converts a map to string
*
* @param map
* the map to convert
* @param nvSep
* the nvp separator
* @param entrySep
* the separator of each entry
* @return the serialised map.
*/ | converts a map to string | convertMapToString | {
"repo_name": "goodjour/RestFixture",
"path": "src/main/java/smartrics/rest/fitnesse/fixture/support/Tools.java",
"license": "gpl-3.0",
"size": 22166
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 724,500 |
public RegisteredProject importProject(
String path,
SourceStorage sourceStorage,
boolean rewrite,
LineConsumerFactory lineConsumerFactory)
throws ServerException, IOException, ForbiddenException, UnauthorizedException,
ConflictException, NotFoundException {
fileWatcherManager.suspend();
try {
return doImportProject(path, sourceStorage, rewrite, lineConsumerFactory);
} finally {
fileWatcherManager.resume();
}
} | RegisteredProject function( String path, SourceStorage sourceStorage, boolean rewrite, LineConsumerFactory lineConsumerFactory) throws ServerException, IOException, ForbiddenException, UnauthorizedException, ConflictException, NotFoundException { fileWatcherManager.suspend(); try { return doImportProject(path, sourceStorage, rewrite, lineConsumerFactory); } finally { fileWatcherManager.resume(); } } | /**
* Import source code as a Basic type of Project
*
* @param path where to import
* @param sourceStorage where sources live
* @param rewrite whether rewrite or not (throw exception othervise) if such a project exists
* @return Project
* @throws ServerException
* @throws IOException
* @throws ForbiddenException
* @throws UnauthorizedException
* @throws ConflictException
* @throws NotFoundException
*/ | Import source code as a Basic type of Project | importProject | {
"repo_name": "Patricol/che",
"path": "wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/project/server/ProjectManager.java",
"license": "epl-1.0",
"size": 29057
} | [
"java.io.IOException",
"org.eclipse.che.api.core.ConflictException",
"org.eclipse.che.api.core.ForbiddenException",
"org.eclipse.che.api.core.NotFoundException",
"org.eclipse.che.api.core.ServerException",
"org.eclipse.che.api.core.UnauthorizedException",
"org.eclipse.che.api.core.model.project.SourceStorage",
"org.eclipse.che.api.core.util.LineConsumerFactory"
] | import java.io.IOException; import org.eclipse.che.api.core.ConflictException; import org.eclipse.che.api.core.ForbiddenException; import org.eclipse.che.api.core.NotFoundException; import org.eclipse.che.api.core.ServerException; import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.core.model.project.SourceStorage; import org.eclipse.che.api.core.util.LineConsumerFactory; | import java.io.*; import org.eclipse.che.api.core.*; import org.eclipse.che.api.core.model.project.*; import org.eclipse.che.api.core.util.*; | [
"java.io",
"org.eclipse.che"
] | java.io; org.eclipse.che; | 2,493,683 |
int countByExample(SubmissionsExample example); | int countByExample(SubmissionsExample example); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table public.submissions
*
* @mbggenerated Thu Mar 31 16:07:59 CST 2016
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table public.submissions | countByExample | {
"repo_name": "zjlywjh001/PhrackCTF-Platform-Personal",
"path": "src/main/java/top/phrack/ctf/models/dao/SubmissionsMapper.java",
"license": "apache-2.0",
"size": 3889
} | [
"top.phrack.ctf.pojo.SubmissionsExample"
] | import top.phrack.ctf.pojo.SubmissionsExample; | import top.phrack.ctf.pojo.*; | [
"top.phrack.ctf"
] | top.phrack.ctf; | 2,827,439 |
Consumer<String> getNewOptionHandler();
void setNewOptionHandler(Consumer<String> newOptionHandler); | Consumer<String> getNewOptionHandler(); void setNewOptionHandler(Consumer<String> newOptionHandler); | /**
* Set handler.
* @param newOptionHandler handler instance
*/ | Set handler | setNewOptionHandler | {
"repo_name": "dimone-kun/cuba",
"path": "modules/gui/src/com/haulmont/cuba/gui/components/LookupField.java",
"license": "apache-2.0",
"size": 6142
} | [
"java.util.function.Consumer"
] | import java.util.function.Consumer; | import java.util.function.*; | [
"java.util"
] | java.util; | 664,438 |
private static final Logger logger = Logger.getLogger(CategoryServlet.class.getCanonicalName());
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
super.doGet(req, resp);
logger.log(Level.INFO, "Obtaining Category listing");
String searchFor = req.getParameter("q");
PrintWriter out = resp.getWriter();
Iterable<Entity> entities = null;
if (searchFor == null || searchFor.equals("") || searchFor == "*") {
entities = Category.getAllCategorys("Category");
out.println(Util.writeJSON(entities));
} else {
Entity category = Category.getCategory(searchFor);
if (category != null) {
Set<Entity> result = new HashSet<Entity>();
result.add(category);
out.println(Util.writeJSON(result));
}
}
}
| static final Logger logger = Logger.getLogger(CategoryServlet.class.getCanonicalName()); protected void function(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doGet(req, resp); logger.log(Level.INFO, STR); String searchFor = req.getParameter("q"); PrintWriter out = resp.getWriter(); Iterable<Entity> entities = null; if (searchFor == null searchFor.equals(STR*STRCategory"); out.println(Util.writeJSON(entities)); } else { Entity category = Category.getCategory(searchFor); if (category != null) { Set<Entity> result = new HashSet<Entity>(); result.add(category); out.println(Util.writeJSON(result)); } } } | /**
* Get the entities in JSON format.
*/ | Get the entities in JSON format | doGet | {
"repo_name": "ljug/gestionDepenseMobile",
"path": "src/com/cnamsmb215html/web/CategoryServlet.java",
"license": "gpl-3.0",
"size": 3703
} | [
"com.cnamsmb215html.web.Util",
"com.google.appengine.api.datastore.Entity",
"java.io.IOException",
"java.io.PrintWriter",
"java.util.HashSet",
"java.util.Set",
"java.util.logging.Level",
"java.util.logging.Logger",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import com.cnamsmb215html.web.Util; import com.google.appengine.api.datastore.Entity; import java.io.IOException; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import com.cnamsmb215html.web.*; import com.google.appengine.api.datastore.*; import java.io.*; import java.util.*; import java.util.logging.*; import javax.servlet.*; import javax.servlet.http.*; | [
"com.cnamsmb215html.web",
"com.google.appengine",
"java.io",
"java.util",
"javax.servlet"
] | com.cnamsmb215html.web; com.google.appengine; java.io; java.util; javax.servlet; | 51,097 |
@Override
public void init() throws IdentityOAuth2Exception {
if (includeClaims && enableSigning) {
String claimsRetrieverImplClass = OAuthServerConfiguration.getInstance().getClaimsRetrieverImplClass();
String sigAlg = OAuthServerConfiguration.getInstance().getSignatureAlgorithm();
if (sigAlg != null && !sigAlg.trim().isEmpty()) {
signatureAlgorithm = OAuth2Util.mapSignatureAlgorithmForJWSAlgorithm(sigAlg);
}
useMultiValueSeparator =
OAuthServerConfiguration.getInstance().isUseMultiValueSeparatorForAuthContextToken();
if (claimsRetrieverImplClass != null) {
try {
claimsRetriever = (ClaimsRetriever) Class.forName(claimsRetrieverImplClass).newInstance();
claimsRetriever.init();
} catch (ClassNotFoundException e) {
log.error("Cannot find class: " + claimsRetrieverImplClass, e);
} catch (InstantiationException e) {
log.error("Error instantiating " + claimsRetrieverImplClass, e);
} catch (IllegalAccessException e) {
log.error("Illegal access to " + claimsRetrieverImplClass, e);
} catch (IdentityOAuth2Exception e) {
log.error("Error while initializing " + claimsRetrieverImplClass, e);
}
}
}
} | void function() throws IdentityOAuth2Exception { if (includeClaims && enableSigning) { String claimsRetrieverImplClass = OAuthServerConfiguration.getInstance().getClaimsRetrieverImplClass(); String sigAlg = OAuthServerConfiguration.getInstance().getSignatureAlgorithm(); if (sigAlg != null && !sigAlg.trim().isEmpty()) { signatureAlgorithm = OAuth2Util.mapSignatureAlgorithmForJWSAlgorithm(sigAlg); } useMultiValueSeparator = OAuthServerConfiguration.getInstance().isUseMultiValueSeparatorForAuthContextToken(); if (claimsRetrieverImplClass != null) { try { claimsRetriever = (ClaimsRetriever) Class.forName(claimsRetrieverImplClass).newInstance(); claimsRetriever.init(); } catch (ClassNotFoundException e) { log.error(STR + claimsRetrieverImplClass, e); } catch (InstantiationException e) { log.error(STR + claimsRetrieverImplClass, e); } catch (IllegalAccessException e) { log.error(STR + claimsRetrieverImplClass, e); } catch (IdentityOAuth2Exception e) { log.error(STR + claimsRetrieverImplClass, e); } } } } | /**
* Reads the ClaimsRetrieverImplClass from identity.xml ->
* OAuth -> TokenGeneration -> ClaimsRetrieverImplClass.
*
* @throws IdentityOAuth2Exception
*/ | Reads the ClaimsRetrieverImplClass from identity.xml -> OAuth -> TokenGeneration -> ClaimsRetrieverImplClass | init | {
"repo_name": "darshanasbg/identity-inbound-auth-oauth",
"path": "components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/authcontext/JWTTokenGenerator.java",
"license": "apache-2.0",
"size": 24079
} | [
"org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration",
"org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception",
"org.wso2.carbon.identity.oauth2.util.OAuth2Util"
] | import org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.util.OAuth2Util; | import org.wso2.carbon.identity.oauth.config.*; import org.wso2.carbon.identity.oauth2.*; import org.wso2.carbon.identity.oauth2.util.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 922,759 |
@Nullable
@Deprecated
public static File getIconFile(Content content, int iconSize) {
return getCachedThumbnailFile(content, iconSize);
} | static File function(Content content, int iconSize) { return getCachedThumbnailFile(content, iconSize); } | /**
* Get a thumbnail of a specified size for the given image. Generates the
* thumbnail if it is not already cached.
*
* @param content
* @param iconSize
*
* @return File object for cached image. Is guaranteed to exist, as long as
* there was not an error generating or saving the thumbnail.
*
* @deprecated use getCachedThumbnailFile(org.sleuthkit.datamodel.Content,
* int) instead.
*
*/ | Get a thumbnail of a specified size for the given image. Generates the thumbnail if it is not already cached | getIconFile | {
"repo_name": "APriestman/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java",
"license": "apache-2.0",
"size": 42008
} | [
"java.io.File",
"org.sleuthkit.datamodel.Content"
] | import java.io.File; import org.sleuthkit.datamodel.Content; | import java.io.*; import org.sleuthkit.datamodel.*; | [
"java.io",
"org.sleuthkit.datamodel"
] | java.io; org.sleuthkit.datamodel; | 631,534 |
void replaceTableMetadataSubList(String appName, DbHandle dbHandleName, String tableId,
String partition, String aspect,
List<KeyValueStoreEntry> entries)
throws ServicesAvailabilityException; | void replaceTableMetadataSubList(String appName, DbHandle dbHandleName, String tableId, String partition, String aspect, List<KeyValueStoreEntry> entries) throws ServicesAvailabilityException; | /**
* Atomically delete all the fields under the given (tableId, partition, aspect)
* and replace with the supplied values.
*
* @param appName
* @param dbHandleName
* @param tableId
* @param partition
* @param aspect
* @param entries List<KeyValueStoreEntry>
*/ | Atomically delete all the fields under the given (tableId, partition, aspect) and replace with the supplied values | replaceTableMetadataSubList | {
"repo_name": "opendatakit/androidlibrary",
"path": "androidlibrary_lib/src/main/java/org/opendatakit/database/service/UserDbInterface.java",
"license": "apache-2.0",
"size": 50250
} | [
"java.util.List",
"org.opendatakit.database.data.KeyValueStoreEntry",
"org.opendatakit.exception.ServicesAvailabilityException"
] | import java.util.List; import org.opendatakit.database.data.KeyValueStoreEntry; import org.opendatakit.exception.ServicesAvailabilityException; | import java.util.*; import org.opendatakit.database.data.*; import org.opendatakit.exception.*; | [
"java.util",
"org.opendatakit.database",
"org.opendatakit.exception"
] | java.util; org.opendatakit.database; org.opendatakit.exception; | 2,673,350 |
public boolean isStepUsedInTransHops( StepMeta stepMeta ) {
TransHopMeta fr = findTransHopFrom( stepMeta );
TransHopMeta to = findTransHopTo( stepMeta );
return fr != null || to != null;
} | boolean function( StepMeta stepMeta ) { TransHopMeta fr = findTransHopFrom( stepMeta ); TransHopMeta to = findTransHopTo( stepMeta ); return fr != null to != null; } | /**
* Checks if a step has been used in a hop or not.
*
* @param stepMeta
* The step queried.
* @return true if a step is used in a hop (active or not), false otherwise
*/ | Checks if a step has been used in a hop or not | isStepUsedInTransHops | {
"repo_name": "dkincade/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/TransMeta.java",
"license": "apache-2.0",
"size": 227503
} | [
"org.pentaho.di.trans.step.StepMeta"
] | import org.pentaho.di.trans.step.StepMeta; | import org.pentaho.di.trans.step.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 634,957 |
static boolean isLoopStructure(Node n) {
switch (n.getToken()) {
case FOR:
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
case DO:
case WHILE:
return true;
default:
return false;
}
} | static boolean isLoopStructure(Node n) { switch (n.getToken()) { case FOR: case FOR_IN: case FOR_OF: case FOR_AWAIT_OF: case DO: case WHILE: return true; default: return false; } } | /**
* Determines whether the given node is a FOR, DO, or WHILE node.
*/ | Determines whether the given node is a FOR, DO, or WHILE node | isLoopStructure | {
"repo_name": "shantanusharma/closure-compiler",
"path": "src/com/google/javascript/jscomp/NodeUtil.java",
"license": "apache-2.0",
"size": 180617
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 533,334 |
public Map<String, LongArrayList> getUserFunctionSelfDurations() {
return userFunctionSelfDurations;
} | Map<String, LongArrayList> function() { return userFunctionSelfDurations; } | /**
* return The execution durations of all calls to user-defined functions excluding the durations
* of all subtasks.
*/ | return The execution durations of all calls to user-defined functions excluding the durations of all subtasks | getUserFunctionSelfDurations | {
"repo_name": "aehlig/bazel",
"path": "src/main/java/com/google/devtools/build/lib/profiler/statistics/SkylarkStatistics.java",
"license": "apache-2.0",
"size": 9273
} | [
"com.google.devtools.build.lib.util.LongArrayList",
"java.util.Map"
] | import com.google.devtools.build.lib.util.LongArrayList; import java.util.Map; | import com.google.devtools.build.lib.util.*; import java.util.*; | [
"com.google.devtools",
"java.util"
] | com.google.devtools; java.util; | 113,512 |
public Enumeration getPortNames ()
{
Vector v = new Vector();
// figure out if multicast is enabled
if(multicastEnabled == null)
{
String enabled = null;
try
{
enabled = OneWireAccessProvider.getProperty(
"NetAdapter.MulticastEnabled");
}
catch(Throwable t){;}
if(enabled!=null)
multicastEnabled = Boolean.valueOf(enabled);
else
multicastEnabled = Boolean.FALSE;
}
// if multicasting is enabled, we'll look for servers dynamically
// and add them to the list
if(multicastEnabled.booleanValue())
{
// figure out what the datagram listen port is
if(datagramPort==-1)
{
String strPort = null;
try
{
strPort = OneWireAccessProvider.getProperty("NetAdapter.MulticastPort");
}
catch(Throwable t){;}
if(strPort==null)
datagramPort = DEFAULT_MULTICAST_PORT;
else
datagramPort = Integer.parseInt(strPort);
}
// figure out what the multicast group is
if(multicastGroup==null)
{
String group = null;
try
{
group = OneWireAccessProvider.getProperty("NetAdapter.MulticastGroup");
}
catch(Throwable t){;}
if(group==null)
multicastGroup = DEFAULT_MULTICAST_GROUP;
else
multicastGroup = group;
}
MulticastSocket socket = null;
InetAddress group = null;
try
{
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
if(DEBUG)
{
System.out.println("DEBUG: Opening multicast on port: " + datagramPort);
System.out.println("DEBUG: joining group: " + multicastGroup);
}
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
// create the multi-cast socket
socket = new MulticastSocket(datagramPort);
// create the group's InetAddress
group = InetAddress.getByName(multicastGroup);
// join the group
socket.joinGroup(group);
// convert the versionUID to a byte[]
byte[] versionBytes = Convert.toByteArray(versionUID);
// send a packet with the versionUID
DatagramPacket outPacket
= new DatagramPacket(versionBytes, 4, group, datagramPort);
socket.send(outPacket);
// set a timeout of 1/2 second for the receive
socket.setSoTimeout(500);
byte[] receiveBuffer = new byte[32];
for(;;)
{
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
if(DEBUG)
System.out.println("DEBUG: waiting for multicast packet");
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
DatagramPacket inPacket
= new DatagramPacket(receiveBuffer, receiveBuffer.length);
socket.receive(inPacket);
int length = inPacket.getLength();
byte[] data = inPacket.getData();
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
if(DEBUG)
{
System.out.println("DEBUG: packet.length=" + length);
System.out.println("DEBUG: expecting=" + 5);
}
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
if(length == 5 && data[4]==(byte)0xFF)
{
int listenPort = Convert.toInt(data, 0, 4);
v.addElement(inPacket.getAddress().getHostName()
+ ":" + listenPort);
}
}
}
catch(Exception e)
{;}
finally
{
try
{
socket.leaveGroup(group);
socket.close();
}
catch(Exception e)
{;}
}
}
// get all servers from the properties file
String server = "";
try
{
for(int i=0; server!=null; i++)
{
server = OneWireAccessProvider.getProperty("NetAdapter.host"+i);
if(server!=null)
v.addElement(server);
}
}
catch(Throwable t){;}
return v.elements();
} | Enumeration function () { Vector v = new Vector(); if(multicastEnabled == null) { String enabled = null; try { enabled = OneWireAccessProvider.getProperty( STR); } catch(Throwable t){;} if(enabled!=null) multicastEnabled = Boolean.valueOf(enabled); else multicastEnabled = Boolean.FALSE; } if(multicastEnabled.booleanValue()) { if(datagramPort==-1) { String strPort = null; try { strPort = OneWireAccessProvider.getProperty(STR); } catch(Throwable t){;} if(strPort==null) datagramPort = DEFAULT_MULTICAST_PORT; else datagramPort = Integer.parseInt(strPort); } if(multicastGroup==null) { String group = null; try { group = OneWireAccessProvider.getProperty(STR); } catch(Throwable t){;} if(group==null) multicastGroup = DEFAULT_MULTICAST_GROUP; else multicastGroup = group; } MulticastSocket socket = null; InetAddress group = null; try { if(DEBUG) { System.out.println(STR + datagramPort); System.out.println(STR + multicastGroup); } socket = new MulticastSocket(datagramPort); group = InetAddress.getByName(multicastGroup); socket.joinGroup(group); byte[] versionBytes = Convert.toByteArray(versionUID); DatagramPacket outPacket = new DatagramPacket(versionBytes, 4, group, datagramPort); socket.send(outPacket); socket.setSoTimeout(500); byte[] receiveBuffer = new byte[32]; for(;;) { if(DEBUG) System.out.println(STR); DatagramPacket inPacket = new DatagramPacket(receiveBuffer, receiveBuffer.length); socket.receive(inPacket); int length = inPacket.getLength(); byte[] data = inPacket.getData(); if(DEBUG) { System.out.println(STR + length); System.out.println(STR + 5); } if(length == 5 && data[4]==(byte)0xFF) { int listenPort = Convert.toInt(data, 0, 4); v.addElement(inPacket.getAddress().getHostName() + ":" + listenPort); } } } catch(Exception e) {;} finally { try { socket.leaveGroup(group); socket.close(); } catch(Exception e) {;} } } String server = STRNetAdapter.host"+i); if(server!=null) v.addElement(server); } } catch(Throwable t){;} return v.elements(); } | /**
* Retrieves a list of the platform appropriate port names for this
* adapter. A port must be selected with the method 'selectPort'
* before any other communication methods can be used. Using
* a communcation method before 'selectPort' will result in
* a <code>OneWireException</code> exception.
*
* @return <code>Enumeration</code> of type <code>String</code> that contains the port
* names
*/ | Retrieves a list of the platform appropriate port names for this adapter. A port must be selected with the method 'selectPort' before any other communication methods can be used. Using a communcation method before 'selectPort' will result in a <code>OneWireException</code> exception | getPortNames | {
"repo_name": "marcass/dz-1",
"path": "dz3-owapi/src/main/java/com/dalsemi/onewire/adapter/NetAdapter.java",
"license": "gpl-3.0",
"size": 63815
} | [
"com.dalsemi.onewire.OneWireAccessProvider",
"com.dalsemi.onewire.utils.Convert",
"java.net.DatagramPacket",
"java.net.InetAddress",
"java.net.MulticastSocket",
"java.util.Enumeration",
"java.util.Vector"
] | import com.dalsemi.onewire.OneWireAccessProvider; import com.dalsemi.onewire.utils.Convert; import java.net.DatagramPacket; import java.net.InetAddress; import java.net.MulticastSocket; import java.util.Enumeration; import java.util.Vector; | import com.dalsemi.onewire.*; import com.dalsemi.onewire.utils.*; import java.net.*; import java.util.*; | [
"com.dalsemi.onewire",
"java.net",
"java.util"
] | com.dalsemi.onewire; java.net; java.util; | 688,089 |
// @Bean uncomment to enable
public BeanNameAutoProxyCreator autoProxyCreater() {
BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
autoProxyCreator.setBeanNames("*Controller");
autoProxyCreator.setInterceptorNames("exceptionInterceptor");
return autoProxyCreator;
} | BeanNameAutoProxyCreator function() { BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator(); autoProxyCreator.setBeanNames(STR); autoProxyCreator.setInterceptorNames(STR); return autoProxyCreator; } | /**
* Bean to create proxies for the interceptor. It scans the classpath for Controller classes
*
* @return BeanNameAutoProxyCreator
*/ | Bean to create proxies for the interceptor. It scans the classpath for Controller classes | autoProxyCreater | {
"repo_name": "juliuskrah/spring-profiles",
"path": "src/main/java/com/jipasoft/config/AspectConfig.java",
"license": "apache-2.0",
"size": 4148
} | [
"org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"
] | import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator; | import org.springframework.aop.framework.autoproxy.*; | [
"org.springframework.aop"
] | org.springframework.aop; | 133,914 |
Reflections reflections;
if (packageName != null) {
String[] packageNames = packageName.split(",");
reflections = new Reflections(packageNames);
} else {
reflections = new Reflections(packageName);
}
Set<Class<?>> jsonApiResources = reflections.getTypesAnnotatedWith(JsonApiResource.class);
Set<Class<? extends ResourceRepository>> entityRepositoryClasses = reflections.getSubTypesOf(ResourceRepository.class);
Set<Class<? extends RelationshipRepository>> relationshipRepositoryClasses = reflections
.getSubTypesOf(RelationshipRepository.class);
ResourceRegistry resourceRegistry = new ResourceRegistry(serviceUrl);
for (Class resourceClass : jsonApiResources) {
Class<? extends ResourceRepository> foundEntityRepositoryClass = findEntityRepository(resourceClass, entityRepositoryClasses);
Set<Class<? extends RelationshipRepository>> foundRelationshipRepositoriesClasses =
findRelationshipRepositories(resourceClass, relationshipRepositoryClasses);
RegistryEntry registryEntry = createEntry(resourceClass, foundEntityRepositoryClass, foundRelationshipRepositoriesClasses);
resourceRegistry.addEntry(resourceClass, registryEntry);
}
return resourceRegistry;
} | Reflections reflections; if (packageName != null) { String[] packageNames = packageName.split(","); reflections = new Reflections(packageNames); } else { reflections = new Reflections(packageName); } Set<Class<?>> jsonApiResources = reflections.getTypesAnnotatedWith(JsonApiResource.class); Set<Class<? extends ResourceRepository>> entityRepositoryClasses = reflections.getSubTypesOf(ResourceRepository.class); Set<Class<? extends RelationshipRepository>> relationshipRepositoryClasses = reflections .getSubTypesOf(RelationshipRepository.class); ResourceRegistry resourceRegistry = new ResourceRegistry(serviceUrl); for (Class resourceClass : jsonApiResources) { Class<? extends ResourceRepository> foundEntityRepositoryClass = findEntityRepository(resourceClass, entityRepositoryClasses); Set<Class<? extends RelationshipRepository>> foundRelationshipRepositoriesClasses = findRelationshipRepositories(resourceClass, relationshipRepositoryClasses); RegistryEntry registryEntry = createEntry(resourceClass, foundEntityRepositoryClass, foundRelationshipRepositoriesClasses); resourceRegistry.addEntry(resourceClass, registryEntry); } return resourceRegistry; } | /**
* Scans all classes in provided package and finds all resources and repositories associated with found resource.
*
* @param packageName Package containing resources (models) and repositories.
* @param serviceUrl URL to the service
* @return an instance of ResourceRegistry
*/ | Scans all classes in provided package and finds all resources and repositories associated with found resource | build | {
"repo_name": "RentTheRunway/katharsis-core",
"path": "src/main/java/io/katharsis/resource/registry/ResourceRegistryBuilder.java",
"license": "apache-2.0",
"size": 5538
} | [
"io.katharsis.repository.RelationshipRepository",
"io.katharsis.repository.ResourceRepository",
"io.katharsis.resource.annotations.JsonApiResource",
"java.util.Set",
"org.reflections.Reflections"
] | import io.katharsis.repository.RelationshipRepository; import io.katharsis.repository.ResourceRepository; import io.katharsis.resource.annotations.JsonApiResource; import java.util.Set; import org.reflections.Reflections; | import io.katharsis.repository.*; import io.katharsis.resource.annotations.*; import java.util.*; import org.reflections.*; | [
"io.katharsis.repository",
"io.katharsis.resource",
"java.util",
"org.reflections"
] | io.katharsis.repository; io.katharsis.resource; java.util; org.reflections; | 635,968 |
public static void callTransportControlsMethod(
int methodId, Object arg, Context context, Parcelable token) {
Intent intent = createIntent(CLIENT_RECEIVER_COMPONENT_NAME, methodId, arg);
intent.setAction(ACTION_CALL_TRANSPORT_CONTROLS_METHOD);
intent.putExtra(KEY_SESSION_TOKEN, token);
if (Build.VERSION.SDK_INT >= 16) {
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
}
context.sendBroadcast(intent);
} | static void function( int methodId, Object arg, Context context, Parcelable token) { Intent intent = createIntent(CLIENT_RECEIVER_COMPONENT_NAME, methodId, arg); intent.setAction(ACTION_CALL_TRANSPORT_CONTROLS_METHOD); intent.putExtra(KEY_SESSION_TOKEN, token); if (Build.VERSION.SDK_INT >= 16) { intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); } context.sendBroadcast(intent); } | /**
* Calls a method of TransportControls. Used by service app.
*/ | Calls a method of TransportControls. Used by service app | callTransportControlsMethod | {
"repo_name": "aosp-mirror/platform_frameworks_support",
"path": "media/version-compat-tests/lib/src/main/java/android/support/mediacompat/testlib/util/IntentUtil.java",
"license": "apache-2.0",
"size": 5703
} | [
"android.content.Context",
"android.content.Intent",
"android.os.Build",
"android.os.Parcelable"
] | import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Parcelable; | import android.content.*; import android.os.*; | [
"android.content",
"android.os"
] | android.content; android.os; | 1,869,577 |
private Item peek() {
if (isEmpty()) throw new NoSuchElementException("Queue underflow");
return q[first];
} | Item function() { if (isEmpty()) throw new NoSuchElementException(STR); return q[first]; } | /**
* Returns the item least recently added to this queue.
* @return the item least recently added to this queue
* @throws java.util.NoSuchElementException if this queue is empty
*/ | Returns the item least recently added to this queue | peek | {
"repo_name": "vinhqdang/coursera_algorithms_princeton",
"path": "part1/w2-stacks-queues/assignment/RandomizedQueue.java",
"license": "gpl-2.0",
"size": 7142
} | [
"java.util.NoSuchElementException"
] | import java.util.NoSuchElementException; | import java.util.*; | [
"java.util"
] | java.util; | 66,743 |
File getPluginsDir(); | File getPluginsDir(); | /**
* Gets the plugin directory of this manager
*
* @return The plugin directory of this manager
*/ | Gets the plugin directory of this manager | getPluginsDir | {
"repo_name": "Prismarine/PrismarineAPI",
"path": "src/org/prismarine/api/plugin/PluginManagerBase.java",
"license": "apache-2.0",
"size": 530
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 967,860 |
public static Class<? extends Comparable<?>> getKeyType(final Class<?> type) {
final KeyType keyType = getAnnotationForClass(KeyType.class, type);
return keyType != null ? keyType.value() : null;
} | static Class<? extends Comparable<?>> function(final Class<?> type) { final KeyType keyType = getAnnotationForClass(KeyType.class, type); return keyType != null ? keyType.value() : null; } | /**
*
* Deduces a key type for on an entity type based on {@link KeyType} annotation.
* <p>
* The method traverses the whole entity type hierarchy to find the most top {@link KeyType} annotation present. The method returns null if the annotation not found on any of
* the types in the hierarchy.
*
* @param type
* @return
*/ | Deduces a key type for on an entity type based on <code>KeyType</code> annotation. The method traverses the whole entity type hierarchy to find the most top <code>KeyType</code> annotation present. The method returns null if the annotation not found on any of the types in the hierarchy | getKeyType | {
"repo_name": "fieldenms/tg",
"path": "platform-pojo-bl/src/main/java/ua/com/fielden/platform/reflection/AnnotationReflector.java",
"license": "mit",
"size": 19436
} | [
"ua.com.fielden.platform.entity.annotation.KeyType"
] | import ua.com.fielden.platform.entity.annotation.KeyType; | import ua.com.fielden.platform.entity.annotation.*; | [
"ua.com.fielden"
] | ua.com.fielden; | 1,275,443 |
public void removeSmbPath(String name, String path) {
SQLiteDatabase sqLiteDatabase = getWritableDatabase();
try {
if (path.equals("")) {
// we don't have a path, remove the entry with this name
throw new CryptException();
}
sqLiteDatabase.delete(TABLE_SMB, COLUMN_NAME + " = ? AND " + COLUMN_PATH + " = ?",
new String[] {name, SmbUtil.getSmbEncryptedPath(context, path)});
} catch (CryptException e) {
e.printStackTrace();
// force remove entry, we end up deleting all entries with same name
sqLiteDatabase.delete(TABLE_SMB, COLUMN_NAME + " = ?",
new String[] {name});
}
} | void function(String name, String path) { SQLiteDatabase sqLiteDatabase = getWritableDatabase(); try { if (path.equals(STR = ? AND STR = ?STR = ?", new String[] {name}); } } | /**
* Remove SMB entry
* @param name
* @param path the path we get from saved runtime variables is a decrypted, to remove entry,
* we must encrypt it's password fiend first first
*/ | Remove SMB entry | removeSmbPath | {
"repo_name": "martincz/AmazeFileManager",
"path": "src/main/java/com/amaze/filemanager/database/UtilsHandler.java",
"license": "gpl-3.0",
"size": 13509
} | [
"android.database.sqlite.SQLiteDatabase"
] | import android.database.sqlite.SQLiteDatabase; | import android.database.sqlite.*; | [
"android.database"
] | android.database; | 412,834 |
public Accessible getAccessibleChild(JComponent a, int b) {
Accessible returnValue =
uis.elementAt(0).getAccessibleChild(a,b);
for (int i = 1; i < uis.size(); i++) {
uis.elementAt(i).getAccessibleChild(a,b);
}
return returnValue;
} | Accessible function(JComponent a, int b) { Accessible returnValue = uis.elementAt(0).getAccessibleChild(a,b); for (int i = 1; i < uis.size(); i++) { uis.elementAt(i).getAccessibleChild(a,b); } return returnValue; } | /**
* Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/ | Invokes the <code>getAccessibleChild</code> method on each UI handled by this object | getAccessibleChild | {
"repo_name": "mirkosertic/Bytecoder",
"path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/swing/plaf/multi/MultiColorChooserUI.java",
"license": "apache-2.0",
"size": 7335
} | [
"javax.accessibility.Accessible",
"javax.swing.JComponent"
] | import javax.accessibility.Accessible; import javax.swing.JComponent; | import javax.accessibility.*; import javax.swing.*; | [
"javax.accessibility",
"javax.swing"
] | javax.accessibility; javax.swing; | 7,048 |
public void addGraphicsNodeMouseWheelListener
(GraphicsNodeMouseWheelListener l) {
if (glisteners == null) {
glisteners = new EventListenerList();
}
glisteners.add(GraphicsNodeMouseWheelListener.class, l);
} | void function (GraphicsNodeMouseWheelListener l) { if (glisteners == null) { glisteners = new EventListenerList(); } glisteners.add(GraphicsNodeMouseWheelListener.class, l); } | /**
* Adds the specified 'global' GraphicsNodeMouseWheelListener which is
* notified of all MouseWheelEvents dispatched.
* @param l the listener to add
*/ | Adds the specified 'global' GraphicsNodeMouseWheelListener which is notified of all MouseWheelEvents dispatched | addGraphicsNodeMouseWheelListener | {
"repo_name": "apache/batik",
"path": "batik-gvt/src/main/java/org/apache/batik/gvt/event/AWTEventDispatcher.java",
"license": "apache-2.0",
"size": 28814
} | [
"javax.swing.event.EventListenerList"
] | import javax.swing.event.EventListenerList; | import javax.swing.event.*; | [
"javax.swing"
] | javax.swing; | 2,884,227 |
Call<List<SearchItem>> performSearch(String query);
} | Call<List<SearchItem>> performSearch(String query); } | /**
* Performs search with specified {@code query}.
*/ | Performs search with specified query | performSearch | {
"repo_name": "azizbekian/MoviesTraktTv",
"path": "app/src/main/java/com/azizbekian/movies/fragment/movies/MoviesContract.java",
"license": "apache-2.0",
"size": 10293
} | [
"com.azizbekian.movies.entity.SearchItem",
"java.util.List"
] | import com.azizbekian.movies.entity.SearchItem; import java.util.List; | import com.azizbekian.movies.entity.*; import java.util.*; | [
"com.azizbekian.movies",
"java.util"
] | com.azizbekian.movies; java.util; | 1,750,736 |
@SuppressWarnings("deprecation")
public void doBulkLoad(Path hfofDir, final Admin admin, Table table,
RegionLocator regionLocator) throws TableNotFoundException, IOException {
if (!admin.isTableAvailable(regionLocator.getName())) {
throw new TableNotFoundException("Table " + table.getName() + "is not currently available.");
}
// initialize thread pools
int nrThreads = getConf().getInt("hbase.loadincremental.threads.max",
Runtime.getRuntime().availableProcessors());
ThreadFactoryBuilder builder = new ThreadFactoryBuilder();
builder.setNameFormat("LoadIncrementalHFiles-%1$d");
ExecutorService pool = new ThreadPoolExecutor(nrThreads, nrThreads,
60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(),
builder.build());
((ThreadPoolExecutor)pool).allowCoreThreadTimeOut(true);
// LQI queue does not need to be threadsafe -- all operations on this queue
// happen in this thread
Deque<LoadQueueItem> queue = new LinkedList<LoadQueueItem>();
try {
discoverLoadQueue(queue, hfofDir);
// check whether there is invalid family name in HFiles to be bulkloaded
Collection<HColumnDescriptor> families = table.getTableDescriptor().getFamilies();
ArrayList<String> familyNames = new ArrayList<String>(families.size());
for (HColumnDescriptor family : families) {
familyNames.add(family.getNameAsString());
}
ArrayList<String> unmatchedFamilies = new ArrayList<String>();
Iterator<LoadQueueItem> queueIter = queue.iterator();
while (queueIter.hasNext()) {
LoadQueueItem lqi = queueIter.next();
String familyNameInHFile = Bytes.toString(lqi.family);
if (!familyNames.contains(familyNameInHFile)) {
unmatchedFamilies.add(familyNameInHFile);
}
}
if (unmatchedFamilies.size() > 0) {
String msg =
"Unmatched family names found: unmatched family names in HFiles to be bulkloaded: "
+ unmatchedFamilies + "; valid family names of table "
+ table.getName() + " are: " + familyNames;
LOG.error(msg);
throw new IOException(msg);
}
int count = 0;
if (queue.isEmpty()) {
LOG.warn("Bulk load operation did not find any files to load in " +
"directory " + hfofDir.toUri() + ". Does it contain files in " +
"subdirectories that correspond to column family names?");
return;
}
//If using secure bulk load, get source delegation token, and
//prepare staging directory and token
// fs is the source filesystem
fsDelegationToken.acquireDelegationToken(fs);
if(isSecureBulkLoadEndpointAvailable()) {
bulkToken = new SecureBulkLoadClient(table).prepareBulkLoad(table.getName());
}
// Assumes that region splits can happen while this occurs.
while (!queue.isEmpty()) {
// need to reload split keys each iteration.
final Pair<byte[][], byte[][]> startEndKeys = regionLocator.getStartEndKeys();
if (count != 0) {
LOG.info("Split occured while grouping HFiles, retry attempt " +
+ count + " with " + queue.size() + " files remaining to group or split");
}
int maxRetries = getConf().getInt("hbase.bulkload.retries.number", 10);
if (maxRetries != 0 && count >= maxRetries) {
throw new IOException("Retry attempted " + count +
" times without completing, bailing out");
}
count++;
// Using ByteBuffer for byte[] equality semantics
Multimap<ByteBuffer, LoadQueueItem> regionGroups = groupOrSplitPhase(table,
pool, queue, startEndKeys);
if (!checkHFilesCountPerRegionPerFamily(regionGroups)) {
// Error is logged inside checkHFilesCountPerRegionPerFamily.
throw new IOException("Trying to load more than " + maxFilesPerRegionPerFamily
+ " hfiles to one family of one region");
}
bulkLoadPhase(table, admin.getConnection(), pool, queue, regionGroups);
// NOTE: The next iteration's split / group could happen in parallel to
// atomic bulkloads assuming that there are splits and no merges, and
// that we can atomically pull out the groups we want to retry.
}
} finally {
fsDelegationToken.releaseDelegationToken();
if(bulkToken != null) {
new SecureBulkLoadClient(table).cleanupBulkLoad(bulkToken);
}
pool.shutdown();
if (queue != null && !queue.isEmpty()) {
StringBuilder err = new StringBuilder();
err.append("-------------------------------------------------\n");
err.append("Bulk load aborted with some files not yet loaded:\n");
err.append("-------------------------------------------------\n");
for (LoadQueueItem q : queue) {
err.append(" ").append(q.hfilePath).append('\n');
}
LOG.error(err);
}
}
if (queue != null && !queue.isEmpty()) {
throw new RuntimeException("Bulk load aborted with some files not yet loaded."
+ "Please check log for more details.");
}
} | @SuppressWarnings(STR) void function(Path hfofDir, final Admin admin, Table table, RegionLocator regionLocator) throws TableNotFoundException, IOException { if (!admin.isTableAvailable(regionLocator.getName())) { throw new TableNotFoundException(STR + table.getName() + STR); } int nrThreads = getConf().getInt(STR, Runtime.getRuntime().availableProcessors()); ThreadFactoryBuilder builder = new ThreadFactoryBuilder(); builder.setNameFormat(STR); ExecutorService pool = new ThreadPoolExecutor(nrThreads, nrThreads, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), builder.build()); ((ThreadPoolExecutor)pool).allowCoreThreadTimeOut(true); Deque<LoadQueueItem> queue = new LinkedList<LoadQueueItem>(); try { discoverLoadQueue(queue, hfofDir); Collection<HColumnDescriptor> families = table.getTableDescriptor().getFamilies(); ArrayList<String> familyNames = new ArrayList<String>(families.size()); for (HColumnDescriptor family : families) { familyNames.add(family.getNameAsString()); } ArrayList<String> unmatchedFamilies = new ArrayList<String>(); Iterator<LoadQueueItem> queueIter = queue.iterator(); while (queueIter.hasNext()) { LoadQueueItem lqi = queueIter.next(); String familyNameInHFile = Bytes.toString(lqi.family); if (!familyNames.contains(familyNameInHFile)) { unmatchedFamilies.add(familyNameInHFile); } } if (unmatchedFamilies.size() > 0) { String msg = STR + unmatchedFamilies + STR + table.getName() + STR + familyNames; LOG.error(msg); throw new IOException(msg); } int count = 0; if (queue.isEmpty()) { LOG.warn(STR + STR + hfofDir.toUri() + STR + STR); return; } fsDelegationToken.acquireDelegationToken(fs); if(isSecureBulkLoadEndpointAvailable()) { bulkToken = new SecureBulkLoadClient(table).prepareBulkLoad(table.getName()); } while (!queue.isEmpty()) { final Pair<byte[][], byte[][]> startEndKeys = regionLocator.getStartEndKeys(); if (count != 0) { LOG.info(STR + + count + STR + queue.size() + STR); } int maxRetries = getConf().getInt(STR, 10); if (maxRetries != 0 && count >= maxRetries) { throw new IOException(STR + count + STR); } count++; Multimap<ByteBuffer, LoadQueueItem> regionGroups = groupOrSplitPhase(table, pool, queue, startEndKeys); if (!checkHFilesCountPerRegionPerFamily(regionGroups)) { throw new IOException(STR + maxFilesPerRegionPerFamily + STR); } bulkLoadPhase(table, admin.getConnection(), pool, queue, regionGroups); } } finally { fsDelegationToken.releaseDelegationToken(); if(bulkToken != null) { new SecureBulkLoadClient(table).cleanupBulkLoad(bulkToken); } pool.shutdown(); if (queue != null && !queue.isEmpty()) { StringBuilder err = new StringBuilder(); err.append(STR); err.append(STR); err.append(STR); for (LoadQueueItem q : queue) { err.append(" ").append(q.hfilePath).append('\n'); } LOG.error(err); } } if (queue != null && !queue.isEmpty()) { throw new RuntimeException(STR + STR); } } | /**
* Perform a bulk load of the given directory into the given
* pre-existing table. This method is not threadsafe.
*
* @param hfofDir the directory that was provided as the output path
* of a job using HFileOutputFormat
* @param table the table to load into
* @throws TableNotFoundException if table does not yet exist
*/ | Perform a bulk load of the given directory into the given pre-existing table. This method is not threadsafe | doBulkLoad | {
"repo_name": "narendragoyal/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java",
"license": "apache-2.0",
"size": 39023
} | [
"com.google.common.collect.Multimap",
"com.google.common.util.concurrent.ThreadFactoryBuilder",
"java.io.IOException",
"java.nio.ByteBuffer",
"java.util.ArrayList",
"java.util.Collection",
"java.util.Deque",
"java.util.Iterator",
"java.util.LinkedList",
"java.util.concurrent.ExecutorService",
"java.util.concurrent.LinkedBlockingQueue",
"java.util.concurrent.ThreadPoolExecutor",
"java.util.concurrent.TimeUnit",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.HColumnDescriptor",
"org.apache.hadoop.hbase.TableNotFoundException",
"org.apache.hadoop.hbase.client.Admin",
"org.apache.hadoop.hbase.client.RegionLocator",
"org.apache.hadoop.hbase.client.Table",
"org.apache.hadoop.hbase.client.coprocessor.SecureBulkLoadClient",
"org.apache.hadoop.hbase.util.Bytes",
"org.apache.hadoop.hbase.util.Pair"
] | import com.google.common.collect.Multimap; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.Deque; import java.util.Iterator; import java.util.LinkedList; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.client.coprocessor.SecureBulkLoadClient; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; | import com.google.common.collect.*; import com.google.common.util.concurrent.*; import java.io.*; import java.nio.*; import java.util.*; import java.util.concurrent.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.client.coprocessor.*; import org.apache.hadoop.hbase.util.*; | [
"com.google.common",
"java.io",
"java.nio",
"java.util",
"org.apache.hadoop"
] | com.google.common; java.io; java.nio; java.util; org.apache.hadoop; | 2,769,238 |
public double computeNext(List<SimpleClassifier> classifiers, int index) {
// FIXME simply subtracting learning rate?
double newWeight = Math.max(0, classifiers.get(index).getWeight() - learningRate);
if(newWeight == classifiers.get(index).getWeight()) {
logger.info("Computed weight under zero. Skipping.");
} else {
classifiers.get(index).setWeight(newWeight);
classifiers = normalizeClassifiers(classifiers);
}
AMapping m = getMapping(classifiers);
buffer = classifiers;
return computeQuality(m);
} | double function(List<SimpleClassifier> classifiers, int index) { double newWeight = Math.max(0, classifiers.get(index).getWeight() - learningRate); if(newWeight == classifiers.get(index).getWeight()) { logger.info(STR); } else { classifiers.get(index).setWeight(newWeight); classifiers = normalizeClassifiers(classifiers); } AMapping m = getMapping(classifiers); buffer = classifiers; return computeQuality(m); } | /**
* Aims to improve upon a particular classifier by checking whether adding a
* delta to its similarity worsens the total classifer
*
**/ | Aims to improve upon a particular classifier by checking whether adding a delta to its similarity worsens the total classifer | computeNext | {
"repo_name": "AKSW/LIMES-CORE",
"path": "limes-core/src/main/java/org/aksw/limes/core/ml/algorithm/euclid/LinearSelfConfigurator.java",
"license": "gpl-2.0",
"size": 22326
} | [
"java.util.List",
"org.aksw.limes.core.io.mapping.AMapping",
"org.aksw.limes.core.ml.algorithm.classifier.SimpleClassifier"
] | import java.util.List; import org.aksw.limes.core.io.mapping.AMapping; import org.aksw.limes.core.ml.algorithm.classifier.SimpleClassifier; | import java.util.*; import org.aksw.limes.core.io.mapping.*; import org.aksw.limes.core.ml.algorithm.classifier.*; | [
"java.util",
"org.aksw.limes"
] | java.util; org.aksw.limes; | 1,993,344 |
public static DiscoveryAdmin getDiscoveryAdmin(ServiceRegistrar serviceObj)
throws ClassNotFoundException,
RemoteException,
TestException
{
if(serviceObj == null) {
throw new NullPointerException("null admin object input to "
+"getDiscoveryAdmin()");
}
Class administrableClass
= Class.forName("net.jini.admin.Administrable");
Class discoveryAdminClass = Class.forName
("net.jini.lookup.DiscoveryAdmin");
if( !administrableClass.isAssignableFrom(serviceObj.getClass()) ) {
throw new TestException("the lookup service under test "
+"does not implement the "
+"net.jini.admin.Administrable "
+"interface");
}
Object admin = ((Administrable)serviceObj).getAdmin();
admin = QAConfig.getConfig().prepare("test.reggieAdminPreparer",
admin);
if( !discoveryAdminClass.isAssignableFrom(admin.getClass()) ) {
throw new TestException("the lookup service under test "
+"does not implement the "
+"net.jini.lookup.DiscoveryAdmin "
+"interface");
}
return ((DiscoveryAdmin)admin);
}//end getDiscoveryAdmin | static DiscoveryAdmin function(ServiceRegistrar serviceObj) throws ClassNotFoundException, RemoteException, TestException { if(serviceObj == null) { throw new NullPointerException(STR +STR); } Class administrableClass = Class.forName(STR); Class discoveryAdminClass = Class.forName (STR); if( !administrableClass.isAssignableFrom(serviceObj.getClass()) ) { throw new TestException(STR +STR +STR +STR); } Object admin = ((Administrable)serviceObj).getAdmin(); admin = QAConfig.getConfig().prepare(STR, admin); if( !discoveryAdminClass.isAssignableFrom(admin.getClass()) ) { throw new TestException(STR +STR +STR +STR); } return ((DiscoveryAdmin)admin); } | /** Determines if the input object implements both the
* <code>net.jini.admin.Administrable</code> and the
* <code>net.jini.lookup.DiscoveryAdmin</code> interfaces, and
* if yes, returns a proxy to an instance of the
* <code>net.jini.lookup.DiscoveryAdmin</code> interface.
*
* @param serviceObj instance of a ServiceRegistrar that implements both
* <code>net.jini.admin.Administrable</code> and
* <code>net.jini.lookup.DiscoveryAdmin</code>, whose
* implementation can be used to administer the member
* groups and the locator port of a lookup service.
*
* @throws java.lang.NullPointerException this exception occurs when
* <code>null</code> is input to the <code>serviceObj</code>
* parameter.
* @throws java.lang.ClassNotFoundException this exception occurs when
* while attempting to load either of the necessary administration
* interfaces, no definition of the interface(s) could be found.
* @throws org.apache.river.qa.harness.TestException this exception occurs
* when the input parameter does not implement either of the
* necessary administration interfaces.
*
* @return an instance of <code>net.jini.lookup.DiscoveryAdmin</code>
* if the input object is administrable and implements the
* <code>net.jini.lookup.DiscoveryAdmin</code> interface. The
* returned object is prepared using the preparer named
* test.reggieAdminPreparer.
*/ | Determines if the input object implements both the <code>net.jini.admin.Administrable</code> and the <code>net.jini.lookup.DiscoveryAdmin</code> interfaces, and if yes, returns a proxy to an instance of the <code>net.jini.lookup.DiscoveryAdmin</code> interface | getDiscoveryAdmin | {
"repo_name": "pfirmstone/JGDMS",
"path": "qa/src/org/apache/river/test/share/DiscoveryAdminUtil.java",
"license": "apache-2.0",
"size": 4959
} | [
"java.rmi.RemoteException",
"net.jini.admin.Administrable",
"net.jini.core.lookup.ServiceRegistrar",
"net.jini.lookup.DiscoveryAdmin",
"org.apache.river.qa.harness.QAConfig",
"org.apache.river.qa.harness.TestException"
] | import java.rmi.RemoteException; import net.jini.admin.Administrable; import net.jini.core.lookup.ServiceRegistrar; import net.jini.lookup.DiscoveryAdmin; import org.apache.river.qa.harness.QAConfig; import org.apache.river.qa.harness.TestException; | import java.rmi.*; import net.jini.admin.*; import net.jini.core.lookup.*; import net.jini.lookup.*; import org.apache.river.qa.harness.*; | [
"java.rmi",
"net.jini.admin",
"net.jini.core",
"net.jini.lookup",
"org.apache.river"
] | java.rmi; net.jini.admin; net.jini.core; net.jini.lookup; org.apache.river; | 934,459 |
public ServiceCall<Void> deleteAsync(String resourceGroupName, String deploymentName, final ServiceCallback<Void> serviceCallback) {
return ServiceCall.create(deleteWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback);
} | ServiceCall<Void> function(String resourceGroupName, String deploymentName, final ServiceCallback<Void> serviceCallback) { return ServiceCall.create(deleteWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); } | /**
* Delete deployment.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentName The name of the deployment to be deleted.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/ | Delete deployment | deleteAsync | {
"repo_name": "herveyw/azure-sdk-for-java",
"path": "azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/DeploymentsInner.java",
"license": "mit",
"size": 64034
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,146,341 |
public static JsonType findSpecifiedType(Adaptable adaptable, EnunciateJacksonContext context) {
JsonType jsonType = null;
if (adaptable instanceof Accessor) {
Accessor accessor = (Accessor) adaptable;
JsonFormat format = accessor.getAnnotation(JsonFormat.class);
if (format != null) {
switch (format.shape()) {
case ARRAY:
return KnownJsonType.ARRAY;
case BOOLEAN:
return KnownJsonType.BOOLEAN;
case NUMBER:
case NUMBER_FLOAT:
return KnownJsonType.NUMBER;
case NUMBER_INT:
return KnownJsonType.WHOLE_NUMBER;
case OBJECT:
return KnownJsonType.OBJECT;
case STRING:
case SCALAR:
return KnownJsonType.STRING;
case ANY:
default:
//fall through...
}
}
TypeHint typeHint = accessor.getAnnotation(TypeHint.class);
if (typeHint != null) {
TypeMirror hint = TypeHintUtils.getTypeHint(typeHint, context.getContext().getProcessingEnvironment(), null);
if (hint != null) {
return getJsonType(hint, context);
}
}
final JsonSerialize serializeInfo = accessor.getAnnotation(JsonSerialize.class);
if (serializeInfo != null) {
DecoratedProcessingEnvironment env = context.getContext().getProcessingEnvironment(); | static JsonType function(Adaptable adaptable, EnunciateJacksonContext context) { JsonType jsonType = null; if (adaptable instanceof Accessor) { Accessor accessor = (Accessor) adaptable; JsonFormat format = accessor.getAnnotation(JsonFormat.class); if (format != null) { switch (format.shape()) { case ARRAY: return KnownJsonType.ARRAY; case BOOLEAN: return KnownJsonType.BOOLEAN; case NUMBER: case NUMBER_FLOAT: return KnownJsonType.NUMBER; case NUMBER_INT: return KnownJsonType.WHOLE_NUMBER; case OBJECT: return KnownJsonType.OBJECT; case STRING: case SCALAR: return KnownJsonType.STRING; case ANY: default: } } TypeHint typeHint = accessor.getAnnotation(TypeHint.class); if (typeHint != null) { TypeMirror hint = TypeHintUtils.getTypeHint(typeHint, context.getContext().getProcessingEnvironment(), null); if (hint != null) { return getJsonType(hint, context); } } final JsonSerialize serializeInfo = accessor.getAnnotation(JsonSerialize.class); if (serializeInfo != null) { DecoratedProcessingEnvironment env = context.getContext().getProcessingEnvironment(); | /**
* Find the specified type of the given adaptable element, if it exists.
*
* @param adaptable The adaptable element for which to find the specified type.
* @param context The context
* @return The specified JSON type, or null if it doesn't exist.
*/ | Find the specified type of the given adaptable element, if it exists | findSpecifiedType | {
"repo_name": "nabilzhang/enunciate",
"path": "jackson/src/main/java/com/webcohesion/enunciate/modules/jackson/model/types/JsonTypeFactory.java",
"license": "apache-2.0",
"size": 7436
} | [
"com.fasterxml.jackson.annotation.JsonFormat",
"com.fasterxml.jackson.databind.annotation.JsonSerialize",
"com.webcohesion.enunciate.javac.decorations.DecoratedProcessingEnvironment",
"com.webcohesion.enunciate.metadata.rs.TypeHint",
"com.webcohesion.enunciate.modules.jackson.EnunciateJacksonContext",
"com.webcohesion.enunciate.modules.jackson.model.Accessor",
"com.webcohesion.enunciate.modules.jackson.model.adapters.Adaptable",
"com.webcohesion.enunciate.util.TypeHintUtils",
"javax.lang.model.type.TypeMirror"
] | import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.webcohesion.enunciate.javac.decorations.DecoratedProcessingEnvironment; import com.webcohesion.enunciate.metadata.rs.TypeHint; import com.webcohesion.enunciate.modules.jackson.EnunciateJacksonContext; import com.webcohesion.enunciate.modules.jackson.model.Accessor; import com.webcohesion.enunciate.modules.jackson.model.adapters.Adaptable; import com.webcohesion.enunciate.util.TypeHintUtils; import javax.lang.model.type.TypeMirror; | import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.annotation.*; import com.webcohesion.enunciate.javac.decorations.*; import com.webcohesion.enunciate.metadata.rs.*; import com.webcohesion.enunciate.modules.jackson.*; import com.webcohesion.enunciate.modules.jackson.model.*; import com.webcohesion.enunciate.modules.jackson.model.adapters.*; import com.webcohesion.enunciate.util.*; import javax.lang.model.type.*; | [
"com.fasterxml.jackson",
"com.webcohesion.enunciate",
"javax.lang"
] | com.fasterxml.jackson; com.webcohesion.enunciate; javax.lang; | 2,492,574 |
public void testOrderByNonGroupedColumn() throws SQLException
{
Statement s = createStatement();
ResultSet rs;
assertStatementError("42Y36", s,
"select a from d2085 group by a order by b");
assertStatementError("42Y36", s,
"select a from d2085 group by a,b order by c");
assertStatementError("42Y36", s,
"select a,b from d2085 group by a,b order by c*2");
} | void function() throws SQLException { Statement s = createStatement(); ResultSet rs; assertStatementError("42Y36", s, STR); assertStatementError("42Y36", s, STR); assertStatementError("42Y36", s, STR); } | /**
* DERBY-2085 check message on order by of non-grouped column
*/ | DERBY-2085 check message on order by of non-grouped column | testOrderByNonGroupedColumn | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GroupByTest.java",
"license": "apache-2.0",
"size": 106831
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,898,838 |
public static Field getField(final Class cls, String fieldName, boolean forceAccess) {
if (cls == null) {
throw new IllegalArgumentException("The class must not be null");
}
if (fieldName == null) {
throw new IllegalArgumentException("The field name must not be null");
}
// Sun Java 1.3 has a bugged implementation of getField hence we write the
// code ourselves
// getField() will return the Field object with the declaring class
// set correctly to the class that declares the field. Thus requesting the
// field on a subclass will return the field from the superclass.
//
// priority order for lookup:
// searchclass private/protected/package/public
// superclass protected/package/public
// private/different package blocks access to further superclasses
// implementedinterface public
// check up the superclass hierarchy
for (Class acls = cls; acls != null; acls = acls.getSuperclass()) {
try {
Field field = acls.getDeclaredField(fieldName);
// getDeclaredField checks for non-public scopes as well
// and it returns accurate results
if (!Modifier.isPublic(field.getModifiers())) {
if (forceAccess) {
field.setAccessible(true);
} else {
continue;
}
}
return field;
} catch (NoSuchFieldException ex) {
// ignore
}
}
// check the public interface case. This must be manually searched for
// incase there is a public supersuperclass field hidden by a private/package
// superclass field.
Field match = null;
for (Iterator intf = ClassUtils.getAllInterfaces(cls).iterator(); intf
.hasNext();) {
try {
Field test = ((Class) intf.next()).getField(fieldName);
if (match != null) {
throw new IllegalArgumentException(
"Reference to field "
+ fieldName
+ " is ambiguous relative to "
+ cls
+ "; a matching field exists on two or more implemented interfaces.");
}
match = test;
} catch (NoSuchFieldException ex) {
// ignore
}
}
return match;
}
| static Field function(final Class cls, String fieldName, boolean forceAccess) { if (cls == null) { throw new IllegalArgumentException(STR); } if (fieldName == null) { throw new IllegalArgumentException(STR); } for (Class acls = cls; acls != null; acls = acls.getSuperclass()) { try { Field field = acls.getDeclaredField(fieldName); if (!Modifier.isPublic(field.getModifiers())) { if (forceAccess) { field.setAccessible(true); } else { continue; } } return field; } catch (NoSuchFieldException ex) { } } Field match = null; for (Iterator intf = ClassUtils.getAllInterfaces(cls).iterator(); intf .hasNext();) { try { Field test = ((Class) intf.next()).getField(fieldName); if (match != null) { throw new IllegalArgumentException( STR + fieldName + STR + cls + STR); } match = test; } catch (NoSuchFieldException ex) { } } return match; } | /**
* Gets an accessible <code>Field</code> by name breaking scope
* if requested. Superclasses/interfaces will be considered.
*
* @param cls the class to reflect, must not be null
* @param fieldName the field name to obtain
* @param forceAccess whether to break scope restrictions using the
* <code>setAccessible</code> method. <code>False</code> will only
* match public fields.
* @return the Field object
* @throws IllegalArgumentException if the class or field name is null
*/ | Gets an accessible <code>Field</code> by name breaking scope if requested. Superclasses/interfaces will be considered | getField | {
"repo_name": "glorycloud/GloryMail",
"path": "CloudyMail/lib_src/org/apache/commons/lang/reflect/FieldUtils.java",
"license": "apache-2.0",
"size": 26754
} | [
"java.lang.reflect.Field",
"java.lang.reflect.Modifier",
"java.util.Iterator",
"org.apache.commons.lang.ClassUtils"
] | import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Iterator; import org.apache.commons.lang.ClassUtils; | import java.lang.reflect.*; import java.util.*; import org.apache.commons.lang.*; | [
"java.lang",
"java.util",
"org.apache.commons"
] | java.lang; java.util; org.apache.commons; | 1,602,401 |
public boolean deleteAccordFile(String fileNameTmp){
boolean signal = false;
// Read File
File file = new File(fileNameTmp);
BufferedReader reader = null;
try{
FileReader fileReader = new FileReader(file);
reader = new BufferedReader(fileReader);
String strLine = null;
IntegerMy integerMyTmp = null;
while((strLine = reader.readLine()) != null){
// deal with one line
integerMyTmp = map.remove(strLine);
if(integerMyTmp != null
&& curNumber.add(integerMyTmp.getNumber())){
signal = true;
}else{
signal = false;
}
}
signal = true;
}catch(Exception e) {
signal = false;
e.printStackTrace();
}finally{
// Close File Stream
if(reader != null){
try{
reader.close();
}catch(Exception e1){
e1.printStackTrace();
}
}
}
return signal;
}
| boolean function(String fileNameTmp){ boolean signal = false; File file = new File(fileNameTmp); BufferedReader reader = null; try{ FileReader fileReader = new FileReader(file); reader = new BufferedReader(fileReader); String strLine = null; IntegerMy integerMyTmp = null; while((strLine = reader.readLine()) != null){ integerMyTmp = map.remove(strLine); if(integerMyTmp != null && curNumber.add(integerMyTmp.getNumber())){ signal = true; }else{ signal = false; } } signal = true; }catch(Exception e) { signal = false; e.printStackTrace(); }finally{ if(reader != null){ try{ reader.close(); }catch(Exception e1){ e1.printStackTrace(); } } } return signal; } | /**
* Delete all values of a file from map.
* @param
* fileName: the name of file will be deleted from map
* like "C:\\URL\\filename.txt".
* @return
* true: success.
* false: failed.
*/ | Delete all values of a file from map | deleteAccordFile | {
"repo_name": "YinYanfei/CadalWorkspace",
"path": "Analyzers/src/com/search/analysis/util/CreateHashMap.java",
"license": "gpl-3.0",
"size": 15705
} | [
"java.io.BufferedReader",
"java.io.File",
"java.io.FileReader"
] | import java.io.BufferedReader; import java.io.File; import java.io.FileReader; | import java.io.*; | [
"java.io"
] | java.io; | 2,078,395 |
protected Document eventToDocument(E2EEvent event) {
Document document = new Document();
document.put(Constants.COLUMN_LABEL, event.getLabel());
document.put(Constants.COLUMN_PRODUCER_MEMBER, event.getProducerMember());
document.put(Constants.COLUMN_SECURITY_SERVER, event.getSecurityServer());
document.put(Constants.COLUMN_REQUEST_ID, event.getRequestId());
document.put(Constants.COLUMN_STATUS, event.isStatus());
document.put(Constants.COLUMN_FAULT_CODE, event.getFaultCode());
document.put(Constants.COLUMN_FAULT_STRING, event.getFaultString());
document.put(Constants.COLUMN_DURATION, event.getDuration());
document.put(Constants.COLUMN_BEGIN, event.getBegin());
document.put(Constants.COLUMN_END, event.getEnd());
document.put(Constants.COLUMN_CREATED_DATE, new Date());
return document;
} | Document function(E2EEvent event) { Document document = new Document(); document.put(Constants.COLUMN_LABEL, event.getLabel()); document.put(Constants.COLUMN_PRODUCER_MEMBER, event.getProducerMember()); document.put(Constants.COLUMN_SECURITY_SERVER, event.getSecurityServer()); document.put(Constants.COLUMN_REQUEST_ID, event.getRequestId()); document.put(Constants.COLUMN_STATUS, event.isStatus()); document.put(Constants.COLUMN_FAULT_CODE, event.getFaultCode()); document.put(Constants.COLUMN_FAULT_STRING, event.getFaultString()); document.put(Constants.COLUMN_DURATION, event.getDuration()); document.put(Constants.COLUMN_BEGIN, event.getBegin()); document.put(Constants.COLUMN_END, event.getEnd()); document.put(Constants.COLUMN_CREATED_DATE, new Date()); return document; } | /**
* Converts the given E2EEvent to a corresponding Document
*
* @param event E2EEvent to be converted
* @return Document representing the given E2EEvent
*/ | Converts the given E2EEvent to a corresponding Document | eventToDocument | {
"repo_name": "petkivim/xrde2e",
"path": "src/client/src/main/java/com/pkrete/xrde2e/client/mongodb/MongoDbManager.java",
"license": "mit",
"size": 10742
} | [
"com.pkrete.xrde2e.common.event.E2EEvent",
"com.pkrete.xrde2e.common.util.Constants",
"java.util.Date",
"org.bson.Document"
] | import com.pkrete.xrde2e.common.event.E2EEvent; import com.pkrete.xrde2e.common.util.Constants; import java.util.Date; import org.bson.Document; | import com.pkrete.xrde2e.common.event.*; import com.pkrete.xrde2e.common.util.*; import java.util.*; import org.bson.*; | [
"com.pkrete.xrde2e",
"java.util",
"org.bson"
] | com.pkrete.xrde2e; java.util; org.bson; | 2,112,508 |
public double calcularHorasTrabalhoRestantes(List<RegistroHoraObservable> registrosHoje) {
double horaRestante = 8;
for (RegistroHoraObservable registroHora : registrosHoje) {
if (StringUtils.isNotBlank(registroHora.getHoraFim())) {
horaRestante -= calcularDuracaoTrabalho(registroHora);
} else {
horaRestante -= calcularDuracaoTrabalho(registroHora.getHoraInicio(), DateUtils.formatarHoraAgora());
}
}
return horaRestante;
}
| double function(List<RegistroHoraObservable> registrosHoje) { double horaRestante = 8; for (RegistroHoraObservable registroHora : registrosHoje) { if (StringUtils.isNotBlank(registroHora.getHoraFim())) { horaRestante -= calcularDuracaoTrabalho(registroHora); } else { horaRestante -= calcularDuracaoTrabalho(registroHora.getHoraInicio(), DateUtils.formatarHoraAgora()); } } return horaRestante; } | /**
* Calcula quanto tempo falta para completar as oito horas do dia
*/ | Calcula quanto tempo falta para completar as oito horas do dia | calcularHorasTrabalhoRestantes | {
"repo_name": "renatorp/WorkHoursControl",
"path": "src/main/java/workhourscontrol/client/service/ControleHorasService.java",
"license": "mit",
"size": 2840
} | [
"java.util.List",
"org.apache.commons.lang3.StringUtils"
] | import java.util.List; import org.apache.commons.lang3.StringUtils; | import java.util.*; import org.apache.commons.lang3.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 780,717 |
public UpdateCriteria priority(int newPriority) {
allCriteria.put(UpdateCriterion.priority, newPriority);
return this;
} | UpdateCriteria function(int newPriority) { allCriteria.put(UpdateCriterion.priority, newPriority); return this; } | /**
* Marks that name field of alert is to be updated and stores the new value
*
* @param newPriority New value for the priority field of alert
* @return Instance with the current criterion added to it.
*/ | Marks that name field of alert is to be updated and stores the new value | priority | {
"repo_name": "bruceMacLeod/motech-server-pillreminder-0.18",
"path": "modules/alerts/api/src/main/java/org/motechproject/server/alerts/contract/UpdateCriteria.java",
"license": "bsd-3-clause",
"size": 2793
} | [
"org.motechproject.server.alerts.domain.UpdateCriterion"
] | import org.motechproject.server.alerts.domain.UpdateCriterion; | import org.motechproject.server.alerts.domain.*; | [
"org.motechproject.server"
] | org.motechproject.server; | 2,109,653 |
public void testListRemoveByIndexBoundsChecking2() {
if (!isRemoveSupported()) {
return;
}
final List<E> list = makeFullCollection();
try {
list.remove(Integer.MIN_VALUE);
fail("List.remove should throw IndexOutOfBoundsException " +
"[Integer.MIN_VALUE]");
} catch(final IndexOutOfBoundsException e) {
// expected
}
try {
list.remove(-1);
fail("List.remove should throw IndexOutOfBoundsException [-1]");
} catch(final IndexOutOfBoundsException e) {
// expected
}
try {
list.remove(getFullElements().length);
fail("List.remove should throw IndexOutOfBoundsException [size]");
} catch(final IndexOutOfBoundsException e) {
// expected
}
try {
list.remove(Integer.MAX_VALUE);
fail("List.remove should throw IndexOutOfBoundsException " +
"[Integer.MAX_VALUE]");
} catch(final IndexOutOfBoundsException e) {
// expected
}
} | void function() { if (!isRemoveSupported()) { return; } final List<E> list = makeFullCollection(); try { list.remove(Integer.MIN_VALUE); fail(STR + STR); } catch(final IndexOutOfBoundsException e) { } try { list.remove(-1); fail(STR); } catch(final IndexOutOfBoundsException e) { } try { list.remove(getFullElements().length); fail(STR); } catch(final IndexOutOfBoundsException e) { } try { list.remove(Integer.MAX_VALUE); fail(STR + STR); } catch(final IndexOutOfBoundsException e) { } } | /**
* Tests bounds checking for {@link List#remove(int)} on a
* full list.
*/ | Tests bounds checking for <code>List#remove(int)</code> on a full list | testListRemoveByIndexBoundsChecking2 | {
"repo_name": "apache/commons-collections",
"path": "src/test/java/org/apache/commons/collections4/list/AbstractListTest.java",
"license": "apache-2.0",
"size": 43688
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,739,353 |
EAttribute getSoftware_Priority(); | EAttribute getSoftware_Priority(); | /**
* Returns the meta object for the attribute '{@link org.eclipse.papyrus.RobotML.Software#getPriority <em>Priority</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Priority</em>'.
* @see org.eclipse.papyrus.RobotML.Software#getPriority()
* @see #getSoftware()
* @generated
*/ | Returns the meta object for the attribute '<code>org.eclipse.papyrus.RobotML.Software#getPriority Priority</code>'. | getSoftware_Priority | {
"repo_name": "RobotML/RobotML-SDK-Juno",
"path": "plugins/robotml/org.eclipse.papyrus.robotml/src/org/eclipse/papyrus/RobotML/RobotMLPackage.java",
"license": "epl-1.0",
"size": 231818
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 539,139 |
public void testGetPropertyNames() throws RepositoryException {
String queryStatement = "/" + jcrRoot;
// build and execute search query
Query query = superuser.getWorkspace().getQueryManager().createQuery(queryStatement, Query.XPATH);
QueryResult result = query.execute();
// Get the node's non-residual properties
PropertyDefinition[] pd = superuser.getWorkspace().getNodeTypeManager().getNodeType(ntBase).getDeclaredPropertyDefinitions();
List singleValPropNames = new ArrayList();
for (int i = 0; i < pd.length; i++) {
// only keep the single-value properties
if (!pd[i].isMultiple()) {
singleValPropNames.add(pd[i].getName());
}
}
// add jcr:path
singleValPropNames.add(jcrPath);
singleValPropNames.add(jcrScore);
String[] foundPropertyNames = result.getColumnNames();
Object[] realPropertyNames = singleValPropNames.toArray();
// sort the 2 arrays before comparing them
Arrays.sort(foundPropertyNames);
Arrays.sort(realPropertyNames);
assertTrue("Property names don't match", Arrays.equals(foundPropertyNames, realPropertyNames));
} | void function() throws RepositoryException { String queryStatement = "/" + jcrRoot; Query query = superuser.getWorkspace().getQueryManager().createQuery(queryStatement, Query.XPATH); QueryResult result = query.execute(); PropertyDefinition[] pd = superuser.getWorkspace().getNodeTypeManager().getNodeType(ntBase).getDeclaredPropertyDefinitions(); List singleValPropNames = new ArrayList(); for (int i = 0; i < pd.length; i++) { if (!pd[i].isMultiple()) { singleValPropNames.add(pd[i].getName()); } } singleValPropNames.add(jcrPath); singleValPropNames.add(jcrScore); String[] foundPropertyNames = result.getColumnNames(); Object[] realPropertyNames = singleValPropNames.toArray(); Arrays.sort(foundPropertyNames); Arrays.sort(realPropertyNames); assertTrue(STR, Arrays.equals(foundPropertyNames, realPropertyNames)); } | /**
* Check if the property names from the search results match the
* non-residual ones from the base node type
*/ | Check if the property names from the search results match the non-residual ones from the base node type | testGetPropertyNames | {
"repo_name": "jalkanen/Priha",
"path": "tests/tck/org/apache/jackrabbit/test/api/query/GetPropertyNamesTest.java",
"license": "apache-2.0",
"size": 3396
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List",
"javax.jcr.RepositoryException",
"javax.jcr.nodetype.PropertyDefinition",
"javax.jcr.query.Query",
"javax.jcr.query.QueryResult"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.jcr.RepositoryException; import javax.jcr.nodetype.PropertyDefinition; import javax.jcr.query.Query; import javax.jcr.query.QueryResult; | import java.util.*; import javax.jcr.*; import javax.jcr.nodetype.*; import javax.jcr.query.*; | [
"java.util",
"javax.jcr"
] | java.util; javax.jcr; | 979,681 |
@Override
public boolean canBePostProcessed(ImmutableList<? extends ImmutableTerm> arguments) {
return false;
} | boolean function(ImmutableList<? extends ImmutableTerm> arguments) { return false; } | /**
* Could be supported in the future
*/ | Could be supported in the future | canBePostProcessed | {
"repo_name": "ontop/ontop",
"path": "core/model/src/main/java/it/unibz/inf/ontop/model/term/functionsymbol/impl/LangSPARQLFunctionSymbolImpl.java",
"license": "apache-2.0",
"size": 2187
} | [
"com.google.common.collect.ImmutableList",
"it.unibz.inf.ontop.model.term.ImmutableTerm"
] | import com.google.common.collect.ImmutableList; import it.unibz.inf.ontop.model.term.ImmutableTerm; | import com.google.common.collect.*; import it.unibz.inf.ontop.model.term.*; | [
"com.google.common",
"it.unibz.inf"
] | com.google.common; it.unibz.inf; | 2,383,575 |
public List<Person> getSpaceMembers(String spaceId) throws WWException {
SpaceMembersGraphQLQuery queryObject = SpaceMembersGraphQLQuery.buildSpaceMemberGraphQueryBySpaceId(spaceId);
return getSpaceMembersWithQuery(queryObject);
} | List<Person> function(String spaceId) throws WWException { SpaceMembersGraphQLQuery queryObject = SpaceMembersGraphQLQuery.buildSpaceMemberGraphQueryBySpaceId(spaceId); return getSpaceMembersWithQuery(queryObject); } | /**
* Get basic data for Space Members for relevant Sapce
*
* @param spaceId
* String id for the Space
* @return Space for relevant ID
* @throws WWException
* containing an error message, if the request was unsuccessful
*
* @since 0.5.0
*/ | Get basic data for Space Members for relevant Sapce | getSpaceMembers | {
"repo_name": "OpenCode4Workspace/Watson-Work-Services-Java-SDK",
"path": "wws-api/src/main/java/org/opencode4workspace/endpoints/WWGraphQLEndpoint.java",
"license": "apache-2.0",
"size": 21961
} | [
"java.util.List",
"org.opencode4workspace.WWException",
"org.opencode4workspace.bo.Person",
"org.opencode4workspace.builders.SpaceMembersGraphQLQuery"
] | import java.util.List; import org.opencode4workspace.WWException; import org.opencode4workspace.bo.Person; import org.opencode4workspace.builders.SpaceMembersGraphQLQuery; | import java.util.*; import org.opencode4workspace.*; import org.opencode4workspace.bo.*; import org.opencode4workspace.builders.*; | [
"java.util",
"org.opencode4workspace",
"org.opencode4workspace.bo",
"org.opencode4workspace.builders"
] | java.util; org.opencode4workspace; org.opencode4workspace.bo; org.opencode4workspace.builders; | 2,026,229 |
@Generated
@Selector("noiseWithNoiseSource:")
public static native GKNoise noiseWithNoiseSource(GKNoiseSource noiseSource); | @Selector(STR) static native GKNoise function(GKNoiseSource noiseSource); | /**
* Initializes a noise with the specified noise source.
*
* @param noiseSource The noise source to use to initially populate the 3D noise space.
*/ | Initializes a noise with the specified noise source | noiseWithNoiseSource | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/gameplaykit/GKNoise.java",
"license": "apache-2.0",
"size": 14043
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,636,357 |
private void updateNodeHealthFailureStatistics(String hostName,
FaultInfo fi) {
//Check if the node was already blacklisted due to
//unhealthy reason. If so dont increment the count.
if (!fi.getReasonforblacklisting().contains(
ReasonForBlackListing.NODE_UNHEALTHY)) {
Set<TaskTracker> trackers = hostnameToTaskTracker.get(hostName);
synchronized (trackers) {
for (TaskTracker t : trackers) {
TaskTrackerStat stat = statistics.getTaskTrackerStat(
t.getTrackerName());
stat.incrHealthCheckFailed();
}
}
}
}
}
/**
* Get all task tracker statuses on given host
*
* Assumes JobTracker is locked on the entry
* @param hostName
* @return {@link java.util.List} of {@link TaskTrackerStatus} | void function(String hostName, FaultInfo fi) { if (!fi.getReasonforblacklisting().contains( ReasonForBlackListing.NODE_UNHEALTHY)) { Set<TaskTracker> trackers = hostnameToTaskTracker.get(hostName); synchronized (trackers) { for (TaskTracker t : trackers) { TaskTrackerStat stat = statistics.getTaskTrackerStat( t.getTrackerName()); stat.incrHealthCheckFailed(); } } } } } /** * Get all task tracker statuses on given host * * Assumes JobTracker is locked on the entry * @param hostName * @return {@link java.util.List} of {@link TaskTrackerStatus} | /**
* Update the node health failure statistics of the given
* host.
*
* We increment the count only when the host transitions
* from healthy -> unhealthy.
*
* @param hostName
* @param fi Fault info object for the host.
*/ | Update the node health failure statistics of the given host. We increment the count only when the host transitions from healthy -> unhealthy | updateNodeHealthFailureStatistics | {
"repo_name": "steveloughran/hadoop-mapreduce",
"path": "src/java/org/apache/hadoop/mapred/JobTracker.java",
"license": "apache-2.0",
"size": 169624
} | [
"java.util.List",
"java.util.Set",
"org.apache.hadoop.mapred.JobTrackerStatistics",
"org.apache.hadoop.mapreduce.server.jobtracker.TaskTracker"
] | import java.util.List; import java.util.Set; import org.apache.hadoop.mapred.JobTrackerStatistics; import org.apache.hadoop.mapreduce.server.jobtracker.TaskTracker; | import java.util.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.mapreduce.server.jobtracker.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 348,377 |
public TransitiveDepTemplatesInfo toFinishedInfo() {
if (finishedInfo == null) {
if (visitInfoOfEarliestEquivalent != null) {
finishedInfo = visitInfoOfEarliestEquivalent.toFinishedInfo();
} else {
finishedInfo = new TransitiveDepTemplatesInfo(depTemplateSet);
}
}
return finishedInfo;
}
}
// -----------------------------------------------------------------------------------------------
// FindTransitiveDepTemplatesVisitor body.
private final TemplateRegistry templateRegistry;
@VisibleForTesting
Map<TemplateNode, TransitiveDepTemplatesInfo> templateToFinishedInfoMap;
private TemplateVisitInfo currTemplateVisitInfo;
private Deque<TemplateVisitInfo> activeTemplateVisitInfoStack;
private Set<TemplateNode> activeTemplateSet;
private Map<TemplateNode, TemplateVisitInfo> visitedTemplateToInfoMap;
public FindTransitiveDepTemplatesVisitor(TemplateRegistry templateRegistry) {
this.templateRegistry = checkNotNull(templateRegistry);
templateToFinishedInfoMap = Maps.newHashMap();
}
/**
* {@inheritDoc} | TransitiveDepTemplatesInfo function() { if (finishedInfo == null) { if (visitInfoOfEarliestEquivalent != null) { finishedInfo = visitInfoOfEarliestEquivalent.toFinishedInfo(); } else { finishedInfo = new TransitiveDepTemplatesInfo(depTemplateSet); } } return finishedInfo; } } private final TemplateRegistry templateRegistry; Map<TemplateNode, TransitiveDepTemplatesInfo> templateToFinishedInfoMap; private TemplateVisitInfo currTemplateVisitInfo; private Deque<TemplateVisitInfo> activeTemplateVisitInfoStack; private Set<TemplateNode> activeTemplateSet; private Map<TemplateNode, TemplateVisitInfo> visitedTemplateToInfoMap; public FindTransitiveDepTemplatesVisitor(TemplateRegistry templateRegistry) { this.templateRegistry = checkNotNull(templateRegistry); templateToFinishedInfoMap = Maps.newHashMap(); } /** * {@inheritDoc} | /**
* Converts this (unfinished) visit info into a (finished) TransitiveDepTemplatesInfo.
* <p> Caches the result so that only one finished info object is created even if called
* multiple times.
* @return The finished info object.
*/ | Converts this (unfinished) visit info into a (finished) TransitiveDepTemplatesInfo. Caches the result so that only one finished info object is created even if called multiple times | toFinishedInfo | {
"repo_name": "atul-bhouraskar/closure-templates",
"path": "java/src/com/google/template/soy/passes/FindTransitiveDepTemplatesVisitor.java",
"license": "apache-2.0",
"size": 19547
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.Maps",
"com.google.template.soy.passes.FindTransitiveDepTemplatesVisitor",
"com.google.template.soy.soytree.TemplateNode",
"com.google.template.soy.soytree.TemplateRegistry",
"java.util.Deque",
"java.util.Map",
"java.util.Set"
] | import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.google.template.soy.passes.FindTransitiveDepTemplatesVisitor; import com.google.template.soy.soytree.TemplateNode; import com.google.template.soy.soytree.TemplateRegistry; import java.util.Deque; import java.util.Map; import java.util.Set; | import com.google.common.base.*; import com.google.common.collect.*; import com.google.template.soy.passes.*; import com.google.template.soy.soytree.*; import java.util.*; | [
"com.google.common",
"com.google.template",
"java.util"
] | com.google.common; com.google.template; java.util; | 805,055 |
private void validateFields(List<String> fields) {
if (fields == null) {
return;
}
List<String> badFields = new ArrayList<String>();
for (String field: fields) {
if (field.contains(".")) {
badFields.add(field);
}
}
if (!badFields.isEmpty()) {
String msg = String.format("Projection field(s) cannot use dotted notation: %s",
Misc.join(", ", badFields));
logger.log(Level.SEVERE, msg);
throw new IllegalArgumentException(msg);
}
} | void function(List<String> fields) { if (fields == null) { return; } List<String> badFields = new ArrayList<String>(); for (String field: fields) { if (field.contains(".")) { badFields.add(field); } } if (!badFields.isEmpty()) { String msg = String.format(STR, Misc.join(STR, badFields)); logger.log(Level.SEVERE, msg); throw new IllegalArgumentException(msg); } } | /**
* Checks if the fields are valid.
*/ | Checks if the fields are valid | validateFields | {
"repo_name": "cloudant/sync-android",
"path": "cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java",
"license": "apache-2.0",
"size": 16642
} | [
"com.cloudant.sync.internal.util.Misc",
"java.util.ArrayList",
"java.util.List",
"java.util.logging.Level"
] | import com.cloudant.sync.internal.util.Misc; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; | import com.cloudant.sync.internal.util.*; import java.util.*; import java.util.logging.*; | [
"com.cloudant.sync",
"java.util"
] | com.cloudant.sync; java.util; | 1,835,164 |
private InputStream downloadUrl(String urlString) throws IOException {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000 );
conn.setConnectTimeout(15000 );
conn.setRequestMethod("GET");
conn.setDoInput(true);
// Start the query
conn.connect();
InputStream stream = conn.getInputStream();
return stream;
} | InputStream function(String urlString) throws IOException { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(10000 ); conn.setConnectTimeout(15000 ); conn.setRequestMethod("GET"); conn.setDoInput(true); conn.connect(); InputStream stream = conn.getInputStream(); return stream; } | /**
* Given a string representation of a URL, sets up a connection and gets
* an input stream.
* @param urlString A string representation of a URL.
* @return An InputStream retrieved from a successful HttpURLConnection.
* @throws IOException
*/ | Given a string representation of a URL, sets up a connection and gets an input stream | downloadUrl | {
"repo_name": "systemantis/location_pusher",
"path": "app/src/main/java/mx/systemantis/locationpusher/SimpleSchedulingService.java",
"license": "apache-2.0",
"size": 4750
} | [
"java.io.IOException",
"java.io.InputStream",
"java.net.HttpURLConnection"
] | import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 141,448 |
public static ims.correspondence.vo.UserAccessFullVo insert(DomainObjectMap map, ims.correspondence.vo.UserAccessFullVo valueObject, ims.correspondence.configuration.domain.objects.UserAccess domainObject)
{
if (null == domainObject)
{
return valueObject;
}
if (null == map)
{
map = new DomainObjectMap();
}
valueObject.setID_UserAccess(domainObject.getId());
valueObject.setIsRIE(domainObject.getIsRIE());
// If this is a recordedInError record, and the domainObject
// value isIncludeRecord has not been set, then we return null and
// not the value object
if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord())
return null;
// If this is not a recordedInError record, and the domainObject
// value isIncludeRecord has been set, then we return null and
// not the value object
if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord())
return null;
// AppUser
if (domainObject.getAppUser() != null)
{
if(domainObject.getAppUser() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the id already.
{
HibernateProxy p = (HibernateProxy) domainObject.getAppUser();
int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
valueObject.setAppUser(new ims.core.configuration.vo.AppUserRefVo(id, -1));
}
else
{
valueObject.setAppUser(new ims.core.configuration.vo.AppUserRefVo(domainObject.getAppUser().getId(), domainObject.getAppUser().getVersion()));
}
}
// ConsultantAccess
valueObject.setConsultantAccess(ims.correspondence.vo.domain.ConsultantAccessFullVoAssembler.createConsultantAccessFullVoCollectionFromConsultantAccess(map, domainObject.getConsultantAccess()) );
// ClinicAccess
valueObject.setClinicAccess(ims.correspondence.vo.domain.ClinicAccessFullVoAssembler.createClinicAccessFullVoCollectionFromClinicAccess(map, domainObject.getClinicAccess()) );
// SpecialtyAccess
valueObject.setSpecialtyAccess(ims.correspondence.vo.domain.SpecialtyAccessVoAssembler.createSpecialtyAccessVoCollectionFromSpecialtyAccess(map, domainObject.getSpecialtyAccess()) );
return valueObject;
} | static ims.correspondence.vo.UserAccessFullVo function(DomainObjectMap map, ims.correspondence.vo.UserAccessFullVo valueObject, ims.correspondence.configuration.domain.objects.UserAccess domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_UserAccess(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; if ((valueObject.getIsRIE() == null valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; if (domainObject.getAppUser() != null) { if(domainObject.getAppUser() instanceof HibernateProxy) { HibernateProxy p = (HibernateProxy) domainObject.getAppUser(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setAppUser(new ims.core.configuration.vo.AppUserRefVo(id, -1)); } else { valueObject.setAppUser(new ims.core.configuration.vo.AppUserRefVo(domainObject.getAppUser().getId(), domainObject.getAppUser().getVersion())); } } valueObject.setConsultantAccess(ims.correspondence.vo.domain.ConsultantAccessFullVoAssembler.createConsultantAccessFullVoCollectionFromConsultantAccess(map, domainObject.getConsultantAccess()) ); valueObject.setClinicAccess(ims.correspondence.vo.domain.ClinicAccessFullVoAssembler.createClinicAccessFullVoCollectionFromClinicAccess(map, domainObject.getClinicAccess()) ); valueObject.setSpecialtyAccess(ims.correspondence.vo.domain.SpecialtyAccessVoAssembler.createSpecialtyAccessVoCollectionFromSpecialtyAccess(map, domainObject.getSpecialtyAccess()) ); return valueObject; } | /**
* Update the ValueObject with the Domain Object.
* @param map DomainObjectMap of DomainObjects to already created ValueObjects.
* @param valueObject to be updated
* @param domainObject ims.correspondence.configuration.domain.objects.UserAccess
*/ | Update the ValueObject with the Domain Object | insert | {
"repo_name": "open-health-hub/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/correspondence/vo/domain/UserAccessFullVoAssembler.java",
"license": "agpl-3.0",
"size": 18639
} | [
"org.hibernate.proxy.HibernateProxy"
] | import org.hibernate.proxy.HibernateProxy; | import org.hibernate.proxy.*; | [
"org.hibernate.proxy"
] | org.hibernate.proxy; | 1,587,132 |
Entry<TKey, TValue> extractMinimum()
throws NoSuchElementException; | Entry<TKey, TValue> extractMinimum() throws NoSuchElementException; | /**
* Remove and return the entry minimum key.
*
* @return the entry.
* @throws NoSuchElementException If the org.teneighty.heap is empty.
* @see #getMinimum()
*/ | Remove and return the entry minimum key | extractMinimum | {
"repo_name": "oskopek/TransportEditor",
"path": "transport-thirdparty/src/main/java/org/teneighty/heap/Heap.java",
"license": "mit",
"size": 17880
} | [
"java.util.NoSuchElementException"
] | import java.util.NoSuchElementException; | import java.util.*; | [
"java.util"
] | java.util; | 1,683,765 |
ApiDirectoryListing getApiDirectoryListing(); | ApiDirectoryListing getApiDirectoryListing(); | /**
* Provides access to the listing.
*
* @return a listing
*/ | Provides access to the listing | getApiDirectoryListing | {
"repo_name": "boa0332/google-plugin-for-eclipse",
"path": "plugins/com.google.gdt.eclipse.managedapis/src/com/google/gdt/eclipse/managedapis/directory/ApiDirectory.java",
"license": "epl-1.0",
"size": 2068
} | [
"com.google.gdt.googleapi.core.ApiDirectoryListing"
] | import com.google.gdt.googleapi.core.ApiDirectoryListing; | import com.google.gdt.googleapi.core.*; | [
"com.google.gdt"
] | com.google.gdt; | 479,891 |
public Collection<Suggestion> getSuggestions()
throws ServiceResponseException {
if (this.suggestionsResponse == null) {
return null;
} else {
this.suggestionsResponse.throwIfNecessary();
return this.suggestionsResponse.getSuggestions();
}
} | Collection<Suggestion> function() throws ServiceResponseException { if (this.suggestionsResponse == null) { return null; } else { this.suggestionsResponse.throwIfNecessary(); return this.suggestionsResponse.getSuggestions(); } } | /**
* Gets a collection of suggested meeting times for the specified time
* period.
*
* @return the suggestions
* @throws microsoft.exchange.webservices.data.ServiceResponseException the service response exception
*/ | Gets a collection of suggested meeting times for the specified time period | getSuggestions | {
"repo_name": "evpaassen/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/GetUserAvailabilityResults.java",
"license": "mit",
"size": 3378
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,545,797 |
// helper methods ..........................................................
public static String normalize(String path)
{
for (Matcher m = thisDirectoryPattern.matcher(path); m.find();)
{
path = m.replaceAll("$1");
m =
thisDirectoryPattern.matcher(path);
}
for (Matcher m = parentDirectoryPattern.matcher(path); m.find();)
{
if (!m.group(2).equals(".."))
{
path = path.substring(0, m.start()) + m.group(1) + path.substring(m.end());
m =
parentDirectoryPattern.matcher(path);
}
}
return path;
} | static String function(String path) { for (Matcher m = thisDirectoryPattern.matcher(path); m.find();) { path = m.replaceAll("$1"); m = thisDirectoryPattern.matcher(path); } for (Matcher m = parentDirectoryPattern.matcher(path); m.find();) { if (!m.group(2).equals("..")) { path = path.substring(0, m.start()) + m.group(1) + path.substring(m.end()); m = parentDirectoryPattern.matcher(path); } } return path; } | /**
* Normalizes the given path by removing unnecessary "." and ".." sequences.
* This normalization is needed because the compiler stores source paths like "foo/../inc.jsp" into .class files.
* Such paths are not supported by our ClassPath API.
* TODO: compiler bug? report to JDK?
*
* @param path path to normalize
* @return normalized path without "." and ".." elements
*/ | Normalizes the given path by removing unnecessary "." and ".." sequences. This normalization is needed because the compiler stores source paths like "foo/../inc.jsp" into .class files. Such paths are not supported by our ClassPath API | normalize | {
"repo_name": "tcolar/fantomidemodule",
"path": "src/net/colar/netbeans/fan/debugger/FanDebugPathProvider.java",
"license": "artistic-2.0",
"size": 26938
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 1,398,281 |
public static String[] splitFirst(String source, String splitter)
{
// hold the results as we find them
Vector rv = new Vector();
int last = 0;
int next = 0;
// find first splitter in source
next = source.indexOf(splitter, last);
if (next != -1)
{
// isolate from last thru before next
rv.add(source.substring(last, next));
last = next + splitter.length();
}
if (last < source.length())
{
rv.add(source.substring(last, source.length()));
}
// convert to array
return (String[]) rv.toArray(new String[rv.size()]);
} | static String[] function(String source, String splitter) { Vector rv = new Vector(); int last = 0; int next = 0; next = source.indexOf(splitter, last); if (next != -1) { rv.add(source.substring(last, next)); last = next + splitter.length(); } if (last < source.length()) { rv.add(source.substring(last, source.length())); } return (String[]) rv.toArray(new String[rv.size()]); } | /**
* Split the source into two strings at the first occurrence of the splitter Subsequent occurrences are not treated specially, and may be part of the second string.
*
* @param source
* The string to split
* @param splitter
* The string that forms the boundary between the two strings returned.
* @return An array of two strings split from source by splitter.
*/ | Split the source into two strings at the first occurrence of the splitter Subsequent occurrences are not treated specially, and may be part of the second string | splitFirst | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "kernel/kernel-util/src/main/java/org/sakaiproject/util/StringUtil.java",
"license": "apache-2.0",
"size": 13828
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,331,774 |
public PointcutExpression getPointcutExpression() {
checkReadyToMatch();
return this.pointcutExpression;
} | PointcutExpression function() { checkReadyToMatch(); return this.pointcutExpression; } | /**
* Return the underlying AspectJ pointcut expression.
*/ | Return the underlying AspectJ pointcut expression | getPointcutExpression | {
"repo_name": "deathspeeder/class-guard",
"path": "spring-framework-3.2.x/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java",
"license": "gpl-2.0",
"size": 22685
} | [
"org.aspectj.weaver.tools.PointcutExpression"
] | import org.aspectj.weaver.tools.PointcutExpression; | import org.aspectj.weaver.tools.*; | [
"org.aspectj.weaver"
] | org.aspectj.weaver; | 2,438,877 |
List<RichMember> getRichMembersWithAttributesByNames(PerunSession sess, Vo vo, List<String> attrsNames) throws InternalErrorException, AttributeNotExistsException; | List<RichMember> getRichMembersWithAttributesByNames(PerunSession sess, Vo vo, List<String> attrsNames) throws InternalErrorException, AttributeNotExistsException; | /**
* Get RichMembers with Attributes but only with selected attributes from list attrsNames for vo.
*
* @param sess
* @param vo
* @param attrsNames list of attrNames for selected attributes
* @return list of RichMembers
* @throws AttributeNotExistsException
* @throws InternalErrorException
*/ | Get RichMembers with Attributes but only with selected attributes from list attrsNames for vo | getRichMembersWithAttributesByNames | {
"repo_name": "ondrocks/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/MembersManagerBl.java",
"license": "bsd-2-clause",
"size": 49250
} | [
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.RichMember",
"cz.metacentrum.perun.core.api.Vo",
"cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"java.util.List"
] | import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.RichMember; import cz.metacentrum.perun.core.api.Vo; import cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.List; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 1,304,761 |
public static void addMoreComponents(Container cnt, Component[] components, boolean areThereMore) {
InfiniteScrollAdapter ia = (InfiniteScrollAdapter)cnt.getClientProperty("cn1$infinite");
ia.addMoreComponents(components, areThereMore);
} | static void function(Container cnt, Component[] components, boolean areThereMore) { InfiniteScrollAdapter ia = (InfiniteScrollAdapter)cnt.getClientProperty(STR); ia.addMoreComponents(components, areThereMore); } | /**
* Invoke this method to add additional components to the container, if you use
* addComponent/removeComponent you will get undefined behavior.
* This is a convenience method saving the need to keep the InfiniteScrollAdapter as a variable
* @param cnt container to add the components to
* @param components the components to add
* @param areThereMore whether additional components exist
*/ | Invoke this method to add additional components to the container, if you use addComponent/removeComponent you will get undefined behavior. This is a convenience method saving the need to keep the InfiniteScrollAdapter as a variable | addMoreComponents | {
"repo_name": "skyHALud/codenameone",
"path": "CodenameOne/src/com/codename1/components/InfiniteScrollAdapter.java",
"license": "gpl-2.0",
"size": 6263
} | [
"com.codename1.ui.Component",
"com.codename1.ui.Container"
] | import com.codename1.ui.Component; import com.codename1.ui.Container; | import com.codename1.ui.*; | [
"com.codename1.ui"
] | com.codename1.ui; | 105,834 |
public Writer getWriter() {
return writer;
} | Writer function() { return writer; } | /**
* Gets the writer which will be written to every time this script runs (if any)
*
* @return
*/ | Gets the writer which will be written to every time this script runs (if any) | getWriter | {
"repo_name": "meitar/zaproxy",
"path": "zap/src/main/java/org/zaproxy/zap/extension/script/ScriptWrapper.java",
"license": "apache-2.0",
"size": 10523
} | [
"java.io.Writer"
] | import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 34,200 |
public int getLine() {
Element lineRoot = ((BaseDocument)getDocument()).getParagraphElement(0).getParentElement();
int lineIndex = lineRoot.getElementIndex(getOffset());
return lineIndex;
// return (getModifyUndoEdit() != null) ? getModifyUndoEdit().getLine() : 0;
} | int function() { Element lineRoot = ((BaseDocument)getDocument()).getParagraphElement(0).getParentElement(); int lineIndex = lineRoot.getElementIndex(getOffset()); return lineIndex; } | /**
* Get the line at which the insert/remove occured.
* @deprecated
*/ | Get the line at which the insert/remove occured | getLine | {
"repo_name": "sitsang/studio",
"path": "src/main/java/org/netbeans/editor/BaseDocumentEvent.java",
"license": "gpl-3.0",
"size": 16463
} | [
"javax.swing.text.Element"
] | import javax.swing.text.Element; | import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 897,994 |
EClass getRequirement(); | EClass getRequirement(); | /**
* Returns the meta object for class '{@link org.eclipse.incquery.examples.cps.cyberPhysicalSystem.Requirement <em>Requirement</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Requirement</em>'.
* @see org.eclipse.incquery.examples.cps.cyberPhysicalSystem.Requirement
* @generated
*/ | Returns the meta object for class '<code>org.eclipse.incquery.examples.cps.cyberPhysicalSystem.Requirement Requirement</code>'. | getRequirement | {
"repo_name": "ZsoltKovari/incquery-examples-cps",
"path": "domains/org.eclipse.incquery.examples.cps.model/src/org/eclipse/incquery/examples/cps/cyberPhysicalSystem/CyberPhysicalSystemPackage.java",
"license": "epl-1.0",
"size": 70719
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 368,667 |
public static void checkExplanations(Query query,
String defaultFieldName,
IndexSearcher searcher,
boolean deep) throws IOException {
searcher.search(query,
new ExplanationAsserter
(query, defaultFieldName, searcher, deep));
} | static void function(Query query, String defaultFieldName, IndexSearcher searcher, boolean deep) throws IOException { searcher.search(query, new ExplanationAsserter (query, defaultFieldName, searcher, deep)); } | /**
* Asserts that the explanation value for every document matching a
* query corresponds with the true score. Optionally does "deep"
* testing of the explanation details.
*
* @see ExplanationAsserter
* @param query the query to test
* @param searcher the searcher to test the query against
* @param defaultFieldName used for displaing the query in assertion messages
* @param deep indicates whether a deep comparison of sub-Explanation details should be executed
*/ | Asserts that the explanation value for every document matching a query corresponds with the true score. Optionally does "deep" testing of the explanation details | checkExplanations | {
"repo_name": "visouza/solr-5.0.0",
"path": "lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java",
"license": "apache-2.0",
"size": 18268
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,450,561 |
public void awaitTermination(long timeout) throws TimeoutException {
if (this.execute.get()) {
throw new IllegalStateException("Threadpool not terminated before awaiting termination");
}
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() - startTime <= timeout) {
boolean flag = true;
for (Thread thread : threads) {
if (thread.isAlive()) {
flag = false;
break;
}
}
if (flag) {
return;
}
try {
Thread.sleep(1);
} catch (InterruptedException e) {
throw new ThreadPoolException(e);
}
}
throw new TimeoutException("Unable to terminate threadpool within the specified timeout (" + timeout + "ms)");
} | void function(long timeout) throws TimeoutException { if (this.execute.get()) { throw new IllegalStateException(STR); } long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() - startTime <= timeout) { boolean flag = true; for (Thread thread : threads) { if (thread.isAlive()) { flag = false; break; } } if (flag) { return; } try { Thread.sleep(1); } catch (InterruptedException e) { throw new ThreadPoolException(e); } } throw new TimeoutException(STR + timeout + "ms)"); } | /**
* Awaits up to <b>timeout</b> ms the termination of the threads in the threadpool
*
* @param timeout Timeout in milliseconds
* @throws TimeoutException Thrown if the termination takes longer than the timeout
* @throws IllegalStateException Thrown if the stop() or terminate() methods haven't been called before awaiting
*/ | Awaits up to timeout ms the termination of the threads in the threadpool | awaitTermination | {
"repo_name": "Bifi1992/Programmentwurf",
"path": "src/ThreadPool.java",
"license": "mit",
"size": 4499
} | [
"java.util.concurrent.TimeoutException"
] | import java.util.concurrent.TimeoutException; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,251,714 |
private void installProjectPom( MavenProject mvnProject, ArtifactRepository testRepository )
throws MojoExecutionException
{
try
{
Artifact pomArtifact = null;
if ( "pom".equals( mvnProject.getPackaging() ) )
{
pomArtifact = mvnProject.getArtifact();
}
if ( pomArtifact == null )
{
pomArtifact =
artifactFactory.createProjectArtifact( mvnProject.getGroupId(), mvnProject.getArtifactId(),
mvnProject.getVersion() );
}
installArtifact( mvnProject.getFile(), pomArtifact, testRepository );
}
catch ( Exception e )
{
throw new MojoExecutionException( "Failed to install POM: " + mvnProject, e );
}
} | void function( MavenProject mvnProject, ArtifactRepository testRepository ) throws MojoExecutionException { try { Artifact pomArtifact = null; if ( "pom".equals( mvnProject.getPackaging() ) ) { pomArtifact = mvnProject.getArtifact(); } if ( pomArtifact == null ) { pomArtifact = artifactFactory.createProjectArtifact( mvnProject.getGroupId(), mvnProject.getArtifactId(), mvnProject.getVersion() ); } installArtifact( mvnProject.getFile(), pomArtifact, testRepository ); } catch ( Exception e ) { throw new MojoExecutionException( STR + mvnProject, e ); } } | /**
* Installs the POM of the specified project to the local repository.
*
* @param mvnProject The project whose POM should be installed, must not be <code>null</code>.
* @param testRepository The local repository to install the POM to, must not be <code>null</code>.
* @throws MojoExecutionException If the POM could not be installed.
*/ | Installs the POM of the specified project to the local repository | installProjectPom | {
"repo_name": "dmlloyd/maven-plugins",
"path": "maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java",
"license": "apache-2.0",
"size": 26503
} | [
"org.apache.maven.artifact.Artifact",
"org.apache.maven.artifact.repository.ArtifactRepository",
"org.apache.maven.plugin.MojoExecutionException",
"org.apache.maven.project.MavenProject"
] | import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; | import org.apache.maven.artifact.*; import org.apache.maven.artifact.repository.*; import org.apache.maven.plugin.*; import org.apache.maven.project.*; | [
"org.apache.maven"
] | org.apache.maven; | 2,086,416 |
public static boolean equals(final BasicNetwork network1,
final BasicNetwork network2,
final int precision) {
final double[] array1 = NetworkCODEC.networkToArray(network1);
final double[] array2 = NetworkCODEC.networkToArray(network2);
if (array1.length != array2.length) {
return false;
}
final double test = Math.pow(10.0, precision);
if (Double.isInfinite(test) || (test > Long.MAX_VALUE)) {
throw new NeuralNetworkError("Precision of " + precision +
" decimal places is not supported.");
}
for (int i = 0; i < array1.length; i++) {
final long l1 = (long) (array1[i] * test);
final long l2 = (long) (array2[i] * test);
if (l1 != l2) {
return false;
}
}
return true;
} | static boolean function(final BasicNetwork network1, final BasicNetwork network2, final int precision) { final double[] array1 = NetworkCODEC.networkToArray(network1); final double[] array2 = NetworkCODEC.networkToArray(network2); if (array1.length != array2.length) { return false; } final double test = Math.pow(10.0, precision); if (Double.isInfinite(test) (test > Long.MAX_VALUE)) { throw new NeuralNetworkError(STR + precision + STR); } for (int i = 0; i < array1.length; i++) { final long l1 = (long) (array1[i] * test); final long l2 = (long) (array2[i] * test); if (l1 != l2) { return false; } } return true; } | /**
* Determine if the two neural networks are equal.
* <p/>
* @param network1
* The first network.
* @param network2
* The second network.
* @param precision
* How many decimal places to check.
* <p/>
* @return True if the two networks are equal.
*/ | Determine if the two neural networks are equal. | equals | {
"repo_name": "ladygagapowerbot/bachelor-thesis-implementation",
"path": "lib/Encog/src/main/java/org/encog/neural/networks/structure/NetworkCODEC.java",
"license": "mit",
"size": 5600
} | [
"org.encog.neural.NeuralNetworkError",
"org.encog.neural.networks.BasicNetwork"
] | import org.encog.neural.NeuralNetworkError; import org.encog.neural.networks.BasicNetwork; | import org.encog.neural.*; import org.encog.neural.networks.*; | [
"org.encog.neural"
] | org.encog.neural; | 723,239 |
public static IntValuedEnum<LiblasLibrary.LASError > LASWriter_WriteOwnedHeader(LiblasLibrary.LASWriterH hWriter) {
return FlagSet.fromValue(LASWriter_WriteOwnedHeader(Pointer.getPeer(hWriter)), LiblasLibrary.LASError.class);
} | static IntValuedEnum<LiblasLibrary.LASError > function(LiblasLibrary.LASWriterH hWriter) { return FlagSet.fromValue(LASWriter_WriteOwnedHeader(Pointer.getPeer(hWriter)), LiblasLibrary.LASError.class); } | /**
* Overwrites the header for the file represented by the LASWriterH that was <br>
* set using LASWriter_SetHeader or flushes the existing header that is on the<br>
* the writer to the file and resets the file for writing.<br>
* @param hWriter opaque pointer to the LASWriterH instance<br>
* @return LE_None if no error occurred during the operation.<br>
* Original signature : <code>LASError LASWriter_WriteOwnedHeader(const LASWriterH)</code><br>
* <i>native declaration : liblas.h:970</i>
*/ | Overwrites the header for the file represented by the LASWriterH that was set using LASWriter_SetHeader or flushes the existing header that is on the the writer to the file and resets the file for writing | LASWriter_WriteOwnedHeader | {
"repo_name": "petvana/las-bridj",
"path": "src/main/java/com/github/petvana/liblas/jna/LiblasLibrary.java",
"license": "bsd-3-clause",
"size": 116212
} | [
"org.bridj.FlagSet",
"org.bridj.IntValuedEnum",
"org.bridj.Pointer"
] | import org.bridj.FlagSet; import org.bridj.IntValuedEnum; import org.bridj.Pointer; | import org.bridj.*; | [
"org.bridj"
] | org.bridj; | 1,558,129 |
@Bean
public CasDefaultFlowUrlHandler loginFlowUrlHandler() {
return new CasDefaultFlowUrlHandler();
} | CasDefaultFlowUrlHandler function() { return new CasDefaultFlowUrlHandler(); } | /**
* Login flow url handler cas default flow url handler.
*
* @return the cas default flow url handler
*/ | Login flow url handler cas default flow url handler | loginFlowUrlHandler | {
"repo_name": "yisiqi/cas",
"path": "cas-server-webapp-config/src/main/java/org/apereo/cas/config/CasWebflowContextConfiguration.java",
"license": "apache-2.0",
"size": 13266
} | [
"org.apereo.cas.web.flow.CasDefaultFlowUrlHandler"
] | import org.apereo.cas.web.flow.CasDefaultFlowUrlHandler; | import org.apereo.cas.web.flow.*; | [
"org.apereo.cas"
] | org.apereo.cas; | 1,219,781 |
public RoutingExplanations explanations() {
return explanations;
}
}
private final AllocationDeciders deciders;
private final RoutingNodes routingNodes;
private final DiscoveryNodes nodes;
private final AllocationExplanation explanation = new AllocationExplanation();
private final ClusterInfo clusterInfo;
private Map<ShardId, Set<String>> ignoredShardToNodes = null;
private boolean ignoreDisable = false;
private boolean debugDecision = false;
private boolean hasPendingAsyncFetch = false;
public RoutingAllocation(AllocationDeciders deciders, RoutingNodes routingNodes, DiscoveryNodes nodes, ClusterInfo clusterInfo) {
this.deciders = deciders;
this.routingNodes = routingNodes;
this.nodes = nodes;
this.clusterInfo = clusterInfo;
} | RoutingExplanations function() { return explanations; } } private final AllocationDeciders deciders; private final RoutingNodes routingNodes; private final DiscoveryNodes nodes; private final AllocationExplanation explanation = new AllocationExplanation(); private final ClusterInfo clusterInfo; private Map<ShardId, Set<String>> ignoredShardToNodes = null; private boolean ignoreDisable = false; private boolean debugDecision = false; private boolean hasPendingAsyncFetch = false; public RoutingAllocation(AllocationDeciders deciders, RoutingNodes routingNodes, DiscoveryNodes nodes, ClusterInfo clusterInfo) { this.deciders = deciders; this.routingNodes = routingNodes; this.nodes = nodes; this.clusterInfo = clusterInfo; } | /**
* Get the explanation of this result
* @return explanation
*/ | Get the explanation of this result | explanations | {
"repo_name": "fubuki/elasticsearch",
"path": "src/main/java/org/elasticsearch/cluster/routing/allocation/RoutingAllocation.java",
"license": "apache-2.0",
"size": 8513
} | [
"java.util.Map",
"java.util.Set",
"org.elasticsearch.cluster.ClusterInfo",
"org.elasticsearch.cluster.node.DiscoveryNodes",
"org.elasticsearch.cluster.routing.RoutingNodes",
"org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders",
"org.elasticsearch.index.shard.ShardId"
] | import java.util.Map; import java.util.Set; import org.elasticsearch.cluster.ClusterInfo; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; import org.elasticsearch.index.shard.ShardId; | import java.util.*; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.node.*; import org.elasticsearch.cluster.routing.*; import org.elasticsearch.cluster.routing.allocation.decider.*; import org.elasticsearch.index.shard.*; | [
"java.util",
"org.elasticsearch.cluster",
"org.elasticsearch.index"
] | java.util; org.elasticsearch.cluster; org.elasticsearch.index; | 844,431 |
public static String makePartName(Map<String, String> spec,
boolean addTrailingSeperator)
throws MetaException {
StringBuilder suffixBuf = new StringBuilder();
int i = 0;
for (Entry<String, String> e : spec.entrySet()) {
if (e.getValue() == null || e.getValue().length() == 0) {
throw new MetaException("Partition spec is incorrect. " + spec);
}
if (i>0) {
suffixBuf.append(Path.SEPARATOR);
}
suffixBuf.append(escapePathName(e.getKey()));
suffixBuf.append('=');
suffixBuf.append(escapePathName(e.getValue()));
i++;
}
if (addTrailingSeperator) {
suffixBuf.append(Path.SEPARATOR);
}
return suffixBuf.toString();
} | static String function(Map<String, String> spec, boolean addTrailingSeperator) throws MetaException { StringBuilder suffixBuf = new StringBuilder(); int i = 0; for (Entry<String, String> e : spec.entrySet()) { if (e.getValue() == null e.getValue().length() == 0) { throw new MetaException(STR + spec); } if (i>0) { suffixBuf.append(Path.SEPARATOR); } suffixBuf.append(escapePathName(e.getKey())); suffixBuf.append('='); suffixBuf.append(escapePathName(e.getValue())); i++; } if (addTrailingSeperator) { suffixBuf.append(Path.SEPARATOR); } return suffixBuf.toString(); } | /**
* Makes a partition name from a specification
* @param spec
* @param addTrailingSeperator if true, adds a trailing separator e.g. 'ds=1/'
* @return partition name
* @throws MetaException
*/ | Makes a partition name from a specification | makePartName | {
"repo_name": "scalingdata/Impala",
"path": "thirdparty/hive-1.2.1.2.3.0.0-2557/src/metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java",
"license": "apache-2.0",
"size": 19798
} | [
"java.util.Map",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hive.metastore.api.MetaException"
] | import java.util.Map; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.metastore.api.MetaException; | import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.metastore.api.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,172,033 |
@Override
public double evaluate(final double[] values, final int begin, final int length) {
double sumLog = Double.NaN;
if (test(values, begin, length)) {
sumLog = 0.0;
for (int i = begin; i < begin + length; i++) {
sumLog += FastMath.log(values[i]);
}
}
return sumLog;
}
/**
* {@inheritDoc} | double function(final double[] values, final int begin, final int length) { double sumLog = Double.NaN; if (test(values, begin, length)) { sumLog = 0.0; for (int i = begin; i < begin + length; i++) { sumLog += FastMath.log(values[i]); } } return sumLog; } /** * {@inheritDoc} | /**
* Returns the sum of the natural logs of the entries in the specified portion of
* the input array, or <code>Double.NaN</code> if the designated subarray
* is empty.
* <p>
* Throws <code>IllegalArgumentException</code> if the array is null.</p>
* <p>
* See {@link SumOfLogs}.</p>
*
* @param values the input array
* @param begin index of the first array element to include
* @param length the number of elements to include
* @return the sum of the natural logs of the values or Double.NaN if
* length = 0
* @throws IllegalArgumentException if the array is null or the array index
* parameters are not valid
*/ | Returns the sum of the natural logs of the entries in the specified portion of the input array, or <code>Double.NaN</code> if the designated subarray is empty. Throws <code>IllegalArgumentException</code> if the array is null. See <code>SumOfLogs</code> | evaluate | {
"repo_name": "martingwhite/astor",
"path": "examples/math_63/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java",
"license": "gpl-2.0",
"size": 4873
} | [
"org.apache.commons.math.util.FastMath"
] | import org.apache.commons.math.util.FastMath; | import org.apache.commons.math.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 457,425 |
public ListenableFuture<T> firstValue() {
return firstValue;
} | ListenableFuture<T> function() { return firstValue; } | /**
* Returns a {@link ListenableFuture} for the first value received from the stream. Useful
* for testing unary call patterns.
*/ | Returns a <code>ListenableFuture</code> for the first value received from the stream. Useful for testing unary call patterns | firstValue | {
"repo_name": "anuraaga/grpc-java",
"path": "testing/src/main/java/io/grpc/testing/StreamRecorder.java",
"license": "bsd-3-clause",
"size": 4009
} | [
"com.google.common.util.concurrent.ListenableFuture"
] | import com.google.common.util.concurrent.ListenableFuture; | import com.google.common.util.concurrent.*; | [
"com.google.common"
] | com.google.common; | 2,322,267 |
public ProductosParamEntity consultaUnicoProd(Integer idProducto){
return conexionWSNewProd().getPortNewProductos().obtenerProdParametrizado(idProducto);
} | ProductosParamEntity function(Integer idProducto){ return conexionWSNewProd().getPortNewProductos().obtenerProdParametrizado(idProducto); } | /**
* metodo que consulta el producto por id
* @param idProducto
* @return
*/ | metodo que consulta el producto por id | consultaUnicoProd | {
"repo_name": "codesoftware/NSIGEMCO",
"path": "src/main/java/co/com/codesoftware/logica/productos/ProductoParamLogica.java",
"license": "apache-2.0",
"size": 1242
} | [
"co.com.codesoftware.servicio.producto.ProductosParamEntity"
] | import co.com.codesoftware.servicio.producto.ProductosParamEntity; | import co.com.codesoftware.servicio.producto.*; | [
"co.com.codesoftware"
] | co.com.codesoftware; | 177,603 |
@ApiModelProperty(value = "The filesystem protocols supported by this service, currently these may include common protocols such as 'http', 'https', 'sftp', 's3', 'gs', 'file', 'synapse', or others as supported by this service.")
public List<String> getSupportedFilesystemProtocols() {
return supportedFilesystemProtocols;
} | @ApiModelProperty(value = STR) List<String> function() { return supportedFilesystemProtocols; } | /**
* The filesystem protocols supported by this service, currently these may include common protocols such as 'http', 'https', 'sftp', 's3', 'gs', 'file', 'synapse', or others as supported by this service.
* @return supportedFilesystemProtocols
**/ | The filesystem protocols supported by this service, currently these may include common protocols such as 'http', 'https', 'sftp', 's3', 'gs', 'file', 'synapse', or others as supported by this service | getSupportedFilesystemProtocols | {
"repo_name": "Consonance/consonance",
"path": "swagger-ga4gh-client/src/main/java/io/swagger/client/model/Ga4ghWesServiceInfo.java",
"license": "gpl-3.0",
"size": 9188
} | [
"io.swagger.annotations.ApiModelProperty",
"java.util.List"
] | import io.swagger.annotations.ApiModelProperty; import java.util.List; | import io.swagger.annotations.*; import java.util.*; | [
"io.swagger.annotations",
"java.util"
] | io.swagger.annotations; java.util; | 464,683 |
public static void renderPDFDocumentWithoutAnnotations(String fileName) {
// ExStart: renderPDFDocumentWithoutAnnotations_17.5
try {
// Setup GroupDocs.Viewer config
ViewerConfig config = Utilities.getConfiguration();
// Create image or html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
String guid = fileName;
// Set pdf options to render content without annotations
HtmlOptions options = new HtmlOptions();
options.getPdfOptions().setDeleteAnnotations(true); // Default value
// is false
// Get pages
List<PageHtml> pages = htmlHandler.getPages(guid, options);
for (PageHtml page : pages) {
System.out.println("Page number: " + page.getPageNumber());
System.out.println("Html content: " + page.getHtmlContent());
}
} catch (Exception exp) {
System.out.println("Exception: " + exp.getMessage());
exp.printStackTrace();
}
// ExEnd: renderPDFDocumentWithoutAnnotations_17.5
} | static void function(String fileName) { try { ViewerConfig config = Utilities.getConfiguration(); ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config); String guid = fileName; HtmlOptions options = new HtmlOptions(); options.getPdfOptions().setDeleteAnnotations(true); List<PageHtml> pages = htmlHandler.getPages(guid, options); for (PageHtml page : pages) { System.out.println(STR + page.getPageNumber()); System.out.println(STR + page.getHtmlContent()); } } catch (Exception exp) { System.out.println(STR + exp.getMessage()); exp.printStackTrace(); } } | /**
* Renders PDF document without annotations
*
* @param fileName
*/ | Renders PDF document without annotations | renderPDFDocumentWithoutAnnotations | {
"repo_name": "saqibmasood/GroupDocs.Viewer-for-Java",
"path": "Examples/GroupDocs.Viewer.Examples.Java/src/main/java/com/groupdocs/viewer/examples/ViewGenerator.java",
"license": "mit",
"size": 89611
} | [
"com.groupdocs.viewer.config.ViewerConfig",
"com.groupdocs.viewer.converter.options.HtmlOptions",
"com.groupdocs.viewer.domain.html.PageHtml",
"com.groupdocs.viewer.handler.ViewerHtmlHandler",
"java.util.List"
] | import com.groupdocs.viewer.config.ViewerConfig; import com.groupdocs.viewer.converter.options.HtmlOptions; import com.groupdocs.viewer.domain.html.PageHtml; import com.groupdocs.viewer.handler.ViewerHtmlHandler; import java.util.List; | import com.groupdocs.viewer.config.*; import com.groupdocs.viewer.converter.options.*; import com.groupdocs.viewer.domain.html.*; import com.groupdocs.viewer.handler.*; import java.util.*; | [
"com.groupdocs.viewer",
"java.util"
] | com.groupdocs.viewer; java.util; | 1,396,081 |
private static void inputFichero(String rutaFichero, String nombreFichero) {
try {
out = new FileOutputStream(rutaFichero +nombreFichero);
try {
BigInteger recibido;
while("1".equals(RSA.decryptMensaje(ois.readUTF()))) {
recibido = (BigInteger) ois.readObject();
byte[] array = RSA.decrypt(recibido).toByteArray();
out.write(array, 1, array.length - 1);
}
}catch(EOFException ex) {
System.out.println("EOF Exception. Es normal: " +ex.getLocalizedMessage());
}
out.flush();
}catch(IOException|ClassNotFoundException ex) {
ex.printStackTrace();
}
} | static void function(String rutaFichero, String nombreFichero) { try { out = new FileOutputStream(rutaFichero +nombreFichero); try { BigInteger recibido; while("1".equals(RSA.decryptMensaje(ois.readUTF()))) { recibido = (BigInteger) ois.readObject(); byte[] array = RSA.decrypt(recibido).toByteArray(); out.write(array, 1, array.length - 1); } }catch(EOFException ex) { System.out.println(STR +ex.getLocalizedMessage()); } out.flush(); }catch(IOException ClassNotFoundException ex) { ex.printStackTrace(); } } | /**
* Desencripta los datos recibidos y los almacena en un fichero.
* @param rutaFichero Ruta donde creamos el fichero.
* @param nombreFichero Nombre con el cual guardamos el fichero.
*/ | Desencripta los datos recibidos y los almacena en un fichero | inputFichero | {
"repo_name": "MarioCodes/ProyectosClaseDAM",
"path": "java/Encryption/AsymmetricFileServer/src/server/Servidor.java",
"license": "apache-2.0",
"size": 10780
} | [
"java.io.EOFException",
"java.io.FileOutputStream",
"java.io.IOException",
"java.math.BigInteger"
] | import java.io.EOFException; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigInteger; | import java.io.*; import java.math.*; | [
"java.io",
"java.math"
] | java.io; java.math; | 2,758,878 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(MindidePackage.Literals.MIND_LIB_OR_PROJECT__MINDPATHENTRIES,
MindideFactory.eINSTANCE.createMindPathEntry()));
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (MindidePackage.Literals.MIND_LIB_OR_PROJECT__MINDPATHENTRIES, MindideFactory.eINSTANCE.createMindPathEntry())); } | /**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object. | collectNewChildDescriptors | {
"repo_name": "StephaneSeyvoz/mindEd",
"path": "org.ow2.mindEd.ide.edit/src-gen/org/ow2/mindEd/ide/edit/provider/MindLibOrProjectItemProvider.java",
"license": "lgpl-3.0",
"size": 6013
} | [
"java.util.Collection",
"org.ow2.mindEd.ide.model.MindideFactory",
"org.ow2.mindEd.ide.model.MindidePackage"
] | import java.util.Collection; import org.ow2.mindEd.ide.model.MindideFactory; import org.ow2.mindEd.ide.model.MindidePackage; | import java.util.*; import org.ow2.*; | [
"java.util",
"org.ow2"
] | java.util; org.ow2; | 2,856,737 |
private Selector parsePredicate(String predicate, String fullPath)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(cclass,
"parsePredicate",
"predicate: " + predicate);
Selector parsed = null;
try
{
// Preprocess predicate for special characters
String parserInput = preProcessForSpecials(predicate);
// Attempt to parse predicate with "JMS" parser
predicateParser = MatchParserImpl.prime(predicateParser, parserInput, true);
parsed = predicateParser.getSelector(parserInput);
if (parsed.getType() == Selector.INVALID)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
tc.debug(this,cclass, "parsePredicate", "Unable to parse predicate");
// reset the output to null
parsed = null;
}
else
{
postProcessSelectorTree(parsed, fullPath);
}
}
catch (Exception ex)
{
// No FFDC Code Needed.
// In this case we will only trace the exception that we encountered.
// It could be that the XPath parser is able to process this predicate
// and that we've encountered a discrepancy between the syntax of an
// expression supported by JMS and by XPath.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
tc.debug(this,cclass, "parsePredicate", ex);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "parsePredicate", parsed);
return parsed;
} | Selector function(String predicate, String fullPath) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, STR, STR + predicate); Selector parsed = null; try { String parserInput = preProcessForSpecials(predicate); predicateParser = MatchParserImpl.prime(predicateParser, parserInput, true); parsed = predicateParser.getSelector(parserInput); if (parsed.getType() == Selector.INVALID) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, STR, STR); parsed = null; } else { postProcessSelectorTree(parsed, fullPath); } } catch (Exception ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, STR, ex); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, STR, parsed); return parsed; } | /**
* Attempt to parse an isolated predicate using the MatchParser.
*
* @param predicate
* @return
*/ | Attempt to parse an isolated predicate using the MatchParser | parsePredicate | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java",
"license": "epl-1.0",
"size": 47594
} | [
"com.ibm.ws.sib.matchspace.Selector",
"com.ibm.ws.sib.matchspace.utils.TraceComponent"
] | import com.ibm.ws.sib.matchspace.Selector; import com.ibm.ws.sib.matchspace.utils.TraceComponent; | import com.ibm.ws.sib.matchspace.*; import com.ibm.ws.sib.matchspace.utils.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 2,528,291 |
final NiFiUser user = NiFiUserUtils.getNiFiUser();
final Map<String, String> userContext;
if (!StringUtils.isBlank(user.getClientAddress())) {
userContext = new HashMap<>();
userContext.put(UserContextKeys.CLIENT_ADDRESS.name(), user.getClientAddress());
} else {
userContext = null;
}
final AuthorizationRequest request = new AuthorizationRequest.Builder()
.resource(ResourceFactory.getSiteToSiteResource())
.identity(user.getIdentity())
.groups(user.getGroups())
.anonymous(user.isAnonymous())
.accessAttempt(true)
.action(RequestAction.READ)
.userContext(userContext)
.explanationSupplier(() -> "Unable to retrieve site to site details.")
.build();
final AuthorizationResult result = authorizer.authorize(request);
if (!Result.Approved.equals(result.getResult())) {
throw new AccessDeniedException(result.getExplanation());
}
}
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Returns the details about this NiFi necessary to communicate via site to site",
response = ControllerEntity.class,
authorizations = {
@Authorization(value = "Read - /site-to-site", type = "")
}
)
@ApiResponses(
value = {
@ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
@ApiResponse(code = 401, message = "Client could not be authenticated."),
@ApiResponse(code = 403, message = "Client is not authorized to make this request."),
@ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
} | final NiFiUser user = NiFiUserUtils.getNiFiUser(); final Map<String, String> userContext; if (!StringUtils.isBlank(user.getClientAddress())) { userContext = new HashMap<>(); userContext.put(UserContextKeys.CLIENT_ADDRESS.name(), user.getClientAddress()); } else { userContext = null; } final AuthorizationRequest request = new AuthorizationRequest.Builder() .resource(ResourceFactory.getSiteToSiteResource()) .identity(user.getIdentity()) .groups(user.getGroups()) .anonymous(user.isAnonymous()) .accessAttempt(true) .action(RequestAction.READ) .userContext(userContext) .explanationSupplier(() -> STR) .build(); final AuthorizationResult result = authorizer.authorize(request); if (!Result.Approved.equals(result.getResult())) { throw new AccessDeniedException(result.getExplanation()); } } @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = STR, response = ControllerEntity.class, authorizations = { @Authorization(value = STR, type = STRNiFi was unable to complete the request because it was invalid. The request should not be retried without modification.STRClient could not be authenticated.STRClient is not authorized to make this request.STRThe request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") } | /**
* Authorizes access to Site To Site details.
* <p>
* Note: Protected for testing purposes
*/ | Authorizes access to Site To Site details. Note: Protected for testing purposes | authorizeSiteToSite | {
"repo_name": "WilliamNouet/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java",
"license": "apache-2.0",
"size": 11975
} | [
"com.wordnik.swagger.annotations.ApiOperation",
"com.wordnik.swagger.annotations.Authorization",
"java.util.HashMap",
"java.util.Map",
"javax.ws.rs.Consumes",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"org.apache.commons.lang3.StringUtils",
"org.apache.nifi.authorization.AccessDeniedException",
"org.apache.nifi.authorization.AuthorizationRequest",
"org.apache.nifi.authorization.AuthorizationResult",
"org.apache.nifi.authorization.RequestAction",
"org.apache.nifi.authorization.UserContextKeys",
"org.apache.nifi.authorization.resource.ResourceFactory",
"org.apache.nifi.authorization.user.NiFiUser",
"org.apache.nifi.authorization.user.NiFiUserUtils",
"org.apache.nifi.web.api.entity.ControllerEntity"
] | import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.Authorization; import java.util.HashMap; import java.util.Map; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.authorization.AccessDeniedException; import org.apache.nifi.authorization.AuthorizationRequest; import org.apache.nifi.authorization.AuthorizationResult; import org.apache.nifi.authorization.RequestAction; import org.apache.nifi.authorization.UserContextKeys; import org.apache.nifi.authorization.resource.ResourceFactory; import org.apache.nifi.authorization.user.NiFiUser; import org.apache.nifi.authorization.user.NiFiUserUtils; import org.apache.nifi.web.api.entity.ControllerEntity; | import com.wordnik.swagger.annotations.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.commons.lang3.*; import org.apache.nifi.authorization.*; import org.apache.nifi.authorization.resource.*; import org.apache.nifi.authorization.user.*; import org.apache.nifi.web.api.entity.*; | [
"com.wordnik.swagger",
"java.util",
"javax.ws",
"org.apache.commons",
"org.apache.nifi"
] | com.wordnik.swagger; java.util; javax.ws; org.apache.commons; org.apache.nifi; | 239,991 |
public ResultAssert hasSuccessMessage(String successMessage) {
// check that actual Result we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting successMessage of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
String actualSuccessMessage = actual.getSuccessMessage();
if (!Objects.areEqual(actualSuccessMessage, successMessage)) {
failWithMessage(assertjErrorMessage, actual, successMessage, actualSuccessMessage);
}
// return the current assertion for method chaining
return this;
} | ResultAssert function(String successMessage) { isNotNull(); String assertjErrorMessage = STR; String actualSuccessMessage = actual.getSuccessMessage(); if (!Objects.areEqual(actualSuccessMessage, successMessage)) { failWithMessage(assertjErrorMessage, actual, successMessage, actualSuccessMessage); } return this; } | /**
* Verifies that the actual Result's successMessage is equal to the given one.
* @param successMessage the given successMessage to compare the actual Result's successMessage to.
* @return this assertion object.
* @throws AssertionError - if the actual Result's successMessage is not equal to the given one.
*/ | Verifies that the actual Result's successMessage is equal to the given one | hasSuccessMessage | {
"repo_name": "jmochel/c3",
"path": "common/src/test/java/org/saltations/c3/common/ResultAssert.java",
"license": "apache-2.0",
"size": 7228
} | [
"org.assertj.core.util.Objects"
] | import org.assertj.core.util.Objects; | import org.assertj.core.util.*; | [
"org.assertj.core"
] | org.assertj.core; | 2,010,552 |
@Override
public String toString() {
return literal;
}
| String function() { return literal; } | /**
* Returns the literal value of the enumerator, which is its string representation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Returns the literal value of the enumerator, which is its string representation. | toString | {
"repo_name": "ISO20022ArchitectForum/sample-code-public",
"path": "DLT/Corda/ISO20022Generated/src/iso20022/MessageValidationOnOff.java",
"license": "apache-2.0",
"size": 5317
} | [
"java.lang.String"
] | import java.lang.String; | import java.lang.*; | [
"java.lang"
] | java.lang; | 1,785,653 |
private double expectedCardinality(double rowCount,
ImmutableBitSet columns) {
switch (columns.cardinality()) {
case 0:
return 1d;
case 1:
return rowCount;
default:
double c = rowCount;
for (ImmutableBitSet bitSet : keyPoset.getParents(columns, true)) {
if (bitSet.isEmpty()) {
// If the parent is the empty group (i.e. "GROUP BY ()", the grand
// total) we cannot improve on the estimate.
continue;
}
final Distribution d1 = distributions.get(bitSet);
final double c2 = cardinality(rowCount, columns.except(bitSet));
final double d = Lattice.getRowCount(rowCount, d1.cardinality, c2);
c = Math.min(c, d);
}
for (ImmutableBitSet bitSet : keyPoset.getChildren(columns, true)) {
final Distribution d1 = distributions.get(bitSet);
c = Math.min(c, d1.cardinality);
}
return c;
}
} | double function(double rowCount, ImmutableBitSet columns) { switch (columns.cardinality()) { case 0: return 1d; case 1: return rowCount; default: double c = rowCount; for (ImmutableBitSet bitSet : keyPoset.getParents(columns, true)) { if (bitSet.isEmpty()) { continue; } final Distribution d1 = distributions.get(bitSet); final double c2 = cardinality(rowCount, columns.except(bitSet)); final double d = Lattice.getRowCount(rowCount, d1.cardinality, c2); c = Math.min(c, d); } for (ImmutableBitSet bitSet : keyPoset.getChildren(columns, true)) { final Distribution d1 = distributions.get(bitSet); c = Math.min(c, d1.cardinality); } return c; } } | /** Estimates the cardinality of a collection of columns represented by
* {@code columnOrdinals}, drawing on existing distributions. Does not
* look in the distribution map for this column set. */ | Estimates the cardinality of a collection of columns represented by columnOrdinals, drawing on existing distributions. Does not | expectedCardinality | {
"repo_name": "julianhyde/calcite",
"path": "core/src/main/java/org/apache/calcite/profile/ProfilerImpl.java",
"license": "apache-2.0",
"size": 28386
} | [
"org.apache.calcite.materialize.Lattice",
"org.apache.calcite.util.ImmutableBitSet"
] | import org.apache.calcite.materialize.Lattice; import org.apache.calcite.util.ImmutableBitSet; | import org.apache.calcite.materialize.*; import org.apache.calcite.util.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 144,113 |
void doFilter(IConfigRequest request, IConfigResponse response, IConfigFilterChain filterChain)
throws NacosException; | void doFilter(IConfigRequest request, IConfigResponse response, IConfigFilterChain filterChain) throws NacosException; | /**
* do filter.
*
* @param request request
* @param response response
* @param filterChain filter Chain
* @throws NacosException exception
*/ | do filter | doFilter | {
"repo_name": "alibaba/nacos",
"path": "api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilter.java",
"license": "apache-2.0",
"size": 1766
} | [
"com.alibaba.nacos.api.exception.NacosException"
] | import com.alibaba.nacos.api.exception.NacosException; | import com.alibaba.nacos.api.exception.*; | [
"com.alibaba.nacos"
] | com.alibaba.nacos; | 3,695 |
public void description(Description newDescription) {
description = checkIsNotNull(newDescription);
}
/**
* {@inheritDoc} | void function(Description newDescription) { description = checkIsNotNull(newDescription); } /** * {@inheritDoc} | /**
* Sets the description of an assertion. To remove or clear the description, pass a <code>{@link EmptyTextDescription}</code> as
* argument.
*
* @param newDescription the new description.
* @throws NullPointerException if the given description is {@code null}.
*/ | Sets the description of an assertion. To remove or clear the description, pass a <code><code>EmptyTextDescription</code></code> as argument | description | {
"repo_name": "dorzey/assertj-core",
"path": "src/main/java/org/assertj/core/api/WritableAssertionInfo.java",
"license": "apache-2.0",
"size": 4512
} | [
"org.assertj.core.api.DescriptionValidations",
"org.assertj.core.description.Description"
] | import org.assertj.core.api.DescriptionValidations; import org.assertj.core.description.Description; | import org.assertj.core.api.*; import org.assertj.core.description.*; | [
"org.assertj.core"
] | org.assertj.core; | 1,498,253 |
public static void logSuccess(String user, String operation, String target,
ApplicationId appId, ContainerId containerId) {
if (LOG.isInfoEnabled()) {
LOG.info(createSuccessLog(user, operation, target, appId, null,
containerId));
}
} | static void function(String user, String operation, String target, ApplicationId appId, ContainerId containerId) { if (LOG.isInfoEnabled()) { LOG.info(createSuccessLog(user, operation, target, appId, null, containerId)); } } | /**
* Create a readable and parseable audit log string for a successful event.
*
* @param user User who made the service request to the ResourceManager
* @param operation Operation requested by the user.
* @param target The target on which the operation is being performed.
* @param appId Application Id in which operation was performed.
* @param containerId Container Id in which operation was performed.
*
* <br><br>
* Note that the {@link RMAuditLogger} uses tabs ('\t') as a key-val delimiter
* and hence the value fields should not contains tabs ('\t').
*/ | Create a readable and parseable audit log string for a successful event | logSuccess | {
"repo_name": "bruthe/hadoop-2.6.0r",
"path": "src/yarn/server/org/apache/hadoop/yarn/server/resourcemanager/RMAuditLogger.java",
"license": "apache-2.0",
"size": 12467
} | [
"org.apache.hadoop.yarn.api.records.ApplicationId",
"org.apache.hadoop.yarn.api.records.ContainerId"
] | import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ContainerId; | import org.apache.hadoop.yarn.api.records.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,114,791 |
private void doDispose() {
if (preferences instanceof IEclipsePreferences)
((IEclipsePreferences) preferences).removePreferenceChangeListener(prefListener);
if (gcImage != null) {
gcImage.dispose();
}
if (disabledGcImage != null) {
disabledGcImage.dispose();
}
} | void function() { if (preferences instanceof IEclipsePreferences) ((IEclipsePreferences) preferences).removePreferenceChangeListener(prefListener); if (gcImage != null) { gcImage.dispose(); } if (disabledGcImage != null) { disabledGcImage.dispose(); } } | /**
* Do dispose.
*/ | Do dispose | doDispose | {
"repo_name": "Minres/SCViewer",
"path": "plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/HeapStatus.java",
"license": "epl-1.0",
"size": 19577
} | [
"org.eclipse.core.runtime.preferences.IEclipsePreferences"
] | import org.eclipse.core.runtime.preferences.IEclipsePreferences; | import org.eclipse.core.runtime.preferences.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 2,404,290 |
private boolean continueWithNotice(Event event) {
String nodeID = event.hasNodeid() ? String.valueOf(event.getNodeid()) : null;
String ipAddr = event.getInterface();
String service = event.getService();
boolean continueNotice = false;
// can't check the database if any of these are null, so let the notice
// continue
if (nodeID == null || ipAddr == null || service == null || ipAddr.equals("0.0.0.0")) {
if (log().isDebugEnabled()) {
log().debug("nodeID=" + nodeID + " ipAddr=" + ipAddr + " service=" + service + ". Not checking DB, continuing...");
}
return true;
}
try {
// check the database to see if notices were turned off for this
// service
String notify = getNotificationManager().getServiceNoticeStatus(nodeID, ipAddr, service);
if ("Y".equals(notify)) {
continueNotice = true;
if (log().isDebugEnabled()) {
log().debug("notify status for service " + service + " on interface/node " + ipAddr + "/" + nodeID + " is 'Y', continuing...");
}
} else {
if (log().isDebugEnabled()) {
log().debug("notify status for service " + service + " on interface/node " + ipAddr + "/" + nodeID + " is " + notify + ", not continuing...");
}
}
} catch (Throwable e) {
continueNotice = true;
log().error("Not able to get notify status for service " + service + " on interface/node " + ipAddr + "/" + nodeID + ". Continuing notice... " + e.getMessage());
}
// in case of a error we will return false
return continueNotice;
} | boolean function(Event event) { String nodeID = event.hasNodeid() ? String.valueOf(event.getNodeid()) : null; String ipAddr = event.getInterface(); String service = event.getService(); boolean continueNotice = false; if (nodeID == null ipAddr == null service == null ipAddr.equals(STR)) { if (log().isDebugEnabled()) { log().debug(STR + nodeID + STR + ipAddr + STR + service + STR); } return true; } try { String notify = getNotificationManager().getServiceNoticeStatus(nodeID, ipAddr, service); if ("Y".equals(notify)) { continueNotice = true; if (log().isDebugEnabled()) { log().debug(STR + service + STR + ipAddr + "/" + nodeID + STR); } } else { if (log().isDebugEnabled()) { log().debug(STR + service + STR + ipAddr + "/" + nodeID + STR + notify + STR); } } } catch (Throwable e) { continueNotice = true; log().error(STR + service + STR + ipAddr + "/" + nodeID + STR + e.getMessage()); } return continueNotice; } | /**
* This method determines if the notice should continue based on the status
* of the notify
*/ | This method determines if the notice should continue based on the status of the notify | continueWithNotice | {
"repo_name": "qoswork/opennmszh",
"path": "opennms-services/src/main/java/org/opennms/netmgt/notifd/BroadcastEventProcessor.java",
"license": "gpl-2.0",
"size": 52236
} | [
"org.opennms.netmgt.xml.event.Event"
] | import org.opennms.netmgt.xml.event.Event; | import org.opennms.netmgt.xml.event.*; | [
"org.opennms.netmgt"
] | org.opennms.netmgt; | 2,140,650 |
public HashMap<String, Object> getGroupInfo(String gid) {
GroupTable grouptable = getGroupTable(gid);
return mTypeGroup.convertObjectToMap(grouptable);
} | HashMap<String, Object> function(String gid) { GroupTable grouptable = getGroupTable(gid); return mTypeGroup.convertObjectToMap(grouptable); } | /**
* API to get the group information from the db
*
* @param gid
* group id
* @return group information payload
*/ | API to get the group information from the db | getGroupInfo | {
"repo_name": "JunhwanPark/TizenRT",
"path": "external/iotivity/iotivity_1.3-rel/cloud/account/src/main/java/org/iotivity/cloud/accountserver/resources/acl/group/GroupManager.java",
"license": "apache-2.0",
"size": 31726
} | [
"java.util.HashMap",
"org.iotivity.cloud.accountserver.db.GroupTable"
] | import java.util.HashMap; import org.iotivity.cloud.accountserver.db.GroupTable; | import java.util.*; import org.iotivity.cloud.accountserver.db.*; | [
"java.util",
"org.iotivity.cloud"
] | java.util; org.iotivity.cloud; | 536,179 |
public ArrayList<InterceptorBinding>
getInterceptorBinding(String ejbName,
boolean isExcludeDefault)
{
assert ejbName != null;
ArrayList<InterceptorBinding> bindings
= new ArrayList<InterceptorBinding>();
for (InterceptorBinding binding : _cfgInterceptorBindings) {
if (binding.getEjbName().equals(ejbName))
bindings.add(binding);
else if (binding.getEjbName().equals("*") && ! isExcludeDefault) {
bindings.add(binding);
}
}
return bindings;
} | ArrayList<InterceptorBinding> function(String ejbName, boolean isExcludeDefault) { assert ejbName != null; ArrayList<InterceptorBinding> bindings = new ArrayList<InterceptorBinding>(); for (InterceptorBinding binding : _cfgInterceptorBindings) { if (binding.getEjbName().equals(ejbName)) bindings.add(binding); else if (binding.getEjbName().equals("*") && ! isExcludeDefault) { bindings.add(binding); } } return bindings; } | /**
* Returns the interceptor bindings for a given ejb name.
*/ | Returns the interceptor bindings for a given ejb name | getInterceptorBinding | {
"repo_name": "WelcomeHUME/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/ejb/cfg/EjbConfig.java",
"license": "gpl-2.0",
"size": 17076
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 973,609 |
@GET
@Path("jobs")
@Produces("application/json")
RestPage<String> jobs(@HeaderParam("sessionid") String sessionId,
@QueryParam("index") @DefaultValue("-1") int index, @QueryParam("limit") @DefaultValue("-1") int limit)
throws NotConnectedRestException, PermissionRestException; | @Path("jobs") @Produces(STR) RestPage<String> jobs(@HeaderParam(STR) String sessionId, @QueryParam("index") @DefaultValue("-1") int index, @QueryParam("limit") @DefaultValue("-1") int limit) throws NotConnectedRestException, PermissionRestException; | /**
* Returns the ids of the current jobs under a list of string.
*
* @param sessionId
* a valid session id
* @param index
* optional, if a sublist has to be returned the index of the
* sublist
* @param limit
* optional, if a sublist has to be returned, the limit of the
* sublist
* @return a list of jobs' ids under the form of a list of string
*/ | Returns the ids of the current jobs under a list of string | jobs | {
"repo_name": "tobwiens/scheduling",
"path": "rest/rest-api/src/main/java/org/ow2/proactive_grid_cloud_portal/common/SchedulerRestInterface.java",
"license": "agpl-3.0",
"size": 80291
} | [
"javax.ws.rs.DefaultValue",
"javax.ws.rs.HeaderParam",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.QueryParam",
"org.ow2.proactive_grid_cloud_portal.scheduler.dto.RestPage",
"org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException",
"org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException"
] | import javax.ws.rs.DefaultValue; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import org.ow2.proactive_grid_cloud_portal.scheduler.dto.RestPage; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException; | import javax.ws.rs.*; import org.ow2.proactive_grid_cloud_portal.scheduler.dto.*; import org.ow2.proactive_grid_cloud_portal.scheduler.exception.*; | [
"javax.ws",
"org.ow2.proactive_grid_cloud_portal"
] | javax.ws; org.ow2.proactive_grid_cloud_portal; | 443,729 |
public UriComponentsBuilder uri(URI uri) {
Assert.notNull(uri, "'uri' must not be null");
this.scheme = uri.getScheme();
if (uri.isOpaque()) {
this.ssp = uri.getRawSchemeSpecificPart();
resetHierarchicalComponents();
}
else {
if (uri.getRawUserInfo() != null) {
this.userInfo = uri.getRawUserInfo();
}
if (uri.getHost() != null) {
this.host = uri.getHost();
}
if (uri.getPort() != -1) {
this.port = String.valueOf(uri.getPort());
}
if (StringUtils.hasLength(uri.getRawPath())) {
this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
}
if (StringUtils.hasLength(uri.getRawQuery())) {
this.queryParams.clear();
query(uri.getRawQuery());
}
resetSchemeSpecificPart();
}
if (uri.getRawFragment() != null) {
this.fragment = uri.getRawFragment();
}
return this;
} | UriComponentsBuilder function(URI uri) { Assert.notNull(uri, STR); this.scheme = uri.getScheme(); if (uri.isOpaque()) { this.ssp = uri.getRawSchemeSpecificPart(); resetHierarchicalComponents(); } else { if (uri.getRawUserInfo() != null) { this.userInfo = uri.getRawUserInfo(); } if (uri.getHost() != null) { this.host = uri.getHost(); } if (uri.getPort() != -1) { this.port = String.valueOf(uri.getPort()); } if (StringUtils.hasLength(uri.getRawPath())) { this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath()); } if (StringUtils.hasLength(uri.getRawQuery())) { this.queryParams.clear(); query(uri.getRawQuery()); } resetSchemeSpecificPart(); } if (uri.getRawFragment() != null) { this.fragment = uri.getRawFragment(); } return this; } | /**
* Initialize all components of this URI builder with the components of the given URI.
* @param uri the URI
* @return this UriComponentsBuilder
*/ | Initialize all components of this URI builder with the components of the given URI | uri | {
"repo_name": "ivarptr/clobaframe-web",
"path": "source/common-spring-web-repackage/src/main/java/org/springframework/web/util/UriComponentsBuilder.java",
"license": "apache-2.0",
"size": 26967
} | [
"org.springframework.util.Assert",
"org.springframework.util.StringUtils"
] | import org.springframework.util.Assert; import org.springframework.util.StringUtils; | import org.springframework.util.*; | [
"org.springframework.util"
] | org.springframework.util; | 562,183 |
public void setSSLSocketFactory(SSLSocketFactory sslSocketFactory) {
synchronized (lock) {
this.sslSocketFactory = sslSocketFactory;
}
} | void function(SSLSocketFactory sslSocketFactory) { synchronized (lock) { this.sslSocketFactory = sslSocketFactory; } } | /**
* Sets the SSL socket factory used to negotiate SSL connections.
*
* @param sslSocketFactory
* The SSL socket factory used to negotiate SSL connections.
*
* @since 1.4
*/ | Sets the SSL socket factory used to negotiate SSL connections | setSSLSocketFactory | {
"repo_name": "joshua-meng/MFtp",
"path": "src/it/sauronsoftware/ftp4j/FTPClient.java",
"license": "gpl-2.0",
"size": 128674
} | [
"javax.net.ssl.SSLSocketFactory"
] | import javax.net.ssl.SSLSocketFactory; | import javax.net.ssl.*; | [
"javax.net"
] | javax.net; | 2,692,251 |
InputStream getInputStream()
throws IOException; | InputStream getInputStream() throws IOException; | /**
* Returns an input stream from which a remote file can be read.
*/ | Returns an input stream from which a remote file can be read | getInputStream | {
"repo_name": "imoseyon/leanKernel-d2usc-deprecated",
"path": "vendor/samsung/common/packages/apps/Email/lib_Src/inetlib-1.1.1/source/gnu/inet/ftp/DTP.java",
"license": "gpl-2.0",
"size": 2950
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,838,494 |
public Structure getStructure() {
return structure;
} | Structure function() { return structure; } | /**
* Gets the structure.
*
* @return the structure
*/ | Gets the structure | getStructure | {
"repo_name": "biojava/biojava",
"path": "biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java",
"license": "lgpl-2.1",
"size": 16725
} | [
"org.biojava.nbio.structure.Structure"
] | import org.biojava.nbio.structure.Structure; | import org.biojava.nbio.structure.*; | [
"org.biojava.nbio"
] | org.biojava.nbio; | 2,914,294 |
public void transMsgReceived(AbstractTransMessage msg); | void function(AbstractTransMessage msg); | /**
* Invoking this method denotes that the given message is received at the
* transport layer (from the network layer towards the application layer).
*
* @param msg
* the received AbstractTransMessage.
*/ | Invoking this method denotes that the given message is received at the transport layer (from the network layer towards the application layer) | transMsgReceived | {
"repo_name": "flyroom/PeerfactSimKOM_Clone",
"path": "src/org/peerfact/api/common/Monitor.java",
"license": "gpl-2.0",
"size": 16925
} | [
"org.peerfact.impl.transport.AbstractTransMessage"
] | import org.peerfact.impl.transport.AbstractTransMessage; | import org.peerfact.impl.transport.*; | [
"org.peerfact.impl"
] | org.peerfact.impl; | 1,322,423 |
public ErrorList errorList() {
String responseString = sendCommand(new ErrorCommand());
return parser.parse(responseString, ErrorList.class);
} | ErrorList function() { String responseString = sendCommand(new ErrorCommand()); return parser.parse(responseString, ErrorList.class); } | /**
* returns the list of all errors happened since last reset.
*
* @return - the list of errors.
*/ | returns the list of all errors happened since last reset | errorList | {
"repo_name": "MikeJMajor/openhab2-addons-dlinksmarthome",
"path": "bundles/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/RobonectClient.java",
"license": "epl-1.0",
"size": 12697
} | [
"org.openhab.binding.robonect.internal.model.ErrorList",
"org.openhab.binding.robonect.internal.model.cmd.ErrorCommand"
] | import org.openhab.binding.robonect.internal.model.ErrorList; import org.openhab.binding.robonect.internal.model.cmd.ErrorCommand; | import org.openhab.binding.robonect.internal.model.*; import org.openhab.binding.robonect.internal.model.cmd.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 2,198,357 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.