import java.util.Random; /* An instance of this class moedles a composite regular expression ** whose main operator is concatenation. */ public class RegExprConcat extends RegularExpression { // instance variables // ------------------ private RegularExpression alpha, beta; // constructor // ----------- /* Establishes this regular expression as being the one obtained by ** applying the concatenation operator to the given regular expressions. */ public RegExprConcat(RegularExpression first, RegularExpression second) { alpha = first; beta = second; } // observers // --------- /* Reports whether or not the given string is a member of the language ** represented by this regular expression. ** A string x is a member of L(alpha.beta) iff there exist strings ** y and z such that ** (1) x = yz, ** (2) y is a member of L(alpha), and ** (3) z is a member of L(beta). */ @Override public boolean isMember(String x) { return true; // STUB } @Override public boolean isFinite() { return true; // STUB } @Override public boolean isEmpty() { return true; // STUB } @Override public int minLength() { return 24; // STUB } @Override public int maxLength() { return 19; // STUB } @Override public String randomMember(Random rand) { return "abcd"; // STUB } @Override public String toString() { return alpha.toString() + RegExprSymbols.CONCAT_OP + beta.toString(); } @Override public RegularExpression reverse() { return null; // STUB } }