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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wealthfront/kawala | kawala-hibernate/src/main/java/com/kaching/platform/hibernate/types/AbstractImmutableType.java | AbstractImmutableType.assemble | public final Object assemble(Serializable cached, Object owner)
throws HibernateException {
if (cached != null) {
log.trace("assemble " + cached + " (" + cached.getClass() + "), owner is " + owner);
}
return cached;
} | java | public final Object assemble(Serializable cached, Object owner)
throws HibernateException {
if (cached != null) {
log.trace("assemble " + cached + " (" + cached.getClass() + "), owner is " + owner);
}
return cached;
} | [
"public",
"final",
"Object",
"assemble",
"(",
"Serializable",
"cached",
",",
"Object",
"owner",
")",
"throws",
"HibernateException",
"{",
"if",
"(",
"cached",
"!=",
"null",
")",
"{",
"log",
".",
"trace",
"(",
"\"assemble \"",
"+",
"cached",
"+",
"\" (\"",
... | Returns the cached value. | [
"Returns",
"the",
"cached",
"value",
"."
] | acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e | https://github.com/wealthfront/kawala/blob/acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e/kawala-hibernate/src/main/java/com/kaching/platform/hibernate/types/AbstractImmutableType.java#L80-L86 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsServiceProxy.java | LcdsServiceProxy.createGroupFinderLobby | public LobbyStatus createGroupFinderLobby(int type, String uuid) {
return client.sendRpcAndWait(SERVICE, "createGroupFinderLobby", type, uuid);
} | java | public LobbyStatus createGroupFinderLobby(int type, String uuid) {
return client.sendRpcAndWait(SERVICE, "createGroupFinderLobby", type, uuid);
} | [
"public",
"LobbyStatus",
"createGroupFinderLobby",
"(",
"int",
"type",
",",
"String",
"uuid",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"createGroupFinderLobby\"",
",",
"type",
",",
"uuid",
")",
";",
"}"
] | Create a group finder lobby. Might be deprecated?
@param type unknown - The queue type?
@param uuid A unique id for the team
@return The lobby status of the group finder lobby | [
"Create",
"a",
"group",
"finder",
"lobby",
".",
"Might",
"be",
"deprecated?"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsServiceProxy.java#L40-L42 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsServiceProxy.java | LcdsServiceProxy.call | public Object call(String uuid, GameMode mode, String procCall, JsonObject object) {
return client.sendRpcAndWait(SERVICE, "call", uuid, mode.name(), procCall, object.toString());
} | java | public Object call(String uuid, GameMode mode, String procCall, JsonObject object) {
return client.sendRpcAndWait(SERVICE, "call", uuid, mode.name(), procCall, object.toString());
} | [
"public",
"Object",
"call",
"(",
"String",
"uuid",
",",
"GameMode",
"mode",
",",
"String",
"procCall",
",",
"JsonObject",
"object",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"call\"",
",",
"uuid",
",",
"mode",
".",
"name",... | Call a group finder action
@param uuid The uuid of the team
@param mode The game mode of lobby
@param procCall The name of the action
@param object Call args
@return unknown | [
"Call",
"a",
"group",
"finder",
"action"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsServiceProxy.java#L52-L54 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLQuery.java | OSQLQuery.run | @SuppressWarnings("unchecked")
public List<T> run(final Object... iArgs) {
final ODatabaseRecord database = ODatabaseRecordThreadLocal.INSTANCE.get();
if (database == null)
throw new OQueryParsingException("No database configured");
setParameters(iArgs);
return (List<T>) database.getStorage().command(this);
} | java | @SuppressWarnings("unchecked")
public List<T> run(final Object... iArgs) {
final ODatabaseRecord database = ODatabaseRecordThreadLocal.INSTANCE.get();
if (database == null)
throw new OQueryParsingException("No database configured");
setParameters(iArgs);
return (List<T>) database.getStorage().command(this);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"List",
"<",
"T",
">",
"run",
"(",
"final",
"Object",
"...",
"iArgs",
")",
"{",
"final",
"ODatabaseRecord",
"database",
"=",
"ODatabaseRecordThreadLocal",
".",
"INSTANCE",
".",
"get",
"(",
")",
";... | Delegates to the OQueryExecutor the query execution. | [
"Delegates",
"to",
"the",
"OQueryExecutor",
"the",
"query",
"execution",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLQuery.java#L61-L69 | train |
dmfs/jdav | src/org/dmfs/dav/rfc6352/AddressbookQuery.java | AddressbookQuery.limitNumberOfResults | public AddressbookQuery limitNumberOfResults(int limit)
{
if (limit > 0)
{
addLimit(WebDavSearch.NRESULTS, limit);
}
else
{
removeLimit(WebDavSearch.NRESULTS);
}
return this;
} | java | public AddressbookQuery limitNumberOfResults(int limit)
{
if (limit > 0)
{
addLimit(WebDavSearch.NRESULTS, limit);
}
else
{
removeLimit(WebDavSearch.NRESULTS);
}
return this;
} | [
"public",
"AddressbookQuery",
"limitNumberOfResults",
"(",
"int",
"limit",
")",
"{",
"if",
"(",
"limit",
">",
"0",
")",
"{",
"addLimit",
"(",
"WebDavSearch",
".",
"NRESULTS",
",",
"limit",
")",
";",
"}",
"else",
"{",
"removeLimit",
"(",
"WebDavSearch",
"."... | Limit the number of results in the response, if supported by the server. A negative value will remove the limit.
@param limit
The maximum number of result in the response if this is a positive integer.
@return This instance. | [
"Limit",
"the",
"number",
"of",
"results",
"in",
"the",
"response",
"if",
"supported",
"by",
"the",
"server",
".",
"A",
"negative",
"value",
"will",
"remove",
"the",
"limit",
"."
] | a619d85423210a283b3eb1fba9abda4fdc894969 | https://github.com/dmfs/jdav/blob/a619d85423210a283b3eb1fba9abda4fdc894969/src/org/dmfs/dav/rfc6352/AddressbookQuery.java#L145-L156 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/db/ODatabasePoolAbstract.java | ODatabasePoolAbstract.close | public void close() {
for (Entry<String, OResourcePool<String, DB>> pool : pools.entrySet()) {
for (DB db : pool.getValue().getResources()) {
pool.getValue().close();
try {
OLogManager.instance().debug(this, "Closing pooled database '%s'...", db.getName());
((ODatabasePooled) db).forceClose();
OLogManager.instance().debug(this, "OK", db.getName());
} catch (Exception e) {
OLogManager.instance().debug(this, "Error: %d", e.toString());
}
}
}
} | java | public void close() {
for (Entry<String, OResourcePool<String, DB>> pool : pools.entrySet()) {
for (DB db : pool.getValue().getResources()) {
pool.getValue().close();
try {
OLogManager.instance().debug(this, "Closing pooled database '%s'...", db.getName());
((ODatabasePooled) db).forceClose();
OLogManager.instance().debug(this, "OK", db.getName());
} catch (Exception e) {
OLogManager.instance().debug(this, "Error: %d", e.toString());
}
}
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"OResourcePool",
"<",
"String",
",",
"DB",
">",
">",
"pool",
":",
"pools",
".",
"entrySet",
"(",
")",
")",
"{",
"for",
"(",
"DB",
"db",
":",
"pool",
".",
"getValue... | Closes all the databases. | [
"Closes",
"all",
"the",
"databases",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/ODatabasePoolAbstract.java#L94-L107 | train |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/collection/OMultiValue.java | OMultiValue.isMultiValue | public static boolean isMultiValue(final Class<?> iType) {
return (iType.isArray() || Collection.class.isAssignableFrom(iType) || Map.class.isAssignableFrom(iType));
} | java | public static boolean isMultiValue(final Class<?> iType) {
return (iType.isArray() || Collection.class.isAssignableFrom(iType) || Map.class.isAssignableFrom(iType));
} | [
"public",
"static",
"boolean",
"isMultiValue",
"(",
"final",
"Class",
"<",
"?",
">",
"iType",
")",
"{",
"return",
"(",
"iType",
".",
"isArray",
"(",
")",
"||",
"Collection",
".",
"class",
".",
"isAssignableFrom",
"(",
"iType",
")",
"||",
"Map",
".",
"c... | Checks if a class is a multi-value type.
@param iType
Class to check
@return true if it's an array, a collection or a map, otherwise false | [
"Checks",
"if",
"a",
"class",
"is",
"a",
"multi",
"-",
"value",
"type",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/collection/OMultiValue.java#L44-L46 | train |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/collection/OMultiValue.java | OMultiValue.getSize | public static int getSize(final Object iObject) {
if (iObject == null)
return 0;
if (!isMultiValue(iObject))
return 0;
if (iObject instanceof Collection<?>)
return ((Collection<Object>) iObject).size();
if (iObject instanceof Map<?, ?>)
return ((Map<?, Object>) iObject).size();
if (iObject.getClass().isArray())
return Array.getLength(iObject);
return 0;
} | java | public static int getSize(final Object iObject) {
if (iObject == null)
return 0;
if (!isMultiValue(iObject))
return 0;
if (iObject instanceof Collection<?>)
return ((Collection<Object>) iObject).size();
if (iObject instanceof Map<?, ?>)
return ((Map<?, Object>) iObject).size();
if (iObject.getClass().isArray())
return Array.getLength(iObject);
return 0;
} | [
"public",
"static",
"int",
"getSize",
"(",
"final",
"Object",
"iObject",
")",
"{",
"if",
"(",
"iObject",
"==",
"null",
")",
"return",
"0",
";",
"if",
"(",
"!",
"isMultiValue",
"(",
"iObject",
")",
")",
"return",
"0",
";",
"if",
"(",
"iObject",
"insta... | Returns the size of the multi-value object
@param iObject
Multi-value object (array, collection or map)
@return the size of the multi value object | [
"Returns",
"the",
"size",
"of",
"the",
"multi",
"-",
"value",
"object"
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/collection/OMultiValue.java#L66-L80 | train |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/thread/OSoftThread.java | OSoftThread.pauseCurrentThread | public static boolean pauseCurrentThread(long iTime) {
try {
if (iTime <= 0)
iTime = Long.MAX_VALUE;
Thread.sleep(iTime);
return true;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
} | java | public static boolean pauseCurrentThread(long iTime) {
try {
if (iTime <= 0)
iTime = Long.MAX_VALUE;
Thread.sleep(iTime);
return true;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
} | [
"public",
"static",
"boolean",
"pauseCurrentThread",
"(",
"long",
"iTime",
")",
"{",
"try",
"{",
"if",
"(",
"iTime",
"<=",
"0",
")",
"iTime",
"=",
"Long",
".",
"MAX_VALUE",
";",
"Thread",
".",
"sleep",
"(",
"iTime",
")",
";",
"return",
"true",
";",
"... | Pauses current thread until iTime timeout or a wake up by another thread.
@param iTime
@return true if timeout has reached, otherwise false. False is the case of wake-up by another thread. | [
"Pauses",
"current",
"thread",
"until",
"iTime",
"timeout",
"or",
"a",
"wake",
"up",
"by",
"another",
"thread",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/thread/OSoftThread.java#L63-L74 | train |
amsa-code/risky | geotools-extras/src/main/java/au/gov/amsa/gt/Shapes.java | Shapes.containing | public Stream<String> containing(double lat, double lon) {
return shapes.keySet().stream()
// select if contains lat lon
.filter(name -> shapes.get(name).contains(lat, lon));
} | java | public Stream<String> containing(double lat, double lon) {
return shapes.keySet().stream()
// select if contains lat lon
.filter(name -> shapes.get(name).contains(lat, lon));
} | [
"public",
"Stream",
"<",
"String",
">",
"containing",
"(",
"double",
"lat",
",",
"double",
"lon",
")",
"{",
"return",
"shapes",
".",
"keySet",
"(",
")",
".",
"stream",
"(",
")",
"// select if contains lat lon",
".",
"filter",
"(",
"name",
"->",
"shapes",
... | Returns the names of those shapes that contain the given lat, lon.
@param lat
@param lon
@return | [
"Returns",
"the",
"names",
"of",
"those",
"shapes",
"that",
"contain",
"the",
"given",
"lat",
"lon",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/geotools-extras/src/main/java/au/gov/amsa/gt/Shapes.java#L58-L62 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/query/OQueryAbstract.java | OQueryAbstract.setFetchPlan | public OQuery<T> setFetchPlan(final String fetchPlan) {
OFetchHelper.checkFetchPlanValid(fetchPlan);
if (fetchPlan != null && fetchPlan.length() == 0)
this.fetchPlan = null;
else
this.fetchPlan = fetchPlan;
return this;
} | java | public OQuery<T> setFetchPlan(final String fetchPlan) {
OFetchHelper.checkFetchPlanValid(fetchPlan);
if (fetchPlan != null && fetchPlan.length() == 0)
this.fetchPlan = null;
else
this.fetchPlan = fetchPlan;
return this;
} | [
"public",
"OQuery",
"<",
"T",
">",
"setFetchPlan",
"(",
"final",
"String",
"fetchPlan",
")",
"{",
"OFetchHelper",
".",
"checkFetchPlanValid",
"(",
"fetchPlan",
")",
";",
"if",
"(",
"fetchPlan",
"!=",
"null",
"&&",
"fetchPlan",
".",
"length",
"(",
")",
"=="... | Sets the fetch plan to use. | [
"Sets",
"the",
"fetch",
"plan",
"to",
"use",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/query/OQueryAbstract.java#L43-L50 | train |
lkoskela/beaninject | src/main/java/org/laughingpanda/beaninject/Inject.java | Inject.field | public static ITargetIdentifier field(final String fieldName) {
return new ITargetIdentifier() {
public IDependencyInjector of(final Object target) {
return new FieldInjector(target, fieldName);
}
};
} | java | public static ITargetIdentifier field(final String fieldName) {
return new ITargetIdentifier() {
public IDependencyInjector of(final Object target) {
return new FieldInjector(target, fieldName);
}
};
} | [
"public",
"static",
"ITargetIdentifier",
"field",
"(",
"final",
"String",
"fieldName",
")",
"{",
"return",
"new",
"ITargetIdentifier",
"(",
")",
"{",
"public",
"IDependencyInjector",
"of",
"(",
"final",
"Object",
"target",
")",
"{",
"return",
"new",
"FieldInject... | Returns a target identifier that uses an injector that injects directly
to a member field regardless of the field's visibility.
@param fieldName
The name of the field to inject. | [
"Returns",
"a",
"target",
"identifier",
"that",
"uses",
"an",
"injector",
"that",
"injects",
"directly",
"to",
"a",
"member",
"field",
"regardless",
"of",
"the",
"field",
"s",
"visibility",
"."
] | 6a63e76bdfbc6953cf582380f42170fc2512c483 | https://github.com/lkoskela/beaninject/blob/6a63e76bdfbc6953cf582380f42170fc2512c483/src/main/java/org/laughingpanda/beaninject/Inject.java#L52-L58 | train |
lkoskela/beaninject | src/main/java/org/laughingpanda/beaninject/Inject.java | Inject.with | public static ITargetInjector with(final IInjectionStrategy strategy) {
return new ITargetInjector() {
public void bean(Object target) {
strategy.inject(target);
}
};
} | java | public static ITargetInjector with(final IInjectionStrategy strategy) {
return new ITargetInjector() {
public void bean(Object target) {
strategy.inject(target);
}
};
} | [
"public",
"static",
"ITargetInjector",
"with",
"(",
"final",
"IInjectionStrategy",
"strategy",
")",
"{",
"return",
"new",
"ITargetInjector",
"(",
")",
"{",
"public",
"void",
"bean",
"(",
"Object",
"target",
")",
"{",
"strategy",
".",
"inject",
"(",
"target",
... | Returns an injector implementation which delegates actual injection to
the given strategy when provided with a target to inject.
@param strategy
The injection strategy. | [
"Returns",
"an",
"injector",
"implementation",
"which",
"delegates",
"actual",
"injection",
"to",
"the",
"given",
"strategy",
"when",
"provided",
"with",
"a",
"target",
"to",
"inject",
"."
] | 6a63e76bdfbc6953cf582380f42170fc2512c483 | https://github.com/lkoskela/beaninject/blob/6a63e76bdfbc6953cf582380f42170fc2512c483/src/main/java/org/laughingpanda/beaninject/Inject.java#L133-L139 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/query/nativ/OQueryContextNative.java | OQueryContextNative.key | public OQueryContextNative key(final Object iKey) {
if (finalResult != null && finalResult.booleanValue())
return this;
if (iKey == null)
// ERROR: BREAK CHAIN
return error();
if (currentValue != null && currentValue instanceof Map)
currentValue = ((Map<Object, Object>) currentValue).get(iKey);
return this;
} | java | public OQueryContextNative key(final Object iKey) {
if (finalResult != null && finalResult.booleanValue())
return this;
if (iKey == null)
// ERROR: BREAK CHAIN
return error();
if (currentValue != null && currentValue instanceof Map)
currentValue = ((Map<Object, Object>) currentValue).get(iKey);
return this;
} | [
"public",
"OQueryContextNative",
"key",
"(",
"final",
"Object",
"iKey",
")",
"{",
"if",
"(",
"finalResult",
"!=",
"null",
"&&",
"finalResult",
".",
"booleanValue",
"(",
")",
")",
"return",
"this",
";",
"if",
"(",
"iKey",
"==",
"null",
")",
"// ERROR: BREAK... | Sets as current value the map's value by key.
@param iKey
Key to use for the lookup
@return This object to allow fluent expressions in chain. | [
"Sets",
"as",
"current",
"value",
"the",
"map",
"s",
"value",
"by",
"key",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/query/nativ/OQueryContextNative.java#L68-L80 | train |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/synch/OSynchEventAdapter.java | OSynchEventAdapter.getValue | public synchronized RESPONSE_TYPE getValue(final RESOURCE_TYPE iResource, final long iTimeout) {
if (OLogManager.instance().isDebugEnabled())
OLogManager.instance().debug(
this,
"Thread [" + Thread.currentThread().getId() + "] is waiting for the resource " + iResource
+ (iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms"));
synchronized (iResource) {
try {
iResource.wait(iTimeout);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new OLockException("Thread interrupted while waiting for resource '" + iResource + "'");
}
}
Object[] value = queue.remove(iResource);
return (RESPONSE_TYPE) (value != null ? value[1] : null);
} | java | public synchronized RESPONSE_TYPE getValue(final RESOURCE_TYPE iResource, final long iTimeout) {
if (OLogManager.instance().isDebugEnabled())
OLogManager.instance().debug(
this,
"Thread [" + Thread.currentThread().getId() + "] is waiting for the resource " + iResource
+ (iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms"));
synchronized (iResource) {
try {
iResource.wait(iTimeout);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new OLockException("Thread interrupted while waiting for resource '" + iResource + "'");
}
}
Object[] value = queue.remove(iResource);
return (RESPONSE_TYPE) (value != null ? value[1] : null);
} | [
"public",
"synchronized",
"RESPONSE_TYPE",
"getValue",
"(",
"final",
"RESOURCE_TYPE",
"iResource",
",",
"final",
"long",
"iTimeout",
")",
"{",
"if",
"(",
"OLogManager",
".",
"instance",
"(",
")",
".",
"isDebugEnabled",
"(",
")",
")",
"OLogManager",
".",
"insta... | Wait until the requested resource is unlocked. Put the current thread in sleep until timeout or is waked up by an unlock. | [
"Wait",
"until",
"the",
"requested",
"resource",
"is",
"unlocked",
".",
"Put",
"the",
"current",
"thread",
"in",
"sleep",
"until",
"timeout",
"or",
"is",
"waked",
"up",
"by",
"an",
"unlock",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/synch/OSynchEventAdapter.java#L32-L51 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/entity/OEntityManager.java | OEntityManager.setClassHandler | public synchronized void setClassHandler(final OEntityManagerClassHandler iClassHandler) {
for (Entry<String, Class<?>> entry : classHandler.getClassesEntrySet()) {
iClassHandler.registerEntityClass(entry.getValue());
}
this.classHandler = iClassHandler;
} | java | public synchronized void setClassHandler(final OEntityManagerClassHandler iClassHandler) {
for (Entry<String, Class<?>> entry : classHandler.getClassesEntrySet()) {
iClassHandler.registerEntityClass(entry.getValue());
}
this.classHandler = iClassHandler;
} | [
"public",
"synchronized",
"void",
"setClassHandler",
"(",
"final",
"OEntityManagerClassHandler",
"iClassHandler",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"entry",
":",
"classHandler",
".",
"getClassesEntrySet",
"(",
")",
... | Sets the received handler as default and merges the classes all together.
@param iClassHandler | [
"Sets",
"the",
"received",
"handler",
"as",
"default",
"and",
"merges",
"the",
"classes",
"all",
"together",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/entity/OEntityManager.java#L143-L148 | train |
jpkrohling/secret-store | secret-store/src/main/java/org/keycloak/secretstore/boundary/TokenEndpoint.java | TokenEndpoint.createFromRedirect | @GET
@Path("create")
public Response createFromRedirect() {
KeycloakPrincipal principal = (KeycloakPrincipal) sessionContext.getCallerPrincipal();
RefreshableKeycloakSecurityContext kcSecurityContext = (RefreshableKeycloakSecurityContext)
principal.getKeycloakSecurityContext();
String refreshToken = kcSecurityContext.getRefreshToken();
Token token = create(refreshToken);
try {
String redirectTo = System.getProperty("secretstore.redirectTo");
if (null == redirectTo || redirectTo.isEmpty()) {
return Response.ok("Redirect URL was not specified but token was created.").build();
}
URI location;
if (redirectTo.toLowerCase().startsWith("http")) {
location = new URI(redirectTo);
} else {
URI uri = uriInfo.getAbsolutePath();
String newPath = redirectTo.replace("{tokenId}", token.getId().toString());
location = new URI(
uri.getScheme(),
uri.getUserInfo(),
uri.getHost(),
uri.getPort(),
newPath,
uri.getQuery(),
uri.getFragment()
);
}
return Response.seeOther(location).build();
} catch (URISyntaxException e) {
e.printStackTrace();
return Response.ok("Could not redirect back to the original URL, but token was created.").build();
}
} | java | @GET
@Path("create")
public Response createFromRedirect() {
KeycloakPrincipal principal = (KeycloakPrincipal) sessionContext.getCallerPrincipal();
RefreshableKeycloakSecurityContext kcSecurityContext = (RefreshableKeycloakSecurityContext)
principal.getKeycloakSecurityContext();
String refreshToken = kcSecurityContext.getRefreshToken();
Token token = create(refreshToken);
try {
String redirectTo = System.getProperty("secretstore.redirectTo");
if (null == redirectTo || redirectTo.isEmpty()) {
return Response.ok("Redirect URL was not specified but token was created.").build();
}
URI location;
if (redirectTo.toLowerCase().startsWith("http")) {
location = new URI(redirectTo);
} else {
URI uri = uriInfo.getAbsolutePath();
String newPath = redirectTo.replace("{tokenId}", token.getId().toString());
location = new URI(
uri.getScheme(),
uri.getUserInfo(),
uri.getHost(),
uri.getPort(),
newPath,
uri.getQuery(),
uri.getFragment()
);
}
return Response.seeOther(location).build();
} catch (URISyntaxException e) {
e.printStackTrace();
return Response.ok("Could not redirect back to the original URL, but token was created.").build();
}
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"create\"",
")",
"public",
"Response",
"createFromRedirect",
"(",
")",
"{",
"KeycloakPrincipal",
"principal",
"=",
"(",
"KeycloakPrincipal",
")",
"sessionContext",
".",
"getCallerPrincipal",
"(",
")",
";",
"RefreshableKeycloakSecurity... | This endpoint is called when Keycloak redirects the logged in user to our application.
@return a response with a TokenCreateResponse as entity. | [
"This",
"endpoint",
"is",
"called",
"when",
"Keycloak",
"redirects",
"the",
"logged",
"in",
"user",
"to",
"our",
"application",
"."
] | f136ea6286a6919cc767d0b4a5e84f333c33f483 | https://github.com/jpkrohling/secret-store/blob/f136ea6286a6919cc767d0b4a5e84f333c33f483/secret-store/src/main/java/org/keycloak/secretstore/boundary/TokenEndpoint.java#L118-L156 | train |
jpkrohling/secret-store | secret-store/src/main/java/org/keycloak/secretstore/boundary/TokenEndpoint.java | TokenEndpoint.createFromBasicAuth | @POST
@Path("create")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response createFromBasicAuth() throws Exception {
return doCreateFromBasicAuth(null);
} | java | @POST
@Path("create")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response createFromBasicAuth() throws Exception {
return doCreateFromBasicAuth(null);
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"create\"",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_FORM_URLENCODED",
")",
"public",
"Response",
"createFromBasicAuth",
"(",
")",
"throws",
"Exception",
"{",
"return",
"doCreateFromBasicAuth",
"(",
"null",
")",
... | This endpoint is called when a client makes a REST call with basic auth as APPLICATION_FORM_URLENCODED, without
parameters.
@return a response with a TokenCreateResponse as entity | [
"This",
"endpoint",
"is",
"called",
"when",
"a",
"client",
"makes",
"a",
"REST",
"call",
"with",
"basic",
"auth",
"as",
"APPLICATION_FORM_URLENCODED",
"without",
"parameters",
"."
] | f136ea6286a6919cc767d0b4a5e84f333c33f483 | https://github.com/jpkrohling/secret-store/blob/f136ea6286a6919cc767d0b4a5e84f333c33f483/secret-store/src/main/java/org/keycloak/secretstore/boundary/TokenEndpoint.java#L164-L169 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/config/OStorageConfiguration.java | OStorageConfiguration.load | public OStorageConfiguration load() throws OSerializationException {
final byte[] record = storage.readRecord(CONFIG_RID, null, false, null).buffer;
if (record == null)
throw new OStorageException("Cannot load database's configuration. The database seems to be corrupted.");
fromStream(record);
return this;
} | java | public OStorageConfiguration load() throws OSerializationException {
final byte[] record = storage.readRecord(CONFIG_RID, null, false, null).buffer;
if (record == null)
throw new OStorageException("Cannot load database's configuration. The database seems to be corrupted.");
fromStream(record);
return this;
} | [
"public",
"OStorageConfiguration",
"load",
"(",
")",
"throws",
"OSerializationException",
"{",
"final",
"byte",
"[",
"]",
"record",
"=",
"storage",
".",
"readRecord",
"(",
"CONFIG_RID",
",",
"null",
",",
"false",
",",
"null",
")",
".",
"buffer",
";",
"if",
... | This method load the record information by the internal cluster segment. It's for compatibility with older database than
0.9.25.
@param iRequesterId
@compatibility 0.9.25
@return
@throws OSerializationException | [
"This",
"method",
"load",
"the",
"record",
"information",
"by",
"the",
"internal",
"cluster",
"segment",
".",
"It",
"s",
"for",
"compatibility",
"with",
"older",
"database",
"than",
"0",
".",
"9",
".",
"25",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/config/OStorageConfiguration.java#L89-L97 | train |
wealthfront/kawala | kawala-common/src/main/java/com/kaching/platform/common/Option.java | Option.some | public static <T> Option<T> some(T t) {
return new Option.Some<T>(t);
} | java | public static <T> Option<T> some(T t) {
return new Option.Some<T>(t);
} | [
"public",
"static",
"<",
"T",
">",
"Option",
"<",
"T",
">",
"some",
"(",
"T",
"t",
")",
"{",
"return",
"new",
"Option",
".",
"Some",
"<",
"T",
">",
"(",
"t",
")",
";",
"}"
] | Gets the some object wrapping the given value. | [
"Gets",
"the",
"some",
"object",
"wrapping",
"the",
"given",
"value",
"."
] | acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e | https://github.com/wealthfront/kawala/blob/acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e/kawala-common/src/main/java/com/kaching/platform/common/Option.java#L292-L294 | train |
wealthfront/kawala | kawala-common/src/main/java/com/kaching/platform/common/Option.java | Option.of | public static <T> Option<T> of(T t) {
return t == null ? Option.<T>none() : some(t);
} | java | public static <T> Option<T> of(T t) {
return t == null ? Option.<T>none() : some(t);
} | [
"public",
"static",
"<",
"T",
">",
"Option",
"<",
"T",
">",
"of",
"(",
"T",
"t",
")",
"{",
"return",
"t",
"==",
"null",
"?",
"Option",
".",
"<",
"T",
">",
"none",
"(",
")",
":",
"some",
"(",
"t",
")",
";",
"}"
] | Wraps anything.
@param <T>
@param t
@return if null, none(), some(t) otherwise | [
"Wraps",
"anything",
"."
] | acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e | https://github.com/wealthfront/kawala/blob/acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e/kawala-common/src/main/java/com/kaching/platform/common/Option.java#L303-L305 | train |
dmfs/jdav | src/org/dmfs/dav/PropertyRequest.java | PropertyRequest.addProperty | public PropertyRequest addProperty(ElementDescriptor<?> property)
{
if (mProp == null)
{
mProp = new HashMap<ElementDescriptor<?>, Object>(16);
}
mProp.put(property, null);
return this;
} | java | public PropertyRequest addProperty(ElementDescriptor<?> property)
{
if (mProp == null)
{
mProp = new HashMap<ElementDescriptor<?>, Object>(16);
}
mProp.put(property, null);
return this;
} | [
"public",
"PropertyRequest",
"addProperty",
"(",
"ElementDescriptor",
"<",
"?",
">",
"property",
")",
"{",
"if",
"(",
"mProp",
"==",
"null",
")",
"{",
"mProp",
"=",
"new",
"HashMap",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Object",
">",
"(",
"16",... | Add another property to the list of requested properties.
@param property
The property to request from the server.
@return This instance. | [
"Add",
"another",
"property",
"to",
"the",
"list",
"of",
"requested",
"properties",
"."
] | a619d85423210a283b3eb1fba9abda4fdc894969 | https://github.com/dmfs/jdav/blob/a619d85423210a283b3eb1fba9abda4fdc894969/src/org/dmfs/dav/PropertyRequest.java#L49-L57 | train |
lightblue-platform/lightblue-migrator | jiff/src/main/java/jiff/JsonDiff.java | JsonDiff.setOption | public void setOption(Option option) {
switch (option) {
case ARRAY_ORDER_SIGNIFICANT:
arrayComparator = new DefaultArrayNodeComparator();
break;
case ARRAY_ORDER_INSIGNIFICANT:
arrayComparator = new SetArrayNodeComparator();
break;
case RETURN_PARENT_DIFFS:
returnParentDiffs = true;
break;
case RETURN_LEAVES_ONLY:
returnParentDiffs = false;
break;
}
} | java | public void setOption(Option option) {
switch (option) {
case ARRAY_ORDER_SIGNIFICANT:
arrayComparator = new DefaultArrayNodeComparator();
break;
case ARRAY_ORDER_INSIGNIFICANT:
arrayComparator = new SetArrayNodeComparator();
break;
case RETURN_PARENT_DIFFS:
returnParentDiffs = true;
break;
case RETURN_LEAVES_ONLY:
returnParentDiffs = false;
break;
}
} | [
"public",
"void",
"setOption",
"(",
"Option",
"option",
")",
"{",
"switch",
"(",
"option",
")",
"{",
"case",
"ARRAY_ORDER_SIGNIFICANT",
":",
"arrayComparator",
"=",
"new",
"DefaultArrayNodeComparator",
"(",
")",
";",
"break",
";",
"case",
"ARRAY_ORDER_INSIGNIFICAN... | Sets an option | [
"Sets",
"an",
"option"
] | ec20748557b40d1f7851e1816d1b76dae48d2027 | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/jiff/src/main/java/jiff/JsonDiff.java#L340-L356 | train |
lightblue-platform/lightblue-migrator | jiff/src/main/java/jiff/JsonDiff.java | JsonDiff.computeDiff | public List<JsonDelta> computeDiff(String node1, String node2) throws IOException {
ObjectMapper mapper = new ObjectMapper();
return computeDiff(mapper.readTree(node1), mapper.readTree(node2));
} | java | public List<JsonDelta> computeDiff(String node1, String node2) throws IOException {
ObjectMapper mapper = new ObjectMapper();
return computeDiff(mapper.readTree(node1), mapper.readTree(node2));
} | [
"public",
"List",
"<",
"JsonDelta",
">",
"computeDiff",
"(",
"String",
"node1",
",",
"String",
"node2",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"return",
"computeDiff",
"(",
"mapper",
".",
"read... | Computes the difference of two JSON strings, and returns the differences | [
"Computes",
"the",
"difference",
"of",
"two",
"JSON",
"strings",
"and",
"returns",
"the",
"differences"
] | ec20748557b40d1f7851e1816d1b76dae48d2027 | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/jiff/src/main/java/jiff/JsonDiff.java#L368-L371 | train |
lightblue-platform/lightblue-migrator | jiff/src/main/java/jiff/JsonDiff.java | JsonDiff.computeDiff | public List<JsonDelta> computeDiff(JsonNode node1, JsonNode node2) {
List<JsonDelta> list = new ArrayList<>();
computeDiff(list, new ArrayList<String>(), node1, node2);
return list;
} | java | public List<JsonDelta> computeDiff(JsonNode node1, JsonNode node2) {
List<JsonDelta> list = new ArrayList<>();
computeDiff(list, new ArrayList<String>(), node1, node2);
return list;
} | [
"public",
"List",
"<",
"JsonDelta",
">",
"computeDiff",
"(",
"JsonNode",
"node1",
",",
"JsonNode",
"node2",
")",
"{",
"List",
"<",
"JsonDelta",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"computeDiff",
"(",
"list",
",",
"new",
"ArrayList"... | Computes the difference of two JSON nodes and returns the differences | [
"Computes",
"the",
"difference",
"of",
"two",
"JSON",
"nodes",
"and",
"returns",
"the",
"differences"
] | ec20748557b40d1f7851e1816d1b76dae48d2027 | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/jiff/src/main/java/jiff/JsonDiff.java#L376-L380 | train |
lightblue-platform/lightblue-migrator | jiff/src/main/java/jiff/JsonDiff.java | JsonDiff.computeDiff | public boolean computeDiff(List<JsonDelta> delta, List<String> context, JsonNode node1, JsonNode node2) {
boolean ret = false;
if (context.size() == 0 || filter.includeField(context)) {
JsonComparator cmp = getComparator(context, node1, node2);
if (cmp != null) {
ret = cmp.compare(delta, context, node1, node2);
} else {
delta.add(new JsonDelta(toString(context), node1, node2));
ret = true;
}
}
return ret;
} | java | public boolean computeDiff(List<JsonDelta> delta, List<String> context, JsonNode node1, JsonNode node2) {
boolean ret = false;
if (context.size() == 0 || filter.includeField(context)) {
JsonComparator cmp = getComparator(context, node1, node2);
if (cmp != null) {
ret = cmp.compare(delta, context, node1, node2);
} else {
delta.add(new JsonDelta(toString(context), node1, node2));
ret = true;
}
}
return ret;
} | [
"public",
"boolean",
"computeDiff",
"(",
"List",
"<",
"JsonDelta",
">",
"delta",
",",
"List",
"<",
"String",
">",
"context",
",",
"JsonNode",
"node1",
",",
"JsonNode",
"node2",
")",
"{",
"boolean",
"ret",
"=",
"false",
";",
"if",
"(",
"context",
".",
"... | Returns true if there is a difference | [
"Returns",
"true",
"if",
"there",
"is",
"a",
"difference"
] | ec20748557b40d1f7851e1816d1b76dae48d2027 | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/jiff/src/main/java/jiff/JsonDiff.java#L385-L397 | train |
lightblue-platform/lightblue-migrator | jiff/src/main/java/jiff/JsonDiff.java | JsonDiff.getComparator | public JsonComparator getComparator(List<String> context,
JsonNode node1,
JsonNode node2) {
if (node1 == null) {
if (node2 == null) {
return NODIFF_CMP;
} else {
return null;
}
} else if (node2 == null) {
return null;
} else {
if (node1 instanceof NullNode) {
if (node2 instanceof NullNode) {
return NODIFF_CMP;
} else {
return null;
}
} else if (node2 instanceof NullNode) {
return null;
}
// Nodes are not null, and they are not null node
if (node1.isContainerNode() && node2.isContainerNode()) {
if (node1 instanceof ObjectNode) {
return objectComparator;
} else if (node1 instanceof ArrayNode) {
return arrayComparator;
}
} else if (node1.isValueNode() && node2.isValueNode()) {
return valueComparator;
}
}
return null;
} | java | public JsonComparator getComparator(List<String> context,
JsonNode node1,
JsonNode node2) {
if (node1 == null) {
if (node2 == null) {
return NODIFF_CMP;
} else {
return null;
}
} else if (node2 == null) {
return null;
} else {
if (node1 instanceof NullNode) {
if (node2 instanceof NullNode) {
return NODIFF_CMP;
} else {
return null;
}
} else if (node2 instanceof NullNode) {
return null;
}
// Nodes are not null, and they are not null node
if (node1.isContainerNode() && node2.isContainerNode()) {
if (node1 instanceof ObjectNode) {
return objectComparator;
} else if (node1 instanceof ArrayNode) {
return arrayComparator;
}
} else if (node1.isValueNode() && node2.isValueNode()) {
return valueComparator;
}
}
return null;
} | [
"public",
"JsonComparator",
"getComparator",
"(",
"List",
"<",
"String",
">",
"context",
",",
"JsonNode",
"node1",
",",
"JsonNode",
"node2",
")",
"{",
"if",
"(",
"node1",
"==",
"null",
")",
"{",
"if",
"(",
"node2",
"==",
"null",
")",
"{",
"return",
"NO... | Returns the comparator for the give field, and nodes. This method can be
overriden to customize comparison logic. | [
"Returns",
"the",
"comparator",
"for",
"the",
"give",
"field",
"and",
"nodes",
".",
"This",
"method",
"can",
"be",
"overriden",
"to",
"customize",
"comparison",
"logic",
"."
] | ec20748557b40d1f7851e1816d1b76dae48d2027 | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/jiff/src/main/java/jiff/JsonDiff.java#L403-L436 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsGameInvitationService.java | LcdsGameInvitationService.createGroupFinderLobby | public LobbyStatus createGroupFinderLobby(long queueId, String uuid) {
return client.sendRpcAndWait(SERVICE, "createGroupFinderLobby", queueId, uuid);
} | java | public LobbyStatus createGroupFinderLobby(long queueId, String uuid) {
return client.sendRpcAndWait(SERVICE, "createGroupFinderLobby", queueId, uuid);
} | [
"public",
"LobbyStatus",
"createGroupFinderLobby",
"(",
"long",
"queueId",
",",
"String",
"uuid",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"createGroupFinderLobby\"",
",",
"queueId",
",",
"uuid",
")",
";",
"}"
] | Create a groupfinder lobby
@param queueId The target queue
@param uuid The uuid for this lobby
@return The lobby status | [
"Create",
"a",
"groupfinder",
"lobby"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsGameInvitationService.java#L40-L42 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapBufferEntry.java | OMMapBufferEntry.flush | boolean flush() {
if (!dirty)
return true;
acquireExclusiveLock();
try {
final long timer = OProfiler.getInstance().startChrono();
// FORCE THE WRITE OF THE BUFFER
for (int i = 0; i < FORCE_RETRY; ++i) {
try {
buffer.force();
dirty = false;
break;
} catch (Exception e) {
OLogManager.instance().debug(this,
"Cannot write memory buffer to disk. Retrying (" + (i + 1) + "/" + FORCE_RETRY + ")...");
OMemoryWatchDog.freeMemory(FORCE_DELAY);
}
}
if (dirty)
OLogManager.instance().debug(this, "Cannot commit memory buffer to disk after %d retries", FORCE_RETRY);
else
OProfiler.getInstance().updateCounter("system.file.mmap.pagesCommitted", 1);
OProfiler.getInstance().stopChrono("system.file.mmap.commitPages", timer);
return !dirty;
} finally {
releaseExclusiveLock();
}
} | java | boolean flush() {
if (!dirty)
return true;
acquireExclusiveLock();
try {
final long timer = OProfiler.getInstance().startChrono();
// FORCE THE WRITE OF THE BUFFER
for (int i = 0; i < FORCE_RETRY; ++i) {
try {
buffer.force();
dirty = false;
break;
} catch (Exception e) {
OLogManager.instance().debug(this,
"Cannot write memory buffer to disk. Retrying (" + (i + 1) + "/" + FORCE_RETRY + ")...");
OMemoryWatchDog.freeMemory(FORCE_DELAY);
}
}
if (dirty)
OLogManager.instance().debug(this, "Cannot commit memory buffer to disk after %d retries", FORCE_RETRY);
else
OProfiler.getInstance().updateCounter("system.file.mmap.pagesCommitted", 1);
OProfiler.getInstance().stopChrono("system.file.mmap.commitPages", timer);
return !dirty;
} finally {
releaseExclusiveLock();
}
} | [
"boolean",
"flush",
"(",
")",
"{",
"if",
"(",
"!",
"dirty",
")",
"return",
"true",
";",
"acquireExclusiveLock",
"(",
")",
";",
"try",
"{",
"final",
"long",
"timer",
"=",
"OProfiler",
".",
"getInstance",
"(",
")",
".",
"startChrono",
"(",
")",
";",
"/... | Flushes the memory mapped buffer to disk only if it's dirty.
@return true if the buffer has been successfully flushed, otherwise false. | [
"Flushes",
"the",
"memory",
"mapped",
"buffer",
"to",
"disk",
"only",
"if",
"it",
"s",
"dirty",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapBufferEntry.java#L65-L99 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapBufferEntry.java | OMMapBufferEntry.close | void close() {
acquireExclusiveLock();
try {
if (buffer != null) {
if (dirty)
buffer.force();
if (sunClass != null) {
// USE SUN JVM SPECIAL METHOD TO FREE RESOURCES
try {
final Method m = sunClass.getMethod("cleaner");
final Object cleaner = m.invoke(buffer);
cleaner.getClass().getMethod("clean").invoke(cleaner);
} catch (Exception e) {
OLogManager.instance().error(this, "Error on calling Sun's MMap buffer clean", e);
}
}
buffer = null;
}
counter = 0;
file = null;
} finally {
releaseExclusiveLock();
}
} | java | void close() {
acquireExclusiveLock();
try {
if (buffer != null) {
if (dirty)
buffer.force();
if (sunClass != null) {
// USE SUN JVM SPECIAL METHOD TO FREE RESOURCES
try {
final Method m = sunClass.getMethod("cleaner");
final Object cleaner = m.invoke(buffer);
cleaner.getClass().getMethod("clean").invoke(cleaner);
} catch (Exception e) {
OLogManager.instance().error(this, "Error on calling Sun's MMap buffer clean", e);
}
}
buffer = null;
}
counter = 0;
file = null;
} finally {
releaseExclusiveLock();
}
} | [
"void",
"close",
"(",
")",
"{",
"acquireExclusiveLock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"buffer",
"!=",
"null",
")",
"{",
"if",
"(",
"dirty",
")",
"buffer",
".",
"force",
"(",
")",
";",
"if",
"(",
"sunClass",
"!=",
"null",
")",
"{",
"// USE... | Force closing of file if it's opened yet. | [
"Force",
"closing",
"of",
"file",
"if",
"it",
"s",
"opened",
"yet",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapBufferEntry.java#L112-L139 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/sql/OIndexProxy.java | OIndexProxy.prepareKeys | private Set<Comparable> prepareKeys(OIndex<?> index, Object keys) {
final Class<?> targetType = index.getKeyTypes()[0].getDefaultJavaType();
return convertResult(keys, targetType);
} | java | private Set<Comparable> prepareKeys(OIndex<?> index, Object keys) {
final Class<?> targetType = index.getKeyTypes()[0].getDefaultJavaType();
return convertResult(keys, targetType);
} | [
"private",
"Set",
"<",
"Comparable",
">",
"prepareKeys",
"(",
"OIndex",
"<",
"?",
">",
"index",
",",
"Object",
"keys",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"targetType",
"=",
"index",
".",
"getKeyTypes",
"(",
")",
"[",
"0",
"]",
".",
"getDefaul... | Make type conversion of keys for specific index.
@param index
- index for which keys prepared for.
@param keys
- which should be prepared.
@return keys converted to necessary type. | [
"Make",
"type",
"conversion",
"of",
"keys",
"for",
"specific",
"index",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OIndexProxy.java#L243-L247 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/record/ORecordSchemaAwareAbstract.java | ORecordSchemaAwareAbstract.validate | public void validate() throws OValidationException {
if (ODatabaseRecordThreadLocal.INSTANCE.isDefined() && !getDatabase().isValidationEnabled())
return;
checkForLoading();
checkForFields();
if (_clazz != null) {
if (_clazz.isStrictMode()) {
// CHECK IF ALL FIELDS ARE DEFINED
for (String f : fieldNames()) {
if (_clazz.getProperty(f) == null)
throw new OValidationException("Found additional field '" + f + "'. It cannot be added because the schema class '"
+ _clazz.getName() + "' is defined as STRICT");
}
}
for (OProperty p : _clazz.properties()) {
validateField(this, p);
}
}
} | java | public void validate() throws OValidationException {
if (ODatabaseRecordThreadLocal.INSTANCE.isDefined() && !getDatabase().isValidationEnabled())
return;
checkForLoading();
checkForFields();
if (_clazz != null) {
if (_clazz.isStrictMode()) {
// CHECK IF ALL FIELDS ARE DEFINED
for (String f : fieldNames()) {
if (_clazz.getProperty(f) == null)
throw new OValidationException("Found additional field '" + f + "'. It cannot be added because the schema class '"
+ _clazz.getName() + "' is defined as STRICT");
}
}
for (OProperty p : _clazz.properties()) {
validateField(this, p);
}
}
} | [
"public",
"void",
"validate",
"(",
")",
"throws",
"OValidationException",
"{",
"if",
"(",
"ODatabaseRecordThreadLocal",
".",
"INSTANCE",
".",
"isDefined",
"(",
")",
"&&",
"!",
"getDatabase",
"(",
")",
".",
"isValidationEnabled",
"(",
")",
")",
"return",
";",
... | Validates the record following the declared constraints defined in schema such as mandatory, notNull, min, max, regexp, etc. If
the schema is not defined for the current class or there are not constraints then the validation is ignored.
@see OProperty
@throws OValidationException
if the document breaks some validation constraints defined in the schema | [
"Validates",
"the",
"record",
"following",
"the",
"declared",
"constraints",
"defined",
"in",
"schema",
"such",
"as",
"mandatory",
"notNull",
"min",
"max",
"regexp",
"etc",
".",
"If",
"the",
"schema",
"is",
"not",
"defined",
"for",
"the",
"current",
"class",
... | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/record/ORecordSchemaAwareAbstract.java#L48-L69 | train |
dmfs/jdav | src/org/dmfs/dav/rfc4918/PropertyUpdate.java | PropertyUpdate.set | public <T> void set(ElementDescriptor<T> property, T value)
{
if (mSet == null)
{
mSet = new HashMap<ElementDescriptor<?>, Object>(16);
}
mSet.put(property, value);
if (mRemove != null)
{
mRemove.remove(property);
}
} | java | public <T> void set(ElementDescriptor<T> property, T value)
{
if (mSet == null)
{
mSet = new HashMap<ElementDescriptor<?>, Object>(16);
}
mSet.put(property, value);
if (mRemove != null)
{
mRemove.remove(property);
}
} | [
"public",
"<",
"T",
">",
"void",
"set",
"(",
"ElementDescriptor",
"<",
"T",
">",
"property",
",",
"T",
"value",
")",
"{",
"if",
"(",
"mSet",
"==",
"null",
")",
"{",
"mSet",
"=",
"new",
"HashMap",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Objec... | Add a new property with a specific value to the resource.
@param property
The {@link ElementDescriptor} of the property to add.
@param value
The value of the property. | [
"Add",
"a",
"new",
"property",
"with",
"a",
"specific",
"value",
"to",
"the",
"resource",
"."
] | a619d85423210a283b3eb1fba9abda4fdc894969 | https://github.com/dmfs/jdav/blob/a619d85423210a283b3eb1fba9abda4fdc894969/src/org/dmfs/dav/rfc4918/PropertyUpdate.java#L142-L154 | train |
dmfs/jdav | src/org/dmfs/dav/rfc4918/PropertyUpdate.java | PropertyUpdate.remove | public <T> void remove(ElementDescriptor<T> property)
{
if (mRemove == null)
{
mRemove = new HashMap<ElementDescriptor<?>, Object>(16);
}
mRemove.put(property, null);
if (mSet != null)
{
mSet.remove(property);
}
} | java | public <T> void remove(ElementDescriptor<T> property)
{
if (mRemove == null)
{
mRemove = new HashMap<ElementDescriptor<?>, Object>(16);
}
mRemove.put(property, null);
if (mSet != null)
{
mSet.remove(property);
}
} | [
"public",
"<",
"T",
">",
"void",
"remove",
"(",
"ElementDescriptor",
"<",
"T",
">",
"property",
")",
"{",
"if",
"(",
"mRemove",
"==",
"null",
")",
"{",
"mRemove",
"=",
"new",
"HashMap",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Object",
">",
"("... | Remove a property from the resource.
@param property
The {@link ElementDescriptor} of the property to remove. | [
"Remove",
"a",
"property",
"from",
"the",
"resource",
"."
] | a619d85423210a283b3eb1fba9abda4fdc894969 | https://github.com/dmfs/jdav/blob/a619d85423210a283b3eb1fba9abda4fdc894969/src/org/dmfs/dav/rfc4918/PropertyUpdate.java#L163-L175 | train |
dmfs/jdav | src/org/dmfs/dav/rfc4918/PropertyUpdate.java | PropertyUpdate.clear | public <T> void clear(ElementDescriptor<T> property)
{
if (mRemove != null)
{
mRemove.remove(property);
}
if (mSet != null)
{
mSet.remove(property);
}
} | java | public <T> void clear(ElementDescriptor<T> property)
{
if (mRemove != null)
{
mRemove.remove(property);
}
if (mSet != null)
{
mSet.remove(property);
}
} | [
"public",
"<",
"T",
">",
"void",
"clear",
"(",
"ElementDescriptor",
"<",
"T",
">",
"property",
")",
"{",
"if",
"(",
"mRemove",
"!=",
"null",
")",
"{",
"mRemove",
".",
"remove",
"(",
"property",
")",
";",
"}",
"if",
"(",
"mSet",
"!=",
"null",
")",
... | Clear the modification of given property, i.e. neither change nor remove the property.
@param property
The {@link ElementDescriptor} of the property to clear. | [
"Clear",
"the",
"modification",
"of",
"given",
"property",
"i",
".",
"e",
".",
"neither",
"change",
"nor",
"remove",
"the",
"property",
"."
] | a619d85423210a283b3eb1fba9abda4fdc894969 | https://github.com/dmfs/jdav/blob/a619d85423210a283b3eb1fba9abda4fdc894969/src/org/dmfs/dav/rfc4918/PropertyUpdate.java#L184-L195 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/cache/OLevel2RecordCache.java | OLevel2RecordCache.updateRecord | public void updateRecord(final ORecordInternal<?> fresh) {
if (!isEnabled() || fresh == null || fresh.isDirty() || fresh.getIdentity().isNew() || !fresh.getIdentity().isValid()
|| fresh.getIdentity().getClusterId() == excludedCluster)
return;
if (fresh.isPinned() == null || fresh.isPinned()) {
underlying.lock(fresh.getIdentity());
try {
final ORecordInternal<?> current = underlying.get(fresh.getIdentity());
if (current != null && current.getVersion() >= fresh.getVersion())
return;
if (ODatabaseRecordThreadLocal.INSTANCE.isDefined() && !ODatabaseRecordThreadLocal.INSTANCE.get().isClosed())
// CACHE A COPY
underlying.put((ORecordInternal<?>) fresh.flatCopy());
else {
// CACHE THE DETACHED RECORD
fresh.detach();
underlying.put(fresh);
}
} finally {
underlying.unlock(fresh.getIdentity());
}
} else
underlying.remove(fresh.getIdentity());
} | java | public void updateRecord(final ORecordInternal<?> fresh) {
if (!isEnabled() || fresh == null || fresh.isDirty() || fresh.getIdentity().isNew() || !fresh.getIdentity().isValid()
|| fresh.getIdentity().getClusterId() == excludedCluster)
return;
if (fresh.isPinned() == null || fresh.isPinned()) {
underlying.lock(fresh.getIdentity());
try {
final ORecordInternal<?> current = underlying.get(fresh.getIdentity());
if (current != null && current.getVersion() >= fresh.getVersion())
return;
if (ODatabaseRecordThreadLocal.INSTANCE.isDefined() && !ODatabaseRecordThreadLocal.INSTANCE.get().isClosed())
// CACHE A COPY
underlying.put((ORecordInternal<?>) fresh.flatCopy());
else {
// CACHE THE DETACHED RECORD
fresh.detach();
underlying.put(fresh);
}
} finally {
underlying.unlock(fresh.getIdentity());
}
} else
underlying.remove(fresh.getIdentity());
} | [
"public",
"void",
"updateRecord",
"(",
"final",
"ORecordInternal",
"<",
"?",
">",
"fresh",
")",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
")",
"||",
"fresh",
"==",
"null",
"||",
"fresh",
".",
"isDirty",
"(",
")",
"||",
"fresh",
".",
"getIdentity",
"(",
... | Push record to cache. Identifier of record used as access key
@param fresh
new record that should be cached | [
"Push",
"record",
"to",
"cache",
".",
"Identifier",
"of",
"record",
"used",
"as",
"access",
"key"
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/cache/OLevel2RecordCache.java#L63-L88 | train |
ptgoetz/storm-hbase | src/main/java/org/apache/storm/hbase/common/ColumnList.java | ColumnList.addColumn | public ColumnList addColumn(byte[] family, byte[] qualifier, byte[] value){
columns().add(new Column(family, qualifier, -1, value));
return this;
} | java | public ColumnList addColumn(byte[] family, byte[] qualifier, byte[] value){
columns().add(new Column(family, qualifier, -1, value));
return this;
} | [
"public",
"ColumnList",
"addColumn",
"(",
"byte",
"[",
"]",
"family",
",",
"byte",
"[",
"]",
"qualifier",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"columns",
"(",
")",
".",
"add",
"(",
"new",
"Column",
"(",
"family",
",",
"qualifier",
",",
"-",
"1... | Add a standard HBase column
@param family
@param qualifier
@param value
@return | [
"Add",
"a",
"standard",
"HBase",
"column"
] | 509e41514bb92ef65dba1449bbd935557dc8193c | https://github.com/ptgoetz/storm-hbase/blob/509e41514bb92ef65dba1449bbd935557dc8193c/src/main/java/org/apache/storm/hbase/common/ColumnList.java#L128-L131 | train |
ptgoetz/storm-hbase | src/main/java/org/apache/storm/hbase/common/ColumnList.java | ColumnList.addCounter | public ColumnList addCounter(byte[] family, byte[] qualifier, long incr){
counters().add(new Counter(family, qualifier, incr));
return this;
} | java | public ColumnList addCounter(byte[] family, byte[] qualifier, long incr){
counters().add(new Counter(family, qualifier, incr));
return this;
} | [
"public",
"ColumnList",
"addCounter",
"(",
"byte",
"[",
"]",
"family",
",",
"byte",
"[",
"]",
"qualifier",
",",
"long",
"incr",
")",
"{",
"counters",
"(",
")",
".",
"add",
"(",
"new",
"Counter",
"(",
"family",
",",
"qualifier",
",",
"incr",
")",
")",... | Add an HBase counter column.
@param family
@param qualifier
@param incr
@return | [
"Add",
"an",
"HBase",
"counter",
"column",
"."
] | 509e41514bb92ef65dba1449bbd935557dc8193c | https://github.com/ptgoetz/storm-hbase/blob/509e41514bb92ef65dba1449bbd935557dc8193c/src/main/java/org/apache/storm/hbase/common/ColumnList.java#L151-L154 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getLeagues | public Future<Map<Long, List<LeagueList>>> getLeagues(long... summoners) {
return new ApiFuture<>(() -> handler.getLeagues(summoners));
} | java | public Future<Map<Long, List<LeagueList>>> getLeagues(long... summoners) {
return new ApiFuture<>(() -> handler.getLeagues(summoners));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Long",
",",
"List",
"<",
"LeagueList",
">",
">",
">",
"getLeagues",
"(",
"long",
"...",
"summoners",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getLeagues",
"(",
"summoners"... | Get a listing of leagues for the specified summoners
@param summoners The ids of the summoners
@return A list of leagues
@see <a href=https://developer.riotgames.com/api/methods#!/593/1862>Official API documentation</a> | [
"Get",
"a",
"listing",
"of",
"leagues",
"for",
"the",
"specified",
"summoners"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L235-L237 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getLeagueEntries | public Future<Map<Long, List<LeagueItem>>> getLeagueEntries(long... summoners) {
return new ApiFuture<>(() -> handler.getLeagueEntries(summoners));
} | java | public Future<Map<Long, List<LeagueItem>>> getLeagueEntries(long... summoners) {
return new ApiFuture<>(() -> handler.getLeagueEntries(summoners));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Long",
",",
"List",
"<",
"LeagueItem",
">",
">",
">",
"getLeagueEntries",
"(",
"long",
"...",
"summoners",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getLeagueEntries",
"(",
... | Get a listing of all league entries in the summoners' leagues
@param summoners The ids of the summoners
@return A map, mapping summoner ids to lists of league entries for that summoner
@see <a href=https://developer.riotgames.com/api/methods#!/593/1863>Official API documentation</a> | [
"Get",
"a",
"listing",
"of",
"all",
"league",
"entries",
"in",
"the",
"summoners",
"leagues"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L255-L257 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getLeagues | public Future<List<LeagueList>> getLeagues(String teamId) {
return new ApiFuture<>(() -> handler.getLeagues(teamId));
} | java | public Future<List<LeagueList>> getLeagues(String teamId) {
return new ApiFuture<>(() -> handler.getLeagues(teamId));
} | [
"public",
"Future",
"<",
"List",
"<",
"LeagueList",
">",
">",
"getLeagues",
"(",
"String",
"teamId",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getLeagues",
"(",
"teamId",
")",
")",
";",
"}"
] | Get a listing of leagues for the specified team
@param teamId The id of the team
@return A list of leagues
@see <a href=https://developer.riotgames.com/api/methods#!/593/1860>Official API documentation</a> | [
"Get",
"a",
"listing",
"of",
"leagues",
"for",
"the",
"specified",
"team"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L265-L267 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getLeagues | public Future<Map<String, List<LeagueList>>> getLeagues(String... teamIds) {
return new ApiFuture<>(() -> handler.getLeagues(teamIds));
} | java | public Future<Map<String, List<LeagueList>>> getLeagues(String... teamIds) {
return new ApiFuture<>(() -> handler.getLeagues(teamIds));
} | [
"public",
"Future",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"LeagueList",
">",
">",
">",
"getLeagues",
"(",
"String",
"...",
"teamIds",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getLeagues",
"(",
"teamIds"... | Get a listing of leagues for the specified teams
@param teamIds The ids of the team
@return A mapping of team ids to lists of leagues
@see <a href=https://developer.riotgames.com/api/methods#!/593/1860>Official API documentation</a> | [
"Get",
"a",
"listing",
"of",
"leagues",
"for",
"the",
"specified",
"teams"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L275-L277 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getLeagueEntries | public Future<List<LeagueItem>> getLeagueEntries(String teamId) {
return new ApiFuture<>(() -> handler.getLeagueEntries(teamId));
} | java | public Future<List<LeagueItem>> getLeagueEntries(String teamId) {
return new ApiFuture<>(() -> handler.getLeagueEntries(teamId));
} | [
"public",
"Future",
"<",
"List",
"<",
"LeagueItem",
">",
">",
"getLeagueEntries",
"(",
"String",
"teamId",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getLeagueEntries",
"(",
"teamId",
")",
")",
";",
"}"
] | Get a listing of all league entries in the team's leagues
@param teamId The id of the team
@return A list of league entries
@see <a href=https://developer.riotgames.com/api/methods#!/593/1861>Official API documentation</a> | [
"Get",
"a",
"listing",
"of",
"all",
"league",
"entries",
"in",
"the",
"team",
"s",
"leagues"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L285-L287 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getLeagueEntries | public Future<Map<String, List<LeagueItem>>> getLeagueEntries(String... teamIds) {
return new ApiFuture<>(() -> handler.getLeagueEntries(teamIds));
} | java | public Future<Map<String, List<LeagueItem>>> getLeagueEntries(String... teamIds) {
return new ApiFuture<>(() -> handler.getLeagueEntries(teamIds));
} | [
"public",
"Future",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"LeagueItem",
">",
">",
">",
"getLeagueEntries",
"(",
"String",
"...",
"teamIds",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getLeagueEntries",
"(",... | Get a listing of all league entries in the teams' leagues
@param teamIds The ids of the teams
@return A mapping of teamIds to lists of league entries
@see <a href=https://developer.riotgames.com/api/methods#!/593/1861>Official API documentation</a> | [
"Get",
"a",
"listing",
"of",
"all",
"league",
"entries",
"in",
"the",
"teams",
"leagues"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L295-L297 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getMatch | public Future<MatchDetail> getMatch(long matchId, boolean includeTimeline) {
return new ApiFuture<>(() -> handler.getMatch(matchId, includeTimeline));
} | java | public Future<MatchDetail> getMatch(long matchId, boolean includeTimeline) {
return new ApiFuture<>(() -> handler.getMatch(matchId, includeTimeline));
} | [
"public",
"Future",
"<",
"MatchDetail",
">",
"getMatch",
"(",
"long",
"matchId",
",",
"boolean",
"includeTimeline",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getMatch",
"(",
"matchId",
",",
"includeTimeline",
")",
... | Retrieves the specified match.
@param matchId The id of the match.
@param includeTimeline Whether or not the event timeline should be retrieved.
@return The match details.
@see <a href="https://developer.riotgames.com/api/methods#!/806/2848">Official API Documentation</a> | [
"Retrieves",
"the",
"specified",
"match",
"."
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L976-L978 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getMatchHistory | public Future<List<MatchSummary>> getMatchHistory(long playerId, String[] championIds, QueueType... queueTypes) {
return new ApiFuture<>(() -> handler.getMatchHistory(playerId, championIds, queueTypes));
} | java | public Future<List<MatchSummary>> getMatchHistory(long playerId, String[] championIds, QueueType... queueTypes) {
return new ApiFuture<>(() -> handler.getMatchHistory(playerId, championIds, queueTypes));
} | [
"public",
"Future",
"<",
"List",
"<",
"MatchSummary",
">",
">",
"getMatchHistory",
"(",
"long",
"playerId",
",",
"String",
"[",
"]",
"championIds",
",",
"QueueType",
"...",
"queueTypes",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
... | Retrieve a player's match history, filtering out all games not in the specified queues.
@param playerId The id of the player.
@param championIds The championIds to use for retrieval.
@param queueTypes The queue types to retrieve (must be one of RANKED_SOLO_5x5, RANKED_TEAM_3x3 or
RANKED_TEAM_5x5).
@return The match history of the player.
@see <a href="https://developer.riotgames.com/api/methods#!/805/2847">Official API Documentation</a> | [
"Retrieve",
"a",
"player",
"s",
"match",
"history",
"filtering",
"out",
"all",
"games",
"not",
"in",
"the",
"specified",
"queues",
"."
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1014-L1016 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getRankedStats | public Future<RankedStats> getRankedStats(long summoner, Season season) {
return new ApiFuture<>(() -> handler.getRankedStats(summoner, season));
} | java | public Future<RankedStats> getRankedStats(long summoner, Season season) {
return new ApiFuture<>(() -> handler.getRankedStats(summoner, season));
} | [
"public",
"Future",
"<",
"RankedStats",
">",
"getRankedStats",
"(",
"long",
"summoner",
",",
"Season",
"season",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getRankedStats",
"(",
"summoner",
",",
"season",
")",
")",
... | Get ranked stats for a player in a specific season
@param summoner The id of the summoner
@param season The season
@return Ranked stats
@see <a href=https://developer.riotgames.com/api/methods#!/622/1937>Official API documentation</a> | [
"Get",
"ranked",
"stats",
"for",
"a",
"player",
"in",
"a",
"specific",
"season"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1055-L1057 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getStatsSummary | public Future<List<PlayerStats>> getStatsSummary(long summoner, Season season) {
return new ApiFuture<>(() -> handler.getStatsSummary(summoner, season));
} | java | public Future<List<PlayerStats>> getStatsSummary(long summoner, Season season) {
return new ApiFuture<>(() -> handler.getStatsSummary(summoner, season));
} | [
"public",
"Future",
"<",
"List",
"<",
"PlayerStats",
">",
">",
"getStatsSummary",
"(",
"long",
"summoner",
",",
"Season",
"season",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getStatsSummary",
"(",
"summoner",
",",
... | Get player stats for the player
@param summoner The id of the summoner
@param season The season
@return The player's stats
@see <a href=https://developer.riotgames.com/api/methods#!/622/1938>Official API documentation</a> | [
"Get",
"player",
"stats",
"for",
"the",
"player"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1076-L1078 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getSummoners | public Future<Map<String, Summoner>> getSummoners(String... names) {
return new ApiFuture<>(() -> handler.getSummoners(names));
} | java | public Future<Map<String, Summoner>> getSummoners(String... names) {
return new ApiFuture<>(() -> handler.getSummoners(names));
} | [
"public",
"Future",
"<",
"Map",
"<",
"String",
",",
"Summoner",
">",
">",
"getSummoners",
"(",
"String",
"...",
"names",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getSummoners",
"(",
"names",
")",
")",
";",
"... | Get summoner information for the summoners with the specified names
@param names The names of the players
@return A map, mapping standardized player names to summoner information
@see <a href=https://developer.riotgames.com/api/methods#!/620/1930>Official API documentation</a>
@see net.boreeas.riotapi.Util#standardizeSummonerName(java.lang.String) | [
"Get",
"summoner",
"information",
"for",
"the",
"summoners",
"with",
"the",
"specified",
"names"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1091-L1093 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getSummoners | public Future<Map<Integer, Summoner>> getSummoners(Integer... ids) {
return new ApiFuture<>(() -> handler.getSummoners(ids));
} | java | public Future<Map<Integer, Summoner>> getSummoners(Integer... ids) {
return new ApiFuture<>(() -> handler.getSummoners(ids));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Integer",
",",
"Summoner",
">",
">",
"getSummoners",
"(",
"Integer",
"...",
"ids",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getSummoners",
"(",
"ids",
")",
")",
";",
"}"... | Get summoner information for the summoners with the specified ids
@param ids The ids of the summoners
@return A map, mapping player ids to summoner information
@see <a href=https://developer.riotgames.com/api/methods#!/620/1931>Official API documentation</a> | [
"Get",
"summoner",
"information",
"for",
"the",
"summoners",
"with",
"the",
"specified",
"ids"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1111-L1113 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getMasteryPagesMultipleUsers | public Future<Map<Integer, Set<MasteryPage>>> getMasteryPagesMultipleUsers(Integer... ids) {
return new ApiFuture<>(() -> handler.getMasteryPagesMultipleUsers(ids));
} | java | public Future<Map<Integer, Set<MasteryPage>>> getMasteryPagesMultipleUsers(Integer... ids) {
return new ApiFuture<>(() -> handler.getMasteryPagesMultipleUsers(ids));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Integer",
",",
"Set",
"<",
"MasteryPage",
">",
">",
">",
"getMasteryPagesMultipleUsers",
"(",
"Integer",
"...",
"ids",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getMasteryPages... | Retrieve mastery pages for multiple users
@param ids The ids of the users
@return A map, mapping player ids to their respective mastery pages
@see <a href=https://developer.riotgames.com/api/methods#!/620/1933>Official API documentation</a> | [
"Retrieve",
"mastery",
"pages",
"for",
"multiple",
"users"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1131-L1133 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getSummonerNames | public Future<Map<Integer, String>> getSummonerNames(Integer... ids) {
return new ApiFuture<>(() -> handler.getSummonerNames(ids));
} | java | public Future<Map<Integer, String>> getSummonerNames(Integer... ids) {
return new ApiFuture<>(() -> handler.getSummonerNames(ids));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Integer",
",",
"String",
">",
">",
"getSummonerNames",
"(",
"Integer",
"...",
"ids",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getSummonerNames",
"(",
"ids",
")",
")",
";",... | Retrieve summoner names for the specified ids
@param ids The ids to lookup
@return A map, mapping user ids to summoner names
@see <a href=https://developer.riotgames.com/api/methods#!/620/1934>Official API documentation</a> | [
"Retrieve",
"summoner",
"names",
"for",
"the",
"specified",
"ids"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1151-L1153 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getRunePagesMultipleUsers | public Future<Map<Integer, Set<RunePage>>> getRunePagesMultipleUsers(int... ids) {
return new ApiFuture<>(() -> handler.getRunePagesMultipleUsers(ids));
} | java | public Future<Map<Integer, Set<RunePage>>> getRunePagesMultipleUsers(int... ids) {
return new ApiFuture<>(() -> handler.getRunePagesMultipleUsers(ids));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Integer",
",",
"Set",
"<",
"RunePage",
">",
">",
">",
"getRunePagesMultipleUsers",
"(",
"int",
"...",
"ids",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getRunePagesMultipleUsers... | Retrieve runes pages for multiple users
@param ids The ids of the users
@return A map, mapping user ids to their respective runes pages
@see <a href=https://developer.riotgames.com/api/methods#!/620/1932>Official API documentation</a> | [
"Retrieve",
"runes",
"pages",
"for",
"multiple",
"users"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1171-L1173 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getTeams | public Future<Map<Long, List<RankedTeam>>> getTeams(long... ids) {
return new ApiFuture<>(() -> handler.getTeamsBySummoners(ids));
} | java | public Future<Map<Long, List<RankedTeam>>> getTeams(long... ids) {
return new ApiFuture<>(() -> handler.getTeamsBySummoners(ids));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Long",
",",
"List",
"<",
"RankedTeam",
">",
">",
">",
"getTeams",
"(",
"long",
"...",
"ids",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getTeamsBySummoners",
"(",
"ids",
"... | Retrieve the ranked teams of the specified users
@param ids The users' ids
@return The ranked teams of the users
@see <a href=https://developer.riotgames.com/api/methods#!/594/1865>Official API documentation</a> | [
"Retrieve",
"the",
"ranked",
"teams",
"of",
"the",
"specified",
"users"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1205-L1207 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getTeams | public Future<Map<String, RankedTeam>> getTeams(String... teamIds) {
return new ApiFuture<>(() -> handler.getTeams(teamIds));
} | java | public Future<Map<String, RankedTeam>> getTeams(String... teamIds) {
return new ApiFuture<>(() -> handler.getTeams(teamIds));
} | [
"public",
"Future",
"<",
"Map",
"<",
"String",
",",
"RankedTeam",
">",
">",
"getTeams",
"(",
"String",
"...",
"teamIds",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getTeams",
"(",
"teamIds",
")",
")",
";",
"}"... | Retrieve information for the specified ranked teams
@param teamIds The ids of the teams
@return A map, mapping team ids to team information
@see <a href=https://developer.riotgames.com/api/methods#!/594/1866>Official API documentation</a> | [
"Retrieve",
"information",
"for",
"the",
"specified",
"ranked",
"teams"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1225-L1227 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getSummonerIds | public Future<List<Long>> getSummonerIds(String... names) {
return new ApiFuture<>(() -> handler.getSummonerIds(names));
} | java | public Future<List<Long>> getSummonerIds(String... names) {
return new ApiFuture<>(() -> handler.getSummonerIds(names));
} | [
"public",
"Future",
"<",
"List",
"<",
"Long",
">",
">",
"getSummonerIds",
"(",
"String",
"...",
"names",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getSummonerIds",
"(",
"names",
")",
")",
";",
"}"
] | Retrieve summoner ids for the specified names
@param names The names of the users
@return Their respective ids | [
"Retrieve",
"summoner",
"ids",
"for",
"the",
"specified",
"names"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1238-L1240 | train |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.developmentDefault | public static ThrottledApiHandler developmentDefault(Shard shard, String token) {
return new ThrottledApiHandler(shard, token,
new Limit(10, 10, TimeUnit.SECONDS),
new Limit(500, 10, TimeUnit.MINUTES));
} | java | public static ThrottledApiHandler developmentDefault(Shard shard, String token) {
return new ThrottledApiHandler(shard, token,
new Limit(10, 10, TimeUnit.SECONDS),
new Limit(500, 10, TimeUnit.MINUTES));
} | [
"public",
"static",
"ThrottledApiHandler",
"developmentDefault",
"(",
"Shard",
"shard",
",",
"String",
"token",
")",
"{",
"return",
"new",
"ThrottledApiHandler",
"(",
"shard",
",",
"token",
",",
"new",
"Limit",
"(",
"10",
",",
"10",
",",
"TimeUnit",
".",
"SE... | Returns a throttled api handler with the current development request limits,
which is 10 requests per 10 seconds and 500 requests per 10 minutes
@param shard The target server
@param token The api key
@return The api handler | [
"Returns",
"a",
"throttled",
"api",
"handler",
"with",
"the",
"current",
"development",
"request",
"limits",
"which",
"is",
"10",
"requests",
"per",
"10",
"seconds",
"and",
"500",
"requests",
"per",
"10",
"minutes"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1379-L1383 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/cache/OLevel1RecordCache.java | OLevel1RecordCache.updateRecord | public void updateRecord(final ORecordInternal<?> record) {
if (isEnabled() && record.getIdentity().getClusterId() != excludedCluster && record.getIdentity().isValid()) {
underlying.lock(record.getIdentity());
try {
if (underlying.get(record.getIdentity()) != record)
underlying.put(record);
} finally {
underlying.unlock(record.getIdentity());
}
}
secondary.updateRecord(record);
} | java | public void updateRecord(final ORecordInternal<?> record) {
if (isEnabled() && record.getIdentity().getClusterId() != excludedCluster && record.getIdentity().isValid()) {
underlying.lock(record.getIdentity());
try {
if (underlying.get(record.getIdentity()) != record)
underlying.put(record);
} finally {
underlying.unlock(record.getIdentity());
}
}
secondary.updateRecord(record);
} | [
"public",
"void",
"updateRecord",
"(",
"final",
"ORecordInternal",
"<",
"?",
">",
"record",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
"&&",
"record",
".",
"getIdentity",
"(",
")",
".",
"getClusterId",
"(",
")",
"!=",
"excludedCluster",
"&&",
"record",
... | Pushes record to cache. Identifier of record used as access key
@param record
record that should be cached | [
"Pushes",
"record",
"to",
"cache",
".",
"Identifier",
"of",
"record",
"used",
"as",
"access",
"key"
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/cache/OLevel1RecordCache.java#L62-L74 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/cache/OLevel1RecordCache.java | OLevel1RecordCache.findRecord | public ORecordInternal<?> findRecord(final ORID rid) {
if (!isEnabled())
// DELEGATE TO THE 2nd LEVEL CACHE
return null; // secondary.retrieveRecord(rid);
ORecordInternal<?> record;
underlying.lock(rid);
try {
record = underlying.get(rid);
if (record == null) {
// DELEGATE TO THE 2nd LEVEL CACHE
record = secondary.retrieveRecord(rid);
if (record != null)
// STORE IT LOCALLY
underlying.put(record);
}
} finally {
underlying.unlock(rid);
}
OProfiler.getInstance().updateCounter(record != null ? CACHE_HIT : CACHE_MISS, 1L);
return record;
} | java | public ORecordInternal<?> findRecord(final ORID rid) {
if (!isEnabled())
// DELEGATE TO THE 2nd LEVEL CACHE
return null; // secondary.retrieveRecord(rid);
ORecordInternal<?> record;
underlying.lock(rid);
try {
record = underlying.get(rid);
if (record == null) {
// DELEGATE TO THE 2nd LEVEL CACHE
record = secondary.retrieveRecord(rid);
if (record != null)
// STORE IT LOCALLY
underlying.put(record);
}
} finally {
underlying.unlock(rid);
}
OProfiler.getInstance().updateCounter(record != null ? CACHE_HIT : CACHE_MISS, 1L);
return record;
} | [
"public",
"ORecordInternal",
"<",
"?",
">",
"findRecord",
"(",
"final",
"ORID",
"rid",
")",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
")",
")",
"// DELEGATE TO THE 2nd LEVEL CACHE\r",
"return",
"null",
";",
"// secondary.retrieveRecord(rid);\r",
"ORecordInternal",
"<",... | Looks up for record in cache by it's identifier. Optionally look up in secondary cache and update primary with found record
@param rid
unique identifier of record
@return record stored in cache if any, otherwise - {@code null} | [
"Looks",
"up",
"for",
"record",
"in",
"cache",
"by",
"it",
"s",
"identifier",
".",
"Optionally",
"look",
"up",
"in",
"secondary",
"cache",
"and",
"update",
"primary",
"with",
"found",
"record"
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/cache/OLevel1RecordCache.java#L83-L108 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateIndex.java | OCommandExecutorSQLCreateIndex.execute | @SuppressWarnings("rawtypes")
public Object execute(final Map<Object, Object> iArgs) {
if (indexName == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
final ODatabaseRecord database = getDatabase();
final OIndex<?> idx;
if (fields == null || fields.length == 0) {
if (keyTypes != null)
idx = database.getMetadata().getIndexManager()
.createIndex(indexName, indexType.toString(), new OSimpleKeyIndexDefinition(keyTypes), null, null);
else if (serializerKeyId != 0) {
idx = database.getMetadata().getIndexManager()
.createIndex(indexName, indexType.toString(), new ORuntimeKeyIndexDefinition(serializerKeyId), null, null);
} else
idx = database.getMetadata().getIndexManager().createIndex(indexName, indexType.toString(), null, null, null);
} else {
if (keyTypes == null || keyTypes.length == 0) {
idx = oClass.createIndex(indexName, indexType, fields);
} else {
final OIndexDefinition idxDef = OIndexDefinitionFactory.createIndexDefinition(oClass, Arrays.asList(fields),
Arrays.asList(keyTypes));
idx = database.getMetadata().getIndexManager()
.createIndex(indexName, indexType.name(), idxDef, oClass.getPolymorphicClusterIds(), null);
}
}
if (idx != null)
return idx.getSize();
return null;
} | java | @SuppressWarnings("rawtypes")
public Object execute(final Map<Object, Object> iArgs) {
if (indexName == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
final ODatabaseRecord database = getDatabase();
final OIndex<?> idx;
if (fields == null || fields.length == 0) {
if (keyTypes != null)
idx = database.getMetadata().getIndexManager()
.createIndex(indexName, indexType.toString(), new OSimpleKeyIndexDefinition(keyTypes), null, null);
else if (serializerKeyId != 0) {
idx = database.getMetadata().getIndexManager()
.createIndex(indexName, indexType.toString(), new ORuntimeKeyIndexDefinition(serializerKeyId), null, null);
} else
idx = database.getMetadata().getIndexManager().createIndex(indexName, indexType.toString(), null, null, null);
} else {
if (keyTypes == null || keyTypes.length == 0) {
idx = oClass.createIndex(indexName, indexType, fields);
} else {
final OIndexDefinition idxDef = OIndexDefinitionFactory.createIndexDefinition(oClass, Arrays.asList(fields),
Arrays.asList(keyTypes));
idx = database.getMetadata().getIndexManager()
.createIndex(indexName, indexType.name(), idxDef, oClass.getPolymorphicClusterIds(), null);
}
}
if (idx != null)
return idx.getSize();
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Object",
"execute",
"(",
"final",
"Map",
"<",
"Object",
",",
"Object",
">",
"iArgs",
")",
"{",
"if",
"(",
"indexName",
"==",
"null",
")",
"throw",
"new",
"OCommandExecutionException",
"(",
"\"Cann... | Execute the CREATE INDEX. | [
"Execute",
"the",
"CREATE",
"INDEX",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateIndex.java#L182-L214 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java | SummonerTeamService.createTeam | public Team createTeam(String name, String tag) {
return client.sendRpcAndWait(SERVICE, "createTeam", name, tag);
} | java | public Team createTeam(String name, String tag) {
return client.sendRpcAndWait(SERVICE, "createTeam", name, tag);
} | [
"public",
"Team",
"createTeam",
"(",
"String",
"name",
",",
"String",
"tag",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"createTeam\"",
",",
"name",
",",
"tag",
")",
";",
"}"
] | Create a new ranked team with the specified name and tag
@param name The name
@param tag The tag
@return The created team | [
"Create",
"a",
"new",
"ranked",
"team",
"with",
"the",
"specified",
"name",
"and",
"tag"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java#L95-L97 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java | SummonerTeamService.invitePlayer | public Team invitePlayer(long summonerId, TeamId teamId) {
return client.sendRpcAndWait(SERVICE, "invitePlayer", summonerId, teamId);
} | java | public Team invitePlayer(long summonerId, TeamId teamId) {
return client.sendRpcAndWait(SERVICE, "invitePlayer", summonerId, teamId);
} | [
"public",
"Team",
"invitePlayer",
"(",
"long",
"summonerId",
",",
"TeamId",
"teamId",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"invitePlayer\"",
",",
"summonerId",
",",
"teamId",
")",
";",
"}"
] | Invite a player to the target team
@param summonerId The id of the player
@param teamId The id of the team
@return The new team state | [
"Invite",
"a",
"player",
"to",
"the",
"target",
"team"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java#L105-L107 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java | SummonerTeamService.kickPlayer | public Team kickPlayer(long summonerId, TeamId teamId) {
return client.sendRpcAndWait(SERVICE, "kickPlayer", summonerId, teamId);
} | java | public Team kickPlayer(long summonerId, TeamId teamId) {
return client.sendRpcAndWait(SERVICE, "kickPlayer", summonerId, teamId);
} | [
"public",
"Team",
"kickPlayer",
"(",
"long",
"summonerId",
",",
"TeamId",
"teamId",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"kickPlayer\"",
",",
"summonerId",
",",
"teamId",
")",
";",
"}"
] | Kick a player from the target team
@param summonerId The id of the player
@param teamId The id of the team
@return The new team state | [
"Kick",
"a",
"player",
"from",
"the",
"target",
"team"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/SummonerTeamService.java#L115-L117 | train |
wealthfront/kawala | kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java | ConstructorAnalysis.analyse | static AnalysisResult analyse(
Class<?> klass, Constructor<?> constructor) throws IOException {
Class<?>[] parameterTypes = constructor.getParameterTypes();
InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class");
if (in == null) {
throw new IllegalArgumentException(format("can not find bytecode for %s", klass));
}
return analyse(in, klass.getName().replace('.', '/'),
klass.getSuperclass().getName().replace('.', '/'),
parameterTypes);
} | java | static AnalysisResult analyse(
Class<?> klass, Constructor<?> constructor) throws IOException {
Class<?>[] parameterTypes = constructor.getParameterTypes();
InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class");
if (in == null) {
throw new IllegalArgumentException(format("can not find bytecode for %s", klass));
}
return analyse(in, klass.getName().replace('.', '/'),
klass.getSuperclass().getName().replace('.', '/'),
parameterTypes);
} | [
"static",
"AnalysisResult",
"analyse",
"(",
"Class",
"<",
"?",
">",
"klass",
",",
"Constructor",
"<",
"?",
">",
"constructor",
")",
"throws",
"IOException",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
"=",
"constructor",
".",
"getParameterTypes"... | Produces an assignment or field names to values or fails.
@throws IllegalConstructorException | [
"Produces",
"an",
"assignment",
"or",
"field",
"names",
"to",
"values",
"or",
"fails",
"."
] | acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e | https://github.com/wealthfront/kawala/blob/acf24b7a9ef6e2f0fc1e862d44cfa4dcc4da8f6e/kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java#L61-L71 | train |
jpkrohling/secret-store | secret-store-api/src/main/java/org/keycloak/secretstore/api/internal/ZonedDateTimeXmlAdapter.java | ZonedDateTimeXmlAdapter.marshal | @Override
public String marshal(ZonedDateTime zonedDateTime) {
if (null == zonedDateTime) {
return null;
}
return zonedDateTime.withZoneSameInstant(ZoneOffset.UTC).format(formatter);
} | java | @Override
public String marshal(ZonedDateTime zonedDateTime) {
if (null == zonedDateTime) {
return null;
}
return zonedDateTime.withZoneSameInstant(ZoneOffset.UTC).format(formatter);
} | [
"@",
"Override",
"public",
"String",
"marshal",
"(",
"ZonedDateTime",
"zonedDateTime",
")",
"{",
"if",
"(",
"null",
"==",
"zonedDateTime",
")",
"{",
"return",
"null",
";",
"}",
"return",
"zonedDateTime",
".",
"withZoneSameInstant",
"(",
"ZoneOffset",
".",
"UTC... | When marshalling, the provided zonedDateTime is normalized to UTC, so that the output is consistent between
dates and time zones.
@param zonedDateTime the zonedDateTime to marshall
@return the UTC-based date time in ISO format | [
"When",
"marshalling",
"the",
"provided",
"zonedDateTime",
"is",
"normalized",
"to",
"UTC",
"so",
"that",
"the",
"output",
"is",
"consistent",
"between",
"dates",
"and",
"time",
"zones",
"."
] | f136ea6286a6919cc767d0b4a5e84f333c33f483 | https://github.com/jpkrohling/secret-store/blob/f136ea6286a6919cc767d0b4a5e84f333c33f483/secret-store-api/src/main/java/org/keycloak/secretstore/api/internal/ZonedDateTimeXmlAdapter.java#L48-L55 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/util/nmea/NmeaUtil.java | NmeaUtil.isValid | public static boolean isValid(String sentence) {
// Compare the characters after the asterisk to the calculation
try {
return sentence.substring(sentence.lastIndexOf("*") + 1)
.equalsIgnoreCase(getChecksum(sentence));
} catch (AisParseException e) {
return false;
}
} | java | public static boolean isValid(String sentence) {
// Compare the characters after the asterisk to the calculation
try {
return sentence.substring(sentence.lastIndexOf("*") + 1)
.equalsIgnoreCase(getChecksum(sentence));
} catch (AisParseException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isValid",
"(",
"String",
"sentence",
")",
"{",
"// Compare the characters after the asterisk to the calculation",
"try",
"{",
"return",
"sentence",
".",
"substring",
"(",
"sentence",
".",
"lastIndexOf",
"(",
"\"*\"",
")",
"+",
"1",
")... | Returns true if and only if the sentence's checksum matches the
calculated checksum.
@param sentence
@return | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"the",
"sentence",
"s",
"checksum",
"matches",
"the",
"calculated",
"checksum",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/util/nmea/NmeaUtil.java#L52-L61 | train |
NetsOSS/embedded-jetty | src/main/java/eu/nets/oss/jetty/ServerUtil.java | ServerUtil.getEnvironmentFile | private static Properties getEnvironmentFile(File configFile) {
Properties mergedProperties = new Properties();
InputStream inputStream;
try {
inputStream = new FileInputStream(configFile);
} catch (FileNotFoundException e) {
// File does not exist. That's all right.
return mergedProperties;
}
try {
mergedProperties.load(inputStream);
inputStream.close();
return mergedProperties;
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | private static Properties getEnvironmentFile(File configFile) {
Properties mergedProperties = new Properties();
InputStream inputStream;
try {
inputStream = new FileInputStream(configFile);
} catch (FileNotFoundException e) {
// File does not exist. That's all right.
return mergedProperties;
}
try {
mergedProperties.load(inputStream);
inputStream.close();
return mergedProperties;
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"private",
"static",
"Properties",
"getEnvironmentFile",
"(",
"File",
"configFile",
")",
"{",
"Properties",
"mergedProperties",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"inputStream",
";",
"try",
"{",
"inputStream",
"=",
"new",
"FileInputStream",
"(... | Leser properties fra classpath og vil overlaste i reverse order, slik at
classpath reverse order styrer hvilke props som gjelder.
@param configFile the file to read properties from
@return Properties med properties i overridden form
@throws {@link java.io.IOException}, {@link RuntimeException} | [
"Leser",
"properties",
"fra",
"classpath",
"og",
"vil",
"overlaste",
"i",
"reverse",
"order",
"slik",
"at",
"classpath",
"reverse",
"order",
"styrer",
"hvilke",
"props",
"som",
"gjelder",
"."
] | c2535867ad4887c4a43a8aa7f95b711ff54c8542 | https://github.com/NetsOSS/embedded-jetty/blob/c2535867ad4887c4a43a8aa7f95b711ff54c8542/src/main/java/eu/nets/oss/jetty/ServerUtil.java#L60-L77 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java | OCommandExecutorSQLSelect.createIndexedProperty | private static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) {
if (iItem == null || !(iItem instanceof OSQLFilterItemField))
return null;
if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField)
return null;
final OSQLFilterItemField item = (OSQLFilterItemField) iItem;
if (item.hasChainOperators() && !item.isFieldChain())
return null;
final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft();
if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) {
return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue);
}
final Object value = OSQLHelper.getValue(origValue);
if (value == null)
return null;
return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value);
} | java | private static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) {
if (iItem == null || !(iItem instanceof OSQLFilterItemField))
return null;
if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField)
return null;
final OSQLFilterItemField item = (OSQLFilterItemField) iItem;
if (item.hasChainOperators() && !item.isFieldChain())
return null;
final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft();
if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) {
return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue);
}
final Object value = OSQLHelper.getValue(origValue);
if (value == null)
return null;
return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value);
} | [
"private",
"static",
"OIndexSearchResult",
"createIndexedProperty",
"(",
"final",
"OSQLFilterCondition",
"iCondition",
",",
"final",
"Object",
"iItem",
")",
"{",
"if",
"(",
"iItem",
"==",
"null",
"||",
"!",
"(",
"iItem",
"instanceof",
"OSQLFilterItemField",
")",
"... | Add SQL filter field to the search candidate list.
@param iCondition
Condition item
@param iItem
Value to search
@return true if the property was indexed and found, otherwise false | [
"Add",
"SQL",
"filter",
"field",
"to",
"the",
"search",
"candidate",
"list",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java#L519-L543 | train |
soi-toolkit/soi-toolkit-mule | tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionData.java | OptionData.addResult | void addResult(String valueData, String detailData) {
if (value) {
if (valueData == null) throw new IllegalArgumentException(CLASS + ": valueData may not be null");
values.add(valueData);
if (detail) {
if (detailData == null) throw new IllegalArgumentException(CLASS + ": detailData may not be null");
details.add(detailData);
}
}
counter++;
} | java | void addResult(String valueData, String detailData) {
if (value) {
if (valueData == null) throw new IllegalArgumentException(CLASS + ": valueData may not be null");
values.add(valueData);
if (detail) {
if (detailData == null) throw new IllegalArgumentException(CLASS + ": detailData may not be null");
details.add(detailData);
}
}
counter++;
} | [
"void",
"addResult",
"(",
"String",
"valueData",
",",
"String",
"detailData",
")",
"{",
"if",
"(",
"value",
")",
"{",
"if",
"(",
"valueData",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"CLASS",
"+",
"\": valueData may not be null\"",
"... | Store the data for a match found | [
"Store",
"the",
"data",
"for",
"a",
"match",
"found"
] | e891350dbf55e6307be94d193d056bdb785b37d3 | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionData.java#L223-L233 | train |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/jaxb/JaxbUtil.java | JaxbUtil.marshal | public String marshal(Object jaxbObject) {
// Precondition, check that the jaxbContext is set!
if (jaxbContext == null) {
logger.error("Trying to marshal with a null jaxbContext, returns null. Check your configuration, e.g. jaxb-transformers!");
return null;
}
try {
StringWriter writer = new StringWriter();
Marshaller marshaller = jaxbContext.createMarshaller();
if (marshallProps != null) {
for (Entry<String, Object> entry : marshallProps.entrySet()) {
marshaller.setProperty(entry.getKey(), entry.getValue());
}
}
marshaller.marshal(jaxbObject, writer);
String xml = writer.toString();
if (logger.isDebugEnabled()) logger.debug("marshalled jaxb object of type {}, returns xml: {}", jaxbObject.getClass().getSimpleName(), xml);
return xml;
} catch (JAXBException e) {
throw new RuntimeException(e);
}
} | java | public String marshal(Object jaxbObject) {
// Precondition, check that the jaxbContext is set!
if (jaxbContext == null) {
logger.error("Trying to marshal with a null jaxbContext, returns null. Check your configuration, e.g. jaxb-transformers!");
return null;
}
try {
StringWriter writer = new StringWriter();
Marshaller marshaller = jaxbContext.createMarshaller();
if (marshallProps != null) {
for (Entry<String, Object> entry : marshallProps.entrySet()) {
marshaller.setProperty(entry.getKey(), entry.getValue());
}
}
marshaller.marshal(jaxbObject, writer);
String xml = writer.toString();
if (logger.isDebugEnabled()) logger.debug("marshalled jaxb object of type {}, returns xml: {}", jaxbObject.getClass().getSimpleName(), xml);
return xml;
} catch (JAXBException e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"marshal",
"(",
"Object",
"jaxbObject",
")",
"{",
"// Precondition, check that the jaxbContext is set!",
"if",
"(",
"jaxbContext",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"Trying to marshal with a null jaxbContext, returns null. Check your c... | Marshal a JAXB object to a XML-string
@param jaxbObject
@return the XML string | [
"Marshal",
"a",
"JAXB",
"object",
"to",
"a",
"XML",
"-",
"string"
] | e891350dbf55e6307be94d193d056bdb785b37d3 | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/jaxb/JaxbUtil.java#L113-L140 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/NmeaMessageExactEarthTimestamp.java | NmeaMessageExactEarthTimestamp.isPghp | @VisibleForTesting
static boolean isPghp(String line) {
if (line == null)
return false;
else
// return Pattern.matches("^(\\\\.*\\\\)?\\$PGHP.*$", line);
return pghpPattern.matcher(line).matches();
} | java | @VisibleForTesting
static boolean isPghp(String line) {
if (line == null)
return false;
else
// return Pattern.matches("^(\\\\.*\\\\)?\\$PGHP.*$", line);
return pghpPattern.matcher(line).matches();
} | [
"@",
"VisibleForTesting",
"static",
"boolean",
"isPghp",
"(",
"String",
"line",
")",
"{",
"if",
"(",
"line",
"==",
"null",
")",
"return",
"false",
";",
"else",
"// return Pattern.matches(\"^(\\\\\\\\.*\\\\\\\\)?\\\\$PGHP.*$\", line);",
"return",
"pghpPattern",
".",
"m... | Returns true if and only if the given NMEA line is a PGHP line. Remember
that the line can start with a tag block.
@param line
@return | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"the",
"given",
"NMEA",
"line",
"is",
"a",
"PGHP",
"line",
".",
"Remember",
"that",
"the",
"line",
"can",
"start",
"with",
"a",
"tag",
"block",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/NmeaMessageExactEarthTimestamp.java#L62-L69 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/NmeaMessageExactEarthTimestamp.java | NmeaMessageExactEarthTimestamp.isExactEarthTimestamp | public static boolean isExactEarthTimestamp(String line) {
try {
new NmeaMessageExactEarthTimestamp(line);
return true;
} catch (AisParseException e) {
return false;
} catch (NmeaMessageParseException e) {
return false;
}
} | java | public static boolean isExactEarthTimestamp(String line) {
try {
new NmeaMessageExactEarthTimestamp(line);
return true;
} catch (AisParseException e) {
return false;
} catch (NmeaMessageParseException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isExactEarthTimestamp",
"(",
"String",
"line",
")",
"{",
"try",
"{",
"new",
"NmeaMessageExactEarthTimestamp",
"(",
"line",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"AisParseException",
"e",
")",
"{",
"return",
"false"... | Returns true if the given line is a custom ExactEarth timestamp.
@param line
@return | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"a",
"custom",
"ExactEarth",
"timestamp",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/NmeaMessageExactEarthTimestamp.java#L77-L86 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/NmeaMessageExactEarthTimestamp.java | NmeaMessageExactEarthTimestamp.getTime | private static long getTime(int year, int month, int day, int hour,
int minute, int second, int millisecond) {
Calendar cal = Calendar.getInstance(Util.TIME_ZONE_UTC);
cal.set(year, month - 1, day, hour, minute, second);
cal.set(Calendar.MILLISECOND, millisecond);
return cal.getTimeInMillis();
} | java | private static long getTime(int year, int month, int day, int hour,
int minute, int second, int millisecond) {
Calendar cal = Calendar.getInstance(Util.TIME_ZONE_UTC);
cal.set(year, month - 1, day, hour, minute, second);
cal.set(Calendar.MILLISECOND, millisecond);
return cal.getTimeInMillis();
} | [
"private",
"static",
"long",
"getTime",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
",",
"int",
"hour",
",",
"int",
"minute",
",",
"int",
"second",
",",
"int",
"millisecond",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstan... | Returns the epoch time in ms.
@return | [
"Returns",
"the",
"epoch",
"time",
"in",
"ms",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/NmeaMessageExactEarthTimestamp.java#L103-L109 | train |
soi-toolkit/soi-toolkit-mule | tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/GeneratorUtil.java | GeneratorUtil.getFolderAndCreateIfMissing | private String getFolderAndCreateIfMissing(String inFolder) {
String folder = outputFolder;
if (inFolder != null) {
folder += "/" + inFolder;
}
mkdirs(folder);
return folder;
} | java | private String getFolderAndCreateIfMissing(String inFolder) {
String folder = outputFolder;
if (inFolder != null) {
folder += "/" + inFolder;
}
mkdirs(folder);
return folder;
} | [
"private",
"String",
"getFolderAndCreateIfMissing",
"(",
"String",
"inFolder",
")",
"{",
"String",
"folder",
"=",
"outputFolder",
";",
"if",
"(",
"inFolder",
"!=",
"null",
")",
"{",
"folder",
"+=",
"\"/\"",
"+",
"inFolder",
";",
"}",
"mkdirs",
"(",
"folder",... | Computes foldername and creates the folders that does not already exist
@param inFolder, left out if null
@return | [
"Computes",
"foldername",
"and",
"creates",
"the",
"folders",
"that",
"does",
"not",
"already",
"exist"
] | e891350dbf55e6307be94d193d056bdb785b37d3 | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/GeneratorUtil.java#L331-L338 | train |
Putnami/putnami-web-toolkit | core/src/main/java/fr/putnami/pwt/core/event/client/EventBus.java | EventBus.get | public static EventBus get() {
if (EventBus.instance == null) {
EventBus.instance = new EventBus();
}
return EventBus.instance;
} | java | public static EventBus get() {
if (EventBus.instance == null) {
EventBus.instance = new EventBus();
}
return EventBus.instance;
} | [
"public",
"static",
"EventBus",
"get",
"(",
")",
"{",
"if",
"(",
"EventBus",
".",
"instance",
"==",
"null",
")",
"{",
"EventBus",
".",
"instance",
"=",
"new",
"EventBus",
"(",
")",
";",
"}",
"return",
"EventBus",
".",
"instance",
";",
"}"
] | Get the singleton.
@return the event bus | [
"Get",
"the",
"singleton",
"."
] | 129aa781d1bda508e579d194693ca3034b4d470b | https://github.com/Putnami/putnami-web-toolkit/blob/129aa781d1bda508e579d194693ca3034b4d470b/core/src/main/java/fr/putnami/pwt/core/event/client/EventBus.java#L40-L45 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorClusters.java | ORecordIteratorClusters.last | @Override
public ORecordIteratorClusters<REC> last() {
currentClusterIdx = clusterIds.length - 1;
current.clusterPosition = liveUpdated ? database.countClusterElements(clusterIds[currentClusterIdx]) : lastClusterPosition + 1;
return this;
} | java | @Override
public ORecordIteratorClusters<REC> last() {
currentClusterIdx = clusterIds.length - 1;
current.clusterPosition = liveUpdated ? database.countClusterElements(clusterIds[currentClusterIdx]) : lastClusterPosition + 1;
return this;
} | [
"@",
"Override",
"public",
"ORecordIteratorClusters",
"<",
"REC",
">",
"last",
"(",
")",
"{",
"currentClusterIdx",
"=",
"clusterIds",
".",
"length",
"-",
"1",
";",
"current",
".",
"clusterPosition",
"=",
"liveUpdated",
"?",
"database",
".",
"countClusterElements... | Move the iterator to the end of the range. If no range was specified move to the last record of the cluster.
@return The object itself | [
"Move",
"the",
"iterator",
"to",
"the",
"end",
"of",
"the",
"range",
".",
"If",
"no",
"range",
"was",
"specified",
"move",
"to",
"the",
"last",
"record",
"of",
"the",
"cluster",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorClusters.java#L274-L279 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/string/ORecordSerializerCSVAbstract.java | ORecordSerializerCSVAbstract.linkToStream | private static OIdentifiable linkToStream(final StringBuilder buffer, final ORecordSchemaAware<?> iParentRecord, Object iLinked) {
if (iLinked == null)
// NULL REFERENCE
return null;
OIdentifiable resultRid = null;
ORID rid;
final ODatabaseRecord database = ODatabaseRecordThreadLocal.INSTANCE.get();
if (iLinked instanceof ORID) {
// JUST THE REFERENCE
rid = (ORID) iLinked;
if (rid.isValid() && rid.isNew()) {
// SAVE AT THE FLY AND STORE THE NEW RID
final ORecord<?> record = rid.getRecord();
if (database.getTransaction().isActive()) {
// USE THE DEFAULT CLUSTER
database.save((ORecordInternal<?>) record);
} else
database.save((ORecordInternal<?>) record);
if (record != null)
rid = record.getIdentity();
resultRid = rid;
}
} else {
if (iLinked instanceof String)
iLinked = new ORecordId((String) iLinked);
else if (!(iLinked instanceof ORecordInternal<?>)) {
// NOT RECORD: TRY TO EXTRACT THE DOCUMENT IF ANY
final String boundDocumentField = OObjectSerializerHelperManager.getInstance().getDocumentBoundField(iLinked.getClass());
if (boundDocumentField != null)
iLinked = OObjectSerializerHelperManager.getInstance().getFieldValue(iLinked, boundDocumentField);
}
if (!(iLinked instanceof OIdentifiable))
throw new IllegalArgumentException("Invalid object received. Expected a OIdentifiable but received type="
+ iLinked.getClass().getName() + " and value=" + iLinked);
// RECORD
ORecordInternal<?> iLinkedRecord = ((OIdentifiable) iLinked).getRecord();
rid = iLinkedRecord.getIdentity();
if (rid.isNew() || iLinkedRecord.isDirty()) {
if (iLinkedRecord instanceof ODocument) {
final OClass schemaClass = ((ODocument) iLinkedRecord).getSchemaClass();
database.save(iLinkedRecord, schemaClass != null ? database.getClusterNameById(schemaClass.getDefaultClusterId()) : null);
} else
// STORE THE TRAVERSED OBJECT TO KNOW THE RECORD ID. CALL THIS VERSION TO AVOID CLEAR OF STACK IN THREAD-LOCAL
database.save(iLinkedRecord);
final ODatabaseComplex<?> dbOwner = database.getDatabaseOwner();
dbOwner.registerUserObjectAfterLinkSave(iLinkedRecord);
resultRid = iLinkedRecord;
}
if (iParentRecord != null && database instanceof ODatabaseRecord) {
final ODatabaseRecord db = database;
if (!db.isRetainRecords())
// REPLACE CURRENT RECORD WITH ITS ID: THIS SAVES A LOT OF MEMORY
resultRid = iLinkedRecord.getIdentity();
}
}
if (rid.isValid())
rid.toString(buffer);
return resultRid;
} | java | private static OIdentifiable linkToStream(final StringBuilder buffer, final ORecordSchemaAware<?> iParentRecord, Object iLinked) {
if (iLinked == null)
// NULL REFERENCE
return null;
OIdentifiable resultRid = null;
ORID rid;
final ODatabaseRecord database = ODatabaseRecordThreadLocal.INSTANCE.get();
if (iLinked instanceof ORID) {
// JUST THE REFERENCE
rid = (ORID) iLinked;
if (rid.isValid() && rid.isNew()) {
// SAVE AT THE FLY AND STORE THE NEW RID
final ORecord<?> record = rid.getRecord();
if (database.getTransaction().isActive()) {
// USE THE DEFAULT CLUSTER
database.save((ORecordInternal<?>) record);
} else
database.save((ORecordInternal<?>) record);
if (record != null)
rid = record.getIdentity();
resultRid = rid;
}
} else {
if (iLinked instanceof String)
iLinked = new ORecordId((String) iLinked);
else if (!(iLinked instanceof ORecordInternal<?>)) {
// NOT RECORD: TRY TO EXTRACT THE DOCUMENT IF ANY
final String boundDocumentField = OObjectSerializerHelperManager.getInstance().getDocumentBoundField(iLinked.getClass());
if (boundDocumentField != null)
iLinked = OObjectSerializerHelperManager.getInstance().getFieldValue(iLinked, boundDocumentField);
}
if (!(iLinked instanceof OIdentifiable))
throw new IllegalArgumentException("Invalid object received. Expected a OIdentifiable but received type="
+ iLinked.getClass().getName() + " and value=" + iLinked);
// RECORD
ORecordInternal<?> iLinkedRecord = ((OIdentifiable) iLinked).getRecord();
rid = iLinkedRecord.getIdentity();
if (rid.isNew() || iLinkedRecord.isDirty()) {
if (iLinkedRecord instanceof ODocument) {
final OClass schemaClass = ((ODocument) iLinkedRecord).getSchemaClass();
database.save(iLinkedRecord, schemaClass != null ? database.getClusterNameById(schemaClass.getDefaultClusterId()) : null);
} else
// STORE THE TRAVERSED OBJECT TO KNOW THE RECORD ID. CALL THIS VERSION TO AVOID CLEAR OF STACK IN THREAD-LOCAL
database.save(iLinkedRecord);
final ODatabaseComplex<?> dbOwner = database.getDatabaseOwner();
dbOwner.registerUserObjectAfterLinkSave(iLinkedRecord);
resultRid = iLinkedRecord;
}
if (iParentRecord != null && database instanceof ODatabaseRecord) {
final ODatabaseRecord db = database;
if (!db.isRetainRecords())
// REPLACE CURRENT RECORD WITH ITS ID: THIS SAVES A LOT OF MEMORY
resultRid = iLinkedRecord.getIdentity();
}
}
if (rid.isValid())
rid.toString(buffer);
return resultRid;
} | [
"private",
"static",
"OIdentifiable",
"linkToStream",
"(",
"final",
"StringBuilder",
"buffer",
",",
"final",
"ORecordSchemaAware",
"<",
"?",
">",
"iParentRecord",
",",
"Object",
"iLinked",
")",
"{",
"if",
"(",
"iLinked",
"==",
"null",
")",
"// NULL REFERENCE\r",
... | Serialize the link.
@param buffer
@param iParentRecord
@param iFieldName
TODO
@param iLinked
Can be an instance of ORID or a Record<?>
@return | [
"Serialize",
"the",
"link",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/record/string/ORecordSerializerCSVAbstract.java#L692-L765 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerShared.java | OIndexManagerShared.toStream | @Override
public ODocument toStream() {
acquireExclusiveLock();
try {
document.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING);
try {
final ORecordTrackedSet idxs = new ORecordTrackedSet(document);
for (final OIndexInternal<?> i : indexes.values()) {
idxs.add(i.updateConfiguration());
}
document.field(CONFIG_INDEXES, idxs, OType.EMBEDDEDSET);
} finally {
document.setInternalStatus(ORecordElement.STATUS.LOADED);
}
document.setDirty();
return document;
} finally {
releaseExclusiveLock();
}
} | java | @Override
public ODocument toStream() {
acquireExclusiveLock();
try {
document.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING);
try {
final ORecordTrackedSet idxs = new ORecordTrackedSet(document);
for (final OIndexInternal<?> i : indexes.values()) {
idxs.add(i.updateConfiguration());
}
document.field(CONFIG_INDEXES, idxs, OType.EMBEDDEDSET);
} finally {
document.setInternalStatus(ORecordElement.STATUS.LOADED);
}
document.setDirty();
return document;
} finally {
releaseExclusiveLock();
}
} | [
"@",
"Override",
"public",
"ODocument",
"toStream",
"(",
")",
"{",
"acquireExclusiveLock",
"(",
")",
";",
"try",
"{",
"document",
".",
"setInternalStatus",
"(",
"ORecordElement",
".",
"STATUS",
".",
"UNMARSHALLING",
")",
";",
"try",
"{",
"final",
"ORecordTrack... | Binds POJO to ODocument. | [
"Binds",
"POJO",
"to",
"ODocument",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/index/OIndexManagerShared.java#L166-L189 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/RtmpClient.java | RtmpClient.releaseCallbacks | private void releaseCallbacks(Exception ex) {
synchronized (callbacks) {
for (Map.Entry<Integer, InvokeCallback> cb: callbacks.entrySet()) {
cb.getValue().release(ex);
}
}
} | java | private void releaseCallbacks(Exception ex) {
synchronized (callbacks) {
for (Map.Entry<Integer, InvokeCallback> cb: callbacks.entrySet()) {
cb.getValue().release(ex);
}
}
} | [
"private",
"void",
"releaseCallbacks",
"(",
"Exception",
"ex",
")",
"{",
"synchronized",
"(",
"callbacks",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"InvokeCallback",
">",
"cb",
":",
"callbacks",
".",
"entrySet",
"(",
")",
")",
"{",... | Release waiting threads if we fail for some reason | [
"Release",
"waiting",
"threads",
"if",
"we",
"fail",
"for",
"some",
"reason"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/RtmpClient.java#L205-L211 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java | NmeaStreamProcessor.line | synchronized void line(String line, long arrivalTime) {
if (count.incrementAndGet() % logCountFrequency == 0)
log.info("count=" + count.get() + ",buffer size=" + lines.size());
NmeaMessage nmea;
try {
nmea = NmeaUtil.parseNmea(line);
} catch (NmeaMessageParseException e) {
listener.invalidNmea(line, arrivalTime, e.getMessage());
return;
}
// if is multi line message then don't report to listener till last
// message in sequence has been received.
if (!nmea.isSingleSentence()) {
Optional<List<NmeaMessage>> messages = nmeaBuffer.add(nmea);
if (messages.isPresent()) {
Optional<NmeaMessage> joined = AisNmeaBuffer
.concatenateMessages(messages.get());
if (joined.isPresent()) {
if (joined.get().getUnixTimeMillis() != null)
listener.message(joined.get().toLine(), joined.get()
.getUnixTimeMillis());
else
listener.message(joined.get().toLine(), arrivalTime);
}
// TODO else report error, might need to change signature of
// listener to handle problem with multi-line message
}
return;
}
if (nmea.getUnixTimeMillis() != null) {
listener.message(line, nmea.getUnixTimeMillis());
return;
}
if (!matchWithTimestampLine) {
listener.message(line, arrivalTime);
return;
}
if (!NmeaUtil.isValid(line))
return;
addLine(line, arrivalTime);
log.debug("buffer lines=" + lines.size());
Integer earliestTimestampLineIndex = getEarliestTimestampLineIndex(lines);
Set<Integer> removeThese;
if (earliestTimestampLineIndex != null) {
removeThese = matchWithClosestAisMessageIfBufferLargeEnough(
arrivalTime, earliestTimestampLineIndex);
} else
removeThese = findExpiredIndexesBeforeIndex(lastIndex());
TreeSet<Integer> orderedIndexes = Sets.newTreeSet(removeThese);
for (int index : orderedIndexes.descendingSet()) {
removeLineWithIndex(index);
}
} | java | synchronized void line(String line, long arrivalTime) {
if (count.incrementAndGet() % logCountFrequency == 0)
log.info("count=" + count.get() + ",buffer size=" + lines.size());
NmeaMessage nmea;
try {
nmea = NmeaUtil.parseNmea(line);
} catch (NmeaMessageParseException e) {
listener.invalidNmea(line, arrivalTime, e.getMessage());
return;
}
// if is multi line message then don't report to listener till last
// message in sequence has been received.
if (!nmea.isSingleSentence()) {
Optional<List<NmeaMessage>> messages = nmeaBuffer.add(nmea);
if (messages.isPresent()) {
Optional<NmeaMessage> joined = AisNmeaBuffer
.concatenateMessages(messages.get());
if (joined.isPresent()) {
if (joined.get().getUnixTimeMillis() != null)
listener.message(joined.get().toLine(), joined.get()
.getUnixTimeMillis());
else
listener.message(joined.get().toLine(), arrivalTime);
}
// TODO else report error, might need to change signature of
// listener to handle problem with multi-line message
}
return;
}
if (nmea.getUnixTimeMillis() != null) {
listener.message(line, nmea.getUnixTimeMillis());
return;
}
if (!matchWithTimestampLine) {
listener.message(line, arrivalTime);
return;
}
if (!NmeaUtil.isValid(line))
return;
addLine(line, arrivalTime);
log.debug("buffer lines=" + lines.size());
Integer earliestTimestampLineIndex = getEarliestTimestampLineIndex(lines);
Set<Integer> removeThese;
if (earliestTimestampLineIndex != null) {
removeThese = matchWithClosestAisMessageIfBufferLargeEnough(
arrivalTime, earliestTimestampLineIndex);
} else
removeThese = findExpiredIndexesBeforeIndex(lastIndex());
TreeSet<Integer> orderedIndexes = Sets.newTreeSet(removeThese);
for (int index : orderedIndexes.descendingSet()) {
removeLineWithIndex(index);
}
} | [
"synchronized",
"void",
"line",
"(",
"String",
"line",
",",
"long",
"arrivalTime",
")",
"{",
"if",
"(",
"count",
".",
"incrementAndGet",
"(",
")",
"%",
"logCountFrequency",
"==",
"0",
")",
"log",
".",
"info",
"(",
"\"count=\"",
"+",
"count",
".",
"get",
... | Handles the arrival of a new NMEA line at the given arrival time.
@param line
@param arrivalTime | [
"Handles",
"the",
"arrival",
"of",
"a",
"new",
"NMEA",
"line",
"at",
"the",
"given",
"arrival",
"time",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java#L91-L150 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java | NmeaStreamProcessor.findExpiredIndexesBeforeIndex | private Set<Integer> findExpiredIndexesBeforeIndex(int index) {
long indexTime = getLineTime(index);
Set<Integer> removeThese = Sets.newHashSet();
for (int i = index - 1; i >= 0; i--) {
if (indexTime - getLineTime(i) > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS) {
listener.timestampNotFound(getLine(i), getLineTime(i));
removeThese.add(i);
}
}
return removeThese;
} | java | private Set<Integer> findExpiredIndexesBeforeIndex(int index) {
long indexTime = getLineTime(index);
Set<Integer> removeThese = Sets.newHashSet();
for (int i = index - 1; i >= 0; i--) {
if (indexTime - getLineTime(i) > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS) {
listener.timestampNotFound(getLine(i), getLineTime(i));
removeThese.add(i);
}
}
return removeThese;
} | [
"private",
"Set",
"<",
"Integer",
">",
"findExpiredIndexesBeforeIndex",
"(",
"int",
"index",
")",
"{",
"long",
"indexTime",
"=",
"getLineTime",
"(",
"index",
")",
";",
"Set",
"<",
"Integer",
">",
"removeThese",
"=",
"Sets",
".",
"newHashSet",
"(",
")",
";"... | Returns the list of those indexes that can be removed from the buffer
because they have a timestamp more than
MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS from the arrival time of the given
index.
@param index
@return | [
"Returns",
"the",
"list",
"of",
"those",
"indexes",
"that",
"can",
"be",
"removed",
"from",
"the",
"buffer",
"because",
"they",
"have",
"a",
"timestamp",
"more",
"than",
"MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS",
"from",
"the",
"arrival",
"time",
"of",
"the",
"given"... | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java#L170-L180 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java | NmeaStreamProcessor.matchWithClosestAisMessageIfBufferLargeEnough | private Set<Integer> matchWithClosestAisMessageIfBufferLargeEnough(
long arrivalTime, Integer earliestTimestampLineIndex) {
String timestampLine = getLine(earliestTimestampLineIndex);
long time = getLineTime(earliestTimestampLineIndex);
log.debug("ts=" + timestampLine + ",time=" + time);
Set<Integer> removeThese;
if (arrivalTime - time > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS) {
removeThese = matchWithClosestAisMessageAndFindIndexesToRemove(
earliestTimestampLineIndex, timestampLine, time);
} else
removeThese = findExpiredIndexesBeforeIndex(earliestTimestampLineIndex);
return removeThese;
} | java | private Set<Integer> matchWithClosestAisMessageIfBufferLargeEnough(
long arrivalTime, Integer earliestTimestampLineIndex) {
String timestampLine = getLine(earliestTimestampLineIndex);
long time = getLineTime(earliestTimestampLineIndex);
log.debug("ts=" + timestampLine + ",time=" + time);
Set<Integer> removeThese;
if (arrivalTime - time > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS) {
removeThese = matchWithClosestAisMessageAndFindIndexesToRemove(
earliestTimestampLineIndex, timestampLine, time);
} else
removeThese = findExpiredIndexesBeforeIndex(earliestTimestampLineIndex);
return removeThese;
} | [
"private",
"Set",
"<",
"Integer",
">",
"matchWithClosestAisMessageIfBufferLargeEnough",
"(",
"long",
"arrivalTime",
",",
"Integer",
"earliestTimestampLineIndex",
")",
"{",
"String",
"timestampLine",
"=",
"getLine",
"(",
"earliestTimestampLineIndex",
")",
";",
"long",
"t... | Finds matches and reports them to the listeners if buffer has a sufficent
span of time in it. Returns the indexes that should be removed from the
buffer.
@param arrivalTime
@param earliestTimestampLineIndex
@return | [
"Finds",
"matches",
"and",
"reports",
"them",
"to",
"the",
"listeners",
"if",
"buffer",
"has",
"a",
"sufficent",
"span",
"of",
"time",
"in",
"it",
".",
"Returns",
"the",
"indexes",
"that",
"should",
"be",
"removed",
"from",
"the",
"buffer",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java#L191-L203 | train |
amsa-code/risky | ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java | NmeaStreamProcessor.reportMatchAndFindIndexesToRemove | private Set<Integer> reportMatchAndFindIndexesToRemove(
Integer earliestTimestampLineIndex,
NmeaMessageExactEarthTimestamp timestamp,
Integer lowestTimeDiffIndex) {
String msg = getLine(lowestTimeDiffIndex);
log.debug("found matching msg=" + msg);
listener.message(msg, timestamp.getTime());
int maxIndex = Math
.max(lowestTimeDiffIndex, earliestTimestampLineIndex);
int minIndex = Math
.min(lowestTimeDiffIndex, earliestTimestampLineIndex);
// now remove from lists must remove bigger index first,
// otherwise indexes will change
return Sets.newHashSet(minIndex, maxIndex);
} | java | private Set<Integer> reportMatchAndFindIndexesToRemove(
Integer earliestTimestampLineIndex,
NmeaMessageExactEarthTimestamp timestamp,
Integer lowestTimeDiffIndex) {
String msg = getLine(lowestTimeDiffIndex);
log.debug("found matching msg=" + msg);
listener.message(msg, timestamp.getTime());
int maxIndex = Math
.max(lowestTimeDiffIndex, earliestTimestampLineIndex);
int minIndex = Math
.min(lowestTimeDiffIndex, earliestTimestampLineIndex);
// now remove from lists must remove bigger index first,
// otherwise indexes will change
return Sets.newHashSet(minIndex, maxIndex);
} | [
"private",
"Set",
"<",
"Integer",
">",
"reportMatchAndFindIndexesToRemove",
"(",
"Integer",
"earliestTimestampLineIndex",
",",
"NmeaMessageExactEarthTimestamp",
"timestamp",
",",
"Integer",
"lowestTimeDiffIndex",
")",
"{",
"String",
"msg",
"=",
"getLine",
"(",
"lowestTime... | Reports a found match and returns the indexes that can be removed from
the buffer.
@param earliestTimestampLineIndex
@param timestamp
@param lowestTimeDiffIndex
@return | [
"Reports",
"a",
"found",
"match",
"and",
"returns",
"the",
"indexes",
"that",
"can",
"be",
"removed",
"from",
"the",
"buffer",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/NmeaStreamProcessor.java#L283-L298 | train |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/mail/MailUtil.java | MailUtil.createMimeMessage | public static MimeMessage createMimeMessage(Session session, String from, String[] to, String subject, String content, DataSource[] attachments) {
logger.debug("Creates a mime message with {} attachments", (attachments == null) ? 0 : attachments.length);
try {
MimeMessage message = new MimeMessage(session);
if (from != null) {
message.setSender(new InternetAddress(from));
}
if (subject != null) {
message.setSubject(subject, "UTF-8");
}
if (to != null) {
for (String toAdr : to) {
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAdr));
}
}
if (attachments == null || attachments.length == 0) {
// Setup a plain text message
message.setContent(content, "text/plain; charset=UTF-8");
} else {
// Setup a multipart message
Multipart multipart = new MimeMultipart();
message.setContent(multipart);
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(content, "text/plain; charset=UTF-8");
multipart.addBodyPart(messageBodyPart);
// Add attachments, if any
if (attachments != null) {
for (DataSource attachment : attachments) {
BodyPart attatchmentBodyPart = new MimeBodyPart();
attatchmentBodyPart.setDataHandler(new DataHandler(attachment));
attatchmentBodyPart.setFileName(attachment.getName());
multipart.addBodyPart(attatchmentBodyPart);
}
}
}
return message;
} catch (AddressException e) {
throw new RuntimeException(e);
} catch (MessagingException e) {
throw new RuntimeException(e);
}
} | java | public static MimeMessage createMimeMessage(Session session, String from, String[] to, String subject, String content, DataSource[] attachments) {
logger.debug("Creates a mime message with {} attachments", (attachments == null) ? 0 : attachments.length);
try {
MimeMessage message = new MimeMessage(session);
if (from != null) {
message.setSender(new InternetAddress(from));
}
if (subject != null) {
message.setSubject(subject, "UTF-8");
}
if (to != null) {
for (String toAdr : to) {
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAdr));
}
}
if (attachments == null || attachments.length == 0) {
// Setup a plain text message
message.setContent(content, "text/plain; charset=UTF-8");
} else {
// Setup a multipart message
Multipart multipart = new MimeMultipart();
message.setContent(multipart);
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(content, "text/plain; charset=UTF-8");
multipart.addBodyPart(messageBodyPart);
// Add attachments, if any
if (attachments != null) {
for (DataSource attachment : attachments) {
BodyPart attatchmentBodyPart = new MimeBodyPart();
attatchmentBodyPart.setDataHandler(new DataHandler(attachment));
attatchmentBodyPart.setFileName(attachment.getName());
multipart.addBodyPart(attatchmentBodyPart);
}
}
}
return message;
} catch (AddressException e) {
throw new RuntimeException(e);
} catch (MessagingException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"MimeMessage",
"createMimeMessage",
"(",
"Session",
"session",
",",
"String",
"from",
",",
"String",
"[",
"]",
"to",
",",
"String",
"subject",
",",
"String",
"content",
",",
"DataSource",
"[",
"]",
"attachments",
")",
"{",
"logger",
".",
... | Creates a mime-message, multipart if attachements are supplied otherwise as plain text. Assumes UTF-8 encoding for both subject and content.
@param session, must be specified
@param from, can be null
@param to, can be null or empty
@param subject, can be null
@param content, must be specified
@param attachments, can be null or empty
@return the mime-message
@throws MessagingException
@throws AddressException
@throws NoSuchProviderException | [
"Creates",
"a",
"mime",
"-",
"message",
"multipart",
"if",
"attachements",
"are",
"supplied",
"otherwise",
"as",
"plain",
"text",
".",
"Assumes",
"UTF",
"-",
"8",
"encoding",
"for",
"both",
"subject",
"and",
"content",
"."
] | e891350dbf55e6307be94d193d056bdb785b37d3 | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/mail/MailUtil.java#L289-L341 | train |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/soap/SoapUtil.java | SoapUtil.disableTlsServerCertificateCheck | public static void disableTlsServerCertificateCheck(Client client) {
if (!(client.getConduit() instanceof HTTPConduit)) {
log.warn("Conduit not of type HTTPConduit (" + client.getConduit().getClass().getName() + ") , skip disabling server certification validation.");
return;
}
log.warn("Disables server certification validation for: " + client.getEndpoint().getEndpointInfo().getAddress());
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsParams = new TLSClientParameters();
TrustManager[] trustAllCerts = new TrustManager[] { new FakeTrustManager() };
tlsParams.setTrustManagers(trustAllCerts);
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);
} | java | public static void disableTlsServerCertificateCheck(Client client) {
if (!(client.getConduit() instanceof HTTPConduit)) {
log.warn("Conduit not of type HTTPConduit (" + client.getConduit().getClass().getName() + ") , skip disabling server certification validation.");
return;
}
log.warn("Disables server certification validation for: " + client.getEndpoint().getEndpointInfo().getAddress());
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsParams = new TLSClientParameters();
TrustManager[] trustAllCerts = new TrustManager[] { new FakeTrustManager() };
tlsParams.setTrustManagers(trustAllCerts);
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);
} | [
"public",
"static",
"void",
"disableTlsServerCertificateCheck",
"(",
"Client",
"client",
")",
"{",
"if",
"(",
"!",
"(",
"client",
".",
"getConduit",
"(",
")",
"instanceof",
"HTTPConduit",
")",
")",
"{",
"log",
".",
"warn",
"(",
"\"Conduit not of type HTTPConduit... | Disables validation of https server certificates, only to be used during development and tests!!!
@param client | [
"Disables",
"validation",
"of",
"https",
"server",
"certificates",
"only",
"to",
"be",
"used",
"during",
"development",
"and",
"tests!!!"
] | e891350dbf55e6307be94d193d056bdb785b37d3 | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/soap/SoapUtil.java#L48-L63 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java | OUser.isRuleDefined | public boolean isRuleDefined(final String iResource) {
for (ORole r : roles)
if (r.hasRule(iResource))
return true;
return false;
} | java | public boolean isRuleDefined(final String iResource) {
for (ORole r : roles)
if (r.hasRule(iResource))
return true;
return false;
} | [
"public",
"boolean",
"isRuleDefined",
"(",
"final",
"String",
"iResource",
")",
"{",
"for",
"(",
"ORole",
"r",
":",
"roles",
")",
"if",
"(",
"r",
".",
"hasRule",
"(",
"iResource",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Checks if a rule was defined for the user.
@param iResource
Requested resource
@return True is a rule is defined, otherwise false | [
"Checks",
"if",
"a",
"rule",
"was",
"defined",
"for",
"the",
"user",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OUser.java#L137-L143 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterProperty.java | OCommandExecutorSQLAlterProperty.execute | public Object execute(final Map<Object, Object> iArgs) {
if (attribute == null)
throw new OCommandExecutionException("Cannot execute the command because it has not yet been parsed");
final OClassImpl sourceClass = (OClassImpl) getDatabase().getMetadata().getSchema().getClass(className);
if (sourceClass == null)
throw new OCommandExecutionException("Source class '" + className + "' not found");
final OPropertyImpl prop = (OPropertyImpl) sourceClass.getProperty(fieldName);
if (prop == null)
throw new OCommandExecutionException("Property '" + className + "." + fieldName + "' not exists");
prop.setInternalAndSave(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 yet been parsed");
final OClassImpl sourceClass = (OClassImpl) getDatabase().getMetadata().getSchema().getClass(className);
if (sourceClass == null)
throw new OCommandExecutionException("Source class '" + className + "' not found");
final OPropertyImpl prop = (OPropertyImpl) sourceClass.getProperty(fieldName);
if (prop == null)
throw new OCommandExecutionException("Property '" + className + "." + fieldName + "' not exists");
prop.setInternalAndSave(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 yet been parsed\"",... | Execute the ALTER PROPERTY. | [
"Execute",
"the",
"ALTER",
"PROPERTY",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLAlterProperty.java#L109-L123 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerOld.java | OMMapManagerOld.flush | public void flush() {
lock.writeLock().lock();
try {
OMMapBufferEntry entry;
for (Iterator<OMMapBufferEntry> it = bufferPoolLRU.iterator(); it.hasNext();) {
entry = it.next();
if (entry.file != null && entry.file.isClosed()) {
if (removeEntry(entry))
it.remove();
}
}
} finally {
lock.writeLock().unlock();
}
} | java | public void flush() {
lock.writeLock().lock();
try {
OMMapBufferEntry entry;
for (Iterator<OMMapBufferEntry> it = bufferPoolLRU.iterator(); it.hasNext();) {
entry = it.next();
if (entry.file != null && entry.file.isClosed()) {
if (removeEntry(entry))
it.remove();
}
}
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"void",
"flush",
"(",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"OMMapBufferEntry",
"entry",
";",
"for",
"(",
"Iterator",
"<",
"OMMapBufferEntry",
">",
"it",
"=",
"bufferPoolLRU",
".",
"iterator",
"... | Flushes away all the buffers of closed files. This frees the memory. | [
"Flushes",
"away",
"all",
"the",
"buffers",
"of",
"closed",
"files",
".",
"This",
"frees",
"the",
"memory",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerOld.java#L293-L307 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerOld.java | OMMapManagerOld.flushFile | public void flushFile(final OFileMMap iFile) {
lock.readLock().lock();
try {
final List<OMMapBufferEntry> entries = bufferPoolPerFile.get(iFile);
if (entries != null)
for (OMMapBufferEntry entry : entries)
entry.flush();
} finally {
lock.readLock().unlock();
}
} | java | public void flushFile(final OFileMMap iFile) {
lock.readLock().lock();
try {
final List<OMMapBufferEntry> entries = bufferPoolPerFile.get(iFile);
if (entries != null)
for (OMMapBufferEntry entry : entries)
entry.flush();
} finally {
lock.readLock().unlock();
}
} | [
"public",
"void",
"flushFile",
"(",
"final",
"OFileMMap",
"iFile",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"List",
"<",
"OMMapBufferEntry",
">",
"entries",
"=",
"bufferPoolPerFile",
".",
"get",
"(",
... | Flushes all the buffers of the passed file.
@param iFile
file to flush on disk. | [
"Flushes",
"all",
"the",
"buffers",
"of",
"the",
"passed",
"file",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerOld.java#L357-L367 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerOld.java | OMMapManagerOld.searchEntry | private static int searchEntry(final List<OMMapBufferEntry> fileEntries, final long iBeginOffset, final int iSize) {
if (fileEntries == null || fileEntries.size() == 0)
return -1;
int high = fileEntries.size() - 1;
if (high < 0)
// NOT FOUND
return -1;
int low = 0;
int mid = -1;
// BINARY SEARCH
OMMapBufferEntry e;
while (low <= high) {
mid = (low + high) >>> 1;
e = fileEntries.get(mid);
if (iBeginOffset >= e.beginOffset && iBeginOffset + iSize <= e.beginOffset + e.size) {
// FOUND: USE IT
OProfiler.getInstance().updateCounter("OMMapManager.reusedPage", 1);
e.counter++;
return mid;
}
if (low == high) {
if (iBeginOffset > e.beginOffset)
// NEXT POSITION
low++;
// NOT FOUND
return (low + 2) * -1;
}
if (iBeginOffset >= e.beginOffset)
low = mid + 1;
else
high = mid;
}
// NOT FOUND
return mid;
} | java | private static int searchEntry(final List<OMMapBufferEntry> fileEntries, final long iBeginOffset, final int iSize) {
if (fileEntries == null || fileEntries.size() == 0)
return -1;
int high = fileEntries.size() - 1;
if (high < 0)
// NOT FOUND
return -1;
int low = 0;
int mid = -1;
// BINARY SEARCH
OMMapBufferEntry e;
while (low <= high) {
mid = (low + high) >>> 1;
e = fileEntries.get(mid);
if (iBeginOffset >= e.beginOffset && iBeginOffset + iSize <= e.beginOffset + e.size) {
// FOUND: USE IT
OProfiler.getInstance().updateCounter("OMMapManager.reusedPage", 1);
e.counter++;
return mid;
}
if (low == high) {
if (iBeginOffset > e.beginOffset)
// NEXT POSITION
low++;
// NOT FOUND
return (low + 2) * -1;
}
if (iBeginOffset >= e.beginOffset)
low = mid + 1;
else
high = mid;
}
// NOT FOUND
return mid;
} | [
"private",
"static",
"int",
"searchEntry",
"(",
"final",
"List",
"<",
"OMMapBufferEntry",
">",
"fileEntries",
",",
"final",
"long",
"iBeginOffset",
",",
"final",
"int",
"iSize",
")",
"{",
"if",
"(",
"fileEntries",
"==",
"null",
"||",
"fileEntries",
".",
"siz... | Search for a buffer in the ordered list.
@param fileEntries
to search necessary record.
@param iBeginOffset
file offset to start search from it.
@param iSize
that will be contained in founded entries.
@return negative number means not found. The position to insert is the (return value +1)*-1. Zero or positive number is the
found position. | [
"Search",
"for",
"a",
"buffer",
"in",
"the",
"ordered",
"list",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerOld.java#L471-L514 | train |
amsa-code/risky | formats/src/main/java/au/gov/amsa/risky/format/BinaryFixes.java | BinaryFixes.from | public static Observable<Fix> from(File file, boolean backpressure, BinaryFixesFormat format) {
if (backpressure)
return BinaryFixesOnSubscribeWithBackp.from(file, format);
else
return BinaryFixesOnSubscribeFastPath.from(file, format);
} | java | public static Observable<Fix> from(File file, boolean backpressure, BinaryFixesFormat format) {
if (backpressure)
return BinaryFixesOnSubscribeWithBackp.from(file, format);
else
return BinaryFixesOnSubscribeFastPath.from(file, format);
} | [
"public",
"static",
"Observable",
"<",
"Fix",
">",
"from",
"(",
"File",
"file",
",",
"boolean",
"backpressure",
",",
"BinaryFixesFormat",
"format",
")",
"{",
"if",
"(",
"backpressure",
")",
"return",
"BinaryFixesOnSubscribeWithBackp",
".",
"from",
"(",
"file",
... | Automatically detects gzip based on filename.
@param file
@param backpressure
@return | [
"Automatically",
"detects",
"gzip",
"based",
"on",
"filename",
"."
] | 13649942aeddfdb9210eec072c605bc5d7a6daf3 | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/formats/src/main/java/au/gov/amsa/risky/format/BinaryFixes.java#L76-L81 | train |
loldevs/riotapi | domain/src/main/java/net/boreeas/riotapi/rtmp/serialization/AmfWriter.java | AmfWriter.encodeAmf3 | public void encodeAmf3(Object obj, Amf3Type marker) throws IOException {
out.write(marker.ordinal());
if (marker == Amf3Type.NULL) {
return; // Null marker is enough
}
serializeAmf3(obj, marker);
} | java | public void encodeAmf3(Object obj, Amf3Type marker) throws IOException {
out.write(marker.ordinal());
if (marker == Amf3Type.NULL) {
return; // Null marker is enough
}
serializeAmf3(obj, marker);
} | [
"public",
"void",
"encodeAmf3",
"(",
"Object",
"obj",
",",
"Amf3Type",
"marker",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"marker",
".",
"ordinal",
"(",
")",
")",
";",
"if",
"(",
"marker",
"==",
"Amf3Type",
".",
"NULL",
")",
"{",
... | Encodes an object in amf3 as an object of
the specified type
@param obj The object to encode
@param marker The type marker for this object
@throws IOException | [
"Encodes",
"an",
"object",
"in",
"amf3",
"as",
"an",
"object",
"of",
"the",
"specified",
"type"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/domain/src/main/java/net/boreeas/riotapi/rtmp/serialization/AmfWriter.java#L222-L230 | train |
loldevs/riotapi | domain/src/main/java/net/boreeas/riotapi/rtmp/serialization/AmfWriter.java | AmfWriter.serializeAmf3 | @SneakyThrows(value = {InstantiationException.class, IllegalAccessException.class})
public void serializeAmf3(Object obj, Amf3Type marker) throws IOException {
if (checkReferenceable(obj, marker)) {
return;
}
Serialization context;
if (amf3Serializers.containsKey(obj.getClass())) {
amf3Serializers.get(obj.getClass()).serialize(obj, out);
} else if ((context = Util.searchClassHierarchy(obj.getClass(), Serialization.class)) != null && !context.deserializeOnly()) {
Amf3ObjectSerializer serializer = context.amf3Serializer().newInstance();
serializer.setTraitRefTable(traitRefTable);
serializer.setTraitDefCache(traitDefCache);
serializer.setWriter(this);
serializer.serialize(obj, out);
} else if (obj.getClass().isArray()) {
// Arrays require special handling
serializeArrayAmf3(obj);
} else if (obj instanceof Enum) {
// Enums are written by name
serializeAmf3(((Enum) obj).name());
} else {
Amf3ObjectSerializer serializer = new Amf3ObjectSerializer();
serializer.setTraitRefTable(traitRefTable);
serializer.setTraitDefCache(traitDefCache);
serializer.setWriter(this);
serializer.serialize(obj, out);
}
out.flush();
} | java | @SneakyThrows(value = {InstantiationException.class, IllegalAccessException.class})
public void serializeAmf3(Object obj, Amf3Type marker) throws IOException {
if (checkReferenceable(obj, marker)) {
return;
}
Serialization context;
if (amf3Serializers.containsKey(obj.getClass())) {
amf3Serializers.get(obj.getClass()).serialize(obj, out);
} else if ((context = Util.searchClassHierarchy(obj.getClass(), Serialization.class)) != null && !context.deserializeOnly()) {
Amf3ObjectSerializer serializer = context.amf3Serializer().newInstance();
serializer.setTraitRefTable(traitRefTable);
serializer.setTraitDefCache(traitDefCache);
serializer.setWriter(this);
serializer.serialize(obj, out);
} else if (obj.getClass().isArray()) {
// Arrays require special handling
serializeArrayAmf3(obj);
} else if (obj instanceof Enum) {
// Enums are written by name
serializeAmf3(((Enum) obj).name());
} else {
Amf3ObjectSerializer serializer = new Amf3ObjectSerializer();
serializer.setTraitRefTable(traitRefTable);
serializer.setTraitDefCache(traitDefCache);
serializer.setWriter(this);
serializer.serialize(obj, out);
}
out.flush();
} | [
"@",
"SneakyThrows",
"(",
"value",
"=",
"{",
"InstantiationException",
".",
"class",
",",
"IllegalAccessException",
".",
"class",
"}",
")",
"public",
"void",
"serializeAmf3",
"(",
"Object",
"obj",
",",
"Amf3Type",
"marker",
")",
"throws",
"IOException",
"{",
"... | Serializes the specified object to amf3
@param obj The object to serialize
@param marker The type of the object to check for referencability
@throws IOException | [
"Serializes",
"the",
"specified",
"object",
"to",
"amf3"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/domain/src/main/java/net/boreeas/riotapi/rtmp/serialization/AmfWriter.java#L267-L303 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryTargetOperator.java | OQueryTargetOperator.evaluateRecord | @Override
public Object evaluateRecord(final OIdentifiable iRecord, final OSQLFilterCondition iCondition, final Object iLeft,
final Object iRight, OCommandContext iContext) {
return true;
} | java | @Override
public Object evaluateRecord(final OIdentifiable iRecord, final OSQLFilterCondition iCondition, final Object iLeft,
final Object iRight, OCommandContext iContext) {
return true;
} | [
"@",
"Override",
"public",
"Object",
"evaluateRecord",
"(",
"final",
"OIdentifiable",
"iRecord",
",",
"final",
"OSQLFilterCondition",
"iCondition",
",",
"final",
"Object",
"iLeft",
",",
"final",
"Object",
"iRight",
",",
"OCommandContext",
"iContext",
")",
"{",
"re... | At run-time the evaluation per record must return always true since the recordset are filtered at the begin. | [
"At",
"run",
"-",
"time",
"the",
"evaluation",
"per",
"record",
"must",
"return",
"always",
"true",
"since",
"the",
"recordset",
"are",
"filtered",
"at",
"the",
"begin",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/operator/OQueryTargetOperator.java#L43-L47 | train |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDropIndex.java | OCommandExecutorSQLDropIndex.execute | public Object execute(final Map<Object, Object> iArgs) {
if (name == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
getDatabase().getMetadata().getIndexManager().dropIndex(name);
return null;
} | java | public Object execute(final Map<Object, Object> iArgs) {
if (name == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
getDatabase().getMetadata().getIndexManager().dropIndex(name);
return null;
} | [
"public",
"Object",
"execute",
"(",
"final",
"Map",
"<",
"Object",
",",
"Object",
">",
"iArgs",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"throw",
"new",
"OCommandExecutionException",
"(",
"\"Cannot execute the command because it has not been parsed yet\"",
")... | Execute the REMOVE INDEX. | [
"Execute",
"the",
"REMOVE",
"INDEX",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDropIndex.java#L70-L76 | train |
wuman/orientdb-android | client/src/main/java/com/orientechnologies/orient/client/remote/ONetworkConnectionPool.java | ONetworkConnectionPool.close | public void close() {
for (Entry<String, OResourcePool<String, CH>> pool : pools.entrySet()) {
for (CH channel : pool.getValue().getResources()) {
channel.close();
}
}
} | java | public void close() {
for (Entry<String, OResourcePool<String, CH>> pool : pools.entrySet()) {
for (CH channel : pool.getValue().getResources()) {
channel.close();
}
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"OResourcePool",
"<",
"String",
",",
"CH",
">",
">",
"pool",
":",
"pools",
".",
"entrySet",
"(",
")",
")",
"{",
"for",
"(",
"CH",
"channel",
":",
"pool",
".",
"get... | Closes all the channels. | [
"Closes",
"all",
"the",
"channels",
"."
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/ONetworkConnectionPool.java#L84-L90 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java | PlayerStatsService.retrievePlayerStatsByAccountId | public PlayerLifetimeStats retrievePlayerStatsByAccountId(long accountId, Season season) {
return client.sendRpcAndWait(SERVICE, "retrievePlayerStatsByAccountId", accountId, season);
} | java | public PlayerLifetimeStats retrievePlayerStatsByAccountId(long accountId, Season season) {
return client.sendRpcAndWait(SERVICE, "retrievePlayerStatsByAccountId", accountId, season);
} | [
"public",
"PlayerLifetimeStats",
"retrievePlayerStatsByAccountId",
"(",
"long",
"accountId",
",",
"Season",
"season",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"retrievePlayerStatsByAccountId\"",
",",
"accountId",
",",
"season",
")",
... | Retrieve player stats
@param accountId The player's id
@param season The target season
@return Player stats | [
"Retrieve",
"player",
"stats"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java#L53-L55 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java | PlayerStatsService.retrieveTopPlayedChampions | public List<ChampionStatInfo> retrieveTopPlayedChampions(long accId, GameMode mode) {
return client.sendRpcAndWait(SERVICE, "retrieveTopPlayedChampions", accId, mode);
} | java | public List<ChampionStatInfo> retrieveTopPlayedChampions(long accId, GameMode mode) {
return client.sendRpcAndWait(SERVICE, "retrieveTopPlayedChampions", accId, mode);
} | [
"public",
"List",
"<",
"ChampionStatInfo",
">",
"retrieveTopPlayedChampions",
"(",
"long",
"accId",
",",
"GameMode",
"mode",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"retrieveTopPlayedChampions\"",
",",
"accId",
",",
"mode",
")",... | Retrieve the most played champions for the target player
@param accId The player's id
@param mode The mode to check
@return Champion stats | [
"Retrieve",
"the",
"most",
"played",
"champions",
"for",
"the",
"target",
"player"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java#L63-L65 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java | PlayerStatsService.getAggregatedStats | public AggregatedStats getAggregatedStats(long id, GameMode gameMode, Season season) {
return client.sendRpcAndWait(SERVICE, "getAggregatedStats", id, gameMode, season.numeric);
} | java | public AggregatedStats getAggregatedStats(long id, GameMode gameMode, Season season) {
return client.sendRpcAndWait(SERVICE, "getAggregatedStats", id, gameMode, season.numeric);
} | [
"public",
"AggregatedStats",
"getAggregatedStats",
"(",
"long",
"id",
",",
"GameMode",
"gameMode",
",",
"Season",
"season",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"getAggregatedStats\"",
",",
"id",
",",
"gameMode",
",",
"seas... | Retrieve a player's stats
@param id The id of the player
@param gameMode The game mode to check
@param season The season to check
@return Stats | [
"Retrieve",
"a",
"player",
"s",
"stats"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java#L74-L76 | train |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java | PlayerStatsService.getTeamEndOfGameStats | public EndOfGameStats getTeamEndOfGameStats(TeamId teamId, long gameId) {
return client.sendRpcAndWait(SERVICE, "getTeamEndOfGameStats", teamId, gameId);
} | java | public EndOfGameStats getTeamEndOfGameStats(TeamId teamId, long gameId) {
return client.sendRpcAndWait(SERVICE, "getTeamEndOfGameStats", teamId, gameId);
} | [
"public",
"EndOfGameStats",
"getTeamEndOfGameStats",
"(",
"TeamId",
"teamId",
",",
"long",
"gameId",
")",
"{",
"return",
"client",
".",
"sendRpcAndWait",
"(",
"SERVICE",
",",
"\"getTeamEndOfGameStats\"",
",",
"teamId",
",",
"gameId",
")",
";",
"}"
] | Retrieve post-game stats for a team
@param teamId The id of the team
@param gameId The if of the game
@return Post-game stats | [
"Retrieve",
"post",
"-",
"game",
"stats",
"for",
"a",
"team"
] | 0b8aac407aa5289845f249024f9732332855544f | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/PlayerStatsService.java#L102-L104 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.