Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/pavment/PlaceTokenCodecRegistry.java

Diff revisions: vs.
  @@ -1,8 +1,6 @@
1 1 package com.temp.client.foundation.pavment;
2 2
3 - import java.util.HashMap;
4 - import java.util.Map;
5 -
3 + import java.util.*;
6 4
7 5 /**
8 6 * Registry of the Default PlaceTokenCodec for encoding, and all the
  @@ -18,11 +16,11 @@
18 16 *
19 17 * @return nulls are returned as "", otherwise the Encoded String.
20 18 */
21 - public static String encode(String unencoded) {
22 - if ((unencoded == null) || (unencoded.length() == 0)) {
19 + public static String encode( String unencoded ) {
20 + if ( (unencoded == null) || (unencoded.length() == 0) ) {
23 21 return "";
24 22 }
25 - return Character.toString(DEFAULT_CODEC_ID) + DEFAULT_CODEC.encode(unencoded);
23 + return Character.toString( DEFAULT_CODEC_ID ) + DEFAULT_CODEC.encode( unencoded );
26 24 }
27 25
28 26 /**
  @@ -30,30 +28,32 @@
30 28 * null.
31 29 *
32 30 * @return null indicates that the data was either null or contained
33 - * unacceptable characters for decoding.
31 + * unacceptable characters for decoding.
34 32 */
35 - public static String decode(String encoded) {
36 - if (encoded == null) {
33 + public static String decode( String encoded ) {
34 + if ( encoded == null ) {
37 35 return null;
38 36 }
39 - if (encoded.length() == 0) {
37 + if ( encoded.length() == 0 ) {
40 38 return "";
41 39 }
42 - PlaceTokenCodec codec = CODECS.get(encoded.charAt(0));
43 - return (codec != null) ? codec.decode(encoded.substring(1)) : null;
40 + PlaceTokenCodec codec = CODECS.get( encoded.charAt( 0 ) );
41 + return (codec != null) ? codec.decode( encoded.substring( 1 ) ) : null;
44 42 }
45 43
46 - /******************************** Maintain the order of the following ********************************/
44 + /**
45 + * ***************************** Maintain the order of the following *******************************
46 + */
47 47 private static final Map<Character, PlaceTokenCodec> CODECS = new HashMap<Character, PlaceTokenCodec>();
48 48 private static char DEFAULT_CODEC_ID;
49 49 private static PlaceTokenCodec DEFAULT_CODEC;
50 50
51 - private static void register(char chr, PlaceTokenCodec codec) {
52 - CODECS.put(DEFAULT_CODEC_ID = chr, DEFAULT_CODEC = codec);
51 + private static void register( char chr, PlaceTokenCodec codec ) {
52 + CODECS.put( DEFAULT_CODEC_ID = chr, DEFAULT_CODEC = codec );
53 53 }
54 54
55 55 static { // Last One registered is the Default!
56 - register('0', new PlaceTokenCodecCharacterDeltaWithRandomStart());
57 - register('1', new PlaceTokenCodecCharacterDeltaWithRandomStartWitAdjustment());
56 + register( '0', new PlaceTokenCodecCharacterDeltaWithRandomStart() );
57 + register( '1', new PlaceTokenCodecCharacterDeltaWithRandomStartWitAdjustment() );
58 58 }
59 59 }