id
int32
0
165k
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
125,200
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.newConnection
private Connection newConnection() throws Exception { final long start = currentTime(); Connection connection = null; try { String username = config.getUsername(); String password = config.getPassword(); connection = (username == null) ? dataSource.getConnection() : dat...
java
private Connection newConnection() throws Exception { final long start = currentTime(); Connection connection = null; try { String username = config.getUsername(); String password = config.getPassword(); connection = (username == null) ? dataSource.getConnection() : dat...
[ "private", "Connection", "newConnection", "(", ")", "throws", "Exception", "{", "final", "long", "start", "=", "currentTime", "(", ")", ";", "Connection", "connection", "=", "null", ";", "try", "{", "String", "username", "=", "config", ".", "getUsername", "(...
Obtain connection from data source. @return a Connection connection
[ "Obtain", "connection", "from", "data", "source", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L344-L376
125,201
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.setupConnection
private void setupConnection(final Connection connection) throws ConnectionSetupException { try { if (networkTimeout == UNINITIALIZED) { networkTimeout = getAndSetNetworkTimeout(connection, validationTimeout); } else { setNetworkTimeout(connection, validationT...
java
private void setupConnection(final Connection connection) throws ConnectionSetupException { try { if (networkTimeout == UNINITIALIZED) { networkTimeout = getAndSetNetworkTimeout(connection, validationTimeout); } else { setNetworkTimeout(connection, validationT...
[ "private", "void", "setupConnection", "(", "final", "Connection", "connection", ")", "throws", "ConnectionSetupException", "{", "try", "{", "if", "(", "networkTimeout", "==", "UNINITIALIZED", ")", "{", "networkTimeout", "=", "getAndSetNetworkTimeout", "(", "connection...
Setup a connection initial state. @param connection a Connection @throws ConnectionSetupException thrown if any exception is encountered
[ "Setup", "a", "connection", "initial", "state", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L384-L423
125,202
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.checkDefaultIsolation
private void checkDefaultIsolation(final Connection connection) throws SQLException { try { defaultTransactionIsolation = connection.getTransactionIsolation(); if (transactionIsolation == -1) { transactionIsolation = defaultTransactionIsolation; } } catch (SQL...
java
private void checkDefaultIsolation(final Connection connection) throws SQLException { try { defaultTransactionIsolation = connection.getTransactionIsolation(); if (transactionIsolation == -1) { transactionIsolation = defaultTransactionIsolation; } } catch (SQL...
[ "private", "void", "checkDefaultIsolation", "(", "final", "Connection", "connection", ")", "throws", "SQLException", "{", "try", "{", "defaultTransactionIsolation", "=", "connection", ".", "getTransactionIsolation", "(", ")", ";", "if", "(", "transactionIsolation", "=...
Check the default transaction isolation of the Connection. @param connection a Connection to check @throws SQLException rethrown from the driver
[ "Check", "the", "default", "transaction", "isolation", "of", "the", "Connection", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L468-L482
125,203
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.setQueryTimeout
private void setQueryTimeout(final Statement statement, final int timeoutSec) { if (isQueryTimeoutSupported != FALSE) { try { statement.setQueryTimeout(timeoutSec); isQueryTimeoutSupported = TRUE; } catch (Exception e) { if (isQueryTimeoutSupported...
java
private void setQueryTimeout(final Statement statement, final int timeoutSec) { if (isQueryTimeoutSupported != FALSE) { try { statement.setQueryTimeout(timeoutSec); isQueryTimeoutSupported = TRUE; } catch (Exception e) { if (isQueryTimeoutSupported...
[ "private", "void", "setQueryTimeout", "(", "final", "Statement", "statement", ",", "final", "int", "timeoutSec", ")", "{", "if", "(", "isQueryTimeoutSupported", "!=", "FALSE", ")", "{", "try", "{", "statement", ".", "setQueryTimeout", "(", "timeoutSec", ")", "...
Set the query timeout, if it is supported by the driver. @param statement a statement to set the query timeout on @param timeoutSec the number of seconds before timeout
[ "Set", "the", "query", "timeout", "if", "it", "is", "supported", "by", "the", "driver", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L490-L504
125,204
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.executeSql
private void executeSql(final Connection connection, final String sql, final boolean isCommit) throws SQLException { if (sql != null) { try (Statement statement = connection.createStatement()) { // connection was created a few milliseconds before, so set query timeout is omitted (we assume...
java
private void executeSql(final Connection connection, final String sql, final boolean isCommit) throws SQLException { if (sql != null) { try (Statement statement = connection.createStatement()) { // connection was created a few milliseconds before, so set query timeout is omitted (we assume...
[ "private", "void", "executeSql", "(", "final", "Connection", "connection", ",", "final", "String", "sql", ",", "final", "boolean", "isCommit", ")", "throws", "SQLException", "{", "if", "(", "sql", "!=", "null", ")", "{", "try", "(", "Statement", "statement",...
Execute the user-specified init SQL. @param connection the connection to initialize @param sql the SQL to execute @param isCommit whether to commit the SQL after execution or not @throws SQLException throws if the init SQL execution fails
[ "Execute", "the", "user", "-", "specified", "init", "SQL", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L564-L581
125,205
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.setLoginTimeout
private void setLoginTimeout(final DataSource dataSource) { if (connectionTimeout != Integer.MAX_VALUE) { try { dataSource.setLoginTimeout(Math.max(1, (int) MILLISECONDS.toSeconds(500L + connectionTimeout))); } catch (Exception e) { logger.info("{} - Failed to...
java
private void setLoginTimeout(final DataSource dataSource) { if (connectionTimeout != Integer.MAX_VALUE) { try { dataSource.setLoginTimeout(Math.max(1, (int) MILLISECONDS.toSeconds(500L + connectionTimeout))); } catch (Exception e) { logger.info("{} - Failed to...
[ "private", "void", "setLoginTimeout", "(", "final", "DataSource", "dataSource", ")", "{", "if", "(", "connectionTimeout", "!=", "Integer", ".", "MAX_VALUE", ")", "{", "try", "{", "dataSource", ".", "setLoginTimeout", "(", "Math", ".", "max", "(", "1", ",", ...
Set the loginTimeout on the specified DataSource. @param dataSource the DataSource
[ "Set", "the", "loginTimeout", "on", "the", "specified", "DataSource", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L606-L616
125,206
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/JavassistProxyFactory.java
JavassistProxyFactory.generateProxyClass
private static <T> void generateProxyClass(Class<T> primaryInterface, String superClassName, String methodBody) throws Exception { String newClassName = superClassName.replaceAll("(.+)\\.(\\w+)", "$1.Hikari$2"); CtClass superCt = classPool.getCtClass(superClassName); CtClass targetCt = classPool.m...
java
private static <T> void generateProxyClass(Class<T> primaryInterface, String superClassName, String methodBody) throws Exception { String newClassName = superClassName.replaceAll("(.+)\\.(\\w+)", "$1.Hikari$2"); CtClass superCt = classPool.getCtClass(superClassName); CtClass targetCt = classPool.m...
[ "private", "static", "<", "T", ">", "void", "generateProxyClass", "(", "Class", "<", "T", ">", "primaryInterface", ",", "String", "superClassName", ",", "String", "methodBody", ")", "throws", "Exception", "{", "String", "newClassName", "=", "superClassName", "."...
Generate Javassist Proxy Classes
[ "Generate", "Javassist", "Proxy", "Classes" ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/JavassistProxyFactory.java#L112-L186
125,207
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/FastList.java
FastList.add
@Override public boolean add(T element) { if (size < elementData.length) { elementData[size++] = element; } else { // overflow-conscious code final int oldCapacity = elementData.length; final int newCapacity = oldCapacity << 1; @SuppressWarnings("unch...
java
@Override public boolean add(T element) { if (size < elementData.length) { elementData[size++] = element; } else { // overflow-conscious code final int oldCapacity = elementData.length; final int newCapacity = oldCapacity << 1; @SuppressWarnings("unch...
[ "@", "Override", "public", "boolean", "add", "(", "T", "element", ")", "{", "if", "(", "size", "<", "elementData", ".", "length", ")", "{", "elementData", "[", "size", "++", "]", "=", "element", ";", "}", "else", "{", "// overflow-conscious code", "final...
Add an element to the tail of the FastList. @param element the element to add
[ "Add", "an", "element", "to", "the", "tail", "of", "the", "FastList", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/FastList.java#L74-L92
125,208
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/FastList.java
FastList.removeLast
public T removeLast() { T element = elementData[--size]; elementData[size] = null; return element; }
java
public T removeLast() { T element = elementData[--size]; elementData[size] = null; return element; }
[ "public", "T", "removeLast", "(", ")", "{", "T", "element", "=", "elementData", "[", "--", "size", "]", ";", "elementData", "[", "size", "]", "=", "null", ";", "return", "element", ";", "}" ]
Remove the last element from the list. No bound check is performed, so if this method is called on an empty list and ArrayIndexOutOfBounds exception will be thrown. @return the last element of the list
[ "Remove", "the", "last", "element", "from", "the", "list", ".", "No", "bound", "check", "is", "performed", "so", "if", "this", "method", "is", "called", "on", "an", "empty", "list", "and", "ArrayIndexOutOfBounds", "exception", "will", "be", "thrown", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/FastList.java#L113-L118
125,209
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/FastList.java
FastList.clear
@Override public void clear() { for (int i = 0; i < size; i++) { elementData[i] = null; } size = 0; }
java
@Override public void clear() { for (int i = 0; i < size; i++) { elementData[i] = null; } size = 0; }
[ "@", "Override", "public", "void", "clear", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "elementData", "[", "i", "]", "=", "null", ";", "}", "size", "=", "0", ";", "}" ]
Clear the FastList.
[ "Clear", "the", "FastList", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/FastList.java#L147-L155
125,210
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.getConnection
public Connection getConnection(final long hardTimeout) throws SQLException { suspendResumeLock.acquire(); final long startTime = currentTime(); try { long timeout = hardTimeout; do { PoolEntry poolEntry = connectionBag.borrow(timeout, MILLISECONDS); if (p...
java
public Connection getConnection(final long hardTimeout) throws SQLException { suspendResumeLock.acquire(); final long startTime = currentTime(); try { long timeout = hardTimeout; do { PoolEntry poolEntry = connectionBag.borrow(timeout, MILLISECONDS); if (p...
[ "public", "Connection", "getConnection", "(", "final", "long", "hardTimeout", ")", "throws", "SQLException", "{", "suspendResumeLock", ".", "acquire", "(", ")", ";", "final", "long", "startTime", "=", "currentTime", "(", ")", ";", "try", "{", "long", "timeout"...
Get a connection from the pool, or timeout after the specified number of milliseconds. @param hardTimeout the maximum time to wait for a connection from the pool @return a java.sql.Connection instance @throws SQLException thrown if a timeout occurs trying to obtain a connection
[ "Get", "a", "connection", "from", "the", "pool", "or", "timeout", "after", "the", "specified", "number", "of", "milliseconds", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L171-L205
125,211
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.shutdown
public synchronized void shutdown() throws InterruptedException { try { poolState = POOL_SHUTDOWN; if (addConnectionExecutor == null) { // pool never started return; } logPoolState("Before shutdown "); if (houseKeeperTask != null) { houseK...
java
public synchronized void shutdown() throws InterruptedException { try { poolState = POOL_SHUTDOWN; if (addConnectionExecutor == null) { // pool never started return; } logPoolState("Before shutdown "); if (houseKeeperTask != null) { houseK...
[ "public", "synchronized", "void", "shutdown", "(", ")", "throws", "InterruptedException", "{", "try", "{", "poolState", "=", "POOL_SHUTDOWN", ";", "if", "(", "addConnectionExecutor", "==", "null", ")", "{", "// pool never started", "return", ";", "}", "logPoolStat...
Shutdown the pool, closing all idle connections and aborting or closing active connections. @throws InterruptedException thrown if the thread is interrupted during shutdown
[ "Shutdown", "the", "pool", "closing", "all", "idle", "connections", "and", "aborting", "or", "closing", "active", "connections", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L213-L261
125,212
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.evictConnection
public void evictConnection(Connection connection) { ProxyConnection proxyConnection = (ProxyConnection) connection; proxyConnection.cancelLeakTask(); try { softEvictConnection(proxyConnection.getPoolEntry(), "(connection evicted by user)", !connection.isClosed() /* owner */); } ...
java
public void evictConnection(Connection connection) { ProxyConnection proxyConnection = (ProxyConnection) connection; proxyConnection.cancelLeakTask(); try { softEvictConnection(proxyConnection.getPoolEntry(), "(connection evicted by user)", !connection.isClosed() /* owner */); } ...
[ "public", "void", "evictConnection", "(", "Connection", "connection", ")", "{", "ProxyConnection", "proxyConnection", "=", "(", "ProxyConnection", ")", "connection", ";", "proxyConnection", ".", "cancelLeakTask", "(", ")", ";", "try", "{", "softEvictConnection", "("...
Evict a Connection from the pool. @param connection the Connection to evict (actually a {@link ProxyConnection})
[ "Evict", "a", "Connection", "from", "the", "pool", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L268-L279
125,213
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.setMetricRegistry
public void setMetricRegistry(Object metricRegistry) { if (metricRegistry != null && safeIsAssignableFrom(metricRegistry, "com.codahale.metrics.MetricRegistry")) { setMetricsTrackerFactory(new CodahaleMetricsTrackerFactory((MetricRegistry) metricRegistry)); } else if (metricRegistry != nul...
java
public void setMetricRegistry(Object metricRegistry) { if (metricRegistry != null && safeIsAssignableFrom(metricRegistry, "com.codahale.metrics.MetricRegistry")) { setMetricsTrackerFactory(new CodahaleMetricsTrackerFactory((MetricRegistry) metricRegistry)); } else if (metricRegistry != nul...
[ "public", "void", "setMetricRegistry", "(", "Object", "metricRegistry", ")", "{", "if", "(", "metricRegistry", "!=", "null", "&&", "safeIsAssignableFrom", "(", "metricRegistry", ",", "\"com.codahale.metrics.MetricRegistry\"", ")", ")", "{", "setMetricsTrackerFactory", "...
Set a metrics registry to be used when registering metrics collectors. The HikariDataSource prevents this method from being called more than once. @param metricRegistry the metrics registry instance to use
[ "Set", "a", "metrics", "registry", "to", "be", "used", "when", "registering", "metrics", "collectors", ".", "The", "HikariDataSource", "prevents", "this", "method", "from", "being", "called", "more", "than", "once", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L287-L298
125,214
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.setMetricsTrackerFactory
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory) { if (metricsTrackerFactory != null) { this.metricsTracker = new MetricsTrackerDelegate(metricsTrackerFactory.create(config.getPoolName(), getPoolStats())); } else { this.metricsTracker = new NopMetr...
java
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory) { if (metricsTrackerFactory != null) { this.metricsTracker = new MetricsTrackerDelegate(metricsTrackerFactory.create(config.getPoolName(), getPoolStats())); } else { this.metricsTracker = new NopMetr...
[ "public", "void", "setMetricsTrackerFactory", "(", "MetricsTrackerFactory", "metricsTrackerFactory", ")", "{", "if", "(", "metricsTrackerFactory", "!=", "null", ")", "{", "this", ".", "metricsTracker", "=", "new", "MetricsTrackerDelegate", "(", "metricsTrackerFactory", ...
Set the MetricsTrackerFactory to be used to create the IMetricsTracker instance used by the pool. @param metricsTrackerFactory an instance of a class that subclasses MetricsTrackerFactory
[ "Set", "the", "MetricsTrackerFactory", "to", "be", "used", "to", "create", "the", "IMetricsTracker", "instance", "used", "by", "the", "pool", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L305-L313
125,215
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.setHealthCheckRegistry
public void setHealthCheckRegistry(Object healthCheckRegistry) { if (healthCheckRegistry != null) { CodahaleHealthChecker.registerHealthChecks(this, config, (HealthCheckRegistry) healthCheckRegistry); } }
java
public void setHealthCheckRegistry(Object healthCheckRegistry) { if (healthCheckRegistry != null) { CodahaleHealthChecker.registerHealthChecks(this, config, (HealthCheckRegistry) healthCheckRegistry); } }
[ "public", "void", "setHealthCheckRegistry", "(", "Object", "healthCheckRegistry", ")", "{", "if", "(", "healthCheckRegistry", "!=", "null", ")", "{", "CodahaleHealthChecker", ".", "registerHealthChecks", "(", "this", ",", "config", ",", "(", "HealthCheckRegistry", "...
Set the health check registry to be used when registering health checks. Currently only Codahale health checks are supported. @param healthCheckRegistry the health check registry instance to use
[ "Set", "the", "health", "check", "registry", "to", "be", "used", "when", "registering", "health", "checks", ".", "Currently", "only", "Codahale", "health", "checks", "are", "supported", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L321-L326
125,216
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.logPoolState
void logPoolState(String... prefix) { if (logger.isDebugEnabled()) { logger.debug("{} - {}stats (total={}, active={}, idle={}, waiting={})", poolName, (prefix.length > 0 ? prefix[0] : ""), getTotalConnections(), getActiveConnections(), getIdleConnections(), ...
java
void logPoolState(String... prefix) { if (logger.isDebugEnabled()) { logger.debug("{} - {}stats (total={}, active={}, idle={}, waiting={})", poolName, (prefix.length > 0 ? prefix[0] : ""), getTotalConnections(), getActiveConnections(), getIdleConnections(), ...
[ "void", "logPoolState", "(", "String", "...", "prefix", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"{} - {}stats (total={}, active={}, idle={}, waiting={})\"", ",", "poolName", ",", "(", "prefix", "."...
Log the current pool state at debug level. @param prefix an optional prefix to prepend the log message
[ "Log", "the", "current", "pool", "state", "at", "debug", "level", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L414-L421
125,217
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.createPoolEntry
private PoolEntry createPoolEntry() { try { final PoolEntry poolEntry = newPoolEntry(); final long maxLifetime = config.getMaxLifetime(); if (maxLifetime > 0) { // variance up to 2.5% of the maxlifetime final long variance = maxLifetime > 10_000 ? ThreadLocal...
java
private PoolEntry createPoolEntry() { try { final PoolEntry poolEntry = newPoolEntry(); final long maxLifetime = config.getMaxLifetime(); if (maxLifetime > 0) { // variance up to 2.5% of the maxlifetime final long variance = maxLifetime > 10_000 ? ThreadLocal...
[ "private", "PoolEntry", "createPoolEntry", "(", ")", "{", "try", "{", "final", "PoolEntry", "poolEntry", "=", "newPoolEntry", "(", ")", ";", "final", "long", "maxLifetime", "=", "config", ".", "getMaxLifetime", "(", ")", ";", "if", "(", "maxLifetime", ">", ...
Creating new poolEntry. If maxLifetime is configured, create a future End-of-life task with 2.5% variance from the maxLifetime time to ensure there is no massive die-off of Connections in the pool.
[ "Creating", "new", "poolEntry", ".", "If", "maxLifetime", "is", "configured", "create", "a", "future", "End", "-", "of", "-", "life", "task", "with", "2", ".", "5%", "variance", "from", "the", "maxLifetime", "time", "to", "ensure", "there", "is", "no", "...
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L470-L512
125,218
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.abortActiveConnections
private void abortActiveConnections(final ExecutorService assassinExecutor) { for (PoolEntry poolEntry : connectionBag.values(STATE_IN_USE)) { Connection connection = poolEntry.close(); try { connection.abort(assassinExecutor); } catch (Throwable e) { ...
java
private void abortActiveConnections(final ExecutorService assassinExecutor) { for (PoolEntry poolEntry : connectionBag.values(STATE_IN_USE)) { Connection connection = poolEntry.close(); try { connection.abort(assassinExecutor); } catch (Throwable e) { ...
[ "private", "void", "abortActiveConnections", "(", "final", "ExecutorService", "assassinExecutor", ")", "{", "for", "(", "PoolEntry", "poolEntry", ":", "connectionBag", ".", "values", "(", "STATE_IN_USE", ")", ")", "{", "Connection", "connection", "=", "poolEntry", ...
Attempt to abort or close active connections. @param assassinExecutor the ExecutorService to pass to Connection.abort()
[ "Attempt", "to", "abort", "or", "close", "active", "connections", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L531-L545
125,219
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.checkFailFast
private void checkFailFast() { final long initializationTimeout = config.getInitializationFailTimeout(); if (initializationTimeout < 0) { return; } final long startTime = currentTime(); do { final PoolEntry poolEntry = createPoolEntry(); if (poolEntry != null...
java
private void checkFailFast() { final long initializationTimeout = config.getInitializationFailTimeout(); if (initializationTimeout < 0) { return; } final long startTime = currentTime(); do { final PoolEntry poolEntry = createPoolEntry(); if (poolEntry != null...
[ "private", "void", "checkFailFast", "(", ")", "{", "final", "long", "initializationTimeout", "=", "config", ".", "getInitializationFailTimeout", "(", ")", ";", "if", "(", "initializationTimeout", "<", "0", ")", "{", "return", ";", "}", "final", "long", "startT...
If initializationFailFast is configured, check that we have DB connectivity. @throws PoolInitializationException if fails to create or validate connection @see HikariConfig#setInitializationFailTimeout(long)
[ "If", "initializationFailFast", "is", "configured", "check", "that", "we", "have", "DB", "connectivity", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L553-L585
125,220
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.throwPoolInitializationException
private void throwPoolInitializationException(Throwable t) { logger.error("{} - Exception during pool initialization.", poolName, t); destroyHouseKeepingExecutorService(); throw new PoolInitializationException(t); }
java
private void throwPoolInitializationException(Throwable t) { logger.error("{} - Exception during pool initialization.", poolName, t); destroyHouseKeepingExecutorService(); throw new PoolInitializationException(t); }
[ "private", "void", "throwPoolInitializationException", "(", "Throwable", "t", ")", "{", "logger", ".", "error", "(", "\"{} - Exception during pool initialization.\"", ",", "poolName", ",", "t", ")", ";", "destroyHouseKeepingExecutorService", "(", ")", ";", "throw", "n...
Log the Throwable that caused pool initialization to fail, and then throw a PoolInitializationException with that cause attached. @param t the Throwable that caused the pool to fail to initialize (possibly null)
[ "Log", "the", "Throwable", "that", "caused", "pool", "initialization", "to", "fail", "and", "then", "throw", "a", "PoolInitializationException", "with", "that", "cause", "attached", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L593-L598
125,221
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.getPoolStats
private PoolStats getPoolStats() { return new PoolStats(SECONDS.toMillis(1)) { @Override protected void update() { this.pendingThreads = HikariPool.this.getThreadsAwaitingConnection(); this.idleConnections = HikariPool.this.getIdleConnections(); this.totalC...
java
private PoolStats getPoolStats() { return new PoolStats(SECONDS.toMillis(1)) { @Override protected void update() { this.pendingThreads = HikariPool.this.getThreadsAwaitingConnection(); this.idleConnections = HikariPool.this.getIdleConnections(); this.totalC...
[ "private", "PoolStats", "getPoolStats", "(", ")", "{", "return", "new", "PoolStats", "(", "SECONDS", ".", "toMillis", "(", "1", ")", ")", "{", "@", "Override", "protected", "void", "update", "(", ")", "{", "this", ".", "pendingThreads", "=", "HikariPool", ...
Create a PoolStats instance that will be used by metrics tracking, with a pollable resolution of 1 second. @return a PoolStats instance
[ "Create", "a", "PoolStats", "instance", "that", "will", "be", "used", "by", "metrics", "tracking", "with", "a", "pollable", "resolution", "of", "1", "second", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L660-L673
125,222
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java
ConcurrentBag.borrow
public T borrow(long timeout, final TimeUnit timeUnit) throws InterruptedException { // Try the thread-local list first final List<Object> list = threadList.get(); for (int i = list.size() - 1; i >= 0; i--) { final Object entry = list.remove(i); @SuppressWarnings("unchecked") ...
java
public T borrow(long timeout, final TimeUnit timeUnit) throws InterruptedException { // Try the thread-local list first final List<Object> list = threadList.get(); for (int i = list.size() - 1; i >= 0; i--) { final Object entry = list.remove(i); @SuppressWarnings("unchecked") ...
[ "public", "T", "borrow", "(", "long", "timeout", ",", "final", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", "{", "// Try the thread-local list first", "final", "List", "<", "Object", ">", "list", "=", "threadList", ".", "get", "(", ")", ";", ...
The method will borrow a BagEntry from the bag, blocking for the specified timeout if none are available. @param timeout how long to wait before giving up, in units of unit @param timeUnit a <code>TimeUnit</code> determining how to interpret the timeout parameter @return a borrowed instance from the bag or null if a t...
[ "The", "method", "will", "borrow", "a", "BagEntry", "from", "the", "bag", "blocking", "for", "the", "specified", "timeout", "if", "none", "are", "available", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java#L126-L170
125,223
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java
ConcurrentBag.requite
public void requite(final T bagEntry) { bagEntry.setState(STATE_NOT_IN_USE); for (int i = 0; waiters.get() > 0; i++) { if (bagEntry.getState() != STATE_NOT_IN_USE || handoffQueue.offer(bagEntry)) { return; } else if ((i & 0xff) == 0xff) { parkNanos(MICR...
java
public void requite(final T bagEntry) { bagEntry.setState(STATE_NOT_IN_USE); for (int i = 0; waiters.get() > 0; i++) { if (bagEntry.getState() != STATE_NOT_IN_USE || handoffQueue.offer(bagEntry)) { return; } else if ((i & 0xff) == 0xff) { parkNanos(MICR...
[ "public", "void", "requite", "(", "final", "T", "bagEntry", ")", "{", "bagEntry", ".", "setState", "(", "STATE_NOT_IN_USE", ")", ";", "for", "(", "int", "i", "=", "0", ";", "waiters", ".", "get", "(", ")", ">", "0", ";", "i", "++", ")", "{", "if"...
This method will return a borrowed object to the bag. Objects that are borrowed from the bag but never "requited" will result in a memory leak. @param bagEntry the value to return to the bag @throws NullPointerException if value is null @throws IllegalStateException if the bagEntry was not borrowed from the bag
[ "This", "method", "will", "return", "a", "borrowed", "object", "to", "the", "bag", ".", "Objects", "that", "are", "borrowed", "from", "the", "bag", "but", "never", "requited", "will", "result", "in", "a", "memory", "leak", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java#L181-L201
125,224
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java
ConcurrentBag.add
public void add(final T bagEntry) { if (closed) { LOGGER.info("ConcurrentBag has been closed, ignoring add()"); throw new IllegalStateException("ConcurrentBag has been closed, ignoring add()"); } sharedList.add(bagEntry); // spin until a thread takes it or none are waiting...
java
public void add(final T bagEntry) { if (closed) { LOGGER.info("ConcurrentBag has been closed, ignoring add()"); throw new IllegalStateException("ConcurrentBag has been closed, ignoring add()"); } sharedList.add(bagEntry); // spin until a thread takes it or none are waiting...
[ "public", "void", "add", "(", "final", "T", "bagEntry", ")", "{", "if", "(", "closed", ")", "{", "LOGGER", ".", "info", "(", "\"ConcurrentBag has been closed, ignoring add()\"", ")", ";", "throw", "new", "IllegalStateException", "(", "\"ConcurrentBag has been closed...
Add a new object to the bag for others to borrow. @param bagEntry an object to add to the bag
[ "Add", "a", "new", "object", "to", "the", "bag", "for", "others", "to", "borrow", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java#L208-L221
125,225
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java
ConcurrentBag.getCount
public int getCount(final int state) { int count = 0; for (IConcurrentBagEntry e : sharedList) { if (e.getState() == state) { count++; } } return count; }
java
public int getCount(final int state) { int count = 0; for (IConcurrentBagEntry e : sharedList) { if (e.getState() == state) { count++; } } return count; }
[ "public", "int", "getCount", "(", "final", "int", "state", ")", "{", "int", "count", "=", "0", ";", "for", "(", "IConcurrentBagEntry", "e", ":", "sharedList", ")", "{", "if", "(", "e", ".", "getState", "(", ")", "==", "state", ")", "{", "count", "+...
Get a count of the number of items in the specified state at the time of this call. @param state the state of the items to count @return a count of how many items in the bag are in the specified state
[ "Get", "a", "count", "of", "the", "number", "of", "items", "in", "the", "specified", "state", "at", "the", "time", "of", "this", "call", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java#L339-L348
125,226
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java
CodahaleHealthChecker.registerHealthChecks
public static void registerHealthChecks(final HikariPool pool, final HikariConfig hikariConfig, final HealthCheckRegistry registry) { final Properties healthCheckProperties = hikariConfig.getHealthCheckProperties(); final MetricRegistry metricRegistry = (MetricRegistry) hikariConfig.getMetricRegistry(); ...
java
public static void registerHealthChecks(final HikariPool pool, final HikariConfig hikariConfig, final HealthCheckRegistry registry) { final Properties healthCheckProperties = hikariConfig.getHealthCheckProperties(); final MetricRegistry metricRegistry = (MetricRegistry) hikariConfig.getMetricRegistry(); ...
[ "public", "static", "void", "registerHealthChecks", "(", "final", "HikariPool", "pool", ",", "final", "HikariConfig", "hikariConfig", ",", "final", "HealthCheckRegistry", "registry", ")", "{", "final", "Properties", "healthCheckProperties", "=", "hikariConfig", ".", "...
Register Dropwizard health checks. @param pool the pool to register health checks for @param hikariConfig the pool configuration @param registry the HealthCheckRegistry into which checks will be registered
[ "Register", "Dropwizard", "health", "checks", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java#L58-L75
125,227
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/UtilityElf.java
UtilityElf.safeIsAssignableFrom
public static boolean safeIsAssignableFrom(Object obj, String className) { try { Class<?> clazz = Class.forName(className); return clazz.isAssignableFrom(obj.getClass()); } catch (ClassNotFoundException ignored) { return false; } }
java
public static boolean safeIsAssignableFrom(Object obj, String className) { try { Class<?> clazz = Class.forName(className); return clazz.isAssignableFrom(obj.getClass()); } catch (ClassNotFoundException ignored) { return false; } }
[ "public", "static", "boolean", "safeIsAssignableFrom", "(", "Object", "obj", ",", "String", "className", ")", "{", "try", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "className", ")", ";", "return", "clazz", ".", "isAssignableF...
Checks whether an object is an instance of given type without throwing exception when the class is not loaded. @param obj the object to check @param className String class @return true if object is assignable from the type, false otherwise or when the class cannot be loaded
[ "Checks", "whether", "an", "object", "is", "an", "instance", "of", "given", "type", "without", "throwing", "exception", "when", "the", "class", "is", "not", "loaded", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java#L73-L80
125,228
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/UtilityElf.java
UtilityElf.createInstance
public static <T> T createInstance(final String className, final Class<T> clazz, final Object... args) { if (className == null) { return null; } try { Class<?> loaded = UtilityElf.class.getClassLoader().loadClass(className); if (args.length == 0) { return cla...
java
public static <T> T createInstance(final String className, final Class<T> clazz, final Object... args) { if (className == null) { return null; } try { Class<?> loaded = UtilityElf.class.getClassLoader().loadClass(className); if (args.length == 0) { return cla...
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "final", "String", "className", ",", "final", "Class", "<", "T", ">", "clazz", ",", "final", "Object", "...", "args", ")", "{", "if", "(", "className", "==", "null", ")", "{", "return", "...
Create and instance of the specified class using the constructor matching the specified arguments. @param <T> the class type @param className the name of the class to instantiate @param clazz a class to cast the result as @param args arguments to a constructor @return an instance of the specified class
[ "Create", "and", "instance", "of", "the", "specified", "class", "using", "the", "constructor", "matching", "the", "specified", "arguments", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java#L92-L114
125,229
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/UtilityElf.java
UtilityElf.createThreadPoolExecutor
public static ThreadPoolExecutor createThreadPoolExecutor(final int queueSize, final String threadName, ThreadFactory threadFactory, final RejectedExecutionHandler policy) { if (threadFactory == null) { threadFactory = new DefaultThreadFactory(threadName, true); } LinkedBlockingQueue<Runn...
java
public static ThreadPoolExecutor createThreadPoolExecutor(final int queueSize, final String threadName, ThreadFactory threadFactory, final RejectedExecutionHandler policy) { if (threadFactory == null) { threadFactory = new DefaultThreadFactory(threadName, true); } LinkedBlockingQueue<Runn...
[ "public", "static", "ThreadPoolExecutor", "createThreadPoolExecutor", "(", "final", "int", "queueSize", ",", "final", "String", "threadName", ",", "ThreadFactory", "threadFactory", ",", "final", "RejectedExecutionHandler", "policy", ")", "{", "if", "(", "threadFactory",...
Create a ThreadPoolExecutor. @param queueSize the queue size @param threadName the thread name @param threadFactory an optional ThreadFactory @param policy the RejectedExecutionHandler policy @return a ThreadPoolExecutor
[ "Create", "a", "ThreadPoolExecutor", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java#L125-L135
125,230
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/UtilityElf.java
UtilityElf.getTransactionIsolation
public static int getTransactionIsolation(final String transactionIsolationName) { if (transactionIsolationName != null) { try { // use the english locale to avoid the infamous turkish locale bug final String upperCaseIsolationLevelName = transactionIsolationName.toUpperCase(Local...
java
public static int getTransactionIsolation(final String transactionIsolationName) { if (transactionIsolationName != null) { try { // use the english locale to avoid the infamous turkish locale bug final String upperCaseIsolationLevelName = transactionIsolationName.toUpperCase(Local...
[ "public", "static", "int", "getTransactionIsolation", "(", "final", "String", "transactionIsolationName", ")", "{", "if", "(", "transactionIsolationName", "!=", "null", ")", "{", "try", "{", "// use the english locale to avoid the infamous turkish locale bug", "final", "Str...
Get the int value of a transaction isolation level by name. @param transactionIsolationName the name of the transaction isolation level @return the int value of the isolation level or -1
[ "Get", "the", "int", "value", "of", "a", "transaction", "isolation", "level", "by", "name", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java#L167-L179
125,231
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/AbstractSequencer.java
AbstractSequencer.newPoller
@Override public <T> EventPoller<T> newPoller(DataProvider<T> dataProvider, Sequence... gatingSequences) { return EventPoller.newInstance(dataProvider, this, new Sequence(), cursor, gatingSequences); }
java
@Override public <T> EventPoller<T> newPoller(DataProvider<T> dataProvider, Sequence... gatingSequences) { return EventPoller.newInstance(dataProvider, this, new Sequence(), cursor, gatingSequences); }
[ "@", "Override", "public", "<", "T", ">", "EventPoller", "<", "T", ">", "newPoller", "(", "DataProvider", "<", "T", ">", "dataProvider", ",", "Sequence", "...", "gatingSequences", ")", "{", "return", "EventPoller", ".", "newInstance", "(", "dataProvider", ",...
Creates an event poller for this sequence that will use the supplied data provider and gating sequences. @param dataProvider The data source for users of this event poller @param gatingSequences Sequence to be gated on. @return A poller that will gate on this ring buffer and the supplied sequences.
[ "Creates", "an", "event", "poller", "for", "this", "sequence", "that", "will", "use", "the", "supplied", "data", "provider", "and", "gating", "sequences", "." ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/AbstractSequencer.java#L121-L125
125,232
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/dsl/Disruptor.java
Disruptor.after
public EventHandlerGroup<T> after(final EventProcessor... processors) { for (final EventProcessor processor : processors) { consumerRepository.add(processor); } return new EventHandlerGroup<>(this, consumerRepository, Util.getSequencesFor(processors)); }
java
public EventHandlerGroup<T> after(final EventProcessor... processors) { for (final EventProcessor processor : processors) { consumerRepository.add(processor); } return new EventHandlerGroup<>(this, consumerRepository, Util.getSequencesFor(processors)); }
[ "public", "EventHandlerGroup", "<", "T", ">", "after", "(", "final", "EventProcessor", "...", "processors", ")", "{", "for", "(", "final", "EventProcessor", "processor", ":", "processors", ")", "{", "consumerRepository", ".", "add", "(", "processor", ")", ";",...
Create a group of event processors to be used as a dependency. @param processors the event processors, previously set up with {@link #handleEventsWith(com.lmax.disruptor.EventProcessor...)}, that will form the barrier for subsequent handlers or processors. @return an {@link EventHandlerGroup} that can be used to setup...
[ "Create", "a", "group", "of", "event", "processors", "to", "be", "used", "as", "a", "dependency", "." ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/dsl/Disruptor.java#L314-L322
125,233
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/dsl/Disruptor.java
Disruptor.publishEvents
public <A> void publishEvents(final EventTranslatorOneArg<T, A> eventTranslator, final A[] arg) { ringBuffer.publishEvents(eventTranslator, arg); }
java
public <A> void publishEvents(final EventTranslatorOneArg<T, A> eventTranslator, final A[] arg) { ringBuffer.publishEvents(eventTranslator, arg); }
[ "public", "<", "A", ">", "void", "publishEvents", "(", "final", "EventTranslatorOneArg", "<", "T", ",", "A", ">", "eventTranslator", ",", "final", "A", "[", "]", "arg", ")", "{", "ringBuffer", ".", "publishEvents", "(", "eventTranslator", ",", "arg", ")", ...
Publish a batch of events to the ring buffer. @param <A> Class of the user supplied argument. @param eventTranslator the translator that will load data into the event. @param arg An array single arguments to load into the events. One Per event.
[ "Publish", "a", "batch", "of", "events", "to", "the", "ring", "buffer", "." ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/dsl/Disruptor.java#L353-L356
125,234
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/dsl/Disruptor.java
Disruptor.hasBacklog
private boolean hasBacklog() { final long cursor = ringBuffer.getCursor(); for (final Sequence consumer : consumerRepository.getLastSequenceInChain(false)) { if (cursor > consumer.get()) { return true; } } return false; ...
java
private boolean hasBacklog() { final long cursor = ringBuffer.getCursor(); for (final Sequence consumer : consumerRepository.getLastSequenceInChain(false)) { if (cursor > consumer.get()) { return true; } } return false; ...
[ "private", "boolean", "hasBacklog", "(", ")", "{", "final", "long", "cursor", "=", "ringBuffer", ".", "getCursor", "(", ")", ";", "for", "(", "final", "Sequence", "consumer", ":", "consumerRepository", ".", "getLastSequenceInChain", "(", "false", ")", ")", "...
Confirms if all messages have been consumed by all event processors
[ "Confirms", "if", "all", "messages", "have", "been", "consumed", "by", "all", "event", "processors" ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/dsl/Disruptor.java#L535-L546
125,235
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/WorkerPool.java
WorkerPool.start
public RingBuffer<T> start(final Executor executor) { if (!started.compareAndSet(false, true)) { throw new IllegalStateException("WorkerPool has already been started and cannot be restarted until halted."); } final long cursor = ringBuffer.getCursor(); workSequen...
java
public RingBuffer<T> start(final Executor executor) { if (!started.compareAndSet(false, true)) { throw new IllegalStateException("WorkerPool has already been started and cannot be restarted until halted."); } final long cursor = ringBuffer.getCursor(); workSequen...
[ "public", "RingBuffer", "<", "T", ">", "start", "(", "final", "Executor", "executor", ")", "{", "if", "(", "!", "started", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"WorkerPool has already...
Start the worker pool processing events in sequence. @param executor providing threads for running the workers. @return the {@link RingBuffer} used for the work queue. @throws IllegalStateException if the pool has already been started and not halted yet
[ "Start", "the", "worker", "pool", "processing", "events", "in", "sequence", "." ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/WorkerPool.java#L127-L144
125,236
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/BatchEventProcessor.java
BatchEventProcessor.notifyStart
private void notifyStart() { if (eventHandler instanceof LifecycleAware) { try { ((LifecycleAware) eventHandler).onStart(); } catch (final Throwable ex) { exceptionHandler.handleOnStartException(ex); ...
java
private void notifyStart() { if (eventHandler instanceof LifecycleAware) { try { ((LifecycleAware) eventHandler).onStart(); } catch (final Throwable ex) { exceptionHandler.handleOnStartException(ex); ...
[ "private", "void", "notifyStart", "(", ")", "{", "if", "(", "eventHandler", "instanceof", "LifecycleAware", ")", "{", "try", "{", "(", "(", "LifecycleAware", ")", "eventHandler", ")", ".", "onStart", "(", ")", ";", "}", "catch", "(", "final", "Throwable", ...
Notifies the EventHandler when this processor is starting up
[ "Notifies", "the", "EventHandler", "when", "this", "processor", "is", "starting", "up" ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/BatchEventProcessor.java#L218-L231
125,237
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/BatchEventProcessor.java
BatchEventProcessor.notifyShutdown
private void notifyShutdown() { if (eventHandler instanceof LifecycleAware) { try { ((LifecycleAware) eventHandler).onShutdown(); } catch (final Throwable ex) { exceptionHandler.handleOnShutdownException(ex);...
java
private void notifyShutdown() { if (eventHandler instanceof LifecycleAware) { try { ((LifecycleAware) eventHandler).onShutdown(); } catch (final Throwable ex) { exceptionHandler.handleOnShutdownException(ex);...
[ "private", "void", "notifyShutdown", "(", ")", "{", "if", "(", "eventHandler", "instanceof", "LifecycleAware", ")", "{", "try", "{", "(", "(", "LifecycleAware", ")", "eventHandler", ")", ".", "onShutdown", "(", ")", ";", "}", "catch", "(", "final", "Throwa...
Notifies the EventHandler immediately prior to this processor shutting down
[ "Notifies", "the", "EventHandler", "immediately", "prior", "to", "this", "processor", "shutting", "down" ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/BatchEventProcessor.java#L236-L249
125,238
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/Sequence.java
Sequence.addAndGet
public long addAndGet(final long increment) { long currentValue; long newValue; do { currentValue = get(); newValue = currentValue + increment; } while (!compareAndSet(currentValue, newValue)); return newValue; }
java
public long addAndGet(final long increment) { long currentValue; long newValue; do { currentValue = get(); newValue = currentValue + increment; } while (!compareAndSet(currentValue, newValue)); return newValue; }
[ "public", "long", "addAndGet", "(", "final", "long", "increment", ")", "{", "long", "currentValue", ";", "long", "newValue", ";", "do", "{", "currentValue", "=", "get", "(", ")", ";", "newValue", "=", "currentValue", "+", "increment", ";", "}", "while", ...
Atomically add the supplied value. @param increment The value to add to the sequence. @return The value after the increment.
[ "Atomically", "add", "the", "supplied", "value", "." ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/Sequence.java#L146-L159
125,239
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/RingBuffer.java
RingBuffer.createMultiProducer
public static <E> RingBuffer<E> createMultiProducer( EventFactory<E> factory, int bufferSize, WaitStrategy waitStrategy) { MultiProducerSequencer sequencer = new MultiProducerSequencer(bufferSize, waitStrategy); return new RingBuffer<E>(factory, sequencer); }
java
public static <E> RingBuffer<E> createMultiProducer( EventFactory<E> factory, int bufferSize, WaitStrategy waitStrategy) { MultiProducerSequencer sequencer = new MultiProducerSequencer(bufferSize, waitStrategy); return new RingBuffer<E>(factory, sequencer); }
[ "public", "static", "<", "E", ">", "RingBuffer", "<", "E", ">", "createMultiProducer", "(", "EventFactory", "<", "E", ">", "factory", ",", "int", "bufferSize", ",", "WaitStrategy", "waitStrategy", ")", "{", "MultiProducerSequencer", "sequencer", "=", "new", "M...
Create a new multiple producer RingBuffer with the specified wait strategy. @param <E> Class of the event stored in the ring buffer. @param factory used to create the events within the ring buffer. @param bufferSize number of elements to create within the ring buffer. @param waitStrategy used to determine how t...
[ "Create", "a", "new", "multiple", "producer", "RingBuffer", "with", "the", "specified", "wait", "strategy", "." ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/RingBuffer.java#L133-L141
125,240
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/RingBuffer.java
RingBuffer.createSingleProducer
public static <E> RingBuffer<E> createSingleProducer( EventFactory<E> factory, int bufferSize, WaitStrategy waitStrategy) { SingleProducerSequencer sequencer = new SingleProducerSequencer(bufferSize, waitStrategy); return new RingBuffer<E>(factory, sequencer); }
java
public static <E> RingBuffer<E> createSingleProducer( EventFactory<E> factory, int bufferSize, WaitStrategy waitStrategy) { SingleProducerSequencer sequencer = new SingleProducerSequencer(bufferSize, waitStrategy); return new RingBuffer<E>(factory, sequencer); }
[ "public", "static", "<", "E", ">", "RingBuffer", "<", "E", ">", "createSingleProducer", "(", "EventFactory", "<", "E", ">", "factory", ",", "int", "bufferSize", ",", "WaitStrategy", "waitStrategy", ")", "{", "SingleProducerSequencer", "sequencer", "=", "new", ...
Create a new single producer RingBuffer with the specified wait strategy. @param <E> Class of the event stored in the ring buffer. @param factory used to create the events within the ring buffer. @param bufferSize number of elements to create within the ring buffer. @param waitStrategy used to determine how to ...
[ "Create", "a", "new", "single", "producer", "RingBuffer", "with", "the", "specified", "wait", "strategy", "." ]
4266d00c5250190313446fdd7c8aa7a4edb5c818
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/RingBuffer.java#L169-L177
125,241
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java
PDF417ScanningDecoder.decode
public static DecoderResult decode(BitMatrix image, ResultPoint imageTopLeft, ResultPoint imageBottomLeft, ResultPoint imageTopRight, ResultPoint imageBottomRight, ...
java
public static DecoderResult decode(BitMatrix image, ResultPoint imageTopLeft, ResultPoint imageBottomLeft, ResultPoint imageTopRight, ResultPoint imageBottomRight, ...
[ "public", "static", "DecoderResult", "decode", "(", "BitMatrix", "image", ",", "ResultPoint", "imageTopLeft", ",", "ResultPoint", "imageBottomLeft", ",", "ResultPoint", "imageTopRight", ",", "ResultPoint", "imageBottomRight", ",", "int", "minCodewordWidth", ",", "int", ...
than it should be. This can happen if the scanner used a bad blackpoint.
[ "than", "it", "should", "be", ".", "This", "can", "happen", "if", "the", "scanner", "used", "a", "bad", "blackpoint", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java#L52-L125
125,242
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java
PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues
private static DecoderResult createDecoderResultFromAmbiguousValues(int ecLevel, int[] codewords, int[] erasureArray, ...
java
private static DecoderResult createDecoderResultFromAmbiguousValues(int ecLevel, int[] codewords, int[] erasureArray, ...
[ "private", "static", "DecoderResult", "createDecoderResultFromAmbiguousValues", "(", "int", "ecLevel", ",", "int", "[", "]", "codewords", ",", "int", "[", "]", "erasureArray", ",", "int", "[", "]", "ambiguousIndexes", ",", "int", "[", "]", "[", "]", "ambiguous...
This method deals with the fact, that the decoding process doesn't always yield a single most likely value. The current error correction implementation doesn't deal with erasures very well, so it's better to provide a value for these ambiguous codewords instead of treating it as an erasure. The problem is that we don't...
[ "This", "method", "deals", "with", "the", "fact", "that", "the", "decoding", "process", "doesn", "t", "always", "yield", "a", "single", "most", "likely", "value", ".", "The", "current", "error", "correction", "implementation", "doesn", "t", "deal", "with", "...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java#L295-L329
125,243
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java
PDF417ScanningDecoder.verifyCodewordCount
private static void verifyCodewordCount(int[] codewords, int numECCodewords) throws FormatException { if (codewords.length < 4) { // Codeword array size should be at least 4 allowing for // Count CW, At least one Data CW, Error Correction CW, Error Correction CW throw FormatException.getFormatInst...
java
private static void verifyCodewordCount(int[] codewords, int numECCodewords) throws FormatException { if (codewords.length < 4) { // Codeword array size should be at least 4 allowing for // Count CW, At least one Data CW, Error Correction CW, Error Correction CW throw FormatException.getFormatInst...
[ "private", "static", "void", "verifyCodewordCount", "(", "int", "[", "]", "codewords", ",", "int", "numECCodewords", ")", "throws", "FormatException", "{", "if", "(", "codewords", ".", "length", "<", "4", ")", "{", "// Codeword array size should be at least 4 allowi...
Verify that all is OK with the codeword array.
[ "Verify", "that", "all", "is", "OK", "with", "the", "codeword", "array", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/PDF417ScanningDecoder.java#L563-L584
125,244
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/encoder/ErrorCorrection.java
ErrorCorrection.encodeECC200
public static String encodeECC200(String codewords, SymbolInfo symbolInfo) { if (codewords.length() != symbolInfo.getDataCapacity()) { throw new IllegalArgumentException( "The number of codewords does not match the selected symbol"); } StringBuilder sb = new StringBuilder(symbolInfo.getDataC...
java
public static String encodeECC200(String codewords, SymbolInfo symbolInfo) { if (codewords.length() != symbolInfo.getDataCapacity()) { throw new IllegalArgumentException( "The number of codewords does not match the selected symbol"); } StringBuilder sb = new StringBuilder(symbolInfo.getDataC...
[ "public", "static", "String", "encodeECC200", "(", "String", "codewords", ",", "SymbolInfo", "symbolInfo", ")", "{", "if", "(", "codewords", ".", "length", "(", ")", "!=", "symbolInfo", ".", "getDataCapacity", "(", ")", ")", "{", "throw", "new", "IllegalArgu...
Creates the ECC200 error correction for an encoded message. @param codewords the codewords @param symbolInfo information about the symbol to be encoded @return the codewords with interleaved error correction.
[ "Creates", "the", "ECC200", "error", "correction", "for", "an", "encoded", "message", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/encoder/ErrorCorrection.java#L101-L134
125,245
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java
BitMatrixParser.remask
void remask() { if (parsedFormatInfo == null) { return; // We have no format information, and have no data mask } DataMask dataMask = DataMask.values()[parsedFormatInfo.getDataMask()]; int dimension = bitMatrix.getHeight(); dataMask.unmaskBitMatrix(bitMatrix, dimension); }
java
void remask() { if (parsedFormatInfo == null) { return; // We have no format information, and have no data mask } DataMask dataMask = DataMask.values()[parsedFormatInfo.getDataMask()]; int dimension = bitMatrix.getHeight(); dataMask.unmaskBitMatrix(bitMatrix, dimension); }
[ "void", "remask", "(", ")", "{", "if", "(", "parsedFormatInfo", "==", "null", ")", "{", "return", ";", "// We have no format information, and have no data mask", "}", "DataMask", "dataMask", "=", "DataMask", ".", "values", "(", ")", "[", "parsedFormatInfo", ".", ...
Revert the mask removal done while reading the code words. The bit matrix should revert to its original state.
[ "Revert", "the", "mask", "removal", "done", "while", "reading", "the", "code", "words", ".", "The", "bit", "matrix", "should", "revert", "to", "its", "original", "state", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java#L210-L217
125,246
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java
BitMatrixParser.mirror
void mirror() { for (int x = 0; x < bitMatrix.getWidth(); x++) { for (int y = x + 1; y < bitMatrix.getHeight(); y++) { if (bitMatrix.get(x, y) != bitMatrix.get(y, x)) { bitMatrix.flip(y, x); bitMatrix.flip(x, y); } } } }
java
void mirror() { for (int x = 0; x < bitMatrix.getWidth(); x++) { for (int y = x + 1; y < bitMatrix.getHeight(); y++) { if (bitMatrix.get(x, y) != bitMatrix.get(y, x)) { bitMatrix.flip(y, x); bitMatrix.flip(x, y); } } } }
[ "void", "mirror", "(", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "bitMatrix", ".", "getWidth", "(", ")", ";", "x", "++", ")", "{", "for", "(", "int", "y", "=", "x", "+", "1", ";", "y", "<", "bitMatrix", ".", "getHeight", "(...
Mirror the bit matrix in order to attempt a second reading.
[ "Mirror", "the", "bit", "matrix", "in", "order", "to", "attempt", "a", "second", "reading", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java#L234-L243
125,247
zxing/zxing
android/src/com/google/zxing/client/android/HttpHelper.java
HttpHelper.downloadViaHttp
public static CharSequence downloadViaHttp(String uri, ContentType type) throws IOException { return downloadViaHttp(uri, type, Integer.MAX_VALUE); }
java
public static CharSequence downloadViaHttp(String uri, ContentType type) throws IOException { return downloadViaHttp(uri, type, Integer.MAX_VALUE); }
[ "public", "static", "CharSequence", "downloadViaHttp", "(", "String", "uri", ",", "ContentType", "type", ")", "throws", "IOException", "{", "return", "downloadViaHttp", "(", "uri", ",", "type", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Downloads the entire resource instead of part. @param uri URI to retrieve @param type expected text-like MIME type of that content @return content as a {@code String} @throws IOException if the content can't be retrieved because of a bad URI, network problem, etc. @see #downloadViaHttp(String, HttpHelper.ContentType, ...
[ "Downloads", "the", "entire", "resource", "instead", "of", "part", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/HttpHelper.java#L68-L70
125,248
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java
FinderPatternFinder.crossCheckDiagonal
private boolean crossCheckDiagonal(int centerI, int centerJ) { int[] stateCount = getCrossCheckStateCount(); // Start counting up, left from center finding black center mass int i = 0; while (centerI >= i && centerJ >= i && image.get(centerJ - i, centerI - i)) { stateCount[2]++; i++; } ...
java
private boolean crossCheckDiagonal(int centerI, int centerJ) { int[] stateCount = getCrossCheckStateCount(); // Start counting up, left from center finding black center mass int i = 0; while (centerI >= i && centerJ >= i && image.get(centerJ - i, centerI - i)) { stateCount[2]++; i++; } ...
[ "private", "boolean", "crossCheckDiagonal", "(", "int", "centerI", ",", "int", "centerJ", ")", "{", "int", "[", "]", "stateCount", "=", "getCrossCheckStateCount", "(", ")", ";", "// Start counting up, left from center finding black center mass", "int", "i", "=", "0", ...
After a vertical and horizontal scan finds a potential finder pattern, this method "cross-cross-cross-checks" by scanning down diagonally through the center of the possible finder pattern to see if the same proportion is detected. @param centerI row where a finder pattern was detected @param centerJ center of the sect...
[ "After", "a", "vertical", "and", "horizontal", "scan", "finds", "a", "potential", "finder", "pattern", "this", "method", "cross", "-", "cross", "-", "cross", "-", "checks", "by", "scanning", "down", "diagonally", "through", "the", "center", "of", "the", "pos...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java#L263-L321
125,249
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java
FinderPatternFinder.squaredDistance
private static double squaredDistance(FinderPattern a, FinderPattern b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); return x * x + y * y; }
java
private static double squaredDistance(FinderPattern a, FinderPattern b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); return x * x + y * y; }
[ "private", "static", "double", "squaredDistance", "(", "FinderPattern", "a", ",", "FinderPattern", "b", ")", "{", "double", "x", "=", "a", ".", "getX", "(", ")", "-", "b", ".", "getX", "(", ")", ";", "double", "y", "=", "a", ".", "getY", "(", ")", ...
Get square of distance between a and b.
[ "Get", "square", "of", "distance", "between", "a", "and", "b", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java#L598-L602
125,250
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java
PDF417Writer.bitMatrixFromBitArray
private static BitMatrix bitMatrixFromBitArray(byte[][] input, int margin) { // Creates the bit matrix with extra space for whitespace BitMatrix output = new BitMatrix(input[0].length + 2 * margin, input.length + 2 * margin); output.clear(); for (int y = 0, yOutput = output.getHeight() - margin - 1; y <...
java
private static BitMatrix bitMatrixFromBitArray(byte[][] input, int margin) { // Creates the bit matrix with extra space for whitespace BitMatrix output = new BitMatrix(input[0].length + 2 * margin, input.length + 2 * margin); output.clear(); for (int y = 0, yOutput = output.getHeight() - margin - 1; y <...
[ "private", "static", "BitMatrix", "bitMatrixFromBitArray", "(", "byte", "[", "]", "[", "]", "input", ",", "int", "margin", ")", "{", "// Creates the bit matrix with extra space for whitespace", "BitMatrix", "output", "=", "new", "BitMatrix", "(", "input", "[", "0", ...
This takes an array holding the values of the PDF 417 @param input a byte array of information with 0 is black, and 1 is white @param margin border around the barcode @return BitMatrix of the input
[ "This", "takes", "an", "array", "holding", "the", "values", "of", "the", "PDF", "417" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java#L145-L159
125,251
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java
PDF417Writer.rotateArray
private static byte[][] rotateArray(byte[][] bitarray) { byte[][] temp = new byte[bitarray[0].length][bitarray.length]; for (int ii = 0; ii < bitarray.length; ii++) { // This makes the direction consistent on screen when rotating the // screen; int inverseii = bitarray.length - ii - 1; f...
java
private static byte[][] rotateArray(byte[][] bitarray) { byte[][] temp = new byte[bitarray[0].length][bitarray.length]; for (int ii = 0; ii < bitarray.length; ii++) { // This makes the direction consistent on screen when rotating the // screen; int inverseii = bitarray.length - ii - 1; f...
[ "private", "static", "byte", "[", "]", "[", "]", "rotateArray", "(", "byte", "[", "]", "[", "]", "bitarray", ")", "{", "byte", "[", "]", "[", "]", "temp", "=", "new", "byte", "[", "bitarray", "[", "0", "]", ".", "length", "]", "[", "bitarray", ...
Takes and rotates the it 90 degrees
[ "Takes", "and", "rotates", "the", "it", "90", "degrees" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/PDF417Writer.java#L164-L175
125,252
zxing/zxing
core/src/main/java/com/google/zxing/oned/Code39Reader.java
Code39Reader.toNarrowWidePattern
private static int toNarrowWidePattern(int[] counters) { int numCounters = counters.length; int maxNarrowCounter = 0; int wideCounters; do { int minCounter = Integer.MAX_VALUE; for (int counter : counters) { if (counter < minCounter && counter > maxNarrowCounter) { minCount...
java
private static int toNarrowWidePattern(int[] counters) { int numCounters = counters.length; int maxNarrowCounter = 0; int wideCounters; do { int minCounter = Integer.MAX_VALUE; for (int counter : counters) { if (counter < minCounter && counter > maxNarrowCounter) { minCount...
[ "private", "static", "int", "toNarrowWidePattern", "(", "int", "[", "]", "counters", ")", "{", "int", "numCounters", "=", "counters", ".", "length", ";", "int", "maxNarrowCounter", "=", "0", ";", "int", "wideCounters", ";", "do", "{", "int", "minCounter", ...
per image when using some of our blackbox images.
[ "per", "image", "when", "using", "some", "of", "our", "blackbox", "images", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/Code39Reader.java#L214-L255
125,253
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/detector/Detector.java
Detector.detect
private static List<ResultPoint[]> detect(boolean multiple, BitMatrix bitMatrix) { List<ResultPoint[]> barcodeCoordinates = new ArrayList<>(); int row = 0; int column = 0; boolean foundBarcodeInRow = false; while (row < bitMatrix.getHeight()) { ResultPoint[] vertices = findVertices(bitMatrix, ...
java
private static List<ResultPoint[]> detect(boolean multiple, BitMatrix bitMatrix) { List<ResultPoint[]> barcodeCoordinates = new ArrayList<>(); int row = 0; int column = 0; boolean foundBarcodeInRow = false; while (row < bitMatrix.getHeight()) { ResultPoint[] vertices = findVertices(bitMatrix, ...
[ "private", "static", "List", "<", "ResultPoint", "[", "]", ">", "detect", "(", "boolean", "multiple", ",", "BitMatrix", "bitMatrix", ")", "{", "List", "<", "ResultPoint", "[", "]", ">", "barcodeCoordinates", "=", "new", "ArrayList", "<>", "(", ")", ";", ...
Detects PDF417 codes in an image. Only checks 0 degree rotation @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will be found and returned @param bitMatrix bit matrix to detect barcodes in @return List of ResultPoint arrays containing the coordinates of found barc...
[ "Detects", "PDF417", "codes", "in", "an", "image", ".", "Only", "checks", "0", "degree", "rotation" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/detector/Detector.java#L97-L141
125,254
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/detector/Detector.java
Detector.findVertices
private static ResultPoint[] findVertices(BitMatrix matrix, int startRow, int startColumn) { int height = matrix.getHeight(); int width = matrix.getWidth(); ResultPoint[] result = new ResultPoint[8]; copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN), ...
java
private static ResultPoint[] findVertices(BitMatrix matrix, int startRow, int startColumn) { int height = matrix.getHeight(); int width = matrix.getWidth(); ResultPoint[] result = new ResultPoint[8]; copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN), ...
[ "private", "static", "ResultPoint", "[", "]", "findVertices", "(", "BitMatrix", "matrix", ",", "int", "startRow", ",", "int", "startColumn", ")", "{", "int", "height", "=", "matrix", ".", "getHeight", "(", ")", ";", "int", "width", "=", "matrix", ".", "g...
Locate the vertices and the codewords area of a black blob using the Start and Stop patterns as locators. @param matrix the scanned barcode image. @return an array containing the vertices: vertices[0] x, y top left barcode vertices[1] x, y bottom left barcode vertices[2] x, y top right barcode vertices[3] x, y bottom ...
[ "Locate", "the", "vertices", "and", "the", "codewords", "area", "of", "a", "black", "blob", "using", "the", "Start", "and", "Stop", "patterns", "as", "locators", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/detector/Detector.java#L158-L173
125,255
zxing/zxing
android/src/com/google/zxing/client/android/camera/CameraManager.java
CameraManager.openDriver
public synchronized void openDriver(SurfaceHolder holder) throws IOException { OpenCamera theCamera = camera; if (theCamera == null) { theCamera = OpenCameraInterface.open(requestedCameraId); if (theCamera == null) { throw new IOException("Camera.open() failed to return object from driver");...
java
public synchronized void openDriver(SurfaceHolder holder) throws IOException { OpenCamera theCamera = camera; if (theCamera == null) { theCamera = OpenCameraInterface.open(requestedCameraId); if (theCamera == null) { throw new IOException("Camera.open() failed to return object from driver");...
[ "public", "synchronized", "void", "openDriver", "(", "SurfaceHolder", "holder", ")", "throws", "IOException", "{", "OpenCamera", "theCamera", "=", "camera", ";", "if", "(", "theCamera", "==", "null", ")", "{", "theCamera", "=", "OpenCameraInterface", ".", "open"...
Opens the camera driver and initializes the hardware parameters. @param holder The surface object which the camera will draw preview frames into. @throws IOException Indicates the camera driver failed to open.
[ "Opens", "the", "camera", "driver", "and", "initializes", "the", "hardware", "parameters", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L78-L122
125,256
zxing/zxing
android/src/com/google/zxing/client/android/camera/CameraManager.java
CameraManager.closeDriver
public synchronized void closeDriver() { if (camera != null) { camera.getCamera().release(); camera = null; // Make sure to clear these each time we close the camera, so that any scanning rect // requested by intent is forgotten. framingRect = null; framingRectInPreview = null; ...
java
public synchronized void closeDriver() { if (camera != null) { camera.getCamera().release(); camera = null; // Make sure to clear these each time we close the camera, so that any scanning rect // requested by intent is forgotten. framingRect = null; framingRectInPreview = null; ...
[ "public", "synchronized", "void", "closeDriver", "(", ")", "{", "if", "(", "camera", "!=", "null", ")", "{", "camera", ".", "getCamera", "(", ")", ".", "release", "(", ")", ";", "camera", "=", "null", ";", "// Make sure to clear these each time we close the ca...
Closes the camera driver if still in use.
[ "Closes", "the", "camera", "driver", "if", "still", "in", "use", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L131-L140
125,257
zxing/zxing
android/src/com/google/zxing/client/android/camera/CameraManager.java
CameraManager.getFramingRect
public synchronized Rect getFramingRect() { if (framingRect == null) { if (camera == null) { return null; } Point screenResolution = configManager.getScreenResolution(); if (screenResolution == null) { // Called early, before init even finished return null; } ...
java
public synchronized Rect getFramingRect() { if (framingRect == null) { if (camera == null) { return null; } Point screenResolution = configManager.getScreenResolution(); if (screenResolution == null) { // Called early, before init even finished return null; } ...
[ "public", "synchronized", "Rect", "getFramingRect", "(", ")", "{", "if", "(", "framingRect", "==", "null", ")", "{", "if", "(", "camera", "==", "null", ")", "{", "return", "null", ";", "}", "Point", "screenResolution", "=", "configManager", ".", "getScreen...
Calculates the framing rect which the UI should draw to show the user where to place the barcode. This target helps with alignment as well as forces the user to hold the device far enough away to ensure the image will be in focus. @return The rectangle to draw on screen in window coordinates.
[ "Calculates", "the", "framing", "rect", "which", "the", "UI", "should", "draw", "to", "show", "the", "user", "where", "to", "place", "the", "barcode", ".", "This", "target", "helps", "with", "alignment", "as", "well", "as", "forces", "the", "user", "to", ...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L213-L233
125,258
zxing/zxing
android/src/com/google/zxing/client/android/camera/CameraManager.java
CameraManager.setManualFramingRect
public synchronized void setManualFramingRect(int width, int height) { if (initialized) { Point screenResolution = configManager.getScreenResolution(); if (width > screenResolution.x) { width = screenResolution.x; } if (height > screenResolution.y) { height = screenResolution...
java
public synchronized void setManualFramingRect(int width, int height) { if (initialized) { Point screenResolution = configManager.getScreenResolution(); if (width > screenResolution.x) { width = screenResolution.x; } if (height > screenResolution.y) { height = screenResolution...
[ "public", "synchronized", "void", "setManualFramingRect", "(", "int", "width", ",", "int", "height", ")", "{", "if", "(", "initialized", ")", "{", "Point", "screenResolution", "=", "configManager", ".", "getScreenResolution", "(", ")", ";", "if", "(", "width",...
Allows third party apps to specify the scanning rectangle dimensions, rather than determine them automatically based on screen resolution. @param width The width in pixels to scan. @param height The height in pixels to scan.
[ "Allows", "third", "party", "apps", "to", "specify", "the", "scanning", "rectangle", "dimensions", "rather", "than", "determine", "them", "automatically", "based", "on", "screen", "resolution", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L292-L310
125,259
zxing/zxing
android/src/com/google/zxing/client/android/camera/CameraManager.java
CameraManager.buildLuminanceSource
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) { Rect rect = getFramingRectInPreview(); if (rect == null) { return null; } // Go ahead and assume it's YUV rather than die. return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, ...
java
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) { Rect rect = getFramingRectInPreview(); if (rect == null) { return null; } // Go ahead and assume it's YUV rather than die. return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, ...
[ "public", "PlanarYUVLuminanceSource", "buildLuminanceSource", "(", "byte", "[", "]", "data", ",", "int", "width", ",", "int", "height", ")", "{", "Rect", "rect", "=", "getFramingRectInPreview", "(", ")", ";", "if", "(", "rect", "==", "null", ")", "{", "ret...
A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters. @param data A preview frame. @param width The width of the image. @param height The height of the image. @return A PlanarYUVLuminanceSource instance.
[ "A", "factory", "method", "to", "build", "the", "appropriate", "LuminanceSource", "object", "based", "on", "the", "format", "of", "the", "preview", "buffers", "as", "described", "by", "Camera", ".", "Parameters", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L321-L329
125,260
zxing/zxing
core/src/main/java/com/google/zxing/BinaryBitmap.java
BinaryBitmap.getBlackRow
public BitArray getBlackRow(int y, BitArray row) throws NotFoundException { return binarizer.getBlackRow(y, row); }
java
public BitArray getBlackRow(int y, BitArray row) throws NotFoundException { return binarizer.getBlackRow(y, row); }
[ "public", "BitArray", "getBlackRow", "(", "int", "y", ",", "BitArray", "row", ")", "throws", "NotFoundException", "{", "return", "binarizer", ".", "getBlackRow", "(", "y", ",", "row", ")", ";", "}" ]
Converts one row of luminance data to 1 bit data. May actually do the conversion, or return cached data. Callers should assume this method is expensive and call it as seldom as possible. This method is intended for decoding 1D barcodes and may choose to apply sharpening. @param y The row to fetch, which must be in [0,...
[ "Converts", "one", "row", "of", "luminance", "data", "to", "1", "bit", "data", ".", "May", "actually", "do", "the", "conversion", "or", "return", "cached", "data", ".", "Callers", "should", "assume", "this", "method", "is", "expensive", "and", "call", "it"...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/BinaryBitmap.java#L65-L67
125,261
zxing/zxing
core/src/main/java/com/google/zxing/client/result/URIResultParser.java
URIResultParser.parse
@Override public URIParsedResult parse(Result result) { String rawText = getMassagedText(result); // We specifically handle the odd "URL" scheme here for simplicity and add "URI" for fun // Assume anything starting this way really means to be a URI if (rawText.startsWith("URL:") || rawText.startsWith(...
java
@Override public URIParsedResult parse(Result result) { String rawText = getMassagedText(result); // We specifically handle the odd "URL" scheme here for simplicity and add "URI" for fun // Assume anything starting this way really means to be a URI if (rawText.startsWith("URL:") || rawText.startsWith(...
[ "@", "Override", "public", "URIParsedResult", "parse", "(", "Result", "result", ")", "{", "String", "rawText", "=", "getMassagedText", "(", "result", ")", ";", "// We specifically handle the odd \"URL\" scheme here for simplicity and add \"URI\" for fun", "// Assume anything st...
query, path or nothing
[ "query", "path", "or", "nothing" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/client/result/URIResultParser.java#L41-L54
125,262
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.detect
public AztecDetectorResult detect(boolean isMirror) throws NotFoundException { // 1. Get the center of the aztec matrix Point pCenter = getMatrixCenter(); // 2. Get the center points of the four diagonal points just outside the bull's eye // [topRight, bottomRight, bottomLeft, topLeft] ResultPoin...
java
public AztecDetectorResult detect(boolean isMirror) throws NotFoundException { // 1. Get the center of the aztec matrix Point pCenter = getMatrixCenter(); // 2. Get the center points of the four diagonal points just outside the bull's eye // [topRight, bottomRight, bottomLeft, topLeft] ResultPoin...
[ "public", "AztecDetectorResult", "detect", "(", "boolean", "isMirror", ")", "throws", "NotFoundException", "{", "// 1. Get the center of the aztec matrix", "Point", "pCenter", "=", "getMatrixCenter", "(", ")", ";", "// 2. Get the center points of the four diagonal points just out...
Detects an Aztec Code in an image. @param isMirror if true, image is a mirror-image of original @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code @throws NotFoundException if no Aztec Code can be found
[ "Detects", "an", "Aztec", "Code", "in", "an", "image", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L69-L98
125,263
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.extractParameters
private void extractParameters(ResultPoint[] bullsEyeCorners) throws NotFoundException { if (!isValid(bullsEyeCorners[0]) || !isValid(bullsEyeCorners[1]) || !isValid(bullsEyeCorners[2]) || !isValid(bullsEyeCorners[3])) { throw NotFoundException.getNotFoundInstance(); } int length = 2 * nbCente...
java
private void extractParameters(ResultPoint[] bullsEyeCorners) throws NotFoundException { if (!isValid(bullsEyeCorners[0]) || !isValid(bullsEyeCorners[1]) || !isValid(bullsEyeCorners[2]) || !isValid(bullsEyeCorners[3])) { throw NotFoundException.getNotFoundInstance(); } int length = 2 * nbCente...
[ "private", "void", "extractParameters", "(", "ResultPoint", "[", "]", "bullsEyeCorners", ")", "throws", "NotFoundException", "{", "if", "(", "!", "isValid", "(", "bullsEyeCorners", "[", "0", "]", ")", "||", "!", "isValid", "(", "bullsEyeCorners", "[", "1", "...
Extracts the number of data layers and data blocks from the layer around the bull's eye. @param bullsEyeCorners the array of bull's eye corners @throws NotFoundException in case of too many errors or invalid parameters
[ "Extracts", "the", "number", "of", "data", "layers", "and", "data", "blocks", "from", "the", "layer", "around", "the", "bull", "s", "eye", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L106-L154
125,264
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.getCorrectedParameterData
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException { int numCodewords; int numDataCodewords; if (compact) { numCodewords = 7; numDataCodewords = 2; } else { numCodewords = 10; numDataCodewords = 4; } int numECCodew...
java
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException { int numCodewords; int numDataCodewords; if (compact) { numCodewords = 7; numDataCodewords = 2; } else { numCodewords = 10; numDataCodewords = 4; } int numECCodew...
[ "private", "static", "int", "getCorrectedParameterData", "(", "long", "parameterData", ",", "boolean", "compact", ")", "throws", "NotFoundException", "{", "int", "numCodewords", ";", "int", "numDataCodewords", ";", "if", "(", "compact", ")", "{", "numCodewords", "...
Corrects the parameter bits using Reed-Solomon algorithm. @param parameterData parameter bits @param compact true if this is a compact Aztec code @throws NotFoundException if the array contains too many errors
[ "Corrects", "the", "parameter", "bits", "using", "Reed", "-", "Solomon", "algorithm", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L194-L224
125,265
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.sampleGrid
private BitMatrix sampleGrid(BitMatrix image, ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomRight, ResultPoint bottomLeft) throws NotFoundException { GridSampler sampler = Grid...
java
private BitMatrix sampleGrid(BitMatrix image, ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomRight, ResultPoint bottomLeft) throws NotFoundException { GridSampler sampler = Grid...
[ "private", "BitMatrix", "sampleGrid", "(", "BitMatrix", "image", ",", "ResultPoint", "topLeft", ",", "ResultPoint", "topRight", ",", "ResultPoint", "bottomRight", ",", "ResultPoint", "bottomLeft", ")", "throws", "NotFoundException", "{", "GridSampler", "sampler", "=",...
Creates a BitMatrix by sampling the provided image. topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the diagonal just outside the bull's eye.
[ "Creates", "a", "BitMatrix", "by", "sampling", "the", "provided", "image", ".", "topLeft", "topRight", "bottomRight", "and", "bottomLeft", "are", "the", "centers", "of", "the", "squares", "on", "the", "diagonal", "just", "outside", "the", "bull", "s", "eye", ...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L367-L390
125,266
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.sampleLine
private int sampleLine(ResultPoint p1, ResultPoint p2, int size) { int result = 0; float d = distance(p1, p2); float moduleSize = d / size; float px = p1.getX(); float py = p1.getY(); float dx = moduleSize * (p2.getX() - p1.getX()) / d; float dy = moduleSize * (p2.getY() - p1.getY()) / d; ...
java
private int sampleLine(ResultPoint p1, ResultPoint p2, int size) { int result = 0; float d = distance(p1, p2); float moduleSize = d / size; float px = p1.getX(); float py = p1.getY(); float dx = moduleSize * (p2.getX() - p1.getX()) / d; float dy = moduleSize * (p2.getY() - p1.getY()) / d; ...
[ "private", "int", "sampleLine", "(", "ResultPoint", "p1", ",", "ResultPoint", "p2", ",", "int", "size", ")", "{", "int", "result", "=", "0", ";", "float", "d", "=", "distance", "(", "p1", ",", "p2", ")", ";", "float", "moduleSize", "=", "d", "/", "...
Samples a line. @param p1 start point (inclusive) @param p2 end point (exclusive) @param size number of bits @return the array of bits as an int (first bit is high-order bit of result)
[ "Samples", "a", "line", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L400-L415
125,267
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.getColor
private int getColor(Point p1, Point p2) { float d = distance(p1, p2); float dx = (p2.getX() - p1.getX()) / d; float dy = (p2.getY() - p1.getY()) / d; int error = 0; float px = p1.getX(); float py = p1.getY(); boolean colorModel = image.get(p1.getX(), p1.getY()); int iMax = (int) Math...
java
private int getColor(Point p1, Point p2) { float d = distance(p1, p2); float dx = (p2.getX() - p1.getX()) / d; float dy = (p2.getY() - p1.getY()) / d; int error = 0; float px = p1.getX(); float py = p1.getY(); boolean colorModel = image.get(p1.getX(), p1.getY()); int iMax = (int) Math...
[ "private", "int", "getColor", "(", "Point", "p1", ",", "Point", "p2", ")", "{", "float", "d", "=", "distance", "(", "p1", ",", "p2", ")", ";", "float", "dx", "=", "(", "p2", ".", "getX", "(", ")", "-", "p1", ".", "getX", "(", ")", ")", "/", ...
Gets the color of a segment @return 1 if segment more than 90% black, -1 if segment is more than 90% white, 0 else
[ "Gets", "the", "color", "of", "a", "segment" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L462-L489
125,268
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.getFirstDifferent
private Point getFirstDifferent(Point init, boolean color, int dx, int dy) { int x = init.getX() + dx; int y = init.getY() + dy; while (isValid(x, y) && image.get(x, y) == color) { x += dx; y += dy; } x -= dx; y -= dy; while (isValid(x, y) && image.get(x, y) == color) { ...
java
private Point getFirstDifferent(Point init, boolean color, int dx, int dy) { int x = init.getX() + dx; int y = init.getY() + dy; while (isValid(x, y) && image.get(x, y) == color) { x += dx; y += dy; } x -= dx; y -= dy; while (isValid(x, y) && image.get(x, y) == color) { ...
[ "private", "Point", "getFirstDifferent", "(", "Point", "init", ",", "boolean", "color", ",", "int", "dx", ",", "int", "dy", ")", "{", "int", "x", "=", "init", ".", "getX", "(", ")", "+", "dx", ";", "int", "y", "=", "init", ".", "getY", "(", ")", ...
Gets the coordinate of the first point with a different color in the given direction
[ "Gets", "the", "coordinate", "of", "the", "first", "point", "with", "a", "different", "color", "in", "the", "given", "direction" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L494-L517
125,269
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.expandSquare
private static ResultPoint[] expandSquare(ResultPoint[] cornerPoints, int oldSide, int newSide) { float ratio = newSide / (2.0f * oldSide); float dx = cornerPoints[0].getX() - cornerPoints[2].getX(); float dy = cornerPoints[0].getY() - cornerPoints[2].getY(); float centerx = (cornerPoints[0].getX() + co...
java
private static ResultPoint[] expandSquare(ResultPoint[] cornerPoints, int oldSide, int newSide) { float ratio = newSide / (2.0f * oldSide); float dx = cornerPoints[0].getX() - cornerPoints[2].getX(); float dy = cornerPoints[0].getY() - cornerPoints[2].getY(); float centerx = (cornerPoints[0].getX() + co...
[ "private", "static", "ResultPoint", "[", "]", "expandSquare", "(", "ResultPoint", "[", "]", "cornerPoints", ",", "int", "oldSide", ",", "int", "newSide", ")", "{", "float", "ratio", "=", "newSide", "/", "(", "2.0f", "*", "oldSide", ")", ";", "float", "dx...
Expand the square represented by the corner points by pushing out equally in all directions @param cornerPoints the corners of the square, which has the bull's eye at its center @param oldSide the original length of the side of the square in the target bit matrix @param newSide the new length of the size of the square...
[ "Expand", "the", "square", "represented", "by", "the", "corner", "points", "by", "pushing", "out", "equally", "in", "all", "directions" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L527-L545
125,270
zxing/zxing
core/src/main/java/com/google/zxing/common/detector/MonochromeRectangleDetector.java
MonochromeRectangleDetector.findCornerFromCenter
private ResultPoint findCornerFromCenter(int centerX, int deltaX, int left, int right, int centerY, int d...
java
private ResultPoint findCornerFromCenter(int centerX, int deltaX, int left, int right, int centerY, int d...
[ "private", "ResultPoint", "findCornerFromCenter", "(", "int", "centerX", ",", "int", "deltaX", ",", "int", "left", ",", "int", "right", ",", "int", "centerY", ",", "int", "deltaY", ",", "int", "top", ",", "int", "bottom", ",", "int", "maxWhiteRun", ")", ...
Attempts to locate a corner of the barcode by scanning up, down, left or right from a center point which should be within the barcode. @param centerX center's x component (horizontal) @param deltaX same as deltaY but change in x per step instead @param left minimum value of x @param right maximum value of x @param cen...
[ "Attempts", "to", "locate", "a", "corner", "of", "the", "barcode", "by", "scanning", "up", "down", "left", "or", "right", "from", "a", "center", "point", "which", "should", "be", "within", "the", "barcode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/detector/MonochromeRectangleDetector.java#L102-L154
125,271
zxing/zxing
core/src/main/java/com/google/zxing/common/detector/MonochromeRectangleDetector.java
MonochromeRectangleDetector.blackWhiteRange
private int[] blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, boolean horizontal) { int center = (minDim + maxDim) / 2; // Scan left/up first int start = center; while (start >= minDim) { if (horizontal ? image.get(start, fixedDimension) : image.get(fixedDimension, s...
java
private int[] blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, boolean horizontal) { int center = (minDim + maxDim) / 2; // Scan left/up first int start = center; while (start >= minDim) { if (horizontal ? image.get(start, fixedDimension) : image.get(fixedDimension, s...
[ "private", "int", "[", "]", "blackWhiteRange", "(", "int", "fixedDimension", ",", "int", "maxWhiteRun", ",", "int", "minDim", ",", "int", "maxDim", ",", "boolean", "horizontal", ")", "{", "int", "center", "=", "(", "minDim", "+", "maxDim", ")", "/", "2",...
Computes the start and end of a region of pixels, either horizontally or vertically, that could be part of a Data Matrix barcode. @param fixedDimension if scanning horizontally, this is the row (the fixed vertical location) where we are scanning. If scanning vertically it's the column, the fixed horizontal location @p...
[ "Computes", "the", "start", "and", "end", "of", "a", "region", "of", "pixels", "either", "horizontally", "or", "vertically", "that", "could", "be", "part", "of", "a", "Data", "Matrix", "barcode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/detector/MonochromeRectangleDetector.java#L170-L215
125,272
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java
DecodedBitStreamParser.decodeHanziSegment
private static void decodeHanziSegment(BitSource bits, StringBuilder result, int count) throws FormatException { // Don't crash trying to read more bits than we have available. if (count * 13 > bits.available()) { throw Form...
java
private static void decodeHanziSegment(BitSource bits, StringBuilder result, int count) throws FormatException { // Don't crash trying to read more bits than we have available. if (count * 13 > bits.available()) { throw Form...
[ "private", "static", "void", "decodeHanziSegment", "(", "BitSource", "bits", ",", "StringBuilder", "result", ",", "int", "count", ")", "throws", "FormatException", "{", "// Don't crash trying to read more bits than we have available.", "if", "(", "count", "*", "13", ">"...
See specification GBT 18284-2000
[ "See", "specification", "GBT", "18284", "-", "2000" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java#L147-L181
125,273
zxing/zxing
android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java
WifiConfigManager.changeNetworkWEP
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) { WifiConfiguration config = changeNetworkCommon(wifiResult); config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58); config.wepTxKeyIndex = 0; config.allowedAuthAlgorithms.set(WifiConfiguration.Aut...
java
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) { WifiConfiguration config = changeNetworkCommon(wifiResult); config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58); config.wepTxKeyIndex = 0; config.allowedAuthAlgorithms.set(WifiConfiguration.Aut...
[ "private", "static", "void", "changeNetworkWEP", "(", "WifiManager", "wifiManager", ",", "WifiParsedResult", "wifiResult", ")", "{", "WifiConfiguration", "config", "=", "changeNetworkCommon", "(", "wifiResult", ")", ";", "config", ".", "wepKeys", "[", "0", "]", "=...
Adding a WEP network
[ "Adding", "a", "WEP", "network" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java#L142-L153
125,274
zxing/zxing
android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java
WifiConfigManager.changeNetworkWPA
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) { WifiConfiguration config = changeNetworkCommon(wifiResult); // Hex passwords that are 64 bits long are not to be quoted. config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64); config.allowedAuthAlgorit...
java
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) { WifiConfiguration config = changeNetworkCommon(wifiResult); // Hex passwords that are 64 bits long are not to be quoted. config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64); config.allowedAuthAlgorit...
[ "private", "static", "void", "changeNetworkWPA", "(", "WifiManager", "wifiManager", ",", "WifiParsedResult", "wifiResult", ")", "{", "WifiConfiguration", "config", "=", "changeNetworkCommon", "(", "wifiResult", ")", ";", "// Hex passwords that are 64 bits long are not to be q...
Adding a WPA or WPA2 network
[ "Adding", "a", "WPA", "or", "WPA2", "network" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java#L156-L170
125,275
zxing/zxing
android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java
WifiConfigManager.changeNetworkUnEncrypted
private static void changeNetworkUnEncrypted(WifiManager wifiManager, WifiParsedResult wifiResult) { WifiConfiguration config = changeNetworkCommon(wifiResult); config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); updateNetwork(wifiManager, config); }
java
private static void changeNetworkUnEncrypted(WifiManager wifiManager, WifiParsedResult wifiResult) { WifiConfiguration config = changeNetworkCommon(wifiResult); config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); updateNetwork(wifiManager, config); }
[ "private", "static", "void", "changeNetworkUnEncrypted", "(", "WifiManager", "wifiManager", ",", "WifiParsedResult", "wifiResult", ")", "{", "WifiConfiguration", "config", "=", "changeNetworkCommon", "(", "wifiResult", ")", ";", "config", ".", "allowedKeyManagement", "....
Adding an open, unsecured network
[ "Adding", "an", "open", "unsecured", "network" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java#L193-L197
125,276
zxing/zxing
android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java
WifiConfigManager.convertToQuotedString
private static String convertToQuotedString(String s) { if (s == null || s.isEmpty()) { return null; } // If already quoted, return as-is if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') { return s; } return '\"' + s + '\"'; }
java
private static String convertToQuotedString(String s) { if (s == null || s.isEmpty()) { return null; } // If already quoted, return as-is if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') { return s; } return '\"' + s + '\"'; }
[ "private", "static", "String", "convertToQuotedString", "(", "String", "s", ")", "{", "if", "(", "s", "==", "null", "||", "s", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "// If already quoted, return as-is", "if", "(", "s", ".", "cha...
Encloses the incoming string inside double quotes, if it isn't already quoted. @param s the input string @return a quoted string, of the form "input". If the input string is null, it returns null as well.
[ "Encloses", "the", "incoming", "string", "inside", "double", "quotes", "if", "it", "isn", "t", "already", "quoted", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java#L222-L231
125,277
zxing/zxing
android/src/com/google/zxing/client/android/result/WifiResultHandler.java
WifiResultHandler.getDisplayContents
@Override public CharSequence getDisplayContents() { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); return wifiResult.getSsid() + " (" + wifiResult.getNetworkEncryption() + ')'; }
java
@Override public CharSequence getDisplayContents() { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); return wifiResult.getSsid() + " (" + wifiResult.getNetworkEncryption() + ')'; }
[ "@", "Override", "public", "CharSequence", "getDisplayContents", "(", ")", "{", "WifiParsedResult", "wifiResult", "=", "(", "WifiParsedResult", ")", "getResult", "(", ")", ";", "return", "wifiResult", ".", "getSsid", "(", ")", "+", "\" (\"", "+", "wifiResult", ...
Display the name of the network and the network type to the user.
[ "Display", "the", "name", "of", "the", "network", "and", "the", "network", "type", "to", "the", "user", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/WifiResultHandler.java#L82-L86
125,278
zxing/zxing
core/src/main/java/com/google/zxing/ResultPoint.java
ResultPoint.crossProductZ
private static float crossProductZ(ResultPoint pointA, ResultPoint pointB, ResultPoint pointC) { float bX = pointB.x; float bY = pointB.y; return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX)); }
java
private static float crossProductZ(ResultPoint pointA, ResultPoint pointB, ResultPoint pointC) { float bX = pointB.x; float bY = pointB.y; return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX)); }
[ "private", "static", "float", "crossProductZ", "(", "ResultPoint", "pointA", ",", "ResultPoint", "pointB", ",", "ResultPoint", "pointC", ")", "{", "float", "bX", "=", "pointB", ".", "x", ";", "float", "bY", "=", "pointB", ".", "y", ";", "return", "(", "(...
Returns the z component of the cross product between vectors BC and BA.
[ "Returns", "the", "z", "component", "of", "the", "cross", "product", "between", "vectors", "BC", "and", "BA", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/ResultPoint.java#L122-L128
125,279
zxing/zxing
android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
QRCodeEncoder.encodeContentsFromZXingIntent
private void encodeContentsFromZXingIntent(Intent intent) { // Default to QR_CODE if no format given. String formatString = intent.getStringExtra(Intents.Encode.FORMAT); format = null; if (formatString != null) { try { format = BarcodeFormat.valueOf(formatString); } catch (IllegalAr...
java
private void encodeContentsFromZXingIntent(Intent intent) { // Default to QR_CODE if no format given. String formatString = intent.getStringExtra(Intents.Encode.FORMAT); format = null; if (formatString != null) { try { format = BarcodeFormat.valueOf(formatString); } catch (IllegalAr...
[ "private", "void", "encodeContentsFromZXingIntent", "(", "Intent", "intent", ")", "{", "// Default to QR_CODE if no format given.", "String", "formatString", "=", "intent", ".", "getStringExtra", "(", "Intents", ".", "Encode", ".", "FORMAT", ")", ";", "format", "=", ...
but we use platform specific code like PhoneNumberUtils, so it can't.
[ "but", "we", "use", "platform", "specific", "code", "like", "PhoneNumberUtils", "so", "it", "can", "t", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java#L102-L127
125,280
zxing/zxing
android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
QRCodeEncoder.encodeContentsFromShareIntent
private void encodeContentsFromShareIntent(Intent intent) throws WriterException { // Check if this is a plain text encoding, or contact if (intent.hasExtra(Intent.EXTRA_STREAM)) { encodeFromStreamExtra(intent); } else { encodeFromTextExtras(intent); } }
java
private void encodeContentsFromShareIntent(Intent intent) throws WriterException { // Check if this is a plain text encoding, or contact if (intent.hasExtra(Intent.EXTRA_STREAM)) { encodeFromStreamExtra(intent); } else { encodeFromTextExtras(intent); } }
[ "private", "void", "encodeContentsFromShareIntent", "(", "Intent", "intent", ")", "throws", "WriterException", "{", "// Check if this is a plain text encoding, or contact", "if", "(", "intent", ".", "hasExtra", "(", "Intent", ".", "EXTRA_STREAM", ")", ")", "{", "encodeF...
Handles send intents from multitude of Android applications
[ "Handles", "send", "intents", "from", "multitude", "of", "Android", "applications" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java#L130-L137
125,281
zxing/zxing
android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java
QRCodeEncoder.encodeFromStreamExtra
private void encodeFromStreamExtra(Intent intent) throws WriterException { format = BarcodeFormat.QR_CODE; Bundle bundle = intent.getExtras(); if (bundle == null) { throw new WriterException("No extras"); } Uri uri = bundle.getParcelable(Intent.EXTRA_STREAM); if (uri == null) { throw...
java
private void encodeFromStreamExtra(Intent intent) throws WriterException { format = BarcodeFormat.QR_CODE; Bundle bundle = intent.getExtras(); if (bundle == null) { throw new WriterException("No extras"); } Uri uri = bundle.getParcelable(Intent.EXTRA_STREAM); if (uri == null) { throw...
[ "private", "void", "encodeFromStreamExtra", "(", "Intent", "intent", ")", "throws", "WriterException", "{", "format", "=", "BarcodeFormat", ".", "QR_CODE", ";", "Bundle", "bundle", "=", "intent", ".", "getExtras", "(", ")", ";", "if", "(", "bundle", "==", "n...
Handles send intents from the Contacts app, retrieving a contact as a VCARD.
[ "Handles", "send", "intents", "from", "the", "Contacts", "app", "retrieving", "a", "contact", "as", "a", "VCARD", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java#L176-L214
125,282
zxing/zxing
core/src/main/java/com/google/zxing/oned/CodaBarReader.java
CodaBarReader.setCounters
private void setCounters(BitArray row) throws NotFoundException { counterLength = 0; // Start from the first white bit. int i = row.getNextUnset(0); int end = row.getSize(); if (i >= end) { throw NotFoundException.getNotFoundInstance(); } boolean isWhite = true; int count = 0; ...
java
private void setCounters(BitArray row) throws NotFoundException { counterLength = 0; // Start from the first white bit. int i = row.getNextUnset(0); int end = row.getSize(); if (i >= end) { throw NotFoundException.getNotFoundInstance(); } boolean isWhite = true; int count = 0; ...
[ "private", "void", "setCounters", "(", "BitArray", "row", ")", "throws", "NotFoundException", "{", "counterLength", "=", "0", ";", "// Start from the first white bit.", "int", "i", "=", "row", ".", "getNextUnset", "(", "0", ")", ";", "int", "end", "=", "row", ...
Records the size of all runs of white and black pixels, starting with white. This is just like recordPattern, except it records all the counters, and uses our builtin "counters" member for storage. @param row row to count from
[ "Records", "the", "size", "of", "all", "runs", "of", "white", "and", "black", "pixels", "starting", "with", "white", ".", "This", "is", "just", "like", "recordPattern", "except", "it", "records", "all", "the", "counters", "and", "uses", "our", "builtin", "...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/CodaBarReader.java#L230-L251
125,283
zxing/zxing
core/src/main/java/com/google/zxing/oned/OneDReader.java
OneDReader.decode
@Override public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException { try { return doDecode(image, hints); } catch (NotFoundException nfe) { boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER...
java
@Override public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException { try { return doDecode(image, hints); } catch (NotFoundException nfe) { boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER...
[ "@", "Override", "public", "Result", "decode", "(", "BinaryBitmap", "image", ",", "Map", "<", "DecodeHintType", ",", "?", ">", "hints", ")", "throws", "NotFoundException", ",", "FormatException", "{", "try", "{", "return", "doDecode", "(", "image", ",", "hin...
Note that we don't try rotation without the try harder flag, even if rotation was supported.
[ "Note", "that", "we", "don", "t", "try", "rotation", "without", "the", "try", "harder", "flag", "even", "if", "rotation", "was", "supported", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/OneDReader.java#L50-L82
125,284
zxing/zxing
core/src/main/java/com/google/zxing/oned/OneDReader.java
OneDReader.recordPattern
protected static void recordPattern(BitArray row, int start, int[] counters) throws NotFoundException { int numCounters = counters.length; Arrays.fill(counters, 0, numCounters, 0); int end = row.getSize(); if (start >= end) { ...
java
protected static void recordPattern(BitArray row, int start, int[] counters) throws NotFoundException { int numCounters = counters.length; Arrays.fill(counters, 0, numCounters, 0); int end = row.getSize(); if (start >= end) { ...
[ "protected", "static", "void", "recordPattern", "(", "BitArray", "row", ",", "int", "start", ",", "int", "[", "]", "counters", ")", "throws", "NotFoundException", "{", "int", "numCounters", "=", "counters", ".", "length", ";", "Arrays", ".", "fill", "(", "...
Records the size of successive runs of white and black pixels in a row, starting at a given point. The values are recorded in the given array, and the number of runs recorded is equal to the size of the array. If the row starts on a white pixel at the given start point, then the first count recorded is the run of white...
[ "Records", "the", "size", "of", "successive", "runs", "of", "white", "and", "black", "pixels", "in", "a", "row", "starting", "at", "a", "given", "point", ".", "The", "values", "are", "recorded", "in", "the", "given", "array", "and", "the", "number", "of"...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/OneDReader.java#L190-L220
125,285
zxing/zxing
core/src/main/java/com/google/zxing/common/HybridBinarizer.java
HybridBinarizer.getBlackMatrix
@Override public BitMatrix getBlackMatrix() throws NotFoundException { if (matrix != null) { return matrix; } LuminanceSource source = getLuminanceSource(); int width = source.getWidth(); int height = source.getHeight(); if (width >= MINIMUM_DIMENSION && height >= MINIMUM_DIMENSION) { ...
java
@Override public BitMatrix getBlackMatrix() throws NotFoundException { if (matrix != null) { return matrix; } LuminanceSource source = getLuminanceSource(); int width = source.getWidth(); int height = source.getHeight(); if (width >= MINIMUM_DIMENSION && height >= MINIMUM_DIMENSION) { ...
[ "@", "Override", "public", "BitMatrix", "getBlackMatrix", "(", ")", "throws", "NotFoundException", "{", "if", "(", "matrix", "!=", "null", ")", "{", "return", "matrix", ";", "}", "LuminanceSource", "source", "=", "getLuminanceSource", "(", ")", ";", "int", "...
Calculates the final BitMatrix once for all requests. This could be called once from the constructor instead, but there are some advantages to doing it lazily, such as making profiling easier, and not doing heavy lifting when callers don't expect it.
[ "Calculates", "the", "final", "BitMatrix", "once", "for", "all", "requests", ".", "This", "could", "be", "called", "once", "from", "the", "constructor", "instead", "but", "there", "are", "some", "advantages", "to", "doing", "it", "lazily", "such", "as", "mak...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/HybridBinarizer.java#L61-L89
125,286
zxing/zxing
core/src/main/java/com/google/zxing/common/HybridBinarizer.java
HybridBinarizer.thresholdBlock
private static void thresholdBlock(byte[] luminances, int xoffset, int yoffset, int threshold, int stride, BitMatrix matrix) { for ...
java
private static void thresholdBlock(byte[] luminances, int xoffset, int yoffset, int threshold, int stride, BitMatrix matrix) { for ...
[ "private", "static", "void", "thresholdBlock", "(", "byte", "[", "]", "luminances", ",", "int", "xoffset", ",", "int", "yoffset", ",", "int", "threshold", ",", "int", "stride", ",", "BitMatrix", "matrix", ")", "{", "for", "(", "int", "y", "=", "0", ","...
Applies a single threshold to a block of pixels.
[ "Applies", "a", "single", "threshold", "to", "a", "block", "of", "pixels", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/HybridBinarizer.java#L140-L154
125,287
zxing/zxing
android/src/com/google/zxing/client/android/result/AddressBookResultHandler.java
AddressBookResultHandler.mapIndexToAction
private int mapIndexToAction(int index) { if (index < buttonCount) { int count = -1; for (int x = 0; x < MAX_BUTTON_COUNT; x++) { if (fields[x]) { count++; } if (count == index) { return x; } } } return -1; }
java
private int mapIndexToAction(int index) { if (index < buttonCount) { int count = -1; for (int x = 0; x < MAX_BUTTON_COUNT; x++) { if (fields[x]) { count++; } if (count == index) { return x; } } } return -1; }
[ "private", "int", "mapIndexToAction", "(", "int", "index", ")", "{", "if", "(", "index", "<", "buttonCount", ")", "{", "int", "count", "=", "-", "1", ";", "for", "(", "int", "x", "=", "0", ";", "x", "<", "MAX_BUTTON_COUNT", ";", "x", "++", ")", "...
positions, based on which fields are present in this barcode.
[ "positions", "based", "on", "which", "fields", "are", "present", "in", "this", "barcode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/AddressBookResultHandler.java#L65-L78
125,288
zxing/zxing
android/src/com/google/zxing/client/android/result/AddressBookResultHandler.java
AddressBookResultHandler.getDisplayContents
@Override public CharSequence getDisplayContents() { AddressBookParsedResult result = (AddressBookParsedResult) getResult(); StringBuilder contents = new StringBuilder(100); ParsedResult.maybeAppend(result.getNames(), contents); int namesLength = contents.length(); String pronunciation = result.g...
java
@Override public CharSequence getDisplayContents() { AddressBookParsedResult result = (AddressBookParsedResult) getResult(); StringBuilder contents = new StringBuilder(100); ParsedResult.maybeAppend(result.getNames(), contents); int namesLength = contents.length(); String pronunciation = result.g...
[ "@", "Override", "public", "CharSequence", "getDisplayContents", "(", ")", "{", "AddressBookParsedResult", "result", "=", "(", "AddressBookParsedResult", ")", "getResult", "(", ")", ";", "StringBuilder", "contents", "=", "new", "StringBuilder", "(", "100", ")", ";...
Overriden so we can hyphenate phone numbers, format birthdays, and bold the name.
[ "Overriden", "so", "we", "can", "hyphenate", "phone", "numbers", "format", "birthdays", "and", "bold", "the", "name", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/AddressBookResultHandler.java#L164-L209
125,289
zxing/zxing
core/src/main/java/com/google/zxing/client/result/VCardResultParser.java
VCardResultParser.formatNames
private static void formatNames(Iterable<List<String>> names) { if (names != null) { for (List<String> list : names) { String name = list.get(0); String[] components = new String[5]; int start = 0; int end; int componentIndex = 0; while (componentIndex < compone...
java
private static void formatNames(Iterable<List<String>> names) { if (names != null) { for (List<String> list : names) { String name = list.get(0); String[] components = new String[5]; int start = 0; int end; int componentIndex = 0; while (componentIndex < compone...
[ "private", "static", "void", "formatNames", "(", "Iterable", "<", "List", "<", "String", ">", ">", "names", ")", "{", "if", "(", "names", "!=", "null", ")", "{", "for", "(", "List", "<", "String", ">", "list", ":", "names", ")", "{", "String", "nam...
Formats name fields of the form "Public;John;Q.;Reverend;III" into a form like "Reverend John Q. Public III". @param names name values to format, in place
[ "Formats", "name", "fields", "of", "the", "form", "Public", ";", "John", ";", "Q", ".", ";", "Reverend", ";", "III", "into", "a", "form", "like", "Reverend", "John", "Q", ".", "Public", "III", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/client/result/VCardResultParser.java#L340-L363
125,290
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/encoder/BarcodeRow.java
BarcodeRow.getScaledRow
byte[] getScaledRow(int scale) { byte[] output = new byte[row.length * scale]; for (int i = 0; i < output.length; i++) { output[i] = row[i / scale]; } return output; }
java
byte[] getScaledRow(int scale) { byte[] output = new byte[row.length * scale]; for (int i = 0; i < output.length; i++) { output[i] = row[i / scale]; } return output; }
[ "byte", "[", "]", "getScaledRow", "(", "int", "scale", ")", "{", "byte", "[", "]", "output", "=", "new", "byte", "[", "row", ".", "length", "*", "scale", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "output", ".", "length", ";", ...
This function scales the row @param scale How much you want the image to be scaled, must be greater than or equal to 1. @return the scaled row
[ "This", "function", "scales", "the", "row" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/BarcodeRow.java#L78-L84
125,291
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java
MaskUtil.applyMaskPenaltyRule4
static int applyMaskPenaltyRule4(ByteMatrix matrix) { int numDarkCells = 0; byte[][] array = matrix.getArray(); int width = matrix.getWidth(); int height = matrix.getHeight(); for (int y = 0; y < height; y++) { byte[] arrayY = array[y]; for (int x = 0; x < width; x++) { if (array...
java
static int applyMaskPenaltyRule4(ByteMatrix matrix) { int numDarkCells = 0; byte[][] array = matrix.getArray(); int width = matrix.getWidth(); int height = matrix.getHeight(); for (int y = 0; y < height; y++) { byte[] arrayY = array[y]; for (int x = 0; x < width; x++) { if (array...
[ "static", "int", "applyMaskPenaltyRule4", "(", "ByteMatrix", "matrix", ")", "{", "int", "numDarkCells", "=", "0", ";", "byte", "[", "]", "[", "]", "array", "=", "matrix", ".", "getArray", "(", ")", ";", "int", "width", "=", "matrix", ".", "getWidth", "...
Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
[ "Apply", "mask", "penalty", "rule", "4", "and", "return", "the", "penalty", ".", "Calculate", "the", "ratio", "of", "dark", "cells", "and", "give", "penalty", "if", "the", "ratio", "is", "far", "from", "50%", ".", "It", "gives", "10", "penalty", "for", ...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java#L132-L148
125,292
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java
MaskUtil.applyMaskPenaltyRule1Internal
private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) { int penalty = 0; int iLimit = isHorizontal ? matrix.getHeight() : matrix.getWidth(); int jLimit = isHorizontal ? matrix.getWidth() : matrix.getHeight(); byte[][] array = matrix.getArray(); for (int i = 0; i <...
java
private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) { int penalty = 0; int iLimit = isHorizontal ? matrix.getHeight() : matrix.getWidth(); int jLimit = isHorizontal ? matrix.getWidth() : matrix.getHeight(); byte[][] array = matrix.getArray(); for (int i = 0; i <...
[ "private", "static", "int", "applyMaskPenaltyRule1Internal", "(", "ByteMatrix", "matrix", ",", "boolean", "isHorizontal", ")", "{", "int", "penalty", "=", "0", ";", "int", "iLimit", "=", "isHorizontal", "?", "matrix", ".", "getHeight", "(", ")", ":", "matrix",...
Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both vertical and horizontal orders respectively.
[ "Helper", "function", "for", "applyMaskPenaltyRule1", ".", "We", "need", "this", "for", "doing", "this", "calculation", "in", "both", "vertical", "and", "horizontal", "orders", "respectively", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/MaskUtil.java#L195-L220
125,293
zxing/zxing
core/src/main/java/com/google/zxing/client/result/BizcardResultParser.java
BizcardResultParser.parse
@Override public AddressBookParsedResult parse(Result result) { String rawText = getMassagedText(result); if (!rawText.startsWith("BIZCARD:")) { return null; } String firstName = matchSingleDoCoMoPrefixedField("N:", rawText, true); String lastName = matchSingleDoCoMoPrefixedField("X:", rawTe...
java
@Override public AddressBookParsedResult parse(Result result) { String rawText = getMassagedText(result); if (!rawText.startsWith("BIZCARD:")) { return null; } String firstName = matchSingleDoCoMoPrefixedField("N:", rawText, true); String lastName = matchSingleDoCoMoPrefixedField("X:", rawTe...
[ "@", "Override", "public", "AddressBookParsedResult", "parse", "(", "Result", "result", ")", "{", "String", "rawText", "=", "getMassagedText", "(", "result", ")", ";", "if", "(", "!", "rawText", ".", "startsWith", "(", "\"BIZCARD:\"", ")", ")", "{", "return"...
DoCoMo's proposed formats
[ "DoCoMo", "s", "proposed", "formats" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/client/result/BizcardResultParser.java#L37-L70
125,294
zxing/zxing
core/src/main/java/com/google/zxing/common/BitArray.java
BitArray.setRange
public void setRange(int start, int end) { if (end < start || start < 0 || end > size) { throw new IllegalArgumentException(); } if (end == start) { return; } end--; // will be easier to treat this as the last actually set bit -- inclusive int firstInt = start / 32; int lastInt =...
java
public void setRange(int start, int end) { if (end < start || start < 0 || end > size) { throw new IllegalArgumentException(); } if (end == start) { return; } end--; // will be easier to treat this as the last actually set bit -- inclusive int firstInt = start / 32; int lastInt =...
[ "public", "void", "setRange", "(", "int", "start", ",", "int", "end", ")", "{", "if", "(", "end", "<", "start", "||", "start", "<", "0", "||", "end", ">", "size", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", ...
Sets a range of bits. @param start start of range, inclusive. @param end end of range, exclusive
[ "Sets", "a", "range", "of", "bits", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitArray.java#L153-L170
125,295
zxing/zxing
core/src/main/java/com/google/zxing/common/BitArray.java
BitArray.isRange
public boolean isRange(int start, int end, boolean value) { if (end < start || start < 0 || end > size) { throw new IllegalArgumentException(); } if (end == start) { return true; // empty range matches } end--; // will be easier to treat this as the last actually set bit -- inclusive ...
java
public boolean isRange(int start, int end, boolean value) { if (end < start || start < 0 || end > size) { throw new IllegalArgumentException(); } if (end == start) { return true; // empty range matches } end--; // will be easier to treat this as the last actually set bit -- inclusive ...
[ "public", "boolean", "isRange", "(", "int", "start", ",", "int", "end", ",", "boolean", "value", ")", "{", "if", "(", "end", "<", "start", "||", "start", "<", "0", "||", "end", ">", "size", ")", "{", "throw", "new", "IllegalArgumentException", "(", "...
Efficient method to check if a range of bits is set, or not set. @param start start of range, inclusive. @param end end of range, exclusive @param value if true, checks that bits in range are set, otherwise checks that they are not set @return true iff all bits are set or not set in range, according to value argument ...
[ "Efficient", "method", "to", "check", "if", "a", "range", "of", "bits", "is", "set", "or", "not", "set", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitArray.java#L191-L214
125,296
zxing/zxing
core/src/main/java/com/google/zxing/common/BitArray.java
BitArray.appendBits
public void appendBits(int value, int numBits) { if (numBits < 0 || numBits > 32) { throw new IllegalArgumentException("Num bits must be between 0 and 32"); } ensureCapacity(size + numBits); for (int numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) { appendBit(((value >> (numBitsLeft -...
java
public void appendBits(int value, int numBits) { if (numBits < 0 || numBits > 32) { throw new IllegalArgumentException("Num bits must be between 0 and 32"); } ensureCapacity(size + numBits); for (int numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) { appendBit(((value >> (numBitsLeft -...
[ "public", "void", "appendBits", "(", "int", "value", ",", "int", "numBits", ")", "{", "if", "(", "numBits", "<", "0", "||", "numBits", ">", "32", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Num bits must be between 0 and 32\"", ")", ";", "}...
Appends the least-significant bits, from value, in order from most-significant to least-significant. For example, appending 6 bits from 0x000001E will append the bits 0, 1, 1, 1, 1, 0 in that order. @param value {@code int} containing bits to append @param numBits bits from value to append
[ "Appends", "the", "least", "-", "significant", "bits", "from", "value", "in", "order", "from", "most", "-", "significant", "to", "least", "-", "significant", ".", "For", "example", "appending", "6", "bits", "from", "0x000001E", "will", "append", "the", "bits...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitArray.java#L232-L240
125,297
zxing/zxing
core/src/main/java/com/google/zxing/common/BitArray.java
BitArray.reverse
public void reverse() { int[] newBits = new int[bits.length]; // reverse all int's first int len = (size - 1) / 32; int oldBitsLen = len + 1; for (int i = 0; i < oldBitsLen; i++) { long x = bits[i]; x = ((x >> 1) & 0x55555555L) | ((x & 0x55555555L) << 1); x = ((x >> 2) & 0x33333...
java
public void reverse() { int[] newBits = new int[bits.length]; // reverse all int's first int len = (size - 1) / 32; int oldBitsLen = len + 1; for (int i = 0; i < oldBitsLen; i++) { long x = bits[i]; x = ((x >> 1) & 0x55555555L) | ((x & 0x55555555L) << 1); x = ((x >> 2) & 0x33333...
[ "public", "void", "reverse", "(", ")", "{", "int", "[", "]", "newBits", "=", "new", "int", "[", "bits", ".", "length", "]", ";", "// reverse all int's first", "int", "len", "=", "(", "size", "-", "1", ")", "/", "32", ";", "int", "oldBitsLen", "=", ...
Reverses all bits in the array.
[ "Reverses", "all", "bits", "in", "the", "array", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitArray.java#L293-L320
125,298
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java
PDF417HighLevelEncoder.determineConsecutiveTextCount
private static int determineConsecutiveTextCount(CharSequence msg, int startpos) { int len = msg.length(); int idx = startpos; while (idx < len) { char ch = msg.charAt(idx); int numericCount = 0; while (numericCount < 13 && isDigit(ch) && idx < len) { numericCount++; idx++;...
java
private static int determineConsecutiveTextCount(CharSequence msg, int startpos) { int len = msg.length(); int idx = startpos; while (idx < len) { char ch = msg.charAt(idx); int numericCount = 0; while (numericCount < 13 && isDigit(ch) && idx < len) { numericCount++; idx++;...
[ "private", "static", "int", "determineConsecutiveTextCount", "(", "CharSequence", "msg", ",", "int", "startpos", ")", "{", "int", "len", "=", "msg", ".", "length", "(", ")", ";", "int", "idx", "=", "startpos", ";", "while", "(", "idx", "<", "len", ")", ...
Determines the number of consecutive characters that are encodable using text compaction. @param msg the message @param startpos the start position within the message @return the requested character count
[ "Determines", "the", "number", "of", "consecutive", "characters", "that", "are", "encodable", "using", "text", "compaction", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java#L498-L527
125,299
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java
PDF417HighLevelEncoder.determineConsecutiveBinaryCount
private static int determineConsecutiveBinaryCount(String msg, int startpos, Charset encoding) throws WriterException { CharsetEncoder encoder = encoding.newEncoder(); int len = msg.length(); int idx = startpos; while (idx < len) { char ch = msg.charAt(idx); int numericCount = 0; ...
java
private static int determineConsecutiveBinaryCount(String msg, int startpos, Charset encoding) throws WriterException { CharsetEncoder encoder = encoding.newEncoder(); int len = msg.length(); int idx = startpos; while (idx < len) { char ch = msg.charAt(idx); int numericCount = 0; ...
[ "private", "static", "int", "determineConsecutiveBinaryCount", "(", "String", "msg", ",", "int", "startpos", ",", "Charset", "encoding", ")", "throws", "WriterException", "{", "CharsetEncoder", "encoder", "=", "encoding", ".", "newEncoder", "(", ")", ";", "int", ...
Determines the number of consecutive characters that are encodable using binary compaction. @param msg the message @param startpos the start position within the message @param encoding the charset used to convert the message to a byte array @return the requested character count
[ "Determines", "the", "number", "of", "consecutive", "characters", "that", "are", "encodable", "using", "binary", "compaction", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java#L537-L566