import java.util.*; /** * A class that defines a new permutation code, as well as methods for encoding * and decoding of the messages that use this code. */ public class PermutationCode{ /** The original list of characters to be encoded */ ArrayList alphabet = new ArrayList(Arrays.asList( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')); ArrayList code = new ArrayList(26); /** A random number generator */ Random rand = new Random(); /** * Create a new instance of the encoder/decoder with a new permutation code */ PermutationCode(){ this.code = this.initEncoder(); } /** * Create a new instance of the encoder/decoder with the given code */ PermutationCode(ArrayList code){ this.code = code; } /** Initialize the encoding permutation of the characters */ ArrayList initEncoder(){ return this.alphabet; } /** * produce an encoded String from the given String * @param source the String to encode * @return the secretly encoded */ String encode(String source){ return ""; } /** * produce an decoded String from the given String * @param source the String to decode * @return the revealed */ String decode(String code){ return ""; } }