text:
/*
  DO NOT EDIT THIS FILE - the content was created using a source code generator
*/

#ifndef QGRAPHICSROTATIONSLOTS_H
#define QGRAPHICSROTATIONSLOTS_H

#include <QtCore/QObject>
#include <QtCore/QCoreApplication>
#include <QtCore/QString>

#include <QtWidgets/QGraphicsRotation>

#include "qt5xhb_common.h"
#include "qt5xhb_macros.h"
#include "qt5xhb_utils.h"
#include "qt5xhb_signals.h"

class QGraphicsRotationSlots: public QObject
{
  Q_OBJECT
  public:
  QGraphicsRotationSlots( QObject *parent = 0 );
  ~QGraphicsRotationSlots();
  public slots:
  void angleChanged();
  void axisChanged();
  void originChanged();
};

#endif /* QGRAPHICSROTATIONSLOTS_H */

redpajama_set_name: RedPajamaGithub


text:
package com.facebook.buck.android;

import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.BuildRuleParams;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.BuildRuleType;
import com.facebook.buck.rules.Description;
import com.facebook.buck.rules.InstallableApk;
import com.facebook.buck.rules.SourcePath;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.rules.macros.ClasspathMacroExpander;
import com.facebook.buck.rules.macros.ExecutableMacroExpander;
import com.facebook.buck.rules.macros.LocationMacroExpander;
import com.facebook.buck.rules.macros.MacroException;
import com.facebook.buck.rules.macros.MacroExpander;
import com.facebook.buck.rules.macros.MacroHandler;
import com.facebook.buck.util.HumanReadableException;
import com.facebook.infer.annotation.SuppressFieldNotInitialized;
import com.google.common.base.Optional;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedSet;

public class ApkGenruleDescription implements Description<ApkGenruleDescription.Arg> {

  public static final BuildRuleType TYPE = BuildRuleType.of("apk_genrule");

  private static final MacroHandler MACRO_HANDLER =
      new MacroHandler(
          ImmutableMap.<String, MacroExpander>of(
              "classpath", new ClasspathMacroExpander(),
              "exe", new ExecutableMacroExpander(),
              "location", new LocationMacroExpander()));

  @Override
  public BuildRuleType getBuildRuleType() {
    return TYPE;
  }

  @Override
  public Arg createUnpopulatedConstructorArg() {
    return new Arg();
  }

  @Override
  public <A extends Arg> ApkGenrule createBuildRule(
      TargetGraph targetGraph,
      BuildRuleParams params,
      BuildRuleResolver resolver,
      A args) {
    BuildRule installableApk = resolver.getRule(args.apk);
    if (!(installableApk instanceof InstallableApk)) {
      throw new HumanReadableException("The 'apk' argument of %s, %s, must correspond to an " +
          "installable rule, such as android_binary() or apk_genrule().",
          params.getBuildTarget(),
          args.apk.getFullyQualifiedName());
    }

    SourcePathResolver pathResolver = new SourcePathResolver(resolver);

    ImmutableList<SourcePath> srcs = args.srcs.get();
    ImmutableSortedSet<BuildRule> extraDeps =
        ImmutableSortedSet.<BuildRule>naturalOrder()
        .addAll(pathResolver.filterBuildRuleInputs(srcs))
        .add(installableApk)
        .build();

    return new ApkGenrule(
        params
            .copyWithExtraDeps(Suppliers.ofInstance(extraDeps))
            // Attach any extra dependencies found from macro expansion.
            .appendExtraDeps(findExtraDepsFromArgs(params.getBuildTarget(), resolver, args)),
        pathResolver,
        srcs,
        MACRO_HANDLER.getExpander(
            params.getBuildTarget(),
            resolver,
            params.getProjectFilesystem()),
        args.cmd,
        args.bash,
        args.cmdExe,
        params.getProjectFilesystem().getAbsolutifier(),
        (InstallableApk) installableApk);
  }

  private ImmutableList<BuildRule> findExtraDepsFromArgs(
      BuildTarget target,
      BuildRuleResolver resolver,
      Arg arg) {
    ImmutableList.Builder<BuildRule> deps = ImmutableList.builder();
    try {
      for (String val :
            Optional.presentInstances(ImmutableList.of(arg.bash, arg.cmd, arg.cmdExe))) {
        deps.addAll(MACRO_HANDLER.extractAdditionalBuildTimeDeps(target, resolver, val));
      }
    } catch (MacroException e) {
      throw new HumanReadableException(e, "%s: %s", target, e.getMessage());
    }
    return deps.build();
  }

  @SuppressFieldNotInitialized
  public static class Arg {
    public BuildTarget apk;

    public String out;
    public Optional<String> bash;
    public Optional<String> cmd;
    public Optional<String> cmdExe;
    public Optional<ImmutableList<SourcePath>> srcs;

    public Optional<ImmutableSortedSet<BuildTarget>> deps;
  }
}


text:
package fr.ensicaen.gui_simulator.gui.panel;

import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.text.DefaultCaret;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;

import com.mxgraph.examples.swing.editor.BasicGraphEditor;
import com.mxgraph.util.mxResources;

import fr.ensicaen.gui_simulator.gui.core.JTextAreaAppender;
import fr.ensicaen.gui_simulator.gui.core.LimitLinesDocumentListener;

public class ConsolePanel extends JTabbedPane {

	private static Logger logger = LoggerFactory.getLogger(ConsolePanel.class);

	private JTextArea txta_console;

	public ConsolePanel(BasicGraphEditor frame) {
		// tab
		addTab(mxResources.get("console"), new JScrollPane(initTab_console()));
	}

	private JComponent initTab_console() {
		// init txtarea
		txta_console = new JTextArea();
		DefaultCaret caret = (DefaultCaret) txta_console.getCaret();
		caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
		txta_console.setEditable(false);
		txta_console.getDocument().addDocumentListener(new LimitLinesDocumentListener(50));
		txta_console.setRows(5);

		JTextAreaAppender appender = new JTextAreaAppender(txta_console);

		// filter all technic log
		Filter filter = new SimulatorLogFilter();
		appender.addFilter(filter);

		return txta_console;
	}

	private class SimulatorLogFilter extends Filter<ILoggingEvent> {

		public FilterReply decide(ILoggingEvent event) {
			if (event.getLoggerName().startsWith("fr.ensicaen.simulator_ep")
					|| event.getLoggerName().startsWith("fr.ensicaen.simulator")) {
				return FilterReply.ACCEPT;
			}

			return FilterReply.DENY;
		}
	}

	public void reset() {
		txta_console.setText(null);
	}
}


text:
using std::vector;
using std::list;
using std::string;
using std::pair;
using std::runtime_error;

using uint = unsigned int;

class hash_table
{
public:
    hash_table();
    hash_table(uint size_bucket);
    const uint bucket_size = 100;
    vector
    <
        list
        <
            pair <string, int>
        >
    > buckets;
    void add(string key, int value);
    int get(string key);
    void remove(string key);
    void print_table();
private:
    int get_bucket(string key);
    int string_to_int(string key);
    int hash_function(int value);
};

#endif // HASH_TABLE_H


text:
declare namespace org {
  namespace w3c {
    namespace dom {
      namespace css {

        interface CSSImportRule extends org.w3c.dom.css.CSSRule {
          getHref(): java.lang.String
          getMedia(): org.w3c.dom.stylesheets.MediaList
          getStyleSheet(): org.w3c.dom.css.CSSStyleSheet
        }

      }
    }
  }
}


text:
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var LoaderDependency = require("./LoaderDependency");

function LoaderPlugin() {}
module.exports = LoaderPlugin;

LoaderPlugin.prototype.apply = function(compiler) {
	compiler.plugin("compilation", function(compilation, params) {
		var normalModuleFactory = params.normalModuleFactory;

		compilation.dependencyFactories.set(LoaderDependency, normalModuleFactory);
	});
	compiler.plugin("compilation", function(compilation) {
		compilation.plugin("normal-module-loader", function(loaderContext, module) {
			loaderContext.loadModule = function loadModule(request, callback) {
				var dep = new LoaderDependency(request);
				dep.loc = request;
				compilation.addModuleDependencies(module, [
					[dep]
				], true, "lm", false, function(err) {
					if(err) return callback(err);

					if(!dep.module) return callback(new Error("Cannot load the module"));
					if(dep.module.building) dep.module.building.push(next);
					else next();

					function next(err) {
						if(err) return callback(err);

						if(dep.module.error) return callback(dep.module.error);
						if(!dep.module._source) throw new Error("The module created for a LoaderDependency must have a property _source");
						var source, map;
						var moduleSource = dep.module._source;
						if(moduleSource.sourceAndMap) {
							var sourceAndMap = moduleSource.sourceAndMap();
							map = sourceAndMap.map;
							source = sourceAndMap.source;
						} else {
							map = moduleSource.map();
							source = moduleSource.source();
						}
						if(dep.module.fileDependencies) {
							dep.module.fileDependencies.forEach(function(dep) {
								loaderContext.addDependency(dep);
							});
						}
						if(dep.module.contextDependencies) {
							dep.module.contextDependencies.forEach(function(dep) {
								loaderContext.addContextDependency(dep);
							});
						}
						return callback(null, source, map, dep.module);
					}
				});
			};
		});
	});
};


text:
require 'test_helper'

class FlixCloud::BogusRecordTestClass < FlixCloud::Record
  record_column :bogus_record_test_child, 'BogusRecordTestChildClass'
end

class FlixCloud::BogusRecordTestChildClass < FlixCloud::Record
  attr_accessor :bogus_attribute
end

class FlixCloud::RecordTest < Test::Unit::TestCase

  context "With a record object initialized with no options" do
    setup do
      @record = FlixCloud::Record.new
    end

    should "intialize errors to an empty array" do
      assert_equal [], @record.errors
    end
  end

  context "With a record object initialized with options" do
    setup do
      @record = FlixCloud::Record.new(:errors => 'will be set, but', :bad_attributes => 'will not be set')
    end

    should "set the values of attributes that have attr_writers" do
      assert_equal 'will be set, but', @record.errors
    end
  end

  context "With a bogus class has a record column and has been initialized with attributes" do
    setup do
      @bogus_record = FlixCloud::BogusRecordTestClass.new(:bogus_record_test_child => {:bogus_attribute => 'bogus value'})
    end

    should "initialize both the parent class and the child class appropriately, assigning to the child attributes" do
      assert_not_nil @bogus_record
      assert @bogus_record.bogus_record_test_child.is_a?(FlixCloud::BogusRecordTestChildClass)
      assert_equal 'bogus value', @bogus_record.bogus_record_test_child.bogus_attribute
    end

    should "update the child attributes when assigning to the parent's child object attribute (confusing?)" do
      @bogus_record.bogus_record_test_child = {:bogus_attribute => 'a new bogus value'}
      assert_equal 'a new bogus value', @bogus_record.bogus_record_test_child.bogus_attribute
    end
  end

