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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
GCRC/nunaliit | nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java | JdbcUtils.safeSqlQueryIntegerValue | static public String safeSqlQueryIntegerValue(String in) throws Exception {
int intValue = Integer.parseInt(in);
return ""+intValue;
} | java | static public String safeSqlQueryIntegerValue(String in) throws Exception {
int intValue = Integer.parseInt(in);
return ""+intValue;
} | [
"static",
"public",
"String",
"safeSqlQueryIntegerValue",
"(",
"String",
"in",
")",
"throws",
"Exception",
"{",
"int",
"intValue",
"=",
"Integer",
".",
"parseInt",
"(",
"in",
")",
";",
"return",
"\"\"",
"+",
"intValue",
";",
"}"
] | This method converts a string into a new one that is safe for
a SQL query. It deals with strings that are expected to be integer
values.
@param in Original string
@return Safe string for a query. | [
"This",
"method",
"converts",
"a",
"string",
"into",
"a",
"new",
"one",
"that",
"is",
"safe",
"for",
"a",
"SQL",
"query",
".",
"It",
"deals",
"with",
"strings",
"that",
"are",
"expected",
"to",
"be",
"integer",
"values",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java#L69-L73 | train |
GCRC/nunaliit | nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java | JdbcUtils.safeSqlQueryIdentifier | static public String safeSqlQueryIdentifier(String in) throws Exception {
if( null == in ) {
throw new Exception("Null string passed as identifier");
}
if( in.indexOf('\0') >= 0 ) {
throw new Exception("Null character found in identifier");
}
// All quotes should be escaped
in = in.replace("\"", "\... | java | static public String safeSqlQueryIdentifier(String in) throws Exception {
if( null == in ) {
throw new Exception("Null string passed as identifier");
}
if( in.indexOf('\0') >= 0 ) {
throw new Exception("Null character found in identifier");
}
// All quotes should be escaped
in = in.replace("\"", "\... | [
"static",
"public",
"String",
"safeSqlQueryIdentifier",
"(",
"String",
"in",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"in",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Null string passed as identifier\"",
")",
";",
"}",
"if",
"(",
"in",
"... | This method converts a string into a new one that is safe for
a SQL query. It deals with strings that are supposed to be
identifiers.
@param in Original string
@return Safe string for a query.
@throws Exception | [
"This",
"method",
"converts",
"a",
"string",
"into",
"a",
"new",
"one",
"that",
"is",
"safe",
"for",
"a",
"SQL",
"query",
".",
"It",
"deals",
"with",
"strings",
"that",
"are",
"supposed",
"to",
"be",
"identifiers",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java#L83-L97 | train |
GCRC/nunaliit | nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java | JdbcUtils.extractStringResult | static public String extractStringResult(ResultSet rs, ResultSetMetaData rsmd, int index) throws Exception {
int count = rsmd.getColumnCount();
if( index > count || index < 1 ) {
throw new Exception("Invalid index");
}
int type = rsmd.getColumnType(index);
switch (type) {
case java.sql.Types.VARCHAR... | java | static public String extractStringResult(ResultSet rs, ResultSetMetaData rsmd, int index) throws Exception {
int count = rsmd.getColumnCount();
if( index > count || index < 1 ) {
throw new Exception("Invalid index");
}
int type = rsmd.getColumnType(index);
switch (type) {
case java.sql.Types.VARCHAR... | [
"static",
"public",
"String",
"extractStringResult",
"(",
"ResultSet",
"rs",
",",
"ResultSetMetaData",
"rsmd",
",",
"int",
"index",
")",
"throws",
"Exception",
"{",
"int",
"count",
"=",
"rsmd",
".",
"getColumnCount",
"(",
")",
";",
"if",
"(",
"index",
">",
... | This method returns a String result at a given index.
@param stmt Statement that has been successfully executed
@param index Index of expected column
@return A string returned at the specified index
@throws Exception If there is no column at index | [
"This",
"method",
"returns",
"a",
"String",
"result",
"at",
"a",
"given",
"index",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java#L106-L121 | train |
GCRC/nunaliit | nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java | JdbcUtils.extractIntResult | static public int extractIntResult(ResultSet rs, ResultSetMetaData rsmd, int index) throws Exception {
int count = rsmd.getColumnCount();
if( index > count || index < 1 ) {
throw new Exception("Invalid index");
}
int type = rsmd.getColumnType(index);
switch (type) {
case java.sql.Types.INTEGER:
c... | java | static public int extractIntResult(ResultSet rs, ResultSetMetaData rsmd, int index) throws Exception {
int count = rsmd.getColumnCount();
if( index > count || index < 1 ) {
throw new Exception("Invalid index");
}
int type = rsmd.getColumnType(index);
switch (type) {
case java.sql.Types.INTEGER:
c... | [
"static",
"public",
"int",
"extractIntResult",
"(",
"ResultSet",
"rs",
",",
"ResultSetMetaData",
"rsmd",
",",
"int",
"index",
")",
"throws",
"Exception",
"{",
"int",
"count",
"=",
"rsmd",
".",
"getColumnCount",
"(",
")",
";",
"if",
"(",
"index",
">",
"coun... | This method returns an int result at a given index.
@param stmt Statement that has been successfully executed
@param index Index of expected column
@return A value returned at the specified index
@throws Exception If there is no column at index | [
"This",
"method",
"returns",
"an",
"int",
"result",
"at",
"a",
"given",
"index",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java#L131-L146 | train |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/file/SystemFile.java | SystemFile.addKnownString | static public void addKnownString(String mimeType, String knownString) {
Map<String,String> map = getKnownStrings();
if( null != mimeType && null != knownString ) {
map.put(knownString.trim(), mimeType.trim());
}
} | java | static public void addKnownString(String mimeType, String knownString) {
Map<String,String> map = getKnownStrings();
if( null != mimeType && null != knownString ) {
map.put(knownString.trim(), mimeType.trim());
}
} | [
"static",
"public",
"void",
"addKnownString",
"(",
"String",
"mimeType",
",",
"String",
"knownString",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"getKnownStrings",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"mimeType",
"&&",
"null",
"!... | Adds a relation between a known string for File and a mime type.
@param mimeType Mime type that should be returned if known string is encountered
@param knownString A string that is found when performing "file -bnk" | [
"Adds",
"a",
"relation",
"between",
"a",
"known",
"string",
"for",
"File",
"and",
"a",
"mime",
"type",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/file/SystemFile.java#L69-L74 | train |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java | ImageIOUtil.getOrCreateChildNode | private static IIOMetadataNode getOrCreateChildNode(IIOMetadataNode parentNode, String name)
{
NodeList nodeList = parentNode.getElementsByTagName(name);
if (nodeList.getLength() > 0)
{
return (IIOMetadataNode) nodeList.item(0);
}
IIOMetadataNode childNode = new I... | java | private static IIOMetadataNode getOrCreateChildNode(IIOMetadataNode parentNode, String name)
{
NodeList nodeList = parentNode.getElementsByTagName(name);
if (nodeList.getLength() > 0)
{
return (IIOMetadataNode) nodeList.item(0);
}
IIOMetadataNode childNode = new I... | [
"private",
"static",
"IIOMetadataNode",
"getOrCreateChildNode",
"(",
"IIOMetadataNode",
"parentNode",
",",
"String",
"name",
")",
"{",
"NodeList",
"nodeList",
"=",
"parentNode",
".",
"getElementsByTagName",
"(",
"name",
")",
";",
"if",
"(",
"nodeList",
".",
"getLe... | Gets the named child node, or creates and attaches it.
@param parentNode the parent node
@param name name of the child node
@return the existing or just created child node | [
"Gets",
"the",
"named",
"child",
"node",
"or",
"creates",
"and",
"attaches",
"it",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java#L336-L346 | train |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java | ImageIOUtil.setDPI | private static void setDPI(IIOMetadata metadata, int dpi, String formatName)
throws IIOInvalidTreeException
{
IIOMetadataNode root = (IIOMetadataNode) metadata.getAsTree(MetaUtil.STANDARD_METADATA_FORMAT);
IIOMetadataNode dimension = getOrCreateChildNode(root, "Dimension");
// ... | java | private static void setDPI(IIOMetadata metadata, int dpi, String formatName)
throws IIOInvalidTreeException
{
IIOMetadataNode root = (IIOMetadataNode) metadata.getAsTree(MetaUtil.STANDARD_METADATA_FORMAT);
IIOMetadataNode dimension = getOrCreateChildNode(root, "Dimension");
// ... | [
"private",
"static",
"void",
"setDPI",
"(",
"IIOMetadata",
"metadata",
",",
"int",
"dpi",
",",
"String",
"formatName",
")",
"throws",
"IIOInvalidTreeException",
"{",
"IIOMetadataNode",
"root",
"=",
"(",
"IIOMetadataNode",
")",
"metadata",
".",
"getAsTree",
"(",
... | sets the DPI metadata | [
"sets",
"the",
"DPI",
"metadata"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java#L349-L372 | train |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/JPEGUtil.java | JPEGUtil.updateMetadata | static void updateMetadata(IIOMetadata metadata, int dpi) throws IIOInvalidTreeException
{
MetaUtil.debugLogMetadata(metadata, MetaUtil.JPEG_NATIVE_FORMAT);
// https://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOJPEGImageWriter.java
... | java | static void updateMetadata(IIOMetadata metadata, int dpi) throws IIOInvalidTreeException
{
MetaUtil.debugLogMetadata(metadata, MetaUtil.JPEG_NATIVE_FORMAT);
// https://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOJPEGImageWriter.java
... | [
"static",
"void",
"updateMetadata",
"(",
"IIOMetadata",
"metadata",
",",
"int",
"dpi",
")",
"throws",
"IIOInvalidTreeException",
"{",
"MetaUtil",
".",
"debugLogMetadata",
"(",
"metadata",
",",
"MetaUtil",
".",
"JPEG_NATIVE_FORMAT",
")",
";",
"// https://svn.apache.org... | Set dpi in a JPEG file
@param metadata the meta data
@param dpi the dpi
@throws IIOInvalidTreeException if something goes wrong | [
"Set",
"dpi",
"in",
"a",
"JPEG",
"file"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/JPEGUtil.java#L41-L93 | train |
GCRC/nunaliit | nunaliit2-json/src/main/java/org/json/HTTPTokener.java | HTTPTokener.nextToken | public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | java | public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | [
"public",
"String",
"nextToken",
"(",
")",
"throws",
"JSONException",
"{",
"char",
"c",
";",
"char",
"q",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"do",
"{",
"c",
"=",
"next",
"(",
")",
";",
"}",
"while",
"(",
"Characte... | Get the next token or string. This is used in parsing HTTP headers.
@throws JSONException
@return A String. | [
"Get",
"the",
"next",
"token",
"or",
"string",
".",
"This",
"is",
"used",
"in",
"parsing",
"HTTP",
"headers",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-json/src/main/java/org/json/HTTPTokener.java#L49-L76 | train |
GCRC/nunaliit | nunaliit2-json/src/main/java/org/json/Property.java | Property.toJSONObject | public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
// can't use the new constructor for Android support
// JSONObject jo = new JSONObject(properties == null ? 0 : properties.size());
JSONObject jo = new JSONObject();
if (properties != null && !p... | java | public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
// can't use the new constructor for Android support
// JSONObject jo = new JSONObject(properties == null ? 0 : properties.size());
JSONObject jo = new JSONObject();
if (properties != null && !p... | [
"public",
"static",
"JSONObject",
"toJSONObject",
"(",
"java",
".",
"util",
".",
"Properties",
"properties",
")",
"throws",
"JSONException",
"{",
"// can't use the new constructor for Android support",
"// JSONObject jo = new JSONObject(properties == null ? 0 : properties.size());",
... | Converts a property file object into a JSONObject. The property file object is a table of name value pairs.
@param properties java.util.Properties
@return JSONObject
@throws JSONException | [
"Converts",
"a",
"property",
"file",
"object",
"into",
"a",
"JSONObject",
".",
"The",
"property",
"file",
"object",
"is",
"a",
"table",
"of",
"name",
"value",
"pairs",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-json/src/main/java/org/json/Property.java#L42-L54 | train |
GCRC/nunaliit | nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/UploadWorkerThread.java | UploadWorkerThread.performSubmittedInlineWork | private void performSubmittedInlineWork(Work work) throws Exception {
String attachmentName = work.getAttachmentName();
FileConversionContext conversionContext =
new FileConversionContextImpl(work,documentDbDesign,mediaDir);
DocumentDescriptor docDescriptor = conversionContext.getDocument();
Attachment... | java | private void performSubmittedInlineWork(Work work) throws Exception {
String attachmentName = work.getAttachmentName();
FileConversionContext conversionContext =
new FileConversionContextImpl(work,documentDbDesign,mediaDir);
DocumentDescriptor docDescriptor = conversionContext.getDocument();
Attachment... | [
"private",
"void",
"performSubmittedInlineWork",
"(",
"Work",
"work",
")",
"throws",
"Exception",
"{",
"String",
"attachmentName",
"=",
"work",
".",
"getAttachmentName",
"(",
")",
";",
"FileConversionContext",
"conversionContext",
"=",
"new",
"FileConversionContextImpl"... | This function is called when a media file was added on a different
node, such as a mobile device. In that case, the media is marked
as 'submitted_inline' since the media is already attached to the document
but as not yet gone through the process that the robot implements.
@param docId
@param attachmentName
@throws Exce... | [
"This",
"function",
"is",
"called",
"when",
"a",
"media",
"file",
"was",
"added",
"on",
"a",
"different",
"node",
"such",
"as",
"a",
"mobile",
"device",
".",
"In",
"that",
"case",
"the",
"media",
"is",
"marked",
"as",
"submitted_inline",
"since",
"the",
... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/UploadWorkerThread.java#L454-L498 | train |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/MetaUtil.java | MetaUtil.debugLogMetadata | static void debugLogMetadata(IIOMetadata metadata, String format)
{
if (!logger.isDebugEnabled())
{
return;
}
// see http://docs.oracle.com/javase/7/docs/api/javax/imageio/
// metadata/doc-files/standard_metadata.html
IIOMetadataNode root = (IIOMetada... | java | static void debugLogMetadata(IIOMetadata metadata, String format)
{
if (!logger.isDebugEnabled())
{
return;
}
// see http://docs.oracle.com/javase/7/docs/api/javax/imageio/
// metadata/doc-files/standard_metadata.html
IIOMetadataNode root = (IIOMetada... | [
"static",
"void",
"debugLogMetadata",
"(",
"IIOMetadata",
"metadata",
",",
"String",
"format",
")",
"{",
"if",
"(",
"!",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"// see http://docs.oracle.com/javase/7/docs/api/javax/imageio/",
"// ... | logs metadata as an XML tree if debug is enabled | [
"logs",
"metadata",
"as",
"an",
"XML",
"tree",
"if",
"debug",
"is",
"enabled"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/MetaUtil.java#L47-L73 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryBuffer.java | FSEntryBuffer.getPositionedBuffer | static public FSEntry getPositionedBuffer(String path, byte[] content) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = new FSEntryBuffer(pathFrags.get(index), content);
--index;
whil... | java | static public FSEntry getPositionedBuffer(String path, byte[] content) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = new FSEntryBuffer(pathFrags.get(index), content);
--index;
whil... | [
"static",
"public",
"FSEntry",
"getPositionedBuffer",
"(",
"String",
"path",
",",
"byte",
"[",
"]",
"content",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"pathFrags",
"=",
"FSEntrySupport",
".",
"interpretPath",
"(",
"path",
")",
";",
"// S... | Create a virtual tree hierarchy with a buffer supporting the leaf.
@param path Position of the buffer in the hierarchy, including its name
@param content The actual buffer backing the end leaf
@return The FSEntry root for this hierarchy
@throws Exception Invalid parameter | [
"Create",
"a",
"virtual",
"tree",
"hierarchy",
"with",
"a",
"buffer",
"supporting",
"the",
"leaf",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryBuffer.java#L24-L40 | train |
GCRC/nunaliit | nunaliit2-couch-date/src/main/java/ca/carleton/gcrc/couch/date/cluster/TreeInsertProcess.java | TreeInsertProcess.insertElements | static public Result insertElements(Tree tree, List<TreeElement> elements, NowReference now) throws Exception {
ResultImpl result = new ResultImpl(tree);
TreeNodeRegular regularRootNode = tree.getRegularRootNode();
TreeNodeOngoing ongoingRootNode = tree.getOngoingRootNode();
for(TreeElement element : elem... | java | static public Result insertElements(Tree tree, List<TreeElement> elements, NowReference now) throws Exception {
ResultImpl result = new ResultImpl(tree);
TreeNodeRegular regularRootNode = tree.getRegularRootNode();
TreeNodeOngoing ongoingRootNode = tree.getOngoingRootNode();
for(TreeElement element : elem... | [
"static",
"public",
"Result",
"insertElements",
"(",
"Tree",
"tree",
",",
"List",
"<",
"TreeElement",
">",
"elements",
",",
"NowReference",
"now",
")",
"throws",
"Exception",
"{",
"ResultImpl",
"result",
"=",
"new",
"ResultImpl",
"(",
"tree",
")",
";",
"Tree... | Modifies a cluster tree as a result of adding a new elements in the
tree.
@param tree Tree where the element is inserted.
@param elements Elements to be inserted in the tree
@return Results of inserting the elements
@throws Exception | [
"Modifies",
"a",
"cluster",
"tree",
"as",
"a",
"result",
"of",
"adding",
"a",
"new",
"elements",
"in",
"the",
"tree",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-date/src/main/java/ca/carleton/gcrc/couch/date/cluster/TreeInsertProcess.java#L80-L97 | train |
GCRC/nunaliit | nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/NunaliitDocument.java | NunaliitDocument.getOriginalGometry | public NunaliitGeometry getOriginalGometry() throws Exception {
NunaliitGeometryImpl result = null;
JSONObject jsonDoc = getJSONObject();
JSONObject nunalitt_geom = jsonDoc.optJSONObject(CouchNunaliitConstants.DOC_KEY_GEOMETRY);
if( null != nunalitt_geom ){
// By default, the wkt is the geometry
St... | java | public NunaliitGeometry getOriginalGometry() throws Exception {
NunaliitGeometryImpl result = null;
JSONObject jsonDoc = getJSONObject();
JSONObject nunalitt_geom = jsonDoc.optJSONObject(CouchNunaliitConstants.DOC_KEY_GEOMETRY);
if( null != nunalitt_geom ){
// By default, the wkt is the geometry
St... | [
"public",
"NunaliitGeometry",
"getOriginalGometry",
"(",
")",
"throws",
"Exception",
"{",
"NunaliitGeometryImpl",
"result",
"=",
"null",
";",
"JSONObject",
"jsonDoc",
"=",
"getJSONObject",
"(",
")",
";",
"JSONObject",
"nunalitt_geom",
"=",
"jsonDoc",
".",
"optJSONOb... | Return the original geometry associated with the document. This is the
geometry that was first submitted with the document. If the document
does not contain a geometry, then null is returned.
@return The original geometry, or null if no geometry is found.
@throws Exception | [
"Return",
"the",
"original",
"geometry",
"associated",
"with",
"the",
"document",
".",
"This",
"is",
"the",
"geometry",
"that",
"was",
"first",
"submitted",
"with",
"the",
"document",
".",
"If",
"the",
"document",
"does",
"not",
"contain",
"a",
"geometry",
"... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/NunaliitDocument.java#L71-L148 | train |
GCRC/nunaliit | nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java | SubmissionUtils.getDocumentIdentifierFromSubmission | static public String getDocumentIdentifierFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
JSONObject originalReserved = submissionInfo.optJSONObject("original_reserved");
JSONObject submittedReserved = submissionInfo.optJS... | java | static public String getDocumentIdentifierFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
JSONObject originalReserved = submissionInfo.optJSONObject("original_reserved");
JSONObject submittedReserved = submissionInfo.optJS... | [
"static",
"public",
"String",
"getDocumentIdentifierFromSubmission",
"(",
"JSONObject",
"submissionDoc",
")",
"throws",
"Exception",
"{",
"JSONObject",
"submissionInfo",
"=",
"submissionDoc",
".",
"getJSONObject",
"(",
"\"nunaliit_submission\"",
")",
";",
"JSONObject",
"o... | Computes the target document identifier for this submission. Returns null
if it can not be found.
@param submissionDoc Submission document from the submission database
@return Document identifier for the submitted document | [
"Computes",
"the",
"target",
"document",
"identifier",
"for",
"this",
"submission",
".",
"Returns",
"null",
"if",
"it",
"can",
"not",
"be",
"found",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L22-L37 | train |
GCRC/nunaliit | nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java | SubmissionUtils.getSubmittedDocumentFromSubmission | static public JSONObject getSubmittedDocumentFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
JSONObject doc = submissionInfo.getJSONObject("submitted_doc");
JSONObject reserved = submissionInfo.optJSONObject("submitted_... | java | static public JSONObject getSubmittedDocumentFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
JSONObject doc = submissionInfo.getJSONObject("submitted_doc");
JSONObject reserved = submissionInfo.optJSONObject("submitted_... | [
"static",
"public",
"JSONObject",
"getSubmittedDocumentFromSubmission",
"(",
"JSONObject",
"submissionDoc",
")",
"throws",
"Exception",
"{",
"JSONObject",
"submissionInfo",
"=",
"submissionDoc",
".",
"getJSONObject",
"(",
"\"nunaliit_submission\"",
")",
";",
"JSONObject",
... | Re-creates the document submitted by the client from
the submission document.
@param submissionDoc Submission document from the submission database
@return Document submitted by user for update | [
"Re",
"-",
"creates",
"the",
"document",
"submitted",
"by",
"the",
"client",
"from",
"the",
"submission",
"document",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L45-L52 | train |
GCRC/nunaliit | nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java | SubmissionUtils.getApprovedDocumentFromSubmission | static public JSONObject getApprovedDocumentFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
// Check if an approved version of the document is available
JSONObject doc = submissionInfo.optJSONObject("approved_doc");
if(... | java | static public JSONObject getApprovedDocumentFromSubmission(JSONObject submissionDoc) throws Exception {
JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission");
// Check if an approved version of the document is available
JSONObject doc = submissionInfo.optJSONObject("approved_doc");
if(... | [
"static",
"public",
"JSONObject",
"getApprovedDocumentFromSubmission",
"(",
"JSONObject",
"submissionDoc",
")",
"throws",
"Exception",
"{",
"JSONObject",
"submissionInfo",
"=",
"submissionDoc",
".",
"getJSONObject",
"(",
"\"nunaliit_submission\"",
")",
";",
"// Check if an ... | Re-creates the approved document submitted by the client from
the submission document.
@param submissionDoc Submission document from the submission database
@return Document submitted by user for update | [
"Re",
"-",
"creates",
"the",
"approved",
"document",
"submitted",
"by",
"the",
"client",
"from",
"the",
"submission",
"document",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L75-L89 | train |
GCRC/nunaliit | nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java | SubmissionUtils.recreateDocumentFromDocAndReserved | static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception {
JSONObject result = JSONSupport.copyObject( doc );
// Re-insert attributes that start with '_'
if( null != reserved ) {
Iterator<?> it = reserved.keys();
while( it.hasNext() ){
Object k... | java | static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception {
JSONObject result = JSONSupport.copyObject( doc );
// Re-insert attributes that start with '_'
if( null != reserved ) {
Iterator<?> it = reserved.keys();
while( it.hasNext() ){
Object k... | [
"static",
"public",
"JSONObject",
"recreateDocumentFromDocAndReserved",
"(",
"JSONObject",
"doc",
",",
"JSONObject",
"reserved",
")",
"throws",
"Exception",
"{",
"JSONObject",
"result",
"=",
"JSONSupport",
".",
"copyObject",
"(",
"doc",
")",
";",
"// Re-insert attribu... | Re-creates a document given the document and the reserved keys.
@param doc Main document
@param reserved Document that contains reserved keys. A reserve key starts with an underscore. In this document,
the reserved keys do not have the starting underscore.
@return
@throws Exception | [
"Re",
"-",
"creates",
"a",
"document",
"given",
"the",
"document",
"and",
"the",
"reserved",
"keys",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L99-L116 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/app/impl/DocumentStoreProcessImpl.java | DocumentStoreProcessImpl.removeUndesiredFiles | private void removeUndesiredFiles(JSONObject doc, File dir) throws Exception {
Set<String> keysKept = new HashSet<String>();
// Loop through each child of directory
File[] children = dir.listFiles();
for(File child : children){
String name = child.getName();
String extension = "";
Matcher matcherNam... | java | private void removeUndesiredFiles(JSONObject doc, File dir) throws Exception {
Set<String> keysKept = new HashSet<String>();
// Loop through each child of directory
File[] children = dir.listFiles();
for(File child : children){
String name = child.getName();
String extension = "";
Matcher matcherNam... | [
"private",
"void",
"removeUndesiredFiles",
"(",
"JSONObject",
"doc",
",",
"File",
"dir",
")",
"throws",
"Exception",
"{",
"Set",
"<",
"String",
">",
"keysKept",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"// Loop through each child of directory",
... | This function scans the directory for files that are no longer needed to represent
the document given in arguments. The detected files are deleted from disk.
@param doc The document that should be stored in the directory
@param dir The directory where the document is going to be stored | [
"This",
"function",
"scans",
"the",
"directory",
"for",
"files",
"that",
"are",
"no",
"longer",
"needed",
"to",
"represent",
"the",
"document",
"given",
"in",
"arguments",
".",
"The",
"detected",
"files",
"are",
"deleted",
"from",
"disk",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/app/impl/DocumentStoreProcessImpl.java#L591-L667 | train |
GCRC/nunaliit | nunaliit2-auth-cookie/src/main/java/ca/carleton/gcrc/auth/cookie/impl/CookieAuthentication.java | CookieAuthentication.getSecret | synchronized static private byte[] getSecret() throws Exception {
if( null == secret ) {
Date now = new Date();
long nowValue = now.getTime();
byte[] nowBytes = new byte[8];
nowBytes[0] = (byte)((nowValue >> 0) & 0xff);
nowBytes[1] = (byte)((nowValue >> 8) & 0xff);
nowBytes[2] = (byte)((nowVal... | java | synchronized static private byte[] getSecret() throws Exception {
if( null == secret ) {
Date now = new Date();
long nowValue = now.getTime();
byte[] nowBytes = new byte[8];
nowBytes[0] = (byte)((nowValue >> 0) & 0xff);
nowBytes[1] = (byte)((nowValue >> 8) & 0xff);
nowBytes[2] = (byte)((nowVal... | [
"synchronized",
"static",
"private",
"byte",
"[",
"]",
"getSecret",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"secret",
")",
"{",
"Date",
"now",
"=",
"new",
"Date",
"(",
")",
";",
"long",
"nowValue",
"=",
"now",
".",
"getTime",
"... | protected for testing | [
"protected",
"for",
"testing"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-auth-cookie/src/main/java/ca/carleton/gcrc/auth/cookie/impl/CookieAuthentication.java#L54-L76 | train |
GCRC/nunaliit | nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/AuthenticationUtils.java | AuthenticationUtils.sendAuthRequiredError | static public void sendAuthRequiredError(HttpServletResponse response, String realm) throws IOException {
response.setHeader("WWW-Authenticate", "Basic realm=\""+realm+"\"");
response.setHeader("Cache-Control", "no-cache,must-revalidate");
response.setDateHeader("Expires", (new Date()).getTime());
response.send... | java | static public void sendAuthRequiredError(HttpServletResponse response, String realm) throws IOException {
response.setHeader("WWW-Authenticate", "Basic realm=\""+realm+"\"");
response.setHeader("Cache-Control", "no-cache,must-revalidate");
response.setDateHeader("Expires", (new Date()).getTime());
response.send... | [
"static",
"public",
"void",
"sendAuthRequiredError",
"(",
"HttpServletResponse",
"response",
",",
"String",
"realm",
")",
"throws",
"IOException",
"{",
"response",
".",
"setHeader",
"(",
"\"WWW-Authenticate\"",
",",
"\"Basic realm=\\\"\"",
"+",
"realm",
"+",
"\"\\\"\"... | Sends a response to the client stating that authorization is required.
@param response Response used to send error message
@param realm Realm that client should provide authorization for
@throws IOException | [
"Sends",
"a",
"response",
"to",
"the",
"client",
"stating",
"that",
"authorization",
"is",
"required",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/AuthenticationUtils.java#L97-L102 | train |
GCRC/nunaliit | nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/AuthenticationUtils.java | AuthenticationUtils.userToCookieString | static public String userToCookieString(boolean loggedIn, User user) throws Exception {
JSONObject cookieObj = new JSONObject();
cookieObj.put("logged", loggedIn);
JSONObject userObj = user.toJSON();
cookieObj.put("user", userObj);
StringWriter sw = new StringWriter();
cookieObj.write(sw);
String... | java | static public String userToCookieString(boolean loggedIn, User user) throws Exception {
JSONObject cookieObj = new JSONObject();
cookieObj.put("logged", loggedIn);
JSONObject userObj = user.toJSON();
cookieObj.put("user", userObj);
StringWriter sw = new StringWriter();
cookieObj.write(sw);
String... | [
"static",
"public",
"String",
"userToCookieString",
"(",
"boolean",
"loggedIn",
",",
"User",
"user",
")",
"throws",
"Exception",
"{",
"JSONObject",
"cookieObj",
"=",
"new",
"JSONObject",
"(",
")",
";",
"cookieObj",
".",
"put",
"(",
"\"logged\"",
",",
"loggedIn... | Converts an instance of User to JSON object, fit for a cookie
@param user Instance of User to convert
@return JSON string containing the user state
@throws Exception | [
"Converts",
"an",
"instance",
"of",
"User",
"to",
"JSON",
"object",
"fit",
"for",
"a",
"cookie"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/AuthenticationUtils.java#L110-L126 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntrySupport.java | FSEntrySupport.findDescendant | static public FSEntry findDescendant(FSEntry root, String path) throws Exception {
if( null == root ) {
throw new Exception("root parameter should not be null");
}
List<String> pathFrags = interpretPath(path);
// Iterate through path fragments, navigating through
// the offered children
FSEntry see... | java | static public FSEntry findDescendant(FSEntry root, String path) throws Exception {
if( null == root ) {
throw new Exception("root parameter should not be null");
}
List<String> pathFrags = interpretPath(path);
// Iterate through path fragments, navigating through
// the offered children
FSEntry see... | [
"static",
"public",
"FSEntry",
"findDescendant",
"(",
"FSEntry",
"root",
",",
"String",
"path",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"root",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"root parameter should not be null\"",
")",
";",
"}"... | Traverses a directory structure designated by root and looks
for a descendant with the provided path. If found, the supporting
instance of FSEntry for the path is returned. If not found, null
is returned.
@param root Root of directory structure where the descendant is searched
@param path Path of the seeked descendant
... | [
"Traverses",
"a",
"directory",
"structure",
"designated",
"by",
"root",
"and",
"looks",
"for",
"a",
"descendant",
"with",
"the",
"provided",
"path",
".",
"If",
"found",
"the",
"supporting",
"instance",
"of",
"FSEntry",
"for",
"the",
"path",
"is",
"returned",
... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntrySupport.java#L35-L65 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntrySupport.java | FSEntrySupport.interpretPath | static public List<String> interpretPath(String path) throws Exception {
if( null == path ) {
throw new Exception("path parameter should not be null");
}
if( path.codePointAt(0) == '/' ) {
throw new Exception("absolute path is not acceptable");
}
// Verify path
List<String> pathFragments = new Vector... | java | static public List<String> interpretPath(String path) throws Exception {
if( null == path ) {
throw new Exception("path parameter should not be null");
}
if( path.codePointAt(0) == '/' ) {
throw new Exception("absolute path is not acceptable");
}
// Verify path
List<String> pathFragments = new Vector... | [
"static",
"public",
"List",
"<",
"String",
">",
"interpretPath",
"(",
"String",
"path",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"path",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"path parameter should not be null\"",
")",
";",
"}",
"if"... | Utility method used to convert a path into its effective segments.
@param path Path to be interpreted
@return List of path fragments
@throws Exception On invalid parameters | [
"Utility",
"method",
"used",
"to",
"convert",
"a",
"path",
"into",
"its",
"effective",
"segments",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntrySupport.java#L73-L99 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/AbstractMetric.java | AbstractMetric.rankItems | protected List<I> rankItems(final Map<I, Double> userItems) {
List<I> sortedItems = new ArrayList<>();
if (userItems == null) {
return sortedItems;
}
Map<Double, Set<I>> itemsByRank = new HashMap<>();
for (Map.Entry<I, Double> e : userItems.entrySet()) {
I... | java | protected List<I> rankItems(final Map<I, Double> userItems) {
List<I> sortedItems = new ArrayList<>();
if (userItems == null) {
return sortedItems;
}
Map<Double, Set<I>> itemsByRank = new HashMap<>();
for (Map.Entry<I, Double> e : userItems.entrySet()) {
I... | [
"protected",
"List",
"<",
"I",
">",
"rankItems",
"(",
"final",
"Map",
"<",
"I",
",",
"Double",
">",
"userItems",
")",
"{",
"List",
"<",
"I",
">",
"sortedItems",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"userItems",
"==",
"null",
")"... | Ranks the set of items by associated score.
@param userItems map with scores for each item
@return the ranked list | [
"Ranks",
"the",
"set",
"of",
"items",
"by",
"associated",
"score",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/AbstractMetric.java#L143-L174 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/AbstractMetric.java | AbstractMetric.rankScores | protected List<Double> rankScores(final Map<I, Double> userItems) {
List<Double> sortedScores = new ArrayList<>();
if (userItems == null) {
return sortedScores;
}
for (Map.Entry<I, Double> e : userItems.entrySet()) {
double pref = e.getValue();
if (Dou... | java | protected List<Double> rankScores(final Map<I, Double> userItems) {
List<Double> sortedScores = new ArrayList<>();
if (userItems == null) {
return sortedScores;
}
for (Map.Entry<I, Double> e : userItems.entrySet()) {
double pref = e.getValue();
if (Dou... | [
"protected",
"List",
"<",
"Double",
">",
"rankScores",
"(",
"final",
"Map",
"<",
"I",
",",
"Double",
">",
"userItems",
")",
"{",
"List",
"<",
"Double",
">",
"sortedScores",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"userItems",
"==",
"... | Ranks the scores of an item-score map.
@param userItems map with scores for each item
@return the ranked list | [
"Ranks",
"the",
"scores",
"of",
"an",
"item",
"-",
"score",
"map",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/AbstractMetric.java#L182-L197 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java | MultipleRecommendationRunner.runLenskitRecommenders | public static void runLenskitRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateLenskitRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | java | public static void runLenskitRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateLenskitRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | [
"public",
"static",
"void",
"runLenskitRecommenders",
"(",
"final",
"Set",
"<",
"String",
">",
"paths",
",",
"final",
"Properties",
"properties",
")",
"{",
"for",
"(",
"AbstractRunner",
"<",
"Long",
",",
"Long",
">",
"rec",
":",
"instantiateLenskitRecommenders",... | Runs the Lenskit recommenders.
@param paths the input and output paths.
@param properties the properties. | [
"Runs",
"the",
"Lenskit",
"recommenders",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L145-L149 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java | MultipleRecommendationRunner.runMahoutRecommenders | public static void runMahoutRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateMahoutRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | java | public static void runMahoutRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateMahoutRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | [
"public",
"static",
"void",
"runMahoutRecommenders",
"(",
"final",
"Set",
"<",
"String",
">",
"paths",
",",
"final",
"Properties",
"properties",
")",
"{",
"for",
"(",
"AbstractRunner",
"<",
"Long",
",",
"Long",
">",
"rec",
":",
"instantiateMahoutRecommenders",
... | Runs Mahout-based recommenders.
@param paths the input and output paths.
@param properties the properties. | [
"Runs",
"Mahout",
"-",
"based",
"recommenders",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L229-L233 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java | MultipleRecommendationRunner.runRanksysRecommenders | public static void runRanksysRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateRanksysRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | java | public static void runRanksysRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateRanksysRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | [
"public",
"static",
"void",
"runRanksysRecommenders",
"(",
"final",
"Set",
"<",
"String",
">",
"paths",
",",
"final",
"Properties",
"properties",
")",
"{",
"for",
"(",
"AbstractRunner",
"<",
"Long",
",",
"Long",
">",
"rec",
":",
"instantiateRanksysRecommenders",... | Runs Ranksys-based recommenders.
@param paths the input and output paths.
@param properties the properties. | [
"Runs",
"Ranksys",
"-",
"based",
"recommenders",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L320-L324 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java | MultipleRecommendationRunner.listAllFiles | public static void listAllFiles(final Set<String> setOfPaths, final String inputPath) {
if (inputPath == null) {
return;
}
File[] files = new File(inputPath).listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file... | java | public static void listAllFiles(final Set<String> setOfPaths, final String inputPath) {
if (inputPath == null) {
return;
}
File[] files = new File(inputPath).listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file... | [
"public",
"static",
"void",
"listAllFiles",
"(",
"final",
"Set",
"<",
"String",
">",
"setOfPaths",
",",
"final",
"String",
"inputPath",
")",
"{",
"if",
"(",
"inputPath",
"==",
"null",
")",
"{",
"return",
";",
"}",
"File",
"[",
"]",
"files",
"=",
"new",... | List all files at a certain path.
@param setOfPaths the set of files at a certain path
@param inputPath the path to check | [
"List",
"all",
"files",
"at",
"a",
"certain",
"path",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L411-L426 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/PopularityStratifiedRecall.java | PopularityStratifiedRecall.getValueAt | @Override
public double getValueAt(final U user, final int at) {
if (userRecallAtCutoff.containsKey(at) && userRecallAtCutoff.get(at).containsKey(user)) {
return userRecallAtCutoff.get(at).get(user) / userTotalRecall.get(user);
}
return Double.NaN;
} | java | @Override
public double getValueAt(final U user, final int at) {
if (userRecallAtCutoff.containsKey(at) && userRecallAtCutoff.get(at).containsKey(user)) {
return userRecallAtCutoff.get(at).get(user) / userTotalRecall.get(user);
}
return Double.NaN;
} | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"U",
"user",
",",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userRecallAtCutoff",
".",
"containsKey",
"(",
"at",
")",
"&&",
"userRecallAtCutoff",
".",
"get",
"(",
"at",
")",
".",
"contains... | Method to return the recall value at a particular cutoff level for a
given user.
@param user the user
@param at cutoff level
@return the recall corresponding to the requested user at the cutoff
level | [
"Method",
"to",
"return",
"the",
"recall",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"for",
"a",
"given",
"user",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/PopularityStratifiedRecall.java#L224-L230 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/MultipleStrategyRunnerInfile.java | MultipleStrategyRunnerInfile.getAllRecommendationFiles | public static void getAllRecommendationFiles(final Set<String> recommendationFiles, final File path, final String prefix, final String suffix) {
if (path == null) {
return;
}
File[] files = path.listFiles();
if (files == null) {
return;
}
for (File... | java | public static void getAllRecommendationFiles(final Set<String> recommendationFiles, final File path, final String prefix, final String suffix) {
if (path == null) {
return;
}
File[] files = path.listFiles();
if (files == null) {
return;
}
for (File... | [
"public",
"static",
"void",
"getAllRecommendationFiles",
"(",
"final",
"Set",
"<",
"String",
">",
"recommendationFiles",
",",
"final",
"File",
"path",
",",
"final",
"String",
"prefix",
",",
"final",
"String",
"suffix",
")",
"{",
"if",
"(",
"path",
"==",
"nul... | Get all recommendation files.
@param recommendationFiles The recommendation files (what is this?)
@param path The path of the recommendation files.
@param prefix The prefix of the recommendation files.
@param suffix The suffix of the recommendation files. | [
"Get",
"all",
"recommendation",
"files",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/MultipleStrategyRunnerInfile.java#L264-L279 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/error/RMSE.java | RMSE.compute | @Override
public void compute() {
if (!Double.isNaN(getValue())) {
// since the data cannot change, avoid re-doing the calculations
return;
}
iniCompute();
Map<U, List<Double>> data = processDataAsPredictedDifferencesToTest();
int testItems = 0;
... | java | @Override
public void compute() {
if (!Double.isNaN(getValue())) {
// since the data cannot change, avoid re-doing the calculations
return;
}
iniCompute();
Map<U, List<Double>> data = processDataAsPredictedDifferencesToTest();
int testItems = 0;
... | [
"@",
"Override",
"public",
"void",
"compute",
"(",
")",
"{",
"if",
"(",
"!",
"Double",
".",
"isNaN",
"(",
"getValue",
"(",
")",
")",
")",
"{",
"// since the data cannot change, avoid re-doing the calculations",
"return",
";",
"}",
"iniCompute",
"(",
")",
";",
... | Instantiates and computes the RMSE value. Prior to running this, there is
no valid value. | [
"Instantiates",
"and",
"computes",
"the",
"RMSE",
"value",
".",
"Prior",
"to",
"running",
"this",
"there",
"is",
"no",
"valid",
"value",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/error/RMSE.java#L61-L96 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/MahoutRecommenderRunner.java | MahoutRecommenderRunner.run | @Override
public TemporalDataModelIF<Long, Long> run(final RUN_OPTIONS opts) throws RecommenderException, TasteException, IOException {
if (isAlreadyRecommended()) {
return null;
}
DataModel trainingModel = new FileDataModel(new File(getProperties().getProperty(RecommendationRunn... | java | @Override
public TemporalDataModelIF<Long, Long> run(final RUN_OPTIONS opts) throws RecommenderException, TasteException, IOException {
if (isAlreadyRecommended()) {
return null;
}
DataModel trainingModel = new FileDataModel(new File(getProperties().getProperty(RecommendationRunn... | [
"@",
"Override",
"public",
"TemporalDataModelIF",
"<",
"Long",
",",
"Long",
">",
"run",
"(",
"final",
"RUN_OPTIONS",
"opts",
")",
"throws",
"RecommenderException",
",",
"TasteException",
",",
"IOException",
"{",
"if",
"(",
"isAlreadyRecommended",
"(",
")",
")",
... | Runs the recommender using models from file.
@param opts see
{@link net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS}
@return see
{@link #runMahoutRecommender(net.recommenders.rival.recommend.frameworks.AbstractRunner.RUN_OPTIONS, org.apache.mahout.cf.taste.model.DataModel, org.apache.mahout.cf.t... | [
"Runs",
"the",
"recommender",
"using",
"models",
"from",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/MahoutRecommenderRunner.java#L73-L81 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/mdp/CrossValidationRecSysEvaluator.java | CrossValidationRecSysEvaluator.split | public void split(final String inFile, final String outPath, boolean perUser, long seed, String delimiter, boolean isTemporalData) {
try {
if (delimiter == null)
delimiter = this.delimiter;
DataModelIF<Long, Long>[] splits = new CrossValidationSplitter<Long, Long>(this.numFolds, p... | java | public void split(final String inFile, final String outPath, boolean perUser, long seed, String delimiter, boolean isTemporalData) {
try {
if (delimiter == null)
delimiter = this.delimiter;
DataModelIF<Long, Long>[] splits = new CrossValidationSplitter<Long, Long>(this.numFolds, p... | [
"public",
"void",
"split",
"(",
"final",
"String",
"inFile",
",",
"final",
"String",
"outPath",
",",
"boolean",
"perUser",
",",
"long",
"seed",
",",
"String",
"delimiter",
",",
"boolean",
"isTemporalData",
")",
"{",
"try",
"{",
"if",
"(",
"delimiter",
"=="... | Load a dataset and stores the splits generated from it.
@param inFile input dataset
@param outPath path where the splits will be stored
@param perUser flag for enable or disable splitting by user
@param seed seed for creating random split
@param delimiter dataset delimiter
@param isTemporalData present tem... | [
"Load",
"a",
"dataset",
"and",
"stores",
"the",
"splits",
"generated",
"from",
"it",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/mdp/CrossValidationRecSysEvaluator.java#L65-L99 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/mdp/CrossValidationRecSysEvaluator.java | CrossValidationRecSysEvaluator.recommend | public void recommend(final String inPath, final String outPath) throws IOException, TasteException {
for (int i = 0; i < this.numFolds; i++) {
org.apache.mahout.cf.taste.model.DataModel trainModel;
org.apache.mahout.cf.taste.model.DataModel testModel;
trainModel = new FileDataModel(... | java | public void recommend(final String inPath, final String outPath) throws IOException, TasteException {
for (int i = 0; i < this.numFolds; i++) {
org.apache.mahout.cf.taste.model.DataModel trainModel;
org.apache.mahout.cf.taste.model.DataModel testModel;
trainModel = new FileDataModel(... | [
"public",
"void",
"recommend",
"(",
"final",
"String",
"inPath",
",",
"final",
"String",
"outPath",
")",
"throws",
"IOException",
",",
"TasteException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"numFolds",
";",
"i",
"++",
")",... | Make predictions.
@param inPath
@param outPath
@throws IOException
@throws TasteException | [
"Make",
"predictions",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/mdp/CrossValidationRecSysEvaluator.java#L111-L162 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/mdp/CrossValidationRecSysEvaluator.java | CrossValidationRecSysEvaluator.buildEvaluationModels | public void buildEvaluationModels(final String splitPath, final String predictionsPath, final String outPath) {
for (int i = 0; i < this.numFolds; i++) {
File trainingFile = new File(Paths.get(splitPath, "train_" + i + FILE_EXT).toString());
File testFile = new File(Paths.get(splitPath, "test_" ... | java | public void buildEvaluationModels(final String splitPath, final String predictionsPath, final String outPath) {
for (int i = 0; i < this.numFolds; i++) {
File trainingFile = new File(Paths.get(splitPath, "train_" + i + FILE_EXT).toString());
File testFile = new File(Paths.get(splitPath, "test_" ... | [
"public",
"void",
"buildEvaluationModels",
"(",
"final",
"String",
"splitPath",
",",
"final",
"String",
"predictionsPath",
",",
"final",
"String",
"outPath",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"numFolds",
";",
"i",
"+... | Prepare the strategy models using prediction files.
@param splitPath path where splits have been stored
@param predictionsPath path where prediction files have been stored
@param outPath path where the filtered recommendations will be stored | [
"Prepare",
"the",
"strategy",
"models",
"using",
"prediction",
"files",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/mdp/CrossValidationRecSysEvaluator.java#L171-L230 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/DataModel.java | DataModel.getUserItemPreference | @Override
public Double getUserItemPreference(U u, I i) {
if (userItemPreferences.containsKey(u) && userItemPreferences.get(u).containsKey(i)) {
return userItemPreferences.get(u).get(i);
}
return Double.NaN;
} | java | @Override
public Double getUserItemPreference(U u, I i) {
if (userItemPreferences.containsKey(u) && userItemPreferences.get(u).containsKey(i)) {
return userItemPreferences.get(u).get(i);
}
return Double.NaN;
} | [
"@",
"Override",
"public",
"Double",
"getUserItemPreference",
"(",
"U",
"u",
",",
"I",
"i",
")",
"{",
"if",
"(",
"userItemPreferences",
".",
"containsKey",
"(",
"u",
")",
"&&",
"userItemPreferences",
".",
"get",
"(",
"u",
")",
".",
"containsKey",
"(",
"i... | Method that returns the preference between a user and an item.
@param u the user.
@param i the item.
@return the preference between a user and an item or NaN. | [
"Method",
"that",
"returns",
"the",
"preference",
"between",
"a",
"user",
"and",
"an",
"item",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/DataModel.java#L88-L94 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/DataModel.java | DataModel.getUserItems | @Override
public Iterable<I> getUserItems(U u) {
if (userItemPreferences.containsKey(u)) {
return userItemPreferences.get(u).keySet();
}
return Collections.emptySet();
} | java | @Override
public Iterable<I> getUserItems(U u) {
if (userItemPreferences.containsKey(u)) {
return userItemPreferences.get(u).keySet();
}
return Collections.emptySet();
} | [
"@",
"Override",
"public",
"Iterable",
"<",
"I",
">",
"getUserItems",
"(",
"U",
"u",
")",
"{",
"if",
"(",
"userItemPreferences",
".",
"containsKey",
"(",
"u",
")",
")",
"{",
"return",
"userItemPreferences",
".",
"get",
"(",
"u",
")",
".",
"keySet",
"("... | Method that returns the items of a user.
@param u the user.
@return the items of a user. | [
"Method",
"that",
"returns",
"the",
"items",
"of",
"a",
"user",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/DataModel.java#L102-L108 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/DataModel.java | DataModel.addPreference | @Override
public void addPreference(final U u, final I i, final Double d) {
// update direct map
Map<I, Double> userPreferences = userItemPreferences.get(u);
if (userPreferences == null) {
userPreferences = new HashMap<>();
userItemPreferences.put(u, userPreferences);... | java | @Override
public void addPreference(final U u, final I i, final Double d) {
// update direct map
Map<I, Double> userPreferences = userItemPreferences.get(u);
if (userPreferences == null) {
userPreferences = new HashMap<>();
userItemPreferences.put(u, userPreferences);... | [
"@",
"Override",
"public",
"void",
"addPreference",
"(",
"final",
"U",
"u",
",",
"final",
"I",
"i",
",",
"final",
"Double",
"d",
")",
"{",
"// update direct map",
"Map",
"<",
"I",
",",
"Double",
">",
"userPreferences",
"=",
"userItemPreferences",
".",
"get... | Method that adds a preference to the model between a user and an item.
@param u the user.
@param i the item.
@param d the preference. | [
"Method",
"that",
"adds",
"a",
"preference",
"to",
"the",
"model",
"between",
"a",
"user",
"and",
"an",
"item",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/DataModel.java#L117-L138 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommenderIO.java | RecommenderIO.writeData | public static void writeData(final long user, final List<Preference<Long, Long>> recommendations, final String path, final String fileName, final boolean append, final TemporalDataModelIF<Long, Long> model) {
BufferedWriter out = null;
try {
File dir = null;
if (path != null) {
... | java | public static void writeData(final long user, final List<Preference<Long, Long>> recommendations, final String path, final String fileName, final boolean append, final TemporalDataModelIF<Long, Long> model) {
BufferedWriter out = null;
try {
File dir = null;
if (path != null) {
... | [
"public",
"static",
"void",
"writeData",
"(",
"final",
"long",
"user",
",",
"final",
"List",
"<",
"Preference",
"<",
"Long",
",",
"Long",
">",
">",
"recommendations",
",",
"final",
"String",
"path",
",",
"final",
"String",
"fileName",
",",
"final",
"boolea... | Write recommendations to file.
@param user the user
@param recommendations the recommendations
@param path directory where fileName will be written (if not null)
@param fileName name of the file, if null recommendations will not be
printed
@param append flag to decide if recommendations should be appended to
file
@par... | [
"Write",
"recommendations",
"to",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommenderIO.java#L53-L93 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/EvaluationMetricRunner.java | EvaluationMetricRunner.main | public static void main(final String[] args) throws Exception {
String propertyFile = System.getProperty("propertyFile");
final Properties properties = new Properties();
try {
properties.load(new FileInputStream(propertyFile));
} catch (IOException ie) {
ie.print... | java | public static void main(final String[] args) throws Exception {
String propertyFile = System.getProperty("propertyFile");
final Properties properties = new Properties();
try {
properties.load(new FileInputStream(propertyFile));
} catch (IOException ie) {
ie.print... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"String",
"propertyFile",
"=",
"System",
".",
"getProperty",
"(",
"\"propertyFile\"",
")",
";",
"final",
"Properties",
"properties",
"=",
"new",
"P... | Main method for running a single evaluation metric.
@param args the arguments.
@throws Exception see {@link #run(java.util.Properties)} | [
"Main",
"method",
"for",
"running",
"a",
"single",
"evaluation",
"metric",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/EvaluationMetricRunner.java#L103-L114 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/EvaluationMetricRunner.java | EvaluationMetricRunner.run | @SuppressWarnings("unchecked")
public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
System.out.println("Parsing started: recommendation file");
Fi... | java | @SuppressWarnings("unchecked")
public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
System.out.println("Parsing started: recommendation file");
Fi... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"run",
"(",
"final",
"Properties",
"properties",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"InvocationTa... | Runs a single evaluation metric.
@param properties The properties of the strategy.
@throws IOException if recommendation file is not found or output cannot
be written (see {@link #generateOutput(net.recommenders.rival.core.DataModelIF, int[],
net.recommenders.rival.evaluation.metric.EvaluationMetric, java.lang.String,... | [
"Runs",
"a",
"single",
"evaluation",
"metric",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/EvaluationMetricRunner.java#L129-L167 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/EvaluationMetricRunner.java | EvaluationMetricRunner.generateOutput | @SuppressWarnings("unchecked")
public static <U, I> void generateOutput(final DataModelIF<U, I> testModel, final int[] rankingCutoffs,
final EvaluationMetric<U> metric, final String metricName,
final Boolean perUser, final File resultsFile, final Boolean overwrite, final Boolean append) thro... | java | @SuppressWarnings("unchecked")
public static <U, I> void generateOutput(final DataModelIF<U, I> testModel, final int[] rankingCutoffs,
final EvaluationMetric<U> metric, final String metricName,
final Boolean perUser, final File resultsFile, final Boolean overwrite, final Boolean append) thro... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"U",
",",
"I",
">",
"void",
"generateOutput",
"(",
"final",
"DataModelIF",
"<",
"U",
",",
"I",
">",
"testModel",
",",
"final",
"int",
"[",
"]",
"rankingCutoffs",
",",
"final",
"... | Generates the output of the evaluation.
@param testModel The test model.
@param rankingCutoffs The ranking cutoffs for the ranking metrics.
@param metric The metric to be executed.
@param metricName The name to be printed in the file for this metric.
@param perUser Whether or not to print results per user.
@param resu... | [
"Generates",
"the",
"output",
"of",
"the",
"evaluation",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/EvaluationMetricRunner.java#L267-L302 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunnerInfile.java | StrategyRunnerInfile.run | public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
// read splits
System.out.println("Parsing started: training file");
File trainingFile = ... | java | public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
// read splits
System.out.println("Parsing started: training file");
File trainingFile = ... | [
"public",
"static",
"void",
"run",
"(",
"final",
"Properties",
"properties",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
"{",
"//... | Process the property file and runs the specified strategies on some data.
@param properties The property file
@throws IOException when a file cannot be parsed
@throws ClassNotFoundException when {@link Class#forName(java.lang.String)}
fails
@throws IllegalAccessException when {@link java.lang.reflect.Constructor#newIn... | [
"Process",
"the",
"property",
"file",
"and",
"runs",
"the",
"specified",
"strategies",
"on",
"some",
"data",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunnerInfile.java#L133-L174 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunnerInfile.java | StrategyRunnerInfile.generateOutput | public static void generateOutput(final DataModelIF<Long, Long> testModel, final File userRecommendationFile,
final EvaluationStrategy<Long, Long> strategy, final EvaluationStrategy.OUTPUT_FORMAT format,
final File rankingFile, final File groundtruthFile, final Boolean overwrite)
thr... | java | public static void generateOutput(final DataModelIF<Long, Long> testModel, final File userRecommendationFile,
final EvaluationStrategy<Long, Long> strategy, final EvaluationStrategy.OUTPUT_FORMAT format,
final File rankingFile, final File groundtruthFile, final Boolean overwrite)
thr... | [
"public",
"static",
"void",
"generateOutput",
"(",
"final",
"DataModelIF",
"<",
"Long",
",",
"Long",
">",
"testModel",
",",
"final",
"File",
"userRecommendationFile",
",",
"final",
"EvaluationStrategy",
"<",
"Long",
",",
"Long",
">",
"strategy",
",",
"final",
... | Runs a particular strategy on some data using pre-computed
recommendations and outputs the result into a file.
@param testModel The test split
@param userRecommendationFile The file where recommendations are stored
@param strategy The strategy to be used
@param format The format of the output
@param rankingFile The fi... | [
"Runs",
"a",
"particular",
"strategy",
"on",
"some",
"data",
"using",
"pre",
"-",
"computed",
"recommendations",
"and",
"outputs",
"the",
"result",
"into",
"a",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunnerInfile.java#L190-L231 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticalSignificance.java | StatisticalSignificance.getPValue | public double getPValue(final String method) {
double p = Double.NaN;
if ("t".equals(method)) {
double[] baselineValues = new double[baselineMetricPerDimension.values().size()];
int i = 0;
for (Double d : baselineMetricPerDimension.values()) {
baselin... | java | public double getPValue(final String method) {
double p = Double.NaN;
if ("t".equals(method)) {
double[] baselineValues = new double[baselineMetricPerDimension.values().size()];
int i = 0;
for (Double d : baselineMetricPerDimension.values()) {
baselin... | [
"public",
"double",
"getPValue",
"(",
"final",
"String",
"method",
")",
"{",
"double",
"p",
"=",
"Double",
".",
"NaN",
";",
"if",
"(",
"\"t\"",
".",
"equals",
"(",
"method",
")",
")",
"{",
"double",
"[",
"]",
"baselineValues",
"=",
"new",
"double",
"... | Gets the p-value according to the requested method.
@param method one of "t", "pairedT", "wilcoxon"
@return the p-value according to the requested method | [
"Gets",
"the",
"p",
"-",
"value",
"according",
"to",
"the",
"requested",
"method",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticalSignificance.java#L67-L107 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/CompletePipelineInMemory.java | CompletePipelineInMemory.fillDefaultProperties | private static void fillDefaultProperties(final Properties props) {
System.out.println("Setting default properties...");
// parser
props.put(ParserRunner.DATASET_FILE, "./data/ml-100k/ml-100k/u.data");
props.put(ParserRunner.DATASET_PARSER, "net.recommenders.rival.split.parser.MovielensP... | java | private static void fillDefaultProperties(final Properties props) {
System.out.println("Setting default properties...");
// parser
props.put(ParserRunner.DATASET_FILE, "./data/ml-100k/ml-100k/u.data");
props.put(ParserRunner.DATASET_PARSER, "net.recommenders.rival.split.parser.MovielensP... | [
"private",
"static",
"void",
"fillDefaultProperties",
"(",
"final",
"Properties",
"props",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Setting default properties...\"",
")",
";",
"// parser",
"props",
".",
"put",
"(",
"ParserRunner",
".",
"DATASET_FILE... | Fills a property mapping with default values.
@param props mapping where the default properties will be set. | [
"Fills",
"a",
"property",
"mapping",
"with",
"default",
"values",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/CompletePipelineInMemory.java#L64-L128 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java | NDCG.compute | @Override
public void compute() {
if (!Double.isNaN(getValue())) {
// since the data cannot change, avoid re-doing the calculations
return;
}
iniCompute();
Map<U, List<Pair<I, Double>>> data = processDataAsRankedTestRelevance();
userDcgAtCutoff = new ... | java | @Override
public void compute() {
if (!Double.isNaN(getValue())) {
// since the data cannot change, avoid re-doing the calculations
return;
}
iniCompute();
Map<U, List<Pair<I, Double>>> data = processDataAsRankedTestRelevance();
userDcgAtCutoff = new ... | [
"@",
"Override",
"public",
"void",
"compute",
"(",
")",
"{",
"if",
"(",
"!",
"Double",
".",
"isNaN",
"(",
"getValue",
"(",
")",
")",
")",
"{",
"// since the data cannot change, avoid re-doing the calculations",
"return",
";",
"}",
"iniCompute",
"(",
")",
";",
... | Computes the global NDCG by first summing the NDCG for each user and then
averaging by the number of users. | [
"Computes",
"the",
"global",
"NDCG",
"by",
"first",
"summing",
"the",
"NDCG",
"for",
"each",
"user",
"and",
"then",
"averaging",
"by",
"the",
"number",
"of",
"users",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java#L110-L168 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java | NDCG.computeDCG | protected double computeDCG(final double rel, final int rank) {
double dcg = 0.0;
if (rel >= getRelevanceThreshold()) {
switch (type) {
default:
case EXP:
dcg = (Math.pow(2.0, rel) - 1.0) / (Math.log(rank + 1) / Math.log(2));
... | java | protected double computeDCG(final double rel, final int rank) {
double dcg = 0.0;
if (rel >= getRelevanceThreshold()) {
switch (type) {
default:
case EXP:
dcg = (Math.pow(2.0, rel) - 1.0) / (Math.log(rank + 1) / Math.log(2));
... | [
"protected",
"double",
"computeDCG",
"(",
"final",
"double",
"rel",
",",
"final",
"int",
"rank",
")",
"{",
"double",
"dcg",
"=",
"0.0",
";",
"if",
"(",
"rel",
">=",
"getRelevanceThreshold",
"(",
")",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"default"... | Method that computes the discounted cumulative gain of a specific item,
taking into account its ranking in a user's list and its relevance value.
@param rel the item's relevance
@param rank the item's rank in a user's list (sorted by predicted rating)
@return the dcg of the item | [
"Method",
"that",
"computes",
"the",
"discounted",
"cumulative",
"gain",
"of",
"a",
"specific",
"item",
"taking",
"into",
"account",
"its",
"ranking",
"in",
"a",
"user",
"s",
"list",
"and",
"its",
"relevance",
"value",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java#L178-L198 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java | NDCG.getValueAt | @Override
public double getValueAt(final int at) {
if (userDcgAtCutoff.containsKey(at) && userIdcgAtCutoff.containsKey(at)) {
int n = 0;
double ndcg = 0.0;
for (U u : userIdcgAtCutoff.get(at).keySet()) {
double udcg = getValueAt(u, at);
if ... | java | @Override
public double getValueAt(final int at) {
if (userDcgAtCutoff.containsKey(at) && userIdcgAtCutoff.containsKey(at)) {
int n = 0;
double ndcg = 0.0;
for (U u : userIdcgAtCutoff.get(at).keySet()) {
double udcg = getValueAt(u, at);
if ... | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userDcgAtCutoff",
".",
"containsKey",
"(",
"at",
")",
"&&",
"userIdcgAtCutoff",
".",
"containsKey",
"(",
"at",
")",
")",
"{",
"int",
"n",
"=",
"0",
";",... | Method to return the NDCG value at a particular cutoff level.
@param at cutoff level
@return the NDCG corresponding to the requested cutoff level | [
"Method",
"to",
"return",
"the",
"NDCG",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java#L250-L270 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java | NDCG.getValueAt | @Override
public double getValueAt(final U user, final int at) {
if (userDcgAtCutoff.containsKey(at) && userDcgAtCutoff.get(at).containsKey(user)
&& userIdcgAtCutoff.containsKey(at) && userIdcgAtCutoff.get(at).containsKey(user)) {
double idcg = userIdcgAtCutoff.get(at).get(user);... | java | @Override
public double getValueAt(final U user, final int at) {
if (userDcgAtCutoff.containsKey(at) && userDcgAtCutoff.get(at).containsKey(user)
&& userIdcgAtCutoff.containsKey(at) && userIdcgAtCutoff.get(at).containsKey(user)) {
double idcg = userIdcgAtCutoff.get(at).get(user);... | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"U",
"user",
",",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userDcgAtCutoff",
".",
"containsKey",
"(",
"at",
")",
"&&",
"userDcgAtCutoff",
".",
"get",
"(",
"at",
")",
".",
"containsKey",
... | Method to return the NDCG value at a particular cutoff level for a given
user.
@param user the user
@param at cutoff level
@return the NDCG corresponding to the requested user at the cutoff level | [
"Method",
"to",
"return",
"the",
"NDCG",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"for",
"a",
"given",
"user",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java#L280-L289 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/GenericRecommenderBuilder.java | GenericRecommenderBuilder.buildRecommender | public Recommender buildRecommender(final DataModel dataModel, final String recType)
throws RecommenderException {
return buildRecommender(dataModel, recType, null, DEFAULT_N, NOFACTORS, NOITER, null);
} | java | public Recommender buildRecommender(final DataModel dataModel, final String recType)
throws RecommenderException {
return buildRecommender(dataModel, recType, null, DEFAULT_N, NOFACTORS, NOITER, null);
} | [
"public",
"Recommender",
"buildRecommender",
"(",
"final",
"DataModel",
"dataModel",
",",
"final",
"String",
"recType",
")",
"throws",
"RecommenderException",
"{",
"return",
"buildRecommender",
"(",
"dataModel",
",",
"recType",
",",
"null",
",",
"DEFAULT_N",
",",
... | CF recommender with default parameters.
@param dataModel the data model
@param recType the recommender type (as Mahout class)
@return the recommender
@throws RecommenderException see {@link #buildRecommender(org.apache.mahout.cf.taste.model.DataModel, java.lang.String, java.lang.String, int, int, int, java.lang.String... | [
"CF",
"recommender",
"with",
"default",
"parameters",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/mahout/GenericRecommenderBuilder.java#L77-L80 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/SimpleParser.java | SimpleParser.parseData | public TemporalDataModelIF<Long, Long> parseData(final File f, final String token, final boolean isTemporal) throws IOException {
TemporalDataModelIF<Long, Long> dataset = DataModelFactory.getDefaultTemporalModel();
BufferedReader br = SimpleParser.getBufferedReader(f);
String line = br.readLin... | java | public TemporalDataModelIF<Long, Long> parseData(final File f, final String token, final boolean isTemporal) throws IOException {
TemporalDataModelIF<Long, Long> dataset = DataModelFactory.getDefaultTemporalModel();
BufferedReader br = SimpleParser.getBufferedReader(f);
String line = br.readLin... | [
"public",
"TemporalDataModelIF",
"<",
"Long",
",",
"Long",
">",
"parseData",
"(",
"final",
"File",
"f",
",",
"final",
"String",
"token",
",",
"final",
"boolean",
"isTemporal",
")",
"throws",
"IOException",
"{",
"TemporalDataModelIF",
"<",
"Long",
",",
"Long",
... | Parses a data file with a specific separator between fields.
@param f The file to be parsed.
@param token The separator to be used.
@param isTemporal A flag indicating if the file contains temporal
information.
@return A dataset created from the file.
@throws IOException if the file cannot be read. | [
"Parses",
"a",
"data",
"file",
"with",
"a",
"specific",
"separator",
"between",
"fields",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/SimpleParser.java#L75-L89 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/DataDownloader.java | DataDownloader.download | public void download() {
URL dataURL = null;
String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1);
if (new File(fileName).exists()) {
return;
}
try {
dataURL = new URL(url);
} catch (MalformedURLException e) {
e.prin... | java | public void download() {
URL dataURL = null;
String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1);
if (new File(fileName).exists()) {
return;
}
try {
dataURL = new URL(url);
} catch (MalformedURLException e) {
e.prin... | [
"public",
"void",
"download",
"(",
")",
"{",
"URL",
"dataURL",
"=",
"null",
";",
"String",
"fileName",
"=",
"folder",
"+",
"\"/\"",
"+",
"url",
".",
"substring",
"(",
"url",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
"+",
"1",
")",
";",
"if",
"(",
"new... | Downloads the file from the provided url. | [
"Downloads",
"the",
"file",
"from",
"the",
"provided",
"url",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/DataDownloader.java#L68-L87 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/DataDownloader.java | DataDownloader.downloadAndUnzip | public void downloadAndUnzip() {
URL dataURL = null;
String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1);
File compressedData = new File(fileName);
if (!new File(fileName).exists()) {
try {
dataURL = new URL(url);
} catch (Malf... | java | public void downloadAndUnzip() {
URL dataURL = null;
String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1);
File compressedData = new File(fileName);
if (!new File(fileName).exists()) {
try {
dataURL = new URL(url);
} catch (Malf... | [
"public",
"void",
"downloadAndUnzip",
"(",
")",
"{",
"URL",
"dataURL",
"=",
"null",
";",
"String",
"fileName",
"=",
"folder",
"+",
"\"/\"",
"+",
"url",
".",
"substring",
"(",
"url",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
"+",
"1",
")",
";",
"File",
"... | Downloads the file from the provided url and uncompresses it to the given
folder. | [
"Downloads",
"the",
"file",
"from",
"the",
"provided",
"url",
"and",
"uncompresses",
"it",
"to",
"the",
"given",
"folder",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/DataDownloader.java#L93-L117 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/CrossValidatedMahoutKNNRecommenderEvaluator.java | CrossValidatedMahoutKNNRecommenderEvaluator.recommend | public static void recommend(final int nFolds, final String inPath, final String outPath) {
for (int i = 0; i < nFolds; i++) {
org.apache.mahout.cf.taste.model.DataModel trainModel;
org.apache.mahout.cf.taste.model.DataModel testModel;
try {
trainModel = new F... | java | public static void recommend(final int nFolds, final String inPath, final String outPath) {
for (int i = 0; i < nFolds; i++) {
org.apache.mahout.cf.taste.model.DataModel trainModel;
org.apache.mahout.cf.taste.model.DataModel testModel;
try {
trainModel = new F... | [
"public",
"static",
"void",
"recommend",
"(",
"final",
"int",
"nFolds",
",",
"final",
"String",
"inPath",
",",
"final",
"String",
"outPath",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nFolds",
";",
"i",
"++",
")",
"{",
"org",
".",
... | Recommends using an UB algorithm.
@param nFolds number of folds
@param inPath path where training and test models have been stored
@param outPath path where recommendation files will be stored | [
"Recommends",
"using",
"an",
"UB",
"algorithm",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/CrossValidatedMahoutKNNRecommenderEvaluator.java#L156-L202 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/CrossValidatedMahoutKNNRecommenderEvaluator.java | CrossValidatedMahoutKNNRecommenderEvaluator.evaluate | public static void evaluate(final int nFolds, final String splitPath, final String recPath) {
double ndcgRes = 0.0;
double precisionRes = 0.0;
double rmseRes = 0.0;
for (int i = 0; i < nFolds; i++) {
File testFile = new File(splitPath + "test_" + i + ".csv");
File... | java | public static void evaluate(final int nFolds, final String splitPath, final String recPath) {
double ndcgRes = 0.0;
double precisionRes = 0.0;
double rmseRes = 0.0;
for (int i = 0; i < nFolds; i++) {
File testFile = new File(splitPath + "test_" + i + ".csv");
File... | [
"public",
"static",
"void",
"evaluate",
"(",
"final",
"int",
"nFolds",
",",
"final",
"String",
"splitPath",
",",
"final",
"String",
"recPath",
")",
"{",
"double",
"ndcgRes",
"=",
"0.0",
";",
"double",
"precisionRes",
"=",
"0.0",
";",
"double",
"rmseRes",
"... | Evaluates the recommendations generated in previous steps.
@param nFolds number of folds
@param splitPath path where splits have been stored
@param recPath path where recommendation files have been stored | [
"Evaluates",
"the",
"recommendations",
"generated",
"in",
"previous",
"steps",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/CrossValidatedMahoutKNNRecommenderEvaluator.java#L265-L296 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticsRunner.java | StatisticsRunner.run | public static void run(final Properties properties) throws IOException {
// read parameters for output (do this at the beginning to avoid unnecessary reading)
File outputFile = new File(properties.getProperty(OUTPUT_FILE));
Boolean overwrite = Boolean.parseBoolean(properties.getProperty(OUTPUT_O... | java | public static void run(final Properties properties) throws IOException {
// read parameters for output (do this at the beginning to avoid unnecessary reading)
File outputFile = new File(properties.getProperty(OUTPUT_FILE));
Boolean overwrite = Boolean.parseBoolean(properties.getProperty(OUTPUT_O... | [
"public",
"static",
"void",
"run",
"(",
"final",
"Properties",
"properties",
")",
"throws",
"IOException",
"{",
"// read parameters for output (do this at the beginning to avoid unnecessary reading)",
"File",
"outputFile",
"=",
"new",
"File",
"(",
"properties",
".",
"getPro... | Run all the statistic functions included in the properties mapping.
@param properties The properties to be executed.
@throws IOException when a file cannot be parsed | [
"Run",
"all",
"the",
"statistic",
"functions",
"included",
"in",
"the",
"properties",
"mapping",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticsRunner.java#L107-L145 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticsRunner.java | StatisticsRunner.readLine | public static void readLine(final String format, final String line, final Map<String, Map<String, Double>> mapMetricUserValue, final Set<String> usersToAvoid) {
String[] toks = line.split("\t");
// default (also trec_eval) format: metric \t user|all \t value
if (format.equals("default")) {
... | java | public static void readLine(final String format, final String line, final Map<String, Map<String, Double>> mapMetricUserValue, final Set<String> usersToAvoid) {
String[] toks = line.split("\t");
// default (also trec_eval) format: metric \t user|all \t value
if (format.equals("default")) {
... | [
"public",
"static",
"void",
"readLine",
"(",
"final",
"String",
"format",
",",
"final",
"String",
"line",
",",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Double",
">",
">",
"mapMetricUserValue",
",",
"final",
"Set",
"<",
"String",
">... | Read a line from the metric file.
@param format The format of the file.
@param line The line.
@param mapMetricUserValue Map where metric values for each user will be
stored.
@param usersToAvoid User ids to be avoided in the subsequent significance
testing (e.g., 'all') | [
"Read",
"a",
"line",
"from",
"the",
"metric",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/StatisticsRunner.java#L263-L280 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunner.java | StrategyRunner.run | public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
// read splits
System.out.println("Parsing started: training file");
File trainingFile = ... | java | public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
// read splits
System.out.println("Parsing started: training file");
File trainingFile = ... | [
"public",
"static",
"void",
"run",
"(",
"final",
"Properties",
"properties",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
"{",
"//... | Runs a single evaluation strategy.
@param properties The properties of the strategy.
@throws IOException when a file cannot be parsed
@throws ClassNotFoundException see {@link #instantiateStrategy(java.util.Properties, net.recommenders.rival.core.DataModelIF, net.recommenders.rival.core.DataModelIF)}
@throws IllegalAc... | [
"Runs",
"a",
"single",
"evaluation",
"strategy",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunner.java#L127-L166 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunner.java | StrategyRunner.instantiateStrategy | public static EvaluationStrategy<Long, Long> instantiateStrategy(final Properties properties, final DataModelIF<Long, Long> trainingModel, final DataModelIF<Long, Long> testModel)
throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException ... | java | public static EvaluationStrategy<Long, Long> instantiateStrategy(final Properties properties, final DataModelIF<Long, Long> trainingModel, final DataModelIF<Long, Long> testModel)
throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException ... | [
"public",
"static",
"EvaluationStrategy",
"<",
"Long",
",",
"Long",
">",
"instantiateStrategy",
"(",
"final",
"Properties",
"properties",
",",
"final",
"DataModelIF",
"<",
"Long",
",",
"Long",
">",
"trainingModel",
",",
"final",
"DataModelIF",
"<",
"Long",
",",
... | Instantiates an strategy, according to the provided properties mapping.
@param properties the properties to be used.
@param trainingModel datamodel containing the training interactions to be
considered when generating the strategy.
@param testModel datamodel containing the interactions in the test split
to be consider... | [
"Instantiates",
"an",
"strategy",
"according",
"to",
"the",
"provided",
"properties",
"mapping",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyRunner.java#L188-L208 | train |
recommenders/rival | rival-split/src/main/java/net/recommenders/rival/split/parser/ParserRunner.java | ParserRunner.run | public static TemporalDataModelIF<Long, Long> run(final Properties properties) throws ClassNotFoundException, IllegalAccessException,
InstantiationException, InvocationTargetException, NoSuchMethodException, IOException {
System.out.println("Parsing started");
TemporalDataModelIF<Long, Long>... | java | public static TemporalDataModelIF<Long, Long> run(final Properties properties) throws ClassNotFoundException, IllegalAccessException,
InstantiationException, InvocationTargetException, NoSuchMethodException, IOException {
System.out.println("Parsing started");
TemporalDataModelIF<Long, Long>... | [
"public",
"static",
"TemporalDataModelIF",
"<",
"Long",
",",
"Long",
">",
"run",
"(",
"final",
"Properties",
"properties",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"InvocationTargetException",
",",
"NoSu... | Run the parser based on given properties.
@param properties The properties
@return The data model parsed by the parser.
@throws ClassNotFoundException when {@link Class#forName(java.lang.String)}
fails
@throws IllegalAccessException when {@link java.lang.reflect.Method#invoke(java.lang.Object, java.lang.Object[])}
fai... | [
"Run",
"the",
"parser",
"based",
"on",
"given",
"properties",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-split/src/main/java/net/recommenders/rival/split/parser/ParserRunner.java#L73-L94 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/AbstractStrategy.java | AbstractStrategy.getModelTrainingDifference | protected Set<Long> getModelTrainingDifference(final DataModelIF<Long, Long> model, final Long user) {
final Set<Long> items = new HashSet<Long>();
if (training.getUserItems(user) != null) {
final Set<Long> trainingItems = new HashSet<>();
for (Long i : training.getUserItems(user... | java | protected Set<Long> getModelTrainingDifference(final DataModelIF<Long, Long> model, final Long user) {
final Set<Long> items = new HashSet<Long>();
if (training.getUserItems(user) != null) {
final Set<Long> trainingItems = new HashSet<>();
for (Long i : training.getUserItems(user... | [
"protected",
"Set",
"<",
"Long",
">",
"getModelTrainingDifference",
"(",
"final",
"DataModelIF",
"<",
"Long",
",",
"Long",
">",
"model",
",",
"final",
"Long",
"user",
")",
"{",
"final",
"Set",
"<",
"Long",
">",
"items",
"=",
"new",
"HashSet",
"<",
"Long"... | Get the items appearing in the training set and not in the data model.
@param model The data model.
@param user The user.
@return The items not appearing in the training set. | [
"Get",
"the",
"items",
"appearing",
"in",
"the",
"training",
"set",
"and",
"not",
"in",
"the",
"data",
"model",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/AbstractStrategy.java#L97-L111 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/AbstractStrategy.java | AbstractStrategy.printRanking | protected void printRanking(final String user, final Map<Long, Double> scoredItems, final PrintStream out, final OUTPUT_FORMAT format) {
final Map<Double, Set<Long>> preferenceMap = new HashMap<Double, Set<Long>>();
for (Map.Entry<Long, Double> e : scoredItems.entrySet()) {
long item = e.get... | java | protected void printRanking(final String user, final Map<Long, Double> scoredItems, final PrintStream out, final OUTPUT_FORMAT format) {
final Map<Double, Set<Long>> preferenceMap = new HashMap<Double, Set<Long>>();
for (Map.Entry<Long, Double> e : scoredItems.entrySet()) {
long item = e.get... | [
"protected",
"void",
"printRanking",
"(",
"final",
"String",
"user",
",",
"final",
"Map",
"<",
"Long",
",",
"Double",
">",
"scoredItems",
",",
"final",
"PrintStream",
"out",
",",
"final",
"OUTPUT_FORMAT",
"format",
")",
"{",
"final",
"Map",
"<",
"Double",
... | Print the item ranking and scores for a specific user.
@param user The user (as a String).
@param scoredItems The item to print rankings for.
@param out Where to direct the print.
@param format The format of the printer. | [
"Print",
"the",
"item",
"ranking",
"and",
"scores",
"for",
"a",
"specific",
"user",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/AbstractStrategy.java#L133-L167 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/DataModelUtils.java | DataModelUtils.saveDataModel | public static <U, I> void saveDataModel(final DataModelIF<U, I> dm, final String outfile, final boolean overwrite, final String delimiter)
throws FileNotFoundException, UnsupportedEncodingException {
if (new File(outfile).exists() && !overwrite) {
System.out.println("Ignoring " + outfile... | java | public static <U, I> void saveDataModel(final DataModelIF<U, I> dm, final String outfile, final boolean overwrite, final String delimiter)
throws FileNotFoundException, UnsupportedEncodingException {
if (new File(outfile).exists() && !overwrite) {
System.out.println("Ignoring " + outfile... | [
"public",
"static",
"<",
"U",
",",
"I",
">",
"void",
"saveDataModel",
"(",
"final",
"DataModelIF",
"<",
"U",
",",
"I",
">",
"dm",
",",
"final",
"String",
"outfile",
",",
"final",
"boolean",
"overwrite",
",",
"final",
"String",
"delimiter",
")",
"throws",... | Method that saves a data model to a file.
@param dm the data model
@param outfile file where the model will be saved
@param overwrite flag that indicates if the file should be overwritten
@param delimiter field delimiter
@param <U> type of users
@param <I> type of items
@throws FileNotFoundException when outfile canno... | [
"Method",
"that",
"saves",
"a",
"data",
"model",
"to",
"a",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/DataModelUtils.java#L49-L63 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/DataModelUtils.java | DataModelUtils.saveDataModel | public static <U, I> void saveDataModel(final TemporalDataModelIF<U, I> dm, final String outfile, final boolean overwrite, String delimiter)
throws FileNotFoundException, UnsupportedEncodingException {
if (new File(outfile).exists() && !overwrite) {
System.out.println("Ignoring " + outfi... | java | public static <U, I> void saveDataModel(final TemporalDataModelIF<U, I> dm, final String outfile, final boolean overwrite, String delimiter)
throws FileNotFoundException, UnsupportedEncodingException {
if (new File(outfile).exists() && !overwrite) {
System.out.println("Ignoring " + outfi... | [
"public",
"static",
"<",
"U",
",",
"I",
">",
"void",
"saveDataModel",
"(",
"final",
"TemporalDataModelIF",
"<",
"U",
",",
"I",
">",
"dm",
",",
"final",
"String",
"outfile",
",",
"final",
"boolean",
"overwrite",
",",
"String",
"delimiter",
")",
"throws",
... | Method that saves a temporal data model to a file.
@param dm the data model
@param outfile file where the model will be saved
@param overwrite flag that indicates if the file should be overwritten
@param delimiter field delimiter
@param <U> type of users
@param <I> type of items
@throws FileNotFoundException when outf... | [
"Method",
"that",
"saves",
"a",
"temporal",
"data",
"model",
"to",
"a",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/DataModelUtils.java#L78-L99 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/AbstractRunner.java | AbstractRunner.setFileName | public void setFileName() {
String type = "";
// lenskit does not provide a factorizer class. This check is to actually see if it's a Mahout or Lenskit SVD.
if (properties.containsKey(RecommendationRunner.FACTORIZER) || properties.containsKey(RecommendationRunner.SIMILARITY)) {
if (p... | java | public void setFileName() {
String type = "";
// lenskit does not provide a factorizer class. This check is to actually see if it's a Mahout or Lenskit SVD.
if (properties.containsKey(RecommendationRunner.FACTORIZER) || properties.containsKey(RecommendationRunner.SIMILARITY)) {
if (p... | [
"public",
"void",
"setFileName",
"(",
")",
"{",
"String",
"type",
"=",
"\"\"",
";",
"// lenskit does not provide a factorizer class. This check is to actually see if it's a Mahout or Lenskit SVD.",
"if",
"(",
"properties",
".",
"containsKey",
"(",
"RecommendationRunner",
".",
... | Create the file name of the output file. | [
"Create",
"the",
"file",
"name",
"of",
"the",
"output",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/AbstractRunner.java#L105-L137 | train |
recommenders/rival | rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/TemporalSplitMahoutKNNRecommenderEvaluator.java | TemporalSplitMahoutKNNRecommenderEvaluator.prepareStrategy | @SuppressWarnings("unchecked")
public static void prepareStrategy(final String splitPath, final String recPath, final String outPath) {
int i = 0;
File trainingFile = new File(splitPath + "train_" + i + ".csv");
File testFile = new File(splitPath + "test_" + i + ".csv");
File recFile... | java | @SuppressWarnings("unchecked")
public static void prepareStrategy(final String splitPath, final String recPath, final String outPath) {
int i = 0;
File trainingFile = new File(splitPath + "train_" + i + ".csv");
File testFile = new File(splitPath + "test_" + i + ".csv");
File recFile... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"prepareStrategy",
"(",
"final",
"String",
"splitPath",
",",
"final",
"String",
"recPath",
",",
"final",
"String",
"outPath",
")",
"{",
"int",
"i",
"=",
"0",
";",
"File",
"traini... | Prepares the strategies to be evaluated with the recommenders already
generated.
@param splitPath path where splits have been stored
@param recPath path where recommendation files have been stored
@param outPath path where the filtered recommendations will be stored | [
"Prepares",
"the",
"strategies",
"to",
"be",
"evaluated",
"with",
"the",
"recommenders",
"already",
"generated",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/TemporalSplitMahoutKNNRecommenderEvaluator.java#L206-L248 | train |
recommenders/rival | rival-split/src/main/java/net/recommenders/rival/split/splitter/SplitterRunner.java | SplitterRunner.run | public static <U, I> void run(final Properties properties, final TemporalDataModelIF<U, I> data, final boolean doDataClear)
throws FileNotFoundException, UnsupportedEncodingException {
System.out.println("Start splitting");
TemporalDataModelIF<U, I>[] splits;
// read parameters
... | java | public static <U, I> void run(final Properties properties, final TemporalDataModelIF<U, I> data, final boolean doDataClear)
throws FileNotFoundException, UnsupportedEncodingException {
System.out.println("Start splitting");
TemporalDataModelIF<U, I>[] splits;
// read parameters
... | [
"public",
"static",
"<",
"U",
",",
"I",
">",
"void",
"run",
"(",
"final",
"Properties",
"properties",
",",
"final",
"TemporalDataModelIF",
"<",
"U",
",",
"I",
">",
"data",
",",
"final",
"boolean",
"doDataClear",
")",
"throws",
"FileNotFoundException",
",",
... | Runs a Splitter instance based on the properties.
@param <U> user identifier type
@param <I> item identifier type
@param properties property file
@param data the data to be split
@param doDataClear flag to clear the memory used for the data before
saving the splits
@throws FileNotFoundException... | [
"Runs",
"a",
"Splitter",
"instance",
"based",
"on",
"the",
"properties",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-split/src/main/java/net/recommenders/rival/split/splitter/SplitterRunner.java#L107-L135 | train |
recommenders/rival | rival-split/src/main/java/net/recommenders/rival/split/splitter/SplitterRunner.java | SplitterRunner.instantiateSplitter | public static <U, I> Splitter<U, I> instantiateSplitter(final Properties properties) {
// read parameters
String splitterClassName = properties.getProperty(DATASET_SPLITTER);
Boolean perUser = Boolean.parseBoolean(properties.getProperty(SPLIT_PERUSER));
Boolean doSplitPerItems = Boolean.... | java | public static <U, I> Splitter<U, I> instantiateSplitter(final Properties properties) {
// read parameters
String splitterClassName = properties.getProperty(DATASET_SPLITTER);
Boolean perUser = Boolean.parseBoolean(properties.getProperty(SPLIT_PERUSER));
Boolean doSplitPerItems = Boolean.... | [
"public",
"static",
"<",
"U",
",",
"I",
">",
"Splitter",
"<",
"U",
",",
"I",
">",
"instantiateSplitter",
"(",
"final",
"Properties",
"properties",
")",
"{",
"// read parameters",
"String",
"splitterClassName",
"=",
"properties",
".",
"getProperty",
"(",
"DATAS... | Instantiates a splitter based on the properties.
@param <U> user identifier type
@param <I> item identifier type
@param properties the properties to be used.
@return a splitter according to the properties mapping provided. | [
"Instantiates",
"a",
"splitter",
"based",
"on",
"the",
"properties",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-split/src/main/java/net/recommenders/rival/split/splitter/SplitterRunner.java#L145-L170 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/TemporalDataModel.java | TemporalDataModel.getUserItemTimestamps | @Override
public Iterable<Long> getUserItemTimestamps(U u, I i) {
if (userItemTimestamps.containsKey(u) && userItemTimestamps.get(u).containsKey(i)) {
return userItemTimestamps.get(u).get(i);
}
return null;
} | java | @Override
public Iterable<Long> getUserItemTimestamps(U u, I i) {
if (userItemTimestamps.containsKey(u) && userItemTimestamps.get(u).containsKey(i)) {
return userItemTimestamps.get(u).get(i);
}
return null;
} | [
"@",
"Override",
"public",
"Iterable",
"<",
"Long",
">",
"getUserItemTimestamps",
"(",
"U",
"u",
",",
"I",
"i",
")",
"{",
"if",
"(",
"userItemTimestamps",
".",
"containsKey",
"(",
"u",
")",
"&&",
"userItemTimestamps",
".",
"get",
"(",
"u",
")",
".",
"c... | Method that returns the map with the timestamps between users and items.
@return the map with the timestamps between users and items. | [
"Method",
"that",
"returns",
"the",
"map",
"with",
"the",
"timestamps",
"between",
"users",
"and",
"items",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/TemporalDataModel.java#L80-L86 | train |
recommenders/rival | rival-core/src/main/java/net/recommenders/rival/core/TemporalDataModel.java | TemporalDataModel.addTimestamp | @Override
public void addTimestamp(final U u, final I i, final Long t) {
Map<I, Set<Long>> userTimestamps = userItemTimestamps.get(u);
if (userTimestamps == null) {
userTimestamps = new HashMap<>();
userItemTimestamps.put(u, userTimestamps);
}
Set<Long> timest... | java | @Override
public void addTimestamp(final U u, final I i, final Long t) {
Map<I, Set<Long>> userTimestamps = userItemTimestamps.get(u);
if (userTimestamps == null) {
userTimestamps = new HashMap<>();
userItemTimestamps.put(u, userTimestamps);
}
Set<Long> timest... | [
"@",
"Override",
"public",
"void",
"addTimestamp",
"(",
"final",
"U",
"u",
",",
"final",
"I",
"i",
",",
"final",
"Long",
"t",
")",
"{",
"Map",
"<",
"I",
",",
"Set",
"<",
"Long",
">",
">",
"userTimestamps",
"=",
"userItemTimestamps",
".",
"get",
"(",
... | Method that adds a timestamp to the model between a user and an item.
@param u the user.
@param i the item.
@param t the timestamp. | [
"Method",
"that",
"adds",
"a",
"timestamp",
"to",
"the",
"model",
"between",
"a",
"user",
"and",
"an",
"item",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-core/src/main/java/net/recommenders/rival/core/TemporalDataModel.java#L95-L108 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyIO.java | StrategyIO.readLine | public static void readLine(final String line, final Map<Long, List<Pair<Long, Double>>> mapUserRecommendations) {
String[] toks = line.split("\t");
// mymedialite format: user \t [item:score,item:score,...]
if (line.contains(":") && line.contains(",")) {
Long user = Long.parseLong(t... | java | public static void readLine(final String line, final Map<Long, List<Pair<Long, Double>>> mapUserRecommendations) {
String[] toks = line.split("\t");
// mymedialite format: user \t [item:score,item:score,...]
if (line.contains(":") && line.contains(",")) {
Long user = Long.parseLong(t... | [
"public",
"static",
"void",
"readLine",
"(",
"final",
"String",
"line",
",",
"final",
"Map",
"<",
"Long",
",",
"List",
"<",
"Pair",
"<",
"Long",
",",
"Double",
">",
">",
">",
"mapUserRecommendations",
")",
"{",
"String",
"[",
"]",
"toks",
"=",
"line",
... | Read a file from the recommended items file.
@param line The line.
@param mapUserRecommendations The recommendations for the users where
information will be stored into. | [
"Read",
"a",
"file",
"from",
"the",
"recommended",
"items",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyIO.java#L43-L71 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/AbstractRankingMetric.java | AbstractRankingMetric.getNumberOfRelevantItems | protected double getNumberOfRelevantItems(final U user) {
int n = 0;
if (getTest().getUserItems(user) != null) {
for (I i : getTest().getUserItems(user)) {
if (getTest().getUserItemPreference(user, i) >= relevanceThreshold) {
n++;
}
... | java | protected double getNumberOfRelevantItems(final U user) {
int n = 0;
if (getTest().getUserItems(user) != null) {
for (I i : getTest().getUserItems(user)) {
if (getTest().getUserItemPreference(user, i) >= relevanceThreshold) {
n++;
}
... | [
"protected",
"double",
"getNumberOfRelevantItems",
"(",
"final",
"U",
"user",
")",
"{",
"int",
"n",
"=",
"0",
";",
"if",
"(",
"getTest",
"(",
")",
".",
"getUserItems",
"(",
"user",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"I",
"i",
":",
"getTest",
... | Method that computes the number of relevant items in the test set for a
user.
@param user a user
@return the number of relevant items the user has in the test set | [
"Method",
"that",
"computes",
"the",
"number",
"of",
"relevant",
"items",
"in",
"the",
"test",
"set",
"for",
"a",
"user",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/AbstractRankingMetric.java#L131-L141 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/Precision.java | Precision.getValueAt | @Override
public double getValueAt(final int at) {
if (userPrecAtCutoff.containsKey(at)) {
int n = 0;
double prec = 0.0;
for (U u : userPrecAtCutoff.get(at).keySet()) {
double uprec = getValueAt(u, at);
if (!Double.isNaN(uprec)) {
... | java | @Override
public double getValueAt(final int at) {
if (userPrecAtCutoff.containsKey(at)) {
int n = 0;
double prec = 0.0;
for (U u : userPrecAtCutoff.get(at).keySet()) {
double uprec = getValueAt(u, at);
if (!Double.isNaN(uprec)) {
... | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userPrecAtCutoff",
".",
"containsKey",
"(",
"at",
")",
")",
"{",
"int",
"n",
"=",
"0",
";",
"double",
"prec",
"=",
"0.0",
";",
"for",
"(",
"U",
"u",... | Method to return the precision value at a particular cutoff level.
@param at cutoff level
@return the precision corresponding to the requested cutoff level | [
"Method",
"to",
"return",
"the",
"precision",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/Precision.java#L140-L160 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/error/AbstractErrorMetric.java | AbstractErrorMetric.considerEstimatedPreference | public static double considerEstimatedPreference(final ErrorStrategy errorStrategy, final double recValue) {
boolean consider = true;
double v = recValue;
switch (errorStrategy) {
default:
case CONSIDER_EVERYTHING:
break;
case NOT_CONSIDER_NAN:... | java | public static double considerEstimatedPreference(final ErrorStrategy errorStrategy, final double recValue) {
boolean consider = true;
double v = recValue;
switch (errorStrategy) {
default:
case CONSIDER_EVERYTHING:
break;
case NOT_CONSIDER_NAN:... | [
"public",
"static",
"double",
"considerEstimatedPreference",
"(",
"final",
"ErrorStrategy",
"errorStrategy",
",",
"final",
"double",
"recValue",
")",
"{",
"boolean",
"consider",
"=",
"true",
";",
"double",
"v",
"=",
"recValue",
";",
"switch",
"(",
"errorStrategy",... | Method that returns an estimated preference according to a given value
and an error strategy.
@param errorStrategy the error strategy
@param recValue the predicted value by the recommender
@return an estimated preference according to the provided strategy | [
"Method",
"that",
"returns",
"an",
"estimated",
"preference",
"according",
"to",
"a",
"given",
"value",
"and",
"an",
"error",
"strategy",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/error/AbstractErrorMetric.java#L159-L190 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/MAP.java | MAP.getValueAt | @Override
public double getValueAt(final int at) {
if (userMAPAtCutoff.containsKey(at)) {
int n = 0;
double map = 0.0;
for (U u : userMAPAtCutoff.get(at).keySet()) {
double uMAP = getValueAt(u, at);
if (!Double.isNaN(uMAP)) {
... | java | @Override
public double getValueAt(final int at) {
if (userMAPAtCutoff.containsKey(at)) {
int n = 0;
double map = 0.0;
for (U u : userMAPAtCutoff.get(at).keySet()) {
double uMAP = getValueAt(u, at);
if (!Double.isNaN(uMAP)) {
... | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userMAPAtCutoff",
".",
"containsKey",
"(",
"at",
")",
")",
"{",
"int",
"n",
"=",
"0",
";",
"double",
"map",
"=",
"0.0",
";",
"for",
"(",
"U",
"u",
... | Method to return the MAP value at a particular cutoff level.
@param at cutoff level
@return the MAP corresponding to the requested cutoff level | [
"Method",
"to",
"return",
"the",
"MAP",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/MAP.java#L147-L167 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java | MultipleEvaluationMetricRunner.run | @SuppressWarnings("unchecked")
public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
EvaluationStrategy.OUTPUT_FORMAT recFormat;
if (properties.get... | java | @SuppressWarnings("unchecked")
public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
EvaluationStrategy.OUTPUT_FORMAT recFormat;
if (properties.get... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"run",
"(",
"final",
"Properties",
"properties",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"InvocationTa... | Runs multiple evaluation metrics.
@param properties The properties of the strategy.
@throws IOException if test file or prediction file are not found or
output cannot be generated (see {@link net.recommenders.rival.core.Parser#parseData(java.io.File)}
and {@link EvaluationMetricRunner#generateOutput(net.recommenders.r... | [
"Runs",
"multiple",
"evaluation",
"metrics",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java#L136-L186 | train |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java | MultipleEvaluationMetricRunner.getAllPredictionFiles | public static void getAllPredictionFiles(final Set<String> predictionFiles, final File path, final String predictionPrefix) {
if (path == null) {
return;
}
File[] files = path.listFiles();
if (files == null) {
return;
}
for (File file : files) {
... | java | public static void getAllPredictionFiles(final Set<String> predictionFiles, final File path, final String predictionPrefix) {
if (path == null) {
return;
}
File[] files = path.listFiles();
if (files == null) {
return;
}
for (File file : files) {
... | [
"public",
"static",
"void",
"getAllPredictionFiles",
"(",
"final",
"Set",
"<",
"String",
">",
"predictionFiles",
",",
"final",
"File",
"path",
",",
"final",
"String",
"predictionPrefix",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
";",
"... | Gets all prediction files.
@param predictionFiles The prediction files.
@param path The path where the splits are.
@param predictionPrefix The prefix of the prediction files. | [
"Gets",
"all",
"prediction",
"files",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java#L231-L246 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java | RecommendationRunner.main | public static void main(final String[] args) {
String propertyFile = System.getProperty("file");
if (propertyFile == null) {
System.out.println("Property file not given, exiting.");
System.exit(0);
}
final Properties properties = new Properties();
try {
... | java | public static void main(final String[] args) {
String propertyFile = System.getProperty("file");
if (propertyFile == null) {
System.out.println("Property file not given, exiting.");
System.exit(0);
}
final Properties properties = new Properties();
try {
... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"{",
"String",
"propertyFile",
"=",
"System",
".",
"getProperty",
"(",
"\"file\"",
")",
";",
"if",
"(",
"propertyFile",
"==",
"null",
")",
"{",
"System",
".",
"out",
"."... | Main method for running a recommendation.
@param args CLI arguments | [
"Main",
"method",
"for",
"running",
"a",
"recommendation",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java#L121-L136 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java | RecommendationRunner.run | public static void run(final AbstractRunner rr) {
time = System.currentTimeMillis();
boolean statsExist = false;
statPath = rr.getCanonicalFileName();
statsExist = rr.isAlreadyRecommended();
try {
rr.run(AbstractRunner.RUN_OPTIONS.OUTPUT_RECS);
} catch (Except... | java | public static void run(final AbstractRunner rr) {
time = System.currentTimeMillis();
boolean statsExist = false;
statPath = rr.getCanonicalFileName();
statsExist = rr.isAlreadyRecommended();
try {
rr.run(AbstractRunner.RUN_OPTIONS.OUTPUT_RECS);
} catch (Except... | [
"public",
"static",
"void",
"run",
"(",
"final",
"AbstractRunner",
"rr",
")",
"{",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"statsExist",
"=",
"false",
";",
"statPath",
"=",
"rr",
".",
"getCanonicalFileName",
"(",
")",
";"... | Run recommendations based on an already instantiated recommender.
@param rr abstract recommender already initialized | [
"Run",
"recommendations",
"based",
"on",
"an",
"already",
"instantiated",
"recommender",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java#L153-L167 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java | RecommendationRunner.instantiateRecommender | public static AbstractRunner<Long, Long> instantiateRecommender(final Properties properties) {
if (properties.getProperty(RECOMMENDER) == null) {
System.out.println("No recommenderClass specified, exiting.");
return null;
}
if (properties.getProperty(TRAINING_SET) == null... | java | public static AbstractRunner<Long, Long> instantiateRecommender(final Properties properties) {
if (properties.getProperty(RECOMMENDER) == null) {
System.out.println("No recommenderClass specified, exiting.");
return null;
}
if (properties.getProperty(TRAINING_SET) == null... | [
"public",
"static",
"AbstractRunner",
"<",
"Long",
",",
"Long",
">",
"instantiateRecommender",
"(",
"final",
"Properties",
"properties",
")",
"{",
"if",
"(",
"properties",
".",
"getProperty",
"(",
"RECOMMENDER",
")",
"==",
"null",
")",
"{",
"System",
".",
"o... | Instantiates a recommender according to the provided properties mapping.
@param properties the properties to be used when initializing the
recommender
@return the recommender instantiated | [
"Instantiates",
"a",
"recommender",
"according",
"to",
"the",
"provided",
"properties",
"mapping",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java#L176-L199 | train |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java | RecommendationRunner.writeStats | public static void writeStats(final String path, final String statLabel, final long stat) {
BufferedWriter out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path, true), "UTF-8"));
out.write(statLabel + "\t" + stat + "\n");
out.flu... | java | public static void writeStats(final String path, final String statLabel, final long stat) {
BufferedWriter out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path, true), "UTF-8"));
out.write(statLabel + "\t" + stat + "\n");
out.flu... | [
"public",
"static",
"void",
"writeStats",
"(",
"final",
"String",
"path",
",",
"final",
"String",
"statLabel",
",",
"final",
"long",
"stat",
")",
"{",
"BufferedWriter",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"BufferedWriter",
"(",
"new",
... | Write the system stats to file.
@param path the path to write to
@param statLabel what statistics is being written
@param stat the value | [
"Write",
"the",
"system",
"stats",
"to",
"file",
"."
] | 6ee8223e91810ae1c6052899595af3906e0c34c6 | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/RecommendationRunner.java#L208-L226 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/tools.java | tools.areEqual | public static boolean areEqual(byte[] array1, byte[] array2) {
if (array1.length != array2.length) return false;
for (int i=0; i<array1.length; ++i)
if (array1[i] != array2[i]) return false;
return true;
} | java | public static boolean areEqual(byte[] array1, byte[] array2) {
if (array1.length != array2.length) return false;
for (int i=0; i<array1.length; ++i)
if (array1[i] != array2[i]) return false;
return true;
} | [
"public",
"static",
"boolean",
"areEqual",
"(",
"byte",
"[",
"]",
"array1",
",",
"byte",
"[",
"]",
"array2",
")",
"{",
"if",
"(",
"array1",
".",
"length",
"!=",
"array2",
".",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",... | Compares two byte arrays element by element
@param array1 first array
@param array2 second array
@return array1 == array2 | [
"Compares",
"two",
"byte",
"arrays",
"element",
"by",
"element"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/tools.java#L83-L90 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/tools.java | tools.isZero | public static boolean isZero(byte[] bytes) {
int x = 0;
for (int i = 0; i < bytes.length; i++) {
x |= bytes[i];
}
return x == 0;
} | java | public static boolean isZero(byte[] bytes) {
int x = 0;
for (int i = 0; i < bytes.length; i++) {
x |= bytes[i];
}
return x == 0;
} | [
"public",
"static",
"boolean",
"isZero",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"int",
"x",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
";",
"i",
"++",
")",
"{",
"x",
"|=",
"bytes",
"[",
"i",
"... | Checks whether a byte array just contains elements equal to zero
@param bytes input byte array
@return true if all bytes of the array are 0 | [
"Checks",
"whether",
"a",
"byte",
"array",
"just",
"contains",
"elements",
"equal",
"to",
"zero"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/tools.java#L136-L142 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/PositionDecoder.java | PositionDecoder.decodePosition | public Position decodePosition(double time, SurfacePositionV0Msg msg) {
if (last_pos == null)
return null;
return decodePosition(time, msg, last_pos);
} | java | public Position decodePosition(double time, SurfacePositionV0Msg msg) {
if (last_pos == null)
return null;
return decodePosition(time, msg, last_pos);
} | [
"public",
"Position",
"decodePosition",
"(",
"double",
"time",
",",
"SurfacePositionV0Msg",
"msg",
")",
"{",
"if",
"(",
"last_pos",
"==",
"null",
")",
"return",
"null",
";",
"return",
"decodePosition",
"(",
"time",
",",
"msg",
",",
"last_pos",
")",
";",
"}... | Shortcut for using the last known position for reference; no reasonableness check on distance to receiver
@param time time of applicability/reception of position report (seconds)
@param msg surface position message
@return WGS84 coordinates with latitude and longitude in dec degrees, and altitude in meters. altitude mi... | [
"Shortcut",
"for",
"using",
"the",
"last",
"known",
"position",
"for",
"reference",
";",
"no",
"reasonableness",
"check",
"on",
"distance",
"to",
"receiver"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/PositionDecoder.java#L447-L452 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/PositionDecoder.java | PositionDecoder.decodePosition | public Position decodePosition(SurfacePositionV0Msg msg, Position reference) {
return decodePosition(System.currentTimeMillis()/1000.0, msg, reference);
} | java | public Position decodePosition(SurfacePositionV0Msg msg, Position reference) {
return decodePosition(System.currentTimeMillis()/1000.0, msg, reference);
} | [
"public",
"Position",
"decodePosition",
"(",
"SurfacePositionV0Msg",
"msg",
",",
"Position",
"reference",
")",
"{",
"return",
"decodePosition",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000.0",
",",
"msg",
",",
"reference",
")",
";",
"}"
] | Shortcut for live decoding; no reasonableness check on distance to receiver
@param reference used for reasonableness test and to decide which of the four resulting positions of the CPR algorithm is the right one
@param msg airborne position message
@return WGS84 coordinates with latitude and longitude in dec degrees, a... | [
"Shortcut",
"for",
"live",
"decoding",
";",
"no",
"reasonableness",
"check",
"on",
"distance",
"to",
"receiver"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/PositionDecoder.java#L461-L463 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/PositionDecoder.java | PositionDecoder.decodePosition | public Position decodePosition(double time, Position receiver, SurfacePositionV0Msg msg, Position reference) {
Position ret = decodePosition(time, msg, reference);
if (ret != null && receiver != null && !withinReasonableRange(receiver, ret)) {
ret.setReasonable(false);
num_reasonable = 0;
}
return ret;
} | java | public Position decodePosition(double time, Position receiver, SurfacePositionV0Msg msg, Position reference) {
Position ret = decodePosition(time, msg, reference);
if (ret != null && receiver != null && !withinReasonableRange(receiver, ret)) {
ret.setReasonable(false);
num_reasonable = 0;
}
return ret;
} | [
"public",
"Position",
"decodePosition",
"(",
"double",
"time",
",",
"Position",
"receiver",
",",
"SurfacePositionV0Msg",
"msg",
",",
"Position",
"reference",
")",
"{",
"Position",
"ret",
"=",
"decodePosition",
"(",
"time",
",",
"msg",
",",
"reference",
")",
";... | Performs all reasonableness tests.
@param time time of applicability/reception of position report (seconds)
@param reference position used to decide which position of the four results of the CPR algorithm is the right one
@param receiver position to check if received position was more than 700km away and
@param msg sur... | [
"Performs",
"all",
"reasonableness",
"tests",
"."
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/PositionDecoder.java#L474-L481 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/ModeSDecoder.java | ModeSDecoder.gc | public void gc() {
List<Integer> toRemove = new ArrayList<Integer>();
for (Integer transponder : decoderData.keySet())
if (decoderData.get(transponder).posDec.getLastUsedTime()<latestTimestamp-3600000)
toRemove.add(transponder);
for (Integer transponder : toRemove)
decoderData.remove(transponder);
} | java | public void gc() {
List<Integer> toRemove = new ArrayList<Integer>();
for (Integer transponder : decoderData.keySet())
if (decoderData.get(transponder).posDec.getLastUsedTime()<latestTimestamp-3600000)
toRemove.add(transponder);
for (Integer transponder : toRemove)
decoderData.remove(transponder);
} | [
"public",
"void",
"gc",
"(",
")",
"{",
"List",
"<",
"Integer",
">",
"toRemove",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"Integer",
"transponder",
":",
"decoderData",
".",
"keySet",
"(",
")",
")",
"if",
"(",
"decoderDa... | Clean state by removing decoders not used for more than an hour. This happens automatically
every 1 Mio messages if more than 50000 aircraft are tracked. | [
"Clean",
"state",
"by",
"removing",
"decoders",
"not",
"used",
"for",
"more",
"than",
"an",
"hour",
".",
"This",
"happens",
"automatically",
"every",
"1",
"Mio",
"messages",
"if",
"more",
"than",
"50000",
"aircraft",
"are",
"tracked",
"."
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/ModeSDecoder.java#L360-L368 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java | AltitudeReply.grayToBin | private static int grayToBin(int gray, int bitlength) {
int result = 0;
for (int i = bitlength-1; i >= 0; --i)
result = result|((((0x1<<(i+1))&result)>>>1)^((1<<i)&gray));
return result;
} | java | private static int grayToBin(int gray, int bitlength) {
int result = 0;
for (int i = bitlength-1; i >= 0; --i)
result = result|((((0x1<<(i+1))&result)>>>1)^((1<<i)&gray));
return result;
} | [
"private",
"static",
"int",
"grayToBin",
"(",
"int",
"gray",
",",
"int",
"bitlength",
")",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"bitlength",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"result",
"=",
"result",... | This method converts a gray code encoded int to a standard decimal int
@param gray gray code encoded int of length bitlength
bitlength bitlength of gray code
@return radix 2 encoded integer | [
"This",
"method",
"converts",
"a",
"gray",
"code",
"encoded",
"int",
"to",
"a",
"standard",
"decimal",
"int"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/msgs/AltitudeReply.java#L187-L192 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/msgs/IdentificationMsg.java | IdentificationMsg.mapChar | private static char[] mapChar (byte[] digits) {
char[] result = new char[digits.length];
for (int i=0; i<digits.length; i++)
result[i] = mapChar(digits[i]);
return result;
} | java | private static char[] mapChar (byte[] digits) {
char[] result = new char[digits.length];
for (int i=0; i<digits.length; i++)
result[i] = mapChar(digits[i]);
return result;
} | [
"private",
"static",
"char",
"[",
"]",
"mapChar",
"(",
"byte",
"[",
"]",
"digits",
")",
"{",
"char",
"[",
"]",
"result",
"=",
"new",
"char",
"[",
"digits",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"digits",
".",... | Maps ADS-B encoded to readable characters
@param digits array of encoded digits
@return array of decoded characters | [
"Maps",
"ADS",
"-",
"B",
"encoded",
"to",
"readable",
"characters"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/msgs/IdentificationMsg.java#L50-L57 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/Position.java | Position.toECEF | public double[] toECEF () {
double lon0r = toRadians(this.longitude);
double lat0r = toRadians(this.latitude);
double height = tools.feet2Meters(altitude);
double v = a / Math.sqrt(1 - e2*Math.sin(lat0r)*Math.sin(lat0r));
return new double[] {
(v + height) * Math.cos(lat0r) * Math.cos(lon0r), // x
(... | java | public double[] toECEF () {
double lon0r = toRadians(this.longitude);
double lat0r = toRadians(this.latitude);
double height = tools.feet2Meters(altitude);
double v = a / Math.sqrt(1 - e2*Math.sin(lat0r)*Math.sin(lat0r));
return new double[] {
(v + height) * Math.cos(lat0r) * Math.cos(lon0r), // x
(... | [
"public",
"double",
"[",
"]",
"toECEF",
"(",
")",
"{",
"double",
"lon0r",
"=",
"toRadians",
"(",
"this",
".",
"longitude",
")",
";",
"double",
"lat0r",
"=",
"toRadians",
"(",
"this",
".",
"latitude",
")",
";",
"double",
"height",
"=",
"tools",
".",
"... | Converts the WGS84 position to cartesian coordinates
@return earth-centered earth-fixed coordinates as [x, y, z] | [
"Converts",
"the",
"WGS84",
"position",
"to",
"cartesian",
"coordinates"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/Position.java#L125-L137 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/Position.java | Position.fromECEF | public static Position fromECEF (double x, double y, double z) {
double p = sqrt(x*x + y*y);
double th = atan2(a * z, b * p);
double lon = atan2(y, x);
double lat = atan2(
(z + (a*a - b*b) / (b*b) * b * pow(sin(th), 3)),
p - e2 * a * pow(cos(th), 3));
double N = a / sqrt(1 - pow(sqrt(e2) * sin(lat), ... | java | public static Position fromECEF (double x, double y, double z) {
double p = sqrt(x*x + y*y);
double th = atan2(a * z, b * p);
double lon = atan2(y, x);
double lat = atan2(
(z + (a*a - b*b) / (b*b) * b * pow(sin(th), 3)),
p - e2 * a * pow(cos(th), 3));
double N = a / sqrt(1 - pow(sqrt(e2) * sin(lat), ... | [
"public",
"static",
"Position",
"fromECEF",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"double",
"p",
"=",
"sqrt",
"(",
"x",
"*",
"x",
"+",
"y",
"*",
"y",
")",
";",
"double",
"th",
"=",
"atan2",
"(",
"a",
"*",
"z",
... | Converts a cartesian earth-centered earth-fixed coordinate into an WGS84 LLA position
@param x coordinate in meters
@param y coordinate in meters
@param z coordinate in meters
@return a position object representing the WGS84 position | [
"Converts",
"a",
"cartesian",
"earth",
"-",
"centered",
"earth",
"-",
"fixed",
"coordinate",
"into",
"an",
"WGS84",
"LLA",
"position"
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/Position.java#L146-L164 | train |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/Position.java | Position.distance3d | public Double distance3d(Position other) {
if (other == null || latitude == null || longitude == null || altitude == null)
return null;
double[] xyz1 = this.toECEF();
double[] xyz2 = other.toECEF();
return Math.sqrt(
Math.pow(xyz2[0] - xyz1[0], 2) +
Math.pow(xyz2[1] - xyz1[1], 2) +
Math.pow... | java | public Double distance3d(Position other) {
if (other == null || latitude == null || longitude == null || altitude == null)
return null;
double[] xyz1 = this.toECEF();
double[] xyz2 = other.toECEF();
return Math.sqrt(
Math.pow(xyz2[0] - xyz1[0], 2) +
Math.pow(xyz2[1] - xyz1[1], 2) +
Math.pow... | [
"public",
"Double",
"distance3d",
"(",
"Position",
"other",
")",
"{",
"if",
"(",
"other",
"==",
"null",
"||",
"latitude",
"==",
"null",
"||",
"longitude",
"==",
"null",
"||",
"altitude",
"==",
"null",
")",
"return",
"null",
";",
"double",
"[",
"]",
"xy... | Calculate the three-dimensional distance between this and another position.
This method assumes that the coordinates are WGS84.
@param other position
@return 3d distance in meters or null if lat, lon, or alt is missing | [
"Calculate",
"the",
"three",
"-",
"dimensional",
"distance",
"between",
"this",
"and",
"another",
"position",
".",
"This",
"method",
"assumes",
"that",
"the",
"coordinates",
"are",
"WGS84",
"."
] | 01d497d3e74ad10063ab443ab583e9c8653a8b8d | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/Position.java#L172-L184 | train |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetAutomationRuleResourcesImpl.java | SheetAutomationRuleResourcesImpl.listAutomationRules | public PagedResult<AutomationRule> listAutomationRules(long sheetId, PaginationParameters pagination) throws SmartsheetException {
String path = "sheets/" + sheetId + "/automationrules";
HashMap<String, Object> parameters = new HashMap<String, Object>();
if (pagination != null) {
pa... | java | public PagedResult<AutomationRule> listAutomationRules(long sheetId, PaginationParameters pagination) throws SmartsheetException {
String path = "sheets/" + sheetId + "/automationrules";
HashMap<String, Object> parameters = new HashMap<String, Object>();
if (pagination != null) {
pa... | [
"public",
"PagedResult",
"<",
"AutomationRule",
">",
"listAutomationRules",
"(",
"long",
"sheetId",
",",
"PaginationParameters",
"pagination",
")",
"throws",
"SmartsheetException",
"{",
"String",
"path",
"=",
"\"sheets/\"",
"+",
"sheetId",
"+",
"\"/automationrules\"",
... | Get all automation rules for this sheet
It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/automationrules
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any prob... | [
"Get",
"all",
"automation",
"rules",
"for",
"this",
"sheet"
] | f60e264412076271f83b65889ef9b891fad83df8 | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetAutomationRuleResourcesImpl.java#L60-L70 | train |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetAutomationRuleResourcesImpl.java | SheetAutomationRuleResourcesImpl.updateAutomationRule | public AutomationRule updateAutomationRule(long sheetId, AutomationRule automationRule) throws SmartsheetException {
Util.throwIfNull(automationRule);
return this.updateResource("sheets/" + sheetId + "/automationrules/" + automationRule.getId(),
AutomationRule.class, automationRule);
... | java | public AutomationRule updateAutomationRule(long sheetId, AutomationRule automationRule) throws SmartsheetException {
Util.throwIfNull(automationRule);
return this.updateResource("sheets/" + sheetId + "/automationrules/" + automationRule.getId(),
AutomationRule.class, automationRule);
... | [
"public",
"AutomationRule",
"updateAutomationRule",
"(",
"long",
"sheetId",
",",
"AutomationRule",
"automationRule",
")",
"throws",
"SmartsheetException",
"{",
"Util",
".",
"throwIfNull",
"(",
"automationRule",
")",
";",
"return",
"this",
".",
"updateResource",
"(",
... | Updates an automation rule.
It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/automationrules/{automationRuleId}
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is a... | [
"Updates",
"an",
"automation",
"rule",
"."
] | f60e264412076271f83b65889ef9b891fad83df8 | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetAutomationRuleResourcesImpl.java#L114-L118 | train |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java | OAuthFlowImpl.newAuthorizationURL | public String newAuthorizationURL(EnumSet<AccessScope> scopes, String state) {
Util.throwIfNull(scopes);
if(state == null){state = "";}
// Build a map of parameters for the URL
HashMap<String,Object> params = new HashMap<String, Object>();
params.put("response_type", "code");
... | java | public String newAuthorizationURL(EnumSet<AccessScope> scopes, String state) {
Util.throwIfNull(scopes);
if(state == null){state = "";}
// Build a map of parameters for the URL
HashMap<String,Object> params = new HashMap<String, Object>();
params.put("response_type", "code");
... | [
"public",
"String",
"newAuthorizationURL",
"(",
"EnumSet",
"<",
"AccessScope",
">",
"scopes",
",",
"String",
"state",
")",
"{",
"Util",
".",
"throwIfNull",
"(",
"scopes",
")",
";",
"if",
"(",
"state",
"==",
"null",
")",
"{",
"state",
"=",
"\"\"",
";",
... | Generate a new authorization URL.
Exceptions: - IllegalArgumentException : if scopes is null/empty
@param scopes the scopes
@param state an arbitrary string that will be returned to your app; intended to be used by you to ensure that
this redirect is indeed from an OAuth flow that you initiated
@return the authorizat... | [
"Generate",
"a",
"new",
"authorization",
"URL",
"."
] | f60e264412076271f83b65889ef9b891fad83df8 | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L136-L155 | train |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java | OAuthFlowImpl.obtainNewToken | public Token obtainNewToken(AuthorizationResult authorizationResult) throws OAuthTokenException, JSONSerializerException, HttpClientException,
URISyntaxException, InvalidRequestException {
if(authorizationResult == null){
throw new IllegalArgumentException();
}
// Prepa... | java | public Token obtainNewToken(AuthorizationResult authorizationResult) throws OAuthTokenException, JSONSerializerException, HttpClientException,
URISyntaxException, InvalidRequestException {
if(authorizationResult == null){
throw new IllegalArgumentException();
}
// Prepa... | [
"public",
"Token",
"obtainNewToken",
"(",
"AuthorizationResult",
"authorizationResult",
")",
"throws",
"OAuthTokenException",
",",
"JSONSerializerException",
",",
"HttpClientException",
",",
"URISyntaxException",
",",
"InvalidRequestException",
"{",
"if",
"(",
"authorizationR... | Obtain a new token using AuthorizationResult.
Exceptions:
- IllegalArgumentException : if authorizationResult is null
- InvalidTokenRequestException : if the token request is invalid (note that this won't really happen in current implementation)
- InvalidOAuthClientException : if the client information is invalid
- In... | [
"Obtain",
"a",
"new",
"token",
"using",
"AuthorizationResult",
"."
] | f60e264412076271f83b65889ef9b891fad83df8 | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L243-L278 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.