repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/iterator/OIdentifiableIterator.java
OIdentifiableIterator.setReuseSameRecord
public OIdentifiableIterator<REC> setReuseSameRecord(final boolean reuseSameRecord) { reusedRecord = (ORecordInternal<?>) (reuseSameRecord ? database.newInstance() : null); return this; }
java
public OIdentifiableIterator<REC> setReuseSameRecord(final boolean reuseSameRecord) { reusedRecord = (ORecordInternal<?>) (reuseSameRecord ? database.newInstance() : null); return this; }
[ "public", "OIdentifiableIterator", "<", "REC", ">", "setReuseSameRecord", "(", "final", "boolean", "reuseSameRecord", ")", "{", "reusedRecord", "=", "(", "ORecordInternal", "<", "?", ">", ")", "(", "reuseSameRecord", "?", "database", ".", "newInstance", "(", ")"...
Tell to the iterator to use the same record for browsing. The record will be reset before every use. This improve the performance and reduce memory utilization since it does not create a new one for each operation, but pay attention to copy the data of the record once read otherwise they will be reset to the next operation. @param reuseSameRecord @return @see #isReuseSameRecord()
[ "Tell", "to", "the", "iterator", "to", "use", "the", "same", "record", "for", "browsing", ".", "The", "record", "will", "be", "reset", "before", "every", "use", ".", "This", "improve", "the", "performance", "and", "reduce", "memory", "utilization", "since", ...
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/iterator/OIdentifiableIterator.java#L118-L121
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/iterator/OIdentifiableIterator.java
OIdentifiableIterator.getRecord
protected ORecordInternal<?> getRecord() { final ORecordInternal<?> record; if (reusedRecord != null) { // REUSE THE SAME RECORD AFTER HAVING RESETTED IT record = reusedRecord; record.reset(); } else record = null; return record; }
java
protected ORecordInternal<?> getRecord() { final ORecordInternal<?> record; if (reusedRecord != null) { // REUSE THE SAME RECORD AFTER HAVING RESETTED IT record = reusedRecord; record.reset(); } else record = null; return record; }
[ "protected", "ORecordInternal", "<", "?", ">", "getRecord", "(", ")", "{", "final", "ORecordInternal", "<", "?", ">", "record", ";", "if", "(", "reusedRecord", "!=", "null", ")", "{", "// REUSE THE SAME RECORD AFTER HAVING RESETTED IT\r", "record", "=", "reusedRec...
Return the record to use for the operation. @return
[ "Return", "the", "record", "to", "use", "for", "the", "operation", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/iterator/OIdentifiableIterator.java#L128-L137
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/iterator/OIdentifiableIterator.java
OIdentifiableIterator.readCurrentRecord
protected ORecordInternal<?> readCurrentRecord(ORecordInternal<?> iRecord, final int iMovement) { if (limit > -1 && browsedRecords >= limit) // LIMIT REACHED return null; current.clusterPosition += iMovement; if (iRecord != null) { iRecord.setIdentity(current); iRecord = lowLevelDatabase.load(iRecord, fetchPlan); } else iRecord = lowLevelDatabase.load(current, fetchPlan); if (iRecord != null) browsedRecords++; return iRecord; }
java
protected ORecordInternal<?> readCurrentRecord(ORecordInternal<?> iRecord, final int iMovement) { if (limit > -1 && browsedRecords >= limit) // LIMIT REACHED return null; current.clusterPosition += iMovement; if (iRecord != null) { iRecord.setIdentity(current); iRecord = lowLevelDatabase.load(iRecord, fetchPlan); } else iRecord = lowLevelDatabase.load(current, fetchPlan); if (iRecord != null) browsedRecords++; return iRecord; }
[ "protected", "ORecordInternal", "<", "?", ">", "readCurrentRecord", "(", "ORecordInternal", "<", "?", ">", "iRecord", ",", "final", "int", "iMovement", ")", "{", "if", "(", "limit", ">", "-", "1", "&&", "browsedRecords", ">=", "limit", ")", "// LIMIT REACHED...
Read the current record and increment the counter if the record was found. @param iRecord @return
[ "Read", "the", "current", "record", "and", "increment", "the", "counter", "if", "the", "record", "was", "found", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/iterator/OIdentifiableIterator.java#L211-L228
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/sql/filter/OSQLPredicate.java
OSQLPredicate.bindParameters
public void bindParameters(final Map<Object, Object> iArgs) { if (parameterItems == null || iArgs == null || iArgs.size() == 0) return; for (Entry<Object, Object> entry : iArgs.entrySet()) { if (entry.getKey() instanceof Integer) parameterItems.get(((Integer) entry.getKey())).setValue(entry.setValue(entry.getValue())); else { String paramName = entry.getKey().toString(); for (OSQLFilterItemParameter value : parameterItems) { if (value.getName().equalsIgnoreCase(paramName)) { value.setValue(entry.getValue()); break; } } } } }
java
public void bindParameters(final Map<Object, Object> iArgs) { if (parameterItems == null || iArgs == null || iArgs.size() == 0) return; for (Entry<Object, Object> entry : iArgs.entrySet()) { if (entry.getKey() instanceof Integer) parameterItems.get(((Integer) entry.getKey())).setValue(entry.setValue(entry.getValue())); else { String paramName = entry.getKey().toString(); for (OSQLFilterItemParameter value : parameterItems) { if (value.getName().equalsIgnoreCase(paramName)) { value.setValue(entry.getValue()); break; } } } } }
[ "public", "void", "bindParameters", "(", "final", "Map", "<", "Object", ",", "Object", ">", "iArgs", ")", "{", "if", "(", "parameterItems", "==", "null", "||", "iArgs", "==", "null", "||", "iArgs", ".", "size", "(", ")", "==", "0", ")", "return", ";"...
Binds parameters. @param iArgs
[ "Binds", "parameters", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/filter/OSQLPredicate.java#L394-L411
train
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/reporter/PostReporter.java
PostReporter.send
@Override public boolean send(Context context, Report report) { if (url != null) { String reportStr = report.asJSON() .toString(); try { postReport(url, reportStr); return true; } catch (IOException e) { e.printStackTrace(); } } return false; }
java
@Override public boolean send(Context context, Report report) { if (url != null) { String reportStr = report.asJSON() .toString(); try { postReport(url, reportStr); return true; } catch (IOException e) { e.printStackTrace(); } } return false; }
[ "@", "Override", "public", "boolean", "send", "(", "Context", "context", ",", "Report", "report", ")", "{", "if", "(", "url", "!=", "null", ")", "{", "String", "reportStr", "=", "report", ".", "asJSON", "(", ")", ".", "toString", "(", ")", ";", "try"...
If the reporter was configured correctly, post the report to the set URL. @see EnhancedReporter#send(Context, Report)
[ "If", "the", "reporter", "was", "configured", "correctly", "post", "the", "report", "to", "the", "set", "URL", "." ]
82fa81354c01c9b1d1928062b634ba21f14be560
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/reporter/PostReporter.java#L99-L112
train
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/reporter/PostReporter.java
PostReporter.post
public static void post(URL url, String params) throws IOException { URLConnection conn = url.openConnection(); if (conn instanceof HttpURLConnection) { ((HttpURLConnection) conn).setRequestMethod("POST"); conn.setRequestProperty("Content-Type" , "application/json"); } OutputStreamWriter writer = null; try { conn.setDoOutput(true); writer = new OutputStreamWriter(conn.getOutputStream(), Charset.forName("UTF-8")); // write parameters writer.write(params); writer.flush(); } finally { if (writer != null) { writer.close(); } } }
java
public static void post(URL url, String params) throws IOException { URLConnection conn = url.openConnection(); if (conn instanceof HttpURLConnection) { ((HttpURLConnection) conn).setRequestMethod("POST"); conn.setRequestProperty("Content-Type" , "application/json"); } OutputStreamWriter writer = null; try { conn.setDoOutput(true); writer = new OutputStreamWriter(conn.getOutputStream(), Charset.forName("UTF-8")); // write parameters writer.write(params); writer.flush(); } finally { if (writer != null) { writer.close(); } } }
[ "public", "static", "void", "post", "(", "URL", "url", ",", "String", "params", ")", "throws", "IOException", "{", "URLConnection", "conn", "=", "url", ".", "openConnection", "(", ")", ";", "if", "(", "conn", "instanceof", "HttpURLConnection", ")", "{", "(...
Executes the given request as a HTTP POST action. @param url the url @param params the parameter @return the response as a String. @throws IOException if the server cannot be reached
[ "Executes", "the", "given", "request", "as", "a", "HTTP", "POST", "action", "." ]
82fa81354c01c9b1d1928062b634ba21f14be560
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/reporter/PostReporter.java#L125-L144
train
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/reporter/PostReporter.java
PostReporter.read
public static String read(InputStream in) throws IOException { InputStreamReader isReader = new InputStreamReader(in, "UTF-8"); BufferedReader reader = new BufferedReader(isReader); StringBuffer out = new StringBuffer(); char[] c = new char[4096]; for (int n; (n = reader.read(c)) != -1;) { out.append(new String(c, 0, n)); } reader.close(); return out.toString(); }
java
public static String read(InputStream in) throws IOException { InputStreamReader isReader = new InputStreamReader(in, "UTF-8"); BufferedReader reader = new BufferedReader(isReader); StringBuffer out = new StringBuffer(); char[] c = new char[4096]; for (int n; (n = reader.read(c)) != -1;) { out.append(new String(c, 0, n)); } reader.close(); return out.toString(); }
[ "public", "static", "String", "read", "(", "InputStream", "in", ")", "throws", "IOException", "{", "InputStreamReader", "isReader", "=", "new", "InputStreamReader", "(", "in", ",", "\"UTF-8\"", ")", ";", "BufferedReader", "reader", "=", "new", "BufferedReader", ...
Reads an input stream and returns the result as a String. @param in the input stream @return the read String @throws IOException if the stream cannot be read.
[ "Reads", "an", "input", "stream", "and", "returns", "the", "result", "as", "a", "String", "." ]
82fa81354c01c9b1d1928062b634ba21f14be560
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/reporter/PostReporter.java#L172-L183
train
loldevs/riotapi
rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java
GameService.joinGame
public Object joinGame(long id, String password) { return client.sendRpcAndWait(SERVICE, "joinGame", id, password); }
java
public Object joinGame(long id, String password) { return client.sendRpcAndWait(SERVICE, "joinGame", id, password); }
[ "public", "Object", "joinGame", "(", "long", "id", ",", "String", "password", ")", "{", "return", "client", ".", "sendRpcAndWait", "(", "SERVICE", ",", "\"joinGame\"", ",", "id", ",", "password", ")", ";", "}" ]
Join a password-protected game. @param id The id of the game @param password The password of the game @return unknown
[ "Join", "a", "password", "-", "protected", "game", "." ]
0b8aac407aa5289845f249024f9732332855544f
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java#L59-L61
train
loldevs/riotapi
rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java
GameService.observeGame
public Object observeGame(long id, String password) { return client.sendRpcAndWait(SERVICE, "observeGame", id, password); }
java
public Object observeGame(long id, String password) { return client.sendRpcAndWait(SERVICE, "observeGame", id, password); }
[ "public", "Object", "observeGame", "(", "long", "id", ",", "String", "password", ")", "{", "return", "client", ".", "sendRpcAndWait", "(", "SERVICE", ",", "\"observeGame\"", ",", "id", ",", "password", ")", ";", "}" ]
Join a password-protected game as a spectator @param id The game id @param password The password of the game @return unknown
[ "Join", "a", "password", "-", "protected", "game", "as", "a", "spectator" ]
0b8aac407aa5289845f249024f9732332855544f
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java#L78-L80
train
loldevs/riotapi
rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java
GameService.switchToPlayer
public boolean switchToPlayer(long id, PlayerSide team) { return client.sendRpcAndWait(SERVICE, "switchObserverToPlayer", id, team.id); }
java
public boolean switchToPlayer(long id, PlayerSide team) { return client.sendRpcAndWait(SERVICE, "switchObserverToPlayer", id, team.id); }
[ "public", "boolean", "switchToPlayer", "(", "long", "id", ",", "PlayerSide", "team", ")", "{", "return", "client", ".", "sendRpcAndWait", "(", "SERVICE", ",", "\"switchObserverToPlayer\"", ",", "id", ",", "team", ".", "id", ")", ";", "}" ]
Switch from observer to player @param id The id of the game @param team The team to join @return unknown - true if the switch succeeded?
[ "Switch", "from", "observer", "to", "player" ]
0b8aac407aa5289845f249024f9732332855544f
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/GameService.java#L106-L108
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/type/tree/provider/OMVRBTreeMapEntryProvider.java
OMVRBTreeMapEntryProvider.serializeStreamValue
protected byte[] serializeStreamValue(final int iIndex) throws IOException { if (serializedValues[iIndex] <= 0) { // NEW OR MODIFIED: MARSHALL CONTENT OProfiler.getInstance().updateCounter("OMVRBTreeMapEntry.serializeValue", 1); return ((OMVRBTreeMapProvider<K, V>) treeDataProvider).valueSerializer.toStream(values[iIndex]); } // RETURN ORIGINAL CONTENT return stream.getAsByteArray(serializedValues[iIndex]); }
java
protected byte[] serializeStreamValue(final int iIndex) throws IOException { if (serializedValues[iIndex] <= 0) { // NEW OR MODIFIED: MARSHALL CONTENT OProfiler.getInstance().updateCounter("OMVRBTreeMapEntry.serializeValue", 1); return ((OMVRBTreeMapProvider<K, V>) treeDataProvider).valueSerializer.toStream(values[iIndex]); } // RETURN ORIGINAL CONTENT return stream.getAsByteArray(serializedValues[iIndex]); }
[ "protected", "byte", "[", "]", "serializeStreamValue", "(", "final", "int", "iIndex", ")", "throws", "IOException", "{", "if", "(", "serializedValues", "[", "iIndex", "]", "<=", "0", ")", "{", "// NEW OR MODIFIED: MARSHALL CONTENT\r", "OProfiler", ".", "getInstanc...
Serialize only the new values or the changed.
[ "Serialize", "only", "the", "new", "values", "or", "the", "changed", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/type/tree/provider/OMVRBTreeMapEntryProvider.java#L544-L553
train
lightblue-platform/lightblue-migrator
migrator/src/main/java/com/redhat/lightblue/migrator/MigratorController.java
MigratorController.retrieveJobs
public MigrationJob[] retrieveJobs(int batchSize, int startIndex, JobType jobType) throws IOException, LightblueException { LOGGER.debug("Retrieving jobs: batchSize={}, startIndex={}", batchSize, startIndex); DataFindRequest findRequest = new DataFindRequest("migrationJob", null); List<Query> conditions = new ArrayList<>(Arrays.asList(new Query[] { // get jobs for this configuration Query.withValue("configurationName", Query.eq, migrationConfiguration.getConfigurationName()), // get jobs whose state ara available Query.withValue("status", Query.eq, "available"), // only get jobs that are Query.withValue("scheduledDate", Query.lte, new Date()) })); if (jobType == JobType.GENERATED) { LOGGER.debug("Looking for generated job"); conditions.add(Query.withValue("generated", Query.eq, true)); } else if (jobType == JobType.NONGENERATED) { LOGGER.debug("Looking for non generated job"); conditions.add(Query.withValue("generated", Query.eq, false)); } findRequest.where(Query.and(conditions)); findRequest.select(Projection.includeField("*")); findRequest.range(startIndex, startIndex + batchSize - 1); LOGGER.debug("Finding Jobs to execute: {}", findRequest.getBody()); return lbClient.data(findRequest, MigrationJob[].class); }
java
public MigrationJob[] retrieveJobs(int batchSize, int startIndex, JobType jobType) throws IOException, LightblueException { LOGGER.debug("Retrieving jobs: batchSize={}, startIndex={}", batchSize, startIndex); DataFindRequest findRequest = new DataFindRequest("migrationJob", null); List<Query> conditions = new ArrayList<>(Arrays.asList(new Query[] { // get jobs for this configuration Query.withValue("configurationName", Query.eq, migrationConfiguration.getConfigurationName()), // get jobs whose state ara available Query.withValue("status", Query.eq, "available"), // only get jobs that are Query.withValue("scheduledDate", Query.lte, new Date()) })); if (jobType == JobType.GENERATED) { LOGGER.debug("Looking for generated job"); conditions.add(Query.withValue("generated", Query.eq, true)); } else if (jobType == JobType.NONGENERATED) { LOGGER.debug("Looking for non generated job"); conditions.add(Query.withValue("generated", Query.eq, false)); } findRequest.where(Query.and(conditions)); findRequest.select(Projection.includeField("*")); findRequest.range(startIndex, startIndex + batchSize - 1); LOGGER.debug("Finding Jobs to execute: {}", findRequest.getBody()); return lbClient.data(findRequest, MigrationJob[].class); }
[ "public", "MigrationJob", "[", "]", "retrieveJobs", "(", "int", "batchSize", ",", "int", "startIndex", ",", "JobType", "jobType", ")", "throws", "IOException", ",", "LightblueException", "{", "LOGGER", ".", "debug", "(", "\"Retrieving jobs: batchSize={}, startIndex={}...
Retrieves jobs that are available, and their scheduled time has passed. Returns at most batchSize jobs starting at startIndex
[ "Retrieves", "jobs", "that", "are", "available", "and", "their", "scheduled", "time", "has", "passed", ".", "Returns", "at", "most", "batchSize", "jobs", "starting", "at", "startIndex" ]
ec20748557b40d1f7851e1816d1b76dae48d2027
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/migrator/src/main/java/com/redhat/lightblue/migrator/MigratorController.java#L56-L88
train
lightblue-platform/lightblue-migrator
migrator/src/main/java/com/redhat/lightblue/migrator/AbstractController.java
AbstractController.lock
public ActiveExecution lock(String id) throws Exception { LOGGER.debug("locking {}", id); if (!myLocks.contains(id)) { if (locking.acquire(id, null)) { myLocks.add(id); ActiveExecution ae = new ActiveExecution(); ae.setMigrationJobId(id); ae.set_id(id); ae.setStartTime(new Date()); return ae; } } return null; }
java
public ActiveExecution lock(String id) throws Exception { LOGGER.debug("locking {}", id); if (!myLocks.contains(id)) { if (locking.acquire(id, null)) { myLocks.add(id); ActiveExecution ae = new ActiveExecution(); ae.setMigrationJobId(id); ae.set_id(id); ae.setStartTime(new Date()); return ae; } } return null; }
[ "public", "ActiveExecution", "lock", "(", "String", "id", ")", "throws", "Exception", "{", "LOGGER", ".", "debug", "(", "\"locking {}\"", ",", "id", ")", ";", "if", "(", "!", "myLocks", ".", "contains", "(", "id", ")", ")", "{", "if", "(", "locking", ...
Attempts to lock a migration job. If successful, return the migration job and the active execution
[ "Attempts", "to", "lock", "a", "migration", "job", ".", "If", "successful", "return", "the", "migration", "job", "and", "the", "active", "execution" ]
ec20748557b40d1f7851e1816d1b76dae48d2027
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/migrator/src/main/java/com/redhat/lightblue/migrator/AbstractController.java#L81-L95
train
Putnami/putnami-web-toolkit
core/src/main/java/com/google/gwt/event/shared/HandlerManager.java
HandlerManager.getHandler
public <H extends EventHandler> H getHandler(GwtEvent.Type<H> type, int index) { return this.eventBus.superGetHandler(type, index); }
java
public <H extends EventHandler> H getHandler(GwtEvent.Type<H> type, int index) { return this.eventBus.superGetHandler(type, index); }
[ "public", "<", "H", "extends", "EventHandler", ">", "H", "getHandler", "(", "GwtEvent", ".", "Type", "<", "H", ">", "type", ",", "int", "index", ")", "{", "return", "this", ".", "eventBus", ".", "superGetHandler", "(", "type", ",", "index", ")", ";", ...
Gets the handler at the given index. @param <H> the event handler type @param index the index @param type the handler's event type @return the given handler
[ "Gets", "the", "handler", "at", "the", "given", "index", "." ]
129aa781d1bda508e579d194693ca3034b4d470b
https://github.com/Putnami/putnami-web-toolkit/blob/129aa781d1bda508e579d194693ca3034b4d470b/core/src/main/java/com/google/gwt/event/shared/HandlerManager.java#L154-L156
train
Putnami/putnami-web-toolkit
core/src/main/java/com/google/gwt/event/shared/HandlerManager.java
HandlerManager.removeHandler
public <H extends EventHandler> void removeHandler(GwtEvent.Type<H> type, final H handler) { this.eventBus.superDoRemove(type, null, handler); }
java
public <H extends EventHandler> void removeHandler(GwtEvent.Type<H> type, final H handler) { this.eventBus.superDoRemove(type, null, handler); }
[ "public", "<", "H", "extends", "EventHandler", ">", "void", "removeHandler", "(", "GwtEvent", ".", "Type", "<", "H", ">", "type", ",", "final", "H", "handler", ")", "{", "this", ".", "eventBus", ".", "superDoRemove", "(", "type", ",", "null", ",", "han...
Removes the given handler from the specified event type. @param <H> handler type @param type the event type @param handler the handler
[ "Removes", "the", "given", "handler", "from", "the", "specified", "event", "type", "." ]
129aa781d1bda508e579d194693ca3034b4d470b
https://github.com/Putnami/putnami-web-toolkit/blob/129aa781d1bda508e579d194693ca3034b4d470b/core/src/main/java/com/google/gwt/event/shared/HandlerManager.java#L185-L187
train
lightblue-platform/lightblue-migrator
lightblue-migration-monitor/src/main/java/com/redhat/lightblue/migrator/monitor/NagiosNotifier.java
NagiosNotifier.sendFailure
@Override public void sendFailure(String message) { System.out.print("Warning: " + message); System.exit(1); }
java
@Override public void sendFailure(String message) { System.out.print("Warning: " + message); System.exit(1); }
[ "@", "Override", "public", "void", "sendFailure", "(", "String", "message", ")", "{", "System", ".", "out", ".", "print", "(", "\"Warning: \"", "+", "message", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}" ]
logs message with status code 1 - warn
[ "logs", "message", "with", "status", "code", "1", "-", "warn" ]
ec20748557b40d1f7851e1816d1b76dae48d2027
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/lightblue-migration-monitor/src/main/java/com/redhat/lightblue/migrator/monitor/NagiosNotifier.java#L15-L19
train
lightblue-platform/lightblue-migrator
lightblue-migration-monitor/src/main/java/com/redhat/lightblue/migrator/monitor/NagiosNotifier.java
NagiosNotifier.sendError
@Override public void sendError(String message) { System.out.print("Critical: " + message); System.exit(2); }
java
@Override public void sendError(String message) { System.out.print("Critical: " + message); System.exit(2); }
[ "@", "Override", "public", "void", "sendError", "(", "String", "message", ")", "{", "System", ".", "out", ".", "print", "(", "\"Critical: \"", "+", "message", ")", ";", "System", ".", "exit", "(", "2", ")", ";", "}" ]
logs message with status code 2 - critical
[ "logs", "message", "with", "status", "code", "2", "-", "critical" ]
ec20748557b40d1f7851e1816d1b76dae48d2027
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/lightblue-migration-monitor/src/main/java/com/redhat/lightblue/migrator/monitor/NagiosNotifier.java#L30-L34
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClass.java
OCommandExecutorSQLCreateClass.execute
public Object execute(final Map<Object, Object> iArgs) { if (className == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final ODatabaseRecord database = getDatabase(); if (database.getMetadata().getSchema().existsClass(className)) throw new OCommandExecutionException("Class " + className + " already exists"); final OClassImpl sourceClass = (OClassImpl) ((OSchemaProxy) database.getMetadata().getSchema()).createClassInternal(className, superClass, clusterIds); sourceClass.saveInternal(); if (superClass != null) { int[] clustersToIndex = superClass.getPolymorphicClusterIds(); String[] clusterNames = new String[clustersToIndex.length]; for (int i = 0; i < clustersToIndex.length; i++) { clusterNames[i] = database.getClusterNameById(clustersToIndex[i]); } for (OIndex<?> index : superClass.getIndexes()) for (String clusterName : clusterNames) index.getInternal().addCluster(clusterName); } return database.getMetadata().getSchema().getClasses().size(); }
java
public Object execute(final Map<Object, Object> iArgs) { if (className == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final ODatabaseRecord database = getDatabase(); if (database.getMetadata().getSchema().existsClass(className)) throw new OCommandExecutionException("Class " + className + " already exists"); final OClassImpl sourceClass = (OClassImpl) ((OSchemaProxy) database.getMetadata().getSchema()).createClassInternal(className, superClass, clusterIds); sourceClass.saveInternal(); if (superClass != null) { int[] clustersToIndex = superClass.getPolymorphicClusterIds(); String[] clusterNames = new String[clustersToIndex.length]; for (int i = 0; i < clustersToIndex.length; i++) { clusterNames[i] = database.getClusterNameById(clustersToIndex[i]); } for (OIndex<?> index : superClass.getIndexes()) for (String clusterName : clusterNames) index.getInternal().addCluster(clusterName); } return database.getMetadata().getSchema().getClasses().size(); }
[ "public", "Object", "execute", "(", "final", "Map", "<", "Object", ",", "Object", ">", "iArgs", ")", "{", "if", "(", "className", "==", "null", ")", "throw", "new", "OCommandExecutionException", "(", "\"Cannot execute the command because it has not been parsed yet\"",...
Execute the CREATE CLASS.
[ "Execute", "the", "CREATE", "CLASS", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateClass.java#L131-L156
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseRecordAbstract.java
ODatabaseRecordAbstract.callbackHooks
public boolean callbackHooks(final TYPE iType, final OIdentifiable id) { if (!OHookThreadLocal.INSTANCE.push(id)) return false; try { final ORecord<?> rec = id.getRecord(); if (rec == null) return false; boolean recordChanged = false; for (ORecordHook hook : hooks) if (hook.onTrigger(iType, rec)) recordChanged = true; return recordChanged; } finally { OHookThreadLocal.INSTANCE.pop(id); } }
java
public boolean callbackHooks(final TYPE iType, final OIdentifiable id) { if (!OHookThreadLocal.INSTANCE.push(id)) return false; try { final ORecord<?> rec = id.getRecord(); if (rec == null) return false; boolean recordChanged = false; for (ORecordHook hook : hooks) if (hook.onTrigger(iType, rec)) recordChanged = true; return recordChanged; } finally { OHookThreadLocal.INSTANCE.pop(id); } }
[ "public", "boolean", "callbackHooks", "(", "final", "TYPE", "iType", ",", "final", "OIdentifiable", "id", ")", "{", "if", "(", "!", "OHookThreadLocal", ".", "INSTANCE", ".", "push", "(", "id", ")", ")", "return", "false", ";", "try", "{", "final", "OReco...
Callback the registeted hooks if any. @param iType @param id Record received in the callback @return True if the input record is changed, otherwise false
[ "Callback", "the", "registeted", "hooks", "if", "any", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseRecordAbstract.java#L869-L887
train
jpkrohling/secret-store
common/src/main/java/org/keycloak/secretstore/common/AuthServerRequestExecutor.java
AuthServerRequestExecutor.execute
public String execute(String url, String urlParameters, String clientId, String secret, String method) throws Exception { HttpURLConnection connection; String credentials = clientId + ":" + secret; String authorizationHeader = "Basic " + Base64.getEncoder().encodeToString(credentials.getBytes()); if ("POST".equalsIgnoreCase(method)) { connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestMethod(method); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Authorization", authorizationHeader); connection.setDoInput(true); connection.setDoOutput(true); if (null != urlParameters) { try (PrintWriter out = new PrintWriter(connection.getOutputStream())) { out.print(urlParameters); } } } else { connection = (HttpURLConnection) new URL(url + "?" + urlParameters).openConnection(); connection.setRequestMethod(method); connection.setRequestProperty("Authorization", authorizationHeader); } int timeout = Integer.parseInt(System.getProperty("org.hawkular.accounts.http.timeout", "5000")); connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); StringBuilder response = new StringBuilder(); int statusCode; try { statusCode = connection.getResponseCode(); } catch (SocketTimeoutException timeoutException) { throw new UsernamePasswordConversionException("Timed out when trying to contact the Keycloak server."); } InputStream inputStream; if (statusCode < 300) { inputStream = connection.getInputStream(); } else { inputStream = connection.getErrorStream(); } try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"))) { for (String line; (line = reader.readLine()) != null; ) { response.append(line); } } return response.toString(); }
java
public String execute(String url, String urlParameters, String clientId, String secret, String method) throws Exception { HttpURLConnection connection; String credentials = clientId + ":" + secret; String authorizationHeader = "Basic " + Base64.getEncoder().encodeToString(credentials.getBytes()); if ("POST".equalsIgnoreCase(method)) { connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestMethod(method); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Authorization", authorizationHeader); connection.setDoInput(true); connection.setDoOutput(true); if (null != urlParameters) { try (PrintWriter out = new PrintWriter(connection.getOutputStream())) { out.print(urlParameters); } } } else { connection = (HttpURLConnection) new URL(url + "?" + urlParameters).openConnection(); connection.setRequestMethod(method); connection.setRequestProperty("Authorization", authorizationHeader); } int timeout = Integer.parseInt(System.getProperty("org.hawkular.accounts.http.timeout", "5000")); connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); StringBuilder response = new StringBuilder(); int statusCode; try { statusCode = connection.getResponseCode(); } catch (SocketTimeoutException timeoutException) { throw new UsernamePasswordConversionException("Timed out when trying to contact the Keycloak server."); } InputStream inputStream; if (statusCode < 300) { inputStream = connection.getInputStream(); } else { inputStream = connection.getErrorStream(); } try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"))) { for (String line; (line = reader.readLine()) != null; ) { response.append(line); } } return response.toString(); }
[ "public", "String", "execute", "(", "String", "url", ",", "String", "urlParameters", ",", "String", "clientId", ",", "String", "secret", ",", "String", "method", ")", "throws", "Exception", "{", "HttpURLConnection", "connection", ";", "String", "credentials", "=...
Performs an HTTP call to the Keycloak server, returning the server's response as String. @param url the full URL to call, including protocol, host, port and path. @param urlParameters the HTTP Query Parameters properly encoded and without the leading "?". @param clientId the OAuth client ID. @param secret the OAuth client secret. @param method the HTTP method to use (GET or POST). If anything other than POST is sent, GET is used. @return a String with the response from the Keycloak server, in both success and error scenarios @throws Exception if communication problems with the Keycloak server occurs.
[ "Performs", "an", "HTTP", "call", "to", "the", "Keycloak", "server", "returning", "the", "server", "s", "response", "as", "String", "." ]
f136ea6286a6919cc767d0b4a5e84f333c33f483
https://github.com/jpkrohling/secret-store/blob/f136ea6286a6919cc767d0b4a5e84f333c33f483/common/src/main/java/org/keycloak/secretstore/common/AuthServerRequestExecutor.java#L66-L120
train
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java
Report.buildReport
private void buildReport(Context context) { try { buildBaseReport(); buildApplicationData(context); buildDeviceData(context); buildLog(); report.put("application", app); report.put("device", device); report.put("log", logs); } catch (JSONException e) { e.printStackTrace(); } }
java
private void buildReport(Context context) { try { buildBaseReport(); buildApplicationData(context); buildDeviceData(context); buildLog(); report.put("application", app); report.put("device", device); report.put("log", logs); } catch (JSONException e) { e.printStackTrace(); } }
[ "private", "void", "buildReport", "(", "Context", "context", ")", "{", "try", "{", "buildBaseReport", "(", ")", ";", "buildApplicationData", "(", "context", ")", ";", "buildDeviceData", "(", "context", ")", ";", "buildLog", "(", ")", ";", "report", ".", "p...
Creates the report as a JSON Object. @param context @return the json object containing the report.
[ "Creates", "the", "report", "as", "a", "JSON", "Object", "." ]
82fa81354c01c9b1d1928062b634ba21f14be560
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java#L117-L129
train
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java
Report.buildLog
private void buildLog() throws JSONException { logs = new JSONObject(); List<String> list = Log.getReportedEntries(); if (list != null) { logs.put("numberOfEntry", list.size()); JSONArray array = new JSONArray(); for (String s : list) { array.put(s); } logs.put("log", array); } }
java
private void buildLog() throws JSONException { logs = new JSONObject(); List<String> list = Log.getReportedEntries(); if (list != null) { logs.put("numberOfEntry", list.size()); JSONArray array = new JSONArray(); for (String s : list) { array.put(s); } logs.put("log", array); } }
[ "private", "void", "buildLog", "(", ")", "throws", "JSONException", "{", "logs", "=", "new", "JSONObject", "(", ")", ";", "List", "<", "String", ">", "list", "=", "Log", ".", "getReportedEntries", "(", ")", ";", "if", "(", "list", "!=", "null", ")", ...
Adds the log entries to the report. @throws JSONException if the log entries cannot be added
[ "Adds", "the", "log", "entries", "to", "the", "report", "." ]
82fa81354c01c9b1d1928062b634ba21f14be560
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java#L139-L150
train
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java
Report.buildDeviceData
private void buildDeviceData(Context context) throws JSONException { device = new JSONObject(); device.put("device", Build.DEVICE); device.put("brand", Build.BRAND); Object windowService = context.getSystemService(Context.WINDOW_SERVICE); if (windowService instanceof WindowManager) { Display display = ((WindowManager)windowService).getDefaultDisplay(); device.put("resolution", display.getWidth() + "x" + display.getHeight()); device.put("orientation", display.getOrientation()); } device.put("display", Build.DISPLAY); device.put("manufacturer", Build.MANUFACTURER); device.put("model", Build.MODEL); device.put("product", Build.PRODUCT); device.put("build.type", Build.TYPE); device.put("android.version", Build.VERSION.SDK_INT); }
java
private void buildDeviceData(Context context) throws JSONException { device = new JSONObject(); device.put("device", Build.DEVICE); device.put("brand", Build.BRAND); Object windowService = context.getSystemService(Context.WINDOW_SERVICE); if (windowService instanceof WindowManager) { Display display = ((WindowManager)windowService).getDefaultDisplay(); device.put("resolution", display.getWidth() + "x" + display.getHeight()); device.put("orientation", display.getOrientation()); } device.put("display", Build.DISPLAY); device.put("manufacturer", Build.MANUFACTURER); device.put("model", Build.MODEL); device.put("product", Build.PRODUCT); device.put("build.type", Build.TYPE); device.put("android.version", Build.VERSION.SDK_INT); }
[ "private", "void", "buildDeviceData", "(", "Context", "context", ")", "throws", "JSONException", "{", "device", "=", "new", "JSONObject", "(", ")", ";", "device", ".", "put", "(", "\"device\"", ",", "Build", ".", "DEVICE", ")", ";", "device", ".", "put", ...
Adds the device data to the report. @param context @throws JSONException if the device data cannot be added
[ "Adds", "the", "device", "data", "to", "the", "report", "." ]
82fa81354c01c9b1d1928062b634ba21f14be560
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java#L157-L174
train
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java
Report.buildApplicationData
private void buildApplicationData(Context context) throws JSONException { app = new JSONObject(); app.put("package", context.getPackageName()); try { PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); app.put("versionCode", info.versionCode); app.put("versionName", info.versionName); // TODO firstInstallTime and lastUpdate } catch (NameNotFoundException e) { // Cannot happen as we're checking a know package. } }
java
private void buildApplicationData(Context context) throws JSONException { app = new JSONObject(); app.put("package", context.getPackageName()); try { PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); app.put("versionCode", info.versionCode); app.put("versionName", info.versionName); // TODO firstInstallTime and lastUpdate } catch (NameNotFoundException e) { // Cannot happen as we're checking a know package. } }
[ "private", "void", "buildApplicationData", "(", "Context", "context", ")", "throws", "JSONException", "{", "app", "=", "new", "JSONObject", "(", ")", ";", "app", ".", "put", "(", "\"package\"", ",", "context", ".", "getPackageName", "(", ")", ")", ";", "tr...
Adds the application data to the report. @param context @throws JSONException if the application data cannot be added
[ "Adds", "the", "application", "data", "to", "the", "report", "." ]
82fa81354c01c9b1d1928062b634ba21f14be560
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/reporter/Report.java#L181-L192
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java
OGraphDatabase.getEdgesBetweenVertexes
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2) { return getEdgesBetweenVertexes(iVertex1, iVertex2, null, null); }
java
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2) { return getEdgesBetweenVertexes(iVertex1, iVertex2, null, null); }
[ "public", "Set", "<", "ODocument", ">", "getEdgesBetweenVertexes", "(", "final", "ODocument", "iVertex1", ",", "final", "ODocument", "iVertex2", ")", "{", "return", "getEdgesBetweenVertexes", "(", "iVertex1", ",", "iVertex2", ",", "null", ",", "null", ")", ";", ...
Returns all the edges between the vertexes iVertex1 and iVertex2. @param iVertex1 First Vertex @param iVertex2 Second Vertex @return The Set with the common Edges between the two vertexes. If edges aren't found the set is empty
[ "Returns", "all", "the", "edges", "between", "the", "vertexes", "iVertex1", "and", "iVertex2", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L338-L340
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java
OGraphDatabase.getEdgesBetweenVertexes
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2, final String[] iLabels) { return getEdgesBetweenVertexes(iVertex1, iVertex2, iLabels, null); }
java
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2, final String[] iLabels) { return getEdgesBetweenVertexes(iVertex1, iVertex2, iLabels, null); }
[ "public", "Set", "<", "ODocument", ">", "getEdgesBetweenVertexes", "(", "final", "ODocument", "iVertex1", ",", "final", "ODocument", "iVertex2", ",", "final", "String", "[", "]", "iLabels", ")", "{", "return", "getEdgesBetweenVertexes", "(", "iVertex1", ",", "iV...
Returns all the edges between the vertexes iVertex1 and iVertex2 with label between the array of labels passed as iLabels. @param iVertex1 First Vertex @param iVertex2 Second Vertex @param iLabels Array of strings with the labels to get as filter @return The Set with the common Edges between the two vertexes. If edges aren't found the set is empty
[ "Returns", "all", "the", "edges", "between", "the", "vertexes", "iVertex1", "and", "iVertex2", "with", "label", "between", "the", "array", "of", "labels", "passed", "as", "iLabels", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L353-L355
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java
OGraphDatabase.getEdgesBetweenVertexes
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2, final String[] iLabels, final String[] iClassNames) { final Set<ODocument> result = new HashSet<ODocument>(); if (iVertex1 != null && iVertex2 != null) { // CHECK OUT EDGES for (OIdentifiable e : getOutEdges(iVertex1)) { final ODocument edge = (ODocument) e; if (checkEdge(edge, iLabels, iClassNames)) { if (edge.<ODocument> field("in").equals(iVertex2)) result.add(edge); } } // CHECK IN EDGES for (OIdentifiable e : getInEdges(iVertex1)) { final ODocument edge = (ODocument) e; if (checkEdge(edge, iLabels, iClassNames)) { if (edge.<ODocument> field("out").equals(iVertex2)) result.add(edge); } } } return result; }
java
public Set<ODocument> getEdgesBetweenVertexes(final ODocument iVertex1, final ODocument iVertex2, final String[] iLabels, final String[] iClassNames) { final Set<ODocument> result = new HashSet<ODocument>(); if (iVertex1 != null && iVertex2 != null) { // CHECK OUT EDGES for (OIdentifiable e : getOutEdges(iVertex1)) { final ODocument edge = (ODocument) e; if (checkEdge(edge, iLabels, iClassNames)) { if (edge.<ODocument> field("in").equals(iVertex2)) result.add(edge); } } // CHECK IN EDGES for (OIdentifiable e : getInEdges(iVertex1)) { final ODocument edge = (ODocument) e; if (checkEdge(edge, iLabels, iClassNames)) { if (edge.<ODocument> field("out").equals(iVertex2)) result.add(edge); } } } return result; }
[ "public", "Set", "<", "ODocument", ">", "getEdgesBetweenVertexes", "(", "final", "ODocument", "iVertex1", ",", "final", "ODocument", "iVertex2", ",", "final", "String", "[", "]", "iLabels", ",", "final", "String", "[", "]", "iClassNames", ")", "{", "final", ...
Returns all the edges between the vertexes iVertex1 and iVertex2 with label between the array of labels passed as iLabels and with class between the array of class names passed as iClassNames. @param iVertex1 First Vertex @param iVertex2 Second Vertex @param iLabels Array of strings with the labels to get as filter @param iClassNames Array of strings with the name of the classes to get as filter @return The Set with the common Edges between the two vertexes. If edges aren't found the set is empty
[ "Returns", "all", "the", "edges", "between", "the", "vertexes", "iVertex1", "and", "iVertex2", "with", "label", "between", "the", "array", "of", "labels", "passed", "as", "iLabels", "and", "with", "class", "between", "the", "array", "of", "class", "names", "...
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L371-L399
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java
OGraphDatabase.getOutEdgesHavingProperties
public Set<OIdentifiable> getOutEdgesHavingProperties(final OIdentifiable iVertex, Iterable<String> iProperties) { final ODocument vertex = iVertex.getRecord(); checkVertexClass(vertex); return filterEdgesByProperties((OMVRBTreeRIDSet) vertex.field(VERTEX_FIELD_OUT), iProperties); }
java
public Set<OIdentifiable> getOutEdgesHavingProperties(final OIdentifiable iVertex, Iterable<String> iProperties) { final ODocument vertex = iVertex.getRecord(); checkVertexClass(vertex); return filterEdgesByProperties((OMVRBTreeRIDSet) vertex.field(VERTEX_FIELD_OUT), iProperties); }
[ "public", "Set", "<", "OIdentifiable", ">", "getOutEdgesHavingProperties", "(", "final", "OIdentifiable", "iVertex", ",", "Iterable", "<", "String", ">", "iProperties", ")", "{", "final", "ODocument", "vertex", "=", "iVertex", ".", "getRecord", "(", ")", ";", ...
Retrieves the outgoing edges of vertex iVertex having the requested properties iProperties @param iVertex Target vertex @param iProperties Map where keys are property names and values the expected values @return
[ "Retrieves", "the", "outgoing", "edges", "of", "vertex", "iVertex", "having", "the", "requested", "properties", "iProperties" ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L463-L468
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java
OGraphDatabase.getInEdgesHavingProperties
public Set<OIdentifiable> getInEdgesHavingProperties(final OIdentifiable iVertex, Iterable<String> iProperties) { final ODocument vertex = iVertex.getRecord(); checkVertexClass(vertex); return filterEdgesByProperties((OMVRBTreeRIDSet) vertex.field(VERTEX_FIELD_IN), iProperties); }
java
public Set<OIdentifiable> getInEdgesHavingProperties(final OIdentifiable iVertex, Iterable<String> iProperties) { final ODocument vertex = iVertex.getRecord(); checkVertexClass(vertex); return filterEdgesByProperties((OMVRBTreeRIDSet) vertex.field(VERTEX_FIELD_IN), iProperties); }
[ "public", "Set", "<", "OIdentifiable", ">", "getInEdgesHavingProperties", "(", "final", "OIdentifiable", "iVertex", ",", "Iterable", "<", "String", ">", "iProperties", ")", "{", "final", "ODocument", "vertex", "=", "iVertex", ".", "getRecord", "(", ")", ";", "...
Retrieves the incoming edges of vertex iVertex having the requested properties iProperties @param iVertex Target vertex @param iProperties Map where keys are property names and values the expected values @return
[ "Retrieves", "the", "incoming", "edges", "of", "vertex", "iVertex", "having", "the", "requested", "properties", "iProperties" ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L507-L512
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java
OGraphDatabase.getInEdgesHavingProperties
public Set<OIdentifiable> getInEdgesHavingProperties(final ODocument iVertex, final Map<String, Object> iProperties) { checkVertexClass(iVertex); return filterEdgesByProperties((OMVRBTreeRIDSet) iVertex.field(VERTEX_FIELD_IN), iProperties); }
java
public Set<OIdentifiable> getInEdgesHavingProperties(final ODocument iVertex, final Map<String, Object> iProperties) { checkVertexClass(iVertex); return filterEdgesByProperties((OMVRBTreeRIDSet) iVertex.field(VERTEX_FIELD_IN), iProperties); }
[ "public", "Set", "<", "OIdentifiable", ">", "getInEdgesHavingProperties", "(", "final", "ODocument", "iVertex", ",", "final", "Map", "<", "String", ",", "Object", ">", "iProperties", ")", "{", "checkVertexClass", "(", "iVertex", ")", ";", "return", "filterEdgesB...
Retrieves the incoming edges of vertex iVertex having the requested properties iProperties set to the passed values @param iVertex Target vertex @param iProperties Map where keys are property names and values the expected values @return
[ "Retrieves", "the", "incoming", "edges", "of", "vertex", "iVertex", "having", "the", "requested", "properties", "iProperties", "set", "to", "the", "passed", "values" ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/graph/OGraphDatabase.java#L523-L526
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.connect
public synchronized OServerAdmin connect(final String iUserName, final String iUserPassword) throws IOException { storage.createConnectionPool(); storage.setSessionId(-1); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_CONNECT); storage.sendClientInfo(network); try { network.writeString(iUserName); network.writeString(iUserPassword); } finally { storage.endRequest(network); } try { storage.beginResponse(network); sessionId = network.readInt(); storage.setSessionId(sessionId); } finally { storage.endResponse(network); } } catch (Exception e) { OLogManager.instance().error(this, "Cannot connect to the remote server: " + storage.getName(), e, OStorageException.class); storage.close(true); } return this; }
java
public synchronized OServerAdmin connect(final String iUserName, final String iUserPassword) throws IOException { storage.createConnectionPool(); storage.setSessionId(-1); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_CONNECT); storage.sendClientInfo(network); try { network.writeString(iUserName); network.writeString(iUserPassword); } finally { storage.endRequest(network); } try { storage.beginResponse(network); sessionId = network.readInt(); storage.setSessionId(sessionId); } finally { storage.endResponse(network); } } catch (Exception e) { OLogManager.instance().error(this, "Cannot connect to the remote server: " + storage.getName(), e, OStorageException.class); storage.close(true); } return this; }
[ "public", "synchronized", "OServerAdmin", "connect", "(", "final", "String", "iUserName", ",", "final", "String", "iUserPassword", ")", "throws", "IOException", "{", "storage", ".", "createConnectionPool", "(", ")", ";", "storage", ".", "setSessionId", "(", "-", ...
Connects to a remote server. @param iUserName Server's user name @param iUserPassword Server's password for the user name used @return The instance itself. Useful to execute method in chain @throws IOException
[ "Connects", "to", "a", "remote", "server", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L79-L108
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.listDatabases
@SuppressWarnings("unchecked") public synchronized Map<String, String> listDatabases() throws IOException { storage.checkConnection(); final ODocument result = new ODocument(); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_LIST); storage.endRequest(network); try { storage.beginResponse(network); result.fromStream(network.readBytes()); } finally { storage.endResponse(network); } } catch (Exception e) { OLogManager.instance().exception("Cannot retrieve the configuration list", e, OStorageException.class); storage.close(true); } return (Map<String, String>) result.field("databases"); }
java
@SuppressWarnings("unchecked") public synchronized Map<String, String> listDatabases() throws IOException { storage.checkConnection(); final ODocument result = new ODocument(); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_LIST); storage.endRequest(network); try { storage.beginResponse(network); result.fromStream(network.readBytes()); } finally { storage.endResponse(network); } } catch (Exception e) { OLogManager.instance().exception("Cannot retrieve the configuration list", e, OStorageException.class); storage.close(true); } return (Map<String, String>) result.field("databases"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "synchronized", "Map", "<", "String", ",", "String", ">", "listDatabases", "(", ")", "throws", "IOException", "{", "storage", ".", "checkConnection", "(", ")", ";", "final", "ODocument", "result", "...
List the databases on a remote server. @param iUserName Server's user name @param iUserPassword Server's password for the user name used @return The instance itself. Useful to execute method in chain @throws IOException
[ "List", "the", "databases", "on", "a", "remote", "server", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L120-L140
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.createDatabase
public synchronized OServerAdmin createDatabase(final String iDatabaseType, String iStorageMode) throws IOException { storage.checkConnection(); try { if (storage.getName() == null || storage.getName().length() <= 0) { OLogManager.instance().error(this, "Cannot create unnamed remote storage. Check your syntax", OStorageException.class); } else { if (iStorageMode == null) iStorageMode = "csv"; final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_CREATE); try { network.writeString(storage.getName()); if (network.getSrvProtocolVersion() >= 8) network.writeString(iDatabaseType); network.writeString(iStorageMode); } finally { storage.endRequest(network); } storage.getResponse(network); } } catch (Exception e) { OLogManager.instance().error(this, "Cannot create the remote storage: " + storage.getName(), e, OStorageException.class); storage.close(true); } return this; }
java
public synchronized OServerAdmin createDatabase(final String iDatabaseType, String iStorageMode) throws IOException { storage.checkConnection(); try { if (storage.getName() == null || storage.getName().length() <= 0) { OLogManager.instance().error(this, "Cannot create unnamed remote storage. Check your syntax", OStorageException.class); } else { if (iStorageMode == null) iStorageMode = "csv"; final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_CREATE); try { network.writeString(storage.getName()); if (network.getSrvProtocolVersion() >= 8) network.writeString(iDatabaseType); network.writeString(iStorageMode); } finally { storage.endRequest(network); } storage.getResponse(network); } } catch (Exception e) { OLogManager.instance().error(this, "Cannot create the remote storage: " + storage.getName(), e, OStorageException.class); storage.close(true); } return this; }
[ "public", "synchronized", "OServerAdmin", "createDatabase", "(", "final", "String", "iDatabaseType", ",", "String", "iStorageMode", ")", "throws", "IOException", "{", "storage", ".", "checkConnection", "(", ")", ";", "try", "{", "if", "(", "storage", ".", "getNa...
Creates a database in a remote server. @param iDatabaseType 'document' or 'graph' @param iStorageMode local or memory @return The instance itself. Useful to execute method in chain @throws IOException
[ "Creates", "a", "database", "in", "a", "remote", "server", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L164-L193
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.existsDatabase
public synchronized boolean existsDatabase() throws IOException { storage.checkConnection(); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_EXIST); try { network.writeString(storage.getName()); } finally { storage.endRequest(network); } try { storage.beginResponse(network); return network.readByte() == 1; } finally { storage.endResponse(network); } } catch (Exception e) { OLogManager.instance().exception("Error on checking existence of the remote storage: " + storage.getName(), e, OStorageException.class); storage.close(true); } return false; }
java
public synchronized boolean existsDatabase() throws IOException { storage.checkConnection(); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_EXIST); try { network.writeString(storage.getName()); } finally { storage.endRequest(network); } try { storage.beginResponse(network); return network.readByte() == 1; } finally { storage.endResponse(network); } } catch (Exception e) { OLogManager.instance().exception("Error on checking existence of the remote storage: " + storage.getName(), e, OStorageException.class); storage.close(true); } return false; }
[ "public", "synchronized", "boolean", "existsDatabase", "(", ")", "throws", "IOException", "{", "storage", ".", "checkConnection", "(", ")", ";", "try", "{", "final", "OChannelBinaryClient", "network", "=", "storage", ".", "beginRequest", "(", "OChannelBinaryProtocol...
Checks if a database exists in the remote server. @return true if exists, otherwise false @throws IOException
[ "Checks", "if", "a", "database", "exists", "in", "the", "remote", "server", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L201-L225
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.dropDatabase
public synchronized OServerAdmin dropDatabase() throws IOException { storage.checkConnection(); boolean retry = true; while (retry) try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_DROP); try { network.writeString(storage.getName()); } finally { storage.endRequest(network); } storage.getResponse(network); retry = false; } catch (OModificationOperationProhibitedException oope) { retry = handleDBFreeze(); } catch (Exception e) { OLogManager.instance().exception("Cannot delete the remote storage: " + storage.getName(), e, OStorageException.class); } for (OStorage s : Orient.instance().getStorages()) { if (s.getURL().startsWith(getURL())) { s.removeResource(OSchema.class.getSimpleName()); s.removeResource(OIndexManager.class.getSimpleName()); s.removeResource(OSecurity.class.getSimpleName()); } } ODatabaseRecordThreadLocal.INSTANCE.set(null); return this; }
java
public synchronized OServerAdmin dropDatabase() throws IOException { storage.checkConnection(); boolean retry = true; while (retry) try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_DROP); try { network.writeString(storage.getName()); } finally { storage.endRequest(network); } storage.getResponse(network); retry = false; } catch (OModificationOperationProhibitedException oope) { retry = handleDBFreeze(); } catch (Exception e) { OLogManager.instance().exception("Cannot delete the remote storage: " + storage.getName(), e, OStorageException.class); } for (OStorage s : Orient.instance().getStorages()) { if (s.getURL().startsWith(getURL())) { s.removeResource(OSchema.class.getSimpleName()); s.removeResource(OIndexManager.class.getSimpleName()); s.removeResource(OSecurity.class.getSimpleName()); } } ODatabaseRecordThreadLocal.INSTANCE.set(null); return this; }
[ "public", "synchronized", "OServerAdmin", "dropDatabase", "(", ")", "throws", "IOException", "{", "storage", ".", "checkConnection", "(", ")", ";", "boolean", "retry", "=", "true", ";", "while", "(", "retry", ")", "try", "{", "final", "OChannelBinaryClient", "...
Drops a database from a remote server instance. @return The instance itself. Useful to execute method in chain @throws IOException
[ "Drops", "a", "database", "from", "a", "remote", "server", "instance", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L245-L278
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.clusterStatus
public ODocument clusterStatus() { final ODocument response = sendRequest(OChannelBinaryProtocol.REQUEST_CLUSTER, new ODocument().field("operation", "status"), "Cluster status"); OLogManager.instance().debug(this, "Cluster status %s", response.toJSON()); return response; }
java
public ODocument clusterStatus() { final ODocument response = sendRequest(OChannelBinaryProtocol.REQUEST_CLUSTER, new ODocument().field("operation", "status"), "Cluster status"); OLogManager.instance().debug(this, "Cluster status %s", response.toJSON()); return response; }
[ "public", "ODocument", "clusterStatus", "(", ")", "{", "final", "ODocument", "response", "=", "sendRequest", "(", "OChannelBinaryProtocol", ".", "REQUEST_CLUSTER", ",", "new", "ODocument", "(", ")", ".", "field", "(", "\"operation\"", ",", "\"status\"", ")", ","...
Gets the cluster status. @return the JSON containing the current cluster structure
[ "Gets", "the", "cluster", "status", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L338-L344
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.replicationStop
public synchronized OServerAdmin replicationStop(final String iDatabaseName, final String iRemoteServer) throws IOException { sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "stop").field("node", iRemoteServer) .field("db", iDatabaseName), "Stop replication"); OLogManager.instance().debug(this, "Stopped replication of database '%s' from server '%s' to '%s'", iDatabaseName, storage.getURL(), iRemoteServer); return this; }
java
public synchronized OServerAdmin replicationStop(final String iDatabaseName, final String iRemoteServer) throws IOException { sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "stop").field("node", iRemoteServer) .field("db", iDatabaseName), "Stop replication"); OLogManager.instance().debug(this, "Stopped replication of database '%s' from server '%s' to '%s'", iDatabaseName, storage.getURL(), iRemoteServer); return this; }
[ "public", "synchronized", "OServerAdmin", "replicationStop", "(", "final", "String", "iDatabaseName", ",", "final", "String", "iRemoteServer", ")", "throws", "IOException", "{", "sendRequest", "(", "OChannelBinaryProtocol", ".", "REQUEST_REPLICATION", ",", "new", "ODocu...
Stops the replication between two servers. @param iDatabaseName database name to replicate @param iRemoteServer remote server alias as IP+address @return The instance itself. Useful to execute method in chain @throws IOException
[ "Stops", "the", "replication", "between", "two", "servers", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L377-L384
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.getReplicationJournal
public synchronized ODocument getReplicationJournal(final String iDatabaseName, final String iRemoteServer) throws IOException { OLogManager.instance().debug(this, "Retrieving the replication log for database '%s' from server '%s'...", iDatabaseName, storage.getURL()); final ODocument response = sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "getJournal").field("node", iRemoteServer).field("db", iDatabaseName), "Retrieve replication log"); OLogManager.instance().debug(this, "Returned %d replication log entries for the database '%s' from server '%s' against server '%s'", response.fields(), iDatabaseName, storage.getURL(), iRemoteServer); return response; }
java
public synchronized ODocument getReplicationJournal(final String iDatabaseName, final String iRemoteServer) throws IOException { OLogManager.instance().debug(this, "Retrieving the replication log for database '%s' from server '%s'...", iDatabaseName, storage.getURL()); final ODocument response = sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "getJournal").field("node", iRemoteServer).field("db", iDatabaseName), "Retrieve replication log"); OLogManager.instance().debug(this, "Returned %d replication log entries for the database '%s' from server '%s' against server '%s'", response.fields(), iDatabaseName, storage.getURL(), iRemoteServer); return response; }
[ "public", "synchronized", "ODocument", "getReplicationJournal", "(", "final", "String", "iDatabaseName", ",", "final", "String", "iRemoteServer", ")", "throws", "IOException", "{", "OLogManager", ".", "instance", "(", ")", ".", "debug", "(", "this", ",", "\"Retrie...
Gets the replication journal for a database. @param iDatabaseName database name to replicate @param iRemoteName @return The journal composed as a JSON with key the serial number of the entry and as key the operation type id and the RID involved. Example {"10022":"1#10:3"} @throws IOException
[ "Gets", "the", "replication", "journal", "for", "a", "database", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L396-L409
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.replicationAlign
public OServerAdmin replicationAlign(final String iDatabaseName, final String iRemoteServer, final String iOptions) { OLogManager.instance().debug(this, "Started the alignment of database '%s' from server '%s' to '%s' with options %s", iDatabaseName, storage.getURL(), iRemoteServer, iOptions); sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "align") .field("node", iRemoteServer).field("db", iDatabaseName).field("options", iOptions), "Align databases"); OLogManager.instance().debug(this, "Alignment finished"); return this; }
java
public OServerAdmin replicationAlign(final String iDatabaseName, final String iRemoteServer, final String iOptions) { OLogManager.instance().debug(this, "Started the alignment of database '%s' from server '%s' to '%s' with options %s", iDatabaseName, storage.getURL(), iRemoteServer, iOptions); sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "align") .field("node", iRemoteServer).field("db", iDatabaseName).field("options", iOptions), "Align databases"); OLogManager.instance().debug(this, "Alignment finished"); return this; }
[ "public", "OServerAdmin", "replicationAlign", "(", "final", "String", "iDatabaseName", ",", "final", "String", "iRemoteServer", ",", "final", "String", "iOptions", ")", "{", "OLogManager", ".", "instance", "(", ")", ".", "debug", "(", "this", ",", "\"Started the...
Aligns a database between two servers @param iDatabaseName database name to align @param iRemoteServer remote server alias as IP+address @param iOptions options @return @return The instance itself. Useful to execute method in chain @throws IOException
[ "Aligns", "a", "database", "between", "two", "servers" ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L471-L481
train
wuman/orientdb-android
client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java
OServerAdmin.copyDatabase
public synchronized OServerAdmin copyDatabase(final String iDatabaseName, final String iDatabaseUserName, final String iDatabaseUserPassword, final String iRemoteName, final String iRemoteEngine) throws IOException { storage.checkConnection(); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_COPY); try { network.writeString(iDatabaseName); network.writeString(iDatabaseUserName); network.writeString(iDatabaseUserPassword); network.writeString(iRemoteName); network.writeString(iRemoteEngine); } finally { storage.endRequest(network); } storage.getResponse(network); OLogManager.instance().debug(this, "Database '%s' has been copied to the server '%s'", iDatabaseName, iRemoteName); } catch (Exception e) { OLogManager.instance().exception("Cannot copy the database: " + iDatabaseName, e, OStorageException.class); } return this; }
java
public synchronized OServerAdmin copyDatabase(final String iDatabaseName, final String iDatabaseUserName, final String iDatabaseUserPassword, final String iRemoteName, final String iRemoteEngine) throws IOException { storage.checkConnection(); try { final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_COPY); try { network.writeString(iDatabaseName); network.writeString(iDatabaseUserName); network.writeString(iDatabaseUserPassword); network.writeString(iRemoteName); network.writeString(iRemoteEngine); } finally { storage.endRequest(network); } storage.getResponse(network); OLogManager.instance().debug(this, "Database '%s' has been copied to the server '%s'", iDatabaseName, iRemoteName); } catch (Exception e) { OLogManager.instance().exception("Cannot copy the database: " + iDatabaseName, e, OStorageException.class); } return this; }
[ "public", "synchronized", "OServerAdmin", "copyDatabase", "(", "final", "String", "iDatabaseName", ",", "final", "String", "iDatabaseUserName", ",", "final", "String", "iDatabaseUserPassword", ",", "final", "String", "iRemoteName", ",", "final", "String", "iRemoteEngine...
Copies a database to a remote server instance. @param iDatabaseName @param iDatabaseUserName @param iDatabaseUserPassword @param iRemoteName @param iRemoteEngine @return The instance itself. Useful to execute method in chain @throws IOException
[ "Copies", "a", "database", "to", "a", "remote", "server", "instance", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L494-L520
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionRuntime.java
OSQLFunctionRuntime.execute
public Object execute(final OIdentifiable o, final OCommandExecutor iRequester) { // RESOLVE VALUES USING THE CURRENT RECORD for (int i = 0; i < configuredParameters.length; ++i) { if (configuredParameters[i] instanceof OSQLFilterItemField) runtimeParameters[i] = ((OSQLFilterItemField) configuredParameters[i]).getValue(o, null); else if (configuredParameters[i] instanceof OSQLFunctionRuntime) runtimeParameters[i] = ((OSQLFunctionRuntime) configuredParameters[i]).execute(o, iRequester); } final Object functionResult = function.execute(o, runtimeParameters, iRequester); return transformValue(o, functionResult); }
java
public Object execute(final OIdentifiable o, final OCommandExecutor iRequester) { // RESOLVE VALUES USING THE CURRENT RECORD for (int i = 0; i < configuredParameters.length; ++i) { if (configuredParameters[i] instanceof OSQLFilterItemField) runtimeParameters[i] = ((OSQLFilterItemField) configuredParameters[i]).getValue(o, null); else if (configuredParameters[i] instanceof OSQLFunctionRuntime) runtimeParameters[i] = ((OSQLFunctionRuntime) configuredParameters[i]).execute(o, iRequester); } final Object functionResult = function.execute(o, runtimeParameters, iRequester); return transformValue(o, functionResult); }
[ "public", "Object", "execute", "(", "final", "OIdentifiable", "o", ",", "final", "OCommandExecutor", "iRequester", ")", "{", "// RESOLVE VALUES USING THE CURRENT RECORD\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "configuredParameters", ".", "length", ";"...
Execute a function. @param o Current record @param iRequester @return
[ "Execute", "a", "function", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/functions/OSQLFunctionRuntime.java#L64-L76
train
NetsOSS/embedded-jetty
src/main/java/eu/nets/oss/jetty/EmbeddedWicketBuilder.java
EmbeddedWicketBuilder.addWicketHandler
public static EmbeddedJettyBuilder.ServletContextHandlerBuilder addWicketHandler(EmbeddedJettyBuilder embeddedJettyBuilder, String contextPath, EventListener springContextloader, Class<? extends WebApplication> wicketApplication, boolean development){ EmbeddedJettyBuilder.ServletContextHandlerBuilder wicketHandler = embeddedJettyBuilder.createRootServletContextHandler(contextPath) .setClassLoader(Thread.currentThread().getContextClassLoader()) .addEventListener(springContextloader); return addWicketHandler(wicketHandler, wicketApplication, development); }
java
public static EmbeddedJettyBuilder.ServletContextHandlerBuilder addWicketHandler(EmbeddedJettyBuilder embeddedJettyBuilder, String contextPath, EventListener springContextloader, Class<? extends WebApplication> wicketApplication, boolean development){ EmbeddedJettyBuilder.ServletContextHandlerBuilder wicketHandler = embeddedJettyBuilder.createRootServletContextHandler(contextPath) .setClassLoader(Thread.currentThread().getContextClassLoader()) .addEventListener(springContextloader); return addWicketHandler(wicketHandler, wicketApplication, development); }
[ "public", "static", "EmbeddedJettyBuilder", ".", "ServletContextHandlerBuilder", "addWicketHandler", "(", "EmbeddedJettyBuilder", "embeddedJettyBuilder", ",", "String", "contextPath", ",", "EventListener", "springContextloader", ",", "Class", "<", "?", "extends", "WebApplicat...
Adds wicket handler at root context.
[ "Adds", "wicket", "handler", "at", "root", "context", "." ]
c2535867ad4887c4a43a8aa7f95b711ff54c8542
https://github.com/NetsOSS/embedded-jetty/blob/c2535867ad4887c4a43a8aa7f95b711ff54c8542/src/main/java/eu/nets/oss/jetty/EmbeddedWicketBuilder.java#L36-L45
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazySet.java
ORecordLazySet.add
public boolean add(final OIdentifiable e) { if (e.getIdentity().isNew()) { final ORecord<?> record = e.getRecord(); // ADD IN TEMP LIST if (newItems == null) newItems = new IdentityHashMap<ORecord<?>, Object>(); else if (newItems.containsKey(record)) return false; newItems.put(record, NEWMAP_VALUE); setDirty(); return true; } else if (OGlobalConfiguration.LAZYSET_WORK_ON_STREAM.getValueAsBoolean() && getStreamedContent() != null) { // FAST INSERT final String ridString = e.getIdentity().toString(); final StringBuilder buffer = getStreamedContent(); if (buffer.indexOf(ridString) < 0) { if (buffer.length() > 0) buffer.append(','); e.getIdentity().toString(buffer); setDirty(); return true; } return false; } else { final int pos = indexOf(e); if (pos < 0) { // FOUND delegate.add(pos * -1 - 1, e); return true; } return false; } }
java
public boolean add(final OIdentifiable e) { if (e.getIdentity().isNew()) { final ORecord<?> record = e.getRecord(); // ADD IN TEMP LIST if (newItems == null) newItems = new IdentityHashMap<ORecord<?>, Object>(); else if (newItems.containsKey(record)) return false; newItems.put(record, NEWMAP_VALUE); setDirty(); return true; } else if (OGlobalConfiguration.LAZYSET_WORK_ON_STREAM.getValueAsBoolean() && getStreamedContent() != null) { // FAST INSERT final String ridString = e.getIdentity().toString(); final StringBuilder buffer = getStreamedContent(); if (buffer.indexOf(ridString) < 0) { if (buffer.length() > 0) buffer.append(','); e.getIdentity().toString(buffer); setDirty(); return true; } return false; } else { final int pos = indexOf(e); if (pos < 0) { // FOUND delegate.add(pos * -1 - 1, e); return true; } return false; } }
[ "public", "boolean", "add", "(", "final", "OIdentifiable", "e", ")", "{", "if", "(", "e", ".", "getIdentity", "(", ")", ".", "isNew", "(", ")", ")", "{", "final", "ORecord", "<", "?", ">", "record", "=", "e", ".", "getRecord", "(", ")", ";", "// ...
Adds the item in the underlying List preserving the order of the collection.
[ "Adds", "the", "item", "in", "the", "underlying", "List", "preserving", "the", "order", "of", "the", "collection", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazySet.java#L189-L223
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazySet.java
ORecordLazySet.indexOf
public int indexOf(final OIdentifiable iElement) { if (delegate.isEmpty()) return -1; final boolean prevConvert = delegate.isAutoConvertToRecord(); if (prevConvert) delegate.setAutoConvertToRecord(false); final int pos = Collections.binarySearch(delegate, iElement); if (prevConvert) // RESET PREVIOUS SETTINGS delegate.setAutoConvertToRecord(true); return pos; }
java
public int indexOf(final OIdentifiable iElement) { if (delegate.isEmpty()) return -1; final boolean prevConvert = delegate.isAutoConvertToRecord(); if (prevConvert) delegate.setAutoConvertToRecord(false); final int pos = Collections.binarySearch(delegate, iElement); if (prevConvert) // RESET PREVIOUS SETTINGS delegate.setAutoConvertToRecord(true); return pos; }
[ "public", "int", "indexOf", "(", "final", "OIdentifiable", "iElement", ")", "{", "if", "(", "delegate", ".", "isEmpty", "(", ")", ")", "return", "-", "1", ";", "final", "boolean", "prevConvert", "=", "delegate", ".", "isAutoConvertToRecord", "(", ")", ";",...
Returns the position of the element in the set. Execute a binary search since the elements are always ordered. @param iElement element to find @return The position of the element if found, otherwise false
[ "Returns", "the", "position", "of", "the", "element", "in", "the", "set", ".", "Execute", "a", "binary", "search", "since", "the", "elements", "are", "always", "ordered", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/record/ORecordLazySet.java#L232-L247
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperator.java
OQueryOperator.compare
public ORDER compare(OQueryOperator other) { final Class<?> thisClass = this.getClass(); final Class<?> otherClass = other.getClass(); int thisPosition = -1; int otherPosition = -1; for (int i = 0; i < DEFAULT_OPERATORS_ORDER.length; i++) { // subclass of default operators inherit their parent ordering final Class<?> clazz = DEFAULT_OPERATORS_ORDER[i]; if (clazz.isAssignableFrom(thisClass)) { thisPosition = i; } if (clazz.isAssignableFrom(otherClass)) { otherPosition = i; } } if (thisPosition == -1 || otherPosition == -1) { // can not decide which comes first return ORDER.UNKNOWNED; } if (thisPosition > otherPosition) { return ORDER.AFTER; } else if (thisPosition < otherPosition) { return ORDER.BEFORE; } return ORDER.EQUAL; }
java
public ORDER compare(OQueryOperator other) { final Class<?> thisClass = this.getClass(); final Class<?> otherClass = other.getClass(); int thisPosition = -1; int otherPosition = -1; for (int i = 0; i < DEFAULT_OPERATORS_ORDER.length; i++) { // subclass of default operators inherit their parent ordering final Class<?> clazz = DEFAULT_OPERATORS_ORDER[i]; if (clazz.isAssignableFrom(thisClass)) { thisPosition = i; } if (clazz.isAssignableFrom(otherClass)) { otherPosition = i; } } if (thisPosition == -1 || otherPosition == -1) { // can not decide which comes first return ORDER.UNKNOWNED; } if (thisPosition > otherPosition) { return ORDER.AFTER; } else if (thisPosition < otherPosition) { return ORDER.BEFORE; } return ORDER.EQUAL; }
[ "public", "ORDER", "compare", "(", "OQueryOperator", "other", ")", "{", "final", "Class", "<", "?", ">", "thisClass", "=", "this", ".", "getClass", "(", ")", ";", "final", "Class", "<", "?", ">", "otherClass", "=", "other", ".", "getClass", "(", ")", ...
Check priority of this operator compare to given operator. @param other @return ORDER place of this operator compared to given operator
[ "Check", "priority", "of", "this", "operator", "compare", "to", "given", "operator", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryOperator.java#L165-L194
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterDatabase.java
OCommandExecutorSQLAlterDatabase.execute
public Object execute(final Map<Object, Object> iArgs) { if (attribute == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final ODatabaseRecord database = getDatabase(); database.checkSecurity(ODatabaseSecurityResources.DATABASE, ORole.PERMISSION_UPDATE); ((ODatabaseComplex<?>) database).setInternal(attribute, value); return null; }
java
public Object execute(final Map<Object, Object> iArgs) { if (attribute == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final ODatabaseRecord database = getDatabase(); database.checkSecurity(ODatabaseSecurityResources.DATABASE, ORole.PERMISSION_UPDATE); ((ODatabaseComplex<?>) database).setInternal(attribute, value); return null; }
[ "public", "Object", "execute", "(", "final", "Map", "<", "Object", ",", "Object", ">", "iArgs", ")", "{", "if", "(", "attribute", "==", "null", ")", "throw", "new", "OCommandExecutionException", "(", "\"Cannot execute the command because it has not been parsed yet\"",...
Execute the ALTER DATABASE.
[ "Execute", "the", "ALTER", "DATABASE", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterDatabase.java#L94-L103
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java
OTxSegment.open
@Override public boolean open() throws IOException { lock.acquireExclusiveLock(); try { // IGNORE IF IT'S SOFTLY CLOSED super.open(); // CHECK FOR PENDING TRANSACTION ENTRIES TO RECOVER recoverTransactions(); return true; } finally { lock.releaseExclusiveLock(); } }
java
@Override public boolean open() throws IOException { lock.acquireExclusiveLock(); try { // IGNORE IF IT'S SOFTLY CLOSED super.open(); // CHECK FOR PENDING TRANSACTION ENTRIES TO RECOVER recoverTransactions(); return true; } finally { lock.releaseExclusiveLock(); } }
[ "@", "Override", "public", "boolean", "open", "(", ")", "throws", "IOException", "{", "lock", ".", "acquireExclusiveLock", "(", ")", ";", "try", "{", "// IGNORE IF IT'S SOFTLY CLOSED\r", "super", ".", "open", "(", ")", ";", "// CHECK FOR PENDING TRANSACTION ENTRIES ...
Opens the file segment and recovers pending transactions if any
[ "Opens", "the", "file", "segment", "and", "recovers", "pending", "transactions", "if", "any" ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java#L77-L93
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java
OTxSegment.addLog
public void addLog(final byte iOperation, final int iTxId, final int iClusterId, final long iClusterOffset, final byte iRecordType, final int iRecordVersion, final byte[] iRecordContent, int dataSegmentId) throws IOException { final int contentSize = iRecordContent != null ? iRecordContent.length : 0; final int size = OFFSET_RECORD_CONTENT + contentSize; lock.acquireExclusiveLock(); try { int offset = file.allocateSpace(size); file.writeByte(offset, STATUS_COMMITTING); offset += OBinaryProtocol.SIZE_BYTE; file.writeByte(offset, iOperation); offset += OBinaryProtocol.SIZE_BYTE; file.writeInt(offset, iTxId); offset += OBinaryProtocol.SIZE_INT; file.writeShort(offset, (short) iClusterId); offset += OBinaryProtocol.SIZE_SHORT; file.writeLong(offset, iClusterOffset); offset += OBinaryProtocol.SIZE_LONG; file.writeByte(offset, iRecordType); offset += OBinaryProtocol.SIZE_BYTE; file.writeInt(offset, iRecordVersion); offset += OBinaryProtocol.SIZE_INT; file.writeInt(offset, dataSegmentId); offset += OBinaryProtocol.SIZE_INT; file.writeInt(offset, contentSize); offset += OBinaryProtocol.SIZE_INT; file.write(offset, iRecordContent); offset += contentSize; if (synchEnabled) file.synch(); } finally { lock.releaseExclusiveLock(); } }
java
public void addLog(final byte iOperation, final int iTxId, final int iClusterId, final long iClusterOffset, final byte iRecordType, final int iRecordVersion, final byte[] iRecordContent, int dataSegmentId) throws IOException { final int contentSize = iRecordContent != null ? iRecordContent.length : 0; final int size = OFFSET_RECORD_CONTENT + contentSize; lock.acquireExclusiveLock(); try { int offset = file.allocateSpace(size); file.writeByte(offset, STATUS_COMMITTING); offset += OBinaryProtocol.SIZE_BYTE; file.writeByte(offset, iOperation); offset += OBinaryProtocol.SIZE_BYTE; file.writeInt(offset, iTxId); offset += OBinaryProtocol.SIZE_INT; file.writeShort(offset, (short) iClusterId); offset += OBinaryProtocol.SIZE_SHORT; file.writeLong(offset, iClusterOffset); offset += OBinaryProtocol.SIZE_LONG; file.writeByte(offset, iRecordType); offset += OBinaryProtocol.SIZE_BYTE; file.writeInt(offset, iRecordVersion); offset += OBinaryProtocol.SIZE_INT; file.writeInt(offset, dataSegmentId); offset += OBinaryProtocol.SIZE_INT; file.writeInt(offset, contentSize); offset += OBinaryProtocol.SIZE_INT; file.write(offset, iRecordContent); offset += contentSize; if (synchEnabled) file.synch(); } finally { lock.releaseExclusiveLock(); } }
[ "public", "void", "addLog", "(", "final", "byte", "iOperation", ",", "final", "int", "iTxId", ",", "final", "int", "iClusterId", ",", "final", "long", "iClusterOffset", ",", "final", "byte", "iRecordType", ",", "final", "int", "iRecordVersion", ",", "final", ...
Appends a log entry
[ "Appends", "a", "log", "entry" ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java#L110-L157
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java
OTxSegment.scanForTransactionsToRecover
private Set<Integer> scanForTransactionsToRecover() throws IOException { // SCAN ALL THE FILE SEARCHING FOR THE TRANSACTIONS TO RECOVER final Set<Integer> txToRecover = new HashSet<Integer>(); final Set<Integer> txToNotRecover = new HashSet<Integer>(); // BROWSE ALL THE ENTRIES for (long offset = 0; eof(offset); offset = nextEntry(offset)) { // READ STATUS final byte status = file.readByte(offset); // READ TX-ID final int txId = file.readInt(offset + OFFSET_TX_ID); switch (status) { case STATUS_FREE: // NOT RECOVER IT SINCE IF FIND AT LEAST ONE "FREE" STATUS MEANS THAT ALL THE LOGS WAS COMMITTED BUT THE USER DIDN'T // RECEIVED THE ACK txToNotRecover.add(txId); break; case STATUS_COMMITTING: // TO RECOVER UNLESS THE REQ/TX IS IN THE MAP txToNotRecover txToRecover.add(txId); break; } } if (txToNotRecover.size() > 0) // FILTER THE TX MAP TO RECOVER BY REMOVING THE TX WITH AT LEAST ONE "FREE" STATUS txToRecover.removeAll(txToNotRecover); return txToRecover; }
java
private Set<Integer> scanForTransactionsToRecover() throws IOException { // SCAN ALL THE FILE SEARCHING FOR THE TRANSACTIONS TO RECOVER final Set<Integer> txToRecover = new HashSet<Integer>(); final Set<Integer> txToNotRecover = new HashSet<Integer>(); // BROWSE ALL THE ENTRIES for (long offset = 0; eof(offset); offset = nextEntry(offset)) { // READ STATUS final byte status = file.readByte(offset); // READ TX-ID final int txId = file.readInt(offset + OFFSET_TX_ID); switch (status) { case STATUS_FREE: // NOT RECOVER IT SINCE IF FIND AT LEAST ONE "FREE" STATUS MEANS THAT ALL THE LOGS WAS COMMITTED BUT THE USER DIDN'T // RECEIVED THE ACK txToNotRecover.add(txId); break; case STATUS_COMMITTING: // TO RECOVER UNLESS THE REQ/TX IS IN THE MAP txToNotRecover txToRecover.add(txId); break; } } if (txToNotRecover.size() > 0) // FILTER THE TX MAP TO RECOVER BY REMOVING THE TX WITH AT LEAST ONE "FREE" STATUS txToRecover.removeAll(txToNotRecover); return txToRecover; }
[ "private", "Set", "<", "Integer", ">", "scanForTransactionsToRecover", "(", ")", "throws", "IOException", "{", "// SCAN ALL THE FILE SEARCHING FOR THE TRANSACTIONS TO RECOVER\r", "final", "Set", "<", "Integer", ">", "txToRecover", "=", "new", "HashSet", "<", "Integer", ...
Scans the segment and returns the set of transactions ids to recover.
[ "Scans", "the", "segment", "and", "returns", "the", "set", "of", "transactions", "ids", "to", "recover", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java#L223-L256
train
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java
OTxSegment.recoverTransaction
private int recoverTransaction(final int iTxId) throws IOException { int recordsRecovered = 0; final ORecordId rid = new ORecordId(); final List<Long> txRecordPositions = new ArrayList<Long>(); // BROWSE ALL THE ENTRIES for (long beginEntry = 0; eof(beginEntry); beginEntry = nextEntry(beginEntry)) { long offset = beginEntry; final byte status = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; if (status != STATUS_FREE) { // DIRTY TX LOG ENTRY offset += OBinaryProtocol.SIZE_BYTE; final int txId = file.readInt(offset); if (txId == iTxId) { txRecordPositions.add(beginEntry); } } } for (int i = txRecordPositions.size() - 1; i >= 0; i--) { final long beginEntry = txRecordPositions.get(i); long offset = beginEntry; final byte status = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; // DIRTY TX LOG ENTRY final byte operation = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; // TX ID FOUND final int txId = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; rid.clusterId = file.readShort(offset); offset += OBinaryProtocol.SIZE_SHORT; rid.clusterPosition = file.readLong(offset); offset += OBinaryProtocol.SIZE_LONG; final byte recordType = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; final int recordVersion = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; final int dataSegmentId = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; final int recordSize = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; final byte[] buffer; if (recordSize > 0) { buffer = new byte[recordSize]; file.read(offset, buffer, recordSize); offset += recordSize; } else buffer = null; recoverTransactionEntry(status, operation, txId, rid, recordType, recordVersion, buffer, dataSegmentId); recordsRecovered++; // CLEAR THE ENTRY BY WRITING '0' file.writeByte(beginEntry, STATUS_FREE); } return recordsRecovered; }
java
private int recoverTransaction(final int iTxId) throws IOException { int recordsRecovered = 0; final ORecordId rid = new ORecordId(); final List<Long> txRecordPositions = new ArrayList<Long>(); // BROWSE ALL THE ENTRIES for (long beginEntry = 0; eof(beginEntry); beginEntry = nextEntry(beginEntry)) { long offset = beginEntry; final byte status = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; if (status != STATUS_FREE) { // DIRTY TX LOG ENTRY offset += OBinaryProtocol.SIZE_BYTE; final int txId = file.readInt(offset); if (txId == iTxId) { txRecordPositions.add(beginEntry); } } } for (int i = txRecordPositions.size() - 1; i >= 0; i--) { final long beginEntry = txRecordPositions.get(i); long offset = beginEntry; final byte status = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; // DIRTY TX LOG ENTRY final byte operation = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; // TX ID FOUND final int txId = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; rid.clusterId = file.readShort(offset); offset += OBinaryProtocol.SIZE_SHORT; rid.clusterPosition = file.readLong(offset); offset += OBinaryProtocol.SIZE_LONG; final byte recordType = file.readByte(offset); offset += OBinaryProtocol.SIZE_BYTE; final int recordVersion = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; final int dataSegmentId = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; final int recordSize = file.readInt(offset); offset += OBinaryProtocol.SIZE_INT; final byte[] buffer; if (recordSize > 0) { buffer = new byte[recordSize]; file.read(offset, buffer, recordSize); offset += recordSize; } else buffer = null; recoverTransactionEntry(status, operation, txId, rid, recordType, recordVersion, buffer, dataSegmentId); recordsRecovered++; // CLEAR THE ENTRY BY WRITING '0' file.writeByte(beginEntry, STATUS_FREE); } return recordsRecovered; }
[ "private", "int", "recoverTransaction", "(", "final", "int", "iTxId", ")", "throws", "IOException", "{", "int", "recordsRecovered", "=", "0", ";", "final", "ORecordId", "rid", "=", "new", "ORecordId", "(", ")", ";", "final", "List", "<", "Long", ">", "txRe...
Recover a transaction. @param iTxId @return Number of records recovered @throws IOException
[ "Recover", "a", "transaction", "." ]
ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OTxSegment.java#L266-L339
train
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java
MonitorEndpointHelper.pingJdbcEndpoint
public static String pingJdbcEndpoint(MuleContext muleContext, String muleJdbcDataSourceName, String tableName) { DataSource ds = JdbcUtil.lookupDataSource(muleContext, muleJdbcDataSourceName); Connection c = null; Statement s = null; ResultSet rs = null; try { c = ds.getConnection(); s = c.createStatement(); rs = s.executeQuery("select 1 from " + tableName); } catch (SQLException e) { return ERROR_PREFIX + ": The table " + tableName + " was not found in the data source " + muleJdbcDataSourceName + ", reason: " + e.getMessage(); } finally { try {if (rs != null) rs.close();} catch (SQLException e) {} try {if ( s != null) s.close();} catch (SQLException e) {} try {if ( c != null) c.close();} catch (SQLException e) {} } return OK_PREFIX + ": The table " + tableName + " was found in the data source " + muleJdbcDataSourceName; }
java
public static String pingJdbcEndpoint(MuleContext muleContext, String muleJdbcDataSourceName, String tableName) { DataSource ds = JdbcUtil.lookupDataSource(muleContext, muleJdbcDataSourceName); Connection c = null; Statement s = null; ResultSet rs = null; try { c = ds.getConnection(); s = c.createStatement(); rs = s.executeQuery("select 1 from " + tableName); } catch (SQLException e) { return ERROR_PREFIX + ": The table " + tableName + " was not found in the data source " + muleJdbcDataSourceName + ", reason: " + e.getMessage(); } finally { try {if (rs != null) rs.close();} catch (SQLException e) {} try {if ( s != null) s.close();} catch (SQLException e) {} try {if ( c != null) c.close();} catch (SQLException e) {} } return OK_PREFIX + ": The table " + tableName + " was found in the data source " + muleJdbcDataSourceName; }
[ "public", "static", "String", "pingJdbcEndpoint", "(", "MuleContext", "muleContext", ",", "String", "muleJdbcDataSourceName", ",", "String", "tableName", ")", "{", "DataSource", "ds", "=", "JdbcUtil", ".", "lookupDataSource", "(", "muleContext", ",", "muleJdbcDataSour...
Verify access to a JDBC endpoint by verifying that a specified table is accessible. @param muleContext @param muleJdbcDataSourceName @param tableName
[ "Verify", "access", "to", "a", "JDBC", "endpoint", "by", "verifying", "that", "a", "specified", "table", "is", "accessible", "." ]
e891350dbf55e6307be94d193d056bdb785b37d3
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L89-L112
train
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java
MonitorEndpointHelper.pingJmsEndpoint
public static String pingJmsEndpoint(MuleContext muleContext, String queueName) { return pingJmsEndpoint(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName); }
java
public static String pingJmsEndpoint(MuleContext muleContext, String queueName) { return pingJmsEndpoint(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName); }
[ "public", "static", "String", "pingJmsEndpoint", "(", "MuleContext", "muleContext", ",", "String", "queueName", ")", "{", "return", "pingJmsEndpoint", "(", "muleContext", ",", "DEFAULT_MULE_JMS_CONNECTOR", ",", "queueName", ")", ";", "}" ]
Verify access to a JMS endpoint by browsing a specified queue for messages.
[ "Verify", "access", "to", "a", "JMS", "endpoint", "by", "browsing", "a", "specified", "queue", "for", "messages", "." ]
e891350dbf55e6307be94d193d056bdb785b37d3
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L117-L119
train
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java
MonitorEndpointHelper.isQueueEmpty
@SuppressWarnings("rawtypes") private static boolean isQueueEmpty(MuleContext muleContext, String muleJmsConnectorName, String queueName) throws JMSException { JmsConnector muleCon = (JmsConnector)MuleUtil.getSpringBean(muleContext, muleJmsConnectorName); Session s = null; QueueBrowser b = null; try { // Get a jms connection from mule and create a jms session s = muleCon.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); Queue q = s.createQueue(queueName); b = s.createBrowser(q); Enumeration e = b.getEnumeration(); return !e.hasMoreElements(); } finally { try {if (b != null) b.close();} catch (JMSException e) {} try {if (s != null) s.close();} catch (JMSException e) {} } }
java
@SuppressWarnings("rawtypes") private static boolean isQueueEmpty(MuleContext muleContext, String muleJmsConnectorName, String queueName) throws JMSException { JmsConnector muleCon = (JmsConnector)MuleUtil.getSpringBean(muleContext, muleJmsConnectorName); Session s = null; QueueBrowser b = null; try { // Get a jms connection from mule and create a jms session s = muleCon.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); Queue q = s.createQueue(queueName); b = s.createBrowser(q); Enumeration e = b.getEnumeration(); return !e.hasMoreElements(); } finally { try {if (b != null) b.close();} catch (JMSException e) {} try {if (s != null) s.close();} catch (JMSException e) {} } }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "static", "boolean", "isQueueEmpty", "(", "MuleContext", "muleContext", ",", "String", "muleJmsConnectorName", ",", "String", "queueName", ")", "throws", "JMSException", "{", "JmsConnector", "muleCon", "=",...
Browse a queue for messages @param muleJmsConnectorName @param queueName @return @throws JMSException
[ "Browse", "a", "queue", "for", "messages" ]
e891350dbf55e6307be94d193d056bdb785b37d3
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L205-L226
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/selectors/BeanSelector.java
BeanSelector.select
@Override public T select(Object item) { if (item == null) { return null; } if (itemClass.isInstance(item)) { return itemClass.cast(item); } logger.debug("item [{}] is not assignable to class [{}], returning null", item, itemClass); return null; }
java
@Override public T select(Object item) { if (item == null) { return null; } if (itemClass.isInstance(item)) { return itemClass.cast(item); } logger.debug("item [{}] is not assignable to class [{}], returning null", item, itemClass); return null; }
[ "@", "Override", "public", "T", "select", "(", "Object", "item", ")", "{", "if", "(", "item", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "itemClass", ".", "isInstance", "(", "item", ")", ")", "{", "return", "itemClass", ".", "ca...
If the item is null, return null. If the item is instance of the constructor parameter itemClass, return the type cast result, otherwise, return null.
[ "If", "the", "item", "is", "null", "return", "null", ".", "If", "the", "item", "is", "instance", "of", "the", "constructor", "parameter", "itemClass", "return", "the", "type", "cast", "result", "otherwise", "return", "null", "." ]
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/selectors/BeanSelector.java#L26-L37
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/BeanQuery.java
BeanQuery.orderBy
public BeanQuery<T> orderBy(String orderByProperty, Comparator propertyValueComparator) { this.comparator = new DelegatedSortOrderableComparator(new PropertyComparator(orderByProperty, propertyValueComparator)); return this; }
java
public BeanQuery<T> orderBy(String orderByProperty, Comparator propertyValueComparator) { this.comparator = new DelegatedSortOrderableComparator(new PropertyComparator(orderByProperty, propertyValueComparator)); return this; }
[ "public", "BeanQuery", "<", "T", ">", "orderBy", "(", "String", "orderByProperty", ",", "Comparator", "propertyValueComparator", ")", "{", "this", ".", "comparator", "=", "new", "DelegatedSortOrderableComparator", "(", "new", "PropertyComparator", "(", "orderByPropert...
Specify the property of the beans to be compared by the propertyValueComparator when sorting the result. If there is not a accessible public read method of the property, the value of the property passed to the propertyValueComparator will be null.
[ "Specify", "the", "property", "of", "the", "beans", "to", "be", "compared", "by", "the", "propertyValueComparator", "when", "sorting", "the", "result", ".", "If", "there", "is", "not", "a", "accessible", "public", "read", "method", "of", "the", "property", "...
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/BeanQuery.java#L140-L144
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/BeanQuery.java
BeanQuery.orderBy
public BeanQuery<T> orderBy(Comparator... beanComparator) { this.comparator = new DelegatedSortOrderableComparator(ComparatorUtils.chainedComparator(beanComparator)); return this; }
java
public BeanQuery<T> orderBy(Comparator... beanComparator) { this.comparator = new DelegatedSortOrderableComparator(ComparatorUtils.chainedComparator(beanComparator)); return this; }
[ "public", "BeanQuery", "<", "T", ">", "orderBy", "(", "Comparator", "...", "beanComparator", ")", "{", "this", ".", "comparator", "=", "new", "DelegatedSortOrderableComparator", "(", "ComparatorUtils", ".", "chainedComparator", "(", "beanComparator", ")", ")", ";"...
Using an array of Comparators, applied in sequence until one returns not equal or the array is exhausted.
[ "Using", "an", "array", "of", "Comparators", "applied", "in", "sequence", "until", "one", "returns", "not", "equal", "or", "the", "array", "is", "exhausted", "." ]
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/BeanQuery.java#L157-L160
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/BeanQuery.java
BeanQuery.executeFrom
public T executeFrom(Object bean) { List<T> executeFromCollectionResult = executeFrom(Collections.singleton(bean)); if (CollectionUtils.isEmpty(executeFromCollectionResult)) { return null; } else { return executeFromCollectionResult.get(0); } }
java
public T executeFrom(Object bean) { List<T> executeFromCollectionResult = executeFrom(Collections.singleton(bean)); if (CollectionUtils.isEmpty(executeFromCollectionResult)) { return null; } else { return executeFromCollectionResult.get(0); } }
[ "public", "T", "executeFrom", "(", "Object", "bean", ")", "{", "List", "<", "T", ">", "executeFromCollectionResult", "=", "executeFrom", "(", "Collections", ".", "singleton", "(", "bean", ")", ")", ";", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "e...
Execute from a bean to check does it match the filtering condition and convert it.
[ "Execute", "from", "a", "bean", "to", "check", "does", "it", "match", "the", "filtering", "condition", "and", "convert", "it", "." ]
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/BeanQuery.java#L201-L208
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/BeanQuery.java
BeanQuery.execute
public List<T> execute() { if (CollectionUtils.isEmpty(from)) { logger.info("Querying from an empty collection, returning empty list."); return Collections.emptyList(); } List copied = new ArrayList(this.from); logger.info("Start apply predicate [{}] to collection with [{}] items.", predicate, copied.size()); CollectionUtils.filter(copied, this.predicate); logger.info("Done filtering collection, filtered result size is [{}]", copied.size()); if (null != this.comparator && copied.size()>1) { Comparator actualComparator = this.descSorting ? comparator.desc() : comparator.asc(); logger.info("Start to sort the filtered collection with comparator [{}]", actualComparator); Collections.sort(copied, actualComparator); logger.info("Done sorting the filtered collection."); } logger.info("Start to slect from filtered collection with selector [{}].", selector); List<T> select = this.selector.select(copied); logger.info("Done select from filtered collection."); return select; }
java
public List<T> execute() { if (CollectionUtils.isEmpty(from)) { logger.info("Querying from an empty collection, returning empty list."); return Collections.emptyList(); } List copied = new ArrayList(this.from); logger.info("Start apply predicate [{}] to collection with [{}] items.", predicate, copied.size()); CollectionUtils.filter(copied, this.predicate); logger.info("Done filtering collection, filtered result size is [{}]", copied.size()); if (null != this.comparator && copied.size()>1) { Comparator actualComparator = this.descSorting ? comparator.desc() : comparator.asc(); logger.info("Start to sort the filtered collection with comparator [{}]", actualComparator); Collections.sort(copied, actualComparator); logger.info("Done sorting the filtered collection."); } logger.info("Start to slect from filtered collection with selector [{}].", selector); List<T> select = this.selector.select(copied); logger.info("Done select from filtered collection."); return select; }
[ "public", "List", "<", "T", ">", "execute", "(", ")", "{", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "from", ")", ")", "{", "logger", ".", "info", "(", "\"Querying from an empty collection, returning empty list.\"", ")", ";", "return", "Collections", ...
Execute this Query. If query from a null or empty collection, an empty list will be returned. @return
[ "Execute", "this", "Query", ".", "If", "query", "from", "a", "null", "or", "empty", "collection", "an", "empty", "list", "will", "be", "returned", "." ]
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/BeanQuery.java#L216-L240
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/BeanQuery.java
BeanQuery.select
public static BeanQuery<Map<String, Object>> select(KeyValueMapSelector... selectors) { return new BeanQuery<Map<String, Object>>(new CompositeSelector(selectors)); }
java
public static BeanQuery<Map<String, Object>> select(KeyValueMapSelector... selectors) { return new BeanQuery<Map<String, Object>>(new CompositeSelector(selectors)); }
[ "public", "static", "BeanQuery", "<", "Map", "<", "String", ",", "Object", ">", ">", "select", "(", "KeyValueMapSelector", "...", "selectors", ")", "{", "return", "new", "BeanQuery", "<", "Map", "<", "String", ",", "Object", ">", ">", "(", "new", "Compos...
Create a BeanQuery instance with multiple Selectors. @param selectors
[ "Create", "a", "BeanQuery", "instance", "with", "multiple", "Selectors", "." ]
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/BeanQuery.java#L247-L249
train
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.write
@Override public void write(final Writer writer) throws ConfigurationException, IOException { Preconditions.checkNotNull(writer); @SuppressWarnings("unchecked") final HashMap<String, Object> settings = (HashMap<String, Object>) fromNode(this.getModel().getInMemoryRepresentation()); this.mapper.writerWithDefaultPrettyPrinter().writeValue(writer, settings); }
java
@Override public void write(final Writer writer) throws ConfigurationException, IOException { Preconditions.checkNotNull(writer); @SuppressWarnings("unchecked") final HashMap<String, Object> settings = (HashMap<String, Object>) fromNode(this.getModel().getInMemoryRepresentation()); this.mapper.writerWithDefaultPrettyPrinter().writeValue(writer, settings); }
[ "@", "Override", "public", "void", "write", "(", "final", "Writer", "writer", ")", "throws", "ConfigurationException", ",", "IOException", "{", "Preconditions", ".", "checkNotNull", "(", "writer", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "fi...
Writes the configuration. @param writer The writer to write to. @throws ConfigurationException @throws IOException
[ "Writes", "the", "configuration", "." ]
40474ab3c641fbbb4ccd9c97d4f7075c1644ef69
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L118-L125
train
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.toNode
private ImmutableNode toNode(final Builder builder, final Object obj) { assert !(obj instanceof List); if (obj instanceof Map) { return mapToNode(builder, (Map<String, Object>) obj); } else { return valueToNode(builder, obj); } }
java
private ImmutableNode toNode(final Builder builder, final Object obj) { assert !(obj instanceof List); if (obj instanceof Map) { return mapToNode(builder, (Map<String, Object>) obj); } else { return valueToNode(builder, obj); } }
[ "private", "ImmutableNode", "toNode", "(", "final", "Builder", "builder", ",", "final", "Object", "obj", ")", "{", "assert", "!", "(", "obj", "instanceof", "List", ")", ";", "if", "(", "obj", "instanceof", "Map", ")", "{", "return", "mapToNode", "(", "bu...
Creates a node for the specified object. @param builder The node builder. @param obj The object. @return The created node.
[ "Creates", "a", "node", "for", "the", "specified", "object", "." ]
40474ab3c641fbbb4ccd9c97d4f7075c1644ef69
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L144-L152
train
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.mapToNode
private ImmutableNode mapToNode(final Builder builder, final Map<String, Object> map) { for (final Map.Entry<String, Object> entry : map.entrySet()) { final String key = entry.getKey(); final Object value = entry.getValue(); if (value instanceof List) { // For a list, add each list item as a child of this node. for (final Object item : (List)value) { addChildNode(builder, key, item); } } else { // Otherwise, add the value as a child of this node. addChildNode(builder, key, value); } } return builder.create(); }
java
private ImmutableNode mapToNode(final Builder builder, final Map<String, Object> map) { for (final Map.Entry<String, Object> entry : map.entrySet()) { final String key = entry.getKey(); final Object value = entry.getValue(); if (value instanceof List) { // For a list, add each list item as a child of this node. for (final Object item : (List)value) { addChildNode(builder, key, item); } } else { // Otherwise, add the value as a child of this node. addChildNode(builder, key, value); } } return builder.create(); }
[ "private", "ImmutableNode", "mapToNode", "(", "final", "Builder", "builder", ",", "final", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "map", ".",...
Creates a node for the specified map. @param builder The node builder. @param map The map. @return The created node.
[ "Creates", "a", "node", "for", "the", "specified", "map", "." ]
40474ab3c641fbbb4ccd9c97d4f7075c1644ef69
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L161-L176
train
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.addChildNode
private void addChildNode(final Builder builder, final String name, final Object value) { assert !(value instanceof List); final Builder childBuilder = new Builder(); // Set the name of the child node. childBuilder.name(name); // Set the value of the child node. final ImmutableNode childNode = toNode(childBuilder, value); // Add the node to the children of the node being built. builder.addChild(childNode); }
java
private void addChildNode(final Builder builder, final String name, final Object value) { assert !(value instanceof List); final Builder childBuilder = new Builder(); // Set the name of the child node. childBuilder.name(name); // Set the value of the child node. final ImmutableNode childNode = toNode(childBuilder, value); // Add the node to the children of the node being built. builder.addChild(childNode); }
[ "private", "void", "addChildNode", "(", "final", "Builder", "builder", ",", "final", "String", "name", ",", "final", "Object", "value", ")", "{", "assert", "!", "(", "value", "instanceof", "List", ")", ";", "final", "Builder", "childBuilder", "=", "new", "...
Adds a child node to the specified builder. @param builder The builder to add the node to. @param name The name of the node. @param value The value of the node.
[ "Adds", "a", "child", "node", "to", "the", "specified", "builder", "." ]
40474ab3c641fbbb4ccd9c97d4f7075c1644ef69
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L185-L195
train
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.valueToNode
private ImmutableNode valueToNode(final Builder builder, final Object value) { // Set the value of the node being built. return builder.value(value).create(); }
java
private ImmutableNode valueToNode(final Builder builder, final Object value) { // Set the value of the node being built. return builder.value(value).create(); }
[ "private", "ImmutableNode", "valueToNode", "(", "final", "Builder", "builder", ",", "final", "Object", "value", ")", "{", "// Set the value of the node being built.", "return", "builder", ".", "value", "(", "value", ")", ".", "create", "(", ")", ";", "}" ]
Creates a node for the specified value. @param builder The node builder. @param value The value. @return The created node.
[ "Creates", "a", "node", "for", "the", "specified", "value", "." ]
40474ab3c641fbbb4ccd9c97d4f7075c1644ef69
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L204-L207
train
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.fromNode
private Object fromNode(final ImmutableNode node) { if (!node.getChildren().isEmpty()) { final Map<String, List<ImmutableNode>> children = getChildrenWithName(node); final HashMap<String, Object> map = new HashMap<>(); for (final Map.Entry<String, List<ImmutableNode>> entry : children.entrySet()) { assert !entry.getValue().isEmpty(); if (entry.getValue().size() == 1) { // Just one node. final ImmutableNode child = entry.getValue().get(0); final Object childValue = fromNode(child); map.put(entry.getKey(), childValue); } else { // Multiple nodes. final ArrayList<Object> list = new ArrayList<>(); for (final ImmutableNode child : entry.getValue()) { final Object childValue = fromNode(child); list.add(childValue); } map.put(entry.getKey(), list); } } return map; } else { return node.getValue(); } }
java
private Object fromNode(final ImmutableNode node) { if (!node.getChildren().isEmpty()) { final Map<String, List<ImmutableNode>> children = getChildrenWithName(node); final HashMap<String, Object> map = new HashMap<>(); for (final Map.Entry<String, List<ImmutableNode>> entry : children.entrySet()) { assert !entry.getValue().isEmpty(); if (entry.getValue().size() == 1) { // Just one node. final ImmutableNode child = entry.getValue().get(0); final Object childValue = fromNode(child); map.put(entry.getKey(), childValue); } else { // Multiple nodes. final ArrayList<Object> list = new ArrayList<>(); for (final ImmutableNode child : entry.getValue()) { final Object childValue = fromNode(child); list.add(childValue); } map.put(entry.getKey(), list); } } return map; } else { return node.getValue(); } }
[ "private", "Object", "fromNode", "(", "final", "ImmutableNode", "node", ")", "{", "if", "(", "!", "node", ".", "getChildren", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "final", "Map", "<", "String", ",", "List", "<", "ImmutableNode", ">", ">", "c...
Gets a serialization object from a node. @param node The node. @return The object representing the node.
[ "Gets", "a", "serialization", "object", "from", "a", "node", "." ]
40474ab3c641fbbb4ccd9c97d4f7075c1644ef69
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L215-L241
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/selectors/ClassSelector.java
ClassSelector.except
public ClassSelector except(String... propertyNames) { if(ArrayUtils.isEmpty(propertyNames)){ return this; } boolean updated = false; for (String propertyToRemove : propertyNames) { if (removePropertySelector(propertyToRemove)) { updated = true; } } if (updated) { compositeSelector = new CompositeSelector(this.propertySelectors); } return this; }
java
public ClassSelector except(String... propertyNames) { if(ArrayUtils.isEmpty(propertyNames)){ return this; } boolean updated = false; for (String propertyToRemove : propertyNames) { if (removePropertySelector(propertyToRemove)) { updated = true; } } if (updated) { compositeSelector = new CompositeSelector(this.propertySelectors); } return this; }
[ "public", "ClassSelector", "except", "(", "String", "...", "propertyNames", ")", "{", "if", "(", "ArrayUtils", ".", "isEmpty", "(", "propertyNames", ")", ")", "{", "return", "this", ";", "}", "boolean", "updated", "=", "false", ";", "for", "(", "String", ...
Exclude properties from the result map.
[ "Exclude", "properties", "from", "the", "result", "map", "." ]
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/selectors/ClassSelector.java#L55-L71
train
Jimmy-Shi/bean-query
src/main/java/cn/jimmyshi/beanquery/selectors/ClassSelector.java
ClassSelector.add
public ClassSelector add(String... propertyNames) { if (ArrayUtils.isNotEmpty(propertyNames)) { for (String propertyNameToAdd : propertyNames) { addPropertySelector(propertyNameToAdd); } } return this; }
java
public ClassSelector add(String... propertyNames) { if (ArrayUtils.isNotEmpty(propertyNames)) { for (String propertyNameToAdd : propertyNames) { addPropertySelector(propertyNameToAdd); } } return this; }
[ "public", "ClassSelector", "add", "(", "String", "...", "propertyNames", ")", "{", "if", "(", "ArrayUtils", ".", "isNotEmpty", "(", "propertyNames", ")", ")", "{", "for", "(", "String", "propertyNameToAdd", ":", "propertyNames", ")", "{", "addPropertySelector", ...
Include properties in the result map.
[ "Include", "properties", "in", "the", "result", "map", "." ]
31d4ffd6518c1b04247fc1cfac3f6dad903f2d20
https://github.com/Jimmy-Shi/bean-query/blob/31d4ffd6518c1b04247fc1cfac3f6dad903f2d20/src/main/java/cn/jimmyshi/beanquery/selectors/ClassSelector.java#L90-L97
train
nikhaldi/android-view-selector
src/main/java/com/nikhaldimann/viewselector/ViewSelectionAssert.java
ViewSelectionAssert.attribute
public ViewSelectionAttributeAssert attribute(String attributeName) { isNotEmpty(); ViewSelectionAttribute attributeValues = new ViewSelectionAttribute(actual, attributeName); return new ViewSelectionAttributeAssert(attributeValues); }
java
public ViewSelectionAttributeAssert attribute(String attributeName) { isNotEmpty(); ViewSelectionAttribute attributeValues = new ViewSelectionAttribute(actual, attributeName); return new ViewSelectionAttributeAssert(attributeValues); }
[ "public", "ViewSelectionAttributeAssert", "attribute", "(", "String", "attributeName", ")", "{", "isNotEmpty", "(", ")", ";", "ViewSelectionAttribute", "attributeValues", "=", "new", "ViewSelectionAttribute", "(", "actual", ",", "attributeName", ")", ";", "return", "n...
Creates an object for making assertions about an attribute set extracted from each view in the selection. This always fails for an empty selection. @param attributeName name of the attribute to check (e.g., {@code "text"}. The implementation will call a getter on each view based on this attribute name (e.g., {@code getText()}. @return a new assert over a set of attributes
[ "Creates", "an", "object", "for", "making", "assertions", "about", "an", "attribute", "set", "extracted", "from", "each", "view", "in", "the", "selection", ".", "This", "always", "fails", "for", "an", "empty", "selection", "." ]
d3e4bf05f6111d116c6b0c1a8c51396e8bfae9b5
https://github.com/nikhaldi/android-view-selector/blob/d3e4bf05f6111d116c6b0c1a8c51396e8bfae9b5/src/main/java/com/nikhaldimann/viewselector/ViewSelectionAssert.java#L34-L38
train
zanata/jgettext
src/main/java/org/fedorahosted/tennera/jgettext/HeaderUtil.java
HeaderUtil.generateHeader
private static Message generateHeader(HeaderValues param) { HeaderFields header = new HeaderFields(); setValues(header, param); Message headerMsg = header.unwrap(); for (String comment : param.comments) { headerMsg.addComment(comment); } return headerMsg; }
java
private static Message generateHeader(HeaderValues param) { HeaderFields header = new HeaderFields(); setValues(header, param); Message headerMsg = header.unwrap(); for (String comment : param.comments) { headerMsg.addComment(comment); } return headerMsg; }
[ "private", "static", "Message", "generateHeader", "(", "HeaderValues", "param", ")", "{", "HeaderFields", "header", "=", "new", "HeaderFields", "(", ")", ";", "setValues", "(", "header", ",", "param", ")", ";", "Message", "headerMsg", "=", "header", ".", "un...
This, more general, generate method is private, along with the HeaderValues object, until we decide what the public API should be. @param param @return
[ "This", "more", "general", "generate", "method", "is", "private", "along", "with", "the", "HeaderValues", "object", "until", "we", "decide", "what", "the", "public", "API", "should", "be", "." ]
29a6170c81b82a14458fb5c8b23720fc0dec291c
https://github.com/zanata/jgettext/blob/29a6170c81b82a14458fb5c8b23720fc0dec291c/src/main/java/org/fedorahosted/tennera/jgettext/HeaderUtil.java#L82-L94
train
nikhaldi/android-view-selector
src/main/java/com/nikhaldimann/viewselector/ViewSelector.java
ViewSelector.selectViews
public ViewSelection selectViews(View view) { ViewSelection result = new ViewSelection(); for (List<Selector> selectorParts : selectorGroups) { result.addAll(selectViewsForGroup(selectorParts, view)); } return result; }
java
public ViewSelection selectViews(View view) { ViewSelection result = new ViewSelection(); for (List<Selector> selectorParts : selectorGroups) { result.addAll(selectViewsForGroup(selectorParts, view)); } return result; }
[ "public", "ViewSelection", "selectViews", "(", "View", "view", ")", "{", "ViewSelection", "result", "=", "new", "ViewSelection", "(", ")", ";", "for", "(", "List", "<", "Selector", ">", "selectorParts", ":", "selectorGroups", ")", "{", "result", ".", "addAll...
Applies this selector to the given view, selecting all descendants of the view that match this selector. @return the ordered set of views that matches this selector
[ "Applies", "this", "selector", "to", "the", "given", "view", "selecting", "all", "descendants", "of", "the", "view", "that", "match", "this", "selector", "." ]
d3e4bf05f6111d116c6b0c1a8c51396e8bfae9b5
https://github.com/nikhaldi/android-view-selector/blob/d3e4bf05f6111d116c6b0c1a8c51396e8bfae9b5/src/main/java/com/nikhaldimann/viewselector/ViewSelector.java#L33-L39
train
kiswanij/jk-util
src/main/java/com/jk/util/validation/Problem.java
Problem.compareTo
@Override public int compareTo(final Problem o) { final int ix = this.severity.ordinal(); final int oid = o.severity.ordinal(); return ix - oid; }
java
@Override public int compareTo(final Problem o) { final int ix = this.severity.ordinal(); final int oid = o.severity.ordinal(); return ix - oid; }
[ "@", "Override", "public", "int", "compareTo", "(", "final", "Problem", "o", ")", "{", "final", "int", "ix", "=", "this", ".", "severity", ".", "ordinal", "(", ")", ";", "final", "int", "oid", "=", "o", ".", "severity", ".", "ordinal", "(", ")", ";...
Compare, such that most severe Problems will appear last, least first. @param o the o @return the difference in severity as an integer
[ "Compare", "such", "that", "most", "severe", "Problems", "will", "appear", "last", "least", "first", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/Problem.java#L56-L61
train
kiswanij/jk-util
src/main/java/com/jk/util/JKStringUtil.java
JKStringUtil.fixValue
public static String fixValue(String value) { if (value != null && !value.equals("")) { final String[] words = value.toLowerCase().split("_"); value = ""; for (final String word : words) { if (word.length() > 1) { value += word.substring(0, 1).toUpperCase() + word.substring(1) + " "; } else { value = word; } } } if (value.contains("\\n")) { value = value.replace("\\n", System.getProperty("line.separator")); } return value; }
java
public static String fixValue(String value) { if (value != null && !value.equals("")) { final String[] words = value.toLowerCase().split("_"); value = ""; for (final String word : words) { if (word.length() > 1) { value += word.substring(0, 1).toUpperCase() + word.substring(1) + " "; } else { value = word; } } } if (value.contains("\\n")) { value = value.replace("\\n", System.getProperty("line.separator")); } return value; }
[ "public", "static", "String", "fixValue", "(", "String", "value", ")", "{", "if", "(", "value", "!=", "null", "&&", "!", "value", ".", "equals", "(", "\"\"", ")", ")", "{", "final", "String", "[", "]", "words", "=", "value", ".", "toLowerCase", "(", ...
replace under score with space replace \n char with platform indepent line.separator @param value the value @return the string
[ "replace", "under", "score", "with", "space", "replace", "\\", "n", "char", "with", "platform", "indepent", "line", ".", "separator" ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKStringUtil.java#L55-L71
train
kiswanij/jk-util
src/main/java/com/jk/util/JKStringUtil.java
JKStringUtil.removeLast
public static String removeLast(String original, String string) { int lastIndexOf = original.lastIndexOf(string); if (lastIndexOf == -1) { return original; } return original.substring(0, lastIndexOf); }
java
public static String removeLast(String original, String string) { int lastIndexOf = original.lastIndexOf(string); if (lastIndexOf == -1) { return original; } return original.substring(0, lastIndexOf); }
[ "public", "static", "String", "removeLast", "(", "String", "original", ",", "String", "string", ")", "{", "int", "lastIndexOf", "=", "original", ".", "lastIndexOf", "(", "string", ")", ";", "if", "(", "lastIndexOf", "==", "-", "1", ")", "{", "return", "o...
This method create nre properties from the origianl one and remove any key with the password , then call toString method on this prperties. @param original the original @param string the string @return the string
[ "This", "method", "create", "nre", "properties", "from", "the", "origianl", "one", "and", "remove", "any", "key", "with", "the", "password", "then", "call", "toString", "method", "on", "this", "prperties", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKStringUtil.java#L119-L125
train
kiswanij/jk-util
src/main/java/com/jk/util/JKStringUtil.java
JKStringUtil.getFirstLine
public static String getFirstLine(final String message) { if (isEmpty(message)) { return message; } if (message.contains("\n")) { return message.split("\n")[0]; } return message; }
java
public static String getFirstLine(final String message) { if (isEmpty(message)) { return message; } if (message.contains("\n")) { return message.split("\n")[0]; } return message; }
[ "public", "static", "String", "getFirstLine", "(", "final", "String", "message", ")", "{", "if", "(", "isEmpty", "(", "message", ")", ")", "{", "return", "message", ";", "}", "if", "(", "message", ".", "contains", "(", "\"\\n\"", ")", ")", "{", "return...
Gets the first line. @param message the message @return the first line
[ "Gets", "the", "first", "line", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKStringUtil.java#L172-L180
train
kiswanij/jk-util
src/main/java/com/jk/util/JKStringUtil.java
JKStringUtil.copyToClipboard
public static void copyToClipboard(String text) { final StringSelection stringSelection = new StringSelection(text); final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, stringSelection); }
java
public static void copyToClipboard(String text) { final StringSelection stringSelection = new StringSelection(text); final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, stringSelection); }
[ "public", "static", "void", "copyToClipboard", "(", "String", "text", ")", "{", "final", "StringSelection", "stringSelection", "=", "new", "StringSelection", "(", "text", ")", ";", "final", "Clipboard", "clipboard", "=", "Toolkit", ".", "getDefaultToolkit", "(", ...
Copy to clipboard. @param text the text
[ "Copy", "to", "clipboard", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKStringUtil.java#L203-L207
train
kiswanij/jk-util
src/main/java/com/jk/util/model/table/JKColumnFilter.java
JKColumnFilter.toQueryString
public String toQueryString() { final StringBuffer buf = new StringBuffer(); final Object value1 = this.values.get(0); buf.append(this.column.getName()); switch (this.type) { case STARTS_WIDTH: buf.append(" like '" + value1 + "%'"); break; case CONTAINS: buf.append(" like '%" + value1 + "%'"); break; case ENDS_WITH: buf.append(" like '%" + value1 + "'"); break; case DOESNOT_CONTAINS: buf.append(" not like '%" + value1 + "%'"); break; case MORE_THAN: buf.append(" > '" + value1 + "'"); break; case LESS_THAN: buf.append(" < '" + value1 + "'"); break; } return buf.toString(); }
java
public String toQueryString() { final StringBuffer buf = new StringBuffer(); final Object value1 = this.values.get(0); buf.append(this.column.getName()); switch (this.type) { case STARTS_WIDTH: buf.append(" like '" + value1 + "%'"); break; case CONTAINS: buf.append(" like '%" + value1 + "%'"); break; case ENDS_WITH: buf.append(" like '%" + value1 + "'"); break; case DOESNOT_CONTAINS: buf.append(" not like '%" + value1 + "%'"); break; case MORE_THAN: buf.append(" > '" + value1 + "'"); break; case LESS_THAN: buf.append(" < '" + value1 + "'"); break; } return buf.toString(); }
[ "public", "String", "toQueryString", "(", ")", "{", "final", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "final", "Object", "value1", "=", "this", ".", "values", ".", "get", "(", "0", ")", ";", "buf", ".", "append", "(", "this", ...
To query string. @return the string
[ "To", "query", "string", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKColumnFilter.java#L162-L187
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/PeptideUtils.java
PeptideUtils.getNaturalAnalogueSequence
public static String getNaturalAnalogueSequence(PolymerNotation polymer) throws HELM2HandledException, PeptideUtilsException, ChemistryException { checkPeptidePolymer(polymer); return FastaFormat.generateFastaFromPeptide(MethodsMonomerUtils.getListOfHandledMonomers(polymer.getListMonomers())); }
java
public static String getNaturalAnalogueSequence(PolymerNotation polymer) throws HELM2HandledException, PeptideUtilsException, ChemistryException { checkPeptidePolymer(polymer); return FastaFormat.generateFastaFromPeptide(MethodsMonomerUtils.getListOfHandledMonomers(polymer.getListMonomers())); }
[ "public", "static", "String", "getNaturalAnalogueSequence", "(", "PolymerNotation", "polymer", ")", "throws", "HELM2HandledException", ",", "PeptideUtilsException", ",", "ChemistryException", "{", "checkPeptidePolymer", "(", "polymer", ")", ";", "return", "FastaFormat", "...
method to produce for a peptide PolymerNotation the natural analogue sequence @param polymer PolymerNotation @return natural analogue sequence @throws HELM2HandledException if the polymer contains HELM2 features @throws PeptideUtilsException if the polymer is not a peptide @throws ChemistryException if the Chemistry Engine is not initialized
[ "method", "to", "produce", "for", "a", "peptide", "PolymerNotation", "the", "natural", "analogue", "sequence" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/PeptideUtils.java#L60-L63
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/PeptideUtils.java
PeptideUtils.getSequence
public static String getSequence(PolymerNotation polymer) throws HELM2HandledException, PeptideUtilsException, ChemistryException{ checkPeptidePolymer(polymer); StringBuilder sb = new StringBuilder(); List<Monomer> monomers = MethodsMonomerUtils.getListOfHandledMonomers(polymer.getListMonomers()); for (Monomer monomer : monomers) { String id = monomer.getAlternateId(); if (id.length() > 1) { id = "[" + id + "]"; } sb.append(id); } return sb.toString(); }
java
public static String getSequence(PolymerNotation polymer) throws HELM2HandledException, PeptideUtilsException, ChemistryException{ checkPeptidePolymer(polymer); StringBuilder sb = new StringBuilder(); List<Monomer> monomers = MethodsMonomerUtils.getListOfHandledMonomers(polymer.getListMonomers()); for (Monomer monomer : monomers) { String id = monomer.getAlternateId(); if (id.length() > 1) { id = "[" + id + "]"; } sb.append(id); } return sb.toString(); }
[ "public", "static", "String", "getSequence", "(", "PolymerNotation", "polymer", ")", "throws", "HELM2HandledException", ",", "PeptideUtilsException", ",", "ChemistryException", "{", "checkPeptidePolymer", "(", "polymer", ")", ";", "StringBuilder", "sb", "=", "new", "S...
method to produce for a peptide PolymerNotation the sequence @param polymer PolymerNotation @return sequence @throws HELM2HandledException if the polmyer contains HELM2 features @throws PeptideUtilsException is not a peptide @throws ChemistryException if the Chemistry Engine is not initialized
[ "method", "to", "produce", "for", "a", "peptide", "PolymerNotation", "the", "sequence" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/PeptideUtils.java#L74-L87
train
kiswanij/jk-util
src/main/java/com/jk/util/datatypes/JKTypeMapping.java
JKTypeMapping.processOtherMappings
private static void processOtherMappings() { codeToJavaMapping.clear(); codeToJKTypeMapping.clear(); shortListOfJKTypes.clear(); Set<Class<?>> keySet = javaToCodeMapping.keySet(); for (Class<?> clas : keySet) { List<Integer> codes = javaToCodeMapping.get(clas); for (Integer code : codes) { codeToJavaMapping.put(code, clas); logger.debug(" Code ({}) class ({}) name ({})", code, clas.getSimpleName(), namesMapping.get(code)); codeToJKTypeMapping.put(code, new JKType(code, clas, namesMapping.get(code))); } shortListOfJKTypes.add(new JKType(codes.get(0), clas, namesMapping.get(codes.get(0)))); } }
java
private static void processOtherMappings() { codeToJavaMapping.clear(); codeToJKTypeMapping.clear(); shortListOfJKTypes.clear(); Set<Class<?>> keySet = javaToCodeMapping.keySet(); for (Class<?> clas : keySet) { List<Integer> codes = javaToCodeMapping.get(clas); for (Integer code : codes) { codeToJavaMapping.put(code, clas); logger.debug(" Code ({}) class ({}) name ({})", code, clas.getSimpleName(), namesMapping.get(code)); codeToJKTypeMapping.put(code, new JKType(code, clas, namesMapping.get(code))); } shortListOfJKTypes.add(new JKType(codes.get(0), clas, namesMapping.get(codes.get(0)))); } }
[ "private", "static", "void", "processOtherMappings", "(", ")", "{", "codeToJavaMapping", ".", "clear", "(", ")", ";", "codeToJKTypeMapping", ".", "clear", "(", ")", ";", "shortListOfJKTypes", ".", "clear", "(", ")", ";", "Set", "<", "Class", "<", "?", ">",...
This method is used to avoid reconigure the mapping in the otherside again.
[ "This", "method", "is", "used", "to", "avoid", "reconigure", "the", "mapping", "in", "the", "otherside", "again", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/datatypes/JKTypeMapping.java#L101-L115
train
kiswanij/jk-util
src/main/java/com/jk/util/locale/JKMessage.java
JKMessage.loadDefaultConfigurations
protected void loadDefaultConfigurations() { if (JK.getURL(DEFAULT_LABLES_FILE_NAME) != null) { logger.debug("Load default lables from : " + DEFAULT_LABLES_FILE_NAME); addLables(JKIOUtil.readPropertiesFile(DEFAULT_LABLES_FILE_NAME)); } }
java
protected void loadDefaultConfigurations() { if (JK.getURL(DEFAULT_LABLES_FILE_NAME) != null) { logger.debug("Load default lables from : " + DEFAULT_LABLES_FILE_NAME); addLables(JKIOUtil.readPropertiesFile(DEFAULT_LABLES_FILE_NAME)); } }
[ "protected", "void", "loadDefaultConfigurations", "(", ")", "{", "if", "(", "JK", ".", "getURL", "(", "DEFAULT_LABLES_FILE_NAME", ")", "!=", "null", ")", "{", "logger", ".", "debug", "(", "\"Load default lables from : \"", "+", "DEFAULT_LABLES_FILE_NAME", ")", ";"...
Load default configurations.
[ "Load", "default", "configurations", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/locale/JKMessage.java#L66-L71
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.cloneBean
public static <T> T cloneBean(final Object bean) { try { return (T) BeanUtils.cloneBean(bean); } catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) { throw new RuntimeException(e); } }
java
public static <T> T cloneBean(final Object bean) { try { return (T) BeanUtils.cloneBean(bean); } catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) { throw new RuntimeException(e); } }
[ "public", "static", "<", "T", ">", "T", "cloneBean", "(", "final", "Object", "bean", ")", "{", "try", "{", "return", "(", "T", ")", "BeanUtils", ".", "cloneBean", "(", "bean", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "InstantiationExce...
Clone bean. @param <T> the generic type @param bean the bean @return the t
[ "Clone", "bean", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L89-L95
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getClass
public static Class<?> getClass(final String beanClassName) { try { return Class.forName(beanClassName); } catch (final ClassNotFoundException e) { throw new RuntimeException(e); } }
java
public static Class<?> getClass(final String beanClassName) { try { return Class.forName(beanClassName); } catch (final ClassNotFoundException e) { throw new RuntimeException(e); } }
[ "public", "static", "Class", "<", "?", ">", "getClass", "(", "final", "String", "beanClassName", ")", "{", "try", "{", "return", "Class", ".", "forName", "(", "beanClassName", ")", ";", "}", "catch", "(", "final", "ClassNotFoundException", "e", ")", "{", ...
Gets the class. @param beanClassName the bean class name @return the class
[ "Gets", "the", "class", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L103-L109
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getPropertyValue
public static <T> T getPropertyValue(final Object instance, final String fieldName) { try { return (T) PropertyUtils.getProperty(instance, fieldName); } catch (final Exception e) { throw new RuntimeException(e); } }
java
public static <T> T getPropertyValue(final Object instance, final String fieldName) { try { return (T) PropertyUtils.getProperty(instance, fieldName); } catch (final Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "<", "T", ">", "T", "getPropertyValue", "(", "final", "Object", "instance", ",", "final", "String", "fieldName", ")", "{", "try", "{", "return", "(", "T", ")", "PropertyUtils", ".", "getProperty", "(", "instance", ",", "fieldName", ")",...
Gets the property value. @param <T> the generic type @param instance the instance @param fieldName the field name @return the property value
[ "Gets", "the", "property", "value", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L119-L125
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.isBoolean
public static boolean isBoolean(final Class type) { if (Boolean.class.isAssignableFrom(type)) { return true; } return type.getName().equals("boolean"); }
java
public static boolean isBoolean(final Class type) { if (Boolean.class.isAssignableFrom(type)) { return true; } return type.getName().equals("boolean"); }
[ "public", "static", "boolean", "isBoolean", "(", "final", "Class", "type", ")", "{", "if", "(", "Boolean", ".", "class", ".", "isAssignableFrom", "(", "type", ")", ")", "{", "return", "true", ";", "}", "return", "type", ".", "getName", "(", ")", ".", ...
Checks if is boolean. @param type the type @return true, if is boolean
[ "Checks", "if", "is", "boolean", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L133-L138
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.setPeopertyValue
public static void setPeopertyValue(final Object target, final String fieldName, Object value) { JK.logger.trace("setPeopertyValue On class({}) on field ({}) with value ({})", target, fieldName, value); try { if (value != null) { Field field = getFieldByName(target.getClass(), fieldName); if (field.getType().isEnum()) { Class<? extends Enum> clas = (Class) field.getType(); value = Enum.valueOf(clas, value.toString()); JK.logger.debug("Field is enum, new value is ({}) for class ({})", value, value.getClass()); } } PropertyUtils.setNestedProperty(target, fieldName, value); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void setPeopertyValue(final Object target, final String fieldName, Object value) { JK.logger.trace("setPeopertyValue On class({}) on field ({}) with value ({})", target, fieldName, value); try { if (value != null) { Field field = getFieldByName(target.getClass(), fieldName); if (field.getType().isEnum()) { Class<? extends Enum> clas = (Class) field.getType(); value = Enum.valueOf(clas, value.toString()); JK.logger.debug("Field is enum, new value is ({}) for class ({})", value, value.getClass()); } } PropertyUtils.setNestedProperty(target, fieldName, value); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "setPeopertyValue", "(", "final", "Object", "target", ",", "final", "String", "fieldName", ",", "Object", "value", ")", "{", "JK", ".", "logger", ".", "trace", "(", "\"setPeopertyValue On class({}) on field ({}) with value ({})\"", ",", "...
Sets the peoperty value. @param target the source @param fieldName the field name @param value the value
[ "Sets", "the", "peoperty", "value", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L259-L275
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.addItemToList
public static void addItemToList(final Object target, final String fieldName, final Object value) { try { List list = (List) getFieldValue(target, fieldName); list.add(value); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void addItemToList(final Object target, final String fieldName, final Object value) { try { List list = (List) getFieldValue(target, fieldName); list.add(value); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "addItemToList", "(", "final", "Object", "target", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "{", "try", "{", "List", "list", "=", "(", "List", ")", "getFieldValue", "(", "target", ",", "fieldNam...
Adds the item to list. @param target the target @param fieldName the field name @param value the value
[ "Adds", "the", "item", "to", "list", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L284-L291
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.toClass
public static Class<?> toClass(final String name) { try { return Class.forName(name); } catch (final ClassNotFoundException e) { throw new RuntimeException(e); } }
java
public static Class<?> toClass(final String name) { try { return Class.forName(name); } catch (final ClassNotFoundException e) { throw new RuntimeException(e); } }
[ "public", "static", "Class", "<", "?", ">", "toClass", "(", "final", "String", "name", ")", "{", "try", "{", "return", "Class", ".", "forName", "(", "name", ")", ";", "}", "catch", "(", "final", "ClassNotFoundException", "e", ")", "{", "throw", "new", ...
To class. @param name the name @return the class
[ "To", "class", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L299-L305
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.toClassesFromObjects
public static Class<?>[] toClassesFromObjects(final Object[] params) { final Class<?>[] classes = new Class<?>[params.length]; int i = 0; for (final Object object : params) { if (object != null) { classes[i++] = object.getClass(); } else { classes[i++] = Object.class; } } return classes; }
java
public static Class<?>[] toClassesFromObjects(final Object[] params) { final Class<?>[] classes = new Class<?>[params.length]; int i = 0; for (final Object object : params) { if (object != null) { classes[i++] = object.getClass(); } else { classes[i++] = Object.class; } } return classes; }
[ "public", "static", "Class", "<", "?", ">", "[", "]", "toClassesFromObjects", "(", "final", "Object", "[", "]", "params", ")", "{", "final", "Class", "<", "?", ">", "[", "]", "classes", "=", "new", "Class", "<", "?", ">", "[", "params", ".", "lengt...
To classes from objects. @param params the params @return the class[]
[ "To", "classes", "from", "objects", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L313-L324
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.isMethodDirectlyExists
public static boolean isMethodDirectlyExists(Object object, String methodName, Class<?>... params) { try { Method method = object.getClass().getDeclaredMethod(methodName, params); return true; } catch (NoSuchMethodException e) { return false; } catch (SecurityException e) { throw new RuntimeException(e); } }
java
public static boolean isMethodDirectlyExists(Object object, String methodName, Class<?>... params) { try { Method method = object.getClass().getDeclaredMethod(methodName, params); return true; } catch (NoSuchMethodException e) { return false; } catch (SecurityException e) { throw new RuntimeException(e); } }
[ "public", "static", "boolean", "isMethodDirectlyExists", "(", "Object", "object", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "params", ")", "{", "try", "{", "Method", "method", "=", "object", ".", "getClass", "(", ")", ".", "getDeclar...
Checks if is method directly exists. @param object the object @param methodName the method name @param params the params @return true, if is method directly exists
[ "Checks", "if", "is", "method", "directly", "exists", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L367-L376
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.toObject
public static Object toObject(final String xml) { // XStream x = createXStream(); // return x.fromXML(xml); // try { final ByteArrayInputStream out = new ByteArrayInputStream(xml.getBytes()); final XMLDecoder encoder = new XMLDecoder(out); final Object object = encoder.readObject(); // encoder.close(); return object; // } catch (Exception e) { // System.err.println("Failed to decode object : \n" + xml); // return null; // } // return null; }
java
public static Object toObject(final String xml) { // XStream x = createXStream(); // return x.fromXML(xml); // try { final ByteArrayInputStream out = new ByteArrayInputStream(xml.getBytes()); final XMLDecoder encoder = new XMLDecoder(out); final Object object = encoder.readObject(); // encoder.close(); return object; // } catch (Exception e) { // System.err.println("Failed to decode object : \n" + xml); // return null; // } // return null; }
[ "public", "static", "Object", "toObject", "(", "final", "String", "xml", ")", "{", "// XStream x = createXStream();\r", "// return x.fromXML(xml);\r", "// try {\r", "final", "ByteArrayInputStream", "out", "=", "new", "ByteArrayInputStream", "(", "xml", ".", "getBytes", ...
To object. @param xml the xml @return the object
[ "To", "object", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L483-L498
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getGenericParamter
public static <T> Class<? extends T> getGenericParamter(String handler) { ParameterizedType parameterizedType = (ParameterizedType) JKObjectUtil.getClass(handler).getGenericInterfaces()[0]; Class<? extends T> clas = (Class<? extends T>) (parameterizedType.getActualTypeArguments()[0]); return clas; }
java
public static <T> Class<? extends T> getGenericParamter(String handler) { ParameterizedType parameterizedType = (ParameterizedType) JKObjectUtil.getClass(handler).getGenericInterfaces()[0]; Class<? extends T> clas = (Class<? extends T>) (parameterizedType.getActualTypeArguments()[0]); return clas; }
[ "public", "static", "<", "T", ">", "Class", "<", "?", "extends", "T", ">", "getGenericParamter", "(", "String", "handler", ")", "{", "ParameterizedType", "parameterizedType", "=", "(", "ParameterizedType", ")", "JKObjectUtil", ".", "getClass", "(", "handler", ...
Gets the generic paramter. @param <T> the generic type @param handler the handler @return the generic paramter
[ "Gets", "the", "generic", "paramter", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L517-L521
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.isClassAvilableInClassPath
public static boolean isClassAvilableInClassPath(String string) { try { Class.forName(string); return true; } catch (ClassNotFoundException e) { return false; } }
java
public static boolean isClassAvilableInClassPath(String string) { try { Class.forName(string); return true; } catch (ClassNotFoundException e) { return false; } }
[ "public", "static", "boolean", "isClassAvilableInClassPath", "(", "String", "string", ")", "{", "try", "{", "Class", ".", "forName", "(", "string", ")", ";", "return", "true", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "return", "false"...
Checks if is class avilable in class path. @param string the string @return true, if is class avilable in class path
[ "Checks", "if", "is", "class", "avilable", "in", "class", "path", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L566-L573
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getInstanceVariables
public static <T> String getInstanceVariables(Class<T> clas) { StringBuffer fieldsString = new StringBuffer(); Field[] fields = clas.getDeclaredFields(); int i = 0; for (Field field : fields) { if (i++ > 0) { fieldsString.append(JK.CSV_SEPARATOR); } fieldsString.append(field.getName()); } return fieldsString.toString(); }
java
public static <T> String getInstanceVariables(Class<T> clas) { StringBuffer fieldsString = new StringBuffer(); Field[] fields = clas.getDeclaredFields(); int i = 0; for (Field field : fields) { if (i++ > 0) { fieldsString.append(JK.CSV_SEPARATOR); } fieldsString.append(field.getName()); } return fieldsString.toString(); }
[ "public", "static", "<", "T", ">", "String", "getInstanceVariables", "(", "Class", "<", "T", ">", "clas", ")", "{", "StringBuffer", "fieldsString", "=", "new", "StringBuffer", "(", ")", ";", "Field", "[", "]", "fields", "=", "clas", ".", "getDeclaredFields...
Gets the instance variables. @param <T> the generic type @param clas the clas @return the instance variables
[ "Gets", "the", "instance", "variables", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L653-L664
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.toJson
public static String toJson(Object obj) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.writeValueAsString(obj); } catch (IOException e) { JK.throww(e); return null; } }
java
public static String toJson(Object obj) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.writeValueAsString(obj); } catch (IOException e) { JK.throww(e); return null; } }
[ "public", "static", "String", "toJson", "(", "Object", "obj", ")", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "try", "{", "return", "mapper", ".", "writeValueAsString", "(", "obj", ")", ";", "}", "catch", "(", "IOException", ...
To json. @param obj the obj @return the string
[ "To", "json", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L672-L680
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.jsonToObject
public static <T> Object jsonToObject(String json, Class<T> clas) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(json, clas); } catch (IOException e) { JK.throww(e); return null; } }
java
public static <T> Object jsonToObject(String json, Class<T> clas) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(json, clas); } catch (IOException e) { JK.throww(e); return null; } }
[ "public", "static", "<", "T", ">", "Object", "jsonToObject", "(", "String", "json", ",", "Class", "<", "T", ">", "clas", ")", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "try", "{", "return", "mapper", ".", "readValue", "(...
Json to object. @param <T> the generic type @param json the json @param clas the clas @return the object
[ "Json", "to", "object", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L690-L698
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getFieldNameByType
public static String getFieldNameByType(Class<?> classType, Class<?> fieldType) { Field[] declaredFields = classType.getDeclaredFields(); for (Field field : declaredFields) { if (field.getType().isAssignableFrom(fieldType)) { return field.getName(); } } if (classType.getSuperclass() != null) { return getFieldNameByType(classType.getSuperclass(), fieldType); } return null; }
java
public static String getFieldNameByType(Class<?> classType, Class<?> fieldType) { Field[] declaredFields = classType.getDeclaredFields(); for (Field field : declaredFields) { if (field.getType().isAssignableFrom(fieldType)) { return field.getName(); } } if (classType.getSuperclass() != null) { return getFieldNameByType(classType.getSuperclass(), fieldType); } return null; }
[ "public", "static", "String", "getFieldNameByType", "(", "Class", "<", "?", ">", "classType", ",", "Class", "<", "?", ">", "fieldType", ")", "{", "Field", "[", "]", "declaredFields", "=", "classType", ".", "getDeclaredFields", "(", ")", ";", "for", "(", ...
Gets the field name by type. @param classType the class type @param fieldType the field type @return the field name by type
[ "Gets", "the", "field", "name", "by", "type", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L786-L797
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.isFieldExists
public static boolean isFieldExists(Class<?> clas, String fieldName) { Field[] fields = clas.getDeclaredFields(); for (Field field : fields) { if (field.getName().equals(fieldName)) { return true; } } if (clas.getSuperclass() != null) { return isFieldExists(clas.getSuperclass(), fieldName); } return false; }
java
public static boolean isFieldExists(Class<?> clas, String fieldName) { Field[] fields = clas.getDeclaredFields(); for (Field field : fields) { if (field.getName().equals(fieldName)) { return true; } } if (clas.getSuperclass() != null) { return isFieldExists(clas.getSuperclass(), fieldName); } return false; }
[ "public", "static", "boolean", "isFieldExists", "(", "Class", "<", "?", ">", "clas", ",", "String", "fieldName", ")", "{", "Field", "[", "]", "fields", "=", "clas", ".", "getDeclaredFields", "(", ")", ";", "for", "(", "Field", "field", ":", "fields", "...
Checks if is field exists. @param clas the clas @param fieldName the field name @return true, if is field exists
[ "Checks", "if", "is", "field", "exists", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L829-L840
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getAllClassesInPackage
public static List<String> getAllClassesInPackage(String packageName) { List<String> classesNames = new Vector<>(); // create scanner and disable default filters (that is the 'false' argument) final ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); // add include filters which matches all the classes (or use your own) provider.addIncludeFilter(new RegexPatternTypeFilter(Pattern.compile(".*"))); // get matching classes defined in the package final Set<BeanDefinition> classes = provider.findCandidateComponents(packageName); // this is how you can load the class type from BeanDefinition instance for (BeanDefinition bean : classes) { classesNames.add(bean.getBeanClassName()); } return classesNames; }
java
public static List<String> getAllClassesInPackage(String packageName) { List<String> classesNames = new Vector<>(); // create scanner and disable default filters (that is the 'false' argument) final ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); // add include filters which matches all the classes (or use your own) provider.addIncludeFilter(new RegexPatternTypeFilter(Pattern.compile(".*"))); // get matching classes defined in the package final Set<BeanDefinition> classes = provider.findCandidateComponents(packageName); // this is how you can load the class type from BeanDefinition instance for (BeanDefinition bean : classes) { classesNames.add(bean.getBeanClassName()); } return classesNames; }
[ "public", "static", "List", "<", "String", ">", "getAllClassesInPackage", "(", "String", "packageName", ")", "{", "List", "<", "String", ">", "classesNames", "=", "new", "Vector", "<>", "(", ")", ";", "// create scanner and disable default filters (that is the 'false'...
Gets the all classes in package. @param packageName the package name @return the all classes in package
[ "Gets", "the", "all", "classes", "in", "package", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L848-L863
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getAllFields
public static List<Field> getAllFields(Class<?> clas) { JK.fixMe("add caching.."); List<Field> list = new Vector<>(); // start by fields from the super class if (clas.getSuperclass() != null) { list.addAll(getAllFields(clas.getSuperclass())); } Field[] fields = clas.getDeclaredFields(); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { list.add(field); } } return list; }
java
public static List<Field> getAllFields(Class<?> clas) { JK.fixMe("add caching.."); List<Field> list = new Vector<>(); // start by fields from the super class if (clas.getSuperclass() != null) { list.addAll(getAllFields(clas.getSuperclass())); } Field[] fields = clas.getDeclaredFields(); for (Field field : fields) { if (!Modifier.isStatic(field.getModifiers())) { list.add(field); } } return list; }
[ "public", "static", "List", "<", "Field", ">", "getAllFields", "(", "Class", "<", "?", ">", "clas", ")", "{", "JK", ".", "fixMe", "(", "\"add caching..\"", ")", ";", "List", "<", "Field", ">", "list", "=", "new", "Vector", "<>", "(", ")", ";", "// ...
Gets the all fields. @param clas the clas @return the all fields
[ "Gets", "the", "all", "fields", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L871-L885
train
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.createInstanceForGenericClass
public static <T> T createInstanceForGenericClass(Object parent) { try { Object instance = getGenericClassFromParent(parent).newInstance(); return (T) instance; } catch (InstantiationException | IllegalAccessException e) { JK.throww(e); } return null; }
java
public static <T> T createInstanceForGenericClass(Object parent) { try { Object instance = getGenericClassFromParent(parent).newInstance(); return (T) instance; } catch (InstantiationException | IllegalAccessException e) { JK.throww(e); } return null; }
[ "public", "static", "<", "T", ">", "T", "createInstanceForGenericClass", "(", "Object", "parent", ")", "{", "try", "{", "Object", "instance", "=", "getGenericClassFromParent", "(", "parent", ")", ".", "newInstance", "(", ")", ";", "return", "(", "T", ")", ...
Creates the instance for generic class. @param <T> the generic type @param parent the parent @return the t
[ "Creates", "the", "instance", "for", "generic", "class", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L894-L902
train