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
52,700
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersSlavesListener.java
AbstractMastersSlavesListener.setSecondaryHostFail
public boolean setSecondaryHostFail() { if (secondaryHostFail.compareAndSet(false, true)) { secondaryHostFailNanos = System.nanoTime(); currentConnectionAttempts.set(0); return true; } return false; }
java
public boolean setSecondaryHostFail() { if (secondaryHostFail.compareAndSet(false, true)) { secondaryHostFailNanos = System.nanoTime(); currentConnectionAttempts.set(0); return true; } return false; }
[ "public", "boolean", "setSecondaryHostFail", "(", ")", "{", "if", "(", "secondaryHostFail", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "secondaryHostFailNanos", "=", "System", ".", "nanoTime", "(", ")", ";", "currentConnectionAttempts", ".",...
Set slave connection lost variables. @return true if fail wasn't seen before
[ "Set", "slave", "connection", "lost", "variables", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersSlavesListener.java#L171-L178
52,701
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/io/TraceObject.java
TraceObject.remove
public void remove() { for (int i = 0; i < buf.length; i++) { buf[i] = null;// force null for easier garbage } buf = null; }
java
public void remove() { for (int i = 0; i < buf.length; i++) { buf[i] = null;// force null for easier garbage } buf = null; }
[ "public", "void", "remove", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buf", ".", "length", ";", "i", "++", ")", "{", "buf", "[", "i", "]", "=", "null", ";", "// force null for easier garbage", "}", "buf", "=", "null", ";", ...
Clear trace array for easy garbage.
[ "Clear", "trace", "array", "for", "easy", "garbage", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/TraceObject.java#L82-L87
52,702
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbDataSource.java
MariaDbDataSource.getPooledConnection
public PooledConnection getPooledConnection(String user, String password) throws SQLException { return new MariaDbPooledConnection((MariaDbConnection) getConnection(user, password)); }
java
public PooledConnection getPooledConnection(String user, String password) throws SQLException { return new MariaDbPooledConnection((MariaDbConnection) getConnection(user, password)); }
[ "public", "PooledConnection", "getPooledConnection", "(", "String", "user", ",", "String", "password", ")", "throws", "SQLException", "{", "return", "new", "MariaDbPooledConnection", "(", "(", "MariaDbConnection", ")", "getConnection", "(", "user", ",", "password", ...
Attempts to establish a physical database connection that can be used as a pooled connection. @param user the database user on whose behalf the connection is being made @param password the user's password @return a <code>PooledConnection</code> object that is a physical connection to the database that this <code>C...
[ "Attempts", "to", "establish", "a", "physical", "database", "connection", "that", "can", "be", "used", "as", "a", "pooled", "connection", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDataSource.java#L464-L466
52,703
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java
MastersFailoverListener.initializeConnection
@Override public void initializeConnection() throws SQLException { super.initializeConnection(); this.currentProtocol = null; //launching initial loop reconnectFailedConnection(new SearchFilter(true, false)); resetMasterFailoverData(); }
java
@Override public void initializeConnection() throws SQLException { super.initializeConnection(); this.currentProtocol = null; //launching initial loop reconnectFailedConnection(new SearchFilter(true, false)); resetMasterFailoverData(); }
[ "@", "Override", "public", "void", "initializeConnection", "(", ")", "throws", "SQLException", "{", "super", ".", "initializeConnection", "(", ")", ";", "this", ".", "currentProtocol", "=", "null", ";", "//launching initial loop", "reconnectFailedConnection", "(", "...
Connect to database. @throws SQLException if connection is on error.
[ "Connect", "to", "database", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java#L97-L104
52,704
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java
MastersFailoverListener.preExecute
public void preExecute() throws SQLException { lastQueryNanos = System.nanoTime(); //if connection is closed or failed on slave if (this.currentProtocol != null && this.currentProtocol.isClosed()) { preAutoReconnect(); } }
java
public void preExecute() throws SQLException { lastQueryNanos = System.nanoTime(); //if connection is closed or failed on slave if (this.currentProtocol != null && this.currentProtocol.isClosed()) { preAutoReconnect(); } }
[ "public", "void", "preExecute", "(", ")", "throws", "SQLException", "{", "lastQueryNanos", "=", "System", ".", "nanoTime", "(", ")", ";", "//if connection is closed or failed on slave", "if", "(", "this", ".", "currentProtocol", "!=", "null", "&&", "this", ".", ...
Before executing query, reconnect if connection is closed, and autoReconnect option is set. @throws SQLException if connection has been explicitly closed.
[ "Before", "executing", "query", "reconnect", "if", "connection", "is", "closed", "and", "autoReconnect", "option", "is", "set", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java#L111-L117
52,705
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java
MastersFailoverListener.reconnectFailedConnection
@Override public void reconnectFailedConnection(SearchFilter searchFilter) throws SQLException { proxy.lock.lock(); try { if (!searchFilter.isInitialConnection() && (isExplicitClosed() || !isMasterHostFail())) { return; } currentConnectionAttempts.incrementAndGet(); ...
java
@Override public void reconnectFailedConnection(SearchFilter searchFilter) throws SQLException { proxy.lock.lock(); try { if (!searchFilter.isInitialConnection() && (isExplicitClosed() || !isMasterHostFail())) { return; } currentConnectionAttempts.incrementAndGet(); ...
[ "@", "Override", "public", "void", "reconnectFailedConnection", "(", "SearchFilter", "searchFilter", ")", "throws", "SQLException", "{", "proxy", ".", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "!", "searchFilter", ".", "isInitialConnection", "...
Loop to connect failed hosts. @param searchFilter search parameters. @throws SQLException if there is any error during reconnection
[ "Loop", "to", "connect", "failed", "hosts", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java#L191-L239
52,706
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java
MastersFailoverListener.switchReadOnlyConnection
public void switchReadOnlyConnection(Boolean mustBeReadOnly) throws SQLException { if (urlParser.getOptions().assureReadOnly && currentReadOnlyAsked != mustBeReadOnly) { proxy.lock.lock(); try { // verify not updated now that hold lock, double check safe due to volatile if (currentReadOn...
java
public void switchReadOnlyConnection(Boolean mustBeReadOnly) throws SQLException { if (urlParser.getOptions().assureReadOnly && currentReadOnlyAsked != mustBeReadOnly) { proxy.lock.lock(); try { // verify not updated now that hold lock, double check safe due to volatile if (currentReadOn...
[ "public", "void", "switchReadOnlyConnection", "(", "Boolean", "mustBeReadOnly", ")", "throws", "SQLException", "{", "if", "(", "urlParser", ".", "getOptions", "(", ")", ".", "assureReadOnly", "&&", "currentReadOnlyAsked", "!=", "mustBeReadOnly", ")", "{", "proxy", ...
Force session to read-only according to options. @param mustBeReadOnly is read-only flag @throws SQLException if a connection error occur
[ "Force", "session", "to", "read", "-", "only", "according", "to", "options", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java#L247-L260
52,707
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java
MastersFailoverListener.foundActiveMaster
@Override public void foundActiveMaster(Protocol protocol) throws SQLException { if (isExplicitClosed()) { proxy.lock.lock(); try { protocol.close(); } finally { proxy.lock.unlock(); } return; } syncConnection(this.currentProtocol, protocol); proxy.lock.lo...
java
@Override public void foundActiveMaster(Protocol protocol) throws SQLException { if (isExplicitClosed()) { proxy.lock.lock(); try { protocol.close(); } finally { proxy.lock.unlock(); } return; } syncConnection(this.currentProtocol, protocol); proxy.lock.lo...
[ "@", "Override", "public", "void", "foundActiveMaster", "(", "Protocol", "protocol", ")", "throws", "SQLException", "{", "if", "(", "isExplicitClosed", "(", ")", ")", "{", "proxy", ".", "lock", ".", "lock", "(", ")", ";", "try", "{", "protocol", ".", "cl...
method called when a new Master connection is found after a fallback. @param protocol the new active connection
[ "method", "called", "when", "a", "new", "Master", "connection", "is", "found", "after", "a", "fallback", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java#L267-L291
52,708
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java
MastersFailoverListener.reconnect
public void reconnect() throws SQLException { boolean inTransaction = currentProtocol != null && currentProtocol.inTransaction(); reconnectFailedConnection(new SearchFilter(true, false)); handleFailLoop(); if (inTransaction) { throw new ReconnectDuringTransactionException( "Connection re...
java
public void reconnect() throws SQLException { boolean inTransaction = currentProtocol != null && currentProtocol.inTransaction(); reconnectFailedConnection(new SearchFilter(true, false)); handleFailLoop(); if (inTransaction) { throw new ReconnectDuringTransactionException( "Connection re...
[ "public", "void", "reconnect", "(", ")", "throws", "SQLException", "{", "boolean", "inTransaction", "=", "currentProtocol", "!=", "null", "&&", "currentProtocol", ".", "inTransaction", "(", ")", ";", "reconnectFailedConnection", "(", "new", "SearchFilter", "(", "t...
Try to reconnect connection. @throws SQLException if reconnect a new connection but there was an active transaction.
[ "Try", "to", "reconnect", "connection", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java#L298-L306
52,709
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/send/authentication/gssapi/StandardGssapiAuthentication.java
StandardGssapiAuthentication.authenticate
public void authenticate(final PacketOutputStream out, final PacketInputStream in, final AtomicInteger sequence, final String servicePrincipalName, String mechanisms) throws SQLException, IOException { if ("".equals(servicePrincipalName)) { throw new SQLException("No principal name...
java
public void authenticate(final PacketOutputStream out, final PacketInputStream in, final AtomicInteger sequence, final String servicePrincipalName, String mechanisms) throws SQLException, IOException { if ("".equals(servicePrincipalName)) { throw new SQLException("No principal name...
[ "public", "void", "authenticate", "(", "final", "PacketOutputStream", "out", ",", "final", "PacketInputStream", "in", ",", "final", "AtomicInteger", "sequence", ",", "final", "String", "servicePrincipalName", ",", "String", "mechanisms", ")", "throws", "SQLException",...
Process default GSS plugin authentication. @param out out stream @param in in stream @param sequence packet sequence @param servicePrincipalName service principal name @param mechanisms gssapi mechanism @throws IOException if socket error @throws SQLExcept...
[ "Process", "default", "GSS", "plugin", "authentication", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/authentication/gssapi/StandardGssapiAuthentication.java#L89-L172
52,710
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/send/SendHandshakeResponsePacket.java
SendHandshakeResponsePacket.send
public static void send(final PacketOutputStream pos, final String username, final String password, final HostAddress currentHost, final String database, final long clientCapabilities, final long serverCapabilities, final byte serverLanguage, final byte packetSeq, f...
java
public static void send(final PacketOutputStream pos, final String username, final String password, final HostAddress currentHost, final String database, final long clientCapabilities, final long serverCapabilities, final byte serverLanguage, final byte packetSeq, f...
[ "public", "static", "void", "send", "(", "final", "PacketOutputStream", "pos", ",", "final", "String", "username", ",", "final", "String", "password", ",", "final", "HostAddress", "currentHost", ",", "final", "String", "database", ",", "final", "long", "clientCa...
Send handshake response packet. @param pos output stream @param username user name @param password password @param currentHost current hostname @param database database name @param clientCapabilities client capabilities @param serverCapabilities server capabilities @...
[ "Send", "handshake", "response", "packet", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/SendHandshakeResponsePacket.java#L105-L187
52,711
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/HostAddress.java
HostAddress.parse
public static List<HostAddress> parse(String spec, HaMode haMode) { if (spec == null) { throw new IllegalArgumentException("Invalid connection URL, host address must not be empty "); } if ("".equals(spec)) { return new ArrayList<>(0); } String[] tokens = spec.trim().split(","); int s...
java
public static List<HostAddress> parse(String spec, HaMode haMode) { if (spec == null) { throw new IllegalArgumentException("Invalid connection URL, host address must not be empty "); } if ("".equals(spec)) { return new ArrayList<>(0); } String[] tokens = spec.trim().split(","); int s...
[ "public", "static", "List", "<", "HostAddress", ">", "parse", "(", "String", "spec", ",", "HaMode", "haMode", ")", "{", "if", "(", "spec", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid connection URL, host address must not be ...
parse - parse server addresses from the URL fragment. @param spec list of endpoints in one of the forms 1 - host1,....,hostN:port (missing port default to MariaDB default 3306 2 - host:port,...,host:port @param haMode High availability mode @return parsed endpoints
[ "parse", "-", "parse", "server", "addresses", "from", "the", "URL", "fragment", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/HostAddress.java#L109-L152
52,712
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/send/parameters/DateParameter.java
DateParameter.writeTo
public void writeTo(final PacketOutputStream os) throws IOException { os.write(QUOTE); os.write(dateByteFormat()); os.write(QUOTE); }
java
public void writeTo(final PacketOutputStream os) throws IOException { os.write(QUOTE); os.write(dateByteFormat()); os.write(QUOTE); }
[ "public", "void", "writeTo", "(", "final", "PacketOutputStream", "os", ")", "throws", "IOException", "{", "os", ".", "write", "(", "QUOTE", ")", ";", "os", ".", "write", "(", "dateByteFormat", "(", ")", ")", ";", "os", ".", "write", "(", "QUOTE", ")", ...
Write to server OutputStream in text protocol. @param os output buffer
[ "Write", "to", "server", "OutputStream", "in", "text", "protocol", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/parameters/DateParameter.java#L89-L93
52,713
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/send/ComStmtPrepare.java
ComStmtPrepare.read
public ServerPrepareResult read(PacketInputStream reader, boolean eofDeprecated) throws IOException, SQLException { Buffer buffer = reader.getPacket(true); byte firstByte = buffer.getByteAt(buffer.position); if (firstByte == ERROR) { throw buildErrorException(buffer); } if (firstByte =...
java
public ServerPrepareResult read(PacketInputStream reader, boolean eofDeprecated) throws IOException, SQLException { Buffer buffer = reader.getPacket(true); byte firstByte = buffer.getByteAt(buffer.position); if (firstByte == ERROR) { throw buildErrorException(buffer); } if (firstByte =...
[ "public", "ServerPrepareResult", "read", "(", "PacketInputStream", "reader", ",", "boolean", "eofDeprecated", ")", "throws", "IOException", ",", "SQLException", "{", "Buffer", "buffer", "=", "reader", ".", "getPacket", "(", "true", ")", ";", "byte", "firstByte", ...
Read COM_PREPARE_RESULT. @param reader inputStream @param eofDeprecated are EOF_packet deprecated @return ServerPrepareResult prepare result @throws IOException if connection has error @throws SQLException if server answer with error.
[ "Read", "COM_PREPARE_RESULT", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/ComStmtPrepare.java#L101-L168
52,714
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/protocol/MastersSlavesProtocol.java
MastersSlavesProtocol.resetHostList
private static void resetHostList(MastersSlavesListener listener, Deque<HostAddress> loopAddresses) { //if all servers have been connected without result //add back all servers List<HostAddress> servers = new ArrayList<>(); servers.addAll(listener.getUrlParser().getHostAddresses()); Collection...
java
private static void resetHostList(MastersSlavesListener listener, Deque<HostAddress> loopAddresses) { //if all servers have been connected without result //add back all servers List<HostAddress> servers = new ArrayList<>(); servers.addAll(listener.getUrlParser().getHostAddresses()); Collection...
[ "private", "static", "void", "resetHostList", "(", "MastersSlavesListener", "listener", ",", "Deque", "<", "HostAddress", ">", "loopAddresses", ")", "{", "//if all servers have been connected without result", "//add back all servers", "List", "<", "HostAddress", ">", "serve...
Reinitialize loopAddresses with all servers in randomize order. @param listener current listener @param loopAddresses the list to reinitialize
[ "Reinitialize", "loopAddresses", "with", "all", "servers", "in", "randomize", "order", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/MastersSlavesProtocol.java#L202-L215
52,715
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java
MariaDbPooledConnection.fireStatementClosed
public void fireStatementClosed(Statement st) { if (st instanceof PreparedStatement) { StatementEvent event = new StatementEvent(this, (PreparedStatement) st); for (StatementEventListener listener : statementEventListeners) { listener.statementClosed(event); } } }
java
public void fireStatementClosed(Statement st) { if (st instanceof PreparedStatement) { StatementEvent event = new StatementEvent(this, (PreparedStatement) st); for (StatementEventListener listener : statementEventListeners) { listener.statementClosed(event); } } }
[ "public", "void", "fireStatementClosed", "(", "Statement", "st", ")", "{", "if", "(", "st", "instanceof", "PreparedStatement", ")", "{", "StatementEvent", "event", "=", "new", "StatementEvent", "(", "this", ",", "(", "PreparedStatement", ")", "st", ")", ";", ...
Fire statement close event to listeners. @param st statement
[ "Fire", "statement", "close", "event", "to", "listeners", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java#L189-L196
52,716
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java
MariaDbPooledConnection.fireStatementErrorOccured
public void fireStatementErrorOccured(Statement st, SQLException ex) { if (st instanceof PreparedStatement) { StatementEvent event = new StatementEvent(this, (PreparedStatement) st, ex); for (StatementEventListener listener : statementEventListeners) { listener.statementErrorOccurred(event); ...
java
public void fireStatementErrorOccured(Statement st, SQLException ex) { if (st instanceof PreparedStatement) { StatementEvent event = new StatementEvent(this, (PreparedStatement) st, ex); for (StatementEventListener listener : statementEventListeners) { listener.statementErrorOccurred(event); ...
[ "public", "void", "fireStatementErrorOccured", "(", "Statement", "st", ",", "SQLException", "ex", ")", "{", "if", "(", "st", "instanceof", "PreparedStatement", ")", "{", "StatementEvent", "event", "=", "new", "StatementEvent", "(", "this", ",", "(", "PreparedSta...
Fire statement error to listeners. @param st statement @param ex exception
[ "Fire", "statement", "error", "to", "listeners", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java#L204-L211
52,717
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java
MariaDbPooledConnection.fireConnectionClosed
public void fireConnectionClosed() { ConnectionEvent event = new ConnectionEvent(this); for (ConnectionEventListener listener : connectionEventListeners) { listener.connectionClosed(event); } }
java
public void fireConnectionClosed() { ConnectionEvent event = new ConnectionEvent(this); for (ConnectionEventListener listener : connectionEventListeners) { listener.connectionClosed(event); } }
[ "public", "void", "fireConnectionClosed", "(", ")", "{", "ConnectionEvent", "event", "=", "new", "ConnectionEvent", "(", "this", ")", ";", "for", "(", "ConnectionEventListener", "listener", ":", "connectionEventListeners", ")", "{", "listener", ".", "connectionClose...
Fire Connection close to listening listeners.
[ "Fire", "Connection", "close", "to", "listening", "listeners", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java#L216-L221
52,718
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java
MariaDbPooledConnection.fireConnectionErrorOccured
public void fireConnectionErrorOccured(SQLException ex) { ConnectionEvent event = new ConnectionEvent(this, ex); for (ConnectionEventListener listener : connectionEventListeners) { listener.connectionErrorOccurred(event); } }
java
public void fireConnectionErrorOccured(SQLException ex) { ConnectionEvent event = new ConnectionEvent(this, ex); for (ConnectionEventListener listener : connectionEventListeners) { listener.connectionErrorOccurred(event); } }
[ "public", "void", "fireConnectionErrorOccured", "(", "SQLException", "ex", ")", "{", "ConnectionEvent", "event", "=", "new", "ConnectionEvent", "(", "this", ",", "ex", ")", ";", "for", "(", "ConnectionEventListener", "listener", ":", "connectionEventListeners", ")",...
Fire connection error to listening listeners. @param ex exception
[ "Fire", "connection", "error", "to", "listening", "listeners", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbPooledConnection.java#L228-L233
52,719
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.setTimerTask
protected void setTimerTask(boolean isBatch) { assert (timerTaskFuture == null); timerTaskFuture = timeoutScheduler.schedule(() -> { try { isTimedout = true; if (!isBatch) { protocol.cancelCurrentQuery(); } protocol.interrupt(); } catch (Throwable e) { ...
java
protected void setTimerTask(boolean isBatch) { assert (timerTaskFuture == null); timerTaskFuture = timeoutScheduler.schedule(() -> { try { isTimedout = true; if (!isBatch) { protocol.cancelCurrentQuery(); } protocol.interrupt(); } catch (Throwable e) { ...
[ "protected", "void", "setTimerTask", "(", "boolean", "isBatch", ")", "{", "assert", "(", "timerTaskFuture", "==", "null", ")", ";", "timerTaskFuture", "=", "timeoutScheduler", ".", "schedule", "(", "(", ")", "->", "{", "try", "{", "isTimedout", "=", "true", ...
Part of query prolog - setup timeout timer
[ "Part", "of", "query", "prolog", "-", "setup", "timeout", "timer" ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L160-L174
52,720
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.executeExceptionEpilogue
protected SQLException executeExceptionEpilogue(SQLException sqle) { //if has a failover, closing the statement if (sqle.getSQLState() != null && sqle.getSQLState().startsWith("08")) { try { close(); } catch (SQLException sqlee) { //eat exception } } if (isTimedout) { ...
java
protected SQLException executeExceptionEpilogue(SQLException sqle) { //if has a failover, closing the statement if (sqle.getSQLState() != null && sqle.getSQLState().startsWith("08")) { try { close(); } catch (SQLException sqlee) { //eat exception } } if (isTimedout) { ...
[ "protected", "SQLException", "executeExceptionEpilogue", "(", "SQLException", "sqle", ")", "{", "//if has a failover, closing the statement", "if", "(", "sqle", ".", "getSQLState", "(", ")", "!=", "null", "&&", "sqle", ".", "getSQLState", "(", ")", ".", "startsWith"...
Reset timeout after query, re-throw SQL exception. @param sqle current exception @return SQLException exception with new message in case of timer timeout.
[ "Reset", "timeout", "after", "query", "re", "-", "throw", "SQL", "exception", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L223-L241
52,721
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.executeLargeUpdate
@Override public long executeLargeUpdate(String sql) throws SQLException { if (executeInternal(sql, fetchSize, Statement.NO_GENERATED_KEYS)) { return 0; } return getLargeUpdateCount(); }
java
@Override public long executeLargeUpdate(String sql) throws SQLException { if (executeInternal(sql, fetchSize, Statement.NO_GENERATED_KEYS)) { return 0; } return getLargeUpdateCount(); }
[ "@", "Override", "public", "long", "executeLargeUpdate", "(", "String", "sql", ")", "throws", "SQLException", "{", "if", "(", "executeInternal", "(", "sql", ",", "fetchSize", ",", "Statement", ".", "NO_GENERATED_KEYS", ")", ")", "{", "return", "0", ";", "}",...
Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement. This method should be used when the returned row count may exceed Integer.MAX_VALUE. @param sql sql command @return update counts @throws SQLException if any err...
[ "Executes", "the", "given", "SQL", "statement", "which", "may", "be", "an", "INSERT", "UPDATE", "or", "DELETE", "statement", "or", "an", "SQL", "statement", "that", "returns", "nothing", "such", "as", "an", "SQL", "DDL", "statement", ".", "This", "method", ...
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L618-L624
52,722
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.getUpdateCount
public int getUpdateCount() { if (results != null && results.getCmdInformation() != null && !results.isBatch()) { return results.getCmdInformation().getUpdateCount(); } return -1; }
java
public int getUpdateCount() { if (results != null && results.getCmdInformation() != null && !results.isBatch()) { return results.getCmdInformation().getUpdateCount(); } return -1; }
[ "public", "int", "getUpdateCount", "(", ")", "{", "if", "(", "results", "!=", "null", "&&", "results", ".", "getCmdInformation", "(", ")", "!=", "null", "&&", "!", "results", ".", "isBatch", "(", ")", ")", "{", "return", "results", ".", "getCmdInformatio...
Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned. This method should be called only once per result. @return the current result as an update count; -1 if the current result is a ResultSet object or there are no more results
[ "Retrieves", "the", "current", "result", "as", "an", "update", "count", ";", "if", "the", "result", "is", "a", "ResultSet", "object", "or", "there", "are", "no", "more", "results", "-", "1", "is", "returned", ".", "This", "method", "should", "be", "calle...
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L1057-L1062
52,723
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.getLargeUpdateCount
@Override public long getLargeUpdateCount() { if (results != null && results.getCmdInformation() != null && !results.isBatch()) { return results.getCmdInformation().getLargeUpdateCount(); } return -1; }
java
@Override public long getLargeUpdateCount() { if (results != null && results.getCmdInformation() != null && !results.isBatch()) { return results.getCmdInformation().getLargeUpdateCount(); } return -1; }
[ "@", "Override", "public", "long", "getLargeUpdateCount", "(", ")", "{", "if", "(", "results", "!=", "null", "&&", "results", ".", "getCmdInformation", "(", ")", "!=", "null", "&&", "!", "results", ".", "isBatch", "(", ")", ")", "{", "return", "results",...
Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned. @return last update count
[ "Retrieves", "the", "current", "result", "as", "an", "update", "count", ";", "if", "the", "result", "is", "a", "ResultSet", "object", "or", "there", "are", "no", "more", "results", "-", "1", "is", "returned", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L1070-L1076
52,724
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.internalBatchExecution
private void internalBatchExecution(int size) throws SQLException { executeQueryPrologue(true); results = new Results(this, 0, true, size, false, resultSetScrollType, resultSetConcurrency, Statement.RETURN_GENERATED_KEYS, protocol.getAutoIncrement...
java
private void internalBatchExecution(int size) throws SQLException { executeQueryPrologue(true); results = new Results(this, 0, true, size, false, resultSetScrollType, resultSetConcurrency, Statement.RETURN_GENERATED_KEYS, protocol.getAutoIncrement...
[ "private", "void", "internalBatchExecution", "(", "int", "size", ")", "throws", "SQLException", "{", "executeQueryPrologue", "(", "true", ")", ";", "results", "=", "new", "Results", "(", "this", ",", "0", ",", "true", ",", "size", ",", "false", ",", "resul...
Internal batch execution. @param size expected result-set size @throws SQLException throw exception if batch error occur
[ "Internal", "batch", "execution", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L1337-L1351
52,725
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/MariaDbStatement.java
MariaDbStatement.checkCloseOnCompletion
public void checkCloseOnCompletion(ResultSet resultSet) throws SQLException { if (mustCloseOnCompletion && !closed && results != null && resultSet.equals(results.getResultSet())) { close(); } }
java
public void checkCloseOnCompletion(ResultSet resultSet) throws SQLException { if (mustCloseOnCompletion && !closed && results != null && resultSet.equals(results.getResultSet())) { close(); } }
[ "public", "void", "checkCloseOnCompletion", "(", "ResultSet", "resultSet", ")", "throws", "SQLException", "{", "if", "(", "mustCloseOnCompletion", "&&", "!", "closed", "&&", "results", "!=", "null", "&&", "resultSet", ".", "equals", "(", "results", ".", "getResu...
Check that close on completion is asked, and close if so. @param resultSet resultSet @throws SQLException if close has error
[ "Check", "that", "close", "on", "completion", "is", "asked", "and", "close", "if", "so", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L1418-L1425
52,726
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/CallableFunctionStatement.java
CallableFunctionStatement.initFunctionData
public void initFunctionData(int parametersCount) { params = new CallParameter[parametersCount]; for (int i = 0; i < parametersCount; i++) { params[i] = new CallParameter(); if (i > 0) { params[i].setInput(true); } } // the query was in the form {?=call function()}, so the firs...
java
public void initFunctionData(int parametersCount) { params = new CallParameter[parametersCount]; for (int i = 0; i < parametersCount; i++) { params[i] = new CallParameter(); if (i > 0) { params[i].setInput(true); } } // the query was in the form {?=call function()}, so the firs...
[ "public", "void", "initFunctionData", "(", "int", "parametersCount", ")", "{", "params", "=", "new", "CallParameter", "[", "parametersCount", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parametersCount", ";", "i", "++", ")", "{", "params"...
Data initialisation when parameterCount is defined. @param parametersCount number of parameters
[ "Data", "initialisation", "when", "parameterCount", "is", "defined", "." ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/CallableFunctionStatement.java#L131-L141
52,727
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/ServerSidePreparedStatement.java
ServerSidePreparedStatement.executeQueryPrologue
private void executeQueryPrologue(ServerPrepareResult serverPrepareResult) throws SQLException { executing = true; if (closed) { throw new SQLException("execute() is called on closed statement"); } protocol .prologProxy(serverPrepareResult, maxRows, protocol.getProxy() != null, connection,...
java
private void executeQueryPrologue(ServerPrepareResult serverPrepareResult) throws SQLException { executing = true; if (closed) { throw new SQLException("execute() is called on closed statement"); } protocol .prologProxy(serverPrepareResult, maxRows, protocol.getProxy() != null, connection,...
[ "private", "void", "executeQueryPrologue", "(", "ServerPrepareResult", "serverPrepareResult", ")", "throws", "SQLException", "{", "executing", "=", "true", ";", "if", "(", "closed", ")", "{", "throw", "new", "SQLException", "(", "\"execute() is called on closed statemen...
must have "lock" locked before invoking
[ "must", "have", "lock", "locked", "before", "invoking" ]
d148c7cd347c4680617be65d9e511b289d38a30b
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/ServerSidePreparedStatement.java#L351-L359
52,728
intel-iot-devkit/upm
examples/java/GroveQTouch_Example.java
GroveQTouch_Example.printButtons
public static void printButtons(int buttonNumber){ boolean buttonPressed = false; System.out.print("Button Pressed: "); for(int i=0;i<7;i++){ if((buttonNumber & (1<<i)) != 0){ System.out.println(i+" "); buttonPressed = true; } } if(!buttonPressed){ System.out.println("None "); } }
java
public static void printButtons(int buttonNumber){ boolean buttonPressed = false; System.out.print("Button Pressed: "); for(int i=0;i<7;i++){ if((buttonNumber & (1<<i)) != 0){ System.out.println(i+" "); buttonPressed = true; } } if(!buttonPressed){ System.out.println("None "); } }
[ "public", "static", "void", "printButtons", "(", "int", "buttonNumber", ")", "{", "boolean", "buttonPressed", "=", "false", ";", "System", ".", "out", ".", "print", "(", "\"Button Pressed: \"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
This function prints out the button numbers from 0 through 6 @param buttonNumber
[ "This", "function", "prints", "out", "the", "button", "numbers", "from", "0", "through", "6" ]
2c7fff24c7c5647ef50a65d5aff587de0c5b8b2f
https://github.com/intel-iot-devkit/upm/blob/2c7fff24c7c5647ef50a65d5aff587de0c5b8b2f/examples/java/GroveQTouch_Example.java#L53-L68
52,729
rapidoid/rapidoid
rapidoid-jpa/src/main/java/org/rapidoid/jpa/JPA.java
JPA.transaction
public static void transaction(Runnable action, boolean readOnly) { Ctx ctx = Ctxs.get(); boolean newContext = ctx == null; if (newContext) { ctx = Ctxs.open("transaction"); } try { EntityManager em = ctx.persister(); JPA.with(em).transactional(action, readOnly); } finally { if (newContext) {...
java
public static void transaction(Runnable action, boolean readOnly) { Ctx ctx = Ctxs.get(); boolean newContext = ctx == null; if (newContext) { ctx = Ctxs.open("transaction"); } try { EntityManager em = ctx.persister(); JPA.with(em).transactional(action, readOnly); } finally { if (newContext) {...
[ "public", "static", "void", "transaction", "(", "Runnable", "action", ",", "boolean", "readOnly", ")", "{", "Ctx", "ctx", "=", "Ctxs", ".", "get", "(", ")", ";", "boolean", "newContext", "=", "ctx", "==", "null", ";", "if", "(", "newContext", ")", "{",...
FIXME replace Runnable with Executable
[ "FIXME", "replace", "Runnable", "with", "Executable" ]
1775344bcf4abbee289d474b34d553ff6bc821b0
https://github.com/rapidoid/rapidoid/blob/1775344bcf4abbee289d474b34d553ff6bc821b0/rapidoid-jpa/src/main/java/org/rapidoid/jpa/JPA.java#L210-L227
52,730
rapidoid/rapidoid
rapidoid-rest/src/main/java/org/rapidoid/setup/App.java
App.run
public static synchronized void run(String[] args, String... extraArgs) { AppStarter.startUp(args, extraArgs); // no implicit classpath scanning here boot(); // finish initialization and start the application onAppReady(); boot(); }
java
public static synchronized void run(String[] args, String... extraArgs) { AppStarter.startUp(args, extraArgs); // no implicit classpath scanning here boot(); // finish initialization and start the application onAppReady(); boot(); }
[ "public", "static", "synchronized", "void", "run", "(", "String", "[", "]", "args", ",", "String", "...", "extraArgs", ")", "{", "AppStarter", ".", "startUp", "(", "args", ",", "extraArgs", ")", ";", "// no implicit classpath scanning here", "boot", "(", ")", ...
Initializes the app in non-atomic way. Then starts serving requests immediately when routes are configured.
[ "Initializes", "the", "app", "in", "non", "-", "atomic", "way", ".", "Then", "starts", "serving", "requests", "immediately", "when", "routes", "are", "configured", "." ]
1775344bcf4abbee289d474b34d553ff6bc821b0
https://github.com/rapidoid/rapidoid/blob/1775344bcf4abbee289d474b34d553ff6bc821b0/rapidoid-rest/src/main/java/org/rapidoid/setup/App.java#L90-L100
52,731
rapidoid/rapidoid
rapidoid-rest/src/main/java/org/rapidoid/setup/App.java
App.bootstrap
public static synchronized void bootstrap(String[] args, String... extraArgs) { AppStarter.startUp(args, extraArgs); boot(); App.scan(); // scan classpath for beans // finish initialization and start the application onAppReady(); boot(); }
java
public static synchronized void bootstrap(String[] args, String... extraArgs) { AppStarter.startUp(args, extraArgs); boot(); App.scan(); // scan classpath for beans // finish initialization and start the application onAppReady(); boot(); }
[ "public", "static", "synchronized", "void", "bootstrap", "(", "String", "[", "]", "args", ",", "String", "...", "extraArgs", ")", "{", "AppStarter", ".", "startUp", "(", "args", ",", "extraArgs", ")", ";", "boot", "(", ")", ";", "App", ".", "scan", "("...
Initializes the app in non-atomic way. Then scans the classpath for beans. Then starts serving requests immediately when routes are configured.
[ "Initializes", "the", "app", "in", "non", "-", "atomic", "way", ".", "Then", "scans", "the", "classpath", "for", "beans", ".", "Then", "starts", "serving", "requests", "immediately", "when", "routes", "are", "configured", "." ]
1775344bcf4abbee289d474b34d553ff6bc821b0
https://github.com/rapidoid/rapidoid/blob/1775344bcf4abbee289d474b34d553ff6bc821b0/rapidoid-rest/src/main/java/org/rapidoid/setup/App.java#L107-L118
52,732
rapidoid/rapidoid
rapidoid-commons/src/main/java/org/rapidoid/cache/impl/ConcurrentCacheAtom.java
ConcurrentCacheAtom.setValueInsideWriteLock
private V setValueInsideWriteLock(V newValue) { CachedValue<V> cached = cachedValue; // read the cached value V oldValue = cached != null ? cached.value : null; if (newValue != null) { long expiresAt = ttlInMs > 0 ? U.time() + ttlInMs : Long.MAX_VALUE; cachedValue = new CachedValue<>(newValue, expiresAt); ...
java
private V setValueInsideWriteLock(V newValue) { CachedValue<V> cached = cachedValue; // read the cached value V oldValue = cached != null ? cached.value : null; if (newValue != null) { long expiresAt = ttlInMs > 0 ? U.time() + ttlInMs : Long.MAX_VALUE; cachedValue = new CachedValue<>(newValue, expiresAt); ...
[ "private", "V", "setValueInsideWriteLock", "(", "V", "newValue", ")", "{", "CachedValue", "<", "V", ">", "cached", "=", "cachedValue", ";", "// read the cached value", "V", "oldValue", "=", "cached", "!=", "null", "?", "cached", ".", "value", ":", "null", ";...
Sets new cached value, executes inside already acquired write lock.
[ "Sets", "new", "cached", "value", "executes", "inside", "already", "acquired", "write", "lock", "." ]
1775344bcf4abbee289d474b34d553ff6bc821b0
https://github.com/rapidoid/rapidoid/blob/1775344bcf4abbee289d474b34d553ff6bc821b0/rapidoid-commons/src/main/java/org/rapidoid/cache/impl/ConcurrentCacheAtom.java#L215-L228
52,733
lviggiano/owner
owner/src/main/java/org/aeonbits/owner/ConfigFactory.java
ConfigFactory.newInstance
public static Factory newInstance() { ScheduledExecutorService scheduler = newSingleThreadScheduledExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { Thread result = new Thread(r); result.setDaemon(true); return result; } ...
java
public static Factory newInstance() { ScheduledExecutorService scheduler = newSingleThreadScheduledExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { Thread result = new Thread(r); result.setDaemon(true); return result; } ...
[ "public", "static", "Factory", "newInstance", "(", ")", "{", "ScheduledExecutorService", "scheduler", "=", "newSingleThreadScheduledExecutor", "(", "new", "ThreadFactory", "(", ")", "{", "public", "Thread", "newThread", "(", "Runnable", "r", ")", "{", "Thread", "r...
Returns a new instance of a config Factory object. @return a new instance of a config Factory object.
[ "Returns", "a", "new", "instance", "of", "a", "config", "Factory", "object", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner/src/main/java/org/aeonbits/owner/ConfigFactory.java#L45-L55
52,734
lviggiano/owner
owner/src/main/java/org/aeonbits/owner/ConfigCache.java
ConfigCache.remove
@SuppressWarnings("unchecked") public static <T extends Config> T remove(Object key) { return (T) CACHE.remove(key); }
java
@SuppressWarnings("unchecked") public static <T extends Config> T remove(Object key) { return (T) CACHE.remove(key); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Config", ">", "T", "remove", "(", "Object", "key", ")", "{", "return", "(", "T", ")", "CACHE", ".", "remove", "(", "key", ")", ";", "}" ]
Removes the cached instance for the given key if it is present. <p>Returns previous instance associated to the given key in the cache, or <code>null</code> if the cache contained no instance for the given key. <p>The cache will not contain the instance for the specified key once the call returns. @param <T> type o...
[ "Removes", "the", "cached", "instance", "for", "the", "given", "key", "if", "it", "is", "present", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner/src/main/java/org/aeonbits/owner/ConfigCache.java#L155-L158
52,735
lviggiano/owner
owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java
PropertiesFileCreator.parse
public void parse(Class clazz, PrintWriter output, String headerName, String projectName) throws Exception { long startTime = System.currentTimeMillis(); Group[] groups = parseMethods(clazz); long finishTime = System.currentTimeMillis(); lastExecutionTime = finishTime - startTi...
java
public void parse(Class clazz, PrintWriter output, String headerName, String projectName) throws Exception { long startTime = System.currentTimeMillis(); Group[] groups = parseMethods(clazz); long finishTime = System.currentTimeMillis(); lastExecutionTime = finishTime - startTi...
[ "public", "void", "parse", "(", "Class", "clazz", ",", "PrintWriter", "output", ",", "String", "headerName", ",", "String", "projectName", ")", "throws", "Exception", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Group", ...
Method to parse the class and write file in the choosen output. @param clazz class to parse @param output output file path @param headerName @param projectName
[ "Method", "to", "parse", "the", "class", "and", "write", "file", "in", "the", "choosen", "output", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java#L46-L57
52,736
lviggiano/owner
owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java
PropertiesFileCreator.parseMethods
private Group[] parseMethods(Class clazz) { List<Group> groups = new ArrayList(); Group unknownGroup = new Group(); groups.add(unknownGroup); String[] groupsOrder = new String[0]; for (Method method : clazz.getMethods()) { Property prop = new Property(); ...
java
private Group[] parseMethods(Class clazz) { List<Group> groups = new ArrayList(); Group unknownGroup = new Group(); groups.add(unknownGroup); String[] groupsOrder = new String[0]; for (Method method : clazz.getMethods()) { Property prop = new Property(); ...
[ "private", "Group", "[", "]", "parseMethods", "(", "Class", "clazz", ")", "{", "List", "<", "Group", ">", "groups", "=", "new", "ArrayList", "(", ")", ";", "Group", "unknownGroup", "=", "new", "Group", "(", ")", ";", "groups", ".", "add", "(", "unkno...
Method to get group array with subgroups and properties. @param clazz class to parse @return array of groups
[ "Method", "to", "get", "group", "array", "with", "subgroups", "and", "properties", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java#L65-L92
52,737
lviggiano/owner
owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java
PropertiesFileCreator.orderGroup
private Group[] orderGroup(List<Group> groups, String[] groupsOrder) { LinkedList<Group> groupsOrdered = new LinkedList(); List<Group> remained = new ArrayList(groups); for (String order : groupsOrder) { for (Group remain : remained) { if (remain.title.equals(order)...
java
private Group[] orderGroup(List<Group> groups, String[] groupsOrder) { LinkedList<Group> groupsOrdered = new LinkedList(); List<Group> remained = new ArrayList(groups); for (String order : groupsOrder) { for (Group remain : remained) { if (remain.title.equals(order)...
[ "private", "Group", "[", "]", "orderGroup", "(", "List", "<", "Group", ">", "groups", ",", "String", "[", "]", "groupsOrder", ")", "{", "LinkedList", "<", "Group", ">", "groupsOrdered", "=", "new", "LinkedList", "(", ")", ";", "List", "<", "Group", ">"...
Order groups based on passed order. @param groups groups to order @param groupsOrder order to follow @return ordered groups
[ "Order", "groups", "based", "on", "passed", "order", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java#L102-L120
52,738
lviggiano/owner
owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java
PropertiesFileCreator.toPropertiesString
private String toPropertiesString(Group[] groups, String headerName, String projectName) { StringBuilder result = new StringBuilder(); result.append(format(header, headerName, projectName)); for (Group group : groups) { result.append(group.toString()); } result.app...
java
private String toPropertiesString(Group[] groups, String headerName, String projectName) { StringBuilder result = new StringBuilder(); result.append(format(header, headerName, projectName)); for (Group group : groups) { result.append(group.toString()); } result.app...
[ "private", "String", "toPropertiesString", "(", "Group", "[", "]", "groups", ",", "String", "headerName", ",", "String", "projectName", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "format", "...
Convert groups list into string.
[ "Convert", "groups", "list", "into", "string", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-creator-maven-plugin/src/main/java/org/aeonbits/owner/creator/PropertiesFileCreator.java#L125-L137
52,739
lviggiano/owner
owner-java8-extras/src/main/java/org/aeonbits/owner/util/bytesize/ByteSize.java
ByteSize.getBytes
public BigInteger getBytes(){ return value.multiply(unit.getFactor()).setScale(0, RoundingMode.CEILING).toBigIntegerExact(); }
java
public BigInteger getBytes(){ return value.multiply(unit.getFactor()).setScale(0, RoundingMode.CEILING).toBigIntegerExact(); }
[ "public", "BigInteger", "getBytes", "(", ")", "{", "return", "value", ".", "multiply", "(", "unit", ".", "getFactor", "(", ")", ")", ".", "setScale", "(", "0", ",", "RoundingMode", ".", "CEILING", ")", ".", "toBigIntegerExact", "(", ")", ";", "}" ]
Returns the number of bytes that this byte size represents after multiplying the unit factor with the value. Since the value part can be a represented by a decimal, there is some possibility of a rounding error. Therefore, the result of multiplying the value and the unit factor are always rounded towards positive infi...
[ "Returns", "the", "number", "of", "bytes", "that", "this", "byte", "size", "represents", "after", "multiplying", "the", "unit", "factor", "with", "the", "value", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-java8-extras/src/main/java/org/aeonbits/owner/util/bytesize/ByteSize.java#L91-L93
52,740
lviggiano/owner
owner/src/main/java/org/aeonbits/owner/StrSubstitutor.java
StrSubstitutor.replace
String replace(String source) { if (source == null) return null; Matcher m = PATTERN.matcher(source); StringBuffer sb = new StringBuffer(); while (m.find()) { String var = m.group(1); String value = values.getProperty(var); String replaceme...
java
String replace(String source) { if (source == null) return null; Matcher m = PATTERN.matcher(source); StringBuffer sb = new StringBuffer(); while (m.find()) { String var = m.group(1); String value = values.getProperty(var); String replaceme...
[ "String", "replace", "(", "String", "source", ")", "{", "if", "(", "source", "==", "null", ")", "return", "null", ";", "Matcher", "m", "=", "PATTERN", ".", "matcher", "(", "source", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ...
Replaces all the occurrences of variables with their matching values from the resolver using the given source string as a template. @param source the string to replace in, null returns null @return the result of the replace operation
[ "Replaces", "all", "the", "occurrences", "of", "variables", "with", "their", "matching", "values", "from", "the", "resolver", "using", "the", "given", "source", "string", "as", "a", "template", "." ]
1223ecfbe3c275b3b7c5ec13e9238c9bb888754f
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner/src/main/java/org/aeonbits/owner/StrSubstitutor.java#L70-L83
52,741
siom79/japicmp
japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java
JarArchiveComparator.compare
public List<JApiClass> compare(JApiCmpArchive oldArchive, JApiCmpArchive newArchive) { return compare(Collections.singletonList(oldArchive), Collections.singletonList(newArchive)); }
java
public List<JApiClass> compare(JApiCmpArchive oldArchive, JApiCmpArchive newArchive) { return compare(Collections.singletonList(oldArchive), Collections.singletonList(newArchive)); }
[ "public", "List", "<", "JApiClass", ">", "compare", "(", "JApiCmpArchive", "oldArchive", ",", "JApiCmpArchive", "newArchive", ")", "{", "return", "compare", "(", "Collections", ".", "singletonList", "(", "oldArchive", ")", ",", "Collections", ".", "singletonList",...
Compares the two given archives. @param oldArchive the old version of the archive @param newArchive the new version of the archive @return a list which contains one instance of {@link japicmp.model.JApiClass} for each class found in one of the two archives @throws JApiCmpException if the comparison fails
[ "Compares", "the", "two", "given", "archives", "." ]
f008ea588eec721c45f568bf1db5074fbcbcfced
https://github.com/siom79/japicmp/blob/f008ea588eec721c45f568bf1db5074fbcbcfced/japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java#L82-L84
52,742
siom79/japicmp
japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java
JarArchiveComparator.compare
public List<JApiClass> compare(List<JApiCmpArchive> oldArchives, List<JApiCmpArchive> newArchives) { return createAndCompareClassLists(toFileList(oldArchives), toFileList(newArchives)); }
java
public List<JApiClass> compare(List<JApiCmpArchive> oldArchives, List<JApiCmpArchive> newArchives) { return createAndCompareClassLists(toFileList(oldArchives), toFileList(newArchives)); }
[ "public", "List", "<", "JApiClass", ">", "compare", "(", "List", "<", "JApiCmpArchive", ">", "oldArchives", ",", "List", "<", "JApiCmpArchive", ">", "newArchives", ")", "{", "return", "createAndCompareClassLists", "(", "toFileList", "(", "oldArchives", ")", ",",...
Compares the two given lists of archives. @param oldArchives the old versions of the archives @param newArchives the new versions of the archives @return a list which contains one instance of {@link japicmp.model.JApiClass} for each class found in one of the archives @throws JApiCmpException if the comparison fails
[ "Compares", "the", "two", "given", "lists", "of", "archives", "." ]
f008ea588eec721c45f568bf1db5074fbcbcfced
https://github.com/siom79/japicmp/blob/f008ea588eec721c45f568bf1db5074fbcbcfced/japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java#L94-L96
52,743
siom79/japicmp
japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java
JarArchiveComparator.compareClassLists
List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) { List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses); List<CtClass> newClassesFiltered = applyFilter(options, newClasses); ClassesComparator classesComparator = new ClassesCo...
java
List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) { List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses); List<CtClass> newClassesFiltered = applyFilter(options, newClasses); ClassesComparator classesComparator = new ClassesCo...
[ "List", "<", "JApiClass", ">", "compareClassLists", "(", "JarArchiveComparatorOptions", "options", ",", "List", "<", "CtClass", ">", "oldClasses", ",", "List", "<", "CtClass", ">", "newClasses", ")", "{", "List", "<", "CtClass", ">", "oldClassesFiltered", "=", ...
Compares the two lists with CtClass objects using the provided options instance. @param options the options to use @param oldClasses a list of CtClasses that represent the old version @param newClasses a list of CtClasses that represent the new version @return a list of {@link japicmp.model.JApiClass} that represen...
[ "Compares", "the", "two", "lists", "with", "CtClass", "objects", "using", "the", "provided", "options", "instance", "." ]
f008ea588eec721c45f568bf1db5074fbcbcfced
https://github.com/siom79/japicmp/blob/f008ea588eec721c45f568bf1db5074fbcbcfced/japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java#L203-L218
52,744
siom79/japicmp
japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java
JarArchiveComparator.loadClass
public Optional<CtClass> loadClass(ArchiveType archiveType, String name) { Optional<CtClass> loadedClass = Optional.absent(); if (this.options.getClassPathMode() == JarArchiveComparatorOptions.ClassPathMode.ONE_COMMON_CLASSPATH) { try { loadedClass = Optional.of(commonClassPool.get(name)); } catch (NotFou...
java
public Optional<CtClass> loadClass(ArchiveType archiveType, String name) { Optional<CtClass> loadedClass = Optional.absent(); if (this.options.getClassPathMode() == JarArchiveComparatorOptions.ClassPathMode.ONE_COMMON_CLASSPATH) { try { loadedClass = Optional.of(commonClassPool.get(name)); } catch (NotFou...
[ "public", "Optional", "<", "CtClass", ">", "loadClass", "(", "ArchiveType", "archiveType", ",", "String", "name", ")", "{", "Optional", "<", "CtClass", ">", "loadedClass", "=", "Optional", ".", "absent", "(", ")", ";", "if", "(", "this", ".", "options", ...
Loads a class either from the old, new or common classpath. @param archiveType specify if this class should be loaded from the old or new class path @param name the name of the class (FQN) @return the loaded class (if options are not set to ignore missing classes) @throws japicmp.exception.JApiCmpException if loading t...
[ "Loads", "a", "class", "either", "from", "the", "old", "new", "or", "common", "classpath", "." ]
f008ea588eec721c45f568bf1db5074fbcbcfced
https://github.com/siom79/japicmp/blob/f008ea588eec721c45f568bf1db5074fbcbcfced/japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java#L345-L379
52,745
siom79/japicmp
japicmp/src/main/java/japicmp/compat/CompatibilityChanges.java
CompatibilityChanges.isImplemented
private boolean isImplemented(JApiMethod jApiMethod) { JApiClass aClass = jApiMethod.getjApiClass(); while(aClass != null) { for (JApiMethod method : aClass.getMethods()) { if (jApiMethod.getName().equals(method.getName()) && jApiMethod.hasSameParameter(method) && ...
java
private boolean isImplemented(JApiMethod jApiMethod) { JApiClass aClass = jApiMethod.getjApiClass(); while(aClass != null) { for (JApiMethod method : aClass.getMethods()) { if (jApiMethod.getName().equals(method.getName()) && jApiMethod.hasSameParameter(method) && ...
[ "private", "boolean", "isImplemented", "(", "JApiMethod", "jApiMethod", ")", "{", "JApiClass", "aClass", "=", "jApiMethod", ".", "getjApiClass", "(", ")", ";", "while", "(", "aClass", "!=", "null", ")", "{", "for", "(", "JApiMethod", "method", ":", "aClass",...
Is a method implemented in a super class @param jApiMethod the method @return <code>true</code> if it is implemented in a super class
[ "Is", "a", "method", "implemented", "in", "a", "super", "class" ]
f008ea588eec721c45f568bf1db5074fbcbcfced
https://github.com/siom79/japicmp/blob/f008ea588eec721c45f568bf1db5074fbcbcfced/japicmp/src/main/java/japicmp/compat/CompatibilityChanges.java#L538-L555
52,746
JakeWharton/RxRelay
src/main/java/com/jakewharton/rxrelay2/SerializedRelay.java
SerializedRelay.emitLoop
private void emitLoop() { for (;;) { AppendOnlyLinkedArrayList<T> q; synchronized (this) { q = queue; if (q == null) { emitting = false; return; } queue = null; } ...
java
private void emitLoop() { for (;;) { AppendOnlyLinkedArrayList<T> q; synchronized (this) { q = queue; if (q == null) { emitting = false; return; } queue = null; } ...
[ "private", "void", "emitLoop", "(", ")", "{", "for", "(", ";", ";", ")", "{", "AppendOnlyLinkedArrayList", "<", "T", ">", "q", ";", "synchronized", "(", "this", ")", "{", "q", "=", "queue", ";", "if", "(", "q", "==", "null", ")", "{", "emitting", ...
Loops until all notifications in the queue has been processed.
[ "Loops", "until", "all", "notifications", "in", "the", "queue", "has", "been", "processed", "." ]
67231debeb87eabbacb3bbacebd5353637b32327
https://github.com/JakeWharton/RxRelay/blob/67231debeb87eabbacb3bbacebd5353637b32327/src/main/java/com/jakewharton/rxrelay2/SerializedRelay.java#L62-L75
52,747
jenetics/jenetics
jenetics/src/main/java/io/jenetics/Genotype.java
Genotype.geneCount
public int geneCount() { int count = 0; for (int i = 0, n = _chromosomes.length(); i < n; ++i) { count += _chromosomes.get(i).length(); } return count; }
java
public int geneCount() { int count = 0; for (int i = 0, n = _chromosomes.length(); i < n; ++i) { count += _chromosomes.get(i).length(); } return count; }
[ "public", "int", "geneCount", "(", ")", "{", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "n", "=", "_chromosomes", ".", "length", "(", ")", ";", "i", "<", "n", ";", "++", "i", ")", "{", "count", "+=", "_chromosomes", ...
Return the number of genes this genotype consists of. This is the sum of the number of genes of the genotype chromosomes. @return Return the number of genes this genotype consists of.
[ "Return", "the", "number", "of", "genes", "this", "genotype", "consists", "of", ".", "This", "is", "the", "sum", "of", "the", "number", "of", "genes", "of", "the", "genotype", "chromosomes", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Genotype.java#L226-L232
52,748
jenetics/jenetics
jenetics/src/main/java/io/jenetics/stat/MinMax.java
MinMax.accept
@Override public void accept(final C object) { _min = min(_comparator, _min, object); _max = max(_comparator, _max, object); ++_count; }
java
@Override public void accept(final C object) { _min = min(_comparator, _min, object); _max = max(_comparator, _max, object); ++_count; }
[ "@", "Override", "public", "void", "accept", "(", "final", "C", "object", ")", "{", "_min", "=", "min", "(", "_comparator", ",", "_min", ",", "object", ")", ";", "_max", "=", "max", "(", "_comparator", ",", "_max", ",", "object", ")", ";", "++", "_...
Accept the element for min-max calculation. @param object the element to use for min-max calculation
[ "Accept", "the", "element", "for", "min", "-", "max", "calculation", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/stat/MinMax.java#L73-L78
52,749
jenetics/jenetics
jenetics/src/main/java/io/jenetics/IntegerChromosome.java
IntegerChromosome.toArray
public int[] toArray(final int[] array) { final int[] a = array.length >= length() ? array : new int[length()]; for (int i = length(); --i >= 0;) { a[i] = intValue(i); } return a; }
java
public int[] toArray(final int[] array) { final int[] a = array.length >= length() ? array : new int[length()]; for (int i = length(); --i >= 0;) { a[i] = intValue(i); } return a; }
[ "public", "int", "[", "]", "toArray", "(", "final", "int", "[", "]", "array", ")", "{", "final", "int", "[", "]", "a", "=", "array", ".", "length", ">=", "length", "(", ")", "?", "array", ":", "new", "int", "[", "length", "(", ")", "]", ";", ...
Returns an int array containing all of the elements in this chromosome in proper sequence. If the chromosome fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the length of this chromosome. @since 3.0 @param array the array into which the elements of this chromosomes are t...
[ "Returns", "an", "int", "array", "containing", "all", "of", "the", "elements", "in", "this", "chromosome", "in", "proper", "sequence", ".", "If", "the", "chromosome", "fits", "in", "the", "specified", "array", "it", "is", "returned", "therein", ".", "Otherwi...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/IntegerChromosome.java#L169-L176
52,750
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/math/DoubleAdder.java
DoubleAdder.add
public DoubleAdder add(final double[] values) { for (int i = values.length; --i >= 0;) { add(values[i]); } return this; }
java
public DoubleAdder add(final double[] values) { for (int i = values.length; --i >= 0;) { add(values[i]); } return this; }
[ "public", "DoubleAdder", "add", "(", "final", "double", "[", "]", "values", ")", "{", "for", "(", "int", "i", "=", "values", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "{", "add", "(", "values", "[", "i", "]", ")", ";", "}", "return", ...
Add the given values to this adder. @param values the values to add. @return {@code this} adder, for command chaining
[ "Add", "the", "given", "values", "to", "this", "adder", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/math/DoubleAdder.java#L116-L122
52,751
jenetics/jenetics
jenetics.example/src/main/java/io/jenetics/example/image/Polygon.java
Polygon.draw
public void draw(final Graphics2D g, final int width, final int height) { g.setColor(new Color(_data[0], _data[1], _data[2], _data[3])); final GeneralPath path = new GeneralPath(); path.moveTo(_data[4]*width, _data[5]*height); for (int j = 1; j < _length; ++j) { path.lineTo(_data[4 + j*2]*width, _data[5 + j...
java
public void draw(final Graphics2D g, final int width, final int height) { g.setColor(new Color(_data[0], _data[1], _data[2], _data[3])); final GeneralPath path = new GeneralPath(); path.moveTo(_data[4]*width, _data[5]*height); for (int j = 1; j < _length; ++j) { path.lineTo(_data[4 + j*2]*width, _data[5 + j...
[ "public", "void", "draw", "(", "final", "Graphics2D", "g", ",", "final", "int", "width", ",", "final", "int", "height", ")", "{", "g", ".", "setColor", "(", "new", "Color", "(", "_data", "[", "0", "]", ",", "_data", "[", "1", "]", ",", "_data", "...
Draw the Polygon to the buffer of the given size.
[ "Draw", "the", "Polygon", "to", "the", "buffer", "of", "the", "given", "size", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.example/src/main/java/io/jenetics/example/image/Polygon.java#L107-L117
52,752
jenetics/jenetics
jenetics.example/src/main/java/io/jenetics/example/image/Polygon.java
Polygon.newRandom
public static Polygon newRandom(final int length, final Random random) { require.positive(length); final Polygon p = new Polygon(length); p._data[0] = random.nextFloat(); // r p._data[1] = random.nextFloat(); // g p._data[2] = random.nextFloat(); // b p._data[3] = max(0.2F, random.nextFloat()*random.nextFl...
java
public static Polygon newRandom(final int length, final Random random) { require.positive(length); final Polygon p = new Polygon(length); p._data[0] = random.nextFloat(); // r p._data[1] = random.nextFloat(); // g p._data[2] = random.nextFloat(); // b p._data[3] = max(0.2F, random.nextFloat()*random.nextFl...
[ "public", "static", "Polygon", "newRandom", "(", "final", "int", "length", ",", "final", "Random", "random", ")", "{", "require", ".", "positive", "(", "length", ")", ";", "final", "Polygon", "p", "=", "new", "Polygon", "(", "length", ")", ";", "p", "....
Creates a new random Polygon of the given length.
[ "Creates", "a", "new", "random", "Polygon", "of", "the", "given", "length", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.example/src/main/java/io/jenetics/example/image/Polygon.java#L122-L138
52,753
jenetics/jenetics
jenetics.tool/src/main/java/io/jenetics/tool/trial/Gnuplot.java
Gnuplot.create
public void create(final Path data, final Path output) throws IOException { _parameters.put(DATA_NAME, data.toString()); _parameters.put(OUTPUT_NAME, output.toString()); final String params = _parameters.entrySet().stream() .map(Gnuplot::toParamString) .collect(Collectors.joining("; ")); String scrip...
java
public void create(final Path data, final Path output) throws IOException { _parameters.put(DATA_NAME, data.toString()); _parameters.put(OUTPUT_NAME, output.toString()); final String params = _parameters.entrySet().stream() .map(Gnuplot::toParamString) .collect(Collectors.joining("; ")); String scrip...
[ "public", "void", "create", "(", "final", "Path", "data", ",", "final", "Path", "output", ")", "throws", "IOException", "{", "_parameters", ".", "put", "(", "DATA_NAME", ",", "data", ".", "toString", "(", ")", ")", ";", "_parameters", ".", "put", "(", ...
Generate the Gnuplot graph. @param data the input data file @param output the output path of the graph @throws IOException if the Gnuplot generation fails
[ "Generate", "the", "Gnuplot", "graph", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.tool/src/main/java/io/jenetics/tool/trial/Gnuplot.java#L86-L121
52,754
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/Timer.java
Timer.of
public static Timer of(final Clock clock) { requireNonNull(clock); return clock instanceof NanoClock ? new Timer(System::nanoTime) : new Timer(() -> nanos(clock)); }
java
public static Timer of(final Clock clock) { requireNonNull(clock); return clock instanceof NanoClock ? new Timer(System::nanoTime) : new Timer(() -> nanos(clock)); }
[ "public", "static", "Timer", "of", "(", "final", "Clock", "clock", ")", "{", "requireNonNull", "(", "clock", ")", ";", "return", "clock", "instanceof", "NanoClock", "?", "new", "Timer", "(", "System", "::", "nanoTime", ")", ":", "new", "Timer", "(", "(",...
Return an new timer object which uses the given clock for measuring the execution time. @param clock the clock used for measuring the execution time @return a new timer
[ "Return", "an", "new", "timer", "object", "which", "uses", "the", "given", "clock", "for", "measuring", "the", "execution", "time", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Timer.java#L86-L91
52,755
jenetics/jenetics
jenetics/src/main/java/io/jenetics/stat/Quantile.java
Quantile.adjustMarkerHeights
private void adjustMarkerHeights() { double mm = _n[1] - 1.0; double mp = _n[1] + 1.0; if (_nn[0] >= mp && _n[2] > mp) { _q[1] = qPlus(mp, _n[0], _n[1], _n[2], _q[0], _q[1], _q[2]); _n[1] = mp; } else if (_nn[0] <= mm && _n[0] < mm) { _q[1] = qMinus(mm, _n[0], _n[1], _n[2], _q[0], _q[1], _q[2]); _n[...
java
private void adjustMarkerHeights() { double mm = _n[1] - 1.0; double mp = _n[1] + 1.0; if (_nn[0] >= mp && _n[2] > mp) { _q[1] = qPlus(mp, _n[0], _n[1], _n[2], _q[0], _q[1], _q[2]); _n[1] = mp; } else if (_nn[0] <= mm && _n[0] < mm) { _q[1] = qMinus(mm, _n[0], _n[1], _n[2], _q[0], _q[1], _q[2]); _n[...
[ "private", "void", "adjustMarkerHeights", "(", ")", "{", "double", "mm", "=", "_n", "[", "1", "]", "-", "1.0", ";", "double", "mp", "=", "_n", "[", "1", "]", "+", "1.0", ";", "if", "(", "_nn", "[", "0", "]", ">=", "mp", "&&", "_n", "[", "2", ...
Adjust heights of markers 0 to 2 if necessary
[ "Adjust", "heights", "of", "markers", "0", "to", "2", "if", "necessary" ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/stat/Quantile.java#L302-L332
52,756
jenetics/jenetics
jenetics.example/src/main/java/io/jenetics/example/BatchEvalKnapsack.java
BatchEvalKnapsack.batchEval
private static <G extends Gene<?, G>, C extends Comparable<? super C>> ISeq<C> batchEval( final Seq<Genotype<G>> genotypes, final Function<? super Genotype<G>, ? extends C> function ) { return genotypes.<C>map(function).asISeq(); }
java
private static <G extends Gene<?, G>, C extends Comparable<? super C>> ISeq<C> batchEval( final Seq<Genotype<G>> genotypes, final Function<? super Genotype<G>, ? extends C> function ) { return genotypes.<C>map(function).asISeq(); }
[ "private", "static", "<", "G", "extends", "Gene", "<", "?", ",", "G", ">", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "ISeq", "<", "C", ">", "batchEval", "(", "final", "Seq", "<", "Genotype", "<", "G", ">", ">", "genotyp...
Not really batch eval. Just for testing.
[ "Not", "really", "batch", "eval", ".", "Just", "for", "testing", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.example/src/main/java/io/jenetics/example/BatchEvalKnapsack.java#L68-L74
52,757
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/engine/ConcatEngine.java
ConcatEngine.of
@SafeVarargs public static <G extends Gene<?, G>, C extends Comparable<? super C>> ConcatEngine<G, C> of(final EvolutionStreamable<G, C>... engines) { return new ConcatEngine<>(Arrays.asList(engines)); }
java
@SafeVarargs public static <G extends Gene<?, G>, C extends Comparable<? super C>> ConcatEngine<G, C> of(final EvolutionStreamable<G, C>... engines) { return new ConcatEngine<>(Arrays.asList(engines)); }
[ "@", "SafeVarargs", "public", "static", "<", "G", "extends", "Gene", "<", "?", ",", "G", ">", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "ConcatEngine", "<", "G", ",", "C", ">", "of", "(", "final", "EvolutionStreamable", "<"...
Create a new concatenating evolution engine with the given array of engines. @param engines the engines which are concatenated to <em>one</em> engine @param <G> the gene type @param <C> the fitness type @return a new concatenating evolution engine @throws NullPointerException if the {@code engines} or one of it's elem...
[ "Create", "a", "new", "concatenating", "evolution", "engine", "with", "the", "given", "array", "of", "engines", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/engine/ConcatEngine.java#L225-L229
52,758
jenetics/jenetics
jenetics.doc/src/main/java/TravelingSalesman.java
TravelingSalesman.of
public static TravelingSalesman of(int stops, double radius) { final MSeq<double[]> points = MSeq.ofLength(stops); final double delta = 2.0*PI/stops; for (int i = 0; i < stops; ++i) { final double alpha = delta*i; final double x = cos(alpha)*radius + radius; final double y = sin(alpha)*radius + radius; ...
java
public static TravelingSalesman of(int stops, double radius) { final MSeq<double[]> points = MSeq.ofLength(stops); final double delta = 2.0*PI/stops; for (int i = 0; i < stops; ++i) { final double alpha = delta*i; final double x = cos(alpha)*radius + radius; final double y = sin(alpha)*radius + radius; ...
[ "public", "static", "TravelingSalesman", "of", "(", "int", "stops", ",", "double", "radius", ")", "{", "final", "MSeq", "<", "double", "[", "]", ">", "points", "=", "MSeq", ".", "ofLength", "(", "stops", ")", ";", "final", "double", "delta", "=", "2.0"...
of stops. All stops lie on a circle with the given radius.
[ "of", "stops", ".", "All", "stops", "lie", "on", "a", "circle", "with", "the", "given", "radius", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.doc/src/main/java/TravelingSalesman.java#L56-L77
52,759
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/util/Args.java
Args.arg
public Optional<String> arg(final String name) { int index = _args.indexOf("--" + name); if (index == -1) index = _args.indexOf("-" + name); return index >= 0 && index < _args.length() - 1 ? Optional.of(_args.get(index + 1)) : Optional.empty(); }
java
public Optional<String> arg(final String name) { int index = _args.indexOf("--" + name); if (index == -1) index = _args.indexOf("-" + name); return index >= 0 && index < _args.length() - 1 ? Optional.of(_args.get(index + 1)) : Optional.empty(); }
[ "public", "Optional", "<", "String", ">", "arg", "(", "final", "String", "name", ")", "{", "int", "index", "=", "_args", ".", "indexOf", "(", "\"--\"", "+", "name", ")", ";", "if", "(", "index", "==", "-", "1", ")", "index", "=", "_args", ".", "i...
Return the parameter with the given name. @param name the parameter name @return the parameter with the given name, if any
[ "Return", "the", "parameter", "with", "the", "given", "name", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/util/Args.java#L51-L58
52,760
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/util/Args.java
Args.intArg
public Optional<Integer> intArg(final String name) { return arg(name) .flatMap(s -> parse(s, Integer::valueOf)); }
java
public Optional<Integer> intArg(final String name) { return arg(name) .flatMap(s -> parse(s, Integer::valueOf)); }
[ "public", "Optional", "<", "Integer", ">", "intArg", "(", "final", "String", "name", ")", "{", "return", "arg", "(", "name", ")", ".", "flatMap", "(", "s", "->", "parse", "(", "s", ",", "Integer", "::", "valueOf", ")", ")", ";", "}" ]
Return the int-argument with the given name. @param name the argument name @return the int argument value, if any
[ "Return", "the", "int", "-", "argument", "with", "the", "given", "name", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/util/Args.java#L66-L69
52,761
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/util/Args.java
Args.longArg
public Optional<Long> longArg(final String name) { return arg(name) .flatMap(s -> parse(s, Long::valueOf)); }
java
public Optional<Long> longArg(final String name) { return arg(name) .flatMap(s -> parse(s, Long::valueOf)); }
[ "public", "Optional", "<", "Long", ">", "longArg", "(", "final", "String", "name", ")", "{", "return", "arg", "(", "name", ")", ".", "flatMap", "(", "s", "->", "parse", "(", "s", ",", "Long", "::", "valueOf", ")", ")", ";", "}" ]
Return the long-argument with the given name. @param name the argument name @return the long argument value, if any
[ "Return", "the", "long", "-", "argument", "with", "the", "given", "name", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/util/Args.java#L88-L91
52,762
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/util/Args.java
Args.doubleArg
public Optional<Double> doubleArg(final String name) { return arg(name) .flatMap(s -> parse(s, Double::valueOf)); }
java
public Optional<Double> doubleArg(final String name) { return arg(name) .flatMap(s -> parse(s, Double::valueOf)); }
[ "public", "Optional", "<", "Double", ">", "doubleArg", "(", "final", "String", "name", ")", "{", "return", "arg", "(", "name", ")", ".", "flatMap", "(", "s", "->", "parse", "(", "s", ",", "Double", "::", "valueOf", ")", ")", ";", "}" ]
Return the double-argument with the given name. @param name the argument name @return the double argument value, if any
[ "Return", "the", "double", "-", "argument", "with", "the", "given", "name", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/util/Args.java#L99-L102
52,763
jenetics/jenetics
jenetics/src/main/java/io/jenetics/stat/DoubleSummary.java
DoubleSummary.min
public static double min(final double[] values) { double min = NaN; if (values.length > 0) { min = values[0]; for (int i = 0; i < values.length; ++i) { if (values[i] < min) { min = values[i]; } } } return min; }
java
public static double min(final double[] values) { double min = NaN; if (values.length > 0) { min = values[0]; for (int i = 0; i < values.length; ++i) { if (values[i] < min) { min = values[i]; } } } return min; }
[ "public", "static", "double", "min", "(", "final", "double", "[", "]", "values", ")", "{", "double", "min", "=", "NaN", ";", "if", "(", "values", ".", "length", ">", "0", ")", "{", "min", "=", "values", "[", "0", "]", ";", "for", "(", "int", "i...
Return the minimum value of the given double array. @since 4.0 @param values the double array. @return the minimum value or {@link Double#NaN} if the given array is empty. @throws NullPointerException if the given array is {@code null}.
[ "Return", "the", "minimum", "value", "of", "the", "given", "double", "array", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/stat/DoubleSummary.java#L243-L256
52,764
jenetics/jenetics
jenetics.xml/src/main/java/io/jenetics/xml/Readers.java
Readers.read
public static < A, G extends Gene<A, G>, C extends Chromosome<G> > List<io.jenetics.Genotype<G>> read(final InputStream in, final Reader<? extends C> chromosomeReader) throws XMLStreamException { return Genotypes.read(in, chromosomeReader); }
java
public static < A, G extends Gene<A, G>, C extends Chromosome<G> > List<io.jenetics.Genotype<G>> read(final InputStream in, final Reader<? extends C> chromosomeReader) throws XMLStreamException { return Genotypes.read(in, chromosomeReader); }
[ "public", "static", "<", "A", ",", "G", "extends", "Gene", "<", "A", ",", "G", ">", ",", "C", "extends", "Chromosome", "<", "G", ">", ">", "List", "<", "io", ".", "jenetics", ".", "Genotype", "<", "G", ">", ">", "read", "(", "final", "InputStream...
Reads the genotypes by using the given chromosome reader. @see Genotypes#read(InputStream, Reader) @param <A> the allele type @param <G> the gene type @param <C> the chromosome type @param in the input stream to read the genotype from @param chromosomeReader the used chromosome reader @return a genotype by using the ...
[ "Reads", "the", "genotypes", "by", "using", "the", "given", "chromosome", "reader", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.xml/src/main/java/io/jenetics/xml/Readers.java#L746-L756
52,765
jenetics/jenetics
jenetics/src/main/java/io/jenetics/CharacterChromosome.java
CharacterChromosome.toArray
public char[] toArray(final char[] array) { final char[] a = array.length >= length() ? array : new char[length()]; for (int i = length(); --i >= 0;) { a[i] = charAt(i); } return a; }
java
public char[] toArray(final char[] array) { final char[] a = array.length >= length() ? array : new char[length()]; for (int i = length(); --i >= 0;) { a[i] = charAt(i); } return a; }
[ "public", "char", "[", "]", "toArray", "(", "final", "char", "[", "]", "array", ")", "{", "final", "char", "[", "]", "a", "=", "array", ".", "length", ">=", "length", "(", ")", "?", "array", ":", "new", "char", "[", "length", "(", ")", "]", ";"...
Returns an char array containing all of the elements in this chromosome in proper sequence. If the chromosome fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the length of this chromosome. @since 3.0 @param array the array into which the elements of this chromosomes are ...
[ "Returns", "an", "char", "array", "containing", "all", "of", "the", "elements", "in", "this", "chromosome", "in", "proper", "sequence", ".", "If", "the", "chromosome", "fits", "in", "the", "specified", "array", "it", "is", "returned", "therein", ".", "Otherw...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/CharacterChromosome.java#L192-L201
52,766
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/engine/AdaptiveEngine.java
AdaptiveEngine.of
public static <G extends Gene<?, G>, C extends Comparable<? super C>> AdaptiveEngine<G, C> of( final Function< ? super EvolutionResult<G, C>, ? extends EvolutionStreamable<G, C>> engine ) { return new AdaptiveEngine<>(engine); }
java
public static <G extends Gene<?, G>, C extends Comparable<? super C>> AdaptiveEngine<G, C> of( final Function< ? super EvolutionResult<G, C>, ? extends EvolutionStreamable<G, C>> engine ) { return new AdaptiveEngine<>(engine); }
[ "public", "static", "<", "G", "extends", "Gene", "<", "?", ",", "G", ">", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "AdaptiveEngine", "<", "G", ",", "C", ">", "of", "(", "final", "Function", "<", "?", "super", "EvolutionR...
Return a new adaptive evolution engine, with the given engine generation function. @param engine the engine generating function used for adapting the engines. <b>Be aware, that the {@code EvolutionResult} for the first created {@code Engine} is {@code null}.</b> @param <G> the gene type @param <C> the fitness type @re...
[ "Return", "a", "new", "adaptive", "evolution", "engine", "with", "the", "given", "engine", "generation", "function", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/engine/AdaptiveEngine.java#L200-L207
52,767
jenetics/jenetics
jenetics/src/main/java/io/jenetics/PermutationChromosome.java
PermutationChromosome.ofInteger
public static PermutationChromosome<Integer> ofInteger(final int start, final int end) { if (end <= start) { throw new IllegalArgumentException(format( "end <= start: %d <= %d", end, start )); } return ofInteger(IntRange.of(start, end), end - start); }
java
public static PermutationChromosome<Integer> ofInteger(final int start, final int end) { if (end <= start) { throw new IllegalArgumentException(format( "end <= start: %d <= %d", end, start )); } return ofInteger(IntRange.of(start, end), end - start); }
[ "public", "static", "PermutationChromosome", "<", "Integer", ">", "ofInteger", "(", "final", "int", "start", ",", "final", "int", "end", ")", "{", "if", "(", "end", "<=", "start", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\...
Create an integer permutation chromosome with the given range. @since 2.0 @param start the start of the integer range (inclusively) of the returned chromosome. @param end the end of the integer range (exclusively) of the returned chromosome. @return a integer permutation chromosome with the given integer range values...
[ "Create", "an", "integer", "permutation", "chromosome", "with", "the", "given", "range", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/PermutationChromosome.java#L283-L292
52,768
jenetics/jenetics
jenetics/src/main/java/io/jenetics/PermutationChromosome.java
PermutationChromosome.ofInteger
public static PermutationChromosome<Integer> ofInteger(final IntRange range, final int length) { return of( range.stream() .boxed() .collect(ISeq.toISeq()), length ); }
java
public static PermutationChromosome<Integer> ofInteger(final IntRange range, final int length) { return of( range.stream() .boxed() .collect(ISeq.toISeq()), length ); }
[ "public", "static", "PermutationChromosome", "<", "Integer", ">", "ofInteger", "(", "final", "IntRange", "range", ",", "final", "int", "length", ")", "{", "return", "of", "(", "range", ".", "stream", "(", ")", ".", "boxed", "(", ")", ".", "collect", "(",...
Create an integer permutation chromosome with the given range and length @since 3.4 @param range the value range @param length the chromosome length @return a new integer permutation chromosome @throws NullPointerException if the given {@code range} is {@code null} @throws IllegalArgumentException if {@code range.get...
[ "Create", "an", "integer", "permutation", "chromosome", "with", "the", "given", "range", "and", "length" ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/PermutationChromosome.java#L309-L317
52,769
jenetics/jenetics
jenetics.example/src/main/java/io/jenetics/example/TravelingSalesman.java
TravelingSalesman.districtCapitals
private static ISeq<WayPoint> districtCapitals() throws IOException { final String capitals = "/io/jenetics/example/DistrictCapitals.gpx"; try (InputStream in = TravelingSalesman .class.getResourceAsStream(capitals)) { return ISeq.of(GPX.read(in).getWayPoints()); } }
java
private static ISeq<WayPoint> districtCapitals() throws IOException { final String capitals = "/io/jenetics/example/DistrictCapitals.gpx"; try (InputStream in = TravelingSalesman .class.getResourceAsStream(capitals)) { return ISeq.of(GPX.read(in).getWayPoints()); } }
[ "private", "static", "ISeq", "<", "WayPoint", ">", "districtCapitals", "(", ")", "throws", "IOException", "{", "final", "String", "capitals", "=", "\"/io/jenetics/example/DistrictCapitals.gpx\"", ";", "try", "(", "InputStream", "in", "=", "TravelingSalesman", ".", "...
Return the district capitals, we want to visit.
[ "Return", "the", "district", "capitals", "we", "want", "to", "visit", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.example/src/main/java/io/jenetics/example/TravelingSalesman.java#L125-L132
52,770
jenetics/jenetics
jenetics/src/main/java/io/jenetics/EnumGene.java
EnumGene.of
public static <A> EnumGene<A> of(final ISeq<? extends A> validAlleles) { return new EnumGene<>( RandomRegistry.getRandom().nextInt(validAlleles.length()), validAlleles ); }
java
public static <A> EnumGene<A> of(final ISeq<? extends A> validAlleles) { return new EnumGene<>( RandomRegistry.getRandom().nextInt(validAlleles.length()), validAlleles ); }
[ "public", "static", "<", "A", ">", "EnumGene", "<", "A", ">", "of", "(", "final", "ISeq", "<", "?", "extends", "A", ">", "validAlleles", ")", "{", "return", "new", "EnumGene", "<>", "(", "RandomRegistry", ".", "getRandom", "(", ")", ".", "nextInt", "...
Return a new enum gene with an allele randomly chosen from the given valid alleles. @param <A> the allele type @param validAlleles the sequence of valid alleles. @return a new {@code EnumGene} with an randomly chosen allele from the sequence of valid alleles @throws java.lang.IllegalArgumentException if the give valid...
[ "Return", "a", "new", "enum", "gene", "with", "an", "allele", "randomly", "chosen", "from", "the", "given", "valid", "alleles", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/EnumGene.java#L224-L229
52,771
jenetics/jenetics
jenetics/src/main/java/io/jenetics/EnumGene.java
EnumGene.of
@SafeVarargs public static <A> EnumGene<A> of( final int alleleIndex, final A... validAlleles ) { return new EnumGene<>(alleleIndex, ISeq.of(validAlleles)); }
java
@SafeVarargs public static <A> EnumGene<A> of( final int alleleIndex, final A... validAlleles ) { return new EnumGene<>(alleleIndex, ISeq.of(validAlleles)); }
[ "@", "SafeVarargs", "public", "static", "<", "A", ">", "EnumGene", "<", "A", ">", "of", "(", "final", "int", "alleleIndex", ",", "final", "A", "...", "validAlleles", ")", "{", "return", "new", "EnumGene", "<>", "(", "alleleIndex", ",", "ISeq", ".", "of...
Create a new enum gene from the given valid genes and the chosen allele index. @param <A> the allele type @param alleleIndex the index of the allele for this gene. @param validAlleles the array of valid alleles. @return a new {@code EnumGene} with the given with the allele {@code validAlleles[alleleIndex]} @throws jav...
[ "Create", "a", "new", "enum", "gene", "from", "the", "given", "valid", "genes", "and", "the", "chosen", "allele", "index", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/EnumGene.java#L243-L249
52,772
jenetics/jenetics
jenetics/src/main/java/io/jenetics/DoubleChromosome.java
DoubleChromosome.toArray
public double[] toArray(final double[] array) { final double[] a = array.length >= length() ? array : new double[length()]; for (int i = length(); --i >= 0;) { a[i] = doubleValue(i); } return a; }
java
public double[] toArray(final double[] array) { final double[] a = array.length >= length() ? array : new double[length()]; for (int i = length(); --i >= 0;) { a[i] = doubleValue(i); } return a; }
[ "public", "double", "[", "]", "toArray", "(", "final", "double", "[", "]", "array", ")", "{", "final", "double", "[", "]", "a", "=", "array", ".", "length", ">=", "length", "(", ")", "?", "array", ":", "new", "double", "[", "length", "(", ")", "]...
Returns an double array containing all of the elements in this chromosome in proper sequence. If the chromosome fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the length of this chromosome. @since 3.0 @param array the array into which the elements of this chromosomes ar...
[ "Returns", "an", "double", "array", "containing", "all", "of", "the", "elements", "in", "this", "chromosome", "in", "proper", "sequence", ".", "If", "the", "chromosome", "fits", "in", "the", "specified", "array", "it", "is", "returned", "therein", ".", "Othe...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/DoubleChromosome.java#L167-L174
52,773
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/moea/ParetoFront.java
ParetoFront.toParetoFront
public static <C extends Comparable<? super C>> Collector<C, ?, ParetoFront<C>> toParetoFront() { return toParetoFront(Comparator.naturalOrder()); }
java
public static <C extends Comparable<? super C>> Collector<C, ?, ParetoFront<C>> toParetoFront() { return toParetoFront(Comparator.naturalOrder()); }
[ "public", "static", "<", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "Collector", "<", "C", ",", "?", ",", "ParetoFront", "<", "C", ">", ">", "toParetoFront", "(", ")", "{", "return", "toParetoFront", "(", "Comparator", ".", "natura...
Return a pareto-front collector. The natural order of the elements is used as pareto-dominance order. @param <C> the element type @return a new pareto-front collector
[ "Return", "a", "pareto", "-", "front", "collector", ".", "The", "natural", "order", "of", "the", "elements", "is", "used", "as", "pareto", "-", "dominance", "order", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/moea/ParetoFront.java#L228-L231
52,774
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/Limits.java
Limits.byFitnessThreshold
public static <C extends Comparable<? super C>> Predicate<EvolutionResult<?, C>> byFitnessThreshold(final C threshold) { return new FitnessThresholdLimit<>(threshold); }
java
public static <C extends Comparable<? super C>> Predicate<EvolutionResult<?, C>> byFitnessThreshold(final C threshold) { return new FitnessThresholdLimit<>(threshold); }
[ "public", "static", "<", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "Predicate", "<", "EvolutionResult", "<", "?", ",", "C", ">", ">", "byFitnessThreshold", "(", "final", "C", "threshold", ")", "{", "return", "new", "FitnessThresholdLi...
Return a predicate, which will truncated the evolution stream if the best fitness of the current population becomes less than the specified threshold and the objective is set to minimize the fitness. This predicate also stops the evolution if the best fitness in the current population becomes greater than the user-spec...
[ "Return", "a", "predicate", "which", "will", "truncated", "the", "evolution", "stream", "if", "the", "best", "fitness", "of", "the", "current", "population", "becomes", "less", "than", "the", "specified", "threshold", "and", "the", "objective", "is", "set", "t...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Limits.java#L203-L206
52,775
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/Limits.java
Limits.byFitnessConvergence
public static <N extends Number & Comparable<? super N>> Predicate<EvolutionResult<?, N>> byFitnessConvergence( final int shortFilterSize, final int longFilterSize, final BiPredicate<DoubleMoments, DoubleMoments> proceed ) { return new FitnessConvergenceLimit<>( shortFilterSize, longFilterSize, proce...
java
public static <N extends Number & Comparable<? super N>> Predicate<EvolutionResult<?, N>> byFitnessConvergence( final int shortFilterSize, final int longFilterSize, final BiPredicate<DoubleMoments, DoubleMoments> proceed ) { return new FitnessConvergenceLimit<>( shortFilterSize, longFilterSize, proce...
[ "public", "static", "<", "N", "extends", "Number", "&", "Comparable", "<", "?", "super", "N", ">", ">", "Predicate", "<", "EvolutionResult", "<", "?", ",", "N", ">", ">", "byFitnessConvergence", "(", "final", "int", "shortFilterSize", ",", "final", "int", ...
Return a predicate, which will truncate the evolution stream if the fitness is converging. Two filters of different lengths are used to smooth the best fitness across the generations. <pre>{@code final Phenotype<DoubleGene, Double> result = engine.stream() .limit(byFitnessConvergence(5, 15, (s, l) -> { final double di...
[ "Return", "a", "predicate", "which", "will", "truncate", "the", "evolution", "stream", "if", "the", "fitness", "is", "converging", ".", "Two", "filters", "of", "different", "lengths", "are", "used", "to", "smooth", "the", "best", "fitness", "across", "the", ...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Limits.java#L245-L256
52,776
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/Limits.java
Limits.byFitnessConvergence
public static <N extends Number & Comparable<? super N>> Predicate<EvolutionResult<?, N>> byFitnessConvergence( final int shortFilterSize, final int longFilterSize, final double epsilon ) { if (epsilon < 0.0 || epsilon > 1.0) { throw new IllegalArgumentException(format( "The given epsilon is not in the...
java
public static <N extends Number & Comparable<? super N>> Predicate<EvolutionResult<?, N>> byFitnessConvergence( final int shortFilterSize, final int longFilterSize, final double epsilon ) { if (epsilon < 0.0 || epsilon > 1.0) { throw new IllegalArgumentException(format( "The given epsilon is not in the...
[ "public", "static", "<", "N", "extends", "Number", "&", "Comparable", "<", "?", "super", "N", ">", ">", "Predicate", "<", "EvolutionResult", "<", "?", ",", "N", ">", ">", "byFitnessConvergence", "(", "final", "int", "shortFilterSize", ",", "final", "int", ...
Return a predicate, which will truncate the evolution stream if the fitness is converging. Two filters of different lengths are used to smooth the best fitness across the generations. When the smoothed best fitness from the long filter is less than a user-specified percentage away from the smoothed best fitness from th...
[ "Return", "a", "predicate", "which", "will", "truncate", "the", "evolution", "stream", "if", "the", "fitness", "is", "converging", ".", "Two", "filters", "of", "different", "lengths", "are", "used", "to", "smooth", "the", "best", "fitness", "across", "the", ...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Limits.java#L299-L316
52,777
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/Limits.java
Limits.eps
private static double eps(final double s, final double l) { final double div = max(abs(s), abs(l)); return abs(s - l)/(div <= 10E-20 ? 1.0 : div); }
java
private static double eps(final double s, final double l) { final double div = max(abs(s), abs(l)); return abs(s - l)/(div <= 10E-20 ? 1.0 : div); }
[ "private", "static", "double", "eps", "(", "final", "double", "s", ",", "final", "double", "l", ")", "{", "final", "double", "div", "=", "max", "(", "abs", "(", "s", ")", ",", "abs", "(", "l", ")", ")", ";", "return", "abs", "(", "s", "-", "l",...
Calculate the relative mean difference between short and long filter.
[ "Calculate", "the", "relative", "mean", "difference", "between", "short", "and", "long", "filter", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Limits.java#L319-L322
52,778
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/Limits.java
Limits.byPopulationConvergence
public static <N extends Number & Comparable<? super N>> Predicate<EvolutionResult<?, N>> byPopulationConvergence(final double epsilon) { if (epsilon < 0.0 || epsilon > 1.0) { throw new IllegalArgumentException(format( "The given epsilon is not in the range [0, 1]: %f", epsilon )); } return new Popul...
java
public static <N extends Number & Comparable<? super N>> Predicate<EvolutionResult<?, N>> byPopulationConvergence(final double epsilon) { if (epsilon < 0.0 || epsilon > 1.0) { throw new IllegalArgumentException(format( "The given epsilon is not in the range [0, 1]: %f", epsilon )); } return new Popul...
[ "public", "static", "<", "N", "extends", "Number", "&", "Comparable", "<", "?", "super", "N", ">", ">", "Predicate", "<", "EvolutionResult", "<", "?", ",", "N", ">", ">", "byPopulationConvergence", "(", "final", "double", "epsilon", ")", "{", "if", "(", ...
A termination method that stops the evolution when the population is deemed as converged. The population is deemed as converged when the average fitness across the current population is less than a user-specified percentage away from the best fitness of the current population. @since 3.9 @param epsilon the maximal re...
[ "A", "termination", "method", "that", "stops", "the", "evolution", "when", "the", "population", "is", "deemed", "as", "converged", ".", "The", "population", "is", "deemed", "as", "converged", "when", "the", "average", "fitness", "across", "the", "current", "po...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/Limits.java#L367-L379
52,779
jenetics/jenetics
jenetics/src/main/java/io/jenetics/CompositeAlterer.java
CompositeAlterer.of
@SafeVarargs static <G extends Gene<?, G>, C extends Comparable<? super C>> CompositeAlterer<G, C> of(final Alterer<G, C>... alterers) { return new CompositeAlterer<>(ISeq.of(alterers)); }
java
@SafeVarargs static <G extends Gene<?, G>, C extends Comparable<? super C>> CompositeAlterer<G, C> of(final Alterer<G, C>... alterers) { return new CompositeAlterer<>(ISeq.of(alterers)); }
[ "@", "SafeVarargs", "static", "<", "G", "extends", "Gene", "<", "?", ",", "G", ">", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "CompositeAlterer", "<", "G", ",", "C", ">", "of", "(", "final", "Alterer", "<", "G", ",", "C...
Combine the given alterers. @param <G> the gene type @param <C> the fitness function result type @param alterers the alterers to combine. @return a new alterer which consists of the given one @throws NullPointerException if one of the alterers is {@code null}.
[ "Combine", "the", "given", "alterers", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/CompositeAlterer.java#L135-L139
52,780
jenetics/jenetics
jenetics/src/main/java/io/jenetics/CompositeAlterer.java
CompositeAlterer.join
static <T extends Gene<?, T>, C extends Comparable<? super C>> CompositeAlterer<T, C> join( final Alterer<T, C> a1, final Alterer<T, C> a2 ) { return CompositeAlterer.of(a1, a2); }
java
static <T extends Gene<?, T>, C extends Comparable<? super C>> CompositeAlterer<T, C> join( final Alterer<T, C> a1, final Alterer<T, C> a2 ) { return CompositeAlterer.of(a1, a2); }
[ "static", "<", "T", "extends", "Gene", "<", "?", ",", "T", ">", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "CompositeAlterer", "<", "T", ",", "C", ">", "join", "(", "final", "Alterer", "<", "T", ",", "C", ">", "a1", ",...
Joins the given alterer and returns a new CompositeAlterer object. If one of the given alterers is a CompositeAlterer the sub alterers of it are unpacked and appended to the newly created CompositeAlterer. @param <T> the gene type of the alterers. @param <C> the fitness function result type @param a1 the first altere...
[ "Joins", "the", "given", "alterer", "and", "returns", "a", "new", "CompositeAlterer", "object", ".", "If", "one", "of", "the", "given", "alterers", "is", "a", "CompositeAlterer", "the", "sub", "alterers", "of", "it", "are", "unpacked", "and", "appended", "to...
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/CompositeAlterer.java#L154-L160
52,781
jenetics/jenetics
jenetics/src/main/java/io/jenetics/Phenotype.java
Phenotype.newInstance
@Deprecated public Phenotype<G, C> newInstance( final long generation, final Function<? super Genotype<G>, ? extends C> function, final Function<? super C, ? extends C> scaler ) { return of(_genotype, generation, function, scaler); }
java
@Deprecated public Phenotype<G, C> newInstance( final long generation, final Function<? super Genotype<G>, ? extends C> function, final Function<? super C, ? extends C> scaler ) { return of(_genotype, generation, function, scaler); }
[ "@", "Deprecated", "public", "Phenotype", "<", "G", ",", "C", ">", "newInstance", "(", "final", "long", "generation", ",", "final", "Function", "<", "?", "super", "Genotype", "<", "G", ">", ",", "?", "extends", "C", ">", "function", ",", "final", "Func...
Return a new phenotype with the the genotype of this and with new fitness function, fitness scaler and generation. @param generation the generation of the new phenotype. @param function the (new) fitness scaler of the created phenotype. @param scaler the (new) fitness scaler of the created phenotype @return a new phen...
[ "Return", "a", "new", "phenotype", "with", "the", "the", "genotype", "of", "this", "and", "with", "new", "fitness", "function", "fitness", "scaler", "and", "generation", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Phenotype.java#L349-L356
52,782
jenetics/jenetics
jenetics/src/main/java/io/jenetics/Phenotype.java
Phenotype.newInstance
@Deprecated public Phenotype<G, C> newInstance( final long generation, final Function<? super Genotype<G>, ? extends C> function ) { return of(_genotype, generation, function, a -> a); }
java
@Deprecated public Phenotype<G, C> newInstance( final long generation, final Function<? super Genotype<G>, ? extends C> function ) { return of(_genotype, generation, function, a -> a); }
[ "@", "Deprecated", "public", "Phenotype", "<", "G", ",", "C", ">", "newInstance", "(", "final", "long", "generation", ",", "final", "Function", "<", "?", "super", "Genotype", "<", "G", ">", ",", "?", "extends", "C", ">", "function", ")", "{", "return",...
Return a new phenotype with the the genotype of this and with new fitness function and generation. @param generation the generation of the new phenotype. @param function the (new) fitness scaler of the created phenotype. @return a new phenotype with the given values. @throws NullPointerException if one of the values i...
[ "Return", "a", "new", "phenotype", "with", "the", "the", "genotype", "of", "this", "and", "with", "new", "fitness", "function", "and", "generation", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Phenotype.java#L371-L377
52,783
jenetics/jenetics
jenetics/src/main/java/io/jenetics/Phenotype.java
Phenotype.of
public static <G extends Gene<?, G>, C extends Comparable<? super C>> Phenotype<G, C> of( final Genotype<G> genotype, final long generation, final Function<? super Genotype<G>, ? extends C> function, final Function<? super C, ? extends C> scaler ) { return new Phenotype<>( genotype, generation, fun...
java
public static <G extends Gene<?, G>, C extends Comparable<? super C>> Phenotype<G, C> of( final Genotype<G> genotype, final long generation, final Function<? super Genotype<G>, ? extends C> function, final Function<? super C, ? extends C> scaler ) { return new Phenotype<>( genotype, generation, fun...
[ "public", "static", "<", "G", "extends", "Gene", "<", "?", ",", "G", ">", ",", "C", "extends", "Comparable", "<", "?", "super", "C", ">", ">", "Phenotype", "<", "G", ",", "C", ">", "of", "(", "final", "Genotype", "<", "G", ">", "genotype", ",", ...
Create a new phenotype from the given arguments. @param <G> the gene type of the chromosome @param <C> the fitness value type @param genotype the genotype of this phenotype. @param generation the current generation of the generated phenotype. @param function the fitness function of this phenotype. @param scaler the fi...
[ "Create", "a", "new", "phenotype", "from", "the", "given", "arguments", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Phenotype.java#L423-L437
52,784
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/internal/util/TreePattern.java
TreePattern.compile
public static TreePattern compile(final String pattern) { return new TreePattern(TreeNode.parse(pattern, Decl::of)); }
java
public static TreePattern compile(final String pattern) { return new TreePattern(TreeNode.parse(pattern, Decl::of)); }
[ "public", "static", "TreePattern", "compile", "(", "final", "String", "pattern", ")", "{", "return", "new", "TreePattern", "(", "TreeNode", ".", "parse", "(", "pattern", ",", "Decl", "::", "of", ")", ")", ";", "}" ]
Compiles the given tree pattern string. @param pattern the tree pattern string @return the compiled pattern @throws NullPointerException if the given pattern is {@code null} @throws IllegalArgumentException if the given parentheses tree string doesn't represent a valid pattern tree
[ "Compiles", "the", "given", "tree", "pattern", "string", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/internal/util/TreePattern.java#L328-L330
52,785
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/collection/Array.java
Array.sort
public void sort( final int from, final int until, final Comparator<? super T> comparator ) { _store.sort(from + _start, until + _start, comparator); }
java
public void sort( final int from, final int until, final Comparator<? super T> comparator ) { _store.sort(from + _start, until + _start, comparator); }
[ "public", "void", "sort", "(", "final", "int", "from", ",", "final", "int", "until", ",", "final", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "_store", ".", "sort", "(", "from", "+", "_start", ",", "until", "+", "_start", ",",...
Sort the store. @param from the start index where to start sorting (inclusively) @param until the end index where to stop sorting (exclusively) @param comparator the {@code Comparator} used to compare sequence elements. A {@code null} value indicates that the elements' Comparable natural ordering should be used
[ "Sort", "the", "store", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/collection/Array.java#L126-L132
52,786
jenetics/jenetics
jenetics.tool/src/main/java/io/jenetics/tool/trial/TrialMeter.java
TrialMeter.of
public static <T> TrialMeter<T> of( final String name, final String description, final Params<T> params, final String... dataSetNames ) { return new TrialMeter<T>( name, description, Env.of(), params, DataSet.of(params.size(), dataSetNames) ); }
java
public static <T> TrialMeter<T> of( final String name, final String description, final Params<T> params, final String... dataSetNames ) { return new TrialMeter<T>( name, description, Env.of(), params, DataSet.of(params.size(), dataSetNames) ); }
[ "public", "static", "<", "T", ">", "TrialMeter", "<", "T", ">", "of", "(", "final", "String", "name", ",", "final", "String", "description", ",", "final", "Params", "<", "T", ">", "params", ",", "final", "String", "...", "dataSetNames", ")", "{", "retu...
Return a new trial measure environment. @param name the trial meter name @param description the trial meter description, maybe {@code null} @param params the parameters which are tested by this trial meter @param dataSetNames the names of the calculated data sets @param <T> the parameter type @return a new trial measu...
[ "Return", "a", "new", "trial", "measure", "environment", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.tool/src/main/java/io/jenetics/tool/trial/TrialMeter.java#L211-L224
52,787
jenetics/jenetics
jenetics.doc/src/main/java/OnesCounting.java
OnesCounting.count
private static Integer count(final Genotype<BitGene> gt) { return gt.getChromosome() .as(BitChromosome.class) .bitCount(); }
java
private static Integer count(final Genotype<BitGene> gt) { return gt.getChromosome() .as(BitChromosome.class) .bitCount(); }
[ "private", "static", "Integer", "count", "(", "final", "Genotype", "<", "BitGene", ">", "gt", ")", "{", "return", "gt", ".", "getChromosome", "(", ")", ".", "as", "(", "BitChromosome", ".", "class", ")", ".", "bitCount", "(", ")", ";", "}" ]
This method calculates the fitness for a given genotype.
[ "This", "method", "calculates", "the", "fitness", "for", "a", "given", "genotype", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.doc/src/main/java/OnesCounting.java#L17-L21
52,788
jenetics/jenetics
jenetics/src/main/java/io/jenetics/engine/EvolutionStatistics.java
EvolutionStatistics.accept
private void accept(final EvolutionDurations durations) { final double selection = toSeconds(durations.getOffspringSelectionDuration()) + toSeconds(durations.getSurvivorsSelectionDuration()); final double alter = toSeconds(durations.getOffspringAlterDuration()) + toSeconds(durations.getOffspringFilter...
java
private void accept(final EvolutionDurations durations) { final double selection = toSeconds(durations.getOffspringSelectionDuration()) + toSeconds(durations.getSurvivorsSelectionDuration()); final double alter = toSeconds(durations.getOffspringAlterDuration()) + toSeconds(durations.getOffspringFilter...
[ "private", "void", "accept", "(", "final", "EvolutionDurations", "durations", ")", "{", "final", "double", "selection", "=", "toSeconds", "(", "durations", ".", "getOffspringSelectionDuration", "(", ")", ")", "+", "toSeconds", "(", "durations", ".", "getSurvivorsS...
Calculate duration statistics
[ "Calculate", "duration", "statistics" ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/engine/EvolutionStatistics.java#L136-L150
52,789
jenetics/jenetics
jenetics.example/src/main/java/io/jenetics/example/EvolutionResume.java
EvolutionResume.run
private EvolutionResult<BitGene, Double> run( final EvolutionResult<BitGene, Double> last, final AtomicBoolean proceed ) { System.out.println("Starting evolution with existing result."); return (last != null ? ENGINE.stream(last) : ENGINE.stream()) .limit(r -> proceed.get()) .collect(EvolutionResult.toB...
java
private EvolutionResult<BitGene, Double> run( final EvolutionResult<BitGene, Double> last, final AtomicBoolean proceed ) { System.out.println("Starting evolution with existing result."); return (last != null ? ENGINE.stream(last) : ENGINE.stream()) .limit(r -> proceed.get()) .collect(EvolutionResult.toB...
[ "private", "EvolutionResult", "<", "BitGene", ",", "Double", ">", "run", "(", "final", "EvolutionResult", "<", "BitGene", ",", "Double", ">", "last", ",", "final", "AtomicBoolean", "proceed", ")", "{", "System", ".", "out", ".", "println", "(", "\"Starting e...
Run the evolution.
[ "Run", "the", "evolution", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.example/src/main/java/io/jenetics/example/EvolutionResume.java#L61-L70
52,790
jenetics/jenetics
jenetics/src/main/java/io/jenetics/stat/DoubleMomentStatistics.java
DoubleMomentStatistics.accept
@Override public void accept(final double value) { super.accept(value); _min = Math.min(_min, value); _max = Math.max(_max, value); _sum.add(value); }
java
@Override public void accept(final double value) { super.accept(value); _min = Math.min(_min, value); _max = Math.max(_max, value); _sum.add(value); }
[ "@", "Override", "public", "void", "accept", "(", "final", "double", "value", ")", "{", "super", ".", "accept", "(", "value", ")", ";", "_min", "=", "Math", ".", "min", "(", "_min", ",", "value", ")", ";", "_max", "=", "Math", ".", "max", "(", "_...
Records a new value into the moments information @param value the input {@code value}
[ "Records", "a", "new", "value", "into", "the", "moments", "information" ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/stat/DoubleMomentStatistics.java#L91-L97
52,791
jenetics/jenetics
jenetics/src/main/java/io/jenetics/BitChromosome.java
BitChromosome.toBitSet
public BitSet toBitSet() { final BitSet set = new BitSet(length()); for (int i = 0, n = length(); i < n; ++i) { set.set(i, getGene(i).getBit()); } return set; }
java
public BitSet toBitSet() { final BitSet set = new BitSet(length()); for (int i = 0, n = length(); i < n; ++i) { set.set(i, getGene(i).getBit()); } return set; }
[ "public", "BitSet", "toBitSet", "(", ")", "{", "final", "BitSet", "set", "=", "new", "BitSet", "(", "length", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ",", "n", "=", "length", "(", ")", ";", "i", "<", "n", ";", "++", "i", ")", ...
Return the corresponding BitSet of this BitChromosome. @return The corresponding BitSet of this BitChromosome.
[ "Return", "the", "corresponding", "BitSet", "of", "this", "BitChromosome", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/BitChromosome.java#L358-L364
52,792
jenetics/jenetics
jenetics/src/main/java/io/jenetics/BitChromosome.java
BitChromosome.invert
public BitChromosome invert() { final byte[] data = _genes.clone(); bit.invert(data); return new BitChromosome(data, _length, 1.0 - _p); }
java
public BitChromosome invert() { final byte[] data = _genes.clone(); bit.invert(data); return new BitChromosome(data, _length, 1.0 - _p); }
[ "public", "BitChromosome", "invert", "(", ")", "{", "final", "byte", "[", "]", "data", "=", "_genes", ".", "clone", "(", ")", ";", "bit", ".", "invert", "(", "data", ")", ";", "return", "new", "BitChromosome", "(", "data", ",", "_length", ",", "1.0",...
Invert the ones and zeros of this bit chromosome. @return a new BitChromosome with inverted ones and zeros.
[ "Invert", "the", "ones", "and", "zeros", "of", "this", "bit", "chromosome", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/BitChromosome.java#L450-L454
52,793
jenetics/jenetics
jenetics/src/main/java/io/jenetics/BitChromosome.java
BitChromosome.of
public static BitChromosome of(final int length, final double p) { return new BitChromosome(bit.newArray(length, p), length, p); }
java
public static BitChromosome of(final int length, final double p) { return new BitChromosome(bit.newArray(length, p), length, p); }
[ "public", "static", "BitChromosome", "of", "(", "final", "int", "length", ",", "final", "double", "p", ")", "{", "return", "new", "BitChromosome", "(", "bit", ".", "newArray", "(", "length", ",", "p", ")", ",", "length", ",", "p", ")", ";", "}" ]
Construct a new BitChromosome with the given _length. @param length Length of the BitChromosome, number of bits. @param p Probability of the TRUEs in the BitChromosome. @return a new {@code BitChromosome} with the given parameter @throws NegativeArraySizeException if the {@code length} is smaller than one. @throws Ill...
[ "Construct", "a", "new", "BitChromosome", "with", "the", "given", "_length", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/BitChromosome.java#L466-L468
52,794
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/internal/IntList.java
IntList.forEach
public void forEach(final IntConsumer action) { requireNonNull(action); final int size = _size; for (int i = 0; i < size; ++i) { action.accept(_data[i]); } }
java
public void forEach(final IntConsumer action) { requireNonNull(action); final int size = _size; for (int i = 0; i < size; ++i) { action.accept(_data[i]); } }
[ "public", "void", "forEach", "(", "final", "IntConsumer", "action", ")", "{", "requireNonNull", "(", "action", ")", ";", "final", "int", "size", "=", "_size", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "++", "i", ")", "{", ...
Performs the given action for each element of the list. @param action the action to be performed for each element @throws NullPointerException if the specified action is {@code null}
[ "Performs", "the", "given", "action", "for", "each", "element", "of", "the", "list", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/internal/IntList.java#L93-L100
52,795
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/internal/IntList.java
IntList.addAll
public boolean addAll(final int[] elements) { final int count = elements.length; ensureSize(_size + count); arraycopy(elements, 0, _data, _size, count); _size += count; return count != 0; }
java
public boolean addAll(final int[] elements) { final int count = elements.length; ensureSize(_size + count); arraycopy(elements, 0, _data, _size, count); _size += count; return count != 0; }
[ "public", "boolean", "addAll", "(", "final", "int", "[", "]", "elements", ")", "{", "final", "int", "count", "=", "elements", ".", "length", ";", "ensureSize", "(", "_size", "+", "count", ")", ";", "arraycopy", "(", "elements", ",", "0", ",", "_data", ...
Appends all of the elements in the specified array to the end of this list. @param elements array containing elements to be added to this list @return <tt>true</tt> if this list changed as a result of the call @throws NullPointerException if the specified array is null
[ "Appends", "all", "of", "the", "elements", "in", "the", "specified", "array", "to", "the", "end", "of", "this", "list", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/internal/IntList.java#L153-L160
52,796
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/internal/IntList.java
IntList.addAll
public boolean addAll(final int index, final int[] elements) { addRangeCheck(index); final int count = elements.length; ensureSize(_size + count); final int moved = _size - index; if (moved > 0) { arraycopy(_data, index, _data, index + count, moved); } arraycopy(elements, 0, _data, index, count); ...
java
public boolean addAll(final int index, final int[] elements) { addRangeCheck(index); final int count = elements.length; ensureSize(_size + count); final int moved = _size - index; if (moved > 0) { arraycopy(_data, index, _data, index + count, moved); } arraycopy(elements, 0, _data, index, count); ...
[ "public", "boolean", "addAll", "(", "final", "int", "index", ",", "final", "int", "[", "]", "elements", ")", "{", "addRangeCheck", "(", "index", ")", ";", "final", "int", "count", "=", "elements", ".", "length", ";", "ensureSize", "(", "_size", "+", "c...
Inserts all of the elements in the specified array into this list, starting at the specified position. @param index index at which to insert the first element from the specified collection @param elements collection containing elements to be added to this list @return <tt>true</tt> if this list changed as a result of ...
[ "Inserts", "all", "of", "the", "elements", "in", "the", "specified", "array", "into", "this", "list", "starting", "at", "the", "specified", "position", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/internal/IntList.java#L174-L188
52,797
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/AbstractTreeGene.java
AbstractTreeGene.getChild
@Override public G getChild(final int index) { checkTreeState(); if (index < 0 || index >= childCount()) { throw new IndexOutOfBoundsException(format( "Child index out of bounds: %s", index )); } assert _genes != null; return _genes.get(_childOffset + index); }
java
@Override public G getChild(final int index) { checkTreeState(); if (index < 0 || index >= childCount()) { throw new IndexOutOfBoundsException(format( "Child index out of bounds: %s", index )); } assert _genes != null; return _genes.get(_childOffset + index); }
[ "@", "Override", "public", "G", "getChild", "(", "final", "int", "index", ")", "{", "checkTreeState", "(", ")", ";", "if", "(", "index", "<", "0", "||", "index", ">=", "childCount", "(", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ...
Return the child gene with the given index. @param index the child index @return the child node with the given index @throws IndexOutOfBoundsException if the {@code index} is out of bounds ({@code [0, childCount())}) @throws IllegalStateException if this gene is not part of a chromosome
[ "Return", "the", "child", "gene", "with", "the", "given", "index", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/AbstractTreeGene.java#L162-L173
52,798
jenetics/jenetics
jenetics/src/main/java/io/jenetics/Mutator.java
Mutator.mutate
@SuppressWarnings("deprecation") protected MutatorResult<Phenotype<G, C>> mutate( final Phenotype<G, C> phenotype, final long generation, final double p, final Random random ) { return mutate(phenotype.getGenotype(), p, random) .map(gt -> phenotype.newInstance(gt, generation)); }
java
@SuppressWarnings("deprecation") protected MutatorResult<Phenotype<G, C>> mutate( final Phenotype<G, C> phenotype, final long generation, final double p, final Random random ) { return mutate(phenotype.getGenotype(), p, random) .map(gt -> phenotype.newInstance(gt, generation)); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "protected", "MutatorResult", "<", "Phenotype", "<", "G", ",", "C", ">", ">", "mutate", "(", "final", "Phenotype", "<", "G", ",", "C", ">", "phenotype", ",", "final", "long", "generation", ",", "final",...
Mutates the given phenotype. @see #mutate(Genotype, double, Random) @see #mutate(Chromosome, double, Random) @see #mutate(Gene, Random) @param phenotype the phenotype to mutate @param generation the actual generation @param p the mutation probability for the underlying genetic objects @param random the random engine ...
[ "Mutates", "the", "given", "phenotype", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Mutator.java#L144-L153
52,799
jenetics/jenetics
jenetics/src/main/java/io/jenetics/Mutator.java
Mutator.mutate
protected MutatorResult<Genotype<G>> mutate( final Genotype<G> genotype, final double p, final Random random ) { final int P = probability.toInt(p); final ISeq<MutatorResult<Chromosome<G>>> result = genotype.toSeq() .map(gt -> random.nextInt() < P ? mutate(gt, p, random) : MutatorResult.of(gt)); ...
java
protected MutatorResult<Genotype<G>> mutate( final Genotype<G> genotype, final double p, final Random random ) { final int P = probability.toInt(p); final ISeq<MutatorResult<Chromosome<G>>> result = genotype.toSeq() .map(gt -> random.nextInt() < P ? mutate(gt, p, random) : MutatorResult.of(gt)); ...
[ "protected", "MutatorResult", "<", "Genotype", "<", "G", ">", ">", "mutate", "(", "final", "Genotype", "<", "G", ">", "genotype", ",", "final", "double", "p", ",", "final", "Random", "random", ")", "{", "final", "int", "P", "=", "probability", ".", "to...
Mutates the given genotype. @see #mutate(Chromosome, double, Random) @see #mutate(Gene, Random) @param genotype the genotype to mutate @param p the mutation probability for the underlying genetic objects @param random the random engine used for the genotype mutation @return the mutation result
[ "Mutates", "the", "given", "genotype", "." ]
ee516770c65ef529b27deb283f071c85f344eff4
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Mutator.java#L166-L181