switch(e.type) {
                    case SWT.Selection:
                        overview.resetState(type);
                }

package org.jcryptool.visual.rss.ui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.jcryptool.visual.rss.Descriptions;
import org.eclipse.swt.widgets.Listener;
import org.jcryptool.visual.rss.Activator;
import org.jcryptool.visual.rss.ui.RssBodyComposite.ActiveRssBodyComposite;

/**
 * A component for the three boxes on the right of the visual. Each component/box contains a button for redoing and viewing.
 *
 * @author Leon Shell, Lukas Krodinger
 */
public class RssVisualDataComposite extends Composite {

    private final Font defaultFont;

    private final Font highlightedFont;

    private final DataType type;

    private final Button viewButton;

    private final Button redoButton;

    private final CLabel l;

    private boolean enabled;

    public RssVisualDataComposite(Composite parent, RssOverviewComposite overview, DataType type) {
        super(parent, SWT.BORDER);
        this.type = type;
        GridLayout gridLayout = new GridLayout(2, false);
        gridLayout.marginWidth = RssOverviewComposite.STATE_BOX_X_PADDING;
        gridLayout.marginHeight = RssOverviewComposite.STATE_BOX_Y_PADDING * 3 / 2;
        gridLayout.verticalSpacing *= 3;
        setLayout(gridLayout);
        setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
        l = new CLabel(this, SWT.CENTER);
        l.setText(type.getName());
        GridData gd = new GridData(SWT.CENTER, SWT.CENTER, true, true, 0, 0);
        gd.horizontalSpan = 2;
        gd.widthHint = l.computeSize(SWT.DEFAULT, SWT.DEFAULT).x + RssOverviewComposite.LABEL_EXTRA_WIDTH;
        l.setLayoutData(gd);
        defaultFont = l.getFont();
        FontData fontData = defaultFont.getFontData()[0];
        highlightedFont = new Font(getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
        GridData buttonGd = new GridData();
        redoButton = new Button(this, SWT.PUSH);
        redoButton.setLayoutData(buttonGd);
        redoButton.setImage(Activator.getImageDescriptor("icons/reset.png").createImage());
        redoButton.setText(Descriptions.Reset);
        viewButton = new Button(this, SWT.PUSH);
        viewButton.setLayoutData(buttonGd);
        viewButton.setImage(Activator.getImageDescriptor("icons/magnifying_glass.png").createImage());
        viewButton.setText(Descriptions.Inspect);
        viewButton.addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event e) {
                switch(e.type) {
                    case SWT.Selection:
                        overview.unfocusAll();
                        setActive();
                        overview.setActiveRssBodyComposite(type.getComposite());
                }
            }
        });
        redoButton.addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event e) {

            }
        });
        setDeactivated();
    }

    public void setFocused() {
        l.setFont(highlightedFont);
        setBackground(RssColors.LIGHT_BLUE);
        l.setBackground(RssColors.LIGHT_BLUE);
    }

    public void setUnfocused() {
        l.setFont(defaultFont);
        if (enabled) {
            setBackground(RssColors.WHITE);
            l.setBackground(RssColors.WHITE);
        } else {
            setBackground(RssColors.LIGHT_GRAY);
            l.setBackground(RssColors.LIGHT_GRAY);
        }
    }

    public void setActive() {
        enabled = true;
        setFocused();
        viewButton.setEnabled(true);
        redoButton.setEnabled(true);
    }

    public void setLit() {
        enabled = true;
        setUnfocused();
        viewButton.setEnabled(true);
        redoButton.setEnabled(true);
    }

    public void setDeactivated() {
        enabled = false;
        setUnfocused();
        viewButton.setEnabled(false);
        redoButton.setEnabled(false);
    }

    public enum DataType {

        KEY(ActiveRssBodyComposite.VIEW_KEY, Descriptions.DataBoxKey), MESSAGE(ActiveRssBodyComposite.VIEW_MESSAGE, Descriptions.DataBoxOrig), REDACTED(ActiveRssBodyComposite.VIEW_REDACTED, Descriptions.DataBoxRed);

        private final ActiveRssBodyComposite composite;

        private final String name;

        DataType(ActiveRssBodyComposite composite, String name) {
            this.composite = composite;
            this.name = name;
        }

        public ActiveRssBodyComposite getComposite() {
            return composite;
        }

        public String getName() {
            return name;
        }
    }
}


switch(dir) {
            case OUT:
                return 0;
            case IN:
                return 1;
            default:
                throw new IllegalArgumentException("Invalid direction: " + dir);
        }

package com.thinkaurelius.titan.graphdb.relations;

import org.apache.tinkerpop.gremlin.structure.Direction;

/**
 * IMPORTANT: The byte values of the proper directions must be sequential,
 * i.e. the byte values of proper and improper directions may NOT be mixed.
 * This is crucial IN the retrieval for proper edges where we make this assumption.
 *
 * @author Matthias Broecheler (example@nnthink.com);
 */
