text:
#include <aws/swf/model/ActivityTypeConfiguration.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::SWF::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

ActivityTypeConfiguration::ActivityTypeConfiguration() :
    m_defaultTaskStartToCloseTimeoutHasBeenSet(false),
    m_defaultTaskHeartbeatTimeoutHasBeenSet(false),
    m_defaultTaskListHasBeenSet(false),
    m_defaultTaskPriorityHasBeenSet(false),
    m_defaultTaskScheduleToStartTimeoutHasBeenSet(false),
    m_defaultTaskScheduleToCloseTimeoutHasBeenSet(false)
{
}

ActivityTypeConfiguration::ActivityTypeConfiguration(const JsonValue& jsonValue) :
    m_defaultTaskStartToCloseTimeoutHasBeenSet(false),
    m_defaultTaskHeartbeatTimeoutHasBeenSet(false),
    m_defaultTaskListHasBeenSet(false),
    m_defaultTaskPriorityHasBeenSet(false),
    m_defaultTaskScheduleToStartTimeoutHasBeenSet(false),
    m_defaultTaskScheduleToCloseTimeoutHasBeenSet(false)
{
  *this = jsonValue;
}

ActivityTypeConfiguration& ActivityTypeConfiguration::operator =(const JsonValue& jsonValue)
{
  if(jsonValue.ValueExists("defaultTaskStartToCloseTimeout"))
  {
    m_defaultTaskStartToCloseTimeout = jsonValue.GetString("defaultTaskStartToCloseTimeout");

    m_defaultTaskStartToCloseTimeoutHasBeenSet = true;
  }

  if(jsonValue.ValueExists("defaultTaskHeartbeatTimeout"))
  {
    m_defaultTaskHeartbeatTimeout = jsonValue.GetString("defaultTaskHeartbeatTimeout");

    m_defaultTaskHeartbeatTimeoutHasBeenSet = true;
  }

  if(jsonValue.ValueExists("defaultTaskList"))
  {
    m_defaultTaskList = jsonValue.GetObject("defaultTaskList");

    m_defaultTaskListHasBeenSet = true;
  }

  if(jsonValue.ValueExists("defaultTaskPriority"))
  {
    m_defaultTaskPriority = jsonValue.GetString("defaultTaskPriority");

    m_defaultTaskPriorityHasBeenSet = true;
  }

  if(jsonValue.ValueExists("defaultTaskScheduleToStartTimeout"))
  {
    m_defaultTaskScheduleToStartTimeout = jsonValue.GetString("defaultTaskScheduleToStartTimeout");

    m_defaultTaskScheduleToStartTimeoutHasBeenSet = true;
  }

  if(jsonValue.ValueExists("defaultTaskScheduleToCloseTimeout"))
  {
    m_defaultTaskScheduleToCloseTimeout = jsonValue.GetString("defaultTaskScheduleToCloseTimeout");

    m_defaultTaskScheduleToCloseTimeoutHasBeenSet = true;
  }

  return *this;
}

JsonValue ActivityTypeConfiguration::Jsonize() const
{
  JsonValue payload;

  if(m_defaultTaskStartToCloseTimeoutHasBeenSet)
  {
   payload.WithString("defaultTaskStartToCloseTimeout", m_defaultTaskStartToCloseTimeout);

  }

  if(m_defaultTaskHeartbeatTimeoutHasBeenSet)
  {
   payload.WithString("defaultTaskHeartbeatTimeout", m_defaultTaskHeartbeatTimeout);

  }

  if(m_defaultTaskListHasBeenSet)
  {
   payload.WithObject("defaultTaskList", m_defaultTaskList.Jsonize());

  }

  if(m_defaultTaskPriorityHasBeenSet)
  {
   payload.WithString("defaultTaskPriority", m_defaultTaskPriority);

  }

  if(m_defaultTaskScheduleToStartTimeoutHasBeenSet)
  {
   payload.WithString("defaultTaskScheduleToStartTimeout", m_defaultTaskScheduleToStartTimeout);

  }

  if(m_defaultTaskScheduleToCloseTimeoutHasBeenSet)
  {
   payload.WithString("defaultTaskScheduleToCloseTimeout", m_defaultTaskScheduleToCloseTimeout);

  }

  return std::move(payload);
}


text:
namespace supersonic {using std::string; }
#include <vector>
using std::vector;

#include <glog/logging.h>
#include "supersonic/utils/logging-inl.h"
#include "supersonic/utils/macros.h"
#include "supersonic/utils/scoped_ptr.h"
#include <atomic>
#include "supersonic/base/exception/exception.h"
#include "supersonic/base/exception/exception_macros.h"
#include "supersonic/base/infrastructure/block.h"
#include "supersonic/base/infrastructure/tuple_schema.h"
#include "supersonic/base/infrastructure/types.h"
#include "supersonic/cursor/base/cursor.h"
#include "supersonic/cursor/base/cursor_transformer.h"
#include "supersonic/cursor/proto/cursors.pb.h"
#include "supersonic/utils/linked_ptr.h"

namespace supersonic {

// Common base class for cursors that:
// * know their schema during construction.
// * possibly have children.
class BasicCursor : public Cursor {
 public:
  virtual ~BasicCursor() {}

  virtual const TupleSchema& schema() const { return schema_; }
  virtual void AppendDebugDescription(string* target) const;

  // Propagates interruption request to the children, and sets the interrupted_
  // status. Thread-safe wrt Next(). (But, doesn't introduce memory barriers,
  // i.e. doesn't guarantee happens-before).
  virtual void Interrupt() {
    interrupted_.store(true, std::memory_order_relaxed);
    for (int i = 0; i < children_.size(); ++i) {
      children_[i]->Interrupt();
    }
  }

  // Basic cursor's Transform() will run the callback on all of its children to
  // which it has access. This means that all classes derived from BasicCursor
  // which do not pass the ownership of its children to the base class have
  // to override Transform() with their own case-specific logic.
  virtual void ApplyToChildren(CursorTransformer* transformer) {
    for (int i = 0; i < children_.size(); ++i) {
      children_[i].reset(transformer->Transform(children_[i].release()));
    }
  }

 protected:
  // Base constructor for cursors with no children.
  explicit BasicCursor(const TupleSchema& schema)
      : schema_(schema),
        view_(schema),
        interrupted_(false) {}

  // Base constructor for cursors with one child. Takes ownership of the child.
  BasicCursor(const TupleSchema& schema, Cursor* child)
      : schema_(schema),
        view_(schema),
        interrupted_(false) {
    children_.push_back(make_linked_ptr(child));
  }

  // Base constructor for cursors with two children. Takes ownership of the
  // children.
  BasicCursor(const TupleSchema& schema, Cursor* child1, Cursor* child2)
      : schema_(schema),
        view_(schema),
        interrupted_(false) {
    children_.push_back(make_linked_ptr(child1));
    children_.push_back(make_linked_ptr(child2));
  }

  // Base constructor for cursors with arbitrary number of children.
  // Takes ownership of the children.
  BasicCursor(const TupleSchema& schema, const vector<Cursor*>& children)
      : schema_(schema),
        view_(schema),
        interrupted_(false) {
    for (int i = 0; i < children.size(); ++i) {
      children_.push_back(make_linked_ptr(children[i]));
    }
  }

  // Returns the n-th child. N must be smaller than children_count().
  Cursor* child_at(const size_t position) const {
    DCHECK_LT(position, children_.size());
    return children_[position].get();
  }

  // Convenience shortcut for child_at(0) for cursors that have exactly one
  // child (which is a common case).
  Cursor* child() const {
    DCHECK_EQ(1, children_.size());
    return children_[0].get();
  }

  // Returns the total count of children.
  size_t children_count() const { return children_.size(); }

  // Result View accessor.
  View* my_view() { return &view_; }

  // Debugging support. Returns a string that describes this cursor. May be
  // overridden by subclasses. The default implementation returns cursor's
  // non-qualified class name. The method is called at most once in any
  // cursor's lifetime.
  virtual string DebugDescription() const;

  // Checks whether the cursor has been interrupted. NOTE: for performance,
  // we're using a relaxed synchronization model. In practice, it means that
  // it might happen that a cursor doesn't see the flag set yet, even though
  // its children already have seen it.
  bool is_interrupted() const {
    return interrupted_.load(std::memory_order_relaxed);
  }

  // Intended use:
  // PROPAGATE_ON_FAILURE(ThrowIfInterrupted());
  FailureOrVoid ThrowIfInterrupted() const {
    if (is_interrupted()) THROW(new Exception(INTERRUPTED, ""));
    return Success();
  }

 private:
  // Caching around GetDebugDescriptor.
  const string& LazilyGetDebugDescription() const;

  TupleSchema schema_;
  View view_;
  vector<linked_ptr<Cursor> > children_;
  mutable string debug_description_;

  // Stores the interruption status for later use. Aimed at leaf cursors,
  // as they need to let the processing thread (calling Next()) know about
  // the interruption request. This flag provides a convenient means to do so.
  std::atomic<bool> interrupted_;

  DISALLOW_COPY_AND_ASSIGN(BasicCursor);
};

// A convenience base class for cursors that pass most calls directly to
// the delegate, decorated cursor.
class BasicDecoratorCursor : public Cursor {
 public:
  virtual ~BasicDecoratorCursor() {}

  virtual const TupleSchema& schema() const { return delegate()->schema(); }

  virtual ResultView Next(rowcount_t max_row_count) {
    return delegate()->Next(max_row_count);
  }

  virtual bool IsWaitingOnBarrierSupported() const {
    return delegate()->IsWaitingOnBarrierSupported();
  }

  virtual void Interrupt() { delegate()->Interrupt(); }

  virtual CursorId GetCursorId() const { return DECORATOR; }

  virtual void AppendDebugDescription(string* target) const {
    delegate()->AppendDebugDescription(target);
  }

 protected:
  explicit BasicDecoratorCursor(Cursor* delegate) : delegate_(delegate) {}

  Cursor* delegate() { return delegate_.get(); }
  const Cursor* delegate() const { return delegate_.get(); }

 private:
  std::unique_ptr<Cursor> delegate_;
  DISALLOW_COPY_AND_ASSIGN(BasicDecoratorCursor);
};

}  // namespace supersonic

#endif  // SUPERSONIC_CURSOR_INFRASTRUCTURE_BASIC_CURSOR_H_

redpajama_set_name: RedPajamaGithub


text:
package ua.yet.adv.java.generics;

import java.util.Collection;
import java.util.List;

/**
 * A class to showcase the type erasure. If the instance of this class is
 * created with generics, then compiler uses generics to check types in methods
 * and weaves method correctly. If the instance of this class is created without
 * generics (i.e. raw type), then compiler ignores generics in methods and can
 * weave calls incorrectly.
 *
 * See {@link TestSomeType} for usages and showcases
 *
 * @author Yuriy_Tkach
 *
 * @param <T>
 *            Some type. Unused in the logic
 */
public class SomeType<T> {

    public <E> void test(final Collection<E> collection) {
        for (final E object : collection) {
            System.out.println("E: " + object);
        }
    }

    public void test(final List<Integer> integerList) {
        int result = 0;
        for (final Integer integer : integerList) {
            result += integer.intValue();
        }
        System.out.println("result: " + result);
    }

}


