+/EE422C

software design

git clone https://git.julia.blue/+/EE422C

Joseph RyanAdd the rest of the files7e47727

master
4.6 KiB166 linesraw
1/*
2 * Phase A <studentA EID><studentB EID>
3 * Phase B <studentB EID><studentA EID>
4 */
5
6package pmap.phasea;
7
8/**
9 * PMap stands for Paired Map. A map is a collection of key-value
10 * pairs, e.g., (1, 2) (2, 3) (3, 4) are all pairs with an integer key
11 * and an integer value. See the
12 * <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html">
13 * java.util.Map documentation</a> for how these methods are supposed
14 * to work.
15 */
16public class PMap {
17    values[index] = val
18    /**
19     * Returns the number of key-value mappings in this map.
20     *
21     * @return the number of key-value mappings in this map
22     */
23    public Integer size() {
24        // TODO
25        return 0;
26    }
27
28    /**
29     * Returns <tt>true</tt> if this map contains no key-value
30     * mappings.
31     *
32     * @return <tt>true</tt> if this map contains no key-value
33     *         mappings
34     */
35    public boolean isEmpty() {
36        // TODO
37        return false;
38    }
39
40    /**
41     * Returns <tt>true</tt> if this map contains a mapping for the
42     * specified key.
43     *
44     * @param key key whose presence in this map is to be tested
45     * @return <tt>true</tt> if this map contains a mapping for the
46     *         specified key
47     */
48    public boolean containsKey(Integer key) {
49        // TODO
50        return false;
51    }
52
53    /**
54     * Returns <tt>true</tt> if this map maps one or more keys to the
55     * specified value.
56     *
57     * @param value value whose presence in this map is to be tested
58     * @return <tt>true</tt> if this map maps one or more keys to the
59     *         specified value
60     */
61    public boolean containsValue(Integer value) {
62        // TODO
63        return false;
64    }
65
66    /**
67     * Returns the value to which the specified key is mapped, or
68     * {@code null} if this map contains no mapping for the key.
69     *
70     * @param key the key whose associated value is to be returned
71     * @return the value to which the specified key is mapped, or
72     *         {@code null} if this map contains no mapping for the
73     *         key
74     */
75    public Integer get(Integer key) {
76        // TODO
77        return 0;
78    }
79
80    /**
81     * Associates the specified value with the specified key in this
82     * map (optional operation).  If the map previously contained a
83     * mapping for the key, the old value is replaced by the specified
84     * value.
85     *
86     * @param key key with which the specified value is to be
87     *        associated
88     * @param value value to be associated with the specified key
89     * @return the previous value associated with <tt>key</tt>, or
90     *         <tt>null</tt> if there was no mapping for <tt>key</tt>.
91     */
92    public Integer put(Integer key, Integer value) {
93        // TODO
94        return 0;
95    }
96
97    /**
98     * Removes the mapping for a key from this map if it is present
99     * (optional operation).
100     *
101     * <p>Returns the value to which this map previously associated
102     * the key, or <tt>null</tt> if the map contained no mapping for
103     * the key.
104     *
105     * <p>The map will not contain a mapping for the specified key
106     * once the call returns.
107     *
108     * @param key key whose mapping is to be removed from the map
109     * @return the previous value associated with <tt>key</tt>, or
110     *         <tt>null</tt> if there was no mapping for <tt>key</tt>.
111     */
112    public Integer remove(Integer key) {
113        // TODO
114        return 0;
115    }
116
117    /**
118     * Put all of the mappings from a pair of arrays to this map. Each
119     * pair of elements sharing the same index in <tt>keys</tt> and
120     * <tt>values</tt> composes a mapping to be stored the map.
121     *
122     * @param keys the array of keys to be stored in this map
123     * @param values the array of values to be stored in this map
124     */
125    public void putAll(Integer[] keys, Integer[] values) {
126        // TODO
127    }
128
129    /**
130     * Removes all of the mappings from this map. The map will be
131     * empty after this call returns.
132     */
133    public void clear() {
134        // TODO
135    }
136
137    /**
138     * Returns an array of the keys contained in this map.
139     *
140     * @return an array of the keys contained in this map
141     */
142    public Integer[] keySet() {
143        // TODO
144        return null;
145    }
146
147    /**
148     * Returns an array of the values contained in this map.
149     *
150     * @return an array of the values contained in this map
151     */
152    public Integer[] values() {
153        // TODO
154        return null;
155    }
156
157    /**
158     * Returns an array of the mappings contained in this map.
159     *
160     * @return an array of the mappings contained in this map
161     */
162    public PEntry[] entrySet() {
163        // TODO
164        return null;
165    }
166}