From 399b5eb971a471204a5db20ea48792beedaf29b7 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Fri, 5 May 2017 22:09:02 +0200 Subject: [PATCH] Performed code review and Javadoc review. --- src/fr/devinsy/xidyn/XidynException.java | 16 +- src/fr/devinsy/xidyn/data/SimpleTagData.java | 82 +++-- src/fr/devinsy/xidyn/data/TagAttributes.java | 6 +- src/fr/devinsy/xidyn/data/TagData.java | 20 +- .../devinsy/xidyn/data/TagDataListById.java | 29 +- .../xidyn/data/TagDataListByIndex.java | 9 +- src/fr/devinsy/xidyn/data/TagDataManager.java | 281 +++++++++++++++--- src/fr/devinsy/xidyn/demo/XidynDemo.java | 18 +- src/fr/devinsy/xidyn/pages/Page.java | 78 ++++- src/fr/devinsy/xidyn/pages/PageFactory.java | 76 +++-- .../xidyn/presenters/DomPresenter.java | 42 ++- .../xidyn/presenters/DomPresenterCore.java | 195 ++++++++++-- .../xidyn/presenters/FilePresenter.java | 44 ++- .../xidyn/presenters/FilePresenters.java | 55 ++-- .../xidyn/presenters/FilePresentersProxy.java | 31 +- .../xidyn/presenters/GenericPresenter.java | 83 ++++-- .../devinsy/xidyn/presenters/Presenter.java | 34 ++- .../xidyn/presenters/PresenterFactory.java | 88 ++++-- .../xidyn/presenters/PresenterUtils.java | 48 ++- .../xidyn/presenters/StringPresenter.java | 30 +- .../xidyn/presenters/TranslatorPresenter.java | 130 +++++--- .../xidyn/presenters/URLPresenter.java | 55 ++-- .../xidyn/utils/ParserErrorHandler.java | 72 +++-- src/fr/devinsy/xidyn/utils/XidynUtils.java | 103 ++++++- src/fr/devinsy/xidyn/utils/cache/Cache.java | 43 ++- .../devinsy/xidyn/utils/cache/CacheItem.java | 26 +- .../xidyn/utils/cache/CacheStrategy.java | 31 +- src/fr/devinsy/xidyn/views/CharterView.java | 16 +- src/fr/devinsy/xidyn/views/View.java | 14 +- test/Foo.java | 15 +- test/XidynTest.java | 26 +- .../devinsy/xidyn/pages/PageFactoryTest.java | 18 +- test/fr/devinsy/xidyn/pages/PageTest.java | 14 +- .../xidyn/presenters/DomPresenterTest.java | 16 +- .../xidyn/presenters/PresenterUtilsTest.java | 19 +- .../xidyn/presenters/StringPresenterTest.java | 22 +- .../devinsy/xidyn/utils/XidynUtilsTest.java | 51 ++-- 37 files changed, 1420 insertions(+), 516 deletions(-) diff --git a/src/fr/devinsy/xidyn/XidynException.java b/src/fr/devinsy/xidyn/XidynException.java index ed70d60..32bc7fa 100644 --- a/src/fr/devinsy/xidyn/XidynException.java +++ b/src/fr/devinsy/xidyn/XidynException.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2016 Christian Pierre MOMON +/* + * Copyright (C) 2016,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -19,6 +19,7 @@ package fr.devinsy.xidyn; /** + * The Class XidynException. * * @author Christian Pierre MOMON (christian.momon@devinsy.fr) */ @@ -27,16 +28,18 @@ public class XidynException extends Exception private static final long serialVersionUID = 8498031594322380559L; /** - * - */ + * Instantiates a new xidyn exception. + */ public XidynException() { super(); } /** + * Instantiates a new xidyn exception. * * @param message + * the message */ public XidynException(final String message) { @@ -44,9 +47,12 @@ public class XidynException extends Exception } /** + * Instantiates a new xidyn exception. * * @param message + * the message * @param cause + * the cause */ public XidynException(final String message, final Throwable cause) { @@ -54,8 +60,10 @@ public class XidynException extends Exception } /** + * Instantiates a new xidyn exception. * * @param cause + * the cause */ public XidynException(final Throwable cause) { diff --git a/src/fr/devinsy/xidyn/data/SimpleTagData.java b/src/fr/devinsy/xidyn/data/SimpleTagData.java index b99a604..61c8aba 100644 --- a/src/fr/devinsy/xidyn/data/SimpleTagData.java +++ b/src/fr/devinsy/xidyn/data/SimpleTagData.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,6 +21,8 @@ package fr.devinsy.xidyn.data; import java.io.Serializable; /** + * The Class SimpleTagData. + * * IdData class is used to hold application data and the business logic that * operates on the data. * @@ -59,8 +61,8 @@ public class SimpleTagData implements Serializable, TagData private String content; /** - * - */ + * Instantiates a new simple tag data. + */ public SimpleTagData() { this.attributes = null; @@ -71,8 +73,11 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Instantiates a new simple tag data. + * + * @param text + * the text + */ public SimpleTagData(final String text) { this.attributes = null; @@ -83,8 +88,11 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Append content. + * + * @param text + * the text + */ public void appendContent(final String text) { if (this.content == null) @@ -98,8 +106,10 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Attributes. + * + * @return the tag attributes + */ public TagAttributes attributes() { TagAttributes result; @@ -116,8 +126,10 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Display. + * + * @return the string + */ public String display() { String result; @@ -129,8 +141,10 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Display mode. + * + * @return the mode + */ public MODE displayMode() { MODE result; @@ -141,8 +155,10 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Exclude section. + * + * @return true, if successful + */ public boolean excludeSection() { boolean result; @@ -154,8 +170,10 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Iteration strategy. + * + * @return the iteration strategy + */ public IterationStrategy iterationStrategy() { IterationStrategy result; @@ -167,32 +185,44 @@ public class SimpleTagData implements Serializable, TagData } /** - * - */ + * Sets the content. + * + * @param text + * the new content + */ public void setContent(final String text) { this.content = text; } /** - * - */ + * Sets the display mode. + * + * @param displayMode + * the new display mode + */ public void setDisplayMode(final MODE displayMode) { this.displayMode = displayMode; } /** - * - */ + * Sets the exclude section. + * + * @param excludeSection + * the new exclude section + */ public void setExcludeSection(final boolean excludeSection) { this.excludeSection = excludeSection; } /** - * - */ + * Sets the iteration strategy. + * + * @param strategy + * the new iteration strategy + */ public void setIterationStrategy(final IterationStrategy strategy) { this.iterationStrategy = strategy; diff --git a/src/fr/devinsy/xidyn/data/TagAttributes.java b/src/fr/devinsy/xidyn/data/TagAttributes.java index c0d2428..8726fea 100644 --- a/src/fr/devinsy/xidyn/data/TagAttributes.java +++ b/src/fr/devinsy/xidyn/data/TagAttributes.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,10 +21,12 @@ package fr.devinsy.xidyn.data; import java.util.HashMap; /** + * The Class TagAttributes. * * Note: no more AttrValue as in Brill, because the exception of style is * managed in the attribute merging on the "style" string detection. */ + public class TagAttributes extends HashMap { private static final long serialVersionUID = 2802739066295665336L; diff --git a/src/fr/devinsy/xidyn/data/TagData.java b/src/fr/devinsy/xidyn/data/TagData.java index a9f1b07..46da92f 100644 --- a/src/fr/devinsy/xidyn/data/TagData.java +++ b/src/fr/devinsy/xidyn/data/TagData.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -18,14 +18,18 @@ */ package fr.devinsy.xidyn.data; -/* - * Xidyn uses three classes to describe data: - * - TagData - * - TagsData - * - TagsDataById +/** + * The Interface TagData. * + * Xidyn uses three classes to describe data: + * + *
* Others classes that do not extends these won't be use by Xidyn. - * + * * This interface helps to express this fact. */ public interface TagData diff --git a/src/fr/devinsy/xidyn/data/TagDataListById.java b/src/fr/devinsy/xidyn/data/TagDataListById.java index 4c075ff..e4b6ef8 100644 --- a/src/fr/devinsy/xidyn/data/TagDataListById.java +++ b/src/fr/devinsy/xidyn/data/TagDataListById.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,24 +21,27 @@ package fr.devinsy.xidyn.data; import java.util.HashMap; /** - * + * The Class TagDataListById. */ public class TagDataListById extends HashMap implements TagData { - private static final long serialVersionUID = -5787252043825503554L; /** - * - */ + * Instantiates a new tag data list by id. + */ public TagDataListById() { super(); } /** - * - */ + * Gets the id. + * + * @param id + * the id + * @return the id + */ public TagData getId(final String id) { TagData result; @@ -50,11 +53,15 @@ public class TagDataListById extends HashMap implements TagData } /** - * - */ + * Sets the id. + * + * @param id + * the id + * @param data + * the data + */ public void setId(final String id, final TagData data) { this.put(id, data); } - } diff --git a/src/fr/devinsy/xidyn/data/TagDataListByIndex.java b/src/fr/devinsy/xidyn/data/TagDataListByIndex.java index f25971d..d81eb35 100644 --- a/src/fr/devinsy/xidyn/data/TagDataListByIndex.java +++ b/src/fr/devinsy/xidyn/data/TagDataListByIndex.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,6 +21,7 @@ package fr.devinsy.xidyn.data; import java.util.Vector; /** + * The Class TagDataListByIndex. * * @author Christian Pierre MOMON (christian.momon@devinsy.fr) */ @@ -29,8 +30,8 @@ public class TagDataListByIndex extends Vector implements TagData private static final long serialVersionUID = 215545720925753884L; /** - * - */ + * Instantiates a new tag data list by index. + */ public TagDataListByIndex() { super(); diff --git a/src/fr/devinsy/xidyn/data/TagDataManager.java b/src/fr/devinsy/xidyn/data/TagDataManager.java index fc9e260..d1f6cde 100644 --- a/src/fr/devinsy/xidyn/data/TagDataManager.java +++ b/src/fr/devinsy/xidyn/data/TagDataManager.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,6 +21,7 @@ package fr.devinsy.xidyn.data; import fr.devinsy.xidyn.presenters.DomPresenterCore; /** + * The Class TagDataManager. * * @author Christian Pierre MOMON (christian.momon@devinsy.fr) */ @@ -29,24 +30,34 @@ public class TagDataManager private TagDataListById idsDataById; /** - * - */ + * Instantiates a new tag data manager. + */ public TagDataManager() { this.idsDataById = new TagDataListById(); } /** - * - */ + * Adds the content. + * + * @param id + * the id + * @param value + * the value + */ public void addContent(final String id, final long value) { addContent(id, String.valueOf(value)); } /** - * - */ + * Adds the content. + * + * @param id + * the id + * @param content + * the content + */ public void addContent(final String id, final String content) { TagDataListByIndex tags = (TagDataListByIndex) this.idsDataById.getId(id); @@ -64,16 +75,30 @@ public class TagDataManager } /** - * - */ + * Append attribute. + * + * @param id + * the id + * @param label + * the label + * @param value + * the value + */ public void appendAttribute(final String id, final String label, final long value) { appendAttribute(id, label, String.valueOf(value)); } /** - * - */ + * Append attribute. + * + * @param id + * the id + * @param label + * the label + * @param value + * the value + */ public void appendAttribute(final String id, final String label, final String value) { SimpleTagData tag = this.getIdData(id); @@ -82,16 +107,30 @@ public class TagDataManager } /** - * - */ + * Append content. + * + * @param id + * the id + * @param line + * the line + * @param value + * the value + */ public void appendContent(final String id, final int line, final long value) { appendContent(id, line, String.valueOf(value)); } /** - * - */ + * Append content. + * + * @param id + * the id + * @param line + * the line + * @param value + * the value + */ public void appendContent(final String id, final int line, final String value) { SimpleTagData tag = this.getIdData(id, line); @@ -100,16 +139,34 @@ public class TagDataManager } /** - * - */ + * Append content. + * + * @param id + * the id + * @param line + * the line + * @param column + * the column + * @param value + * the value + */ public void appendContent(final String id, final int line, final String column, final long value) { appendContent(id, line, column, String.valueOf(value)); } /** - * - */ + * Append content. + * + * @param id + * the id + * @param line + * the line + * @param column + * the column + * @param value + * the value + */ public void appendContent(final String id, final int line, final String column, final String value) { SimpleTagData tag = this.getIdData(id, line, column); @@ -118,8 +175,13 @@ public class TagDataManager } /** - * - */ + * Append content. + * + * @param id + * the id + * @param value + * the value + */ public void appendContent(final String id, final String value) { SimpleTagData tag = this.getIdData(id); @@ -127,8 +189,12 @@ public class TagDataManager } /** - * - */ + * Gets the id data. + * + * @param id + * the id + * @return the id data + */ public SimpleTagData getIdData(final String id) { SimpleTagData result; @@ -148,8 +214,14 @@ public class TagDataManager } /** - * - */ + * Gets the id data. + * + * @param id + * the id + * @param line + * the line + * @return the id data + */ public SimpleTagData getIdData(final String id, final int line) { SimpleTagData result; @@ -178,8 +250,16 @@ public class TagDataManager } /** - * - */ + * Gets the id data. + * + * @param id + * the id + * @param line + * the line + * @param column + * the column + * @return the id data + */ public SimpleTagData getIdData(final String id, final int line, final String column) { SimpleTagData result; @@ -217,8 +297,10 @@ public class TagDataManager } /** - * - */ + * Gets the ids data by id. + * + * @return the ids data by id + */ public TagDataListById getIdsDataById() { TagDataListById result; @@ -230,8 +312,9 @@ public class TagDataManager } /** + * Checks if is empty. * - * @return + * @return true, if is empty */ public boolean isEmpty() { @@ -251,8 +334,10 @@ public class TagDataManager } /** + * Removes the tag. * * @param id + * the id */ public void removeTag(final String id) { @@ -262,11 +347,16 @@ public class TagDataManager } /** + * Sets the attribute. * * @param id + * the id * @param line + * the line * @param label + * the label * @param value + * the value */ public void setAttribute(final String id, final int line, final String label, final long value) { @@ -274,11 +364,16 @@ public class TagDataManager } /** + * Sets the attribute. * * @param id + * the id * @param line + * the line * @param label + * the label * @param value + * the value */ public void setAttribute(final String id, final int line, final String label, final String value) { @@ -288,12 +383,18 @@ public class TagDataManager } /** + * Sets the attribute. * * @param id + * the id * @param line + * the line * @param column + * the column * @param label + * the label * @param value + * the value */ public void setAttribute(final String id, final int line, final String column, final String label, final long value) { @@ -301,8 +402,19 @@ public class TagDataManager } /** - * - */ + * Sets the attribute. + * + * @param id + * the id + * @param line + * the line + * @param column + * the column + * @param label + * the label + * @param value + * the value + */ public void setAttribute(final String id, final int line, final String column, final String label, final String value) { SimpleTagData tag = this.getIdData(id, line, column); @@ -311,16 +423,30 @@ public class TagDataManager } /** - * - */ + * Sets the attribute. + * + * @param id + * the id + * @param label + * the label + * @param value + * the value + */ public void setAttribute(final String id, final String label, final long value) { setAttribute(id, label, String.valueOf(value)); } /** - * - */ + * Sets the attribute. + * + * @param id + * the id + * @param label + * the label + * @param value + * the value + */ public void setAttribute(final String id, final String label, final String value) { SimpleTagData tag = this.getIdData(id); @@ -329,7 +455,14 @@ public class TagDataManager } /** - * + * Sets the content. + * + * @param id + * the id + * @param line + * the line + * @param value + * the value */ public void setContent(final String id, final int line, final long value) { @@ -337,7 +470,14 @@ public class TagDataManager } /** - * + * Sets the content. + * + * @param id + * the id + * @param line + * the line + * @param content + * the content */ public void setContent(final String id, final int line, final String content) { @@ -347,6 +487,20 @@ public class TagDataManager } /** + * Sets the content. + * + * @param id + * the id + * @param line + * the line + * @param subId + * the sub id + * @param subLine + * the sub line + * @param column + * the column + * @param content + * the content * @TODO */ public void setContent(final String id, final int line, final String subId, final int subLine, final String column, final String content) @@ -357,7 +511,16 @@ public class TagDataManager } /** - * + * Sets the content. + * + * @param id + * the id + * @param line + * the line + * @param column + * the column + * @param value + * the value */ public void setContent(final String id, final int line, final String column, final long value) { @@ -365,7 +528,16 @@ public class TagDataManager } /** - * + * Sets the content. + * + * @param id + * the id + * @param line + * the line + * @param column + * the column + * @param content + * the content */ public void setContent(final String id, final int line, final String column, final String content) { @@ -375,16 +547,26 @@ public class TagDataManager } /** - * - */ + * Sets the content. + * + * @param id + * the id + * @param value + * the value + */ public void setContent(final String id, final long value) { setContent(id, String.valueOf(value)); } /** - * - */ + * Sets the content. + * + * @param id + * the id + * @param content + * the content + */ public void setContent(final String id, final String content) { SimpleTagData idData = this.getIdData(id); @@ -393,8 +575,13 @@ public class TagDataManager } /** - * - */ + * Sets the iteration strategy. + * + * @param id + * the id + * @param strategy + * the strategy + */ public void setIterationStrategy(final String id, final SimpleTagData.IterationStrategy strategy) { SimpleTagData tag = this.getIdData(id); diff --git a/src/fr/devinsy/xidyn/demo/XidynDemo.java b/src/fr/devinsy/xidyn/demo/XidynDemo.java index ca0c16c..739df2f 100644 --- a/src/fr/devinsy/xidyn/demo/XidynDemo.java +++ b/src/fr/devinsy/xidyn/demo/XidynDemo.java @@ -1,6 +1,5 @@ -package fr.devinsy.xidyn.demo; -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -17,6 +16,8 @@ package fr.devinsy.xidyn.demo; * You should have received a copy of the GNU General Public License * along with Xidyn. If not, see */ +package fr.devinsy.xidyn.demo; + import org.apache.log4j.Level; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,11 +28,11 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.presenters.PresenterUtils; /** - * + * The Class XidynDemo. */ class XidynDemo { - private static Logger logger = LoggerFactory.getLogger(XidynDemo.class); + private final Logger logger = LoggerFactory.getLogger(XidynDemo.class); static { // Initialize logger. @@ -40,8 +41,11 @@ class XidynDemo } /** - * - */ + * The main method. + * + * @param args + * the arguments + */ public static void main(final String[] args) { System.out.println("Hello World!"); diff --git a/src/fr/devinsy/xidyn/pages/Page.java b/src/fr/devinsy/xidyn/pages/Page.java index 73d251d..6d52ce4 100644 --- a/src/fr/devinsy/xidyn/pages/Page.java +++ b/src/fr/devinsy/xidyn/pages/Page.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2016 Christian Pierre MOMON +/* + * Copyright (C) 2016,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -33,7 +33,7 @@ import fr.devinsy.xidyn.presenters.URLPresenter; import fr.devinsy.xidyn.utils.XidynUtils; /** - * + * The Class Page. */ public class Page extends TagDataManager { @@ -41,8 +41,10 @@ public class Page extends TagDataManager private StringBuffer lastDynamize; /** + * Instantiates a new page. * * @param source + * the source */ public Page(final CharSequence source) { @@ -50,8 +52,12 @@ public class Page extends TagDataManager } /** + * Instantiates a new page. * * @param source + * the source + * @param locale + * the locale */ public Page(final CharSequence source, final Locale locale) { @@ -59,8 +65,10 @@ public class Page extends TagDataManager } /** + * Instantiates a new page. * * @param source + * the source */ public Page(final Document source) { @@ -68,8 +76,10 @@ public class Page extends TagDataManager } /** + * Instantiates a new page. * * @param source + * the source */ public Page(final File source) { @@ -77,8 +87,12 @@ public class Page extends TagDataManager } /** + * Instantiates a new page. * * @param source + * the source + * @param locale + * the locale */ public Page(final File source, final Locale locale) { @@ -86,8 +100,11 @@ public class Page extends TagDataManager } /** - * - */ + * Instantiates a new page. + * + * @param presenter + * the presenter + */ public Page(final Presenter presenter) { super(); @@ -104,8 +121,10 @@ public class Page extends TagDataManager } /** + * Instantiates a new page. * * @param source + * the source */ public Page(final URL source) { @@ -113,8 +132,12 @@ public class Page extends TagDataManager } /** + * Instantiates a new page. * * @param source + * the source + * @param locale + * the locale */ public Page(final URL source, final Locale locale) { @@ -122,9 +145,11 @@ public class Page extends TagDataManager } /** + * Dynamize. * - * @return + * @return the string buffer * @throws Exception + * the exception */ public StringBuffer dynamize() throws Exception { @@ -146,9 +171,11 @@ public class Page extends TagDataManager } /** + * Dynamize to string. * - * @return + * @return the string * @throws Exception + * the exception */ public String dynamizeToString() throws Exception { @@ -170,10 +197,14 @@ public class Page extends TagDataManager } /** + * Include. * * @param id - * @param page + * the id + * @param source + * the source * @throws Exception + * the exception */ public void include(final String id, final Page source) throws Exception { @@ -214,10 +245,14 @@ public class Page extends TagDataManager } /** + * Include page. * * @param id - * @param page + * the id + * @param source + * the source * @throws Exception + * the exception */ public void includePage(final String id, final CharSequence source) throws Exception { @@ -230,10 +265,14 @@ public class Page extends TagDataManager } /** + * Include page. * * @param id - * @param page + * the id + * @param source + * the source * @throws Exception + * the exception */ public void includePage(final String id, final Document source) throws Exception { @@ -246,10 +285,14 @@ public class Page extends TagDataManager } /** + * Include page. * * @param id - * @param page + * the id + * @param source + * the source * @throws Exception + * the exception */ public void includePage(final String id, final File source) throws Exception { @@ -262,10 +305,14 @@ public class Page extends TagDataManager } /** + * Include page. * * @param id - * @param page + * the id + * @param source + * the source * @throws Exception + * the exception */ public void includePage(final String id, final URL source) throws Exception { @@ -278,8 +325,9 @@ public class Page extends TagDataManager } /** + * Checks if is complete. * - * @return + * @return true, if is complete */ public boolean isComplete() { @@ -299,7 +347,11 @@ public class Page extends TagDataManager } /** + * Last version. + * + * @return the string buffer * @throws Exception + * the exception */ public StringBuffer lastVersion() throws Exception { diff --git a/src/fr/devinsy/xidyn/pages/PageFactory.java b/src/fr/devinsy/xidyn/pages/PageFactory.java index f29414f..f6f1a59 100644 --- a/src/fr/devinsy/xidyn/pages/PageFactory.java +++ b/src/fr/devinsy/xidyn/pages/PageFactory.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2016 Christian Pierre MOMON +/* + * Copyright (C) 2016,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -29,6 +29,7 @@ import fr.devinsy.xidyn.presenters.PresenterFactory; import fr.devinsy.xidyn.utils.cache.Cache; /** + * A factory for creating Page objects. * * @author Christian Pierre MOMON (christian.momon@devinsy.fr) */ @@ -47,16 +48,16 @@ public class PageFactory private Cache cache; /** - * - */ + * Instantiates a new page factory. + */ private PageFactory() { this.cache = new Cache(); } /** - * - */ + * Clear. + */ public void clear() { this.cache.clear(); @@ -64,9 +65,11 @@ public class PageFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the page */ public Page create(final CharSequence source) { @@ -79,9 +82,11 @@ public class PageFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the page */ public Page create(final Document source) { @@ -94,9 +99,11 @@ public class PageFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the page */ public Page create(final File source) { @@ -109,9 +116,13 @@ public class PageFactory } /** + * Creates the. * * @param source - * @return + * the source + * @param locale + * the locale + * @return the page */ public Page create(final File source, final Locale locale) { @@ -124,9 +135,11 @@ public class PageFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the page */ public Page create(final URL source) { @@ -139,9 +152,13 @@ public class PageFactory } /** + * Creates the. * * @param source - * @return + * the source + * @param locale + * the locale + * @return the page */ public Page create(final URL source, final Locale locale) { @@ -154,11 +171,13 @@ public class PageFactory } /** + * Gets the. * * @param source - * @param parameters - * @return - * @throws Exception + * the source + * @param keys + * the keys + * @return the page */ public Page get(final Document source, final String... keys) { @@ -178,10 +197,13 @@ public class PageFactory } /** + * Gets the. * * @param source - * @param parameters - * @return + * the source + * @param keys + * the keys + * @return the page */ public Page get(final File source, final String... keys) { @@ -201,10 +223,13 @@ public class PageFactory } /** + * Gets the. * * @param source - * @param parameters - * @return + * the source + * @param keys + * the keys + * @return the page */ public Page get(final String source, final String... keys) { @@ -224,10 +249,13 @@ public class PageFactory } /** + * Gets the. * * @param source - * @param parameters - * @return + * the source + * @param keys + * the keys + * @return the page */ public Page get(final URL source, final String... keys) { @@ -247,8 +275,9 @@ public class PageFactory } /** + * Size. * - * @return + * @return the int */ public int size() { @@ -261,8 +290,9 @@ public class PageFactory } /** + * Instance. * - * @return + * @return the page factory */ public static PageFactory instance() { diff --git a/src/fr/devinsy/xidyn/presenters/DomPresenter.java b/src/fr/devinsy/xidyn/presenters/DomPresenter.java index 8f94c52..8b5e3b7 100644 --- a/src/fr/devinsy/xidyn/presenters/DomPresenter.java +++ b/src/fr/devinsy/xidyn/presenters/DomPresenter.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -28,7 +28,7 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.utils.XidynUtils; /** - * + * The Class DomPresenter. */ public class DomPresenter implements Presenter { @@ -38,8 +38,8 @@ public class DomPresenter implements Presenter private StringBuffer defaultHtmlTarget; /** - * - */ + * Instantiates a new dom presenter. + */ public DomPresenter() { this.dom = null; @@ -47,8 +47,11 @@ public class DomPresenter implements Presenter } /** - * - */ + * Instantiates a new dom presenter. + * + * @param doc + * the doc + */ public DomPresenter(final Document doc) { setSource(doc); @@ -107,8 +110,10 @@ public class DomPresenter implements Presenter } /** - * - */ + * Gets the dom. + * + * @return the dom + */ public Document getDOM() { Document result; @@ -169,8 +174,11 @@ public class DomPresenter implements Presenter } /** - * - */ + * Sets the dom. + * + * @param doc + * the new dom + */ public void setDOM(final Document doc) { this.dom = doc; @@ -178,8 +186,11 @@ public class DomPresenter implements Presenter } /** - * - */ + * Sets the source. + * + * @param doc + * the new source + */ public void setSource(final Document doc) { this.dom = doc; @@ -187,9 +198,8 @@ public class DomPresenter implements Presenter this.isOutdated = true; } - /** - * - * @throws Exception + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#update() */ @Override public void update() throws Exception diff --git a/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java b/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java index 8d9a4cf..c0ac86a 100644 --- a/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java +++ b/src/fr/devinsy/xidyn/presenters/DomPresenterCore.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -42,7 +42,7 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.utils.XidynUtils; /** - * + * The Class DomPresenterCore. */ public class DomPresenterCore { @@ -53,6 +53,14 @@ public class DomPresenterCore /** * Dynamize a doc with data. + * + * @param doc + * the doc + * @param data + * the data + * @return the string buffer + * @throws Exception + * the exception */ public static StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception { @@ -68,6 +76,14 @@ public class DomPresenterCore /** * Dynamize a doc with data. + * + * @param doc + * the doc + * @param data + * the data + * @return the string buffer + * @throws Exception + * the exception */ public static StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception { @@ -81,6 +97,15 @@ public class DomPresenterCore /** * Dynamize a doc with data. + * + * @param result + * the result + * @param doc + * the doc + * @param data + * the data + * @throws Exception + * the exception */ public static void dynamize(final Writer result, final Document doc, final TagDataListById data) throws Exception { @@ -89,6 +114,15 @@ public class DomPresenterCore /** * Dynamize a doc with data. + * + * @param result + * the result + * @param doc + * the doc + * @param data + * the data + * @throws Exception + * the exception */ public static void dynamize(final Writer result, final Document doc, final TagDataManager data) throws Exception { @@ -96,8 +130,12 @@ public class DomPresenterCore } /** - * - */ + * Gets the class attribute value. + * + * @param node + * the node + * @return the class attribute value + */ private static String getClassAttributeValue(final Node node) { String result; @@ -129,6 +167,8 @@ public class DomPresenterCore * Get the text for an element. Converts new lines to spaces. * * @param node + * the node + * @return the element text */ private static String getElementText(final Node node) { @@ -174,8 +214,14 @@ public class DomPresenterCore } /** - * - */ + * Merge attributes. + * + * @param target + * the target + * @param source + * the source + * @return the tag attributes + */ private static TagAttributes mergeAttributes(final TagAttributes target, final TagAttributes source) { TagAttributes result; @@ -245,8 +291,17 @@ public class DomPresenterCore } /** - * - */ + * Process. + * + * @param result + * the result + * @param node + * the node + * @param data + * the data + * @throws Exception + * the exception + */ private static void process(final Writer result, final Node node, final TagDataListById data) throws Exception { process(result, node, data, ""); @@ -255,6 +310,16 @@ public class DomPresenterCore /** * Recursive method that processes a node and any child nodes. * + * @param result + * the result + * @param node + * the node + * @param datas + * the datas + * @param suffix + * the suffix + * @throws Exception + * the exception */ private static void process(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception { @@ -375,8 +440,12 @@ public class DomPresenterCore } /** - * - */ + * Process attributes. + * + * @param attrs + * the attrs + * @return the string buffer + */ private static StringBuffer processAttributes(final NamedNodeMap attrs) { StringBuffer result; @@ -388,8 +457,14 @@ public class DomPresenterCore } /** - * - */ + * Process attributes. + * + * @param attrs + * the attrs + * @param dataAttributes + * the data attributes + * @return the string buffer + */ private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes) { StringBuffer result; @@ -401,8 +476,16 @@ public class DomPresenterCore } /** - * - */ + * Process attributes. + * + * @param attrs + * the attrs + * @param dataAttributes + * the data attributes + * @param suffix + * the suffix + * @return the string buffer + */ private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final String suffix) { StringBuffer result; @@ -466,8 +549,18 @@ public class DomPresenterCore } /** - * - */ + * Process attributes. + * + * @param attrs + * the attrs + * @param dataAttributes + * the data attributes + * @param namedDataAttributes + * the named data attributes + * @param suffix + * the suffix + * @return the string buffer + */ private static StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final TagAttributes namedDataAttributes, final String suffix) { StringBuffer result; @@ -479,16 +572,36 @@ public class DomPresenterCore } /** - * - */ + * Process children. + * + * @param result + * the result + * @param node + * the node + * @param datas + * the datas + * @throws Exception + * the exception + */ private static void processChildren(final Writer result, final Node node, final TagDataListById datas) throws Exception { processChildren(result, node, datas, ""); } /** - * - */ + * Process children. + * + * @param result + * the result + * @param node + * the node + * @param datas + * the datas + * @param suffix + * the suffix + * @throws Exception + * the exception + */ private static void processChildren(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception { // Get the iteration strategy. @@ -618,7 +731,16 @@ public class DomPresenterCore } /** - * TODO remove? + * TODO remove?. + * + * @param result + * the result + * @param node + * the node + * @param datas + * the datas + * @throws Exception + * the exception */ private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas) throws Exception { @@ -626,8 +748,19 @@ public class DomPresenterCore } /** - * - */ + * Process element basically. + * + * @param result + * the result + * @param node + * the node + * @param datas + * the datas + * @param suffix + * the suffix + * @throws Exception + * the exception + */ private static void processElementBasically(final Writer result, final Node node, final TagDataListById datas, final String suffix) throws Exception { logger.debug("processElementBasically - started [{}]", node.getNodeName()); @@ -664,12 +797,18 @@ public class DomPresenterCore * Processes a node that has dynamic content. Calls the appropriate code * generator method, depending on the tag. * + * @param result + * the result * @param node * Current node. * @param attrs * The tag attributes. * @param idAttr * The ID. + * @param datas + * the datas + * @throws Exception + * the exception */ private static void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas) throws Exception @@ -681,12 +820,20 @@ public class DomPresenterCore * Processes a node that has dynamic content. Calls the appropriate code * generator method, depending on the tag. * + * @param result + * the result * @param node * Current node. * @param attrs * The tag attributes. * @param idAttr * The ID. + * @param datas + * the datas + * @param suffix + * the suffix + * @throws Exception + * the exception */ private static void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagDataListById datas, final String suffix) throws Exception { diff --git a/src/fr/devinsy/xidyn/presenters/FilePresenter.java b/src/fr/devinsy/xidyn/presenters/FilePresenter.java index 7e5f462..5c1dbb8 100644 --- a/src/fr/devinsy/xidyn/presenters/FilePresenter.java +++ b/src/fr/devinsy/xidyn/presenters/FilePresenter.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -29,7 +29,7 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.utils.XidynUtils; /** - * + * The Class FilePresenter. */ public class FilePresenter extends StringPresenter { @@ -40,24 +40,30 @@ public class FilePresenter extends StringPresenter private long sourceTime; /** - * - */ + * Instantiates a new file presenter. + */ public FilePresenter() { setSource((String) null); } /** - * - */ + * Instantiates a new file presenter. + * + * @param source + * the source + */ public FilePresenter(final File source) { setSource(source); } /** - * - */ + * Instantiates a new file presenter. + * + * @param filePathname + * the file pathname + */ public FilePresenter(final String filePathname) { setSource(filePathname); @@ -104,8 +110,10 @@ public class FilePresenter extends StringPresenter } /** - * - */ + * Gets the file. + * + * @return the file + */ public File getFile() { File result; @@ -178,8 +186,11 @@ public class FilePresenter extends StringPresenter } /** - * - */ + * Sets the source. + * + * @param source + * the new source + */ public void setSource(final File source) { if (source == null) @@ -200,8 +211,10 @@ public class FilePresenter extends StringPresenter } /** - * @throws Exception + * Sets the source. * + * @param source + * the new source */ @Override public void setSource(final String source) @@ -234,7 +247,10 @@ public class FilePresenter extends StringPresenter } /** + * Update. + * * @throws Exception + * the exception */ @Override public void update() throws Exception diff --git a/src/fr/devinsy/xidyn/presenters/FilePresenters.java b/src/fr/devinsy/xidyn/presenters/FilePresenters.java index a7af61a..3f14da9 100644 --- a/src/fr/devinsy/xidyn/presenters/FilePresenters.java +++ b/src/fr/devinsy/xidyn/presenters/FilePresenters.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -24,7 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * + * The Class FilePresenters. */ public class FilePresenters extends Vector { @@ -32,16 +32,19 @@ public class FilePresenters extends Vector private static Logger logger = LoggerFactory.getLogger(FilePresenters.class); /** - * - */ + * Instantiates a new file presenters. + */ public FilePresenters() { super(); } /** - * - */ + * Instantiates a new file presenters. + * + * @param source + * the source + */ public FilePresenters(final FilePresenters source) { super(); @@ -52,8 +55,12 @@ public class FilePresenters extends Vector } /** - * - */ + * Exists. + * + * @param source + * the source + * @return true, if successful + */ public boolean exists(final String source) { boolean result; @@ -72,8 +79,12 @@ public class FilePresenters extends Vector } /** - * - */ + * Gets the by index. + * + * @param id + * the id + * @return the by index + */ public FilePresenter getByIndex(final int id) { FilePresenter result; @@ -85,8 +96,12 @@ public class FilePresenters extends Vector } /** - * - */ + * Gets the by source. + * + * @param source + * the source + * @return the by source + */ public FilePresenter getBySource(final String source) { FilePresenter result; @@ -129,8 +144,12 @@ public class FilePresenters extends Vector } /** - * - */ + * Gets the index of. + * + * @param source + * the source + * @return the index of + */ public int getIndexOf(final String source) { int result; @@ -172,9 +191,9 @@ public class FilePresenters extends Vector return result; } - /** - * - */ + /* (non-Javadoc) + * @see java.util.Vector#toString() + */ @Override public String toString() { diff --git a/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java b/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java index 38cb909..5852088 100644 --- a/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java +++ b/src/fr/devinsy/xidyn/presenters/FilePresentersProxy.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -22,7 +22,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * + * The Class FilePresentersProxy. */ public class FilePresentersProxy { @@ -32,16 +32,25 @@ public class FilePresentersProxy private FilePresenters presenters = null; /** - * - */ + * Instantiates a new file presenters proxy. + * + * @throws Exception + * the exception + */ protected FilePresentersProxy() throws Exception { this.presenters = new FilePresenters(); } /** - * - */ + * Gets the by source. + * + * @param source + * the source + * @return the by source + * @throws Exception + * the exception + */ public FilePresenter getBySource(final String source) throws Exception { FilePresenter result; @@ -65,8 +74,12 @@ public class FilePresentersProxy } /** - * - */ + * Instance. + * + * @return the file presenters proxy + * @throws Exception + * the exception + */ public static FilePresentersProxy instance() throws Exception { FilePresentersProxy result; diff --git a/src/fr/devinsy/xidyn/presenters/GenericPresenter.java b/src/fr/devinsy/xidyn/presenters/GenericPresenter.java index 2bdcf9f..d56dbd1 100644 --- a/src/fr/devinsy/xidyn/presenters/GenericPresenter.java +++ b/src/fr/devinsy/xidyn/presenters/GenericPresenter.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -26,7 +26,7 @@ import org.w3c.dom.Document; import fr.devinsy.xidyn.data.TagDataManager; /** - * + * The Class GenericPresenter. */ public class GenericPresenter implements Presenter { @@ -35,8 +35,11 @@ public class GenericPresenter implements Presenter private Presenter presenter; /** - * - */ + * Instantiates a new generic presenter. + * + * @param source + * the source + */ public GenericPresenter(final Document source) { if (source == null) @@ -50,8 +53,11 @@ public class GenericPresenter implements Presenter } /** - * - */ + * Instantiates a new generic presenter. + * + * @param source + * the source + */ public GenericPresenter(final File source) { if (source == null) @@ -65,8 +71,11 @@ public class GenericPresenter implements Presenter } /** - * - */ + * Instantiates a new generic presenter. + * + * @param source + * the source + */ public GenericPresenter(final String source) { if (source == null) @@ -80,8 +89,11 @@ public class GenericPresenter implements Presenter } /** - * - */ + * Instantiates a new generic presenter. + * + * @param source + * the source + */ public GenericPresenter(final URL source) { if (source == null) @@ -94,9 +106,9 @@ public class GenericPresenter implements Presenter } } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#dynamize() + */ @Override public StringBuffer dynamize() throws Exception { @@ -108,9 +120,9 @@ public class GenericPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#dynamize(fr.devinsy.xidyn.data.TagDataManager) + */ @Override public StringBuffer dynamize(final TagDataManager datas) throws Exception { @@ -122,9 +134,9 @@ public class GenericPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#getSource() + */ @Override public Object getSource() { @@ -150,9 +162,9 @@ public class GenericPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#isOutdated() + */ @Override public boolean isOutdated() throws Exception { @@ -165,8 +177,10 @@ public class GenericPresenter implements Presenter } /** + * Sets the source. * * @param source + * the new source */ public void setSource(final Document source) { @@ -181,8 +195,10 @@ public class GenericPresenter implements Presenter } /** + * Sets the source. * * @param source + * the new source */ public void setSource(final File source) { @@ -197,8 +213,10 @@ public class GenericPresenter implements Presenter } /** + * Sets the source. * * @param source + * the new source */ public void setSource(final String source) { @@ -213,8 +231,10 @@ public class GenericPresenter implements Presenter } /** + * Sets the source. * * @param source + * the new source */ public void setSource(final URL source) { @@ -229,8 +249,14 @@ public class GenericPresenter implements Presenter } /** - * - */ + * To string. + * + * @param language + * the language + * @return the string + * @throws Exception + * the exception + */ public String toString(final String language) throws Exception { String result; @@ -241,14 +267,13 @@ public class GenericPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#update() + */ @Override public void update() throws Exception { this.presenter.update(); - } } diff --git a/src/fr/devinsy/xidyn/presenters/Presenter.java b/src/fr/devinsy/xidyn/presenters/Presenter.java index 529cf26..bf82734 100644 --- a/src/fr/devinsy/xidyn/presenters/Presenter.java +++ b/src/fr/devinsy/xidyn/presenters/Presenter.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,6 +21,8 @@ package fr.devinsy.xidyn.presenters; import fr.devinsy.xidyn.data.TagDataManager; /** + * The Interface Presenter. + * * This objectives of a presenter are: *
    *
  • return the untouched source if there is no tag data (dynamize()) @@ -30,43 +32,55 @@ import fr.devinsy.xidyn.data.TagDataManager; */ public interface Presenter { + /** + * Dynamize. * - * @param datas - * @return + * @return the string buffer * @throws Exception + * the exception */ public StringBuffer dynamize() throws Exception; /** + * Dynamize. * * @param datas - * @return + * the datas + * @return the string buffer * @throws Exception + * the exception */ public StringBuffer dynamize(final TagDataManager datas) throws Exception; /** + * Gets the source. * - * @return + * @return the source */ public Object getSource(); /** * This method check if the source exists and it is readable. * - * @return + * @return true, if is available */ public boolean isAvailable(); /** + * Checks if is outdated. * - * @return + * @return true, if is outdated + * @throws Exception + * the exception */ public boolean isOutdated() throws Exception; /** - * - */ + * Update. + * + * @throws Exception + * the exception + */ public void update() throws Exception; } diff --git a/src/fr/devinsy/xidyn/presenters/PresenterFactory.java b/src/fr/devinsy/xidyn/presenters/PresenterFactory.java index 159546f..6043733 100644 --- a/src/fr/devinsy/xidyn/presenters/PresenterFactory.java +++ b/src/fr/devinsy/xidyn/presenters/PresenterFactory.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -31,7 +31,7 @@ import fr.devinsy.util.FileTools; import fr.devinsy.xidyn.utils.cache.Cache; /** - * + * A factory for creating Presenter objects. */ public class PresenterFactory { @@ -49,25 +49,27 @@ public class PresenterFactory private Cache cache; /** - * - */ + * Instantiates a new presenter factory. + */ private PresenterFactory() { this.cache = new Cache(); } /** - * - */ + * Clear. + */ public void clear() { this.cache.clear(); } /** + * Gets the. * * @param source - * @return + * the source + * @return the presenter */ public Presenter get(final CharSequence source) { @@ -86,9 +88,13 @@ public class PresenterFactory } /** + * Gets the. * * @param source - * @return + * the source + * @param locale + * the locale + * @return the presenter */ public Presenter get(final CharSequence source, final Locale locale) { @@ -126,9 +132,11 @@ public class PresenterFactory } /** + * Gets the. * * @param source - * @return + * the source + * @return the presenter */ public Presenter get(final Document source) { @@ -147,9 +155,11 @@ public class PresenterFactory } /** + * Gets the. * * @param source - * @return + * the source + * @return the presenter */ public Presenter get(final File source) { @@ -168,9 +178,13 @@ public class PresenterFactory } /** + * Gets the. * * @param source - * @return + * the source + * @param locale + * the locale + * @return the presenter */ public Presenter get(final File source, final Locale locale) { @@ -208,9 +222,11 @@ public class PresenterFactory } /** + * Gets the. * * @param source - * @return + * the source + * @return the presenter */ public Presenter get(final URL source) { @@ -229,10 +245,13 @@ public class PresenterFactory } /** + * Gets the. * * @param source - * @return - * @throws MalformedURLException + * the source + * @param locale + * the locale + * @return the presenter */ public Presenter get(final URL source, final Locale locale) { @@ -280,8 +299,9 @@ public class PresenterFactory } /** + * Size. * - * @return + * @return the int */ public int size() { @@ -294,9 +314,11 @@ public class PresenterFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the presenter */ public static Presenter create(final CharSequence source) { @@ -339,9 +361,13 @@ public class PresenterFactory } /** + * Creates the. * * @param source - * @return + * the source + * @param locale + * the locale + * @return the presenter */ public static Presenter create(final CharSequence source, final Locale locale) { @@ -372,9 +398,11 @@ public class PresenterFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the presenter */ public static Presenter create(final Document source) { @@ -394,9 +422,11 @@ public class PresenterFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the presenter */ public static Presenter create(final File source) { @@ -416,10 +446,13 @@ public class PresenterFactory } /** + * Creates the. * * @param source + * the source * @param locale - * @return + * the locale + * @return the presenter */ public static Presenter create(final File source, final Locale locale) { @@ -450,9 +483,11 @@ public class PresenterFactory } /** + * Creates the. * * @param source - * @return + * the source + * @return the presenter */ public static Presenter create(final URL source) { @@ -472,9 +507,13 @@ public class PresenterFactory } /** + * Creates the. * * @param source - * @return + * the source + * @param locale + * the locale + * @return the presenter */ public static Presenter create(final URL source, final Locale locale) { @@ -513,8 +552,9 @@ public class PresenterFactory } /** + * Instance. * - * @return + * @return the presenter factory */ public static PresenterFactory instance() { diff --git a/src/fr/devinsy/xidyn/presenters/PresenterUtils.java b/src/fr/devinsy/xidyn/presenters/PresenterUtils.java index ef9e3a4..ec782a3 100644 --- a/src/fr/devinsy/xidyn/presenters/PresenterUtils.java +++ b/src/fr/devinsy/xidyn/presenters/PresenterUtils.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -28,25 +28,29 @@ import fr.devinsy.xidyn.data.TagDataListById; import fr.devinsy.xidyn.data.TagDataManager; /** - * + * The Class PresenterUtils. */ public class PresenterUtils { private static Logger logger = LoggerFactory.getLogger(PresenterUtils.class); /** - * - */ + * Instantiates a new presenter utils. + */ private PresenterUtils() { } /** + * Dynamize. * * @param doc + * the doc * @param data - * @return + * the data + * @return the string buffer * @throws Exception + * the exception */ public static StringBuffer dynamize(final Document doc, final TagDataListById data) throws Exception { @@ -59,11 +63,15 @@ public class PresenterUtils } /** + * Dynamize. * * @param doc + * the doc * @param data - * @return + * the data + * @return the string buffer * @throws Exception + * the exception */ public static StringBuffer dynamize(final Document doc, final TagDataManager data) throws Exception { @@ -77,6 +85,12 @@ public class PresenterUtils /** * Dynamize a file without data. + * + * @param source + * the source + * @return the string buffer + * @throws Exception + * the exception */ public static StringBuffer dynamize(final File source) throws Exception { @@ -92,6 +106,14 @@ public class PresenterUtils /** * Dynamize a file. + * + * @param source + * the source + * @param datas + * the datas + * @return the string buffer + * @throws Exception + * the exception */ public static StringBuffer dynamize(final File source, final TagDataManager datas) throws Exception { @@ -108,6 +130,14 @@ public class PresenterUtils /** * Dynamize a string with HTML in, or with file path name in, or with URL * in. + * + * @param source + * the source + * @param datas + * the datas + * @return the string buffer + * @throws Exception + * the exception */ public static StringBuffer dynamize(final String source, final TagDataManager datas) throws Exception { @@ -122,9 +152,11 @@ public class PresenterUtils } /** + * Checks for html tag. * * @param source - * @return + * the source + * @return true, if successful */ public static boolean hasHtmlTag(final String source) { diff --git a/src/fr/devinsy/xidyn/presenters/StringPresenter.java b/src/fr/devinsy/xidyn/presenters/StringPresenter.java index c09d8c1..7768729 100644 --- a/src/fr/devinsy/xidyn/presenters/StringPresenter.java +++ b/src/fr/devinsy/xidyn/presenters/StringPresenter.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -28,7 +28,7 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.utils.XidynUtils; /** - * + * The Class StringPresenter. */ public class StringPresenter implements Presenter { @@ -39,16 +39,19 @@ public class StringPresenter implements Presenter private Document dom; /** - * - */ + * Instantiates a new string presenter. + */ public StringPresenter() { setSource(""); } /** - * - */ + * Instantiates a new string presenter. + * + * @param html + * the html + */ public StringPresenter(final String html) { setSource(html); @@ -215,8 +218,11 @@ public class StringPresenter implements Presenter } /** - * - */ + * Sets the source. + * + * @param html + * the new source + */ public void setSource(final String html) { this.source = html; @@ -224,9 +230,9 @@ public class StringPresenter implements Presenter this.dom = null; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#update() + */ @Override public void update() throws Exception { diff --git a/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java b/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java index 1ba2464..9c9f829 100644 --- a/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java +++ b/src/fr/devinsy/xidyn/presenters/TranslatorPresenter.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -26,7 +26,7 @@ import fr.devinsy.util.FileTools; import fr.devinsy.xidyn.data.TagDataManager; /** - * + * The Class TranslatorPresenter. */ public class TranslatorPresenter implements Presenter { @@ -35,8 +35,11 @@ public class TranslatorPresenter implements Presenter private Map presenters; /** - * - */ + * Instantiates a new translator presenter. + * + * @param defaultSource + * the default source + */ public TranslatorPresenter(final String defaultSource) { @@ -51,9 +54,9 @@ public class TranslatorPresenter implements Presenter } } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#dynamize() + */ @Override public StringBuffer dynamize() throws Exception { @@ -74,8 +77,14 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * Dynamize. + * + * @param locale + * the locale + * @return the string buffer + * @throws Exception + * the exception + */ public StringBuffer dynamize(final Locale locale) throws Exception { StringBuffer result; @@ -99,8 +108,14 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * Dynamize. + * + * @param language + * the language + * @return the string buffer + * @throws Exception + * the exception + */ public StringBuffer dynamize(final String language) throws Exception { StringBuffer result; @@ -111,9 +126,9 @@ public class TranslatorPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#dynamize(fr.devinsy.xidyn.data.TagDataManager) + */ @Override public StringBuffer dynamize(final TagDataManager datas) throws Exception { @@ -134,8 +149,16 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * Dynamize. + * + * @param datas + * the datas + * @param locale + * the locale + * @return the string buffer + * @throws Exception + * the exception + */ public StringBuffer dynamize(final TagDataManager datas, final Locale locale) throws Exception { StringBuffer result; @@ -159,8 +182,16 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * Dynamize. + * + * @param datas + * the datas + * @param language + * the language + * @return the string buffer + * @throws Exception + * the exception + */ public StringBuffer dynamize(final TagDataManager datas, final String language) throws Exception { StringBuffer result; @@ -172,8 +203,14 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * Gets the presenter. + * + * @param locale + * the locale + * @return the presenter + * @throws Exception + * the exception + */ public Presenter getPresenter(final Locale locale) throws Exception { Presenter result; @@ -197,8 +234,14 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * Gets the presenter. + * + * @param language + * the language + * @return the presenter + * @throws Exception + * the exception + */ public Presenter getPresenter(final String language) throws Exception { Presenter result; @@ -253,9 +296,9 @@ public class TranslatorPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#getSource() + */ @Override public Object getSource() { @@ -267,9 +310,9 @@ public class TranslatorPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#isAvailable() + */ @Override public boolean isAvailable() { @@ -288,9 +331,9 @@ public class TranslatorPresenter implements Presenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#isOutdated() + */ @Override public boolean isOutdated() throws Exception { @@ -298,8 +341,14 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * To string. + * + * @param locale + * the locale + * @return the string + * @throws Exception + * the exception + */ public String toString(final Locale locale) throws Exception { String result; @@ -323,8 +372,14 @@ public class TranslatorPresenter implements Presenter } /** - * - */ + * To string. + * + * @param language + * the language + * @return the string + * @throws Exception + * the exception + */ public String toString(final String language) throws Exception { String result; @@ -343,6 +398,9 @@ public class TranslatorPresenter implements Presenter return result; } + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.Presenter#update() + */ @Override public void update() throws Exception { diff --git a/src/fr/devinsy/xidyn/presenters/URLPresenter.java b/src/fr/devinsy/xidyn/presenters/URLPresenter.java index f842c55..79da481 100644 --- a/src/fr/devinsy/xidyn/presenters/URLPresenter.java +++ b/src/fr/devinsy/xidyn/presenters/URLPresenter.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -29,7 +29,7 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.utils.XidynUtils; /** - * + * The Class URLPresenter. */ public class URLPresenter extends StringPresenter { @@ -40,8 +40,8 @@ public class URLPresenter extends StringPresenter private long sourceTime; /** - * - */ + * Instantiates a new URL presenter. + */ public URLPresenter() { super(); @@ -49,8 +49,11 @@ public class URLPresenter extends StringPresenter } /** - * - */ + * Instantiates a new URL presenter. + * + * @param source + * the source + */ public URLPresenter(final String source) { super(); @@ -58,8 +61,11 @@ public class URLPresenter extends StringPresenter } /** - * - */ + * Instantiates a new URL presenter. + * + * @param source + * the source + */ public URLPresenter(final URL source) { super(); @@ -68,6 +74,10 @@ public class URLPresenter extends StringPresenter /** * No need to be synchronized. + * + * @return the string buffer + * @throws Exception + * the exception */ @Override public StringBuffer dynamize() throws Exception @@ -86,6 +96,12 @@ public class URLPresenter extends StringPresenter /** * No need to be synchronized. + * + * @param data + * the data + * @return the string buffer + * @throws Exception + * the exception */ @Override public StringBuffer dynamize(final TagDataManager data) throws Exception @@ -119,8 +135,10 @@ public class URLPresenter extends StringPresenter } /** - * - */ + * Gets the url. + * + * @return the url + */ public URL getURL() { URL result; @@ -208,9 +226,9 @@ public class URLPresenter extends StringPresenter return result; } - /** - * - */ + /* (non-Javadoc) + * @see fr.devinsy.xidyn.presenters.StringPresenter#setSource(java.lang.String) + */ @Override public void setSource(final String source) { @@ -263,8 +281,10 @@ public class URLPresenter extends StringPresenter } /** + * Sets the source. * * @param source + * the new source */ public void setSource(final URL source) { @@ -284,9 +304,9 @@ public class URLPresenter extends StringPresenter } } - /** - * - */ + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { @@ -313,6 +333,7 @@ public class URLPresenter extends StringPresenter * No need to be synchronized. * * @throws Exception + * the exception */ @Override public void update() throws Exception diff --git a/src/fr/devinsy/xidyn/utils/ParserErrorHandler.java b/src/fr/devinsy/xidyn/utils/ParserErrorHandler.java index 77dcfd2..620e71e 100644 --- a/src/fr/devinsy/xidyn/utils/ParserErrorHandler.java +++ b/src/fr/devinsy/xidyn/utils/ParserErrorHandler.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -24,11 +24,14 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.SAXParseException; /** - * Extract from org.xml.sax Interface ErrorHandler: "If a SAX application needs - * to implement customized error handling, it must implement this interface and - * then register an instance with the XML reader using the setErrorHandler - * method. The parser will then report all errors and warnings through this - * interface." + * The Class ParserErrorHandler. + * + * Extract from org.xml.sax Interface ErrorHandler: + * + * "If a SAX application needs to implement customized error handling, it must + * implement this interface and then register an instance with the XML reader + * using the setErrorHandler method. The parser will then report all errors and + * warnings through this interface." * */ public class ParserErrorHandler implements ErrorHandler @@ -38,6 +41,9 @@ public class ParserErrorHandler implements ErrorHandler private int errorsCount; private int warningCount; + /** + * Instantiates a new parser error handler. + */ public ParserErrorHandler() { this.fatalErrorsCount = 0; @@ -47,8 +53,10 @@ public class ParserErrorHandler implements ErrorHandler } /** - * - */ + * All errors count. + * + * @return the int + */ public int allErrorsCount() { int result; @@ -62,9 +70,8 @@ public class ParserErrorHandler implements ErrorHandler /** * Called by the XML parser to handle fatal errors. * - * @param ex - * Parse Excpetion. Contains the warning text and the line - * number. + * @param exception + * the exception */ @Override public void error(final SAXParseException exception) @@ -76,8 +83,10 @@ public class ParserErrorHandler implements ErrorHandler } /** - * - */ + * Errors count. + * + * @return the int + */ public int errorsCount() { int result; @@ -91,10 +100,8 @@ public class ParserErrorHandler implements ErrorHandler /** * Called by the XML parser to handle fatal errors. * - * @param ex - * Parse Excpetion. Contains the error text and the line number. - * When a fatal parse error occurs, the parse does not return a - * document. + * @param exception + * the exception */ @Override public void fatalError(final SAXParseException exception) @@ -106,8 +113,10 @@ public class ParserErrorHandler implements ErrorHandler } /** - * - */ + * Fatal errors count. + * + * @return the int + */ public int fatalErrorsCount() { int result; @@ -119,8 +128,10 @@ public class ParserErrorHandler implements ErrorHandler } /** - * - */ + * Checks for error. + * + * @return true, if successful + */ public boolean hasError() { boolean result; @@ -138,9 +149,9 @@ public class ParserErrorHandler implements ErrorHandler return result; } - /** - * - */ + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ @Override public String toString() { @@ -161,9 +172,8 @@ public class ParserErrorHandler implements ErrorHandler /** * Called by the XML parser to handle warnings. * - * @param ex - * Parse Excpetion. Contains the warning text and the line - * number. + * @param exception + * the exception */ @Override public void warning(final SAXParseException exception) @@ -175,8 +185,10 @@ public class ParserErrorHandler implements ErrorHandler } /** - * - */ + * Warning count. + * + * @return the int + */ public int warningCount() { int result; diff --git a/src/fr/devinsy/xidyn/utils/XidynUtils.java b/src/fr/devinsy/xidyn/utils/XidynUtils.java index b6ccd6e..af2bb9e 100644 --- a/src/fr/devinsy/xidyn/utils/XidynUtils.java +++ b/src/fr/devinsy/xidyn/utils/XidynUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2006-2016 Christian Pierre MOMON + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -44,7 +44,7 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** - * + * The Class XidynUtils. */ public class XidynUtils { @@ -53,6 +53,13 @@ public class XidynUtils /** * This method adds a tag to a DOM object. + * + * @param doc + * the doc + * @param name + * the name + * @param content + * the content */ public static void addMetaTag(final Document doc, final String name, final String content) { @@ -78,6 +85,12 @@ public class XidynUtils /** * This method builds a DOM object from a source. + * + * @param source + * the source + * @return the document + * @throws Exception + * the exception */ public static Document buildDom(final InputStream source) throws Exception { @@ -150,6 +163,12 @@ public class XidynUtils /** * This method builds a DOM object from a source. + * + * @param source + * the source + * @return the document + * @throws Exception + * the exception */ public static Document buildDom(final String source) throws Exception { @@ -222,6 +241,10 @@ public class XidynUtils /** * Good estimation of the target length able to optimize performance. + * + * @param sourceLength + * the source length + * @return the int */ public static int estimatedTargetLength(final long sourceLength) { @@ -249,8 +272,12 @@ public class XidynUtils } /** - * - */ + * Extract body content. + * + * @param source + * the source + * @return the string + */ public static String extractBodyContent(final CharSequence source) { String result; @@ -299,6 +326,7 @@ public class XidynUtils * * * @param source + * the source * @return the string before the html tag or null if no html * tag found. So, "" if there is a html tag without doctype. */ @@ -364,8 +392,14 @@ public class XidynUtils } /** - * - */ + * File to dom. + * + * @param source + * the source + * @return the document + * @throws Exception + * the exception + */ public static Document fileToDom(final File source) throws Exception { Document result; @@ -408,6 +442,8 @@ public class XidynUtils * * @param node * Document node. + * @param name + * the name * @return The head tag node */ public static Node findNodeByName(final Node node, final String name) @@ -480,10 +516,13 @@ public class XidynUtils } /** + * Load. * - * @param file - * @return + * @param source + * the source + * @return the string * @throws IOException + * Signals that an I/O exception has occurred. */ public static String load(final File source) throws IOException { @@ -497,9 +536,15 @@ public class XidynUtils } /** + * Load. * - * @param file + * @param source + * the source + * @param charsetName + * the charset name + * @return the string * @throws IOException + * Signals that an I/O exception has occurred. */ public static String load(final File source, final String charsetName) throws IOException { @@ -512,10 +557,13 @@ public class XidynUtils } /** + * Load. * - * @param file - * @return + * @param source + * the source + * @return the string * @throws IOException + * Signals that an I/O exception has occurred. */ public static String load(final URL source) throws IOException { @@ -529,9 +577,15 @@ public class XidynUtils } /** + * Load. * - * @param file + * @param source + * the source + * @param charsetName + * the charset name + * @return the string * @throws IOException + * Signals that an I/O exception has occurred. */ public static String load(final URL source, final String charsetName) throws IOException { @@ -549,9 +603,15 @@ public class XidynUtils } /** + * Load to string buffer. * * @param file + * the file + * @param charsetName + * the charset name + * @return the string buffer * @throws IOException + * Signals that an I/O exception has occurred. */ public static StringBuffer loadToStringBuffer(final File file, final String charsetName) throws IOException { @@ -599,9 +659,16 @@ public class XidynUtils } /** + * Read. * - * @param file + * @param out + * the out + * @param is + * the is + * @param charsetName + * the charset name * @throws IOException + * Signals that an I/O exception has occurred. */ public static void read(final StringBuffer out, final InputStream is, final String charsetName) throws IOException { @@ -701,8 +768,14 @@ public class XidynUtils } /** - * - */ + * Url to dom. + * + * @param source + * the source + * @return the document + * @throws Exception + * the exception + */ public static Document urlToDom(final URL source) throws Exception { Document result; diff --git a/src/fr/devinsy/xidyn/utils/cache/Cache.java b/src/fr/devinsy/xidyn/utils/cache/Cache.java index 978a329..f02240f 100644 --- a/src/fr/devinsy/xidyn/utils/cache/Cache.java +++ b/src/fr/devinsy/xidyn/utils/cache/Cache.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2016 Christian Pierre MOMON + * Copyright (C) 2016,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -24,7 +24,10 @@ import java.util.Map; import fr.devinsy.xidyn.utils.cache.CacheStrategy.Strategy; /** - * + * The Class Cache. + * + * @param + * the generic type */ public class Cache { @@ -32,8 +35,8 @@ public class Cache private Map> map; /** - * - */ + * Instantiates a new cache. + */ public Cache() { this.strategy = new CacheStrategy(Strategy.NONE, 0); @@ -41,8 +44,11 @@ public class Cache } /** - * - */ + * Instantiates a new cache. + * + * @param initialCapacity + * the initial capacity + */ public Cache(final int initialCapacity) { this.strategy = new CacheStrategy(Strategy.NONE, 0); @@ -50,18 +56,19 @@ public class Cache } /** - * - */ + * Clear. + */ public void clear() { this.map.clear(); } /** + * Gets the. * * @param key - * @return - * @throws Exception + * the key + * @return the t */ public T get(final Object key) { @@ -83,8 +90,9 @@ public class Cache } /** + * Checks if is empty. * - * @return + * @return true, if is empty */ public boolean isEmpty() { @@ -97,8 +105,8 @@ public class Cache } /** - * - */ + * Purge. + */ public void purge() { switch (this.strategy.getStrategy()) @@ -126,9 +134,13 @@ public class Cache } /** + * Put. * + * @param key + * the key * @param source - * @return + * the source + * @return the t */ public T put(final Object key, final T source) { @@ -157,8 +169,9 @@ public class Cache } /** + * Size. * - * @return + * @return the int */ public int size() { diff --git a/src/fr/devinsy/xidyn/utils/cache/CacheItem.java b/src/fr/devinsy/xidyn/utils/cache/CacheItem.java index 1bb54d9..2dc288e 100644 --- a/src/fr/devinsy/xidyn/utils/cache/CacheItem.java +++ b/src/fr/devinsy/xidyn/utils/cache/CacheItem.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2016 Christian Pierre MOMON + * Copyright (C) 2016,17 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,7 +21,10 @@ package fr.devinsy.xidyn.utils.cache; import java.util.Date; /** - * + * The Class CacheItem. + * + * @param + * the generic type */ public class CacheItem { @@ -31,8 +34,10 @@ public class CacheItem private long accessDate; /** + * Instantiates a new cache item. * * @param source + * the source */ public CacheItem(final T source) { @@ -43,8 +48,9 @@ public class CacheItem } /** + * Access date. * - * @return + * @return the long */ public long accessDate() { @@ -57,8 +63,9 @@ public class CacheItem } /** + * Creation date. * - * @return + * @return the long */ public long creationDate() { @@ -71,8 +78,9 @@ public class CacheItem } /** + * Edition date. * - * @return + * @return the long */ public long editionDate() { @@ -85,8 +93,9 @@ public class CacheItem } /** + * Gets the value. * - * @return + * @return the value */ public T getValue() { @@ -100,8 +109,10 @@ public class CacheItem } /** + * Sets the value. * * @param source + * the new value */ public void setValue(final T source) { @@ -110,8 +121,9 @@ public class CacheItem } /** + * Time. * - * @return + * @return the long */ private static long time() { diff --git a/src/fr/devinsy/xidyn/utils/cache/CacheStrategy.java b/src/fr/devinsy/xidyn/utils/cache/CacheStrategy.java index 92d28ac..c9d85ae 100644 --- a/src/fr/devinsy/xidyn/utils/cache/CacheStrategy.java +++ b/src/fr/devinsy/xidyn/utils/cache/CacheStrategy.java @@ -1,5 +1,5 @@ -/** - * Copyright (C)2016 Christian Pierre MOMON +/* + * Copyright (C) 2016,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -19,7 +19,7 @@ package fr.devinsy.xidyn.utils.cache; /** - * + * The Class CacheStrategy. */ public class CacheStrategy { @@ -34,9 +34,12 @@ public class CacheStrategy private long parameter; /** + * Instantiates a new cache strategy. * * @param strategy + * the strategy * @param parameter + * the parameter */ public CacheStrategy(final Strategy strategy, final long parameter) { @@ -55,21 +58,43 @@ public class CacheStrategy } } + /** + * Gets the parameter. + * + * @return the parameter + */ public long getParameter() { return this.parameter; } + /** + * Gets the strategy. + * + * @return the strategy + */ public Strategy getStrategy() { return this.strategy; } + /** + * Sets the parameter. + * + * @param parameter + * the new parameter + */ public void setParameter(final long parameter) { this.parameter = parameter; } + /** + * Sets the strategy. + * + * @param strategy + * the new strategy + */ public void setStrategy(final Strategy strategy) { this.strategy = strategy; diff --git a/src/fr/devinsy/xidyn/views/CharterView.java b/src/fr/devinsy/xidyn/views/CharterView.java index 4902c61..abff1e7 100644 --- a/src/fr/devinsy/xidyn/views/CharterView.java +++ b/src/fr/devinsy/xidyn/views/CharterView.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,16 +21,22 @@ package fr.devinsy.xidyn.views; import java.util.Locale; /** - * + * The Interface CharterView. */ public interface CharterView extends View { /** + * Gets the html. * * @param userId - * @param lang + * the user id + * @param language + * the language * @param content - * @return + * the content + * @return the html + * @throws Exception + * the exception */ public StringBuffer getHtml(final Long userId, final Locale language, final CharSequence content) throws Exception; } diff --git a/src/fr/devinsy/xidyn/views/View.java b/src/fr/devinsy/xidyn/views/View.java index f17558c..3abc517 100644 --- a/src/fr/devinsy/xidyn/views/View.java +++ b/src/fr/devinsy/xidyn/views/View.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -19,13 +19,17 @@ package fr.devinsy.xidyn.views; /** - * + * The Interface View. */ public interface View { /** - * - */ + * Gets the html. + * + * @return the html + * @throws Exception + * the exception + */ public StringBuffer getHtml() throws Exception; } diff --git a/test/Foo.java b/test/Foo.java index d18d085..02ea84c 100644 --- a/test/Foo.java +++ b/test/Foo.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2014 Christian Pierre MOMON +/* + * Copyright (C) 2006-2014,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -21,13 +21,18 @@ import org.w3c.dom.Document; import fr.devinsy.xidyn.utils.XidynUtils; /** - * + * The Class Foo. */ -class Foo +public class Foo { + /** - * @throws Exception + * The main method. * + * @param args + * the arguments + * @throws Exception + * the exception */ public static void main(final String[] args) throws Exception { diff --git a/test/XidynTest.java b/test/XidynTest.java index 9948dfb..c815a42 100644 --- a/test/XidynTest.java +++ b/test/XidynTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -25,7 +25,7 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.presenters.PresenterUtils; /** - * + * The Class XidynTest. */ class XidynTest { @@ -46,6 +46,7 @@ class XidynTest } private static Logger logger = LoggerFactory.getLogger(XidynTest.class); + static { // Initialize logger. @@ -54,8 +55,16 @@ class XidynTest } /** - * - */ + * Check. + * + * @param title + * the title + * @param source + * the source + * @param model + * the model + * @return the string + */ public static String check(final String title, final StringBuffer source, final String model) { String result; @@ -75,8 +84,11 @@ class XidynTest }; /** - * - */ + * The main method. + * + * @param args + * the arguments + */ public static void main(final String[] args) { System.out.println("Automatic test action for Xid!"); diff --git a/test/fr/devinsy/xidyn/pages/PageFactoryTest.java b/test/fr/devinsy/xidyn/pages/PageFactoryTest.java index be6e546..2e27832 100644 --- a/test/fr/devinsy/xidyn/pages/PageFactoryTest.java +++ b/test/fr/devinsy/xidyn/pages/PageFactoryTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2016 Christian Pierre MOMON +/* + * Copyright (C) 2016,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -26,13 +26,13 @@ import org.junit.Before; import org.junit.Test; /** - * + * The Class PageFactoryTest. */ public class PageFactoryTest { /** - * - */ + * Before. + */ @Before public void before() { @@ -41,8 +41,10 @@ public class PageFactoryTest } /** - * @throws Exception + * Test page 01. * + * @throws Exception + * the exception */ @Test(expected = IllegalArgumentException.class) public void testPage01() throws Exception @@ -55,8 +57,10 @@ public class PageFactoryTest } /** - * @throws Exception + * Test page 02. * + * @throws Exception + * the exception */ @Test public void testPage02() throws Exception diff --git a/test/fr/devinsy/xidyn/pages/PageTest.java b/test/fr/devinsy/xidyn/pages/PageTest.java index 9ee406a..57fb548 100644 --- a/test/fr/devinsy/xidyn/pages/PageTest.java +++ b/test/fr/devinsy/xidyn/pages/PageTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2016 Christian Pierre MOMON +/* + * Copyright (C) 2016,2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -28,13 +28,13 @@ import org.junit.Test; import fr.devinsy.xidyn.presenters.StringPresenter; /** - * + * The Class PageTest. */ public class PageTest { /** - * - */ + * Before. + */ @Before public void before() { @@ -43,8 +43,10 @@ public class PageTest } /** - * @throws Exception + * Test page 01. * + * @throws Exception + * the exception */ @Test public void testPage01() throws Exception diff --git a/test/fr/devinsy/xidyn/presenters/DomPresenterTest.java b/test/fr/devinsy/xidyn/presenters/DomPresenterTest.java index 85304a4..f7faca0 100644 --- a/test/fr/devinsy/xidyn/presenters/DomPresenterTest.java +++ b/test/fr/devinsy/xidyn/presenters/DomPresenterTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -24,14 +24,15 @@ import org.junit.Test; import fr.devinsy.xidyn.data.TagDataManager; /** - * + * The Class DomPresenterTest. */ public class DomPresenterTest { - /** - * @throws Exception + * Test static dynamize 01. * + * @throws Exception + * the exception */ @Test public void testStaticDynamize01() throws Exception @@ -44,8 +45,10 @@ public class DomPresenterTest } /** - * @throws Exception + * Test static dynamize 02. * + * @throws Exception + * the exception */ @Test public void testStaticDynamize02() throws Exception @@ -56,5 +59,4 @@ public class DomPresenterTest Assertions.assertThat(target).isEqualTo(source); } - } diff --git a/test/fr/devinsy/xidyn/presenters/PresenterUtilsTest.java b/test/fr/devinsy/xidyn/presenters/PresenterUtilsTest.java index 8dc87c0..a8be1d2 100644 --- a/test/fr/devinsy/xidyn/presenters/PresenterUtilsTest.java +++ b/test/fr/devinsy/xidyn/presenters/PresenterUtilsTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -28,13 +28,13 @@ import org.junit.Test; import fr.devinsy.xidyn.data.TagDataManager; /** - * + * The Class PresenterUtilsTest. */ public class PresenterUtilsTest { /** - * - */ + * Before. + */ @Before public void before() { @@ -43,8 +43,10 @@ public class PresenterUtilsTest } /** - * @throws Exception + * Test static dynamize 01. * + * @throws Exception + * the exception */ @Test public void testStaticDynamize01() throws Exception @@ -57,8 +59,10 @@ public class PresenterUtilsTest } /** - * @throws Exception + * Test static dynamize 02. * + * @throws Exception + * the exception */ @Test public void testStaticDynamize02() throws Exception @@ -69,5 +73,4 @@ public class PresenterUtilsTest Assertions.assertThat(target).isEqualTo(source); } - } diff --git a/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java b/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java index 521c827..f7fcb29 100644 --- a/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java +++ b/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -28,13 +28,13 @@ import org.junit.Test; import fr.devinsy.xidyn.data.TagDataManager; /** - * + * The Class StringPresenterTest. */ public class StringPresenterTest { /** - * - */ + * Before. + */ @Before public void before() { @@ -43,8 +43,10 @@ public class StringPresenterTest } /** - * @throws Exception + * Test dynamize 01. * + * @throws Exception + * the exception */ @Test public void testDynamize01() throws Exception @@ -57,8 +59,10 @@ public class StringPresenterTest } /** - * @throws Exception + * Test dynamize 02. * + * @throws Exception + * the exception */ @Test public void testDynamize02() throws Exception @@ -71,8 +75,10 @@ public class StringPresenterTest } /** - * @throws Exception + * Test dynamize 03. * + * @throws Exception + * the exception */ @Test public void testDynamize03() throws Exception diff --git a/test/fr/devinsy/xidyn/utils/XidynUtilsTest.java b/test/fr/devinsy/xidyn/utils/XidynUtilsTest.java index 54340ce..a5e32e9 100644 --- a/test/fr/devinsy/xidyn/utils/XidynUtilsTest.java +++ b/test/fr/devinsy/xidyn/utils/XidynUtilsTest.java @@ -1,5 +1,5 @@ -/** - * Copyright (C) 2006-2016 Christian Pierre MOMON +/* + * Copyright (C) 2006-2017 Christian Pierre MOMON * * This file is part of Xidyn. * @@ -26,13 +26,13 @@ import org.junit.Before; import org.junit.Test; /** - * + * The Class XidynUtilsTest. */ public class XidynUtilsTest { /** - * - */ + * Before. + */ @Before public void before() { @@ -41,8 +41,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract body content 01. + */ @Test public void testExtractBodyContent01() { @@ -53,8 +53,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract body content 02. + */ @Test public void testExtractBodyContent02() { @@ -65,8 +65,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract body content 03. + */ @Test public void testExtractBodyContent03() { @@ -77,8 +77,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract body content 04. + */ @Test public void testExtractBodyContent04() { @@ -89,8 +89,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract body content 05. + */ @Test public void testExtractBodyContent05() { @@ -118,8 +118,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract doctype 01. + */ @Test public void testExtractDoctype01() { @@ -130,8 +130,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract doctype 02. + */ @Test public void testExtractDoctype02() { @@ -142,8 +142,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract doctype 03. + */ @Test public void testExtractDoctype03() { @@ -154,8 +154,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract doctype 04. + */ @Test public void testExtractDoctype04() { @@ -166,8 +166,8 @@ public class XidynUtilsTest } /** - * - */ + * Test extract doctype 05. + */ @Test public void testExtractDoctype05() { @@ -176,5 +176,4 @@ public class XidynUtilsTest String target = XidynUtils.extractDoctype(source); Assertions.assertThat(target).isEqualTo(""); } - }