[Japi-cvs] SF.net SVN: japi:[757]
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2008-12-29 04:10:15
|
Revision: 757
http://japi.svn.sourceforge.net/japi/?rev=757&view=rev
Author: christianhujer
Date: 2008-12-29 04:10:11 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
Made all local variables final that can be final.
Modified Paths:
--------------
historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
historic/trunk/src/app/net/sf/japi/util/Table.java
historic/trunk/src/doc/guide/io/src/UniqPlain.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestV1.java
Modified: historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:02:35 UTC (rev 756)
+++ historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-29 04:10:11 UTC (rev 757)
@@ -41,7 +41,7 @@
* @param numberOfPeriods
* @return the overall capital after numberOfPeriods periods
*/
- public double calculateCapital( int numberOfPeriods ) {
+ public double calculateCapital( final int numberOfPeriods ) {
if ( numberOfPeriods < 0 ) {
throw new IllegalArgumentException("Number of periods has to be at least 0!");
}
@@ -62,14 +62,14 @@
/** Sets new current capital.
* @param currentCapital
*/
- public void setCurrentCapital(double currentCapital) {
+ public void setCurrentCapital(final double currentCapital) {
this.currentCapital = currentCapital;
}
/** Sets new interest rate.
* @param interestRate
*/
- public void setInterestRate(double interestRate) {
+ public void setInterestRate(final double interestRate) {
this.interestRate = interestRate;
}
Modified: historic/trunk/src/app/net/sf/japi/util/Table.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/util/Table.java 2008-12-29 04:02:35 UTC (rev 756)
+++ historic/trunk/src/app/net/sf/japi/util/Table.java 2008-12-29 04:10:11 UTC (rev 757)
@@ -67,7 +67,7 @@
*/
public Collection<Pair<T1,T2>> getPairsByFirst(final T1 first) {
final Set<Pair<T1,T2>> pairsByFirst = new HashSet<Pair<T1,T2>>();
- for (Pair<T1, T2> pair : pairs) {
+ for (final Pair<T1, T2> pair : pairs) {
final T1 pairFirst = pair.getFirst();
if (pairFirst.equals(first)) {
pairsByFirst.add(pair);
@@ -82,7 +82,7 @@
*/
public Collection<Pair<T1,T2>> getPairsBySecond(final T2 second) {
final Set<Pair<T1,T2>> pairsBySecond = new HashSet<Pair<T1,T2>>();
- for (Pair<T1, T2> pair : pairs) {
+ for (final Pair<T1, T2> pair : pairs) {
final T2 pairSecond = pair.getSecond();
if (pairSecond.equals(second)) {
pairsBySecond.add(pair);
Modified: historic/trunk/src/doc/guide/io/src/UniqPlain.java
===================================================================
--- historic/trunk/src/doc/guide/io/src/UniqPlain.java 2008-12-29 04:02:35 UTC (rev 756)
+++ historic/trunk/src/doc/guide/io/src/UniqPlain.java 2008-12-29 04:10:11 UTC (rev 757)
@@ -34,7 +34,7 @@
} else {
for (final String arg : args) {
try {
- BufferedReader in = new BufferedReader(new FileReader(arg));
+ final BufferedReader in = new BufferedReader(new FileReader(arg));
try {
for (String line; (line = in.readLine()) != null;) {
if (!line.equals(prevLine)) {
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestV1.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestV1.java 2008-12-29 04:02:35 UTC (rev 756)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/io/JTestV1.java 2008-12-29 04:10:11 UTC (rev 757)
@@ -133,21 +133,21 @@
* @throws SAXException in case of XML parsing errors
*/
public QuestionCollection load(final Document doc) throws IOException, SAXException {
- List<QuestionText> questions = new ArrayList<QuestionText>();
- NodeList questionEls = doc.getElementsByTagName("QuestionText");
- int questionElsSize = questionEls.getLength();
+ final List<QuestionText> questions = new ArrayList<QuestionText>();
+ final NodeList questionEls = doc.getElementsByTagName("QuestionText");
+ final int questionElsSize = questionEls.getLength();
for (int i = 0; i < questionElsSize; i++) {
- Element questionEl = (Element) questionEls.item(i);
- String qtype = questionEl.getAttribute("qtype");
+ final Element questionEl = (Element) questionEls.item(i);
+ final String qtype = questionEl.getAttribute("qtype");
if ("regex".equals(qtype)) {
- List<String> expressions = new ArrayList<String>();
- NodeList textEls = questionEl.getChildNodes();
- int textElsSize = textEls.getLength();
+ final List<String> expressions = new ArrayList<String>();
+ final NodeList textEls = questionEl.getChildNodes();
+ final int textElsSize = textEls.getLength();
String questionText = null;
for (int j = 0; j < textElsSize; j++) {
- Node n = textEls.item(j);
+ final Node n = textEls.item(j);
if (n.getNodeType() == ELEMENT_NODE) {
- String tagName = n.getNodeName();
+ final String tagName = n.getNodeName();
if ("text".equals(tagName)) {
questionText = n.getFirstChild().getNodeValue();
} else if ("regex".equals(tagName)) {
@@ -155,19 +155,19 @@
}
}
}
- OpenQuestionText question = new OpenQuestionText(questionText, expressions);
+ final OpenQuestionText question = new OpenQuestionText(questionText, expressions);
question.setType(questionEl.getAttribute("type"));
question.setHTML(true);
questions.add(question);
} else {
- List<MCAnswerText> answers = new ArrayList<MCAnswerText>();
- NodeList textEls = questionEl.getChildNodes();
- int textElsSize = textEls.getLength();
+ final List<MCAnswerText> answers = new ArrayList<MCAnswerText>();
+ final NodeList textEls = questionEl.getChildNodes();
+ final int textElsSize = textEls.getLength();
String questionText = null;
for (int j = 0; j < textElsSize; j++) {
- Node n = textEls.item(j);
+ final Node n = textEls.item(j);
if (n.getNodeType() == ELEMENT_NODE) {
- String tagName = n.getNodeName();
+ final String tagName = n.getNodeName();
if ("text".equals(tagName)) {
questionText = n.getFirstChild().getNodeValue();
} else if ("true".equals(tagName)) {
@@ -177,13 +177,13 @@
}
}
}
- QuestionText question = new MCQuestionText(questionText, answers);
+ final QuestionText question = new MCQuestionText(questionText, answers);
question.setType(questionEl.getAttribute("type"));
question.setHTML(true);
questions.add(question);
}
}
- QuestionCollection col = new QuestionCollection(questions);
+ final QuestionCollection col = new QuestionCollection(questions);
setInfo(col, doc);
return col;
}
@@ -216,7 +216,7 @@
if (!(domImpl instanceof DOMImplementationLS)) {
throw new IOException("DOM Implementation with LS-Feature required, upgrade your Java XML Library");
}
- DOMImplementationLS ls = (DOMImplementationLS) domImpl;
+ final DOMImplementationLS ls = (DOMImplementationLS) domImpl;
ls.createLSSerializer().writeToURI(export(col), f.toURI().toString());
}
@@ -225,12 +225,12 @@
* @return XML Document (KEduca) for <var>col</var>
*/
public Document export(final QuestionCollection col) {
- DocumentType keduca = domImpl.createDocumentType("educa", null, null);
- Document doc = domImpl.createDocument(null, "Document", keduca);
+ final DocumentType keduca = domImpl.createDocumentType("educa", null, null);
+ final Document doc = domImpl.createDocument(null, "Document", keduca);
//System.err.println("<!DOCTYPE " + doc.getDoctype().getName() + ">");
- Element docEl = doc.getDocumentElement();
+ final Element docEl = doc.getDocumentElement();
{
- Element infoEl = doc.createElement("info");
+ final Element infoEl = doc.createElement("info");
docEl.appendChild(infoEl);
infoEl.appendChild(create(doc, "title", col.getTitle()));
infoEl.appendChild(create(doc, "category", col.getCategory()));
@@ -238,7 +238,7 @@
infoEl.appendChild(create(doc, "level", col.getLevel()));
infoEl.appendChild(create(doc, "language", col.getLanguage()));
{
- Element authorEl = doc.createElement("author");
+ final Element authorEl = doc.createElement("author");
infoEl.appendChild(authorEl);
infoEl.appendChild(create(doc, "name", col.getAuthorName()));
infoEl.appendChild(create(doc, "email", col.getAuthorEMail()));
@@ -246,10 +246,10 @@
}
}
{
- Element dataEl = doc.createElement("data");
+ final Element dataEl = doc.createElement("data");
docEl.appendChild(dataEl);
for (int i = 0; i < col.getSize(); i++) {
- QuestionText qt = col.getQuestion(i);
+ final QuestionText qt = col.getQuestion(i);
if (qt instanceof MCQuestionText) { // skip answers other than Multiple Choice
dataEl.appendChild(createQuestionEl(doc, (MCQuestionText) qt));
}
@@ -264,13 +264,13 @@
* @return element for question
*/
private Element createQuestionEl(final Document doc, final MCQuestionText question) {
- Element questionEl = doc.createElement("question");
+ final Element questionEl = doc.createElement("question");
if (question.getType() != null) {
questionEl.setAttribute("type", question.getType());
}
questionEl.appendChild(create(doc, "text", question.getText()));
for (int i = 0; i < question.getSize(); i++) {
- MCAnswerText answer = question.getAnswer(i);
+ final MCAnswerText answer = question.getAnswer(i);
questionEl.appendChild(create(doc, answer.isCorrect() ? "true" : "false", answer.getText()));
}
return questionEl;
@@ -283,7 +283,7 @@
* @return element with name <var>name</var> containing <var>text</var>
*/
private Element create(final Document doc, final String name, final String text) {
- Element el = doc.createElement(name);
+ final Element el = doc.createElement(name);
el.appendChild(doc.createTextNode(text));
return el;
}
@@ -301,7 +301,7 @@
/** {@inheritDoc} */
protected boolean canLoadImpl(final String uri) {
try {
- ErrorCapture capture = new ErrorCapture();
+ final ErrorCapture capture = new ErrorCapture();
db.setErrorHandler(capture);
db.parse(uri);
return capture.hadErrors();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|