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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
@Test
public void clearPersistedFiles() throws Exception {
writeFileWithBlocks(1L, ImmutableList.of(2L, 3L));
mManager.clearPersistedFiles(ImmutableList.of(1L));
assertEquals(Collections.emptyList(), mManager.getPersistedFiles());
} | void function() throws Exception { writeFileWithBlocks(1L, ImmutableList.of(2L, 3L)); mManager.clearPersistedFiles(ImmutableList.of(1L)); assertEquals(Collections.emptyList(), mManager.getPersistedFiles()); } | /**
* Tests that persisted file are cleared in the manager.
*/ | Tests that persisted file are cleared in the manager | clearPersistedFiles | {
"repo_name": "ChangerYoung/alluxio",
"path": "core/server/worker/src/test/java/alluxio/worker/file/FileDataManagerTest.java",
"license": "apache-2.0",
"size": 11829
} | [
"com.google.common.collect.ImmutableList",
"java.util.Collections",
"org.junit.Assert"
] | import com.google.common.collect.ImmutableList; import java.util.Collections; import org.junit.Assert; | import com.google.common.collect.*; import java.util.*; import org.junit.*; | [
"com.google.common",
"java.util",
"org.junit"
] | com.google.common; java.util; org.junit; | 2,111,248 |
public void walkFileTree(Path root, FileVisitor<Path> fileVisitor) throws IOException {
java.nio.file.Files.walkFileTree(root, fileVisitor);
} | void function(Path root, FileVisitor<Path> fileVisitor) throws IOException { java.nio.file.Files.walkFileTree(root, fileVisitor); } | /**
* Allows {@link java.nio.file.Files#walkFileTree} to be faked in tests.
*/ | Allows <code>java.nio.file.Files#walkFileTree</code> to be faked in tests | walkFileTree | {
"repo_name": "denizt/buck",
"path": "src/com/facebook/buck/util/ProjectFilesystem.java",
"license": "apache-2.0",
"size": 11970
} | [
"com.google.common.io.Files",
"java.io.IOException",
"java.nio.file.FileVisitor",
"java.nio.file.Path"
] | import com.google.common.io.Files; import java.io.IOException; import java.nio.file.FileVisitor; import java.nio.file.Path; | import com.google.common.io.*; import java.io.*; import java.nio.file.*; | [
"com.google.common",
"java.io",
"java.nio"
] | com.google.common; java.io; java.nio; | 195,666 |
public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj);
mCdmaForSubscriptionInfoReadyRegistrants.add(r);
if (isMinInfoReady()) {
r.notifyRegistrant();
}
} | void function(Handler h, int what, Object obj) { Registrant r = new Registrant(h, what, obj); mCdmaForSubscriptionInfoReadyRegistrants.add(r); if (isMinInfoReady()) { r.notifyRegistrant(); } } | /**
* Registration point for subscription info ready
* @param h handler to notify
* @param what what code of message when delivered
* @param obj placed in Message.obj
*/ | Registration point for subscription info ready | registerForSubscriptionInfoReady | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/opt/telephony/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java",
"license": "gpl-3.0",
"size": 83187
} | [
"android.os.Handler",
"android.os.Registrant"
] | import android.os.Handler; import android.os.Registrant; | import android.os.*; | [
"android.os"
] | android.os; | 687,255 |
public Element getRootElement(){
return doc.getRootElement();
}
| Element function(){ return doc.getRootElement(); } | /** Gets the root element of the DOM
* @return Root element of DOM
*/ | Gets the root element of the DOM | getRootElement | {
"repo_name": "DynamicalSystem/brailleblaster",
"path": "src/main/org/brailleblaster/document/BBDocument.java",
"license": "apache-2.0",
"size": 23111
} | [
"nu.xom.Element"
] | import nu.xom.Element; | import nu.xom.*; | [
"nu.xom"
] | nu.xom; | 2,080,123 |
public void receivedUnknownMessage(UnknownMessageEvent evt); | void function(UnknownMessageEvent evt); | /**
* Fired when an Unknow message is received
*
* @param evt UnknownMessageEvent
*/ | Fired when an Unknow message is received | receivedUnknownMessage | {
"repo_name": "guusdk/Spark",
"path": "plugins/sip/src/main/java/net/java/sipmack/softphone/listeners/SoftPhoneListener.java",
"license": "apache-2.0",
"size": 1858
} | [
"net.java.sipmack.sip.event.UnknownMessageEvent"
] | import net.java.sipmack.sip.event.UnknownMessageEvent; | import net.java.sipmack.sip.event.*; | [
"net.java.sipmack"
] | net.java.sipmack; | 1,215,361 |
public void addButton(String name, ActionListener action) {
JButton temp = new JButton(name);
buttonMap.put(name, temp);
int rows = buttonMap.size() % buttonsPerCol == 0 ? buttonMap.size() / buttonsPerCol : buttonMap.size() / buttonsPerCol + 1;
masterPanel.setLayout(new GridLayout(rows, buttonsPerCol > buttonMap.size() ? buttonMap.size() : buttonsPerCol, 15, 15));
masterPanel.add(temp);
temp.addActionListener(action);
buttonAction.put(name, action);
}
| void function(String name, ActionListener action) { JButton temp = new JButton(name); buttonMap.put(name, temp); int rows = buttonMap.size() % buttonsPerCol == 0 ? buttonMap.size() / buttonsPerCol : buttonMap.size() / buttonsPerCol + 1; masterPanel.setLayout(new GridLayout(rows, buttonsPerCol > buttonMap.size() ? buttonMap.size() : buttonsPerCol, 15, 15)); masterPanel.add(temp); temp.addActionListener(action); buttonAction.put(name, action); } | /**
* add button
* @param name button name
* @param action action when pressing this menu bar item
*/ | add button | addButton | {
"repo_name": "andyballer/battleGame",
"path": "src/display/util/ButtonPanel.java",
"license": "mit",
"size": 2103
} | [
"java.awt.GridLayout",
"java.awt.event.ActionListener",
"javax.swing.JButton"
] | import java.awt.GridLayout; import java.awt.event.ActionListener; import javax.swing.JButton; | import java.awt.*; import java.awt.event.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,126,043 |
@Test
public void shouldSendThirtyDataPackets() throws Exception {
byte[] controlData = new byte[blockSize * 3];
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
initiatorJID);
// set acknowledgments for the data packets
IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);
for (int i = 0; i < controlData.length; i++) {
protocol.addResponse(resultIQ, incrementingSequence);
}
OutputStream outputStream = session.getOutputStream();
for (byte b : controlData) {
outputStream.write(b);
outputStream.flush();
}
protocol.verifyAll();
} | void function() throws Exception { byte[] controlData = new byte[blockSize * 3]; InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream, initiatorJID); IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID); for (int i = 0; i < controlData.length; i++) { protocol.addResponse(resultIQ, incrementingSequence); } OutputStream outputStream = session.getOutputStream(); for (byte b : controlData) { outputStream.write(b); outputStream.flush(); } protocol.verifyAll(); } | /**
* Test the output stream flush() method.
*
* @throws Exception should not happen
*/ | Test the output stream flush() method | shouldSendThirtyDataPackets | {
"repo_name": "magnetsystems/message-smack",
"path": "smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java",
"license": "apache-2.0",
"size": 22768
} | [
"java.io.OutputStream"
] | import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,236,385 |
List<VpnTarget> vpnTarget(); | List<VpnTarget> vpnTarget(); | /**
* Returns the attribute vpnTarget.
*
* @return list of vpnTarget
*/ | Returns the attribute vpnTarget | vpnTarget | {
"repo_name": "mengmoya/onos",
"path": "apps/l3vpn/nel3vpn/nemgr/src/main/java/org/onosproject/yang/gen/v1/ne/l3vpn/api/rev20141225/nel3vpnapi/l3vpninstances/l3vpninstance/vpninstafs/vpninstaf/VpnTargets.java",
"license": "apache-2.0",
"size": 1815
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 977,248 |
public Map<String, Chain> getChainMap() {
return this.chainMap;
} | Map<String, Chain> function() { return this.chainMap; } | /**
* return Map of chains this channel is in
*
* @return Map
*/ | return Map of chains this channel is in | getChainMap | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelContainer.java",
"license": "epl-1.0",
"size": 3037
} | [
"com.ibm.ws.channelfw.internal.chains.Chain",
"java.util.Map"
] | import com.ibm.ws.channelfw.internal.chains.Chain; import java.util.Map; | import com.ibm.ws.channelfw.internal.chains.*; import java.util.*; | [
"com.ibm.ws",
"java.util"
] | com.ibm.ws; java.util; | 12,848 |
static ByteString unescapeBytes(final CharSequence charString)
throws InvalidEscapeSequenceException {
// First convert the Java characater sequence to UTF-8 bytes.
ByteString input = ByteString.copyFromUtf8(charString.toString());
// Then unescape certain byte sequences introduced by ASCII '\\'. The valid
// escapes can all be expressed with ASCII characters, so it is safe to
// operate on bytes here.
//
// Unescaping the input byte array will result in a byte sequence that's no
// longer than the input. That's because each escape sequence is between
// two and four bytes long and stands for a single byte.
final byte[] result = new byte[input.size()];
int pos = 0;
for (int i = 0; i < input.size(); i++) {
byte c = input.byteAt(i);
if (c == '\\') {
if (i + 1 < input.size()) {
++i;
c = input.byteAt(i);
if (isOctal(c)) {
// Octal escape.
int code = digitValue(c);
if (i + 1 < input.size() && isOctal(input.byteAt(i + 1))) {
++i;
code = code * 8 + digitValue(input.byteAt(i));
}
if (i + 1 < input.size() && isOctal(input.byteAt(i + 1))) {
++i;
code = code * 8 + digitValue(input.byteAt(i));
}
// TODO: Check that 0 <= code && code <= 0xFF.
result[pos++] = (byte)code;
} else {
switch (c) {
case 'a' : result[pos++] = 0x07; break;
case 'b' : result[pos++] = '\b'; break;
case 'f' : result[pos++] = '\f'; break;
case 'n' : result[pos++] = '\n'; break;
case 'r' : result[pos++] = '\r'; break;
case 't' : result[pos++] = '\t'; break;
case 'v' : result[pos++] = 0x0b; break;
case '\\': result[pos++] = '\\'; break;
case '\'': result[pos++] = '\''; break;
case '"' : result[pos++] = '\"'; break;
case 'x':
// hex escape
int code = 0;
if (i + 1 < input.size() && isHex(input.byteAt(i + 1))) {
++i;
code = digitValue(input.byteAt(i));
} else {
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\x' with no digits");
}
if (i + 1 < input.size() && isHex(input.byteAt(i + 1))) {
++i;
code = code * 16 + digitValue(input.byteAt(i));
}
result[pos++] = (byte)code;
break;
default:
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\" + (char)c + '\'');
}
}
} else {
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\' at end of string.");
}
} else {
result[pos++] = c;
}
}
return ByteString.copyFrom(result, 0, pos);
}
static class InvalidEscapeSequenceException extends IOException {
private static final long serialVersionUID = -8164033650142593304L;
InvalidEscapeSequenceException(final String description) {
super(description);
}
} | static ByteString unescapeBytes(final CharSequence charString) throws InvalidEscapeSequenceException { ByteString input = ByteString.copyFromUtf8(charString.toString()); final byte[] result = new byte[input.size()]; int pos = 0; for (int i = 0; i < input.size(); i++) { byte c = input.byteAt(i); if (c == '\\') { if (i + 1 < input.size()) { ++i; c = input.byteAt(i); if (isOctal(c)) { int code = digitValue(c); if (i + 1 < input.size() && isOctal(input.byteAt(i + 1))) { ++i; code = code * 8 + digitValue(input.byteAt(i)); } if (i + 1 < input.size() && isOctal(input.byteAt(i + 1))) { ++i; code = code * 8 + digitValue(input.byteAt(i)); } result[pos++] = (byte)code; } else { switch (c) { case 'a' : result[pos++] = 0x07; break; case 'b' : result[pos++] = '\b'; break; case 'f' : result[pos++] = '\f'; break; case 'n' : result[pos++] = '\n'; break; case 'r' : result[pos++] = '\r'; break; case 't' : result[pos++] = '\t'; break; case 'v' : result[pos++] = 0x0b; break; case '\\': result[pos++] = '\\'; break; case '\'': result[pos++] = '\''; break; case 'STR'; break; case 'x': int code = 0; if (i + 1 < input.size() && isHex(input.byteAt(i + 1))) { ++i; code = digitValue(input.byteAt(i)); } else { throw new InvalidEscapeSequenceException( STR); } if (i + 1 < input.size() && isHex(input.byteAt(i + 1))) { ++i; code = code * 16 + digitValue(input.byteAt(i)); } result[pos++] = (byte)code; break; default: throw new InvalidEscapeSequenceException( STR + (char)c + '\''); } } } else { throw new InvalidEscapeSequenceException( STR); } } else { result[pos++] = c; } } return ByteString.copyFrom(result, 0, pos); } static class InvalidEscapeSequenceException extends IOException { private static final long serialVersionUID = -8164033650142593304L; InvalidEscapeSequenceException(final String description) { super(description); } } | /**
* Un-escape a byte sequence as escaped using
* {@link #escapeBytes(ByteString)}. Two-digit hex escapes (starting with
* "\x") are also recognized.
*/ | Un-escape a byte sequence as escaped using <code>#escapeBytes(ByteString)</code>. Two-digit hex escapes (starting with "\x") are also recognized | unescapeBytes | {
"repo_name": "os72/protobuf-java-shaded-241",
"path": "java/src/main/java/com/github/os72/protobuf241/TextFormat.java",
"license": "bsd-3-clause",
"size": 50731
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,442,495 |
public String getString(final String name, final String category, final String defaultValue, final String comment, final String langKey, final Pattern pattern)
{
final Property prop = this.get(category, name, defaultValue);
prop.setLanguageKey(langKey);
prop.setValidationPattern(pattern);
prop.comment = comment + " [default: " + defaultValue + "]";
return prop.getString();
} | String function(final String name, final String category, final String defaultValue, final String comment, final String langKey, final Pattern pattern) { final Property prop = this.get(category, name, defaultValue); prop.setLanguageKey(langKey); prop.setValidationPattern(pattern); prop.comment = comment + STR + defaultValue + "]"; return prop.getString(); } | /**
* Creates a string property.
*
* @param name Name of the property.
* @param category Category of the property.
* @param defaultValue Default value of the property.
* @param comment A brief description what the property does.
* @param langKey A language key used for localization of GUIs
* @return The value of the new string property.
*/ | Creates a string property | getString | {
"repo_name": "OreCruncher/Restructured",
"path": "src/main/java/org/blockartistry/mod/Restructured/util/JarConfiguration.java",
"license": "mit",
"size": 61536
} | [
"java.util.regex.Pattern",
"net.minecraftforge.common.config.Property"
] | import java.util.regex.Pattern; import net.minecraftforge.common.config.Property; | import java.util.regex.*; import net.minecraftforge.common.config.*; | [
"java.util",
"net.minecraftforge.common"
] | java.util; net.minecraftforge.common; | 254,453 |
public static void printDebug(String message) {
if(DEBUG){
printMessage(LogService.LOG_DEBUG, message);
}
} | static void function(String message) { if(DEBUG){ printMessage(LogService.LOG_DEBUG, message); } } | /**
* show debug with the logger service or only on standard output if it doesn't
* started
*
* @param message
*/ | show debug with the logger service or only on standard output if it doesn't started | printDebug | {
"repo_name": "Orange-OpenSource/Driver-RX-TX",
"path": "driver-rx-tx/src/java/gnu/io/RXTXlog.java",
"license": "lgpl-2.1",
"size": 4625
} | [
"org.osgi.service.log.LogService"
] | import org.osgi.service.log.LogService; | import org.osgi.service.log.*; | [
"org.osgi.service"
] | org.osgi.service; | 802,870 |
public void validateDocument(Document doc) throws ConverterException {
ClassLoader cl = PathwayModel.class.getClassLoader();
InputStream is = cl.getResourceAsStream(xsdFile);
if (is != null) {
Schema schema;
try {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
StreamSource ss = new StreamSource(is);
schema = factory.newSchema(ss);
ValidatorHandler vh = schema.newValidatorHandler();
SAXOutputter so = new SAXOutputter(vh);
so.output(doc);
// If no errors occur, the file is valid according to the gpml xml schema
// definition
Logger.log
.info("Document is valid according to the xml schema definition '" + xsdFile.toString() + "'");
} catch (SAXException se) {
Logger.log.error("Could not parse the xml-schema definition", se);
throw new ConverterException(se);
} catch (JDOMException je) {
Logger.log.error("Document is invalid according to the xml-schema definition!: " + je.getMessage(), je);
XMLOutputter xmlcode = new XMLOutputter(Format.getPrettyFormat());
Logger.log.error("The invalid XML code:\n" + xmlcode.outputString(doc));
throw new ConverterException(je);
}
} else {
Logger.log.error("Document is not validated because the xml schema definition '" + xsdFile
+ "' could not be found in classpath");
throw new ConverterException("Document is not validated because the xml schema definition '" + xsdFile
+ "' could not be found in classpath");
}
} | void function(Document doc) throws ConverterException { ClassLoader cl = PathwayModel.class.getClassLoader(); InputStream is = cl.getResourceAsStream(xsdFile); if (is != null) { Schema schema; try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); StreamSource ss = new StreamSource(is); schema = factory.newSchema(ss); ValidatorHandler vh = schema.newValidatorHandler(); SAXOutputter so = new SAXOutputter(vh); so.output(doc); Logger.log .info(STR + xsdFile.toString() + "'"); } catch (SAXException se) { Logger.log.error(STR, se); throw new ConverterException(se); } catch (JDOMException je) { Logger.log.error(STR + je.getMessage(), je); XMLOutputter xmlcode = new XMLOutputter(Format.getPrettyFormat()); Logger.log.error(STR + xmlcode.outputString(doc)); throw new ConverterException(je); } } else { Logger.log.error(STR + xsdFile + STR); throw new ConverterException(STR + xsdFile + STR); } } | /**
* validates a JDOM document against the xml-schema definition specified by
* 'xsdFile'
*
* @param doc the document to validate
*/ | validates a JDOM document against the xml-schema definition specified by 'xsdFile' | validateDocument | {
"repo_name": "PathVisio/libGPML",
"path": "org.pathvisio.lib/src/main/java/org/pathvisio/model/GPML2021FormatAbstract.java",
"license": "apache-2.0",
"size": 6240
} | [
"java.io.InputStream",
"javax.xml.XMLConstants",
"javax.xml.transform.stream.StreamSource",
"javax.xml.validation.Schema",
"javax.xml.validation.SchemaFactory",
"javax.xml.validation.ValidatorHandler",
"org.jdom2.Document",
"org.jdom2.JDOMException",
"org.jdom2.output.Format",
"org.jdom2.output.SA... | import java.io.InputStream; import javax.xml.XMLConstants; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.ValidatorHandler; import org.jdom2.Document; import org.jdom2.JDOMException; import org.jdom2.output.Format; import org.jdom2.output.SAXOutputter; import org.jdom2.output.XMLOutputter; import org.pathvisio.debug.Logger; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.*; import javax.xml.transform.stream.*; import javax.xml.validation.*; import org.jdom2.*; import org.jdom2.output.*; import org.pathvisio.debug.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.jdom2",
"org.jdom2.output",
"org.pathvisio.debug",
"org.xml.sax"
] | java.io; javax.xml; org.jdom2; org.jdom2.output; org.pathvisio.debug; org.xml.sax; | 1,165,970 |
private String runValidation(final String file, final boolean result)
throws IOException {
final Environment.Mock mock = new Environment.Mock();
final File license = this.rule.savePackageInfo(
new File(mock.basedir(), CheckstyleValidatorTest.DIRECTORY)
).withLines(new String[] {CheckstyleValidatorTest.LICENSE})
.withEol("\n").file();
final StringWriter writer = new StringWriter();
org.apache.log4j.Logger.getRootLogger().addAppender(
new WriterAppender(new SimpleLayout(), writer)
);
final Environment env = mock.withParam(
CheckstyleValidatorTest.LICENSE_PROP,
this.toURL(license)
)
.withFile(
String.format("src/main/java/foo/%s", file),
IOUtils.toString(
this.getClass().getResourceAsStream(file)
)
);
boolean valid = true;
try {
new CheckstyleValidator().validate(env);
} catch (final ValidationException ex) {
valid = false;
}
MatcherAssert.assertThat(valid, Matchers.is(result));
return writer.toString();
} | String function(final String file, final boolean result) throws IOException { final Environment.Mock mock = new Environment.Mock(); final File license = this.rule.savePackageInfo( new File(mock.basedir(), CheckstyleValidatorTest.DIRECTORY) ).withLines(new String[] {CheckstyleValidatorTest.LICENSE}) .withEol("\n").file(); final StringWriter writer = new StringWriter(); org.apache.log4j.Logger.getRootLogger().addAppender( new WriterAppender(new SimpleLayout(), writer) ); final Environment env = mock.withParam( CheckstyleValidatorTest.LICENSE_PROP, this.toURL(license) ) .withFile( String.format(STR, file), IOUtils.toString( this.getClass().getResourceAsStream(file) ) ); boolean valid = true; try { new CheckstyleValidator().validate(env); } catch (final ValidationException ex) { valid = false; } MatcherAssert.assertThat(valid, Matchers.is(result)); return writer.toString(); } | /**
* Returns string with Checkstyle validation results.
* @param file File to check.
* @param result Expected validation result.
* @return String containing validation results in textual form.
* @throws IOException In case of error
*/ | Returns string with Checkstyle validation results | runValidation | {
"repo_name": "carlosmiranda/qulice",
"path": "qulice-checkstyle/src/test/java/com/qulice/checkstyle/CheckstyleValidatorTest.java",
"license": "bsd-3-clause",
"size": 15108
} | [
"com.qulice.spi.Environment",
"com.qulice.spi.ValidationException",
"java.io.File",
"java.io.IOException",
"java.io.StringWriter",
"org.apache.commons.io.IOUtils",
"org.apache.log4j.SimpleLayout",
"org.apache.log4j.WriterAppender",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import com.qulice.spi.Environment; import com.qulice.spi.ValidationException; import java.io.File; import java.io.IOException; import java.io.StringWriter; import org.apache.commons.io.IOUtils; import org.apache.log4j.SimpleLayout; import org.apache.log4j.WriterAppender; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import com.qulice.spi.*; import java.io.*; import org.apache.commons.io.*; import org.apache.log4j.*; import org.hamcrest.*; | [
"com.qulice.spi",
"java.io",
"org.apache.commons",
"org.apache.log4j",
"org.hamcrest"
] | com.qulice.spi; java.io; org.apache.commons; org.apache.log4j; org.hamcrest; | 1,028,302 |
void sortBy(int index)
{
model.getSorter().setByDate(SORT_BY_DATE == index);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Browser browser = model.getBrowser();
Layout layout = browser.getSelectedLayout();
if (layout != null)
browser.accept(layout, ImageDisplayVisitor.IMAGE_SET_ONLY);
ImageTableView v = model.getTableView();
if (v != null) v.refreshTable();
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} | void sortBy(int index) { model.getSorter().setByDate(SORT_BY_DATE == index); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Browser browser = model.getBrowser(); Layout layout = browser.getSelectedLayout(); if (layout != null) browser.accept(layout, ImageDisplayVisitor.IMAGE_SET_ONLY); ImageTableView v = model.getTableView(); if (v != null) v.refreshTable(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } | /**
* Sorts the thumbnails either alphabetically or by date.
*
* @param index The sorting index.
*/ | Sorts the thumbnails either alphabetically or by date | sortBy | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserUI.java",
"license": "gpl-2.0",
"size": 19515
} | [
"java.awt.Cursor",
"org.openmicroscopy.shoola.agents.dataBrowser.browser.Browser",
"org.openmicroscopy.shoola.agents.dataBrowser.browser.ImageDisplayVisitor",
"org.openmicroscopy.shoola.agents.dataBrowser.layout.Layout"
] | import java.awt.Cursor; import org.openmicroscopy.shoola.agents.dataBrowser.browser.Browser; import org.openmicroscopy.shoola.agents.dataBrowser.browser.ImageDisplayVisitor; import org.openmicroscopy.shoola.agents.dataBrowser.layout.Layout; | import java.awt.*; import org.openmicroscopy.shoola.agents.*; | [
"java.awt",
"org.openmicroscopy.shoola"
] | java.awt; org.openmicroscopy.shoola; | 1,218,409 |
public List<List<Integer>> getFactors3(int n) {
List<List<Integer>> ans = new ArrayList<>();
backtrack3(n, ans, new ArrayList<Integer>());
return ans;
} | List<List<Integer>> function(int n) { List<List<Integer>> ans = new ArrayList<>(); backtrack3(n, ans, new ArrayList<Integer>()); return ans; } | /**
* same speed as above
*/ | same speed as above | getFactors3 | {
"repo_name": "BruceZu/KeepTry",
"path": "arrows/src/main/java/nosubmmitted/LC254FactorCombinations.java",
"license": "apache-2.0",
"size": 5846
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,586,808 |
private static void enableCountrySpecificEncodings() {
Resources r = Resources.getSystem();
// See comments in frameworks/base/core/res/res/values/config.xml for allowed values
sEnabledSingleShiftTables = r.getIntArray(R.array.config_sms_enabled_single_shift_tables);
sEnabledLockingShiftTables = r.getIntArray(R.array.config_sms_enabled_locking_shift_tables);
if (sEnabledSingleShiftTables.length > 0) {
sHighestEnabledSingleShiftCode =
sEnabledSingleShiftTables[sEnabledSingleShiftTables.length-1];
} else {
sHighestEnabledSingleShiftCode = 0;
}
}
private static final SparseIntArray[] sCharsToGsmTables;
private static final SparseIntArray[] sCharsToShiftTables;
private static int[] sEnabledSingleShiftTables;
private static int[] sEnabledLockingShiftTables;
private static int sHighestEnabledSingleShiftCode;
private static boolean sDisableCountryEncodingCheck = false;
private static class LanguagePairCount {
final int languageCode;
final int[] septetCounts;
final int[] unencodableCounts;
LanguagePairCount(int code) {
this.languageCode = code;
int maxSingleShiftCode = sHighestEnabledSingleShiftCode;
septetCounts = new int[maxSingleShiftCode + 1];
unencodableCounts = new int[maxSingleShiftCode + 1];
// set counters for disabled single shift tables to -1
// (GSM default extension table index 0 is always enabled)
for (int i = 1, tableOffset = 0; i <= maxSingleShiftCode; i++) {
if (sEnabledSingleShiftTables[tableOffset] == i) {
tableOffset++;
} else {
septetCounts[i] = -1; // disabled
}
}
// exclude Turkish locking + Turkish single shift table and
// Portuguese locking + Spanish single shift table (these
// combinations will never be optimal for any input).
if (code == 1 && maxSingleShiftCode >= 1) {
septetCounts[1] = -1; // Turkish + Turkish
} else if (code == 3 && maxSingleShiftCode >= 2) {
septetCounts[2] = -1; // Portuguese + Spanish
}
}
}
private static final String[] sLanguageTables = {
"@\u00a3$\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\n\u00d8\u00f8\r\u00c5\u00e5\u0394_"
// 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
+ "\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\uffff\u00c6\u00e6\u00df"
// F.....012.34.....56789ABCDEF0123456789ABCDEF0.....123456789ABCDEF0123456789A
+ "\u00c9 !\"#\u00a4%&'()*+,-./0123456789:;<=>?\u00a1ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// B.....C.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
+ "\u00c4\u00d6\u00d1\u00dc\u00a7\u00bfabcdefghijklmnopqrstuvwxyz\u00e4\u00f6\u00f1"
// E.....F.....
+ "\u00fc\u00e0",
"@\u00a3$\u00a5\u20ac\u00e9\u00f9\u0131\u00f2\u00c7\n\u011e\u011f\r\u00c5\u00e5\u0394_"
// 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
+ "\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\uffff\u015e\u015f\u00df"
// F.....012.34.....56789ABCDEF0123456789ABCDEF0.....123456789ABCDEF0123456789A
+ "\u00c9 !\"#\u00a4%&'()*+,-./0123456789:;<=>?\u0130ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// B.....C.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
+ "\u00c4\u00d6\u00d1\u00dc\u00a7\u00e7abcdefghijklmnopqrstuvwxyz\u00e4\u00f6\u00f1"
// E.....F.....
+ "\u00fc\u00e0",
"",
"@\u00a3$\u00a5\u00ea\u00e9\u00fa\u00ed\u00f3\u00e7\n\u00d4\u00f4\r\u00c1\u00e1\u0394_"
// 2.....3.....4.....5.....67.8.....9.....AB.....C.....D.....E.....F.....012.34.....
+ "\u00aa\u00c7\u00c0\u221e^\\\u20ac\u00d3|\uffff\u00c2\u00e2\u00ca\u00c9 !\"#\u00ba"
// 56789ABCDEF0123456789ABCDEF0.....123456789ABCDEF0123456789AB.....C.....D.....E.....
+ "%&'()*+,-./0123456789:;<=>?\u00cdABCDEFGHIJKLMNOPQRSTUVWXYZ\u00c3\u00d5\u00da\u00dc"
// F.....0123456789ABCDEF0123456789AB.....C.....DE.....F.....
+ "\u00a7~abcdefghijklmnopqrstuvwxyz\u00e3\u00f5`\u00fc\u00e0",
"\u0981\u0982\u0983\u0985\u0986\u0987\u0988\u0989\u098a\u098b\n\u098c \r \u098f\u0990"
// 123.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....
+ " \u0993\u0994\u0995\u0996\u0997\u0998\u0999\u099a\uffff\u099b\u099c\u099d\u099e"
// 012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABC
+ " !\u099f\u09a0\u09a1\u09a2\u09a3\u09a4)(\u09a5\u09a6,\u09a7.\u09a80123456789:; "
// D.....E.....F0.....1.....2.....3.....4.....56.....789A.....B.....C.....D.....
+ "\u09aa\u09ab?\u09ac\u09ad\u09ae\u09af\u09b0 \u09b2 \u09b6\u09b7\u09b8\u09b9"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....789.....A.....BCD.....E.....
+ "\u09bc\u09bd\u09be\u09bf\u09c0\u09c1\u09c2\u09c3\u09c4 \u09c7\u09c8 \u09cb\u09cc"
// F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....F.....
+ "\u09cd\u09ceabcdefghijklmnopqrstuvwxyz\u09d7\u09dc\u09dd\u09f0\u09f1",
"\u0a81\u0a82\u0a83\u0a85\u0a86\u0a87\u0a88\u0a89\u0a8a\u0a8b\n\u0a8c\u0a8d\r \u0a8f\u0a90"
// 1.....23.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
+ "\u0a91 \u0a93\u0a94\u0a95\u0a96\u0a97\u0a98\u0a99\u0a9a\uffff\u0a9b\u0a9c\u0a9d"
// F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789AB
+ "\u0a9e !\u0a9f\u0aa0\u0aa1\u0aa2\u0aa3\u0aa4)(\u0aa5\u0aa6,\u0aa7.\u0aa80123456789:;"
// CD.....E.....F0.....1.....2.....3.....4.....56.....7.....89.....A.....B.....C.....
+ " \u0aaa\u0aab?\u0aac\u0aad\u0aae\u0aaf\u0ab0 \u0ab2\u0ab3 \u0ab5\u0ab6\u0ab7\u0ab8"
// D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89.....A.....
+ "\u0ab9\u0abc\u0abd\u0abe\u0abf\u0ac0\u0ac1\u0ac2\u0ac3\u0ac4\u0ac5 \u0ac7\u0ac8"
// B.....CD.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....
+ "\u0ac9 \u0acb\u0acc\u0acd\u0ad0abcdefghijklmnopqrstuvwxyz\u0ae0\u0ae1\u0ae2\u0ae3"
// F.....
+ "\u0af1",
"\u0901\u0902\u0903\u0905\u0906\u0907\u0908\u0909\u090a\u090b\n\u090c\u090d\r\u090e\u090f"
// 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....
+ "\u0910\u0911\u0912\u0913\u0914\u0915\u0916\u0917\u0918\u0919\u091a\uffff\u091b\u091c"
// E.....F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....012345
+ "\u091d\u091e !\u091f\u0920\u0921\u0922\u0923\u0924)(\u0925\u0926,\u0927.\u0928012345"
// 6789ABC.....D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....8.....
+ "6789:;\u0929\u092a\u092b?\u092c\u092d\u092e\u092f\u0930\u0931\u0932\u0933\u0934"
// 9.....A.....B.....C.....D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....
+ "\u0935\u0936\u0937\u0938\u0939\u093c\u093d\u093e\u093f\u0940\u0941\u0942\u0943\u0944"
// 7.....8.....9.....A.....B.....C.....D.....E.....F.....0.....123456789ABCDEF012345678
+ "\u0945\u0946\u0947\u0948\u0949\u094a\u094b\u094c\u094d\u0950abcdefghijklmnopqrstuvwx"
// 9AB.....C.....D.....E.....F.....
+ "yz\u0972\u097b\u097c\u097e\u097f",
" \u0c82\u0c83\u0c85\u0c86\u0c87\u0c88\u0c89\u0c8a\u0c8b\n\u0c8c \r\u0c8e\u0c8f\u0c90 "
// 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....
+ "\u0c92\u0c93\u0c94\u0c95\u0c96\u0c97\u0c98\u0c99\u0c9a\uffff\u0c9b\u0c9c\u0c9d\u0c9e"
// 012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABC
+ " !\u0c9f\u0ca0\u0ca1\u0ca2\u0ca3\u0ca4)(\u0ca5\u0ca6,\u0ca7.\u0ca80123456789:; "
// D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....89.....A.....B.....
+ "\u0caa\u0cab?\u0cac\u0cad\u0cae\u0caf\u0cb0\u0cb1\u0cb2\u0cb3 \u0cb5\u0cb6\u0cb7"
// C.....D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....78.....9.....
+ "\u0cb8\u0cb9\u0cbc\u0cbd\u0cbe\u0cbf\u0cc0\u0cc1\u0cc2\u0cc3\u0cc4 \u0cc6\u0cc7"
// A.....BC.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
+ "\u0cc8 \u0cca\u0ccb\u0ccc\u0ccd\u0cd5abcdefghijklmnopqrstuvwxyz\u0cd6\u0ce0\u0ce1"
// E.....F.....
+ "\u0ce2\u0ce3",
" \u0d02\u0d03\u0d05\u0d06\u0d07\u0d08\u0d09\u0d0a\u0d0b\n\u0d0c \r\u0d0e\u0d0f\u0d10 "
// 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....
+ "\u0d12\u0d13\u0d14\u0d15\u0d16\u0d17\u0d18\u0d19\u0d1a\uffff\u0d1b\u0d1c\u0d1d\u0d1e"
// 012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABC
+ " !\u0d1f\u0d20\u0d21\u0d22\u0d23\u0d24)(\u0d25\u0d26,\u0d27.\u0d280123456789:; "
// D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....
+ "\u0d2a\u0d2b?\u0d2c\u0d2d\u0d2e\u0d2f\u0d30\u0d31\u0d32\u0d33\u0d34\u0d35\u0d36"
// B.....C.....D.....EF.....0.....1.....2.....3.....4.....5.....6.....78.....9.....
+ "\u0d37\u0d38\u0d39 \u0d3d\u0d3e\u0d3f\u0d40\u0d41\u0d42\u0d43\u0d44 \u0d46\u0d47"
// A.....BC.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
+ "\u0d48 \u0d4a\u0d4b\u0d4c\u0d4d\u0d57abcdefghijklmnopqrstuvwxyz\u0d60\u0d61\u0d62"
// E.....F.....
+ "\u0d63\u0d79",
"\u0b01\u0b02\u0b03\u0b05\u0b06\u0b07\u0b08\u0b09\u0b0a\u0b0b\n\u0b0c \r \u0b0f\u0b10 "
// 3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....01
+ "\u0b13\u0b14\u0b15\u0b16\u0b17\u0b18\u0b19\u0b1a\uffff\u0b1b\u0b1c\u0b1d\u0b1e !"
// 2.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABCD.....
+ "\u0b1f\u0b20\u0b21\u0b22\u0b23\u0b24)(\u0b25\u0b26,\u0b27.\u0b280123456789:; \u0b2a"
// E.....F0.....1.....2.....3.....4.....56.....7.....89.....A.....B.....C.....D.....
+ "\u0b2b?\u0b2c\u0b2d\u0b2e\u0b2f\u0b30 \u0b32\u0b33 \u0b35\u0b36\u0b37\u0b38\u0b39"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....789.....A.....BCD.....E.....
+ "\u0b3c\u0b3d\u0b3e\u0b3f\u0b40\u0b41\u0b42\u0b43\u0b44 \u0b47\u0b48 \u0b4b\u0b4c"
// F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....F.....
+ "\u0b4d\u0b56abcdefghijklmnopqrstuvwxyz\u0b57\u0b60\u0b61\u0b62\u0b63",
"\u0a01\u0a02\u0a03\u0a05\u0a06\u0a07\u0a08\u0a09\u0a0a \n \r \u0a0f\u0a10 \u0a13\u0a14"
// 5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....012.....3.....
+ "\u0a15\u0a16\u0a17\u0a18\u0a19\u0a1a\uffff\u0a1b\u0a1c\u0a1d\u0a1e !\u0a1f\u0a20"
// 4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABCD.....E.....F0.....
+ "\u0a21\u0a22\u0a23\u0a24)(\u0a25\u0a26,\u0a27.\u0a280123456789:; \u0a2a\u0a2b?\u0a2c"
// 1.....2.....3.....4.....56.....7.....89.....A.....BC.....D.....E.....F0.....1.....
+ "\u0a2d\u0a2e\u0a2f\u0a30 \u0a32\u0a33 \u0a35\u0a36 \u0a38\u0a39\u0a3c \u0a3e\u0a3f"
// 2.....3.....4.....56789.....A.....BCD.....E.....F.....0.....123456789ABCDEF012345678
+ "\u0a40\u0a41\u0a42 \u0a47\u0a48 \u0a4b\u0a4c\u0a4d\u0a51abcdefghijklmnopqrstuvwx"
// 9AB.....C.....D.....E.....F.....
+ "yz\u0a70\u0a71\u0a72\u0a73\u0a74",
" \u0b82\u0b83\u0b85\u0b86\u0b87\u0b88\u0b89\u0b8a \n \r\u0b8e\u0b8f\u0b90 \u0b92\u0b93"
// 4.....5.....6789.....A.....B.....CD.....EF.....012.....3456.....7.....89ABCDEF.....
+ "\u0b94\u0b95 \u0b99\u0b9a\uffff \u0b9c \u0b9e !\u0b9f \u0ba3\u0ba4)( , .\u0ba8"
// 0123456789ABC.....D.....EF012.....3.....4.....5.....6.....7.....8.....9.....A.....
+ "0123456789:;\u0ba9\u0baa ? \u0bae\u0baf\u0bb0\u0bb1\u0bb2\u0bb3\u0bb4\u0bb5\u0bb6"
// B.....C.....D.....EF0.....1.....2.....3.....4.....5678.....9.....A.....BC.....D.....
+ "\u0bb7\u0bb8\u0bb9 \u0bbe\u0bbf\u0bc0\u0bc1\u0bc2 \u0bc6\u0bc7\u0bc8 \u0bca\u0bcb"
// E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....F.....
+ "\u0bcc\u0bcd\u0bd0abcdefghijklmnopqrstuvwxyz\u0bd7\u0bf0\u0bf1\u0bf2\u0bf9",
"\u0c01\u0c02\u0c03\u0c05\u0c06\u0c07\u0c08\u0c09\u0c0a\u0c0b\n\u0c0c \r\u0c0e\u0c0f\u0c10"
// 12.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
+ " \u0c12\u0c13\u0c14\u0c15\u0c16\u0c17\u0c18\u0c19\u0c1a\uffff\u0c1b\u0c1c\u0c1d"
// F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789AB
+ "\u0c1e !\u0c1f\u0c20\u0c21\u0c22\u0c23\u0c24)(\u0c25\u0c26,\u0c27.\u0c280123456789:;"
// CD.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....89.....A.....B.....
+ " \u0c2a\u0c2b?\u0c2c\u0c2d\u0c2e\u0c2f\u0c30\u0c31\u0c32\u0c33 \u0c35\u0c36\u0c37"
// C.....D.....EF.....0.....1.....2.....3.....4.....5.....6.....78.....9.....A.....B
+ "\u0c38\u0c39 \u0c3d\u0c3e\u0c3f\u0c40\u0c41\u0c42\u0c43\u0c44 \u0c46\u0c47\u0c48 "
// C.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....
+ "\u0c4a\u0c4b\u0c4c\u0c4d\u0c55abcdefghijklmnopqrstuvwxyz\u0c56\u0c60\u0c61\u0c62"
// F.....
+ "\u0c63",
"\u0627\u0622\u0628\u067b\u0680\u067e\u06a6\u062a\u06c2\u067f\n\u0679\u067d\r\u067a\u067c"
// 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....
+ "\u062b\u062c\u0681\u0684\u0683\u0685\u0686\u0687\u062d\u062e\u062f\uffff\u068c\u0688"
// E.....F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....012345
+ "\u0689\u068a !\u068f\u068d\u0630\u0631\u0691\u0693)(\u0699\u0632,\u0696.\u0698012345"
// 6789ABC.....D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....8.....
+ "6789:;\u069a\u0633\u0634?\u0635\u0636\u0637\u0638\u0639\u0641\u0642\u06a9\u06aa"
// 9.....A.....B.....C.....D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....
+ "\u06ab\u06af\u06b3\u06b1\u0644\u0645\u0646\u06ba\u06bb\u06bc\u0648\u06c4\u06d5\u06c1"
// 7.....8.....9.....A.....B.....C.....D.....E.....F.....0.....123456789ABCDEF012345678
+ "\u06be\u0621\u06cc\u06d0\u06d2\u064d\u0650\u064f\u0657\u0654abcdefghijklmnopqrstuvwx"
// 9AB.....C.....D.....E.....F.....
+ "yz\u0655\u0651\u0653\u0656\u0670"
};
private static final String[] sLanguageShiftTables = new String[]{
" \u000c ^ {} \\ [~] | "
// 0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
+ " \u20ac ",
" \u000c ^ {} \\ [~] | \u011e "
// 9.....ABCDEF0123.....456789ABCDEF0123.....45.....67.....89.....ABCDEF0123.....
+ "\u0130 \u015e \u00e7 \u20ac \u011f \u0131 \u015f"
// 456789ABCDEF
+ " ",
" \u00e7\u000c ^ {} \\ [~] |\u00c1 "
// 456789.....ABCDEF.....012345.....6789ABCDEF01.....2345.....6789.....ABCDEF.....012
+ " \u00cd \u00d3 \u00da \u00e1 \u20ac \u00ed \u00f3 "
// 345.....6789ABCDEF
+ " \u00fa ",
" \u00ea \u00e7\u000c\u00d4\u00f4 \u00c1\u00e1 \u03a6\u0393^\u03a9\u03a0\u03a8\u03a3"
// 9.....ABCDEF.....0123456789ABCDEF.0123456789ABCDEF01.....23456789.....ABCDE
+ "\u0398 \u00ca {} \\ [~] |\u00c0 \u00cd "
// F.....012345.....6789AB.....C.....DEF01.....2345.....6789.....ABCDEF.....01234
+ "\u00d3 \u00da \u00c3\u00d5 \u00c2 \u20ac \u00ed \u00f3 "
// 5.....6789AB.....C.....DEF.....
+ "\u00fa \u00e3\u00f5 \u00e2",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u09e6\u09e7 \u09e8\u09e9"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
+ "\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u09df\u09e0\u09e1\u09e2{}\u09e3\u09f2\u09f3"
// D.....E.....F.0.....1.....2.....3.....4.....56789ABCDEF0123456789ABCDEF
+ "\u09f4\u09f5\\\u09f6\u09f7\u09f8\u09f9\u09fa [~] |ABCDEFGHIJKLMNO"
// 0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
+ "PQRSTUVWXYZ \u20ac ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0ae6\u0ae7"
// E.....F.....0.....1.....2.....3.....4.....5.....6789ABCDEF.0123456789ABCDEF
+ "\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef {} \\ [~] "
// 0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
+ "|ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0966\u0967"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
+ "\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0951\u0952{}\u0953\u0954\u0958"
// D.....E.....F.0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....
+ "\u0959\u095a\\\u095b\u095c\u095d\u095e\u095f\u0960\u0961\u0962\u0963\u0970\u0971"
// BCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
+ " [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0ce6\u0ce7"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....BCDEF.01234567
+ "\u0ce8\u0ce9\u0cea\u0ceb\u0cec\u0ced\u0cee\u0cef\u0cde\u0cf1{}\u0cf2 \\ "
// 89ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
+ " [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0d66\u0d67"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
+ "\u0d68\u0d69\u0d6a\u0d6b\u0d6c\u0d6d\u0d6e\u0d6f\u0d70\u0d71{}\u0d72\u0d73\u0d74"
// D.....E.....F.0.....1.....2.....3.....4.....56789ABCDEF0123456789ABCDEF0123456789A
+ "\u0d75\u0d7a\\\u0d7b\u0d7c\u0d7d\u0d7e\u0d7f [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// BCDEF012345.....6789ABCDEF0123456789ABCDEF
+ " \u20ac ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0b66\u0b67"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....DE
+ "\u0b68\u0b69\u0b6a\u0b6b\u0b6c\u0b6d\u0b6e\u0b6f\u0b5c\u0b5d{}\u0b5f\u0b70\u0b71 "
// F.0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789A
+ "\\ [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
// BCDEF
+ " ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0a66\u0a67"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
+ "\u0a68\u0a69\u0a6a\u0a6b\u0a6c\u0a6d\u0a6e\u0a6f\u0a59\u0a5a{}\u0a5b\u0a5c\u0a5e"
// D.....EF.0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF01
+ "\u0a75 \\ [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
// 23456789ABCDEF
+ " ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0be6\u0be7"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
+ "\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef\u0bf3\u0bf4{}\u0bf5\u0bf6\u0bf7"
// D.....E.....F.0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABC
+ "\u0bf8\u0bfa\\ [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
// DEF0123456789ABCDEF
+ " ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#* \u0c66\u0c67\u0c68\u0c69"
// 0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....D.....E.....F.
+ "\u0c6a\u0c6b\u0c6c\u0c6d\u0c6e\u0c6f\u0c58\u0c59{}\u0c78\u0c79\u0c7a\u0c7b\u0c7c\\"
// 0.....1.....2.....3456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCD
+ "\u0c7d\u0c7e\u0c7f [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
// EF0123456789ABCDEF
+ " ",
"@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0600\u0601 \u06f0\u06f1"
// E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
+ "\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u060c\u060d{}\u060e\u060f\u0610"
// D.....E.....F.0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....
+ "\u0611\u0612\\\u0613\u0614\u061b\u061f\u0640\u0652\u0658\u066b\u066c\u0672\u0673"
// B.....CDEF.....0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
+ "\u06cd[~]\u06d4|ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
};
static {
enableCountrySpecificEncodings();
int numTables = sLanguageTables.length;
int numShiftTables = sLanguageShiftTables.length;
if (numTables != numShiftTables) {
Rlog.e(TAG, "Error: language tables array length " + numTables +
" != shift tables array length " + numShiftTables);
}
sCharsToGsmTables = new SparseIntArray[numTables];
for (int i = 0; i < numTables; i++) {
String table = sLanguageTables[i];
int tableLen = table.length();
if (tableLen != 0 && tableLen != 128) {
Rlog.e(TAG, "Error: language tables index " + i +
" length " + tableLen + " (expected 128 or 0)");
}
SparseIntArray charToGsmTable = new SparseIntArray(tableLen);
sCharsToGsmTables[i] = charToGsmTable;
for (int j = 0; j < tableLen; j++) {
char c = table.charAt(j);
charToGsmTable.put(c, j);
}
}
sCharsToShiftTables = new SparseIntArray[numTables];
for (int i = 0; i < numShiftTables; i++) {
String shiftTable = sLanguageShiftTables[i];
int shiftTableLen = shiftTable.length();
if (shiftTableLen != 0 && shiftTableLen != 128) {
Rlog.e(TAG, "Error: language shift tables index " + i +
" length " + shiftTableLen + " (expected 128 or 0)");
}
SparseIntArray charToShiftTable = new SparseIntArray(shiftTableLen);
sCharsToShiftTables[i] = charToShiftTable;
for (int j = 0; j < shiftTableLen; j++) {
char c = shiftTable.charAt(j);
if (c != ' ') {
charToShiftTable.put(c, j);
}
}
}
} | static void function() { Resources r = Resources.getSystem(); sEnabledSingleShiftTables = r.getIntArray(R.array.config_sms_enabled_single_shift_tables); sEnabledLockingShiftTables = r.getIntArray(R.array.config_sms_enabled_locking_shift_tables); if (sEnabledSingleShiftTables.length > 0) { sHighestEnabledSingleShiftCode = sEnabledSingleShiftTables[sEnabledSingleShiftTables.length-1]; } else { sHighestEnabledSingleShiftCode = 0; } } static final SparseIntArray[] sCharsToGsmTables; private static final SparseIntArray[] sCharsToShiftTables; private static int[] sEnabledSingleShiftTables; private static int[] sEnabledLockingShiftTables; private static int sHighestEnabledSingleShiftCode; private static boolean sDisableCountryEncodingCheck = false; private static class LanguagePairCount { final int languageCode; final int[] septetCounts; final int[] unencodableCounts; LanguagePairCount(int code) { this.languageCode = code; int maxSingleShiftCode = sHighestEnabledSingleShiftCode; septetCounts = new int[maxSingleShiftCode + 1]; unencodableCounts = new int[maxSingleShiftCode + 1]; for (int i = 1, tableOffset = 0; i <= maxSingleShiftCode; i++) { if (sEnabledSingleShiftTables[tableOffset] == i) { tableOffset++; } else { septetCounts[i] = -1; } } if (code == 1 && maxSingleShiftCode >= 1) { septetCounts[1] = -1; } else if (code == 3 && maxSingleShiftCode >= 2) { septetCounts[2] = -1; } } } private static final String[] sLanguageTables = { STR + STR + STR#\u00a4%&'()*+,-./0123456789:;<=>?\u00a1ABCDEFGHIJKLMNOPQRSTUVWXYZSTR\u00c4\u00d6\u00d1\u00dc\u00a7\u00bfabcdefghijklmnopqrstuvwxyz\u00e4\u00f6\u00f1STR\u00fc\u00e0STR@\u00a3$\u00a5\u20ac\u00e9\u00f9\u0131\u00f2\u00c7\n\u011e\u011f\r\u00c5\u00e5\u0394_STR\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\uffff\u015e\u015f\u00df" + STR#\u00a4%&'()*+,-./0123456789:;<=>?\u0130ABCDEFGHIJKLMNOPQRSTUVWXYZSTR\u00c4\u00d6\u00d1\u00dc\u00a7\u00e7abcdefghijklmnopqrstuvwxyz\u00e4\u00f6\u00f1STR\u00fc\u00e0STRSTR@\u00a3$\u00a5\u00ea\u00e9\u00fa\u00ed\u00f3\u00e7\n\u00d4\u00f4\r\u00c1\u00e1\u0394_STR\u00aa\u00c7\u00c0\u221e^\\\u20ac\u00d3 \uffff\u00c2\u00e2\u00ca\u00c9 !\"#\u00baSTR%&'()*+,-./0123456789:;<=>?\u00cdABCDEFGHIJKLMNOPQRSTUVWXYZ\u00c3\u00d5\u00da\u00dcSTR\u00a7~abcdefghijklmnopqrstuvwxyz\u00e3\u00f5`\u00fc\u00e0STR\u0981\u0982\u0983\u0985\u0986\u0987\u0988\u0989\u098a\u098b\n\u098c \r \u098f\u0990STR \u0993\u0994\u0995\u0996\u0997\u0998\u0999\u099a\uffff\u099b\u099c\u099d\u099eSTR !\u099f\u09a0\u09a1\u09a2\u09a3\u09a4)(\u09a5\u09a6,\u09a7.\u09a80123456789:; STR\u09aa\u09ab?\u09ac\u09ad\u09ae\u09af\u09b0 \u09b2 \u09b6\u09b7\u09b8\u09b9STR\u09bc\u09bd\u09be\u09bf\u09c0\u09c1\u09c2\u09c3\u09c4 \u09c7\u09c8 \u09cb\u09ccSTR\u09cd\u09ceabcdefghijklmnopqrstuvwxyz\u09d7\u09dc\u09dd\u09f0\u09f1STR\u0a81\u0a82\u0a83\u0a85\u0a86\u0a87\u0a88\u0a89\u0a8a\u0a8b\n\u0a8c\u0a8d\r \u0a8f\u0a90STR\u0a91 \u0a93\u0a94\u0a95\u0a96\u0a97\u0a98\u0a99\u0a9a\uffff\u0a9b\u0a9c\u0a9dSTR\u0a9e !\u0a9f\u0aa0\u0aa1\u0aa2\u0aa3\u0aa4)(\u0aa5\u0aa6,\u0aa7.\u0aa80123456789:;STR \u0aaa\u0aab?\u0aac\u0aad\u0aae\u0aaf\u0ab0 \u0ab2\u0ab3 \u0ab5\u0ab6\u0ab7\u0ab8STR\u0ab9\u0abc\u0abd\u0abe\u0abf\u0ac0\u0ac1\u0ac2\u0ac3\u0ac4\u0ac5 \u0ac7\u0ac8STR\u0ac9 \u0acb\u0acc\u0acd\u0ad0abcdefghijklmnopqrstuvwxyz\u0ae0\u0ae1\u0ae2\u0ae3STR\u0af1STR\u0901\u0902\u0903\u0905\u0906\u0907\u0908\u0909\u090a\u090b\n\u090c\u090d\r\u090e\u090fSTR\u0910\u0911\u0912\u0913\u0914\u0915\u0916\u0917\u0918\u0919\u091a\uffff\u091b\u091cSTR\u091d\u091e !\u091f\u0920\u0921\u0922\u0923\u0924)(\u0925\u0926,\u0927.\u0928012345STR6789:;\u0929\u092a\u092b?\u092c\u092d\u092e\u092f\u0930\u0931\u0932\u0933\u0934STR\u0935\u0936\u0937\u0938\u0939\u093c\u093d\u093e\u093f\u0940\u0941\u0942\u0943\u0944STR\u0945\u0946\u0947\u0948\u0949\u094a\u094b\u094c\u094d\u0950abcdefghijklmnopqrstuvwxSTRyz\u0972\u097b\u097c\u097e\u097fSTR \u0c82\u0c83\u0c85\u0c86\u0c87\u0c88\u0c89\u0c8a\u0c8b\n\u0c8c \r\u0c8e\u0c8f\u0c90 STR\u0c92\u0c93\u0c94\u0c95\u0c96\u0c97\u0c98\u0c99\u0c9a\uffff\u0c9b\u0c9c\u0c9d\u0c9eSTR !\u0c9f\u0ca0\u0ca1\u0ca2\u0ca3\u0ca4)(\u0ca5\u0ca6,\u0ca7.\u0ca80123456789:; STR\u0caa\u0cab?\u0cac\u0cad\u0cae\u0caf\u0cb0\u0cb1\u0cb2\u0cb3 \u0cb5\u0cb6\u0cb7STR\u0cb8\u0cb9\u0cbc\u0cbd\u0cbe\u0cbf\u0cc0\u0cc1\u0cc2\u0cc3\u0cc4 \u0cc6\u0cc7STR\u0cc8 \u0cca\u0ccb\u0ccc\u0ccd\u0cd5abcdefghijklmnopqrstuvwxyz\u0cd6\u0ce0\u0ce1STR\u0ce2\u0ce3STR \u0d02\u0d03\u0d05\u0d06\u0d07\u0d08\u0d09\u0d0a\u0d0b\n\u0d0c \r\u0d0e\u0d0f\u0d10 STR\u0d12\u0d13\u0d14\u0d15\u0d16\u0d17\u0d18\u0d19\u0d1a\uffff\u0d1b\u0d1c\u0d1d\u0d1eSTR !\u0d1f\u0d20\u0d21\u0d22\u0d23\u0d24)(\u0d25\u0d26,\u0d27.\u0d280123456789:; STR\u0d2a\u0d2b?\u0d2c\u0d2d\u0d2e\u0d2f\u0d30\u0d31\u0d32\u0d33\u0d34\u0d35\u0d36STR\u0d37\u0d38\u0d39 \u0d3d\u0d3e\u0d3f\u0d40\u0d41\u0d42\u0d43\u0d44 \u0d46\u0d47STR\u0d48 \u0d4a\u0d4b\u0d4c\u0d4d\u0d57abcdefghijklmnopqrstuvwxyz\u0d60\u0d61\u0d62STR\u0d63\u0d79STR\u0b01\u0b02\u0b03\u0b05\u0b06\u0b07\u0b08\u0b09\u0b0a\u0b0b\n\u0b0c \r \u0b0f\u0b10 STR\u0b13\u0b14\u0b15\u0b16\u0b17\u0b18\u0b19\u0b1a\uffff\u0b1b\u0b1c\u0b1d\u0b1e !STR\u0b1f\u0b20\u0b21\u0b22\u0b23\u0b24)(\u0b25\u0b26,\u0b27.\u0b280123456789:; \u0b2aSTR\u0b2b?\u0b2c\u0b2d\u0b2e\u0b2f\u0b30 \u0b32\u0b33 \u0b35\u0b36\u0b37\u0b38\u0b39STR\u0b3c\u0b3d\u0b3e\u0b3f\u0b40\u0b41\u0b42\u0b43\u0b44 \u0b47\u0b48 \u0b4b\u0b4cSTR\u0b4d\u0b56abcdefghijklmnopqrstuvwxyz\u0b57\u0b60\u0b61\u0b62\u0b63STR\u0a01\u0a02\u0a03\u0a05\u0a06\u0a07\u0a08\u0a09\u0a0a \n \r \u0a0f\u0a10 \u0a13\u0a14STR\u0a15\u0a16\u0a17\u0a18\u0a19\u0a1a\uffff\u0a1b\u0a1c\u0a1d\u0a1e !\u0a1f\u0a20STR\u0a21\u0a22\u0a23\u0a24)(\u0a25\u0a26,\u0a27.\u0a280123456789:; \u0a2a\u0a2b?\u0a2cSTR\u0a2d\u0a2e\u0a2f\u0a30 \u0a32\u0a33 \u0a35\u0a36 \u0a38\u0a39\u0a3c \u0a3e\u0a3fSTR\u0a40\u0a41\u0a42 \u0a47\u0a48 \u0a4b\u0a4c\u0a4d\u0a51abcdefghijklmnopqrstuvwxSTRyz\u0a70\u0a71\u0a72\u0a73\u0a74STR \u0b82\u0b83\u0b85\u0b86\u0b87\u0b88\u0b89\u0b8a \n \r\u0b8e\u0b8f\u0b90 \u0b92\u0b93STR\u0b94\u0b95 \u0b99\u0b9a\uffff \u0b9c \u0b9e !\u0b9f \u0ba3\u0ba4)( , .\u0ba8STR0123456789:;\u0ba9\u0baa ? \u0bae\u0baf\u0bb0\u0bb1\u0bb2\u0bb3\u0bb4\u0bb5\u0bb6STR\u0bb7\u0bb8\u0bb9 \u0bbe\u0bbf\u0bc0\u0bc1\u0bc2 \u0bc6\u0bc7\u0bc8 \u0bca\u0bcbSTR\u0bcc\u0bcd\u0bd0abcdefghijklmnopqrstuvwxyz\u0bd7\u0bf0\u0bf1\u0bf2\u0bf9STR\u0c01\u0c02\u0c03\u0c05\u0c06\u0c07\u0c08\u0c09\u0c0a\u0c0b\n\u0c0c \r\u0c0e\u0c0f\u0c10STR \u0c12\u0c13\u0c14\u0c15\u0c16\u0c17\u0c18\u0c19\u0c1a\uffff\u0c1b\u0c1c\u0c1dSTR\u0c1e !\u0c1f\u0c20\u0c21\u0c22\u0c23\u0c24)(\u0c25\u0c26,\u0c27.\u0c280123456789:;STR \u0c2a\u0c2b?\u0c2c\u0c2d\u0c2e\u0c2f\u0c30\u0c31\u0c32\u0c33 \u0c35\u0c36\u0c37STR\u0c38\u0c39 \u0c3d\u0c3e\u0c3f\u0c40\u0c41\u0c42\u0c43\u0c44 \u0c46\u0c47\u0c48 STR\u0c4a\u0c4b\u0c4c\u0c4d\u0c55abcdefghijklmnopqrstuvwxyz\u0c56\u0c60\u0c61\u0c62STR\u0c63STR\u0627\u0622\u0628\u067b\u0680\u067e\u06a6\u062a\u06c2\u067f\n\u0679\u067d\r\u067a\u067cSTR\u062b\u062c\u0681\u0684\u0683\u0685\u0686\u0687\u062d\u062e\u062f\uffff\u068c\u0688STR\u0689\u068a !\u068f\u068d\u0630\u0631\u0691\u0693)(\u0699\u0632,\u0696.\u0698012345STR6789:;\u069a\u0633\u0634?\u0635\u0636\u0637\u0638\u0639\u0641\u0642\u06a9\u06aaSTR\u06ab\u06af\u06b3\u06b1\u0644\u0645\u0646\u06ba\u06bb\u06bc\u0648\u06c4\u06d5\u06c1STR\u06be\u0621\u06cc\u06d0\u06d2\u064d\u0650\u064f\u0657\u0654abcdefghijklmnopqrstuvwxSTRyz\u0655\u0651\u0653\u0656\u0670" }; private static final String[] sLanguageShiftTables = new String[]{ " \u000c ^ {} \\ [~] STR \u20ac STR \u000c ^ {} \\ [~] \u011e STR\u0130 \u015e \u00e7 \u20ac \u011f \u0131 \u015fSTR STR \u00e7\u000c ^ {} \\ [~] \u00c1 STR \u00cd \u00d3 \u00da \u00e1 \u20ac \u00ed \u00f3 STR \u00fa STR \u00ea \u00e7\u000c\u00d4\u00f4 \u00c1\u00e1 \u03a6\u0393^\u03a9\u03a0\u03a8\u03a3STR\u0398 \u00ca {} \\ [~] \u00c0 \u00cd STR\u00d3 \u00da \u00c3\u00d5 \u00c2 \u20ac \u00ed \u00f3 STR\u00fa \u00e3\u00f5 \u00e2STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u09e6\u09e7 \u09e8\u09e9STR\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u09df\u09e0\u09e1\u09e2{}\u09e3\u09f2\u09f3STR\u09f4\u09f5\\\u09f6\u09f7\u09f8\u09f9\u09fa [~] ABCDEFGHIJKLMNOSTRPQRSTUVWXYZ \u20ac STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0ae6\u0ae7STR\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef {} \\ [~] STR ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0966\u0967STR\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0951\u0952{}\u0953\u0954\u0958STR\u0959\u095a\\\u095b\u095c\u095d\u095e\u095f\u0960\u0961\u0962\u0963\u0970\u0971STR [~] ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0ce6\u0ce7STR\u0ce8\u0ce9\u0cea\u0ceb\u0cec\u0ced\u0cee\u0cef\u0cde\u0cf1{}\u0cf2 \\ STR [~] ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0d66\u0d67STR\u0d68\u0d69\u0d6a\u0d6b\u0d6c\u0d6d\u0d6e\u0d6f\u0d70\u0d71{}\u0d72\u0d73\u0d74STR\u0d75\u0d7a\\\u0d7b\u0d7c\u0d7d\u0d7e\u0d7f [~] ABCDEFGHIJKLMNOPQRSTUVWXYZSTR \u20ac STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0b66\u0b67STR\u0b68\u0b69\u0b6a\u0b6b\u0b6c\u0b6d\u0b6e\u0b6f\u0b5c\u0b5d{}\u0b5f\u0b70\u0b71 STR\\ [~] ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac STR STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0a66\u0a67STR\u0a68\u0a69\u0a6a\u0a6b\u0a6c\u0a6d\u0a6e\u0a6f\u0a59\u0a5a{}\u0a5b\u0a5c\u0a5eSTR\u0a75 \\ [~] ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac STR STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0be6\u0be7STR\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef\u0bf3\u0bf4{}\u0bf5\u0bf6\u0bf7STR\u0bf8\u0bfa\\ [~] ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac STR STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#* \u0c66\u0c67\u0c68\u0c69STR\u0c6a\u0c6b\u0c6c\u0c6d\u0c6e\u0c6f\u0c58\u0c59{}\u0c78\u0c79\u0c7a\u0c7b\u0c7c\\STR\u0c7d\u0c7e\u0c7f [~] ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac STR STR@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0600\u0601 \u06f0\u06f1STR\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u060c\u060d{}\u060e\u060f\u0610STR\u0611\u0612\\\u0613\u0614\u061b\u061f\u0640\u0652\u0658\u066b\u066c\u0672\u0673STR\u06cd[~]\u06d4 ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac " }; static { function(); int numTables = sLanguageTables.length; int numShiftTables = sLanguageShiftTables.length; if (numTables != numShiftTables) { Rlog.e(TAG, STR + numTables + STR + numShiftTables); } sCharsToGsmTables = new SparseIntArray[numTables]; for (int i = 0; i < numTables; i++) { String table = sLanguageTables[i]; int tableLen = table.length(); if (tableLen != 0 && tableLen != 128) { Rlog.e(TAG, STR + i + STR + tableLen + STR); } SparseIntArray charToGsmTable = new SparseIntArray(tableLen); sCharsToGsmTables[i] = charToGsmTable; for (int j = 0; j < tableLen; j++) { char c = table.charAt(j); charToGsmTable.put(c, j); } } sCharsToShiftTables = new SparseIntArray[numTables]; for (int i = 0; i < numShiftTables; i++) { String shiftTable = sLanguageShiftTables[i]; int shiftTableLen = shiftTable.length(); if (shiftTableLen != 0 && shiftTableLen != 128) { Rlog.e(TAG, STR + i + STR + shiftTableLen + STR); } SparseIntArray charToShiftTable = new SparseIntArray(shiftTableLen); sCharsToShiftTables[i] = charToShiftTable; for (int j = 0; j < shiftTableLen; j++) { char c = shiftTable.charAt(j); if (c != ' ') { charToShiftTable.put(c, j); } } } } | /**
* Enable country-specific language tables from MCC-specific overlays.
* @context the context to use to get the TelephonyManager
*/ | Enable country-specific language tables from MCC-specific overlays | enableCountrySpecificEncodings | {
"repo_name": "Ant-Droid/android_frameworks_base_OLD",
"path": "telephony/java/com/android/internal/telephony/GsmAlphabet.java",
"license": "apache-2.0",
"size": 72469
} | [
"android.content.res.Resources",
"android.telephony.Rlog",
"android.util.SparseIntArray"
] | import android.content.res.Resources; import android.telephony.Rlog; import android.util.SparseIntArray; | import android.content.res.*; import android.telephony.*; import android.util.*; | [
"android.content",
"android.telephony",
"android.util"
] | android.content; android.telephony; android.util; | 2,096,250 |
private List<Object> getModules() {
// If you define all the dependencies directly in the module class annotation
// using includes, you don't need to list all the modules here. Otherwise,
// this is the right place to define all modules
// return Arrays.asList(
// new AndroidModule(this),
// new MobileModule()
// );
return Arrays.asList(
(Object) new MobileModule(this.getApplicationContext())
);
} | List<Object> function() { return Arrays.asList( (Object) new MobileModule(this.getApplicationContext()) ); } | /**
* Could be overridden in tests, passing a different list of modules
* @return
*/ | Could be overridden in tests, passing a different list of modules | getModules | {
"repo_name": "rainbowbreeze/20150124-ciscolive",
"path": "mobileapp/ciscolive/mobile/src/main/java/it/rainbowbreeze/ciscolive/common/MyApp.java",
"license": "apache-2.0",
"size": 2751
} | [
"java.util.Arrays",
"java.util.List"
] | import java.util.Arrays; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,680,187 |
public FirewallPolicyThreatIntelWhitelist threatIntelWhitelist() {
return this.innerProperties() == null ? null : this.innerProperties().threatIntelWhitelist();
} | FirewallPolicyThreatIntelWhitelist function() { return this.innerProperties() == null ? null : this.innerProperties().threatIntelWhitelist(); } | /**
* Get the threatIntelWhitelist property: ThreatIntel Whitelist for Firewall Policy.
*
* @return the threatIntelWhitelist value.
*/ | Get the threatIntelWhitelist property: ThreatIntel Whitelist for Firewall Policy | threatIntelWhitelist | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/FirewallPolicyInner.java",
"license": "mit",
"size": 14473
} | [
"com.azure.resourcemanager.network.models.FirewallPolicyThreatIntelWhitelist"
] | import com.azure.resourcemanager.network.models.FirewallPolicyThreatIntelWhitelist; | import com.azure.resourcemanager.network.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 2,406,464 |
public static void addGVTListener(BridgeContext ctx, Document doc) {
UserAgent ua = ctx.getUserAgent();
if (ua != null) {
EventDispatcher dispatcher = ua.getEventDispatcher();
if (dispatcher != null) {
final Listener listener = new Listener(ctx, ua);
dispatcher.addGraphicsNodeMouseListener(listener);
dispatcher.addGraphicsNodeMouseWheelListener(listener);
dispatcher.addGraphicsNodeKeyListener(listener);
// add an unload listener on the SVGDocument to remove
// that listener for dispatching events
EventListener l = new GVTUnloadListener(dispatcher, listener);
NodeEventTarget target = (NodeEventTarget) doc;
target.addEventListenerNS
(XMLConstants.XML_EVENTS_NAMESPACE_URI,
"SVGUnload",
l, false, null);
storeEventListenerNS
(ctx, target,
XMLConstants.XML_EVENTS_NAMESPACE_URI,
"SVGUnload",
l, false);
}
}
}
protected static class Listener
extends BridgeEventSupport.Listener
implements GraphicsNodeMouseWheelListener {
protected SVG12BridgeContext ctx12;
public Listener(BridgeContext ctx, UserAgent u) {
super(ctx, u);
ctx12 = (SVG12BridgeContext) ctx;
}
// Key ------------------------------------------------------------- | static void function(BridgeContext ctx, Document doc) { UserAgent ua = ctx.getUserAgent(); if (ua != null) { EventDispatcher dispatcher = ua.getEventDispatcher(); if (dispatcher != null) { final Listener listener = new Listener(ctx, ua); dispatcher.addGraphicsNodeMouseListener(listener); dispatcher.addGraphicsNodeMouseWheelListener(listener); dispatcher.addGraphicsNodeKeyListener(listener); EventListener l = new GVTUnloadListener(dispatcher, listener); NodeEventTarget target = (NodeEventTarget) doc; target.addEventListenerNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, STR, l, false, null); storeEventListenerNS (ctx, target, XMLConstants.XML_EVENTS_NAMESPACE_URI, STR, l, false); } } } protected static class Listener extends BridgeEventSupport.Listener implements GraphicsNodeMouseWheelListener { protected SVG12BridgeContext ctx12; public Listener(BridgeContext ctx, UserAgent u) { super(ctx, u); ctx12 = (SVG12BridgeContext) ctx; } | /**
* Is called only for the root element in order to dispatch GVT
* events to the DOM.
*/ | Is called only for the root element in order to dispatch GVT events to the DOM | addGVTListener | {
"repo_name": "sflyphotobooks/crp-batik",
"path": "sources/org/apache/batik/bridge/svg12/SVG12BridgeEventSupport.java",
"license": "apache-2.0",
"size": 40847
} | [
"org.apache.batik.bridge.BridgeContext",
"org.apache.batik.bridge.BridgeEventSupport",
"org.apache.batik.bridge.UserAgent",
"org.apache.batik.dom.events.NodeEventTarget",
"org.apache.batik.gvt.event.EventDispatcher",
"org.apache.batik.gvt.event.GraphicsNodeMouseWheelListener",
"org.apache.batik.util.XML... | import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.BridgeEventSupport; import org.apache.batik.bridge.UserAgent; import org.apache.batik.dom.events.NodeEventTarget; import org.apache.batik.gvt.event.EventDispatcher; import org.apache.batik.gvt.event.GraphicsNodeMouseWheelListener; import org.apache.batik.util.XMLConstants; import org.w3c.dom.Document; import org.w3c.dom.events.EventListener; | import org.apache.batik.bridge.*; import org.apache.batik.dom.events.*; import org.apache.batik.gvt.event.*; import org.apache.batik.util.*; import org.w3c.dom.*; import org.w3c.dom.events.*; | [
"org.apache.batik",
"org.w3c.dom"
] | org.apache.batik; org.w3c.dom; | 1,784,121 |
public void removeItem(int which, float velocityX) {
if (mDragState == IDLE || mDragState == DRAGGING) {
if (mDragState == IDLE) {
// called from outside drag-sort
mSrcPos = getHeaderViewsCount() + which;
mFirstExpPos = mSrcPos;
mSecondExpPos = mSrcPos;
mFloatPos = mSrcPos;
View v = getChildAt(mSrcPos - getFirstVisiblePosition());
if (v != null) {
v.setVisibility(View.INVISIBLE);
}
}
mDragState = REMOVING;
mRemoveVelocityX = velocityX;
if (mInTouchEvent) {
switch (mCancelMethod) {
case ON_TOUCH_EVENT:
super.onTouchEvent(mCancelEvent);
break;
case ON_INTERCEPT_TOUCH_EVENT:
super.onInterceptTouchEvent(mCancelEvent);
break;
}
}
if (mRemoveAnimator != null) {
mRemoveAnimator.start();
} else {
doRemoveItem(which);
}
}
} | void function(int which, float velocityX) { if (mDragState == IDLE mDragState == DRAGGING) { if (mDragState == IDLE) { mSrcPos = getHeaderViewsCount() + which; mFirstExpPos = mSrcPos; mSecondExpPos = mSrcPos; mFloatPos = mSrcPos; View v = getChildAt(mSrcPos - getFirstVisiblePosition()); if (v != null) { v.setVisibility(View.INVISIBLE); } } mDragState = REMOVING; mRemoveVelocityX = velocityX; if (mInTouchEvent) { switch (mCancelMethod) { case ON_TOUCH_EVENT: super.onTouchEvent(mCancelEvent); break; case ON_INTERCEPT_TOUCH_EVENT: super.onInterceptTouchEvent(mCancelEvent); break; } } if (mRemoveAnimator != null) { mRemoveAnimator.start(); } else { doRemoveItem(which); } } } | /**
* Removes an item from the list and animates the removal.
*
* @param which Position to remove (NOTE: headers/footers ignored!
* this is a position in your input ListAdapter).
* @param velocityX
*/ | Removes an item from the list and animates the removal | removeItem | {
"repo_name": "libill/InformationDemo",
"path": "src/com/android/informationdemo/view/DragSortListView.java",
"license": "epl-1.0",
"size": 100496
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,362,761 |
public static void parse(DocListener document, InputStream is) {
HtmlParser p = new HtmlParser();
p.go(document, new InputSource(is));
}
| static void function(DocListener document, InputStream is) { HtmlParser p = new HtmlParser(); p.go(document, new InputSource(is)); } | /**
* Parses a given file that validates with the iText DTD and writes the content to a document.
* @param document the document the parser will write to
* @param is the InputStream with the content
*/ | Parses a given file that validates with the iText DTD and writes the content to a document | parse | {
"repo_name": "bullda/DroidText",
"path": "src/core/com/lowagie/text/html/HtmlParser.java",
"license": "lgpl-3.0",
"size": 6384
} | [
"com.lowagie.text.DocListener",
"java.io.InputStream",
"org.xml.sax.InputSource"
] | import com.lowagie.text.DocListener; import java.io.InputStream; import org.xml.sax.InputSource; | import com.lowagie.text.*; import java.io.*; import org.xml.sax.*; | [
"com.lowagie.text",
"java.io",
"org.xml.sax"
] | com.lowagie.text; java.io; org.xml.sax; | 1,861,466 |
@Observer(JpaIdentityStore.EVENT_PRE_PERSIST_USER)
public void prePersistUser(User user) {
if(!ConfigurationServiceImpl.configurationInProgress) {
user.setResource(tripleStore.createUriResource(
configurationService.getBaseUri()+"/user/"+user.getLogin()));
user.setType(tripleStore.createUriResource(Constants.NS_KIWI_CORE + "User"));
}
} | @Observer(JpaIdentityStore.EVENT_PRE_PERSIST_USER) void function(User user) { if(!ConfigurationServiceImpl.configurationInProgress) { user.setResource(tripleStore.createUriResource( configurationService.getBaseUri()+STR+user.getLogin())); user.setType(tripleStore.createUriResource(Constants.NS_KIWI_CORE + "User")); } } | /**
* Called by IdentityManager.instance().createUser() before the user will be created
* @param user
*/ | Called by IdentityManager.instance().createUser() before the user will be created | prePersistUser | {
"repo_name": "StexX/KiWi-OSE",
"path": "src/action/kiwi/service/user/IdentityManagerService.java",
"license": "bsd-3-clause",
"size": 9086
} | [
"kiwi.model.Constants",
"kiwi.model.user.User",
"kiwi.service.config.ConfigurationServiceImpl",
"org.jboss.seam.annotations.Observer",
"org.jboss.seam.security.management.JpaIdentityStore"
] | import kiwi.model.Constants; import kiwi.model.user.User; import kiwi.service.config.ConfigurationServiceImpl; import org.jboss.seam.annotations.Observer; import org.jboss.seam.security.management.JpaIdentityStore; | import kiwi.model.*; import kiwi.model.user.*; import kiwi.service.config.*; import org.jboss.seam.annotations.*; import org.jboss.seam.security.management.*; | [
"kiwi.model",
"kiwi.model.user",
"kiwi.service.config",
"org.jboss.seam"
] | kiwi.model; kiwi.model.user; kiwi.service.config; org.jboss.seam; | 1,190,452 |
protected void addDecimalMinutesPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_DMSAngleType_decimalMinutes_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_DMSAngleType_decimalMinutes_feature", "_UI_DMSAngleType_type"),
GmlPackage.eINSTANCE.getDMSAngleType_DecimalMinutes(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), GmlPackage.eINSTANCE.getDMSAngleType_DecimalMinutes(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Decimal Minutes feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Decimal Minutes feature. | addDecimalMinutesPropertyDescriptor | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/DMSAngleTypeItemProvider.java",
"license": "apache-2.0",
"size": 7824
} | [
"net.opengis.gml.GmlPackage",
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import net.opengis.gml.GmlPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import net.opengis.gml.*; import org.eclipse.emf.edit.provider.*; | [
"net.opengis.gml",
"org.eclipse.emf"
] | net.opengis.gml; org.eclipse.emf; | 1,579,207 |
private static BaseModel loadModel(int index) {
Tools toolElement = Tools.values()[index];
LogHelper.getLogger(LogHelper.INIT).info("Initializing the " + toolElement.description + "...");
PerformanceMonitor.start("model");
InputStream is = null;
try {is = new FileInputStream(Paths.TOOLS[index]);}
catch (IOException e) {
LogHelper.getLogger(LogHelper.IO).fatal(toolElement.description + "failed to load - program terminating.");
e.printStackTrace();
System.exit(1);
}
BaseModel model = null;
try {model = toolElement.modelClass.getConstructor(InputStream.class).newInstance(is);}
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {e.printStackTrace();}
LogHelper.getLogger(LogHelper.INIT).info("Complete (" + PerformanceMonitor.stop("model") + ")");
return model;
}
| static BaseModel function(int index) { Tools toolElement = Tools.values()[index]; LogHelper.getLogger(LogHelper.INIT).info(STR + toolElement.description + "..."); PerformanceMonitor.start("model"); InputStream is = null; try {is = new FileInputStream(Paths.TOOLS[index]);} catch (IOException e) { LogHelper.getLogger(LogHelper.IO).fatal(toolElement.description + STR); e.printStackTrace(); System.exit(1); } BaseModel model = null; try {model = toolElement.modelClass.getConstructor(InputStream.class).newInstance(is);} catch (InstantiationException IllegalAccessException IllegalArgumentException InvocationTargetException NoSuchMethodException SecurityException e) {e.printStackTrace();} LogHelper.getLogger(LogHelper.INIT).info(STR + PerformanceMonitor.stop("model") + ")"); return model; } | /**
* Loads an individual openNLP tool.
*
* @param index the index of the tool in both the {@code Tools} enum and the array of Tools in {@link Paths}.
* @return a BaseModel which holds the loaded file
*/ | Loads an individual openNLP tool | loadModel | {
"repo_name": "MXProgrammingClub/BSChecker",
"path": "src/main/java/bschecker/util/Tools.java",
"license": "bsd-3-clause",
"size": 4064
} | [
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.lang.reflect.InvocationTargetException"
] | import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; | import java.io.*; import java.lang.reflect.*; | [
"java.io",
"java.lang"
] | java.io; java.lang; | 982,394 |
private static JitterParameter getNewParameter1(
ArrayList<JitterParameter> solutions, double expectation,
double iqr) {
double middleM = (solutions.get(0).m + solutions.get(1).m + solutions
.get(2).m) / 3.0;
double middleS = (solutions.get(0).s + solutions.get(1).s + solutions
.get(2).s) / 3.0;
double newM = middleM + (solutions.get(0).m - solutions.get(2).m);
double newS = middleS + (solutions.get(0).s - solutions.get(2).s);
if (newS > 0) {
return new JitterParameter(newM, newS, expectation, iqr);
} else {
return null;
}
} | static JitterParameter function( ArrayList<JitterParameter> solutions, double expectation, double iqr) { double middleM = (solutions.get(0).m + solutions.get(1).m + solutions .get(2).m) / 3.0; double middleS = (solutions.get(0).s + solutions.get(1).s + solutions .get(2).s) / 3.0; double newM = middleM + (solutions.get(0).m - solutions.get(2).m); double newS = middleS + (solutions.get(0).s - solutions.get(2).s); if (newS > 0) { return new JitterParameter(newM, newS, expectation, iqr); } else { return null; } } | /**
* movement of factor 2 to center of solutions
*
* @param solutions
* @param expectation
* @param iqr
* @return moved solution
*/ | movement of factor 2 to center of solutions | getNewParameter1 | {
"repo_name": "flyroom/PeerfactSimKOM_Clone",
"path": "src/org/peerfact/impl/network/modular/common/PingErToolkit.java",
"license": "gpl-2.0",
"size": 7073
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,686,460 |
@Pure
public void toCoordinateSystem2D(Point3D point, Point2D result) {
switch(this) {
case XYZ_RIGHT_HAND:
case XYZ_LEFT_HAND:
result.set(point.getX(), point.getY());
break;
case XZY_LEFT_HAND:
case XZY_RIGHT_HAND:
result.set(point.getX(), point.getZ());
break;
default:
throw new CoordinateSystemNotFoundException();
}
} | void function(Point3D point, Point2D result) { switch(this) { case XYZ_RIGHT_HAND: case XYZ_LEFT_HAND: result.set(point.getX(), point.getY()); break; case XZY_LEFT_HAND: case XZY_RIGHT_HAND: result.set(point.getX(), point.getZ()); break; default: throw new CoordinateSystemNotFoundException(); } } | /** Convert the specified point into from the current coordinate system
* to the specified coordinate system.
*
* @param point is the point to convert
* @param result the 2D point.
*/ | Convert the specified point into from the current coordinate system to the specified coordinate system | toCoordinateSystem2D | {
"repo_name": "gallandarakhneorg/afc",
"path": "core/maths/mathgeom/tobeincluded/src/coordinatesystem/CoordinateSystem3D.java",
"license": "apache-2.0",
"size": 36244
} | [
"org.arakhne.afc.math.geometry.d2.Point2D",
"org.arakhne.afc.math.geometry.d3.Point3D"
] | import org.arakhne.afc.math.geometry.d2.Point2D; import org.arakhne.afc.math.geometry.d3.Point3D; | import org.arakhne.afc.math.geometry.d2.*; import org.arakhne.afc.math.geometry.d3.*; | [
"org.arakhne.afc"
] | org.arakhne.afc; | 2,520,274 |
public VmStatisticsDao getVmStatisticsDao() {
return getDao(VmStatisticsDao.class);
} | VmStatisticsDao function() { return getDao(VmStatisticsDao.class); } | /**
* Returns the singleton instance of {@link VmStatisticsDao}.
*
* @return the dao
*/ | Returns the singleton instance of <code>VmStatisticsDao</code> | getVmStatisticsDao | {
"repo_name": "jtux270/translate",
"path": "ovirt/3.6_source/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java",
"license": "gpl-3.0",
"size": 42484
} | [
"org.ovirt.engine.core.dao.VmStatisticsDao"
] | import org.ovirt.engine.core.dao.VmStatisticsDao; | import org.ovirt.engine.core.dao.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 2,876,187 |
@SuppressWarnings("unchecked")
private void markBranch(GraphNode node) {
ArrayList<GraphItem> items = new ArrayList<GraphItem>();
try {
GraphConnection connection = (GraphConnection) node.getTargetConnections().get(0);
connection.setLineColor(viewer.getGraphControl().DARK_BLUE);
items.add(connection.getSource());
items.add(connection.getDestination());
markedConnectionList.add(connection);
List<GraphConnection> l = connection.getSource().getTargetConnections();
while (l.size() != 0) {
connection = (GraphConnection) connection.getSource().getTargetConnections().get(0);
connection.setLineColor(viewer.getGraphControl().DARK_BLUE);
items.add(connection.getSource());
items.add(connection.getDestination());
markedConnectionList.add(connection);
l = connection.getSource().getTargetConnections();
}
} catch (IndexOutOfBoundsException ex) {
items.add(((GraphConnection) (node.getSourceConnections().get(0))).getSource());
}
} | @SuppressWarnings(STR) void function(GraphNode node) { ArrayList<GraphItem> items = new ArrayList<GraphItem>(); try { GraphConnection connection = (GraphConnection) node.getTargetConnections().get(0); connection.setLineColor(viewer.getGraphControl().DARK_BLUE); items.add(connection.getSource()); items.add(connection.getDestination()); markedConnectionList.add(connection); List<GraphConnection> l = connection.getSource().getTargetConnections(); while (l.size() != 0) { connection = (GraphConnection) connection.getSource().getTargetConnections().get(0); connection.setLineColor(viewer.getGraphControl().DARK_BLUE); items.add(connection.getSource()); items.add(connection.getDestination()); markedConnectionList.add(connection); l = connection.getSource().getTargetConnections(); } } catch (IndexOutOfBoundsException ex) { items.add(((GraphConnection) (node.getSourceConnections().get(0))).getSource()); } } | /**
* Marks the whole branch beginning from the selected node
*
* @param node any node of the graph
*/ | Marks the whole branch beginning from the selected node | markBranch | {
"repo_name": "jcryptool/crypto",
"path": "org.jcryptool.visual.sphincs/src/org/jcryptool/visual/sphincs/ui/SphincsTreeView.java",
"license": "epl-1.0",
"size": 19686
} | [
"java.util.ArrayList",
"java.util.List",
"org.eclipse.zest.core.widgets.GraphConnection",
"org.eclipse.zest.core.widgets.GraphItem",
"org.eclipse.zest.core.widgets.GraphNode"
] | import java.util.ArrayList; import java.util.List; import org.eclipse.zest.core.widgets.GraphConnection; import org.eclipse.zest.core.widgets.GraphItem; import org.eclipse.zest.core.widgets.GraphNode; | import java.util.*; import org.eclipse.zest.core.widgets.*; | [
"java.util",
"org.eclipse.zest"
] | java.util; org.eclipse.zest; | 2,903,637 |
@Override
public Collection<String> getCliqueFeatures(PaddedList<IN> cInfo, int loc, Clique clique) {
Collection<String> features = Generics.newHashSet();
String domain = cInfo.get(0).get(CoreAnnotations.DomainAnnotation.class);
final boolean doFE = domain != null;
// log.info(doFE+"\t"+domain);
// there are two special cases below, because 2 cliques have 2 names
Collection<String> c;
String suffix;
if (clique == cliqueC) {
//200710: tried making this clique null; didn't improve performance (rafferty)
c = featuresC(cInfo, loc);
suffix = "C";
} else if (clique == cliqueCpC) {
c = featuresCpC(cInfo, loc);
suffix = "CpC";
addAllInterningAndSuffixing(features, c, suffix);
if (doFE) {
addAllInterningAndSuffixing(features, c, domain + '-' + suffix);
}
c = featuresCnC(cInfo, loc-1);
suffix = "CnC";
} else if (clique == cliqueCp2C) {
c = featuresCp2C(cInfo, loc);
suffix = "Cp2C";
} else if (clique == cliqueCp3C) {
c = featuresCp3C(cInfo, loc);
suffix = "Cp3C";
} else if (clique == cliqueCp4C) {
c = featuresCp4C(cInfo, loc);
suffix = "Cp4C";
} else if (clique == cliqueCp5C) {
c = featuresCp5C(cInfo, loc);
suffix = "Cp5C";
} else if (clique == cliqueCpCp2C) {
c = featuresCpCp2C(cInfo, loc);
suffix = "CpCp2C";
addAllInterningAndSuffixing(features, c, suffix);
if (doFE) {
addAllInterningAndSuffixing(features, c, domain+ '-' + suffix);
}
c = featuresCpCnC(cInfo, loc-1);
suffix = "CpCnC";
} else if (clique == cliqueCpCp2Cp3C) {
c = featuresCpCp2Cp3C(cInfo, loc);
suffix = "CpCp2Cp3C";
} else if (clique == cliqueCpCp2Cp3Cp4C) {
c = featuresCpCp2Cp3Cp4C(cInfo, loc);
suffix = "CpCp2Cp3Cp4C";
} else {
throw new IllegalArgumentException("Unknown clique: " + clique);
}
addAllInterningAndSuffixing(features, c, suffix);
if (doFE) {
addAllInterningAndSuffixing(features, c, domain + '-' + suffix);
}
// log.info(StringUtils.join(features,"\n")+"\n");
return features;
}
// TODO: when breaking serialization, it seems like it would be better to
// move the lexicon into (Abstract)SequenceClassifier and to do this
// annotation as part of the ObjectBankWrapper. But note that it is
// serialized in this object currently and it would then need to be
// serialized elsewhere or loaded each time
private Map<String,String> lexicon; | Collection<String> function(PaddedList<IN> cInfo, int loc, Clique clique) { Collection<String> features = Generics.newHashSet(); String domain = cInfo.get(0).get(CoreAnnotations.DomainAnnotation.class); final boolean doFE = domain != null; Collection<String> c; String suffix; if (clique == cliqueC) { c = featuresC(cInfo, loc); suffix = "C"; } else if (clique == cliqueCpC) { c = featuresCpC(cInfo, loc); suffix = "CpC"; addAllInterningAndSuffixing(features, c, suffix); if (doFE) { addAllInterningAndSuffixing(features, c, domain + '-' + suffix); } c = featuresCnC(cInfo, loc-1); suffix = "CnC"; } else if (clique == cliqueCp2C) { c = featuresCp2C(cInfo, loc); suffix = "Cp2C"; } else if (clique == cliqueCp3C) { c = featuresCp3C(cInfo, loc); suffix = "Cp3C"; } else if (clique == cliqueCp4C) { c = featuresCp4C(cInfo, loc); suffix = "Cp4C"; } else if (clique == cliqueCp5C) { c = featuresCp5C(cInfo, loc); suffix = "Cp5C"; } else if (clique == cliqueCpCp2C) { c = featuresCpCp2C(cInfo, loc); suffix = STR; addAllInterningAndSuffixing(features, c, suffix); if (doFE) { addAllInterningAndSuffixing(features, c, domain+ '-' + suffix); } c = featuresCpCnC(cInfo, loc-1); suffix = "CpCnC"; } else if (clique == cliqueCpCp2Cp3C) { c = featuresCpCp2Cp3C(cInfo, loc); suffix = STR; } else if (clique == cliqueCpCp2Cp3Cp4C) { c = featuresCpCp2Cp3Cp4C(cInfo, loc); suffix = STR; } else { throw new IllegalArgumentException(STR + clique); } addAllInterningAndSuffixing(features, c, suffix); if (doFE) { addAllInterningAndSuffixing(features, c, domain + '-' + suffix); } return features; } private Map<String,String> lexicon; | /**
* Extracts all the features from the input data at a certain index.
*
* @param cInfo The complete data set as a List of WordInfo
* @param loc The index at which to extract features.
*/ | Extracts all the features from the input data at a certain index | getCliqueFeatures | {
"repo_name": "intfloat/CoreNLP",
"path": "src/edu/stanford/nlp/ie/NERFeatureFactory.java",
"license": "gpl-2.0",
"size": 108304
} | [
"edu.stanford.nlp.ling.CoreAnnotations",
"edu.stanford.nlp.sequences.Clique",
"edu.stanford.nlp.util.Generics",
"edu.stanford.nlp.util.PaddedList",
"java.util.Collection",
"java.util.Map"
] | import edu.stanford.nlp.ling.CoreAnnotations; import edu.stanford.nlp.sequences.Clique; import edu.stanford.nlp.util.Generics; import edu.stanford.nlp.util.PaddedList; import java.util.Collection; import java.util.Map; | import edu.stanford.nlp.ling.*; import edu.stanford.nlp.sequences.*; import edu.stanford.nlp.util.*; import java.util.*; | [
"edu.stanford.nlp",
"java.util"
] | edu.stanford.nlp; java.util; | 900,301 |
public synchronized void unload(LCMSDataSubset subset, Object user, Set<LCMSDataSubset> exclude) {
//System.err.println("=========== UNLOAD (user) CALLED ***********************");
if (!isLoaded(subset)) {
throw new IllegalStateException("LCMSData load/unload methods only"
+ " work for subsets loaded/unloaded using LCMSData API. The"
+ " subset you requested to unload wasn't loaded. If you've"
+ " loaded data into ScanCollection manually, then use"
+ " IScanCollection's API for unloading data manually as"
+ " well.");
}
Set<LCMSDataSubset> userSubsets = cache.getIfPresent(user);
if (userSubsets == null) {
throw new IllegalStateException("The user was not present in cache,"
+ " which means it either has never been there, or has already"
+ " been reclaimed by GC.");
}
if (!userSubsets.contains(subset)) {
throw new IllegalArgumentException("This user has not loaded the subset"
+ " in the first place. The user must load the subset using"
+ " LCMSData API first. Unloading a subset that a user has not"
+ " loaded itself is illegal.");
}
// removing the subset from the user's currently loaded subsets
userSubsets.remove(subset);
// getting subsets loaded by all other users of this LCMSData
ConcurrentMap<Object, Set<LCMSDataSubset>> otherUserMaps = cache.asMap();
HashSet<LCMSDataSubset> otherUsersSubsetsCombined = new HashSet<>();
for (Map.Entry<Object, Set<LCMSDataSubset>> entry : otherUserMaps.entrySet()) {
Object otherUser = entry.getKey();
if (otherUser != user) {
// we need to exclude the user requesting the unloading operation from the
// list of other loaded subsets
Set<LCMSDataSubset> otherUserSubsets = entry.getValue();
otherUsersSubsetsCombined.addAll(otherUserSubsets);
}
}
if (exclude != null) {
otherUsersSubsetsCombined.addAll(exclude);
}
if (otherUsersSubsetsCombined.isEmpty()) {
scans.unloadData(subset);
} else {
scans.unloadData(subset, otherUsersSubsetsCombined);
}
} | synchronized void function(LCMSDataSubset subset, Object user, Set<LCMSDataSubset> exclude) { if (!isLoaded(subset)) { throw new IllegalStateException(STR + STR + STR + STR + STR + STR); } Set<LCMSDataSubset> userSubsets = cache.getIfPresent(user); if (userSubsets == null) { throw new IllegalStateException(STR + STR + STR); } if (!userSubsets.contains(subset)) { throw new IllegalArgumentException(STR + STR + STR + STR); } userSubsets.remove(subset); ConcurrentMap<Object, Set<LCMSDataSubset>> otherUserMaps = cache.asMap(); HashSet<LCMSDataSubset> otherUsersSubsetsCombined = new HashSet<>(); for (Map.Entry<Object, Set<LCMSDataSubset>> entry : otherUserMaps.entrySet()) { Object otherUser = entry.getKey(); if (otherUser != user) { Set<LCMSDataSubset> otherUserSubsets = entry.getValue(); otherUsersSubsetsCombined.addAll(otherUserSubsets); } } if (exclude != null) { otherUsersSubsetsCombined.addAll(exclude); } if (otherUsersSubsetsCombined.isEmpty()) { scans.unloadData(subset); } else { scans.unloadData(subset, otherUsersSubsetsCombined); } } | /**
* Unloads spectra matched by this subset.
*
* @param subset to be unloaded
* @param user the user, that has had this subset loaded. If other users have parts of this subset
* loaded, those parts won't be unloaded.
* @param exclude can be null. If specified, data from these subsets won't be excluded.
*/ | Unloads spectra matched by this subset | unload | {
"repo_name": "chhh/MSFTBX",
"path": "MSFileToolbox/src/main/java/umich/ms/datatypes/LCMSData.java",
"license": "apache-2.0",
"size": 12150
} | [
"java.util.HashSet",
"java.util.Map",
"java.util.Set",
"java.util.concurrent.ConcurrentMap"
] | import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentMap; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,295,651 |
void delete(final RamFileObject file) throws FileSystemException {
// root is read only check
if (file.getParent() == null) {
throw new FileSystemException("unable to delete root");
}
// Remove reference from cache
this.cache.remove(file.getName());
// Notify the parent
final RamFileObject parent = (RamFileObject) this.resolveFile(file.getParent().getName());
parent.getData().removeChild(file.getData());
parent.close();
// Close the file
file.getData().clear();
file.close();
} | void delete(final RamFileObject file) throws FileSystemException { if (file.getParent() == null) { throw new FileSystemException(STR); } this.cache.remove(file.getName()); final RamFileObject parent = (RamFileObject) this.resolveFile(file.getParent().getName()); parent.getData().removeChild(file.getData()); parent.close(); file.getData().clear(); file.close(); } | /**
* Delete a file
*
* @param file
* @throws FileSystemException
*/ | Delete a file | delete | {
"repo_name": "wso2/wso2-commons-vfs",
"path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileSystem.java",
"license": "apache-2.0",
"size": 9220
} | [
"org.apache.commons.vfs2.FileSystemException"
] | import org.apache.commons.vfs2.FileSystemException; | import org.apache.commons.vfs2.*; | [
"org.apache.commons"
] | org.apache.commons; | 102,894 |
@Test
public void checkFindSecondElement() {
int expectedIndex = 2;
assertEquals(expectedIndex, tree.findNearestIndex(16.0));
assertEquals(expectedIndex, tree.findNearestIndex(19.0));
assertEquals(expectedIndex, tree.findNearestIndex(20.0));
assertEquals(expectedIndex, tree.findNearestIndex(21.0));
assertEquals(expectedIndex, tree.findNearestIndex(25.0));
double expectedValue = 20.0;
assertEquals(expectedValue, tree.findNearestValue(16.0), epsilon);
assertEquals(expectedValue, tree.findNearestValue(19.0), epsilon);
assertEquals(expectedValue, tree.findNearestValue(20.0), epsilon);
assertEquals(expectedValue, tree.findNearestValue(21.0), epsilon);
assertEquals(expectedValue, tree.findNearestValue(25.0), epsilon);
// Try values very close to the edge of the previous index.
assertEquals(expectedIndex, tree.findNearestIndex(15.0 + epsilon));
return;
}
| void function() { int expectedIndex = 2; assertEquals(expectedIndex, tree.findNearestIndex(16.0)); assertEquals(expectedIndex, tree.findNearestIndex(19.0)); assertEquals(expectedIndex, tree.findNearestIndex(20.0)); assertEquals(expectedIndex, tree.findNearestIndex(21.0)); assertEquals(expectedIndex, tree.findNearestIndex(25.0)); double expectedValue = 20.0; assertEquals(expectedValue, tree.findNearestValue(16.0), epsilon); assertEquals(expectedValue, tree.findNearestValue(19.0), epsilon); assertEquals(expectedValue, tree.findNearestValue(20.0), epsilon); assertEquals(expectedValue, tree.findNearestValue(21.0), epsilon); assertEquals(expectedValue, tree.findNearestValue(25.0), epsilon); assertEquals(expectedIndex, tree.findNearestIndex(15.0 + epsilon)); return; } | /**
* Checks that the element at index 2 in the tree can be found with the
* appropriate search values (anything between 15.0--exclusive--to
* 25.0--inclusive).
*/ | Checks that the element at index 2 in the tree can be found with the appropriate search values (anything between 15.0--exclusive--to 25.0--inclusive) | checkFindSecondElement | {
"repo_name": "SmithRWORNL/ice",
"path": "tests/org.eclipse.ice.viz.service.visit.test/src/org/eclipse/ice/viz/service/visit/test/BinarySearchTreeTester.java",
"license": "epl-1.0",
"size": 16020
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,120,157 |
long worldTime = getWorldTime();
while (worldTime - lastChange >= spawnDelay && location.getCreatureCount(id) < populationLimit) {
World world = location.getWorld();
Creature creature = world.getCreatureFactory().makeCreature(id, world);
if (creature != null) {
location.addCreature(creature);
} else {
DungeonLogger.warning("Could not find the creature preset for " + id + ".");
}
// Simulate that the creature was spawned just when it should have been.
// Do not prevent this modification if making the creature was unsuccessful to avoid an infinite loop.
lastChange += spawnDelay;
}
} | long worldTime = getWorldTime(); while (worldTime - lastChange >= spawnDelay && location.getCreatureCount(id) < populationLimit) { World world = location.getWorld(); Creature creature = world.getCreatureFactory().makeCreature(id, world); if (creature != null) { location.addCreature(creature); } else { DungeonLogger.warning(STR + id + "."); } lastChange += spawnDelay; } } | /**
* Refresh the spawner, spawning all creatures that should have spawned since the last spawn.
*
* <p>Only spawners in locations whose creatures are visible to the player should be refreshed.
*/ | Refresh the spawner, spawning all creatures that should have spawned since the last spawn. Only spawners in locations whose creatures are visible to the player should be refreshed | refresh | {
"repo_name": "ffurkanhas/dungeon",
"path": "src/main/java/org/mafagafogigante/dungeon/game/Spawner.java",
"license": "bsd-3-clause",
"size": 2772
} | [
"org.mafagafogigante.dungeon.entity.creatures.Creature",
"org.mafagafogigante.dungeon.logging.DungeonLogger"
] | import org.mafagafogigante.dungeon.entity.creatures.Creature; import org.mafagafogigante.dungeon.logging.DungeonLogger; | import org.mafagafogigante.dungeon.entity.creatures.*; import org.mafagafogigante.dungeon.logging.*; | [
"org.mafagafogigante.dungeon"
] | org.mafagafogigante.dungeon; | 2,621,249 |
public static void parseExtras(Context context, AccountType accountType, RawContactDelta state,
Bundle extras) {
if (extras == null || extras.size() == 0) {
// Bail early if no useful data
return;
}
parseStructuredNameExtra(context, accountType, state, extras);
parseStructuredPostalExtra(accountType, state, extras);
{
// Phone
final DataKind kind = accountType.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
parseExtras(state, kind, extras, Insert.PHONE_TYPE, Insert.PHONE, Phone.NUMBER);
parseExtras(state, kind, extras, Insert.SECONDARY_PHONE_TYPE, Insert.SECONDARY_PHONE,
Phone.NUMBER);
parseExtras(state, kind, extras, Insert.TERTIARY_PHONE_TYPE, Insert.TERTIARY_PHONE,
Phone.NUMBER);
}
{
// Email
final DataKind kind = accountType.getKindForMimetype(Email.CONTENT_ITEM_TYPE);
parseExtras(state, kind, extras, Insert.EMAIL_TYPE, Insert.EMAIL, Email.DATA);
parseExtras(state, kind, extras, Insert.SECONDARY_EMAIL_TYPE, Insert.SECONDARY_EMAIL,
Email.DATA);
parseExtras(state, kind, extras, Insert.TERTIARY_EMAIL_TYPE, Insert.TERTIARY_EMAIL,
Email.DATA);
}
//The following lines are provided and maintained by Mediatek Inc.
if(SipManager.isVoipSupported(context)){
//Internet call
final boolean hasInternetCall = extras.containsKey(Insert.SIP_ADDRESS);
String accountTypeName = accountType.getAccountTypeAndDataSet().accountType;
Log.i(TAG, "[parseExtras] accountTypeName : " + accountTypeName);
final DataKind kindSipAddress = accountType.getKindForMimetype(SipAddress.CONTENT_ITEM_TYPE);
//UIM
// if (hasInternetCall && (accountTypeName.equals(mSimAccountType) || accountTypeName.equals(mUsimAccountType))) {
if (hasInternetCall && (accountTypeName.equals(mSimAccountType)
|| accountTypeName.equals(mUsimAccountType)
|| accountTypeName.equals(mUimAccountType))) {
//UIM
Log.i(TAG, "[parseExtras] add SIP to sim/usim");
mIsSimType = true;
} else if (hasInternetCall && RawContactModifier.canInsert(state, kindSipAddress)) {
Log.i(TAG, "[parseExtras] add SIP to phone");
final ValuesDelta child = RawContactModifier.insertChild(state, kindSipAddress);
Log.i(TAG,"[parseExtras] child.hashCode : "+child.hashCode());
final String internetCall = extras.getString(Insert.SIP_ADDRESS);
if (ContactsUtils.isGraphic(internetCall)) {
child.put(Data.DATA1, internetCall);
}
} else if (hasInternetCall) {
Log.i(TAG,"[parseExtras] has SIP No. so add fail.");
mHasSip = true;
}
}
//The previous lines are provided and maintained by Mediatek Inc.
{
// Im
final DataKind kind = accountType.getKindForMimetype(Im.CONTENT_ITEM_TYPE);
fixupLegacyImType(extras);
parseExtras(state, kind, extras, Insert.IM_PROTOCOL, Insert.IM_HANDLE, Im.DATA);
}
// Organization
final boolean hasOrg = extras.containsKey(Insert.COMPANY)
|| extras.containsKey(Insert.JOB_TITLE);
final DataKind kindOrg = accountType.getKindForMimetype(Organization.CONTENT_ITEM_TYPE);
if (hasOrg && RawContactModifier.canInsert(state, kindOrg)) {
final ValuesDelta child = RawContactModifier.insertChild(state, kindOrg);
final String company = extras.getString(Insert.COMPANY);
if (ContactsUtils.isGraphic(company)) {
child.put(Organization.COMPANY, company);
}
final String title = extras.getString(Insert.JOB_TITLE);
if (ContactsUtils.isGraphic(title)) {
child.put(Organization.TITLE, title);
}
}
// Notes
final boolean hasNotes = extras.containsKey(Insert.NOTES);
final DataKind kindNotes = accountType.getKindForMimetype(Note.CONTENT_ITEM_TYPE);
if (hasNotes && RawContactModifier.canInsert(state, kindNotes)) {
final ValuesDelta child = RawContactModifier.insertChild(state, kindNotes);
final String notes = extras.getString(Insert.NOTES);
if (ContactsUtils.isGraphic(notes)) {
child.put(Note.NOTE, notes);
}
}
// Arbitrary additional data
ArrayList<ContentValues> values = extras.getParcelableArrayList(Insert.DATA);
if (values != null) {
Log.i(TAG,"[parseValues]");
parseValues(state, accountType, values);
}
} | static void function(Context context, AccountType accountType, RawContactDelta state, Bundle extras) { if (extras == null extras.size() == 0) { return; } parseStructuredNameExtra(context, accountType, state, extras); parseStructuredPostalExtra(accountType, state, extras); { final DataKind kind = accountType.getKindForMimetype(Phone.CONTENT_ITEM_TYPE); parseExtras(state, kind, extras, Insert.PHONE_TYPE, Insert.PHONE, Phone.NUMBER); parseExtras(state, kind, extras, Insert.SECONDARY_PHONE_TYPE, Insert.SECONDARY_PHONE, Phone.NUMBER); parseExtras(state, kind, extras, Insert.TERTIARY_PHONE_TYPE, Insert.TERTIARY_PHONE, Phone.NUMBER); } { final DataKind kind = accountType.getKindForMimetype(Email.CONTENT_ITEM_TYPE); parseExtras(state, kind, extras, Insert.EMAIL_TYPE, Insert.EMAIL, Email.DATA); parseExtras(state, kind, extras, Insert.SECONDARY_EMAIL_TYPE, Insert.SECONDARY_EMAIL, Email.DATA); parseExtras(state, kind, extras, Insert.TERTIARY_EMAIL_TYPE, Insert.TERTIARY_EMAIL, Email.DATA); } if(SipManager.isVoipSupported(context)){ final boolean hasInternetCall = extras.containsKey(Insert.SIP_ADDRESS); String accountTypeName = accountType.getAccountTypeAndDataSet().accountType; Log.i(TAG, STR + accountTypeName); final DataKind kindSipAddress = accountType.getKindForMimetype(SipAddress.CONTENT_ITEM_TYPE); if (hasInternetCall && (accountTypeName.equals(mSimAccountType) accountTypeName.equals(mUsimAccountType) accountTypeName.equals(mUimAccountType))) { Log.i(TAG, STR); mIsSimType = true; } else if (hasInternetCall && RawContactModifier.canInsert(state, kindSipAddress)) { Log.i(TAG, STR); final ValuesDelta child = RawContactModifier.insertChild(state, kindSipAddress); Log.i(TAG,STR+child.hashCode()); final String internetCall = extras.getString(Insert.SIP_ADDRESS); if (ContactsUtils.isGraphic(internetCall)) { child.put(Data.DATA1, internetCall); } } else if (hasInternetCall) { Log.i(TAG,STR); mHasSip = true; } } { final DataKind kind = accountType.getKindForMimetype(Im.CONTENT_ITEM_TYPE); fixupLegacyImType(extras); parseExtras(state, kind, extras, Insert.IM_PROTOCOL, Insert.IM_HANDLE, Im.DATA); } final boolean hasOrg = extras.containsKey(Insert.COMPANY) extras.containsKey(Insert.JOB_TITLE); final DataKind kindOrg = accountType.getKindForMimetype(Organization.CONTENT_ITEM_TYPE); if (hasOrg && RawContactModifier.canInsert(state, kindOrg)) { final ValuesDelta child = RawContactModifier.insertChild(state, kindOrg); final String company = extras.getString(Insert.COMPANY); if (ContactsUtils.isGraphic(company)) { child.put(Organization.COMPANY, company); } final String title = extras.getString(Insert.JOB_TITLE); if (ContactsUtils.isGraphic(title)) { child.put(Organization.TITLE, title); } } final boolean hasNotes = extras.containsKey(Insert.NOTES); final DataKind kindNotes = accountType.getKindForMimetype(Note.CONTENT_ITEM_TYPE); if (hasNotes && RawContactModifier.canInsert(state, kindNotes)) { final ValuesDelta child = RawContactModifier.insertChild(state, kindNotes); final String notes = extras.getString(Insert.NOTES); if (ContactsUtils.isGraphic(notes)) { child.put(Note.NOTE, notes); } } ArrayList<ContentValues> values = extras.getParcelableArrayList(Insert.DATA); if (values != null) { Log.i(TAG,STR); parseValues(state, accountType, values); } } | /**
* Parse the given {@link Bundle} into the given {@link RawContactDelta} state,
* assuming the extras defined through {@link Intents}.
*/ | Parse the given <code>Bundle</code> into the given <code>RawContactDelta</code> state, assuming the extras defined through <code>Intents</code> | parseExtras | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Contacts/src/com/android/contacts/model/RawContactModifier.java",
"license": "gpl-2.0",
"size": 68535
} | [
"android.content.ContentValues",
"android.content.Context",
"android.net.sip.SipManager",
"android.os.Bundle",
"android.provider.ContactsContract",
"android.util.Log",
"com.android.contacts.ContactsUtils",
"com.android.contacts.model.RawContactDelta",
"com.android.contacts.model.account.AccountType"... | import android.content.ContentValues; import android.content.Context; import android.net.sip.SipManager; import android.os.Bundle; import android.provider.ContactsContract; import android.util.Log; import com.android.contacts.ContactsUtils; import com.android.contacts.model.RawContactDelta; import com.android.contacts.model.account.AccountType; import com.android.contacts.model.dataitem.DataKind; import java.util.ArrayList; | import android.content.*; import android.net.sip.*; import android.os.*; import android.provider.*; import android.util.*; import com.android.contacts.*; import com.android.contacts.model.*; import com.android.contacts.model.account.*; import com.android.contacts.model.dataitem.*; import java.util.*; | [
"android.content",
"android.net",
"android.os",
"android.provider",
"android.util",
"com.android.contacts",
"java.util"
] | android.content; android.net; android.os; android.provider; android.util; com.android.contacts; java.util; | 355,456 |
@NonNull
public static String generateSignatureHash(@NonNull Signature signature) {
try {
MessageDigest digest = MessageDigest.getInstance(DIGEST_SHA_512);
byte[] hashBytes = digest.digest(signature.toByteArray());
return Base64.encodeToString(hashBytes, Base64.URL_SAFE | Base64.NO_WRAP);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(
"Platform does not support" + DIGEST_SHA_512 + " hashing");
}
} | static String function(@NonNull Signature signature) { try { MessageDigest digest = MessageDigest.getInstance(DIGEST_SHA_512); byte[] hashBytes = digest.digest(signature.toByteArray()); return Base64.encodeToString(hashBytes, Base64.URL_SAFE Base64.NO_WRAP); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException( STR + DIGEST_SHA_512 + STR); } } | /**
* Generates a SHA-512 hash, Base64 url-safe encoded, from a {@link Signature}.
*/ | Generates a SHA-512 hash, Base64 url-safe encoded, from a <code>Signature</code> | generateSignatureHash | {
"repo_name": "VKCOM/vk-android-sdk",
"path": "core/src/main/java/com/vk/api/sdk/browser/BrowserDescriptor.java",
"license": "mit",
"size": 7425
} | [
"android.content.pm.Signature",
"android.util.Base64",
"androidx.annotation.NonNull",
"java.security.MessageDigest",
"java.security.NoSuchAlgorithmException"
] | import android.content.pm.Signature; import android.util.Base64; import androidx.annotation.NonNull; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; | import android.content.pm.*; import android.util.*; import androidx.annotation.*; import java.security.*; | [
"android.content",
"android.util",
"androidx.annotation",
"java.security"
] | android.content; android.util; androidx.annotation; java.security; | 2,380,403 |
private void showProgressDialog(){
if(progressDialog==null){
progressDialog=new ProgressDialog(getActivity());
progressDialog.setMessage("正在加载..");
progressDialog.setCanceledOnTouchOutside(false);
}
progressDialog.show();
} | void function(){ if(progressDialog==null){ progressDialog=new ProgressDialog(getActivity()); progressDialog.setMessage(STR); progressDialog.setCanceledOnTouchOutside(false); } progressDialog.show(); } | /***
* show Progressialog
*/ | show Progressialog | showProgressDialog | {
"repo_name": "atVoidYX/heweather",
"path": "app/src/main/java/android/heweather/com/heweather/Fragment/ChooseAreaFragment.java",
"license": "apache-2.0",
"size": 9560
} | [
"android.app.ProgressDialog"
] | import android.app.ProgressDialog; | import android.app.*; | [
"android.app"
] | android.app; | 2,725,168 |
this.conf = conf;
int configuredRetentionSize = conf.getInt(
YarnConfiguration.NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP,
YarnConfiguration
.DEFAULT_NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP);
if (configuredRetentionSize <= 0) {
this.retentionSize =
YarnConfiguration
.DEFAULT_NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP;
} else {
this.retentionSize = configuredRetentionSize;
}
this.fileControllerName = controllerName;
extractRemoteRootLogDir();
extractRemoteRootLogDirSuffix();
initInternal(conf);
} | this.conf = conf; int configuredRetentionSize = conf.getInt( YarnConfiguration.NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP, YarnConfiguration .DEFAULT_NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP); if (configuredRetentionSize <= 0) { this.retentionSize = YarnConfiguration .DEFAULT_NM_LOG_AGGREGATION_NUM_LOG_FILES_SIZE_PER_APP; } else { this.retentionSize = configuredRetentionSize; } this.fileControllerName = controllerName; extractRemoteRootLogDir(); extractRemoteRootLogDirSuffix(); initInternal(conf); } | /**
* Initialize the log file controller.
* @param conf the Configuration
* @param controllerName the log controller class name
*/ | Initialize the log file controller | initialize | {
"repo_name": "lukmajercak/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/LogAggregationFileController.java",
"license": "apache-2.0",
"size": 21879
} | [
"org.apache.hadoop.yarn.conf.YarnConfiguration"
] | import org.apache.hadoop.yarn.conf.YarnConfiguration; | import org.apache.hadoop.yarn.conf.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,210,759 |
public MdmLink newMdmLink() {
return myMdmLinkFactory.newMdmLink();
} | MdmLink function() { return myMdmLinkFactory.newMdmLink(); } | /**
* Factory delegation method, whenever you need a new MdmLink, use this factory method.
* //TODO Should we make the constructor private for MdmLink? or work out some way to ensure they can only be instantiated via factory.
*
* @return A new {@link MdmLink}.
*/ | Factory delegation method, whenever you need a new MdmLink, use this factory method. TODO Should we make the constructor private for MdmLink? or work out some way to ensure they can only be instantiated via factory | newMdmLink | {
"repo_name": "aemay2/hapi-fhir",
"path": "hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java",
"license": "apache-2.0",
"size": 12946
} | [
"ca.uhn.fhir.jpa.entity.MdmLink"
] | import ca.uhn.fhir.jpa.entity.MdmLink; | import ca.uhn.fhir.jpa.entity.*; | [
"ca.uhn.fhir"
] | ca.uhn.fhir; | 2,082,317 |
public void setFinancialObject(ObjectCode financialObject) {
this.financialObject = financialObject;
} | void function(ObjectCode financialObject) { this.financialObject = financialObject; } | /**
* Sets the financialObject attribute.
*
* @param financialObject The financialObject to set.
* @deprecated
*/ | Sets the financialObject attribute | setFinancialObject | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/bc/businessobject/BudgetConstructionAppointmentFundingReason.java",
"license": "apache-2.0",
"size": 10384
} | [
"org.kuali.kfs.coa.businessobject.ObjectCode"
] | import org.kuali.kfs.coa.businessobject.ObjectCode; | import org.kuali.kfs.coa.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,257,570 |
public ExecutorBuilder setActionInputPrefetcher(ActionInputPrefetcher prefetcher) {
Preconditions.checkState(this.prefetcher == null);
this.prefetcher = Preconditions.checkNotNull(prefetcher);
return this;
} | ExecutorBuilder function(ActionInputPrefetcher prefetcher) { Preconditions.checkState(this.prefetcher == null); this.prefetcher = Preconditions.checkNotNull(prefetcher); return this; } | /**
* Sets the action input prefetcher. Only one module may set the prefetcher. If multiple modules
* set it, this method will throw an {@link IllegalStateException}.
*/ | Sets the action input prefetcher. Only one module may set the prefetcher. If multiple modules set it, this method will throw an <code>IllegalStateException</code> | setActionInputPrefetcher | {
"repo_name": "juhalindfors/bazel-patches",
"path": "src/main/java/com/google/devtools/build/lib/exec/ExecutorBuilder.java",
"license": "apache-2.0",
"size": 3667
} | [
"com.google.devtools.build.lib.util.Preconditions"
] | import com.google.devtools.build.lib.util.Preconditions; | import com.google.devtools.build.lib.util.*; | [
"com.google.devtools"
] | com.google.devtools; | 653,437 |
public static String rewriteViewStatement(PhoenixConnection conn, PTable index, PTable table, String viewStatement) throws SQLException {
if (viewStatement == null) {
return null;
} | static String function(PhoenixConnection conn, PTable index, PTable table, String viewStatement) throws SQLException { if (viewStatement == null) { return null; } | /**
* Rewrite a view statement to be valid against an index
* @param conn
* @param index
* @param table
* @return
* @throws SQLException
*/ | Rewrite a view statement to be valid against an index | rewriteViewStatement | {
"repo_name": "apurtell/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java",
"license": "apache-2.0",
"size": 45682
} | [
"java.sql.SQLException",
"org.apache.phoenix.jdbc.PhoenixConnection",
"org.apache.phoenix.schema.PTable"
] | import java.sql.SQLException; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.schema.PTable; | import java.sql.*; import org.apache.phoenix.jdbc.*; import org.apache.phoenix.schema.*; | [
"java.sql",
"org.apache.phoenix"
] | java.sql; org.apache.phoenix; | 1,369,864 |
public Media createMediaRecorder(String path) throws IOException {
return createMediaRecorder(path, getAvailableRecordingMimeTypes()[0]);
} | Media function(String path) throws IOException { return createMediaRecorder(path, getAvailableRecordingMimeTypes()[0]); } | /**
* Creates a Media recorder Object which will record from the device mic to
* a file in the given path.
* The output format will be amr-nb if supported by the platform.
*
* @param path a file path to where to store the recording, if the file does
* not exists it will be created.
* @deprecated
*/ | Creates a Media recorder Object which will record from the device mic to a file in the given path. The output format will be amr-nb if supported by the platform | createMediaRecorder | {
"repo_name": "codenameone/CodenameOne",
"path": "CodenameOne/src/com/codename1/ui/Display.java",
"license": "gpl-2.0",
"size": 192339
} | [
"com.codename1.media.Media",
"java.io.IOException"
] | import com.codename1.media.Media; import java.io.IOException; | import com.codename1.media.*; import java.io.*; | [
"com.codename1.media",
"java.io"
] | com.codename1.media; java.io; | 508,955 |
public boolean istPartnerEinAuftragteilnehmer(Integer iIdPartnerI,
Integer iIdAuftragI)
throws
ExceptionLP {
boolean bIstTeilnehmerO = false;
try {
bIstTeilnehmerO = auftragteilnehmerFac.istPartnerEinAuftragteilnehmer(
iIdPartnerI, iIdAuftragI);
}
catch (Throwable ex) {
handleThrowable(ex);
}
return bIstTeilnehmerO;
} | boolean function(Integer iIdPartnerI, Integer iIdAuftragI) throws ExceptionLP { boolean bIstTeilnehmerO = false; try { bIstTeilnehmerO = auftragteilnehmerFac.istPartnerEinAuftragteilnehmer( iIdPartnerI, iIdAuftragI); } catch (Throwable ex) { handleThrowable(ex); } return bIstTeilnehmerO; } | /**
* Feststellen, ob ein bestimmter Partner bereits in der Teilnehmerliste eines
* bestimmten Auftrags enthalten ist.
* @param iIdPartnerI PK des Partners
* @param iIdAuftragI PK des Auftrags
* @return boolean true, wenn der Partner in der Liste der Teilnehmer enthalten ist
* @throws ExceptionLP Ausnahme
*/ | Feststellen, ob ein bestimmter Partner bereits in der Teilnehmerliste eines bestimmten Auftrags enthalten ist | istPartnerEinAuftragteilnehmer | {
"repo_name": "erdincay/lpclientpc",
"path": "src/com/lp/client/frame/delegate/AuftragteilnehmerDelegate.java",
"license": "agpl-3.0",
"size": 7367
} | [
"com.lp.client.frame.ExceptionLP"
] | import com.lp.client.frame.ExceptionLP; | import com.lp.client.frame.*; | [
"com.lp.client"
] | com.lp.client; | 2,398,713 |
@Override
public void changeModel(int step) {
if (step >= numberOfSteps) {
return;
}
if (values != null) {
if (singleClass) {
Double refST = (Double) ((Vector) values).get(step);
Distribution distr = (Distribution) stationDef.getServiceTimeDistribution(stationKey, classKey);
distr.setMean(refST.doubleValue());
} else {
//Vector classSet = classDef.getClassKeys();
for (int i = 0; i < avaibleClasses.size(); i++) {
Object thisClass = avaibleClasses.get(i);
double refST = ((ValuesTable) values).getValue(thisClass, step);
Distribution distr = (Distribution) stationDef.getServiceTimeDistribution(stationKey, thisClass);
distr.setMean(refST);
}
}
}
}
| void function(int step) { if (step >= numberOfSteps) { return; } if (values != null) { if (singleClass) { Double refST = (Double) ((Vector) values).get(step); Distribution distr = (Distribution) stationDef.getServiceTimeDistribution(stationKey, classKey); distr.setMean(refST.doubleValue()); } else { for (int i = 0; i < avaibleClasses.size(); i++) { Object thisClass = avaibleClasses.get(i); double refST = ((ValuesTable) values).getValue(thisClass, step); Distribution distr = (Distribution) stationDef.getServiceTimeDistribution(stationKey, thisClass); distr.setMean(refST); } } } } | /**
* Changes the model preparing it for the next step
*
*/ | Changes the model preparing it for the next step | changeModel | {
"repo_name": "chpatrick/jmt",
"path": "src/jmt/gui/common/definitions/parametric/ServiceTimesParametricAnalysis.java",
"license": "gpl-2.0",
"size": 15667
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,086,691 |
@Test
@SmallTest
@Feature({"Navigation"})
public void testLaunchActivity() {
// Launch chrome
mActivityTestRule.startMainActivityFromLauncher();
String currentUrl = ChromeTabUtils.getUrlStringOnUiThread(
mActivityTestRule.getActivity().getActivityTab());
Assert.assertNotNull(currentUrl);
Assert.assertEquals(false, currentUrl.isEmpty());
} | @Feature({STR}) void function() { mActivityTestRule.startMainActivityFromLauncher(); String currentUrl = ChromeTabUtils.getUrlStringOnUiThread( mActivityTestRule.getActivity().getActivityTab()); Assert.assertNotNull(currentUrl); Assert.assertEquals(false, currentUrl.isEmpty()); } | /**
* Launch and verify URL is neither null nor empty.
*/ | Launch and verify URL is neither null nor empty | testLaunchActivity | {
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/javatests/src/org/chromium/chrome/browser/MainActivityWithURLTest.java",
"license": "bsd-3-clause",
"size": 3584
} | [
"org.chromium.base.test.util.Feature",
"org.chromium.chrome.test.util.ChromeTabUtils",
"org.junit.Assert"
] | import org.chromium.base.test.util.Feature; import org.chromium.chrome.test.util.ChromeTabUtils; import org.junit.Assert; | import org.chromium.base.test.util.*; import org.chromium.chrome.test.util.*; import org.junit.*; | [
"org.chromium.base",
"org.chromium.chrome",
"org.junit"
] | org.chromium.base; org.chromium.chrome; org.junit; | 2,403,824 |
public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
} catch (IOException e) {
e.printStackTrace();
} finally {
if (gzos != null) try {
gzos.close();
} catch (IOException ignore) {
}
}
return baos.toByteArray();
} | static byte[] function(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace(); } finally { if (gzos != null) try { gzos.close(); } catch (IOException ignore) { } } return baos.toByteArray(); } | /**
* GZip compress a string of bytes
*
* @param input
* @return
*/ | GZip compress a string of bytes | gzip | {
"repo_name": "Jabulba/VGScoreboardPing",
"path": "src/com/jabulba/vgscoreboardping/MetricsLite.java",
"license": "gpl-3.0",
"size": 17458
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.util.zip.GZIPOutputStream"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPOutputStream; | import java.io.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 190,499 |
synchronized SelectionKey register(SelectableChannel channel,
Object attachment) throws IOException {
SelectionKey key = null;
pendingChannels.add(channel);
pendingAttachments.add(attachment);
channel.configureBlocking(false);
selector.wakeup();
while (key == null) {
try {
wait();
} catch (InterruptedException e) {
// IGNORE
}
key = channel.keyFor(selector);
}
return key;
} | synchronized SelectionKey register(SelectableChannel channel, Object attachment) throws IOException { SelectionKey key = null; pendingChannels.add(channel); pendingAttachments.add(attachment); channel.configureBlocking(false); selector.wakeup(); while (key == null) { try { wait(); } catch (InterruptedException e) { } key = channel.keyFor(selector); } return key; } | /**
* Registers the given channel with our selector.
*
* @return The SelectionKey representing the registration, with the given
* attachment attached to it.
*/ | Registers the given channel with our selector | register | {
"repo_name": "jmaassen/AetherNIO",
"path": "src/nl/esciencecenter/aether/impl/nio/SendReceiveThread.java",
"license": "apache-2.0",
"size": 8090
} | [
"java.io.IOException",
"java.nio.channels.SelectableChannel",
"java.nio.channels.SelectionKey"
] | import java.io.IOException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; | import java.io.*; import java.nio.channels.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,924,691 |
public static ims.core.patient.domain.objects.Patient extractPatient(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.PatientForEDDischargeVo valueObject)
{
return extractPatient(domainFactory, valueObject, new HashMap());
}
| static ims.core.patient.domain.objects.Patient function(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.PatientForEDDischargeVo valueObject) { return extractPatient(domainFactory, valueObject, new HashMap()); } | /**
* Create the domain object from the value object.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param valueObject - extract the domain object fields from this.
*/ | Create the domain object from the value object | extractPatient | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/emergency/vo/domain/PatientForEDDischargeVoAssembler.java",
"license": "agpl-3.0",
"size": 17520
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,581,117 |
protected void emit_aWireStiff_WSTerminalRuleCall_3_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
acceptNodes(transition, nodes);
}
| void function(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); } | /**
* Syntax:
* WS?
*/ | Syntax: WS | emit_aWireStiff_WSTerminalRuleCall_3_q | {
"repo_name": "cooked/NDT",
"path": "sc.ndt.editor.bmodes.bmi/src-gen/sc/ndt/editor/bmodes/serializer/BmodesbmiSyntacticSequencer.java",
"license": "gpl-3.0",
"size": 75631
} | [
"java.util.List",
"org.eclipse.emf.ecore.EObject",
"org.eclipse.xtext.nodemodel.INode",
"org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider"
] | import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider; | import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.serializer.analysis.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.xtext"
] | java.util; org.eclipse.emf; org.eclipse.xtext; | 2,356,532 |
public int pwd() throws IOException
{
return sendCommand(FTPCommand.PWD);
}
/***
* A convenience method to send the FTP LIST command to the server,
* receive the reply, and return the reply code. Remember, it is up
* to you to manage the data connection. If you don't need this low
* level of access, use {@link org.netling.ftp.FTPClient} | int function() throws IOException { return sendCommand(FTPCommand.PWD); } /*** * A convenience method to send the FTP LIST command to the server, * receive the reply, and return the reply code. Remember, it is up * to you to manage the data connection. If you don't need this low * level of access, use {@link org.netling.ftp.FTPClient} | /***
* A convenience method to send the FTP PWD command to the server,
* receive the reply, and return the reply code.
* <p>
* @return The reply code received from the server.
* @exception FTPConnectionClosedException
* If the FTP server prematurely closes the connection as a result
* of the client being idle or some other reason causing the server
* to send FTP reply code 421. This exception may be caught either
* as an IOException or independently as itself.
* @exception IOException If an I/O error occurs while either sending the
* command or receiving the server reply.
***/ | A convenience method to send the FTP PWD command to the server, receive the reply, and return the reply code. | pwd | {
"repo_name": "rwinston/netling",
"path": "src/main/java/org/netling/ftp/FTP.java",
"license": "apache-2.0",
"size": 62046
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 42,518 |
public List<ExpressRouteLinkInner> links() {
return this.links;
} | List<ExpressRouteLinkInner> function() { return this.links; } | /**
* Get the set of physical links of the ExpressRoutePort resource.
*
* @return the links value
*/ | Get the set of physical links of the ExpressRoutePort resource | links | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/implementation/ExpressRoutePortInner.java",
"license": "mit",
"size": 8879
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 800,096 |
public int readRawInt(int bits) throws IOException {
if (bits == 0) {
return 0;
}
int uval = 0;
for (int i = 0; i < bits; i++) {
uval = readBitToInt(uval);
}
// fix the sign
int val;
int bitsToleft = 32 - bits;
if (bitsToleft != 0) {
uval <<= bitsToleft;
val = uval;
val >>= bitsToleft;
} else {
val = uval;
}
return val;
} | int function(int bits) throws IOException { if (bits == 0) { return 0; } int uval = 0; for (int i = 0; i < bits; i++) { uval = readBitToInt(uval); } int val; int bitsToleft = 32 - bits; if (bitsToleft != 0) { uval <<= bitsToleft; val = uval; val >>= bitsToleft; } else { val = uval; } return val; } | /**
* read bits into a signed integer.
*
* @param bits The number of bits to read
* @return The bits as a signed integer
* @throws IOException Thrown if error reading input stream
*/ | read bits into a signed integer | readRawInt | {
"repo_name": "dubenju/javay",
"path": "src/java/org/kc7bfi/jflac/io/BitInputStream.java",
"license": "apache-2.0",
"size": 26245
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 176,356 |
ImmutableList<SchemaOrgType> getAcquiredFromList(); | ImmutableList<SchemaOrgType> getAcquiredFromList(); | /**
* Returns the value list of property acquiredFrom. Empty list is returned if the property not set
* in current object.
*/ | Returns the value list of property acquiredFrom. Empty list is returned if the property not set in current object | getAcquiredFromList | {
"repo_name": "google/schemaorg-java",
"path": "src/main/java/com/google/schemaorg/core/OwnershipInfo.java",
"license": "apache-2.0",
"size": 7118
} | [
"com.google.common.collect.ImmutableList",
"com.google.schemaorg.SchemaOrgType"
] | import com.google.common.collect.ImmutableList; import com.google.schemaorg.SchemaOrgType; | import com.google.common.collect.*; import com.google.schemaorg.*; | [
"com.google.common",
"com.google.schemaorg"
] | com.google.common; com.google.schemaorg; | 1,500,821 |
public boolean canConnectFenceTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int l = par1IBlockAccess.getBlockId(par2, par3, par4);
if (l != this.blockID && l != Block.fenceGate.blockID)
{
Block block = Block.blocksList[l];
return block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock() ? block.blockMaterial != Material.pumpkin : false;
}
else
{
return true;
}
} | boolean function(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int l = par1IBlockAccess.getBlockId(par2, par3, par4); if (l != this.blockID && l != Block.fenceGate.blockID) { Block block = Block.blocksList[l]; return block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock() ? block.blockMaterial != Material.pumpkin : false; } else { return true; } } | /**
* Returns true if the specified block can be connected by a fence
*/ | Returns true if the specified block can be connected by a fence | canConnectFenceTo | {
"repo_name": "zDeathKnight/VanillaAddon",
"path": "common/com/VanillaAddon/block/BlockFenceModtest.java",
"license": "gpl-3.0",
"size": 6137
} | [
"net.minecraft.block.Block",
"net.minecraft.block.material.Material",
"net.minecraft.world.IBlockAccess"
] | import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.IBlockAccess; | import net.minecraft.block.*; import net.minecraft.block.material.*; import net.minecraft.world.*; | [
"net.minecraft.block",
"net.minecraft.world"
] | net.minecraft.block; net.minecraft.world; | 1,117,587 |
protected boolean validRoleNamespace(IdentityManagementRoleDocument roleDoc) {
boolean validRoleNamespace = false;
if(StringUtils.isNotBlank(roleDoc.getRoleNamespace())) {
validRoleNamespace = true;
}
else{
GlobalVariables.getMessageMap().putError("document.roleNamespace",
RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {"Role Namespace"});
}
return validRoleNamespace;
}
| boolean function(IdentityManagementRoleDocument roleDoc) { boolean validRoleNamespace = false; if(StringUtils.isNotBlank(roleDoc.getRoleNamespace())) { validRoleNamespace = true; } else{ GlobalVariables.getMessageMap().putError(STR, RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {STR}); } return validRoleNamespace; } | /**
* Ensures the {@link IdentityManagementRoleDocument} role namespace is not null or an empty string.
* @param roleDoc the {@link IdentityManagementRoleDocument} to validate.
* @return TRUE if the role namespace is not null or an empty string, FALSE otherwise.
*/ | Ensures the <code>IdentityManagementRoleDocument</code> role namespace is not null or an empty string | validRoleNamespace | {
"repo_name": "ricepanda/rice-git3",
"path": "rice-middleware/impl/src/main/java/org/kuali/rice/kim/document/rule/IdentityManagementRoleDocumentRule.java",
"license": "apache-2.0",
"size": 46012
} | [
"org.apache.commons.lang.StringUtils",
"org.kuali.rice.core.api.util.RiceKeyConstants",
"org.kuali.rice.kim.document.IdentityManagementRoleDocument",
"org.kuali.rice.krad.util.GlobalVariables"
] | import org.apache.commons.lang.StringUtils; import org.kuali.rice.core.api.util.RiceKeyConstants; import org.kuali.rice.kim.document.IdentityManagementRoleDocument; import org.kuali.rice.krad.util.GlobalVariables; | import org.apache.commons.lang.*; import org.kuali.rice.core.api.util.*; import org.kuali.rice.kim.document.*; import org.kuali.rice.krad.util.*; | [
"org.apache.commons",
"org.kuali.rice"
] | org.apache.commons; org.kuali.rice; | 80,589 |
protected void tearDown() {
// No-op.
}
}
private static class GridPingFutureAdapter<R> extends GridFutureAdapter<R> {
private final UUID nodeId;
private volatile Socket sock;
GridPingFutureAdapter(@Nullable UUID nodeId) {
this.nodeId = nodeId;
} | void function() { } } private static class GridPingFutureAdapter<R> extends GridFutureAdapter<R> { private final UUID nodeId; private volatile Socket sock; GridPingFutureAdapter(@Nullable UUID nodeId) { this.nodeId = nodeId; } | /**
* Actions to be done before worker termination.
*/ | Actions to be done before worker termination | tearDown | {
"repo_name": "ascherbakoff/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java",
"license": "apache-2.0",
"size": 337852
} | [
"java.net.Socket",
"org.apache.ignite.internal.util.future.GridFutureAdapter",
"org.jetbrains.annotations.Nullable"
] | import java.net.Socket; import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.jetbrains.annotations.Nullable; | import java.net.*; import org.apache.ignite.internal.util.future.*; import org.jetbrains.annotations.*; | [
"java.net",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.net; org.apache.ignite; org.jetbrains.annotations; | 718,460 |
@VisibleForTesting
public Builder setSimpleTestingIndexSchema(@Nullable Boolean rollup, final AggregatorFactory... metrics)
{
IncrementalIndexSchema.Builder builder = new IncrementalIndexSchema.Builder().withMetrics(metrics);
this.incrementalIndexSchema = rollup != null ? builder.withRollup(rollup).build() : builder.build();
return this;
} | Builder function(@Nullable Boolean rollup, final AggregatorFactory... metrics) { IncrementalIndexSchema.Builder builder = new IncrementalIndexSchema.Builder().withMetrics(metrics); this.incrementalIndexSchema = rollup != null ? builder.withRollup(rollup).build() : builder.build(); return this; } | /**
* A helper method to set a simple index schema with controllable metrics and rollup, and default values for the
* other parameters. Note that this method is normally used for testing and benchmarking; it is unlikely that you
* would use it in production settings.
*
* @param metrics variable array of {@link AggregatorFactory} metrics
*
* @return this
*/ | A helper method to set a simple index schema with controllable metrics and rollup, and default values for the other parameters. Note that this method is normally used for testing and benchmarking; it is unlikely that you would use it in production settings | setSimpleTestingIndexSchema | {
"repo_name": "knoguchi/druid",
"path": "processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java",
"license": "apache-2.0",
"size": 52139
} | [
"javax.annotation.Nullable",
"org.apache.druid.query.aggregation.AggregatorFactory"
] | import javax.annotation.Nullable; import org.apache.druid.query.aggregation.AggregatorFactory; | import javax.annotation.*; import org.apache.druid.query.aggregation.*; | [
"javax.annotation",
"org.apache.druid"
] | javax.annotation; org.apache.druid; | 1,302,178 |
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<ProfileInner> listByResourceGroupAsync(String resourceGroupName) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ProfileInner> function(String resourceGroupName) { return new PagedFlux<>( () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } | /**
* Lists all of the CDN profiles within a resource group.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @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 result of the request to list profiles.
*/ | Lists all of the CDN profiles within a resource group | listByResourceGroupAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/implementation/ProfilesClientImpl.java",
"license": "mit",
"size": 111257
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.cdn.fluent.models.ProfileInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.cdn.fluent.models.ProfileInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.cdn.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 809,346 |
void runPeriodicStep(String policy, Metadata metadata, IndexMetadata indexMetadata) {
String index = indexMetadata.getIndex().getName();
LifecycleExecutionState lifecycleState = LifecycleExecutionState.fromIndexMetadata(indexMetadata);
final Step currentStep;
try {
currentStep = getCurrentStep(stepRegistry, policy, indexMetadata);
} catch (Exception e) {
markPolicyRetrievalError(policy, indexMetadata.getIndex(), lifecycleState, e);
return;
}
if (currentStep == null) {
if (stepRegistry.policyExists(policy) == false) {
markPolicyDoesNotExist(policy, indexMetadata.getIndex(), lifecycleState);
return;
} else {
Step.StepKey currentStepKey = LifecycleExecutionState.getCurrentStepKey(lifecycleState);
if (TerminalPolicyStep.KEY.equals(currentStepKey)) {
// This index is a leftover from before we halted execution on the final phase
// instead of going to the completed phase, so it's okay to ignore this index
// for now
return;
}
logger.error("current step [{}] for index [{}] with policy [{}] is not recognized",
currentStepKey, index, policy);
return;
}
}
if (currentStep instanceof TerminalPolicyStep) {
logger.debug("policy [{}] for index [{}] complete, skipping execution", policy, index);
return;
} else if (currentStep instanceof ErrorStep) {
onErrorMaybeRetryFailedStep(policy, indexMetadata);
return;
}
logger.trace("[{}] maybe running periodic step ({}) with current step {}",
index, currentStep.getClass().getSimpleName(), currentStep.getKey());
// Only phase changing and async wait steps should be run through periodic polling
if (currentStep instanceof PhaseCompleteStep) {
if (currentStep.getNextStepKey() == null) {
logger.debug("[{}] stopping in the current phase ({}) as there are no more steps in the policy",
index, currentStep.getKey().getPhase());
return;
}
// Only proceed to the next step if enough time has elapsed to go into the next phase
if (isReadyToTransitionToThisPhase(policy, indexMetadata, currentStep.getNextStepKey().getPhase())) {
moveToStep(indexMetadata.getIndex(), policy, currentStep.getKey(), currentStep.getNextStepKey());
}
} else if (currentStep instanceof AsyncWaitStep) {
logger.debug("[{}] running periodic policy with current-step [{}]", index, currentStep.getKey());
((AsyncWaitStep) currentStep).evaluateCondition(metadata, indexMetadata.getIndex(), new AsyncWaitStep.Listener() { | void runPeriodicStep(String policy, Metadata metadata, IndexMetadata indexMetadata) { String index = indexMetadata.getIndex().getName(); LifecycleExecutionState lifecycleState = LifecycleExecutionState.fromIndexMetadata(indexMetadata); final Step currentStep; try { currentStep = getCurrentStep(stepRegistry, policy, indexMetadata); } catch (Exception e) { markPolicyRetrievalError(policy, indexMetadata.getIndex(), lifecycleState, e); return; } if (currentStep == null) { if (stepRegistry.policyExists(policy) == false) { markPolicyDoesNotExist(policy, indexMetadata.getIndex(), lifecycleState); return; } else { Step.StepKey currentStepKey = LifecycleExecutionState.getCurrentStepKey(lifecycleState); if (TerminalPolicyStep.KEY.equals(currentStepKey)) { return; } logger.error(STR, currentStepKey, index, policy); return; } } if (currentStep instanceof TerminalPolicyStep) { logger.debug(STR, policy, index); return; } else if (currentStep instanceof ErrorStep) { onErrorMaybeRetryFailedStep(policy, indexMetadata); return; } logger.trace(STR, index, currentStep.getClass().getSimpleName(), currentStep.getKey()); if (currentStep instanceof PhaseCompleteStep) { if (currentStep.getNextStepKey() == null) { logger.debug(STR, index, currentStep.getKey().getPhase()); return; } if (isReadyToTransitionToThisPhase(policy, indexMetadata, currentStep.getNextStepKey().getPhase())) { moveToStep(indexMetadata.getIndex(), policy, currentStep.getKey(), currentStep.getNextStepKey()); } } else if (currentStep instanceof AsyncWaitStep) { logger.debug(STR, index, currentStep.getKey()); ((AsyncWaitStep) currentStep).evaluateCondition(metadata, indexMetadata.getIndex(), new AsyncWaitStep.Listener() { | /**
* Run the current step, only if it is an asynchronous wait step. These
* wait criteria are checked periodically from the ILM scheduler
*/ | Run the current step, only if it is an asynchronous wait step. These wait criteria are checked periodically from the ILM scheduler | runPeriodicStep | {
"repo_name": "nknize/elasticsearch",
"path": "x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleRunner.java",
"license": "apache-2.0",
"size": 27331
} | [
"org.elasticsearch.cluster.metadata.IndexMetadata",
"org.elasticsearch.cluster.metadata.Metadata",
"org.elasticsearch.xpack.core.ilm.AsyncWaitStep",
"org.elasticsearch.xpack.core.ilm.ErrorStep",
"org.elasticsearch.xpack.core.ilm.LifecycleExecutionState",
"org.elasticsearch.xpack.core.ilm.PhaseCompleteStep... | import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.xpack.core.ilm.AsyncWaitStep; import org.elasticsearch.xpack.core.ilm.ErrorStep; import org.elasticsearch.xpack.core.ilm.LifecycleExecutionState; import org.elasticsearch.xpack.core.ilm.PhaseCompleteStep; import org.elasticsearch.xpack.core.ilm.Step; import org.elasticsearch.xpack.core.ilm.TerminalPolicyStep; | import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.xpack.core.ilm.*; | [
"org.elasticsearch.cluster",
"org.elasticsearch.xpack"
] | org.elasticsearch.cluster; org.elasticsearch.xpack; | 1,664,525 |
private void fitImageToView() {
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
return;
}
if (matrix == null || prevMatrix == null) {
return;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
//
// Scale image for view
//
float scaleX = (float) viewWidth / drawableWidth;
float scaleY = (float) viewHeight / drawableHeight;
switch (mScaleType) {
case CENTER:
scaleX = scaleY = 1;
break;
case CENTER_CROP:
scaleX = scaleY = Math.max(scaleX, scaleY);
break;
case CENTER_INSIDE:
scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
case FIT_CENTER:
scaleX = scaleY = Math.min(scaleX, scaleY);
break;
case FIT_XY:
break;
default:
//
// FIT_START and FIT_END not supported
//
throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
}
//
// Center the image
//
float redundantXSpace = viewWidth - (scaleX * drawableWidth);
float redundantYSpace = viewHeight - (scaleY * drawableHeight);
matchViewWidth = viewWidth - redundantXSpace;
matchViewHeight = viewHeight - redundantYSpace;
if (!isZoomed() && !imageRenderedAtLeastOnce) {
//
// Stretch and center image to fit view
//
matrix.setScale(scaleX, scaleY);
matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2);
normalizedScale = 1;
} else {
//
// These values should never be 0 or we will set viewWidth and viewHeight
// to NaN in translateMatrixAfterRotate. To avoid this, call savePreviousImageValues
// to set them equal to the current values.
//
if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
savePreviousImageValues();
}
prevMatrix.getValues(m);
//
// Rescale Matrix after rotation
//
m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale;
m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale;
//
// TransX and TransY from previous matrix
//
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
//
// Width
//
float prevActualWidth = prevMatchViewWidth * normalizedScale;
float actualWidth = getImageWidth();
translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth);
//
// Height
//
float prevActualHeight = prevMatchViewHeight * normalizedScale;
float actualHeight = getImageHeight();
translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight);
//
// Set the matrix to the adjusted scale and translate values.
//
matrix.setValues(m);
}
fixTrans();
setImageMatrix(matrix);
} | void function() { Drawable drawable = getDrawable(); if (drawable == null drawable.getIntrinsicWidth() == 0 drawable.getIntrinsicHeight() == 0) { return; } if (matrix == null prevMatrix == null) { return; } int drawableWidth = drawable.getIntrinsicWidth(); int drawableHeight = drawable.getIntrinsicHeight(); float scaleY = (float) viewHeight / drawableHeight; switch (mScaleType) { case CENTER: scaleX = scaleY = 1; break; case CENTER_CROP: scaleX = scaleY = Math.max(scaleX, scaleY); break; case CENTER_INSIDE: scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY)); case FIT_CENTER: scaleX = scaleY = Math.min(scaleX, scaleY); break; case FIT_XY: break; default: } float redundantYSpace = viewHeight - (scaleY * drawableHeight); matchViewWidth = viewWidth - redundantXSpace; matchViewHeight = viewHeight - redundantYSpace; if (!isZoomed() && !imageRenderedAtLeastOnce) { matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2); normalizedScale = 1; } else { savePreviousImageValues(); } prevMatrix.getValues(m); m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale; float transY = m[Matrix.MTRANS_Y]; float actualWidth = getImageWidth(); translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth); float actualHeight = getImageHeight(); translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight); } fixTrans(); setImageMatrix(matrix); } | /**
* If the normalizedScale is equal to 1, then the image is made to fit the screen. Otherwise,
* it is made to fit the screen according to the dimensions of the previous image matrix. This
* allows the image to maintain its zoom after rotation.
*/ | If the normalizedScale is equal to 1, then the image is made to fit the screen. Otherwise, it is made to fit the screen according to the dimensions of the previous image matrix. This allows the image to maintain its zoom after rotation | fitImageToView | {
"repo_name": "dbuscaglia/codepath_project_2",
"path": "app/src/main/java/danbuscaglia/googleimagesearch/components/TouchImageView.java",
"license": "apache-2.0",
"size": 42695
} | [
"android.graphics.Matrix",
"android.graphics.drawable.Drawable"
] | import android.graphics.Matrix; import android.graphics.drawable.Drawable; | import android.graphics.*; import android.graphics.drawable.*; | [
"android.graphics"
] | android.graphics; | 864,514 |
public ITokenElement getElement() {
return element;
} | ITokenElement function() { return element; } | /**
* Returns the element which contains the comments.
*/ | Returns the element which contains the comments | getElement | {
"repo_name": "vimaier/conqat",
"path": "org.conqat.engine.text/src/org/conqat/engine/text/comments/Comment.java",
"license": "apache-2.0",
"size": 4195
} | [
"org.conqat.engine.sourcecode.resource.ITokenElement"
] | import org.conqat.engine.sourcecode.resource.ITokenElement; | import org.conqat.engine.sourcecode.resource.*; | [
"org.conqat.engine"
] | org.conqat.engine; | 967,760 |
public static void readFully(
InputStream in, byte[] b, int off, int len) throws IOException {
int read = read(in, b, off, len);
if (read != len) {
throw new EOFException("reached end of stream after reading "
+ read + " bytes; " + len + " bytes expected");
}
} | static void function( InputStream in, byte[] b, int off, int len) throws IOException { int read = read(in, b, off, len); if (read != len) { throw new EOFException(STR + read + STR + len + STR); } } | /**
* Attempts to read {@code len} bytes from the stream into the given array
* starting at {@code off}, with the same behavior as
* {@link DataInput#readFully(byte[], int, int)}. Does not close the
* stream.
*
* @param in the input stream to read from.
* @param b the buffer into which the data is read.
* @param off an int specifying the offset into the data.
* @param len an int specifying the number of bytes to read.
* @throws EOFException if this stream reaches the end before reading all
* the bytes.
* @throws IOException if an I/O error occurs.
*/ | Attempts to read len bytes from the stream into the given array starting at off, with the same behavior as <code>DataInput#readFully(byte[], int, int)</code>. Does not close the stream | readFully | {
"repo_name": "LightSun/android-common-utils",
"path": "common-utils/third_sdks/src/main/java/com/heaven7/third/pay/ByteStreams.java",
"license": "apache-2.0",
"size": 6600
} | [
"java.io.EOFException",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.EOFException; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,857,310 |
public void unload() throws IOException {
if(!csvParser.isClosed()) {
csvParser.close();
}
} | void function() throws IOException { if(!csvParser.isClosed()) { csvParser.close(); } } | /**
* This method saves the loaded CSV in its file
* @return
*/ | This method saves the loaded CSV in its file | unload | {
"repo_name": "onaio/OpenMapKit",
"path": "app/src/main/java/org/redcross/openmapkit/PullCsvBuilder.java",
"license": "bsd-3-clause",
"size": 9512
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 754,113 |
public final MetaProperty<Tenor> maturityTenor() {
return _maturityTenor;
} | final MetaProperty<Tenor> function() { return _maturityTenor; } | /**
* The meta-property for the {@code maturityTenor} property.
* @return the meta-property, not null
*/ | The meta-property for the maturityTenor property | maturityTenor | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial/src/main/java/com/opengamma/financial/analytics/ircurve/strips/FXForwardNode.java",
"license": "apache-2.0",
"size": 16364
} | [
"com.opengamma.util.time.Tenor",
"org.joda.beans.MetaProperty"
] | import com.opengamma.util.time.Tenor; import org.joda.beans.MetaProperty; | import com.opengamma.util.time.*; import org.joda.beans.*; | [
"com.opengamma.util",
"org.joda.beans"
] | com.opengamma.util; org.joda.beans; | 1,200,584 |
private void verifySerialization(SegmentedTimeline a1) {
SegmentedTimeline a2 = null;
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(a1);
out.close();
ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
a2 = (SegmentedTimeline) in.readObject();
in.close();
}
catch (Exception e) {
System.out.println(e.toString());
}
assertEquals(a1, a2);
} | void function(SegmentedTimeline a1) { SegmentedTimeline a2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); a2 = (SegmentedTimeline) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(a1, a2); } | /**
* Tests serialization of an instance.
* @param a1 The timeline to verify the serialization
*/ | Tests serialization of an instance | verifySerialization | {
"repo_name": "simeshev/parabuild-ci",
"path": "3rdparty/jfreechart0921/source/org/jfree/chart/axis/junit/SegmentedTimelineTests.java",
"license": "lgpl-3.0",
"size": 47122
} | [
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.ObjectInput",
"java.io.ObjectInputStream",
"java.io.ObjectOutput",
"java.io.ObjectOutputStream",
"org.jfree.chart.axis.SegmentedTimeline"
] | import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import org.jfree.chart.axis.SegmentedTimeline; | import java.io.*; import org.jfree.chart.axis.*; | [
"java.io",
"org.jfree.chart"
] | java.io; org.jfree.chart; | 187,205 |
protected static boolean matches(Class<?>[] types, Object[] instances) {
if (types==null) return instances==null || instances.length==0;
assert(types!=null);
if (instances==null) return types.length==0;
if (types.length==instances.length) {
for(int i=0; i<types.length; ++i) {
// Use the reflection util that supports the base types.
if (!ReflectionUtil.isInstance(types[i],instances[i]))
return false;
}
return true;
}
return false;
} | static boolean function(Class<?>[] types, Object[] instances) { if (types==null) return instances==null instances.length==0; assert(types!=null); if (instances==null) return types.length==0; if (types.length==instances.length) { for(int i=0; i<types.length; ++i) { if (!ReflectionUtil.isInstance(types[i],instances[i])) return false; } return true; } return false; } | /** Test if the instances are matching the types.
*
* @param types
* @param instances
* @return <code>true</code> if the instances are matching the types;
* otherwise <code>false</code>.
*/ | Test if the instances are matching the types | matches | {
"repo_name": "tpiotrow/afc",
"path": "ui/swing/src/main/java/org/arakhne/afc/ui/swing/undo/UndoableAction.java",
"license": "apache-2.0",
"size": 5539
} | [
"org.arakhne.afc.vmutil.ReflectionUtil"
] | import org.arakhne.afc.vmutil.ReflectionUtil; | import org.arakhne.afc.vmutil.*; | [
"org.arakhne.afc"
] | org.arakhne.afc; | 2,293,223 |
public void execute(TransformerImpl transformer) throws TransformerException
{
transformer.pushCurrentTemplateRuleIsNull(true);
if (transformer.getDebug())
transformer.getTraceManager().fireTraceEvent(this);//trigger for-each element event
try
{
transformSelectedNodes(transformer);
}
finally
{
if (transformer.getDebug())
transformer.getTraceManager().fireTraceEndEvent(this);
transformer.popCurrentTemplateRuleIsNull();
}
}
| void function(TransformerImpl transformer) throws TransformerException { transformer.pushCurrentTemplateRuleIsNull(true); if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this); try { transformSelectedNodes(transformer); } finally { if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this); transformer.popCurrentTemplateRuleIsNull(); } } | /**
* Execute the xsl:for-each transformation
*
* @param transformer non-null reference to the the current transform-time state.
*
* @throws TransformerException
*/ | Execute the xsl:for-each transformation | execute | {
"repo_name": "srnsw/xena",
"path": "xena/ext/src/xalan-j_2_7_1/src/org/apache/xalan/templates/ElemForEach.java",
"license": "gpl-3.0",
"size": 15705
} | [
"javax.xml.transform.TransformerException",
"org.apache.xalan.transformer.TransformerImpl"
] | import javax.xml.transform.TransformerException; import org.apache.xalan.transformer.TransformerImpl; | import javax.xml.transform.*; import org.apache.xalan.transformer.*; | [
"javax.xml",
"org.apache.xalan"
] | javax.xml; org.apache.xalan; | 50,242 |
@GwtIncompatible // reflection
public static Method getListIteratorUnmodifiableMethod() {
return Helpers.getMethod(ListListIteratorTester.class, "testListIterator_unmodifiable");
} | @GwtIncompatible static Method function() { return Helpers.getMethod(ListListIteratorTester.class, STR); } | /**
* Returns the {@link Method} instance for
* {@link #testListIterator_unmodifiable()} so that it can be suppressed in
* GWT tests.
*/ | Returns the <code>Method</code> instance for <code>#testListIterator_unmodifiable()</code> so that it can be suppressed in GWT tests | getListIteratorUnmodifiableMethod | {
"repo_name": "DavesMan/guava",
"path": "guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java",
"license": "apache-2.0",
"size": 4600
} | [
"com.google.common.annotations.GwtIncompatible",
"com.google.common.collect.testing.Helpers",
"java.lang.reflect.Method"
] | import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.testing.Helpers; import java.lang.reflect.Method; | import com.google.common.annotations.*; import com.google.common.collect.testing.*; import java.lang.reflect.*; | [
"com.google.common",
"java.lang"
] | com.google.common; java.lang; | 632,410 |
public Collection<HistogramQuestionScoresBean> getPartInfo()
{
return partInfo;
} | Collection<HistogramQuestionScoresBean> function() { return partInfo; } | /**
* the a collection of information for the active part
*
* @return the part info collection
*/ | the a collection of information for the active part | getPartInfo | {
"repo_name": "harfalm/Sakai-10.1",
"path": "samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/HistogramScoresBean.java",
"license": "apache-2.0",
"size": 21829
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,843,165 |
protected boolean persistStringSet(Set<String> values) {
if (shouldPersist()) {
// Shouldn't store null
if (values.equals(getPersistedStringSet(null))) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putStringSet(mKey, values);
tryCommit(editor);
return true;
}
return false;
} | boolean function(Set<String> values) { if (shouldPersist()) { if (values.equals(getPersistedStringSet(null))) { return true; } SharedPreferences.Editor editor = mPreferenceManager.getEditor(); editor.putStringSet(mKey, values); tryCommit(editor); return true; } return false; } | /**
* Attempts to persist a set of Strings to the {@link android.content.SharedPreferences}.
* <p>
* This will check if this Preference is persistent, get an editor from
* the {@link PreferenceManager}, put in the strings, and check if we should commit (and
* commit if so).
*
* @param values The values to persist.
* @return True if the Preference is persistent. (This is not whether the
* value was persisted, since we may not necessarily commit if there
* will be a batch commit later.)
* @see #getPersistedString(Set)
*
* @hide Pending API approval
*/ | Attempts to persist a set of Strings to the <code>android.content.SharedPreferences</code>. This will check if this Preference is persistent, get an editor from the <code>PreferenceManager</code>, put in the strings, and check if we should commit (and commit if so) | persistStringSet | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/android/preference/Preference.java",
"license": "apache-2.0",
"size": 64205
} | [
"android.content.SharedPreferences",
"java.util.Set"
] | import android.content.SharedPreferences; import java.util.Set; | import android.content.*; import java.util.*; | [
"android.content",
"java.util"
] | android.content; java.util; | 2,484,024 |
public PhotoList getContactsPhotos(int count, boolean justFriends, boolean singlePhoto, boolean includeSelf)
throws IOException, FlickrException, JSONException {
return getContactsPhotos(count, Extras.MIN_EXTRAS, justFriends, singlePhoto, includeSelf, 0, 0);
} | PhotoList function(int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws IOException, FlickrException, JSONException { return getContactsPhotos(count, Extras.MIN_EXTRAS, justFriends, singlePhoto, includeSelf, 0, 0); } | /**
* Get photos from the user's contacts.
*
* This method requires authentication with 'read' permission.
*
* @see com.googlecode.flickrjandroid.photos.Extras
* @param count The number of photos to return
* @param justFriends Set to true to only show friends photos
* @param singlePhoto Set to true to get a single photo
* @param includeSelf Set to true to include self
* @return The Collection of photos
* @throws IOException
* @throws FlickrException
* @throws JSONException
*/ | Get photos from the user's contacts. This method requires authentication with 'read' permission | getContactsPhotos | {
"repo_name": "0570dev/flickr-glass",
"path": "src/com/googlecode/flickrjandroid/photos/PhotosInterface.java",
"license": "apache-2.0",
"size": 57549
} | [
"com.googlecode.flickrjandroid.FlickrException",
"java.io.IOException",
"org.json.JSONException"
] | import com.googlecode.flickrjandroid.FlickrException; import java.io.IOException; import org.json.JSONException; | import com.googlecode.flickrjandroid.*; import java.io.*; import org.json.*; | [
"com.googlecode.flickrjandroid",
"java.io",
"org.json"
] | com.googlecode.flickrjandroid; java.io; org.json; | 1,101,690 |
@Deprecated
public void writeUnknownGroup(final int fieldNumber,
final MessageLite value)
throws IOException {
writeGroup(fieldNumber, value);
} | void function(final int fieldNumber, final MessageLite value) throws IOException { writeGroup(fieldNumber, value); } | /**
* Write a group represented by an {@link UnknownFieldSet}.
*
* @deprecated UnknownFieldSet now implements MessageLite, so you can just
* call {@link #writeGroup}.
*/ | Write a group represented by an <code>UnknownFieldSet</code> | writeUnknownGroup | {
"repo_name": "spotify/ffwd-java",
"path": "protobuf250/src/main/java/com/spotify/ffwd/protobuf250/CodedOutputStream.java",
"license": "apache-2.0",
"size": 38935
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 417,830 |
Chronology getEffectiveChronology() {
Chronology chrono = currentParsed().chrono;
if (chrono == null) {
chrono = overrideChronology;
if (chrono == null) {
chrono = IsoChronology.INSTANCE;
}
}
return chrono;
} | Chronology getEffectiveChronology() { Chronology chrono = currentParsed().chrono; if (chrono == null) { chrono = overrideChronology; if (chrono == null) { chrono = IsoChronology.INSTANCE; } } return chrono; } | /**
* Gets the effective chronology during parsing.
*
* @return the effective parsing chronology, not null
*/ | Gets the effective chronology during parsing | getEffectiveChronology | {
"repo_name": "jnehlmeier/threetenbp",
"path": "src/main/java/org/threeten/bp/format/DateTimeParseContext.java",
"license": "bsd-3-clause",
"size": 17872
} | [
"org.threeten.bp.chrono.Chronology",
"org.threeten.bp.chrono.IsoChronology"
] | import org.threeten.bp.chrono.Chronology; import org.threeten.bp.chrono.IsoChronology; | import org.threeten.bp.chrono.*; | [
"org.threeten.bp"
] | org.threeten.bp; | 1,909,611 |
private void applyRepresentation(boolean isFlat)
{
page = RequirementHelper.INSTANCE.getUpstreamPage();
if (page != null && !page.getViewer().getControl().isDisposed())
{
page.getUpstreamRequirementContentProvider().setIsFlat(isFlat);
if (page.getViewer() instanceof StructuredViewer)
{
((StructuredViewer) page.getViewer()).refresh(false);
}
else
{
page.getViewer().refresh();
}
}
} | void function(boolean isFlat) { page = RequirementHelper.INSTANCE.getUpstreamPage(); if (page != null && !page.getViewer().getControl().isDisposed()) { page.getUpstreamRequirementContentProvider().setIsFlat(isFlat); if (page.getViewer() instanceof StructuredViewer) { ((StructuredViewer) page.getViewer()).refresh(false); } else { page.getViewer().refresh(); } } } | /**
* Applies the right representation of the tree contents
*
* @param isFlat should we use the flat representation or the tree one ?
*/ | Applies the right representation of the tree contents | applyRepresentation | {
"repo_name": "pgaufillet/topcased-req",
"path": "plugins/org.topcased.requirement.core/src/org/topcased/requirement/core/handlers/FlatHandler.java",
"license": "epl-1.0",
"size": 3316
} | [
"org.eclipse.jface.viewers.StructuredViewer",
"org.topcased.requirement.core.utils.RequirementHelper"
] | import org.eclipse.jface.viewers.StructuredViewer; import org.topcased.requirement.core.utils.RequirementHelper; | import org.eclipse.jface.viewers.*; import org.topcased.requirement.core.utils.*; | [
"org.eclipse.jface",
"org.topcased.requirement"
] | org.eclipse.jface; org.topcased.requirement; | 1,317,721 |
public static void reattachStaticPackageSuperTypes(EPackage ePackage) {
if (ePackage.getNsURI().startsWith(IdocPackage.eNS_URI)) {
for (EClassifier eClassifier : ePackage.getEClassifiers()) {
if (eClassifier instanceof EClass) {
EClass eClass = (EClass) eClassifier;
EList<EClass> superTypes = eClass.getESuperTypes();
for (int i = 0; i < superTypes.size(); i++) {
EClass superClass = superTypes.get(i);
switch (superClass.getName()) {
case "Document":
superTypes.set(i, IdocPackage.eINSTANCE.getDocument());
continue;
case "Segment":
superTypes.set(i, IdocPackage.eINSTANCE.getSegment());
continue;
case "SegmentChildren":
superTypes.set(i, IdocPackage.eINSTANCE.getSegmentChildren());
continue;
case "SegmentList":
superTypes.set(i, IdocPackage.eINSTANCE.getSegmentList());
continue;
}
}
}
}
} else if (ePackage.getNsURI().startsWith(RfcPackage.eNS_URI)) {
for (EClassifier eClassifier : ePackage.getEClassifiers()) {
if (eClassifier instanceof EClass) {
EClass eClass = (EClass) eClassifier;
EList<EClass> superTypes = eClass.getESuperTypes();
for (int i = 0; i < superTypes.size(); i++) {
EClass superClass = superTypes.get(i);
switch (superClass.getName()) {
case "AbapException":
superTypes.set(i, RfcPackage.eINSTANCE.getAbapException());
continue;
case "Destination":
superTypes.set(i, RfcPackage.eINSTANCE.getDestination());
continue;
case "DestinationData":
superTypes.set(i, RfcPackage.eINSTANCE.getDestinationData());
continue;
case "DestinationDataEntry":
superTypes.set(i, RfcPackage.eINSTANCE.getDestinationDataEntry());
continue;
case "DestinationDataStore":
superTypes.set(i, RfcPackage.eINSTANCE.getDestinationDataStore());
continue;
case "DestinationDataStoreEntry":
superTypes.set(i, RfcPackage.eINSTANCE.getDestinationDataStoreEntry());
continue;
case "FieldMetaData":
superTypes.set(i, RfcPackage.eINSTANCE.getFieldMetaData());
continue;
case "FunctionTemplate":
superTypes.set(i, RfcPackage.eINSTANCE.getFunctionTemplate());
continue;
case "ListFieldMetaData":
superTypes.set(i, RfcPackage.eINSTANCE.getListFieldMetaData());
continue;
case "RecordMetaData":
superTypes.set(i, RfcPackage.eINSTANCE.getRecordMetaData());
continue;
case "RepositoryData":
superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryData());
continue;
case "RepositoryDataStore":
superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryDataStore());
continue;
case "RepositoryDataEntry":
superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryDataEntry());
continue;
case "RepositoryDataStoreEntry":
superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryDataStoreEntry());
continue;
case "RFC":
superTypes.set(i, RfcPackage.eINSTANCE.getRFC());
continue;
case "Server":
superTypes.set(i, RfcPackage.eINSTANCE.getServer());
continue;
case "ServerData":
superTypes.set(i, RfcPackage.eINSTANCE.getServerData());
continue;
case "ServerDataEntry":
superTypes.set(i, RfcPackage.eINSTANCE.getServerDataEntry());
continue;
case "ServerDataStore":
superTypes.set(i, RfcPackage.eINSTANCE.getServerDataStore());
continue;
case "Request":
superTypes.set(i, RfcPackage.eINSTANCE.getRequest());
continue;
case "Response":
superTypes.set(i, RfcPackage.eINSTANCE.getResponse());
continue;
case "Structure":
superTypes.set(i, RfcPackage.eINSTANCE.getStructure());
continue;
case "Table":
superTypes.set(i, RfcPackage.eINSTANCE.getTable());
continue;
}
}
}
}
}
} | static void function(EPackage ePackage) { if (ePackage.getNsURI().startsWith(IdocPackage.eNS_URI)) { for (EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass) { EClass eClass = (EClass) eClassifier; EList<EClass> superTypes = eClass.getESuperTypes(); for (int i = 0; i < superTypes.size(); i++) { EClass superClass = superTypes.get(i); switch (superClass.getName()) { case STR: superTypes.set(i, IdocPackage.eINSTANCE.getDocument()); continue; case STR: superTypes.set(i, IdocPackage.eINSTANCE.getSegment()); continue; case STR: superTypes.set(i, IdocPackage.eINSTANCE.getSegmentChildren()); continue; case STR: superTypes.set(i, IdocPackage.eINSTANCE.getSegmentList()); continue; } } } } } else if (ePackage.getNsURI().startsWith(RfcPackage.eNS_URI)) { for (EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass) { EClass eClass = (EClass) eClassifier; EList<EClass> superTypes = eClass.getESuperTypes(); for (int i = 0; i < superTypes.size(); i++) { EClass superClass = superTypes.get(i); switch (superClass.getName()) { case STR: superTypes.set(i, RfcPackage.eINSTANCE.getAbapException()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getDestination()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getDestinationData()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getDestinationDataEntry()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getDestinationDataStore()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getDestinationDataStoreEntry()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getFieldMetaData()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getFunctionTemplate()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getListFieldMetaData()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getRecordMetaData()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryData()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryDataStore()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryDataEntry()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getRepositoryDataStoreEntry()); continue; case "RFC": superTypes.set(i, RfcPackage.eINSTANCE.getRFC()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getServer()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getServerData()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getServerDataEntry()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getServerDataStore()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getRequest()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getResponse()); continue; case STR: superTypes.set(i, RfcPackage.eINSTANCE.getStructure()); continue; case "Table": superTypes.set(i, RfcPackage.eINSTANCE.getTable()); continue; } } } } } } | /**
* Re-attaches super types of Dynamic types derived from classes defined in static packaged.
* This operation is necessary when loading a
* package from storage since its EClasses reference the stored instance of
* static base package classes instead of static package in runtime.
*
* @param ePackage
* - package containing classes whose super types will be
* re-attached.
*/ | Re-attaches super types of Dynamic types derived from classes defined in static packaged. This operation is necessary when loading a package from storage since its EClasses reference the stored instance of static base package classes instead of static package in runtime | reattachStaticPackageSuperTypes | {
"repo_name": "DaemonSu/fuse-master",
"path": "components/camel-sap/org.fusesource.camel.component.sap/src/org/fusesource/camel/component/sap/util/Util.java",
"license": "apache-2.0",
"size": 20902
} | [
"org.eclipse.emf.common.util.EList",
"org.eclipse.emf.ecore.EClass",
"org.eclipse.emf.ecore.EClassifier",
"org.eclipse.emf.ecore.EPackage",
"org.fusesource.camel.component.sap.model.idoc.IdocPackage",
"org.fusesource.camel.component.sap.model.rfc.RfcPackage"
] | import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EPackage; import org.fusesource.camel.component.sap.model.idoc.IdocPackage; import org.fusesource.camel.component.sap.model.rfc.RfcPackage; | import org.eclipse.emf.common.util.*; import org.eclipse.emf.ecore.*; import org.fusesource.camel.component.sap.model.idoc.*; import org.fusesource.camel.component.sap.model.rfc.*; | [
"org.eclipse.emf",
"org.fusesource.camel"
] | org.eclipse.emf; org.fusesource.camel; | 2,246,632 |
private static Transform tokenizeTransformation(String transformation)
throws NoSuchAlgorithmException {
if (transformation == null) {
throw new NoSuchAlgorithmException("No transformation given.");
}
String[] parts = new String[3];
int count = 0;
StringTokenizer parser = new StringTokenizer(transformation, "/");
while (parser.hasMoreTokens() && count < 3) {
parts[count++] = parser.nextToken().trim();
}
if (count != 3 || parser.hasMoreTokens()) {
throw new NoSuchAlgorithmException(
"Invalid transformation format: " + transformation);
}
return new Transform(parts[0], parts[1], parts[2]);
}
/**
* Initialize this cipher with a key and IV.
*
* @param mode {@link #ENCRYPT_MODE} or {@link #DECRYPT_MODE} | static Transform function(String transformation) throws NoSuchAlgorithmException { if (transformation == null) { throw new NoSuchAlgorithmException(STR); } String[] parts = new String[3]; int count = 0; StringTokenizer parser = new StringTokenizer(transformation, "/"); while (parser.hasMoreTokens() && count < 3) { parts[count++] = parser.nextToken().trim(); } if (count != 3 parser.hasMoreTokens()) { throw new NoSuchAlgorithmException( STR + transformation); } return new Transform(parts[0], parts[1], parts[2]); } /** * Initialize this cipher with a key and IV. * * @param mode {@link #ENCRYPT_MODE} or {@link #DECRYPT_MODE} | /**
* Gets the tokens of transformation.
*
* @param transformation the transformation.
* @return the {@link Transform} instance.
* @throws NoSuchAlgorithmException if the transformation is null.
*/ | Gets the tokens of transformation | tokenizeTransformation | {
"repo_name": "kexianda/commons-crypto",
"path": "src/main/java/org/apache/commons/crypto/cipher/OpenSsl.java",
"license": "apache-2.0",
"size": 14180
} | [
"java.security.NoSuchAlgorithmException",
"java.util.StringTokenizer"
] | import java.security.NoSuchAlgorithmException; import java.util.StringTokenizer; | import java.security.*; import java.util.*; | [
"java.security",
"java.util"
] | java.security; java.util; | 1,770,074 |
@Test
public void testCompact() {
BytesRef ref = new BytesRef();
int num = atLeast(2);
for (int j = 0; j < num; j++) {
int numEntries = 0;
final int size = 797;
BitSet bits = new BitSet(size);
for (int i = 0; i < size; i++) {
String str;
do {
str = TestUtil.randomRealisticUnicodeString(random(), 1000);
} while (str.length() == 0);
ref.copyChars(str);
final int key = hash.add(ref);
if (key < 0) {
assertTrue(bits.get((-key)-1));
} else {
assertFalse(bits.get(key));
bits.set(key);
numEntries++;
}
}
assertEquals(hash.size(), bits.cardinality());
assertEquals(numEntries, bits.cardinality());
assertEquals(numEntries, hash.size());
int[] compact = hash.compact();
assertTrue(numEntries < compact.length);
for (int i = 0; i < numEntries; i++) {
bits.set(compact[i], false);
}
assertEquals(0, bits.cardinality());
hash.clear();
assertEquals(0, hash.size());
hash.reinit();
}
} | void function() { BytesRef ref = new BytesRef(); int num = atLeast(2); for (int j = 0; j < num; j++) { int numEntries = 0; final int size = 797; BitSet bits = new BitSet(size); for (int i = 0; i < size; i++) { String str; do { str = TestUtil.randomRealisticUnicodeString(random(), 1000); } while (str.length() == 0); ref.copyChars(str); final int key = hash.add(ref); if (key < 0) { assertTrue(bits.get((-key)-1)); } else { assertFalse(bits.get(key)); bits.set(key); numEntries++; } } assertEquals(hash.size(), bits.cardinality()); assertEquals(numEntries, bits.cardinality()); assertEquals(numEntries, hash.size()); int[] compact = hash.compact(); assertTrue(numEntries < compact.length); for (int i = 0; i < numEntries; i++) { bits.set(compact[i], false); } assertEquals(0, bits.cardinality()); hash.clear(); assertEquals(0, hash.size()); hash.reinit(); } } | /**
* Test method for {@link org.apache.lucene.util.BytesRefHash#compact()}.
*/ | Test method for <code>org.apache.lucene.util.BytesRefHash#compact()</code> | testCompact | {
"repo_name": "williamchengit/TestRepo",
"path": "solr-4.9.0/lucene/core/src/test/org/apache/lucene/util/TestBytesRefHash.java",
"license": "apache-2.0",
"size": 11746
} | [
"java.util.BitSet"
] | import java.util.BitSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,880,509 |
@Override public void enterTypeParameter(@NotNull PJParser.TypeParameterContext ctx) { } | @Override public void enterTypeParameter(@NotNull PJParser.TypeParameterContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitPj | {
"repo_name": "Diolor/PJ",
"path": "src/main/java/com/lorentzos/pj/PJBaseListener.java",
"license": "mit",
"size": 73292
} | [
"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; | 782,620 |
if (SDK_INT >= N && !registered) {
IntentFilter intentFilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
context.getApplicationContext().registerReceiver(new TriggerReceiver(), intentFilter);
registered = true;
}
} | if (SDK_INT >= N && !registered) { IntentFilter intentFilter = new IntentFilter(STR); context.getApplicationContext().registerReceiver(new TriggerReceiver(), intentFilter); registered = true; } } | /**
* "Project Svelte" is just there to f**k things up...
*/ | "Project Svelte" is just there to f**k things up.. | register | {
"repo_name": "microg/android_packages_apps_GmsCore",
"path": "play-services-core/src/main/java/org/microg/gms/gcm/TriggerReceiver.java",
"license": "apache-2.0",
"size": 4616
} | [
"android.content.IntentFilter"
] | import android.content.IntentFilter; | import android.content.*; | [
"android.content"
] | android.content; | 95,620 |
public List<ISuite> dispatch(IConfiguration configuration,
List<XmlSuite> suites, String outputDir, List<ITestListener> testListeners){
List<ISuite> result = Lists.newArrayList();
try
{
//
// Dispatch the suites/tests
//
for (XmlSuite suite : suites) {
suite.setVerbose(m_verbose);
SuiteRunner suiteRunner = new SuiteRunner(configuration, suite, outputDir);
RemoteResultListener listener = new RemoteResultListener( suiteRunner);
if (m_isStrategyTest) {
for (XmlTest test : suite.getTests()) {
XmlSuite tmpSuite = new XmlSuite();
tmpSuite.setXmlPackages(suite.getXmlPackages());
tmpSuite.setJUnit(suite.isJUnit());
tmpSuite.setSkipFailedInvocationCounts(suite.skipFailedInvocationCounts());
tmpSuite.setName("Temporary suite for " + test.getName());
tmpSuite.setParallel(suite.getParallel());
tmpSuite.setParentModule(suite.getParentModule());
tmpSuite.setGuiceStage(suite.getGuiceStage());
tmpSuite.setParameters(suite.getParameters());
tmpSuite.setThreadCount(suite.getThreadCount());
tmpSuite.setDataProviderThreadCount(suite.getDataProviderThreadCount());
tmpSuite.setVerbose(suite.getVerbose());
tmpSuite.setObjectFactory(suite.getObjectFactory());
XmlTest tmpTest = new XmlTest(tmpSuite);
tmpTest.setBeanShellExpression(test.getExpression());
tmpTest.setXmlClasses(test.getXmlClasses());
tmpTest.setExcludedGroups(test.getExcludedGroups());
tmpTest.setIncludedGroups(test.getIncludedGroups());
tmpTest.setJUnit(test.isJUnit());
tmpTest.setMethodSelectors(test.getMethodSelectors());
tmpTest.setName(test.getName());
tmpTest.setParallel(test.getParallel());
tmpTest.setParameters(test.getLocalParameters());
tmpTest.setVerbose(test.getVerbose());
tmpTest.setXmlClasses(test.getXmlClasses());
tmpTest.setXmlPackages(test.getXmlPackages());
m_masterAdpter.runSuitesRemotely(tmpSuite, listener);
}
}
else
{
m_masterAdpter.runSuitesRemotely(suite, listener);
}
result.add(suiteRunner);
}
m_masterAdpter.awaitTermination(100000);
//
// Run test listeners
//
for (ISuite suite : result) {
for (ISuiteResult suiteResult : suite.getResults().values()) {
Collection<ITestResult> allTests[] = new Collection[] {
suiteResult.getTestContext().getPassedTests().getAllResults(),
suiteResult.getTestContext().getFailedTests().getAllResults(),
suiteResult.getTestContext().getSkippedTests().getAllResults(),
suiteResult.getTestContext().getFailedButWithinSuccessPercentageTests().getAllResults(),
};
for (Collection<ITestResult> all : allTests) {
for (ITestResult tr : all) {
Invoker.runTestListeners(tr, testListeners);
}
}
}
}
}
catch( Exception ex)
{
//TODO add to logs
ex.printStackTrace();
}
return result;
}
| List<ISuite> function(IConfiguration configuration, List<XmlSuite> suites, String outputDir, List<ITestListener> testListeners){ List<ISuite> result = Lists.newArrayList(); try { for (XmlSuite suite : suites) { suite.setVerbose(m_verbose); SuiteRunner suiteRunner = new SuiteRunner(configuration, suite, outputDir); RemoteResultListener listener = new RemoteResultListener( suiteRunner); if (m_isStrategyTest) { for (XmlTest test : suite.getTests()) { XmlSuite tmpSuite = new XmlSuite(); tmpSuite.setXmlPackages(suite.getXmlPackages()); tmpSuite.setJUnit(suite.isJUnit()); tmpSuite.setSkipFailedInvocationCounts(suite.skipFailedInvocationCounts()); tmpSuite.setName(STR + test.getName()); tmpSuite.setParallel(suite.getParallel()); tmpSuite.setParentModule(suite.getParentModule()); tmpSuite.setGuiceStage(suite.getGuiceStage()); tmpSuite.setParameters(suite.getParameters()); tmpSuite.setThreadCount(suite.getThreadCount()); tmpSuite.setDataProviderThreadCount(suite.getDataProviderThreadCount()); tmpSuite.setVerbose(suite.getVerbose()); tmpSuite.setObjectFactory(suite.getObjectFactory()); XmlTest tmpTest = new XmlTest(tmpSuite); tmpTest.setBeanShellExpression(test.getExpression()); tmpTest.setXmlClasses(test.getXmlClasses()); tmpTest.setExcludedGroups(test.getExcludedGroups()); tmpTest.setIncludedGroups(test.getIncludedGroups()); tmpTest.setJUnit(test.isJUnit()); tmpTest.setMethodSelectors(test.getMethodSelectors()); tmpTest.setName(test.getName()); tmpTest.setParallel(test.getParallel()); tmpTest.setParameters(test.getLocalParameters()); tmpTest.setVerbose(test.getVerbose()); tmpTest.setXmlClasses(test.getXmlClasses()); tmpTest.setXmlPackages(test.getXmlPackages()); m_masterAdpter.runSuitesRemotely(tmpSuite, listener); } } else { m_masterAdpter.runSuitesRemotely(suite, listener); } result.add(suiteRunner); } m_masterAdpter.awaitTermination(100000); for (ISuite suite : result) { for (ISuiteResult suiteResult : suite.getResults().values()) { Collection<ITestResult> allTests[] = new Collection[] { suiteResult.getTestContext().getPassedTests().getAllResults(), suiteResult.getTestContext().getFailedTests().getAllResults(), suiteResult.getTestContext().getSkippedTests().getAllResults(), suiteResult.getTestContext().getFailedButWithinSuccessPercentageTests().getAllResults(), }; for (Collection<ITestResult> all : allTests) { for (ITestResult tr : all) { Invoker.runTestListeners(tr, testListeners); } } } } } catch( Exception ex) { ex.printStackTrace(); } return result; } | /**
* Dispatch test suites
* @return suites result
*/ | Dispatch test suites | dispatch | {
"repo_name": "s2oBCN/testng",
"path": "src/main/java/org/testng/remote/SuiteDispatcher.java",
"license": "apache-2.0",
"size": 5418
} | [
"java.util.Collection",
"java.util.List",
"org.testng.ISuite",
"org.testng.ISuiteResult",
"org.testng.ITestListener",
"org.testng.ITestResult",
"org.testng.SuiteRunner",
"org.testng.collections.Lists",
"org.testng.internal.IConfiguration",
"org.testng.internal.Invoker",
"org.testng.remote.adapte... | import java.util.Collection; import java.util.List; import org.testng.ISuite; import org.testng.ISuiteResult; import org.testng.ITestListener; import org.testng.ITestResult; import org.testng.SuiteRunner; import org.testng.collections.Lists; import org.testng.internal.IConfiguration; import org.testng.internal.Invoker; import org.testng.remote.adapter.RemoteResultListener; import org.testng.xml.XmlSuite; import org.testng.xml.XmlTest; | import java.util.*; import org.testng.*; import org.testng.collections.*; import org.testng.internal.*; import org.testng.remote.adapter.*; import org.testng.xml.*; | [
"java.util",
"org.testng",
"org.testng.collections",
"org.testng.internal",
"org.testng.remote",
"org.testng.xml"
] | java.util; org.testng; org.testng.collections; org.testng.internal; org.testng.remote; org.testng.xml; | 378,753 |
private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(s);
} catch (IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
this.mode = 'k';
}
this.comma = true;
return this;
}
throw new JSONException("Value out of sequence.");
} | JSONWriter function(String s) throws JSONException { if (s == null) { throw new JSONException(STR); } if (this.mode == 'o' this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); } this.writer.write(s); } catch (IOException e) { throw new JSONException(e); } if (this.mode == 'o') { this.mode = 'k'; } this.comma = true; return this; } throw new JSONException(STR); } | /**
* Append a value.
*
* @param s A string value.
* @return this.
* @throws JSONException If the value is out of sequence.
*/ | Append a value | append | {
"repo_name": "NetEase-Cloudsearch/streamproxy-sdk-java",
"path": "streamproxy-sdk-java/src/main/java/com/netease/cloud/util/json/JSONWriter.java",
"license": "apache-2.0",
"size": 9523
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,040,549 |
private static String validateOrderItemShipGroupAssoc(Delegator delegator, LocalDispatcher dispatcher, GenericValue orderItem, BigDecimal totalQuantity, GenericValue lastOISGAssoc, GenericValue userLogin, Locale locale)
throws GeneralException {
String result = null;
BigDecimal qty = (BigDecimal) orderItem.get("quantity");
if (UtilValidate.isEmpty(qty)) {
qty = BigDecimal.ZERO;
}
BigDecimal cancelQty = (BigDecimal) orderItem.get("cancelQuantity");
if (UtilValidate.isEmpty(cancelQty)) {
cancelQty = BigDecimal.ZERO;
}
BigDecimal orderItemQuantity = qty.subtract(cancelQty);
if (totalQuantity.compareTo(orderItemQuantity) < 0) {
//if quantity in orderItem is bigger than in totalQUantity then added missing quantity in ShipGroupAssoc
BigDecimal adjustementQuantity = orderItemQuantity.subtract( totalQuantity);
BigDecimal lastOISGAssocQuantity = (BigDecimal) lastOISGAssoc.get("quantity");
if (UtilValidate.isEmpty(lastOISGAssocQuantity)) {
lastOISGAssocQuantity = BigDecimal.ZERO;
}
BigDecimal oisgaQty = lastOISGAssocQuantity.add(adjustementQuantity);
lastOISGAssoc.set("quantity", oisgaQty);
lastOISGAssoc.store();
// reserve the inventory
GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", lastOISGAssoc.get("orderId")).queryOne();
if (UtilValidate.isNotEmpty(orderHeader)) {
Map<String, Object> cancelOrderInventoryReservationMap = UtilMisc.toMap("userLogin", userLogin, "locale", locale);
cancelOrderInventoryReservationMap.put("orderId", lastOISGAssoc.get("orderId"));
cancelOrderInventoryReservationMap.put("orderItemSeqId", lastOISGAssoc.get("orderItemSeqId"));
cancelOrderInventoryReservationMap.put("shipGroupSeqId", lastOISGAssoc.get("shipGroupSeqId"));
Map<String, Object> cancelResp = dispatcher.runSync("cancelOrderInventoryReservation", cancelOrderInventoryReservationMap);
if (ServiceUtil.isError(cancelResp)) {
throw new GeneralException(ServiceUtil.getErrorMessage(cancelResp));
}
String productStoreId = orderHeader.getString("productStoreId");
String orderTypeId = orderHeader.getString("orderTypeId");
List<String> resErrorMessages = new LinkedList<String>();
if (Debug.infoOn()) Debug.logInfo("Calling reserve inventory...", module);
reserveInventory(delegator, dispatcher, userLogin, locale, UtilMisc.toList(lastOISGAssoc), null, UtilMisc.<String, GenericValue>toMap(lastOISGAssoc.getString("orderItemSeqId"), orderItem), orderTypeId, productStoreId, resErrorMessages);
}
//return warning message
Map<String, Object> messageParameters = new HashMap<String, Object>();
messageParameters.put("shipByDate", lastOISGAssoc.getRelatedOne("OrderItemShipGroup", false).getString("shipByDate"));
messageParameters.put("adjustementQuantity", adjustementQuantity);
return "Order OISG Assoc Quantity Auto Completed";
}
return result;
} | static String function(Delegator delegator, LocalDispatcher dispatcher, GenericValue orderItem, BigDecimal totalQuantity, GenericValue lastOISGAssoc, GenericValue userLogin, Locale locale) throws GeneralException { String result = null; BigDecimal qty = (BigDecimal) orderItem.get(STR); if (UtilValidate.isEmpty(qty)) { qty = BigDecimal.ZERO; } BigDecimal cancelQty = (BigDecimal) orderItem.get(STR); if (UtilValidate.isEmpty(cancelQty)) { cancelQty = BigDecimal.ZERO; } BigDecimal orderItemQuantity = qty.subtract(cancelQty); if (totalQuantity.compareTo(orderItemQuantity) < 0) { BigDecimal adjustementQuantity = orderItemQuantity.subtract( totalQuantity); BigDecimal lastOISGAssocQuantity = (BigDecimal) lastOISGAssoc.get(STR); if (UtilValidate.isEmpty(lastOISGAssocQuantity)) { lastOISGAssocQuantity = BigDecimal.ZERO; } BigDecimal oisgaQty = lastOISGAssocQuantity.add(adjustementQuantity); lastOISGAssoc.set(STR, oisgaQty); lastOISGAssoc.store(); GenericValue orderHeader = EntityQuery.use(delegator).from(STR).where(STR, lastOISGAssoc.get(STR)).queryOne(); if (UtilValidate.isNotEmpty(orderHeader)) { Map<String, Object> cancelOrderInventoryReservationMap = UtilMisc.toMap(STR, userLogin, STR, locale); cancelOrderInventoryReservationMap.put(STR, lastOISGAssoc.get(STR)); cancelOrderInventoryReservationMap.put(STR, lastOISGAssoc.get(STR)); cancelOrderInventoryReservationMap.put(STR, lastOISGAssoc.get(STR)); Map<String, Object> cancelResp = dispatcher.runSync(STR, cancelOrderInventoryReservationMap); if (ServiceUtil.isError(cancelResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(cancelResp)); } String productStoreId = orderHeader.getString(STR); String orderTypeId = orderHeader.getString(STR); List<String> resErrorMessages = new LinkedList<String>(); if (Debug.infoOn()) Debug.logInfo(STR, module); reserveInventory(delegator, dispatcher, userLogin, locale, UtilMisc.toList(lastOISGAssoc), null, UtilMisc.<String, GenericValue>toMap(lastOISGAssoc.getString(STR), orderItem), orderTypeId, productStoreId, resErrorMessages); } Map<String, Object> messageParameters = new HashMap<String, Object>(); messageParameters.put(STR, lastOISGAssoc.getRelatedOne(STR, false).getString(STR)); messageParameters.put(STR, adjustementQuantity); return STR; } return result; } | /**
* Validate OrderItemShipGroupAssoc quantity
* This service should be called after updateOrderItemShipGroupAssoc
* test if orderItem quantity equals OrderItemShipGroupAssocs quantities
* if not then get the last orderItemShipgroupAssoc estimated shipDate and add quantity to this OrderItemShipGroupAssoc
* @param ctx
* @param context
* @return
* @throws GeneralException
*/ | Validate OrderItemShipGroupAssoc quantity This service should be called after updateOrderItemShipGroupAssoc test if orderItem quantity equals OrderItemShipGroupAssocs quantities if not then get the last orderItemShipgroupAssoc estimated shipDate and add quantity to this OrderItemShipGroupAssoc | validateOrderItemShipGroupAssoc | {
"repo_name": "gehaisong/ofbiz-16.11.02",
"path": "applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java",
"license": "apache-2.0",
"size": 365145
} | [
"java.math.BigDecimal",
"java.util.HashMap",
"java.util.LinkedList",
"java.util.List",
"java.util.Locale",
"java.util.Map",
"org.apache.ofbiz.base.util.Debug",
"org.apache.ofbiz.base.util.GeneralException",
"org.apache.ofbiz.base.util.UtilMisc",
"org.apache.ofbiz.base.util.UtilValidate",
"org.ap... | import java.math.BigDecimal; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ServiceUtil; | import java.math.*; import java.util.*; import org.apache.ofbiz.base.util.*; import org.apache.ofbiz.entity.*; import org.apache.ofbiz.entity.util.*; import org.apache.ofbiz.service.*; | [
"java.math",
"java.util",
"org.apache.ofbiz"
] | java.math; java.util; org.apache.ofbiz; | 2,867,519 |
public static EmbeddableHierarchy createEmbeddableHierarchy(Class<?> embeddableClass, String propertyName, AccessType accessType, AnnotationBindingContext context) {
ClassInfo embeddableClassInfo = context.getClassInfo( embeddableClass.getName() );
if ( embeddableClassInfo == null ) {
throw new AssertionFailure(
String.format(
"The specified class %s cannot be found in the annotation index",
embeddableClass.getName()
)
);
}
if ( JandexHelper.getSingleAnnotation( embeddableClassInfo, JPADotNames.EMBEDDABLE ) == null ) {
throw new AssertionFailure(
String.format(
"The specified class %s is not annotated with @Embeddable even though it is as embeddable",
embeddableClass.getName()
)
);
}
List<ClassInfo> classInfoList = new ArrayList<ClassInfo>();
ClassInfo tmpClassInfo;
Class<?> clazz = embeddableClass;
while ( clazz != null && !clazz.equals( Object.class ) ) {
tmpClassInfo = context.getIndex().getClassByName( DotName.createSimple( clazz.getName() ) );
clazz = clazz.getSuperclass();
if ( tmpClassInfo == null ) {
continue;
}
classInfoList.add( 0, tmpClassInfo );
}
return new EmbeddableHierarchy(
classInfoList,
propertyName,
context,
accessType
);
}
@SuppressWarnings("unchecked")
private EmbeddableHierarchy(
List<ClassInfo> classInfoList,
String propertyName,
AnnotationBindingContext context,
AccessType defaultAccessType) {
this.defaultAccessType = defaultAccessType;
// the resolved type for the top level class in the hierarchy
context.resolveAllTypes( classInfoList.get( classInfoList.size() - 1 ).name().toString() );
embeddables = new ArrayList<EmbeddableClass>();
ConfiguredClass parent = null;
EmbeddableClass embeddable;
for ( ClassInfo info : classInfoList ) {
embeddable = new EmbeddableClass(
info, propertyName, parent, defaultAccessType, context
);
embeddables.add( embeddable );
parent = embeddable;
}
} | static EmbeddableHierarchy function(Class<?> embeddableClass, String propertyName, AccessType accessType, AnnotationBindingContext context) { ClassInfo embeddableClassInfo = context.getClassInfo( embeddableClass.getName() ); if ( embeddableClassInfo == null ) { throw new AssertionFailure( String.format( STR, embeddableClass.getName() ) ); } if ( JandexHelper.getSingleAnnotation( embeddableClassInfo, JPADotNames.EMBEDDABLE ) == null ) { throw new AssertionFailure( String.format( STR, embeddableClass.getName() ) ); } List<ClassInfo> classInfoList = new ArrayList<ClassInfo>(); ClassInfo tmpClassInfo; Class<?> clazz = embeddableClass; while ( clazz != null && !clazz.equals( Object.class ) ) { tmpClassInfo = context.getIndex().getClassByName( DotName.createSimple( clazz.getName() ) ); clazz = clazz.getSuperclass(); if ( tmpClassInfo == null ) { continue; } classInfoList.add( 0, tmpClassInfo ); } return new EmbeddableHierarchy( classInfoList, propertyName, context, accessType ); } @SuppressWarnings(STR) private EmbeddableHierarchy( List<ClassInfo> classInfoList, String propertyName, AnnotationBindingContext context, AccessType defaultAccessType) { this.defaultAccessType = defaultAccessType; context.resolveAllTypes( classInfoList.get( classInfoList.size() - 1 ).name().toString() ); embeddables = new ArrayList<EmbeddableClass>(); ConfiguredClass parent = null; EmbeddableClass embeddable; for ( ClassInfo info : classInfoList ) { embeddable = new EmbeddableClass( info, propertyName, parent, defaultAccessType, context ); embeddables.add( embeddable ); parent = embeddable; } } | /**
* Builds the configured class hierarchy for a an embeddable class.
*
* @param embeddableClass the top level embedded class
* @param propertyName the name of the property in the entity class embedding this embeddable
* @param accessType the access type inherited from the class in which the embeddable gets embedded
* @param context the annotation binding context with access to the service registry and the annotation index
*
* @return a set of {@code ConfiguredClassHierarchy}s. One for each "leaf" entity.
*/ | Builds the configured class hierarchy for a an embeddable class | createEmbeddableHierarchy | {
"repo_name": "HerrB92/obp",
"path": "OpenBeaconPackage/libraries/hibernate-release-4.2.7.SP1/project/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/entity/EmbeddableHierarchy.java",
"license": "mit",
"size": 5102
} | [
"java.util.ArrayList",
"java.util.List",
"javax.persistence.AccessType",
"org.hibernate.AssertionFailure",
"org.hibernate.metamodel.source.annotations.AnnotationBindingContext",
"org.hibernate.metamodel.source.annotations.JPADotNames",
"org.hibernate.metamodel.source.annotations.JandexHelper",
"org.jb... | import java.util.ArrayList; import java.util.List; import javax.persistence.AccessType; import org.hibernate.AssertionFailure; import org.hibernate.metamodel.source.annotations.AnnotationBindingContext; import org.hibernate.metamodel.source.annotations.JPADotNames; import org.hibernate.metamodel.source.annotations.JandexHelper; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; | import java.util.*; import javax.persistence.*; import org.hibernate.*; import org.hibernate.metamodel.source.annotations.*; import org.jboss.jandex.*; | [
"java.util",
"javax.persistence",
"org.hibernate",
"org.hibernate.metamodel",
"org.jboss.jandex"
] | java.util; javax.persistence; org.hibernate; org.hibernate.metamodel; org.jboss.jandex; | 1,086,487 |
EClass getGradientColorDefinition(); | EClass getGradientColorDefinition(); | /**
* Returns the meta object for class '{@link fr.obeo.dsl.sPrototyper.GradientColorDefinition <em>Gradient Color Definition</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Gradient Color Definition</em>'.
* @see fr.obeo.dsl.sPrototyper.GradientColorDefinition
* @generated
*/ | Returns the meta object for class '<code>fr.obeo.dsl.sPrototyper.GradientColorDefinition Gradient Color Definition</code>'. | getGradientColorDefinition | {
"repo_name": "glefur/s-prototyper",
"path": "plugins/fr.obeo.dsl.sprototyper/src-gen/fr/obeo/dsl/sPrototyper/SPrototyperPackage.java",
"license": "apache-2.0",
"size": 98928
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,402,571 |
private GamePanel createInventory(ActionListener listener) {
GamePanel result = new GamePanel(true);
result.setLayout(new BorderLayout());
result.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE);
GamePanel backPackPanel = new GamePanel(true);
backPackPanel.setLayout(new BorderLayout());
backPackPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE);
GamePanel northPanel = new GamePanel(true);
northPanel.setLayout(new BorderLayout());
northPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE);
GameLabel label = new GameLabel("Carry weight:");
northPanel.add(label,BorderLayout.NORTH);
carryLabel = new GameLabel("Carrying: 0/15 kg");
northPanel.add(carryLabel,BorderLayout.CENTER);
moneyLabel = new GameLabel("Copper pieces: 0");
northPanel.add(moneyLabel,BorderLayout.SOUTH);
backPackPanel.add(northPanel,BorderLayout.NORTH);
GamePanel useEquipPanel = new GamePanel(true);
useEquipPanel.setLayout(new BorderLayout());
useEquipPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE);
GameButton useBtn = new GameButton("Use/Equip",
ActionCommands.SHEET_USE_EQUIP);
useBtn.addActionListener(listener);
useEquipPanel.add(useBtn,BorderLayout.EAST);
GameButton dropBtn = new GameButton("Drop",
ActionCommands.SHEET_DROP);
dropBtn.addActionListener(listener);
useEquipPanel.add(dropBtn,BorderLayout.WEST);
backPackPanel.add(useEquipPanel,BorderLayout.SOUTH);
itemList = new ItemList();
Item[] myItemList = new Item[3];
myItemList[0] = ItemFactory.Create(3);
myItemList[1] = ItemFactory.Create(7);
myItemList[2] = ItemFactory.Create(12);
itemList.setListData(myItemList);
itemList.setActionCommand(ActionCommands.SHEET_USE_EQUIP);
itemList.addActionListener(listener);
JScrollPane scroll = new JScrollPane(itemList);
backPackPanel.add(scroll,BorderLayout.CENTER);
result.add(backPackPanel,BorderLayout.WEST);
GamePanel equipsPanel = new GamePanel(true);
equipsPanel.setLayout(new GridLayout(0,1));
equipsPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_INVISIBLE);
firstHandBtn = new ItemButton(myItemList[0],"Main hand", ActionCommands.SHEET_FIRSTHAND);
firstHandBtn.addActionListener(listener);
equipsPanel.add(firstHandBtn);
secondHandBtn = new ItemButton(null,"Off hand", ActionCommands.SHEET_SECONDHAND);
secondHandBtn.addActionListener(listener);
equipsPanel.add(secondHandBtn);
armorBtn = new ItemButton(null,"Armor", ActionCommands.SHEET_ARMOR);
armorBtn.addActionListener(listener);
equipsPanel.add(armorBtn);
headGearBtn = new ItemButton(null,"Head", ActionCommands.SHEET_HEADGEAR);
headGearBtn.addActionListener(listener);
equipsPanel.add(headGearBtn);
amuletBtn = new ItemButton(null,"Amulet", ActionCommands.SHEET_AMULET);
amuletBtn.addActionListener(listener);
equipsPanel.add(amuletBtn);
ringBtn = new ItemButton(null,"Ring", ActionCommands.SHEET_RING);
ringBtn.addActionListener(listener);
equipsPanel.add(ringBtn);
bootsBtn = new ItemButton(null,"Boots", ActionCommands.SHEET_BOOTS);
bootsBtn.addActionListener(listener);
equipsPanel.add(bootsBtn);
result.add(equipsPanel,BorderLayout.CENTER);
GamePanel infoPanel = new GamePanel(true);
infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS));
infoPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE);
label = new GameLabel("Main attack:");
infoPanel.add(label);
mainAttackText = new GameTextArea(currentChar.getFirstAttack().getAttackAsString());
mainAttackText.setEditable(false);
infoPanel.add(mainAttackText);
label = new GameLabel("Secondary attack:");
infoPanel.add(label);
secondAttackText = new GameTextArea("No attack");
secondAttackText.setEditable(false);
infoPanel.add(secondAttackText);
label = new GameLabel("Defense:");
infoPanel.add(label);
defenseText = new GameTextArea(currentChar.getDefense().getDefenseAsString());
defenseText.setEditable(false);
infoPanel.add(defenseText);
label = new GameLabel("Item info:");
infoPanel.add(label);
itemHelpText = new GameTextArea("");
itemHelpText.setEditable(false);
infoPanel.add(itemHelpText);
result.add(infoPanel,BorderLayout.EAST);
return result;
} | GamePanel function(ActionListener listener) { GamePanel result = new GamePanel(true); result.setLayout(new BorderLayout()); result.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE); GamePanel backPackPanel = new GamePanel(true); backPackPanel.setLayout(new BorderLayout()); backPackPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE); GamePanel northPanel = new GamePanel(true); northPanel.setLayout(new BorderLayout()); northPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE); GameLabel label = new GameLabel(STR); northPanel.add(label,BorderLayout.NORTH); carryLabel = new GameLabel(STR); northPanel.add(carryLabel,BorderLayout.CENTER); moneyLabel = new GameLabel(STR); northPanel.add(moneyLabel,BorderLayout.SOUTH); backPackPanel.add(northPanel,BorderLayout.NORTH); GamePanel useEquipPanel = new GamePanel(true); useEquipPanel.setLayout(new BorderLayout()); useEquipPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE); GameButton useBtn = new GameButton(STR, ActionCommands.SHEET_USE_EQUIP); useBtn.addActionListener(listener); useEquipPanel.add(useBtn,BorderLayout.EAST); GameButton dropBtn = new GameButton("Drop", ActionCommands.SHEET_DROP); dropBtn.addActionListener(listener); useEquipPanel.add(dropBtn,BorderLayout.WEST); backPackPanel.add(useEquipPanel,BorderLayout.SOUTH); itemList = new ItemList(); Item[] myItemList = new Item[3]; myItemList[0] = ItemFactory.Create(3); myItemList[1] = ItemFactory.Create(7); myItemList[2] = ItemFactory.Create(12); itemList.setListData(myItemList); itemList.setActionCommand(ActionCommands.SHEET_USE_EQUIP); itemList.addActionListener(listener); JScrollPane scroll = new JScrollPane(itemList); backPackPanel.add(scroll,BorderLayout.CENTER); result.add(backPackPanel,BorderLayout.WEST); GamePanel equipsPanel = new GamePanel(true); equipsPanel.setLayout(new GridLayout(0,1)); equipsPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_INVISIBLE); firstHandBtn = new ItemButton(myItemList[0],STR, ActionCommands.SHEET_FIRSTHAND); firstHandBtn.addActionListener(listener); equipsPanel.add(firstHandBtn); secondHandBtn = new ItemButton(null,STR, ActionCommands.SHEET_SECONDHAND); secondHandBtn.addActionListener(listener); equipsPanel.add(secondHandBtn); armorBtn = new ItemButton(null,"Armor", ActionCommands.SHEET_ARMOR); armorBtn.addActionListener(listener); equipsPanel.add(armorBtn); headGearBtn = new ItemButton(null,"Head", ActionCommands.SHEET_HEADGEAR); headGearBtn.addActionListener(listener); equipsPanel.add(headGearBtn); amuletBtn = new ItemButton(null,STR, ActionCommands.SHEET_AMULET); amuletBtn.addActionListener(listener); equipsPanel.add(amuletBtn); ringBtn = new ItemButton(null,"Ring", ActionCommands.SHEET_RING); ringBtn.addActionListener(listener); equipsPanel.add(ringBtn); bootsBtn = new ItemButton(null,"Boots", ActionCommands.SHEET_BOOTS); bootsBtn.addActionListener(listener); equipsPanel.add(bootsBtn); result.add(equipsPanel,BorderLayout.CENTER); GamePanel infoPanel = new GamePanel(true); infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS)); infoPanel.setGradientColor(GuiStatics.GRADIENT_COLOR_BLUE); label = new GameLabel(STR); infoPanel.add(label); mainAttackText = new GameTextArea(currentChar.getFirstAttack().getAttackAsString()); mainAttackText.setEditable(false); infoPanel.add(mainAttackText); label = new GameLabel(STR); infoPanel.add(label); secondAttackText = new GameTextArea(STR); secondAttackText.setEditable(false); infoPanel.add(secondAttackText); label = new GameLabel(STR); infoPanel.add(label); defenseText = new GameTextArea(currentChar.getDefense().getDefenseAsString()); defenseText.setEditable(false); infoPanel.add(defenseText); label = new GameLabel(STR); infoPanel.add(label); itemHelpText = new GameTextArea(""); itemHelpText.setEditable(false); infoPanel.add(itemHelpText); result.add(infoPanel,BorderLayout.EAST); return result; } | /**
* Create Inventory panel
* @param listener ActionListener
* @return GamePanel
*/ | Create Inventory panel | createInventory | {
"repo_name": "tuomount/JHeroes",
"path": "src/org/jheroes/game/GameCharacterSheet.java",
"license": "gpl-2.0",
"size": 41516
} | [
"java.awt.BorderLayout",
"java.awt.GridLayout",
"java.awt.event.ActionListener",
"javax.swing.BoxLayout",
"javax.swing.JScrollPane",
"org.jheroes.gui.ActionCommands",
"org.jheroes.gui.GuiStatics",
"org.jheroes.gui.buttons.GameButton",
"org.jheroes.gui.buttons.ItemButton",
"org.jheroes.gui.labels.G... | import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JScrollPane; import org.jheroes.gui.ActionCommands; import org.jheroes.gui.GuiStatics; import org.jheroes.gui.buttons.GameButton; import org.jheroes.gui.buttons.ItemButton; import org.jheroes.gui.labels.GameLabel; import org.jheroes.gui.labels.GameTextArea; import org.jheroes.gui.lists.ItemList; import org.jheroes.gui.panels.GamePanel; import org.jheroes.map.item.Item; import org.jheroes.map.item.ItemFactory; | import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.jheroes.gui.*; import org.jheroes.gui.buttons.*; import org.jheroes.gui.labels.*; import org.jheroes.gui.lists.*; import org.jheroes.gui.panels.*; import org.jheroes.map.item.*; | [
"java.awt",
"javax.swing",
"org.jheroes.gui",
"org.jheroes.map"
] | java.awt; javax.swing; org.jheroes.gui; org.jheroes.map; | 1,785,131 |
@Override
protected synchronized void startInternal() throws LifecycleException {
super.startInternal();
if (store == null)
log.error("No Store configured, persistence disabled");
else if (store instanceof Lifecycle)
((Lifecycle)store).start();
setState(LifecycleState.STARTING);
} | synchronized void function() throws LifecycleException { super.startInternal(); if (store == null) log.error(STR); else if (store instanceof Lifecycle) ((Lifecycle)store).start(); setState(LifecycleState.STARTING); } | /**
* Start this component and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/ | Start this component and implement the requirements of <code>org.apache.catalina.util.LifecycleBase#startInternal()</code> | startInternal | {
"repo_name": "SourceStudyNotes/Tomcat8",
"path": "src/main/java/org/apache/catalina/session/PersistentManagerBase.java",
"license": "apache-2.0",
"size": 33366
} | [
"org.apache.catalina.Lifecycle",
"org.apache.catalina.LifecycleException",
"org.apache.catalina.LifecycleState"
] | import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; | import org.apache.catalina.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 1,506,069 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } | /**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Handles the HTTP <code>POST</code> method | doPost | {
"repo_name": "stoiandan/msg-code",
"path": "Adelina/Project3/DVDLibrary/src/main/java/com/msgsystems/dvdlibrary/SerDVDItem.java",
"license": "mit",
"size": 2945
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 113,929 |
double getCapacityRatio(StorageType storageType) {
// If capacity ratio is set, return the val.
if (capacityRatioMap.containsKey(storageType)) {
return capacityRatioMap.get(storageType);
}
// If capacity ratio is set for counterpart,
// use the rest of capacity of the mount for it.
if (!capacityRatioMap.isEmpty()) {
double leftOver = 1;
for (Map.Entry<StorageType, Double> e : capacityRatioMap.entrySet()) {
leftOver -= e.getValue();
}
return leftOver;
}
// Use reservedForArchiveDefault by default.
if (storageTypeVolumeMap.containsKey(storageType)
&& storageTypeVolumeMap.size() > 1) {
if (storageType == StorageType.ARCHIVE) {
return reservedForArchiveDefault;
} else if (storageType == StorageType.DISK) {
return 1 - reservedForArchiveDefault;
}
}
return 1;
} | double getCapacityRatio(StorageType storageType) { if (capacityRatioMap.containsKey(storageType)) { return capacityRatioMap.get(storageType); } if (!capacityRatioMap.isEmpty()) { double leftOver = 1; for (Map.Entry<StorageType, Double> e : capacityRatioMap.entrySet()) { leftOver -= e.getValue(); } return leftOver; } if (storageTypeVolumeMap.containsKey(storageType) && storageTypeVolumeMap.size() > 1) { if (storageType == StorageType.ARCHIVE) { return reservedForArchiveDefault; } else if (storageType == StorageType.DISK) { return 1 - reservedForArchiveDefault; } } return 1; } | /**
* Return configured capacity ratio.
*/ | Return configured capacity ratio | getCapacityRatio | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/MountVolumeInfo.java",
"license": "apache-2.0",
"size": 4935
} | [
"java.util.Map",
"org.apache.hadoop.fs.StorageType"
] | import java.util.Map; import org.apache.hadoop.fs.StorageType; | import java.util.*; import org.apache.hadoop.fs.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,164,360 |
@Override
public String getText(Object object) {
String label = ((InitialNode) object).getComment();
return label == null || label.length() == 0 ? getString("_UI_InitialNode_type") : //$NON-NLS-1$
getString("_UI_InitialNode_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
} | String function(Object object) { String label = ((InitialNode) object).getComment(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "aljoschability/eclipse-stodito",
"path": "bundles/com.aljoschability.eclipse.stodito.edit/src-gen/com/aljoschability/eclipse/stodito/providers/InitialNodeItemProvider.java",
"license": "epl-1.0",
"size": 3370
} | [
"com.aljoschability.eclipse.stodito.InitialNode"
] | import com.aljoschability.eclipse.stodito.InitialNode; | import com.aljoschability.eclipse.stodito.*; | [
"com.aljoschability.eclipse"
] | com.aljoschability.eclipse; | 405,071 |
void recycleViewInternal(View view) {
recycleViewHolderInternal(getChildViewHolderInt(view));
} | void recycleViewInternal(View view) { recycleViewHolderInternal(getChildViewHolderInt(view)); } | /**
* Internally, use this method instead of {@link #recycleView(android.view.View)} to
* catch potential bugs.
* @param view
*/ | Internally, use this method instead of <code>#recycleView(android.view.View)</code> to catch potential bugs | recycleViewInternal | {
"repo_name": "maoProgrammer/Telema",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/support/widget/RecyclerView.java",
"license": "gpl-2.0",
"size": 438207
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,238,159 |
@Override
public void setShadowGenerator(ShadowGenerator generator) {
setNotify(false);
super.setShadowGenerator(generator);
Iterator iterator = this.subplots.iterator();
while (iterator.hasNext()) {
XYPlot plot = (XYPlot) iterator.next();
plot.setShadowGenerator(generator);
}
setNotify(true);
}
| void function(ShadowGenerator generator) { setNotify(false); super.setShadowGenerator(generator); Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setShadowGenerator(generator); } setNotify(true); } | /**
* Sets the shadow generator for the plot (and all subplots) and sends
* a {@link PlotChangeEvent} to all registered listeners.
*
* @param generator the new generator (<code>null</code> permitted).
*/ | Sets the shadow generator for the plot (and all subplots) and sends a <code>PlotChangeEvent</code> to all registered listeners | setShadowGenerator | {
"repo_name": "sternze/CurrentTopics_JFreeChart",
"path": "source/org/jfree/chart/plot/CombinedRangeXYPlot.java",
"license": "lgpl-2.1",
"size": 27079
} | [
"java.util.Iterator",
"org.jfree.chart.util.ShadowGenerator"
] | import java.util.Iterator; import org.jfree.chart.util.ShadowGenerator; | import java.util.*; import org.jfree.chart.util.*; | [
"java.util",
"org.jfree.chart"
] | java.util; org.jfree.chart; | 436,289 |
public void setResourceIdResolver(ResourceIdResolver resourceIdResolver) {
this.resourceIdResolver = resourceIdResolver;
} | void function(ResourceIdResolver resourceIdResolver) { this.resourceIdResolver = resourceIdResolver; } | /**
* Configures an optional {@link org.springframework.cloud.aws.core.env.ResourceIdResolver} used to resolve a logical name to a
* physical one.
*
* @param resourceIdResolver
* - the resourceIdResolver instance, might be null or not called at all
*/ | Configures an optional <code>org.springframework.cloud.aws.core.env.ResourceIdResolver</code> used to resolve a logical name to a physical one | setResourceIdResolver | {
"repo_name": "sbuettner/spring-cloud-aws",
"path": "spring-cloud-aws-jdbc/src/main/java/org/springframework/cloud/aws/jdbc/rds/AmazonRdsDataSourceFactoryBean.java",
"license": "apache-2.0",
"size": 7896
} | [
"org.springframework.cloud.aws.core.env.ResourceIdResolver"
] | import org.springframework.cloud.aws.core.env.ResourceIdResolver; | import org.springframework.cloud.aws.core.env.*; | [
"org.springframework.cloud"
] | org.springframework.cloud; | 1,527,535 |
private void writeChunkToNBT(Chunk chunkIn, World worldIn, NBTTagCompound compound)
{
compound.setInteger("xPos", chunkIn.xPosition);
compound.setInteger("zPos", chunkIn.zPosition);
compound.setLong("LastUpdate", worldIn.getTotalWorldTime());
compound.setIntArray("HeightMap", chunkIn.getHeightMap());
compound.setBoolean("TerrainPopulated", chunkIn.isTerrainPopulated());
compound.setBoolean("LightPopulated", chunkIn.isLightPopulated());
compound.setLong("InhabitedTime", chunkIn.getInhabitedTime());
ExtendedBlockStorage[] aextendedblockstorage = chunkIn.getBlockStorageArray();
NBTTagList nbttaglist = new NBTTagList();
boolean flag = !worldIn.provider.getHasNoSky();
for (ExtendedBlockStorage extendedblockstorage : aextendedblockstorage)
{
if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Y", (byte)(extendedblockstorage.getYLocation() >> 4 & 255));
byte[] abyte = new byte[4096];
NibbleArray nibblearray = new NibbleArray();
NibbleArray nibblearray1 = extendedblockstorage.getData().getDataForNBT(abyte, nibblearray);
nbttagcompound.setByteArray("Blocks", abyte);
nbttagcompound.setByteArray("Data", nibblearray.getData());
if (nibblearray1 != null)
{
nbttagcompound.setByteArray("Add", nibblearray1.getData());
}
nbttagcompound.setByteArray("BlockLight", extendedblockstorage.getBlocklightArray().getData());
if (flag)
{
nbttagcompound.setByteArray("SkyLight", extendedblockstorage.getSkylightArray().getData());
}
else
{
nbttagcompound.setByteArray("SkyLight", new byte[extendedblockstorage.getBlocklightArray().getData().length]);
}
nbttaglist.appendTag(nbttagcompound);
}
}
compound.setTag("Sections", nbttaglist);
compound.setByteArray("Biomes", chunkIn.getBiomeArray());
chunkIn.setHasEntities(false);
NBTTagList nbttaglist1 = new NBTTagList();
for (int i = 0; i < chunkIn.getEntityLists().length; ++i)
{
for (Entity entity : chunkIn.getEntityLists()[i])
{
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
if (entity.writeToNBTOptional(nbttagcompound2))
{
try
{
chunkIn.setHasEntities(true);
nbttaglist1.appendTag(nbttagcompound2);
}
catch (Exception e)
{
net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e,
"An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author",
entity.getClass().getName());
}
}
}
}
compound.setTag("Entities", nbttaglist1);
NBTTagList nbttaglist2 = new NBTTagList();
for (TileEntity tileentity : chunkIn.getTileEntityMap().values())
{
try
{
NBTTagCompound nbttagcompound3 = tileentity.writeToNBT(new NBTTagCompound());
nbttaglist2.appendTag(nbttagcompound3);
}
catch (Exception e)
{
net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e,
"A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author",
tileentity.getClass().getName());
}
}
compound.setTag("TileEntities", nbttaglist2);
List<NextTickListEntry> list = worldIn.getPendingBlockUpdates(chunkIn, false);
if (list != null)
{
long j = worldIn.getTotalWorldTime();
NBTTagList nbttaglist3 = new NBTTagList();
for (NextTickListEntry nextticklistentry : list)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
ResourceLocation resourcelocation = (ResourceLocation)Block.REGISTRY.getNameForObject(nextticklistentry.getBlock());
nbttagcompound1.setString("i", resourcelocation == null ? "" : resourcelocation.toString());
nbttagcompound1.setInteger("x", nextticklistentry.position.getX());
nbttagcompound1.setInteger("y", nextticklistentry.position.getY());
nbttagcompound1.setInteger("z", nextticklistentry.position.getZ());
nbttagcompound1.setInteger("t", (int)(nextticklistentry.scheduledTime - j));
nbttagcompound1.setInteger("p", nextticklistentry.priority);
nbttaglist3.appendTag(nbttagcompound1);
}
compound.setTag("TileTicks", nbttaglist3);
}
} | void function(Chunk chunkIn, World worldIn, NBTTagCompound compound) { compound.setInteger("xPos", chunkIn.xPosition); compound.setInteger("zPos", chunkIn.zPosition); compound.setLong(STR, worldIn.getTotalWorldTime()); compound.setIntArray(STR, chunkIn.getHeightMap()); compound.setBoolean(STR, chunkIn.isTerrainPopulated()); compound.setBoolean(STR, chunkIn.isLightPopulated()); compound.setLong(STR, chunkIn.getInhabitedTime()); ExtendedBlockStorage[] aextendedblockstorage = chunkIn.getBlockStorageArray(); NBTTagList nbttaglist = new NBTTagList(); boolean flag = !worldIn.provider.getHasNoSky(); for (ExtendedBlockStorage extendedblockstorage : aextendedblockstorage) { if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE) { NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setByte("Y", (byte)(extendedblockstorage.getYLocation() >> 4 & 255)); byte[] abyte = new byte[4096]; NibbleArray nibblearray = new NibbleArray(); NibbleArray nibblearray1 = extendedblockstorage.getData().getDataForNBT(abyte, nibblearray); nbttagcompound.setByteArray(STR, abyte); nbttagcompound.setByteArray("Data", nibblearray.getData()); if (nibblearray1 != null) { nbttagcompound.setByteArray("Add", nibblearray1.getData()); } nbttagcompound.setByteArray(STR, extendedblockstorage.getBlocklightArray().getData()); if (flag) { nbttagcompound.setByteArray(STR, extendedblockstorage.getSkylightArray().getData()); } else { nbttagcompound.setByteArray(STR, new byte[extendedblockstorage.getBlocklightArray().getData().length]); } nbttaglist.appendTag(nbttagcompound); } } compound.setTag(STR, nbttaglist); compound.setByteArray(STR, chunkIn.getBiomeArray()); chunkIn.setHasEntities(false); NBTTagList nbttaglist1 = new NBTTagList(); for (int i = 0; i < chunkIn.getEntityLists().length; ++i) { for (Entity entity : chunkIn.getEntityLists()[i]) { NBTTagCompound nbttagcompound2 = new NBTTagCompound(); if (entity.writeToNBTOptional(nbttagcompound2)) { try { chunkIn.setHasEntities(true); nbttaglist1.appendTag(nbttagcompound2); } catch (Exception e) { net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, STR, entity.getClass().getName()); } } } } compound.setTag(STR, nbttaglist1); NBTTagList nbttaglist2 = new NBTTagList(); for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) { try { NBTTagCompound nbttagcompound3 = tileentity.writeToNBT(new NBTTagCompound()); nbttaglist2.appendTag(nbttagcompound3); } catch (Exception e) { net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, STR, tileentity.getClass().getName()); } } compound.setTag(STR, nbttaglist2); List<NextTickListEntry> list = worldIn.getPendingBlockUpdates(chunkIn, false); if (list != null) { long j = worldIn.getTotalWorldTime(); NBTTagList nbttaglist3 = new NBTTagList(); for (NextTickListEntry nextticklistentry : list) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); ResourceLocation resourcelocation = (ResourceLocation)Block.REGISTRY.getNameForObject(nextticklistentry.getBlock()); nbttagcompound1.setString("i", resourcelocation == null ? STRxSTRySTRzSTRtSTRpSTRTileTicks", nbttaglist3); } } | /**
* Writes the Chunk passed as an argument to the NBTTagCompound also passed, using the World argument to retrieve
* the Chunk's last update time.
*/ | Writes the Chunk passed as an argument to the NBTTagCompound also passed, using the World argument to retrieve the Chunk's last update time | writeChunkToNBT | {
"repo_name": "Im-Jrotica/forge_latest",
"path": "build/tmp/recompileMc/sources/net/minecraft/world/chunk/storage/AnvilChunkLoader.java",
"license": "lgpl-2.1",
"size": 25079
} | [
"java.util.List",
"net.minecraft.block.Block",
"net.minecraft.entity.Entity",
"net.minecraft.nbt.NBTTagCompound",
"net.minecraft.nbt.NBTTagList",
"net.minecraft.tileentity.TileEntity",
"net.minecraft.util.ResourceLocation",
"net.minecraft.world.NextTickListEntry",
"net.minecraft.world.World",
"net... | import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.NextTickListEntry; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.NibbleArray; | import java.util.*; import net.minecraft.block.*; import net.minecraft.entity.*; import net.minecraft.nbt.*; import net.minecraft.tileentity.*; import net.minecraft.util.*; import net.minecraft.world.*; import net.minecraft.world.chunk.*; | [
"java.util",
"net.minecraft.block",
"net.minecraft.entity",
"net.minecraft.nbt",
"net.minecraft.tileentity",
"net.minecraft.util",
"net.minecraft.world"
] | java.util; net.minecraft.block; net.minecraft.entity; net.minecraft.nbt; net.minecraft.tileentity; net.minecraft.util; net.minecraft.world; | 1,211,726 |
public static void addOwnerDataToSelectedModuleOptional(ItemStack toolStack, ModuleType moduleType, Entity entity, boolean isPublic)
{
OwnerData data = getOwnerDataFromSelectedModule(toolStack, moduleType);
if (data == null)
{
writeOwnerTagToSelectedModule(toolStack, moduleType, entity, isPublic);
}
} | static void function(ItemStack toolStack, ModuleType moduleType, Entity entity, boolean isPublic) { OwnerData data = getOwnerDataFromSelectedModule(toolStack, moduleType); if (data == null) { writeOwnerTagToSelectedModule(toolStack, moduleType, entity, isPublic); } } | /**
* Adds OwnerData to the selected module in the item, but only if it doesn't exist yet.
*/ | Adds OwnerData to the selected module in the item, but only if it doesn't exist yet | addOwnerDataToSelectedModuleOptional | {
"repo_name": "maruohon/enderutilities",
"path": "src/main/java/fi/dy/masa/enderutilities/util/nbt/OwnerData.java",
"license": "gpl-3.0",
"size": 12699
} | [
"fi.dy.masa.enderutilities.item.base.ItemModule",
"net.minecraft.entity.Entity",
"net.minecraft.item.ItemStack"
] | import fi.dy.masa.enderutilities.item.base.ItemModule; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; | import fi.dy.masa.enderutilities.item.base.*; import net.minecraft.entity.*; import net.minecraft.item.*; | [
"fi.dy.masa",
"net.minecraft.entity",
"net.minecraft.item"
] | fi.dy.masa; net.minecraft.entity; net.minecraft.item; | 1,123,907 |
public void check() {
if (type == null) {
throw new BuildException(
"classname attribute must be set for provider element",
getLocation());
}
if (type.length() == 0) {
throw new BuildException(
"Invalid empty classname", getLocation());
}
} | void function() { if (type == null) { throw new BuildException( STR, getLocation()); } if (type.length() == 0) { throw new BuildException( STR, getLocation()); } } | /**
* Check if the component has been configured correctly.
*/ | Check if the component has been configured correctly | check | {
"repo_name": "Mayo-WE01051879/mayosapp",
"path": "Build/src/main/org/apache/tools/ant/types/spi/Provider.java",
"license": "mit",
"size": 2056
} | [
"org.apache.tools.ant.BuildException"
] | import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.*; | [
"org.apache.tools"
] | org.apache.tools; | 1,888,528 |
public void paintComponent(Graphics gx) {
super.paintComponent(gx);
if (m_isEnabled) {
if (m_isNumeric) {
m_oldWidth = -9000; //done so that if change back to nom, it will
//work
this.removeAll();
paintNumeric(gx);
} else {
if (m_Instances != null &&
m_Instances.numInstances() > 0 &&
m_Instances.numAttributes() > 0) {
if (m_oldWidth != this.getWidth()) {
this.removeAll();
m_oldWidth = this.getWidth();
paintNominal(gx);
}
}
}
}
} | void function(Graphics gx) { super.paintComponent(gx); if (m_isEnabled) { if (m_isNumeric) { m_oldWidth = -9000; this.removeAll(); paintNumeric(gx); } else { if (m_Instances != null && m_Instances.numInstances() > 0 && m_Instances.numAttributes() > 0) { if (m_oldWidth != this.getWidth()) { this.removeAll(); m_oldWidth = this.getWidth(); paintNominal(gx); } } } } } | /**
* Renders this component
* @param gx the graphics context
*/ | Renders this component | paintComponent | {
"repo_name": "williamClanton/jbossBA",
"path": "weka/src/main/java/weka/gui/visualize/ClassPanel.java",
"license": "gpl-2.0",
"size": 20162
} | [
"java.awt.Graphics"
] | import java.awt.Graphics; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,938,998 |
public String[] getPathName()
{
String[] pathName = new String[path.size()];
int index=0;
for(Group group : path)
pathName[index++] = group.getName();
return pathName;
} | String[] function() { String[] pathName = new String[path.size()]; int index=0; for(Group group : path) pathName[index++] = group.getName(); return pathName; } | /**
* Return the names of the Group instances in the path as a String array, which
* is the way that the Cache usually deals with paths.
* @return
*/ | Return the names of the Group instances in the path as a String array, which is the way that the Cache usually deals with paths | getPathName | {
"repo_name": "VHAINNOVATIONS/Telepathology",
"path": "Source/Java/CacheAPI/main/src/java/gov/va/med/imaging/storage/cache/impl/GroupPath.java",
"license": "apache-2.0",
"size": 1810
} | [
"gov.va.med.imaging.storage.cache.Group"
] | import gov.va.med.imaging.storage.cache.Group; | import gov.va.med.imaging.storage.cache.*; | [
"gov.va.med"
] | gov.va.med; | 2,727,261 |
public void setJmsOperations(JmsOperations jmsOperations) {
this.jmsOperations = jmsOperations;
} | void function(JmsOperations jmsOperations) { this.jmsOperations = jmsOperations; } | /**
* Allows you to use your own implementation of the org.springframework.jms.core.JmsOperations interface.
* Camel uses JmsTemplate as default. Can be used for testing purpose, but not used much as stated in the spring API docs.
*/ | Allows you to use your own implementation of the org.springframework.jms.core.JmsOperations interface. Camel uses JmsTemplate as default. Can be used for testing purpose, but not used much as stated in the spring API docs | setJmsOperations | {
"repo_name": "Fabryprog/camel",
"path": "components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java",
"license": "apache-2.0",
"size": 107870
} | [
"org.springframework.jms.core.JmsOperations"
] | import org.springframework.jms.core.JmsOperations; | import org.springframework.jms.core.*; | [
"org.springframework.jms"
] | org.springframework.jms; | 891,057 |
@RestrictedApi(explanation = "Should only be called in tests", link = "",
allowedOnPath = ".*/src/test/.*")
boolean isStreamUnsupported() {
return streamUnsupported;
} | @RestrictedApi(explanation = STR, link = STR.*/src/test/.*") boolean isStreamUnsupported() { return streamUnsupported; } | /**
* For tests only, returns whether the passed stream is supported
*/ | For tests only, returns whether the passed stream is supported | isStreamUnsupported | {
"repo_name": "mahak/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/InputStreamBlockDistribution.java",
"license": "apache-2.0",
"size": 6678
} | [
"com.google.errorprone.annotations.RestrictedApi"
] | import com.google.errorprone.annotations.RestrictedApi; | import com.google.errorprone.annotations.*; | [
"com.google.errorprone"
] | com.google.errorprone; | 1,989,239 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.