text:
namespace {

views::Link* CreateLink(views::LinkListener* listener,
                        int resource_id,
                        int id) {
  views::Link* link = new views::Link(l10n_util::GetStringUTF16(resource_id));
  link->set_listener(listener);
  link->set_id(id);
  return link;
}

// TODO(ftang) Restore icons in CreateViewAfterTranslate and CreateViewError
// without causing layout issues; see http://crbug.com/610351
void AddIconToLayout(views::GridLayout* layout) {
  views::ImageView* icon = new views::ImageView();
  ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
  icon->SetImage(bundle.GetImageNamed(IDR_TRANSLATE_ICON_BUBBLE).ToImageSkia());
  layout->AddView(icon);
}

bool Use2016Q2UI() {
  return base::FeatureList::IsEnabled(translate::kTranslateUI2016Q2);
}

}  // namespace

// static
TranslateBubbleView* TranslateBubbleView::translate_bubble_view_ = NULL;

TranslateBubbleView::~TranslateBubbleView() {
  // A child view could refer to a model which is owned by this class when
  // the child view is destructed. For example, |source_language_combobx_model_|
  // is referred by Combobox's destructor. Before destroying the models,
  // removing the child views is needed.
  RemoveAllChildViews(true);
}

// static
views::Widget* TranslateBubbleView::ShowBubble(
    views::View* anchor_view,
    content::WebContents* web_contents,
    translate::TranslateStep step,
    translate::TranslateErrors::Type error_type,
    DisplayReason reason) {
  if (translate_bubble_view_) {
    // When the user reads the advanced setting panel, the bubble should not be
    // changed because they are focusing on the bubble.
    if (translate_bubble_view_->web_contents() == web_contents &&
        translate_bubble_view_->model()->GetViewState() ==
            TranslateBubbleModel::VIEW_STATE_ADVANCED) {
      return nullptr;
    }
    if (step != translate::TRANSLATE_STEP_TRANSLATE_ERROR) {
      TranslateBubbleModel::ViewState state =
          TranslateBubbleModelImpl::TranslateStepToViewState(step);
      translate_bubble_view_->SwitchView(state);
    } else {
      translate_bubble_view_->SwitchToErrorView(error_type);
    }
    return nullptr;
  } else {
    if (step == translate::TRANSLATE_STEP_AFTER_TRANSLATE &&
        reason == AUTOMATIC) {
      return nullptr;
    }
  }

  std::string source_language;
  std::string target_language;
  ChromeTranslateClient::GetTranslateLanguages(web_contents, &source_language,
                                               &target_language);

  std::unique_ptr<translate::TranslateUIDelegate> ui_delegate(
      new translate::TranslateUIDelegate(
          ChromeTranslateClient::GetManagerFromWebContents(web_contents)
              ->GetWeakPtr(),
          source_language, target_language));
  std::unique_ptr<TranslateBubbleModel> model(
      new TranslateBubbleModelImpl(step, std::move(ui_delegate)));
  TranslateBubbleView* view = new TranslateBubbleView(
      anchor_view, std::move(model), error_type, web_contents);
  views::Widget* bubble_widget =
      views::BubbleDialogDelegateView::CreateBubble(view);
  view->ShowForReason(reason);
  translate::ReportUiAction(translate::BUBBLE_SHOWN);
  return bubble_widget;
}

// static
void TranslateBubbleView::CloseCurrentBubble() {
  if (translate_bubble_view_)
    translate_bubble_view_->CloseBubble();
}

// static
TranslateBubbleView* TranslateBubbleView::GetCurrentBubble() {
  return translate_bubble_view_;
}

void TranslateBubbleView::CloseBubble() {
  mouse_handler_.reset();
  LocationBarBubbleDelegateView::CloseBubble();
}

void TranslateBubbleView::Init() {
  SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));

  should_always_translate_ = model_->ShouldAlwaysTranslate();
  if (Use2016Q2UI() && !is_in_incognito_window_) {
    should_always_translate_ =
        model_->ShouldAlwaysTranslateBeCheckedByDefault();
  }

  before_translate_view_ = CreateViewBeforeTranslate();
  translating_view_ = CreateViewTranslating();
  after_translate_view_ = CreateViewAfterTranslate();
  error_view_ = CreateViewError();
  advanced_view_ = CreateViewAdvanced();

  AddChildView(before_translate_view_);
  AddChildView(translating_view_);
  AddChildView(after_translate_view_);
  AddChildView(error_view_);
  AddChildView(advanced_view_);

  AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));

  UpdateChildVisibilities();

  if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ERROR)
    model_->ShowError(error_type_);
}

void TranslateBubbleView::ButtonPressed(views::Button* sender,
                                        const ui::Event& event) {
  HandleButtonPressed(static_cast<ButtonID>(sender->id()));
}

bool TranslateBubbleView::ShouldShowCloseButton() const {
  return Use2016Q2UI();
}

void TranslateBubbleView::WindowClosing() {
  // The operations for |model_| are valid only when a WebContents is alive.
  // TODO(hajimehoshi): TranslateBubbleViewModel(Impl) should not hold a
  // WebContents as a member variable because the WebContents might be destroyed
  // while the TranslateBubbleViewModel(Impl) is still alive. Instead,
  // TranslateBubbleViewModel should take a reference of a WebContents at each
  // method. (crbug/320497)
  if (web_contents())
    model_->OnBubbleClosing();

  // We have to reset |translate_bubble_view_| here, not in our destructor,
  // because we'll be destroyed asynchronously and the shown state will be
  // checked before then.
  DCHECK_EQ(translate_bubble_view_, this);
  translate_bubble_view_ = NULL;
}

bool TranslateBubbleView::AcceleratorPressed(
    const ui::Accelerator& accelerator) {
  switch (model_->GetViewState()) {
    case TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE: {
      if (accelerator.key_code() == ui::VKEY_RETURN) {
        HandleButtonPressed(BUTTON_ID_TRANSLATE);
        return true;
      }
      break;
    }
    case TranslateBubbleModel::VIEW_STATE_TRANSLATING:
      break;
    case TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE: {
      if (accelerator.key_code() == ui::VKEY_RETURN) {
        HandleButtonPressed(BUTTON_ID_SHOW_ORIGINAL);
        return true;
      }
      break;
    }
    case TranslateBubbleModel::VIEW_STATE_ERROR:
      break;
    case TranslateBubbleModel::VIEW_STATE_ADVANCED: {
      if (accelerator.key_code() == ui::VKEY_RETURN) {
        HandleButtonPressed(BUTTON_ID_DONE);
        return true;
      }
      break;
    }
  }
  return BubbleDialogDelegateView::AcceleratorPressed(accelerator);
}

gfx::Size TranslateBubbleView::GetPreferredSize() const {
  int width = 0;
  for (int i = 0; i < child_count(); i++) {
    const views::View* child = child_at(i);
    width = std::max(width, child->GetPreferredSize().width());
  }
  int height = GetCurrentView()->GetPreferredSize().height();
  return gfx::Size(width, height);
}

void TranslateBubbleView::OnPerformAction(views::Combobox* combobox) {
  HandleComboboxPerformAction(static_cast<ComboboxID>(combobox->id()));
}

void TranslateBubbleView::LinkClicked(views::Link* source, int event_flags) {
  HandleLinkClicked(static_cast<LinkID>(source->id()));
}

void TranslateBubbleView::OnMenuButtonClicked(views::MenuButton* source,
                                              const gfx::Point& point,
                                              const ui::Event* event) {
  if (!denial_menu_runner_) {
    denial_menu_model_.reset(new ui::SimpleMenuModel(this));
    denial_menu_model_->AddItem(
        DenialMenuItem::NEVER_TRANSLATE_LANGUAGE,
        l10n_util::GetStringFUTF16(
            IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG,
            model_->GetLanguageNameAt(model_->GetOriginalLanguageIndex())));

    denial_menu_model_->AddSeparator(ui::NORMAL_SEPARATOR);

    denial_menu_model_->AddItemWithStringId(
        DenialMenuItem::NEVER_TRANSLATE_SITE,
        IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE);

    denial_menu_runner_.reset(new views::MenuRunner(denial_menu_model_.get(),
                                                    views::MenuRunner::ASYNC));
  }
  gfx::Rect screen_bounds = source->GetBoundsInScreen();
  screen_bounds.Inset(source->GetInsets());
  denial_menu_runner_->RunMenuAt(source->GetWidget(), source, screen_bounds,
                                 views::MENU_ANCHOR_TOPRIGHT,
                                 ui::MENU_SOURCE_MOUSE);
}

bool TranslateBubbleView::IsCommandIdChecked(int command_id) const {
  return false;
}

bool TranslateBubbleView::IsCommandIdEnabled(int command_id) const {
  return true;
}

void TranslateBubbleView::ExecuteCommand(int command_id, int event_flags) {
  model_->DeclineTranslation();
  switch (command_id) {
    case DenialMenuItem::NEVER_TRANSLATE_LANGUAGE:
      model_->SetNeverTranslateLanguage(true);
      translate::ReportUiAction(
          translate::NEVER_TRANSLATE_LANGUAGE_MENU_CLICKED);
      break;
    case DenialMenuItem::NEVER_TRANSLATE_SITE:
      model_->SetNeverTranslateSite(true);
      translate::ReportUiAction(translate::NEVER_TRANSLATE_SITE_MENU_CLICKED);
      break;
    default:
      NOTREACHED();
  }
  GetWidget()->Close();
}

void TranslateBubbleView::StyledLabelLinkClicked(views::StyledLabel* label,
                                                 const gfx::Range& range,
                                                 int event_flags) {
  SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED);
  translate::ReportUiAction(translate::ADVANCED_LINK_CLICKED);
}

void TranslateBubbleView::WebContentsDestroyed() {
  GetWidget()->CloseNow();
}

void TranslateBubbleView::OnWidgetClosing(views::Widget* widget) {
  if (GetBubbleFrameView()->close_button_clicked()) {
    model_->DeclineTranslation();
    translate::ReportUiAction(translate::CLOSE_BUTTON_CLICKED);
  }
}

TranslateBubbleModel::ViewState TranslateBubbleView::GetViewState() const {
  return model_->GetViewState();
}

TranslateBubbleView::TranslateBubbleView(
    views::View* anchor_view,
    std::unique_ptr<TranslateBubbleModel> model,
    translate::TranslateErrors::Type error_type,
    content::WebContents* web_contents)
    : LocationBarBubbleDelegateView(anchor_view, web_contents),
      WebContentsObserver(web_contents),
      before_translate_view_(NULL),
      translating_view_(NULL),
      after_translate_view_(NULL),
      error_view_(NULL),
      advanced_view_(NULL),
      denial_combobox_(NULL),
      source_language_combobox_(NULL),
      target_language_combobox_(NULL),
      before_always_translate_checkbox_(NULL),
      advanced_always_translate_checkbox_(NULL),
      advanced_cancel_button_(NULL),
      advanced_done_button_(NULL),
      denial_menu_button_(NULL),
      model_(std::move(model)),
      error_type_(error_type),
      is_in_incognito_window_(
          web_contents && web_contents->GetBrowserContext()->IsOffTheRecord()),
      should_always_translate_(false) {
  translate_bubble_view_ = this;
  if (web_contents)  // web_contents can be null in unit_tests.
    mouse_handler_.reset(new WebContentMouseHandler(this, web_contents));
}

