1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
package tim.prune.function.compress;
import tim.prune.function.compress.methods.CompressionMethod;
import java.util.ArrayList;
public class MethodList extends ArrayList<CompressionMethod>
{
public String toConfigString()
{
StringBuilder sb = new StringBuilder();
boolean firstMethod = true;
for (CompressionMethod method : this)
{
if (method == null) {
continue;
}
String methodString = method.getTotalSettingsString();
if (!methodString.isEmpty())
{
if (!firstMethod) {
sb.append(';');
}
sb.append(methodString);
firstMethod = false;
}
}
return sb.toString();
}
public static MethodList fromConfigString(String inString)
{
MethodList methods = new MethodList();
if (inString != null && !inString.isEmpty())
{
for (String methodString : inString.split(";"))
{
CompressionMethod method = CompressionMethod.fromSettingsString(methodString);
if (method != null) {
methods.add(method);
}
}
}
return methods;
}
}
|