/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Portions Copyright 2012 Jens Elkner.
*/
/**
* Class representing file annotation, i.e., revision and author for the last
* modification of each line in the file.
*/
public class Annotation {
private int widestRevision;
private int widestAuthor;
/**
* Create a new instance.
* @param filename the basename of the associated file.
*/
}
return -1;
}
}
/**
* Gets the revision for the last change to the specified line.
*
* @param line line number (counting from 1)
* @return revision string, or an empty string if there is no information
* about the specified line
*/
}
/**
* Gets all revisions that are in use, first is the lowest one (sorted using
* natural order)
*
* @return list of all revisions the file has
*/
}
/**
* Gets the author who last modified the specified line.
*
* @param line line number (counting from 1)
* @return author, or an empty string if there is no information about the
* specified line
*/
}
/**
* Returns the size of the file (number of lines).
*
* @return number of lines
*/
public int size() {
}
/**
* Returns the widest revision string in the file (used for pretty
* printing).
*
* @return number of characters in the widest revision string
*/
public int getWidestRevision() {
return widestRevision;
}
/**
* Returns the widest author name in the file (used for pretty printing).
*
* @return number of characters in the widest author string
*/
public int getWidestAuthor() {
return widestAuthor;
}
private class RevInfo {
}
}
/**
* Adds a line to the file. Invokeing concurrently causes unpredictable
* results.
*
* @param revision revision number
* @param author author name
*/
revision = "";
}
author = "";
}
}
}
private class Desc {
/**
* Converts different html special characters into their encodings used in
* html. Currently used only for tooltips of annotation revision number view
*
* @param s
* input text
* @return encoded text for use in <a title=""> tag
*/
for (int i = 0; i < s.length(); i++ ) {
char c = s.charAt(i);
switch (c) {
case '\\':
break;
case '"':
break; // \\\"
case '&':
break;
case '>':
break;
case '<':
break;
case ' ':
break;
case '\t':
break;
case '\n':
break;
case '\r':
break;
default:
break;
}
}
}
}
+ "date: " + date;
}
return html;
}
// not stored because usually called once only
return
+ "<b>Date</b>: " + date;
}
}
/**
* Add the full commit message to the given revision. Ignored if there is
* no revision, which may accommodate this message (add an appropriate line
* before, if desired).
* @param revision revision in question.
* @param description full commit message to add (gets automatically html
* escaped including newlines, which are translated into '>br/<).
*/
{
}
}
}
/**
* Get the full commit message for the given revision.
* @param revision revision in question.
* @return {@code null} if not found, the html escaped commit message
* otherwise.
*/
}
/**
* Get the basename of the associated source file.
* @return a filename
* @see Annotation#Annotation(String)
*/
return filename;
}
/**
* Convert this annotation data into compact JSON format.
* @return a JSON Object.
*/
.append(",\"line2rev\":[");
int count = 0;
count++;
continue;
}
}
}
.append("\"},");
}
}
}
}