From 33cbc71a230e7522168fdfe41afd5e3acf5bb7b5 Mon Sep 17 00:00:00 2001 From: ArghKevin Date: Wed, 8 May 2024 21:24:42 -0700 Subject: Javadoc beginning. --- src/FontFamily.java | 55 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 10 deletions(-) (limited to 'src/FontFamily.java') diff --git a/src/FontFamily.java b/src/FontFamily.java index 54e174f..8e32f05 100644 --- a/src/FontFamily.java +++ b/src/FontFamily.java @@ -8,28 +8,63 @@ import java.util.HashMap; * References: * * Date: - * 2024-04-28 + * 2024-05-08 * * Purpose of class: * Store and operate on font family metadata. */ public class FontFamily { - /* The directory containing the associated METADATA.pb */ - private String directoryName; + /* JSONReader from which metadata is pulled. */ + private JSONReader metadata; /* Taken from first line of METADATA.pb */ private String familyName; /* Taken from fonts/tags/all/families.csv */ - private ArrayList styles; + private HashMap styles; /* Taken from top level of METADATA.pb */ private String dateAdded; - /* Average glyph count of every font file specified in METADATA.pb */ - private int glyphCount; - /* Average file size of every font file specified in METADATA.pb */ - private int fileSize; - /* Author from METADATA.pb */ - private String author; + /* Languages supported. */ + private String[] languages; + private String designer; /* total views, 7day views, 30day views, 90day views, year views. Taken from popularity.json. */ private HashMap views; + private String license; + private String category; + /* popularity.json and families.csv are shared among all families. + Have their associated objects passed from outside. */ + + /* + * Constructor. + */ + public FontFamily(JSONReader metadata, JSONReader popularity, CSVReader styles) { + this.metadata = metadata; + parseMetadata(metadata); + parsePopularity(popularity); + parseStyles(styles); + } + + /* + * Parse metadata. + */ + private void parseMetadata(JSONReader metadata) { + familyName = metadata.get("name"); + dateAdded = metadata.get("date_added"); + languages = metadata.getAll("languages"); + designer = metadata.get("designer"); + license = metadata.get("license"); + category = metadata.get("category"); + } + + /* + * Parse popularity. + */ + private void parsePopularity(JSONReader popularity) { + } + + /* + * Parse styles. + */ + private void parseStyles(CSVReader styles) { + } } -- cgit v1.2.3