1 | /* This file is part of Aard Dictionary for Android <http://aarddict.org>. |
2 | * |
3 | * This program is free software: you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License version 3 |
5 | * as published by the Free Software Foundation. |
6 | * |
7 | * This program is distributed in the hope that it will be useful, |
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 | * GNU General Public License <http://www.gnu.org/licenses/gpl-3.0.txt> |
11 | * for more details. |
12 | * |
13 | * Copyright (C) 2010 Igor Tkach |
14 | */ |
15 | |
16 | package aarddict; |
17 | |
18 | import java.util.HashMap; |
19 | import java.util.List; |
20 | import java.util.Map; |
21 | |
22 | import android.util.Log; |
23 | |
24 | public final class Metadata { |
25 | |
26 | private final static String TAG = Metadata.class.getName(); |
27 | |
28 | public String title; |
29 | public String version; |
30 | public int update; |
31 | public String description; |
32 | public String copyright; |
33 | public String license; |
34 | public String source; |
35 | public String lang; |
36 | public String sitelang; |
37 | public String aardtools; |
38 | public String ver; |
39 | public int article_count; |
40 | public String article_format; |
41 | public String article_language; |
42 | public String index_language; |
43 | public String name; |
44 | public String mwlib; |
45 | public String[] language_links; |
46 | public Map<String, Object> siteinfo; |
47 | |
48 | private Map<String, String> interwikiMap; |
49 | |
50 | @SuppressWarnings("unchecked") |
51 | Map<String, String> getInterwikiMap() { |
52 | if (interwikiMap == null) { |
53 | interwikiMap = new HashMap<String, String>(); |
54 | if (siteinfo != null) { |
55 | Log.d(TAG, "Siteinfo not null"); |
56 | List interwiki = (List) siteinfo.get("interwikimap"); |
57 | if (interwiki != null) { |
58 | Log.d(TAG, "Interwiki map not null"); |
59 | for (Object item : interwiki) { |
60 | Map interwikiItem = (Map) item; |
61 | String prefix = (String) interwikiItem.get("prefix"); |
62 | String url = (String) interwikiItem.get("url"); |
63 | interwikiMap.put(prefix, url); |
64 | } |
65 | } |
66 | } |
67 | } |
68 | return interwikiMap; |
69 | } |
70 | } |