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
public Map getCollectionsByKey();
Map function();
/** * Get the mapping from collection key to collection instance */
Get the mapping from collection key to collection instance
getCollectionsByKey
{ "repo_name": "kevin-chen-hw/LDAE", "path": "com.huawei.soa.ldae/src/main/java/org/hibernate/engine/spi/PersistenceContext.java", "license": "lgpl-2.1", "size": 31321 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
92,571
EClass getAndExpression();
EClass getAndExpression();
/** * Returns the meta object for class '{@link org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.AndExpression <em>And Expression</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>And Expression</em>'. * @see org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.AndExpression * @generated */
Returns the meta object for class '<code>org.eclipse.xtext.testlanguages.backtracking.beeLangTestLanguage.AndExpression And Expression</code>'.
getAndExpression
{ "repo_name": "miklossy/xtext-core", "path": "org.eclipse.xtext.testlanguages/src-gen/org/eclipse/xtext/testlanguages/backtracking/beeLangTestLanguage/BeeLangTestLanguagePackage.java", "license": "epl-1.0", "size": 161651 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
682,273
static void terminateBits(int numDataBytes, BitArray bits) throws WriterException { int capacity = numDataBytes << 3; if (bits.getSize() > capacity) { throw new WriterException("data bits cannot fit in the QR Code" + bits.getSize() + " > " + capacity); } for (int i = 0; i < 4 && bits.getSize() < capacity; ++i) { bits.appendBit(false); } // Append termination bits. See 8.4.8 of JISX0510:2004 (p.24) for details. // If the last byte isn't 8-bit aligned, we'll add padding bits. int numBitsInLastByte = bits.getSize() & 0x07; if (numBitsInLastByte > 0) { for (int i = numBitsInLastByte; i < 8; i++) { bits.appendBit(false); } } // If we have more space, we'll fill the space with padding patterns defined in 8.4.9 (p.24). int numPaddingBytes = numDataBytes - bits.getSizeInBytes(); for (int i = 0; i < numPaddingBytes; ++i) { bits.appendBits((i & 0x01) == 0 ? 0xEC : 0x11, 8); } if (bits.getSize() != capacity) { throw new WriterException("Bits size does not equal capacity"); } }
static void terminateBits(int numDataBytes, BitArray bits) throws WriterException { int capacity = numDataBytes << 3; if (bits.getSize() > capacity) { throw new WriterException(STR + bits.getSize() + STR + capacity); } for (int i = 0; i < 4 && bits.getSize() < capacity; ++i) { bits.appendBit(false); } int numBitsInLastByte = bits.getSize() & 0x07; if (numBitsInLastByte > 0) { for (int i = numBitsInLastByte; i < 8; i++) { bits.appendBit(false); } } int numPaddingBytes = numDataBytes - bits.getSizeInBytes(); for (int i = 0; i < numPaddingBytes; ++i) { bits.appendBits((i & 0x01) == 0 ? 0xEC : 0x11, 8); } if (bits.getSize() != capacity) { throw new WriterException(STR); } }
/** * Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24). */
Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24)
terminateBits
{ "repo_name": "magicgoose/qr-encoder-desktop", "path": "src/com/google/zxing/qrcode/encoder/Encoder.java", "license": "gpl-3.0", "size": 21796 }
[ "com.google.zxing.WriterException", "com.google.zxing.common.BitArray" ]
import com.google.zxing.WriterException; import com.google.zxing.common.BitArray;
import com.google.zxing.*; import com.google.zxing.common.*;
[ "com.google.zxing" ]
com.google.zxing;
2,595,334
public void trace(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.TRACE, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
void function(Throwable throwable, String msg, Object[] argArray) { logIfEnabled(Level.TRACE, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray); }
/** * Log a trace message with a throwable. */
Log a trace message with a throwable
trace
{ "repo_name": "droidefense/engine", "path": "mods/simplemagic/src/main/java/com/j256/simplemagic/logger/Logger.java", "license": "gpl-3.0", "size": 19636 }
[ "com.j256.simplemagic.logger.Log" ]
import com.j256.simplemagic.logger.Log;
import com.j256.simplemagic.logger.*;
[ "com.j256.simplemagic" ]
com.j256.simplemagic;
2,368,911
public void setResourcePersistence(ResourcePersistence resourcePersistence) { this.resourcePersistence = resourcePersistence; }
void function(ResourcePersistence resourcePersistence) { this.resourcePersistence = resourcePersistence; }
/** * Sets the resource persistence. * * @param resourcePersistence the resource persistence */
Sets the resource persistence
setResourcePersistence
{ "repo_name": "iucn-whp/world-heritage-outlook", "path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/base/assessment_whvaluesLocalServiceBaseImpl.java", "license": "gpl-2.0", "size": 175950 }
[ "com.liferay.portal.service.persistence.ResourcePersistence" ]
import com.liferay.portal.service.persistence.ResourcePersistence;
import com.liferay.portal.service.persistence.*;
[ "com.liferay.portal" ]
com.liferay.portal;
1,220,575
@GetMapping("/account") @Timed public ResponseEntity<UserDTO> getAccount() { return Optional.ofNullable(userService.getUserWithAuthorities()) .map(user -> new ResponseEntity<>(new UserDTO(user), HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); }
@GetMapping(STR) ResponseEntity<UserDTO> function() { return Optional.ofNullable(userService.getUserWithAuthorities()) .map(user -> new ResponseEntity<>(new UserDTO(user), HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); }
/** * GET /account : get the current user. * * @return the ResponseEntity with status 200 (OK) and the current user in body, or status 500 (Internal Server Error) if the user couldn't be returned */
GET /account : get the current user
getAccount
{ "repo_name": "kms77/Fayabank", "path": "src/main/java/fr/trouillet/faya/fayabank/web/rest/AccountResource.java", "license": "gpl-3.0", "size": 10953 }
[ "fr.trouillet.faya.fayabank.service.dto.UserDTO", "java.util.Optional", "org.springframework.http.HttpStatus", "org.springframework.http.ResponseEntity", "org.springframework.web.bind.annotation.GetMapping" ]
import fr.trouillet.faya.fayabank.service.dto.UserDTO; import java.util.Optional; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping;
import fr.trouillet.faya.fayabank.service.dto.*; import java.util.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "fr.trouillet.faya", "java.util", "org.springframework.http", "org.springframework.web" ]
fr.trouillet.faya; java.util; org.springframework.http; org.springframework.web;
1,412,107
CmdAndAddressRet header = CmdAndAddressRet.parse(input, true); if (header != null) { try { Matcher matcher; switch (header.getCmd().toUpperCase()) { case "VAR_REL": case "VAR_ADD": // Same as "VAR_REL" case "VAR_SUB": // "VAR_REL" inverted if ((matcher = PATTERN_VAR_REL.matcher(header.getRestInput())).matches()) { double value = NumberFormat.getInstance(Locale.GERMANY).parse(matcher.group("value")) .doubleValue(); if (header.getCmd().equalsIgnoreCase("VAR_SUB")) { value = -value; } LcnDefs.VarUnit unit = matcher.group("modifier") == null ? LcnDefs.VarUnit.NATIVE : LcnDefs.VarUnit.parse(matcher.group("modifier")); return new VarRel(header.getAddr(), LcnDefs.Var.varIdToVar(Integer.parseInt(matcher.group("varId")) - 1), LcnDefs.RelVarRef.CURRENT, LcnDefs.VarValue.fromVarUnit(value, unit, false), false); } break; case "SETPOINT_REL": case "SETPOINT_ADD": // Same as "SETPOINT_REL" case "SETPOINT_SUB": // "SETPOINT_REL" inverted if ((matcher = PATTERN_SETPOINT_REL.matcher(header.getRestInput())).matches()) { LcnDefs.RelVarRef targetLcnType = (matcher.group("ref") != null && matcher.group("ref").equalsIgnoreCase("PROG")) ? RelVarRef.PROG : RelVarRef.CURRENT; double value = NumberFormat.getInstance(Locale.GERMANY).parse(matcher.group("value")) .doubleValue(); if (header.getCmd().equalsIgnoreCase("SETPOINT_SUB")) { value = -value; } LcnDefs.VarUnit unit = matcher.group("modifier") == null ? LcnDefs.VarUnit.NATIVE : LcnDefs.VarUnit.parse(matcher.group("modifier")); return new VarRel(header.getAddr(), LcnDefs.Var.setPointIdToVar(Integer.parseInt(matcher.group("regId")) - 1), targetLcnType, LcnDefs.VarValue.fromVarUnit(value, unit, false), false); } break; case "THRESHOLD_REL": case "THRESHOLD_ADD": // Same as "THRESHOLD_REL" case "THRESHOLD_SUB": // "THRESHOLD_REL" inverted case "THRESHOLD_REL_OLD": case "THRESHOLD_ADD_OLD": // Same as "THRESHOLD_REL_OLD" case "THRESHOLD_SUB_OLD": // "THRESHOLD_REL_OLD" inverted if ((matcher = PATTERN_THRS_REL.matcher(header.getRestInput())).matches()) { LcnDefs.RelVarRef targetLcnType = (matcher.group("ref") != null && matcher.group("ref").equalsIgnoreCase("PROG")) ? RelVarRef.PROG : RelVarRef.CURRENT; double value = NumberFormat.getInstance(Locale.GERMANY).parse(matcher.group("value")) .doubleValue(); if (header.getCmd().toUpperCase().contains("SUB")) { value = -value; } LcnDefs.VarUnit unit = matcher.group("modifier") == null ? LcnDefs.VarUnit.NATIVE : LcnDefs.VarUnit.parse(matcher.group("modifier")); return new VarRel(header.getAddr(), LcnDefs.Var.thrsIdToVar(Integer.parseInt(matcher.group("registerId")) - 1, Integer.parseInt(matcher.group("thrsId")) - 1), targetLcnType, LcnDefs.VarValue.fromVarUnit(value, unit, false), header.getCmd().toUpperCase().endsWith("_OLD")); } break; } } catch (ParseException ex) { } catch (IllegalArgumentException ex) { } } return null; }
CmdAndAddressRet header = CmdAndAddressRet.parse(input, true); if (header != null) { try { Matcher matcher; switch (header.getCmd().toUpperCase()) { case STR: case STR: case STR: if ((matcher = PATTERN_VAR_REL.matcher(header.getRestInput())).matches()) { double value = NumberFormat.getInstance(Locale.GERMANY).parse(matcher.group("value")) .doubleValue(); if (header.getCmd().equalsIgnoreCase(STR)) { value = -value; } LcnDefs.VarUnit unit = matcher.group(STR) == null ? LcnDefs.VarUnit.NATIVE : LcnDefs.VarUnit.parse(matcher.group(STR)); return new VarRel(header.getAddr(), LcnDefs.Var.varIdToVar(Integer.parseInt(matcher.group("varId")) - 1), LcnDefs.RelVarRef.CURRENT, LcnDefs.VarValue.fromVarUnit(value, unit, false), false); } break; case STR: case STR: case STR: if ((matcher = PATTERN_SETPOINT_REL.matcher(header.getRestInput())).matches()) { LcnDefs.RelVarRef targetLcnType = (matcher.group("ref") != null && matcher.group("ref").equalsIgnoreCase("PROG")) ? RelVarRef.PROG : RelVarRef.CURRENT; double value = NumberFormat.getInstance(Locale.GERMANY).parse(matcher.group("value")) .doubleValue(); if (header.getCmd().equalsIgnoreCase(STR)) { value = -value; } LcnDefs.VarUnit unit = matcher.group(STR) == null ? LcnDefs.VarUnit.NATIVE : LcnDefs.VarUnit.parse(matcher.group(STR)); return new VarRel(header.getAddr(), LcnDefs.Var.setPointIdToVar(Integer.parseInt(matcher.group("regId")) - 1), targetLcnType, LcnDefs.VarValue.fromVarUnit(value, unit, false), false); } break; case STR: case STR: case STR: case STR: case STR: case STR: if ((matcher = PATTERN_THRS_REL.matcher(header.getRestInput())).matches()) { LcnDefs.RelVarRef targetLcnType = (matcher.group("ref") != null && matcher.group("ref").equalsIgnoreCase("PROG")) ? RelVarRef.PROG : RelVarRef.CURRENT; double value = NumberFormat.getInstance(Locale.GERMANY).parse(matcher.group("value")) .doubleValue(); if (header.getCmd().toUpperCase().contains("SUB")) { value = -value; } LcnDefs.VarUnit unit = matcher.group(STR) == null ? LcnDefs.VarUnit.NATIVE : LcnDefs.VarUnit.parse(matcher.group(STR)); return new VarRel(header.getAddr(), LcnDefs.Var.thrsIdToVar(Integer.parseInt(matcher.group(STR)) - 1, Integer.parseInt(matcher.group(STR)) - 1), targetLcnType, LcnDefs.VarValue.fromVarUnit(value, unit, false), header.getCmd().toUpperCase().endsWith("_OLD")); } break; } } catch (ParseException ex) { } catch (IllegalArgumentException ex) { } } return null; }
/** * Tries to parse the given input text. * * @param input the text to parse * @return the parsed {@link VarRel} or null */
Tries to parse the given input text
tryParseTarget
{ "repo_name": "paolodenti/openhab", "path": "bundles/binding/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/mappingtarget/VarRel.java", "license": "epl-1.0", "size": 11730 }
[ "java.text.NumberFormat", "java.text.ParseException", "java.util.Locale", "java.util.regex.Matcher", "org.openhab.binding.lcn.common.LcnDefs" ]
import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; import java.util.regex.Matcher; import org.openhab.binding.lcn.common.LcnDefs;
import java.text.*; import java.util.*; import java.util.regex.*; import org.openhab.binding.lcn.common.*;
[ "java.text", "java.util", "org.openhab.binding" ]
java.text; java.util; org.openhab.binding;
149,800
@Override public void run() { m_area.blink(); if (m_working) { Display.getCurrent().timerExec(BLINK_RATE_MSEC, this); } }
void function() { m_area.blink(); if (m_working) { Display.getCurrent().timerExec(BLINK_RATE_MSEC, this); } }
/************************************************************************** * Thread run method *************************************************************************/
Thread run method
run
{ "repo_name": "Spacecraft-Code/SPELL", "path": "src/spel-gui/com.astra.ses.spell.gui/src/com/astra/ses/spell/gui/views/controls/input/PromptBlinker.java", "license": "lgpl-3.0", "size": 3591 }
[ "org.eclipse.swt.widgets.Display" ]
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
831,395
@EventHandler(value = "change", target = "@editor") protected void onChange(ChangeEvent event) { if (hasChanged()) { propGrid.propertyChanged(); } }
@EventHandler(value = STR, target = STR) void function(ChangeEvent event) { if (hasChanged()) { propGrid.propertyChanged(); } }
/** * Notify the property grid that the value has changed. * * @param event The change event. */
Notify the property grid that the value has changed
onChange
{ "repo_name": "carewebframework/carewebframework-core", "path": "org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java", "license": "apache-2.0", "size": 6336 }
[ "org.fujion.annotation.EventHandler", "org.fujion.event.ChangeEvent" ]
import org.fujion.annotation.EventHandler; import org.fujion.event.ChangeEvent;
import org.fujion.annotation.*; import org.fujion.event.*;
[ "org.fujion.annotation", "org.fujion.event" ]
org.fujion.annotation; org.fujion.event;
781,474
private boolean checkThatEntriesHaveKeys(List<BibEntry> entries) { // Check if there are empty keys boolean emptyKeys = false; for (BibEntry entry : entries) { if (!entry.getCiteKeyOptional().isPresent()) { // Found one, no need to look further for now emptyKeys = true; break; } } // If no empty keys, return true if (!emptyKeys) { return true; } // Ask if keys should be generated String[] options = {Localization.lang("Generate keys"), Localization.lang("Cancel")}; int answer = JOptionPane.showOptionDialog(this.frame, Localization.lang("Cannot cite entries without BibTeX keys. Generate keys now?"), Localization.lang("Cite"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, null); BasePanel panel = frame.getCurrentBasePanel(); if ((answer == JOptionPane.OK_OPTION) && (panel != null)) { // Generate keys BibtexKeyPatternPreferences prefs = Globals.prefs.getBibtexKeyPatternPreferences(); NamedCompound undoCompound = new NamedCompound(Localization.lang("Cite")); for (BibEntry entry : entries) { if (!entry.getCiteKeyOptional().isPresent()) { // Generate key BibtexKeyPatternUtil .makeAndSetLabel( panel.getBibDatabaseContext().getMetaData().getCiteKeyPattern(prefs.getKeyPattern()), panel.getDatabase(), entry, prefs); // Add undo change undoCompound.addEdit( new UndoableKeyChange(entry, null, entry.getCiteKeyOptional().get())); } } undoCompound.end(); // Add all undos panel.getUndoManager().addEdit(undoCompound); // Now every entry has a key return true; } else { // No, we canceled (or there is no panel to get the database from, highly unlikely) return false; } }
boolean function(List<BibEntry> entries) { boolean emptyKeys = false; for (BibEntry entry : entries) { if (!entry.getCiteKeyOptional().isPresent()) { emptyKeys = true; break; } } if (!emptyKeys) { return true; } String[] options = {Localization.lang(STR), Localization.lang(STR)}; int answer = JOptionPane.showOptionDialog(this.frame, Localization.lang(STR), Localization.lang("Cite"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, null); BasePanel panel = frame.getCurrentBasePanel(); if ((answer == JOptionPane.OK_OPTION) && (panel != null)) { BibtexKeyPatternPreferences prefs = Globals.prefs.getBibtexKeyPatternPreferences(); NamedCompound undoCompound = new NamedCompound(Localization.lang("Cite")); for (BibEntry entry : entries) { if (!entry.getCiteKeyOptional().isPresent()) { BibtexKeyPatternUtil .makeAndSetLabel( panel.getBibDatabaseContext().getMetaData().getCiteKeyPattern(prefs.getKeyPattern()), panel.getDatabase(), entry, prefs); undoCompound.addEdit( new UndoableKeyChange(entry, null, entry.getCiteKeyOptional().get())); } } undoCompound.end(); panel.getUndoManager().addEdit(undoCompound); return true; } else { return false; } }
/** * Check that all entries in the list have BibTeX keys, if not ask if they should be generated * * @param entries A list of entries to be checked * @return true if all entries have BibTeX keys, if it so may be after generating them */
Check that all entries in the list have BibTeX keys, if not ask if they should be generated
checkThatEntriesHaveKeys
{ "repo_name": "luizvneto/DC-UFSCar-ES2-201701-Grupo-NichRosaHugoLuizRodr", "path": "src/main/java/net/sf/jabref/gui/openoffice/OpenOfficePanel.java", "license": "mit", "size": 36294 }
[ "java.util.List", "javax.swing.JOptionPane", "net.sf.jabref.Globals", "net.sf.jabref.gui.BasePanel", "net.sf.jabref.gui.undo.NamedCompound", "net.sf.jabref.gui.undo.UndoableKeyChange", "net.sf.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences", "net.sf.jabref.logic.bibtexkeypattern.BibtexKeyPatternUtil", "net.sf.jabref.logic.l10n.Localization", "net.sf.jabref.model.entry.BibEntry" ]
import java.util.List; import javax.swing.JOptionPane; import net.sf.jabref.Globals; import net.sf.jabref.gui.BasePanel; import net.sf.jabref.gui.undo.NamedCompound; import net.sf.jabref.gui.undo.UndoableKeyChange; import net.sf.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences; import net.sf.jabref.logic.bibtexkeypattern.BibtexKeyPatternUtil; import net.sf.jabref.logic.l10n.Localization; import net.sf.jabref.model.entry.BibEntry;
import java.util.*; import javax.swing.*; import net.sf.jabref.*; import net.sf.jabref.gui.*; import net.sf.jabref.gui.undo.*; import net.sf.jabref.logic.bibtexkeypattern.*; import net.sf.jabref.logic.l10n.*; import net.sf.jabref.model.entry.*;
[ "java.util", "javax.swing", "net.sf.jabref" ]
java.util; javax.swing; net.sf.jabref;
2,181,830
public static Resource precedes() { return _namespace_CDAO("CDAO_0000160"); }
static Resource function() { return _namespace_CDAO(STR); }
/** * -- No comment or description provided. -- * (http://purl.obolibrary.org/obo/CDAO_0000160) */
-- No comment or description provided. -- (HREF)
precedes
{ "repo_name": "BioInterchange/BioInterchange", "path": "supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/CDAO.java", "license": "mit", "size": 85675 }
[ "com.hp.hpl.jena.rdf.model.Resource" ]
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.*;
[ "com.hp.hpl" ]
com.hp.hpl;
1,656,073
public @Nullable Object getTag(@Nonnull String tag) { return getTags().get(tag); }
@Nullable Object function(@Nonnull String tag) { return getTags().get(tag); }
/** * Fetches the value of the specified tag key. * @param tag the key of the tag to be fetched * @return the value associated with the specified key, if any */
Fetches the value of the specified tag key
getTag
{ "repo_name": "OSS-TheWeatherCompany/dasein-cloud-core", "path": "src/main/java/org/dasein/cloud/ci/ConvergedInfrastructure.java", "license": "apache-2.0", "size": 5187 }
[ "javax.annotation.Nonnull", "javax.annotation.Nullable" ]
import javax.annotation.Nonnull; import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,906,436
User saveUser(User user) throws UserExistsException;
User saveUser(User user) throws UserExistsException;
/** * Saves a user's information * * @param user * the user's information * @throws UserExistsException * thrown when user already exists * @return updated user */
Saves a user's information
saveUser
{ "repo_name": "delphiprogramming/gisgraphy", "path": "src/main/java/com/gisgraphy/service/UserService.java", "license": "lgpl-3.0", "size": 2711 }
[ "com.gisgraphy.model.User" ]
import com.gisgraphy.model.User;
import com.gisgraphy.model.*;
[ "com.gisgraphy.model" ]
com.gisgraphy.model;
1,659,362
private RelBuilder convertSingletonDistinct(RelBuilder relBuilder, Aggregate aggregate, Set<Pair<List<Integer>, Integer>> argLists) { // In this case, we are assuming that there is a single distinct function. // So make sure that argLists is of size one. Preconditions.checkArgument(argLists.size() == 1); // For example, // SELECT deptno, COUNT(*), SUM(bonus), MIN(DISTINCT sal) // FROM emp // GROUP BY deptno // // becomes // // SELECT deptno, SUM(cnt), SUM(bonus), MIN(sal) // FROM ( // SELECT deptno, COUNT(*) as cnt, SUM(bonus), sal // FROM EMP // GROUP BY deptno, sal) // Aggregate B // GROUP BY deptno // Aggregate A relBuilder.push(aggregate.getInput()); final List<AggregateCall> originalAggCalls = aggregate.getAggCallList(); final ImmutableBitSet originalGroupSet = aggregate.getGroupSet(); // Add the distinct aggregate column(s) to the group-by columns, // if not already a part of the group-by final SortedSet<Integer> bottomGroupSet = new TreeSet<>(); bottomGroupSet.addAll(aggregate.getGroupSet().asList()); for (AggregateCall aggCall : originalAggCalls) { if (aggCall.isDistinct()) { bottomGroupSet.addAll(aggCall.getArgList()); break; // since we only have single distinct call } } // Generate the intermediate aggregate B, the one on the bottom that converts // a distinct call to group by call. // Bottom aggregate is the same as the original aggregate, except that // the bottom aggregate has converted the DISTINCT aggregate to a group by clause. final List<AggregateCall> bottomAggregateCalls = new ArrayList<>(); for (AggregateCall aggCall : originalAggCalls) { // Project the column corresponding to the distinct aggregate. Project // as-is all the non-distinct aggregates if (!aggCall.isDistinct()) { final AggregateCall newCall = AggregateCall.create(aggCall.getAggregation(), false, aggCall.isApproximate(), aggCall.getArgList(), -1, ImmutableBitSet.of(bottomGroupSet).cardinality(), relBuilder.peek(), null, aggCall.name); bottomAggregateCalls.add(newCall); } } // Generate the aggregate B (see the reference example above) relBuilder.push( aggregate.copy( aggregate.getTraitSet(), relBuilder.build(), false, ImmutableBitSet.of(bottomGroupSet), null, bottomAggregateCalls)); // Add aggregate A (see the reference example above), the top aggregate // to handle the rest of the aggregation that the bottom aggregate hasn't handled final List<AggregateCall> topAggregateCalls = Lists.newArrayList(); // Use the remapped arguments for the (non)distinct aggregate calls int nonDistinctAggCallProcessedSoFar = 0; for (AggregateCall aggCall : originalAggCalls) { final AggregateCall newCall; if (aggCall.isDistinct()) { List<Integer> newArgList = new ArrayList<>(); for (int arg : aggCall.getArgList()) { newArgList.add(bottomGroupSet.headSet(arg).size()); } newCall = AggregateCall.create(aggCall.getAggregation(), false, aggCall.isApproximate(), newArgList, -1, originalGroupSet.cardinality(), relBuilder.peek(), aggCall.getType(), aggCall.name); } else { // If aggregate B had a COUNT aggregate call the corresponding aggregate at // aggregate A must be SUM. For other aggregates, it remains the same. final List<Integer> newArgs = Lists.newArrayList(bottomGroupSet.size() + nonDistinctAggCallProcessedSoFar); if (aggCall.getAggregation().getKind() == SqlKind.COUNT) { newCall = AggregateCall.create(new SqlSumEmptyIsZeroAggFunction(), false, aggCall.isApproximate(), newArgs, -1, originalGroupSet.cardinality(), relBuilder.peek(), aggCall.getType(), aggCall.getName()); } else { newCall = AggregateCall.create(aggCall.getAggregation(), false, aggCall.isApproximate(), newArgs, -1, originalGroupSet.cardinality(), relBuilder.peek(), aggCall.getType(), aggCall.name); } nonDistinctAggCallProcessedSoFar++; } topAggregateCalls.add(newCall); } // Populate the group-by keys with the remapped arguments for aggregate A // The top groupset is basically an identity (first X fields of aggregate B's // output), minus the distinct aggCall's input. final Set<Integer> topGroupSet = new HashSet<>(); int groupSetToAdd = 0; for (int bottomGroup : bottomGroupSet) { if (originalGroupSet.get(bottomGroup)) { topGroupSet.add(groupSetToAdd); } groupSetToAdd++; } relBuilder.push( aggregate.copy(aggregate.getTraitSet(), relBuilder.build(), aggregate.indicator, ImmutableBitSet.of(topGroupSet), null, topAggregateCalls)); return relBuilder; }
RelBuilder function(RelBuilder relBuilder, Aggregate aggregate, Set<Pair<List<Integer>, Integer>> argLists) { Preconditions.checkArgument(argLists.size() == 1); relBuilder.push(aggregate.getInput()); final List<AggregateCall> originalAggCalls = aggregate.getAggCallList(); final ImmutableBitSet originalGroupSet = aggregate.getGroupSet(); final SortedSet<Integer> bottomGroupSet = new TreeSet<>(); bottomGroupSet.addAll(aggregate.getGroupSet().asList()); for (AggregateCall aggCall : originalAggCalls) { if (aggCall.isDistinct()) { bottomGroupSet.addAll(aggCall.getArgList()); break; } } final List<AggregateCall> bottomAggregateCalls = new ArrayList<>(); for (AggregateCall aggCall : originalAggCalls) { if (!aggCall.isDistinct()) { final AggregateCall newCall = AggregateCall.create(aggCall.getAggregation(), false, aggCall.isApproximate(), aggCall.getArgList(), -1, ImmutableBitSet.of(bottomGroupSet).cardinality(), relBuilder.peek(), null, aggCall.name); bottomAggregateCalls.add(newCall); } } relBuilder.push( aggregate.copy( aggregate.getTraitSet(), relBuilder.build(), false, ImmutableBitSet.of(bottomGroupSet), null, bottomAggregateCalls)); final List<AggregateCall> topAggregateCalls = Lists.newArrayList(); int nonDistinctAggCallProcessedSoFar = 0; for (AggregateCall aggCall : originalAggCalls) { final AggregateCall newCall; if (aggCall.isDistinct()) { List<Integer> newArgList = new ArrayList<>(); for (int arg : aggCall.getArgList()) { newArgList.add(bottomGroupSet.headSet(arg).size()); } newCall = AggregateCall.create(aggCall.getAggregation(), false, aggCall.isApproximate(), newArgList, -1, originalGroupSet.cardinality(), relBuilder.peek(), aggCall.getType(), aggCall.name); } else { final List<Integer> newArgs = Lists.newArrayList(bottomGroupSet.size() + nonDistinctAggCallProcessedSoFar); if (aggCall.getAggregation().getKind() == SqlKind.COUNT) { newCall = AggregateCall.create(new SqlSumEmptyIsZeroAggFunction(), false, aggCall.isApproximate(), newArgs, -1, originalGroupSet.cardinality(), relBuilder.peek(), aggCall.getType(), aggCall.getName()); } else { newCall = AggregateCall.create(aggCall.getAggregation(), false, aggCall.isApproximate(), newArgs, -1, originalGroupSet.cardinality(), relBuilder.peek(), aggCall.getType(), aggCall.name); } nonDistinctAggCallProcessedSoFar++; } topAggregateCalls.add(newCall); } final Set<Integer> topGroupSet = new HashSet<>(); int groupSetToAdd = 0; for (int bottomGroup : bottomGroupSet) { if (originalGroupSet.get(bottomGroup)) { topGroupSet.add(groupSetToAdd); } groupSetToAdd++; } relBuilder.push( aggregate.copy(aggregate.getTraitSet(), relBuilder.build(), aggregate.indicator, ImmutableBitSet.of(topGroupSet), null, topAggregateCalls)); return relBuilder; }
/** * Converts an aggregate with one distinct aggregate and one or more * non-distinct aggregates to multi-phase aggregates (see reference example * below). * * @param relBuilder Contains the input relational expression * @param aggregate Original aggregate * @param argLists Arguments and filters to the distinct aggregate function * */
Converts an aggregate with one distinct aggregate and one or more non-distinct aggregates to multi-phase aggregates (see reference example below)
convertSingletonDistinct
{ "repo_name": "b-slim/calcite", "path": "core/src/main/java/org/apache/calcite/rel/rules/AggregateExpandDistinctAggregatesRule.java", "license": "apache-2.0", "size": 33557 }
[ "com.google.common.base.Preconditions", "com.google.common.collect.Lists", "java.util.ArrayList", "java.util.HashSet", "java.util.List", "java.util.Set", "java.util.SortedSet", "java.util.TreeSet", "org.apache.calcite.rel.core.Aggregate", "org.apache.calcite.rel.core.AggregateCall", "org.apache.calcite.sql.SqlKind", "org.apache.calcite.sql.fun.SqlSumEmptyIsZeroAggFunction", "org.apache.calcite.tools.RelBuilder", "org.apache.calcite.util.ImmutableBitSet", "org.apache.calcite.util.Pair" ]
import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import org.apache.calcite.rel.core.Aggregate; import org.apache.calcite.rel.core.AggregateCall; import org.apache.calcite.sql.SqlKind; import org.apache.calcite.sql.fun.SqlSumEmptyIsZeroAggFunction; import org.apache.calcite.tools.RelBuilder; import org.apache.calcite.util.ImmutableBitSet; import org.apache.calcite.util.Pair;
import com.google.common.base.*; import com.google.common.collect.*; import java.util.*; import org.apache.calcite.rel.core.*; import org.apache.calcite.sql.*; import org.apache.calcite.sql.fun.*; import org.apache.calcite.tools.*; import org.apache.calcite.util.*;
[ "com.google.common", "java.util", "org.apache.calcite" ]
com.google.common; java.util; org.apache.calcite;
2,704,317
@Generated @Selector("deactivateConstraints:") public static native void deactivateConstraints(NSArray<? extends NSLayoutConstraint> constraints);
@Selector(STR) static native void function(NSArray<? extends NSLayoutConstraint> constraints);
/** * Convenience method that deactivates each constraint in the contained array, in the same manner as setting active=NO. This is often more efficient than deactivating each constraint individually. */
Convenience method that deactivates each constraint in the contained array, in the same manner as setting active=NO. This is often more efficient than deactivating each constraint individually
deactivateConstraints
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/NSLayoutConstraint.java", "license": "apache-2.0", "size": 11957 }
[ "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;
1,089,564
@Test(expectedExceptions = IllegalArgumentException.class) public void testNonRecordRootSchemaDDL() throws Exception { String schemaName = "nonRecordRootSchema"; Schema schema = Schema.create(Schema.Type.STRING); HiveAvroORCQueryGenerator .generateCreateTableDDL(schema, schemaName, "file:/user/hive/warehouse/" + schemaName, Optional.<String>absent(), Optional.<Map<String, String>>absent(), Optional.<List<String>>absent(), Optional.<Map<String, HiveAvroORCQueryGenerator.COLUMN_SORT_ORDER>>absent(), Optional.<Integer>absent(), Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent(), null, isEvolutionEnabled, true, destinationTableMeta, new HashMap<String, String>()); }
@Test(expectedExceptions = IllegalArgumentException.class) void function() throws Exception { String schemaName = STR; Schema schema = Schema.create(Schema.Type.STRING); HiveAvroORCQueryGenerator .generateCreateTableDDL(schema, schemaName, STR + schemaName, Optional.<String>absent(), Optional.<Map<String, String>>absent(), Optional.<List<String>>absent(), Optional.<Map<String, HiveAvroORCQueryGenerator.COLUMN_SORT_ORDER>>absent(), Optional.<Integer>absent(), Optional.<String>absent(), Optional.<String>absent(), Optional.<String>absent(), null, isEvolutionEnabled, true, destinationTableMeta, new HashMap<String, String>()); }
/*** * Test bad schema * @throws IOException */
Test bad schema
testNonRecordRootSchemaDDL
{ "repo_name": "jack-moseley/gobblin", "path": "gobblin-data-management/src/test/java/org/apache/gobblin/data/management/conversion/hive/util/HiveAvroORCQueryGeneratorTest.java", "license": "apache-2.0", "size": 21043 }
[ "com.google.common.base.Optional", "java.util.HashMap", "java.util.List", "java.util.Map", "org.apache.avro.Schema", "org.apache.gobblin.data.management.conversion.hive.query.HiveAvroORCQueryGenerator", "org.testng.annotations.Test" ]
import com.google.common.base.Optional; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.avro.Schema; import org.apache.gobblin.data.management.conversion.hive.query.HiveAvroORCQueryGenerator; import org.testng.annotations.Test;
import com.google.common.base.*; import java.util.*; import org.apache.avro.*; import org.apache.gobblin.data.management.conversion.hive.query.*; import org.testng.annotations.*;
[ "com.google.common", "java.util", "org.apache.avro", "org.apache.gobblin", "org.testng.annotations" ]
com.google.common; java.util; org.apache.avro; org.apache.gobblin; org.testng.annotations;
1,302,846
public ParticleManager withVelocity(int velocityX, int velocityY) { ParticleView p = getLastParticleView(); return withVelocity(p, velocityX, velocityY); }
ParticleManager function(int velocityX, int velocityY) { ParticleView p = getLastParticleView(); return withVelocity(p, velocityX, velocityY); }
/** * Add Velocity * @param velocityX * @param velocityY * @return */
Add Velocity
withVelocity
{ "repo_name": "ffournier/animations", "path": "app/src/main/java/com/animations/animations/lib/ParticleManager.java", "license": "apache-2.0", "size": 17090 }
[ "com.animations.animations.lib.view.ParticleView" ]
import com.animations.animations.lib.view.ParticleView;
import com.animations.animations.lib.view.*;
[ "com.animations.animations" ]
com.animations.animations;
1,077,544
public void setPreferencesHandler(final PreferencesHandler preferencesHandler) { eventHandler.preferencesDispatcher.setHandler(preferencesHandler); }
void function(final PreferencesHandler preferencesHandler) { eventHandler.preferencesDispatcher.setHandler(preferencesHandler); }
/** * Installs a handler to create the Preferences menu item in your application's app menu. * * Setting the {@link PreferencesHandler} to {@code null} will remove the Preferences item from the app menu. * * @param preferencesHandler * @since Java for Mac OS X 10.6 Update 3 * @since Java for Mac OS X 10.5 Update 8 */
Installs a handler to create the Preferences menu item in your application's app menu. Setting the <code>PreferencesHandler</code> to null will remove the Preferences item from the app menu
setPreferencesHandler
{ "repo_name": "md-5/jdk10", "path": "src/java.desktop/macosx/classes/com/apple/eawt/Application.java", "license": "gpl-2.0", "size": 17463 }
[ "java.awt.desktop.PreferencesHandler" ]
import java.awt.desktop.PreferencesHandler;
import java.awt.desktop.*;
[ "java.awt" ]
java.awt;
2,619,185
@Override public void captureResponse(boolean suppressListeners) { String utcTimeStampString = mLocalCalendar.getTimeInMillis() + ""; setResponse(new QuestionResponse(utcTimeStampString, ConstantUtil.DATE_RESPONSE_TYPE, getQuestion().getId()), suppressListeners); }
void function(boolean suppressListeners) { String utcTimeStampString = mLocalCalendar.getTimeInMillis() + ""; setResponse(new QuestionResponse(utcTimeStampString, ConstantUtil.DATE_RESPONSE_TYPE, getQuestion().getId()), suppressListeners); }
/** * pulls the data out of the fields and saves it as a response object, * possibly suppressing listeners */
pulls the data out of the fields and saves it as a response object, possibly suppressing listeners
captureResponse
{ "repo_name": "MelEnt/akvo-flow-mobile", "path": "app/src/main/java/org/akvo/flow/ui/view/DateQuestionView.java", "license": "gpl-3.0", "size": 5481 }
[ "org.akvo.flow.domain.QuestionResponse", "org.akvo.flow.util.ConstantUtil" ]
import org.akvo.flow.domain.QuestionResponse; import org.akvo.flow.util.ConstantUtil;
import org.akvo.flow.domain.*; import org.akvo.flow.util.*;
[ "org.akvo.flow" ]
org.akvo.flow;
2,390,493
protected String parseName(String name) throws NamingException { return name; }
String function(String name) throws NamingException { return name; }
/** * Parses a name. * * @return the parsed name */
Parses a name
parseName
{ "repo_name": "johnaoahra80/JBOSSWEB_7_5_0_FINAL", "path": "src/main/java/org/apache/naming/resources/ProxyDirContext.java", "license": "apache-2.0", "size": 69508 }
[ "javax.naming.NamingException" ]
import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
961,437
@Test public void testGetOptions() { assertNotNull(autocomplete.getOptions()); assertEquals(autocomplete.getOptions().getJavaScriptOptions().toString(), "{}"); autocomplete.setDelay(5); assertEquals(autocomplete.getOptions().getJavaScriptOptions().toString(), "{delay: 5}"); } /** * Test method for {@link org.odlabs.wiquery.ui.autocomplete.Autocomplete#getSource()}
void function() { assertNotNull(autocomplete.getOptions()); assertEquals(autocomplete.getOptions().getJavaScriptOptions().toString(), "{}"); autocomplete.setDelay(5); assertEquals(autocomplete.getOptions().getJavaScriptOptions().toString(), STR); } /** * Test method for {@link org.odlabs.wiquery.ui.autocomplete.Autocomplete#getSource()}
/** * Test method for * {@link org.odlabs.wiquery.ui.autocomplete.Autocomplete#getOptions()}. */
Test method for <code>org.odlabs.wiquery.ui.autocomplete.Autocomplete#getOptions()</code>
testGetOptions
{ "repo_name": "WiQuery/wiquery", "path": "wiquery-jquery-ui/src/test/java/org/odlabs/wiquery/ui/autocomplete/AutocompleteTestCase.java", "license": "mit", "size": 11113 }
[ "org.junit.Assert", "org.junit.Test" ]
import org.junit.Assert; import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,571,007
public DataDictionaryService getDataDictionaryService() { return dataDictionaryService; }
DataDictionaryService function() { return dataDictionaryService; }
/** * Gets the dataDictionaryService attribute. * @return Returns the dataDictionaryService. */
Gets the dataDictionaryService attribute
getDataDictionaryService
{ "repo_name": "ua-eas/kfs", "path": "kfs-core/src/main/java/org/kuali/kfs/fp/batch/service/impl/ProcurementCardCreateDocumentServiceImpl.java", "license": "agpl-3.0", "size": 95596 }
[ "org.kuali.rice.krad.service.DataDictionaryService" ]
import org.kuali.rice.krad.service.DataDictionaryService;
import org.kuali.rice.krad.service.*;
[ "org.kuali.rice" ]
org.kuali.rice;
1,108,658
JsonRpcResponse getResponse(String operationId);
JsonRpcResponse getResponse(String operationId);
/** * Returns a response for a specific robot operation. * * @param operationId the id of the robot operation to get the response for. * @return returns a {@link JsonRpcResponse} if set else null. */
Returns a response for a specific robot operation
getResponse
{ "repo_name": "gburd/wave", "path": "src/org/waveprotocol/box/server/robots/OperationResults.java", "license": "apache-2.0", "size": 1539 }
[ "com.google.wave.api.JsonRpcResponse" ]
import com.google.wave.api.JsonRpcResponse;
import com.google.wave.api.*;
[ "com.google.wave" ]
com.google.wave;
1,504,239
boolean isWritable() { boolean b = isUserOwner(); if (b) return b; GroupData g = ImViewerAgent.getUserDetails().getDefaultGroup(); switch (g.getPermissions().getPermissionsLevel()) { case GroupData.PERMISSIONS_GROUP_READ_LINK: case GroupData.PERMISSIONS_PUBLIC_READ_WRITE: return true; } return false; }
boolean isWritable() { boolean b = isUserOwner(); if (b) return b; GroupData g = ImViewerAgent.getUserDetails().getDefaultGroup(); switch (g.getPermissions().getPermissionsLevel()) { case GroupData.PERMISSIONS_GROUP_READ_LINK: case GroupData.PERMISSIONS_PUBLIC_READ_WRITE: return true; } return false; }
/** * Returns <code>true</code> if the object is writable, * <code>false</code> otherwise. * * @return See above. */
Returns <code>true</code> if the object is writable, <code>false</code> otherwise
isWritable
{ "repo_name": "MontpellierRessourcesImagerie/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java", "license": "gpl-2.0", "size": 85080 }
[ "org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent" ]
import org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent;
import org.openmicroscopy.shoola.agents.imviewer.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
2,881,920
public static Function<Object,Float> methodForFloat(final String methodName, final Object... optionalParameters) { return new Call<Object,Float>(Types.FLOAT, methodName, VarArgsUtil.asOptionalObjectArray(Object.class,optionalParameters)); }
static Function<Object,Float> function(final String methodName, final Object... optionalParameters) { return new Call<Object,Float>(Types.FLOAT, methodName, VarArgsUtil.asOptionalObjectArray(Object.class,optionalParameters)); }
/** * <p> * Executes a method on the target object which returns Float. Parameters must match * those of the method. * </p> * * @param methodName the name of the method * @param optionalParameters the (optional) parameters of the method. * @return the result of the method execution */
Executes a method on the target object which returns Float. Parameters must match those of the method.
methodForFloat
{ "repo_name": "op4j/op4j", "path": "src/main/java/org/op4j/functions/Call.java", "license": "apache-2.0", "size": 27542 }
[ "org.javaruntype.type.Types", "org.op4j.util.VarArgsUtil" ]
import org.javaruntype.type.Types; import org.op4j.util.VarArgsUtil;
import org.javaruntype.type.*; import org.op4j.util.*;
[ "org.javaruntype.type", "org.op4j.util" ]
org.javaruntype.type; org.op4j.util;
2,544,168
public void setCreateDate(java.util.Date createDate) { _chatRoom.setCreateDate(createDate); }
void function(java.util.Date createDate) { _chatRoom.setCreateDate(createDate); }
/** * Sets the create date of this chat room. * * @param createDate the create date of this chat room */
Sets the create date of this chat room
setCreateDate
{ "repo_name": "camaradosdeputadosoficial/edemocracia", "path": "cd-chat-portlet/src/main/java/br/gov/camara/edemocracia/portlets/chat/model/ChatRoomWrapper.java", "license": "lgpl-2.1", "size": 20510 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
451,931
@Nullable public IgniteInternalFuture<?> awaitAckAsync() { synchronized (this) { if (cnt == 0) return null; if (nodeLeft) return new GridFinishedFuture<>(new IgniteCheckedException("Failed to wait for finish synchronizer " + "state (node left grid): " + nodeId)); if (pendingFut == null) { if (log.isTraceEnabled()) log.trace("Creating transaction synchronizer future [nodeId=" + nodeId + ", threadId=" + threadId + ']'); pendingFut = new GridFutureAdapter<>(); } return pendingFut; } }
@Nullable IgniteInternalFuture<?> function() { synchronized (this) { if (cnt == 0) return null; if (nodeLeft) return new GridFinishedFuture<>(new IgniteCheckedException(STR + STR + nodeId)); if (pendingFut == null) { if (log.isTraceEnabled()) log.trace(STR + nodeId + STR + threadId + ']'); pendingFut = new GridFutureAdapter<>(); } return pendingFut; } }
/** * Asynchronously waits for ack to be received from node. * * @return {@code null} if ack has been received, or future that will be completed when ack is received. */
Asynchronously waits for ack to be received from node
awaitAckAsync
{ "repo_name": "amirakhmedov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxFinishSync.java", "license": "apache-2.0", "size": 10867 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.IgniteInternalFuture", "org.apache.ignite.internal.util.future.GridFinishedFuture", "org.apache.ignite.internal.util.future.GridFutureAdapter", "org.jetbrains.annotations.Nullable" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.future.GridFinishedFuture; import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.jetbrains.annotations.Nullable;
import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.future.*; import org.jetbrains.annotations.*;
[ "org.apache.ignite", "org.jetbrains.annotations" ]
org.apache.ignite; org.jetbrains.annotations;
2,343,022
public void unregisterCatalog(String catalogName, boolean ignoreIfNotExists) { checkArgument( !StringUtils.isNullOrWhitespaceOnly(catalogName), "Catalog name cannot be null or empty."); if (catalogs.containsKey(catalogName)) { Catalog catalog = catalogs.remove(catalogName); catalog.close(); } else if (!ignoreIfNotExists) { throw new CatalogException(format("Catalog %s does not exist.", catalogName)); } }
void function(String catalogName, boolean ignoreIfNotExists) { checkArgument( !StringUtils.isNullOrWhitespaceOnly(catalogName), STR); if (catalogs.containsKey(catalogName)) { Catalog catalog = catalogs.remove(catalogName); catalog.close(); } else if (!ignoreIfNotExists) { throw new CatalogException(format(STR, catalogName)); } }
/** * Unregisters a catalog under the given name. The catalog name must be existed. * * @param catalogName name under which to unregister the given catalog. * @param ignoreIfNotExists If false exception will be thrown if the table or database or * catalog to be altered does not exist. * @throws CatalogException if the unregistration of the catalog under the given name failed */
Unregisters a catalog under the given name. The catalog name must be existed
unregisterCatalog
{ "repo_name": "tillrohrmann/flink", "path": "flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java", "license": "apache-2.0", "size": 36417 }
[ "org.apache.flink.table.catalog.exceptions.CatalogException", "org.apache.flink.util.Preconditions", "org.apache.flink.util.StringUtils" ]
import org.apache.flink.table.catalog.exceptions.CatalogException; import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils;
import org.apache.flink.table.catalog.exceptions.*; import org.apache.flink.util.*;
[ "org.apache.flink" ]
org.apache.flink;
2,471,944
// init options Options options = new Options(); options.addOption("build", false, "build model"); options.addOption("load", false, "load model"); options.addOption("save", false, "save model"); options.addOption("conf", true, "the path of configuration file"); options.addOption("jobconf", true, "a specified key-value pair for configuration"); options.addOption("D", true, "a specified key-value pair for configuration"); // parse options CommandLineParser parser = new DefaultParser(); CommandLine cmd = parser.parse(options, args, false); // init configuration Configuration conf = new Configuration(); if (cmd.hasOption("conf")) { String confFilePath = cmd.getOptionValue("conf"); Properties prop = new Properties(); prop.load(new FileInputStream(confFilePath)); for (String name : prop.stringPropertyNames()) { conf.set(name, prop.getProperty(name)); } } if (cmd.hasOption("jobconf")) { String[] optionValues = cmd.getOptionValues("jobconf"); for (String optionValue : optionValues) { String[] keyValuePair = optionValue.split("="); conf.set(keyValuePair[0], keyValuePair[1]); } } if (cmd.hasOption("D")) { String[] optionValues = cmd.getOptionValues("D"); for (String optionValue : optionValues) { String[] keyValuePair = optionValue.split("="); conf.set(keyValuePair[0], keyValuePair[1]); } } TextDataModel dataModel = new TextDataModel(conf); dataModel.buildDataModel(); System.out.println("well done!!!"); return 0; }
Options options = new Options(); options.addOption("build", false, STR); options.addOption("load", false, STR); options.addOption("save", false, STR); options.addOption("conf", true, STR); options.addOption(STR, true, STR); options.addOption("D", true, STR); CommandLineParser parser = new DefaultParser(); CommandLine cmd = parser.parse(options, args, false); Configuration conf = new Configuration(); if (cmd.hasOption("conf")) { String confFilePath = cmd.getOptionValue("conf"); Properties prop = new Properties(); prop.load(new FileInputStream(confFilePath)); for (String name : prop.stringPropertyNames()) { conf.set(name, prop.getProperty(name)); } } if (cmd.hasOption(STR)) { String[] optionValues = cmd.getOptionValues(STR); for (String optionValue : optionValues) { String[] keyValuePair = optionValue.split("="); conf.set(keyValuePair[0], keyValuePair[1]); } } if (cmd.hasOption("D")) { String[] optionValues = cmd.getOptionValues("D"); for (String optionValue : optionValues) { String[] keyValuePair = optionValue.split("="); conf.set(keyValuePair[0], keyValuePair[1]); } } TextDataModel dataModel = new TextDataModel(conf); dataModel.buildDataModel(); System.out.println(STR); return 0; }
/** * Execute the command with the given arguments. * * @param args command specific arguments. * @return exit code. * @throws Exception if error occurs */
Execute the command with the given arguments
run
{ "repo_name": "rburke2233/librec", "path": "core/src/main/java/net/librec/tool/driver/DataDriver.java", "license": "gpl-3.0", "size": 4262 }
[ "java.io.FileInputStream", "java.util.Properties", "net.librec.conf.Configuration", "net.librec.data.model.TextDataModel", "org.apache.commons.cli.CommandLine", "org.apache.commons.cli.CommandLineParser", "org.apache.commons.cli.DefaultParser", "org.apache.commons.cli.Options" ]
import java.io.FileInputStream; import java.util.Properties; import net.librec.conf.Configuration; import net.librec.data.model.TextDataModel; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.Options;
import java.io.*; import java.util.*; import net.librec.conf.*; import net.librec.data.model.*; import org.apache.commons.cli.*;
[ "java.io", "java.util", "net.librec.conf", "net.librec.data", "org.apache.commons" ]
java.io; java.util; net.librec.conf; net.librec.data; org.apache.commons;
2,181,492
public void activar(){ if(!this.validateActivar()){ return; } this.setEstado(Estado.ACTIVO.getId()); DefDAOFactory.getCodEmiDAO().update(this); }
void function(){ if(!this.validateActivar()){ return; } this.setEstado(Estado.ACTIVO.getId()); DefDAOFactory.getCodEmiDAO().update(this); }
/** * Activa el CodEmi. Previamente valida la activacion. * */
Activa el CodEmi. Previamente valida la activacion
activar
{ "repo_name": "avdata99/SIAT", "path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/def/buss/bean/CodEmi.java", "license": "gpl-3.0", "size": 7548 }
[ "ar.gov.rosario.siat.def.buss.dao.DefDAOFactory", "coop.tecso.demoda.iface.model.Estado" ]
import ar.gov.rosario.siat.def.buss.dao.DefDAOFactory; import coop.tecso.demoda.iface.model.Estado;
import ar.gov.rosario.siat.def.buss.dao.*; import coop.tecso.demoda.iface.model.*;
[ "ar.gov.rosario", "coop.tecso.demoda" ]
ar.gov.rosario; coop.tecso.demoda;
2,368,820
@WebMethod(operationName = "GetExportRecordedDataState", action = "http://www.onvif.org/ver10/recording/wsdl/GetExportRecordedDataState") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "GetExportRecordedDataStateResponse", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl", partName = "parameters") public GetExportRecordedDataStateResponse getExportRecordedDataState( @WebParam(partName = "parameters", name = "GetExportRecordedDataState", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl") GetExportRecordedDataState parameters );
@WebMethod(operationName = STR, action = STRGetExportRecordedDataStateResponseSTRhttp: GetExportRecordedDataStateResponse function( @WebParam(partName = STR, name = STR, targetNamespace = "http: GetExportRecordedDataState parameters );
/** * Retrieves the status of selected ExportRecordedData operation. * */
Retrieves the status of selected ExportRecordedData operation
getExportRecordedDataState
{ "repo_name": "fpompermaier/onvif", "path": "onvif-ws-client/src/main/java/org/onvif/ver10/recording/wsdl/RecordingPort.java", "license": "apache-2.0", "size": 24757 }
[ "javax.jws.WebMethod", "javax.jws.WebParam" ]
import javax.jws.WebMethod; import javax.jws.WebParam;
import javax.jws.*;
[ "javax.jws" ]
javax.jws;
2,744,308
public Date getAccountRestrictedStatusDate() { return accountRestrictedStatusDate; }
Date function() { return accountRestrictedStatusDate; }
/** * Gets the accountRestrictedStatusDate attribute. * * @return Returns the accountRestrictedStatusDate */
Gets the accountRestrictedStatusDate attribute
getAccountRestrictedStatusDate
{ "repo_name": "kuali/kfs-git-training", "path": "src/main/java/org/kuali/kfs/coa/businessobject/Account.java", "license": "agpl-3.0", "size": 36161 }
[ "java.sql.Date" ]
import java.sql.Date;
import java.sql.*;
[ "java.sql" ]
java.sql;
962,603
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; }
AxisAlignedBB function(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; }
/** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */
Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been cleared to be reused)
getCollisionBoundingBoxFromPool
{ "repo_name": "NovaViper/ZeroQuest", "path": "1.7.10-src/common/zeroquest/block/portal/BlockDarkaxFire.java", "license": "apache-2.0", "size": 25521 }
[ "net.minecraft.util.AxisAlignedBB", "net.minecraft.world.World" ]
import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World;
import net.minecraft.util.*; import net.minecraft.world.*;
[ "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.util; net.minecraft.world;
2,715,534
ByteBuffer getRandomSubset(ByteBuffer src) { int len = src.remaining(); len = Math.min(4096, Math.min(len, 1 + random.nextInt(len))); ByteBuffer temp = ByteBuffer.allocate(len); src.get(temp.array()); return temp; }
ByteBuffer getRandomSubset(ByteBuffer src) { int len = src.remaining(); len = Math.min(4096, Math.min(len, 1 + random.nextInt(len))); ByteBuffer temp = ByteBuffer.allocate(len); src.get(temp.array()); return temp; }
/** * Get a buffer with a subset (the head) of the data of the source buffer. * * @param src the source buffer * @return a buffer with a subset of the data */
Get a buffer with a subset (the head) of the data of the source buffer
getRandomSubset
{ "repo_name": "vdr007/ThriftyPaxos", "path": "src/applications/h2/src/test/org/h2/test/utils/FilePathUnstable.java", "license": "apache-2.0", "size": 7384 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
995,553
public void maintain() { while (true) { final Reference ref = softQueue.poll(); if (ref == null) return; final Class type = instanceTypes.remove(ref); getPool(softInstances, type).remove(ref); } }
void function() { while (true) { final Reference ref = softQueue.poll(); if (ref == null) return; final Class type = instanceTypes.remove(ref); getPool(softInstances, type).remove(ref); } }
/** * Clears dead soft references from the various object pools. */
Clears dead soft references from the various object pools
maintain
{ "repo_name": "markmckenna/lib-java", "path": "src/main/java/com/lantopia/libjava/patterns/PoolingAllocator.java", "license": "mit", "size": 3277 }
[ "java.lang.ref.Reference" ]
import java.lang.ref.Reference;
import java.lang.ref.*;
[ "java.lang" ]
java.lang;
2,283,472
public static int extractPort(String address) { Pattern p = Pattern.compile(PORT_PATTERN); Matcher m = p.matcher(address); if (m.find()) { String match = m.group().substring(1); return Integer.parseInt(match); } return 0; }
static int function(String address) { Pattern p = Pattern.compile(PORT_PATTERN); Matcher m = p.matcher(address); if (m.find()) { String match = m.group().substring(1); return Integer.parseInt(match); } return 0; }
/** * Extracts the port from an addrees. * * @param address * @return */
Extracts the port from an addrees
extractPort
{ "repo_name": "alexeev/jboss-fuse-mirror", "path": "fabric/fabric-utils/src/main/java/io/fabric8/utils/Ports.java", "license": "apache-2.0", "size": 6243 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,334,671
@JSStaticFunction public static void setMaxInputSplitSize(final Context ctx, final Scriptable thisObj, final Object[] args, final Function func) { FileInputFormatHelper.setMaxInputSplitSize(TextInputFormat.class, ctx, thisObj, args); }
static void function(final Context ctx, final Scriptable thisObj, final Object[] args, final Function func) { FileInputFormatHelper.setMaxInputSplitSize(TextInputFormat.class, ctx, thisObj, args); }
/** * Java wrapper for {@link TextInputFormat#setMaxInputSplitSize(org.apache.hadoop.mapreduce.Job, long)}. * * @param ctx the JavaScript context * @param thisObj the 'this' object * @param args the function arguments * @param func the function being called */
Java wrapper for <code>TextInputFormat#setMaxInputSplitSize(org.apache.hadoop.mapreduce.Job, long)</code>
setMaxInputSplitSize
{ "repo_name": "apigee/lembos", "path": "src/main/java/io/apigee/lembos/node/types/TextInputFormatWrap.java", "license": "apache-2.0", "size": 7694 }
[ "org.apache.hadoop.mapreduce.lib.input.TextInputFormat", "org.mozilla.javascript.Context", "org.mozilla.javascript.Function", "org.mozilla.javascript.Scriptable" ]
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.Scriptable;
import org.apache.hadoop.mapreduce.lib.input.*; import org.mozilla.javascript.*;
[ "org.apache.hadoop", "org.mozilla.javascript" ]
org.apache.hadoop; org.mozilla.javascript;
1,143,692
Optional<ServletRequest> convert(ServletRequest request, ServletResponse response) throws IOException;
Optional<ServletRequest> convert(ServletRequest request, ServletResponse response) throws IOException;
/** * Check if the given request needs conversion and perform those conversions. * This method is supposed to create a mutable request and to modify and returns that one. However in case of * error it won't return the modified request, but it will handle directly the errors in the response. * * @param request the request that might contain parameter needing conversion * @param response the response used to redirect or do changes in case of conversion error * @return a mutable request with the converted parameters, or an empty optional in case of error * @throws IOException in case of problem to write an answer in the response */
Check if the given request needs conversion and perform those conversions. This method is supposed to create a mutable request and to modify and returns that one. However in case of error it won't return the modified request, but it will handle directly the errors in the response
convert
{ "repo_name": "xwiki/xwiki-platform", "path": "xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/converter/RequestParameterConverter.java", "license": "lgpl-2.1", "size": 2156 }
[ "java.io.IOException", "java.util.Optional", "javax.servlet.ServletRequest", "javax.servlet.ServletResponse" ]
import java.io.IOException; import java.util.Optional; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse;
import java.io.*; import java.util.*; import javax.servlet.*;
[ "java.io", "java.util", "javax.servlet" ]
java.io; java.util; javax.servlet;
2,101,261
PromotionRequest request = getPromotionRequest(targetRepo); String buildName = releaseInfo.getBuildName(); String buildNumber = releaseInfo.getBuildNumber(); logger.info("Promoting " + buildName + "/" + buildNumber + " to " + request.getTargetRepo()); RequestEntity<PromotionRequest> requestEntity = RequestEntity .post(URI.create(PROMOTION_URL + buildName + "/" + buildNumber)).contentType(MediaType.APPLICATION_JSON) .body(request); try { this.restTemplate.exchange(requestEntity, String.class); logger.debug("Promotion complete"); } catch (HttpClientErrorException ex) { boolean isAlreadyPromoted = isAlreadyPromoted(buildName, buildNumber, request.getTargetRepo()); if (isAlreadyPromoted) { logger.info("Already promoted."); } else { logger.info("Promotion failed."); throw ex; } } }
PromotionRequest request = getPromotionRequest(targetRepo); String buildName = releaseInfo.getBuildName(); String buildNumber = releaseInfo.getBuildNumber(); logger.info(STR + buildName + "/" + buildNumber + STR + request.getTargetRepo()); RequestEntity<PromotionRequest> requestEntity = RequestEntity .post(URI.create(PROMOTION_URL + buildName + "/" + buildNumber)).contentType(MediaType.APPLICATION_JSON) .body(request); try { this.restTemplate.exchange(requestEntity, String.class); logger.debug(STR); } catch (HttpClientErrorException ex) { boolean isAlreadyPromoted = isAlreadyPromoted(buildName, buildNumber, request.getTargetRepo()); if (isAlreadyPromoted) { logger.info(STR); } else { logger.info(STR); throw ex; } } }
/** * Move artifacts to a target repository in Artifactory. * @param targetRepo the targetRepo * @param releaseInfo the release information */
Move artifacts to a target repository in Artifactory
promote
{ "repo_name": "royclarkson/spring-boot", "path": "ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/artifactory/ArtifactoryService.java", "license": "apache-2.0", "size": 5897 }
[ "io.spring.concourse.releasescripts.artifactory.payload.PromotionRequest", "java.net.URI", "org.springframework.http.MediaType", "org.springframework.http.RequestEntity", "org.springframework.web.client.HttpClientErrorException" ]
import io.spring.concourse.releasescripts.artifactory.payload.PromotionRequest; import java.net.URI; import org.springframework.http.MediaType; import org.springframework.http.RequestEntity; import org.springframework.web.client.HttpClientErrorException;
import io.spring.concourse.releasescripts.artifactory.payload.*; import java.net.*; import org.springframework.http.*; import org.springframework.web.client.*;
[ "io.spring.concourse", "java.net", "org.springframework.http", "org.springframework.web" ]
io.spring.concourse; java.net; org.springframework.http; org.springframework.web;
1,191,769
private void connectionLost() { Log.d(TAG, "BluetoothManager :: connectionLost()"); setState(STATE_LISTEN); // Send a failure message back to the Activity // WARNING: This makes too many toast. // Reserve re-connect timer reserveRetryConnect(); }
void function() { Log.d(TAG, STR); setState(STATE_LISTEN); reserveRetryConnect(); }
/** * Indicate that the connection was lost and notify the UI Activity. */
Indicate that the connection was lost and notify the UI Activity
connectionLost
{ "repo_name": "godstale/BT-Connection-Template", "path": "BTCTemplate/src/com/hardcopy/btctemplate/bluetooth/BluetoothManager.java", "license": "apache-2.0", "size": 18952 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,968,666
//---------------------------------------------------------------------------- public ICloneService getCloneService() throws CloneException { if(textTableCellCloneService == null) textTableCellCloneService = new TextTableCellCloneService(this); return textTableCellCloneService; }
ICloneService function() throws CloneException { if(textTableCellCloneService == null) textTableCellCloneService = new TextTableCellCloneService(this); return textTableCellCloneService; }
/** * Gets the clone service of the element. * * @return the clone service * * @throws CloneException if the clone service could not be returned * * @author Markus Krüger */
Gets the clone service of the element
getCloneService
{ "repo_name": "LibreOffice/noa-libre", "path": "src/ag/ion/bion/officelayer/internal/text/TextTableCell.java", "license": "lgpl-2.1", "size": 17852 }
[ "ag.ion.bion.officelayer.clone.CloneException", "ag.ion.bion.officelayer.clone.ICloneService", "ag.ion.bion.officelayer.internal.text.table.TextTableCellCloneService" ]
import ag.ion.bion.officelayer.clone.CloneException; import ag.ion.bion.officelayer.clone.ICloneService; import ag.ion.bion.officelayer.internal.text.table.TextTableCellCloneService;
import ag.ion.bion.officelayer.clone.*; import ag.ion.bion.officelayer.internal.text.table.*;
[ "ag.ion.bion" ]
ag.ion.bion;
1,871,454
protected void expose(Request request, Request actual) { // Ensure that this request came in on an SSLSocket if (actual.getSocket() == null) return; if (!(actual.getSocket() instanceof SSLSocket)) return; SSLSocket socket = (SSLSocket) actual.getSocket(); // Look up the current SSLSession SSLSession session = socket.getSession(); if (session == null) return; // if (debug >= 2) // log(" expose: Has current SSLSession"); // Expose the cipher suite and key size String cipherSuite = session.getCipherSuite(); if (cipherSuite != null) request.getRequest().setAttribute(Globals.CIPHER_SUITE_ATTR, cipherSuite); Integer keySize = (Integer) session.getValue(Globals.KEY_SIZE_ATTR); if (keySize == null) { int size = 0; for (int i = 0; i < ciphers.length; i++) { if (cipherSuite.indexOf(ciphers[i].phrase) >= 0) { size = ciphers[i].keySize; break; } } keySize = new Integer(size); session.putValue(Globals.KEY_SIZE_ATTR, keySize); } request.getRequest().setAttribute(Globals.KEY_SIZE_ATTR, keySize); // if (debug >= 2) // log(" expose: Has cipher suite " + cipherSuite + // " and key size " + keySize); // Expose ssl_session (getId) byte [] ssl_session = session.getId(); if (ssl_session!=null) { StringBuffer buf=new StringBuffer(""); for(int x=0; x<ssl_session.length; x++) { String digit=Integer.toHexString((int)ssl_session[x]); if (digit.length()<2) buf.append('0'); if (digit.length()>2) digit=digit.substring(digit.length()-2); buf.append(digit); } request.getRequest().setAttribute( "javax.servlet.request.ssl_session", buf.toString()); } // If we have cached certificates, return them Object cached = session.getValue(Globals.CERTIFICATES_ATTR); if (cached != null) { // if (debug >= 2) // log(" expose: Has cached certificates"); request.getRequest().setAttribute(Globals.CERTIFICATES_ATTR, cached); return; } // Convert JSSE's certificate format to the ones we need X509Certificate jsseCerts[] = null; java.security.cert.X509Certificate x509Certs[] = null; try { jsseCerts = session.getPeerCertificateChain(); if (jsseCerts == null) jsseCerts = new X509Certificate[0]; x509Certs = new java.security.cert.X509Certificate[jsseCerts.length]; for (int i = 0; i < x509Certs.length; i++) { byte buffer[] = jsseCerts[i].getEncoded(); CertificateFactory cf = CertificateFactory.getInstance("X.509"); ByteArrayInputStream stream = new ByteArrayInputStream(buffer); x509Certs[i] = (java.security.cert.X509Certificate) cf.generateCertificate(stream); } } catch (Throwable t) { return; } // Expose these certificates as a request attribute if ((x509Certs == null) || (x509Certs.length < 1)) return; session.putValue(Globals.CERTIFICATES_ATTR, x509Certs); log(" expose: Exposing converted certificates"); request.getRequest().setAttribute(Globals.CERTIFICATES_ATTR, x509Certs); }
void function(Request request, Request actual) { if (actual.getSocket() == null) return; if (!(actual.getSocket() instanceof SSLSocket)) return; SSLSocket socket = (SSLSocket) actual.getSocket(); SSLSession session = socket.getSession(); if (session == null) return; String cipherSuite = session.getCipherSuite(); if (cipherSuite != null) request.getRequest().setAttribute(Globals.CIPHER_SUITE_ATTR, cipherSuite); Integer keySize = (Integer) session.getValue(Globals.KEY_SIZE_ATTR); if (keySize == null) { int size = 0; for (int i = 0; i < ciphers.length; i++) { if (cipherSuite.indexOf(ciphers[i].phrase) >= 0) { size = ciphers[i].keySize; break; } } keySize = new Integer(size); session.putValue(Globals.KEY_SIZE_ATTR, keySize); } request.getRequest().setAttribute(Globals.KEY_SIZE_ATTR, keySize); byte [] ssl_session = session.getId(); if (ssl_session!=null) { StringBuffer buf=new StringBuffer(STRjavax.servlet.request.ssl_sessionSTRX.509STR expose: Exposing converted certificates"); request.getRequest().setAttribute(Globals.CERTIFICATES_ATTR, x509Certs); }
/** * Expose the certificate chain for this request, if there is one. * * @param request The possibly wrapped Request being processed * @param actual The actual underlying Request object */
Expose the certificate chain for this request, if there is one
expose
{ "repo_name": "devjin24/howtomcatworks", "path": "bookrefer/jakarta-tomcat-4.1.12-src/catalina/src/share/org/apache/catalina/valves/CertificatesValve.java", "license": "apache-2.0", "size": 20065 }
[ "javax.net.ssl.SSLSession", "javax.net.ssl.SSLSocket", "org.apache.catalina.Globals", "org.apache.catalina.Request" ]
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import org.apache.catalina.Globals; import org.apache.catalina.Request;
import javax.net.ssl.*; import org.apache.catalina.*;
[ "javax.net", "org.apache.catalina" ]
javax.net; org.apache.catalina;
2,704,672
public void testNullEnum() { String example = null; try { CompassDirection temp = CompassDirection.valueForString(example); assertNull("Result of valueForString should be null.", temp); } catch (NullPointerException exception) { fail("Null string throws NullPointerException."); } }
void function() { String example = null; try { CompassDirection temp = CompassDirection.valueForString(example); assertNull(STR, temp); } catch (NullPointerException exception) { fail(STR); } }
/** * Verifies that a null assignment is invalid. */
Verifies that a null assignment is invalid
testNullEnum
{ "repo_name": "smartdevicelink/sdl_android", "path": "android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CompassDirectionTests.java", "license": "bsd-3-clause", "size": 3665 }
[ "com.smartdevicelink.proxy.rpc.enums.CompassDirection" ]
import com.smartdevicelink.proxy.rpc.enums.CompassDirection;
import com.smartdevicelink.proxy.rpc.enums.*;
[ "com.smartdevicelink.proxy" ]
com.smartdevicelink.proxy;
745,489
@ServiceMethod(returns = ReturnType.SINGLE) public BackupShortTermRetentionPolicyInner get( String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { return getAsync(resourceGroupName, serverName, databaseName, policyName).block(); }
@ServiceMethod(returns = ReturnType.SINGLE) BackupShortTermRetentionPolicyInner function( String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { return getAsync(resourceGroupName, serverName, databaseName, policyName).block(); }
/** * Gets a database's short term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value * from the Azure Resource Manager API or the portal. * @param serverName The name of the server. * @param databaseName The name of the database. * @param policyName The policy name. Should always be "default". * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a database's short term retention policy. */
Gets a database's short term retention policy
get
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/implementation/BackupShortTermRetentionPoliciesClientImpl.java", "license": "mit", "size": 71299 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.sql.fluent.models.BackupShortTermRetentionPolicyInner", "com.azure.resourcemanager.sql.models.ShortTermRetentionPolicyName" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.sql.fluent.models.BackupShortTermRetentionPolicyInner; import com.azure.resourcemanager.sql.models.ShortTermRetentionPolicyName;
import com.azure.core.annotation.*; import com.azure.resourcemanager.sql.fluent.models.*; import com.azure.resourcemanager.sql.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,429,286
public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { ImageNode imageNode = (ImageNode)super.createGraphicsNode(ctx, e); if (imageNode == null) { return null; } associateSVGContext(ctx, e, imageNode); hitCheckChildren = false; GraphicsNode node = buildImageGraphicsNode(ctx,e); if (node == null) { SVGImageElement ie = (SVGImageElement) e; String uriStr = ie.getHref().getAnimVal(); throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } imageNode.setImage(node); imageNode.setHitCheckChildren(hitCheckChildren); // 'image-rendering' and 'color-rendering' RenderingHints hints = null; hints = CSSUtilities.convertImageRendering(e, hints); hints = CSSUtilities.convertColorRendering(e, hints); if (hints != null) imageNode.setRenderingHints(hints); return imageNode; }
GraphicsNode function(BridgeContext ctx, Element e) { ImageNode imageNode = (ImageNode)super.createGraphicsNode(ctx, e); if (imageNode == null) { return null; } associateSVGContext(ctx, e, imageNode); hitCheckChildren = false; GraphicsNode node = buildImageGraphicsNode(ctx,e); if (node == null) { SVGImageElement ie = (SVGImageElement) e; String uriStr = ie.getHref().getAnimVal(); throw new BridgeException(ctx, e, ERR_URI_IMAGE_INVALID, new Object[] {uriStr}); } imageNode.setImage(node); imageNode.setHitCheckChildren(hitCheckChildren); RenderingHints hints = null; hints = CSSUtilities.convertImageRendering(e, hints); hints = CSSUtilities.convertColorRendering(e, hints); if (hints != null) imageNode.setRenderingHints(hints); return imageNode; }
/** * Creates a graphics node using the specified BridgeContext and for the * specified element. * * @param ctx the bridge context to use * @param e the element that describes the graphics node to build * @return a graphics node that represents the specified element */
Creates a graphics node using the specified BridgeContext and for the specified element
createGraphicsNode
{ "repo_name": "iconfinder/batik", "path": "sources/org/apache/batik/bridge/SVGImageElementBridge.java", "license": "apache-2.0", "size": 38290 }
[ "java.awt.RenderingHints", "org.apache.batik.gvt.GraphicsNode", "org.apache.batik.gvt.ImageNode", "org.w3c.dom.Element", "org.w3c.dom.svg.SVGImageElement" ]
import java.awt.RenderingHints; import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.ImageNode; import org.w3c.dom.Element; import org.w3c.dom.svg.SVGImageElement;
import java.awt.*; import org.apache.batik.gvt.*; import org.w3c.dom.*; import org.w3c.dom.svg.*;
[ "java.awt", "org.apache.batik", "org.w3c.dom" ]
java.awt; org.apache.batik; org.w3c.dom;
1,198,735
public void testUnusedJoinDoesNotAffectOtherJoins() { EntityManager em = createEntityManager(); beginTransaction(em); try{ CriteriaBuilder qbuilder = em.getCriteriaBuilder(); CriteriaQuery<Employee> cquery = qbuilder.createQuery(Employee.class); Root<Employee> customer = cquery.from(Employee.class); Path pathToIgnore = customer.get("manager").get("address"); Join manager = customer.join("manager", JoinType.LEFT); TypedQuery<Employee> tquery = em.createQuery(cquery); List<Employee> result = tquery.getResultList(); assertFalse ("No results found", result.isEmpty()); long count = (Long)em.createQuery("Select count(e) from Employee e ").getSingleResult(); assertTrue("Incorrect number of results returned", result.size() == count); } finally { rollbackTransaction(em); closeEntityManager(em); } }
void function() { EntityManager em = createEntityManager(); beginTransaction(em); try{ CriteriaBuilder qbuilder = em.getCriteriaBuilder(); CriteriaQuery<Employee> cquery = qbuilder.createQuery(Employee.class); Root<Employee> customer = cquery.from(Employee.class); Path pathToIgnore = customer.get(STR).get(STR); Join manager = customer.join(STR, JoinType.LEFT); TypedQuery<Employee> tquery = em.createQuery(cquery); List<Employee> result = tquery.getResultList(); assertFalse (STR, result.isEmpty()); long count = (Long)em.createQuery(STR).getSingleResult(); assertTrue(STR, result.size() == count); } finally { rollbackTransaction(em); closeEntityManager(em); } }
/** * bug 413892: tests that unused inner join expressions from root.get("manager") do not affect explicit out joins * created from root.join("manager"). */
bug 413892: tests that unused inner join expressions from root.get("manager") do not affect explicit out joins created from root.join("manager")
testUnusedJoinDoesNotAffectOtherJoins
{ "repo_name": "gameduell/eclipselink.runtime", "path": "jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/criteria/AdvancedCriteriaQueryTestSuite.java", "license": "epl-1.0", "size": 90112 }
[ "java.util.List", "javax.persistence.EntityManager", "javax.persistence.TypedQuery", "javax.persistence.criteria.CriteriaBuilder", "javax.persistence.criteria.CriteriaQuery", "javax.persistence.criteria.Join", "javax.persistence.criteria.JoinType", "javax.persistence.criteria.Path", "javax.persistence.criteria.Root", "org.eclipse.persistence.testing.models.jpa.advanced.Employee" ]
import java.util.List; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Join; import javax.persistence.criteria.JoinType; import javax.persistence.criteria.Path; import javax.persistence.criteria.Root; import org.eclipse.persistence.testing.models.jpa.advanced.Employee;
import java.util.*; import javax.persistence.*; import javax.persistence.criteria.*; import org.eclipse.persistence.testing.models.jpa.advanced.*;
[ "java.util", "javax.persistence", "org.eclipse.persistence" ]
java.util; javax.persistence; org.eclipse.persistence;
653,912
public void testSingleVM(int config, boolean endorsed) throws Exception { SubProcess server = null; try { System.out.println("Starting test server"); server = startProcess("org.apache.harmony.rmi.ConnectionTest", CHILD_ID, config, endorsed); server.pipeError(); server.closeOutput(); System.out.println("Expecting READY from server"); server.expect(); server.pipeInput(); } finally { if (server != null) { System.out.println("Destroying server"); server.destroy(); } } }
void function(int config, boolean endorsed) throws Exception { SubProcess server = null; try { System.out.println(STR); server = startProcess(STR, CHILD_ID, config, endorsed); server.pipeError(); server.closeOutput(); System.out.println(STR); server.expect(); server.pipeInput(); } finally { if (server != null) { System.out.println(STR); server.destroy(); } } }
/** * Tests RMI data exchange in one separate VM. * * @param config * Configuration to set environment for. * * @param endorsed * If endorsedDirs and bootClassPath * should be propagated to test VM. * * @throws Exception * If some error occurs. */
Tests RMI data exchange in one separate VM
testSingleVM
{ "repo_name": "shannah/cn1", "path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java", "license": "gpl-2.0", "size": 15677 }
[ "org.apache.harmony.rmi.common.SubProcess" ]
import org.apache.harmony.rmi.common.SubProcess;
import org.apache.harmony.rmi.common.*;
[ "org.apache.harmony" ]
org.apache.harmony;
2,594,743
OpenCmsTestProperties.initialize(org.opencms.test.AllTests.TEST_PROPERTIES_PATH); TestSuite suite = new TestSuite(); suite.setName(TestCmsSolrCollector.class.getName()); suite.addTest(new TestCmsSolrCollector("testByQuery")); suite.addTest(new TestCmsSolrCollector("testByContext")); suite.addTest(new TestCmsSolrCollector("testByContextWithQuery")); TestSetup wrapper = new TestSetup(suite) {
OpenCmsTestProperties.initialize(org.opencms.test.AllTests.TEST_PROPERTIES_PATH); TestSuite suite = new TestSuite(); suite.setName(TestCmsSolrCollector.class.getName()); suite.addTest(new TestCmsSolrCollector(STR)); suite.addTest(new TestCmsSolrCollector(STR)); suite.addTest(new TestCmsSolrCollector(STR)); TestSetup wrapper = new TestSetup(suite) {
/** * Test suite for this test class.<p> * * @return the test suite */
Test suite for this test class
suite
{ "repo_name": "ggiudetti/opencms-core", "path": "test/org/opencms/search/solr/TestCmsSolrCollector.java", "license": "lgpl-2.1", "size": 6606 }
[ "junit.extensions.TestSetup", "junit.framework.TestSuite", "org.opencms.test.OpenCmsTestProperties" ]
import junit.extensions.TestSetup; import junit.framework.TestSuite; import org.opencms.test.OpenCmsTestProperties;
import junit.extensions.*; import junit.framework.*; import org.opencms.test.*;
[ "junit.extensions", "junit.framework", "org.opencms.test" ]
junit.extensions; junit.framework; org.opencms.test;
2,695,752
public TileMap build() { // the region manager RegionManager mgr = World.getWorld().getRegionManager(); // a setQuestStage of regions covered by our center position + radius Set<Region> coveredRegions = new HashSet<Region>(); // populates the setQuestStage of covered regions for(int x = (-radius-1); x <= (radius+1); x++) { for(int y = (-radius-1); y <= (radius+1); y++) { Location loc = centerPosition.transform(x, y, 0); coveredRegions.add(mgr.getRegionByLocation(loc)); } } // calculate top left positions int topX = centerPosition.getX() - radius; int topY = centerPosition.getY() - radius; // now fills in the tile map for(Region region : coveredRegions) { for(GameObject obj : region.getGameObjects()) { if(!obj.getDefinition().isSolid()) { continue; } Location loc = obj.getLocation(); if(loc.getZ() != centerPosition.getZ()) { continue; } int sizeX = obj.getDefinition().getSizeX(); int sizeY = obj.getDefinition().getSizeY(); // position in the tile map int posX = loc.getX() - topX; int posY = loc.getY() - topY; if(obj.getDirection() == 1 || obj.getDirection() == 3) { // switch sizes if rotated int temp = sizeX; sizeX = sizeY; sizeY = temp; } if((posX + sizeX) < 0 || (posY + sizeY) < 0 || (posX) >= tileMap.getWidth() || (posY) >= tileMap.getHeight()) { continue; } if(obj.getType() >= 0 && obj.getType() <= 3) { // walls if(posX >= 0 && posY >= 0 && posX < tileMap.getWidth() && posY < tileMap.getHeight()) { //int finalRotation = (obj.getType() + obj.getRotation()) % 4; int finalRotation = obj.getDirection(); // finalRotation - 0 = west, 1 = north, 2 = east, 3 = south Tile t = tileMap.getTile(posX, posY); int flags = t.getTraversalMask(); // clear flags if(finalRotation == 0) { flags &= ~Tile.WEST_TRAVERSAL_PERMITTED; } else if(finalRotation == 1) { flags &= ~Tile.NORTH_TRAVERSAL_PERMITTED; } else if(finalRotation == 2) { flags &= ~Tile.EAST_TRAVERSAL_PERMITTED; } else { flags &= ~Tile.SOUTH_TRAVERSAL_PERMITTED; } if(flags != t.getTraversalMask()) { tileMap.setTile(posX, posY, new Tile(flags)); } } } else if(obj.getType() == 9) { // diagonal walls if(posX >= 0 && posY >= 0 && posX < tileMap.getWidth() && posY < tileMap.getHeight()) { tileMap.setTile(posX, posY, TileMap.SOLID_TILE); } } else if(obj.getType() == 10 || obj.getType() == 11) { // world objects for(int offX = 0; offX <= sizeX; offX++) { for(int offY = 0; offY <= sizeY; offY++) { int x = offX + posX; int y = offY + posY; if(x >= 0 && y >= 0 && x < tileMap.getWidth() && y < tileMap.getHeight()) { tileMap.setTile(x, y, TileMap.SOLID_TILE); } } } } else if(obj.getType() == 22) { // floor decoration if(obj.getDefinition().hasActions()) { if(posX >= 0 && posY >= 0 && posX < tileMap.getWidth() && posY < tileMap.getHeight()) { tileMap.setTile(posX, posY, TileMap.SOLID_TILE); } } } else { // 4-8 are wall decorations and 12-21 are roofs // we can ignore those } } } return tileMap; }
TileMap function() { RegionManager mgr = World.getWorld().getRegionManager(); Set<Region> coveredRegions = new HashSet<Region>(); for(int x = (-radius-1); x <= (radius+1); x++) { for(int y = (-radius-1); y <= (radius+1); y++) { Location loc = centerPosition.transform(x, y, 0); coveredRegions.add(mgr.getRegionByLocation(loc)); } } int topX = centerPosition.getX() - radius; int topY = centerPosition.getY() - radius; for(Region region : coveredRegions) { for(GameObject obj : region.getGameObjects()) { if(!obj.getDefinition().isSolid()) { continue; } Location loc = obj.getLocation(); if(loc.getZ() != centerPosition.getZ()) { continue; } int sizeX = obj.getDefinition().getSizeX(); int sizeY = obj.getDefinition().getSizeY(); int posX = loc.getX() - topX; int posY = loc.getY() - topY; if(obj.getDirection() == 1 obj.getDirection() == 3) { int temp = sizeX; sizeX = sizeY; sizeY = temp; } if((posX + sizeX) < 0 (posY + sizeY) < 0 (posX) >= tileMap.getWidth() (posY) >= tileMap.getHeight()) { continue; } if(obj.getType() >= 0 && obj.getType() <= 3) { if(posX >= 0 && posY >= 0 && posX < tileMap.getWidth() && posY < tileMap.getHeight()) { int finalRotation = obj.getDirection(); Tile t = tileMap.getTile(posX, posY); int flags = t.getTraversalMask(); if(finalRotation == 0) { flags &= ~Tile.WEST_TRAVERSAL_PERMITTED; } else if(finalRotation == 1) { flags &= ~Tile.NORTH_TRAVERSAL_PERMITTED; } else if(finalRotation == 2) { flags &= ~Tile.EAST_TRAVERSAL_PERMITTED; } else { flags &= ~Tile.SOUTH_TRAVERSAL_PERMITTED; } if(flags != t.getTraversalMask()) { tileMap.setTile(posX, posY, new Tile(flags)); } } } else if(obj.getType() == 9) { if(posX >= 0 && posY >= 0 && posX < tileMap.getWidth() && posY < tileMap.getHeight()) { tileMap.setTile(posX, posY, TileMap.SOLID_TILE); } } else if(obj.getType() == 10 obj.getType() == 11) { for(int offX = 0; offX <= sizeX; offX++) { for(int offY = 0; offY <= sizeY; offY++) { int x = offX + posX; int y = offY + posY; if(x >= 0 && y >= 0 && x < tileMap.getWidth() && y < tileMap.getHeight()) { tileMap.setTile(x, y, TileMap.SOLID_TILE); } } } } else if(obj.getType() == 22) { if(obj.getDefinition().hasActions()) { if(posX >= 0 && posY >= 0 && posX < tileMap.getWidth() && posY < tileMap.getHeight()) { tileMap.setTile(posX, posY, TileMap.SOLID_TILE); } } } else { } } } return tileMap; }
/** * Builds the tile map. * @return The built tile map. */
Builds the tile map
build
{ "repo_name": "kewle003/hyperion", "path": "src/org/rs2server/rs2/pf/TileMapBuilder.java", "license": "mit", "size": 4584 }
[ "java.util.HashSet", "java.util.Set", "org.rs2server.rs2.model.GameObject", "org.rs2server.rs2.model.Location", "org.rs2server.rs2.model.World", "org.rs2server.rs2.model.region.Region", "org.rs2server.rs2.model.region.RegionManager" ]
import java.util.HashSet; import java.util.Set; import org.rs2server.rs2.model.GameObject; import org.rs2server.rs2.model.Location; import org.rs2server.rs2.model.World; import org.rs2server.rs2.model.region.Region; import org.rs2server.rs2.model.region.RegionManager;
import java.util.*; import org.rs2server.rs2.model.*; import org.rs2server.rs2.model.region.*;
[ "java.util", "org.rs2server.rs2" ]
java.util; org.rs2server.rs2;
2,465,807
@Test public void nameTest() { NegativeBoundHiveDate.NegativeBoundHiveDateTag tag = new NegativeBoundHiveDate.NegativeBoundHiveDateTag(); tag.setName("date_test"); Assert.assertEquals(tag.getName(), "date_test"); tag.setName("date_test2"); Assert.assertEquals(tag.getName(), "date_test2"); }
void function() { NegativeBoundHiveDate.NegativeBoundHiveDateTag tag = new NegativeBoundHiveDate.NegativeBoundHiveDateTag(); tag.setName(STR); Assert.assertEquals(tag.getName(), STR); tag.setName(STR); Assert.assertEquals(tag.getName(), STR); }
/** * test for setName() and getName() */
test for setName() and getName()
nameTest
{ "repo_name": "SamerAdra/DataGenerator", "path": "dg-core/src/test/java/org/finra/datagenerator/engine/scxml/tags/boundary/NegativeBoundHiveDateTest.java", "license": "apache-2.0", "size": 5306 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
673,661
public synchronized SlaveStatus getSlaveStatusAvailable() throws SlaveUnavailableException { if (isAvailable()) { return getSlaveStatus(); } throw new SlaveUnavailableException("Slave is not online"); }
synchronized SlaveStatus function() throws SlaveUnavailableException { if (isAvailable()) { return getSlaveStatus(); } throw new SlaveUnavailableException(STR); }
/** * Returns the RemoteSlave's stored SlaveStatus, will not return a status * before remerge() is completed */
Returns the RemoteSlave's stored SlaveStatus, will not return a status before remerge() is completed
getSlaveStatusAvailable
{ "repo_name": "g2x3k/Drftpd2Stable", "path": "src/org/drftpd/master/RemoteSlave.java", "license": "gpl-2.0", "size": 34816 }
[ "net.sf.drftpd.SlaveUnavailableException", "org.drftpd.slave.SlaveStatus" ]
import net.sf.drftpd.SlaveUnavailableException; import org.drftpd.slave.SlaveStatus;
import net.sf.drftpd.*; import org.drftpd.slave.*;
[ "net.sf.drftpd", "org.drftpd.slave" ]
net.sf.drftpd; org.drftpd.slave;
838,281
//----------------------------------------------------------------------- private static String buildMessage(final String message, final int maxErrors, final Bean expected, final Bean actual) { List<String> diffs = new ArrayList<String>(); buildMessage(diffs, "", expected, actual); StringBuilder buf = new StringBuilder(); buf.append(message != null ? message + ": " : ""); buf.append("Bean did not equal expected. Differences:"); int size = diffs.size(); if (size > maxErrors) { diffs = diffs.subList(0, maxErrors); } for (String diff : diffs) { buf.append('\n').append(diff); } if (size > maxErrors) { buf.append("\n...and " + (size - 10) + " more differences"); } return buf.toString(); }
static String function(final String message, final int maxErrors, final Bean expected, final Bean actual) { List<String> diffs = new ArrayList<String>(); buildMessage(diffs, STR: STRSTRBean did not equal expected. Differences:STR\n...and STR more differences"); } return buf.toString(); }
/** * Compares the two beans. * * @param message the message, may be null * @param maxErrors the maximum number of errors to report * @param expected the expected value, not null * @param actual the actual value, not null * @return the message, not null */
Compares the two beans
buildMessage
{ "repo_name": "fengshao0907/joda-beans", "path": "src/main/java/org/joda/beans/test/BeanComparisonError.java", "license": "apache-2.0", "size": 6654 }
[ "java.util.ArrayList", "java.util.List", "org.joda.beans.Bean" ]
import java.util.ArrayList; import java.util.List; import org.joda.beans.Bean;
import java.util.*; import org.joda.beans.*;
[ "java.util", "org.joda.beans" ]
java.util; org.joda.beans;
574,406
@Nullable public Artifact createInstrumentationMetadata(Artifact outputJar, JavaCompilationArtifacts.Builder javaArtifactsBuilder) { // If we need to instrument the jar, add additional output (the coverage metadata file) to the // JavaCompileAction. Artifact instrumentationMetadata = null; if (shouldInstrumentJar()) { instrumentationMetadata = createInstrumentationMetadataArtifact( getRuleContext(), outputJar); if (instrumentationMetadata != null) { javaArtifactsBuilder.addInstrumentationMetadata(instrumentationMetadata); } } return instrumentationMetadata; }
Artifact function(Artifact outputJar, JavaCompilationArtifacts.Builder javaArtifactsBuilder) { Artifact instrumentationMetadata = null; if (shouldInstrumentJar()) { instrumentationMetadata = createInstrumentationMetadataArtifact( getRuleContext(), outputJar); if (instrumentationMetadata != null) { javaArtifactsBuilder.addInstrumentationMetadata(instrumentationMetadata); } } return instrumentationMetadata; }
/** * Creates the instrumentation metadata artifact if needed. * * @return the instrumentation metadata artifact or null if instrumentation is * disabled */
Creates the instrumentation metadata artifact if needed
createInstrumentationMetadata
{ "repo_name": "snnn/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java", "license": "apache-2.0", "size": 34730 }
[ "com.google.devtools.build.lib.actions.Artifact" ]
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.*;
[ "com.google.devtools" ]
com.google.devtools;
2,128,246
protected List<NamedRelatedResourceRep> getList(String path, Object... args) { SnapshotList response = client.get(SnapshotList.class, path, args); return defaultList(response.getSnapList()); }
List<NamedRelatedResourceRep> function(String path, Object... args) { SnapshotList response = client.get(SnapshotList.class, path, args); return defaultList(response.getSnapList()); }
/** * Gets a list of block snapshot references from the given URL (path + args). * * @param path * the path to get. * @param args * the arguments for the path. * @return the list of snapshot references. */
Gets a list of block snapshot references from the given URL (path + args)
getList
{ "repo_name": "emcvipr/controller-client-java", "path": "client/src/main/java/com/emc/vipr/client/core/BlockSnapshots.java", "license": "apache-2.0", "size": 14912 }
[ "com.emc.storageos.model.NamedRelatedResourceRep", "com.emc.storageos.model.SnapshotList", "com.emc.vipr.client.core.util.ResourceUtils", "java.util.List" ]
import com.emc.storageos.model.NamedRelatedResourceRep; import com.emc.storageos.model.SnapshotList; import com.emc.vipr.client.core.util.ResourceUtils; import java.util.List;
import com.emc.storageos.model.*; import com.emc.vipr.client.core.util.*; import java.util.*;
[ "com.emc.storageos", "com.emc.vipr", "java.util" ]
com.emc.storageos; com.emc.vipr; java.util;
57,836
public UtteranceProcessor getPitchmarkGenerator() throws IOException { return new DiphonePitchmarkGenerator(); }
UtteranceProcessor function() throws IOException { return new DiphonePitchmarkGenerator(); }
/** * Returns the pitch mark generator to be used by this voice. * Derived voices typically override this to customize behaviors. * This voice uses a DiphonePitchMark generator to generate * pitchmarks. * * @return the pitchmark processor * * @throws IOException if an IO error occurs while getting * processor */
Returns the pitch mark generator to be used by this voice. Derived voices typically override this to customize behaviors. This voice uses a DiphonePitchMark generator to generate pitchmarks
getPitchmarkGenerator
{ "repo_name": "edwardtoday/PolyU_MScST", "path": "COMP5517/JavaSpeech/freetts-1.2.2-src/freetts-1.2.2/com/sun/speech/freetts/en/us/CMUDiphoneVoice.java", "license": "mit", "size": 6818 }
[ "com.sun.speech.freetts.UtteranceProcessor", "com.sun.speech.freetts.diphone.DiphonePitchmarkGenerator", "java.io.IOException" ]
import com.sun.speech.freetts.UtteranceProcessor; import com.sun.speech.freetts.diphone.DiphonePitchmarkGenerator; import java.io.IOException;
import com.sun.speech.freetts.*; import com.sun.speech.freetts.diphone.*; import java.io.*;
[ "com.sun.speech", "java.io" ]
com.sun.speech; java.io;
39,265
@XmlTransient public Cell[][] getMap() { return map; }
Cell[][] function() { return map; }
/** * Gets the full current city map. * * @return the current city map. */
Gets the full current city map
getMap
{ "repo_name": "odhranroche/imas", "path": "src/cat/urv/imas/onthology/GameSettings.java", "license": "gpl-3.0", "size": 6896 }
[ "cat.urv.imas.map.Cell" ]
import cat.urv.imas.map.Cell;
import cat.urv.imas.map.*;
[ "cat.urv.imas" ]
cat.urv.imas;
2,147,661
public AbstractBindingBuilder methods(Iterable<HttpMethod> methods) { requireNonNull(methods, "methods"); checkArgument(!Iterables.isEmpty(methods), "methods can't be empty."); this.methods = Sets.immutableEnumSet(methods); return this; } /** * Sets {@link MediaType}s that an {@link HttpService} will consume. If not set, the {@link HttpService}
AbstractBindingBuilder function(Iterable<HttpMethod> methods) { requireNonNull(methods, STR); checkArgument(!Iterables.isEmpty(methods), STR); this.methods = Sets.immutableEnumSet(methods); return this; } /** * Sets {@link MediaType}s that an {@link HttpService} will consume. If not set, the {@link HttpService}
/** * Sets the {@link HttpMethod}s that an {@link HttpService} will support. If not set, * {@link HttpMethod#knownMethods()}s are set. * * @see #path(String) * @see #pathPrefix(String) */
Sets the <code>HttpMethod</code>s that an <code>HttpService</code> will support. If not set, <code>HttpMethod#knownMethods()</code>s are set
methods
{ "repo_name": "line/armeria", "path": "core/src/main/java/com/linecorp/armeria/server/AbstractBindingBuilder.java", "license": "apache-2.0", "size": 20864 }
[ "com.google.common.base.Preconditions", "com.google.common.collect.Iterables", "com.google.common.collect.Sets", "com.linecorp.armeria.common.HttpMethod", "com.linecorp.armeria.common.MediaType", "java.util.Objects" ]
import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; import com.linecorp.armeria.common.HttpMethod; import com.linecorp.armeria.common.MediaType; import java.util.Objects;
import com.google.common.base.*; import com.google.common.collect.*; import com.linecorp.armeria.common.*; import java.util.*;
[ "com.google.common", "com.linecorp.armeria", "java.util" ]
com.google.common; com.linecorp.armeria; java.util;
2,581,522
public void receive(IOObject object);
void function(IOObject object);
/** * Receives data from the output port. Throws an {@link PortException} if data has already been * set. (Called by {@link OuptutPort#deliver(Object)} . * */
Receives data from the output port. Throws an <code>PortException</code> if data has already been set. (Called by <code>OuptutPort#deliver(Object)</code> .
receive
{ "repo_name": "boob-sbcm/3838438", "path": "src/main/java/com/rapidminer/operator/ports/InputPort.java", "license": "agpl-3.0", "size": 2999 }
[ "com.rapidminer.operator.IOObject" ]
import com.rapidminer.operator.IOObject;
import com.rapidminer.operator.*;
[ "com.rapidminer.operator" ]
com.rapidminer.operator;
613,192
@Override public List<String> resolveValues(TemplateVariable variable, XtextTemplateContext xtextTemplateContext) { Resource currentResource = xtextTemplateContext.getContentAssistContext().getCurrentModel().eResource(); SadlModelManager visitor = null; if (currentResource == null) { Iterator<EObject> itr = xtextTemplateContext.getContentAssistContext().getCurrentModel().eContents().iterator(); while (itr.hasNext()) { EObject obj = itr.next(); if (obj instanceof ModelName) { String modelUri = ((ModelName)obj).getBaseUri(); visitor = sadlModelManagerProvider.get(); break; } } IDocument doc = xtextTemplateContext.getDocument(); if (doc instanceof XtextDocument) { URI resourceUri = ((XtextDocument)doc).getResourceURI(); URI prjUri; try { prjUri = ResourceManager.getProjectUri(resourceUri); visitor = sadlModelManagerProvider.get(prjUri); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { try { visitor = sadlModelManagerProvider.get(currentResource); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } String conceptualType = (String) variable.getVariableType() .getParams().iterator().next(); if (conceptualType.equals("VERSION")) { List<String> values = new ArrayList<String>(); values.add("$" + "Revision:" + "$ Last modified on $" + "Date:" + "$"); return values; } else if (conceptualType.equals("BUILTINNAME")) { ICompositeNode parent = xtextTemplateContext.getContentAssistContext().getCurrentNode().getParent(); // System.out.println(parent.toString()); // INode lastCompleteNode = xtextTemplateContext.getContentAssistContext().getLastCompleteNode(); // ICompositeNode lcnc = lastCompleteNode.getParent(); // System.out.println(lcnc.toString()); // TreeIterator<EObject> contents = lcnc.eAllContents(); // while (contents.hasNext()) { // EObject nextobj = contents.next(); //// System.out.println(nextobj.toString()); // } List<String> values = new ArrayList<String>(); String modelFolderName = null; try { IConfigurationManagerForIDE configMgr = visitor.getConfigurationMgr(modelFolderName); List<BuiltinInfo> builtins = ((IConfigurationManagerForIDE)configMgr).getAvailableBuiltinsForCurrentReasoner(); if (builtins != null) { for (int i = 0; i < builtins.size(); i++) { String withArgs = builtins.get(i).getName() + "("; int argCnt = builtins.get(i).getNumArgs(); int effectiveArgCount = argCnt; // this should include determination of whether this is in the premise (given, if) // or in the conclusion. Conclusion rules do not assign values to output variables so all arguments // should be retained. For a premise built-in, the number of output variables should be dropped // from the syntax constructed for the content assist. if (argCnt > 1) { effectiveArgCount--; } if (argCnt <= 0) { withArgs += "v1,..."; } else { for (int j = 0; j < effectiveArgCount; j++) { if (j > 0) { withArgs += ", "; } withArgs += "v" + (j + 1); } } withArgs += ")"; if (values.size() > 0) { boolean added = false; for (int j = 0; j < values.size(); j++) { String nextele = values.get(j); if (nextele.compareToIgnoreCase(withArgs) > 0) { values.add(j, withArgs); added = true; break; } } if (!added) { values.add(withArgs); } } else { values.add(withArgs); } } } } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Throwable t) { t.printStackTrace(); } if (values.size() == 0) { values.add("no_builtins_found"); } return values; } ConceptType cType = null; //ANNOTATIONPROPERTY, DATATYPEPROPERTY, OBJECTPROPERTY, ONTCLASS, INDIVIDUAL String constraint = null; if (conceptualType.indexOf(':') > 0) { int colpos = conceptualType.indexOf(':'); constraint = conceptualType.substring(colpos + 1); conceptualType = conceptualType.substring(0, colpos); } if (ConceptType.ANNOTATIONPROPERTY.toString().equals(conceptualType)) { cType = ConceptType.ANNOTATIONPROPERTY; } else if (ConceptType.DATATYPEPROPERTY.toString().equals(conceptualType)) { cType = ConceptType.DATATYPEPROPERTY; } else if (ConceptType.OBJECTPROPERTY.toString().equals(conceptualType)) { cType = ConceptType.OBJECTPROPERTY; } else if (ConceptType.ONTCLASS.toString().equals(conceptualType)) { cType = ConceptType.ONTCLASS; } else if (ConceptType.INDIVIDUAL.toString().equals(conceptualType)) { cType = ConceptType.INDIVIDUAL; } else if (ConceptType.MODELNAME.toString().equals(conceptualType)) { cType = ConceptType.MODELNAME; IPreferencesService service = Platform.getPreferencesService(); String value = service.getString("com.ge.research.sadl.Sadl", "importBy", "fn", null); if (value != null && !value.isEmpty()) { visitor.setImportListType(value.equals("fn") ? ImportListType.NAME_AS_SADL_FILENAME : ImportListType.NAME_AS_URI); } } else { cType = ConceptType.ONTCLASS; } List<String> values = new ArrayList<String>(); try { boolean modelEmpty = true; for (TreeIterator<EObject> iter = EcoreUtil.getAllContents(visitor.getModelResource(), true); visitor.getModelName() == null && iter.hasNext();) { EObject eObject = iter.next(); if (visitor.doSwitch(eObject) != null) { iter.prune(); } modelEmpty = false; } if (modelEmpty) { try { visitor.getModel().init(visitor.getConfigurationMgr((String)null), sadlModelManagerProvider, currentResource); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (visitor.getModelBaseUri() == null) { // set the model baseUri (from preferences) if it hasn't been set so that we can generate // a default model name if needed visitor.setModelBaseUri(proposalProvider.generateBaseUri(visitor.getModelResource().getURI())); } List<ConceptName> names = null; if (constraint != null) { names = visitor.getNamedConceptsOfType(cType, Scope.INCLUDEIMPORTS, new ConceptName(constraint)); } else { names = visitor.getNamedConceptsOfType(cType, Scope.INCLUDEIMPORTS); } if (names != null && names.size() > 0) { IPreferencesService service = Platform.getPreferencesService(); boolean bRemoveUnnecessaryPrefixes = service.getBoolean("com.ge.research.sadl.Sadl", "prefixesOnlyAsNeeded", false, null); if (!cType.equals(ConceptType.MODELNAME) && bRemoveUnnecessaryPrefixes) { SadlProposalProvider.removeUnnecessaryPrefixes(names); } } for (ConceptName name : names) { values.add(name.toString()); } } catch (InvalidNameException e) { e.printStackTrace(); } catch (ConfigurationException e) { e.printStackTrace(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (values.size() == 0) { values.add("No_valid_completions_found"); } else { // alphabetize the list Collections.sort(values); } return values; }
List<String> function(TemplateVariable variable, XtextTemplateContext xtextTemplateContext) { Resource currentResource = xtextTemplateContext.getContentAssistContext().getCurrentModel().eResource(); SadlModelManager visitor = null; if (currentResource == null) { Iterator<EObject> itr = xtextTemplateContext.getContentAssistContext().getCurrentModel().eContents().iterator(); while (itr.hasNext()) { EObject obj = itr.next(); if (obj instanceof ModelName) { String modelUri = ((ModelName)obj).getBaseUri(); visitor = sadlModelManagerProvider.get(); break; } } IDocument doc = xtextTemplateContext.getDocument(); if (doc instanceof XtextDocument) { URI resourceUri = ((XtextDocument)doc).getResourceURI(); URI prjUri; try { prjUri = ResourceManager.getProjectUri(resourceUri); visitor = sadlModelManagerProvider.get(prjUri); } catch (MalformedURLException e) { e.printStackTrace(); } } } else { try { visitor = sadlModelManagerProvider.get(currentResource); } catch (MalformedURLException e) { e.printStackTrace(); } } String conceptualType = (String) variable.getVariableType() .getParams().iterator().next(); if (conceptualType.equals(STR)) { List<String> values = new ArrayList<String>(); values.add("$" + STR + STR + "Date:" + "$"); return values; } else if (conceptualType.equals(STR)) { ICompositeNode parent = xtextTemplateContext.getContentAssistContext().getCurrentNode().getParent(); List<String> values = new ArrayList<String>(); String modelFolderName = null; try { IConfigurationManagerForIDE configMgr = visitor.getConfigurationMgr(modelFolderName); List<BuiltinInfo> builtins = ((IConfigurationManagerForIDE)configMgr).getAvailableBuiltinsForCurrentReasoner(); if (builtins != null) { for (int i = 0; i < builtins.size(); i++) { String withArgs = builtins.get(i).getName() + "("; int argCnt = builtins.get(i).getNumArgs(); int effectiveArgCount = argCnt; if (argCnt > 1) { effectiveArgCount--; } if (argCnt <= 0) { withArgs += STR; } else { for (int j = 0; j < effectiveArgCount; j++) { if (j > 0) { withArgs += STR; } withArgs += "v" + (j + 1); } } withArgs += ")"; if (values.size() > 0) { boolean added = false; for (int j = 0; j < values.size(); j++) { String nextele = values.get(j); if (nextele.compareToIgnoreCase(withArgs) > 0) { values.add(j, withArgs); added = true; break; } } if (!added) { values.add(withArgs); } } else { values.add(withArgs); } } } } catch (ConfigurationException e) { e.printStackTrace(); } catch (Throwable t) { t.printStackTrace(); } if (values.size() == 0) { values.add(STR); } return values; } ConceptType cType = null; String constraint = null; if (conceptualType.indexOf(':') > 0) { int colpos = conceptualType.indexOf(':'); constraint = conceptualType.substring(colpos + 1); conceptualType = conceptualType.substring(0, colpos); } if (ConceptType.ANNOTATIONPROPERTY.toString().equals(conceptualType)) { cType = ConceptType.ANNOTATIONPROPERTY; } else if (ConceptType.DATATYPEPROPERTY.toString().equals(conceptualType)) { cType = ConceptType.DATATYPEPROPERTY; } else if (ConceptType.OBJECTPROPERTY.toString().equals(conceptualType)) { cType = ConceptType.OBJECTPROPERTY; } else if (ConceptType.ONTCLASS.toString().equals(conceptualType)) { cType = ConceptType.ONTCLASS; } else if (ConceptType.INDIVIDUAL.toString().equals(conceptualType)) { cType = ConceptType.INDIVIDUAL; } else if (ConceptType.MODELNAME.toString().equals(conceptualType)) { cType = ConceptType.MODELNAME; IPreferencesService service = Platform.getPreferencesService(); String value = service.getString("com.ge.research.sadl.SadlSTRimportBySTRfn", null); if (value != null && !value.isEmpty()) { visitor.setImportListType(value.equals("fn") ? ImportListType.NAME_AS_SADL_FILENAME : ImportListType.NAME_AS_URI); } } else { cType = ConceptType.ONTCLASS; } List<String> values = new ArrayList<String>(); try { boolean modelEmpty = true; for (TreeIterator<EObject> iter = EcoreUtil.getAllContents(visitor.getModelResource(), true); visitor.getModelName() == null && iter.hasNext();) { EObject eObject = iter.next(); if (visitor.doSwitch(eObject) != null) { iter.prune(); } modelEmpty = false; } if (modelEmpty) { try { visitor.getModel().init(visitor.getConfigurationMgr((String)null), sadlModelManagerProvider, currentResource); } catch (URISyntaxException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } if (visitor.getModelBaseUri() == null) { visitor.setModelBaseUri(proposalProvider.generateBaseUri(visitor.getModelResource().getURI())); } List<ConceptName> names = null; if (constraint != null) { names = visitor.getNamedConceptsOfType(cType, Scope.INCLUDEIMPORTS, new ConceptName(constraint)); } else { names = visitor.getNamedConceptsOfType(cType, Scope.INCLUDEIMPORTS); } if (names != null && names.size() > 0) { IPreferencesService service = Platform.getPreferencesService(); boolean bRemoveUnnecessaryPrefixes = service.getBoolean("com.ge.research.sadl.SadlSTRprefixesOnlyAsNeeded", false, null); if (!cType.equals(ConceptType.MODELNAME) && bRemoveUnnecessaryPrefixes) { SadlProposalProvider.removeUnnecessaryPrefixes(names); } } for (ConceptName name : names) { values.add(name.toString()); } } catch (InvalidNameException e) { e.printStackTrace(); } catch (ConfigurationException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } if (values.size() == 0) { values.add(STR); } else { Collections.sort(values); } return values; }
/** * Looks up and returns a list of names having the given conceptual type. * * @param variable Has a parameter specifying the conceptual type. * @param xtextTemplateContext Not needed by this method. * @return List of names having the given conceptual type. */
Looks up and returns a list of names having the given conceptual type
resolveValues
{ "repo_name": "crapo/sadlos2", "path": "com.ge.research.sadl.ui/src/com/ge/research/sadl/ui/contentassist/SadlResourceNameTemplateVariableResolver.java", "license": "epl-1.0", "size": 11617 }
[ "com.ge.research.sadl.builder.IConfigurationManagerForIDE", "com.ge.research.sadl.builder.ModelManager", "com.ge.research.sadl.builder.ResourceManager", "com.ge.research.sadl.builder.SadlModelManager", "com.ge.research.sadl.model.ConceptName", "com.ge.research.sadl.reasoner.BuiltinInfo", "com.ge.research.sadl.reasoner.ConfigurationException", "com.ge.research.sadl.reasoner.IConfigurationManagerForEditing", "com.ge.research.sadl.reasoner.InvalidNameException", "com.ge.research.sadl.sadl.ModelName", "com.ge.research.sadl.utils.SadlUtils", "java.io.IOException", "java.net.MalformedURLException", "java.net.URISyntaxException", "java.util.ArrayList", "java.util.Collections", "java.util.Iterator", "java.util.List", "org.eclipse.core.runtime.Platform", "org.eclipse.core.runtime.preferences.IPreferencesService", "org.eclipse.emf.common.util.TreeIterator", "org.eclipse.emf.ecore.EObject", "org.eclipse.emf.ecore.resource.Resource", "org.eclipse.emf.ecore.util.EcoreUtil", "org.eclipse.jface.text.IDocument", "org.eclipse.jface.text.templates.TemplateVariable", "org.eclipse.xtext.nodemodel.ICompositeNode", "org.eclipse.xtext.ui.editor.model.XtextDocument", "org.eclipse.xtext.ui.editor.templates.XtextTemplateContext" ]
import com.ge.research.sadl.builder.IConfigurationManagerForIDE; import com.ge.research.sadl.builder.ModelManager; import com.ge.research.sadl.builder.ResourceManager; import com.ge.research.sadl.builder.SadlModelManager; import com.ge.research.sadl.model.ConceptName; import com.ge.research.sadl.reasoner.BuiltinInfo; import com.ge.research.sadl.reasoner.ConfigurationException; import com.ge.research.sadl.reasoner.IConfigurationManagerForEditing; import com.ge.research.sadl.reasoner.InvalidNameException; import com.ge.research.sadl.sadl.ModelName; import com.ge.research.sadl.utils.SadlUtils; import java.io.IOException; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.IPreferencesService; import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.templates.TemplateVariable; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.ui.editor.model.XtextDocument; import org.eclipse.xtext.ui.editor.templates.XtextTemplateContext;
import com.ge.research.sadl.builder.*; import com.ge.research.sadl.model.*; import com.ge.research.sadl.reasoner.*; import com.ge.research.sadl.sadl.*; import com.ge.research.sadl.utils.*; import java.io.*; import java.net.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.preferences.*; import org.eclipse.emf.common.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.emf.ecore.resource.*; import org.eclipse.emf.ecore.util.*; import org.eclipse.jface.text.*; import org.eclipse.jface.text.templates.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.ui.editor.model.*; import org.eclipse.xtext.ui.editor.templates.*;
[ "com.ge.research", "java.io", "java.net", "java.util", "org.eclipse.core", "org.eclipse.emf", "org.eclipse.jface", "org.eclipse.xtext" ]
com.ge.research; java.io; java.net; java.util; org.eclipse.core; org.eclipse.emf; org.eclipse.jface; org.eclipse.xtext;
2,166,504
public PathUtil getPath() { return currentFilePath; }
PathUtil function() { return currentFilePath; }
/** * Returns the current breadcrumb path. */
Returns the current breadcrumb path
getPath
{ "repo_name": "WeTheInternet/collide", "path": "client/src/main/java/com/google/collide/client/code/WorkspaceLocationBreadcrumbs.java", "license": "apache-2.0", "size": 11767 }
[ "com.google.collide.client.util.PathUtil" ]
import com.google.collide.client.util.PathUtil;
import com.google.collide.client.util.*;
[ "com.google.collide" ]
com.google.collide;
2,822,581
public static NetworkListOption filter(NetworkFilter filter) { return new NetworkListOption(ComputeRpc.Option.FILTER, filter.toPb()); }
static NetworkListOption function(NetworkFilter filter) { return new NetworkListOption(ComputeRpc.Option.FILTER, filter.toPb()); }
/** * Returns an option to specify a filter on the networks being listed. */
Returns an option to specify a filter on the networks being listed
filter
{ "repo_name": "jabubake/google-cloud-java", "path": "google-cloud-compute/src/main/java/com/google/cloud/compute/Compute.java", "license": "apache-2.0", "size": 93984 }
[ "com.google.cloud.compute.spi.ComputeRpc" ]
import com.google.cloud.compute.spi.ComputeRpc;
import com.google.cloud.compute.spi.*;
[ "com.google.cloud" ]
com.google.cloud;
2,569,205
@Test public void testIsValid() { assertTrue(MozColumnCount.isValid("1")); assertTrue(MozColumnCount.isValid("0")); assertTrue(MozColumnCount.isValid(MozColumnCount.INITIAL)); assertTrue(MozColumnCount.isValid(MozColumnCount.INHERIT)); assertTrue(MozColumnCount.isValid(MozColumnCount.AUTO)); assertFalse(MozColumnCount.isValid(".5")); assertFalse(MozColumnCount.isValid("0.5")); assertFalse(MozColumnCount.isValid("0.1")); assertFalse(MozColumnCount.isValid("dfd")); assertFalse(MozColumnCount.isValid("1px")); assertFalse(MozColumnCount.isValid("")); assertFalse(MozColumnCount.isValid("1 1")); assertFalse(MozColumnCount.isValid("1.1")); assertFalse(MozColumnCount.isValid("-0.5")); assertFalse(MozColumnCount.isValid("-0")); assertFalse(MozColumnCount.isValid("-0.0")); assertFalse(MozColumnCount.isValid("+0.0")); }
void function() { assertTrue(MozColumnCount.isValid("1")); assertTrue(MozColumnCount.isValid("0")); assertTrue(MozColumnCount.isValid(MozColumnCount.INITIAL)); assertTrue(MozColumnCount.isValid(MozColumnCount.INHERIT)); assertTrue(MozColumnCount.isValid(MozColumnCount.AUTO)); assertFalse(MozColumnCount.isValid(".5STR0.5STR0.1STRdfdSTR1px")); assertFalse(MozColumnCount.isValid(STR1 1STR1.1STR-0.5STR-0STR-0.0STR+0.0")); }
/** * Test method for {@link com.webfirmframework.wffweb.css.css3.MozColumnCount#isValid(java.lang.String)}. */
Test method for <code>com.webfirmframework.wffweb.css.css3.MozColumnCount#isValid(java.lang.String)</code>
testIsValid
{ "repo_name": "webfirmframework/wff", "path": "wffweb/src/test/java/com/webfirmframework/wffweb/css/css3/MozColumnCountTest.java", "license": "apache-2.0", "size": 9189 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
169,002
public static void displayPromptIdsError(List<File> fileList, int index, String message) { System.out.println(message); displayPromptForId(fileList, index); }
static void function(List<File> fileList, int index, String message) { System.out.println(message); displayPromptForId(fileList, index); }
/** * Displays an error message for the previous user input and redisplays * the same prompt for the given index * @param fileList File List * @param index File index to display in list (from 0) * @param message error message to display */
Displays an error message for the previous user input and redisplays the same prompt for the given index
displayPromptIdsError
{ "repo_name": "samicemalone/swapf", "path": "src/swapf/Display.java", "license": "bsd-3-clause", "size": 4255 }
[ "java.io.File", "java.util.List" ]
import java.io.File; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,908,306
private void manageOutputStatus(SyncML message, HashMap sourceReplacedMap) { if (log.isTraceEnabled()) { log.trace("Replace TargetRef into output Status commands"); } SyncBody syncBody = message.getSyncBody(); AbstractCommand[] allServerCommands = (AbstractCommand[])syncBody.getCommands().toArray( new AbstractCommand[0]); ArrayList statusList = CoreUtil.filterCommands(allServerCommands, Status.class); Iterator itStatusList = statusList.iterator(); Status status = null; while (itStatusList.hasNext()) { status = (Status)itStatusList.next(); if (status.getTargetRef() == null) { continue; } TargetRef[] trefs = (TargetRef[])status.getTargetRef().toArray(new TargetRef[0]); int s = trefs.length; for(int i=0;i<s;i++) { TargetRef tr = (TargetRef)trefs[i]; if (sourceReplacedMap.containsKey(tr.getValue())) { tr.setValue((String)sourceReplacedMap.get(tr.getValue())); } } } }
void function(SyncML message, HashMap sourceReplacedMap) { if (log.isTraceEnabled()) { log.trace(STR); } SyncBody syncBody = message.getSyncBody(); AbstractCommand[] allServerCommands = (AbstractCommand[])syncBody.getCommands().toArray( new AbstractCommand[0]); ArrayList statusList = CoreUtil.filterCommands(allServerCommands, Status.class); Iterator itStatusList = statusList.iterator(); Status status = null; while (itStatusList.hasNext()) { status = (Status)itStatusList.next(); if (status.getTargetRef() == null) { continue; } TargetRef[] trefs = (TargetRef[])status.getTargetRef().toArray(new TargetRef[0]); int s = trefs.length; for(int i=0;i<s;i++) { TargetRef tr = (TargetRef)trefs[i]; if (sourceReplacedMap.containsKey(tr.getValue())) { tr.setValue((String)sourceReplacedMap.get(tr.getValue())); } } } }
/** * Replace TargetRef into Status commands * * @param message the client message * @param sourceReplacedMap the HashMap with the uri to replace */
Replace TargetRef into Status commands
manageOutputStatus
{ "repo_name": "accesstest3/cfunambol", "path": "modules/foundation/foundation-core/src/main/java/com/funambol/foundation/synclet/SourceUriPrefixSynclet.java", "license": "agpl-3.0", "size": 19842 }
[ "com.funambol.framework.core.AbstractCommand", "com.funambol.framework.core.Status", "com.funambol.framework.core.SyncBody", "com.funambol.framework.core.SyncML", "com.funambol.framework.core.TargetRef", "com.funambol.framework.tools.CoreUtil", "java.util.ArrayList", "java.util.HashMap", "java.util.Iterator" ]
import com.funambol.framework.core.AbstractCommand; import com.funambol.framework.core.Status; import com.funambol.framework.core.SyncBody; import com.funambol.framework.core.SyncML; import com.funambol.framework.core.TargetRef; import com.funambol.framework.tools.CoreUtil; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator;
import com.funambol.framework.core.*; import com.funambol.framework.tools.*; import java.util.*;
[ "com.funambol.framework", "java.util" ]
com.funambol.framework; java.util;
360,797
public int valInt(int pos) { return this.value.getInt(pos, ByteOrder.BIG_ENDIAN); }
int function(int pos) { return this.value.getInt(pos, ByteOrder.BIG_ENDIAN); }
/** * Get data from value at current cursor position. * * @param pos byte position * @return int */
Get data from value at current cursor position
valInt
{ "repo_name": "recoilme/lmdbjni", "path": "lmdbjni/src/main/java/org/fusesource/lmdbjni/BufferCursor.java", "license": "apache-2.0", "size": 23616 }
[ "java.nio.ByteOrder" ]
import java.nio.ByteOrder;
import java.nio.*;
[ "java.nio" ]
java.nio;
1,265,043
protected Iterator filter(Iterator items) { return new FilteringIterator(items, this.localFilter); } // ********** behavior **********
Iterator function(Iterator items) { return new FilteringIterator(items, this.localFilter); }
/** * Return an iterator that filters the specified iterator. */
Return an iterator that filters the specified iterator
filter
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "utils/eclipselink.utils.workbench/uitools/source/org/eclipse/persistence/tools/workbench/uitools/app/FilteringCollectionValueModel.java", "license": "epl-1.0", "size": 7730 }
[ "java.util.Iterator", "org.eclipse.persistence.tools.workbench.utility.iterators.FilteringIterator" ]
import java.util.Iterator; import org.eclipse.persistence.tools.workbench.utility.iterators.FilteringIterator;
import java.util.*; import org.eclipse.persistence.tools.workbench.utility.iterators.*;
[ "java.util", "org.eclipse.persistence" ]
java.util; org.eclipse.persistence;
553,609
protected void initComponent(ComponentRepository repo, ComponentInfo info) { URI componentUri = info.getUri(); if (info.getAttributes().containsKey(ComponentInfoAttributes.REMOTE_CLIENT_JAVA) && info.getAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA).endsWith("Provider")) { String remoteTypeStr = info.getAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA); Class<?> remoteType = ReflectionUtils.loadClass(remoteTypeStr); Constructor<?> con = ReflectionUtils.findConstructor(remoteType, URI.class); Object target = ReflectionUtils.newInstance(con, componentUri); repo.registerComponent(info, target); if (isPublishRest()) { repo.getRestComponents().republish(info); } if (info.getType() == PermissionCheckProvider.class) { connectPermissionCheckProvider(repo, info, (PermissionCheckProvider) target); } } }
void function(ComponentRepository repo, ComponentInfo info) { URI componentUri = info.getUri(); if (info.getAttributes().containsKey(ComponentInfoAttributes.REMOTE_CLIENT_JAVA) && info.getAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA).endsWith(STR)) { String remoteTypeStr = info.getAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA); Class<?> remoteType = ReflectionUtils.loadClass(remoteTypeStr); Constructor<?> con = ReflectionUtils.findConstructor(remoteType, URI.class); Object target = ReflectionUtils.newInstance(con, componentUri); repo.registerComponent(info, target); if (isPublishRest()) { repo.getRestComponents().republish(info); } if (info.getType() == PermissionCheckProvider.class) { connectPermissionCheckProvider(repo, info, (PermissionCheckProvider) target); } } }
/** * Initialize the remote component. * * @param repo the local repository, not null * @param info the remote information, not null */
Initialize the remote component
initComponent
{ "repo_name": "codeaudit/OG-Platform", "path": "projects/OG-Component/src/main/java/com/opengamma/component/factory/provider/RemoteProvidersComponentFactory.java", "license": "apache-2.0", "size": 11201 }
[ "com.opengamma.component.ComponentInfo", "com.opengamma.component.ComponentRepository", "com.opengamma.component.factory.ComponentInfoAttributes", "com.opengamma.provider.permission.PermissionCheckProvider", "com.opengamma.util.ReflectionUtils", "java.lang.reflect.Constructor" ]
import com.opengamma.component.ComponentInfo; import com.opengamma.component.ComponentRepository; import com.opengamma.component.factory.ComponentInfoAttributes; import com.opengamma.provider.permission.PermissionCheckProvider; import com.opengamma.util.ReflectionUtils; import java.lang.reflect.Constructor;
import com.opengamma.component.*; import com.opengamma.component.factory.*; import com.opengamma.provider.permission.*; import com.opengamma.util.*; import java.lang.reflect.*;
[ "com.opengamma.component", "com.opengamma.provider", "com.opengamma.util", "java.lang" ]
com.opengamma.component; com.opengamma.provider; com.opengamma.util; java.lang;
1,292,197
public Builder setChannelConfigurator( @SuppressWarnings("rawtypes") ApiFunction<ManagedChannelBuilder, ManagedChannelBuilder> channelConfigurator) { this.channelConfigurator = channelConfigurator; return this; }
Builder function( @SuppressWarnings(STR) ApiFunction<ManagedChannelBuilder, ManagedChannelBuilder> channelConfigurator) { this.channelConfigurator = channelConfigurator; return this; }
/** * Sets an {@link ApiFunction} that will be used to configure the transport channel. This will * only be used if no custom {@link TransportChannelProvider} has been set. */
Sets an <code>ApiFunction</code> that will be used to configure the transport channel. This will only be used if no custom <code>TransportChannelProvider</code> has been set
setChannelConfigurator
{ "repo_name": "googleapis/java-spanner", "path": "google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java", "license": "apache-2.0", "size": 54969 }
[ "com.google.api.core.ApiFunction", "io.grpc.ManagedChannelBuilder" ]
import com.google.api.core.ApiFunction; import io.grpc.ManagedChannelBuilder;
import com.google.api.core.*; import io.grpc.*;
[ "com.google.api", "io.grpc" ]
com.google.api; io.grpc;
216,083
public static int[] copyIfExceeded(int[] arr, int len) { assert arr != null; assert 0 <= len && len <= arr.length; return len == arr.length ? arr : Arrays.copyOf(arr, len); }
static int[] function(int[] arr, int len) { assert arr != null; assert 0 <= len && len <= arr.length; return len == arr.length ? arr : Arrays.copyOf(arr, len); }
/** * Copies array only if array length greater than needed length. * * @param arr Array. * @param len Prefix length. * @return Old array if length of {@code arr} is equals to {@code len}, * otherwise copy of array. */
Copies array only if array length greater than needed length
copyIfExceeded
{ "repo_name": "shurun19851206/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 289056 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,743,062
protected void checkNode(@Nullable Node node, Token type) throws MalformedException { if (node == null) { throw new MalformedException( "Expected node type " + type + "; found: null", node); } if (node.getToken() != type) { throw new MalformedException( "Expected node type " + type + "; found: " + node.getToken(), node); } } static class MalformedException extends Exception { private static final long serialVersionUID = 1L; private final Node node; MalformedException(String message, Node node) { super(message); this.node = node; }
void function(@Nullable Node node, Token type) throws MalformedException { if (node == null) { throw new MalformedException( STR + type + STR, node); } if (node.getToken() != type) { throw new MalformedException( STR + type + STR + node.getToken(), node); } } static class MalformedException extends Exception { private static final long serialVersionUID = 1L; private final Node node; MalformedException(String message, Node node) { super(message); this.node = node; }
/** * Checks a node's type. * * @throws MalformedException if the node is null or the wrong type */
Checks a node's type
checkNode
{ "repo_name": "brad4d/closure-compiler", "path": "src/com/google/javascript/jscomp/JsMessageVisitor.java", "license": "apache-2.0", "size": 32998 }
[ "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token", "javax.annotation.Nullable" ]
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; import javax.annotation.Nullable;
import com.google.javascript.rhino.*; import javax.annotation.*;
[ "com.google.javascript", "javax.annotation" ]
com.google.javascript; javax.annotation;
2,729,681
@POST @Path("/{currencyPair}/money/order/add") Bl3pNewOrder createMarketOrder( @HeaderParam("Rest-Key") String restKey, @HeaderParam("Rest-Sign") ParamsDigest restSign, @FormParam("nonce") SynchronizedValueFactory<Long> nonce, @PathParam("currencyPair") String currencyPair, @FormParam("type") String type, @FormParam("amount_int") long amountInt, @FormParam("fee_currency") String feeCurrency);
@Path(STR) Bl3pNewOrder createMarketOrder( @HeaderParam(STR) String restKey, @HeaderParam(STR) ParamsDigest restSign, @FormParam("nonce") SynchronizedValueFactory<Long> nonce, @PathParam(STR) String currencyPair, @FormParam("type") String type, @FormParam(STR) long amountInt, @FormParam(STR) String feeCurrency);
/** * Create a market order * * @param restKey * @param restSign * @param nonce * @param currencyPair * @param type * @param amountInt * @param feeCurrency * @return */
Create a market order
createMarketOrder
{ "repo_name": "timmolter/XChange", "path": "xchange-bl3p/src/main/java/org/knowm/xchange/bl3p/Bl3pAuthenticated.java", "license": "mit", "size": 6679 }
[ "javax.ws.rs.FormParam", "javax.ws.rs.HeaderParam", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "org.knowm.xchange.bl3p.dto.trade.Bl3pNewOrder", "si.mazi.rescu.ParamsDigest", "si.mazi.rescu.SynchronizedValueFactory" ]
import javax.ws.rs.FormParam; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.knowm.xchange.bl3p.dto.trade.Bl3pNewOrder; import si.mazi.rescu.ParamsDigest; import si.mazi.rescu.SynchronizedValueFactory;
import javax.ws.rs.*; import org.knowm.xchange.bl3p.dto.trade.*; import si.mazi.rescu.*;
[ "javax.ws", "org.knowm.xchange", "si.mazi.rescu" ]
javax.ws; org.knowm.xchange; si.mazi.rescu;
2,093,659
static void displayRemoveBookmarkDialog( final long id, final String title, final Context context, final Message msg, boolean is_folder) {
static void displayRemoveBookmarkDialog( final long id, final String title, final Context context, final Message msg, boolean is_folder) {
/** * Show a confirmation dialog to remove a bookmark. * @param id Id of the bookmark to remove * @param title Title of the bookmark, to be displayed in the confirmation method. * @param context Package Context for strings, dialog, ContentResolver * @param msg Message to send if the bookmark is deleted. */
Show a confirmation dialog to remove a bookmark
displayRemoveBookmarkDialog
{ "repo_name": "ChaOSChriS/chaoschrome", "path": "src/com/android/browser/BookmarkUtils.java", "license": "gpl-2.0", "size": 13155 }
[ "android.content.Context", "android.os.Message" ]
import android.content.Context; import android.os.Message;
import android.content.*; import android.os.*;
[ "android.content", "android.os" ]
android.content; android.os;
778,710
public Icon<T> removeLargeIcon() { childNode.removeChildren("large-icon"); return this; }
Icon<T> function() { childNode.removeChildren(STR); return this; }
/** * Removes the <code>large-icon</code> element * @return the current instance of <code>Icon<T></code> */
Removes the <code>large-icon</code> element
removeLargeIcon
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/connector10/IconImpl.java", "license": "epl-1.0", "size": 3660 }
[ "org.jboss.shrinkwrap.descriptor.api.connector10.Icon" ]
import org.jboss.shrinkwrap.descriptor.api.connector10.Icon;
import org.jboss.shrinkwrap.descriptor.api.connector10.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
2,408,903
@Test(expected = IllegalArgumentException.class) public void invalidIntSizeTest() { RandomArray.randomIntArray(0, false, false); }
@Test(expected = IllegalArgumentException.class) void function() { RandomArray.randomIntArray(0, false, false); }
/** * Checks if the empty integer array size exception get's thrown */
Checks if the empty integer array size exception get's thrown
invalidIntSizeTest
{ "repo_name": "markuskorbel/adt.reference", "path": "tests/ie/lyit/adt/tests/tools/RandomArrayTests.java", "license": "gpl-2.0", "size": 3307 }
[ "ie.lyit.adt.tools.RandomArray", "org.junit.Test" ]
import ie.lyit.adt.tools.RandomArray; import org.junit.Test;
import ie.lyit.adt.tools.*; import org.junit.*;
[ "ie.lyit.adt", "org.junit" ]
ie.lyit.adt; org.junit;
758,875
@Generated @CVariable() @MappedReturn(ObjCStringMapper.class) public static native String GCProductCategoryMouse();
@CVariable() @MappedReturn(ObjCStringMapper.class) static native String function();
/** * Keyboards and Mice Product Categories */
Keyboards and Mice Product Categories
GCProductCategoryMouse
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/gamecontroller/c/GameController.java", "license": "apache-2.0", "size": 61506 }
[ "org.moe.natj.c.ann.CVariable", "org.moe.natj.general.ann.MappedReturn", "org.moe.natj.objc.map.ObjCStringMapper" ]
import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper;
import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*;
[ "org.moe.natj" ]
org.moe.natj;
1,250,407
private static void assertExceptionMessage(final Throwable throwable, final Class<? extends Throwable> exceptionClass, final String desc) { assertTrue("Throwable was not of UserException type.", throwable instanceof UserException); final ExceptionWrapper cause = ((UserException) throwable).getOrCreatePBError(false).getException(); assertEquals("Exception class names should match.", exceptionClass.getName(), cause.getExceptionClass()); assertEquals("Exception sites should match.", desc, cause.getMessage()); }
static void function(final Throwable throwable, final Class<? extends Throwable> exceptionClass, final String desc) { assertTrue(STR, throwable instanceof UserException); final ExceptionWrapper cause = ((UserException) throwable).getOrCreatePBError(false).getException(); assertEquals(STR, exceptionClass.getName(), cause.getExceptionClass()); assertEquals(STR, desc, cause.getMessage()); }
/** * Check that the injected exception is what we were expecting. * * @param throwable the throwable that was caught (by the test) * @param exceptionClass the expected exception class * @param desc the expected exception site description */
Check that the injected exception is what we were expecting
assertExceptionMessage
{ "repo_name": "kkhatua/drill", "path": "exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java", "license": "apache-2.0", "size": 38914 }
[ "org.apache.drill.common.exceptions.UserException", "org.apache.drill.exec.proto.UserBitShared", "org.junit.Assert" ]
import org.apache.drill.common.exceptions.UserException; import org.apache.drill.exec.proto.UserBitShared; import org.junit.Assert;
import org.apache.drill.common.exceptions.*; import org.apache.drill.exec.proto.*; import org.junit.*;
[ "org.apache.drill", "org.junit" ]
org.apache.drill; org.junit;
2,626,144
protected void childClass(Production node, Node child) throws ParseException { node.addChild(child); }
void function(Production node, Node child) throws ParseException { node.addChild(child); }
/** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */
Called when adding a child to a parse tree node
childClass
{ "repo_name": "richb-hanover/mibble-2.9.2", "path": "src/java/net/percederberg/mibble/asn1/Asn1Analyzer.java", "license": "gpl-2.0", "size": 275483 }
[ "net.percederberg.grammatica.parser.Node", "net.percederberg.grammatica.parser.ParseException", "net.percederberg.grammatica.parser.Production" ]
import net.percederberg.grammatica.parser.Node; import net.percederberg.grammatica.parser.ParseException; import net.percederberg.grammatica.parser.Production;
import net.percederberg.grammatica.parser.*;
[ "net.percederberg.grammatica" ]
net.percederberg.grammatica;
447,629
protected void addParameter__pPinRetractedPosPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_CtrlUnit100_Parameter__pPinRetractedPos_feature"), getString("_UI_PropertyDescriptor_description", "_UI_CtrlUnit100_Parameter__pPinRetractedPos_feature", "_UI_CtrlUnit100_type"), WTSpecPackage.eINSTANCE.getCtrlUnit100_Parameter__pPinRetractedPos(), true, false, true, null, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), WTSpecPackage.eINSTANCE.getCtrlUnit100_Parameter__pPinRetractedPos(), true, false, true, null, null, null)); }
/** * This adds a property descriptor for the Parameter pPin Retracted Pos feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Parameter pPin Retracted Pos feature.
addParameter__pPinRetractedPosPropertyDescriptor
{ "repo_name": "FTSRG/mondo-collab-framework", "path": "archive/workspaceTracker/VA/ikerlanEMF.edit/src/eu/mondo/collaboration/operationtracemodel/example/WTSpec/provider/CtrlUnit100ItemProvider.java", "license": "epl-1.0", "size": 9516 }
[ "eu.mondo.collaboration.operationtracemodel.example.WTSpec", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory" ]
import eu.mondo.collaboration.operationtracemodel.example.WTSpec; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import eu.mondo.collaboration.operationtracemodel.example.*; import org.eclipse.emf.edit.provider.*;
[ "eu.mondo.collaboration", "org.eclipse.emf" ]
eu.mondo.collaboration; org.eclipse.emf;
623,701
private boolean noticeContainsPosition(ParserNotice notice, int offs){ if (notice.getKnowsOffsetAndLength()) { return notice.containsPosition(offs); } Document doc = textArea.getDocument(); Element root = doc.getDefaultRootElement(); int line = notice.getLine(); if (line<0) { // Defensive against possible bad user-defined notices. return false; } Element elem = root.getElement(line); return elem != null && offs>=elem.getStartOffset() && offs<elem.getEndOffset(); }
boolean function(ParserNotice notice, int offs){ if (notice.getKnowsOffsetAndLength()) { return notice.containsPosition(offs); } Document doc = textArea.getDocument(); Element root = doc.getDefaultRootElement(); int line = notice.getLine(); if (line<0) { return false; } Element elem = root.getElement(line); return elem != null && offs>=elem.getStartOffset() && offs<elem.getEndOffset(); }
/** * Returns whether a parser notice contains the specified offset. * * @param notice The notice. * @param offs The offset. * @return Whether the notice contains the offset. */
Returns whether a parser notice contains the specified offset
noticeContainsPosition
{ "repo_name": "Thecarisma/powertext", "path": "Power Text/src/com/power/text/ui/pteditor/ParserManager.java", "license": "gpl-3.0", "size": 22597 }
[ "com.power.text.pteditor.parser.ParserNotice", "javax.swing.text.Document", "javax.swing.text.Element" ]
import com.power.text.pteditor.parser.ParserNotice; import javax.swing.text.Document; import javax.swing.text.Element;
import com.power.text.pteditor.parser.*; import javax.swing.text.*;
[ "com.power.text", "javax.swing" ]
com.power.text; javax.swing;
62,163
protected static ModelNode checkOutcome(ModelNode result) { return ModelTestUtils.checkOutcome(result); }
static ModelNode function(ModelNode result) { return ModelTestUtils.checkOutcome(result); }
/** * Checks that the result was successful * * @param result the result to check * @return the result contents */
Checks that the result was successful
checkOutcome
{ "repo_name": "aloubyansky/wildfly-core", "path": "subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/AbstractSubsystemTest.java", "license": "lgpl-2.1", "size": 14040 }
[ "org.jboss.as.model.test.ModelTestUtils", "org.jboss.dmr.ModelNode" ]
import org.jboss.as.model.test.ModelTestUtils; import org.jboss.dmr.ModelNode;
import org.jboss.as.model.test.*; import org.jboss.dmr.*;
[ "org.jboss.as", "org.jboss.dmr" ]
org.jboss.as; org.jboss.dmr;
1,697,458
public static FlexiProviderEnginesPlugin getDefault() { return plugin; } private static SecureRandom sha1prng;
static FlexiProviderEnginesPlugin function() { return plugin; } private static SecureRandom sha1prng;
/** * Returns the shared instance * * @return the shared instance */
Returns the shared instance
getDefault
{ "repo_name": "jcryptool/core", "path": "org.jcryptool.crypto.flexiprovider.engines/src/org/jcryptool/crypto/flexiprovider/engines/FlexiProviderEnginesPlugin.java", "license": "epl-1.0", "size": 2050 }
[ "de.flexiprovider.api.SecureRandom" ]
import de.flexiprovider.api.SecureRandom;
import de.flexiprovider.api.*;
[ "de.flexiprovider.api" ]
de.flexiprovider.api;
374,592
public String[] getRoles(); /** * Returns the {@link com.gemstone.gemfire.distributed.DistributedMember}
String[] function(); /** * Returns the {@link com.gemstone.gemfire.distributed.DistributedMember}
/** * Returns the names of the membership roles filled by this member. * * @return array of string membership role names * @since 5.0 */
Returns the names of the membership roles filled by this member
getRoles
{ "repo_name": "papicella/snappy-store", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/admin/SystemMember.java", "license": "apache-2.0", "size": 4960 }
[ "com.gemstone.gemfire.distributed.DistributedMember" ]
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
660,257
public void include(String relativeUrl, boolean flush) throws ServletException, IOException { RequestDispatcher rd = null; HttpServletRequest req = (HttpServletRequest) getCauchoRequest(); HttpServletResponse res = (HttpServletResponse) getResponse(); if (relativeUrl != null && ! relativeUrl.startsWith("/")) { String path = RequestAdapter.getPageServletPath(req); String pathInfo = RequestAdapter.getPagePathInfo(req); String servletPath = req.getServletPath(); if (path != null) { // jsp/15du vs jsp/15lk (tck) if (pathInfo != null && ! path.equals(servletPath)) path += pathInfo; } else if (pathInfo != null) path = pathInfo; else path = "/"; int p = path.lastIndexOf('/'); if (p >= 0) { _cb.clear(); _cb.append(path, 0, p + 1); _cb.append(relativeUrl); rd = getServletContext().getRequestDispatcher(_cb.toString()); } } if (rd == null) rd = req.getRequestDispatcher(relativeUrl); if (rd == null) throw new ServletException(L.l("unknown including page `{0}'.", relativeUrl)); // the FlushBuffer needs to happen to deal with OpenSymphony (Bug#1710) // jsp/17e9, 15lc, 15m4 if (! flush) { } else if (_out instanceof FlushBuffer) ((FlushBuffer) _out).flushBuffer(); else if (flush) _out.flush(); rd.include(req, res); }
void function(String relativeUrl, boolean flush) throws ServletException, IOException { RequestDispatcher rd = null; HttpServletRequest req = (HttpServletRequest) getCauchoRequest(); HttpServletResponse res = (HttpServletResponse) getResponse(); if (relativeUrl != null && ! relativeUrl.startsWith("/")) { String path = RequestAdapter.getPageServletPath(req); String pathInfo = RequestAdapter.getPagePathInfo(req); String servletPath = req.getServletPath(); if (path != null) { if (pathInfo != null && ! path.equals(servletPath)) path += pathInfo; } else if (pathInfo != null) path = pathInfo; else path = "/"; int p = path.lastIndexOf('/'); if (p >= 0) { _cb.clear(); _cb.append(path, 0, p + 1); _cb.append(relativeUrl); rd = getServletContext().getRequestDispatcher(_cb.toString()); } } if (rd == null) rd = req.getRequestDispatcher(relativeUrl); if (rd == null) throw new ServletException(L.l(STR, relativeUrl)); if (! flush) { } else if (_out instanceof FlushBuffer) ((FlushBuffer) _out).flushBuffer(); else if (flush) _out.flush(); rd.include(req, res); }
/** * Include another servlet into the current output stream. * * @param relativeUrl url relative to the current request. */
Include another servlet into the current output stream
include
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/jsp/PageContextImpl.java", "license": "gpl-2.0", "size": 53497 }
[ "com.caucho.server.http.RequestAdapter", "com.caucho.vfs.FlushBuffer", "java.io.IOException", "javax.servlet.RequestDispatcher", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import com.caucho.server.http.RequestAdapter; import com.caucho.vfs.FlushBuffer; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import com.caucho.server.http.*; import com.caucho.vfs.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "com.caucho.server", "com.caucho.vfs", "java.io", "javax.servlet" ]
com.caucho.server; com.caucho.vfs; java.io; javax.servlet;
905,395
T visitPrint(@NotNull BigDataScriptParser.PrintContext ctx);
T visitPrint(@NotNull BigDataScriptParser.PrintContext ctx);
/** * Visit a parse tree produced by {@link BigDataScriptParser#print}. * @param ctx the parse tree * @return the visitor result */
Visit a parse tree produced by <code>BigDataScriptParser#print</code>
visitPrint
{ "repo_name": "leepc12/BigDataScript", "path": "src/org/bds/antlr/BigDataScriptVisitor.java", "license": "apache-2.0", "size": 22181 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,315,983
public Properties getProperties() { return properties; }
Properties function() { return properties; }
/** * Returns the properties for the Kafka consumer. * * @return properties for the Kafka consumer. */
Returns the properties for the Kafka consumer
getProperties
{ "repo_name": "xiaokuangkuang/kuangjingxiangmu", "path": "flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceBase.java", "license": "apache-2.0", "size": 26071 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
1,687,126
@NonNull public List<String> whereArgs() { return whereArgs; }
List<String> function() { return whereArgs; }
/** * Gets optional immutable list of arguments for {@link #where()} clause. * * @return non-null, immutable list of arguments for {@code WHERE} clause. */
Gets optional immutable list of arguments for <code>#where()</code> clause
whereArgs
{ "repo_name": "zayass/storio", "path": "storio-sqlite/src/main/java/com/pushtorefresh/storio/sqlite/queries/UpdateQuery.java", "license": "apache-2.0", "size": 6760 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,620,660
public SharedObjects getSharedObjects() { if ( sharedObjects == null ) { try { String soFile = environmentSubstitute( sharedObjectsFile ); sharedObjects = new SharedObjects( soFile ); } catch ( KettleException e ) { LogChannel.GENERAL.logDebug( e.getMessage(), e ); } } return sharedObjects; }
SharedObjects function() { if ( sharedObjects == null ) { try { String soFile = environmentSubstitute( sharedObjectsFile ); sharedObjects = new SharedObjects( soFile ); } catch ( KettleException e ) { LogChannel.GENERAL.logDebug( e.getMessage(), e ); } } return sharedObjects; }
/** * Gets the shared objects. * * @return the sharedObjects */
Gets the shared objects
getSharedObjects
{ "repo_name": "GauravAshara/pentaho-kettle", "path": "engine/src/org/pentaho/di/base/AbstractMeta.java", "license": "apache-2.0", "size": 45990 }
[ "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.core.logging.LogChannel", "org.pentaho.di.shared.SharedObjects" ]
import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannel; import org.pentaho.di.shared.SharedObjects;
import org.pentaho.di.core.exception.*; import org.pentaho.di.core.logging.*; import org.pentaho.di.shared.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,236,968
public void computeFromTris(Triangle[] tris, int start, int end) { if (end - start <= 0) { return; } Vector3D[] vertList = new Vector3D[(end - start) * 3]; int count = 0; for (int i = start; i < end; i++) { // vertList[count++] = tris[i].get(0); // vertList[count++] = tris[i].get(1); // vertList[count++] = tris[i].get(2); vertList[count++] = tris[i].v0; vertList[count++] = tris[i].v1; vertList[count++] = tris[i].v2; } averagePoints(vertList); } // // public void computeFromTris(int[] indices, MTTriangleMesh mesh, int start, int end) { // if (end - start <= 0) { // return; // } // // Vector3D[] vertList = new Vector3D[(end - start) * 3]; // // Triangle[] tris = mesh.getTriangles(); // // int count = 0; // for (int i = start; i < end; i++) { // mesh.getTriangle(indices[i], verts); // vertList[count++] = new Vector3D(verts[0]); // vertList[count++] = new Vector3D(verts[1]); // vertList[count++] = new Vector3D(verts[2]); // } // // averagePoints(vertList); // }
void function(Triangle[] tris, int start, int end) { if (end - start <= 0) { return; } Vector3D[] vertList = new Vector3D[(end - start) * 3]; int count = 0; for (int i = start; i < end; i++) { vertList[count++] = tris[i].v0; vertList[count++] = tris[i].v1; vertList[count++] = tris[i].v2; } averagePoints(vertList); }
/** * <code>computeFromTris</code> creates a new Bounding Box from a given * set of triangles. It is used in OBBTree calculations. * * @param tris * @param start * @param end */
<code>computeFromTris</code> creates a new Bounding Box from a given set of triangles. It is used in OBBTree calculations
computeFromTris
{ "repo_name": "Twelve-60/mt4j", "path": "src/org/mt4j/components/bounds/BoundingSphere.java", "license": "gpl-2.0", "size": 55325 }
[ "org.mt4j.components.visibleComponents.shapes.mesh.Triangle", "org.mt4j.util.math.Vector3D" ]
import org.mt4j.components.visibleComponents.shapes.mesh.Triangle; import org.mt4j.util.math.Vector3D;
import org.mt4j.components.*; import org.mt4j.util.math.*;
[ "org.mt4j.components", "org.mt4j.util" ]
org.mt4j.components; org.mt4j.util;
1,991,462
@Override public synchronized void onWorkerComplete(IWorker worker) { if(storeFinishedWorkers()) getFinishedWorkers().put(worker.getId(), worker); getRunningWorkers().remove(worker); getStatusInfo().numComplete += 1; // checks if pause or stop were pending if(!isRunning()) return; notifyProgress(worker); // check completion if(sizePendingWorkers()==0 && getRunningWorkers().size()==0) { getStatusInfo().setStatus(WorkerManagerStatus.Status.STATUS_IDLE); notifyComplete(); return; } tryRunNextWorker(); } /** * {@link IWorker} progress {@code observer} * * @param worker the progressed {@link IWorker}
synchronized void function(IWorker worker) { if(storeFinishedWorkers()) getFinishedWorkers().put(worker.getId(), worker); getRunningWorkers().remove(worker); getStatusInfo().numComplete += 1; if(!isRunning()) return; notifyProgress(worker); if(sizePendingWorkers()==0 && getRunningWorkers().size()==0) { getStatusInfo().setStatus(WorkerManagerStatus.Status.STATUS_IDLE); notifyComplete(); return; } tryRunNextWorker(); } /** * {@link IWorker} progress {@code observer} * * @param worker the progressed {@link IWorker}
/** * process complete callback * * @param worker the completed process */
process complete callback
onWorkerComplete
{ "repo_name": "HKMOpen/Android-Zorn", "path": "src/main/java/com/hendrix/zorn/managers/AbstractWorkerManager.java", "license": "apache-2.0", "size": 13442 }
[ "com.hendrix.zorn.workers.IWorker" ]
import com.hendrix.zorn.workers.IWorker;
import com.hendrix.zorn.workers.*;
[ "com.hendrix.zorn" ]
com.hendrix.zorn;
1,298,017
public static RFC822name createRFC822name(final lotus.domino.Name name) { try { if (null == name) { throw new IllegalArgumentException("Name is null"); } String addr822 = Names.buildAddr822Full(name); return (Strings.isBlankString(addr822)) ? new RFC822name() : new RFC822name(addr822); } catch (final Exception e) { DominoUtils.handleException(e); } return null; }
static RFC822name function(final lotus.domino.Name name) { try { if (null == name) { throw new IllegalArgumentException(STR); } String addr822 = Names.buildAddr822Full(name); return (Strings.isBlankString(addr822)) ? new RFC822name() : new RFC822name(addr822); } catch (final Exception e) { DominoUtils.handleException(e); } return null; }
/** * Creates a new RFC822name object using the specified Name object as it's source. * * @param name * Name object from which to construct a new Name object. * * @return RFC822name created from the specified Name. Null on error. */
Creates a new RFC822name object using the specified Name object as it's source
createRFC822name
{ "repo_name": "OpenNTF/org.openntf.domino", "path": "domino/core/src/main/java/org/openntf/domino/utils/Names.java", "license": "apache-2.0", "size": 35655 }
[ "org.openntf.arpa.RFC822name", "org.openntf.domino.Name" ]
import org.openntf.arpa.RFC822name; import org.openntf.domino.Name;
import org.openntf.arpa.*; import org.openntf.domino.*;
[ "org.openntf.arpa", "org.openntf.domino" ]
org.openntf.arpa; org.openntf.domino;
2,662,716
public String getURL() throws SQLException { return this.conn.getURL(); }
String function() throws SQLException { return this.conn.getURL(); }
/** * What's the url for this database? * * @return the url or null if it can't be generated * @throws SQLException DOCUMENT ME! */
What's the url for this database
getURL
{ "repo_name": "hongliangpan/manydesigns.cn", "path": "trunk/portofino-database/mysql.src/com/mysql/jdbc/DatabaseMetaData.java", "license": "lgpl-3.0", "size": 275823 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,356,920
@ExternalFunction public static double carryRho(final double spot, final double strike, final double timeToExpiry, final double lognormalVol, final double interestRate, final double costOfCarry, final boolean isCall) { ArgumentChecker.isTrue(spot >= 0.0, "negative/NaN spot; have {}", spot); ArgumentChecker.isTrue(strike >= 0.0, "negative/NaN strike; have {}", strike); ArgumentChecker.isTrue(timeToExpiry >= 0.0, "negative/NaN timeToExpiry; have {}", timeToExpiry); ArgumentChecker.isTrue(lognormalVol >= 0.0, "negative/NaN lognormalVol; have {}", lognormalVol); ArgumentChecker.isFalse(Double.isNaN(interestRate), "interestRate is NaN"); ArgumentChecker.isFalse(Double.isNaN(costOfCarry), "costOfCarry is NaN"); double coef = 0.; if (interestRate > LARGE && costOfCarry > LARGE || -interestRate > LARGE && -costOfCarry > LARGE || Math.abs(costOfCarry - interestRate) < SMALL) { coef = 1.; // ref value is returned } else { final double rate = costOfCarry - interestRate; if (rate > LARGE) { return isCall ? Double.POSITIVE_INFINITY : costOfCarry > LARGE ? 0. : Double.NEGATIVE_INFINITY; } if (-rate > LARGE) { return 0.; } coef = Math.exp(rate * timeToExpiry); } if (spot > LARGE * strike || timeToExpiry > LARGE) { final double res = isCall ? coef * spot * timeToExpiry : 0.; return Double.isNaN(res) ? coef : res; } if (LARGE * spot < strike || timeToExpiry < SMALL) { final double res = isCall ? 0. : -coef * spot * timeToExpiry; return Double.isNaN(res) ? -coef : res; } final int sign = isCall ? 1 : -1; final double rootT = Math.sqrt(timeToExpiry); final double sigmaRootT = lognormalVol * rootT; final double factor = Math.exp(costOfCarry * timeToExpiry); final double rescaledSpot = spot * factor; double d1 = 0.; if (Math.abs(spot - strike) < SMALL || sigmaRootT > LARGE || spot > LARGE && strike > LARGE) { final double coefD1 = costOfCarry / lognormalVol + 0.5 * lognormalVol; final double tmp = coefD1 * rootT; d1 = Double.isNaN(tmp) ? 0. : tmp; } else { if (sigmaRootT < SMALL) { return isCall ? rescaledSpot > strike ? coef * timeToExpiry * spot : 0. : rescaledSpot < strike ? -coef * timeToExpiry * spot : 0.; } final double tmp = costOfCarry * rootT / lognormalVol; final double sig = costOfCarry >= 0. ? 1. : -1.; final double scnd = Double.isNaN(tmp) ? lognormalVol < LARGE && lognormalVol > SMALL ? sig / lognormalVol : sig * rootT : tmp; d1 = Math.log(spot / strike) / sigmaRootT + scnd + 0.5 * sigmaRootT; } // if (Double.isNaN(d1)) { // throw new IllegalArgumentException("NaN found"); // } final double norm = NORMAL.getCDF(sign * d1); final double result = norm < SMALL ? 0. : sign * coef * timeToExpiry * spot * norm; return Double.isNaN(result) ? sign * coef : result; }
static double function(final double spot, final double strike, final double timeToExpiry, final double lognormalVol, final double interestRate, final double costOfCarry, final boolean isCall) { ArgumentChecker.isTrue(spot >= 0.0, STR, spot); ArgumentChecker.isTrue(strike >= 0.0, STR, strike); ArgumentChecker.isTrue(timeToExpiry >= 0.0, STR, timeToExpiry); ArgumentChecker.isTrue(lognormalVol >= 0.0, STR, lognormalVol); ArgumentChecker.isFalse(Double.isNaN(interestRate), STR); ArgumentChecker.isFalse(Double.isNaN(costOfCarry), STR); double coef = 0.; if (interestRate > LARGE && costOfCarry > LARGE -interestRate > LARGE && -costOfCarry > LARGE Math.abs(costOfCarry - interestRate) < SMALL) { coef = 1.; } else { final double rate = costOfCarry - interestRate; if (rate > LARGE) { return isCall ? Double.POSITIVE_INFINITY : costOfCarry > LARGE ? 0. : Double.NEGATIVE_INFINITY; } if (-rate > LARGE) { return 0.; } coef = Math.exp(rate * timeToExpiry); } if (spot > LARGE * strike timeToExpiry > LARGE) { final double res = isCall ? coef * spot * timeToExpiry : 0.; return Double.isNaN(res) ? coef : res; } if (LARGE * spot < strike timeToExpiry < SMALL) { final double res = isCall ? 0. : -coef * spot * timeToExpiry; return Double.isNaN(res) ? -coef : res; } final int sign = isCall ? 1 : -1; final double rootT = Math.sqrt(timeToExpiry); final double sigmaRootT = lognormalVol * rootT; final double factor = Math.exp(costOfCarry * timeToExpiry); final double rescaledSpot = spot * factor; double d1 = 0.; if (Math.abs(spot - strike) < SMALL sigmaRootT > LARGE spot > LARGE && strike > LARGE) { final double coefD1 = costOfCarry / lognormalVol + 0.5 * lognormalVol; final double tmp = coefD1 * rootT; d1 = Double.isNaN(tmp) ? 0. : tmp; } else { if (sigmaRootT < SMALL) { return isCall ? rescaledSpot > strike ? coef * timeToExpiry * spot : 0. : rescaledSpot < strike ? -coef * timeToExpiry * spot : 0.; } final double tmp = costOfCarry * rootT / lognormalVol; final double sig = costOfCarry >= 0. ? 1. : -1.; final double scnd = Double.isNaN(tmp) ? lognormalVol < LARGE && lognormalVol > SMALL ? sig / lognormalVol : sig * rootT : tmp; d1 = Math.log(spot / strike) / sigmaRootT + scnd + 0.5 * sigmaRootT; } final double norm = NORMAL.getCDF(sign * d1); final double result = norm < SMALL ? 0. : sign * coef * timeToExpiry * spot * norm; return Double.isNaN(result) ? sign * coef : result; }
/** * The carry rho, the derivative of the option value with respect to the cost of carry Note that costOfCarry = interestRate - dividend, which the derivative * also acts on. * * @param spot * The spot value of the underlying * @param strike * The strike * @param timeToExpiry * The time to expiry * @param lognormalVol * The log-normal volatility * @param interestRate * The interest rate * @param costOfCarry * The cost of carry * @param isCall * True for call * @return The carry rho */
The carry rho, the derivative of the option value with respect to the cost of carry Note that costOfCarry = interestRate - dividend, which the derivative also acts on
carryRho
{ "repo_name": "McLeodMoores/starling", "path": "projects/analytics/src/main/java/com/opengamma/analytics/financial/model/volatility/BlackScholesFormulaRepository.java", "license": "apache-2.0", "size": 63346 }
[ "com.opengamma.util.ArgumentChecker" ]
import com.opengamma.util.ArgumentChecker;
import com.opengamma.util.*;
[ "com.opengamma.util" ]
com.opengamma.util;
1,792,826
public static void copyFile(String fromFilename, String toFilename) throws IOException { copyFile(new File(fromFilename), new File(toFilename)); }
static void function(String fromFilename, String toFilename) throws IOException { copyFile(new File(fromFilename), new File(toFilename)); }
/** * Copies a file to another location. */
Copies a file to another location
copyFile
{ "repo_name": "jeromechan/brooder", "path": "Packease/packease/src/main/java/com/aboutcoder/packease/util/io/FileUtils.java", "license": "mit", "size": 5097 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
895,045
NavigableMap<Integer, T> getMapByRawNum();
NavigableMap<Integer, T> getMapByRawNum();
/** * A mapping from original raw scan numbers (or "spectrum index" values in mzML). */
A mapping from original raw scan numbers (or "spectrum index" values in mzML)
getMapByRawNum
{ "repo_name": "chhh/MSFTBX", "path": "MSFileToolbox/src/main/java/umich/ms/datatypes/index/Index.java", "license": "apache-2.0", "size": 1868 }
[ "java.util.NavigableMap" ]
import java.util.NavigableMap;
import java.util.*;
[ "java.util" ]
java.util;
2,257,678
protected Metrics createMetricsByDimension(String namespace) { Map<String, String> dimensionMap = Maps.newHashMap(); dimensionMap.put("namespace", namespace); return createMetrics(dimensionMap); }
Metrics function(String namespace) { Map<String, String> dimensionMap = Maps.newHashMap(); dimensionMap.put(STR, namespace); return createMetrics(dimensionMap); }
/** * Creates a dimension key for metrics. * * @param namespace Namespace of metric * @return */
Creates a dimension key for metrics
createMetricsByDimension
{ "repo_name": "yahoo/pulsar", "path": "pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/metrics/AbstractMetrics.java", "license": "apache-2.0", "size": 9427 }
[ "com.google.common.collect.Maps", "java.util.Map", "org.apache.pulsar.common.stats.Metrics" ]
import com.google.common.collect.Maps; import java.util.Map; import org.apache.pulsar.common.stats.Metrics;
import com.google.common.collect.*; import java.util.*; import org.apache.pulsar.common.stats.*;
[ "com.google.common", "java.util", "org.apache.pulsar" ]
com.google.common; java.util; org.apache.pulsar;
1,776,711
@Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConnectionControl info = (ConnectionControl)o; int rc = super.tightMarshal1(wireFormat, o, bs); bs.writeBoolean(info.isClose()); bs.writeBoolean(info.isExit()); bs.writeBoolean(info.isFaultTolerant()); bs.writeBoolean(info.isResume()); bs.writeBoolean(info.isSuspend()); return rc + 0; }
int function(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConnectionControl info = (ConnectionControl)o; int rc = super.tightMarshal1(wireFormat, o, bs); bs.writeBoolean(info.isClose()); bs.writeBoolean(info.isExit()); bs.writeBoolean(info.isFaultTolerant()); bs.writeBoolean(info.isResume()); bs.writeBoolean(info.isSuspend()); return rc + 0; }
/** * Write the booleans that this object uses to a BooleanStream */
Write the booleans that this object uses to a BooleanStream
tightMarshal1
{ "repo_name": "tabish121/OpenWire", "path": "openwire-legacy/src/main/java/io/openwire/codec/v2/ConnectionControlMarshaller.java", "license": "apache-2.0", "size": 4623 }
[ "io.openwire.codec.BooleanStream", "io.openwire.codec.OpenWireFormat", "io.openwire.commands.ConnectionControl", "java.io.IOException" ]
import io.openwire.codec.BooleanStream; import io.openwire.codec.OpenWireFormat; import io.openwire.commands.ConnectionControl; import java.io.IOException;
import io.openwire.codec.*; import io.openwire.commands.*; import java.io.*;
[ "io.openwire.codec", "io.openwire.commands", "java.io" ]
io.openwire.codec; io.openwire.commands; java.io;
1,564,319
private RequestHandlerResponse search( HttpServletRequest request ) throws InvalidFormException, SQLException { RequestHandlerResponse response = new RequestHandlerResponse(); String submission_number = request.getParameter("search_sub_no"); if ( TextConverter.isEmpty(submission_number )) { throw new InvalidFormException( "No Search parameter provided" ); } DBconnection conn = null; DBWriteManager connectionPool = DBWriteManager.getInstance(); HashMap expressionsets = new HashMap (); try { conn = connectionPool.getSearchConnection(); String query = "select tair_object_id, name from ExpressionSet where submission_number=" + TextConverter.dbQuote(submission_number); ResultSet rset = null; conn.setQuery(query ); rset = conn.getResultSet(); while (rset.next()) { String id = rset.getString( "tair_object_id"); String name = rset.getString("name"); expressionsets.put ( id, name ); } } finally { connectionPool.return_connection( conn ); } String page = "/jsp/processor/microarray/delete_expressionset.jsp"; response.setPage( page ); response.setAttribute ( "expressionSets", expressionsets ); return response; }
RequestHandlerResponse function( HttpServletRequest request ) throws InvalidFormException, SQLException { RequestHandlerResponse response = new RequestHandlerResponse(); String submission_number = request.getParameter(STR); if ( TextConverter.isEmpty(submission_number )) { throw new InvalidFormException( STR ); } DBconnection conn = null; DBWriteManager connectionPool = DBWriteManager.getInstance(); HashMap expressionsets = new HashMap (); try { conn = connectionPool.getSearchConnection(); String query = STR + TextConverter.dbQuote(submission_number); ResultSet rset = null; conn.setQuery(query ); rset = conn.getResultSet(); while (rset.next()) { String id = rset.getString( STR); String name = rset.getString("name"); expressionsets.put ( id, name ); } } finally { connectionPool.return_connection( conn ); } String page = STR; response.setPage( page ); response.setAttribute ( STR, expressionsets ); return response; }
/** * Retrieves experiment submission number submitted for expression set * to be deleted from the database * @param request Servlet request * @param conn An active connection to the database * @throws InvalidFormException if submission number is missing * @throws SQLException if a database error occurs */
Retrieves experiment submission number submitted for expression set to be deleted from the database
search
{ "repo_name": "tair/tairwebapp", "path": "src/org/tair/processor/microarray/MicroarrayLoadHandler.java", "license": "gpl-3.0", "size": 22536 }
[ "java.sql.ResultSet", "java.sql.SQLException", "java.util.HashMap", "javax.servlet.http.HttpServletRequest", "org.tair.handler.RequestHandlerResponse", "org.tair.tfc.DBWriteManager", "org.tair.tfc.DBconnection", "org.tair.utilities.InvalidFormException", "org.tair.utilities.TextConverter" ]
import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import org.tair.handler.RequestHandlerResponse; import org.tair.tfc.DBWriteManager; import org.tair.tfc.DBconnection; import org.tair.utilities.InvalidFormException; import org.tair.utilities.TextConverter;
import java.sql.*; import java.util.*; import javax.servlet.http.*; import org.tair.handler.*; import org.tair.tfc.*; import org.tair.utilities.*;
[ "java.sql", "java.util", "javax.servlet", "org.tair.handler", "org.tair.tfc", "org.tair.utilities" ]
java.sql; java.util; javax.servlet; org.tair.handler; org.tair.tfc; org.tair.utilities;
1,691,435
public File getCSVDataAsFile(String fileName, List<IProject> projects, List<HLAMeasure> hlaMeasure, boolean cleanValues);
File function(String fileName, List<IProject> projects, List<HLAMeasure> hlaMeasure, boolean cleanValues);
/** * Convert the given projects into CSV data and write them to a file object. The fields will not be surrounded with any * quotation marks. * * @param fileName A relative or absolute file name. * @param projects A list of projects. * @param hlaMeasure The measures to use. * @param cleanValues When set to true, no non-numeric characters will be contained. * @return The {@link File} object containing the CSV data. */
Convert the given projects into CSV data and write them to a file object. The fields will not be surrounded with any quotation marks
getCSVDataAsFile
{ "repo_name": "badamowicz/sonar-hla", "path": "sonar-hla/src/main/java/com/github/badamowicz/sonar/hla/api/ISonarConverter.java", "license": "gpl-3.0", "size": 7120 }
[ "java.io.File", "java.util.List" ]
import java.io.File; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
804,774
protected long powerOfTen(int scale) { assert scale >= 0; assert scale < builder.getTypeFactory().getTypeSystem().getMaxNumericPrecision(); return BigInteger.TEN.pow(scale).longValue(); }
long function(int scale) { assert scale >= 0; assert scale < builder.getTypeFactory().getTypeSystem().getMaxNumericPrecision(); return BigInteger.TEN.pow(scale).longValue(); }
/** * Calculates a power of ten, as a long value. */
Calculates a power of ten, as a long value
powerOfTen
{ "repo_name": "datametica/calcite", "path": "core/src/main/java/org/apache/calcite/rel/rules/ReduceDecimalsRule.java", "license": "apache-2.0", "size": 44846 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,359,460
public Map<String, SocketAddress> getStreamOwnerMapping() { return stream2Addresses; }
Map<String, SocketAddress> function() { return stream2Addresses; }
/** * Get the stream ownership mapping. * * @return stream ownership mapping. */
Get the stream ownership mapping
getStreamOwnerMapping
{ "repo_name": "sijie/incubator-distributedlog", "path": "distributedlog-proxy-client/src/main/java/org/apache/distributedlog/client/ownership/OwnershipCache.java", "license": "apache-2.0", "size": 8791 }
[ "java.net.SocketAddress", "java.util.Map" ]
import java.net.SocketAddress; import java.util.Map;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
1,838,187