views::View* TranslateBubbleView::GetCurrentView() const {
  switch (model_->GetViewState()) {
    case TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE:
      return before_translate_view_;
    case TranslateBubbleModel::VIEW_STATE_TRANSLATING:
      return translating_view_;
    case TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE:
      return after_translate_view_;
    case TranslateBubbleModel::VIEW_STATE_ERROR:
      return error_view_;
    case TranslateBubbleModel::VIEW_STATE_ADVANCED:
      return advanced_view_;
  }
  NOTREACHED();
  return NULL;
}

void TranslateBubbleView::HandleButtonPressed(
    TranslateBubbleView::ButtonID sender_id) {
  switch (sender_id) {
    case BUTTON_ID_TRANSLATE: {
      model_->SetAlwaysTranslate(should_always_translate_);
      model_->Translate();
      translate::ReportUiAction(translate::TRANSLATE_BUTTON_CLICKED);
      break;
    }
    case BUTTON_ID_DONE: {
      model_->SetAlwaysTranslate(should_always_translate_);
      if (model_->IsPageTranslatedInCurrentLanguages()) {
        model_->GoBackFromAdvanced();
        UpdateChildVisibilities();
        SizeToContents();
      } else {
        model_->Translate();
        SwitchView(TranslateBubbleModel::VIEW_STATE_TRANSLATING);
      }
      translate::ReportUiAction(translate::DONE_BUTTON_CLICKED);
      break;
    }
    case BUTTON_ID_CANCEL: {
      model_->GoBackFromAdvanced();
      UpdateChildVisibilities();
      SizeToContents();
      translate::ReportUiAction(translate::CANCEL_BUTTON_CLICKED);
      break;
    }
    case BUTTON_ID_TRY_AGAIN: {
      model_->Translate();
      translate::ReportUiAction(translate::TRY_AGAIN_BUTTON_CLICKED);
      break;
    }
    case BUTTON_ID_SHOW_ORIGINAL: {
      model_->RevertTranslation();
      GetWidget()->Close();
      translate::ReportUiAction(translate::SHOW_ORIGINAL_BUTTON_CLICKED);
      break;
    }
    case BUTTON_ID_ALWAYS_TRANSLATE: {
      views::Checkbox* always_checkbox = GetAlwaysTranslateCheckbox();
      DCHECK(always_checkbox);
      should_always_translate_ = always_checkbox->checked();
      translate::ReportUiAction(should_always_translate_
                                    ? translate::ALWAYS_TRANSLATE_CHECKED
                                    : translate::ALWAYS_TRANSLATE_UNCHECKED);
      break;
    }
  }
}

void TranslateBubbleView::HandleLinkClicked(
    TranslateBubbleView::LinkID sender_id) {
  switch (sender_id) {
    case LINK_ID_ADVANCED: {
      SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED);
      translate::ReportUiAction(translate::ADVANCED_LINK_CLICKED);
      break;
    }
    case LINK_ID_LANGUAGE_SETTINGS: {
      GURL url = chrome::GetSettingsUrl(chrome::kLanguageOptionsSubPage);
      web_contents()->OpenURL(content::OpenURLParams(
          url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB,
          ui::PAGE_TRANSITION_LINK, false));
      translate::ReportUiAction(translate::SETTINGS_LINK_CLICKED);
      break;
    }
  }
}

void TranslateBubbleView::HandleComboboxPerformAction(
    TranslateBubbleView::ComboboxID sender_id) {
  switch (sender_id) {
    case COMBOBOX_ID_DENIAL: {
      model_->DeclineTranslation();
      DenialComboboxIndex index =
          static_cast<DenialComboboxIndex>(denial_combobox_->selected_index());
      switch (index) {
        case DenialComboboxIndex::DONT_TRANSLATE:
          translate::ReportUiAction(translate::NOPE_MENU_CLICKED);
          break;
        case DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE:
          model_->SetNeverTranslateLanguage(true);
          translate::ReportUiAction(
              translate::NEVER_TRANSLATE_LANGUAGE_MENU_CLICKED);
          break;
        case DenialComboboxIndex::NEVER_TRANSLATE_SITE:
          model_->SetNeverTranslateSite(true);
          translate::ReportUiAction(
              translate::NEVER_TRANSLATE_SITE_MENU_CLICKED);
          break;
        default:
          NOTREACHED();
          break;
      }
      GetWidget()->Close();
      break;
    }
    case COMBOBOX_ID_SOURCE_LANGUAGE: {
      if (model_->GetOriginalLanguageIndex() ==
          source_language_combobox_->selected_index()) {
        break;
      }
      model_->UpdateOriginalLanguageIndex(
          source_language_combobox_->selected_index());
      UpdateAdvancedView();
      translate::ReportUiAction(translate::SOURCE_LANGUAGE_MENU_CLICKED);
      break;
    }
    case COMBOBOX_ID_TARGET_LANGUAGE: {
      if (model_->GetTargetLanguageIndex() ==
          target_language_combobox_->selected_index()) {
        break;
      }
      model_->UpdateTargetLanguageIndex(
          target_language_combobox_->selected_index());
      UpdateAdvancedView();
      translate::ReportUiAction(translate::TARGET_LANGUAGE_MENU_CLICKED);
      break;
    }
  }
}

void TranslateBubbleView::UpdateChildVisibilities() {
  // Update the statew of the always translate checkbox
  if (advanced_always_translate_checkbox_)
    advanced_always_translate_checkbox_->SetChecked(should_always_translate_);
  if (before_always_translate_checkbox_)
    before_always_translate_checkbox_->SetChecked(should_always_translate_);
  for (int i = 0; i < child_count(); i++) {
    views::View* view = child_at(i);
    view->SetVisible(view == GetCurrentView());
  }
}

views::View* TranslateBubbleView::CreateViewBeforeTranslate() {
  const int kQuestionWidth = 200;
  base::string16 original_language_name =
      model_->GetLanguageNameAt(model_->GetOriginalLanguageIndex());

  views::View* view = new views::View();
  views::GridLayout* layout = new views::GridLayout(view);
  view->SetLayoutManager(layout);

  using views::GridLayout;

  enum {
    COLUMN_SET_ID_MESSAGE,
    COLUMN_SET_ID_CONTENT,
  };

  views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  if (Use2016Q2UI()) {
    // Add padding between the icon and the text.
    cs->AddPaddingColumn(0, views::kUnrelatedControlHorizontalSpacing);
  } else {
    // Add padding between the text and the link.
    cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
  }
  cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(1, 0);

  cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT);
  cs->AddPaddingColumn(1, 0);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);

  layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
  if (Use2016Q2UI()) {
    AddIconToLayout(layout);

    base::string16 target_language_name =
        model_->GetLanguageNameAt(model_->GetTargetLanguageIndex());
    std::vector<size_t> offsets;
    auto* styled_label = new views::StyledLabel(
        l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_NEW,
                                   original_language_name, target_language_name,
                                   &offsets),
        this);
    auto style_info = views::StyledLabel::RangeStyleInfo::CreateForLink();
    styled_label->AddStyleRange(
        gfx::Range(static_cast<uint32_t>(offsets[0]),
                   static_cast<uint32_t>(offsets[0] +
                                         original_language_name.length())),
        style_info);
    styled_label->AddStyleRange(
        gfx::Range(
            static_cast<uint32_t>(offsets[1]),
            static_cast<uint32_t>(offsets[1] + target_language_name.length())),
        style_info);
    styled_label->SizeToFit(kQuestionWidth);
    layout->AddView(styled_label);
  } else {
    layout->AddView(new views::Label(
        l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE)));
    layout->AddView(
        CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED));
  }

  // In an incognito window, the "Always translate" checkbox shouldn't be shown.
  if (Use2016Q2UI() && !is_in_incognito_window_) {
    layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
    layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
    layout->SkipColumns(1);
    before_always_translate_checkbox_ = new views::Checkbox(
        l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ALWAYS_DO_THIS));
    before_always_translate_checkbox_->set_id(BUTTON_ID_ALWAYS_TRANSLATE);
    before_always_translate_checkbox_->set_listener(this);
    layout->AddView(before_always_translate_checkbox_);
  }
  if (Use2016Q2UI()) {
    layout->AddPaddingRow(0, views::kPanelSubVerticalSpacing);
  } else {
    layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
  }

  layout->StartRow(0, COLUMN_SET_ID_CONTENT);
  views::LabelButton* accept_button =
      Use2016Q2UI()
          ? views::MdTextButton::CreateSecondaryUiBlueButton(
                this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT))
          : views::MdTextButton::CreateSecondaryUiButton(
                this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT));
  accept_button->set_id(BUTTON_ID_TRANSLATE);
  layout->AddView(accept_button);
  accept_button->SetIsDefault(true);
  if (Use2016Q2UI()) {
    denial_menu_button_ = new views::MenuButton(
        l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_OPTIONS_MENU_BUTTON),
        this, true);
    denial_menu_button_->SetStyle(views::Button::STYLE_BUTTON);
    layout->AddView(denial_menu_button_);
  } else {
    std::vector<base::string16> items(
        static_cast<size_t>(DenialComboboxIndex::MENU_SIZE));
    items[static_cast<size_t>(DenialComboboxIndex::DONT_TRANSLATE)] =
        l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY);
    items[static_cast<size_t>(DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE)] =
        l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG,
                                   original_language_name);
    items[static_cast<size_t>(DenialComboboxIndex::NEVER_TRANSLATE_SITE)] =
        l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE);
    denial_combobox_model_.reset(new ui::SimpleComboboxModel(items));
    denial_combobox_ = new views::Combobox(denial_combobox_model_.get(),
                                           views::Combobox::STYLE_ACTION);
    denial_combobox_->set_id(COMBOBOX_ID_DENIAL);
    denial_combobox_->set_listener(this);
    layout->AddView(denial_combobox_);
  }

  return view;
}

views::View* TranslateBubbleView::CreateViewTranslating() {
  base::string16 target_language_name =
      model_->GetLanguageNameAt(model_->GetTargetLanguageIndex());
  views::Label* label = new views::Label(
      l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRANSLATING));

  views::View* view = new views::View();
  views::GridLayout* layout = new views::GridLayout(view);
  view->SetLayoutManager(layout);

  using views::GridLayout;

  enum {
    COLUMN_SET_ID_MESSAGE,
    COLUMN_SET_ID_CONTENT,
  };

  views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);
  if (Use2016Q2UI()) {
    cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                  views::GridLayout::USE_PREF, 0, 0);
    // Add padding between the icon and the text.
    cs->AddPaddingColumn(0, views::kUnrelatedControlHorizontalSpacing);
  }
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(1, 0);

  cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT);
  cs->AddPaddingColumn(1, 0);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);

  layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
  if (Use2016Q2UI())
    AddIconToLayout(layout);
  layout->AddView(label);

  layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);

  layout->StartRow(0, COLUMN_SET_ID_CONTENT);
  views::LabelButton* revert_button =
      views::MdTextButton::CreateSecondaryUiButton(
          this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_REVERT));
  revert_button->set_id(BUTTON_ID_SHOW_ORIGINAL);
  revert_button->SetEnabled(false);
  layout->AddView(revert_button);

  return view;
}

