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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/UrlsApi.java | UrlsApi.lookupGroup | public GroupUrls lookupGroup(String url) throws JinxException {
JinxUtils.validateParams(url);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.urls.lookupGroup");
params.put("url", url);
return jinx.flickrGet(params, GroupUrls.class, false);
} | java | public GroupUrls lookupGroup(String url) throws JinxException {
JinxUtils.validateParams(url);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.urls.lookupGroup");
params.put("url", url);
return jinx.flickrGet(params, GroupUrls.class, false);
} | [
"public",
"GroupUrls",
"lookupGroup",
"(",
"String",
"url",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"url",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"pa... | Returns a group NSID, given the url to a group's page or photo pool.
This method does not require authentication.
@param url url to the group's page or photo pool. Required.
@return group NSID and name.
@throws JinxException if the url is missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.urls.lookupGroup.html">flickr.urls.lookupGroup</a> | [
"Returns",
"a",
"group",
"NSID",
"given",
"the",
"url",
"to",
"a",
"group",
"s",
"page",
"or",
"photo",
"pool",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/UrlsApi.java#L131-L137 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/UrlsApi.java | UrlsApi.lookupUser | public UserUrls lookupUser(String url) throws JinxException {
JinxUtils.validateParams(url);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.urls.lookupUser");
params.put("url", url);
return jinx.flickrGet(params, UserUrls.class);
} | java | public UserUrls lookupUser(String url) throws JinxException {
JinxUtils.validateParams(url);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.urls.lookupUser");
params.put("url", url);
return jinx.flickrGet(params, UserUrls.class);
} | [
"public",
"UserUrls",
"lookupUser",
"(",
"String",
"url",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"url",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"para... | Returns a user NSID, given the url to a user's photos or profile.
This method does not require authentication.
@param url url to the user's profile or photos page. Required.
@return user id and username.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.urls.lookupUser.html">flickr.urls.lookupUser</a> | [
"Returns",
"a",
"user",
"NSID",
"given",
"the",
"url",
"to",
"a",
"user",
"s",
"photos",
"or",
"profile",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/UrlsApi.java#L149-L155 | train |
zanata/openprops | orig/Properties.java | Properties.storeToXML | public synchronized void storeToXML(OutputStream os, String comment)
throws IOException
{
if (os == null)
throw new NullPointerException();
storeToXML(os, comment, "UTF-8");
} | java | public synchronized void storeToXML(OutputStream os, String comment)
throws IOException
{
if (os == null)
throw new NullPointerException();
storeToXML(os, comment, "UTF-8");
} | [
"public",
"synchronized",
"void",
"storeToXML",
"(",
"OutputStream",
"os",
",",
"String",
"comment",
")",
"throws",
"IOException",
"{",
"if",
"(",
"os",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"storeToXML",
"(",
"os",
",",
... | Emits an XML document representing all of the properties contained
in this table.
<p> An invocation of this method of the form <tt>props.storeToXML(os,
comment)</tt> behaves in exactly the same way as the invocation
<tt>props.storeToXML(os, comment, "UTF-8");</tt>.
@param os the output stream on which to emit the XML document.
@param comment a description of the property list, or <code>null</code>
if no comment is desired.
@throws IOException if writing to the specified output stream
results in an <tt>IOException</tt>.
@throws NullPointerException if <code>os</code> is null.
@throws ClassCastException if this <code>Properties</code> object
contains any keys or values that are not
<code>Strings</code>.
@see #loadFromXML(InputStream)
@since 1.5 | [
"Emits",
"an",
"XML",
"document",
"representing",
"all",
"of",
"the",
"properties",
"contained",
"in",
"this",
"table",
"."
] | 46510e610a765e4a91b302fc0d6a2123ed589603 | https://github.com/zanata/openprops/blob/46510e610a765e4a91b302fc0d6a2123ed589603/orig/Properties.java#L893-L899 | train |
zanata/openprops | orig/Properties.java | Properties.list | public void list(PrintStream out) {
out.println("-- listing properties --");
Hashtable h = new Hashtable();
enumerate(h);
for (Enumeration e = h.keys() ; e.hasMoreElements() ;) {
String key = (String)e.nextElement();
String val = (String)h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
}
out.println(key + "=" + val);
}
} | java | public void list(PrintStream out) {
out.println("-- listing properties --");
Hashtable h = new Hashtable();
enumerate(h);
for (Enumeration e = h.keys() ; e.hasMoreElements() ;) {
String key = (String)e.nextElement();
String val = (String)h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
}
out.println(key + "=" + val);
}
} | [
"public",
"void",
"list",
"(",
"PrintStream",
"out",
")",
"{",
"out",
".",
"println",
"(",
"\"-- listing properties --\"",
")",
";",
"Hashtable",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"enumerate",
"(",
"h",
")",
";",
"for",
"(",
"Enumeration",
"e"... | Prints this property list out to the specified output stream.
This method is useful for debugging.
@param out an output stream.
@throws ClassCastException if any key in this property list
is not a string. | [
"Prints",
"this",
"property",
"list",
"out",
"to",
"the",
"specified",
"output",
"stream",
".",
"This",
"method",
"is",
"useful",
"for",
"debugging",
"."
] | 46510e610a765e4a91b302fc0d6a2123ed589603 | https://github.com/zanata/openprops/blob/46510e610a765e4a91b302fc0d6a2123ed589603/orig/Properties.java#L1024-L1036 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/GroupsApi.java | GroupsApi.browse | @Deprecated
public Response browse(String categoryId) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.browse");
return jinx.flickrGet(params, Response.class);
} | java | @Deprecated
public Response browse(String categoryId) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.browse");
return jinx.flickrGet(params, Response.class);
} | [
"@",
"Deprecated",
"public",
"Response",
"browse",
"(",
"String",
"categoryId",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
... | This is a legacy method and will not return anything useful.
@param categoryId (Optional) Category id to fetch a list of groups and sub-categories for.
If not specified, it defaults to zero, the root of the category tree.
@return object with response from Flickr indicating ok or fail.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.groups.browse.html">flickr.groups.browse</a>
@deprecated this is a legacy method, and will not return anything useful. | [
"This",
"is",
"a",
"legacy",
"method",
"and",
"will",
"not",
"return",
"anything",
"useful",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsApi.java#L54-L59 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/Jinx.java | Jinx.setoAuthAccessToken | public void setoAuthAccessToken(OAuthAccessToken oAuthAccessToken) {
this.oAuthAccessToken = oAuthAccessToken;
this.accessToken = new Token(oAuthAccessToken.getOauthToken(), oAuthAccessToken.getOauthTokenSecret());
} | java | public void setoAuthAccessToken(OAuthAccessToken oAuthAccessToken) {
this.oAuthAccessToken = oAuthAccessToken;
this.accessToken = new Token(oAuthAccessToken.getOauthToken(), oAuthAccessToken.getOauthTokenSecret());
} | [
"public",
"void",
"setoAuthAccessToken",
"(",
"OAuthAccessToken",
"oAuthAccessToken",
")",
"{",
"this",
".",
"oAuthAccessToken",
"=",
"oAuthAccessToken",
";",
"this",
".",
"accessToken",
"=",
"new",
"Token",
"(",
"oAuthAccessToken",
".",
"getOauthToken",
"(",
")",
... | Set the oauth access token.
@param oAuthAccessToken the oauth access token. | [
"Set",
"the",
"oauth",
"access",
"token",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/Jinx.java#L360-L363 | train |
nobuoka/android-lib-ZXingCaptureActivity | src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java | CaptureActivityIntents.setDecodeHintAllowedLengths | public static void setDecodeHintAllowedLengths(Intent intent, int[] lengths) {
intent.putExtra(DecodeHintType.ALLOWED_LENGTHS.name(), lengths);
} | java | public static void setDecodeHintAllowedLengths(Intent intent, int[] lengths) {
intent.putExtra(DecodeHintType.ALLOWED_LENGTHS.name(), lengths);
} | [
"public",
"static",
"void",
"setDecodeHintAllowedLengths",
"(",
"Intent",
"intent",
",",
"int",
"[",
"]",
"lengths",
")",
"{",
"intent",
".",
"putExtra",
"(",
"DecodeHintType",
".",
"ALLOWED_LENGTHS",
".",
"name",
"(",
")",
",",
"lengths",
")",
";",
"}"
] | Set allowed lengths of encoded data.
@param intent Target intent.
@param lengths allowed lengths. | [
"Set",
"allowed",
"lengths",
"of",
"encoded",
"data",
"."
] | 17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6 | https://github.com/nobuoka/android-lib-ZXingCaptureActivity/blob/17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6/src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java#L80-L82 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java | PlacesApi.getInfo | public PlaceInfo getInfo(String placeId, String woeId) throws JinxException {
if (JinxUtils.isNullOrEmpty(placeId)) {
JinxUtils.validateParams(woeId);
}
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.getInfo");
if (JinxUtils.isNullOrEmpty(placeId)) {
params.put("woe_id", woeId);
} else {
params.put("place_id", placeId);
}
return jinx.flickrGet(params, PlaceInfo.class, false);
} | java | public PlaceInfo getInfo(String placeId, String woeId) throws JinxException {
if (JinxUtils.isNullOrEmpty(placeId)) {
JinxUtils.validateParams(woeId);
}
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.getInfo");
if (JinxUtils.isNullOrEmpty(placeId)) {
params.put("woe_id", woeId);
} else {
params.put("place_id", placeId);
}
return jinx.flickrGet(params, PlaceInfo.class, false);
} | [
"public",
"PlaceInfo",
"getInfo",
"(",
"String",
"placeId",
",",
"String",
"woeId",
")",
"throws",
"JinxException",
"{",
"if",
"(",
"JinxUtils",
".",
"isNullOrEmpty",
"(",
"placeId",
")",
")",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"woeId",
")",
";",
... | Get information about a place.
Authentication
This method does not require authentication.
You must provide a valid placesId or woeId. If you provide both, the placesId will be used.
@param placeId 4yya valid Flickr place id.
@param woeId a Where On Earth (WOE) id.
@return information about the specified place.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.places.getInfo.html">flickr.places.getInfo</a> | [
"Get",
"information",
"about",
"a",
"place",
".",
"Authentication",
"This",
"method",
"does",
"not",
"require",
"authentication",
".",
"You",
"must",
"provide",
"a",
"valid",
"placesId",
"or",
"woeId",
".",
"If",
"you",
"provide",
"both",
"the",
"placesId",
... | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java#L154-L166 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java | PlacesApi.getPlacesForBoundingBox | public Places getPlacesForBoundingBox(String boundingBox, JinxConstants.PlaceTypeId placeTypeId) throws JinxException {
JinxUtils.validateParams(boundingBox, placeTypeId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.placesForBoundingBox");
params.put("bbox", boundingBox);
params.put("place_type_id", placeTypeId.getTypeId().toString());
return jinx.flickrGet(params, Places.class, false);
} | java | public Places getPlacesForBoundingBox(String boundingBox, JinxConstants.PlaceTypeId placeTypeId) throws JinxException {
JinxUtils.validateParams(boundingBox, placeTypeId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.placesForBoundingBox");
params.put("bbox", boundingBox);
params.put("place_type_id", placeTypeId.getTypeId().toString());
return jinx.flickrGet(params, Places.class, false);
} | [
"public",
"Places",
"getPlacesForBoundingBox",
"(",
"String",
"boundingBox",
",",
"JinxConstants",
".",
"PlaceTypeId",
"placeTypeId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"boundingBox",
",",
"placeTypeId",
")",
";",
"Map",
"<... | Return all the locations of a matching place type for a bounding box.
<p>The maximum allowable size of a bounding box (the distance between the SW and NE corners)
is governed by the place type you are requesting. Allowable sizes are as follows:</p>
<ul>
<li>neighbourhood: 3km (1.8mi)</li>
<li>locality: 7km (4.3mi)</li>
<li>county: 50km (31mi)</li>
<li>region: 200km (124mi)</li>
<li>country: 500km (310mi)</li>
<li>continent: 1500km (932mi)</li>
</ul>
Authentication
This method does not require authentication.
@param boundingBox a comma-delimited list of 4 values defining the Bounding Box of the area
that will be searched. The 4 values represent the bottom-left corner of the
box and the top-right corner, minimum_longitude, minimum_latitude,
maximum_longitude, maximum_latitude. Required.
@param placeTypeId id for a specific place to cluster photos by. Required.
@return places matching the bounding box.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.places.placesForBoundingBox.html">flickr.places.placesForBoundingBox</a> | [
"Return",
"all",
"the",
"locations",
"of",
"a",
"matching",
"place",
"type",
"for",
"a",
"bounding",
"box",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java#L294-L301 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java | PlacesApi.getPlacesForContacts | public Places getPlacesForContacts(JinxConstants.PlaceTypeId placeTypeId, String placeId, String woeId,
Integer threshold, JinxConstants.Contacts contacts,
Date minimumUploadDate, Date maximumUploadDate,
Date minimumTakenDate, Date maximumTakenDate) throws JinxException {
JinxUtils.validateParams(placeTypeId);
if (JinxUtils.isNullOrEmpty(placeId)) {
JinxUtils.validateParams(woeId);
}
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.placesForContacts");
params.put("place_type_id", placeTypeId.getTypeId().toString());
if (JinxUtils.isNullOrEmpty(placeId)) {
params.put("woe_id", woeId);
} else {
params.put("place_id", placeId);
}
if (threshold != null) {
params.put("threshold", threshold.toString());
}
if (contacts != null) {
params.put("contacts", contacts.toString());
}
if (minimumUploadDate != null) {
params.put("min_upload_date", JinxUtils.formatDateAsUnixTimestamp(minimumUploadDate));
}
if (maximumUploadDate != null) {
params.put("max_upload_date", JinxUtils.formatDateAsUnixTimestamp(maximumUploadDate));
}
if (minimumTakenDate != null) {
params.put("min_taken_date", JinxUtils.formatDateAsMySqlTimestamp(minimumTakenDate));
}
if (maximumTakenDate != null) {
params.put("max_taken_date", JinxUtils.formatDateAsMySqlTimestamp(maximumTakenDate));
}
return jinx.flickrGet(params, Places.class);
} | java | public Places getPlacesForContacts(JinxConstants.PlaceTypeId placeTypeId, String placeId, String woeId,
Integer threshold, JinxConstants.Contacts contacts,
Date minimumUploadDate, Date maximumUploadDate,
Date minimumTakenDate, Date maximumTakenDate) throws JinxException {
JinxUtils.validateParams(placeTypeId);
if (JinxUtils.isNullOrEmpty(placeId)) {
JinxUtils.validateParams(woeId);
}
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.placesForContacts");
params.put("place_type_id", placeTypeId.getTypeId().toString());
if (JinxUtils.isNullOrEmpty(placeId)) {
params.put("woe_id", woeId);
} else {
params.put("place_id", placeId);
}
if (threshold != null) {
params.put("threshold", threshold.toString());
}
if (contacts != null) {
params.put("contacts", contacts.toString());
}
if (minimumUploadDate != null) {
params.put("min_upload_date", JinxUtils.formatDateAsUnixTimestamp(minimumUploadDate));
}
if (maximumUploadDate != null) {
params.put("max_upload_date", JinxUtils.formatDateAsUnixTimestamp(maximumUploadDate));
}
if (minimumTakenDate != null) {
params.put("min_taken_date", JinxUtils.formatDateAsMySqlTimestamp(minimumTakenDate));
}
if (maximumTakenDate != null) {
params.put("max_taken_date", JinxUtils.formatDateAsMySqlTimestamp(maximumTakenDate));
}
return jinx.flickrGet(params, Places.class);
} | [
"public",
"Places",
"getPlacesForContacts",
"(",
"JinxConstants",
".",
"PlaceTypeId",
"placeTypeId",
",",
"String",
"placeId",
",",
"String",
"woeId",
",",
"Integer",
"threshold",
",",
"JinxConstants",
".",
"Contacts",
"contacts",
",",
"Date",
"minimumUploadDate",
"... | Return a list of the top 100 unique places clustered by a given placetype for a user's contacts.
Authentication
This method requires authentication with 'read' permission.
@param placeTypeId ID for a specific place type to cluster photos by. Required.
@param placeId a Flickr Places identifier to use to filter photo clusters.
You must pass a placesId or woeId.
@param woeId a Where on Earth identifier to use to filter photo clusters.
You must pass a placesId or woeId.
@param threshold the minimum number of photos that a place type must have to be included.
If the number of photos is lowered then the parent place type for that
place will be used. Optional.
@param contacts which contacts to search. Default is all. Optional.
@param minimumUploadDate Minimum upload date. Photos with an upload date greater than or
equal to this value will be returned. Optional.
@param maximumUploadDate Maximum upload date. Photos with an upload date less than or equal
to this value will be returned. Optional.
@param minimumTakenDate Minimum taken date. Photos with an taken date greater than or equal to
this value will be returned. Optional.
The date should be in the form of a mysql datetime.
@param maximumTakenDate Maximum taken date. Photos with an taken date less than or equal to
this value will be returned. Optional.
The date should be in the form of a mysql datetime.
@return places for users contacts.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.places.placesForContacts.html">flickr.places.placesForContacts</a> | [
"Return",
"a",
"list",
"of",
"the",
"top",
"100",
"unique",
"places",
"clustered",
"by",
"a",
"given",
"placetype",
"for",
"a",
"user",
"s",
"contacts",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java#L333-L368 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/ReflectionApi.java | ReflectionApi.getMethods | public Methods getMethods() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.reflection.getMethods");
return jinx.flickrGet(params, Methods.class, false);
} | java | public Methods getMethods() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.reflection.getMethods");
return jinx.flickrGet(params, Methods.class, false);
} | [
"public",
"Methods",
"getMethods",
"(",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
",",
"\"flickr.reflection.getMethods\"",
")"... | Returns a list of available Flickr API methods.
Authentication
This method does not require authentication.
@return available Flickr API methods.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.reflection.getMethods.html">flickr.reflection.getMethods</a> | [
"Returns",
"a",
"list",
"of",
"available",
"Flickr",
"API",
"methods",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/ReflectionApi.java#L56-L60 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/ReflectionApi.java | ReflectionApi.getMethodInfo | public MethodInfo getMethodInfo(String methodName) throws JinxException {
JinxUtils.validateParams(methodName);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.reflection.getMethodInfo");
params.put("method_name", methodName);
return jinx.flickrGet(params, MethodInfo.class, false);
} | java | public MethodInfo getMethodInfo(String methodName) throws JinxException {
JinxUtils.validateParams(methodName);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.reflection.getMethodInfo");
params.put("method_name", methodName);
return jinx.flickrGet(params, MethodInfo.class, false);
} | [
"public",
"MethodInfo",
"getMethodInfo",
"(",
"String",
"methodName",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"methodName",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
... | Returns information for a given Flickr API method.
Authentication
This method does not require authentication.
@param methodName the name of the method to fetch information for. Required.
@return information about the method.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.reflection.getMethodInfo.html">flickr.reflection.getMethodInfo</a> | [
"Returns",
"information",
"for",
"a",
"given",
"Flickr",
"API",
"method",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/ReflectionApi.java#L74-L80 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/TagsApi.java | TagsApi.getClusters | public Clusters getClusters(String tag) throws JinxException {
JinxUtils.validateParams(tag);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getClusters");
params.put("tag", tag);
return jinx.flickrGet(params, Clusters.class, false);
} | java | public Clusters getClusters(String tag) throws JinxException {
JinxUtils.validateParams(tag);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getClusters");
params.put("tag", tag);
return jinx.flickrGet(params, Clusters.class, false);
} | [
"public",
"Clusters",
"getClusters",
"(",
"String",
"tag",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"tag",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"par... | Gives you a list of tag clusters for the given tag.
This method does not require authentication.
@param tag the tag to fetch clusters for. Required.
@return tag clusters for the given tag.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.tags.getClusters.html">flickr.tags.getClusters</a> | [
"Gives",
"you",
"a",
"list",
"of",
"tag",
"clusters",
"for",
"the",
"given",
"tag",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/TagsApi.java#L107-L113 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/TagsApi.java | TagsApi.getListPhoto | public PhotoTagList getListPhoto(String photoId) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getListPhoto");
params.put("photo_id", photoId);
return jinx.flickrGet(params, PhotoTagList.class, false);
} | java | public PhotoTagList getListPhoto(String photoId) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getListPhoto");
params.put("photo_id", photoId);
return jinx.flickrGet(params, PhotoTagList.class, false);
} | [
"public",
"PhotoTagList",
"getListPhoto",
"(",
"String",
"photoId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
... | Get the tag list for a given photo.
This method does not require authentication.
@return tags list for the photo. Required.
@throws JinxException if required parameter is missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.tags.getListPhoto.html">flickr.tags.getListPhoto</a> | [
"Get",
"the",
"tag",
"list",
"for",
"a",
"given",
"photo",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/TagsApi.java#L147-L153 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/TagsApi.java | TagsApi.getMostFrequentlyUsed | public TagsForUser getMostFrequentlyUsed() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getMostFrequentlyUsed");
return jinx.flickrGet(params, TagsForUser.class);
} | java | public TagsForUser getMostFrequentlyUsed() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getMostFrequentlyUsed");
return jinx.flickrGet(params, TagsForUser.class);
} | [
"public",
"TagsForUser",
"getMostFrequentlyUsed",
"(",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
",",
"\"flickr.tags.getMostFreq... | Returns a list of most frequently used tags for a user.
This method requires authentication with 'read' permission.
@return most frequently used tags for the calling user.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.tags.getMostFrequentlyUsed.html">flickr.tags.getMostFrequentlyUsed</a> | [
"Returns",
"a",
"list",
"of",
"most",
"frequently",
"used",
"tags",
"for",
"a",
"user",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/TagsApi.java#L228-L232 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/TagsApi.java | TagsApi.getRelated | public RelatedTags getRelated(String tag) throws JinxException {
JinxUtils.validateParams(tag);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getRelated");
params.put("tag", tag);
return jinx.flickrGet(params, RelatedTags.class);
} | java | public RelatedTags getRelated(String tag) throws JinxException {
JinxUtils.validateParams(tag);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getRelated");
params.put("tag", tag);
return jinx.flickrGet(params, RelatedTags.class);
} | [
"public",
"RelatedTags",
"getRelated",
"(",
"String",
"tag",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"tag",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"p... | Returns a list of tags 'related' to the given tag, based on clustered usage analysis.
This method does not require authentication.
@param tag tag to fetch related tags for. Required.
@return related tags.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.tags.getRelated.html">flickr.tags.getRelated</a> | [
"Returns",
"a",
"list",
"of",
"tags",
"related",
"to",
"the",
"given",
"tag",
"based",
"on",
"clustered",
"usage",
"analysis",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/TagsApi.java#L245-L251 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/response/people/Person.java | Person.getPhotosFirstDateTaken | public String getPhotosFirstDateTaken() {
return (person == null || person.photos == null || person.photos.firstDateTaken == null) ? null : person.photos.firstDateTaken._content;
} | java | public String getPhotosFirstDateTaken() {
return (person == null || person.photos == null || person.photos.firstDateTaken == null) ? null : person.photos.firstDateTaken._content;
} | [
"public",
"String",
"getPhotosFirstDateTaken",
"(",
")",
"{",
"return",
"(",
"person",
"==",
"null",
"||",
"person",
".",
"photos",
"==",
"null",
"||",
"person",
".",
"photos",
".",
"firstDateTaken",
"==",
"null",
")",
"?",
"null",
":",
"person",
".",
"p... | Get the mysql datetime of the first photo taken by the user.
You can use {@link JinxUtils#parseMySqlDatetimeToDate(String)} to convert this value to a Date object.
@return mysql datetime of the first photo taken by the user, or null if the value was not returned. | [
"Get",
"the",
"mysql",
"datetime",
"of",
"the",
"first",
"photo",
"taken",
"by",
"the",
"user",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/response/people/Person.java#L209-L211 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/response/people/Person.java | Person.getPhotosFirstDate | public String getPhotosFirstDate() {
return (person == null || person.photos == null || person.photos.firstDate == null) ? null : person.photos.firstDate._content;
} | java | public String getPhotosFirstDate() {
return (person == null || person.photos == null || person.photos.firstDate == null) ? null : person.photos.firstDate._content;
} | [
"public",
"String",
"getPhotosFirstDate",
"(",
")",
"{",
"return",
"(",
"person",
"==",
"null",
"||",
"person",
".",
"photos",
"==",
"null",
"||",
"person",
".",
"photos",
".",
"firstDate",
"==",
"null",
")",
"?",
"null",
":",
"person",
".",
"photos",
... | Get the unix timestamp of the first photo uploaded by the user.
You can use {@link JinxUtils#parseTimestampToDate(String)} to convert this value to a Date object.
@return unix timestamp of the first photo uploaded by the user, or null if the value was not returned. | [
"Get",
"the",
"unix",
"timestamp",
"of",
"the",
"first",
"photo",
"uploaded",
"by",
"the",
"user",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/response/people/Person.java#L220-L222 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/CamerasApi.java | CamerasApi.getBrandModels | public CameraModels getBrandModels(String brandId) throws JinxException {
JinxUtils.validateParams(brandId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.cameras.getBrandModels");
params.put("brand", brandId);
return jinx.flickrGet(params, CameraModels.class, false);
} | java | public CameraModels getBrandModels(String brandId) throws JinxException {
JinxUtils.validateParams(brandId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.cameras.getBrandModels");
params.put("brand", brandId);
return jinx.flickrGet(params, CameraModels.class, false);
} | [
"public",
"CameraModels",
"getBrandModels",
"(",
"String",
"brandId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"brandId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")"... | Retrieve all the models for a given camera brand.
This method does not require authentication.
@param brandId (Required) the ID of the requested brand (as returned from {@link net.jeremybrooks.jinx.api.CamerasApi#getBrands()}).
@return All camera models for a given camera brand.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.cameras.getBrandModels.html">flickr.cameras.getBrandModels</a> | [
"Retrieve",
"all",
"the",
"models",
"for",
"a",
"given",
"camera",
"brand",
".",
"This",
"method",
"does",
"not",
"require",
"authentication",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/CamerasApi.java#L70-L77 | train |
vsima/uber-java-client | src/main/java/com/victorsima/uber/Utils.java | Utils.generateAuthorizeUrl | public static String generateAuthorizeUrl(String oAuthUri, String clientId, String[] scope){
StringBuilder sb = new StringBuilder(oAuthUri);
sb.append("/oauth/authorize?response_type=code");
sb.append("&client_id=" + clientId);
if (scope != null) {
sb.append("&scope=");
for (int i = 0; i < scope.length; i++) {
if (i > 0) {
sb.append("%20");
}
sb.append(scope[i]);
}
}
return sb.toString();
} | java | public static String generateAuthorizeUrl(String oAuthUri, String clientId, String[] scope){
StringBuilder sb = new StringBuilder(oAuthUri);
sb.append("/oauth/authorize?response_type=code");
sb.append("&client_id=" + clientId);
if (scope != null) {
sb.append("&scope=");
for (int i = 0; i < scope.length; i++) {
if (i > 0) {
sb.append("%20");
}
sb.append(scope[i]);
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"generateAuthorizeUrl",
"(",
"String",
"oAuthUri",
",",
"String",
"clientId",
",",
"String",
"[",
"]",
"scope",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"oAuthUri",
")",
";",
"sb",
".",
"append",
"(",
... | Generates the initial url for the OAuth authorization flow
@return oauth authorize url | [
"Generates",
"the",
"initial",
"url",
"for",
"the",
"OAuth",
"authorization",
"flow"
] | 7cb081728db6286d949024c1b4c85dd74d275472 | https://github.com/vsima/uber-java-client/blob/7cb081728db6286d949024c1b4c85dd74d275472/src/main/java/com/victorsima/uber/Utils.java#L40-L54 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java | PhotosGeoApi.correctLocation | public Response correctLocation(String photoId, String placeId, String woeId, String foursquareId) throws JinxException {
JinxUtils.validateParams(photoId);
if (JinxUtils.isNullOrEmpty(placeId)) {
JinxUtils.validateParams(woeId);
}
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.geo.correctLocation");
params.put("photo_id", photoId);
if (!JinxUtils.isNullOrEmpty(placeId)) {
params.put("place_id", placeId);
}
if (!JinxUtils.isNullOrEmpty(woeId)) {
params.put("woe_id", woeId);
}
if (!JinxUtils.isNullOrEmpty(foursquareId)) {
params.put("foursquare_id", foursquareId);
}
return jinx.flickrPost(params, Response.class);
} | java | public Response correctLocation(String photoId, String placeId, String woeId, String foursquareId) throws JinxException {
JinxUtils.validateParams(photoId);
if (JinxUtils.isNullOrEmpty(placeId)) {
JinxUtils.validateParams(woeId);
}
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.geo.correctLocation");
params.put("photo_id", photoId);
if (!JinxUtils.isNullOrEmpty(placeId)) {
params.put("place_id", placeId);
}
if (!JinxUtils.isNullOrEmpty(woeId)) {
params.put("woe_id", woeId);
}
if (!JinxUtils.isNullOrEmpty(foursquareId)) {
params.put("foursquare_id", foursquareId);
}
return jinx.flickrPost(params, Response.class);
} | [
"public",
"Response",
"correctLocation",
"(",
"String",
"photoId",
",",
"String",
"placeId",
",",
"String",
"woeId",
",",
"String",
"foursquareId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
")",
";",
"if",
"(",
"J... | This method requires authentication with 'write' permission.
@param photoId (Required) The ID of the photo whose WOE location is being corrected.
@param placeId A Flickr Places ID. (While optional, you must pass either a valid Places ID or a WOE ID.)
@param woeId A Where On Earth (WOE) ID. (While optional, you must pass either a valid Places ID or a WOE ID.)
@param foursquareId The venue ID for a Foursquare location. (If not passed in with correction, any existing foursquare venue will be removed).
@return object with the status of the requested operation.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.geo.correctLocation.html">flickr.photos.geo.correctLocation</a> | [
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java#L94-L112 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java | GalleriesApi.galleryInfo | public GalleryInfo galleryInfo(String galleryId) throws JinxException {
JinxUtils.validateParams(galleryId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.galleries.getInfo");
params.put("gallery_id", galleryId);
return jinx.flickrPost(params, GalleryInfo.class);
} | java | public GalleryInfo galleryInfo(String galleryId) throws JinxException {
JinxUtils.validateParams(galleryId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.galleries.getInfo");
params.put("gallery_id", galleryId);
return jinx.flickrPost(params, GalleryInfo.class);
} | [
"public",
"GalleryInfo",
"galleryInfo",
"(",
"String",
"galleryId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"galleryId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")"... | This method does not require authentication.
@param galleryId Required. The gallery ID you are requesting information for.
@return information about the gallery.
@throws JinxException if required parameters are null or empty, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.galleries.getInfo.html">flickr.galleries.getInfo</a> | [
"This",
"method",
"does",
"not",
"require",
"authentication",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java#L176-L182 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PushApi.java | PushApi.getSubscriptions | public Subscriptions getSubscriptions() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.getSubscriptions");
return jinx.flickrGet(params, Subscriptions.class);
} | java | public Subscriptions getSubscriptions() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.getSubscriptions");
return jinx.flickrGet(params, Subscriptions.class);
} | [
"public",
"Subscriptions",
"getSubscriptions",
"(",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
",",
"\"flickr.push.getSubscriptio... | Returns a list of the subscriptions for the logged-in user.
(this method is experimental and may change)
This method requires authentication with 'read' permission.
@return subscriptions for the logged in user.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.push.getSubscriptions.html">flickr.push.getSubscriptions</a> | [
"Returns",
"a",
"list",
"of",
"the",
"subscriptions",
"for",
"the",
"logged",
"-",
"in",
"user",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PushApi.java#L62-L66 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PushApi.java | PushApi.getTopics | public Topics getTopics() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.getTopics");
return jinx.flickrGet(params, Topics.class);
} | java | public Topics getTopics() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.getTopics");
return jinx.flickrGet(params, Topics.class);
} | [
"public",
"Topics",
"getTopics",
"(",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
",",
"\"flickr.push.getTopics\"",
")",
";",
... | Get all available push topics.
(this method is experimental and may change)
This method does not require authentication.
@return all the different flavors of topics.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.push.getTopics.html">flickr.push.getTopics</a> | [
"Get",
"all",
"available",
"push",
"topics",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PushApi.java#L79-L83 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PushApi.java | PushApi.subscribe | public Response subscribe(String topic, String callbackUrl, JinxConstants.VerificationMode mode,
String verificationToken, Integer leaseSeconds, Integer woeIds,
List<String> placeIds, Float latitude, Float longitude, Integer radius,
JinxConstants.RadiusUnits radiusUnits, Integer accuracy, List<String> commonsNSIDs,
List<String> tags) throws JinxException {
JinxUtils.validateParams(topic, callbackUrl, mode);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.subscribe");
params.put("topic", topic);
params.put("callback", callbackUrl);
params.put("verify", mode.toString());
if (!JinxUtils.isNullOrEmpty(verificationToken)) {
params.put("verify_token", verificationToken);
}
if (leaseSeconds != null && leaseSeconds > 59) {
params.put("lease_seconds", leaseSeconds.toString());
}
if (woeIds != null) {
params.put("woe_ids", woeIds.toString());
}
if (!JinxUtils.isNullOrEmpty(placeIds)) {
params.put("place_ids", JinxUtils.buildCommaDelimitedList(placeIds));
}
if (latitude != null) {
params.put("lat", latitude.toString());
}
if (longitude != null) {
params.put("lon", longitude.toString());
}
if (radius != null) {
params.put("radius", radius.toString());
}
if (radiusUnits != null) {
params.put("radius_units", radiusUnits.toString());
}
if (accuracy != null) {
params.put("accuracy", accuracy.toString());
}
if (!JinxUtils.isNullOrEmpty(commonsNSIDs)) {
params.put("nsids", JinxUtils.buildCommaDelimitedList(commonsNSIDs));
}
if (!JinxUtils.isNullOrEmpty(tags)) {
params.put("tags", JinxUtils.buildCommaDelimitedList(tags));
}
return jinx.flickrGet(params, Response.class);
} | java | public Response subscribe(String topic, String callbackUrl, JinxConstants.VerificationMode mode,
String verificationToken, Integer leaseSeconds, Integer woeIds,
List<String> placeIds, Float latitude, Float longitude, Integer radius,
JinxConstants.RadiusUnits radiusUnits, Integer accuracy, List<String> commonsNSIDs,
List<String> tags) throws JinxException {
JinxUtils.validateParams(topic, callbackUrl, mode);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.subscribe");
params.put("topic", topic);
params.put("callback", callbackUrl);
params.put("verify", mode.toString());
if (!JinxUtils.isNullOrEmpty(verificationToken)) {
params.put("verify_token", verificationToken);
}
if (leaseSeconds != null && leaseSeconds > 59) {
params.put("lease_seconds", leaseSeconds.toString());
}
if (woeIds != null) {
params.put("woe_ids", woeIds.toString());
}
if (!JinxUtils.isNullOrEmpty(placeIds)) {
params.put("place_ids", JinxUtils.buildCommaDelimitedList(placeIds));
}
if (latitude != null) {
params.put("lat", latitude.toString());
}
if (longitude != null) {
params.put("lon", longitude.toString());
}
if (radius != null) {
params.put("radius", radius.toString());
}
if (radiusUnits != null) {
params.put("radius_units", radiusUnits.toString());
}
if (accuracy != null) {
params.put("accuracy", accuracy.toString());
}
if (!JinxUtils.isNullOrEmpty(commonsNSIDs)) {
params.put("nsids", JinxUtils.buildCommaDelimitedList(commonsNSIDs));
}
if (!JinxUtils.isNullOrEmpty(tags)) {
params.put("tags", JinxUtils.buildCommaDelimitedList(tags));
}
return jinx.flickrGet(params, Response.class);
} | [
"public",
"Response",
"subscribe",
"(",
"String",
"topic",
",",
"String",
"callbackUrl",
",",
"JinxConstants",
".",
"VerificationMode",
"mode",
",",
"String",
"verificationToken",
",",
"Integer",
"leaseSeconds",
",",
"Integer",
"woeIds",
",",
"List",
"<",
"String"... | Subscribe to a push feed.
(this method is experimental and may change)
This method requires authentication with 'read' permission.
@param topic the type of subscription. See {@link #getTopics()}. Required.
@param callbackUrl the url for the subscription endpoint. Limited to 255 bytes, and must be
unique for this user, i.e. no two subscriptions for a given user may
use the same callback url. Required.
@param mode verification mode. Required.
@param verificationToken the verification token to be echoed back to the subscriber during the
verification callback, as per the Google PubSubHubbub spec.
Limited to 200 bytes. Optional.
@param leaseSeconds number of seconds for which the subscription will be valid. Legal values
are 60 to 86400 (1 minute to 1 day). If not present, the subscription will
be auto-renewing. Optional.
@param woeIds a 32-bit integer for a Where on Earth ID. Only valid if topic is geo. The order of
precedence for geo subscriptions is : woe ids, place ids,
radial i.e. the latitude, longitude parameters will be ignored if placeIds is present,
which will be ignored if woeIds is present. Optional.
@param placeIds a list of Flickr place IDs. Only valid if topic is geo. The order of precedence for
geo subscriptions is : woe ids, place ids, radial i.e. the latitude, longitude parameters will be
ignored if placeIds is present, which will be ignored if woeIds is present. Optional.
@param latitude a latitude value, in decimal format. Only valid if topic is geo. Defines the latitude for a
radial query centered around (latitude, longitude). The order of precedence for geo
subscriptions is : woe ids, place ids, radial i.e. the latitude, longitude parameters will
be ignored if placeIds is present, which will be ignored if woeIds is present. Optional.
@param longitude a longitude value, in decimal format. Only valid if topic is geo. Defines the longitude
for a radial query centered around (latitude, longitude). The order of precedence for geo
subscriptions is : woe ids, place ids, radial i.e. the latitude, longitude parameters will
be ignored if placeIds is present, which will be ignored if woeIds is present. Optional.
@param radius a radius value, in the units defined by radiusUnits. Only valid if topic is geo. Defines the radius
of a circle for a radial query centered around (latitude, longitude). Default is 5 km. The order
of precedence for geo subscriptions is : woe ids, place ids, radial i.e. the latitude, longitude
parameters will be ignored if placeIds is present, which will be ignored if woeIds is present. Optional.
@param radiusUnits defines the units for the radius parameter. Only valid if topic is geo.
Options are mi and km. Default is km. Optional.
@param accuracy defines the minimum accuracy required for photos to be included in a subscription. Only valid
if topic is geo Legal values are 1-16, default is 1 (i.e. any accuracy level). World level is 1,
Country is ~3, Region is ~6, City is ~11, Street is ~16. Optional.
@param commonsNSIDs a list of nsids representing Flickr Commons institutions. See {@link CommonsApi#getInstitutions()}.
Only valid if topic is commons. If not present this argument defaults to all Flickr Commons
institutions. Optional.
@param tags a list of strings to be used for tag subscriptions. Photos with one or more of the tags listed
will be included in the subscription. Only valid if the topic is tags. Optional.
@return if successful, response.stat will be "ok".
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.push.subscribe.html">flickr.push.subscribe</a> | [
"Subscribe",
"to",
"a",
"push",
"feed",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PushApi.java#L137-L182 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PushApi.java | PushApi.unsubscribe | public Response unsubscribe(String topic, String callbackUrl, JinxConstants.VerificationMode mode, String verificationToken) throws JinxException {
JinxUtils.validateParams(topic, callbackUrl, mode);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.unsubscribe");
params.put("topic", topic);
params.put("callback", callbackUrl);
params.put("verify", mode.toString());
if (!JinxUtils.isNullOrEmpty(verificationToken)) {
params.put("verify_token", verificationToken);
}
return jinx.flickrGet(params, Response.class);
} | java | public Response unsubscribe(String topic, String callbackUrl, JinxConstants.VerificationMode mode, String verificationToken) throws JinxException {
JinxUtils.validateParams(topic, callbackUrl, mode);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.push.unsubscribe");
params.put("topic", topic);
params.put("callback", callbackUrl);
params.put("verify", mode.toString());
if (!JinxUtils.isNullOrEmpty(verificationToken)) {
params.put("verify_token", verificationToken);
}
return jinx.flickrGet(params, Response.class);
} | [
"public",
"Response",
"unsubscribe",
"(",
"String",
"topic",
",",
"String",
"callbackUrl",
",",
"JinxConstants",
".",
"VerificationMode",
"mode",
",",
"String",
"verificationToken",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"topic... | Unsubscribe from a push feed.
(this method is experimental and may change)
This method requires authentication with 'read' permission.
@param topic the type of subscription. Required.
@param callbackUrl url for the subscription endpoint. Must be the same url used when subscribing. Required.
@param mode verification mode. Required.
@param verificationToken verification token to be echoed back to the subscriber during the
verification callback. Optional.
@return if successful, response.stat will be "ok".
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.push.unsubscribe.html">flickr.push.unsubscribe</a> | [
"Unsubscribe",
"from",
"a",
"push",
"feed",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PushApi.java#L200-L211 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/logger/StdoutLogger.java | StdoutLogger.log | public void log(String message, Throwable t) {
System.out.println(message);
System.out.println(getStackTrace(t));
} | java | public void log(String message, Throwable t) {
System.out.println(message);
System.out.println(getStackTrace(t));
} | [
"public",
"void",
"log",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"message",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"getStackTrace",
"(",
"t",
")",
")",
";",
"}"
] | Log message to stdout, along with exception information.
@param message the message to log.
@param t the Throwable to log. | [
"Log",
"message",
"to",
"stdout",
"along",
"with",
"exception",
"information",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/logger/StdoutLogger.java#L50-L53 | train |
nobuoka/android-lib-ZXingCaptureActivity | src/main/java/info/vividcode/android/zxing/camera/CameraManager.java | CameraManager.stopPreview | public synchronized void stopPreview() {
if (autoFocusManager != null) {
autoFocusManager.stop();
autoFocusManager = null;
}
if (camera != null && previewing) {
camera.stopPreview();
previewCallback.setHandler(null, 0);
previewing = false;
}
} | java | public synchronized void stopPreview() {
if (autoFocusManager != null) {
autoFocusManager.stop();
autoFocusManager = null;
}
if (camera != null && previewing) {
camera.stopPreview();
previewCallback.setHandler(null, 0);
previewing = false;
}
} | [
"public",
"synchronized",
"void",
"stopPreview",
"(",
")",
"{",
"if",
"(",
"autoFocusManager",
"!=",
"null",
")",
"{",
"autoFocusManager",
".",
"stop",
"(",
")",
";",
"autoFocusManager",
"=",
"null",
";",
"}",
"if",
"(",
"camera",
"!=",
"null",
"&&",
"pr... | Tells the camera to stop drawing preview frames. | [
"Tells",
"the",
"camera",
"to",
"stop",
"drawing",
"preview",
"frames",
"."
] | 17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6 | https://github.com/nobuoka/android-lib-ZXingCaptureActivity/blob/17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6/src/main/java/info/vividcode/android/zxing/camera/CameraManager.java#L155-L165 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/response/photos/Photos.java | Photos.getPerPage | public Integer getPerPage() {
int ret = 0;
if (photos != null) {
int pp;
if (photos.perpage == null) {
pp = 0;
} else {
pp = photos.perpage;
}
int pP;
if (photos.perPage == null ) {
pP = 0;
} else {
pP = photos.perPage;
}
if (pp > pP) {
ret = pp;
} else {
ret = pP;
}
}
return ret;
} | java | public Integer getPerPage() {
int ret = 0;
if (photos != null) {
int pp;
if (photos.perpage == null) {
pp = 0;
} else {
pp = photos.perpage;
}
int pP;
if (photos.perPage == null ) {
pP = 0;
} else {
pP = photos.perPage;
}
if (pp > pP) {
ret = pp;
} else {
ret = pP;
}
}
return ret;
} | [
"public",
"Integer",
"getPerPage",
"(",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"photos",
"!=",
"null",
")",
"{",
"int",
"pp",
";",
"if",
"(",
"photos",
".",
"perpage",
"==",
"null",
")",
"{",
"pp",
"=",
"0",
";",
"}",
"else",
"{",
... | Get the number of photos per page.
This value is returned by flickr as "per_page" and "perpage", depending on the method that was called.
This class can parse either value, and will return whichever one was found.
@return number of photos per page. | [
"Get",
"the",
"number",
"of",
"photos",
"per",
"page",
".",
"This",
"value",
"is",
"returned",
"by",
"flickr",
"as",
"per_page",
"and",
"perpage",
"depending",
"on",
"the",
"method",
"that",
"was",
"called",
".",
"This",
"class",
"can",
"parse",
"either",
... | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/response/photos/Photos.java#L52-L76 | train |
zanata/openprops | src/main/java/org/fedorahosted/openprops/Properties.java | Properties.getComment | public String getComment(String key) {
String raw = getRawComment(key);
return cookComment(raw);
} | java | public String getComment(String key) {
String raw = getRawComment(key);
return cookComment(raw);
} | [
"public",
"String",
"getComment",
"(",
"String",
"key",
")",
"{",
"String",
"raw",
"=",
"getRawComment",
"(",
"key",
")",
";",
"return",
"cookComment",
"(",
"raw",
")",
";",
"}"
] | Returns the comment for the specified key, or null if there is none.
Any embedded newline sequences will be replaced by \n characters.
@param key
@return | [
"Returns",
"the",
"comment",
"for",
"the",
"specified",
"key",
"or",
"null",
"if",
"there",
"is",
"none",
".",
"Any",
"embedded",
"newline",
"sequences",
"will",
"be",
"replaced",
"by",
"\\",
"n",
"characters",
"."
] | 46510e610a765e4a91b302fc0d6a2123ed589603 | https://github.com/zanata/openprops/blob/46510e610a765e4a91b302fc0d6a2123ed589603/src/main/java/org/fedorahosted/openprops/Properties.java#L1288-L1291 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/PhotoUtils.java | PhotoUtils.getImageForSize | public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, Photo photo) throws JinxException {
if (photo == null || size == null) {
throw new JinxException("Cannot look up null photo or size.");
}
BufferedImage image;
try {
image = ImageIO.read(getUrlForSize(size, photo));
} catch (JinxException je) {
throw je;
} catch (Exception e) {
throw new JinxException("Unable to get image for size " + size.toString(), e);
}
return image;
} | java | public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, Photo photo) throws JinxException {
if (photo == null || size == null) {
throw new JinxException("Cannot look up null photo or size.");
}
BufferedImage image;
try {
image = ImageIO.read(getUrlForSize(size, photo));
} catch (JinxException je) {
throw je;
} catch (Exception e) {
throw new JinxException("Unable to get image for size " + size.toString(), e);
}
return image;
} | [
"public",
"static",
"BufferedImage",
"getImageForSize",
"(",
"JinxConstants",
".",
"PhotoSize",
"size",
",",
"Photo",
"photo",
")",
"throws",
"JinxException",
"{",
"if",
"(",
"photo",
"==",
"null",
"||",
"size",
"==",
"null",
")",
"{",
"throw",
"new",
"JinxE... | Get an image for a photo at a specific size.
@param size Required. The the desired size.
@param photo Required. The photo to get the image for.
@return buffered image data from Flickr.
@throws JinxException if any parameter is null, or if there are any errors. | [
"Get",
"an",
"image",
"for",
"a",
"photo",
"at",
"a",
"specific",
"size",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/PhotoUtils.java#L54-L67 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/PhotoUtils.java | PhotoUtils.getImageForSize | public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, PhotoInfo info) throws JinxException {
if (info == null || size == null) {
throw new JinxException("Cannot look up null photo or size.");
}
BufferedImage image;
try {
image = ImageIO.read(getUrlForSize(size, info));
} catch (JinxException je) {
throw je;
} catch (Exception e) {
throw new JinxException("Unable to get image for size " + size.toString(), e);
}
return image;
} | java | public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, PhotoInfo info) throws JinxException {
if (info == null || size == null) {
throw new JinxException("Cannot look up null photo or size.");
}
BufferedImage image;
try {
image = ImageIO.read(getUrlForSize(size, info));
} catch (JinxException je) {
throw je;
} catch (Exception e) {
throw new JinxException("Unable to get image for size " + size.toString(), e);
}
return image;
} | [
"public",
"static",
"BufferedImage",
"getImageForSize",
"(",
"JinxConstants",
".",
"PhotoSize",
"size",
",",
"PhotoInfo",
"info",
")",
"throws",
"JinxException",
"{",
"if",
"(",
"info",
"==",
"null",
"||",
"size",
"==",
"null",
")",
"{",
"throw",
"new",
"Jin... | Get an image for photo info at a specific size.
@param size Required. The the desired size.
@param info Required. The photo info describing the photo.
@return buffered image data from Flickr.
@throws JinxException if any parameter is null, or if there are any errors. | [
"Get",
"an",
"image",
"for",
"photo",
"info",
"at",
"a",
"specific",
"size",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/PhotoUtils.java#L77-L90 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/PhotoUtils.java | PhotoUtils.getUrlForSize | public static URL getUrlForSize(
JinxConstants.PhotoSize size, String photoId, String secret, String farm, String server, String originalFormat, String originalSecret) throws JinxException {
JinxUtils.validateParams(photoId, size, farm, server);
if (size == JinxConstants.PhotoSize.SIZE_ORIGINAL) {
JinxUtils.validateParams(originalFormat, originalSecret);
} else {
JinxUtils.validateParams(secret);
}
StringBuilder sb = new StringBuilder("https://farm");
sb.append(farm);
sb.append(".static.flickr.com/");
sb.append(server).append("/");
sb.append(photoId).append('_');
switch (size) {
case SIZE_SMALL_SQUARE:
sb.append(secret).append("_s.jpg");
break;
case SIZE_LARGE_SQUARE:
sb.append(secret).append("_q.jpg");
break;
case SIZE_THUMBNAIL:
sb.append(secret).append("_t.jpg");
break;
case SIZE_SMALL:
sb.append(secret).append("_m.jpg");
break;
case SIZE_SMALL_320:
sb.append(secret).append("_n.jpg");
break;
case SIZE_MEDIUM:
sb.append(secret).append(".jpg");
break;
case SIZE_MEDIUM_640:
sb.append(secret).append("_z.jpg");
break;
case SIZE_MEDIUM_800:
sb.append(secret).append("_c.jpg");
break;
case SIZE_LARGE:
sb.append(secret).append("_b.jpg");
break;
case SIZE_LARGE_1600:
sb.append(secret).append("_h.jpg");
break;
case SIZE_LARGE_2048:
sb.append(secret).append("_k.jpg");
break;
case SIZE_ORIGINAL:
sb.append(originalSecret).append("_o");
sb.append('.').append(originalFormat);
break;
default:
throw new JinxException("Undefined size: " + size);
}
try {
return new URL(sb.toString());
} catch (Exception e) {
throw new JinxException("Could not create URL from string " + sb.toString());
}
} | java | public static URL getUrlForSize(
JinxConstants.PhotoSize size, String photoId, String secret, String farm, String server, String originalFormat, String originalSecret) throws JinxException {
JinxUtils.validateParams(photoId, size, farm, server);
if (size == JinxConstants.PhotoSize.SIZE_ORIGINAL) {
JinxUtils.validateParams(originalFormat, originalSecret);
} else {
JinxUtils.validateParams(secret);
}
StringBuilder sb = new StringBuilder("https://farm");
sb.append(farm);
sb.append(".static.flickr.com/");
sb.append(server).append("/");
sb.append(photoId).append('_');
switch (size) {
case SIZE_SMALL_SQUARE:
sb.append(secret).append("_s.jpg");
break;
case SIZE_LARGE_SQUARE:
sb.append(secret).append("_q.jpg");
break;
case SIZE_THUMBNAIL:
sb.append(secret).append("_t.jpg");
break;
case SIZE_SMALL:
sb.append(secret).append("_m.jpg");
break;
case SIZE_SMALL_320:
sb.append(secret).append("_n.jpg");
break;
case SIZE_MEDIUM:
sb.append(secret).append(".jpg");
break;
case SIZE_MEDIUM_640:
sb.append(secret).append("_z.jpg");
break;
case SIZE_MEDIUM_800:
sb.append(secret).append("_c.jpg");
break;
case SIZE_LARGE:
sb.append(secret).append("_b.jpg");
break;
case SIZE_LARGE_1600:
sb.append(secret).append("_h.jpg");
break;
case SIZE_LARGE_2048:
sb.append(secret).append("_k.jpg");
break;
case SIZE_ORIGINAL:
sb.append(originalSecret).append("_o");
sb.append('.').append(originalFormat);
break;
default:
throw new JinxException("Undefined size: " + size);
}
try {
return new URL(sb.toString());
} catch (Exception e) {
throw new JinxException("Could not create URL from string " + sb.toString());
}
} | [
"public",
"static",
"URL",
"getUrlForSize",
"(",
"JinxConstants",
".",
"PhotoSize",
"size",
",",
"String",
"photoId",
",",
"String",
"secret",
",",
"String",
"farm",
",",
"String",
"server",
",",
"String",
"originalFormat",
",",
"String",
"originalSecret",
")",
... | Get the URL for a specific size of photo.
@param size Required. The the desired size.
@param photoId Required. The ID of the photo.
@param secret The secret of the photo. Required for all sizes except SIZE_ORIGINAL.
@param farm Required. The farm of the photo.
@param server Required. The server of the photo.
@param originalFormat The original format. Only required if size is SIZE_ORIGINAL.
@param originalSecret The original secret. Only required if size is SIZE_ORIGINAL.
@return URL for the photo at the specified size.
@throws JinxException if required parameters are missing, or if the URL cannot be created. | [
"Get",
"the",
"URL",
"for",
"a",
"specific",
"size",
"of",
"photo",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/PhotoUtils.java#L138-L212 | train |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PrefsApi.java | PrefsApi.getContentType | public Person getContentType() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.prefs.getContentType");
return jinx.flickrGet(params, Person.class);
} | java | public Person getContentType() throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.prefs.getContentType");
return jinx.flickrGet(params, Person.class);
} | [
"public",
"Person",
"getContentType",
"(",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",
",",
"\"flickr.prefs.getContentType\"",
"... | Returns the default content type preference for the user.
Authentication
This method requires authentication with 'read' permission.
@return person object with nsid and contentType fields set.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.prefs.getContentType.html">flickr.prefs.getContentType</a> | [
"Returns",
"the",
"default",
"content",
"type",
"preference",
"for",
"the",
"user",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PrefsApi.java#L57-L61 | train |
datacleaner/AnalyzerBeans | env/cluster/src/main/java/org/eobjects/analyzer/cluster/http/SlaveServletHelper.java | SlaveServletHelper.cancelJob | public boolean cancelJob(String slaveJobId) {
final AnalysisResultFuture resultFuture = _runningJobs.remove(slaveJobId);
if (resultFuture != null) {
resultFuture.cancel();
return true;
}
return false;
} | java | public boolean cancelJob(String slaveJobId) {
final AnalysisResultFuture resultFuture = _runningJobs.remove(slaveJobId);
if (resultFuture != null) {
resultFuture.cancel();
return true;
}
return false;
} | [
"public",
"boolean",
"cancelJob",
"(",
"String",
"slaveJobId",
")",
"{",
"final",
"AnalysisResultFuture",
"resultFuture",
"=",
"_runningJobs",
".",
"remove",
"(",
"slaveJobId",
")",
";",
"if",
"(",
"resultFuture",
"!=",
"null",
")",
"{",
"resultFuture",
".",
"... | Cancels a slave job, referred by it's id.
@param slaveJobId
@return whether or not the job was (found and) cancelled. | [
"Cancels",
"a",
"slave",
"job",
"referred",
"by",
"it",
"s",
"id",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/cluster/src/main/java/org/eobjects/analyzer/cluster/http/SlaveServletHelper.java#L309-L316 | train |
fuinorg/event-store-commons | jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java | AbstractJpaEventStore.entityExists | protected final boolean entityExists(final String entityName) {
final Set<EntityType<?>> entityTypes = getEm().getMetamodel().getEntities();
for (final EntityType<?> entityType : entityTypes) {
if (entityType.getName().equals(entityName)) {
return true;
}
}
return false;
} | java | protected final boolean entityExists(final String entityName) {
final Set<EntityType<?>> entityTypes = getEm().getMetamodel().getEntities();
for (final EntityType<?> entityType : entityTypes) {
if (entityType.getName().equals(entityName)) {
return true;
}
}
return false;
} | [
"protected",
"final",
"boolean",
"entityExists",
"(",
"final",
"String",
"entityName",
")",
"{",
"final",
"Set",
"<",
"EntityType",
"<",
"?",
">",
">",
"entityTypes",
"=",
"getEm",
"(",
")",
".",
"getMetamodel",
"(",
")",
".",
"getEntities",
"(",
")",
";... | Returns if an entity with agiven name exists.
@param entityName
Entity to test.
@return TRUE if the entity is known, else FALSE. | [
"Returns",
"if",
"an",
"entity",
"with",
"agiven",
"name",
"exists",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java#L340-L348 | train |
fuinorg/event-store-commons | jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java | AbstractJpaEventStore.createJpqlStreamSelect | protected final String createJpqlStreamSelect(final StreamId streamId) {
if (streamId.isProjection()) {
throw new IllegalArgumentException("Projections do not have a stream table : " + streamId);
}
final List<KeyValue> params = new ArrayList<>(streamId.getParameters());
if (params.size() == 0) {
// NoParamsStream
params.add(new KeyValue("streamName", streamId.getName()));
}
final StringBuilder sb = new StringBuilder("SELECT t FROM " + streamEntityName(streamId) + " t");
sb.append(" WHERE ");
for (int i = 0; i < params.size(); i++) {
final KeyValue param = params.get(i);
if (i > 0) {
sb.append(" AND ");
}
sb.append("t." + param.getKey() + "=:" + param.getKey());
}
return sb.toString();
} | java | protected final String createJpqlStreamSelect(final StreamId streamId) {
if (streamId.isProjection()) {
throw new IllegalArgumentException("Projections do not have a stream table : " + streamId);
}
final List<KeyValue> params = new ArrayList<>(streamId.getParameters());
if (params.size() == 0) {
// NoParamsStream
params.add(new KeyValue("streamName", streamId.getName()));
}
final StringBuilder sb = new StringBuilder("SELECT t FROM " + streamEntityName(streamId) + " t");
sb.append(" WHERE ");
for (int i = 0; i < params.size(); i++) {
final KeyValue param = params.get(i);
if (i > 0) {
sb.append(" AND ");
}
sb.append("t." + param.getKey() + "=:" + param.getKey());
}
return sb.toString();
} | [
"protected",
"final",
"String",
"createJpqlStreamSelect",
"(",
"final",
"StreamId",
"streamId",
")",
"{",
"if",
"(",
"streamId",
".",
"isProjection",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Projections do not have a stream table : \"",
... | Creates the JPQL to select the stream itself.
@param streamId
Unique stream identifier.
@return JPQL that selects the stream with the given identifier. | [
"Creates",
"the",
"JPQL",
"to",
"select",
"the",
"stream",
"itself",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java#L388-L409 | train |
fuinorg/event-store-commons | jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java | AbstractJpaEventStore.findStream | @NotNull
protected final JpaStream findStream(@NotNull final StreamId streamId) {
Contract.requireArgNotNull("streamId", streamId);
verifyStreamEntityExists(streamId);
final String sql = createJpqlStreamSelect(streamId);
final TypedQuery<JpaStream> query = getEm().createQuery(sql, JpaStream.class);
setJpqlParameters(query, streamId);
final List<JpaStream> streams = query.getResultList();
if (streams.size() == 0) {
throw new StreamNotFoundException(streamId);
}
final JpaStream stream = streams.get(0);
if (stream.getState() == StreamState.SOFT_DELETED) {
// TODO Remove after event store has a way to distinguish between
// never-existing and soft deleted
// streams
throw new StreamNotFoundException(streamId);
}
return stream;
} | java | @NotNull
protected final JpaStream findStream(@NotNull final StreamId streamId) {
Contract.requireArgNotNull("streamId", streamId);
verifyStreamEntityExists(streamId);
final String sql = createJpqlStreamSelect(streamId);
final TypedQuery<JpaStream> query = getEm().createQuery(sql, JpaStream.class);
setJpqlParameters(query, streamId);
final List<JpaStream> streams = query.getResultList();
if (streams.size() == 0) {
throw new StreamNotFoundException(streamId);
}
final JpaStream stream = streams.get(0);
if (stream.getState() == StreamState.SOFT_DELETED) {
// TODO Remove after event store has a way to distinguish between
// never-existing and soft deleted
// streams
throw new StreamNotFoundException(streamId);
}
return stream;
} | [
"@",
"NotNull",
"protected",
"final",
"JpaStream",
"findStream",
"(",
"@",
"NotNull",
"final",
"StreamId",
"streamId",
")",
"{",
"Contract",
".",
"requireArgNotNull",
"(",
"\"streamId\"",
",",
"streamId",
")",
";",
"verifyStreamEntityExists",
"(",
"streamId",
")",... | Reads the stream with the given identifier from the DB and returns it.
@param streamId
Stream to load.
@return Stream. | [
"Reads",
"the",
"stream",
"with",
"the",
"given",
"identifier",
"from",
"the",
"DB",
"and",
"returns",
"it",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java#L419-L441 | train |
fuinorg/event-store-commons | jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java | AbstractJpaEventStore.createNativeSqlEventSelect | private final String createNativeSqlEventSelect(final StreamId streamId,
final List<NativeSqlCondition> conditions) {
final StringBuilder sb = new StringBuilder("SELECT " + JPA_EVENT_PREFIX + ".* FROM "
+ JpaEvent.TABLE_NAME + " " + JPA_EVENT_PREFIX + ", " + nativeEventsTableName(streamId) + " "
+ JPA_STREAM_EVENT_PREFIX + " WHERE " + JPA_EVENT_PREFIX + "." + JpaEvent.COLUMN_ID + "="
+ JPA_STREAM_EVENT_PREFIX + "." + JpaStreamEvent.COLUMN_EVENTS_ID);
for (final NativeSqlCondition condition : conditions) {
sb.append(" AND ");
sb.append(condition.asWhereConditionWithParam());
}
return sb.toString();
} | java | private final String createNativeSqlEventSelect(final StreamId streamId,
final List<NativeSqlCondition> conditions) {
final StringBuilder sb = new StringBuilder("SELECT " + JPA_EVENT_PREFIX + ".* FROM "
+ JpaEvent.TABLE_NAME + " " + JPA_EVENT_PREFIX + ", " + nativeEventsTableName(streamId) + " "
+ JPA_STREAM_EVENT_PREFIX + " WHERE " + JPA_EVENT_PREFIX + "." + JpaEvent.COLUMN_ID + "="
+ JPA_STREAM_EVENT_PREFIX + "." + JpaStreamEvent.COLUMN_EVENTS_ID);
for (final NativeSqlCondition condition : conditions) {
sb.append(" AND ");
sb.append(condition.asWhereConditionWithParam());
}
return sb.toString();
} | [
"private",
"final",
"String",
"createNativeSqlEventSelect",
"(",
"final",
"StreamId",
"streamId",
",",
"final",
"List",
"<",
"NativeSqlCondition",
">",
"conditions",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"SELECT \"",
"+",
"J... | Creates a native SQL select using the parameters from the stream
identifier and optional other arguments.
@param streamId
Unique stream identifier that has the parameter values.
@param additionalParams
Parameters to add in addition to the ones from the stream
identifier.
@return JPQL for selecting the events. | [
"Creates",
"a",
"native",
"SQL",
"select",
"using",
"the",
"parameters",
"from",
"the",
"stream",
"identifier",
"and",
"optional",
"other",
"arguments",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/AbstractJpaEventStore.java#L491-L503 | train |
fuinorg/event-store-commons | jpa/src/main/java/org/fuin/esc/jpa/JpaStream.java | JpaStream.delete | public void delete(final boolean hardDelete) {
if (hardDelete) {
this.state = StreamState.HARD_DELETED.dbValue();
} else {
this.state = StreamState.SOFT_DELETED.dbValue();
}
} | java | public void delete(final boolean hardDelete) {
if (hardDelete) {
this.state = StreamState.HARD_DELETED.dbValue();
} else {
this.state = StreamState.SOFT_DELETED.dbValue();
}
} | [
"public",
"void",
"delete",
"(",
"final",
"boolean",
"hardDelete",
")",
"{",
"if",
"(",
"hardDelete",
")",
"{",
"this",
".",
"state",
"=",
"StreamState",
".",
"HARD_DELETED",
".",
"dbValue",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"state",
"=",
... | Marks the stream as deleted.
@param hardDelete
Hard or soft deletion. | [
"Marks",
"the",
"stream",
"as",
"deleted",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/JpaStream.java#L63-L69 | train |
datacleaner/AnalyzerBeans | env/xml-config/src/main/java/org/eobjects/analyzer/configuration/DatastoreXmlExternalizer.java | DatastoreXmlExternalizer.removeDatastore | public boolean removeDatastore(final String datastoreName) {
final Element datastoreCatalogElement = getDatastoreCatalogElement();
final NodeList childNodes = datastoreCatalogElement.getChildNodes();
final int length = childNodes.getLength();
for (int i = 0; i < length; i++) {
final Node node = childNodes.item(i);
if (node instanceof Element) {
final Element element = (Element) node;
final Attr[] attributes = XmlDomDataContext.getAttributes(element);
for (Attr attr : attributes) {
if ("name".equals(attr.getName())) {
final String value = attr.getValue();
if (datastoreName.equals(value)) {
// we have a match
datastoreCatalogElement.removeChild(element);
onDocumentChanged(getDocument());
return true;
}
}
}
}
}
return false;
} | java | public boolean removeDatastore(final String datastoreName) {
final Element datastoreCatalogElement = getDatastoreCatalogElement();
final NodeList childNodes = datastoreCatalogElement.getChildNodes();
final int length = childNodes.getLength();
for (int i = 0; i < length; i++) {
final Node node = childNodes.item(i);
if (node instanceof Element) {
final Element element = (Element) node;
final Attr[] attributes = XmlDomDataContext.getAttributes(element);
for (Attr attr : attributes) {
if ("name".equals(attr.getName())) {
final String value = attr.getValue();
if (datastoreName.equals(value)) {
// we have a match
datastoreCatalogElement.removeChild(element);
onDocumentChanged(getDocument());
return true;
}
}
}
}
}
return false;
} | [
"public",
"boolean",
"removeDatastore",
"(",
"final",
"String",
"datastoreName",
")",
"{",
"final",
"Element",
"datastoreCatalogElement",
"=",
"getDatastoreCatalogElement",
"(",
")",
";",
"final",
"NodeList",
"childNodes",
"=",
"datastoreCatalogElement",
".",
"getChildN... | Removes a datastore by it's name, if it exists and is recognizeable by
the externalizer.
@param datastoreName
@return true if a datastore element was removed from the XML document. | [
"Removes",
"a",
"datastore",
"by",
"it",
"s",
"name",
"if",
"it",
"exists",
"and",
"is",
"recognizeable",
"by",
"the",
"externalizer",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/xml-config/src/main/java/org/eobjects/analyzer/configuration/DatastoreXmlExternalizer.java#L129-L155 | train |
fuinorg/event-store-commons | spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java | SimpleSerializerDeserializerRegistry.add | public final void add(@NotNull final SerializedDataType type, final String contentType,
@NotNull final SerDeserializer serDeserializer) {
this.addSerializer(type, serDeserializer);
this.addDeserializer(type, contentType, serDeserializer);
} | java | public final void add(@NotNull final SerializedDataType type, final String contentType,
@NotNull final SerDeserializer serDeserializer) {
this.addSerializer(type, serDeserializer);
this.addDeserializer(type, contentType, serDeserializer);
} | [
"public",
"final",
"void",
"add",
"(",
"@",
"NotNull",
"final",
"SerializedDataType",
"type",
",",
"final",
"String",
"contentType",
",",
"@",
"NotNull",
"final",
"SerDeserializer",
"serDeserializer",
")",
"{",
"this",
".",
"addSerializer",
"(",
"type",
",",
"... | Convenience method that adds both, a new serializer and deserializer to the registry.
@param type
Type of the data.
@param contentType
Content type like "application/xml" or "application/json" (without parameters - Only base
type).
@param serDeserializer
Serializer and deserializer. | [
"Convenience",
"method",
"that",
"adds",
"both",
"a",
"new",
"serializer",
"and",
"deserializer",
"to",
"the",
"registry",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java#L59-L65 | train |
fuinorg/event-store-commons | spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java | SimpleSerializerDeserializerRegistry.addDeserializer | public final void addDeserializer(@NotNull final SerializedDataType type, final String contentType,
@NotNull final Deserializer deserializer) {
Contract.requireArgNotNull("type", type);
Contract.requireArgNotNull("contentType", contentType);
Contract.requireArgNotNull("deserializer", deserializer);
final Key key = new Key(type, contentType);
desMap.put(key, deserializer);
} | java | public final void addDeserializer(@NotNull final SerializedDataType type, final String contentType,
@NotNull final Deserializer deserializer) {
Contract.requireArgNotNull("type", type);
Contract.requireArgNotNull("contentType", contentType);
Contract.requireArgNotNull("deserializer", deserializer);
final Key key = new Key(type, contentType);
desMap.put(key, deserializer);
} | [
"public",
"final",
"void",
"addDeserializer",
"(",
"@",
"NotNull",
"final",
"SerializedDataType",
"type",
",",
"final",
"String",
"contentType",
",",
"@",
"NotNull",
"final",
"Deserializer",
"deserializer",
")",
"{",
"Contract",
".",
"requireArgNotNull",
"(",
"\"t... | Adds a new deserializer to the registry.
@param type
Type of the data.
@param contentType
Content type like "application/xml" or "application/json" (without parameters - Only base
type).
@param deserializer
Deserializer. | [
"Adds",
"a",
"new",
"deserializer",
"to",
"the",
"registry",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java#L78-L88 | train |
fuinorg/event-store-commons | spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java | SimpleSerializerDeserializerRegistry.setDefaultContentType | public final void setDefaultContentType(@NotNull final SerializedDataType type,
final EnhancedMimeType contentType) {
Contract.requireArgNotNull("type", type);
Contract.requireArgNotNull("contentType", contentType);
contentTypes.put(type, contentType);
} | java | public final void setDefaultContentType(@NotNull final SerializedDataType type,
final EnhancedMimeType contentType) {
Contract.requireArgNotNull("type", type);
Contract.requireArgNotNull("contentType", contentType);
contentTypes.put(type, contentType);
} | [
"public",
"final",
"void",
"setDefaultContentType",
"(",
"@",
"NotNull",
"final",
"SerializedDataType",
"type",
",",
"final",
"EnhancedMimeType",
"contentType",
")",
"{",
"Contract",
".",
"requireArgNotNull",
"(",
"\"type\"",
",",
"type",
")",
";",
"Contract",
"."... | Sets the default content type to use if no content type is given.
@param type
Type of the data.
@param contentType
Content type like "application/xml" or "application/json" (without parameters - Only base
type). | [
"Sets",
"the",
"default",
"content",
"type",
"to",
"use",
"if",
"no",
"content",
"type",
"is",
"given",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java#L99-L107 | train |
fuinorg/event-store-commons | spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java | SimpleSerializerDeserializerRegistry.addSerializer | public final void addSerializer(@NotNull final SerializedDataType type,
@NotNull final Serializer serializer) {
Contract.requireArgNotNull("type", type);
Contract.requireArgNotNull("serializer", serializer);
serMap.put(type, serializer);
} | java | public final void addSerializer(@NotNull final SerializedDataType type,
@NotNull final Serializer serializer) {
Contract.requireArgNotNull("type", type);
Contract.requireArgNotNull("serializer", serializer);
serMap.put(type, serializer);
} | [
"public",
"final",
"void",
"addSerializer",
"(",
"@",
"NotNull",
"final",
"SerializedDataType",
"type",
",",
"@",
"NotNull",
"final",
"Serializer",
"serializer",
")",
"{",
"Contract",
".",
"requireArgNotNull",
"(",
"\"type\"",
",",
"type",
")",
";",
"Contract",
... | Adds a new serializer to the registry.
@param type
Type of the data.
@param serializer
Serializer. | [
"Adds",
"a",
"new",
"serializer",
"to",
"the",
"registry",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/SimpleSerializerDeserializerRegistry.java#L117-L125 | train |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/ProgramEvaluator.java | ProgramEvaluator.compileProgram | public void compileProgram() {
program.inputs().forEach(var -> var.calculateFuzzySpace());
program.outputs().forEach(var -> var.calculateFuzzySpace());
program.rules().forEach(rule -> {
updateMemberReferenceCount(rule.getCondition());
rule.assignmentMembers().forEach(member -> member.incrReferenceCount());
});
} | java | public void compileProgram() {
program.inputs().forEach(var -> var.calculateFuzzySpace());
program.outputs().forEach(var -> var.calculateFuzzySpace());
program.rules().forEach(rule -> {
updateMemberReferenceCount(rule.getCondition());
rule.assignmentMembers().forEach(member -> member.incrReferenceCount());
});
} | [
"public",
"void",
"compileProgram",
"(",
")",
"{",
"program",
".",
"inputs",
"(",
")",
".",
"forEach",
"(",
"var",
"->",
"var",
".",
"calculateFuzzySpace",
"(",
")",
")",
";",
"program",
".",
"outputs",
"(",
")",
".",
"forEach",
"(",
"var",
"->",
"va... | Compile the program | [
"Compile",
"the",
"program"
] | e8aa46313bb1d1328865f26f99455124aede828c | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/ProgramEvaluator.java#L27-L35 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/job/builder/TransformerJobBuilder.java | TransformerJobBuilder.getOutputColumnByName | public MutableInputColumn<?> getOutputColumnByName(String name) {
if (StringUtils.isNullOrEmpty(name)) {
return null;
}
final List<MutableInputColumn<?>> outputColumns = getOutputColumns();
for (MutableInputColumn<?> inputColumn : outputColumns) {
if (name.equals(inputColumn.getName())) {
return inputColumn;
}
}
return null;
} | java | public MutableInputColumn<?> getOutputColumnByName(String name) {
if (StringUtils.isNullOrEmpty(name)) {
return null;
}
final List<MutableInputColumn<?>> outputColumns = getOutputColumns();
for (MutableInputColumn<?> inputColumn : outputColumns) {
if (name.equals(inputColumn.getName())) {
return inputColumn;
}
}
return null;
} | [
"public",
"MutableInputColumn",
"<",
"?",
">",
"getOutputColumnByName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"name",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"List",
"<",
"MutableInputColumn",
"<",
... | Gets an output column by name.
@see #getOutputColumns()
@param name
@return | [
"Gets",
"an",
"output",
"column",
"by",
"name",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/job/builder/TransformerJobBuilder.java#L240-L252 | train |
ktoso/janbanery | janbanery-core/src/main/java/pl/project13/janbanery/exceptions/kanbanery/InvalidEntityKanbaneryException.java | InvalidEntityKanbaneryException.mostSpecializedException | public static InvalidEntityKanbaneryException mostSpecializedException(String response) {
//todo refactor this!!!
if (response == null || "".equals(response)) {
return new InvalidEntityKanbaneryException(response);
} else if (TaskAlreadyInFirstColumnException.isBestExceptionFor(response)) {
return new TaskAlreadyInFirstColumnException(response);
} else if (TaskAlreadyInLastColumnException.isBestExceptionFor(response)) {
return new TaskAlreadyInLastColumnException(response);
} else if (PositionExceedsNumberOfTasksInColumnException.isBestExceptionFor(response)) {
return new PositionExceedsNumberOfTasksInColumnException(response);
} else if (CanOnlyIceBoxTaskFromFirstColumnException.isBestExceptionFor(response)) {
return new CanOnlyIceBoxTaskFromFirstColumnException(response);
} else if (CanOnlyArchiveFromLastColumnException.isBestExceptionFor(response)) {
return new CanOnlyArchiveFromLastColumnException(response);
} else if (NotFixedColumnCannotBeFirstException.isBestExceptionFor(response)) {
return new NotFixedColumnCannotBeFirstException(response);
} else if (BodyMustNotBeBlankException.isBestExceptionFor(response)) {
return new BodyMustNotBeBlankException(response);
} else if (MaximumNumbersOfCollaboratorsReachedException.isBestExceptionFor(response)) {
return new MaximumNumbersOfCollaboratorsReachedException(response);
} else if (UserAlreadyAssignedToThisProjectException.isBestExceptionFor(response)) {
return new UserAlreadyAssignedToThisProjectException(response);
} else if (ProjectOwnerCanNotBeGivenProjectMembership.isBestExceptionFor(response)) {
return new ProjectOwnerCanNotBeGivenProjectMembership(response);
} else if (CanNotDeleteColumnThatContainsTasksException.isBestExceptionFor(response)) {
return new CanNotDeleteColumnThatContainsTasksException(response);
} else {
return new InvalidEntityKanbaneryException(response);
}
} | java | public static InvalidEntityKanbaneryException mostSpecializedException(String response) {
//todo refactor this!!!
if (response == null || "".equals(response)) {
return new InvalidEntityKanbaneryException(response);
} else if (TaskAlreadyInFirstColumnException.isBestExceptionFor(response)) {
return new TaskAlreadyInFirstColumnException(response);
} else if (TaskAlreadyInLastColumnException.isBestExceptionFor(response)) {
return new TaskAlreadyInLastColumnException(response);
} else if (PositionExceedsNumberOfTasksInColumnException.isBestExceptionFor(response)) {
return new PositionExceedsNumberOfTasksInColumnException(response);
} else if (CanOnlyIceBoxTaskFromFirstColumnException.isBestExceptionFor(response)) {
return new CanOnlyIceBoxTaskFromFirstColumnException(response);
} else if (CanOnlyArchiveFromLastColumnException.isBestExceptionFor(response)) {
return new CanOnlyArchiveFromLastColumnException(response);
} else if (NotFixedColumnCannotBeFirstException.isBestExceptionFor(response)) {
return new NotFixedColumnCannotBeFirstException(response);
} else if (BodyMustNotBeBlankException.isBestExceptionFor(response)) {
return new BodyMustNotBeBlankException(response);
} else if (MaximumNumbersOfCollaboratorsReachedException.isBestExceptionFor(response)) {
return new MaximumNumbersOfCollaboratorsReachedException(response);
} else if (UserAlreadyAssignedToThisProjectException.isBestExceptionFor(response)) {
return new UserAlreadyAssignedToThisProjectException(response);
} else if (ProjectOwnerCanNotBeGivenProjectMembership.isBestExceptionFor(response)) {
return new ProjectOwnerCanNotBeGivenProjectMembership(response);
} else if (CanNotDeleteColumnThatContainsTasksException.isBestExceptionFor(response)) {
return new CanNotDeleteColumnThatContainsTasksException(response);
} else {
return new InvalidEntityKanbaneryException(response);
}
} | [
"public",
"static",
"InvalidEntityKanbaneryException",
"mostSpecializedException",
"(",
"String",
"response",
")",
"{",
"//todo refactor this!!!",
"if",
"(",
"response",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"response",
")",
")",
"{",
"return",
"new",
"I... | May be used as "Exception factory" to determine the "best" exception to be thrown
for such JSON response. For example we may throw "TaskAlreadyInFirstColumnException"
if the JSON contains a message informing us about this.
@param response the JSON server response, containing a error messages
@return the "best" exception to be thrown for such an response JSON, based on it's error messages | [
"May",
"be",
"used",
"as",
"Exception",
"factory",
"to",
"determine",
"the",
"best",
"exception",
"to",
"be",
"thrown",
"for",
"such",
"JSON",
"response",
".",
"For",
"example",
"we",
"may",
"throw",
"TaskAlreadyInFirstColumnException",
"if",
"the",
"JSON",
"c... | cd77b774814c7fbb2a0c9c55d4c3f7e76affa636 | https://github.com/ktoso/janbanery/blob/cd77b774814c7fbb2a0c9c55d4c3f7e76affa636/janbanery-core/src/main/java/pl/project13/janbanery/exceptions/kanbanery/InvalidEntityKanbaneryException.java#L56-L85 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/reference/DatastoreSynonymCatalog.java | DatastoreSynonymCatalog.init | @Initialize
public void init() {
logger.info("Initializing dictionary: {}", this);
Datastore datastore = getDatastore();
DatastoreConnection dataContextProvider = datastore.openConnection();
getDatastoreConnections().add(dataContextProvider);
} | java | @Initialize
public void init() {
logger.info("Initializing dictionary: {}", this);
Datastore datastore = getDatastore();
DatastoreConnection dataContextProvider = datastore.openConnection();
getDatastoreConnections().add(dataContextProvider);
} | [
"@",
"Initialize",
"public",
"void",
"init",
"(",
")",
"{",
"logger",
".",
"info",
"(",
"\"Initializing dictionary: {}\"",
",",
"this",
")",
";",
"Datastore",
"datastore",
"=",
"getDatastore",
"(",
")",
";",
"DatastoreConnection",
"dataContextProvider",
"=",
"da... | Initializes a DatastoreConnection, which will keep the connection open | [
"Initializes",
"a",
"DatastoreConnection",
"which",
"will",
"keep",
"the",
"connection",
"open"
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/reference/DatastoreSynonymCatalog.java#L98-L104 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/util/ClassLoaderUtils.java | ClassLoaderUtils.getParentClassLoader | public static ClassLoader getParentClassLoader() {
logger.debug("getParentClassLoader() invoked, web start mode: {}", IS_WEB_START);
if (IS_WEB_START) {
return Thread.currentThread().getContextClassLoader();
} else {
return ClassLoaderUtils.class.getClassLoader();
}
} | java | public static ClassLoader getParentClassLoader() {
logger.debug("getParentClassLoader() invoked, web start mode: {}", IS_WEB_START);
if (IS_WEB_START) {
return Thread.currentThread().getContextClassLoader();
} else {
return ClassLoaderUtils.class.getClassLoader();
}
} | [
"public",
"static",
"ClassLoader",
"getParentClassLoader",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"getParentClassLoader() invoked, web start mode: {}\"",
",",
"IS_WEB_START",
")",
";",
"if",
"(",
"IS_WEB_START",
")",
"{",
"return",
"Thread",
".",
"currentThread... | Gets an appropriate classloader for usage when performing classpath
lookups and scanning.
@return | [
"Gets",
"an",
"appropriate",
"classloader",
"for",
"usage",
"when",
"performing",
"classpath",
"lookups",
"and",
"scanning",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/util/ClassLoaderUtils.java#L58-L65 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/result/AbstractCrosstabResultReducer.java | AbstractCrosstabResultReducer.createMasterCrosstab | protected Crosstab<Serializable> createMasterCrosstab(Collection<? extends R> results) {
final R firstResult = results.iterator().next();
final Crosstab<?> firstCrosstab = firstResult.getCrosstab();
final Class<?> valueClass = firstCrosstab.getValueClass();
final CrosstabDimension dimension1 = firstCrosstab.getDimension(0);
final CrosstabDimension dimension2 = firstCrosstab.getDimension(1);
@SuppressWarnings({ "unchecked", "rawtypes" })
final Crosstab<Serializable> masterCrosstab = new Crosstab(valueClass, dimension1, dimension2);
return masterCrosstab;
} | java | protected Crosstab<Serializable> createMasterCrosstab(Collection<? extends R> results) {
final R firstResult = results.iterator().next();
final Crosstab<?> firstCrosstab = firstResult.getCrosstab();
final Class<?> valueClass = firstCrosstab.getValueClass();
final CrosstabDimension dimension1 = firstCrosstab.getDimension(0);
final CrosstabDimension dimension2 = firstCrosstab.getDimension(1);
@SuppressWarnings({ "unchecked", "rawtypes" })
final Crosstab<Serializable> masterCrosstab = new Crosstab(valueClass, dimension1, dimension2);
return masterCrosstab;
} | [
"protected",
"Crosstab",
"<",
"Serializable",
">",
"createMasterCrosstab",
"(",
"Collection",
"<",
"?",
"extends",
"R",
">",
"results",
")",
"{",
"final",
"R",
"firstResult",
"=",
"results",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"final",
... | Builds the master crosstab, including all dimensions and categories that
will be included in the final result.
By default this method will use the first result's crosstab dimensions
and categories, assuming that they are all the same.
Subclasses can override this method to build the other dimensions.
@param results
@return | [
"Builds",
"the",
"master",
"crosstab",
"including",
"all",
"dimensions",
"and",
"categories",
"that",
"will",
"be",
"included",
"in",
"the",
"final",
"result",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/result/AbstractCrosstabResultReducer.java#L98-L109 | train |
PrashamTrivedi/SharedPreferenceInspector | sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/SharedPrefsBrowser.java | SharedPrefsBrowser.startFragment | public void startFragment(Fragment fragment, String tag, boolean canAddToBackstack) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer, fragment);
if (canAddToBackstack) {
transaction.addToBackStack(tag);
}
transaction.commit();
} | java | public void startFragment(Fragment fragment, String tag, boolean canAddToBackstack) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer, fragment);
if (canAddToBackstack) {
transaction.addToBackStack(tag);
}
transaction.commit();
} | [
"public",
"void",
"startFragment",
"(",
"Fragment",
"fragment",
",",
"String",
"tag",
",",
"boolean",
"canAddToBackstack",
")",
"{",
"FragmentTransaction",
"transaction",
"=",
"getSupportFragmentManager",
"(",
")",
".",
"beginTransaction",
"(",
")",
".",
"replace",
... | Start given Fragment
@param fragment
: Fragment Instance to start.
@param tag
: Tag to be notified when adding to backstack
@param canAddToBackstack
: pass <code>true</code> if you want to add this item in backstack. pass <code>false</code> otherwise | [
"Start",
"given",
"Fragment"
] | c04d567c4d0fc5e0f8cda308ca85df19c6b3b838 | https://github.com/PrashamTrivedi/SharedPreferenceInspector/blob/c04d567c4d0fc5e0f8cda308ca85df19c6b3b838/sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/SharedPrefsBrowser.java#L36-L43 | train |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/Variable.java | Variable.calculateFuzzySpace | public void calculateFuzzySpace() {
double start = getFrom().doubleValue();
double stop = getTo().doubleValue();
double step = getStep().doubleValue();
// enumerate the variable range
members().forEach(member -> {
if (member.haveFunctionCall()) {
for (double i = start; i <= stop; i += step) {
member.calculateFunctionAt(i);
}
} else {
member.calculateEndPoints(start, stop);
for (double i = start; i <= stop; i += step) {
member.calculateValueAt(i);
}
}
});
// find the max over all members
double yMax = Double.MIN_VALUE;
for (Member member : members()) {
double memberMax = member.findMax();
yMax = memberMax > yMax ? memberMax : yMax;
}
// normalize exploded values into a byte range
for (Member member : members()) {
member.normalizeY(yMax, 255);
totalSteps = Math.max(totalSteps, member.normalized().size());
}
this.calculated = true;
} | java | public void calculateFuzzySpace() {
double start = getFrom().doubleValue();
double stop = getTo().doubleValue();
double step = getStep().doubleValue();
// enumerate the variable range
members().forEach(member -> {
if (member.haveFunctionCall()) {
for (double i = start; i <= stop; i += step) {
member.calculateFunctionAt(i);
}
} else {
member.calculateEndPoints(start, stop);
for (double i = start; i <= stop; i += step) {
member.calculateValueAt(i);
}
}
});
// find the max over all members
double yMax = Double.MIN_VALUE;
for (Member member : members()) {
double memberMax = member.findMax();
yMax = memberMax > yMax ? memberMax : yMax;
}
// normalize exploded values into a byte range
for (Member member : members()) {
member.normalizeY(yMax, 255);
totalSteps = Math.max(totalSteps, member.normalized().size());
}
this.calculated = true;
} | [
"public",
"void",
"calculateFuzzySpace",
"(",
")",
"{",
"double",
"start",
"=",
"getFrom",
"(",
")",
".",
"doubleValue",
"(",
")",
";",
"double",
"stop",
"=",
"getTo",
"(",
")",
".",
"doubleValue",
"(",
")",
";",
"double",
"step",
"=",
"getStep",
"(",
... | Calculate the full fuzzy space for this variable. | [
"Calculate",
"the",
"full",
"fuzzy",
"space",
"for",
"this",
"variable",
"."
] | e8aa46313bb1d1328865f26f99455124aede828c | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Variable.java#L269-L302 | train |
schaloner/deadbolt | app/controllers/deadbolt/Deadbolt.java | Deadbolt.accessFailed | static void accessFailed() throws Throwable
{
String controllerClassName = getControllerClass().getName();
Logger.debug("Deadbolt: Access failure on [%s]",
controllerClassName);
String responseFormat = null;
if (getActionAnnotation(JSON.class) != null)
{
responseFormat = "json";
}
else if (getActionAnnotation(XML.class) != null)
{
responseFormat = "xml";
}
else if (getControllerAnnotation(JSON.class) != null)
{
responseFormat = "json";
}
else if (getControllerAnnotation(XML.class) != null)
{
responseFormat = "xml";
}
else
{
String defaultResponseFormat = Play.configuration.getProperty(DEFAULT_RESPONSE_FORMAT);
if (!isEmpty(defaultResponseFormat))
{
responseFormat = defaultResponseFormat;
}
}
if (!isEmpty(responseFormat))
{
request.format = responseFormat;
}
DEADBOLT_HANDLER.onAccessFailure(controllerClassName);
} | java | static void accessFailed() throws Throwable
{
String controllerClassName = getControllerClass().getName();
Logger.debug("Deadbolt: Access failure on [%s]",
controllerClassName);
String responseFormat = null;
if (getActionAnnotation(JSON.class) != null)
{
responseFormat = "json";
}
else if (getActionAnnotation(XML.class) != null)
{
responseFormat = "xml";
}
else if (getControllerAnnotation(JSON.class) != null)
{
responseFormat = "json";
}
else if (getControllerAnnotation(XML.class) != null)
{
responseFormat = "xml";
}
else
{
String defaultResponseFormat = Play.configuration.getProperty(DEFAULT_RESPONSE_FORMAT);
if (!isEmpty(defaultResponseFormat))
{
responseFormat = defaultResponseFormat;
}
}
if (!isEmpty(responseFormat))
{
request.format = responseFormat;
}
DEADBOLT_HANDLER.onAccessFailure(controllerClassName);
} | [
"static",
"void",
"accessFailed",
"(",
")",
"throws",
"Throwable",
"{",
"String",
"controllerClassName",
"=",
"getControllerClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"Logger",
".",
"debug",
"(",
"\"Deadbolt: Access failure on [%s]\"",
",",
"controllerClassNam... | Generic access failure forwarding point. | [
"Generic",
"access",
"failure",
"forwarding",
"point",
"."
] | 8a3a3f6b51e224eda39b3f7f8d5ce5869995e966 | https://github.com/schaloner/deadbolt/blob/8a3a3f6b51e224eda39b3f7f8d5ce5869995e966/app/controllers/deadbolt/Deadbolt.java#L331-L370 | train |
schaloner/deadbolt | app/controllers/deadbolt/Deadbolt.java | Deadbolt.hasAllRoles | public static boolean hasAllRoles(RoleHolder roleHolder,
String[] roleNames)
{
boolean hasRole = false;
if (roleHolder != null)
{
List<? extends Role> roles = roleHolder.getRoles();
if (roles != null)
{
List<String> heldRoles = new ArrayList<String>();
for (Role role : roles)
{
if (role != null)
{
heldRoles.add(role.getRoleName());
}
}
boolean roleCheckResult = true;
for (int i = 0; roleCheckResult && i < roleNames.length; i++)
{
boolean invert = false;
String roleName = roleNames[i];
if (roleName.startsWith("!"))
{
invert = true;
roleName = roleName.substring(1);
}
roleCheckResult = heldRoles.contains(roleName);
if (invert)
{
roleCheckResult = !roleCheckResult;
}
}
hasRole = roleCheckResult;
}
}
return hasRole;
} | java | public static boolean hasAllRoles(RoleHolder roleHolder,
String[] roleNames)
{
boolean hasRole = false;
if (roleHolder != null)
{
List<? extends Role> roles = roleHolder.getRoles();
if (roles != null)
{
List<String> heldRoles = new ArrayList<String>();
for (Role role : roles)
{
if (role != null)
{
heldRoles.add(role.getRoleName());
}
}
boolean roleCheckResult = true;
for (int i = 0; roleCheckResult && i < roleNames.length; i++)
{
boolean invert = false;
String roleName = roleNames[i];
if (roleName.startsWith("!"))
{
invert = true;
roleName = roleName.substring(1);
}
roleCheckResult = heldRoles.contains(roleName);
if (invert)
{
roleCheckResult = !roleCheckResult;
}
}
hasRole = roleCheckResult;
}
}
return hasRole;
} | [
"public",
"static",
"boolean",
"hasAllRoles",
"(",
"RoleHolder",
"roleHolder",
",",
"String",
"[",
"]",
"roleNames",
")",
"{",
"boolean",
"hasRole",
"=",
"false",
";",
"if",
"(",
"roleHolder",
"!=",
"null",
")",
"{",
"List",
"<",
"?",
"extends",
"Role",
... | Checks if the current user has all of the specified roles.
@param roleHolder the object requiring authorisation
@param roleNames the role names
@return true iff the current user has all of the specified roles | [
"Checks",
"if",
"the",
"current",
"user",
"has",
"all",
"of",
"the",
"specified",
"roles",
"."
] | 8a3a3f6b51e224eda39b3f7f8d5ce5869995e966 | https://github.com/schaloner/deadbolt/blob/8a3a3f6b51e224eda39b3f7f8d5ce5869995e966/app/controllers/deadbolt/Deadbolt.java#L379-L419 | train |
schaloner/deadbolt | app/controllers/deadbolt/Deadbolt.java | Deadbolt.hasRoles | public static boolean hasRoles(List<String> roleNames) throws Throwable
{
DEADBOLT_HANDLER.beforeRoleCheck();
RoleHolder roleHolder = getRoleHolder();
return roleHolder != null &&
roleHolder.getRoles() != null &&
hasAllRoles(roleHolder,
roleNames.toArray(new String[roleNames.size()]));
} | java | public static boolean hasRoles(List<String> roleNames) throws Throwable
{
DEADBOLT_HANDLER.beforeRoleCheck();
RoleHolder roleHolder = getRoleHolder();
return roleHolder != null &&
roleHolder.getRoles() != null &&
hasAllRoles(roleHolder,
roleNames.toArray(new String[roleNames.size()]));
} | [
"public",
"static",
"boolean",
"hasRoles",
"(",
"List",
"<",
"String",
">",
"roleNames",
")",
"throws",
"Throwable",
"{",
"DEADBOLT_HANDLER",
".",
"beforeRoleCheck",
"(",
")",
";",
"RoleHolder",
"roleHolder",
"=",
"getRoleHolder",
"(",
")",
";",
"return",
"rol... | Checks if the current user has the specified role.
@param roleNames the names of the required roles
@return true iff the current user has the specified role | [
"Checks",
"if",
"the",
"current",
"user",
"has",
"the",
"specified",
"role",
"."
] | 8a3a3f6b51e224eda39b3f7f8d5ce5869995e966 | https://github.com/schaloner/deadbolt/blob/8a3a3f6b51e224eda39b3f7f8d5ce5869995e966/app/controllers/deadbolt/Deadbolt.java#L473-L483 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/result/CrosstabNavigator.java | CrosstabNavigator.put | public void put(E value, boolean createCategories) throws IllegalArgumentException, NullPointerException {
if (createCategories) {
for (int i = 0; i < categories.length; i++) {
String category = categories[i];
CrosstabDimension dimension = crosstab.getDimension(i);
dimension.addCategory(category);
}
}
crosstab.putValue(value, categories);
} | java | public void put(E value, boolean createCategories) throws IllegalArgumentException, NullPointerException {
if (createCategories) {
for (int i = 0; i < categories.length; i++) {
String category = categories[i];
CrosstabDimension dimension = crosstab.getDimension(i);
dimension.addCategory(category);
}
}
crosstab.putValue(value, categories);
} | [
"public",
"void",
"put",
"(",
"E",
"value",
",",
"boolean",
"createCategories",
")",
"throws",
"IllegalArgumentException",
",",
"NullPointerException",
"{",
"if",
"(",
"createCategories",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"categories... | Puts the given value to the navigated position in the crosstab.
@param value
the value to put.
@param createCategories
if true, the chosen categories will automatically be created
if they do not already exists in the dimensions of the
crosstab.
@throws IllegalArgumentException
if the position or value is invalid, typically because one or
more dimensions lacks a specified category or the value type
is not acceptable (typically because of class casting issues)
@throws NullPointerException
if some of the specified categories are null | [
"Puts",
"the",
"given",
"value",
"to",
"the",
"navigated",
"position",
"in",
"the",
"crosstab",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/result/CrosstabNavigator.java#L64-L73 | train |
datacleaner/AnalyzerBeans | components/html-rendering/src/main/java/org/eobjects/analyzer/result/renderer/TableBodyElement.java | TableBodyElement.getHeaderValue | protected String getHeaderValue(HtmlRenderingContext context, int col, String columnName) {
return context.escapeHtml(columnName);
} | java | protected String getHeaderValue(HtmlRenderingContext context, int col, String columnName) {
return context.escapeHtml(columnName);
} | [
"protected",
"String",
"getHeaderValue",
"(",
"HtmlRenderingContext",
"context",
",",
"int",
"col",
",",
"String",
"columnName",
")",
"{",
"return",
"context",
".",
"escapeHtml",
"(",
"columnName",
")",
";",
"}"
] | Overrideable method for defining the literal HTML table header of a
particular column.
@param context
@param col
@param columnName
@return | [
"Overrideable",
"method",
"for",
"defining",
"the",
"literal",
"HTML",
"table",
"header",
"of",
"a",
"particular",
"column",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/components/html-rendering/src/main/java/org/eobjects/analyzer/result/renderer/TableBodyElement.java#L122-L124 | train |
fuinorg/event-store-commons | jpa/src/main/java/org/fuin/esc/jpa/NativeSqlCondition.java | NativeSqlCondition.asWhereConditionWithParam | public final String asWhereConditionWithParam() {
if (table == null) {
return column + operator + ":" + column;
}
return table + "." + column + operator + ":" + column;
} | java | public final String asWhereConditionWithParam() {
if (table == null) {
return column + operator + ":" + column;
}
return table + "." + column + operator + ":" + column;
} | [
"public",
"final",
"String",
"asWhereConditionWithParam",
"(",
")",
"{",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"return",
"column",
"+",
"operator",
"+",
"\":\"",
"+",
"column",
";",
"}",
"return",
"table",
"+",
"\".\"",
"+",
"column",
"+",
"operato... | Returns the 'where' condition with a parameter.
@return Native SQL 'where' with column name as parameter. | [
"Returns",
"the",
"where",
"condition",
"with",
"a",
"parameter",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/jpa/src/main/java/org/fuin/esc/jpa/NativeSqlCondition.java#L113-L118 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/job/runner/RowProcessingPublisher.java | RowProcessingPublisher.sortConsumers | public static List<RowProcessingConsumer> sortConsumers(List<RowProcessingConsumer> consumers) {
final RowProcessingConsumerSorter sorter = new RowProcessingConsumerSorter(consumers);
final List<RowProcessingConsumer> sortedConsumers = sorter.createProcessOrderedConsumerList();
if (logger.isDebugEnabled()) {
logger.debug("Row processing order ({} consumers):", sortedConsumers.size());
int i = 1;
for (RowProcessingConsumer rowProcessingConsumer : sortedConsumers) {
logger.debug(" {}) {}", i, rowProcessingConsumer);
i++;
}
}
return sortedConsumers;
} | java | public static List<RowProcessingConsumer> sortConsumers(List<RowProcessingConsumer> consumers) {
final RowProcessingConsumerSorter sorter = new RowProcessingConsumerSorter(consumers);
final List<RowProcessingConsumer> sortedConsumers = sorter.createProcessOrderedConsumerList();
if (logger.isDebugEnabled()) {
logger.debug("Row processing order ({} consumers):", sortedConsumers.size());
int i = 1;
for (RowProcessingConsumer rowProcessingConsumer : sortedConsumers) {
logger.debug(" {}) {}", i, rowProcessingConsumer);
i++;
}
}
return sortedConsumers;
} | [
"public",
"static",
"List",
"<",
"RowProcessingConsumer",
">",
"sortConsumers",
"(",
"List",
"<",
"RowProcessingConsumer",
">",
"consumers",
")",
"{",
"final",
"RowProcessingConsumerSorter",
"sorter",
"=",
"new",
"RowProcessingConsumerSorter",
"(",
"consumers",
")",
"... | Sorts a list of consumers into their execution order
@param consumers
@return | [
"Sorts",
"a",
"list",
"of",
"consumers",
"into",
"their",
"execution",
"order"
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/job/runner/RowProcessingPublisher.java#L200-L212 | train |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/job/runner/RowProcessingPublisher.java | RowProcessingPublisher.processRows | public void processRows(RowProcessingMetrics rowProcessingMetrics) {
final RowProcessingQueryOptimizer queryOptimizer = getQueryOptimizer();
final Query finalQuery = queryOptimizer.getOptimizedQuery();
final RowIdGenerator idGenerator;
if (finalQuery.getFirstRow() == null) {
idGenerator = new SimpleRowIdGenerator();
} else {
idGenerator = new SimpleRowIdGenerator(finalQuery.getFirstRow());
}
final AnalysisJob analysisJob = _publishers.getAnalysisJob();
final AnalysisListener analysisListener = _publishers.getAnalysisListener();
final TaskRunner taskRunner = _publishers.getTaskRunner();
for (RowProcessingConsumer rowProcessingConsumer : _consumers) {
if (rowProcessingConsumer instanceof AnalyzerConsumer) {
final AnalyzerConsumer analyzerConsumer = (AnalyzerConsumer) rowProcessingConsumer;
final AnalyzerJob analyzerJob = analyzerConsumer.getComponentJob();
final AnalyzerMetrics metrics = rowProcessingMetrics.getAnalysisJobMetrics().getAnalyzerMetrics(
analyzerJob);
analysisListener.analyzerBegin(analysisJob, analyzerJob, metrics);
}
if (rowProcessingConsumer instanceof TransformerConsumer) {
((TransformerConsumer) rowProcessingConsumer).setRowIdGenerator(idGenerator);
}
}
final List<RowProcessingConsumer> consumers = queryOptimizer.getOptimizedConsumers();
final Collection<? extends FilterOutcome> availableOutcomes = queryOptimizer.getOptimizedAvailableOutcomes();
analysisListener.rowProcessingBegin(analysisJob, rowProcessingMetrics);
final RowConsumerTaskListener taskListener = new RowConsumerTaskListener(analysisJob, analysisListener,
taskRunner);
final Datastore datastore = _publishers.getDatastore();
try (final DatastoreConnection con = datastore.openConnection()) {
final DataContext dataContext = con.getDataContext();
if (logger.isDebugEnabled()) {
final String queryString;
if (dataContext instanceof JdbcDataContext) {
final JdbcDataContext jdbcDataContext = (JdbcDataContext) dataContext;
queryString = jdbcDataContext.getQueryRewriter().rewriteQuery(finalQuery);
} else {
queryString = finalQuery.toSql();
}
logger.debug("Final query: {}", queryString);
logger.debug("Final query firstRow={}, maxRows={}", finalQuery.getFirstRow(), finalQuery.getMaxRows());
}
// represents the distinct count of rows as well as the number of
// tasks to execute
int numTasks = 0;
try (final DataSet dataSet = dataContext.executeQuery(finalQuery)) {
final ConsumeRowHandler consumeRowHandler = new ConsumeRowHandler(consumers, availableOutcomes);
while (dataSet.next()) {
if (taskListener.isErrornous()) {
break;
}
numTasks++;
final Row metaModelRow = dataSet.getRow();
final int rowId = idGenerator.nextPhysicalRowId();
final MetaModelInputRow inputRow = new MetaModelInputRow(rowId, metaModelRow);
final ConsumeRowTask task = new ConsumeRowTask(consumeRowHandler, rowProcessingMetrics, inputRow,
analysisListener, numTasks);
taskRunner.run(task, taskListener);
}
}
taskListener.awaitTasks(numTasks);
}
if (taskListener.isErrornous()) {
_successful.set(false);
return;
}
analysisListener.rowProcessingSuccess(analysisJob, rowProcessingMetrics);
} | java | public void processRows(RowProcessingMetrics rowProcessingMetrics) {
final RowProcessingQueryOptimizer queryOptimizer = getQueryOptimizer();
final Query finalQuery = queryOptimizer.getOptimizedQuery();
final RowIdGenerator idGenerator;
if (finalQuery.getFirstRow() == null) {
idGenerator = new SimpleRowIdGenerator();
} else {
idGenerator = new SimpleRowIdGenerator(finalQuery.getFirstRow());
}
final AnalysisJob analysisJob = _publishers.getAnalysisJob();
final AnalysisListener analysisListener = _publishers.getAnalysisListener();
final TaskRunner taskRunner = _publishers.getTaskRunner();
for (RowProcessingConsumer rowProcessingConsumer : _consumers) {
if (rowProcessingConsumer instanceof AnalyzerConsumer) {
final AnalyzerConsumer analyzerConsumer = (AnalyzerConsumer) rowProcessingConsumer;
final AnalyzerJob analyzerJob = analyzerConsumer.getComponentJob();
final AnalyzerMetrics metrics = rowProcessingMetrics.getAnalysisJobMetrics().getAnalyzerMetrics(
analyzerJob);
analysisListener.analyzerBegin(analysisJob, analyzerJob, metrics);
}
if (rowProcessingConsumer instanceof TransformerConsumer) {
((TransformerConsumer) rowProcessingConsumer).setRowIdGenerator(idGenerator);
}
}
final List<RowProcessingConsumer> consumers = queryOptimizer.getOptimizedConsumers();
final Collection<? extends FilterOutcome> availableOutcomes = queryOptimizer.getOptimizedAvailableOutcomes();
analysisListener.rowProcessingBegin(analysisJob, rowProcessingMetrics);
final RowConsumerTaskListener taskListener = new RowConsumerTaskListener(analysisJob, analysisListener,
taskRunner);
final Datastore datastore = _publishers.getDatastore();
try (final DatastoreConnection con = datastore.openConnection()) {
final DataContext dataContext = con.getDataContext();
if (logger.isDebugEnabled()) {
final String queryString;
if (dataContext instanceof JdbcDataContext) {
final JdbcDataContext jdbcDataContext = (JdbcDataContext) dataContext;
queryString = jdbcDataContext.getQueryRewriter().rewriteQuery(finalQuery);
} else {
queryString = finalQuery.toSql();
}
logger.debug("Final query: {}", queryString);
logger.debug("Final query firstRow={}, maxRows={}", finalQuery.getFirstRow(), finalQuery.getMaxRows());
}
// represents the distinct count of rows as well as the number of
// tasks to execute
int numTasks = 0;
try (final DataSet dataSet = dataContext.executeQuery(finalQuery)) {
final ConsumeRowHandler consumeRowHandler = new ConsumeRowHandler(consumers, availableOutcomes);
while (dataSet.next()) {
if (taskListener.isErrornous()) {
break;
}
numTasks++;
final Row metaModelRow = dataSet.getRow();
final int rowId = idGenerator.nextPhysicalRowId();
final MetaModelInputRow inputRow = new MetaModelInputRow(rowId, metaModelRow);
final ConsumeRowTask task = new ConsumeRowTask(consumeRowHandler, rowProcessingMetrics, inputRow,
analysisListener, numTasks);
taskRunner.run(task, taskListener);
}
}
taskListener.awaitTasks(numTasks);
}
if (taskListener.isErrornous()) {
_successful.set(false);
return;
}
analysisListener.rowProcessingSuccess(analysisJob, rowProcessingMetrics);
} | [
"public",
"void",
"processRows",
"(",
"RowProcessingMetrics",
"rowProcessingMetrics",
")",
"{",
"final",
"RowProcessingQueryOptimizer",
"queryOptimizer",
"=",
"getQueryOptimizer",
"(",
")",
";",
"final",
"Query",
"finalQuery",
"=",
"queryOptimizer",
".",
"getOptimizedQuer... | Fires the actual row processing. This method assumes that consumers have
been initialized and the publisher is ready to start processing.
@return true if no errors occurred during processing
@param rowProcessingMetrics
@see #runRowProcessing(Queue, TaskListener) | [
"Fires",
"the",
"actual",
"row",
"processing",
".",
"This",
"method",
"assumes",
"that",
"consumers",
"have",
"been",
"initialized",
"and",
"the",
"publisher",
"is",
"ready",
"to",
"start",
"processing",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/job/runner/RowProcessingPublisher.java#L255-L340 | train |
datacleaner/AnalyzerBeans | env/xml-config/src/main/java/org/eobjects/analyzer/configuration/JaxbPojoDatastoreAdaptor.java | JaxbPojoDatastoreAdaptor.createPojoDatastore | public AbstractDatastoreType createPojoDatastore(final Datastore datastore, final Set<Column> columns,
final int maxRowsToQuery) {
final PojoDatastoreType datastoreType = new PojoDatastoreType();
datastoreType.setName(datastore.getName());
datastoreType.setDescription(datastore.getDescription());
try (final DatastoreConnection con = datastore.openConnection()) {
final DataContext dataContext = con.getDataContext();
final Schema schema;
final Table[] tables;
if (columns == null || columns.isEmpty()) {
schema = dataContext.getDefaultSchema();
tables = schema.getTables();
} else {
tables = MetaModelHelper.getTables(columns);
// TODO: There's a possibility that tables span multiple
// schemas, but we cannot currently support that in a
// PojoDatastore, so we just pick the first and cross our
// fingers.
schema = tables[0].getSchema();
}
datastoreType.setSchemaName(schema.getName());
for (final Table table : tables) {
final Column[] usedColumns;
if (columns == null || columns.isEmpty()) {
usedColumns = table.getColumns();
} else {
usedColumns = MetaModelHelper.getTableColumns(table, columns);
}
final PojoTableType tableType = createPojoTable(dataContext, table, usedColumns, maxRowsToQuery);
datastoreType.getTable().add(tableType);
}
}
return datastoreType;
} | java | public AbstractDatastoreType createPojoDatastore(final Datastore datastore, final Set<Column> columns,
final int maxRowsToQuery) {
final PojoDatastoreType datastoreType = new PojoDatastoreType();
datastoreType.setName(datastore.getName());
datastoreType.setDescription(datastore.getDescription());
try (final DatastoreConnection con = datastore.openConnection()) {
final DataContext dataContext = con.getDataContext();
final Schema schema;
final Table[] tables;
if (columns == null || columns.isEmpty()) {
schema = dataContext.getDefaultSchema();
tables = schema.getTables();
} else {
tables = MetaModelHelper.getTables(columns);
// TODO: There's a possibility that tables span multiple
// schemas, but we cannot currently support that in a
// PojoDatastore, so we just pick the first and cross our
// fingers.
schema = tables[0].getSchema();
}
datastoreType.setSchemaName(schema.getName());
for (final Table table : tables) {
final Column[] usedColumns;
if (columns == null || columns.isEmpty()) {
usedColumns = table.getColumns();
} else {
usedColumns = MetaModelHelper.getTableColumns(table, columns);
}
final PojoTableType tableType = createPojoTable(dataContext, table, usedColumns, maxRowsToQuery);
datastoreType.getTable().add(tableType);
}
}
return datastoreType;
} | [
"public",
"AbstractDatastoreType",
"createPojoDatastore",
"(",
"final",
"Datastore",
"datastore",
",",
"final",
"Set",
"<",
"Column",
">",
"columns",
",",
"final",
"int",
"maxRowsToQuery",
")",
"{",
"final",
"PojoDatastoreType",
"datastoreType",
"=",
"new",
"PojoDat... | Creates a serialized POJO copy of a datastore.
@param datastore
the datastore to copy
@param columns
the columns to include, or null if all tables/columns should
be included.
@param maxRowsToQuery
the maximum number of records to query and include in the
datastore copy. Keep this number reasonably low, or else the
copy might cause out-of-memory issues (Both while reading and
writing).
@return | [
"Creates",
"a",
"serialized",
"POJO",
"copy",
"of",
"a",
"datastore",
"."
] | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/xml-config/src/main/java/org/eobjects/analyzer/configuration/JaxbPojoDatastoreAdaptor.java#L463-L502 | train |
fuinorg/event-store-commons | spi/src/main/java/org/fuin/esc/spi/Data.java | Data.valueOf | public static Data valueOf(final String type, final Object obj) {
return new Data(type, mimeType(obj), content(obj));
} | java | public static Data valueOf(final String type, final Object obj) {
return new Data(type, mimeType(obj), content(obj));
} | [
"public",
"static",
"Data",
"valueOf",
"(",
"final",
"String",
"type",
",",
"final",
"Object",
"obj",
")",
"{",
"return",
"new",
"Data",
"(",
"type",
",",
"mimeType",
"(",
"obj",
")",
",",
"content",
"(",
"obj",
")",
")",
";",
"}"
] | Creates a new instance from a given object.
@param type
Name of the type.
@param obj
Object to convert.
@return Either JSON or XML UTF-8 encoded content without a version. | [
"Creates",
"a",
"new",
"instance",
"from",
"a",
"given",
"object",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/Data.java#L223-L225 | train |
datacleaner/AnalyzerBeans | components/pattern-finder/src/main/java/org/eobjects/analyzer/beans/stringpattern/PatternFinder.java | PatternFinder.run | public void run(R row, String value, int distinctCount) {
final List<Token> tokens;
boolean match = false;
try {
tokens = _tokenizer.tokenize(value);
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while tokenizing value: " + value, e);
}
final String patternCode = getPatternCode(tokens);
Set<TokenPattern> patterns;
synchronized (this) {
patterns = _patterns.get(patternCode);
if (patterns == null) {
patterns = new HashSet<TokenPattern>();
_patterns.put(patternCode, patterns);
}
for (TokenPattern pattern : patterns) {
if (pattern.match(tokens)) {
storeMatch(pattern, row, value, distinctCount);
match = true;
}
}
if (!match) {
final TokenPattern pattern;
try {
pattern = new TokenPatternImpl(value, tokens, _configuration);
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e);
}
storeNewPattern(pattern, row, value, distinctCount);
patterns.add(pattern);
}
}
} | java | public void run(R row, String value, int distinctCount) {
final List<Token> tokens;
boolean match = false;
try {
tokens = _tokenizer.tokenize(value);
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while tokenizing value: " + value, e);
}
final String patternCode = getPatternCode(tokens);
Set<TokenPattern> patterns;
synchronized (this) {
patterns = _patterns.get(patternCode);
if (patterns == null) {
patterns = new HashSet<TokenPattern>();
_patterns.put(patternCode, patterns);
}
for (TokenPattern pattern : patterns) {
if (pattern.match(tokens)) {
storeMatch(pattern, row, value, distinctCount);
match = true;
}
}
if (!match) {
final TokenPattern pattern;
try {
pattern = new TokenPatternImpl(value, tokens, _configuration);
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e);
}
storeNewPattern(pattern, row, value, distinctCount);
patterns.add(pattern);
}
}
} | [
"public",
"void",
"run",
"(",
"R",
"row",
",",
"String",
"value",
",",
"int",
"distinctCount",
")",
"{",
"final",
"List",
"<",
"Token",
">",
"tokens",
";",
"boolean",
"match",
"=",
"false",
";",
"try",
"{",
"tokens",
"=",
"_tokenizer",
".",
"tokenize",... | This method should be invoked by the user of the PatternFinder. Invoke it
for each value in your dataset. Repeated values are handled correctly but
if available it is more effecient to handle only the distinct values and
their corresponding distinct counts.
@param row
the row containing the value
@param value
the string value to be tokenized and matched against other
patterns
@param distinctCount
the count of the value | [
"This",
"method",
"should",
"be",
"invoked",
"by",
"the",
"user",
"of",
"the",
"PatternFinder",
".",
"Invoke",
"it",
"for",
"each",
"value",
"in",
"your",
"dataset",
".",
"Repeated",
"values",
"are",
"handled",
"correctly",
"but",
"if",
"available",
"it",
... | f82dae080d80d2a647b706a5fb22b3ea250613b3 | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/components/pattern-finder/src/main/java/org/eobjects/analyzer/beans/stringpattern/PatternFinder.java#L71-L109 | train |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/java/NameMap.java | NameMap.map | public String map(String name) {
String mapped = super.get(name);
if (mapped == null) {
mapped = String.format("%s%03d", BASENAME, count.incrementAndGet());
super.put(name, mapped);
}
return mapped;
} | java | public String map(String name) {
String mapped = super.get(name);
if (mapped == null) {
mapped = String.format("%s%03d", BASENAME, count.incrementAndGet());
super.put(name, mapped);
}
return mapped;
} | [
"public",
"String",
"map",
"(",
"String",
"name",
")",
"{",
"String",
"mapped",
"=",
"super",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"mapped",
"==",
"null",
")",
"{",
"mapped",
"=",
"String",
".",
"format",
"(",
"\"%s%03d\"",
",",
"BASENAME",
... | Map a variable name
@param name is the full name
@return the mapped name | [
"Map",
"a",
"variable",
"name"
] | e8aa46313bb1d1328865f26f99455124aede828c | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/java/NameMap.java#L29-L36 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.createFromFile | public static KAFDocument createFromFile(File file) throws IOException {
KAFDocument kaf = null;
try {
kaf = ReadWriteManager.load(file);
} catch(JDOMException e) {
e.printStackTrace();
}
return kaf;
} | java | public static KAFDocument createFromFile(File file) throws IOException {
KAFDocument kaf = null;
try {
kaf = ReadWriteManager.load(file);
} catch(JDOMException e) {
e.printStackTrace();
}
return kaf;
} | [
"public",
"static",
"KAFDocument",
"createFromFile",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"KAFDocument",
"kaf",
"=",
"null",
";",
"try",
"{",
"kaf",
"=",
"ReadWriteManager",
".",
"load",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"JDOMExc... | Creates a new KAFDocument and loads the contents of the file passed as argument
@param file an existing KAF file to be loaded into the library. | [
"Creates",
"a",
"new",
"KAFDocument",
"and",
"loads",
"the",
"contents",
"of",
"the",
"file",
"passed",
"as",
"argument"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L396-L404 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.createFromStream | public static KAFDocument createFromStream(Reader stream) throws IOException, JDOMException {
KAFDocument kaf = null;
kaf = ReadWriteManager.load(stream);
return kaf;
} | java | public static KAFDocument createFromStream(Reader stream) throws IOException, JDOMException {
KAFDocument kaf = null;
kaf = ReadWriteManager.load(stream);
return kaf;
} | [
"public",
"static",
"KAFDocument",
"createFromStream",
"(",
"Reader",
"stream",
")",
"throws",
"IOException",
",",
"JDOMException",
"{",
"KAFDocument",
"kaf",
"=",
"null",
";",
"kaf",
"=",
"ReadWriteManager",
".",
"load",
"(",
"stream",
")",
";",
"return",
"ka... | Creates a new KAFDocument loading the content read from the reader given on argument.
@param stream Reader to read KAF content. | [
"Creates",
"a",
"new",
"KAFDocument",
"loading",
"the",
"content",
"read",
"from",
"the",
"reader",
"given",
"on",
"argument",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L409-L413 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.addLinguisticProcessor | public LinguisticProcessor addLinguisticProcessor(String layer, String name) {
LinguisticProcessor lp = new LinguisticProcessor(name, layer);
//lp.setBeginTimestamp(timestamp); // no default timestamp
List<LinguisticProcessor> layerLps = lps.get(layer);
if (layerLps == null) {
layerLps = new ArrayList<LinguisticProcessor>();
lps.put(layer, layerLps);
}
layerLps.add(lp);
return lp;
} | java | public LinguisticProcessor addLinguisticProcessor(String layer, String name) {
LinguisticProcessor lp = new LinguisticProcessor(name, layer);
//lp.setBeginTimestamp(timestamp); // no default timestamp
List<LinguisticProcessor> layerLps = lps.get(layer);
if (layerLps == null) {
layerLps = new ArrayList<LinguisticProcessor>();
lps.put(layer, layerLps);
}
layerLps.add(lp);
return lp;
} | [
"public",
"LinguisticProcessor",
"addLinguisticProcessor",
"(",
"String",
"layer",
",",
"String",
"name",
")",
"{",
"LinguisticProcessor",
"lp",
"=",
"new",
"LinguisticProcessor",
"(",
"name",
",",
"layer",
")",
";",
"//lp.setBeginTimestamp(timestamp); // no default times... | Adds a linguistic processor to the document header. The timestamp is added implicitly. | [
"Adds",
"a",
"linguistic",
"processor",
"to",
"the",
"document",
"header",
".",
"The",
"timestamp",
"is",
"added",
"implicitly",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L436-L446 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.linguisticProcessorExists | public boolean linguisticProcessorExists(String layer, String name, String version) {
List<LinguisticProcessor> layerLPs = lps.get(layer);
if (layerLPs == null) {
return false;
}
for (LinguisticProcessor lp : layerLPs) {
if (lp.version == null) {
return false;
}
else if (lp.name.equals(name) && lp.version.equals(version)) {
return true;
}
}
return false;
} | java | public boolean linguisticProcessorExists(String layer, String name, String version) {
List<LinguisticProcessor> layerLPs = lps.get(layer);
if (layerLPs == null) {
return false;
}
for (LinguisticProcessor lp : layerLPs) {
if (lp.version == null) {
return false;
}
else if (lp.name.equals(name) && lp.version.equals(version)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"linguisticProcessorExists",
"(",
"String",
"layer",
",",
"String",
"name",
",",
"String",
"version",
")",
"{",
"List",
"<",
"LinguisticProcessor",
">",
"layerLPs",
"=",
"lps",
".",
"get",
"(",
"layer",
")",
";",
"if",
"(",
"layerLPs",
... | Returns wether the given linguistic processor is already defined or not. Both name and version must be exactly the same. | [
"Returns",
"wether",
"the",
"given",
"linguistic",
"processor",
"is",
"already",
"defined",
"or",
"not",
".",
"Both",
"name",
"and",
"version",
"must",
"be",
"exactly",
"the",
"same",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L479-L493 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newTerm | public Term newTerm(String id, Span<WF> span) {
idManager.updateCounter(AnnotationType.TERM, id);
Term newTerm = new Term(id, span, false);
annotationContainer.add(newTerm, Layer.TERMS, AnnotationType.TERM);
addToWfTermIndex(newTerm.getSpan().getTargets(), newTerm); // Rodrirekin hitz egin hau kentzeko
return newTerm;
} | java | public Term newTerm(String id, Span<WF> span) {
idManager.updateCounter(AnnotationType.TERM, id);
Term newTerm = new Term(id, span, false);
annotationContainer.add(newTerm, Layer.TERMS, AnnotationType.TERM);
addToWfTermIndex(newTerm.getSpan().getTargets(), newTerm); // Rodrirekin hitz egin hau kentzeko
return newTerm;
} | [
"public",
"Term",
"newTerm",
"(",
"String",
"id",
",",
"Span",
"<",
"WF",
">",
"span",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"TERM",
",",
"id",
")",
";",
"Term",
"newTerm",
"=",
"new",
"Term",
"(",
"id",
",",
"span"... | Creates a Term object to load an existing term. It receives the ID as an argument. The Term is added to the document object.
@param id term's ID.
@param type type of term. There are two types of term: open and close.
@param lemma the lemma of the term.
@param pos part of speech of the term.
@param wfs the list of word forms this term is formed by.
@return a new term. | [
"Creates",
"a",
"Term",
"object",
"to",
"load",
"an",
"existing",
"term",
".",
"It",
"receives",
"the",
"ID",
"as",
"an",
"argument",
".",
"The",
"Term",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L582-L588 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newDep | public Dep newDep(Term from, Term to, String rfunc) {
Dep newDep = new Dep(from, to, rfunc);
annotationContainer.add(newDep, Layer.DEPS, AnnotationType.DEP);
return newDep;
} | java | public Dep newDep(Term from, Term to, String rfunc) {
Dep newDep = new Dep(from, to, rfunc);
annotationContainer.add(newDep, Layer.DEPS, AnnotationType.DEP);
return newDep;
} | [
"public",
"Dep",
"newDep",
"(",
"Term",
"from",
",",
"Term",
"to",
",",
"String",
"rfunc",
")",
"{",
"Dep",
"newDep",
"=",
"new",
"Dep",
"(",
"from",
",",
"to",
",",
"rfunc",
")",
";",
"annotationContainer",
".",
"add",
"(",
"newDep",
",",
"Layer",
... | Creates a new dependency. The Dep is added to the document object.
@param from the origin term of the dependency.
@param to the target term of the dependency.
@param rfunc relational function of the dependency.
@return a new dependency. | [
"Creates",
"a",
"new",
"dependency",
".",
"The",
"Dep",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L691-L695 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newChunk | public Chunk newChunk(String id, String phrase, Span<Term> span) {
idManager.updateCounter(AnnotationType.CHUNK, id);
Chunk newChunk = new Chunk(id, span);
newChunk.setPhrase(phrase);
annotationContainer.add(newChunk, Layer.CHUNKS, AnnotationType.CHUNK);
return newChunk;
} | java | public Chunk newChunk(String id, String phrase, Span<Term> span) {
idManager.updateCounter(AnnotationType.CHUNK, id);
Chunk newChunk = new Chunk(id, span);
newChunk.setPhrase(phrase);
annotationContainer.add(newChunk, Layer.CHUNKS, AnnotationType.CHUNK);
return newChunk;
} | [
"public",
"Chunk",
"newChunk",
"(",
"String",
"id",
",",
"String",
"phrase",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"CHUNK",
",",
"id",
")",
";",
"Chunk",
"newChunk",
"=",
"new",
... | Creates a chunk object to load an existing chunk. It receives it's ID as an argument. The Chunk is added to the document object.
@param id chunk's ID.
@param head the chunk head.
@param phrase type of the phrase.
@param terms the list of the terms in the chunk.
@return a new chunk. | [
"Creates",
"a",
"chunk",
"object",
"to",
"load",
"an",
"existing",
"chunk",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"Chunk",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L704-L710 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newChunk | public Chunk newChunk(String phrase, Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.CHUNK);
Chunk newChunk = new Chunk(newId, span);
newChunk.setPhrase(phrase);
annotationContainer.add(newChunk, Layer.CHUNKS, AnnotationType.CHUNK);
return newChunk;
} | java | public Chunk newChunk(String phrase, Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.CHUNK);
Chunk newChunk = new Chunk(newId, span);
newChunk.setPhrase(phrase);
annotationContainer.add(newChunk, Layer.CHUNKS, AnnotationType.CHUNK);
return newChunk;
} | [
"public",
"Chunk",
"newChunk",
"(",
"String",
"phrase",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"CHUNK",
")",
";",
"Chunk",
"newChunk",
"=",
"new",
"Chunk",
"(",
... | Creates a new chunk. It assigns an appropriate ID to it. The Chunk is added to the document object.
@param head the chunk head.
@param phrase type of the phrase.
@param terms the list of the terms in the chunk.
@return a new chunk. | [
"Creates",
"a",
"new",
"chunk",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"Chunk",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L718-L724 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newEntity | public Entity newEntity(String id, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.ENTITY, id);
Entity newEntity = new Entity(id, references);
annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY);
return newEntity;
} | java | public Entity newEntity(String id, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.ENTITY, id);
Entity newEntity = new Entity(id, references);
annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY);
return newEntity;
} | [
"public",
"Entity",
"newEntity",
"(",
"String",
"id",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"ENTITY",
",",
"id",
")",
";",
"Entity",
"newEntity",
"=",
"new"... | Creates an Entity object to load an existing entity. It receives the ID as an argument. The entity is added to the document object.
@param id the ID of the named entity.
@param type entity type. 8 values are posible: Person, Organization, Location, Date, Time, Money, Percent, Misc.
@param references it contains one or more span elements. A span can be used to reference the different occurrences of the same named entity in the document. If the entity is composed by multiple words, multiple target elements are used.
@return a new named entity. | [
"Creates",
"an",
"Entity",
"object",
"to",
"load",
"an",
"existing",
"entity",
".",
"It",
"receives",
"the",
"ID",
"as",
"an",
"argument",
".",
"The",
"entity",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L732-L737 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newEntity | public Entity newEntity(List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.ENTITY);
Entity newEntity = new Entity(newId, references);
annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY);
return newEntity;
} | java | public Entity newEntity(List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.ENTITY);
Entity newEntity = new Entity(newId, references);
annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY);
return newEntity;
} | [
"public",
"Entity",
"newEntity",
"(",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"ENTITY",
")",
";",
"Entity",
"newEntity",
"=",
"new",
"Entity",
... | Creates a new Entity. It assigns an appropriate ID to it. The entity is added to the document object.
@param type entity type. 8 values are posible: Person, Organization, Location, Date, Time, Money, Percent, Misc.
@param references it contains one or more span elements. A span can be used to reference the different occurrences of the same named entity in the document. If the entity is composed by multiple words, multiple target elements are used.
@return a new named entity. | [
"Creates",
"a",
"new",
"Entity",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"entity",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L744-L749 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newCoref | public Coref newCoref(String id, List<Span<Term>> mentions) {
idManager.updateCounter(AnnotationType.COREF, id);
Coref newCoref = new Coref(id, mentions);
annotationContainer.add(newCoref, Layer.COREFERENCES, AnnotationType.COREF);
return newCoref;
} | java | public Coref newCoref(String id, List<Span<Term>> mentions) {
idManager.updateCounter(AnnotationType.COREF, id);
Coref newCoref = new Coref(id, mentions);
annotationContainer.add(newCoref, Layer.COREFERENCES, AnnotationType.COREF);
return newCoref;
} | [
"public",
"Coref",
"newCoref",
"(",
"String",
"id",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"mentions",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"COREF",
",",
"id",
")",
";",
"Coref",
"newCoref",
"=",
"new",
"Co... | Creates a coreference object to load an existing Coref. It receives it's ID as an argument. The Coref is added to the document.
@param id the ID of the coreference.
@param references different mentions (list of targets) to the same entity.
@return a new coreference. | [
"Creates",
"a",
"coreference",
"object",
"to",
"load",
"an",
"existing",
"Coref",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"Coref",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L756-L761 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newCoref | public Coref newCoref(List<Span<Term>> mentions) {
String newId = idManager.getNextId(AnnotationType.COREF);
Coref newCoref = new Coref(newId, mentions);
annotationContainer.add(newCoref, Layer.COREFERENCES, AnnotationType.COREF);
return newCoref;
} | java | public Coref newCoref(List<Span<Term>> mentions) {
String newId = idManager.getNextId(AnnotationType.COREF);
Coref newCoref = new Coref(newId, mentions);
annotationContainer.add(newCoref, Layer.COREFERENCES, AnnotationType.COREF);
return newCoref;
} | [
"public",
"Coref",
"newCoref",
"(",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"mentions",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"COREF",
")",
";",
"Coref",
"newCoref",
"=",
"new",
"Coref",
"(",
"... | Creates a new coreference. It assigns an appropriate ID to it. The Coref is added to the document.
@param references different mentions (list of targets) to the same entity.
@return a new coreference. | [
"Creates",
"a",
"new",
"coreference",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"Coref",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L767-L772 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newTimex3 | public Timex3 newTimex3(String id, String type) {
idManager.updateCounter(AnnotationType.TIMEX3, id);
Timex3 newTimex3 = new Timex3(id, type);
annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3);
return newTimex3;
} | java | public Timex3 newTimex3(String id, String type) {
idManager.updateCounter(AnnotationType.TIMEX3, id);
Timex3 newTimex3 = new Timex3(id, type);
annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3);
return newTimex3;
} | [
"public",
"Timex3",
"newTimex3",
"(",
"String",
"id",
",",
"String",
"type",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"TIMEX3",
",",
"id",
")",
";",
"Timex3",
"newTimex3",
"=",
"new",
"Timex3",
"(",
"id",
",",
"type",
")",... | Creates a timeExpressions object to load an existing Timex3. It receives it's ID as an argument. The Timex3 is added to the document.
@param id the ID of the coreference.
@param references different mentions (list of targets) to the same entity.
@return a new timex3. | [
"Creates",
"a",
"timeExpressions",
"object",
"to",
"load",
"an",
"existing",
"Timex3",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"Timex3",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L779-L784 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newTimex3 | public Timex3 newTimex3(String type) {
String newId = idManager.getNextId(AnnotationType.TIMEX3);
Timex3 newTimex3 = new Timex3(newId, type);
annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3);
return newTimex3;
} | java | public Timex3 newTimex3(String type) {
String newId = idManager.getNextId(AnnotationType.TIMEX3);
Timex3 newTimex3 = new Timex3(newId, type);
annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3);
return newTimex3;
} | [
"public",
"Timex3",
"newTimex3",
"(",
"String",
"type",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"TIMEX3",
")",
";",
"Timex3",
"newTimex3",
"=",
"new",
"Timex3",
"(",
"newId",
",",
"type",
")",
";",
"an... | Creates a new timeExpressions. It assigns an appropriate ID to it. The Coref is added to the document.
@param references different mentions (list of targets) to the same entity.
@return a new timex3. | [
"Creates",
"a",
"new",
"timeExpressions",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"Coref",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L790-L795 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newFactvalue | public Factvalue newFactvalue(WF wf, String prediction) {
Factvalue factuality = new Factvalue(wf, prediction);
annotationContainer.add(factuality, Layer.FACTUALITY_LAYER, AnnotationType.FACTVALUE);
return factuality;
} | java | public Factvalue newFactvalue(WF wf, String prediction) {
Factvalue factuality = new Factvalue(wf, prediction);
annotationContainer.add(factuality, Layer.FACTUALITY_LAYER, AnnotationType.FACTVALUE);
return factuality;
} | [
"public",
"Factvalue",
"newFactvalue",
"(",
"WF",
"wf",
",",
"String",
"prediction",
")",
"{",
"Factvalue",
"factuality",
"=",
"new",
"Factvalue",
"(",
"wf",
",",
"prediction",
")",
";",
"annotationContainer",
".",
"add",
"(",
"factuality",
",",
"Layer",
"."... | Creates a factualitylayer object and add it to the document
@param term the Term of the coreference.
@return a new factuality. | [
"Creates",
"a",
"factualitylayer",
"object",
"and",
"add",
"it",
"to",
"the",
"document"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L877-L881 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newProperty | public Feature newProperty(String id, String lemma, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.PROPERTY, id);
Feature newProperty = new Feature(id, lemma, references);
annotationContainer.add(newProperty, Layer.PROPERTIES, AnnotationType.PROPERTY);
return newProperty;
} | java | public Feature newProperty(String id, String lemma, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.PROPERTY, id);
Feature newProperty = new Feature(id, lemma, references);
annotationContainer.add(newProperty, Layer.PROPERTIES, AnnotationType.PROPERTY);
return newProperty;
} | [
"public",
"Feature",
"newProperty",
"(",
"String",
"id",
",",
"String",
"lemma",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"PROPERTY",
",",
"id",
")",
";",
"Fea... | Creates a new property. It receives it's ID as an argument. The property is added to the document.
@param id the ID of the property.
@param lemma the lemma of the property.
@param references different mentions (list of targets) to the same property.
@return a new coreference. | [
"Creates",
"a",
"new",
"property",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"property",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L902-L907 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newProperty | public Feature newProperty(String lemma, List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.PROPERTY);
Feature newProperty = new Feature(newId, lemma, references);
annotationContainer.add(newProperty, Layer.PROPERTIES, AnnotationType.PROPERTY);
return newProperty;
} | java | public Feature newProperty(String lemma, List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.PROPERTY);
Feature newProperty = new Feature(newId, lemma, references);
annotationContainer.add(newProperty, Layer.PROPERTIES, AnnotationType.PROPERTY);
return newProperty;
} | [
"public",
"Feature",
"newProperty",
"(",
"String",
"lemma",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"PROPERTY",
")",
";",
"Feature",
"newPro... | Creates a new property. It assigns an appropriate ID to it. The property is added to the document.
@param lemma the lemma of the property.
@param references different mentions (list of targets) to the same property.
@return a new coreference. | [
"Creates",
"a",
"new",
"property",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"property",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L914-L919 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newCategory | public Feature newCategory(String id, String lemma, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.CATEGORY, id);
Feature newCategory = new Feature(id, lemma, references);
annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY);
return newCategory;
} | java | public Feature newCategory(String id, String lemma, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.CATEGORY, id);
Feature newCategory = new Feature(id, lemma, references);
annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY);
return newCategory;
} | [
"public",
"Feature",
"newCategory",
"(",
"String",
"id",
",",
"String",
"lemma",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"CATEGORY",
",",
"id",
")",
";",
"Fea... | Creates a new category. It receives it's ID as an argument. The category is added to the document.
@param id the ID of the category.
@param lemma the lemma of the category.
@param references different mentions (list of targets) to the same category.
@return a new coreference. | [
"Creates",
"a",
"new",
"category",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"category",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L927-L932 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newCategory | public Feature newCategory(String lemma, List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.CATEGORY);
Feature newCategory = new Feature(newId, lemma, references);
annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY);
return newCategory;
} | java | public Feature newCategory(String lemma, List<Span<Term>> references) {
String newId = idManager.getNextId(AnnotationType.CATEGORY);
Feature newCategory = new Feature(newId, lemma, references);
annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY);
return newCategory;
} | [
"public",
"Feature",
"newCategory",
"(",
"String",
"lemma",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"CATEGORY",
")",
";",
"Feature",
"newCat... | Creates a new category. It assigns an appropriate ID to it. The category is added to the document.
@param lemma the lemma of the category.
@param references different mentions (list of targets) to the same category.
@return a new coreference. | [
"Creates",
"a",
"new",
"category",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"category",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L939-L944 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newOpinion | public Opinion newOpinion() {
String newId = idManager.getNextId(AnnotationType.OPINION);
Opinion newOpinion = new Opinion(newId);
annotationContainer.add(newOpinion, Layer.OPINIONS, AnnotationType.OPINION);
return newOpinion;
} | java | public Opinion newOpinion() {
String newId = idManager.getNextId(AnnotationType.OPINION);
Opinion newOpinion = new Opinion(newId);
annotationContainer.add(newOpinion, Layer.OPINIONS, AnnotationType.OPINION);
return newOpinion;
} | [
"public",
"Opinion",
"newOpinion",
"(",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"OPINION",
")",
";",
"Opinion",
"newOpinion",
"=",
"new",
"Opinion",
"(",
"newId",
")",
";",
"annotationContainer",
".",
"add... | Creates a new opinion object. It assigns an appropriate ID to it. The opinion is added to the document.
@return a new opinion. | [
"Creates",
"a",
"new",
"opinion",
"object",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"opinion",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L949-L954 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newOpinion | public Opinion newOpinion(String id) {
idManager.updateCounter(AnnotationType.OPINION, id);
Opinion newOpinion = new Opinion(id);
annotationContainer.add(newOpinion, Layer.OPINIONS, AnnotationType.OPINION);
return newOpinion;
} | java | public Opinion newOpinion(String id) {
idManager.updateCounter(AnnotationType.OPINION, id);
Opinion newOpinion = new Opinion(id);
annotationContainer.add(newOpinion, Layer.OPINIONS, AnnotationType.OPINION);
return newOpinion;
} | [
"public",
"Opinion",
"newOpinion",
"(",
"String",
"id",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"OPINION",
",",
"id",
")",
";",
"Opinion",
"newOpinion",
"=",
"new",
"Opinion",
"(",
"id",
")",
";",
"annotationContainer",
".",
... | Creates a new opinion object. It receives its ID as an argument. The opinion is added to the document.
@return a new opinion. | [
"Creates",
"a",
"new",
"opinion",
"object",
".",
"It",
"receives",
"its",
"ID",
"as",
"an",
"argument",
".",
"The",
"opinion",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L959-L964 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newPredicate | public Predicate newPredicate(String id, Span<Term> span) {
idManager.updateCounter(AnnotationType.PREDICATE, id);
Predicate newPredicate = new Predicate(id, span);
annotationContainer.add(newPredicate, Layer.SRL, AnnotationType.PREDICATE);
return newPredicate;
} | java | public Predicate newPredicate(String id, Span<Term> span) {
idManager.updateCounter(AnnotationType.PREDICATE, id);
Predicate newPredicate = new Predicate(id, span);
annotationContainer.add(newPredicate, Layer.SRL, AnnotationType.PREDICATE);
return newPredicate;
} | [
"public",
"Predicate",
"newPredicate",
"(",
"String",
"id",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"PREDICATE",
",",
"id",
")",
";",
"Predicate",
"newPredicate",
"=",
"new",
"Predicate"... | Creates a new srl predicate. It receives its ID as an argument. The predicate is added to the document.
@param id the ID of the predicate
@param span span containing the targets of the predicate
@return a new predicate | [
"Creates",
"a",
"new",
"srl",
"predicate",
".",
"It",
"receives",
"its",
"ID",
"as",
"an",
"argument",
".",
"The",
"predicate",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L996-L1001 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newPredicate | public Predicate newPredicate(Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.PREDICATE);
Predicate newPredicate = new Predicate(newId, span);
annotationContainer.add(newPredicate, Layer.SRL, AnnotationType.PREDICATE);
return newPredicate;
} | java | public Predicate newPredicate(Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.PREDICATE);
Predicate newPredicate = new Predicate(newId, span);
annotationContainer.add(newPredicate, Layer.SRL, AnnotationType.PREDICATE);
return newPredicate;
} | [
"public",
"Predicate",
"newPredicate",
"(",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"PREDICATE",
")",
";",
"Predicate",
"newPredicate",
"=",
"new",
"Predicate",
"(",
"newI... | Creates a new srl predicate. It assigns an appropriate ID to it. The predicate is added to the document.
@param span span containing all the targets of the predicate
@return a new predicate | [
"Creates",
"a",
"new",
"srl",
"predicate",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"The",
"predicate",
"is",
"added",
"to",
"the",
"document",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1007-L1012 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newRole | public Predicate.Role newRole(String id, Predicate predicate, String semRole, Span<Term> span) {
idManager.updateCounter(AnnotationType.ROLE, id);
Predicate.Role newRole = new Predicate.Role(id, semRole, span);
return newRole;
} | java | public Predicate.Role newRole(String id, Predicate predicate, String semRole, Span<Term> span) {
idManager.updateCounter(AnnotationType.ROLE, id);
Predicate.Role newRole = new Predicate.Role(id, semRole, span);
return newRole;
} | [
"public",
"Predicate",
".",
"Role",
"newRole",
"(",
"String",
"id",
",",
"Predicate",
"predicate",
",",
"String",
"semRole",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"ROLE",
",",
"id",
... | Creates a Role object to load an existing role. It receives the ID as an argument. It doesn't add the role to the predicate.
@param id role's ID.
@param predicate the predicate which this role is part of
@param semRole semantic role
@param span span containing all the targets of the role
@return a new role. | [
"Creates",
"a",
"Role",
"object",
"to",
"load",
"an",
"existing",
"role",
".",
"It",
"receives",
"the",
"ID",
"as",
"an",
"argument",
".",
"It",
"doesn",
"t",
"add",
"the",
"role",
"to",
"the",
"predicate",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1021-L1025 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newRole | public Predicate.Role newRole(Predicate predicate, String semRole, Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.ROLE);
Predicate.Role newRole = new Predicate.Role(newId, semRole, span);
return newRole;
} | java | public Predicate.Role newRole(Predicate predicate, String semRole, Span<Term> span) {
String newId = idManager.getNextId(AnnotationType.ROLE);
Predicate.Role newRole = new Predicate.Role(newId, semRole, span);
return newRole;
} | [
"public",
"Predicate",
".",
"Role",
"newRole",
"(",
"Predicate",
"predicate",
",",
"String",
"semRole",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"String",
"newId",
"=",
"idManager",
".",
"getNextId",
"(",
"AnnotationType",
".",
"ROLE",
")",
";",
... | Creates a new Role object. It assigns an appropriate ID to it. It uses the ID of the predicate to create a new ID for the role. It doesn't add the role to the predicate.
@param predicate the predicate which this role is part of
@param semRole semantic role
@param span span containing all the targets of the role
@return a new role. | [
"Creates",
"a",
"new",
"Role",
"object",
".",
"It",
"assigns",
"an",
"appropriate",
"ID",
"to",
"it",
".",
"It",
"uses",
"the",
"ID",
"of",
"the",
"predicate",
"to",
"create",
"a",
"new",
"ID",
"for",
"the",
"role",
".",
"It",
"doesn",
"t",
"add",
... | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1033-L1037 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.getSentences | public List<List<WF>> getSentences() {
return (List<List<WF>>)(List<?>) annotationContainer.getSentences(AnnotationType.WF);
} | java | public List<List<WF>> getSentences() {
return (List<List<WF>>)(List<?>) annotationContainer.getSentences(AnnotationType.WF);
} | [
"public",
"List",
"<",
"List",
"<",
"WF",
">",
">",
"getSentences",
"(",
")",
"{",
"return",
"(",
"List",
"<",
"List",
"<",
"WF",
">",
">",
")",
"(",
"List",
"<",
"?",
">",
")",
"annotationContainer",
".",
"getSentences",
"(",
"AnnotationType",
".",
... | Returns a list with all sentences. Each sentence is a list of WFs. | [
"Returns",
"a",
"list",
"with",
"all",
"sentences",
".",
"Each",
"sentence",
"is",
"a",
"list",
"of",
"WFs",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1270-L1272 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.getTermsFromWFs | public List<Term> getTermsFromWFs(List<String> wfIds) {
List<Term> terms = new ArrayList<Term>();
for (String wfId : wfIds) {
terms.addAll(this.wfId2Terms.get(wfId));
}
return terms;
} | java | public List<Term> getTermsFromWFs(List<String> wfIds) {
List<Term> terms = new ArrayList<Term>();
for (String wfId : wfIds) {
terms.addAll(this.wfId2Terms.get(wfId));
}
return terms;
} | [
"public",
"List",
"<",
"Term",
">",
"getTermsFromWFs",
"(",
"List",
"<",
"String",
">",
"wfIds",
")",
"{",
"List",
"<",
"Term",
">",
"terms",
"=",
"new",
"ArrayList",
"<",
"Term",
">",
"(",
")",
";",
"for",
"(",
"String",
"wfId",
":",
"wfIds",
")",... | Hau kendu behar da | [
"Hau",
"kendu",
"behar",
"da"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1505-L1511 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.createTimestamp | public String createTimestamp() {
Date date = new Date();
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd H:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String formattedDate = sdf.format(date);
return formattedDate;
} | java | public String createTimestamp() {
Date date = new Date();
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd H:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String formattedDate = sdf.format(date);
return formattedDate;
} | [
"public",
"String",
"createTimestamp",
"(",
")",
"{",
"Date",
"date",
"=",
"new",
"Date",
"(",
")",
";",
"//SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd H:mm:ss\");",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ssZ\"",
... | Returns current timestamp. | [
"Returns",
"current",
"timestamp",
"."
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1652-L1658 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.list2Span | static <T extends IdentifiableAnnotation> Span<T> list2Span(List<T> list) {
Span<T> span = new Span<T>();
for (T elem : list) {
span.addTarget(elem);
}
return span;
} | java | static <T extends IdentifiableAnnotation> Span<T> list2Span(List<T> list) {
Span<T> span = new Span<T>();
for (T elem : list) {
span.addTarget(elem);
}
return span;
} | [
"static",
"<",
"T",
"extends",
"IdentifiableAnnotation",
">",
"Span",
"<",
"T",
">",
"list2Span",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"Span",
"<",
"T",
">",
"span",
"=",
"new",
"Span",
"<",
"T",
">",
"(",
")",
";",
"for",
"(",
"T",
"e... | Converts a List into a Span | [
"Converts",
"a",
"List",
"into",
"a",
"Span"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1868-L1874 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.targetList2Span | static Span<Term> targetList2Span(List<Target> list) {
Span<Term> span = new Span<Term>();
for (Target target : list) {
if (target.isHead()) {
span.addTarget(target.getTerm(), true);
} else {
span.addTarget(target.getTerm());
}
}
return span;
} | java | static Span<Term> targetList2Span(List<Target> list) {
Span<Term> span = new Span<Term>();
for (Target target : list) {
if (target.isHead()) {
span.addTarget(target.getTerm(), true);
} else {
span.addTarget(target.getTerm());
}
}
return span;
} | [
"static",
"Span",
"<",
"Term",
">",
"targetList2Span",
"(",
"List",
"<",
"Target",
">",
"list",
")",
"{",
"Span",
"<",
"Term",
">",
"span",
"=",
"new",
"Span",
"<",
"Term",
">",
"(",
")",
";",
"for",
"(",
"Target",
"target",
":",
"list",
")",
"{"... | Converts a Target list into a Span of terms | [
"Converts",
"a",
"Target",
"list",
"into",
"a",
"Span",
"of",
"terms"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1890-L1900 | train |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.span2TargetList | static List<Target> span2TargetList(Span<Term> span) {
List<Target> list = new ArrayList<Target>();
for (Term t : span.getTargets()) {
list.add(KAFDocument.createTarget(t, (t==span.getHead())));
}
return list;
} | java | static List<Target> span2TargetList(Span<Term> span) {
List<Target> list = new ArrayList<Target>();
for (Term t : span.getTargets()) {
list.add(KAFDocument.createTarget(t, (t==span.getHead())));
}
return list;
} | [
"static",
"List",
"<",
"Target",
">",
"span2TargetList",
"(",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"List",
"<",
"Target",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Target",
">",
"(",
")",
";",
"for",
"(",
"Term",
"t",
":",
"span",
".",
"... | Converts a Span into a Target list | [
"Converts",
"a",
"Span",
"into",
"a",
"Target",
"list"
] | 3921f55d9ae4621736a329418f6334fb721834b8 | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L1903-L1909 | train |
fuinorg/event-store-commons | eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java | ESHttpUtils.findContentText | @Nullable
public static String findContentText(final Node rootNode, final XPath xPath, final String expression) {
final Node node = findNode(rootNode, xPath, expression);
if (node == null) {
return null;
}
return node.getTextContent();
} | java | @Nullable
public static String findContentText(final Node rootNode, final XPath xPath, final String expression) {
final Node node = findNode(rootNode, xPath, expression);
if (node == null) {
return null;
}
return node.getTextContent();
} | [
"@",
"Nullable",
"public",
"static",
"String",
"findContentText",
"(",
"final",
"Node",
"rootNode",
",",
"final",
"XPath",
"xPath",
",",
"final",
"String",
"expression",
")",
"{",
"final",
"Node",
"node",
"=",
"findNode",
"(",
"rootNode",
",",
"xPath",
",",
... | Returns an string from a node's content.
@param rootNode
Node to search.
@param xPath
XPath to use.
@param expression
XPath expression.
@return Node or <code>null</code> if no match was found. | [
"Returns",
"an",
"string",
"from",
"a",
"node",
"s",
"content",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java#L61-L68 | train |
fuinorg/event-store-commons | eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java | ESHttpUtils.findContentInteger | @Nullable
public static Integer findContentInteger(final Node rootNode, final XPath xPath,
final String expression) {
final Node node = findNode(rootNode, xPath, expression);
if (node == null) {
return null;
}
final String str = node.getTextContent();
return Integer.valueOf(str);
} | java | @Nullable
public static Integer findContentInteger(final Node rootNode, final XPath xPath,
final String expression) {
final Node node = findNode(rootNode, xPath, expression);
if (node == null) {
return null;
}
final String str = node.getTextContent();
return Integer.valueOf(str);
} | [
"@",
"Nullable",
"public",
"static",
"Integer",
"findContentInteger",
"(",
"final",
"Node",
"rootNode",
",",
"final",
"XPath",
"xPath",
",",
"final",
"String",
"expression",
")",
"{",
"final",
"Node",
"node",
"=",
"findNode",
"(",
"rootNode",
",",
"xPath",
"... | Returns an integer value from a node's content.
@param rootNode
Node to search.
@param xPath
XPath to use.
@param expression
XPath expression.
@return Node or <code>null</code> if no match was found. | [
"Returns",
"an",
"integer",
"value",
"from",
"a",
"node",
"s",
"content",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java#L82-L91 | train |
fuinorg/event-store-commons | eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java | ESHttpUtils.findNode | @Nullable
public static Node findNode(@NotNull final Node rootNode, @NotNull final XPath xPath,
@NotNull final String expression) {
Contract.requireArgNotNull("rootNode", rootNode);
Contract.requireArgNotNull("xPath", xPath);
Contract.requireArgNotNull("expression", expression);
try {
return (Node) xPath.compile(expression).evaluate(rootNode, XPathConstants.NODE);
} catch (final XPathExpressionException ex) {
throw new RuntimeException("Failed to read node: " + expression, ex);
}
} | java | @Nullable
public static Node findNode(@NotNull final Node rootNode, @NotNull final XPath xPath,
@NotNull final String expression) {
Contract.requireArgNotNull("rootNode", rootNode);
Contract.requireArgNotNull("xPath", xPath);
Contract.requireArgNotNull("expression", expression);
try {
return (Node) xPath.compile(expression).evaluate(rootNode, XPathConstants.NODE);
} catch (final XPathExpressionException ex) {
throw new RuntimeException("Failed to read node: " + expression, ex);
}
} | [
"@",
"Nullable",
"public",
"static",
"Node",
"findNode",
"(",
"@",
"NotNull",
"final",
"Node",
"rootNode",
",",
"@",
"NotNull",
"final",
"XPath",
"xPath",
",",
"@",
"NotNull",
"final",
"String",
"expression",
")",
"{",
"Contract",
".",
"requireArgNotNull",
"... | Returns a single node from a given document using xpath.
@param rootNode
Node to search.
@param xPath
XPath to use.
@param expression
XPath expression.
@return Node or <code>null</code> if no match was found. | [
"Returns",
"a",
"single",
"node",
"from",
"a",
"given",
"document",
"using",
"xpath",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java#L105-L116 | train |
fuinorg/event-store-commons | eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java | ESHttpUtils.findNodes | @Nullable
public static NodeList findNodes(@NotNull final Node rootNode, @NotNull final XPath xPath,
@NotNull final String expression) {
Contract.requireArgNotNull("doc", rootNode);
Contract.requireArgNotNull("xPath", xPath);
Contract.requireArgNotNull("expression", expression);
try {
return (NodeList) xPath.compile(expression).evaluate(rootNode, XPathConstants.NODESET);
} catch (final XPathExpressionException ex) {
throw new RuntimeException("Failed to read node: " + expression, ex);
}
} | java | @Nullable
public static NodeList findNodes(@NotNull final Node rootNode, @NotNull final XPath xPath,
@NotNull final String expression) {
Contract.requireArgNotNull("doc", rootNode);
Contract.requireArgNotNull("xPath", xPath);
Contract.requireArgNotNull("expression", expression);
try {
return (NodeList) xPath.compile(expression).evaluate(rootNode, XPathConstants.NODESET);
} catch (final XPathExpressionException ex) {
throw new RuntimeException("Failed to read node: " + expression, ex);
}
} | [
"@",
"Nullable",
"public",
"static",
"NodeList",
"findNodes",
"(",
"@",
"NotNull",
"final",
"Node",
"rootNode",
",",
"@",
"NotNull",
"final",
"XPath",
"xPath",
",",
"@",
"NotNull",
"final",
"String",
"expression",
")",
"{",
"Contract",
".",
"requireArgNotNull"... | Returns a list of nodes from a given document using xpath.
@param rootNode
Node to search.
@param xPath
XPath to use.
@param expression
XPath expression.
@return Nodes or <code>null</code> if no match was found. | [
"Returns",
"a",
"list",
"of",
"nodes",
"from",
"a",
"given",
"document",
"using",
"xpath",
"."
] | ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c | https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java#L130-L141 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.