package x7c1.linen;

import android.content.Context;
import android.content.Intent;

import x7c1.linen.dev.CreateRecordsActivity;
import x7c1.linen.glue.activity.ActivityLabel;
import x7c1.linen.glue.service.ServiceLabel;

import static java.lang.String.format;

public class Control {

	public static Class<?> getActivityClassOf(ActivityLabel label) {
		final Class<?> klass;
		switch(label){
			case SettingChannels:
				klass = SettingChannelsActivity.class;
				break;
			case CreateRecords:
				klass = CreateRecordsActivity.class;
				break;
			default:
				throw new IllegalArgumentException(format("unknown activity label: %s", label));
		}
		return klass;
	}

	public static Intent getActivityIntentOf(Context context, ActivityLabel label) {
		final Intent intent;
		switch (label){
			case SettingChannels:
				intent = new Intent(context, SettingChannelsActivity.class);
				break;
			case CreateRecords:
				intent = new Intent(context, CreateRecordsActivity.class);
				break;
			default:
				throw new IllegalArgumentException(format("unknown activity label: %s", label));
		}
		return intent;
	}

	public static Class<?> getServiceClassOf(ServiceLabel label) {
		final Class<?> klass;
		switch(label){
			case Updater:
				klass = UpdaterService.class;
				break;
			default:
				throw new IllegalArgumentException(format("unknown service label: %s", label));
		}
		return klass;
	}

	public static Intent getServiceIntentOf(Context context, ServiceLabel label) {
		final Intent intent;
		switch(label){
			case Updater:
				intent = new Intent(context, UpdaterService.class);
				break;
			default:
				throw new IllegalArgumentException(format("unknown service label: %s", label));
		}
		return intent;
	}
}

@@ -18,72 +18,8 @@
 n;%0A%0A
-import android.content.Context;%0Aimport android.content.Intent;%0A%0A
 impo
@@ -617,1042 +617,274 @@
 tic 
-Intent getActivityIntentOf(Context context, ActivityLabel label) %7B%0A%09%09final Intent intent;%0A%09%09switch (label)%7B%0A%09%09%09case SettingChannels:%0A%09%09%09%09intent = new Intent(context, SettingChannelsActivity.class);%0A%09%09%09%09break;%0A%09%09%09case CreateRecords:%0A%09%09%09%09intent = new Intent(context, CreateRecordsActivity.class);%0A%09%09%09%09break;%0A%09%09%09default:%0A%09%09%09%09throw new IllegalArgumentException(format(%22unknown activity label: %25s%22, label));%0A%09%09%7D%0A%09%09return intent;%0A%09%7D%0A%0A%09public static Class%3C?%3E getServiceClassOf(ServiceLabel label) %7B%0A%09%09final Class%3C?%3E klass;%0A%09%09switch(label)%7B%0A%09%09%09case Updater:%0A%09%09%09%09klass = UpdaterService.class;%0A%09%09%09%09break;%0A%09%09%09default:%0A%09%09%09%09throw new IllegalArgumentException(format(%22unknown service label: %25s%22, label));%0A%09%09%7D%0A%09%09return klass;%0A%09%7D%0A%0A%09public static Intent getServiceIntentOf(Context context, ServiceLabel label) %7B%0A%09%09final Intent intent;%0A%09%09switch(label)%7B%0A%09%09%09case Updater:%0A%09%09%09%09intent = new Intent(context, UpdaterService.class);%0A%09%09%09%09break;%0A%09%09%09default:%0A%09%09%09%09throw new IllegalArgumentException(format(%22unknown service label: %25s%22, label));%0A%09%09%7D%0A%09%09return intent
+Class%3C?%3E getServiceClassOf(ServiceLabel label) %7B%0A%09%09final Class%3C?%3E klass;%0A%09%09switch(label)%7B%0A%09%09%09case Updater:%0A%09%09%09%09klass = UpdaterService.class;%0A%09%09%09%09break;%0A%09%09%09default:%0A%09%09%09%09throw new IllegalArgumentException(format(%22unknown service label: %25s%22, label));%0A%09%09%7D%0A%09%09return klass
 ;%0A%09%7D

remove unused methods