end


text:
//AutoGenerated Begin
//DO NOT EDIT!
package simx.components.editor.gui

import scala.swing._
import simx.components.mesh.ColoredMesh

class ColoredMeshSVarViewGeneratorde93015946924f88b97291a66f765033 extends SVarViewGenerator[ColoredMesh] {

  def generate: SVarView[ColoredMesh] = new SVarView[ColoredMesh] {

//AutoGenerated END
//Put your code below

    /**
     *  The scala.swing.Component that visualizes the value.
     */
    //Todo: Implement yourself!
    val component = new TextArea()

    /**
     *  This function is called whenever the visualized value changes.
     *  It should update component accordingly.
     */
    //Todo: Implement yourself!
    def update(sVarValue: ColoredMesh) {
      val mD = sVarValue
      component.text += "Mesh data:\n"
      component.text += "Indizes Array: "+mD.getIndicesCount+"\n"
      component.text += "Vertices Array: "+mD.getVerticesCount+"\n"
      component.text += "Positions Array: "+mD.positions.length+"\n"
      component.text += "Normals Array: "+mD.normals.length+"\n"
      component.text += "Texture Coords Array: "+mD.texCoords.length+"\n"
      component.text += "Color Array: "+mD.colors.length+"\n"

    }

  }

  /**
   *  The name of this visualizer.
   *  This must not be unique.
   */
  //Todo: Name it!
  val name: String = "ColoredMesh View"

}


text:
package gemlite.shell.converters;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.commons.lang.StringUtils;
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.Converter;
import org.springframework.shell.core.MethodTarget;
import org.springframework.stereotype.Component;

@Component
public class JobStatusConverter implements Converter<String>
{

    @Override
    public boolean supports(Class<?> type, String optionContext)
    {
        return (String.class.equals(type)) && (StringUtils.contains(optionContext, "param.context.job.status"));
    }

    @Override
    public String convertFromText(String value, Class<?> targetType, String optionContext)
    {
        return value;
    }

    @Override
    public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target)
    {
        if ((String.class.equals(targetType)) && (StringUtils.contains(optionContext, "param.context.job.status")))
        {
            Set<String> status = new HashSet<String>();
            status.add("STARTED");
            status.add("COMPLETED");
            for (String regionPath : status)
            {
                if (existingData != null)
                {
                    if (regionPath.startsWith(existingData))
                    {
                        completions.add(new Completion(regionPath));
                    }
                }
                else
                {
                    completions.add(new Completion(regionPath));
                }
            }
        }
        return !completions.isEmpty();
    }

}


text:
Aria.classDefinition({
    $classpath : "test.aria.popups.PopupEventsTestCase",
    $extends : "aria.jsunit.TestCase",
    $dependencies : ["aria.popups.Popup", "aria.templates.Section", "aria.popups.PopupManager"],
    $constructor : function () {
        this.$TestCase.constructor.call(this);
        this.mockSection = {
            html : "test",
            initWidgets : function () {},
            $unregisterListeners : function () {},
            removeContent : function () {},
            $dispose : function () {},
            refreshProcessingIndicator : function () {}
        };
        this.defaultTestTimeout = 5000;
    },
    $prototype : {

        /**
         * Make sure the right events are thrown
         */
        testAsync_checkEvents : function () {
            var browserVersion = parseInt(aria.core.Browser.version, 10);
            var cssAnimationsNotSupported = (aria.core.Browser.isOldIE && browserVersion < 10)
                    || (aria.core.Browser.isFirefox && browserVersion < 4);

            if (cssAnimationsNotSupported) {
                this.notifyTestEnd("testAsync_checkEvents");
                return;
            }

            this.eventsFired = [];
            var conf = {
                // Content
                section : this.mockSection,
                modal : true,
                absolutePosition : {
                    top : 200,
                    left : 500
                },
                animateIn : "slide right",
                animateOut : "slide left"
            };

            this.popup = new aria.popups.Popup();
            var popup = this.popup;
            popup.$on({
                "*" : function (evt) {
                    this.eventsFired.push(evt.name);
                },
                scope : this
            });

            this.assertEquals(this.eventsFired.length, 0);

            popup.open(conf);

            this.assertJsonEquals(["onBeforeOpen", "onPositioned"], this.eventsFired);
            // reset
            this.eventsFired = [];
            this.__waitForEvent(this.checkEventsArrayAfterOpen);
        },

        checkEventsArrayAfterOpen : function () {
            this.assertJsonEquals(["onAfterOpen"], this.eventsFired);
            this.eventsFired = [];
            this.popup.close();
            this.assertJsonEquals(["onBeforeClose"], this.eventsFired);
            this.eventsFired = [];
            this.__waitForEvent(this.checkEventsArrayAfterClose);
        },

        checkEventsArrayAfterClose : function () {

            this.assertJsonEquals(["onAfterClose"], this.eventsFired);
            this.popup.$dispose();
            this.eventsFired = null;
            this.notifyTestEnd("testAsync_checkEvents");
        },

        __waitForEvent : function (cb) {
            this.waitFor({
                condition : function () {
                    return this.eventsFired.length > 0;
                },
                callback : {
                    fn : cb,
                    scope : this
                }
            });
        }

    }
});


text:
.class public Lcom/android/internal/policy/impl/RecentApplicationsDialog;
.super Landroid/app/Dialog;
.source "RecentApplicationsDialog.java"

# interfaces
.implements Landroid/view/View$OnClickListener;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    }
.end annotation

# static fields
.field private static final DBG_FORCE_EMPTY_LIST:Z = false

.field private static final MAX_RECENT_TASKS:I = 0x10

.field private static final NUM_BUTTONS:I = 0x8

.field private static sStatusBar:Landroid/app/StatusBarManager;

# instance fields
.field mBroadcastIntentFilter:Landroid/content/IntentFilter;

.field private mBroadcastReceiver:Landroid/content/BroadcastReceiver;

.field mCleanup:Ljava/lang/Runnable;

.field mHandler:Landroid/os/Handler;

