1 // Copyright 2011 Google Inc. All Rights Reserved.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 package com.hughes.android.dictionary;
17 import java.io.Serializable;
19 public class DictionaryInfo implements Serializable {
21 private static final long serialVersionUID = -6850863377577700388L;
23 // Stuff populated from the text file.
24 public final String[] langIsos = new String[2];
25 public String uncompressedFilename;
26 public String downloadUrl;
27 public long uncompressedSize;
28 public long creationMillis;
29 public final int[] allTokenCounts = new int[2];
30 public final int[] mainTokenCounts = new int[2];
32 String name; // Determined at runtime based on locale on device--user editable.
33 String localFile; // Determined based on device's Environment.
35 public String toTabSeparatedString() {
36 return String.format("%s\t%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d", langIsos[0],
37 langIsos[1], uncompressedFilename, downloadUrl, creationMillis, uncompressedSize,
38 mainTokenCounts[0], mainTokenCounts[1], allTokenCounts[0],
42 public DictionaryInfo(final String line) {
43 final String[] fields = line.split("\t");
45 langIsos[0] = fields[i++];
46 langIsos[1] = fields[i++];
47 uncompressedFilename = fields[i++];
48 downloadUrl = fields[i++];
49 creationMillis = Long.parseLong(fields[i++]);
50 uncompressedSize = Long.parseLong(fields[i++]);
51 mainTokenCounts[0] = Integer.parseInt(fields[i++]);
52 mainTokenCounts[1] = Integer.parseInt(fields[i++]);
53 allTokenCounts[0] = Integer.parseInt(fields[i++]);
54 allTokenCounts[1] = Integer.parseInt(fields[i++]);
57 public DictionaryInfo() {
62 public String toString() {