From 2766c785025dc89b4db77e257b8a5a476e87949f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 15 Mar 2013 22:51:46 +0100 Subject: [PATCH] Add mutators. --- .../net/pterodactylus/sonitus/data/Format.java | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/main/java/net/pterodactylus/sonitus/data/Format.java b/src/main/java/net/pterodactylus/sonitus/data/Format.java index c9c9b08..59ba9ef 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/Format.java +++ b/src/main/java/net/pterodactylus/sonitus/data/Format.java @@ -91,6 +91,46 @@ public class Format { } // + // MUTATORS + // + + /** + * Returns a format with the same parameters as this format and the given + * number of channels. + * + * @param channels + * The new number of channels + * @return A new format with the given number of channels + */ + public Format channels(int channels) { + return new Format(channels, frequency, encoding); + } + + /** + * Returns a new format with the same parameters as this format and the given + * frequency. + * + * @param frequency + * The new frequency + * @return A new format with the given frequency + */ + public Format frequency(int frequency) { + return new Format(channels, frequency, encoding); + } + + /** + * Returns a new format with the same parameters as this format and the given + * encoding. + * + * @param encoding + * The new encoding + * @return A new format with the given encoding + */ + public Format encoding(String encoding) { + return new Format(channels, frequency, encoding); + } + + // // OBJECT METHODS // -- 2.7.4