views::View* TranslateBubbleView::CreateViewAfterTranslate() {
  views::Label* label = new views::Label(
      l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRANSLATED));

  views::View* view = new views::View();
  views::GridLayout* layout = new views::GridLayout(view);
  view->SetLayoutManager(layout);

  using views::GridLayout;

  enum {
    COLUMN_SET_ID_MESSAGE,
    COLUMN_SET_ID_CONTENT,
  };

  views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);

  // TODO(ftang) Restore icon without causing layout defects: crbug.com/610351

  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(1, 0);

  cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT);
  cs->AddPaddingColumn(1, 0);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);

  layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
  layout->AddView(label);
  layout->AddView(
      CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED));

  layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);

  layout->StartRow(0, COLUMN_SET_ID_CONTENT);
  views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton(
      this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_REVERT));
  button->set_id(BUTTON_ID_SHOW_ORIGINAL);
  layout->AddView(button);

  return view;
}

views::View* TranslateBubbleView::CreateViewError() {
  views::Label* label = new views::Label(
      l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE));

  views::View* view = new views::View();
  views::GridLayout* layout = new views::GridLayout(view);
  view->SetLayoutManager(layout);

  using views::GridLayout;

  enum {
    COLUMN_SET_ID_MESSAGE,
    COLUMN_SET_ID_CONTENT,
  };

  views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE);

  // TODO(ftang) Restore icon without causing layout defects: crbug.com/610351

  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(1, 0);

  cs = layout->AddColumnSet(COLUMN_SET_ID_CONTENT);
  cs->AddPaddingColumn(1, 0);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);

  layout->StartRow(0, COLUMN_SET_ID_MESSAGE);
  layout->AddView(label);
  layout->AddView(
      CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED));

  layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);

  layout->StartRow(0, COLUMN_SET_ID_CONTENT);
  views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton(
      this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRY_AGAIN));
  button->set_id(BUTTON_ID_TRY_AGAIN);
  layout->AddView(button);

  return view;
}

// TODO(hajimehoshi): Revice this later to show a specific message for each
// error. (crbug/307350)
views::View* TranslateBubbleView::CreateViewAdvanced() {
  views::Label* source_language_label = new views::Label(
      l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_PAGE_LANGUAGE));

  views::Label* target_language_label = new views::Label(
      l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRANSLATION_LANGUAGE));

  int source_default_index = model_->GetOriginalLanguageIndex();
  source_language_combobox_model_.reset(
      new LanguageComboboxModel(source_default_index, model_.get()));
  source_language_combobox_ =
      new views::Combobox(source_language_combobox_model_.get());

  source_language_combobox_->set_id(COMBOBOX_ID_SOURCE_LANGUAGE);
  source_language_combobox_->set_listener(this);

  int target_default_index = model_->GetTargetLanguageIndex();
  target_language_combobox_model_.reset(
      new LanguageComboboxModel(target_default_index, model_.get()));
  target_language_combobox_ =
      new views::Combobox(target_language_combobox_model_.get());

  target_language_combobox_->set_id(COMBOBOX_ID_TARGET_LANGUAGE);
  target_language_combobox_->set_listener(this);

  // In an incognito window, "Always translate" checkbox shouldn't be shown.
  if (!is_in_incognito_window_) {
    advanced_always_translate_checkbox_ = new views::Checkbox(base::string16());
    advanced_always_translate_checkbox_->set_id(BUTTON_ID_ALWAYS_TRANSLATE);
    advanced_always_translate_checkbox_->set_listener(this);
  }

  views::View* view = new views::View();
  views::GridLayout* layout = new views::GridLayout(view);
  view->SetLayoutManager(layout);

  using views::GridLayout;

  enum {
    COLUMN_SET_ID_LANGUAGES,
    COLUMN_SET_ID_BUTTONS,
  };

  views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_LANGUAGES);
  cs->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
  cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, GridLayout::USE_PREF,
                0, 0);
  cs->AddPaddingColumn(1, 0);

  cs = layout->AddColumnSet(COLUMN_SET_ID_BUTTONS);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
  cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
                GridLayout::USE_PREF, 0, 0);

  layout->StartRow(0, COLUMN_SET_ID_LANGUAGES);
  layout->AddView(source_language_label);
  layout->AddView(source_language_combobox_);

  layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);

  layout->StartRow(0, COLUMN_SET_ID_LANGUAGES);
  layout->AddView(target_language_label);
  layout->AddView(target_language_combobox_);

  if (!is_in_incognito_window_) {
    layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
    layout->StartRow(0, COLUMN_SET_ID_LANGUAGES);
    layout->SkipColumns(1);
    layout->AddView(advanced_always_translate_checkbox_);
  }

  layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);

  layout->StartRow(0, COLUMN_SET_ID_BUTTONS);
  // TODO(estade): this should use CreateExtraView().
  layout->AddView(CreateLink(this, IDS_TRANSLATE_BUBBLE_LANGUAGE_SETTINGS,
                             LINK_ID_LANGUAGE_SETTINGS));
  advanced_done_button_ =
      Use2016Q2UI() ? views::MdTextButton::CreateSecondaryUiBlueButton(
                          this, l10n_util::GetStringUTF16(IDS_DONE))
                    : views::MdTextButton::CreateSecondaryUiButton(
                          this, l10n_util::GetStringUTF16(IDS_DONE));
  advanced_done_button_->set_id(BUTTON_ID_DONE);
  advanced_done_button_->SetIsDefault(true);
  advanced_cancel_button_ = views::MdTextButton::CreateSecondaryUiButton(
      this, l10n_util::GetStringUTF16(IDS_CANCEL));
  advanced_cancel_button_->set_id(BUTTON_ID_CANCEL);
  // TODO(estade): this should be using GetDialogButtons().
  layout->AddView(advanced_done_button_);
  layout->AddView(advanced_cancel_button_);

  UpdateAdvancedView();

  return view;
}

views::Checkbox* TranslateBubbleView::GetAlwaysTranslateCheckbox() {
  if (model_->GetViewState() == TranslateBubbleModel::VIEW_STATE_ADVANCED) {
    return advanced_always_translate_checkbox_;
  } else if (model_->GetViewState() ==
             TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE) {
    return before_always_translate_checkbox_;
  } else {
    NOTREACHED();
    return nullptr;
  }
}

void TranslateBubbleView::SwitchView(
    TranslateBubbleModel::ViewState view_state) {
  if (model_->GetViewState() == view_state)
    return;

  model_->SetViewState(view_state);
  UpdateChildVisibilities();
  if (view_state == TranslateBubbleModel::VIEW_STATE_ADVANCED)
    UpdateAdvancedView();
  SizeToContents();
}

void TranslateBubbleView::SwitchToErrorView(
    translate::TranslateErrors::Type error_type) {
  SwitchView(TranslateBubbleModel::VIEW_STATE_ERROR);
  error_type_ = error_type;
  model_->ShowError(error_type);
}

void TranslateBubbleView::UpdateAdvancedView() {
  DCHECK(source_language_combobox_);
  DCHECK(target_language_combobox_);
  DCHECK(advanced_done_button_);

  base::string16 source_language_name =
      model_->GetLanguageNameAt(model_->GetOriginalLanguageIndex());
  base::string16 target_language_name =
      model_->GetLanguageNameAt(model_->GetTargetLanguageIndex());

  // "Always translate" checkbox doesn't exist in an incognito window.
  if (advanced_always_translate_checkbox_) {
    advanced_always_translate_checkbox_->SetText(
        l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ALWAYS));
  }

  base::string16 label;
  if (model_->IsPageTranslatedInCurrentLanguages())
    label = l10n_util::GetStringUTF16(IDS_DONE);
  else
    label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT);
  advanced_done_button_->SetText(label);
  advanced_done_button_->SizeToPreferredSize();
  if (advanced_view_)
    advanced_view_->Layout();
}


text:
package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation;

import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.cosmosdb.v2019_12_12.Percentiles;
import rx.functions.Func1;
import rx.Observable;
import java.util.List;
import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileMetric;

class PercentilesImpl extends WrapperImpl<PercentilesInner> implements Percentiles {
    private final CosmosDBManager manager;

    PercentilesImpl(CosmosDBManager manager) {
        super(manager.inner().percentiles());
        this.manager = manager;
    }

    public CosmosDBManager manager() {
        return this.manager;
    }

    @Override
    public Observable<PercentileMetric> listMetricsAsync(String resourceGroupName, String accountName, String filter) {
        PercentilesInner client = this.inner();
        return client.listMetricsAsync(resourceGroupName, accountName, filter)
        .flatMap(new Func1<List<PercentileMetricInner>, Observable<PercentileMetricInner>>() {
            @Override
            public Observable<PercentileMetricInner> call(List<PercentileMetricInner> innerList) {
                return Observable.from(innerList);
            }
        })
        .map(new Func1<PercentileMetricInner, PercentileMetric>() {
            @Override
            public PercentileMetric call(PercentileMetricInner inner) {
                return new PercentileMetricImpl(inner, manager());
            }
        });
    }

}


text:
IC CAgentManagerPropertyEvaluatorItem::CAgentManagerPropertyEvaluatorItem(CAgentManager* object,
                                                                          LPCSTR evaluator_name)
    : inherited(object, evaluator_name) {}

IC CAgentManagerPropertyEvaluatorEnemy::CAgentManagerPropertyEvaluatorEnemy(CAgentManager* object,
                                                                            LPCSTR evaluator_name)
    : inherited(object, evaluator_name) {}

IC CAgentManagerPropertyEvaluatorDanger::CAgentManagerPropertyEvaluatorDanger(CAgentManager* object,
                                                                              LPCSTR evaluator_name)
    : inherited(object, evaluator_name) {}


text:
function BxDolVote(options)
{
	this._sObjName = undefined == options.sObjName ? 'oVote' : options.sObjName; // javascript object name, to run current object instance from onTimer
	this._sSystem = options.sSystem; // current comment system
	this._iAuthorId = options.iAuthorId; // this comment's author ID.
    this._iObjId = options.iObjId; // this object id comments
    this._iLikeMode = undefined == options.iLikeMode ? 0 : options.iLikeMode;

    this._sActionsUri = 'vote.php';
    this._sActionsUrl = options.sRootUrl + this._sActionsUri; // actions url address

    this._sAnimationEffect = 'fade';
    this._iAnimationSpeed = 'slow';
    this._sSP = undefined == options.sStylePrefix ? 'bx-vote' : options.sStylePrefix;
    this._aHtmlIds = options.aHtmlIds;

    this._iSaveWidth = -1;

    //--- Init stars based vote ---//
    var $this = this;
    if(!this._iLikeMode) {
    	$('.' + this._sSP + '.' + this._sSP + '-stars').each(function() {
    		var oDoVote = $(this);
	    	var fRate = oDoVote.attr('bx_vote_data_rate');
	    	var iStarWidth = $this._getStarWidthDo(oDoVote);

	    	$this._getSliderDo(oDoVote).width(Math.round(fRate * iStarWidth));
    	});

    	$('.' + this._sSP + '-legend.' + this._sSP + '-legend-stars').each(function() {
    		var oLegend = $(this);
    		var iStarWidth = $this._getStarWidthLegend(oLegend);

	    	oLegend.find('.' + $this._sSP + '-legend-item').each(function() {
	    		var oItem = $(this);

	    		oItem.find('.' + $this._sSP + '-slider').width(parseInt(oItem.attr('bx_vote_item_value')) * iStarWidth);
	    	});
    	});
    }
}

