<commit_before>package org.demyo.model;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.Date;
import java.util.List;
import java.util.SortedSet;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.NamedEntityGraphs;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.SortComparator;
import org.hibernate.validator.constraints.NotBlank;

import org.demyo.model.constraints.ISBN;
import org.demyo.model.util.AuthorComparator;
import org.demyo.model.util.ComparableComparator;
import org.demyo.model.util.DefaultOrder;
import org.demyo.model.util.IdentifyingNameComparator;

/**
 * Represents Albums. Albums are the core elements in Demyo. They may belong to a {@link Series} or not.
 */
@Entity
@Table(name = "ALBUMS")
@DefaultOrder(expression = { @DefaultOrder.Order(property = "series.name"), @DefaultOrder.Order(property = "cycle"),
		@DefaultOrder.Order(property = "number"), @DefaultOrder.Order(property = "numberSuffix") })
@NamedEntityGraphs({ //
		@NamedEntityGraph(name = "Album.forView", attributeNodes =
		{ @NamedAttributeNode("series"), @NamedAttributeNode("publisher"), @NamedAttributeNode("collection"),
				@NamedAttributeNode("cover"), @NamedAttributeNode("binding"), @NamedAttributeNode("tags"),
				@NamedAttributeNode("writers"), @NamedAttributeNode("artists"), @NamedAttributeNode("colorists"),
				@NamedAttributeNode("inkers"), @NamedAttributeNode("translators"), @NamedAttributeNode("images"),
				@NamedAttributeNode("prices"), @NamedAttributeNode("readersFavourites") }), //
		@NamedEntityGraph(name = "Album.forEdition", attributeNodes =
		{ @NamedAttributeNode("series"), @NamedAttributeNode("publisher"), @NamedAttributeNode("collection"),
				@NamedAttributeNode("cover"), @NamedAttributeNode("binding"), @NamedAttributeNode("tags"),
				@NamedAttributeNode("writers"), @NamedAttributeNode("artists"), @NamedAttributeNode("colorists"),
				@NamedAttributeNode("inkers"), @NamedAttributeNode("translators"), @NamedAttributeNode("images"),
				@NamedAttributeNode("prices") })//
})
public class Album extends AbstractPricedModel<AlbumPrice, Album> {
	private static final ThreadLocal<NumberFormat> NUMBER_FORMAT = new ThreadLocal<NumberFormat>() {
		@Override
		protected NumberFormat initialValue() {
			NumberFormat fmt = NumberFormat.getInstance();
			if (fmt instanceof DecimalFormat) {
				DecimalFormat df = (DecimalFormat) fmt;
				DecimalFormatSymbols symbols = (DecimalFormatSymbols) df.getDecimalFormatSymbols().clone();<commit_msg>Improve Album order for one shots.<commit_after>package org.demyo.model;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.Date;
import java.util.List;
import java.util.SortedSet;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.NamedEntityGraphs;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.SortComparator;
import org.hibernate.validator.constraints.NotBlank;

import org.demyo.model.constraints.ISBN;
import org.demyo.model.util.AuthorComparator;
import org.demyo.model.util.ComparableComparator;
import org.demyo.model.util.DefaultOrder;
import org.demyo.model.util.IdentifyingNameComparator;

/**
 * Represents Albums. Albums are the core elements in Demyo. They may belong to a {@link Series} or not.
 */
@Entity
@Table(name = "ALBUMS")
@DefaultOrder(expression = { @DefaultOrder.Order(property = "series.name"), @DefaultOrder.Order(property = "cycle"),
		@DefaultOrder.Order(property = "number"), @DefaultOrder.Order(property = "numberSuffix"),
		// All other things being equal, sort by title. It's more intuitive for one shots in Album indexes, for example
		@DefaultOrder.Order(property = "title") })
@NamedEntityGraphs({ //
		@NamedEntityGraph(name = "Album.forView", attributeNodes =
		{ @NamedAttributeNode("series"), @NamedAttributeNode("publisher"), @NamedAttributeNode("collection"),
				@NamedAttributeNode("cover"), @NamedAttributeNode("binding"), @NamedAttributeNode("tags"),
				@NamedAttributeNode("writers"), @NamedAttributeNode("artists"), @NamedAttributeNode("colorists"),
				@NamedAttributeNode("inkers"), @NamedAttributeNode("translators"), @NamedAttributeNode("images"),
				@NamedAttributeNode("prices"), @NamedAttributeNode("readersFavourites") }), //
		@NamedEntityGraph(name = "Album.forEdition", attributeNodes =
		{ @NamedAttributeNode("series"), @NamedAttributeNode("publisher"), @NamedAttributeNode("collection"),
				@NamedAttributeNode("cover"), @NamedAttributeNode("binding"), @NamedAttributeNode("tags"),
				@NamedAttributeNode("writers"), @NamedAttributeNode("artists"), @NamedAttributeNode("colorists"),
				@NamedAttributeNode("inkers"), @NamedAttributeNode("translators"), @NamedAttributeNode("images"),
				@NamedAttributeNode("prices") })//
})
public class Album extends AbstractPricedModel<AlbumPrice, Album> {
	private static final ThreadLocal<NumberFormat> NUMBER_FORMAT = new ThreadLocal<NumberFormat>() {
		@Override
		protected NumberFormat initialValue() {
			NumberFormat fmt = NumberFormat.getInstance();
			if (fmt instanceof DecimalFormat) {
				DecimalFormat df = (DecimalFormat) fmt;
				DecimalFormatSymbols symbols = (DecimalFormatSymbols) df.getDecimalFormatSymbols().clone();
{'fraction_non_alphanumeric': 0.1273816840811309, 'fraction_numerical': 0.0, 'mean_word_length': 7.541994750656168, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4625157', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1789, 'n_words': 349}