Package memely

Class Commands

java.lang.Object
memely.Commands

public class Commands
extends Object
String-based commands provided by the meme generation system.

PS3 instructions: this is a required class. You MUST NOT change its name or package or the names or type signatures of existing methods. You MUST NOT add fields, constructors, or instance methods. You may, however, add additional static methods, or strengthen the specs of existing methods.

  • Method Details

    • size

      public static String size​(Expression expression) throws IOException
      Compute the size of an image expression.
      Parameters:
      expression - the meme expression to use
      Returns:
      "WxH" (in the same syntax as the corresponding part of the @ resize operator) representing the width W and height H of the image generated by the expression, according to the language definition in the PS3 handout
      Throws:
      IOException - if any of the filenames used in the expression can't be read as images
    • flip

      public static Expression flip​(Expression expression, FlipDirection direction)
      Flip an image expression horizontally or vertically.
      Parameters:
      expression - the meme expression to flip
      direction - the direction to flip
      Returns:
      a valid expression representing `expression` flipped in `direction`, as described in the PS3 handout
    • image

      public static BufferedImage image​(Expression expression) throws IOException
      Generate the meme of an expression.
      Parameters:
      expression - the expression to generate
      Returns:
      the image generated by the expression, according to the language definition in the PS3 handout
      Throws:
      IOException - if any of the filenames used in the expression can't be read as images