package cyoastudio.data;

import java.util.*;

public class Section {
	public enum ImagePositioning {
		TOP, LEFT, RIGHT, ALTERNATING
	}

	private String title = "";
	private String description = "";
	private ImagePositioning imagePositioning = ImagePositioning.TOP;
	private List<Option> options = new ArrayList<>();
	private int optionsPerRow = 3;
	private int aspectX = 0, aspectY = 0;
	private String classes = "";
	private boolean rollable = false;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<Option> getOptions() {
		return options;
	}

	public void setImagePositioning(ImagePositioning imagePositioning) {
		this.imagePositioning = imagePositioning;
	}

	public ImagePositioning getImagePositioning() {
		return imagePositioning;
	}

	public void setOptionsPerRow(int optionsPerRow) {
		this.optionsPerRow = optionsPerRow;
	}

	public int getOptionsPerRow() {
		return optionsPerRow;
	}

	public int getAspectY() {
		return aspectY;
	}

	public void setAspectY(int aspectY) {
		this.aspectY = aspectY;
	}

	public int getAspectX() {
		return aspectX;
	}

	public void setAspectX(int aspectX) {
		this.aspectX = aspectX;
	}

	public boolean hasAspectRatio() {
		return aspectX != 0 && aspectY != 0;
	}

	public double getAspectRatio() {
		if (aspectY == 0) {
			return 0;
		} else {
			return aspectX / aspectY;
		}
	}

	public String getClasses() {
		return classes;
	}

	public void setClasses(String classes) {
		this.classes = classes;
	}

	@Override
	public String toString() {
		return "Section " + (title == null ? "null" : title);
	}

	public boolean isRollable() {
		return rollable;
	}

	public void setRollable(boolean rollable) {
		this.rollable = rollable;
	}
}

@@ -1521,24 +1521,34 @@
 %09%09return
+ ((double)
  aspectX
  / aspec
@@ -1543,18 +1543,29 @@
 ectX
+)
  /
+ ((double)
  aspectY
 ;%0A%09%09
@@ -1560,16 +1560,17 @@
  aspectY
+)
 ;%0A%09%09%7D%0A%09%7D

Fix bug not allowing most image ratios