BxDolVote.prototype.toggleByPopup = function(oLink) {
	var $this = this;
    var oData = this._getDefaultParams();
    oData['action'] = 'GetVotedBy';

	$(oLink).dolPopupAjax({
		id: this._aHtmlIds['by_popup'],
		url: bx_append_url_params(this._sActionsUri, oData)
	});
};

BxDolVote.prototype.over = function (oLink)
{
	var oSlider = this._getSliderDo(oLink);
	var iIndex = this._getButtons(oLink).index(oLink);

    this._iSaveWidth = parseInt(oSlider.width());
    oSlider.width((iIndex + 1) * this._getStarWidthDo(oLink));
};

BxDolVote.prototype.out = function (oLink)
{
	var oSlider = this._getSliderDo(oLink);

	oSlider.width(this._iSaveWidth);
};

BxDolVote.prototype.vote = function (oLink, iValue)
{
    var $this = this;
    var oParams = this._getDefaultParams();
    oParams['action'] = 'Vote';
    oParams['value'] = iValue;

    $.post(
    	this._sActionsUrl,
    	oParams,
    	function(oData) {
    		if(oData && oData.msg != undefined)
                alert(oData.msg);

    		if(oData && oData.code != 0)
                return;

    		if($this._iLikeMode) {
	    		if(oData && oData.label_icon)
	    			$(oLink).find('.sys-icon').attr('class', 'sys-icon ' + oData.label_icon);

	    		if(oData && oData.label_title) {
	    			$(oLink).attr('title', oData.label_title);
	    			$(oLink).find('span').html(oData.label_title);
	    		}

	    		if(oData && oData.disabled)
	    			$(oLink).removeAttr('onclick').addClass($(oLink).hasClass('bx-btn') ? 'bx-btn-disabled' : 'bx-vote-disabled');
    		}

    		if(!$this._iLikeMode)
    			$this._iSaveWidth = Math.round(oData.rate * $this._getStarWidthDo(oLink));

            var oCounter = $this._getCounter(oLink);
            if(oCounter && oCounter.length > 0) {
            	oCounter.html(oData.countf);

            	oCounter.parents('.' + $this._sSP + '-counter-holder:first').bx_anim(oData.count > 0 ? 'show' : 'hide');
            }
        },
        'json'
    );
};

BxDolVote.prototype._getButtons = function(oElement) {
	if($(oElement).hasClass(this._sSP))
		return $(oElement).find('.' + this._sSP + '-button');
	else
		return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-button');
};

BxDolVote.prototype._getSliderDo = function(oElement) {
	return this._getSlider(oElement, '.' + this._sSP + '-do');
};
BxDolVote.prototype._getSliderLegend = function(oElement) {
	return this._getSlider(oElement, '.' + this._sSP + '-legend');
};
BxDolVote.prototype._getSlider = function(oElement, sParent) {
	var sSlider = (sParent.length > 0 ? sParent + ' ' : '') + '.' + this._sSP + '-slider';
	if($(oElement).hasClass(this._sSP))
		return $(oElement).find(sSlider);
	else
		return $(oElement).parents('.' + this._sSP + ':first').find(sSlider);
};

BxDolVote.prototype._getStarWidthDo = function(oElement) {
	return this._getSliderDo(oElement).find('.sys-icon').width();
};
BxDolVote.prototype._getStarWidthLegend = function(oElement) {
	return this._getSliderLegend(oElement).find('.sys-icon').width();
};

BxDolVote.prototype._getCounter = function(oElement) {
	if($(oElement).hasClass(this._sSP))
		return $(oElement).find('.' + this._sSP + '-counter');
	else
		return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-counter');
};

BxDolVote.prototype._loadingInButton = function(e, bShow) {
	if($(e).length)
		bx_loading_btn($(e), bShow);
	else
		bx_loading($('body'), bShow);
};

BxDolVote.prototype._getDefaultParams = function() {
	var oDate = new Date();
    return {
        sys: this._sSystem,
        id: this._iObjId,
        _t: oDate.getTime()
    };
};

/** @} */


text:
import json
from .default import DefaultParser
from .author_names import AuthorNames

class ADSFeedbackParser(DefaultParser):

    def __init__(self,json_string):
        self.data = json.loads(json_string)

    def parse(self,**kwargs):
        output_metadata = dict()

        simple_fields = ['bibcode','abstract','publication','title','authors','comments','keywords','references']

        for field in simple_fields:
            try:
                output_metadata[field] = self.data[field]
            except Exception as err:
                pass

        # Other fields....

        # Pubdate
        try:
           output_metadata['pubdate'] = self.data['publicationDate']
        except Exception as err:
           pass

        # Collection/database:
        try:
            collections = self.data['collection']
            database = list()
            for col in collections:
                if col == 'astronomy':
                    database.append('AST')
                elif col == 'physics':
                    database.append('PHY')
            if database:
                output_metadata['database'] = database
        except Exception as err:
            pass

        # Affiliation and ORCID fields
        try:
            affil_list = self.data['affiliation']
        except Exception as err:
            affil_list = list()
        try:
            orcid_list = self.data['orcid']
        except Exception as err:
            orcid_list = list()

        try:
            n_affil = len(affil_list)
            n_orcid = len(orcid_list)
            n_auth = len(output_metadata['authors'])

            if n_affil == n_auth:
                if n_orcid == n_affil:
                    new_affils = list()
                    for (affil,orcid) in zip(affil_list,orcid_list):
                        if orcid:
                            affil = affil + ' <id system="ORCID">' + orcid + '</id>'
                        new_affils.append(affil)
                    affil_list = new_affils

                output_metadata['affiliations'] = affil_list
            else:
                # send a warning to logger when logging is implemented
                pass
        except Exception as err:
            pass

        # Properties / URLs
        url_types = ['pdf','other','doi','html','arxiv']
        properties = {}
        try:
            url_data = self.data['urls']
            for url in url_data:
                (utype,link) = url.split()
                utype = utype.strip('(').strip(')').upper()
                properties[utype] = link
            if properties:
                output_metadata['properties'] = properties
        except Exception as err:
            pass

        # Fix names
        old_names = output_metadata['authors']
        authparse = AuthorNames()
        new_names = [authparse.parse(name) for name in old_names]
        output_metadata['authors'] = new_names

        return output_metadata


text:
/**
 * IncludeAdultContentSearchParameter.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.adwords.axis.v201406.o;

/**
 * {@link SearchParameter} that specifies whether adult content should
 * be
 *             returned.

 *
 *             Presence of this {@link SearchParameter} will allow adult
 * keywords
 *             to be included in the results.
 *
This element is supported by following {@link IdeaType}s:
 * KEYWORD.
 *
This element is supported by following {@link RequestType}s:
 * IDEAS, STATS.
 */
public class IncludeAdultContentSearchParameter  extends com.google.api.ads.adwords.axis.v201406.o.SearchParameter  implements java.io.Serializable {
    public IncludeAdultContentSearchParameter() {
    }

    public IncludeAdultContentSearchParameter(
           java.lang.String searchParameterType) {
        super(
            searchParameterType);
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof IncludeAdultContentSearchParameter)) return false;
        IncludeAdultContentSearchParameter other = (IncludeAdultContentSearchParameter) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = super.equals(obj);
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = super.hashCode();
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(IncludeAdultContentSearchParameter.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/o/v201406", "IncludeAdultContentSearchParameter"));
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}


text:
package ajia.service.impl;

import ajia.domain.shipment.Tracking;
import ajia.service.EmailerService;

public class EmailerServiceImpl implements EmailerService {

	public void send(Tracking tracking) {

	}

}


text:
<!DOCTYPE html>

    <title>Tense Enum Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>

 Docs

View on GitHub

         Reference

        Tense Enum Reference

            Classes

                RelationshipExtraction

            Enums

                EntityClass

                EntityLevel

                MentionClass

                MentionType

                Modality

                RelatedMentionClass

                Tense

            Structs

                Document

                Entity

                Mention

                ReferencingMentions

                RelatedMentionArgument

                RelatedMentions

                Relation

                RelationEntityArgument

                Relations

                Sentence

                Token

Tense

public enum Tense: String

The time for which the relation mention holds.

                    past

The relation holds only for some span prior to the publication time.

Declaration

Swift

case past = "PAST"

                    present

A relation holds for a limited span that overlaps with the publication time.

Declaration

Swift

case present = "PRESENT"

                    future

A relation holds for some span of time after the publication time.

Declaration

Swift

case future = "FUTURE"

                    unspecified

The relation is static, or the span of time cannot be determined with certainty.

Declaration

Swift

case unspecified = "UNSPECIFIED"

© 2017 . All rights reserved. (Last updated: 2017-03-02)

Generated by jazzy ♪♫ v0.7.3, a Realm project.


text:
import Vue from 'vue';
import Vuex from 'vuex';
import createState from './state';
import * as actions from './actions';
import * as getters from './getters';
import mutations from './mutations';

Vue.use(Vuex);

export default () =>
  new Vuex.Store({
    state: createState(),
    actions,
    getters,
    mutations,
  });


text:
/**
 * NTwitBot - process.test.js
 * @author Jordan Sne <jordansne@gmail.com>
 * @license MIT
 */

const Process = require('../../src/process.js');
const Utils   = require('../../src/utils.js');

const processor = new Process();

const MOCK_TIME           =  201710302350;
const MOCK_TIME_FORMATTED = '10/30/2017 23:50:15';