.field final mIcons:[Landroid/widget/TextView;

.field mNoAppsText:Landroid/view/View;

# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 2
    .parameter "context"

    .prologue
    .line 75
    const v0, #style@Theme.Dialog.RecentApplications#t

    invoke-direct {p0, p1, v0}, Landroid/app/Dialog;-><init>(Landroid/content/Context;I)V

    .line 54
    const/16 v0, 0x8

    new-array v0, v0, [Landroid/widget/TextView;

    iput-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    .line 56
    new-instance v0, Landroid/content/IntentFilter;

    const-string v1, "android.intent.action.CLOSE_SYSTEM_DIALOGS"

    invoke-direct {v0, v1}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mBroadcastIntentFilter:Landroid/content/IntentFilter;

    .line 63
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mHandler:Landroid/os/Handler;

    .line 64
    new-instance v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog$1;

    invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog$1;-><init>(Lcom/android/internal/policy/impl/RecentApplicationsDialog;)V

    iput-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mCleanup:Ljava/lang/Runnable;

    .line 335
    new-instance v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog$2;

    invoke-direct {v0, p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog$2;-><init>(Lcom/android/internal/policy/impl/RecentApplicationsDialog;)V

    iput-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

    .line 77
    return-void
.end method

.method private reloadButtons()V
    .locals 24

    .prologue
    .line 257
    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getContext()Landroid/content/Context;

    move-result-object v6

    .line 258
    .local v6, context:Landroid/content/Context;
    invoke-virtual {v6}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v15

    .line 259
    .local v15, pm:Landroid/content/pm/PackageManager;
    const-string v21, "activity"

    move-object/from16 v0, v21

    invoke-virtual {v6, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Landroid/app/ActivityManager;

    .line 261
    .local v5, am:Landroid/app/ActivityManager;
    const/16 v21, 0x10

    const/16 v22, 0x2

    move/from16 v0, v21

    move/from16 v1, v22

    invoke-virtual {v5, v0, v1}, Landroid/app/ActivityManager;->getRecentTasks(II)Ljava/util/List;

    move-result-object v16

    .line 264
    .local v16, recentTasks:Ljava/util/List;,"Ljava/util/List<Landroid/app/ActivityManager$RecentTaskInfo;>;"
    new-instance v21, Landroid/content/Intent;

    const-string v22, "android.intent.action.MAIN"

    invoke-direct/range {v21 .. v22}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    const-string v22, "android.intent.category.HOME"

    invoke-virtual/range {v21 .. v22}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    move-result-object v21

    const/16 v22, 0x0

    move-object/from16 v0, v21

    move/from16 v1, v22

    invoke-virtual {v0, v15, v1}, Landroid/content/Intent;->resolveActivityInfo(Landroid/content/pm/PackageManager;I)Landroid/content/pm/ActivityInfo;

    move-result-object v7

    .line 268
    .local v7, homeInfo:Landroid/content/pm/ActivityInfo;
    new-instance v10, Lcom/android/internal/policy/impl/IconUtilities;

    invoke-virtual/range {p0 .. p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getContext()Landroid/content/Context;

    move-result-object v21

    move-object/from16 v0, v21

    invoke-direct {v10, v0}, Lcom/android/internal/policy/impl/IconUtilities;-><init>(Landroid/content/Context;)V

    .line 273
    .local v10, iconUtilities:Lcom/android/internal/policy/impl/IconUtilities;
    const/4 v11, 0x0

    .line 274
    .local v11, index:I
    invoke-interface/range {v16 .. v16}, Ljava/util/List;->size()I

    move-result v14

    .line 275
    .local v14, numTasks:I
    const/4 v8, 0x0

    .local v8, i:I
    :goto_0
    if-ge v8, v14, :cond_3

    const/16 v21, 0x8

    move/from16 v0, v21

    if-ge v11, v0, :cond_3

    .line 276
    move-object/from16 v0, v16

    invoke-interface {v0, v8}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v12

    check-cast v12, Landroid/app/ActivityManager$RecentTaskInfo;

    .line 281
    .local v12, info:Landroid/app/ActivityManager$RecentTaskInfo;
    new-instance v13, Landroid/content/Intent;

    iget-object v0, v12, Landroid/app/ActivityManager$RecentTaskInfo;->baseIntent:Landroid/content/Intent;

    move-object/from16 v21, v0

    move-object/from16 v0, v21

    invoke-direct {v13, v0}, Landroid/content/Intent;-><init>(Landroid/content/Intent;)V

    .line 282
    .local v13, intent:Landroid/content/Intent;
    iget-object v0, v12, Landroid/app/ActivityManager$RecentTaskInfo;->origActivity:Landroid/content/ComponentName;

    move-object/from16 v21, v0

    if-eqz v21, :cond_0

    .line 283
    iget-object v0, v12, Landroid/app/ActivityManager$RecentTaskInfo;->origActivity:Landroid/content/ComponentName;

    move-object/from16 v21, v0

    move-object/from16 v0, v21

    invoke-virtual {v13, v0}, Landroid/content/Intent;->setComponent(Landroid/content/ComponentName;)Landroid/content/Intent;

    .line 287
    :cond_0
    if-eqz v7, :cond_2

    .line 288
    iget-object v0, v7, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

    move-object/from16 v21, v0

    invoke-virtual {v13}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;

    move-result-object v22

    invoke-virtual/range {v22 .. v22}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;

    move-result-object v22

    invoke-virtual/range {v21 .. v22}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v21

    if-eqz v21, :cond_2

    iget-object v0, v7, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;

    move-object/from16 v21, v0

    invoke-virtual {v13}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName;

    move-result-object v22

    invoke-virtual/range {v22 .. v22}, Landroid/content/ComponentName;->getClassName()Ljava/lang/String;

    move-result-object v22

    invoke-virtual/range {v21 .. v22}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v21

    if-eqz v21, :cond_2

    .line 275
    :cond_1
    :goto_1
    add-int/lit8 v8, v8, 0x1

    goto :goto_0

    .line 296
    :cond_2
    invoke-virtual {v13}, Landroid/content/Intent;->getFlags()I

    move-result v21

    const v22, -0x200001

    and-int v21, v21, v22

    const/high16 v22, 0x1000

    or-int v21, v21, v22

    move/from16 v0, v21

    invoke-virtual {v13, v0}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 298
    const/16 v21, 0x0

    move/from16 v0, v21

    invoke-virtual {v15, v13, v0}, Landroid/content/pm/PackageManager;->resolveActivity(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;

    move-result-object v17

    .line 299
    .local v17, resolveInfo:Landroid/content/pm/ResolveInfo;
    if-eqz v17, :cond_1

    .line 300
    move-object/from16 v0, v17

    iget-object v4, v0, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    .line 301
    .local v4, activityInfo:Landroid/content/pm/ActivityInfo;
    invoke-virtual {v4, v15}, Landroid/content/pm/ActivityInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;

    move-result-object v21

    invoke-virtual/range {v21 .. v21}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v19

    .line 302
    .local v19, title:Ljava/lang/String;
    invoke-virtual {v4, v15}, Landroid/content/pm/ActivityInfo;->loadIcon(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;

    move-result-object v9

    .line 304
    .local v9, icon:Landroid/graphics/drawable/Drawable;
    if-eqz v19, :cond_1

    invoke-virtual/range {v19 .. v19}, Ljava/lang/String;->length()I

    move-result v21

    if-lez v21, :cond_1

    if-eqz v9, :cond_1

    .line 305
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    move-object/from16 v21, v0

    aget-object v20, v21, v11

    .line 306
    .local v20, tv:Landroid/widget/TextView;
    move-object/from16 v0, v20

    move-object/from16 v1, v19

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 307
    invoke-virtual {v10, v9}, Lcom/android/internal/policy/impl/IconUtilities;->createIconDrawable(Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;

    move-result-object v9

    .line 308
    const/16 v21, 0x0

    const/16 v22, 0x0

    const/16 v23, 0x0

    move-object/from16 v0, v20

    move-object/from16 v1, v21

    move-object/from16 v2, v22

    move-object/from16 v3, v23

    invoke-virtual {v0, v1, v9, v2, v3}, Landroid/widget/TextView;->setCompoundDrawables(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V

    .line 309
    new-instance v18, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;

    move-object/from16 v0, v18

    move-object/from16 v1, p0

    invoke-direct {v0, v1}, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;-><init>(Lcom/android/internal/policy/impl/RecentApplicationsDialog;)V

    .line 310
    .local v18, tag:Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    move-object/from16 v0, v18

    iput-object v12, v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;->info:Landroid/app/ActivityManager$RecentTaskInfo;

    .line 311
    move-object/from16 v0, v18

    iput-object v13, v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;->intent:Landroid/content/Intent;

    .line 312
    move-object/from16 v0, v20

    move-object/from16 v1, v18

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setTag(Ljava/lang/Object;)V

    .line 313
    const/16 v21, 0x0

    invoke-virtual/range {v20 .. v21}, Landroid/widget/TextView;->setVisibility(I)V

    .line 314
    const/16 v21, 0x0

    invoke-virtual/range {v20 .. v21}, Landroid/widget/TextView;->setPressed(Z)V

    .line 315
    invoke-virtual/range {v20 .. v20}, Landroid/widget/TextView;->clearFocus()V

    .line 316
    add-int/lit8 v11, v11, 0x1

    goto/16 :goto_1

    .line 322
    .end local v4           #activityInfo:Landroid/content/pm/ActivityInfo;
    .end local v9           #icon:Landroid/graphics/drawable/Drawable;
    .end local v12           #info:Landroid/app/ActivityManager$RecentTaskInfo;
    .end local v13           #intent:Landroid/content/Intent;
    .end local v17           #resolveInfo:Landroid/content/pm/ResolveInfo;
    .end local v18           #tag:Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    .end local v19           #title:Ljava/lang/String;
    .end local v20           #tv:Landroid/widget/TextView;
    :cond_3
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mNoAppsText:Landroid/view/View;

    move-object/from16 v22, v0

    if-nez v11, :cond_4

    const/16 v21, 0x0

    :goto_2
    move-object/from16 v0, v22

    move/from16 v1, v21

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    .line 325
    :goto_3
    const/16 v21, 0x8

    move/from16 v0, v21

    if-ge v11, v0, :cond_5

    .line 326
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    move-object/from16 v21, v0

    aget-object v21, v21, v11

    const/16 v22, 0x8

    invoke-virtual/range {v21 .. v22}, Landroid/widget/TextView;->setVisibility(I)V

    .line 325
    add-int/lit8 v11, v11, 0x1

    goto :goto_3

    .line 322
    :cond_4
    const/16 v21, 0x8

    goto :goto_2

    .line 328
    :cond_5
    return-void
.end method

.method private switchTo(Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;)V
    .locals 4
    .parameter "tag"

    .prologue
    .line 202
    iget-object v2, p1, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;->info:Landroid/app/ActivityManager$RecentTaskInfo;

    iget v2, v2, Landroid/app/ActivityManager$RecentTaskInfo;->id:I

    if-ltz v2, :cond_1

    .line 204
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getContext()Landroid/content/Context;

    move-result-object v2

    const-string v3, "activity"

    invoke-virtual {v2, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager;

    .line 206
    .local v0, am:Landroid/app/ActivityManager;
    iget-object v2, p1, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;->info:Landroid/app/ActivityManager$RecentTaskInfo;

    iget v2, v2, Landroid/app/ActivityManager$RecentTaskInfo;->id:I

    const/4 v3, 0x1

    invoke-virtual {v0, v2, v3}, Landroid/app/ActivityManager;->moveTaskToFront(II)V

    .line 216
    .end local v0           #am:Landroid/app/ActivityManager;
    :cond_0
    :goto_0
    return-void

    .line 207
    :cond_1
    iget-object v2, p1, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;->intent:Landroid/content/Intent;

    if-eqz v2, :cond_0

    .line 208
    iget-object v2, p1, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;->intent:Landroid/content/Intent;

    const v3, 0x104000

    invoke-virtual {v2, v3}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    .line 211
    :try_start_0
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getContext()Landroid/content/Context;

    move-result-object v2

    iget-object v3, p1, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;->intent:Landroid/content/Intent;

    invoke-virtual {v2, v3}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
    :try_end_0
    .catch Landroid/content/ActivityNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 212
    :catch_0
    move-exception v1

    .line 213
    .local v1, e:Landroid/content/ActivityNotFoundException;
    const-string v2, "Recent"

    const-string v3, "Unable to launch recent task"

    invoke-static {v2, v3, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0
.end method

# virtual methods
.method public dismissAndSwitch()V
    .locals 4

    .prologue
    .line 168
    iget-object v3, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    array-length v1, v3

    .line 169
    .local v1, numIcons:I
    const/4 v2, 0x0

    .line 170
    .local v2, tag:Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-ge v0, v1, :cond_0

    .line 171
    iget-object v3, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v3, v3, v0

    invoke-virtual {v3}, Landroid/widget/TextView;->getVisibility()I

    move-result v3

    if-eqz v3, :cond_2

    .line 181
    :cond_0
    if-eqz v2, :cond_1

    .line 182
    invoke-direct {p0, v2}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->switchTo(Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;)V

    .line 184
    :cond_1
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->dismiss()V

    .line 185
    return-void

    .line 174
    :cond_2
    if-eqz v0, :cond_3

    iget-object v3, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v3, v3, v0

    invoke-virtual {v3}, Landroid/widget/TextView;->hasFocus()Z

    move-result v3

    if-eqz v3, :cond_4

    .line 175
    :cond_3
    iget-object v3, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v3, v3, v0

    invoke-virtual {v3}, Landroid/widget/TextView;->getTag()Ljava/lang/Object;

    move-result-object v2

    .end local v2           #tag:Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    check-cast v2, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;

    .line 176
    .restart local v2       #tag:Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    iget-object v3, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v3, v3, v0

    invoke-virtual {v3}, Landroid/widget/TextView;->hasFocus()Z

    move-result v3

    if-nez v3, :cond_0

    .line 170
    :cond_4
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public onClick(Landroid/view/View;)V
    .locals 5
    .parameter "v"

    .prologue
    .line 191
    iget-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    .local v0, arr$:[Landroid/widget/TextView;
    array-length v3, v0

    .local v3, len$:I
    const/4 v2, 0x0

    .local v2, i$:I
    :goto_0
    if-ge v2, v3, :cond_0

    aget-object v1, v0, v2

    .line 192
    .local v1, b:Landroid/widget/TextView;
    if-ne v1, p1, :cond_1

    .line 193
    invoke-virtual {v1}, Landroid/widget/TextView;->getTag()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;

    .line 194
    .local v4, tag:Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    invoke-direct {p0, v4}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->switchTo(Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;)V

    .line 198
    .end local v1           #b:Landroid/widget/TextView;
    .end local v4           #tag:Lcom/android/internal/policy/impl/RecentApplicationsDialog$RecentTag;
    :cond_0
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->dismiss()V

    .line 199
    return-void

    .line 191
    .restart local v1       #b:Landroid/widget/TextView;
    :cond_1
    add-int/lit8 v2, v2, 0x1

    goto :goto_0
.end method

.method protected onCreate(Landroid/os/Bundle;)V
    .locals 13
    .parameter "savedInstanceState"

    .prologue
    const/high16 v12, 0x2

    const/4 v11, 0x2

    const/4 v10, 0x1

    const/4 v9, 0x0

    const/4 v8, -0x1

    .line 87
    invoke-super {p0, p1}, Landroid/app/Dialog;->onCreate(Landroid/os/Bundle;)V

    .line 89
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getContext()Landroid/content/Context;

    move-result-object v2

    .line 91
    .local v2, context:Landroid/content/Context;
    sget-object v7, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->sStatusBar:Landroid/app/StatusBarManager;

    if-nez v7, :cond_0

    .line 92
    const-string v7, "statusbar"

    invoke-virtual {v2, v7}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Landroid/app/StatusBarManager;

    sput-object v7, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->sStatusBar:Landroid/app/StatusBarManager;

    .line 95
    :cond_0
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getWindow()Landroid/view/Window;

    move-result-object v6

    .line 96
    .local v6, window:Landroid/view/Window;
    invoke-virtual {v6, v10}, Landroid/view/Window;->requestFeature(I)Z

    .line 97
    const/16 v7, 0x7ec

    invoke-virtual {v6, v7}, Landroid/view/Window;->setType(I)V

    .line 98
    invoke-virtual {v6, v12, v12}, Landroid/view/Window;->setFlags(II)V

    .line 100
    const-string v7, "Recents"

    invoke-virtual {v6, v7}, Landroid/view/Window;->setTitle(Ljava/lang/CharSequence;)V

    .line 102
    const v7, #layout@recent_apps_dialog#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->setContentView(I)V

    .line 104
    invoke-virtual {v6}, Landroid/view/Window;->getAttributes()Landroid/view/WindowManager$LayoutParams;

    move-result-object v5

    .line 105
    .local v5, params:Landroid/view/WindowManager$LayoutParams;
    iput v8, v5, Landroid/view/ViewGroup$LayoutParams;->width:I

    .line 106
    iput v8, v5, Landroid/view/ViewGroup$LayoutParams;->height:I

    .line 107
    invoke-virtual {v6, v5}, Landroid/view/Window;->setAttributes(Landroid/view/WindowManager$LayoutParams;)V

    .line 108
    invoke-virtual {v6, v9, v11}, Landroid/view/Window;->setFlags(II)V

    .line 110
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const v7, #id@button0#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v9

    .line 111
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const v7, #id@button1#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v10

    .line 112
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const v7, #id@button2#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v11

    .line 113
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const/4 v9, 0x3

    const v7, #id@button3#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v9

    .line 114
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const/4 v9, 0x4

    const v7, #id@button4#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v9

    .line 115
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const/4 v9, 0x5

    const v7, #id@button5#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v9

    .line 116
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const/4 v9, 0x6

    const v7, #id@button6#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v9

    .line 117
    iget-object v8, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    const/4 v9, 0x7

    const v7, #id@button7#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    aput-object v7, v8, v9

    .line 118
    const v7, #id@no_applications_message#t

    invoke-virtual {p0, v7}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->findViewById(I)Landroid/view/View;

    move-result-object v7

    iput-object v7, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mNoAppsText:Landroid/view/View;

    .line 120
    iget-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    .local v0, arr$:[Landroid/widget/TextView;
    array-length v4, v0

    .local v4, len$:I
    const/4 v3, 0x0

    .local v3, i$:I
    :goto_0
    if-ge v3, v4, :cond_1

    aget-object v1, v0, v3

    .line 121
    .local v1, b:Landroid/widget/TextView;
    invoke-virtual {v1, p0}, Landroid/widget/TextView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 120
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 123
    .end local v1           #b:Landroid/widget/TextView;
    :cond_1
    return-void
.end method

.method public onKeyDown(ILandroid/view/KeyEvent;)Z
    .locals 9
    .parameter "keyCode"
    .parameter "event"

    .prologue
    const/4 v6, 0x1

    .line 127
    const/16 v7, 0x3d

    if-ne p1, v7, :cond_7

    .line 131
    invoke-virtual {p2}, Landroid/view/KeyEvent;->isShiftPressed()Z

    move-result v0

    .line 132
    .local v0, backward:Z
    iget-object v7, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    array-length v5, v7

    .line 133
    .local v5, numIcons:I
    const/4 v4, 0x0

    .line 134
    .local v4, numButtons:I
    :goto_0
    if-ge v4, v5, :cond_0

    iget-object v7, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v7, v7, v4

    invoke-virtual {v7}, Landroid/widget/TextView;->getVisibility()I

    move-result v7

    if-nez v7, :cond_0

    .line 135
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 137
    :cond_0
    if-eqz v4, :cond_2

    .line 138
    if-eqz v0, :cond_3

    add-int/lit8 v3, v4, -0x1

    .line 139
    .local v3, nextFocus:I
    :goto_1
    const/4 v2, 0x0

    .local v2, i:I
    :goto_2
    if-ge v2, v4, :cond_1

    .line 140
    iget-object v7, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v7, v7, v2

    invoke-virtual {v7}, Landroid/widget/TextView;->hasFocus()Z

    move-result v7

    if-eqz v7, :cond_5

    .line 141
    if-eqz v0, :cond_4

    .line 142
    add-int v7, v2, v4

    add-int/lit8 v7, v7, -0x1

    rem-int v3, v7, v4

    .line 149
    :cond_1
    :goto_3
    if-eqz v0, :cond_6

    move v1, v6

    .line 150
    .local v1, direction:I
    :goto_4
    iget-object v7, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v7, v7, v3

    invoke-virtual {v7, v1}, Landroid/widget/TextView;->requestFocus(I)Z

    move-result v7

    if-eqz v7, :cond_2

    .line 151
    iget-object v7, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mIcons:[Landroid/widget/TextView;

    aget-object v7, v7, v3

    invoke-static {v1}, Landroid/view/SoundEffectConstants;->getContantForFocusDirection(I)I

    move-result v8

    invoke-virtual {v7, v8}, Landroid/widget/TextView;->playSoundEffect(I)V

    .line 161
    .end local v0           #backward:Z
    .end local v1           #direction:I
    .end local v2           #i:I
    .end local v3           #nextFocus:I
    .end local v4           #numButtons:I
    .end local v5           #numIcons:I
    :cond_2
    :goto_5
    return v6

    .line 138
    .restart local v0       #backward:Z
    .restart local v4       #numButtons:I
    .restart local v5       #numIcons:I
    :cond_3
    const/4 v3, 0x0

    goto :goto_1

    .line 144
    .restart local v2       #i:I
    .restart local v3       #nextFocus:I
    :cond_4
    add-int/lit8 v7, v2, 0x1

    rem-int v3, v7, v4

    .line 146
    goto :goto_3

    .line 139
    :cond_5
    add-int/lit8 v2, v2, 0x1

    goto :goto_2

    .line 149
    :cond_6
    const/4 v1, 0x2

    goto :goto_4

    .line 161
    .end local v0           #backward:Z
    .end local v2           #i:I
    .end local v3           #nextFocus:I
    .end local v4           #numButtons:I
    .end local v5           #numIcons:I
    :cond_7
    invoke-super {p0, p1, p2}, Landroid/app/Dialog;->onKeyDown(ILandroid/view/KeyEvent;)Z

    move-result v6

    goto :goto_5
.end method

.method public onStart()V
    .locals 3

    .prologue
    .line 223
    invoke-super {p0}, Landroid/app/Dialog;->onStart()V

    .line 224
    invoke-direct {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->reloadButtons()V

    .line 225
    sget-object v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->sStatusBar:Landroid/app/StatusBarManager;

    if-eqz v0, :cond_0

    .line 226
    sget-object v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->sStatusBar:Landroid/app/StatusBarManager;

    const/high16 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/app/StatusBarManager;->disable(I)V

    .line 230
    :cond_0
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getContext()Landroid/content/Context;

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

    iget-object v2, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mBroadcastIntentFilter:Landroid/content/IntentFilter;

    invoke-virtual {v0, v1, v2}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 232
    iget-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mCleanup:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Landroid/os/Handler;->removeCallbacks(Ljava/lang/Runnable;)V

    .line 233
    return-void
.end method

.method public onStop()V
    .locals 4

    .prologue
    .line 240
    invoke-super {p0}, Landroid/app/Dialog;->onStop()V

    .line 242
    sget-object v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->sStatusBar:Landroid/app/StatusBarManager;

    if-eqz v0, :cond_0

    .line 243
    sget-object v0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->sStatusBar:Landroid/app/StatusBarManager;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/app/StatusBarManager;->disable(I)V

    .line 247
    :cond_0
    invoke-virtual {p0}, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->getContext()Landroid/content/Context;

    move-result-object v0

    iget-object v1, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v0, v1}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 249
    iget-object v0, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mHandler:Landroid/os/Handler;

    iget-object v1, p0, Lcom/android/internal/policy/impl/RecentApplicationsDialog;->mCleanup:Ljava/lang/Runnable;

    const-wide/16 v2, 0x64

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 250
    return-void
.end method


text:
/* @flow */

export const input = `
  var demo: string;
  demo = "foo bar";
`;

export const expected = `
  import t from "flow-runtime";
  var _demoType = t.string(), demo;
  demo = _demoType.assert("foo bar");
`;


text:
package org.runningdinner.admin;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;

import javax.persistence.EntityNotFoundException;

import org.apache.commons.lang3.StringUtils;
import org.runningdinner.admin.check.ValidateAdminId;
import org.runningdinner.admin.rest.BasicSettingsTO;
import org.runningdinner.common.Issue;
import org.runningdinner.common.IssueList;
import org.runningdinner.common.IssueType;
import org.runningdinner.common.exception.ValidationException;
import org.runningdinner.common.service.IdGenerator;
import org.runningdinner.common.service.UrlGenerator;
import org.runningdinner.common.service.ValidatorService;
import org.runningdinner.core.AssignableParticipantSizes;
import org.runningdinner.core.MealClass;
import org.runningdinner.core.MealClassSorter;
import org.runningdinner.core.PublicSettings;
import org.runningdinner.core.RegistrationType;
import org.runningdinner.core.RunningDinner;
import org.runningdinner.core.RunningDinner.RunningDinnerType;
import org.runningdinner.core.RunningDinnerConfig;
import org.runningdinner.core.RunningDinnerInfo;
import org.runningdinner.core.RunningDinnerPreference;
import org.runningdinner.core.RunningDinnerPreferences;
import org.runningdinner.core.util.DateTimeUtil;
import org.runningdinner.event.RunningDinnerSettingsUpdatedEvent;
import org.runningdinner.event.publisher.EventPublisher;
import org.runningdinner.masterdata.MasterDataService;
import org.runningdinner.wizard.BasicDetailsTO;
import org.runningdinner.wizard.PublicSettingsTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;

@Service
public class RunningDinnerService implements ApplicationContextAware {

  private static Logger LOGGER = LoggerFactory.getLogger(RunningDinnerService.class);

  @Autowired
  private RunningDinnerRepository runningDinnerRepository;

  @Autowired
  private RunningDinnerPreferencesRepository runningDinnerPreferencesRepository;

  @Autowired
  private MealRepository mealRepository;

  @Autowired
  private IdGenerator idGenerator;

  @Autowired
  private EventPublisher eventPublisher;

  @Autowired
  private ValidatorService validatorService;

  @Autowired
  private MasterDataService masterDataService;

  @Autowired
  private UrlGenerator urlGenerator;

  private ApplicationContext applicationContext;

  public RunningDinner findRunningDinnerByAdminId(@ValidateAdminId String adminId) {

    RunningDinner runningDinner = runningDinnerRepository.findByAdminId(adminId);
    validatorService.checkRunningDinnerNotNull(runningDinner);
    return urlGenerator.addPublicDinnerUrl(runningDinner);
  }

  public RunningDinner findRunningDinnerBySelfAdministrationId(UUID selfAdministrationId) {

    RunningDinner runningDinner = runningDinnerRepository.findBySelfAdministrationId(selfAdministrationId);
    validatorService.checkRunningDinnerNotNull(runningDinner);
    return urlGenerator.addPublicDinnerUrl(runningDinner);
  }

  /**
   * Creates a new persistent running dinner instance
   *
   * @param runningDinnerInfo Basic detail infos about the running dinner to create
   * @param runningDinnerConfig The options of the running dinner
   * @param email
   * @param runningDinnerType
   * @return
   */
  @Transactional
  public RunningDinner createRunningDinner(RunningDinnerInfo runningDinnerInfo, RunningDinnerConfig runningDinnerConfig, String email, RunningDinnerType runningDinnerType) {

    return createRunningDinner(runningDinnerInfo, runningDinnerConfig, null, email, runningDinnerType);
  }

  @Transactional
  public RunningDinner createRunningDinner(RunningDinnerInfo runningDinnerInfo,
                                           RunningDinnerConfig runningDinnerConfig,
                                           PublicSettings publicSettings,
                                           String email,
                                           RunningDinnerType runningDinnerType) {

    return createRunningDinnerInternal(runningDinnerInfo, runningDinnerConfig, publicSettings, email, runningDinnerType);
  }

  protected RunningDinner createRunningDinnerInternal(RunningDinnerInfo runningDinnerInfo,
                                                      RunningDinnerConfig runningDinnerConfig,
                                                      PublicSettings publicSettings,
                                                      String email,
                                                      RunningDinnerType runningDinnerType) {

    String adminId = idGenerator.generateAdminId();

    RunningDinner result = new RunningDinner();

    copyBasicDetails(runningDinnerInfo, result);

    result.setRunningDinnerType(runningDinnerType);

    result.setEmail(email);

    List<MealClass> incomingMealClasses = runningDinnerConfig.getMealClasses();
    List<MealClass> mealClasses = incomingMealClasses.stream().map(m -> new MealClass(m.getLabel(), m.getTime())).collect(
      Collectors.toList());
    LOGGER.info("Saving {} meals for running dinner {}", mealClasses.size(), adminId);
    runningDinnerConfig.setMealClasses(mealRepository.saveAll(mealClasses));

    result.setConfiguration(runningDinnerConfig);
    result.setAdminId(adminId);

    result.setSelfAdministrationId(UUID.randomUUID());

    if (result.getRegistrationType() != RegistrationType.CLOSED) {
      result.setPublicSettings(publicSettings);
      generatePublicIdIfNotExisting(result.getPublicSettings());
    }

    LOGGER.info("Saving complete running dinner {}", adminId);
    result = runningDinnerRepository.save(result);

    emitNewRunningDinnerEvent(result);

    return result;
  }

  private static void copyBasicDetails(RunningDinnerInfo src, RunningDinner dest) {

    dest.setCity(src.getCity());
    dest.setZip(src.getZip());
    dest.setTitle(src.getTitle());
    dest.setDate(src.getDate());
    dest.setRegistrationType(src.getRegistrationType());
    dest.setLanguageCode(src.getLanguageCode());
  }

  @Transactional
  public RunningDinner cancelRunningDinner(@ValidateAdminId String adminId, LocalDateTime cancellationDate) {

    RunningDinner result = findRunningDinnerByAdminId(adminId);

    if (result.isCancelled()) {
      return result;
    }

    result.setCancellationDate(cancellationDate);
    result = runningDinnerRepository.save(result);

    emitRunningDinnerCancelledEvent(result);

    return result;
  }

  @Transactional
  public RunningDinner acknowledgeRunningDinner(@ValidateAdminId String adminId, UUID acknowledgeId, LocalDateTime acknowledgedDate) {

    RunningDinner result = findRunningDinnerByAdminId(adminId);
    if (result.isAcknowledged()) {
      return result;
    }

    // We "abuse" the objectId for this stuff... the objectId is never sent outside in the rest layer... if so, we must change this logic
    Assert.state(result.getObjectId().equals(acknowledgeId), "Incoming id to acknowledge is not valid!");

    result.setAcknowledgedDate(acknowledgedDate);
    result = runningDinnerRepository.save(result);

    return result;
  }

  public List<RunningDinner> findRunningDinnersCancelledBefore(LocalDateTime date) {

    List<RunningDinner> result = runningDinnerRepository.findByCancellationDateLessThanEqual(date);
    return urlGenerator.addPublicDinnerUrl(result);
  }

  @Transactional
  public RunningDinner updateMealTimes(@ValidateAdminId String adminId, Collection<MealClass> incomingMeals) {

    RunningDinner dinner = findRunningDinnerByAdminId(adminId);
    List<MealClass> existingMeals = dinner.getConfiguration().getMealClasses();

    LOGGER.info("Update {} meal-times for dinner {}", existingMeals.size(), adminId);

    // It's not allowed to add or remove meals (just update the existing ones):
    Assert.state(existingMeals.size() == incomingMeals.size(), "Expected " + incomingMeals.size() + " meals to be found, but there were  " + existingMeals.size());

    for (MealClass incomingMeal : incomingMeals) {

      Optional<MealClass> existingMealOptional = existingMeals.stream().filter(m -> m.isSameId(incomingMeal.getId())).findFirst();
      MealClass existingMeal = existingMealOptional.orElseThrow(() -> new EntityNotFoundException(incomingMeal.getId() + " could not be found!"));

      existingMeal.setTime(incomingMeal.getTime());
    }

    // TODO Maybe add validation for times not being set to other days.

    // Ensure that ordering is still correct
    existingMeals.sort(new MealClassSorter());
    dinner.getConfiguration().setMealClasses(existingMeals);

    emitUpdateMealTimesEvent(dinner);

    return dinner;
  }

  @Transactional
  public RunningDinner updateRunningDinnerAdminEmail(@ValidateAdminId String adminId, String newAdminEmail) {

  	RunningDinner runningDinner = findRunningDinnerByAdminId(adminId);
  	Assert.hasText(newAdminEmail, "Expected incoming newAdminEmail to be not empty for dinner " + adminId);
  	boolean publicContactMailUpdateNeeded = runningDinner.getPublicSettings() != null &&
  	                                        StringUtils.equalsIgnoreCase(runningDinner.getPublicSettings().getPublicContactEmail(), runningDinner.getEmail());
  	runningDinner.setEmail(newAdminEmail);
  	if (publicContactMailUpdateNeeded) {
  	  runningDinner.getPublicSettings().setPublicContactEmail(newAdminEmail);
  	}
  	return runningDinnerRepository.save(runningDinner);
  }

  @Transactional
  public RunningDinner updateBasicSettings(@ValidateAdminId String adminId, BasicSettingsTO basicSettings) {

    BasicDetailsTO basicDetails = basicSettings.getBasicDetails();

    validateRunningDinnerDate(basicDetails.getDate());

    RunningDinner dinnerToUpdate = findRunningDinnerByAdminId(adminId);
    RunningDinnerInfo basicDetailsUnmodified = dinnerToUpdate.createDetachedCloneRunningDinnerInfo();

    RegistrationType unmodifiedRegistrationType = dinnerToUpdate.getRegistrationType();
    LocalDate unmodifiedDinnerDate = dinnerToUpdate.getDate();

    copyBasicDetails(basicDetails, dinnerToUpdate);

    handleChangedRegistrationType(dinnerToUpdate, unmodifiedRegistrationType);
    handleChangedDinnerDate(dinnerToUpdate, unmodifiedDinnerDate);

    dinnerToUpdate.getConfiguration().setTeamPartnerWishDisabled(basicSettings.isTeamPartnerWishDisabled());

    RunningDinner result = runningDinnerRepository.save(dinnerToUpdate);
    result = urlGenerator.addPublicDinnerUrl(result);

    emitRunningDinnerSettingsUpdatedEvent(new RunningDinnerSettingsUpdatedEvent(this, result, basicDetailsUnmodified));

    return result;
  }

  @Transactional
  public RunningDinner updatePublicSettings(@ValidateAdminId String adminId, PublicSettingsTO publicSettings) {

    RunningDinner dinnerToUpdate = findRunningDinnerByAdminId(adminId);
    PublicSettings publicSettingsUnmodified = dinnerToUpdate.getPublicSettings().createDetachedClone();

    validatePublicSettings(publicSettings, dinnerToUpdate.getDate());

    PublicSettings publicSettingsToUpdate = dinnerToUpdate.getPublicSettings();
    publicSettingsToUpdate.setEndOfRegistrationDate(publicSettings.getEndOfRegistrationDate());
    publicSettingsToUpdate.setPublicDescription(publicSettings.getDescription());
    publicSettingsToUpdate.setPublicTitle(publicSettings.getTitle());
    publicSettingsToUpdate.setPublicContactEmail(publicSettings.getPublicContactEmail());
    publicSettingsToUpdate.setPublicContactMobileNumber(publicSettings.getPublicContactMobileNumber());
    publicSettingsToUpdate.setPublicContactName(publicSettings.getPublicContactName());

    RunningDinner result = runningDinnerRepository.save(dinnerToUpdate);
    result = urlGenerator.addPublicDinnerUrl(result);

    emitRunningDinnerSettingsUpdatedEvent(new RunningDinnerSettingsUpdatedEvent(this, result, publicSettingsUnmodified));

    return result;
  }

  @Transactional
  public RunningDinner updateRegistrationActiveState(@ValidateAdminId String adminId, boolean enable) {

    RunningDinner dinnerToUpdate = findRunningDinnerByAdminId(adminId);
    Assert.state(!dinnerToUpdate.getRegistrationType().isClosed(), "Can only activate/deactivate registration for non-closed events: " + dinnerToUpdate);

    PublicSettings publicSettingsUnmodified = dinnerToUpdate.getPublicSettings().createDetachedClone();

    dinnerToUpdate.getPublicSettings().setRegistrationDeactivated(!enable);
    RunningDinner result = runningDinnerRepository.save(dinnerToUpdate);
    result = urlGenerator.addPublicDinnerUrl(result);

    emitRunningDinnerSettingsUpdatedEvent(new RunningDinnerSettingsUpdatedEvent(this, result, publicSettingsUnmodified));

    return result;
  }

  public static void validatePublicSettings(PublicSettingsTO publicSettings, LocalDate runningDinnerDate) {

    LocalDate endOfRegistrationDate = publicSettings.getEndOfRegistrationDate();
    if (runningDinnerDate.isBefore(endOfRegistrationDate)) {
      throw new ValidationException(new IssueList(new Issue("endOfRegistrationDate", "error.endOfRegistrationDate.invalid",
        IssueType.VALIDATION)));
    }
  }

  public static void validateRunningDinnerDate(LocalDate runningDinnerDate) {

    LocalDate now = LocalDate.now();
    if (runningDinnerDate.isBefore(now)) {
      throw new ValidationException(new IssueList(new Issue("date", "error_date_invalid", IssueType.VALIDATION)));
    }
  }

  private void handleChangedDinnerDate(RunningDinner dinnerToUpdate, LocalDate unmodifiedDinnerDate) {

    if (dinnerToUpdate.getDate().isEqual(unmodifiedDinnerDate)) {
      return;
    }

    List<MealClass> meals = dinnerToUpdate.getConfiguration().getMealClasses();
    for (MealClass meal : meals) {
      LocalDateTime mealTime = meal.getTime();
      mealTime = mealTime.with(dinnerToUpdate.getDate());
      meal.setTime(mealTime);
    }

    List<MealClass> updatedMeals = mealRepository.saveAll(meals);
    dinnerToUpdate.getConfiguration().setMealClasses(updatedMeals);
  }

  private void handleChangedRegistrationType(RunningDinner dinnerToUpdate, RegistrationType unmodifiedRegistrationType) {

    RegistrationType updatedRegistrationType = dinnerToUpdate.getRegistrationType();

    if (unmodifiedRegistrationType.isChangedFromClosedToPublicOrOpen(updatedRegistrationType)) {
      PublicSettings publicSettings = dinnerToUpdate.getPublicSettings();
      generatePublicIdIfNotExisting(publicSettings);
      if (publicSettings.getEndOfRegistrationDate() == null) {
        LocalDate dinnerDate = dinnerToUpdate.getDate();
        LocalDate endOfRegistrationDateProposal = dinnerDate.minusDays(7);
        LocalDate now = LocalDate.now();
        if (endOfRegistrationDateProposal.isBefore(now)) {
          endOfRegistrationDateProposal = DateTimeUtil.min(now, dinnerDate);
        }
        publicSettings.setEndOfRegistrationDate(endOfRegistrationDateProposal);
      }
      if (StringUtils.isEmpty(publicSettings.getPublicTitle())) {
        publicSettings.setPublicTitle(dinnerToUpdate.getTitle());
      }
      dinnerToUpdate.setPublicSettings(publicSettings);
    }

  }

  public RunningDinnerPreferences getPreferences(final String adminId) {

    RunningDinner runningDinner = findRunningDinnerByAdminId(adminId);

    List<RunningDinnerPreference> preferences = runningDinnerPreferencesRepository.findByAdminIdOrderByPreferenceNameAsc(adminId);
    // Not nice, but by doing so we achieve prototype-scope for this bean within the service (singleton) bean:
    RunningDinnerPreferences result = applicationContext.getBean("runningDinnerPreferences", RunningDinnerPreferences.class);
    result.init(runningDinner, preferences);
    return result;
  }

  public RunningDinnerSessionData findSessionData(String dinnerAdminId, Locale locale) {

    RunningDinner runningDinner = findRunningDinnerByAdminId(dinnerAdminId);
    return calculateSessionData(runningDinner, locale);
  }

  public RunningDinnerSessionData calculateSessionData(RunningDinner runningDinner, Locale locale) {

    RunningDinnerSessionData result = new RunningDinnerSessionData();
    result.setAssignableParticipantSizes(AssignableParticipantSizes.create(runningDinner.getConfiguration()));

    int numSeatsNeededForHost = runningDinner.getConfiguration().getNumberOfMealClasses() * runningDinner.getConfiguration().getTeamSize();
    result.setNumSeatsNeededForHost(numSeatsNeededForHost);

    result.setGenderAspects(masterDataService.findGenderAspects(locale));
    result.setGenders(masterDataService.findGenders(locale));
    result.setRegistrationTypes(masterDataService.findRegistrationTypes(locale));

    return result;
  }

  public List<RunningDinner> findRunningDinnersWithDateBefore(LocalDate date) {

    List<RunningDinner> result = runningDinnerRepository.findByDateBefore(date);
    return urlGenerator.addPublicDinnerUrl(result);
  }

  /**
   * Generate a new UUID which can e.g. be used for a new running dinner administration
   *
   * @return
   */
  public String generateNewAdminId() {

    return idGenerator.generateAdminId();
  }

  protected void checkRunningDinnerExists(final String adminId) {

    RunningDinner runningDinner = runningDinnerRepository.findByAdminId(adminId);
    validatorService.checkRunningDinnerNotNull(runningDinner);
  }

  private void emitUpdateMealTimesEvent(RunningDinner dinner) {

    TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {

      @Override
      public void afterCommit() {

        eventPublisher.notifyMealTimesUpdated(dinner);
      }
    });
  }

  private void emitRunningDinnerSettingsUpdatedEvent(RunningDinnerSettingsUpdatedEvent runningDinnerSettingsUpdatedEvent) {

    TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {

      @Override
      public void afterCommit() {

        eventPublisher.notifyRunningDinnerSettingsUpdated(runningDinnerSettingsUpdatedEvent);
      }
    });
  }

  private void emitNewRunningDinnerEvent(final RunningDinner result) {

    // Publish event only after transaction is successfully committed:
    TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {

      @Override
      public void afterCommit() {

        eventPublisher.notifyNewRunningDinner(result);
      }
    });
  }

  private void emitRunningDinnerCancelledEvent(final RunningDinner result) {

    // Publish event only after transaction is successfully committed:
    TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {

      @Override
      public void afterCommit() {

        eventPublisher.notifyRunningDinnerCancelled(result);
      }
    });
  }

  private void generatePublicIdIfNotExisting(PublicSettings publicSettings) {

    if (StringUtils.isEmpty(publicSettings.getPublicId())) {
      String publicId = idGenerator.generatePublicId();
      publicSettings.setPublicId(publicId);
    }
  }

  @Override
  public void setApplicationContext(ApplicationContext applicationContext)
    throws BeansException {

    this.applicationContext = applicationContext;
  }

}


text:
% Multi-Parametric Toolbox Accessory functions
%
%   help extras/analysis   - Analysis functions
%   help extras/auxiliary  - Auxiliary functions
%   help extras/control    - Control functions
%   help extras/geometry   - Geometry functions
%   help extras/graphics   - Plotting functions
%   help extras/simulink   - MPT Simulink library
%
% Authors: Michal Kvasnica, Pascal Grieder, Mato Baotic
% kvasnica@control.ee.ethz.ch, grieder@control.ee.ethz.ch, baotic@control.ee.ethz.ch
%
% Copyright (C) 2003-2006 Michal Kvasnica, Pascal Grieder, Mato Baotic
%
% For support, write to: mpt@control.ee.ethz.ch


text:
package org.beanio.parser.annotation;

import org.beanio.annotation.*;

@Record
public class AnnotatedRoom {

    @Segment(at=0, type=AnnotatedLight.class, getter="getLightFixture", setter="setLightFixture")
    private Object light;

    @Field(at=5)
    public String name;

    private AnnotatedFloor floor;

    public AnnotatedLight getLightFixture() {
        return (AnnotatedLight) light;
    }

    public void setLightFixture(AnnotatedLight light) {
        this.light = light;
    }

    @Segment(at=6)
    public AnnotatedFloor getFlooring() {
        return floor;
    }

    public void setFlooring(AnnotatedFloor floor) {
        this.floor = floor;
    }
}


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="it.ninepatch.scotchimageview">

    <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:supportsRtl="true"></application>

</manifest>


text:
package postgres

import (
	"database/sql"

	_ "github.com/lib/pq"

	"github.com/vrischmann/ghmirror/internal/config"
	"github.com/vrischmann/ghmirror/internal/datastore"
)

type ownerBlacklistStore struct {
	db *sql.DB
}

func NewOwnerBlacklistStore(conf *config.Postgres) (datastore.OwnerBlacklist, error) {
	s := new(ownerBlacklistStore)

	var err error
	s.db, err = makeDB(conf)

	return s, err
}

func (s *ownerBlacklistStore) Close() error { return s.db.Close() }

func (s *ownerBlacklistStore) IsBlacklisted(name string) (bool, error) {
	const q = `SELECT 1 FROM owner_blacklist
               WHERE name = $1`

	var i int

	err := s.db.QueryRow(q, name).Scan(&i)
	switch {
	case err == sql.ErrNoRows:
		return false, nil
	case err != nil:
		return false, err
	default:
		return true, nil
	}
}

var _ datastore.OwnerBlacklist = (*ownerBlacklistStore)(nil)


text:
BOOST_AUTO_TEST_SUITE(getarg_tests)

static void
ResetArgs(const std::string& strArg)
{
    std::vector<std::string> vecArg;
    boost::split(vecArg, strArg, boost::is_space(), boost::token_compress_on);

    // Insert dummy executable name:
    vecArg.insert(vecArg.begin(), "testbitcoin");

    // Convert to char*:
    std::vector<const char*> vecChar;
    BOOST_FOREACH(std::string& s, vecArg)
        vecChar.push_back(s.c_str());

    ParseParameters(vecChar.size(), &vecChar[0]);
}

BOOST_AUTO_TEST_CASE(boolarg)
{
    ResetArgs("-COCO");
    BOOST_CHECK(GetBoolArg("-COCO"));
    BOOST_CHECK(GetBoolArg("-COCO", false));
    BOOST_CHECK(GetBoolArg("-COCO", true));

    BOOST_CHECK(!GetBoolArg("-fo"));
    BOOST_CHECK(!GetBoolArg("-fo", false));
    BOOST_CHECK(GetBoolArg("-fo", true));

    BOOST_CHECK(!GetBoolArg("-COCOo"));
    BOOST_CHECK(!GetBoolArg("-COCOo", false));
    BOOST_CHECK(GetBoolArg("-COCOo", true));

    ResetArgs("-COCO=0");
    BOOST_CHECK(!GetBoolArg("-COCO"));
    BOOST_CHECK(!GetBoolArg("-COCO", false));
    BOOST_CHECK(!GetBoolArg("-COCO", true));

    ResetArgs("-COCO=1");
    BOOST_CHECK(GetBoolArg("-COCO"));
    BOOST_CHECK(GetBoolArg("-COCO", false));
    BOOST_CHECK(GetBoolArg("-COCO", true));

    // New 0.6 feature: auto-map -nosomething to !-something:
    ResetArgs("-noCOCO");
    BOOST_CHECK(!GetBoolArg("-COCO"));
    BOOST_CHECK(!GetBoolArg("-COCO", false));
    BOOST_CHECK(!GetBoolArg("-COCO", true));

    ResetArgs("-noCOCO=1");
    BOOST_CHECK(!GetBoolArg("-COCO"));
    BOOST_CHECK(!GetBoolArg("-COCO", false));
    BOOST_CHECK(!GetBoolArg("-COCO", true));

    ResetArgs("-COCO -noCOCO");  // -COCO should win
    BOOST_CHECK(GetBoolArg("-COCO"));
    BOOST_CHECK(GetBoolArg("-COCO", false));
    BOOST_CHECK(GetBoolArg("-COCO", true));

    ResetArgs("-COCO=1 -noCOCO=1");  // -COCO should win
    BOOST_CHECK(GetBoolArg("-COCO"));
    BOOST_CHECK(GetBoolArg("-COCO", false));
    BOOST_CHECK(GetBoolArg("-COCO", true));

    ResetArgs("-COCO=0 -noCOCO=0");  // -COCO should win
    BOOST_CHECK(!GetBoolArg("-COCO"));
    BOOST_CHECK(!GetBoolArg("-COCO", false));
    BOOST_CHECK(!GetBoolArg("-COCO", true));

    // New 0.6 feature: treat -- same as -:
    ResetArgs("--COCO=1");
    BOOST_CHECK(GetBoolArg("-COCO"));
    BOOST_CHECK(GetBoolArg("-COCO", false));
    BOOST_CHECK(GetBoolArg("-COCO", true));

    ResetArgs("--noCOCO=1");
    BOOST_CHECK(!GetBoolArg("-COCO"));
    BOOST_CHECK(!GetBoolArg("-COCO", false));
    BOOST_CHECK(!GetBoolArg("-COCO", true));

}

BOOST_AUTO_TEST_CASE(stringarg)
{
    ResetArgs("");
    BOOST_CHECK_EQUAL(GetArg("-COCO", ""), "");
    BOOST_CHECK_EQUAL(GetArg("-COCO", "eleven"), "eleven");

    ResetArgs("-COCO -bar");
    BOOST_CHECK_EQUAL(GetArg("-COCO", ""), "");
    BOOST_CHECK_EQUAL(GetArg("-COCO", "eleven"), "");

    ResetArgs("-COCO=");
    BOOST_CHECK_EQUAL(GetArg("-COCO", ""), "");
    BOOST_CHECK_EQUAL(GetArg("-COCO", "eleven"), "");

    ResetArgs("-COCO=11");
    BOOST_CHECK_EQUAL(GetArg("-COCO", ""), "11");
    BOOST_CHECK_EQUAL(GetArg("-COCO", "eleven"), "11");

    ResetArgs("-COCO=eleven");
    BOOST_CHECK_EQUAL(GetArg("-COCO", ""), "eleven");
    BOOST_CHECK_EQUAL(GetArg("-COCO", "eleven"), "eleven");

}

BOOST_AUTO_TEST_CASE(intarg)
{
    ResetArgs("");
    BOOST_CHECK_EQUAL(GetArg("-COCO", 11), 11);
    BOOST_CHECK_EQUAL(GetArg("-COCO", 0), 0);

    ResetArgs("-COCO -bar");
    BOOST_CHECK_EQUAL(GetArg("-COCO", 11), 0);
    BOOST_CHECK_EQUAL(GetArg("-bar", 11), 0);

    ResetArgs("-COCO=11 -bar=12");
    BOOST_CHECK_EQUAL(GetArg("-COCO", 0), 11);
    BOOST_CHECK_EQUAL(GetArg("-bar", 11), 12);

    ResetArgs("-COCO=NaN -bar=NotANumber");
    BOOST_CHECK_EQUAL(GetArg("-COCO", 1), 0);
    BOOST_CHECK_EQUAL(GetArg("-bar", 11), 0);
}

BOOST_AUTO_TEST_CASE(doubledash)
{
    ResetArgs("--COCO");
    BOOST_CHECK_EQUAL(GetBoolArg("-COCO"), true);

    ResetArgs("--COCO=verbose --bar=1");
    BOOST_CHECK_EQUAL(GetArg("-COCO", ""), "verbose");
    BOOST_CHECK_EQUAL(GetArg("-bar", 0), 1);
}

BOOST_AUTO_TEST_CASE(boolargno)
{
    ResetArgs("-noCOCO");
    BOOST_CHECK(!GetBoolArg("-COCO"));
    BOOST_CHECK(!GetBoolArg("-COCO", true));
    BOOST_CHECK(!GetBoolArg("-COCO", false));

    ResetArgs("-noCOCO=1");
    BOOST_CHECK(!GetBoolArg("-COCO"));
    BOOST_CHECK(!GetBoolArg("-COCO", true));
    BOOST_CHECK(!GetBoolArg("-COCO", false));

    ResetArgs("-noCOCO=0");
    BOOST_CHECK(GetBoolArg("-COCO"));
    BOOST_CHECK(GetBoolArg("-COCO", true));
    BOOST_CHECK(GetBoolArg("-COCO", false));

    ResetArgs("-COCO --noCOCO");
    BOOST_CHECK(GetBoolArg("-COCO"));

    ResetArgs("-noCOCO -COCO"); // COCO always wins:
    BOOST_CHECK(GetBoolArg("-COCO"));
}

BOOST_AUTO_TEST_SUITE_END()


text:
require 'active_support/hash_with_indifferent_access'

module RubyUtils
  class LazyIndifferentHash < HashWithIndifferentAccess
    attr_accessor :args

    def initialize (*args)
      self.args = args
    end

    def [] (key)
      value = super
      if value.is_a?(Proc)
        value     = evaluate(value)
        self[key] = value
      end
      value
    end

    private

    def evaluate (proc)
      proc.call(*args)
    end
  end
end

LazyIndifferentHash = RubyUtils::LazyIndifferentHash


text:
'use strict';

import React from 'react';
import {Link} from 'react-router';
import LaddaButton from 'react-ladda';
import Immutable from 'immutable';
import Component from '../components/component.react';
import FlashMessages from '../components/flashmessages.react';
import {signUp, getToken} from './actions';
import {flash} from '../flashMessages/actions';

class SignUp extends Component {

  static willTransitionTo(transition) {
    if (getToken()) transition.redirect('dashboard');
  }

  onFormSubmit(e) {
    e.preventDefault();

    const data = {
      email: this.refs.email.getDOMNode().value,
      password: this.refs.password.getDOMNode().value,
      firstName: this.refs.firstName.getDOMNode().value,
      lastName: this.refs.lastName.getDOMNode().value,
      company: this.refs.company.getDOMNode().value
    };

    signUp(data).then(() => {
      this.redirectAfterSignUp();
    });
  }

  redirecToDashboard() {
    this.props.router.transitionTo('dashboard');
  }

  redirectAfterSignUp() {
    this.props.router.transitionTo('signin');

    flash('Signed up. Now you can login.');
  }

  render() {
    const messages = this.props.flashMessages;
    const pending = signUp.pending;

    return (

smsgw

sign up

        <FlashMessages messages={messages} />

        <form onSubmit={(e) => this.onFormSubmit(e)}>

            <input type="email"
                   name="email"
                   ref="email"
                   className="form-control"
                   placeholder="E-mail"
                   disabled={pending}
                   required />

            <input type="password"
                   name="password"
                   ref="password"
                   className="form-control"
                   placeholder="Password"
                   disabled={pending}
                   required />

              <input type="text"
                     name="firstName"
                     ref="firstName"
                     className="form-control"
                     placeholder="First name"
                     disabled={pending}
                     required />

            <input type="text"
                   name="lastName"
                   ref="lastName"
                   className="form-control"
                   placeholder="Last name"
                   disabled={pending}
                   required />

            <input type="text"
                   name="company"
                   ref="company"
                   className="form-control"
                   disabled={pending}
                   placeholder="Company" />

          <LaddaButton active={pending}
                       style="expand-right">
            <button>Sign up</button>
          </LaddaButton>
        </form>

          Have an account already? <Link to="signin">Sign in</Link>.

    );
  }

}

SignUp.propTypes = {
  router: React.PropTypes.func,
  flashMessages: React.PropTypes.instanceOf(Immutable.List).isRequired
};

export default SignUp;


text:
puts "we are in main"

require "./module.rb"

print_something( "you're done" )


text:
import { HStack } from "@chakra-ui/react"
import { AiOutlineHome, AiFillGithub } from "react-icons/ai"
import { BsJournalCode } from "react-icons/bs"
import { FiGitPullRequest } from "react-icons/fi"
import { ColorModeSwitcher } from "../ColorModeSwitcher"
import { NavIcon } from "../GSSinglePageLayout/NavIcon"

export let navIcons = ({ page, dispatch, responsive }) => (
  <>
    <HStack>
      <NavIcon
        name="home"
        icon={<AiOutlineHome />}
        type="navigation"
        ariaLabel={"navigate to home"}
        {...{ page, dispatch, responsive }}
      />
    </HStack>
    <HStack>
      <NavIcon
        name="docs"
        icon={<BsJournalCode />}
        type="navigation"
        ariaLabel={"navigate to docs"}
        {...{ page, dispatch, responsive }}
      />
    </HStack>
    <HStack>
      <NavIcon
        type="navigation"
        name="changelog"
        icon={<FiGitPullRequest />}
        {...{ page, dispatch, responsive }}
        ariaLabel={"navigate to change log"}
      />
    </HStack>
    <HStack>
      <NavIcon
        type="link"
        name="GitHub"
        icon={<AiFillGithub />}
        page={"https://github.com/smartprocure/futil-js"}
        {...{ dispatch, responsive }}
        ariaLabel={"Go to futil GitHub page"}
      />
    </HStack>
    <HStack>
      <ColorModeSwitcher marginX={0} title={"Dark/Light Toggle"} />
    </HStack>
  </>
)


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. Soc. Zool. France, 57, 118.

#### Original name
null

### Remarks
null


text:
  <modal-close></modal-close>

New Application

  <form role="form" class="container-fluid" novalidate name="newApplicationForm" ng-if="!newAppModal.initializing">

Name

          <input type="text"
                 autofocus
                 name="name"
                 ng-pattern="/^[a-zA-z_0-9.]*$/"
                 class="form-control input-sm"
                 data-purpose="application-name"
                 ng-model="newAppModal.application.name"
                 placeholder="Enter an application name"
                 validate-unique="newAppModal.appNameList"
                 required
                 id="applicationName">
          </input>

          Only dot(.) and underscore(_) special characters are allowed.

          Application name must be unique.

 -1">

          If the application's name contains an underscore(_), you will not be able to create a load balancer,
            preventing it from being used as a front end service.

Owner Email

          <input type="email"
                 name="email"
                 ng-class="{'ng-invalid ng-dirty':newAppModal.emailErrorMsg.length > 0 }"
                 class="form-control input-sm "
                 data-purpose="application-email"
                 ng-model="newAppModal.application.email"
                 placeholder="Enter an email address"
                 required
                 id="ownerEmail">
          </input>

          Please enter a valid email address

          {{errorMsg}}

PagerDuty API Key

          <input type="text"
                 class="form-control input-sm"
                 ng-model="newAppModal.application.pdApiKey"
                 placeholder="Enter your PagerDuty API key"
                 id="pagerDutyApiKey">
          </input>

Repo Type

          <select
            class="form-control input-sm"
            ng-options="repoType for repoType in ['stash', 'github']"
            ng-model="newAppModal.application.repoType">
            <option value="">Select Repo Type</option>
          </select>

Repo Project

          <input type="text"
                 class="form-control input-sm"
                 ng-model="newAppModal.application.repoProjectKey"
                 placeholder="Enter your source repository project name"
                 id="repoProjectKey">
          </input>

Repo Name

          <input type="text"
                 class="form-control input-sm"
                 ng-model="newAppModal.application.repoSlug"
                 placeholder="Enter your source repository name (not the URL)"
                 pattern="^((?!\:\/\/).)*$"
                 id="repoSlug"
                 name="repoSlug"
              >
          </input>

          Enter your source repository name (not the URL).

Description

          <textarea
                 class="form-control input-sm"
                 ng-model="newAppModal.application.description"
                 placeholder="Enter a description"
                 data-purpose="application-description"
                 id="applicationDescription">
          </textarea>

Accounts

          <account-select-field component="newAppModal.application" field="account" accounts="newAppModal.accounts" provider="'aws'" multiselect="true"></account-select-field>

 1">

Cloud Providers

          <ui-select multiple ng-model="newAppModal.application.cloudProviders" class="form-control input-sm">
            <ui-select-match>
              {{$item}}
            </ui-select-match>
            <ui-select-choices repeat="provider in newAppModal.cloudProviders | filter: $select.search">
              {{provider}}
            </ui-select-choices>
          </ui-select>

Instance Health

            <input type="checkbox"
                   ng-model="newAppModal.application.platformHealthOnly"
                   id="applicationPlatformHealthOnly">
            </input>
            Consider only cloud provider health when executing tasks
            <help-field key="application.platformHealthOnly"></help-field>

            <input type="checkbox"
                   ng-model="newAppModal.application.platformHealthOnlyShowOverride"
                   id="applicationPlatformHealthOnlyShowOverride">
            </input>
            Show health override option for each operation
            <help-field key="application.showPlatformHealthOverride"></help-field>

            <status-glyph item="{isFailed: true}"></status-glyph> {{errorMsg}}

      Cancel
      <button type="submit"
              class="btn btn-primary"
              data-purpose="submit"
              ng-disabled="newApplicationForm.$invalid || !newAppModal.application.hasOwnProperty('account') || (newAppModal.application.hasOwnProperty('account') && newAppModal.application.account.length < 1)|| newAppModal.submitting"
              ng-click="newAppModal.submit()">

        Create
      </button>

  </form>


text:
module Google
  module Cloud
    module Compute
      module V1
        module SslPolicies
          module Rest
            # GRPC transcoding helper methods for the SslPolicies REST API.
            module GrpcTranscoding
              # @param request_pb [::Google::Cloud::Compute::V1::DeleteSslPolicyRequest]
              #   A request object representing the call parameters. Required.
              # @return [Array(String, [String, nil], Hash{String => String})]
              #   Uri, Body, Query string parameters
              def transcode_delete request_pb
                uri = "/compute/v1/projects/#{request_pb.project}/global/sslPolicies/#{request_pb.ssl_policy}"
                body = nil
                query_string_params = {}
                query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

                [uri, body, query_string_params]
              end

              # @param request_pb [::Google::Cloud::Compute::V1::GetSslPolicyRequest]
              #   A request object representing the call parameters. Required.
              # @return [Array(String, [String, nil], Hash{String => String})]
              #   Uri, Body, Query string parameters
              def transcode_get request_pb
                uri = "/compute/v1/projects/#{request_pb.project}/global/sslPolicies/#{request_pb.ssl_policy}"
                body = nil
                query_string_params = {}

                [uri, body, query_string_params]
              end

              # @param request_pb [::Google::Cloud::Compute::V1::InsertSslPolicyRequest]
              #   A request object representing the call parameters. Required.
              # @return [Array(String, [String, nil], Hash{String => String})]
              #   Uri, Body, Query string parameters
              def transcode_insert request_pb
                uri = "/compute/v1/projects/#{request_pb.project}/global/sslPolicies"
                body = request_pb.ssl_policy_resource.to_json
                query_string_params = {}
                query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

                [uri, body, query_string_params]
              end

              # @param request_pb [::Google::Cloud::Compute::V1::ListSslPoliciesRequest]
              #   A request object representing the call parameters. Required.
              # @return [Array(String, [String, nil], Hash{String => String})]
              #   Uri, Body, Query string parameters
              def transcode_list request_pb
                uri = "/compute/v1/projects/#{request_pb.project}/global/sslPolicies"
                body = nil
                query_string_params = {}
                query_string_params["filter"] = request_pb.filter.to_s if request_pb.has_filter?
                query_string_params["maxResults"] = request_pb.max_results.to_s if request_pb.has_max_results?
                query_string_params["orderBy"] = request_pb.order_by.to_s if request_pb.has_order_by?
                query_string_params["pageToken"] = request_pb.page_token.to_s if request_pb.has_page_token?
                query_string_params["returnPartialSuccess"] = request_pb.return_partial_success.to_s if request_pb.has_return_partial_success?

                [uri, body, query_string_params]
              end

              # @param request_pb [::Google::Cloud::Compute::V1::ListAvailableFeaturesSslPoliciesRequest]
              #   A request object representing the call parameters. Required.
              # @return [Array(String, [String, nil], Hash{String => String})]
              #   Uri, Body, Query string parameters
              def transcode_list_available_features request_pb
                uri = "/compute/v1/projects/#{request_pb.project}/global/sslPolicies/listAvailableFeatures"
                body = nil
                query_string_params = {}
                query_string_params["filter"] = request_pb.filter.to_s if request_pb.has_filter?
                query_string_params["maxResults"] = request_pb.max_results.to_s if request_pb.has_max_results?
                query_string_params["orderBy"] = request_pb.order_by.to_s if request_pb.has_order_by?
                query_string_params["pageToken"] = request_pb.page_token.to_s if request_pb.has_page_token?
                query_string_params["returnPartialSuccess"] = request_pb.return_partial_success.to_s if request_pb.has_return_partial_success?

                [uri, body, query_string_params]
              end

              # @param request_pb [::Google::Cloud::Compute::V1::PatchSslPolicyRequest]
              #   A request object representing the call parameters. Required.
              # @return [Array(String, [String, nil], Hash{String => String})]
              #   Uri, Body, Query string parameters
              def transcode_patch request_pb
                uri = "/compute/v1/projects/#{request_pb.project}/global/sslPolicies/#{request_pb.ssl_policy}"
                body = request_pb.ssl_policy_resource.to_json
                query_string_params = {}
                query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

                [uri, body, query_string_params]
              end
              extend self
            end
          end
        end
      end
    end
  end
end