repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/impl/parser/AbstractParser.java | AbstractParser.getAttribute | protected static String getAttribute(Node node, String name, boolean required) {
NamedNodeMap attributes = node.getAttributes();
Node idNode = attributes.getNamedItem(name);
if (idNode == null) {
if (required) {
throw new IllegalArgumentException(toPath(node) + "... | java | protected static String getAttribute(Node node, String name, boolean required) {
NamedNodeMap attributes = node.getAttributes();
Node idNode = attributes.getNamedItem(name);
if (idNode == null) {
if (required) {
throw new IllegalArgumentException(toPath(node) + "... | [
"protected",
"static",
"String",
"getAttribute",
"(",
"Node",
"node",
",",
"String",
"name",
",",
"boolean",
"required",
")",
"{",
"NamedNodeMap",
"attributes",
"=",
"node",
".",
"getAttributes",
"(",
")",
";",
"Node",
"idNode",
"=",
"attributes",
".",
"getN... | Get an Attribute from the given node and throwing an exception in the case it is required but
not present
@param node
@param name
@param required
@return | [
"Get",
"an",
"Attribute",
"from",
"the",
"given",
"node",
"and",
"throwing",
"an",
"exception",
"in",
"the",
"case",
"it",
"is",
"required",
"but",
"not",
"present"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/impl/parser/AbstractParser.java#L109-L127 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/impl/parser/AbstractParser.java | AbstractParser.evaluate | protected static Iterable<Node> evaluate(Node element, XPathExpression expression,
boolean detatch) throws XPathExpressionException {
final NodeList nodeList = (NodeList) expression.evaluate(element, XPathConstants.NODESET);
return new Iterable<Node>() {
@Override
... | java | protected static Iterable<Node> evaluate(Node element, XPathExpression expression,
boolean detatch) throws XPathExpressionException {
final NodeList nodeList = (NodeList) expression.evaluate(element, XPathConstants.NODESET);
return new Iterable<Node>() {
@Override
... | [
"protected",
"static",
"Iterable",
"<",
"Node",
">",
"evaluate",
"(",
"Node",
"element",
",",
"XPathExpression",
"expression",
",",
"boolean",
"detatch",
")",
"throws",
"XPathExpressionException",
"{",
"final",
"NodeList",
"nodeList",
"=",
"(",
"NodeList",
")",
... | evaluates a XPath expression and loops over the nodeset result
@param element
@param xpath
@return
@throws XPathExpressionException | [
"evaluates",
"a",
"XPath",
"expression",
"and",
"loops",
"over",
"the",
"nodeset",
"result"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/impl/parser/AbstractParser.java#L214-L244 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam/src/main/java/org/ops4j/pax/exam/ConfigurationManager.java | ConfigurationManager.getProperty | public String getProperty(String key, String defaultValue) {
String value = resolver.get(key);
return (value == null) ? defaultValue : value;
} | java | public String getProperty(String key, String defaultValue) {
String value = resolver.get(key);
return (value == null) ? defaultValue : value;
} | [
"public",
"String",
"getProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"resolver",
".",
"get",
"(",
"key",
")",
";",
"return",
"(",
"value",
"==",
"null",
")",
"?",
"defaultValue",
":",
"value",
";",
"... | Returns the configuration property for the given key, or the given default value.
@param key
configuration key
@param defaultValue
default value for key
@return configuration value, or the default value if the key is not defined | [
"Returns",
"the",
"configuration",
"property",
"for",
"the",
"given",
"key",
"or",
"the",
"given",
"default",
"value",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam/src/main/java/org/ops4j/pax/exam/ConfigurationManager.java#L91-L94 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java | ConfigurationAdminOptions.newConfiguration | public static ConfigurationOption newConfiguration(String pid) {
return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>());
} | java | public static ConfigurationOption newConfiguration(String pid) {
return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>());
} | [
"public",
"static",
"ConfigurationOption",
"newConfiguration",
"(",
"String",
"pid",
")",
"{",
"return",
"new",
"org",
".",
"ops4j",
".",
"pax",
".",
"exam",
".",
"cm",
".",
"internal",
".",
"ConfigurationProvisionOption",
"(",
"pid",
",",
"new",
"HashMap",
... | Creates a basic, empty configuration for the given PID
@param pid
the pid for this configuration
@return empty configuration | [
"Creates",
"a",
"basic",
"empty",
"configuration",
"for",
"the",
"given",
"PID"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java#L52-L54 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java | ConfigurationAdminOptions.overrideConfiguration | public static ConfigurationOption overrideConfiguration(String pid) {
return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>()).override(true)
.create(false);
} | java | public static ConfigurationOption overrideConfiguration(String pid) {
return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>()).override(true)
.create(false);
} | [
"public",
"static",
"ConfigurationOption",
"overrideConfiguration",
"(",
"String",
"pid",
")",
"{",
"return",
"new",
"org",
".",
"ops4j",
".",
"pax",
".",
"exam",
".",
"cm",
".",
"internal",
".",
"ConfigurationProvisionOption",
"(",
"pid",
",",
"new",
"HashMap... | Creates an overriding, empty configuration for the given PID
@param pid
the pid for this configuration
@return empty configuration | [
"Creates",
"an",
"overriding",
"empty",
"configuration",
"for",
"the",
"given",
"PID"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java#L63-L66 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java | ConfigurationAdminOptions.factoryConfiguration | public static ConfigurationOption factoryConfiguration(String pid) {
return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>()).factory(true);
} | java | public static ConfigurationOption factoryConfiguration(String pid) {
return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>()).factory(true);
} | [
"public",
"static",
"ConfigurationOption",
"factoryConfiguration",
"(",
"String",
"pid",
")",
"{",
"return",
"new",
"org",
".",
"ops4j",
".",
"pax",
".",
"exam",
".",
"cm",
".",
"internal",
".",
"ConfigurationProvisionOption",
"(",
"pid",
",",
"new",
"HashMap"... | Creates a factory, empty configuration for the given PID
@param pid
the pid for this configuration
@return an empty factory configuration | [
"Creates",
"a",
"factory",
"empty",
"configuration",
"for",
"the",
"given",
"PID"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java#L75-L77 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java | ConfigurationAdminOptions.configurationFolder | public static Option configurationFolder(File folder, String extension) {
if (!folder.exists()) {
throw new TestContainerException("folder " + folder + " does not exits");
}
List<Option> options = new ArrayList<Option>();
File[] files = folder.listFiles();
for (File ... | java | public static Option configurationFolder(File folder, String extension) {
if (!folder.exists()) {
throw new TestContainerException("folder " + folder + " does not exits");
}
List<Option> options = new ArrayList<Option>();
File[] files = folder.listFiles();
for (File ... | [
"public",
"static",
"Option",
"configurationFolder",
"(",
"File",
"folder",
",",
"String",
"extension",
")",
"{",
"if",
"(",
"!",
"folder",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"TestContainerException",
"(",
"\"folder \"",
"+",
"folder",
"+",
... | read all configuration files from a folder and transform them into configuration options
@param folder
folder containing configuration files
@param extension
the file extension to scan for (eg .cfg)
@return an option containing all the read configurations | [
"read",
"all",
"configuration",
"files",
"from",
"a",
"folder",
"and",
"transform",
"them",
"into",
"configuration",
"options"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-cm/src/main/java/org/ops4j/pax/exam/cm/ConfigurationAdminOptions.java#L100-L142 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-extender-service/src/main/java/org/ops4j/pax/exam/raw/extender/intern/ServiceInjector.java | ServiceInjector.getBundleContext | private BundleContext getBundleContext(Bundle bundle, long timeout) {
long endTime = System.currentTimeMillis() + timeout;
BundleContext bc = null;
while (bc == null) {
bc = bundle.getBundleContext();
if (bc == null) {
if (System.currentTimeMillis() >= end... | java | private BundleContext getBundleContext(Bundle bundle, long timeout) {
long endTime = System.currentTimeMillis() + timeout;
BundleContext bc = null;
while (bc == null) {
bc = bundle.getBundleContext();
if (bc == null) {
if (System.currentTimeMillis() >= end... | [
"private",
"BundleContext",
"getBundleContext",
"(",
"Bundle",
"bundle",
",",
"long",
"timeout",
")",
"{",
"long",
"endTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"timeout",
";",
"BundleContext",
"bc",
"=",
"null",
";",
"while",
"(",
"bc",... | Retrieve bundle context from given bundle. If the bundle is being restarted the bundle
context can be null for some time
@param bundle
@param timeout TODO
@return bundleContext or exception if bundleContext is null after timeout | [
"Retrieve",
"bundle",
"context",
"from",
"given",
"bundle",
".",
"If",
"the",
"bundle",
"is",
"being",
"restarted",
"the",
"bundle",
"context",
"can",
"be",
"null",
"for",
"some",
"time"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-extender-service/src/main/java/org/ops4j/pax/exam/raw/extender/intern/ServiceInjector.java#L134-L153 | train |
ops4j/org.ops4j.pax.exam2 | samples/pax-exam-sample4-service/src/main/java/org/ops4j/pax/exam/sample4/service/PersistenceContextProvider.java | PersistenceContextProvider.getEntityManager | @Produces
@RequestScoped
public EntityManager getEntityManager(EntityManagerFactory emf) {
log.debug("producing EntityManager");
return emf.createEntityManager();
} | java | @Produces
@RequestScoped
public EntityManager getEntityManager(EntityManagerFactory emf) {
log.debug("producing EntityManager");
return emf.createEntityManager();
} | [
"@",
"Produces",
"@",
"RequestScoped",
"public",
"EntityManager",
"getEntityManager",
"(",
"EntityManagerFactory",
"emf",
")",
"{",
"log",
".",
"debug",
"(",
"\"producing EntityManager\"",
")",
";",
"return",
"emf",
".",
"createEntityManager",
"(",
")",
";",
"}"
] | Use a producer method so that CDI will find this EntityManager.
@param emf
entity manager factory
@return entity manager | [
"Use",
"a",
"producer",
"method",
"so",
"that",
"CDI",
"will",
"find",
"this",
"EntityManager",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/samples/pax-exam-sample4-service/src/main/java/org/ops4j/pax/exam/sample4/service/PersistenceContextProvider.java#L51-L56 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/reactors/ReactorManager.java | ReactorManager.createProbeBuilder | public TestProbeBuilder createProbeBuilder(Object testClassInstance) throws IOException,
ExamConfigurationException {
if (defaultProbeBuilder == null) {
defaultProbeBuilder = system.createProbe();
}
TestProbeBuilder probeBuilder = overwriteWithUserDefinition(currentTestClass,... | java | public TestProbeBuilder createProbeBuilder(Object testClassInstance) throws IOException,
ExamConfigurationException {
if (defaultProbeBuilder == null) {
defaultProbeBuilder = system.createProbe();
}
TestProbeBuilder probeBuilder = overwriteWithUserDefinition(currentTestClass,... | [
"public",
"TestProbeBuilder",
"createProbeBuilder",
"(",
"Object",
"testClassInstance",
")",
"throws",
"IOException",
",",
"ExamConfigurationException",
"{",
"if",
"(",
"defaultProbeBuilder",
"==",
"null",
")",
"{",
"defaultProbeBuilder",
"=",
"system",
".",
"createProb... | Lazily creates a probe builder. The same probe builder will be reused for all test classes,
unless the default builder is overridden in a given class.
@param testClassInstance instance of test class
@return probe builder
@throws IOException when probe cannot be created
@throws ExamConfigurationException when user-defi... | [
"Lazily",
"creates",
"a",
"probe",
"builder",
".",
"The",
"same",
"probe",
"builder",
"will",
"be",
"reused",
"for",
"all",
"test",
"classes",
"unless",
"the",
"default",
"builder",
"is",
"overridden",
"in",
"a",
"given",
"class",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/reactors/ReactorManager.java#L320-L331 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-forked/src/main/java/org/ops4j/pax/exam/forked/provision/StreamUtils.java | StreamUtils.streamCopy | public static void streamCopy(final InputStream in, final FileChannel out,
final ProgressBar progressBar) throws IOException {
NullArgumentException.validateNotNull(in, "Input stream");
NullArgumentException.validateNotNull(out, "Output stream");
final long start = System.currentTimeMill... | java | public static void streamCopy(final InputStream in, final FileChannel out,
final ProgressBar progressBar) throws IOException {
NullArgumentException.validateNotNull(in, "Input stream");
NullArgumentException.validateNotNull(out, "Output stream");
final long start = System.currentTimeMill... | [
"public",
"static",
"void",
"streamCopy",
"(",
"final",
"InputStream",
"in",
",",
"final",
"FileChannel",
"out",
",",
"final",
"ProgressBar",
"progressBar",
")",
"throws",
"IOException",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"in",
",",
"\"Inpu... | Copy a stream to a destination. It does not close the streams.
@param in
the stream to copy from
@param out
the stream to copy to
@param progressBar
download progress feedback. Can be null.
@throws IOException
re-thrown | [
"Copy",
"a",
"stream",
"to",
"a",
"destination",
".",
"It",
"does",
"not",
"close",
"the",
"streams",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-forked/src/main/java/org/ops4j/pax/exam/forked/provision/StreamUtils.java#L64-L83 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-forked/src/main/java/org/ops4j/pax/exam/forked/provision/StreamUtils.java | StreamUtils.streamCopy | public static void streamCopy(final URL url, final FileChannel out,
final ProgressBar progressBar) throws IOException {
NullArgumentException.validateNotNull(url, "URL");
InputStream is = null;
try {
is = url.openStream();
streamCopy(is, out, progressBar);
... | java | public static void streamCopy(final URL url, final FileChannel out,
final ProgressBar progressBar) throws IOException {
NullArgumentException.validateNotNull(url, "URL");
InputStream is = null;
try {
is = url.openStream();
streamCopy(is, out, progressBar);
... | [
"public",
"static",
"void",
"streamCopy",
"(",
"final",
"URL",
"url",
",",
"final",
"FileChannel",
"out",
",",
"final",
"ProgressBar",
"progressBar",
")",
"throws",
"IOException",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"url",
",",
"\"URL\"",
... | Copy a stream from an urlto a destination.
@param url
the url to copy from
@param out
the stream to copy to
@param progressBar
download progress feedback. Can be null.
@throws IOException
re-thrown | [
"Copy",
"a",
"stream",
"from",
"an",
"urlto",
"a",
"destination",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-forked/src/main/java/org/ops4j/pax/exam/forked/provision/StreamUtils.java#L98-L112 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java | ZipBuilder.close | public void close() throws IOException {
if (jarOutputStream != null) {
jarOutputStream.close();
}
else if (os != null) {
os.close();
}
} | java | public void close() throws IOException {
if (jarOutputStream != null) {
jarOutputStream.close();
}
else if (os != null) {
os.close();
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"jarOutputStream",
"!=",
"null",
")",
"{",
"jarOutputStream",
".",
"close",
"(",
")",
";",
"}",
"else",
"if",
"(",
"os",
"!=",
"null",
")",
"{",
"os",
".",
"close",
"(",
... | Closes the archive and releases file system resources. No more files or directories may be
added after calling this method.
@throws IOException
on I/O error | [
"Closes",
"the",
"archive",
"and",
"releases",
"file",
"system",
"resources",
".",
"No",
"more",
"files",
"or",
"directories",
"may",
"be",
"added",
"after",
"calling",
"this",
"method",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L119-L126 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java | ZipBuilder.addDirectory | private void addDirectory(File root, File directory, String targetPath, ZipOutputStream zos) throws IOException {
String prefix = targetPath;
if (!prefix.isEmpty() && !prefix.endsWith("/")) {
prefix += "/";
}
// directory entries are required, or else bundle classpath may be
... | java | private void addDirectory(File root, File directory, String targetPath, ZipOutputStream zos) throws IOException {
String prefix = targetPath;
if (!prefix.isEmpty() && !prefix.endsWith("/")) {
prefix += "/";
}
// directory entries are required, or else bundle classpath may be
... | [
"private",
"void",
"addDirectory",
"(",
"File",
"root",
",",
"File",
"directory",
",",
"String",
"targetPath",
",",
"ZipOutputStream",
"zos",
")",
"throws",
"IOException",
"{",
"String",
"prefix",
"=",
"targetPath",
";",
"if",
"(",
"!",
"prefix",
".",
"isEmp... | Recursively adds the contents of the given directory and all subdirectories to the given ZIP
output stream.
@param root
an ancestor of {@code directory}, used to determine the relative path within the
archive
@param directory
current directory to be added
@param zos
ZIP output stream
@throws IOException | [
"Recursively",
"adds",
"the",
"contents",
"of",
"the",
"given",
"directory",
"and",
"all",
"subdirectories",
"to",
"the",
"given",
"ZIP",
"output",
"stream",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L141-L163 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java | ZipBuilder.addFile | private void addFile(File root, File file, String prefix, ZipOutputStream zos) throws IOException {
FileInputStream fis = new FileInputStream(file);
ZipEntry jarEntry = new ZipEntry(prefix + normalizePath(root, file));
zos.putNextEntry(jarEntry);
StreamUtils.copyStream(fis, zos, false);
... | java | private void addFile(File root, File file, String prefix, ZipOutputStream zos) throws IOException {
FileInputStream fis = new FileInputStream(file);
ZipEntry jarEntry = new ZipEntry(prefix + normalizePath(root, file));
zos.putNextEntry(jarEntry);
StreamUtils.copyStream(fis, zos, false);
... | [
"private",
"void",
"addFile",
"(",
"File",
"root",
",",
"File",
"file",
",",
"String",
"prefix",
",",
"ZipOutputStream",
"zos",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"ZipEntry",
"ja... | Adds a given file to the given ZIP output stream.
@param root
an ancestor of {@code file}, used to determine the relative path within the
archive
@param file
file to be added
@param zos
ZIP output stream
@throws IOException | [
"Adds",
"a",
"given",
"file",
"to",
"the",
"given",
"ZIP",
"output",
"stream",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L177-L183 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java | ZipBuilder.normalizePath | private String normalizePath(File root, File file) {
String relativePath = file.getPath().substring(root.getPath().length() + 1);
String path = relativePath.replaceAll("\\" + File.separator, "/");
return path;
} | java | private String normalizePath(File root, File file) {
String relativePath = file.getPath().substring(root.getPath().length() + 1);
String path = relativePath.replaceAll("\\" + File.separator, "/");
return path;
} | [
"private",
"String",
"normalizePath",
"(",
"File",
"root",
",",
"File",
"file",
")",
"{",
"String",
"relativePath",
"=",
"file",
".",
"getPath",
"(",
")",
".",
"substring",
"(",
"root",
".",
"getPath",
"(",
")",
".",
"length",
"(",
")",
"+",
"1",
")"... | Returns the relative path of the given file with respect to the root directory, with all file
separators replaced by slashes.
Example: For root {@code C:\work} and file {@code C:\work\com\example\Foo.class}, the result
is {@code com/example/Foo.class}
@param root
root directory
@param file
relative path
@return norma... | [
"Returns",
"the",
"relative",
"path",
"of",
"the",
"given",
"file",
"with",
"respect",
"to",
"the",
"root",
"directory",
"with",
"all",
"file",
"separators",
"replaced",
"by",
"slashes",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L198-L202 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java | DependenciesDeployer.copyBootClasspathLibraries | public void copyBootClasspathLibraries() throws IOException {
BootClasspathLibraryOption[] bootClasspathLibraryOptions = subsystem
.getOptions(BootClasspathLibraryOption.class);
for (BootClasspathLibraryOption bootClasspathLibraryOption : bootClasspathLibraryOptions) {
UrlReferen... | java | public void copyBootClasspathLibraries() throws IOException {
BootClasspathLibraryOption[] bootClasspathLibraryOptions = subsystem
.getOptions(BootClasspathLibraryOption.class);
for (BootClasspathLibraryOption bootClasspathLibraryOption : bootClasspathLibraryOptions) {
UrlReferen... | [
"public",
"void",
"copyBootClasspathLibraries",
"(",
")",
"throws",
"IOException",
"{",
"BootClasspathLibraryOption",
"[",
"]",
"bootClasspathLibraryOptions",
"=",
"subsystem",
".",
"getOptions",
"(",
"BootClasspathLibraryOption",
".",
"class",
")",
";",
"for",
"(",
"... | Copy jars specified as BootClasspathLibraryOption in system
to the karaf lib path to make them available in the boot classpath
@throws IOException if copy fails | [
"Copy",
"jars",
"specified",
"as",
"BootClasspathLibraryOption",
"in",
"system",
"to",
"the",
"karaf",
"lib",
"path",
"to",
"make",
"them",
"available",
"in",
"the",
"boot",
"classpath"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java#L61-L71 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java | DependenciesDeployer.copyReferencedArtifactsToDeployFolder | public void copyReferencedArtifactsToDeployFolder() {
File deploy = new File(karafBase, "deploy");
String[] fileEndings = new String[] { "jar", "war", "zip", "kar", "xml" };
ProvisionOption<?>[] options = subsystem.getOptions(ProvisionOption.class);
for (ProvisionOption<?> option : optio... | java | public void copyReferencedArtifactsToDeployFolder() {
File deploy = new File(karafBase, "deploy");
String[] fileEndings = new String[] { "jar", "war", "zip", "kar", "xml" };
ProvisionOption<?>[] options = subsystem.getOptions(ProvisionOption.class);
for (ProvisionOption<?> option : optio... | [
"public",
"void",
"copyReferencedArtifactsToDeployFolder",
"(",
")",
"{",
"File",
"deploy",
"=",
"new",
"File",
"(",
"karafBase",
",",
"\"deploy\"",
")",
";",
"String",
"[",
"]",
"fileEndings",
"=",
"new",
"String",
"[",
"]",
"{",
"\"jar\"",
",",
"\"war\"",
... | Copy dependencies specified as ProvisionOption in system to the deploy folder | [
"Copy",
"dependencies",
"specified",
"as",
"ProvisionOption",
"in",
"system",
"to",
"the",
"deploy",
"folder"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java#L76-L90 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java | DependenciesDeployer.getDependenciesFeature | public KarafFeaturesOption getDependenciesFeature() {
if (subsystem == null) {
return null;
}
try {
File featuresXmlFile = new File(karafBase, "test-dependencies.xml");
Writer wr = new OutputStreamWriter(new FileOutputStream(featuresXmlFile), "UTF-8");
... | java | public KarafFeaturesOption getDependenciesFeature() {
if (subsystem == null) {
return null;
}
try {
File featuresXmlFile = new File(karafBase, "test-dependencies.xml");
Writer wr = new OutputStreamWriter(new FileOutputStream(featuresXmlFile), "UTF-8");
... | [
"public",
"KarafFeaturesOption",
"getDependenciesFeature",
"(",
")",
"{",
"if",
"(",
"subsystem",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"File",
"featuresXmlFile",
"=",
"new",
"File",
"(",
"karafBase",
",",
"\"test-dependencies.xml\"",
... | Create a feature for the test dependencies
specified as ProvisionOption in the system
@return feature option for dependencies | [
"Create",
"a",
"feature",
"for",
"the",
"test",
"dependencies",
"specified",
"as",
"ProvisionOption",
"in",
"the",
"system"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java#L116-L133 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java | DependenciesDeployer.writeDependenciesFeature | static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) {
XMLOutputFactory xof = XMLOutputFactory.newInstance();
xof.setProperty("javax.xml.stream.isRepairingNamespaces", true);
XMLStreamWriter sw = null;
try {
sw = xof.createXMLStreamWrit... | java | static void writeDependenciesFeature(Writer writer, ProvisionOption<?>... provisionOptions) {
XMLOutputFactory xof = XMLOutputFactory.newInstance();
xof.setProperty("javax.xml.stream.isRepairingNamespaces", true);
XMLStreamWriter sw = null;
try {
sw = xof.createXMLStreamWrit... | [
"static",
"void",
"writeDependenciesFeature",
"(",
"Writer",
"writer",
",",
"ProvisionOption",
"<",
"?",
">",
"...",
"provisionOptions",
")",
"{",
"XMLOutputFactory",
"xof",
"=",
"XMLOutputFactory",
".",
"newInstance",
"(",
")",
";",
"xof",
".",
"setProperty",
"... | Write a feature xml structure for test dependencies specified as ProvisionOption
in system to the given writer
@param writer where to write the feature xml
@param provisionOptions dependencies | [
"Write",
"a",
"feature",
"xml",
"structure",
"for",
"test",
"dependencies",
"specified",
"as",
"ProvisionOption",
"in",
"system",
"to",
"the",
"given",
"writer"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java#L142-L180 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/ArchiveExtractor.java | ArchiveExtractor.extract | public static void extract(URL sourceURL, File targetFolder)
throws IOException {
if (sourceURL.getProtocol().equals("file")) {
if (sourceURL.getFile().indexOf(".zip") > 0) {
extractZipDistribution(sourceURL, targetFolder);
}
else if (sourceURL.getFile... | java | public static void extract(URL sourceURL, File targetFolder)
throws IOException {
if (sourceURL.getProtocol().equals("file")) {
if (sourceURL.getFile().indexOf(".zip") > 0) {
extractZipDistribution(sourceURL, targetFolder);
}
else if (sourceURL.getFile... | [
"public",
"static",
"void",
"extract",
"(",
"URL",
"sourceURL",
",",
"File",
"targetFolder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"sourceURL",
".",
"getProtocol",
"(",
")",
".",
"equals",
"(",
"\"file\"",
")",
")",
"{",
"if",
"(",
"sourceURL",
"... | Extract zip or tar.gz archives to a target folder
@param sourceURL url of the archive to extract
@param targetFolder where to extract to
@throws IOException on I/O error | [
"Extract",
"zip",
"or",
"tar",
".",
"gz",
"archives",
"to",
"a",
"target",
"folder"
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/ArchiveExtractor.java#L51-L76 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/runner/CommandLineBuilder.java | CommandLineBuilder.append | public CommandLineBuilder append(final String[] segments) {
if (segments != null && segments.length > 0) {
final String[] command = new String[commandLine.length + segments.length];
System.arraycopy(commandLine, 0, command, 0, commandLine.length);
System.arraycopy(segments, 0... | java | public CommandLineBuilder append(final String[] segments) {
if (segments != null && segments.length > 0) {
final String[] command = new String[commandLine.length + segments.length];
System.arraycopy(commandLine, 0, command, 0, commandLine.length);
System.arraycopy(segments, 0... | [
"public",
"CommandLineBuilder",
"append",
"(",
"final",
"String",
"[",
"]",
"segments",
")",
"{",
"if",
"(",
"segments",
"!=",
"null",
"&&",
"segments",
".",
"length",
">",
"0",
")",
"{",
"final",
"String",
"[",
"]",
"command",
"=",
"new",
"String",
"[... | Appends an array of strings to command line.
@param segments array to append
@return CommandLineBuilder for fluent api | [
"Appends",
"an",
"array",
"of",
"strings",
"to",
"command",
"line",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/runner/CommandLineBuilder.java#L39-L47 | train |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/runner/CommandLineBuilder.java | CommandLineBuilder.append | public CommandLineBuilder append(final String segment) {
if (segment != null && !segment.isEmpty()) {
return append(new String[]{segment});
}
return this;
} | java | public CommandLineBuilder append(final String segment) {
if (segment != null && !segment.isEmpty()) {
return append(new String[]{segment});
}
return this;
} | [
"public",
"CommandLineBuilder",
"append",
"(",
"final",
"String",
"segment",
")",
"{",
"if",
"(",
"segment",
"!=",
"null",
"&&",
"!",
"segment",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"append",
"(",
"new",
"String",
"[",
"]",
"{",
"segment",
"}"... | Appends a string to command line.
@param segment string to append
@return CommandLineBuilder for fluent api | [
"Appends",
"a",
"string",
"to",
"command",
"line",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/runner/CommandLineBuilder.java#L55-L60 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam/src/main/java/org/ops4j/pax/exam/MavenUtils.java | MavenUtils.getArtifactVersion | public static String getArtifactVersion(final String groupId, final String artifactId) {
final Properties dependencies = new Properties();
InputStream depInputStream = null;
try {
String depFilePath = "META-INF/maven/dependencies.properties";
URL fileURL = MavenUtils.clas... | java | public static String getArtifactVersion(final String groupId, final String artifactId) {
final Properties dependencies = new Properties();
InputStream depInputStream = null;
try {
String depFilePath = "META-INF/maven/dependencies.properties";
URL fileURL = MavenUtils.clas... | [
"public",
"static",
"String",
"getArtifactVersion",
"(",
"final",
"String",
"groupId",
",",
"final",
"String",
"artifactId",
")",
"{",
"final",
"Properties",
"dependencies",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"depInputStream",
"=",
"null",
"... | Gets the artifact version out of dependencies file. The dependencies file had to be generated
by using the maven plugin.
@param groupId
artifact group id
@param artifactId
artifact id
@return found version
@throws RuntimeException
- If artifact version cannot be found | [
"Gets",
"the",
"artifact",
"version",
"out",
"of",
"dependencies",
"file",
".",
"The",
"dependencies",
"file",
"had",
"to",
"be",
"generated",
"by",
"using",
"the",
"maven",
"plugin",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam/src/main/java/org/ops4j/pax/exam/MavenUtils.java#L57-L96 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam/src/main/java/org/ops4j/pax/exam/MavenUtils.java | MavenUtils.asInProject | public static MavenArtifactUrlReference.VersionResolver asInProject() {
return new MavenArtifactUrlReference.VersionResolver() {
@Override
public String getVersion(final String groupId, final String artifactId) {
return getArtifactVersion(groupId, artifactId);
... | java | public static MavenArtifactUrlReference.VersionResolver asInProject() {
return new MavenArtifactUrlReference.VersionResolver() {
@Override
public String getVersion(final String groupId, final String artifactId) {
return getArtifactVersion(groupId, artifactId);
... | [
"public",
"static",
"MavenArtifactUrlReference",
".",
"VersionResolver",
"asInProject",
"(",
")",
"{",
"return",
"new",
"MavenArtifactUrlReference",
".",
"VersionResolver",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"getVersion",
"(",
"final",
"String",
"gr... | Utility method for creating an artifact version resolver that will get the version out of
maven project.
@return version resolver | [
"Utility",
"method",
"for",
"creating",
"an",
"artifact",
"version",
"resolver",
"that",
"will",
"get",
"the",
"version",
"out",
"of",
"maven",
"project",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam/src/main/java/org/ops4j/pax/exam/MavenUtils.java#L104-L113 | train |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/WarBuilder.java | WarBuilder.buildWar | public URI buildWar() {
if (option.getName() == null) {
option.name(UUID.randomUUID().toString());
}
processClassPath();
try {
File webResourceDir = getWebResourceDir();
File probeWar = new File(tempDir, option.getName() + ".war");
ZipBuild... | java | public URI buildWar() {
if (option.getName() == null) {
option.name(UUID.randomUUID().toString());
}
processClassPath();
try {
File webResourceDir = getWebResourceDir();
File probeWar = new File(tempDir, option.getName() + ".war");
ZipBuild... | [
"public",
"URI",
"buildWar",
"(",
")",
"{",
"if",
"(",
"option",
".",
"getName",
"(",
")",
"==",
"null",
")",
"{",
"option",
".",
"name",
"(",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"processClassPath",
"(",
... | Builds a WAR from the given option.
@return file URI referencing the WAR in a temporary directory | [
"Builds",
"a",
"WAR",
"from",
"the",
"given",
"option",
"."
] | 7f83796cbbb857123d8fc7fe817a7637218d5d77 | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/WarBuilder.java#L84-L117 | train |
scalanlp/nak | src/main/java/nak/liblinear/Tron.java | Tron.daxpy | private static void daxpy(double constant, double vector1[], double vector2[]) {
if (constant == 0) return;
assert vector1.length == vector2.length;
for (int i = 0; i < vector1.length; i++) {
vector2[i] += constant * vector1[i];
}
} | java | private static void daxpy(double constant, double vector1[], double vector2[]) {
if (constant == 0) return;
assert vector1.length == vector2.length;
for (int i = 0; i < vector1.length; i++) {
vector2[i] += constant * vector1[i];
}
} | [
"private",
"static",
"void",
"daxpy",
"(",
"double",
"constant",
",",
"double",
"vector1",
"[",
"]",
",",
"double",
"vector2",
"[",
"]",
")",
"{",
"if",
"(",
"constant",
"==",
"0",
")",
"return",
";",
"assert",
"vector1",
".",
"length",
"==",
"vector2"... | constant times a vector plus a vector
<pre>
vector2 += constant * vector1
</pre>
@since 1.8 | [
"constant",
"times",
"a",
"vector",
"plus",
"a",
"vector"
] | 46462728f0fa85a884387e33f9beeec57f9cd109 | https://github.com/scalanlp/nak/blob/46462728f0fa85a884387e33f9beeec57f9cd109/src/main/java/nak/liblinear/Tron.java#L184-L191 | train |
scalanlp/nak | src/main/java/nak/liblinear/Tron.java | Tron.dot | private static double dot(double vector1[], double vector2[]) {
double product = 0;
assert vector1.length == vector2.length;
for (int i = 0; i < vector1.length; i++) {
product += vector1[i] * vector2[i];
}
return product;
} | java | private static double dot(double vector1[], double vector2[]) {
double product = 0;
assert vector1.length == vector2.length;
for (int i = 0; i < vector1.length; i++) {
product += vector1[i] * vector2[i];
}
return product;
} | [
"private",
"static",
"double",
"dot",
"(",
"double",
"vector1",
"[",
"]",
",",
"double",
"vector2",
"[",
"]",
")",
"{",
"double",
"product",
"=",
"0",
";",
"assert",
"vector1",
".",
"length",
"==",
"vector2",
".",
"length",
";",
"for",
"(",
"int",
"i... | returns the dot product of two vectors
@since 1.8 | [
"returns",
"the",
"dot",
"product",
"of",
"two",
"vectors"
] | 46462728f0fa85a884387e33f9beeec57f9cd109 | https://github.com/scalanlp/nak/blob/46462728f0fa85a884387e33f9beeec57f9cd109/src/main/java/nak/liblinear/Tron.java#L198-L207 | train |
scalanlp/nak | src/main/java/nak/liblinear/Tron.java | Tron.euclideanNorm | private static double euclideanNorm(double vector[]) {
int n = vector.length;
if (n < 1) {
return 0;
}
if (n == 1) {
return Math.abs(vector[0]);
}
// this algorithm is (often) more accurate than just summing up the squares and taking the square... | java | private static double euclideanNorm(double vector[]) {
int n = vector.length;
if (n < 1) {
return 0;
}
if (n == 1) {
return Math.abs(vector[0]);
}
// this algorithm is (often) more accurate than just summing up the squares and taking the square... | [
"private",
"static",
"double",
"euclideanNorm",
"(",
"double",
"vector",
"[",
"]",
")",
"{",
"int",
"n",
"=",
"vector",
".",
"length",
";",
"if",
"(",
"n",
"<",
"1",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"n",
"==",
"1",
")",
"{",
"retur... | returns the euclidean norm of a vector
@since 1.8 | [
"returns",
"the",
"euclidean",
"norm",
"of",
"a",
"vector"
] | 46462728f0fa85a884387e33f9beeec57f9cd109 | https://github.com/scalanlp/nak/blob/46462728f0fa85a884387e33f9beeec57f9cd109/src/main/java/nak/liblinear/Tron.java#L214-L246 | train |
scalanlp/nak | src/main/java/nak/liblinear/Tron.java | Tron.scale | private static void scale(double constant, double vector[]) {
if (constant == 1.0) return;
for (int i = 0; i < vector.length; i++) {
vector[i] *= constant;
}
} | java | private static void scale(double constant, double vector[]) {
if (constant == 1.0) return;
for (int i = 0; i < vector.length; i++) {
vector[i] *= constant;
}
} | [
"private",
"static",
"void",
"scale",
"(",
"double",
"constant",
",",
"double",
"vector",
"[",
"]",
")",
"{",
"if",
"(",
"constant",
"==",
"1.0",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vector",
".",
"length",
";",
"... | scales a vector by a constant
@since 1.8 | [
"scales",
"a",
"vector",
"by",
"a",
"constant"
] | 46462728f0fa85a884387e33f9beeec57f9cd109 | https://github.com/scalanlp/nak/blob/46462728f0fa85a884387e33f9beeec57f9cd109/src/main/java/nak/liblinear/Tron.java#L253-L259 | train |
alexvasilkov/FoldableLayout | library/src/main/java/com/alexvasilkov/foldablelayout/FoldableListLayout.java | FoldableListLayout.setAutoScaleEnabled | @SuppressWarnings("unused") // Public API
public void setAutoScaleEnabled(boolean isAutoScaleEnabled) {
this.isAutoScaleEnabled = isAutoScaleEnabled;
for (int i = 0, size = foldableItemsMap.size(); i < size; i++) {
foldableItemsMap.valueAt(i).setAutoScaleEnabled(isAutoScaleEnabled);
... | java | @SuppressWarnings("unused") // Public API
public void setAutoScaleEnabled(boolean isAutoScaleEnabled) {
this.isAutoScaleEnabled = isAutoScaleEnabled;
for (int i = 0, size = foldableItemsMap.size(); i < size; i++) {
foldableItemsMap.valueAt(i).setAutoScaleEnabled(isAutoScaleEnabled);
... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// Public API",
"public",
"void",
"setAutoScaleEnabled",
"(",
"boolean",
"isAutoScaleEnabled",
")",
"{",
"this",
".",
"isAutoScaleEnabled",
"=",
"isAutoScaleEnabled",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"... | Sets whether view should scale down to fit moving part into screen. | [
"Sets",
"whether",
"view",
"should",
"scale",
"down",
"to",
"fit",
"moving",
"part",
"into",
"screen",
"."
] | 2e0d4f8c67b7bb94037cb68e55cb6d80423897d7 | https://github.com/alexvasilkov/FoldableLayout/blob/2e0d4f8c67b7bb94037cb68e55cb6d80423897d7/library/src/main/java/com/alexvasilkov/foldablelayout/FoldableListLayout.java#L204-L210 | train |
alexvasilkov/FoldableLayout | library/src/main/java/com/alexvasilkov/foldablelayout/FoldableItemLayout.java | FoldableItemLayout.setFoldRotation | public void setFoldRotation(float rotation) {
foldRotation = rotation;
topPart.applyFoldRotation(rotation);
bottomPart.applyFoldRotation(rotation);
setInTransformation(rotation != 0f);
scaleFactor = 1f;
if (isAutoScaleEnabled && width > 0) {
double sin = M... | java | public void setFoldRotation(float rotation) {
foldRotation = rotation;
topPart.applyFoldRotation(rotation);
bottomPart.applyFoldRotation(rotation);
setInTransformation(rotation != 0f);
scaleFactor = 1f;
if (isAutoScaleEnabled && width > 0) {
double sin = M... | [
"public",
"void",
"setFoldRotation",
"(",
"float",
"rotation",
")",
"{",
"foldRotation",
"=",
"rotation",
";",
"topPart",
".",
"applyFoldRotation",
"(",
"rotation",
")",
";",
"bottomPart",
".",
"applyFoldRotation",
"(",
"rotation",
")",
";",
"setInTransformation",... | Fold rotation value in degrees. | [
"Fold",
"rotation",
"value",
"in",
"degrees",
"."
] | 2e0d4f8c67b7bb94037cb68e55cb6d80423897d7 | https://github.com/alexvasilkov/FoldableLayout/blob/2e0d4f8c67b7bb94037cb68e55cb6d80423897d7/library/src/main/java/com/alexvasilkov/foldablelayout/FoldableItemLayout.java#L104-L121 | train |
alexvasilkov/FoldableLayout | library/src/main/java/com/alexvasilkov/foldablelayout/FoldableItemLayout.java | FoldableItemLayout.setRollingDistance | public void setRollingDistance(float distance) {
final float scaleY = scale * scaleFactor * scaleFactorY;
topPart.applyRollingDistance(distance, scaleY);
bottomPart.applyRollingDistance(distance, scaleY);
} | java | public void setRollingDistance(float distance) {
final float scaleY = scale * scaleFactor * scaleFactorY;
topPart.applyRollingDistance(distance, scaleY);
bottomPart.applyRollingDistance(distance, scaleY);
} | [
"public",
"void",
"setRollingDistance",
"(",
"float",
"distance",
")",
"{",
"final",
"float",
"scaleY",
"=",
"scale",
"*",
"scaleFactor",
"*",
"scaleFactorY",
";",
"topPart",
".",
"applyRollingDistance",
"(",
"distance",
",",
"scaleY",
")",
";",
"bottomPart",
... | Translation preserving middle line splitting. | [
"Translation",
"preserving",
"middle",
"line",
"splitting",
"."
] | 2e0d4f8c67b7bb94037cb68e55cb6d80423897d7 | https://github.com/alexvasilkov/FoldableLayout/blob/2e0d4f8c67b7bb94037cb68e55cb6d80423897d7/library/src/main/java/com/alexvasilkov/foldablelayout/FoldableItemLayout.java#L144-L148 | train |
alexvasilkov/FoldableLayout | library/src/main/java/com/alexvasilkov/foldablelayout/UnfoldableView.java | UnfoldableView.unfold | public void unfold(View coverView, View detailsView) {
if (this.coverView == coverView && this.detailsView == detailsView) {
scrollToPosition(1); // Starting unfold animation
return;
}
if ((this.coverView != null && this.coverView != coverView)
|| (this.d... | java | public void unfold(View coverView, View detailsView) {
if (this.coverView == coverView && this.detailsView == detailsView) {
scrollToPosition(1); // Starting unfold animation
return;
}
if ((this.coverView != null && this.coverView != coverView)
|| (this.d... | [
"public",
"void",
"unfold",
"(",
"View",
"coverView",
",",
"View",
"detailsView",
")",
"{",
"if",
"(",
"this",
".",
"coverView",
"==",
"coverView",
"&&",
"this",
".",
"detailsView",
"==",
"detailsView",
")",
"{",
"scrollToPosition",
"(",
"1",
")",
";",
"... | Starting unfold animation for given views. | [
"Starting",
"unfold",
"animation",
"for",
"given",
"views",
"."
] | 2e0d4f8c67b7bb94037cb68e55cb6d80423897d7 | https://github.com/alexvasilkov/FoldableLayout/blob/2e0d4f8c67b7bb94037cb68e55cb6d80423897d7/library/src/main/java/com/alexvasilkov/foldablelayout/UnfoldableView.java#L107-L139 | train |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/ST_EndPoint.java | ST_EndPoint.evaluate | public BytesWritable evaluate(BytesWritable geomref) {
if (geomref == null || geomref.getLength() == 0){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
... | java | public BytesWritable evaluate(BytesWritable geomref) {
if (geomref == null || geomref.getLength() == 0){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
... | [
"public",
"BytesWritable",
"evaluate",
"(",
"BytesWritable",
"geomref",
")",
"{",
"if",
"(",
"geomref",
"==",
"null",
"||",
"geomref",
".",
"getLength",
"(",
")",
"==",
"0",
")",
"{",
"LogUtils",
".",
"Log_ArgumentsNull",
"(",
"LOG",
")",
";",
"return",
... | Return the last point of the ST_Linestring.
@param geomref hive geometry bytes
@return byte-reference of the last ST_Point | [
"Return",
"the",
"last",
"point",
"of",
"the",
"ST_Linestring",
"."
] | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/ST_EndPoint.java#L28-L53 | train |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/BinUtils.java | BinUtils.getId | public long getId(double x, double y) {
double down = (extentMax - y) / binSize;
double over = (x - extentMin) / binSize;
return ((long)down * numCols) + (long)over;
} | java | public long getId(double x, double y) {
double down = (extentMax - y) / binSize;
double over = (x - extentMin) / binSize;
return ((long)down * numCols) + (long)over;
} | [
"public",
"long",
"getId",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"down",
"=",
"(",
"extentMax",
"-",
"y",
")",
"/",
"binSize",
";",
"double",
"over",
"=",
"(",
"x",
"-",
"extentMin",
")",
"/",
"binSize",
";",
"return",
"(",
... | Gets bin ID from a point.
@param x
@param y
@return | [
"Gets",
"bin",
"ID",
"from",
"a",
"point",
"."
] | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/BinUtils.java#L33-L38 | train |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/BinUtils.java | BinUtils.queryEnvelope | public void queryEnvelope(long binId, Envelope envelope) {
long down = binId / numCols;
long over = binId % numCols;
double xmin = extentMin + (over * binSize);
double xmax = xmin + binSize;
double ymax = extentMax - (down * binSize);
double ymin = ymax - binSize;
envelope.setCoords(xmin, y... | java | public void queryEnvelope(long binId, Envelope envelope) {
long down = binId / numCols;
long over = binId % numCols;
double xmin = extentMin + (over * binSize);
double xmax = xmin + binSize;
double ymax = extentMax - (down * binSize);
double ymin = ymax - binSize;
envelope.setCoords(xmin, y... | [
"public",
"void",
"queryEnvelope",
"(",
"long",
"binId",
",",
"Envelope",
"envelope",
")",
"{",
"long",
"down",
"=",
"binId",
"/",
"numCols",
";",
"long",
"over",
"=",
"binId",
"%",
"numCols",
";",
"double",
"xmin",
"=",
"extentMin",
"+",
"(",
"over",
... | Gets the envelope for the bin ID.
@param binId
@param envelope | [
"Gets",
"the",
"envelope",
"for",
"the",
"bin",
"ID",
"."
] | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/BinUtils.java#L46-L56 | train |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/BinUtils.java | BinUtils.queryEnvelope | public void queryEnvelope(double x, double y, Envelope envelope) {
double down = (extentMax - y) / binSize;
double over = (x - extentMin) / binSize;
double xmin = extentMin + (over * binSize);
double xmax = xmin + binSize;
double ymax = extentMax - (down * binSize);
double ymin = ymax - binSize;
... | java | public void queryEnvelope(double x, double y, Envelope envelope) {
double down = (extentMax - y) / binSize;
double over = (x - extentMin) / binSize;
double xmin = extentMin + (over * binSize);
double xmax = xmin + binSize;
double ymax = extentMax - (down * binSize);
double ymin = ymax - binSize;
... | [
"public",
"void",
"queryEnvelope",
"(",
"double",
"x",
",",
"double",
"y",
",",
"Envelope",
"envelope",
")",
"{",
"double",
"down",
"=",
"(",
"extentMax",
"-",
"y",
")",
"/",
"binSize",
";",
"double",
"over",
"=",
"(",
"x",
"-",
"extentMin",
")",
"/"... | Gets the envelope for the bin that contains the x,y coords.
@param x
@param y
@param envelope | [
"Gets",
"the",
"envelope",
"for",
"the",
"bin",
"that",
"contains",
"the",
"x",
"y",
"coords",
"."
] | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/BinUtils.java#L65-L75 | train |
Esri/spatial-framework-for-hadoop | json/src/main/java/com/esri/json/hadoop/EnclosedBaseJsonRecordReader.java | EnclosedBaseJsonRecordReader.next | @Override
public boolean next(LongWritable key, Text value) throws IOException {
JsonToken token;
// first call to nextKeyValue() so we need to create the parser and move to the
// feature array
if (parser == null) {
parser = new JsonFactory().createJsonParser(inputStream);
parser.setCodec(new Obj... | java | @Override
public boolean next(LongWritable key, Text value) throws IOException {
JsonToken token;
// first call to nextKeyValue() so we need to create the parser and move to the
// feature array
if (parser == null) {
parser = new JsonFactory().createJsonParser(inputStream);
parser.setCodec(new Obj... | [
"@",
"Override",
"public",
"boolean",
"next",
"(",
"LongWritable",
"key",
",",
"Text",
"value",
")",
"throws",
"IOException",
"{",
"JsonToken",
"token",
";",
"// first call to nextKeyValue() so we need to create the parser and move to the",
"// feature array",
"if",
"(",
... | Both Esri JSON and GeoJSON conveniently have "features" | [
"Both",
"Esri",
"JSON",
"and",
"GeoJSON",
"conveniently",
"have",
"features"
] | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/json/src/main/java/com/esri/json/hadoop/EnclosedBaseJsonRecordReader.java#L100-L134 | train |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/LogUtils.java | LogUtils.Log_SRIDMismatch | public static void Log_SRIDMismatch(Log logger, BytesWritable geomref1, BytesWritable geomref2){
logger.error(String.format(messages[MSG_SRID_MISMATCH], GeometryUtils.getWKID(geomref1), GeometryUtils.getWKID(geomref2)));
} | java | public static void Log_SRIDMismatch(Log logger, BytesWritable geomref1, BytesWritable geomref2){
logger.error(String.format(messages[MSG_SRID_MISMATCH], GeometryUtils.getWKID(geomref1), GeometryUtils.getWKID(geomref2)));
} | [
"public",
"static",
"void",
"Log_SRIDMismatch",
"(",
"Log",
"logger",
",",
"BytesWritable",
"geomref1",
",",
"BytesWritable",
"geomref2",
")",
"{",
"logger",
".",
"error",
"(",
"String",
".",
"format",
"(",
"messages",
"[",
"MSG_SRID_MISMATCH",
"]",
",",
"Geom... | Log when comparing geometries in different spatial references
@param logger
@param geomref1
@param geomref2 | [
"Log",
"when",
"comparing",
"geometries",
"in",
"different",
"spatial",
"references"
] | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/LogUtils.java#L45-L47 | train |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/GeometryUtils.java | GeometryUtils.getWKID | public static int getWKID(BytesWritable geomref){
ByteBuffer bb = ByteBuffer.wrap(geomref.getBytes());
return bb.getInt(0);
} | java | public static int getWKID(BytesWritable geomref){
ByteBuffer bb = ByteBuffer.wrap(geomref.getBytes());
return bb.getInt(0);
} | [
"public",
"static",
"int",
"getWKID",
"(",
"BytesWritable",
"geomref",
")",
"{",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"geomref",
".",
"getBytes",
"(",
")",
")",
";",
"return",
"bb",
".",
"getInt",
"(",
"0",
")",
";",
"}"
] | Gets the WKID for the given hive geometry bytes
@param geomref reference to hive geometry bytes
@return WKID set in the first 4 bytes of the hive geometry bytes | [
"Gets",
"the",
"WKID",
"for",
"the",
"given",
"hive",
"geometry",
"bytes"
] | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/GeometryUtils.java#L166-L169 | train |
Esri/spatial-framework-for-hadoop | json/src/main/java/com/esri/json/hadoop/UnenclosedEsriJsonRecordReader.java | UnenclosedEsriJsonRecordReader.moveToRecordStart | protected boolean moveToRecordStart() throws IOException {
int next = 0;
long resetPosition = readerPosition;
// The case of split point exactly at whitespace between records, is
// handled by forcing it to the split following, in the interest of
// better balancing the splits, by consuming the whitespace in... | java | protected boolean moveToRecordStart() throws IOException {
int next = 0;
long resetPosition = readerPosition;
// The case of split point exactly at whitespace between records, is
// handled by forcing it to the split following, in the interest of
// better balancing the splits, by consuming the whitespace in... | [
"protected",
"boolean",
"moveToRecordStart",
"(",
")",
"throws",
"IOException",
"{",
"int",
"next",
"=",
"0",
";",
"long",
"resetPosition",
"=",
"readerPosition",
";",
"// The case of split point exactly at whitespace between records, is",
"// handled by forcing it to the split... | Given an arbitrary byte offset into a unenclosed JSON document,
find the start of the next record in the document. Discard trailing
bytes from the previous record if we happened to seek to the middle
of it
Record boundary defined as : \{\s*"(attributes|geometry)"\s*:\s*\{
@throws IOException | [
"Given",
"an",
"arbitrary",
"byte",
"offset",
"into",
"a",
"unenclosed",
"JSON",
"document",
"find",
"the",
"start",
"of",
"the",
"next",
"record",
"in",
"the",
"document",
".",
"Discard",
"trailing",
"bytes",
"from",
"the",
"previous",
"record",
"if",
"we",... | 00959d6b4465313c934aaa8aaf17b52d6c9c60d4 | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/json/src/main/java/com/esri/json/hadoop/UnenclosedEsriJsonRecordReader.java#L51-L145 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/BAMRecordReader.java | BAMRecordReader.getProgress | @Override public float getProgress() throws IOException {
if (reachedEnd)
return 1;
else {
final long filePos = in.position();
final long fileEnd = virtualEnd >>> 16;
// Add 1 to the denominator to make sure it doesn't reach 1 here when
// filePos == fileEnd.
return (float)(filePos - fileStart) / ... | java | @Override public float getProgress() throws IOException {
if (reachedEnd)
return 1;
else {
final long filePos = in.position();
final long fileEnd = virtualEnd >>> 16;
// Add 1 to the denominator to make sure it doesn't reach 1 here when
// filePos == fileEnd.
return (float)(filePos - fileStart) / ... | [
"@",
"Override",
"public",
"float",
"getProgress",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"reachedEnd",
")",
"return",
"1",
";",
"else",
"{",
"final",
"long",
"filePos",
"=",
"in",
".",
"position",
"(",
")",
";",
"final",
"long",
"fileEnd",
... | Unless the end has been reached, this only takes file position into
account, not the position within the block. | [
"Unless",
"the",
"end",
"has",
"been",
"reached",
"this",
"only",
"takes",
"file",
"position",
"into",
"account",
"not",
"the",
"position",
"within",
"the",
"block",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BAMRecordReader.java#L212-L222 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/BGZFSplitGuesser.java | BGZFSplitGuesser.guessNextBGZFPos | private int guessNextBGZFPos(int p, int end)
throws IOException
{
for (;;) {
for (;;) {
in.seek(p);
in.read(buf.array(), 0, 4);
int n = buf.getInt(0);
if (n == BGZF_MAGIC)
break;
// Skip ahead a bit more than 1 byte if you can.
if (n >>> 8 == BGZF_MAGIC << 8 >>> 8)
++p;
e... | java | private int guessNextBGZFPos(int p, int end)
throws IOException
{
for (;;) {
for (;;) {
in.seek(p);
in.read(buf.array(), 0, 4);
int n = buf.getInt(0);
if (n == BGZF_MAGIC)
break;
// Skip ahead a bit more than 1 byte if you can.
if (n >>> 8 == BGZF_MAGIC << 8 >>> 8)
++p;
e... | [
"private",
"int",
"guessNextBGZFPos",
"(",
"int",
"p",
",",
"int",
"end",
")",
"throws",
"IOException",
"{",
"for",
"(",
";",
";",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"in",
".",
"seek",
"(",
"p",
")",
";",
"in",
".",
"read",
"(",
"buf",
... | Returns a negative number if it doesn't find anything. | [
"Returns",
"a",
"negative",
"number",
"if",
"it",
"doesn",
"t",
"find",
"anything",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/BGZFSplitGuesser.java#L115-L168 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/SAMFileMerger.java | SAMFileMerger.writeTerminatorBlock | private static void writeTerminatorBlock(final OutputStream out, final SAMFormat samOutputFormat) throws IOException {
if (SAMFormat.CRAM == samOutputFormat) {
CramIO.issueEOF(CramVersions.DEFAULT_CRAM_VERSION, out); // terminate with CRAM EOF container
} else if (SAMFormat.BAM == samOutputFormat) {
... | java | private static void writeTerminatorBlock(final OutputStream out, final SAMFormat samOutputFormat) throws IOException {
if (SAMFormat.CRAM == samOutputFormat) {
CramIO.issueEOF(CramVersions.DEFAULT_CRAM_VERSION, out); // terminate with CRAM EOF container
} else if (SAMFormat.BAM == samOutputFormat) {
... | [
"private",
"static",
"void",
"writeTerminatorBlock",
"(",
"final",
"OutputStream",
"out",
",",
"final",
"SAMFormat",
"samOutputFormat",
")",
"throws",
"IOException",
"{",
"if",
"(",
"SAMFormat",
".",
"CRAM",
"==",
"samOutputFormat",
")",
"{",
"CramIO",
".",
"iss... | Terminate the aggregated output stream with an appropriate SAMOutputFormat-dependent terminator block | [
"Terminate",
"the",
"aggregated",
"output",
"stream",
"with",
"an",
"appropriate",
"SAMOutputFormat",
"-",
"dependent",
"terminator",
"block"
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/SAMFileMerger.java#L96-L103 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java | BAMInputFormat.setIntervals | public static <T extends Locatable> void setIntervals(Configuration conf,
List<T> intervals) {
setTraversalParameters(conf, intervals, false);
} | java | public static <T extends Locatable> void setIntervals(Configuration conf,
List<T> intervals) {
setTraversalParameters(conf, intervals, false);
} | [
"public",
"static",
"<",
"T",
"extends",
"Locatable",
">",
"void",
"setIntervals",
"(",
"Configuration",
"conf",
",",
"List",
"<",
"T",
">",
"intervals",
")",
"{",
"setTraversalParameters",
"(",
"conf",
",",
"intervals",
",",
"false",
")",
";",
"}"
] | Only include reads that overlap the given intervals. Unplaced unmapped reads are not
included.
@param conf the Hadoop configuration to set properties on
@param intervals the intervals to filter by
@param <T> the {@link Locatable} type | [
"Only",
"include",
"reads",
"that",
"overlap",
"the",
"given",
"intervals",
".",
"Unplaced",
"unmapped",
"reads",
"are",
"not",
"included",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java#L127-L130 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java | BAMInputFormat.unsetTraversalParameters | public static void unsetTraversalParameters(Configuration conf) {
conf.unset(BOUNDED_TRAVERSAL_PROPERTY);
conf.unset(INTERVALS_PROPERTY);
conf.unset(TRAVERSE_UNPLACED_UNMAPPED_PROPERTY);
} | java | public static void unsetTraversalParameters(Configuration conf) {
conf.unset(BOUNDED_TRAVERSAL_PROPERTY);
conf.unset(INTERVALS_PROPERTY);
conf.unset(TRAVERSE_UNPLACED_UNMAPPED_PROPERTY);
} | [
"public",
"static",
"void",
"unsetTraversalParameters",
"(",
"Configuration",
"conf",
")",
"{",
"conf",
".",
"unset",
"(",
"BOUNDED_TRAVERSAL_PROPERTY",
")",
";",
"conf",
".",
"unset",
"(",
"INTERVALS_PROPERTY",
")",
";",
"conf",
".",
"unset",
"(",
"TRAVERSE_UNP... | Reset traversal parameters so that all reads are included.
@param conf the Hadoop configuration to set properties on | [
"Reset",
"traversal",
"parameters",
"so",
"that",
"all",
"reads",
"are",
"included",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java#L174-L178 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java | BAMInputFormat.prepareQueryIntervals | static QueryInterval[] prepareQueryIntervals( final List<Interval>
rawIntervals, final SAMSequenceDictionary sequenceDictionary ) {
if ( rawIntervals == null || rawIntervals.isEmpty() ) {
return null;
}
// Convert each SimpleInterval to a QueryInterval
final QueryInterval[] convertedIntervals =
rawIn... | java | static QueryInterval[] prepareQueryIntervals( final List<Interval>
rawIntervals, final SAMSequenceDictionary sequenceDictionary ) {
if ( rawIntervals == null || rawIntervals.isEmpty() ) {
return null;
}
// Convert each SimpleInterval to a QueryInterval
final QueryInterval[] convertedIntervals =
rawIn... | [
"static",
"QueryInterval",
"[",
"]",
"prepareQueryIntervals",
"(",
"final",
"List",
"<",
"Interval",
">",
"rawIntervals",
",",
"final",
"SAMSequenceDictionary",
"sequenceDictionary",
")",
"{",
"if",
"(",
"rawIntervals",
"==",
"null",
"||",
"rawIntervals",
".",
"is... | Converts a List of SimpleIntervals into the format required by the SamReader query API
@param rawIntervals SimpleIntervals to be converted
@return A sorted, merged list of QueryIntervals suitable for passing to the SamReader query API | [
"Converts",
"a",
"List",
"of",
"SimpleIntervals",
"into",
"the",
"format",
"required",
"by",
"the",
"SamReader",
"query",
"API"
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java#L651-L665 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java | BAMInputFormat.convertSimpleIntervalToQueryInterval | private static QueryInterval convertSimpleIntervalToQueryInterval( final Interval interval, final SAMSequenceDictionary sequenceDictionary ) {
if (interval == null) {
throw new IllegalArgumentException("interval may not be null");
}
if (sequenceDictionary == null) {
throw new IllegalArgumentException("seque... | java | private static QueryInterval convertSimpleIntervalToQueryInterval( final Interval interval, final SAMSequenceDictionary sequenceDictionary ) {
if (interval == null) {
throw new IllegalArgumentException("interval may not be null");
}
if (sequenceDictionary == null) {
throw new IllegalArgumentException("seque... | [
"private",
"static",
"QueryInterval",
"convertSimpleIntervalToQueryInterval",
"(",
"final",
"Interval",
"interval",
",",
"final",
"SAMSequenceDictionary",
"sequenceDictionary",
")",
"{",
"if",
"(",
"interval",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentExce... | Converts an interval in SimpleInterval format into an htsjdk QueryInterval.
In doing so, a header lookup is performed to convert from contig name to index
@param interval interval to convert
@param sequenceDictionary sequence dictionary used to perform the conversion
@return an equivalent interval in QueryInterval fo... | [
"Converts",
"an",
"interval",
"in",
"SimpleInterval",
"format",
"into",
"an",
"htsjdk",
"QueryInterval",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BAMInputFormat.java#L675-L690 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/SequencedFragment.java | SequencedFragment.convertQuality | public static void convertQuality(Text quality, BaseQualityEncoding current, BaseQualityEncoding target)
{
if (current == target)
throw new IllegalArgumentException("current and target quality encodinds are the same (" + current + ")");
byte[] bytes = quality.getBytes();
final int len = quality.getLength();
... | java | public static void convertQuality(Text quality, BaseQualityEncoding current, BaseQualityEncoding target)
{
if (current == target)
throw new IllegalArgumentException("current and target quality encodinds are the same (" + current + ")");
byte[] bytes = quality.getBytes();
final int len = quality.getLength();
... | [
"public",
"static",
"void",
"convertQuality",
"(",
"Text",
"quality",
",",
"BaseQualityEncoding",
"current",
",",
"BaseQualityEncoding",
"target",
")",
"{",
"if",
"(",
"current",
"==",
"target",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"current and ta... | Convert quality scores in-place.
@throws FormatException if quality scores are out of the range
allowed by the current encoding.
@throws IllegalArgumentException if current and target quality encodings are the same. | [
"Convert",
"quality",
"scores",
"in",
"-",
"place",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/SequencedFragment.java#L229-L268 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/SequencedFragment.java | SequencedFragment.verifyQuality | public static int verifyQuality(Text quality, BaseQualityEncoding encoding)
{
// set allowed quality range
int max, min;
if (encoding == BaseQualityEncoding.Illumina)
{
max = FormatConstants.ILLUMINA_OFFSET + FormatConstants.ILLUMINA_MAX;
min = FormatConstants.ILLUMINA_OFFSET;
}
else if (encoding ==... | java | public static int verifyQuality(Text quality, BaseQualityEncoding encoding)
{
// set allowed quality range
int max, min;
if (encoding == BaseQualityEncoding.Illumina)
{
max = FormatConstants.ILLUMINA_OFFSET + FormatConstants.ILLUMINA_MAX;
min = FormatConstants.ILLUMINA_OFFSET;
}
else if (encoding ==... | [
"public",
"static",
"int",
"verifyQuality",
"(",
"Text",
"quality",
",",
"BaseQualityEncoding",
"encoding",
")",
"{",
"// set allowed quality range",
"int",
"max",
",",
"min",
";",
"if",
"(",
"encoding",
"==",
"BaseQualityEncoding",
".",
"Illumina",
")",
"{",
"m... | Verify that the given quality bytes are within the range allowed for the specified encoding.
In theory, the Sanger encoding uses the entire
range of characters from ASCII 33 to 126, giving a value range of [0,93]. However, values over 60 are
unlikely in practice, and are more likely to be caused by mistaking a file t... | [
"Verify",
"that",
"the",
"given",
"quality",
"bytes",
"are",
"within",
"the",
"range",
"allowed",
"for",
"the",
"specified",
"encoding",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/SequencedFragment.java#L281-L309 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/BGZFBlockIndex.java | BGZFBlockIndex.main | public static void main(String[] args) {
if (args.length == 0) {
System.out.println(
"Usage: BGZFBlockIndex [BGZF block indices...]\n\n"+
"Writes a few statistics about each BGZF block index.");
return;
}
for (String arg : args) {
final File f = new File(arg);
if (f.isFile() && f.canRead()) ... | java | public static void main(String[] args) {
if (args.length == 0) {
System.out.println(
"Usage: BGZFBlockIndex [BGZF block indices...]\n\n"+
"Writes a few statistics about each BGZF block index.");
return;
}
for (String arg : args) {
final File f = new File(arg);
if (f.isFile() && f.canRead()) ... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Usage: BGZFBlockIndex [BGZF block indices...]\\n\\n\"",
"+",
"\"Writes a few sta... | Writes some statistics about each BGZF block index file given as an
argument. | [
"Writes",
"some",
"statistics",
"about",
"each",
"BGZF",
"block",
"index",
"file",
"given",
"as",
"an",
"argument",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/BGZFBlockIndex.java#L89-L120 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/CRAMRecordWriter.java | CRAMRecordWriter.init | private void init(
final Path output, final SAMFileHeader header, final boolean writeHeader,
final TaskAttemptContext ctx)
throws IOException
{
init(
output.getFileSystem(ctx.getConfiguration()).create(output),
header, writeHeader, ctx);
... | java | private void init(
final Path output, final SAMFileHeader header, final boolean writeHeader,
final TaskAttemptContext ctx)
throws IOException
{
init(
output.getFileSystem(ctx.getConfiguration()).create(output),
header, writeHeader, ctx);
... | [
"private",
"void",
"init",
"(",
"final",
"Path",
"output",
",",
"final",
"SAMFileHeader",
"header",
",",
"final",
"boolean",
"writeHeader",
",",
"final",
"TaskAttemptContext",
"ctx",
")",
"throws",
"IOException",
"{",
"init",
"(",
"output",
".",
"getFileSystem",... | first statement... | [
"first",
"statement",
"..."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/CRAMRecordWriter.java#L64-L72 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java | NIOFileUtil.getFilesMatching | static List<Path> getFilesMatching(Path directory,
String syntaxAndPattern, String excludesExt) throws IOException {
PathMatcher matcher = directory.getFileSystem().getPathMatcher(syntaxAndPattern);
List<Path> parts = Files.walk(directory)
.filter(matcher::matches)
.filter(path -> excludes... | java | static List<Path> getFilesMatching(Path directory,
String syntaxAndPattern, String excludesExt) throws IOException {
PathMatcher matcher = directory.getFileSystem().getPathMatcher(syntaxAndPattern);
List<Path> parts = Files.walk(directory)
.filter(matcher::matches)
.filter(path -> excludes... | [
"static",
"List",
"<",
"Path",
">",
"getFilesMatching",
"(",
"Path",
"directory",
",",
"String",
"syntaxAndPattern",
",",
"String",
"excludesExt",
")",
"throws",
"IOException",
"{",
"PathMatcher",
"matcher",
"=",
"directory",
".",
"getFileSystem",
"(",
")",
".",... | Returns all the files in a directory that match the given pattern, and that don't
have the given extension.
@param directory the directory to look for files in, subdirectories are not
considered
@param syntaxAndPattern the syntax and pattern to use for matching (see
{@link java.nio.file.FileSystem#getPathMatcher}
@para... | [
"Returns",
"all",
"the",
"files",
"in",
"a",
"directory",
"that",
"match",
"the",
"given",
"pattern",
"and",
"that",
"don",
"t",
"have",
"the",
"given",
"extension",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java#L88-L97 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java | NIOFileUtil.mergeInto | static void mergeInto(List<Path> parts, OutputStream out)
throws IOException {
for (final Path part : parts) {
Files.copy(part, out);
Files.delete(part);
}
} | java | static void mergeInto(List<Path> parts, OutputStream out)
throws IOException {
for (final Path part : parts) {
Files.copy(part, out);
Files.delete(part);
}
} | [
"static",
"void",
"mergeInto",
"(",
"List",
"<",
"Path",
">",
"parts",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"Path",
"part",
":",
"parts",
")",
"{",
"Files",
".",
"copy",
"(",
"part",
",",
"out",
")",
";"... | Merge the given part files in order into an output stream.
This deletes the parts.
@param parts the part files to merge
@param out the stream to write each file into, in order
@throws IOException | [
"Merge",
"the",
"given",
"part",
"files",
"in",
"order",
"into",
"an",
"output",
"stream",
".",
"This",
"deletes",
"the",
"parts",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/NIOFileUtil.java#L106-L112 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/BGZFSplitFileInputFormat.java | BGZFSplitFileInputFormat.getSplits | @Override public List<InputSplit> getSplits(JobContext job)
throws IOException
{
final List<InputSplit> splits = super.getSplits(job);
// Align the splits so that they don't cross blocks
// addIndexedSplits() requires the given splits to be sorted by file
// path, so do so. Although FileInputFormat.getSpli... | java | @Override public List<InputSplit> getSplits(JobContext job)
throws IOException
{
final List<InputSplit> splits = super.getSplits(job);
// Align the splits so that they don't cross blocks
// addIndexedSplits() requires the given splits to be sorted by file
// path, so do so. Although FileInputFormat.getSpli... | [
"@",
"Override",
"public",
"List",
"<",
"InputSplit",
">",
"getSplits",
"(",
"JobContext",
"job",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"InputSplit",
">",
"splits",
"=",
"super",
".",
"getSplits",
"(",
"job",
")",
";",
"// Align the splits... | The splits returned are FileSplits. | [
"The",
"splits",
"returned",
"are",
"FileSplits",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/BGZFSplitFileInputFormat.java#L51-L81 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/WrapSeekable.java | WrapSeekable.openPath | public static WrapSeekable<FSDataInputStream> openPath(
FileSystem fs, Path p) throws IOException
{
return new WrapSeekable<FSDataInputStream>(
fs.open(p), fs.getFileStatus(p).getLen(), p);
} | java | public static WrapSeekable<FSDataInputStream> openPath(
FileSystem fs, Path p) throws IOException
{
return new WrapSeekable<FSDataInputStream>(
fs.open(p), fs.getFileStatus(p).getLen(), p);
} | [
"public",
"static",
"WrapSeekable",
"<",
"FSDataInputStream",
">",
"openPath",
"(",
"FileSystem",
"fs",
",",
"Path",
"p",
")",
"throws",
"IOException",
"{",
"return",
"new",
"WrapSeekable",
"<",
"FSDataInputStream",
">",
"(",
"fs",
".",
"open",
"(",
"p",
")"... | A helper for the common use case. | [
"A",
"helper",
"for",
"the",
"common",
"use",
"case",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/WrapSeekable.java#L56-L61 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/SAMHeaderReader.java | SAMHeaderReader.readSAMHeaderFrom | public static SAMFileHeader readSAMHeaderFrom(
final InputStream in, final Configuration conf)
{
final ValidationStringency
stringency = getValidationStringency(conf);
SamReaderFactory readerFactory = SamReaderFactory.makeDefault()
.setOption(SamReaderFactory.Option.EAGERLY_DECODE, false)
.setUseAsync... | java | public static SAMFileHeader readSAMHeaderFrom(
final InputStream in, final Configuration conf)
{
final ValidationStringency
stringency = getValidationStringency(conf);
SamReaderFactory readerFactory = SamReaderFactory.makeDefault()
.setOption(SamReaderFactory.Option.EAGERLY_DECODE, false)
.setUseAsync... | [
"public",
"static",
"SAMFileHeader",
"readSAMHeaderFrom",
"(",
"final",
"InputStream",
"in",
",",
"final",
"Configuration",
"conf",
")",
"{",
"final",
"ValidationStringency",
"stringency",
"=",
"getValidationStringency",
"(",
"conf",
")",
";",
"SamReaderFactory",
"rea... | Does not close the stream. | [
"Does",
"not",
"close",
"the",
"stream",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/SAMHeaderReader.java#L58-L75 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/LineReader.java | LineReader.skip | public long skip(long n) throws IOException
{
boolean end = false;
long toskip = n;
while (toskip > 0 && !end)
{
if (bufferPosn < bufferLength)
{
int skipped = (int)Math.min(bufferLength - bufferPosn, toskip);
bufferPosn += skipped;
toskip -= skipped;
}
if (bufferPosn >= bufferLength)
... | java | public long skip(long n) throws IOException
{
boolean end = false;
long toskip = n;
while (toskip > 0 && !end)
{
if (bufferPosn < bufferLength)
{
int skipped = (int)Math.min(bufferLength - bufferPosn, toskip);
bufferPosn += skipped;
toskip -= skipped;
}
if (bufferPosn >= bufferLength)
... | [
"public",
"long",
"skip",
"(",
"long",
"n",
")",
"throws",
"IOException",
"{",
"boolean",
"end",
"=",
"false",
";",
"long",
"toskip",
"=",
"n",
";",
"while",
"(",
"toskip",
">",
"0",
"&&",
"!",
"end",
")",
"{",
"if",
"(",
"bufferPosn",
"<",
"buffer... | Skip n bytes from the InputStream.
@param n the number of bytes to skip.
@return the number of bytes skipped.
@throws IOException if the underlying stream throws. | [
"Skip",
"n",
"bytes",
"from",
"the",
"InputStream",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/LineReader.java#L202-L221 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/BCFRecordReader.java | BCFRecordReader.getProgress | @Override public float getProgress() {
if (length == 0)
return 1;
if (!isBGZF)
return (float)(in.getPosition() - fileStart) / length;
try {
if (in.peek() == -1)
return 1;
} catch (IOException e) {
return 1;
}
// Add 1 to the denominator to make sure that we never report 1 here.
return (... | java | @Override public float getProgress() {
if (length == 0)
return 1;
if (!isBGZF)
return (float)(in.getPosition() - fileStart) / length;
try {
if (in.peek() == -1)
return 1;
} catch (IOException e) {
return 1;
}
// Add 1 to the denominator to make sure that we never report 1 here.
return (... | [
"@",
"Override",
"public",
"float",
"getProgress",
"(",
")",
"{",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"1",
";",
"if",
"(",
"!",
"isBGZF",
")",
"return",
"(",
"float",
")",
"(",
"in",
".",
"getPosition",
"(",
")",
"-",
"fileStart",
")",
... | For compressed BCF, unless the end has been reached, this is quite
inaccurate. | [
"For",
"compressed",
"BCF",
"unless",
"the",
"end",
"has",
"been",
"reached",
"this",
"is",
"quite",
"inaccurate",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/BCFRecordReader.java#L137-L153 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndexer.java | SplittingBAMIndexer.processAlignment | public void processAlignment(final SAMRecord rec) throws IOException {
// write an offset for the first record and for the g-th record thereafter (where
// g is the granularity), to be consistent with the index method
if (count == 0 || (count + 1) % granularity == 0) {
SAMFileSource fileSource = rec.getFileSou... | java | public void processAlignment(final SAMRecord rec) throws IOException {
// write an offset for the first record and for the g-th record thereafter (where
// g is the granularity), to be consistent with the index method
if (count == 0 || (count + 1) % granularity == 0) {
SAMFileSource fileSource = rec.getFileSou... | [
"public",
"void",
"processAlignment",
"(",
"final",
"SAMRecord",
"rec",
")",
"throws",
"IOException",
"{",
"// write an offset for the first record and for the g-th record thereafter (where",
"// g is the granularity), to be consistent with the index method",
"if",
"(",
"count",
"=="... | Process the given record for the index.
@param rec the record from the file being indexed
@throws IOException | [
"Process",
"the",
"given",
"record",
"for",
"the",
"index",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndexer.java#L170-L179 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndexer.java | SplittingBAMIndexer.writeVirtualOffset | public void writeVirtualOffset(long virtualOffset) throws IOException {
lb.put(0, virtualOffset);
out.write(byteBuffer.array());
} | java | public void writeVirtualOffset(long virtualOffset) throws IOException {
lb.put(0, virtualOffset);
out.write(byteBuffer.array());
} | [
"public",
"void",
"writeVirtualOffset",
"(",
"long",
"virtualOffset",
")",
"throws",
"IOException",
"{",
"lb",
".",
"put",
"(",
"0",
",",
"virtualOffset",
")",
";",
"out",
".",
"write",
"(",
"byteBuffer",
".",
"array",
"(",
")",
")",
";",
"}"
] | Write the given virtual offset to the index. This method is for internal use only.
@param virtualOffset virtual file pointer
@throws IOException | [
"Write",
"the",
"given",
"virtual",
"offset",
"to",
"the",
"index",
".",
"This",
"method",
"is",
"for",
"internal",
"use",
"only",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndexer.java#L213-L216 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndexer.java | SplittingBAMIndexer.index | public static void index(
final InputStream rawIn, final OutputStream out, final long inputSize,
final int granularity)
throws IOException
{
final BlockCompressedInputStream in =
new BlockCompressedInputStream(rawIn);
final ByteBuffer byteBuffer = ByteBuffer.allocate(8); // Enough to fit a long
final... | java | public static void index(
final InputStream rawIn, final OutputStream out, final long inputSize,
final int granularity)
throws IOException
{
final BlockCompressedInputStream in =
new BlockCompressedInputStream(rawIn);
final ByteBuffer byteBuffer = ByteBuffer.allocate(8); // Enough to fit a long
final... | [
"public",
"static",
"void",
"index",
"(",
"final",
"InputStream",
"rawIn",
",",
"final",
"OutputStream",
"out",
",",
"final",
"long",
"inputSize",
",",
"final",
"int",
"granularity",
")",
"throws",
"IOException",
"{",
"final",
"BlockCompressedInputStream",
"in",
... | Perform indexing on the given BAM file, at the granularity level specified. | [
"Perform",
"indexing",
"on",
"the",
"given",
"BAM",
"file",
"at",
"the",
"granularity",
"level",
"specified",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndexer.java#L232-L274 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/IntervalUtil.java | IntervalUtil.getIntervals | public static List<Interval> getIntervals(final Configuration conf, final String intervalPropertyName) {
final String intervalsProperty = conf.get(intervalPropertyName);
if (intervalsProperty == null) {
return null;
}
if (intervalsProperty.isEmpty()) {
return Immu... | java | public static List<Interval> getIntervals(final Configuration conf, final String intervalPropertyName) {
final String intervalsProperty = conf.get(intervalPropertyName);
if (intervalsProperty == null) {
return null;
}
if (intervalsProperty.isEmpty()) {
return Immu... | [
"public",
"static",
"List",
"<",
"Interval",
">",
"getIntervals",
"(",
"final",
"Configuration",
"conf",
",",
"final",
"String",
"intervalPropertyName",
")",
"{",
"final",
"String",
"intervalsProperty",
"=",
"conf",
".",
"get",
"(",
"intervalPropertyName",
")",
... | Returns the list of intervals found in a string configuration property separated by colons.
@param conf the source configuration.
@param intervalPropertyName the property name holding the intervals.
@return {@code null} if there is no such a property in the configuration.
@throws NullPointerException if either input is... | [
"Returns",
"the",
"list",
"of",
"intervals",
"found",
"in",
"a",
"string",
"configuration",
"property",
"separated",
"by",
"colons",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/IntervalUtil.java#L27-L53 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/FileVirtualSplit.java | FileVirtualSplit.getLength | @Override public long getLength() {
final long vsHi = vStart & ~0xffff;
final long veHi = vEnd & ~0xffff;
final long hiDiff = veHi - vsHi;
return hiDiff == 0 ? ((vEnd & 0xffff) - (vStart & 0xffff)) : hiDiff;
} | java | @Override public long getLength() {
final long vsHi = vStart & ~0xffff;
final long veHi = vEnd & ~0xffff;
final long hiDiff = veHi - vsHi;
return hiDiff == 0 ? ((vEnd & 0xffff) - (vStart & 0xffff)) : hiDiff;
} | [
"@",
"Override",
"public",
"long",
"getLength",
"(",
")",
"{",
"final",
"long",
"vsHi",
"=",
"vStart",
"&",
"~",
"0xffff",
";",
"final",
"long",
"veHi",
"=",
"vEnd",
"&",
"~",
"0xffff",
";",
"final",
"long",
"hiDiff",
"=",
"veHi",
"-",
"vsHi",
";",
... | Inexact due to the nature of virtual offsets.
We can't know how many blocks there are in between two file offsets, nor
how large those blocks are. So this uses only the difference between the
file offsets—unless that difference is zero, in which case the split is
wholly contained in one block and thus we can give an e... | [
"Inexact",
"due",
"to",
"the",
"nature",
"of",
"virtual",
"offsets",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/FileVirtualSplit.java#L73-L78 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/VCFInputFormat.java | VCFInputFormat.fixBCFSplits | private void fixBCFSplits(
List<FileSplit> splits, List<InputSplit> newSplits)
throws IOException
{
// addGuessedSplits() requires the given splits to be sorted by file
// path, so do so. Although FileInputFormat.getSplits() does, at the time
// of writing this, generate them in that order, we shouldn't rel... | java | private void fixBCFSplits(
List<FileSplit> splits, List<InputSplit> newSplits)
throws IOException
{
// addGuessedSplits() requires the given splits to be sorted by file
// path, so do so. Although FileInputFormat.getSplits() does, at the time
// of writing this, generate them in that order, we shouldn't rel... | [
"private",
"void",
"fixBCFSplits",
"(",
"List",
"<",
"FileSplit",
">",
"splits",
",",
"List",
"<",
"InputSplit",
">",
"newSplits",
")",
"throws",
"IOException",
"{",
"// addGuessedSplits() requires the given splits to be sorted by file",
"// path, so do so. Although FileInput... | FileVirtualSplits, uncompressed in FileSplits. | [
"FileVirtualSplits",
"uncompressed",
"in",
"FileSplits",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/VCFInputFormat.java#L303-L318 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/util/ConfHelper.java | ConfHelper.parseBoolean | public static boolean parseBoolean(String value, boolean defaultValue)
{
if (value == null)
return defaultValue;
value = value.trim();
// any of the following will
final String[] acceptedTrue = new String[]{ "yes", "true", "t", "y", "1" };
final String[] acceptedFalse = new String[]{ "no", "false", "f"... | java | public static boolean parseBoolean(String value, boolean defaultValue)
{
if (value == null)
return defaultValue;
value = value.trim();
// any of the following will
final String[] acceptedTrue = new String[]{ "yes", "true", "t", "y", "1" };
final String[] acceptedFalse = new String[]{ "no", "false", "f"... | [
"public",
"static",
"boolean",
"parseBoolean",
"(",
"String",
"value",
",",
"boolean",
"defaultValue",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"defaultValue",
";",
"value",
"=",
"value",
".",
"trim",
"(",
")",
";",
"// any of the following... | Convert a string to a boolean.
Accepted values: "yes", "true", "t", "y", "1"
"no", "false", "f", "n", "0"
All comparisons are case insensitive.
If the value provided is null, defaultValue is returned.
@exception IllegalArgumentException Thrown if value is not
null and doesn't match any of the accepted strings. | [
"Convert",
"a",
"string",
"to",
"a",
"boolean",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/ConfHelper.java#L41-L64 | train |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndex.java | SplittingBAMIndex.main | public static void main(String[] args) {
if (args.length == 0) {
System.out.println(
"Usage: SplittingBAMIndex [splitting BAM indices...]\n\n"+
"Writes a few statistics about each splitting BAM index.");
return;
}
for (String arg : args) {
final File f = new File(arg);
if (f.isFile() && f.ca... | java | public static void main(String[] args) {
if (args.length == 0) {
System.out.println(
"Usage: SplittingBAMIndex [splitting BAM indices...]\n\n"+
"Writes a few statistics about each splitting BAM index.");
return;
}
for (String arg : args) {
final File f = new File(arg);
if (f.isFile() && f.ca... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Usage: SplittingBAMIndex [splitting BAM indices...]\\n\\n\"",
"+",
"\"Writes a f... | Writes some statistics about each splitting BAM index file given as an
argument. | [
"Writes",
"some",
"statistics",
"about",
"each",
"splitting",
"BAM",
"index",
"file",
"given",
"as",
"an",
"argument",
"."
] | 9f974cf635a8d72f69604021cc3d5f3469d38d2f | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/SplittingBAMIndex.java#L116-L154 | train |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/network/RaygunNetworkLogger.java | RaygunNetworkLogger.cancelNetworkCall | public static synchronized void cancelNetworkCall(String url, String requestMethod, long endTime, String exception) {
if (url != null) {
String id = sanitiseURL(url);
if ((connections != null) && (connections.containsKey(id))) {
connections.remove(id);
}
}
} | java | public static synchronized void cancelNetworkCall(String url, String requestMethod, long endTime, String exception) {
if (url != null) {
String id = sanitiseURL(url);
if ((connections != null) && (connections.containsKey(id))) {
connections.remove(id);
}
}
} | [
"public",
"static",
"synchronized",
"void",
"cancelNetworkCall",
"(",
"String",
"url",
",",
"String",
"requestMethod",
",",
"long",
"endTime",
",",
"String",
"exception",
")",
"{",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"String",
"id",
"=",
"sanitiseURL",... | When a network request is cancelled we stop tracking it and do not send the information through.
Future updates may include sending the cancelled request timing through with information showing it was cancelled. | [
"When",
"a",
"network",
"request",
"is",
"cancelled",
"we",
"stop",
"tracking",
"it",
"and",
"do",
"not",
"send",
"the",
"information",
"through",
".",
"Future",
"updates",
"may",
"include",
"sending",
"the",
"cancelled",
"request",
"timing",
"through",
"with"... | 227231f9b8aca1cafa5b6518a388d128e37d35fe | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/network/RaygunNetworkLogger.java#L61-L68 | train |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/services/RUMPostService.java | RUMPostService.postRUM | private static int postRUM(String apiKey, String jsonPayload) {
try {
if (validateApiKey(apiKey)) {
String endpoint = RaygunSettings.getRUMEndpoint();
MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient.Builder()
... | java | private static int postRUM(String apiKey, String jsonPayload) {
try {
if (validateApiKey(apiKey)) {
String endpoint = RaygunSettings.getRUMEndpoint();
MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient.Builder()
... | [
"private",
"static",
"int",
"postRUM",
"(",
"String",
"apiKey",
",",
"String",
"jsonPayload",
")",
"{",
"try",
"{",
"if",
"(",
"validateApiKey",
"(",
"apiKey",
")",
")",
"{",
"String",
"endpoint",
"=",
"RaygunSettings",
".",
"getRUMEndpoint",
"(",
")",
";"... | Raw post method that delivers a pre-built RUM payload to the Raygun API.
@param apiKey The API key of the app to deliver to
@param jsonPayload The JSON representation of a ??? to be delivered over HTTPS.
@return HTTP result code - 202 if successful, 403 if API key invalid, 400 if bad message (invalid properties) | [
"Raw",
"post",
"method",
"that",
"delivers",
"a",
"pre",
"-",
"built",
"RUM",
"payload",
"to",
"the",
"Raygun",
"API",
"."
] | 227231f9b8aca1cafa5b6518a388d128e37d35fe | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/services/RUMPostService.java#L63-L101 | train |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java | RaygunClient.init | public static void init(Context context) {
String apiKey = readApiKey(context);
init(context, apiKey);
} | java | public static void init(Context context) {
String apiKey = readApiKey(context);
init(context, apiKey);
} | [
"public",
"static",
"void",
"init",
"(",
"Context",
"context",
")",
"{",
"String",
"apiKey",
"=",
"readApiKey",
"(",
"context",
")",
";",
"init",
"(",
"context",
",",
"apiKey",
")",
";",
"}"
] | Initializes the Raygun client. This expects that you have placed the API key in your
AndroidManifest.xml, in a meta-data element.
@param context The context of the calling Android activity. | [
"Initializes",
"the",
"Raygun",
"client",
".",
"This",
"expects",
"that",
"you",
"have",
"placed",
"the",
"API",
"key",
"in",
"your",
"AndroidManifest",
".",
"xml",
"in",
"a",
"meta",
"-",
"data",
"element",
"."
] | 227231f9b8aca1cafa5b6518a388d128e37d35fe | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java#L64-L67 | train |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java | RaygunClient.init | public static void init(Context context, String apiKey) {
RaygunClient.apiKey = apiKey;
RaygunClient.context = context;
RaygunClient.appContextIdentifier = UUID.randomUUID().toString();
RaygunLogger.d("Configuring Raygun (v"+RaygunSettings.RAYGUN_CLIENT_VERSION+")");
try {
RaygunClient.versi... | java | public static void init(Context context, String apiKey) {
RaygunClient.apiKey = apiKey;
RaygunClient.context = context;
RaygunClient.appContextIdentifier = UUID.randomUUID().toString();
RaygunLogger.d("Configuring Raygun (v"+RaygunSettings.RAYGUN_CLIENT_VERSION+")");
try {
RaygunClient.versi... | [
"public",
"static",
"void",
"init",
"(",
"Context",
"context",
",",
"String",
"apiKey",
")",
"{",
"RaygunClient",
".",
"apiKey",
"=",
"apiKey",
";",
"RaygunClient",
".",
"context",
"=",
"context",
";",
"RaygunClient",
".",
"appContextIdentifier",
"=",
"UUID",
... | Initializes the Raygun client with your Android application's context and your
Raygun API key. The version transmitted will be the value of the versionName attribute in your manifest element.
@param context The Android context of your activity
@param apiKey An API key that belongs to a Raygun application created in you... | [
"Initializes",
"the",
"Raygun",
"client",
"with",
"your",
"Android",
"application",
"s",
"context",
"and",
"your",
"Raygun",
"API",
"key",
".",
"The",
"version",
"transmitted",
"will",
"be",
"the",
"value",
"of",
"the",
"versionName",
"attribute",
"in",
"your"... | 227231f9b8aca1cafa5b6518a388d128e37d35fe | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java#L100-L113 | train |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java | RaygunClient.init | public static void init(Context context, String apiKey, String version) {
init(context, apiKey);
RaygunClient.version = version;
} | java | public static void init(Context context, String apiKey, String version) {
init(context, apiKey);
RaygunClient.version = version;
} | [
"public",
"static",
"void",
"init",
"(",
"Context",
"context",
",",
"String",
"apiKey",
",",
"String",
"version",
")",
"{",
"init",
"(",
"context",
",",
"apiKey",
")",
";",
"RaygunClient",
".",
"version",
"=",
"version",
";",
"}"
] | Initializes the Raygun client with your Android application's context, your
Raygun API key, and the version of your application
@param context The Android context of your activity
@param apiKey An API key that belongs to a Raygun application created in your dashboard
@param version The version of your application, form... | [
"Initializes",
"the",
"Raygun",
"client",
"with",
"your",
"Android",
"application",
"s",
"context",
"your",
"Raygun",
"API",
"key",
"and",
"the",
"version",
"of",
"your",
"application"
] | 227231f9b8aca1cafa5b6518a388d128e37d35fe | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java#L129-L132 | train |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java | RaygunClient.send | public static void send(Throwable throwable, List tags, Map userCustomData) {
RaygunMessage msg = buildMessage(throwable);
if (msg == null) {
RaygunLogger.e("Failed to send RaygunMessage - due to invalid message being built");
return;
}
msg.getDetails().setTags(RaygunUtils.mergeLists(Raygu... | java | public static void send(Throwable throwable, List tags, Map userCustomData) {
RaygunMessage msg = buildMessage(throwable);
if (msg == null) {
RaygunLogger.e("Failed to send RaygunMessage - due to invalid message being built");
return;
}
msg.getDetails().setTags(RaygunUtils.mergeLists(Raygu... | [
"public",
"static",
"void",
"send",
"(",
"Throwable",
"throwable",
",",
"List",
"tags",
",",
"Map",
"userCustomData",
")",
"{",
"RaygunMessage",
"msg",
"=",
"buildMessage",
"(",
"throwable",
")",
";",
"if",
"(",
"msg",
"==",
"null",
")",
"{",
"RaygunLogger... | Sends an exception-type object to Raygun with a list of tags you specify, and a set of
custom data.
@param throwable The Throwable object that occurred in your application that will be sent to Raygun.
@param tags A list of data that will be attached to the Raygun message and visible on the error in the dashboard.
This ... | [
"Sends",
"an",
"exception",
"-",
"type",
"object",
"to",
"Raygun",
"with",
"a",
"list",
"of",
"tags",
"you",
"specify",
"and",
"a",
"set",
"of",
"custom",
"data",
"."
] | 227231f9b8aca1cafa5b6518a388d128e37d35fe | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java#L365-L385 | train |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java | RaygunClient.sendPulseTimingEvent | public static void sendPulseTimingEvent(RaygunPulseEventType eventType, String name, long milliseconds) {
if (RaygunClient.sessionId == null) {
sendPulseEvent(RaygunSettings.RUM_EVENT_SESSION_START);
}
if (eventType == RaygunPulseEventType.ACTIVITY_LOADED) {
if (RaygunClient.shouldIgnoreView(na... | java | public static void sendPulseTimingEvent(RaygunPulseEventType eventType, String name, long milliseconds) {
if (RaygunClient.sessionId == null) {
sendPulseEvent(RaygunSettings.RUM_EVENT_SESSION_START);
}
if (eventType == RaygunPulseEventType.ACTIVITY_LOADED) {
if (RaygunClient.shouldIgnoreView(na... | [
"public",
"static",
"void",
"sendPulseTimingEvent",
"(",
"RaygunPulseEventType",
"eventType",
",",
"String",
"name",
",",
"long",
"milliseconds",
")",
"{",
"if",
"(",
"RaygunClient",
".",
"sessionId",
"==",
"null",
")",
"{",
"sendPulseEvent",
"(",
"RaygunSettings"... | Sends a pulse timing event to Raygun. The message is sent on a background thread.
@param eventType The type of event that occurred.
@param name The name of the event resource such as the activity name or URL of a network call.
@param milliseconds The duration of the event in milliseconds. | [
"Sends",
"a",
"pulse",
"timing",
"event",
"to",
"Raygun",
".",
"The",
"message",
"is",
"sent",
"on",
"a",
"background",
"thread",
"."
] | 227231f9b8aca1cafa5b6518a388d128e37d35fe | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/RaygunClient.java#L492-L544 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java | ConverterRegistry.register | public static <T extends Tag, V> void register(Class<T> tag, Class<V> type, TagConverter<T, V> converter) throws ConverterRegisterException {
if(tagToConverter.containsKey(tag)) {
throw new ConverterRegisterException("Type conversion to tag " + tag.getName() + " is already registered.");
}
... | java | public static <T extends Tag, V> void register(Class<T> tag, Class<V> type, TagConverter<T, V> converter) throws ConverterRegisterException {
if(tagToConverter.containsKey(tag)) {
throw new ConverterRegisterException("Type conversion to tag " + tag.getName() + " is already registered.");
}
... | [
"public",
"static",
"<",
"T",
"extends",
"Tag",
",",
"V",
">",
"void",
"register",
"(",
"Class",
"<",
"T",
">",
"tag",
",",
"Class",
"<",
"V",
">",
"type",
",",
"TagConverter",
"<",
"T",
",",
"V",
">",
"converter",
")",
"throws",
"ConverterRegisterEx... | Registers a converter.
@param <T> Tag type to convert from.
@param <V> Value type to convert to.
@param tag Tag type class to register the converter to.
@param type Value type class to register the converter to.
@param converter Converter to register.
@throws ConverterRegisterException If an err... | [
"Registers",
"a",
"converter",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java#L68-L79 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java | ConverterRegistry.unregister | public static <T extends Tag, V> void unregister(Class<T> tag, Class<V> type) {
tagToConverter.remove(tag);
typeToConverter.remove(type);
} | java | public static <T extends Tag, V> void unregister(Class<T> tag, Class<V> type) {
tagToConverter.remove(tag);
typeToConverter.remove(type);
} | [
"public",
"static",
"<",
"T",
"extends",
"Tag",
",",
"V",
">",
"void",
"unregister",
"(",
"Class",
"<",
"T",
">",
"tag",
",",
"Class",
"<",
"V",
">",
"type",
")",
"{",
"tagToConverter",
".",
"remove",
"(",
"tag",
")",
";",
"typeToConverter",
".",
"... | Unregisters a converter.
@param <T> Tag type to unregister.
@param <V> Value type to unregister.
@param tag Tag type class to unregister.
@param type Value type class to unregister. | [
"Unregisters",
"a",
"converter",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java#L89-L92 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java | ConverterRegistry.convertToValue | public static <T extends Tag, V> V convertToValue(T tag) throws ConversionException {
if(tag == null || tag.getValue() == null) {
return null;
}
if(!tagToConverter.containsKey(tag.getClass())) {
throw new ConversionException("Tag type " + tag.getClass().getName() + " has... | java | public static <T extends Tag, V> V convertToValue(T tag) throws ConversionException {
if(tag == null || tag.getValue() == null) {
return null;
}
if(!tagToConverter.containsKey(tag.getClass())) {
throw new ConversionException("Tag type " + tag.getClass().getName() + " has... | [
"public",
"static",
"<",
"T",
"extends",
"Tag",
",",
"V",
">",
"V",
"convertToValue",
"(",
"T",
"tag",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"tag",
"==",
"null",
"||",
"tag",
".",
"getValue",
"(",
")",
"==",
"null",
")",
"{",
"return"... | Converts the given tag to a value.
@param <T> Tag type to convert from.
@param <V> Value type to convert to.
@param tag Tag to convert.
@return The converted value.
@throws ConversionException If a suitable converter could not be found. | [
"Converts",
"the",
"given",
"tag",
"to",
"a",
"value",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java#L103-L114 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java | ConverterRegistry.convertToTag | public static <V, T extends Tag> T convertToTag(String name, V value) throws ConversionException {
if(value == null) {
return null;
}
TagConverter<T, V> converter = (TagConverter<T, V>) typeToConverter.get(value.getClass());
if(converter == null) {
for(Class<?> c... | java | public static <V, T extends Tag> T convertToTag(String name, V value) throws ConversionException {
if(value == null) {
return null;
}
TagConverter<T, V> converter = (TagConverter<T, V>) typeToConverter.get(value.getClass());
if(converter == null) {
for(Class<?> c... | [
"public",
"static",
"<",
"V",
",",
"T",
"extends",
"Tag",
">",
"T",
"convertToTag",
"(",
"String",
"name",
",",
"V",
"value",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"TagConvert... | Converts the given value to a tag.
@param <V> Value type to convert from.
@param <T> Tag type to convert to.
@param name Name of the resulting tag.
@param value Value to convert.
@return The converted tag.
@throws ConversionException If a suitable converter could not be found. | [
"Converts",
"the",
"given",
"value",
"to",
"a",
"tag",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/conversion/ConverterRegistry.java#L126-L149 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/NBTIO.java | NBTIO.writeTag | public static void writeTag(OutputStream out, Tag tag) throws IOException {
writeTag(out, tag, false);
} | java | public static void writeTag(OutputStream out, Tag tag) throws IOException {
writeTag(out, tag, false);
} | [
"public",
"static",
"void",
"writeTag",
"(",
"OutputStream",
"out",
",",
"Tag",
"tag",
")",
"throws",
"IOException",
"{",
"writeTag",
"(",
"out",
",",
"tag",
",",
"false",
")",
";",
"}"
] | Writes an NBT tag in big endian.
@param out Output stream to write to.
@param tag Tag to write.
@throws java.io.IOException If an I/O error occurs. | [
"Writes",
"an",
"NBT",
"tag",
"in",
"big",
"endian",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/NBTIO.java#L204-L206 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java | ListTag.setValue | public void setValue(List<Tag> value) throws IllegalArgumentException {
this.type = null;
this.value.clear();
for(Tag tag : value) {
this.add(tag);
}
} | java | public void setValue(List<Tag> value) throws IllegalArgumentException {
this.type = null;
this.value.clear();
for(Tag tag : value) {
this.add(tag);
}
} | [
"public",
"void",
"setValue",
"(",
"List",
"<",
"Tag",
">",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"this",
".",
"type",
"=",
"null",
";",
"this",
".",
"value",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Tag",
"tag",
":",
"value",
")"... | Sets the value of this tag.
The list tag's type will be set to that of the first tag being added, or null if the given list is empty.
@param value New value of this tag.
@throws IllegalArgumentException If all tags in the list are not of the same type. | [
"Sets",
"the",
"value",
"of",
"this",
"tag",
".",
"The",
"list",
"tag",
"s",
"type",
"will",
"be",
"set",
"to",
"that",
"of",
"the",
"first",
"tag",
"being",
"added",
"or",
"null",
"if",
"the",
"given",
"list",
"is",
"empty",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java#L70-L77 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java | ListTag.add | public boolean add(Tag tag) throws IllegalArgumentException {
if(tag == null) {
return false;
}
// If empty list, use this as tag type.
if(this.type == null) {
this.type = tag.getClass();
} else if(tag.getClass() != this.type) {
throw new Ille... | java | public boolean add(Tag tag) throws IllegalArgumentException {
if(tag == null) {
return false;
}
// If empty list, use this as tag type.
if(this.type == null) {
this.type = tag.getClass();
} else if(tag.getClass() != this.type) {
throw new Ille... | [
"public",
"boolean",
"add",
"(",
"Tag",
"tag",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// If empty list, use this as tag type.",
"if",
"(",
"this",
".",
"type",
"==",
"null",
")"... | Adds a tag to this list tag.
If the list does not yet have a type, it will be set to the type of the tag being added.
@param tag Tag to add. Should not be null.
@return If the list was changed as a result.
@throws IllegalArgumentException If the tag's type differs from the list tag's type. | [
"Adds",
"a",
"tag",
"to",
"this",
"list",
"tag",
".",
"If",
"the",
"list",
"does",
"not",
"yet",
"have",
"a",
"type",
"it",
"will",
"be",
"set",
"to",
"the",
"type",
"of",
"the",
"tag",
"being",
"added",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java#L96-L109 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java | CompoundTag.setValue | public void setValue(Map<String, Tag> value) {
this.value = new LinkedHashMap<String, Tag>(value);
} | java | public void setValue(Map<String, Tag> value) {
this.value = new LinkedHashMap<String, Tag>(value);
} | [
"public",
"void",
"setValue",
"(",
"Map",
"<",
"String",
",",
"Tag",
">",
"value",
")",
"{",
"this",
".",
"value",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Tag",
">",
"(",
"value",
")",
";",
"}"
] | Sets the value of this tag.
@param value New value of this tag. | [
"Sets",
"the",
"value",
"of",
"this",
"tag",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java#L54-L56 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java | CompoundTag.get | public <T extends Tag> T get(String tagName) {
return (T) this.value.get(tagName);
} | java | public <T extends Tag> T get(String tagName) {
return (T) this.value.get(tagName);
} | [
"public",
"<",
"T",
"extends",
"Tag",
">",
"T",
"get",
"(",
"String",
"tagName",
")",
"{",
"return",
"(",
"T",
")",
"this",
".",
"value",
".",
"get",
"(",
"tagName",
")",
";",
"}"
] | Gets the tag with the specified name.
@param <T> Type of tag to get.
@param tagName Name of the tag.
@return The tag with the specified name. | [
"Gets",
"the",
"tag",
"with",
"the",
"specified",
"name",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java#L84-L86 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java | CompoundTag.put | public <T extends Tag> T put(T tag) {
return (T) this.value.put(tag.getName(), tag);
} | java | public <T extends Tag> T put(T tag) {
return (T) this.value.put(tag.getName(), tag);
} | [
"public",
"<",
"T",
"extends",
"Tag",
">",
"T",
"put",
"(",
"T",
"tag",
")",
"{",
"return",
"(",
"T",
")",
"this",
".",
"value",
".",
"put",
"(",
"tag",
".",
"getName",
"(",
")",
",",
"tag",
")",
";",
"}"
] | Puts the tag into this compound tag.
@param <T> Type of tag to put.
@param tag Tag to put into this compound tag.
@return The previous tag associated with its name, or null if there wasn't one. | [
"Puts",
"the",
"tag",
"into",
"this",
"compound",
"tag",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java#L95-L97 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java | CompoundTag.remove | public <T extends Tag> T remove(String tagName) {
return (T) this.value.remove(tagName);
} | java | public <T extends Tag> T remove(String tagName) {
return (T) this.value.remove(tagName);
} | [
"public",
"<",
"T",
"extends",
"Tag",
">",
"T",
"remove",
"(",
"String",
"tagName",
")",
"{",
"return",
"(",
"T",
")",
"this",
".",
"value",
".",
"remove",
"(",
"tagName",
")",
";",
"}"
] | Removes a tag from this compound tag.
@param <T> Type of tag to remove.
@param tagName Name of the tag to remove.
@return The removed tag. | [
"Removes",
"a",
"tag",
"from",
"this",
"compound",
"tag",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java#L106-L108 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java | TagRegistry.register | public static void register(int id, Class<? extends Tag> tag) throws TagRegisterException {
if(idToTag.containsKey(id)) {
throw new TagRegisterException("Tag ID \"" + id + "\" is already in use.");
}
if(tagToId.containsKey(tag)) {
throw new TagRegisterException("Tag \"" ... | java | public static void register(int id, Class<? extends Tag> tag) throws TagRegisterException {
if(idToTag.containsKey(id)) {
throw new TagRegisterException("Tag ID \"" + id + "\" is already in use.");
}
if(tagToId.containsKey(tag)) {
throw new TagRegisterException("Tag \"" ... | [
"public",
"static",
"void",
"register",
"(",
"int",
"id",
",",
"Class",
"<",
"?",
"extends",
"Tag",
">",
"tag",
")",
"throws",
"TagRegisterException",
"{",
"if",
"(",
"idToTag",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"throw",
"new",
"TagRegisterEx... | Registers a tag class.
@param id ID of the tag.
@param tag Tag class to register.
@throws TagRegisterException If an error occurs while registering the tag. | [
"Registers",
"a",
"tag",
"class",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java#L57-L68 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java | TagRegistry.getClassFor | public static Class<? extends Tag> getClassFor(int id) {
if(!idToTag.containsKey(id)) {
return null;
}
return idToTag.get(id);
} | java | public static Class<? extends Tag> getClassFor(int id) {
if(!idToTag.containsKey(id)) {
return null;
}
return idToTag.get(id);
} | [
"public",
"static",
"Class",
"<",
"?",
"extends",
"Tag",
">",
"getClassFor",
"(",
"int",
"id",
")",
"{",
"if",
"(",
"!",
"idToTag",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"idToTag",
".",
"get",
"(",
"id"... | Gets the tag class with the given id.
@param id Id of the tag.
@return The tag class with the given id, or null if it cannot be found. | [
"Gets",
"the",
"tag",
"class",
"with",
"the",
"given",
"id",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java#L86-L92 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java | TagRegistry.getIdFor | public static int getIdFor(Class<? extends Tag> clazz) {
if(!tagToId.containsKey(clazz)) {
return -1;
}
return tagToId.get(clazz);
} | java | public static int getIdFor(Class<? extends Tag> clazz) {
if(!tagToId.containsKey(clazz)) {
return -1;
}
return tagToId.get(clazz);
} | [
"public",
"static",
"int",
"getIdFor",
"(",
"Class",
"<",
"?",
"extends",
"Tag",
">",
"clazz",
")",
"{",
"if",
"(",
"!",
"tagToId",
".",
"containsKey",
"(",
"clazz",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"tagToId",
".",
"get",
"(",... | Gets the id of the given tag class.
@param clazz The tag class to get the id of.
@return The id of the given tag class, or -1 if it cannot be found. | [
"Gets",
"the",
"id",
"of",
"the",
"given",
"tag",
"class",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java#L100-L106 | train |
Steveice10/OpenNBT | src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java | TagRegistry.createInstance | public static Tag createInstance(int id, String tagName) throws TagCreateException {
Class<? extends Tag> clazz = idToTag.get(id);
if(clazz == null) {
throw new TagCreateException("Could not find tag with ID \"" + id + "\".");
}
try {
Constructor<? extends Tag> c... | java | public static Tag createInstance(int id, String tagName) throws TagCreateException {
Class<? extends Tag> clazz = idToTag.get(id);
if(clazz == null) {
throw new TagCreateException("Could not find tag with ID \"" + id + "\".");
}
try {
Constructor<? extends Tag> c... | [
"public",
"static",
"Tag",
"createInstance",
"(",
"int",
"id",
",",
"String",
"tagName",
")",
"throws",
"TagCreateException",
"{",
"Class",
"<",
"?",
"extends",
"Tag",
">",
"clazz",
"=",
"idToTag",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"clazz",
"... | Creates an instance of the tag with the given id, using the String constructor.
@param id Id of the tag.
@param tagName Name to give the tag.
@return The created tag.
@throws TagCreateException If an error occurs while creating the tag. | [
"Creates",
"an",
"instance",
"of",
"the",
"tag",
"with",
"the",
"given",
"id",
"using",
"the",
"String",
"constructor",
"."
] | 9bf4adb2afd206a21bc4309c85d642494d1fb536 | https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java#L116-L129 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.onMeasure | @Override
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = 200;
if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(widthMeasureSpec)) {
width = MeasureSpec.getSize(widthMeasureSpec);
}
int height = thumbImage.getHeight()
... | java | @Override
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = 200;
if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(widthMeasureSpec)) {
width = MeasureSpec.getSize(widthMeasureSpec);
}
int height = thumbImage.getHeight()
... | [
"@",
"Override",
"protected",
"synchronized",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"int",
"width",
"=",
"200",
";",
"if",
"(",
"MeasureSpec",
".",
"UNSPECIFIED",
"!=",
"MeasureSpec",
".",
"getMode",
"(... | Ensures correct size of the widget. | [
"Ensures",
"correct",
"size",
"of",
"the",
"widget",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L589-L603 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.drawThumb | private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) {
Bitmap buttonToDraw;
if (!activateOnDefaultValues && areSelectedValuesDefault) {
buttonToDraw = thumbDisabledImage;
} else {
buttonToDraw = pressed ? thumbPressed... | java | private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) {
Bitmap buttonToDraw;
if (!activateOnDefaultValues && areSelectedValuesDefault) {
buttonToDraw = thumbDisabledImage;
} else {
buttonToDraw = pressed ? thumbPressed... | [
"private",
"void",
"drawThumb",
"(",
"float",
"screenCoord",
",",
"boolean",
"pressed",
",",
"Canvas",
"canvas",
",",
"boolean",
"areSelectedValuesDefault",
")",
"{",
"Bitmap",
"buttonToDraw",
";",
"if",
"(",
"!",
"activateOnDefaultValues",
"&&",
"areSelectedValuesD... | Draws the "normal" resp. "pressed" thumb image on specified x-coordinate.
@param screenCoord The x-coordinate in screen space where to draw the image.
@param pressed Is the thumb currently in "pressed" state?
@param canvas The canvas to draw upon. | [
"Draws",
"the",
"normal",
"resp",
".",
"pressed",
"thumb",
"image",
"on",
"specified",
"x",
"-",
"coordinate",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L735-L746 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.drawThumbShadow | private void drawThumbShadow(float screenCoord, Canvas canvas) {
thumbShadowMatrix.setTranslate(screenCoord + thumbShadowXOffset, textOffset + thumbHalfHeight + thumbShadowYOffset);
translatedThumbShadowPath.set(thumbShadowPath);
translatedThumbShadowPath.transform(thumbShadowMatrix);
ca... | java | private void drawThumbShadow(float screenCoord, Canvas canvas) {
thumbShadowMatrix.setTranslate(screenCoord + thumbShadowXOffset, textOffset + thumbHalfHeight + thumbShadowYOffset);
translatedThumbShadowPath.set(thumbShadowPath);
translatedThumbShadowPath.transform(thumbShadowMatrix);
ca... | [
"private",
"void",
"drawThumbShadow",
"(",
"float",
"screenCoord",
",",
"Canvas",
"canvas",
")",
"{",
"thumbShadowMatrix",
".",
"setTranslate",
"(",
"screenCoord",
"+",
"thumbShadowXOffset",
",",
"textOffset",
"+",
"thumbHalfHeight",
"+",
"thumbShadowYOffset",
")",
... | Draws a drop shadow beneath the slider thumb.
@param screenCoord the x-coordinate of the slider thumb
@param canvas the canvas on which to draw the shadow | [
"Draws",
"a",
"drop",
"shadow",
"beneath",
"the",
"slider",
"thumb",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L754-L759 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.setNormalizedMinValue | private void setNormalizedMinValue(double value) {
normalizedMinValue = Math.max(0d, Math.min(1d, Math.min(value, normalizedMaxValue)));
invalidate();
} | java | private void setNormalizedMinValue(double value) {
normalizedMinValue = Math.max(0d, Math.min(1d, Math.min(value, normalizedMaxValue)));
invalidate();
} | [
"private",
"void",
"setNormalizedMinValue",
"(",
"double",
"value",
")",
"{",
"normalizedMinValue",
"=",
"Math",
".",
"max",
"(",
"0d",
",",
"Math",
".",
"min",
"(",
"1d",
",",
"Math",
".",
"min",
"(",
"value",
",",
"normalizedMaxValue",
")",
")",
")",
... | Sets normalized min value to value so that 0 <= value <= normalized max value <= 1. The View will get invalidated when calling this method.
@param value The new normalized min value to set. | [
"Sets",
"normalized",
"min",
"value",
"to",
"value",
"so",
"that",
"0",
"<",
"=",
"value",
"<",
"=",
"normalized",
"max",
"value",
"<",
"=",
"1",
".",
"The",
"View",
"will",
"get",
"invalidated",
"when",
"calling",
"this",
"method",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L798-L801 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.setNormalizedMaxValue | private void setNormalizedMaxValue(double value) {
normalizedMaxValue = Math.max(0d, Math.min(1d, Math.max(value, normalizedMinValue)));
invalidate();
} | java | private void setNormalizedMaxValue(double value) {
normalizedMaxValue = Math.max(0d, Math.min(1d, Math.max(value, normalizedMinValue)));
invalidate();
} | [
"private",
"void",
"setNormalizedMaxValue",
"(",
"double",
"value",
")",
"{",
"normalizedMaxValue",
"=",
"Math",
".",
"max",
"(",
"0d",
",",
"Math",
".",
"min",
"(",
"1d",
",",
"Math",
".",
"max",
"(",
"value",
",",
"normalizedMinValue",
")",
")",
")",
... | Sets normalized max value to value so that 0 <= normalized min value <= value <= 1. The View will get invalidated when calling this method.
@param value The new normalized max value to set. | [
"Sets",
"normalized",
"max",
"value",
"to",
"value",
"so",
"that",
"0",
"<",
"=",
"normalized",
"min",
"value",
"<",
"=",
"value",
"<",
"=",
"1",
".",
"The",
"View",
"will",
"get",
"invalidated",
"when",
"calling",
"this",
"method",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L808-L811 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.normalizedToValue | @SuppressWarnings("unchecked")
protected T normalizedToValue(double normalized) {
double v = absoluteMinValuePrim + normalized * (absoluteMaxValuePrim - absoluteMinValuePrim);
// TODO parameterize this rounding to allow variable decimal points
return (T) numberType.toNumber(Math.round(v * 10... | java | @SuppressWarnings("unchecked")
protected T normalizedToValue(double normalized) {
double v = absoluteMinValuePrim + normalized * (absoluteMaxValuePrim - absoluteMinValuePrim);
// TODO parameterize this rounding to allow variable decimal points
return (T) numberType.toNumber(Math.round(v * 10... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"T",
"normalizedToValue",
"(",
"double",
"normalized",
")",
"{",
"double",
"v",
"=",
"absoluteMinValuePrim",
"+",
"normalized",
"*",
"(",
"absoluteMaxValuePrim",
"-",
"absoluteMinValuePrim",
")",
";",
... | Converts a normalized value to a Number object in the value space between absolute minimum and maximum. | [
"Converts",
"a",
"normalized",
"value",
"to",
"a",
"Number",
"object",
"in",
"the",
"value",
"space",
"between",
"absolute",
"minimum",
"and",
"maximum",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L816-L821 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.valueToNormalized | protected double valueToNormalized(T value) {
if (0 == absoluteMaxValuePrim - absoluteMinValuePrim) {
// prevent division by zero, simply return 0.
return 0d;
}
return (value.doubleValue() - absoluteMinValuePrim) / (absoluteMaxValuePrim - absoluteMinValuePrim);
} | java | protected double valueToNormalized(T value) {
if (0 == absoluteMaxValuePrim - absoluteMinValuePrim) {
// prevent division by zero, simply return 0.
return 0d;
}
return (value.doubleValue() - absoluteMinValuePrim) / (absoluteMaxValuePrim - absoluteMinValuePrim);
} | [
"protected",
"double",
"valueToNormalized",
"(",
"T",
"value",
")",
"{",
"if",
"(",
"0",
"==",
"absoluteMaxValuePrim",
"-",
"absoluteMinValuePrim",
")",
"{",
"// prevent division by zero, simply return 0.",
"return",
"0d",
";",
"}",
"return",
"(",
"value",
".",
"d... | Converts the given Number value to a normalized double.
@param value The Number value to normalize.
@return The normalized double. | [
"Converts",
"the",
"given",
"Number",
"value",
"to",
"a",
"normalized",
"double",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L829-L835 | train |
anothem/android-range-seek-bar | rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java | RangeSeekBar.screenToNormalized | private double screenToNormalized(float screenCoord) {
int width = getWidth();
if (width <= 2 * padding) {
// prevent division by zero, simply return 0.
return 0d;
} else {
double result = (screenCoord - padding) / (width - 2 * padding);
return Mat... | java | private double screenToNormalized(float screenCoord) {
int width = getWidth();
if (width <= 2 * padding) {
// prevent division by zero, simply return 0.
return 0d;
} else {
double result = (screenCoord - padding) / (width - 2 * padding);
return Mat... | [
"private",
"double",
"screenToNormalized",
"(",
"float",
"screenCoord",
")",
"{",
"int",
"width",
"=",
"getWidth",
"(",
")",
";",
"if",
"(",
"width",
"<=",
"2",
"*",
"padding",
")",
"{",
"// prevent division by zero, simply return 0.",
"return",
"0d",
";",
"}"... | Converts screen space x-coordinates into normalized values.
@param screenCoord The x-coordinate in screen space to convert.
@return The normalized value. | [
"Converts",
"screen",
"space",
"x",
"-",
"coordinates",
"into",
"normalized",
"values",
"."
] | a88663da2d9e835907d3551b8a8569100c5b7b0f | https://github.com/anothem/android-range-seek-bar/blob/a88663da2d9e835907d3551b8a8569100c5b7b0f/rangeseekbar/src/main/java/org/florescu/android/rangeseekbar/RangeSeekBar.java#L853-L862 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/L2Regularizer.java | L2Regularizer.updateWeights | public static <K> void updateWeights(double l2, double learningRate, Map<K, Double> weights, Map<K, Double> newWeights) {
if(l2 > 0.0) {
for(Map.Entry<K, Double> e : weights.entrySet()) {
K column = e.getKey();
newWeights.put(column, newWeights.get(column) + l2*e.getV... | java | public static <K> void updateWeights(double l2, double learningRate, Map<K, Double> weights, Map<K, Double> newWeights) {
if(l2 > 0.0) {
for(Map.Entry<K, Double> e : weights.entrySet()) {
K column = e.getKey();
newWeights.put(column, newWeights.get(column) + l2*e.getV... | [
"public",
"static",
"<",
"K",
">",
"void",
"updateWeights",
"(",
"double",
"l2",
",",
"double",
"learningRate",
",",
"Map",
"<",
"K",
",",
"Double",
">",
"weights",
",",
"Map",
"<",
"K",
",",
"Double",
">",
"newWeights",
")",
"{",
"if",
"(",
"l2",
... | Updates the weights by applying the L2 regularization.
@param l2
@param learningRate
@param weights
@param newWeights
@param <K> | [
"Updates",
"the",
"weights",
"by",
"applying",
"the",
"L2",
"regularization",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/L2Regularizer.java#L36-L43 | train |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/L2Regularizer.java | L2Regularizer.estimatePenalty | public static <K> double estimatePenalty(double l2, Map<K, Double> weights) {
double penalty = 0.0;
if(l2 > 0.0) {
double sumWeightsSquared = 0.0;
for(double w : weights.values()) {
sumWeightsSquared += w*w;
}
penalty = l2*sumWeightsSquared... | java | public static <K> double estimatePenalty(double l2, Map<K, Double> weights) {
double penalty = 0.0;
if(l2 > 0.0) {
double sumWeightsSquared = 0.0;
for(double w : weights.values()) {
sumWeightsSquared += w*w;
}
penalty = l2*sumWeightsSquared... | [
"public",
"static",
"<",
"K",
">",
"double",
"estimatePenalty",
"(",
"double",
"l2",
",",
"Map",
"<",
"K",
",",
"Double",
">",
"weights",
")",
"{",
"double",
"penalty",
"=",
"0.0",
";",
"if",
"(",
"l2",
">",
"0.0",
")",
"{",
"double",
"sumWeightsSqua... | Estimates the penalty by adding the L2 regularization.
@param l2
@param weights
@param <K>
@return | [
"Estimates",
"the",
"penalty",
"by",
"adding",
"the",
"L2",
"regularization",
"."
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/L2Regularizer.java#L53-L63 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.