describe('Process', () => {
    let getTimeMock, getFormattedTimeMock;

    beforeAll(() => {
        getTimeMock = jest.spyOn(Utils, 'getTime').mockReturnValue(MOCK_TIME);
        getFormattedTimeMock = jest.spyOn(Utils, 'getFormattedTime').mockReturnValue(MOCK_TIME_FORMATTED);
    });

    afterAll(() => {
        getTimeMock.mockRestore();
        getFormattedTimeMock.mockRestore();
    });

    it('should filter mentions and links from words', () => {
        const words = [ 'good', '@bad', 'http://bad.ca', 'good2' ];
        const filtered = processor.filterWords(words);

        expect(filtered).toEqual([ 'good', 'good2' ]);
    });

    it('should convert words to lowercase', () => {
        const words = [ 'Test', 'sentENCE.' ];
        processor.convertToLowercase(words);

        expect(words).toEqual([ 'test', 'sentence.' ]);
    });

    it('should capitalize sentences', () => {
        const words = [ 'test', 'one.', 'test', 'two!', 'test', 'three?', 'final' ];
        processor.capitalizeSentences(words);

        expect(words).toEqual([ 'Test', 'one.', 'Test', 'two!', 'Test', 'three?', 'Final' ]);
    });

    it('should append periods to the end of tweets', () => {
        const words = [ 'Test', 'sentence' ];
        processor.appendPeriod(words);

        expect(words).toEqual([ 'Test', 'sentence.' ]);
    });

    it('should add new keys in a data object', () => {
        const data = {};
        const words = [ 'Test', 'sentence', 'one.' ];

        processor.appendData(data, words);

        expect(data).toEqual({
            'Test sentence': [{ word: 'one.', time: MOCK_TIME }]
        });
    });

    it('should append to existing keys in a data object', () => {
        const data = { 'Test sentence': [{ word: 'one.', time: MOCK_TIME }] };
        const words = [ 'Test', 'sentence', 'two.' ];

        processor.appendData(data, words);

        expect(data).toEqual({
            'Test sentence': [{ word: 'one.', time: MOCK_TIME }, { word: 'two.', time: MOCK_TIME }]
        });
    });

    it('should convert raw tweets into a data object', () => {
        const tweets = [
            { text: 'test sentence one. tEst sentence two' },
            { text: 'Another sentence one.' }
        ];
        const data = processor.processTweets(tweets);

        expect(data).toEqual({
            'Test sentence': [{ word: 'one.', time: MOCK_TIME }, { word: 'two.', time: MOCK_TIME }],
            'sentence one.': [{ word: 'Test', time: MOCK_TIME }],
            'one. Test': [{ word: 'sentence', time: MOCK_TIME }],
            'Another sentence': [{ word: 'one.', time: MOCK_TIME }]
        });
    });
});


text:
(function($) {
	"use strict";
	/*
	 Created Component Using Factory Design pattern.
	 *
	 **/

	var htmlTemplate = '
' +
		'
' +
		'
' +
		'<input type="text" placeholder="Search Release" id="searchBox" />' +
		'' +
		'
' +
		'<select id="optionSelector" size="10" multiple="multiple" class="btn-group selectCookbooksandRecipes"></select>' +
		'
' +
		'
' +
		'<button id="btnaddToRunlist" type="button" class="btn cat-btn-update anchorAdd">' +
		'' +
		'' +
		'</button>' +
		'

' +
		'<button id="btnremoveFromRunlist" type="button" class="btn cat-btn-update anchorRemove">' +
		'' +
		'</button>' +
		'
' +
		'
' +
		'
' +
		'' +
		'
' +
		'<select id="selectorList" size="10" multiple="multiple" class="btn-group selectCookbooksandRecipes"></select>' +
		'
' +
		'
' +
		'<button id="btnRunlistItemUp" type="button" class="btn cat-btn-update anchorUp">' +
		'' +
		'</button>' +
		'

' +
		'<button id="btnRunlistItemDown" type="button" class="btn cat-btn-update anchorDown">' +
		'' +
		'</button>' +
		'
' +
		'
' +
		'
' +
		'
';

	//Utility Helper Methods
	var helper = {
		getExcludeList: function(list1, list2) {
			var p = [];
			var temp;
			var x = list1;
						var initialLength;
						temp = $.grep(list2, function(object, index) {
								initialLength = x.length;
				x = ($.grep(x, function(o) {
					return o.value === object.value && o.className === object.className;
				}, true));
				if (x.length < initialLength) {
					p.push(list2[index]);
				}
				return !x.length;
			});
			return {
				exclude: x, // exclude is the list of items remaining in the main list(array)
				update: p // update is the list of items on the right side. One's that have been selected by the user.
			};
		},
		getOptionList: function(list) {
			var str = [];
			for (var i = 0; i < list.length; i++) {
				str.push(
					$('<option></option>')
					.addClass(list[i].className)
					.attr('value', list[i].value)
					.text(list[i].value)
					.data('json', list[i].data)
				);
			}
			return str;
		},
		getOptionListForMainList: function(list) {
			var str = [];
			for (var i = 0; i < list.length; i++) {

				var o = $('<option></option>')
					.addClass(list[i].className)
					.attr('value', list[i].value)
					.text(list[i].value)
					.data('json', list[i].data);

				if (!list[i].isShow) {
					str.push(o.hide());
				} else {
					str.push(o);
				}

			}
			return str;
		},
		plainArraySorter: function(list) {
			list.sort(function(a, b) {
				return a.toLowerCase().localeCompare(b.toLowerCase());
			});
			return list;
		},
		objectArraySorter: function(list, prop, asc) {
			list = list.sort(function(a, b) {
				if (asc) {
					return (a[prop] > b[prop]) ? 1 : ((a[prop]  a[prop]) ? 1 : ((b[prop] < a[prop]) ? -1 : 0);
				}
			});
			return list;
		}
	};

	window.chefSelectorComponent = window.chefSelectorComponent || function(
		options) {
		var lastFilterClass = '';
		var defaultOptions = {
			scopeElement: "body", //parent element which restrict the dom search scope
			optionList: [{ //Json format it will have className,value and arbitrary key(data) which can contains anything
				className: "hi",
				value: "welcome",
				data: {}
			}],
			selectorList: [], //collections which will be available in the Left Side
			isSortList: false, //Sorting of the complete left selector list
			isSearchBoxEnable: true, //search box is enable or not
			isOverrideHtmlTemplate: true, //you can use your own html template or predefined html template available in the component
			isExcludeDataFromOption: false, //A case where you want to give raw list to left and seperate list to the right it will exclude them while showing in the dom
			idList: { //list of id's which will require when you are opting 'isOverrideHtmlTemplate' option
				selectorList: '#selectorList', //right select list id
				optionSelector: '#optionSelector', //left select list id
				upBtn: '#btnRunlistItemUp',
				downBtn: '#btnRunlistItemDown',
				addToSelector: '#btnaddToRunlist',
				removeFromSelector: '#btnremoveFromRunlist',
				searchBox: '#searchBox'
			},
			isPriorityEnable: true //opt this option if you want to enable priority buttons these can be hide by providing false values
		};
		var eventCallBackList = [];
		var opt = $.extend(defaultOptions, options);
		var $scopeElement = $(opt.scopeElement);
		if (!$scopeElement.length) {
			throw "Scope Element is not found";
		}
		if (opt.isOverrideHtmlTemplate) {
			$scopeElement.html(htmlTemplate);
		}
		if (opt.isExcludeDataFromOption) {
			var p = helper.getExcludeList(opt.optionList, opt.selectorList);
			opt.optionList = p.exclude;
			opt.selectorList = p.update;
		}
		var combineList = [];
		for (var i = 0; i < opt.optionList.length; i++) {
			opt.optionList[i].isShow = true;
			combineList.push(opt.optionList[i]);
		}
		for (i = 0; i < opt.selectorList.length; i++) {
			opt.selectorList[i].isShow = false;
			combineList.push(opt.selectorList[i]);
		}

		var $optionSelector = $scopeElement.find(opt.idList.optionSelector),
			$selectorList = $scopeElement.find(opt.idList.selectorList),
			$upBtn = $scopeElement.find(opt.idList.upBtn),
			$downBtn = $scopeElement.find(opt.idList.downBtn),
			$addToSelector = $scopeElement.find(opt.idList.addToSelector),
			$removeFromSelector = $scopeElement.find(opt.idList.removeFromSelector),
			$searchBox = $scopeElement.find(opt.idList.searchBox);

		if (options.isSortList) {
			opt.optionList = helper.objectArraySorter(combineList, "value", true);
			opt.selectorList = opt.selectorList;
		}

		function downBtnListener() {
			var obj = {};
			var itemsCount = $selectorList.find("option").length;
			$($selectorList.find("option:selected").get().reverse()).each(function() {
				var listItem = $(this);
				var listItemPosition = $selectorList.find("option").index(
					listItem) + 1;
				if (listItemPosition === itemsCount) {
					return false;
				}
				listItem.insertAfter(listItem.next());
				var currentList = [];
				$selectorList.find('option').each(function() {
					obj = {
						value: $(this).val(),
						className: $(this).attr('class')
					};
					currentList.push(obj);
				});
				var operationType = "down";
				broadCastRegisteredEvents(listItem, currentList, operationType);
			});
		}

		//Up selector
		function upBtnListener() {
			var obj = {};
			$selectorList.find("option:selected").each(function() {
				var listItem = $(this);
				var listItemPosition = $selectorList.find("option").index(listItem) + 1;
				if (listItemPosition === 1) {
					return false;
				}
				listItem.insertBefore(listItem.prev());
				var currentList = [];
				$selectorList.find('option').each(function() {
					obj = {
						value: $(this).val(),
						className: $(this).attr('class')
					};
					currentList.push(obj);
				});
				var operationType = "up";
				broadCastRegisteredEvents(listItem, currentList, operationType);
			});
		}

		//Add selected from optionList to SelectorList
		function addDblClickListener() {
			var currentList = [];
			var currentValue = [];
			$selectorList.find('option').each(function() {
				var obj = {
					value: $(this).val(),
					className: $(this).attr('class')
				};
				currentList.push(obj);
			});
			var $this = $(event.target);
			var obj = {
				value: $this.val(),
				className: $this.attr('class')
			};
			var duplicateCheck = false;
			if(currentList.length === 0){
				duplicateCheck = false;
			}else{
				for(var i = 0; i < currentList.length; i++){
					if(currentList[i].value === obj.value && currentList[i].className === obj.className){
						duplicateCheck = true;
					}
				}
			}
			if(duplicateCheck === false){
				$selectorList.append($this.clone().data('json', $this.data(
					'json')));
			}
			$this.hide();
			currentValue.push(obj);
			var operationType = "add";

			broadCastRegisteredEvents(currentValue, currentList, operationType);
		}

		//Remove Selected from SelectorList
		function removeDblClickListener() {
			var $this = $(event.target),
				value = $this.val(),
				classlist = $this[0].classList.toString(),
				obj = {};
			$this.remove();
			triggerSearchManually();
			$optionSelector.find('option[value="' + value + '"]').each(function() {
				if ($(this).hasClass(classlist)) {
					// findList.push(this);
					$(this).show();
				}
			});
			var currentValue = [{
				value: $this.val(),
				className: $this.attr('class')
			}];
			var currentList = [];
			$selectorList.find('option').each(function() {
				obj = {
					value: $(this).val(),
					className: $(this).attr('class')
				};
				currentList.push(obj);
			});
			var operationType = "remove";

			broadCastRegisteredEvents(currentValue, currentList, operationType);
		}

		//Add Button Listener
		function addBtnListener() {
			var $options = $optionSelector.find('option:selected');
			var currentValue = [];
			var currentList = [];
			var obj = {};
			$selectorList.find('option').each(function() {
				obj = {
					value: $(this).val(),
					className: $(this).attr('class')
				};
				currentList.push(obj);
			});
			$options.each(function() {
				var $this = $(this);
				obj = {
					value: $this.val(),
					className: $this.attr('class')
				};
				var duplicateCheck = false;
				if(currentList.length === 0){
					duplicateCheck = false;
				}else{
					for(var i = 0; i < currentList.length; i++){
						if(currentList[i].value === obj.value && currentList[i].className === obj.className){
							duplicateCheck = true;
						}
					}
				}
				if(duplicateCheck === false){
					$selectorList.append($this.clone().data('json', $this.data(
						'json')));
				}
				$this.hide();
				currentValue.push(obj);
			});
			var operationType = "add";
			broadCastRegisteredEvents(currentValue, currentList, operationType);
		}

		//Remove Button Listener
		function removeBtnListener() {
			var currentValue = [],
				obj = {};
			$selectorList.find("option:selected").each(function() {
				var $this = $(this);
				var value = $this.val();
				$this.remove();
				var classlist = $this[0].classList.toString();
				triggerSearchManually();
				$optionSelector.find('option[value="' + value + '"]').each(function() {
					if ($(this).hasClass(classlist)) {
						$(this).show();
					}
				});
				obj = {
					value: $this.val(),
					className: $this.attr('class')
				};
				currentValue.push(obj);
			});

			var currentList = [];
			$selectorList.find('option').each(function() {
				obj = {
					value: $(this).val(),
					className: $(this).attr('class')
				};
				currentList.push(obj);
			});
			var operationType = "remove";
			broadCastRegisteredEvents(currentValue, currentList, operationType);
		}

		function registerListener() {
			$optionSelector.on('dblclick', 'option', addDblClickListener);
			$selectorList.on('dblclick', 'option', removeDblClickListener);
			$addToSelector.on('click', addBtnListener);
			$removeFromSelector.on('click', removeBtnListener);
			$upBtn.on('click', upBtnListener);
			$downBtn.on('click', downBtnListener);
		}

		function applySearchBox() {
			$optionSelector.filterByText($searchBox, false);
		}

		function populateDataInList() {
			$optionSelector.html(helper.getOptionListForMainList(combineList));
			$selectorList.html(helper.getOptionList(opt.selectorList));
		}

		function triggerSearchManually() {
			searchComputing($optionSelector, $searchBox.val());
		}

		function searchComputing(select, value) {
			var options = $(select).empty().data('options');
			var search = value.trim();
			var regex = new RegExp(search, "gi");
			var l = options.length;
			var o, temp;
			var finalList = [];

			for (var i = 0; i < l; i++) {
				o = options[i];
				temp = $('<option>').text(o.text)
					.val(
						o.value).addClass(o.class).data(
						'json', o.json);
				//match found in the dom
				if (o.text.match(regex) !== null && o.class.indexOf(lastFilterClass) !== -1) {
					//checking whether that is available in the selected list
					var matchAvailable = $selectorList.find('option[value="' + o.value + '"]').is('.' + o.class);
					if (matchAvailable) {
						temp.hide();
					} else {
						temp.show();
					}
				} else {
					temp.hide();
				}
				finalList.push(temp);
			}
			$(select).append(finalList);
		}

		function init() {
			populateDataInList();
			registerListener();

			if (opt.isSearchBoxEnable) {
				if ($searchBox.length) {
					appendSearchInJquery();
					applySearchBox();
				} else {
					throw "Search box is not avialble in DOM";
				}

			} else {
				appendSearchInJquery();
				applySearchBox();
				$searchBox.hide();
			}

			if (!opt.isPriorityEnable) {
				$upBtn.hide();
				$downBtn.hide();
			}
		}

		function appendSearchInJquery() {
			//Filter the Roles/Cookbooks
			$.fn.filterByText = function(textbox) {
				return this.each(function() {
					var select = this;
					var options = [];
					$(select).find('option').each(function() {
						options.push({
							value: $(this).val(),
							text: $(this).text(),
							class: $(this).attr("class"),
							json: $(this).data('json')
						});
					});

					$(select).data('options', options);
					$(textbox).bind('change keyup', function() {
						searchComputing(select, $(this).val());
					});
				});
			};
		}

		function broadCastRegisteredEvents(currentValue, currentList, operationType) {
			var l = eventCallBackList.length;
			for (var i = 0; i < l; i++) {
				eventCallBackList[i].callback(currentValue, currentList, operationType);
			}
			console.log(currentValue + " :: " + currentList.toString() + " :: " + operationType);
		}

		function resetSearch() {
			$searchBox.val('');
		}
		init();

		//api's methods

		//get list of elements which is available right side
		this.getSelectorList = function() {
			var t = [];
			$selectorList.find('option').each(function() {
				t.push({
					value: this.value,
					className: this.classList.toString(),
					data: $(this).data('json')
				});
			});
			return t;
		};

		//get list of elements which is available left side
		this.getOptionList = function() {
			var t = [];
			$optionSelector.find('option:visible').each(function() {
				t.push({
					value: this.value,
					className: this.classList.toString(),
					data: $(this).data('json')
				});
			});
			return t;
		};

		//filter the left list through class
		this.applyFilterThroughClass = function(className) {
			this.resetFilters();
			$optionSelector.children().not('.' + className).each(function() {
				if (!$selectorList.find('option[value="' + this.value + '"]').length) {
					$(this).hide();
				}
			});
			lastFilterClass = className;
		};

		//reset all filters
		this.resetFilters = function() {
			resetSearch();
			$optionSelector.find('option').each(function() {
				if (!$selectorList.find('option[value="' + this.value + '"]').length) {
					$(this).show();
				}
			});
			lastFilterClass = '';
		};

		//register any custom event which will trigger when any update in the right list will happen
		this.addListUpdateListener = function(eventName, callback) {
			var uniqueIdentifier = (new Date()).getTime();
			callback.unique = uniqueIdentifier;
			eventCallBackList.push({
				eventName: eventName,
				callback: callback,
				unique: uniqueIdentifier
			});
		};

		//remove the custom event listener
		this.removeListUpdateListener = function(eventName, callback) {
			var l = eventCallBackList.length;
			var temp = [];
			var t;
			for (var i = 0; i < l; i++) {
				t = eventCallBackList[i];
				if (callback) {
					if (!(callback.unique === t.unique && eventName === t.eventName)) {
						//element deleted
						temp.push(t);
					}
				} else {
					if (eventName !== t.eventName) {
						temp.push(t);
					}
				}
			}
			eventCallBackList = temp;
		};
	};
})(jQuery);


text:
package auth

import (
	"encoding/base64"
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/Xuyuanp/hador"
	"github.com/smartystreets/goconvey/convey"
)

var (
	username = "foo"
	password = "bar"
)

func TestBasic(t *testing.T) {
	convey.Convey("Test Auth", t, func() {

		h := hador.New()
		h.AddFilters(
			Filter(Basic(username, password)),
		)

		h.Get("/test", hador.HandlerFunc(func(ctx *hador.Context) {
			ctx.Response.Write([]byte("OK"))
		}))

		convey.Convey("no Authorization", func() {
			req, _ := http.NewRequest("GET", "/test", nil)
			resp := httptest.NewRecorder()

			h.ServeHTTP(resp, req)

			convey.So(resp.Code, convey.ShouldEqual, http.StatusUnauthorized)
		})

		convey.Convey("Authorization", func() {
			req, _ := http.NewRequest("GET", "/test", nil)
			auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(username+":"+password))
			req.Header.Set("Authorization", auth)
			resp := httptest.NewRecorder()

			h.ServeHTTP(resp, req)

			convey.So(resp.Code, convey.ShouldEqual, http.StatusOK)
			convey.So(resp.Body.String(), convey.ShouldEqual, "OK")
		})
	})
}


