X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fdata%2FMetaData.java;h=5989604ce92f51edef0b631a45dcec1ff0200ab6;hb=50df0f093afbc78a1d120bbc7c1233fa704688b1;hp=586196a663fea88aa39fe45111445d76df0d5651;hpb=4094d35262cee2bd2e41c0039b82bd0ef31041f8;p=fanfix.git
diff --git a/src/be/nikiroo/fanfix/data/MetaData.java b/src/be/nikiroo/fanfix/data/MetaData.java
index 586196a..5989604 100644
--- a/src/be/nikiroo/fanfix/data/MetaData.java
+++ b/src/be/nikiroo/fanfix/data/MetaData.java
@@ -4,11 +4,18 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import be.nikiroo.fanfix.supported.SupportType;
import be.nikiroo.utils.Image;
import be.nikiroo.utils.StringUtils;
/**
* The meta data associated to a {@link Story} object.
+ *
+ * Note that some earlier version of the program did not save the resume as an
+ * external file; for those stories, the resume is not fetched until the story
+ * is.
+ *
+ * The cover is never fetched until the story is.
*
* @author niki
*/
@@ -34,6 +41,12 @@ public class MetaData implements Cloneable, Comparable, Serializable {
private String creationDate;
private boolean fakeCover;
+ /**
+ * Create an empty {@link MetaData}.
+ */
+ public MetaData() {
+ }
+
/**
* The title of the story.
*
@@ -73,7 +86,7 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The story publication date.
+ * The story publication date, we try to use "YYYY-mm-dd" when possible.
*
* @return the date
*/
@@ -82,7 +95,7 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The story publication date.
+ * The story publication date, we try to use "YYYY-mm-dd" when possible.
*
* @param date
* the date to set
@@ -114,6 +127,10 @@ public class MetaData implements Cloneable, Comparable, Serializable {
* The story resume (a.k.a. description).
*
* This can be NULL if we don't have a resume for this {@link Story}.
+ *
+ * Note that some earlier version of the program did not save the resume as
+ * an external file; for those stories, the resume is not fetched until the
+ * story is.
*
* @return the resume
*/
@@ -123,6 +140,10 @@ public class MetaData implements Cloneable, Comparable, Serializable {
/**
* The story resume (a.k.a. description).
+ *
+ * Note that some earlier version of the program did not save the resume as
+ * an external file; for those stories, the resume is not fetched until the
+ * story is.
*
* @param resume
* the resume to set
@@ -132,7 +153,9 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The cover image of the story if any (can be NULL).
+ * The cover image of the story, if any (can be NULL).
+ *
+ * The cover is not fetched until the story is.
*
* @return the cover
*/
@@ -141,7 +164,9 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The cover image of the story if any (can be NULL).
+ * The cover image of the story, if any (can be NULL).
+ *
+ * The cover is not fetched until the story is.
*
* @param cover
* the cover to set
@@ -151,7 +176,7 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The subject of the story (or instance, if it is a fanfiction, what is the
+ * The subject of the story (for instance, if it is a fanfiction, what is the
* original work; if it is a technical text, what is the technical
* subject...).
*
@@ -174,7 +199,11 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The source of this story (which online library it was downloaded from).
+ * The source of this story -- a very user-visible piece of data.
+ *
+ * It is initialised with the same value as {@link MetaData#getPublisher()},
+ * but the user is allowed to change it into any value -- this is a sort of
+ * 'category'.
*
* @return the source
*/
@@ -183,7 +212,11 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The source of this story (which online library it was downloaded from).
+ * The source of this story -- a very user-visible piece of data.
+ *
+ * It is initialised with the same value as {@link MetaData#getPublisher()},
+ * but the user is allowed to change it into any value -- this is a sort of
+ * 'category'.
*
* @param source
* the source to set
@@ -231,7 +264,14 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * A unique value representing the story in the local library.
+ * A unique value representing the story in the local library (usually a
+ * numerical value 0-padded with a minimum size of 3; but this is subject to
+ * change and you can also obviously have more than 1000 stories --
+ * a luid may potentially be anything else, including non-numeric
+ * characters).
+ *
+ * A NULL or empty luid represents an incomplete, corrupted or fake
+ * {@link Story}.
*
* @return the luid
*/
@@ -240,7 +280,14 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * A unique value representing the story in the local library.
+ * A unique value representing the story in the local library (usually a
+ * numerical value 0-padded with a minimum size of 3; but this is subject to
+ * change and you can also obviously have more than 1000 stories --
+ * a luid may potentially be anything else, including non-numeric
+ * characters).
+ *
+ * A NULL or empty luid represents an incomplete, corrupted or fake
+ * {@link Story}.
*
* @param luid
* the luid to set
@@ -269,7 +316,15 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The story publisher (other the same as the source).
+ * The story publisher -- which is also the user representation of the
+ * output type this {@link Story} is in (see {@link SupportType}).
+ *
+ * It allows you to know where the {@link Story} comes from, and is not
+ * supposed to change, even when re-imported.
+ *
+ * It's the user representation of the enum
+ * ({@link SupportType#getSourceName()}, not
+ * {@link SupportType#toString()}).
*
* @return the publisher
*/
@@ -278,7 +333,15 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The story publisher (other the same as the source).
+ * The story publisher -- which is also the user representation of the
+ * output type this {@link Story} is in (see {@link SupportType}).
+ *
+ * It allows you to know where the {@link Story} comes from, and is not
+ * supposed to change, even when re-imported.
+ *
+ * It's the user representation of the enum
+ * ({@link SupportType#getSourceName()}, not
+ * {@link SupportType#toString()}).
*
* @param publisher
* the publisher to set
@@ -288,7 +351,14 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The output type this {@link Story} is in.
+ * The output type this {@link Story} is in (see {@link SupportType}).
+ *
+ * It allows you to know where the {@link Story} comes from, and is supposed
+ * to only change when it is imported anew.
+ *
+ * It's the direct representation of the enum
+ * ({@link SupportType#toString()}, not
+ * {@link SupportType#getSourceName()}).
*
* @return the type the type
*/
@@ -297,7 +367,14 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The output type this {@link Story} is in.
+ * The output type this {@link Story} is in (see {@link SupportType}).
+ *
+ * It allows you to know where the {@link Story} comes from, and is supposed
+ * to only change when it is imported anew.
+ *
+ * It's the direct representation of the enum
+ * ({@link SupportType#toString()}, not
+ * {@link SupportType#getSourceName()}).
*
* @param type
* the new type to set
@@ -308,6 +385,10 @@ public class MetaData implements Cloneable, Comparable, Serializable {
/**
* Document catering mostly to image files.
+ *
+ * I.E., this is a comics or a manga, not a textual story with actual words.
+ *
+ * In image documents, all the paragraphs are supposed to be images.
*
* @return the imageDocument state
*/
@@ -317,6 +398,10 @@ public class MetaData implements Cloneable, Comparable, Serializable {
/**
* Document catering mostly to image files.
+ *
+ * I.E., this is a comics or a manga, not a textual story with actual words.
+ *
+ * In image documents, all the paragraphs are supposed to be images.
*
* @param imageDocument
* the imageDocument state to set
@@ -326,45 +411,49 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The number of words in the related {@link Story}.
+ * The number of words (or images if this is an image document -- see
+ * {@link MetaData#isImageDocument()}) in the related {@link Story}.
*
- * @return the number of words
+ * @return the number of words/images
*/
public long getWords() {
return words;
}
/**
- * The number of words in the related {@link Story}.
+ * The number of words (or images if this is an image document -- see
+ * {@link MetaData#isImageDocument()}) in the related {@link Story}.
*
* @param words
- * the number of words to set
+ * the number of words/images to set
*/
public void setWords(long words) {
this.words = words;
}
/**
- * The (Fanfix) {@link Story} creation date.
+ * The (Fanfix) {@link Story} creation date, i.e., when the {@link Story}
+ * was fetched via Fanfix.
*
- * @return the creationDate
+ * @return the creation date
*/
public String getCreationDate() {
return creationDate;
}
/**
- * The (Fanfix) {@link Story} creation date.
+ * The (Fanfix) {@link Story} creation date, i.e., when the {@link Story}
+ * was fetched via Fanfix.
*
* @param creationDate
- * the creationDate to set
+ * the creation date to set
*/
public void setCreationDate(String creationDate) {
this.creationDate = creationDate;
}
/**
- * The cover in this {@link MetaData} object is "fake", in the sens that it
+ * The cover in this {@link MetaData} object is "fake", in the sense that it
* comes from the actual content images.
*
* @return TRUE for a fake cover
@@ -374,7 +463,7 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
/**
- * The cover in this {@link MetaData} object is "fake", in the sens that it
+ * The cover in this {@link MetaData} object is "fake", in the sense that it
* comes from the actual content images
*
* @param fakeCover
@@ -479,8 +568,9 @@ public class MetaData implements Cloneable, Comparable, Serializable {
}
return String.format(
- "Meta %s:\n\tTitle: [%s]\n\tAuthor: [%s]\n\tDate: [%s]\n\tTags: [%s]"
- + "\n\tResume: [%s]\n\tCover: [%s]", luid, title,
- getAuthor(), getDate(), tags.toString(), resume, cover);
+ "Meta %s:\n\tTitle: [%s]\n\tAuthor: [%s]\n\tDate: [%s]\n\tTags: [%s]\n\tWord count: [%s]"
+ + "\n\tResume: [%s]\n\tCover: [%s]",
+ luid, title, getAuthor(), getDate(), tags.toString(),
+ "" + words, resume, cover);
}
}