public class EdgeDirection {

    public static final Direction[] PROPER_DIRS = { Direction.IN, Direction.OUT };

    public static boolean impliedBy(Direction sub, Direction sup) {
        return sup == sub || sup == Direction.BOTH;
    }

    public static Direction fromPosition(int pos) {
        switch(pos) {
            case 0:
                return Direction.OUT;
            case 1:
                return Direction.IN;
            default:
                throw new IllegalArgumentException("Invalid position:" + pos);
        }
    }

    public static int position(Direction dir) {

    }

    public static boolean isProperDirection(Direction dir) {
        return dir == Direction.IN || dir == Direction.OUT;
    }
}


switch(msg.what) {
                case MSG_FINISH:
                    result.task.onPostExecute(result.data[0]);
                    break;
                case MSG_PROGRESS:
                    result.task.onProgressUpdate(result.data);
                    break;
            }

package moe.feng.nhentai.util;

import android.os.Handler;
import android.os.Message;
import android.util.Log;
import static moe.feng.nhentai.BuildConfig.DEBUG;

/*
 Real AsyncTask
 */
public abstract class AsyncTask<Params, Progress, Result> {

    private static final String TAG = AsyncTask.class.getSimpleName();

    private static class AsyncResult<Data> {

        public AsyncTask task;

        public Data[] data;

        public AsyncResult(AsyncTask task, Data... data) {
            this.task = task;
            this.data = data;
        }
    }

    private static final int MSG_FINISH = 1000;

    private static final int MSG_PROGRESS = 1001;

    private static Handler sInternalHandler = new Handler() {

        @SuppressWarnings({ "unchecked", "RawUseOfParameterizedType" })
        @Override
        public void handleMessage(Message msg) {
            AsyncResult result = (AsyncResult) msg.obj;

        }
    };

    private Params[] mParams;

    private Thread mThread = new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                Result result = doInBackground(mParams);
                sInternalHandler.sendMessage(sInternalHandler.obtainMessage(MSG_FINISH, new AsyncResult<Result>(AsyncTask.this, result)));
            } catch (Exception e) {
                // Don't crash the whole app
                if (DEBUG) {
                    Log.d(TAG, e.getClass().getSimpleName() + " caught when running background task. Printing stack trace.");
                    Log.d(TAG, Log.getStackTraceString(e));
                }
            }
            Thread.currentThread().interrupt();
        }
    });

    protected void onPostExecute(Result result) {
    }

    protected abstract Result doInBackground(Params... params);

    protected void onPreExecute() {
    }

    protected void onProgressUpdate(Progress... progress) {
    }

    protected void publishProgress(Progress... progress) {
        sInternalHandler.sendMessage(sInternalHandler.obtainMessage(MSG_PROGRESS, new AsyncResult<Progress>(this, progress)));
    }

    public void execute(Params... params) {
        onPreExecute();
        mParams = params;
        mThread.start();
    }
}


switch(selectedTheme) {
            case DEFAULT:
                getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
                break;
            case LIGHT:
                getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO);
                break;
            case DARK:
                getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
        }

/*
 *
 * This file is part of Amahi.
 *
 */
package org.amahi.anywhere.activity;

import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.squareup.otto.Subscribe;
import org.amahi.anywhere.AmahiApplication;
import org.amahi.anywhere.R;
import org.amahi.anywhere.bus.BusProvider;
import org.amahi.anywhere.bus.UploadSettingsOpeningEvent;
import org.amahi.anywhere.fragment.SettingsFragment;
import org.amahi.anywhere.fragment.UploadSettingsFragment;
import org.amahi.anywhere.util.AppTheme;
import org.amahi.anywhere.util.LocaleHelper;

/**
 * Settings activity. Shows application's settings.
 * Settings itself are provided via {@link org.amahi.anywhere.fragment.SettingsFragment}.
 */
public class SettingsActivity extends AppCompatActivity {

    public static final int RESULT_THEME_UPDATED = 3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        AppTheme selectedTheme = AmahiApplication.getInstance().getThemeEnabled();

        super.onCreate(savedInstanceState);
        setUpHomeNavigation();
        setContentView(R.layout.activity_settings);
        if (savedInstanceState == null) {
            setUpSettingsFragment();
        }
    }

    private void setUpHomeNavigation() {
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    private void setUpSettingsFragment() {
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).replace(R.id.settings_container, new SettingsFragment()).commit();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == android.R.id.home) {
            onBackPressed();
            return true;
        }
        return super.onOptionsItemSelected(menuItem);
    }

    @Subscribe
    public void onUploadSettingsOpenEvent(UploadSettingsOpeningEvent event) {
        getSupportFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).replace(R.id.settings_container, new UploadSettingsFragment()).addToBackStack(null).commit();
    }

    @Override
    protected void onResume() {
        super.onResume();
        BusProvider.getBus().register(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        BusProvider.getBus().unregister(this);
    }

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(LocaleHelper.onAttach(newBase));
    }
}