aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/equalparts/cardbase/utils/UID.java
blob: ae4a11d277df9c1840977d2ad5e2abae5e7af4e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package eu.equalparts.cardbase.utils;

import eu.equalparts.cardbase.cards.Card;

public class UID {

	/**
	 * Used in the hash generation.
	 */
	private static final String HASH_DIVIDER = "~";
	
	/**
	 * Generate the hash used as a key in the storage map.
	 * 
	 * @param setCode the card's set code.
	 * @param number the card's set number.
	 * @return the generated hash.
	 */
	public static String makeHash(String setCode, String number) {
		return setCode + HASH_DIVIDER + number;
	}

	/**
	 * Generate the hash used as a key in the storage map.
	 * 
	 * @param the {@code Card} whose hash is desired.
	 * @return the generated hash.
	 */
	public static String makeHash(Card card) {
		return card.setCode + HASH_DIVIDER + card.number;
	}

}