text:
namespace OpenXMLSDK.Engine.Word.ReportEngine.Models
{
    public class ForEachPage : Page
    {
        /// <summary>
        /// Define the prefix that will be used for automatically added items
        /// IsFirstItem, ...
        /// </summary>
        public string AutoContextAddItemsPrefix { get; set; }

        public string DataSourceKey { get; set; }

        /// <summary>
        /// Constructor
        /// </summary>
        public ForEachPage()
            : base(typeof(ForEachPage).Name)
        {
        }
    }
}


text:
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('account', '0014_auto_20170421_1011'),
    ]

    operations = [
        migrations.AddField(
            model_name='user',
            name='following',
            field=models.ManyToManyField(related_name='followed', related_query_name='followed', to=settings.AUTH_USER_MODEL),
        ),
    ]


text:
package generator.standard.field_types.boxed_primitives;

import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import gsonpath.annotation.GsonPathGenerated;
import gsonpath.internal.GsonPathTypeAdapter;
import gsonpath.internal.GsonUtil;
import gsonpath.internal.JsonReaderHelper;

import java.io.IOException;
import java.lang.Boolean;
import java.lang.Byte;
import java.lang.Character;
import java.lang.Double;
import java.lang.Float;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Override;
import java.lang.Short;
import java.lang.String;

@GsonPathGenerated
public final class TestBoxedPrimitives_GsonTypeAdapter extends GsonPathTypeAdapter<TestBoxedPrimitives> {
    public TestBoxedPrimitives_GsonTypeAdapter(Gson gson) {
        super(gson);
    }

    @Override
    public TestBoxedPrimitives readImpl(JsonReader in) throws IOException {
        TestBoxedPrimitives result = new TestBoxedPrimitives();
        JsonReaderHelper jsonReaderHelper = new JsonReaderHelper(in, 1, 0);

        while (jsonReaderHelper.handleObject(0, 9)) {
            switch (in.nextName()) {
                case "value1":
                    String value_value1 = gson.getAdapter(String.class).read(in);
                    if (value_value1 != null) {
                        result.value1 = value_value1;
                    }
                    break;

                case "value2":
                    Boolean value_value2 = gson.getAdapter(Boolean.class).read(in);
                    if (value_value2 != null) {
                        result.value2 = value_value2;
                    }
                    break;

                case "value3":
                    Integer value_value3 = gson.getAdapter(Integer.class).read(in);
                    if (value_value3 != null) {
                        result.value3 = value_value3;
                    }
                    break;

                case "value4":
                    Double value_value4 = gson.getAdapter(Double.class).read(in);
                    if (value_value4 != null) {
                        result.value4 = value_value4;
                    }
                    break;

                case "value5":
                    Long value_value5 = gson.getAdapter(Long.class).read(in);
                    if (value_value5 != null) {
                        result.value5 = value_value5;
                    }
                    break;

                case "value6":
                    Byte value_value6 = gson.getAdapter(Byte.class).read(in);
                    if (value_value6 != null) {
                        result.value6 = value_value6;
                    }
                    break;

                case "value7":
                    Short value_value7 = gson.getAdapter(Short.class).read(in);
                    if (value_value7 != null) {
                        result.value7 = value_value7;
                    }
                    break;

                case "value8":
                    Float value_value8 = gson.getAdapter(Float.class).read(in);
                    if (value_value8 != null) {
                        result.value8 = value_value8;
                    }
                    break;

                case "value9":
                    Character value_value9 = gson.getAdapter(Character.class).read(in);
                    if (value_value9 != null) {
                        result.value9 = value_value9;
                    }
                    break;

                default:
                    jsonReaderHelper.onObjectFieldNotFound(0);
                    break;

            }
        }
        return result;
    }

    @Override
    public void writeImpl(JsonWriter out, TestBoxedPrimitives value) throws IOException {
        // Begin
        out.beginObject();
        String obj0 = value.value1;
        if (obj0 != null) {
            out.name("value1");
            GsonUtil.writeWithGenericAdapter(gson, obj0.getClass(), out, obj0);
        }

        Boolean obj1 = value.value2;
        if (obj1 != null) {
            out.name("value2");
            GsonUtil.writeWithGenericAdapter(gson, obj1.getClass(), out, obj1);
        }

        Integer obj2 = value.value3;
        if (obj2 != null) {
            out.name("value3");
            GsonUtil.writeWithGenericAdapter(gson, obj2.getClass(), out, obj2);
        }

        Double obj3 = value.value4;
        if (obj3 != null) {
            out.name("value4");
            GsonUtil.writeWithGenericAdapter(gson, obj3.getClass(), out, obj3);
        }

        Long obj4 = value.value5;
        if (obj4 != null) {
            out.name("value5");
            GsonUtil.writeWithGenericAdapter(gson, obj4.getClass(), out, obj4);
        }

        Byte obj5 = value.value6;
        if (obj5 != null) {
            out.name("value6");
            GsonUtil.writeWithGenericAdapter(gson, obj5.getClass(), out, obj5);
        }

        Short obj6 = value.value7;
        if (obj6 != null) {
            out.name("value7");
            GsonUtil.writeWithGenericAdapter(gson, obj6.getClass(), out, obj6);
        }

        Float obj7 = value.value8;
        if (obj7 != null) {
            out.name("value8");
            GsonUtil.writeWithGenericAdapter(gson, obj7.getClass(), out, obj7);
        }

        Character obj8 = value.value9;
        if (obj8 != null) {
            out.name("value9");
            GsonUtil.writeWithGenericAdapter(gson, obj8.getClass(), out, obj8);
        }

        // End
        out.endObject();
    }
}


text:
/******************************************************************************
 *
 * Name: acwin64.h - OS specific defines, etc.
 *
 *****************************************************************************/

/******************************************************************************
 *
 * 1. Copyright Notice
 *
 * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp.
 * All rights reserved.
 *
 * 2. License
 *
 * 2.1. This is your license from Intel Corp. under its intellectual property
 * rights. You may have additional license terms from the party that provided
 * you this software, covering your right to use that party's intellectual
 * property rights.
 *
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
 * copy of the source code appearing in this file ("Covered Code") an
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
 * base code distributed originally by Intel ("Original Intel Code") to copy,
 * make derivatives, distribute, use and display any portion of the Covered
 * Code in any form, with the right to sublicense such rights; and
 *
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
 * license (with the right to sublicense), under only those claims of Intel
 * patents that are infringed by the Original Intel Code, to make, use, sell,
 * offer to sell, and import the Covered Code and derivative works thereof
 * solely to the minimum extent necessary to exercise the above copyright
 * license, and in no event shall the patent license extend to any additions
 * to or modifications of the Original Intel Code. No other license or right
 * is granted directly or by implication, estoppel or otherwise;
 *
 * The above copyright and patent license is granted only if the following
 * conditions are met:
 *
 * 3. Conditions
 *
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification with rights to further distribute source must include
 * the above Copyright Notice, the above License, this list of Conditions,
 * and the following Disclaimer and Export Compliance provision. In addition,
 * Licensee must cause all Covered Code to which Licensee contributes to
 * contain a file documenting the changes Licensee made to create that Covered
 * Code and the date of any change. Licensee must include in that file the
 * documentation of any changes made by any predecessor Licensee. Licensee
 * must include a prominent statement that the modification is derived,
 * directly or indirectly, from Original Intel Code.
 *
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification without rights to further distribute source must
 * include the following Disclaimer and Export Compliance provision in the
 * documentation and/or other materials provided with distribution. In
 * addition, Licensee may not authorize further sublicense of source of any
 * portion of the Covered Code, and must include terms to the effect that the
 * license from Licensee to its licensee is limited to the intellectual
 * property embodied in the software Licensee provides to its licensee, and
 * not to intellectual property embodied in modifications its licensee may
 * make.
 *
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
 * substantial portion of the Covered Code or modification must reproduce the
 * above Copyright Notice, and the following Disclaimer and Export Compliance
 * provision in the documentation and/or other materials provided with the
 * distribution.
 *
 * 3.4. Intel retains all right, title, and interest in and to the Original
 * Intel Code.
 *
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
 * Intel shall be used in advertising or otherwise to promote the sale, use or
 * other dealings in products derived from or relating to the Covered Code
 * without prior written authorization from Intel.
 *
 * 4. Disclaimer and Export Compliance
 *
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE.
 *
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
 * LIMITED REMEDY.
 *
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
 * software or system incorporating such software without first obtaining any
 * required license or other approval from the U. S. Department of Commerce or
 * any other agency or department of the United States Government. In the
 * event Licensee exports any such software from the United States or
 * re-exports any such software from a foreign destination, Licensee shall
 * ensure that the distribution and export/re-export of the software is in
 * compliance with all laws, regulations, orders, or other restrictions of the
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
 * any of its subsidiaries will export/re-export any technical data, process,
 * software, or service, directly or indirectly, to any country for which the
 * United States government or any agency thereof requires an export license,
 * other governmental approval, or letter of assurance, without first obtaining
 * such license, approval or letter.
 *
 *****************************************************************************
 *
 * Alternatively, you may choose to be licensed under the terms of the
 * following license:
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Alternatively, you may choose to be licensed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 *****************************************************************************/

#ifndef __ACWIN64_H__
#define __ACWIN64_H__

#define ACPI_USE_STANDARD_HEADERS
#define ACPI_USE_SYSTEM_CLIBRARY

 /* Note: do not include any C library headers here */

 /*
 * Note: MSVC project files should define ACPI_DEBUGGER and ACPI_DISASSEMBLER
 * as appropriate to enable editor functions like "Find all references".
 * The editor isn't smart enough to dig through the include files to find
 * out if these are actually defined.
 */

 /* Eliminate warnings for "old" (non-secure) versions of clib functions */

#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif

/* Eliminate warnings for POSIX clib function names (open, write, etc.) */

#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#endif

#define ACPI_MACHINE_WIDTH          64

/*
 * Map low I/O functions for MS. This allows us to disable MS language
 * extensions for maximum portability.
 */
#define open            _open
#define read            _read
#define write           _write
#define close           _close
#define stat            _stat
#define fstat           _fstat
#define mkdir           _mkdir
#define snprintf        _snprintf
#if _MSC_VER <= 1200 /* Versions below VC++ 6 */
#define vsnprintf       _vsnprintf
#endif
#define O_RDONLY        _O_RDONLY
#define O_BINARY        _O_BINARY
#define O_CREAT         _O_CREAT
#define O_WRONLY        _O_WRONLY
#define O_TRUNC         _O_TRUNC
#define S_IREAD         _S_IREAD
#define S_IWRITE        _S_IWRITE
#define S_IFDIR         _S_IFDIR

/*
 * Handle platform- and compiler-specific assembly language differences.
 *
 * Notes:
 * 1) Interrupt 3 is used to break into a debugger
 * 2) Interrupts are turned off during ACPI register setup
 */

/*! [Begin] no source code translation  */

#define ACPI_FLUSH_CPU_CACHE()

/*
 * For Acpi applications, we don't want to try to access the global lock
 */
#ifdef ACPI_APPLICATION
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)       if (AcpiGbl_GlobalLockPresent) {Acq = 0xFF;} else {Acq = 0;}
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd)       if (AcpiGbl_GlobalLockPresent) {Pnd = 0xFF;} else {Pnd = 0;}
#else

#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)

#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd)

#endif

/*! [End] no source code translation !*/

#endif /* __ACWIN_H__ */


text:
var React = require('react-native');
var {
  View,
  Text,
  Image,
  Switch,
  PixelRatio,
  StyleSheet,
  TouchableHighlight
} = React;

var GiftedListView = require('react-native-gifted-listview');

var List1 = React.createClass({

  _renderRowView: function(rowData) {
    var row = rowData;

    return (
      <TouchableHighlight
        underlayColor='#c8c7cc'
        style={{margin:10}}
      >
        <View>
          <View style={ styles.row } >
            <View style={ styles.textContainer }>
              <Text style={ styles.name } numberOfLines={ 1 }>
                { row.location }
              </Text>
              <Text style={ styles.tag } numberOfLines={ 1 }>
                { row.tag }
              </Text>
            </View>
          </View>
          <View style={ styles.cellBorder } />
        </View>
      </TouchableHighlight>
    );
  },
  _onFetch: function(page = 1, callback, options) {
    var rows = [{'location':'Toyko', 'tag':'#123 #456' }];
    callback(rows);
  },

  render: function() {
    return (
      <View>
        <GiftedListView
          rowView={this._renderRowView}
          onFetch={this._onFetch}
          firstLoader={true} // display a loader for the first fetching
          pagination={false} // enable infinite scrolling using touch to load more
          refreshable={true} // enable pull-to-refresh for iOS and touch-to-refresh for Android
          withSections={false} // enable sections
          customStyles={{
            refreshableView: {
              backgroundColor: '#eee',
            },
          }}
          emptyView={this._renderEmptyView}
          PullToRefreshViewAndroidProps={{
            colors: ['#ff0000', '#00ff00', '#0000ff'],
            progressBackgroundColor: '#c8c7cc',
          }}
        />
      </View>
    );
  },

});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#FFF',
    marginTop: 64,
  },
  navBar: {
    height: 64,
    backgroundColor: '#f8f8f8'
  },
  row: {
    flex: 1,
    alignItems: 'flex-start',
    backgroundColor: '#f2f2f2',
    flexDirection: 'row',
    height: 80,
    padding: 10
  },
  textContainer: {
    flex: 1
  },
  countWrapB: {
    position: 'absolute',
    top: 40,
    right: 0,
    flexDirection: 'row',
  },
  labelWrap: {
    color: '#999999'
  },
  name: {
    flex: 1,
    fontSize: 16,
    fontWeight: 'bold',
    marginBottom: 2
  },
  tag: {
    marginTop:20,
    color: '#999999',
    fontSize: 12,
  },
  cellBorder: {
    backgroundColor: 'rgba(0, 0, 0, 0.1)',
    height: 1 / PixelRatio.get(),
    marginLeft: 4
  },
  itemWrapper: {
    height: 40,
    margin: 10,
    flexDirection:'row',
    justifyContent: 'center',
    alignItems: 'center',
    alignSelf: 'stretch',
  },
  itemValueWrapperR: {
    flex: 8,
    alignSelf: 'center',
    alignItems: 'flex-end',
    padding: 5
  },
  countB: {
    color: 'green',
    fontSize: 13,
    width: 30,
    textAlign : 'right',
  },
  actionButtonIcon: {
    fontSize: 20,
    height: 22,
    color: 'white',
  },
  tabItemOn: {
    flex: 1,
    underlayColor: '#c8c7cc',
    justifyContent: 'center',
    alignItems: 'center',
    alignSelf: 'stretch',
    borderColor: '#455469',
    borderWidth: 1,
    backgroundColor: '#455469',
    padding: 20,
    color: 'white'
  },
  tabItemOff: {
    flex: 1,
    underlayColor: '#c8c7cc',
    justifyContent: 'center',
    alignItems: 'center',
    alignSelf: 'stretch',
    borderColor: '#455469',
    borderWidth: 1,
    backgroundColor: 'white',
    padding: 20,
    color: '#455469'
  },
  tabTitle:{
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    alignSelf: 'center',
    textAlign: 'center'
  }
});

module.exports = List1;