text:
<?php

class Storymarket_Content_PhotoManager extends Storymarket_Content_BinaryContentManager {
}


text:
/** @externs */

/** @typedef {{
 * styleElement: function(!HTMLElement),
 * styleSubtree: function(!HTMLElement, Object<string, string>=),
 * prepareTemplate: function(!HTMLTemplateElement, string, string=),
 * prepareTemplateStyles: function(!HTMLTemplateElement, string, string=),
 * prepareTemplateDom: function(!HTMLTemplateElement, string),
 * styleDocument: function(Object<string, string>=),
 * flushCustomStyles: function(),
 * getComputedStyleValue: function(!Element, string): string,
 * ScopingShim: (Object|undefined),
 * ApplyShim: (Object|undefined),
 * CustomStyleInterface: (Object|undefined),
 * nativeCss: boolean,
 * nativeShadow: boolean,
 * }}
 */
let ShadyCSSInterface; //eslint-disable-line no-unused-vars

/**
 * @typedef {{
 * shimcssproperties: (boolean | undefined),
 * shimshadow: (boolean | undefined)
 * }}
 */
let ShadyCSSOptions; //eslint-disable-line no-unused-vars

/** @type {(ShadyCSSInterface | ShadyCSSOptions | undefined)} */
window.ShadyCSS;

redpajama_set_name: RedPajamaGithub


text:
.markjax-hidden {
    display: none;
}

.markjax-preview p {
    text-align: justify;
}

.markjax-preview ol {
    counter-reset: list;
    padding-left: 0;
}

.markjax-preview ol > li {
    list-style: none;
}

.markjax-preview ol > li > p:first-of-type:before {
    content: "(" counter(list, lower-alpha) ")  ";
    counter-increment: list;
}

.markjax-editor {
    height: 200px;
}

.markjax-editor-textarea {
    resize: none;
    width: 100%;
    height: 100%;
    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
    box-sizing: border-box;         /* Opera/IE 8+ */
}

#MathJax_Message {
    display: none;
}

.MathJax_Display {
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding-top: 0.25em;
    padding-bottom: 0.25em;
}


text:
package org.apache.beam.sdk.testing;

import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkNotNull;

import com.google.auto.value.AutoValue;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.PipelineRunner;
import org.apache.beam.sdk.annotations.Experimental;
import org.apache.beam.sdk.annotations.Experimental.Kind;
import org.apache.beam.sdk.annotations.Internal;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.DurationCoder;
import org.apache.beam.sdk.coders.InstantCoder;
import org.apache.beam.sdk.coders.StructuredCoder;
import org.apache.beam.sdk.coders.VarIntCoder;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.SchemaCoder;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.transforms.SerializableFunction;
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
import org.apache.beam.sdk.values.PBegin;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PCollection.IsBounded;
import org.apache.beam.sdk.values.Row;
import org.apache.beam.sdk.values.TimestampedValue;
import org.apache.beam.sdk.values.TypeDescriptor;
import org.apache.beam.sdk.values.WindowingStrategy;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables;
import org.joda.time.Duration;
import org.joda.time.Instant;

/**
 * A testing input that generates an unbounded {@link PCollection} of elements, advancing the
 * watermark and processing time as elements are emitted. After all of the specified elements are
 * emitted, ceases to produce output.
 *
 *
Each call to a {@link TestStream.Builder} method will only be reflected in the state of the
 * {@link Pipeline} after each method before it has completed and no more progress can be made by
 * the {@link Pipeline}. A {@link PipelineRunner} must ensure that no more progress can be made in
 * the {@link Pipeline} before advancing the state of the {@link TestStream}.
 */
public final class TestStream<T> extends PTransform<PBegin, PCollection<T>> {
  private final List<Event<T>> events;
  private final Coder<T> coder;

  /**
   * Create a new {@link TestStream.Builder} with no elements and watermark equal to {@link
   * BoundedWindow#TIMESTAMP_MIN_VALUE}.
   */
  public static <T> Builder<T> create(Coder<T> coder) {
    return new Builder<>(coder);
  }

  @Experimental(Kind.SCHEMAS)
  public static Builder<Row> create(Schema schema) {
    return create(SchemaCoder.of(schema));
  }

  @Experimental(Kind.SCHEMAS)
  public static <T> Builder<T> create(
      Schema schema,
      TypeDescriptor<T> typeDescriptor,
      SerializableFunction<T, Row> toRowFunction,
      SerializableFunction<Row, T> fromRowFunction) {
    return create(SchemaCoder.of(schema, typeDescriptor, toRowFunction, fromRowFunction));
  }

  private TestStream(Coder<T> coder, List<Event<T>> events) {
    this.coder = coder;
    this.events = checkNotNull(events);
  }

  /**
   * An incomplete {@link TestStream}. Elements added to this builder will be produced in sequence
   * when the pipeline created by the {@link TestStream} is run.
   */
  public static class Builder<T> {
    private final Coder<T> coder;
    private final ImmutableList<Event<T>> events;
    private final Instant currentWatermark;

    private Builder(Coder<T> coder) {
      this(coder, ImmutableList.of(), BoundedWindow.TIMESTAMP_MIN_VALUE);
    }

    private Builder(Coder<T> coder, ImmutableList<Event<T>> events, Instant currentWatermark) {
      this.coder = coder;
      this.events = events;
      this.currentWatermark = currentWatermark;
    }

    /**
     * Adds the specified elements to the source with timestamp equal to the current watermark.
     *
     * @return A {@link TestStream.Builder} like this one that will add the provided elements after
     *     all earlier events have completed.
     */
    @SafeVarargs
    public final Builder<T> addElements(T element, T... elements) {
      TimestampedValue<T> firstElement = TimestampedValue.of(element, currentWatermark);
      @SuppressWarnings({"unchecked", "rawtypes"})
      TimestampedValue<T>[] remainingElements = new TimestampedValue[elements.length];
      for (int i = 0; i < elements.length; i++) {
        remainingElements[i] = TimestampedValue.of(elements[i], currentWatermark);
      }
      return addElements(firstElement, remainingElements);
    }

    /**
     * Adds the specified elements to the source with the provided timestamps.
     *
     * @return A {@link TestStream.Builder} like this one that will add the provided elements after
     *     all earlier events have completed.
     */
    @SafeVarargs
    public final Builder<T> addElements(
        TimestampedValue<T> element, TimestampedValue<T>... elements) {
      checkArgument(
          element.getTimestamp().isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE),
          "Elements must have timestamps before %s. Got: %s",
          BoundedWindow.TIMESTAMP_MAX_VALUE,
          element.getTimestamp());
      for (TimestampedValue<T> multiElement : elements) {
        checkArgument(
            multiElement.getTimestamp().isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE),
            "Elements must have timestamps before %s. Got: %s",
            BoundedWindow.TIMESTAMP_MAX_VALUE,
            multiElement.getTimestamp());
      }
      ImmutableList<Event<T>> newEvents =
          ImmutableList.<Event<T>>builder()
              .addAll(events)
              .add(ElementEvent.add(element, elements))
              .build();
      return new Builder<>(coder, newEvents, currentWatermark);
    }

    /**
     * Advance the watermark of this source to the specified instant.
     *
     *
The watermark must advance monotonically and cannot advance to {@link
     * BoundedWindow#TIMESTAMP_MAX_VALUE} or beyond.
     *
     * @return A {@link TestStream.Builder} like this one that will advance the watermark to the
     *     specified point after all earlier events have completed.
     */
    public Builder<T> advanceWatermarkTo(Instant newWatermark) {
      checkArgument(
          !newWatermark.isBefore(currentWatermark), "The watermark must monotonically advance");
      checkArgument(
          newWatermark.isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE),
          "The Watermark cannot progress beyond the maximum. Got: %s. Maximum: %s",
          newWatermark,
          BoundedWindow.TIMESTAMP_MAX_VALUE);
      ImmutableList<Event<T>> newEvents =
          ImmutableList.<Event<T>>builder()
              .addAll(events)
              .add(WatermarkEvent.advanceTo(newWatermark))
              .build();
      return new Builder<>(coder, newEvents, newWatermark);
    }

    /**
     * Advance the processing time by the specified amount.
     *
     * @return A {@link TestStream.Builder} like this one that will advance the processing time by
     *     the specified amount after all earlier events have completed.
     */
    public Builder<T> advanceProcessingTime(Duration amount) {
      checkArgument(
          amount.getMillis() > 0,
          "Must advance the processing time by a positive amount. Got: ",
          amount);
      ImmutableList<Event<T>> newEvents =
          ImmutableList.<Event<T>>builder()
              .addAll(events)
              .add(ProcessingTimeEvent.advanceBy(amount))
              .build();
      return new Builder<>(coder, newEvents, currentWatermark);
    }

    /**
     * Advance the watermark to infinity, completing this {@link TestStream}. Future calls to the
     * same builder will not affect the returned {@link TestStream}.
     */
    public TestStream<T> advanceWatermarkToInfinity() {
      ImmutableList<Event<T>> newEvents =
          ImmutableList.<Event<T>>builder()
              .addAll(events)
              .add(WatermarkEvent.advanceTo(BoundedWindow.TIMESTAMP_MAX_VALUE))
              .build();
      return new TestStream<>(coder, newEvents);
    }
  }

  /**
   * An event in a {@link TestStream}. A marker interface for all events that happen while
   * evaluating a {@link TestStream}.
   */
  public interface Event<T> {
    EventType getType();
  }

  /** The types of {@link Event} that are supported by {@link TestStream}. */
  public enum EventType {
    ELEMENT,
    WATERMARK,
    PROCESSING_TIME
  }

  /** A {@link Event} that produces elements. */
  @AutoValue
  public abstract static class ElementEvent<T> implements Event<T> {
    public abstract Iterable<TimestampedValue<T>> getElements();

    @SafeVarargs
    static <T> Event<T> add(TimestampedValue<T> element, TimestampedValue<T>... elements) {
      return add(ImmutableList.<TimestampedValue<T>>builder().add(element).add(elements).build());
    }

    /** For internal use only: no backwards compatibility guarantees. */
    @Internal
    public static <T> Event<T> add(Iterable<TimestampedValue<T>> elements) {
      return new AutoValue_TestStream_ElementEvent<>(EventType.ELEMENT, elements);
    }
  }

  /** A {@link Event} that advances the watermark. */
  @AutoValue
  public abstract static class WatermarkEvent<T> implements Event<T> {
    public abstract Instant getWatermark();

    /** For internal use only: no backwards compatibility guarantees. */
    @Internal
    public static <T> Event<T> advanceTo(Instant newWatermark) {
      return new AutoValue_TestStream_WatermarkEvent<>(EventType.WATERMARK, newWatermark);
    }
  }

  /** A {@link Event} that advances the processing time clock. */
  @AutoValue
  public abstract static class ProcessingTimeEvent<T> implements Event<T> {
    public abstract Duration getProcessingTimeAdvance();

    /** For internal use only: no backwards compatibility guarantees. */
    @Internal
    public static <T> Event<T> advanceBy(Duration amount) {
      return new AutoValue_TestStream_ProcessingTimeEvent<>(EventType.PROCESSING_TIME, amount);
    }
  }

  @Override
  public PCollection<T> expand(PBegin input) {
    return PCollection.createPrimitiveOutputInternal(
        input.getPipeline(), WindowingStrategy.globalDefault(), IsBounded.UNBOUNDED, coder);
  }

  public Coder<T> getValueCoder() {
    return coder;
  }

  /**
   * Returns the sequence of {@link Event Events} in this {@link TestStream}.
   *
   *
For use by {@link PipelineRunner} authors.
   */
  public List<Event<T>> getEvents() {
    return events;
  }

  /**
   * For internal use only. No backwards-compatibility guarantees.
   *
   *
Builder a test stream directly from events. No validation is performed on watermark
   * monotonicity, etc. This is assumed to be a previously-serialized {@link TestStream} transform
   * that is correct by construction.
   */
  @Internal
  public static <T> TestStream<T> fromRawEvents(Coder<T> coder, List<Event<T>> events) {
    return new TestStream<>(coder, events);
  }

  @Override
  public boolean equals(Object other) {
    if (!(other instanceof TestStream)) {
      return false;
    }
    TestStream<?> that = (TestStream<?>) other;

    return getValueCoder().equals(that.getValueCoder()) && getEvents().equals(that.getEvents());
  }

  @Override
  public int hashCode() {
    return Objects.hash(TestStream.class, getValueCoder(), getEvents());
  }

  /** Coder for {@link TestStream}. */
  public static class TestStreamCoder<T> extends StructuredCoder<TestStream<T>> {

    private final TimestampedValue.TimestampedValueCoder<T> elementCoder;

    public static <T> TestStreamCoder<T> of(Coder<T> valueCoder) {
      return new TestStreamCoder<>(valueCoder);
    }

    private TestStreamCoder(Coder<T> valueCoder) {
      this.elementCoder = TimestampedValue.TimestampedValueCoder.of(valueCoder);
    }

    @Override
    public void encode(TestStream<T> value, OutputStream outStream) throws IOException {
      List<Event<T>> events = value.getEvents();
      VarIntCoder.of().encode(events.size(), outStream);

      for (Event event : events) {
        if (event instanceof ElementEvent) {
          outStream.write(event.getType().ordinal());
          Iterable<TimestampedValue<T>> elements = ((ElementEvent) event).getElements();
          VarIntCoder.of().encode(Iterables.size(elements), outStream);
          for (TimestampedValue<T> element : elements) {
            elementCoder.encode(element, outStream);
          }
        } else if (event instanceof WatermarkEvent) {
          outStream.write(event.getType().ordinal());
          Instant watermark = ((WatermarkEvent) event).getWatermark();
          InstantCoder.of().encode(watermark, outStream);
        } else if (event instanceof ProcessingTimeEvent) {
          outStream.write(event.getType().ordinal());
          Duration processingTimeAdvance = ((ProcessingTimeEvent) event).getProcessingTimeAdvance();
          DurationCoder.of().encode(processingTimeAdvance, outStream);
        }
      }
    }

    @Override
    public TestStream<T> decode(InputStream inStream) throws IOException {
      Integer numberOfEvents = VarIntCoder.of().decode(inStream);
      List<Event<T>> events = new ArrayList<>(numberOfEvents);

      for (int i = 0; i < numberOfEvents; i++) {
        EventType eventType = EventType.values()[inStream.read()];
        switch (eventType) {
          case ELEMENT:
            int numElements = VarIntCoder.of().decode(inStream);
            List<TimestampedValue<T>> elements = new ArrayList<>(numElements);
            for (int j = 0; j < numElements; j++) {
              elements.add(elementCoder.decode(inStream));
            }
            events.add(ElementEvent.add(elements));
            break;
          case WATERMARK:
            Instant watermark = InstantCoder.of().decode(inStream);
            events.add(WatermarkEvent.advanceTo(watermark));
            break;
          case PROCESSING_TIME:
            Duration duration = DurationCoder.of().decode(inStream).toDuration();
            events.add(ProcessingTimeEvent.advanceBy(duration));
            break;
          default:
            throw new IllegalStateException("Unknown event type + " + eventType);
        }
      }
      return TestStream.fromRawEvents(elementCoder.getValueCoder(), events);
    }

    @Override
    public List<? extends Coder<?>> getCoderArguments() {
      return Collections.singletonList(elementCoder);
    }

    @Override
    public void verifyDeterministic() throws NonDeterministicException {}
  }
}


text:
using System.Threading;
using System.Threading.Tasks;
using Bolt.Test.Common;

namespace Bolt.Server.IntegrationTest.Core
{
    public interface ITestContract : ITestContractInner
    {
        void SimpleMethodWithSimpleArguments(int val);

        [AsyncOperation]
        void SimpleMethod();

        void MethodWithNullableArguments(string arg);

        [SyncOperation]
        Task SimpleMethodExAsync();

        void SimpleMethodWithCancellation(CancellationToken cancellation);

        void SimpleWithCancellationAsFirstArgument(CancellationToken cancellation, int value);

        [AsyncOperation]
        CompositeType ComplexFunction();
    }
}


text:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.m.js';
import 'chrome://resources/cr_elements/shared_vars_css.m.js';
import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js';
import './strings.m.js';

import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {BrowserProxy} from './browser_proxy.js';

/**
 * Enum for the state of `crostini-upgrader-app`.
 * @enum {string}
 */
const State = {
  PROMPT: 'prompt',
  BACKUP: 'backup',
  BACKUP_ERROR: 'backupError',
  BACKUP_SUCCEEDED: 'backupSucceeded',
  PRECHECKS_FAILED: 'prechecksFailed',
  UPGRADING: 'upgrading',
  UPGRADE_ERROR: 'upgrade_error',
  OFFER_RESTORE: 'offerRestore',
  RESTORE: 'restore',
  RESTORE_ERROR: 'restoreError',
  RESTORE_SUCCEEDED: 'restoreSucceeded',
  CANCELING: 'canceling',
  SUCCEEDED: 'succeeded',
};

const kMaxUpgradeAttempts = 3;

Polymer({
  is: 'crostini-upgrader-app',

  _template: html`{__html_template__}`,

  properties: {
    /** @private {State} */
    state_: {
      type: String,
      value: State.PROMPT,
    },

    /** @private */
    backupCheckboxChecked_: {
      type: Boolean,
      value: true,
    },

    /** @private */
    backupProgress_: {
      type: Number,
    },

    /** @private */
    upgradeProgress_: {
      type: Number,
      value: 0,
    },

    /** @private */
    restoreProgress_: {
      type: Number,
    },

    /** @private */
    progressMessages_: {
      type: Array,
    },

    /** @private */
    progressLineNumber_: {
      type: Number,
      value: 0,
    },

    /** @private */
    lastProgressLine_: {
      type: String,
      value: '',
    },

    /** @private */
    progressLineDisplayMs_: {
      type: Number,
      value: 300,
    },

    /** @private */
    upgradeAttemptCount_: {
      type: Number,
      value: 0,
    },

    /** @private */
    logFileName_: {
      type: String,
      value: '',
    },

    /** @private */
    precheckStatus_: {
      type: Number,
      value: chromeos.crostiniUpgrader.mojom.UpgradePrecheckStatus.OK,
    },

    /**
     * Enable the html template to use State.
     * @private
     */
    State: {
      type: Object,
      value: State,
    },
  },

  /** @override */
  created() {
    // Must be set here rather then in the defaults above because arrays are
    // mutable objects and every instance of the element needs its own array.
    this.progressMessages_ = [];
  },

  /** @override */
  attached() {
    const callbackRouter = BrowserProxy.getInstance().callbackRouter;

    this.listenerIds_ = [
      callbackRouter.onBackupProgress.addListener((percent) => {
        this.state_ = State.BACKUP;
        this.backupProgress_ = percent;
      }),
      callbackRouter.onBackupSucceeded.addListener((wasCancelled) => {
        assert(this.state_ === State.BACKUP);
        this.state_ = State.BACKUP_SUCCEEDED;
        // We do a short (2 second) interstitial display of the backup success
        // message before continuing the upgrade.
        var timeout = new Promise((resolve, reject) => {
          setTimeout(resolve, wasCancelled ? 0 : 2000);
        });
        // We also want to wait for the prechecks to finish.
        var callback = new Promise((resolve, reject) => {
          this.startPrechecks_(resolve, reject);
        });
        Promise.all([timeout, callback]).then(() => {
          this.startUpgrade_();
        });
      }),
      callbackRouter.onBackupFailed.addListener(() => {
        assert(this.state_ === State.BACKUP);
        this.state_ = State.BACKUP_ERROR;
      }),
      callbackRouter.precheckStatus.addListener((status) => {
        this.precheckStatus_ = status;
        if (status ===
            chromeos.crostiniUpgrader.mojom.UpgradePrecheckStatus.OK) {
          this.precheckSuccessCallback_();
        } else {
          this.state_ = State.PRECHECKS_FAILED;
          this.precheckFailureCallback_();
        }
      }),
      callbackRouter.onUpgradeProgress.addListener((progressMessages) => {
        assert(this.state_ === State.UPGRADING);
        this.progressMessages_.push(...progressMessages);
        this.upgradeProgress_ = this.progressMessages_.length;

        if (this.progressLineNumber_ < this.upgradeProgress_) {
          this.updateProgressLine_();
        }
      }),
      callbackRouter.onUpgradeSucceeded.addListener(() => {
        assert(this.state_ === State.UPGRADING);
        this.state_ = State.SUCCEEDED;
      }),
      callbackRouter.onUpgradeFailed.addListener(() => {
        assert(this.state_ === State.UPGRADING);
        if (this.upgradeAttemptCount_ < kMaxUpgradeAttempts) {
          this.precheckThenUpgrade_();
          return;
        }
        if (this.backupCheckboxChecked_) {
          this.state_ = State.OFFER_RESTORE;
        } else {
          this.state_ = State.UPGRADE_ERROR;
        }
      }),
      callbackRouter.onRestoreProgress.addListener((percent) => {
        assert(this.state_ === State.RESTORE);
        this.restoreProgress_ = percent;
      }),
      callbackRouter.onRestoreSucceeded.addListener(() => {
        assert(this.state_ === State.RESTORE);
        this.state_ = State.RESTORE_SUCCEEDED;
      }),
      callbackRouter.onRestoreFailed.addListener(() => {
        assert(this.state_ === State.RESTORE);
        this.state_ = State.RESTORE_ERROR;
      }),
      callbackRouter.onCanceled.addListener(() => {
        if (this.state_ === State.RESTORE) {
          this.state_ = State.RESTORE_ERROR;
          return;
        }
        this.closePage_();
      }),
      callbackRouter.requestClose.addListener(() => {
        if (this.canCancel_(this.state_)) {
          this.onCancelButtonClick_();
        }
      }),
      callbackRouter.onLogFileCreated.addListener((path) => {
        this.logFileName_ = path;
      }),
    ];

    document.addEventListener('keyup', event => {
      if (event.key == 'Escape' && this.canCancel_(this.state_)) {
        this.onCancelButtonClick_();
        event.preventDefault();
      }
    });

    this.$$('.action-button').focus();
  },

  /** @override */
  detached() {
    const callbackRouter = BrowserProxy.getInstance().callbackRouter;
    this.listenerIds_.forEach(id => callbackRouter.removeListener(id));
  },

  /** @private */
  precheckThenUpgrade_() {
    this.startPrechecks_(() => {
      this.startUpgrade_();
    }, () => {});
  },

  /** @private */
  onActionButtonClick_() {
    switch (this.state_) {
      case State.SUCCEEDED:
        BrowserProxy.getInstance().handler.launch();
        this.closePage_();
        break;
      case State.PRECHECKS_FAILED:
        this.precheckThenUpgrade_();
        break;
      case State.PROMPT:
        if (this.backupCheckboxChecked_) {
          this.startBackup_(/*showFileChooser=*/ false);
        } else {
          this.precheckThenUpgrade_();
        }
        break;
      case State.OFFER_RESTORE:
        this.startRestore_();
        break;
      default:
        assertNotReached();
    }
  },

  /** @private */
  onCancelButtonClick_() {
    switch (this.state_) {
      case State.PROMPT:
        BrowserProxy.getInstance().handler.cancelBeforeStart();
        break;
      case State.UPGRADING:
        this.state_ = State.CANCELING;
        BrowserProxy.getInstance().handler.cancel();
        break;
      case State.RESTORE_SUCCEEDED:
        BrowserProxy.getInstance().handler.launch();
        this.closePage_();
        break;
      case State.PRECHECKS_FAILED:
      case State.BACKUP_ERROR:
      case State.UPGRADE_ERROR:
      case State.RESTORE_ERROR:
      case State.OFFER_RESTORE:
      case State.SUCCEEDED:
        this.closePage_();
        break;
      case State.CANCELING:
        break;
      default:
        assertNotReached();
    }
  },

  /** @private */
  onChangeLocationButtonClick_() {
    this.startBackup_(/*showFileChooser=*/ true);
  },

  /**
   * @param {boolean} showFileChooser
   * @private
   */
  startBackup_(showFileChooser) {
    BrowserProxy.getInstance().handler.backup(showFileChooser);
  },

  /** @private */
  startPrechecks_(success, failure) {
    this.precheckSuccessCallback_ = success;
    this.precheckFailureCallback_ = failure;
    BrowserProxy.getInstance().handler.startPrechecks();
  },

  /** @private */
  startUpgrade_() {
    this.state_ = State.UPGRADING;
    this.upgradeAttemptCount_++;
    BrowserProxy.getInstance().handler.upgrade();
  },

  /** @private */
  startRestore_() {
    this.state_ = State.RESTORE;
    BrowserProxy.getInstance().handler.restore();
  },

  /** @private */
  closePage_() {
    BrowserProxy.getInstance().handler.onPageClosed();
  },

  /**
   * @param {State} state1
   * @param {State} state2
   * @return {boolean}
   * @private
   */
  isState_(state1, state2) {
    return state1 === state2;
  },

  isErrorLogsHidden_(state) {
    return !(
        this.isState_(this.state_, State.UPGRADE_ERROR) ||
        this.isState_(this.state_, State.OFFER_RESTORE));
  },

  /**
   * @param {State} state
   * @return {boolean}
   * @private
   */
  canDoAction_(state) {
    switch (state) {
      case State.PROMPT:
      case State.PRECHECKS_FAILED:
      case State.SUCCEEDED:
      case State.OFFER_RESTORE:
        return true;
    }
    return false;
  },

  /**
   * @param {State} state
   * @return {boolean}
   * @private
   */
  canCancel_(state) {
    switch (state) {
      case State.BACKUP:
      case State.RESTORE:
      case State.BACKUP_SUCCEEDED:
      case State.CANCELING:
      case State.SUCCEEDED:
        return false;
    }
    return true;
  },

  /**
   * @return {string}
   * @private
   */
  getTitle_() {
    let titleId;
    switch (this.state_) {
      case State.PROMPT:
        titleId = 'promptTitle';
        break;
      case State.BACKUP:
        titleId = 'backingUpTitle';
        break;
      case State.BACKUP_ERROR:
        titleId = 'backupErrorTitle';
        break;
      case State.BACKUP_SUCCEEDED:
        titleId = 'backupSucceededTitle';
        break;
      case State.PRECHECKS_FAILED:
        titleId = 'prechecksFailedTitle';
        break;
      case State.UPGRADING:
        titleId = 'upgradingTitle';
        break;
      case State.OFFER_RESTORE:
      case State.UPGRADE_ERROR:
        titleId = 'errorTitle';
        break;
      case State.RESTORE:
        titleId = 'restoreTitle';
        break;
      case State.RESTORE_ERROR:
        titleId = 'restoreErrorTitle';
        break;
      case State.RESTORE_SUCCEEDED:
        titleId = 'restoreSucceededTitle';
        break;
      case State.CANCELING:
        titleId = 'cancelingTitle';
        break;
      case State.SUCCEEDED:
        titleId = 'succeededTitle';
        break;
      default:
        assertNotReached();
    }
    return loadTimeData.getString(/** @type {string} */ (titleId));
  },

  /**
   * @param {State} state
   * @return {string}
   * @private
   */
  getActionButtonLabel_(state) {
    switch (state) {
      case State.PROMPT:
        return loadTimeData.getString('upgrade');
      case State.PRECHECKS_FAILED:
        return loadTimeData.getString('retry');
      case State.SUCCEEDED:
        return loadTimeData.getString('done');
      case State.OFFER_RESTORE:
        return loadTimeData.getString('restore');
    }
    return '';
  },

  /**
   * @param {State} state
   * @return {string}
   * @private
   */
  getCancelButtonLabel_(state) {
    switch (state) {
      case State.RESTORE_SUCCEEDED:
      case State.BACKUP_ERROR:
      case State.UPGRADE_ERROR:
      case State.RESTORE_ERROR:
        return loadTimeData.getString('close');
      case State.PROMPT:
        return loadTimeData.getString('notNow');
      default:
        return loadTimeData.getString('cancel');
    }
  },

  /**
   * @param {State} state
   * @return {string}
   * @private
   */
  getProgressMessage_(state, precheckStatus, file_name) {
    let messageId = null;
    switch (state) {
      case State.PROMPT:
        messageId = 'promptMessage';
        break;
      case State.BACKUP:
        messageId = 'backingUpMessage';
        break;
      case State.BACKUP_ERROR:
        messageId = 'backupErrorMessage';
        break;
      case State.PRECHECKS_FAILED:
        switch (precheckStatus) {
          case chromeos.crostiniUpgrader.mojom.UpgradePrecheckStatus
              .NETWORK_FAILURE:
            messageId = 'precheckNoNetwork';
            break;
          case chromeos.crostiniUpgrader.mojom.UpgradePrecheckStatus.LOW_POWER:
            messageId = 'precheckNoPower';
            break;
          default:
            assertNotReached();
        }
        break;
      case State.UPGRADING:
        messageId = 'upgradingMessage';
        break;
      case State.RESTORE:
        messageId = 'restoreMessage';
        break;
      case State.RESTORE_ERROR:
        messageId = 'restoreErrorMessage';
        break;
      case State.SUCCEEDED:
        return loadTimeData.getStringF('logFileMessageSuccess', file_name);
        break;
      case State.UPGRADE_ERROR:
      case State.OFFER_RESTORE:
        return loadTimeData.getStringF('logFileMessageError', file_name);
        break;
    }
    return messageId ? loadTimeData.getString(messageId) : '';
  },

  /**
   * @param {State} state
   * @return {string}
   * @private
   */
  getErrorLogs_(state) {
    return this.progressMessages_.join('\n');
  },

  /**
   * @param {State} state
   * @return {string}
   * @private
   */
  getIllustrationStyle_(state) {
    switch (state) {
      case State.BACKUP_ERROR:
      case State.BACKUP_SUCCEEDED:
      case State.RESTORE_ERROR:
      case State.RESTORE_SUCCEEDED:
      case State.PRECHECKS_FAILED:
        return 'img-square-illustration';
    }
    return 'img-rect-illustration';
  },

  /**
   * @param {State} state
   * @return {string}
   * @private
   */
  getIllustrationURI_(state) {
    switch (state) {
      case State.BACKUP_SUCCEEDED:
      case State.RESTORE_SUCCEEDED:
        return 'images/success_illustration.svg';
      case State.PRECHECKS_FAILED:
      case State.BACKUP_ERROR:
      case State.RESTORE_ERROR:
        return 'images/error_illustration.png';
    }
    return 'images/linux_illustration.png';
  },

  /**
   * @param {State} state
   * @return {boolean}
   * @private
   */
  hideIllustration_(state) {
    switch (state) {
      case State.OFFER_RESTORE:
      case State.UPGRADE_ERROR:
        return true;
    }
    return false;
  },

  /** @private */
  updateProgressLine_() {
    if (this.progressLineNumber_ < this.upgradeProgress_) {
      this.lastProgressLine_ =
          this.progressMessages_[this.progressLineNumber_++];
      var t = setTimeout(
          this.updateProgressLine_.bind(this), this.progressLineDisplayMs_);
    }
  },
});


text:
<?php

namespace Sylius\Bundle\ThemeBundle\Synchronizer;

/**
 * @author Kamil Kokot <kamil.kokot@lakion.com>
 */
class SynchronizationFailedException extends \DomainException
{
}


text:
@interface FLCodeStorageOptions : FLCodeStorageOptionsBaseClass {
@private
}

+ (id) codeStorageOptions;

@end


text:
package org.eclipse.emf.cdo.spi.server;

import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
import org.eclipse.emf.cdo.server.IQueryHandler;
import org.eclipse.emf.cdo.server.IQueryHandlerProvider;

import org.eclipse.net4j.util.factory.IFactory;
import org.eclipse.net4j.util.registry.HashMapRegistry;
import org.eclipse.net4j.util.registry.IRegistry;

/**
 * @author Eike Stepper
 * @since 2.0
 */
public class FactoriesQueryHandlerProvider implements IQueryHandlerProvider
{
  private IRegistry<String, IFactory> registry;

  public FactoriesQueryHandlerProvider()
  {
  }

  public FactoriesQueryHandlerProvider(IRegistry<String, IFactory> registry)
  {
    setRegistry(registry);
  }

  public FactoriesQueryHandlerProvider(IFactory factory)
  {
    addFactory(factory);
  }

  public IRegistry<String, IFactory> getRegistry()
  {
    if (registry == null)
    {
      registry = new HashMapRegistry<String, IFactory>();
    }

    return registry;
  }

  public void setRegistry(IRegistry<String, IFactory> registry)
  {
    this.registry = registry;
  }

  public void addFactory(IFactory factory)
  {
    getRegistry().put(factory.getKey().getType(), factory);
  }

  /**
   * @since 3.0
   */
  public IQueryHandler getQueryHandler(CDOQueryInfo info)
  {
    IFactory factory = registry.get(info.getQueryLanguage());
    if (factory != null)
    {
      return (IQueryHandler)factory.create(null);
    }

    return null;
  }
}


text:
"""
prefutil.py

Created by Eric on 2009-12-28.

Helper functions for the preferences.
"""
from __future__ import division

import pdb

from numpy import argmax

def query2prefs(query, f, bestDegree=0):
    """
    Given a sequence of query points and a function to evaluate, return a set
    of preferences.
    """
    try:
        # for now, find the biggest gap and use that as the preference point
        D = zip([f(q) for q in query], query)
        D.sort(key=lambda x:x[0])

        bpoint = argmax([D[i+1][0]-D[i][0] for i in xrange(len(query)-1)]) + 1

        # everything on the right of the break point is preferred to
        # everything on the left
        prefs = []
        for i, (yu, xu) in enumerate(D[:bpoint]):
            for j, (yv, xv) in enumerate(D[bpoint:]):
                if i==0 and j==len(D)-bpoint-1:
                    prefs.append((xv, xu, bestDegree))
                else:
                    prefs.append((xv, xu, 0))
    except e:
        print e
        pdb.set_trace()
    return prefs


text:
package fr.ign.spark.iqmulus.las

import org.apache.hadoop.mapreduce.TaskAttemptContext
import org.apache.spark.sql.sources.{ OutputWriter, OutputWriterFactory }
import org.apache.spark.sql.types.StructType

private[las] class LasOutputWriterFactory(format: Option[Byte], version: Version) extends OutputWriterFactory {

  override def newInstance(
    path: String,
    dataSchema: StructType,
    context: TaskAttemptContext
  ): OutputWriter =
    new LasOutputWriter(path, context, dataSchema, format, version)
}


text:
<?php

namespace Rbac\Traversal\Strategy;

use Generator;
use Rbac\Role\HierarchicalRoleInterface;
use Rbac\Role\RoleInterface;
use Traversable;

/**
 * Recursively traverse roles using generator
 * Requires PHP >= 5.5
 */
class GeneratorStrategy implements TraversalStrategyInterface
{
    /**
     * @param  RoleInterface[]|Traversable $roles
     * @return Generator
     */
    public function getRolesIterator($roles)
    {
        foreach ($roles as $role) {
            yield $role;

            if (!$role instanceof HierarchicalRoleInterface) {
                continue;
            }

            $children = $this->getRolesIterator($role->getChildren());

            foreach ($children as $child) {
                yield $child;
            }
        }
    }
}


text:
"""Tests for flax.training.early_stopping."""

import copy
import os

from absl.testing import absltest
from flax.training import early_stopping
import jax
from jax import test_util as jtu

# Parse absl flags test_srcdir and test_tmpdir.
jax.config.parse_flags_with_absl()

class EarlyStoppingTests(absltest.TestCase):

  def test_update(self):
    es = early_stopping.EarlyStopping(min_delta=0,
                                      patience=0)

    for i in range(2):
      improve_steps = 0
      for step in range(10):
        metric = 1.
        did_improve, es = es.update(metric)
        if not did_improve:
          improve_steps += 1
        if es.should_stop:
          break

      self.assertEqual(improve_steps, 1)
      self.assertEqual(step, 1)

      es = es.reset()  # ensure object is reusable if reset.

  def test_patience(self):
    es = early_stopping.EarlyStopping(min_delta=0,
                                      patience=0)
    patient_es = early_stopping.EarlyStopping(min_delta=0,
                                              patience=6)
    for step in range(10):
      metric = 1.
      did_improve, es = es.update(metric)
      if es.should_stop:
        break

    self.assertEqual(step, 1)

    for patient_step in range(10):
      metric = 1.
      did_improve, patient_es = patient_es.update(metric)
      if patient_es.should_stop:
        break

    self.assertEqual(patient_step, 7)

  def test_delta(self):
    es = early_stopping.EarlyStopping(min_delta=0,
                                      patience=0)
    delta_es = early_stopping.EarlyStopping(min_delta=1e-3,
                                            patience=0)
    delta_patient_es = early_stopping.EarlyStopping(min_delta=1e-3,
                                                    patience=1)
    metric = 1.
    for step in range(100):
      metric -= 1e-4
      did_improve, es = es.update(metric)
      if es.should_stop:
        break

    self.assertEqual(step, 99)

    metric = 1.
    for step in range(100):
      metric -= 1e-4
      did_improve, delta_es = delta_es.update(metric)
      if delta_es.should_stop:
        break

    self.assertEqual(step, 1)

    metrics = [0.01, 0.005, 0.0033, 0.0025, 0.002,
               0.0017, 0.0014, 0.0012, 0.0011, 0.001]
    improvement_steps = 0
    for step in range(10):
      metric = metrics[step]
      did_improve, delta_patient_es = delta_patient_es.update(metric)
      if did_improve:
        improvement_steps += 1
      if delta_patient_es.should_stop:
        break

    self.assertEqual(improvement_steps, 4)  # steps 0, 1, 2, 4
    self.assertEqual(step, 6)

if __name__ == '__main__':
  absltest.main()


text:
@extends('admin.layout')

@section('customer_css')
    @parent

@stop
@section('content')

Log [{{ $log->date }}]

            @include('log-viewer::_partials.menu')

                    Log info :

                        date]) }}" class="btn btn-xs btn-success">
                             DOWNLOAD

                             DELETE

                            File path :
                            {{ $log->getPath() }}

                            Log entries :

                                        {{ $entries->total() }}

                            Size :

                                {{ $log->size() }}

                            Created at :

                                {{ $log->createdAt() }}

                            Updated at :

                                {{ $log->updatedAt() }}

                        {!! $entries->render() !!}

                        ENV
                        Level
                        Time
                        Header

                    @foreach($entries as $key => $entry)

                                    {{ $entry->env }}

                                level }}">
                                    {!! $entry->level() !!}

                                    {{ $entry->datetime->format('H:i:s') }}

{{ $entry->header }}

                    @endforeach

                        {!! $entries->render() !!}

    {{-- DELETE MODAL --}}

            <form id="delete-log-form" action="{{ route('log-viewer::logs.delete') }}" method="POST">
                <input type="hidden" name="_method" value="DELETE">
                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                <input type="hidden" name="date" value="{{ $log->date }}">

                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            ×
                        </button>

DELETE LOG FILE

Are you sure you want to DELETE this log file {{ $log->date }} ?

                        <button type="button" class="btn btn-sm btn-default pull-left" data-dismiss="modal">Cancel</button>
                        <button type="submit" class="btn btn-sm btn-danger" data-loading-text="Loading…">DELETE FILE</button>

            </form>

@stop

@section('js')
    @parent

@stop


text:
var setExpr;

angular.module("AppNameHere", [])
.controller("MainController", ["$scope", function($scope) {
  $scope.x = "two plus two equals four ({\u03bb {\u03bb @<2>}} means true)";

  $scope.exprControl = null;

  window.mainScope = $scope;

  $scope.expr1 = [example.parseLambda(example.twotwofour)];
  $scope.input = example.twotwofour;
  $scope.showGoButton = false;
  $scope.showClearButton = false;
  $scope.keepExprs = false;
  $scope.rules = Object.keys(example.rules);
  $scope.selectedRule = $scope.rules[0];
  $scope.selection = [];

  $scope.rules.unshift("delete", "clone");

  $scope.$watch("selectedRule", function() {
    if ($scope.selectedRule == "delete") {
      $scope.showClearButton = false;
      $scope.showGoButton = false;
      $scope.clearSelection();
      return;
    }
    var rule = example.rules[$scope.selectedRule];
    $scope.showClearButton = (rule.inputsNeeded != 1);
    $scope.showGoButton = (rule.inputsNeeded == "many");
    $scope.clearSelection();
  });

  $scope.clearSelection = function() {
    $scope.selection = [];
    $scope.exprControl.setAllSelected(false);
  }

  $scope.setExprLambda = function setExprLambda(val) {
    $scope.expr1 = example.parseMultiLambda(val);
  }
  $scope.appendExprLambda = function setExprLambda(val) {
    $scope.expr1 = $scope.expr1.concat(example.parseMultiLambda(val));
  }

  $scope.onExprClick = function onExprClick(val) {
    if ($scope.selectedRule == "delete") {
      if (val.length > 0) {
        $scope.expr1.splice(val[0], 1);
      }
      $scope.clearSelection()
      return;
    } else if ($scope.selectedRule == "clone") {
      if (val.length> 0) {
        $scope.expr1.push($scope.expr1[val[0]]);
      }
      $scope.clearSelection();
      return;
    }

    var rule = example.rules[$scope.selectedRule];

    $scope.selection.push(val);

    if ($scope.selection.length == rule.inputsNeeded) {
      $scope.doTransform();
    }
  }

  $scope.doTransform = function doTransform() {
    var rule = example.rules[$scope.selectedRule];

    var expr = $scope.selection.map(e => logic.index($scope.expr1, e));

    var input = rule.getVars($scope.expr1, $scope.selection, expr);

    if (input) {
      var exprs = $scope.selection.slice(0,rule.ante.length).map(e => $scope.expr1[e[0]]);
      var result = logic.apply(exprs, rule, input);

      if (result.length > 0) {
        //$scope.expr1 = result;
        $scope.expr1 = $scope.expr1.concat(result);

        if (!$scope.keepExprs) {
          var remove = $scope.selection.map(e=>e[0]);
          $scope.expr1 = $scope.expr1.filter((e,i)=>remove.indexOf(i) == -1);
        }
      }
    }

    $scope.clearSelection();
  }

  setExpr = function(val) {
    $scope.expr1 = val;
    $scope.$apply();
    return val;
  }
  /*
  $scope.inSelection(val) {
    return $scope.selection.findIndex(e => {

    })
  }

  $scope.toggleSelected(val) {
    var index = $scope.inSelection(val);
    if (index == -1) {
      $scope.selection.push(val);
    } else {
      $scope.selection.splice(index, 1);
    }
  }
  */
}])

.component("expression", {
  bindings: {
    expression: '=',
    exprControl: '&',
    exprClick: '&',
  },
  template: `

      <expression
        ng-repeat="e in $ctrl.expression track by $index"
        expression="e"
        expr-click="subclick($index, expr)"
        expr-control="setChildControl(ctrl, $index)"
        ng-mouseenter="setChildHover(true)"
        ng-mouseleave="setChildHover(false)"></expression>

    {{$ctrl.expression|exprToString}}
  `,
  controller: function($scope, $element) {
    var ctrl = this;

    $scope.children = [];
    $scope.logic = logic;
    $scope.selected = false;
    $scope.childClickListener = [];
    $scope.hover = false;
    $scope.childHover = false;

    $scope.setChildControl = function(childController, index) {
      $scope.children[index] = childController;
    }

    $scope.setChildHover = function(val) {
      $scope.childHover = val;
    };

    $scope.onclick = function(event) {
      $scope.selected = true;
      event.stopPropagation();
      ctrl.exprClick({expr:[]});
    }

    $scope.subclick = function(id, expr) {
      expr.unshift(id);
      ctrl.exprClick({expr: expr});
    }

    ctrl.setSelected = function(val) {
      $scope.selected = val;
    }

    ctrl.setAllSelected = function(val) {
      $scope.selected = val;
      for (var i=0; i<$scope.children.length; i++) {
        $scope.children[i].setAllSelected(val);
      }
    }

    $element.on("mouseenter", function(e) {
      $scope.hover = true;
      $scope.$apply();
    })

    $element.on("mouseleave", function(e) {
      $scope.hover = false;
      $scope.$apply();
    })

    ctrl.exprControl({ctrl});
  }
})

.filter("exprToString", function() {return function(val) {
  return logic.toString(val);
}})


text:
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ui.docking;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.IdeFrame;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.Set;
import java.util.function.Predicate;

public abstract class DockManager {

  public abstract void register(@NotNull DockContainer container, @NotNull Disposable parentDisposable);

  public abstract void register(@NotNull String id, @NotNull DockContainerFactory factory, @NotNull Disposable parentDisposable);

  public static DockManager getInstance(@NotNull Project project) {
    return project.getService(DockManager.class);
  }

  public abstract DragSession createDragSession(MouseEvent mouseEvent, @NotNull DockableContent<?> content);

  public abstract @NotNull Set<@NotNull DockContainer> getContainers();

  public abstract IdeFrame getIdeFrame(@NotNull DockContainer container);

  public abstract String getDimensionKeyForFocus(@NotNull String key);

  /**
   * @deprecated use {@link #getContainerFor(Component, Predicate)} instead
   */
  @Deprecated(forRemoval = true)
  public abstract @Nullable DockContainer getContainerFor(Component c);

  public abstract @Nullable DockContainer getContainerFor(@Nullable Component c, @NotNull Predicate<DockContainer> filter);
}


text:
<?php

namespace Benrowe\Formatter\Providers;

use Benrowe\Formatter\AbstractFormatterProvider;

/**
 * @package Benrowe\Formatter
 */
class Numbers extends AbstractFormatterProvider
{
    /**
     * Display the value as currency
     *
     * @param  mixed $value
     * @return string
     */
    public function asCurrency($value)
    {
        if ($value === null) {
            return $this->nullValue;
        }

        $value = $this->normaliseValue($value);

        $prefix = '$';
        if ($value < 0) {
            $prefix = '-$';
            $value *= -1;
        }

        $newValue = number_format($value, 2);

        return $prefix.$newValue;
    }

    /**
     * Displays the number as an unsigned value
     *
     * @param  mixed $value
     * @return double|int|string
     */
    public function asUnsigned($value)
    {
        if ($value === null) {
            return $this->nullValue;
        }

        $value = $this->normaliseValue($value);
        if ($value < 0) {
            $value *= -1;
        }
        return $value;
    }

    /**
     * Format the supplied value as a number
     *
     * @param  mixed $value
     * @return double|int|string
     */
    public function asNumber($value)
    {
        if ($value === null) {
            return $this->nullValue;
        }

        return $this->normaliseValue($value);
    }

    /**
     * Convert the supplied value into a valid number value
     *
     * @param  mixed $value
     * @return float|int
     */
    private function normaliseValue($value)
    {
        if (!is_numeric($value)) {
            $value = 0;
        }
        // cast the value to int or float based on its true type
        return (float)$value === (float)(int)$value ? (int)$value : (float)$value;
    }
}


text:
This contains a snapshot of the SDNdbg project that
is Django-based.  In November 2016, I decided it may be
best to first get functionality (perhaps even update capabilities)
before doing any persistence.

Probably might be better to use a nosql database that can do graphs
and also look at perhaps time-series databases if we want to be able
to pull metrics down to help in debugging of SDN issues.

In other words, keeping up with Django changes and working around
it was distracting me from the complexities needed to properly get
any significant progress done.


text:
layout: blog-page
title: Announcing Dotty 0.3.0-RC2
author: Allan Renucci
authorImg: images/allan.jpg
date: 2017-09-07
---

Today, we are excited to release Dotty version 0.3.0-RC2. This release
serves as a technology preview that demonstrates new language features
and the compiler supporting them.

If you're not familiar with Dotty, it's a platform to try out new language concepts and compiler
technologies for Scala. The focus is mainly on simplification. We remove extraneous syntax
(e.g. no XML literals), and try to boil down Scala's types into a smaller set of more fundamental
constructs. The theory behind these constructs is researched in
[DOT](https://infoscience.epfl.ch/record/215280), a calculus for dependent object types.
You can learn more about Dotty on our [website](http://dotty.epfl.ch).

<!--more-->

This is our third scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html).
The [previous technology preview](/_blog/_posts/2017-07-12-second-dotty-milestone-release.html) improved
stability and reliability:

 - substantial improvement of quality of generated code for pattern matching
 - improvements in VS Code IDE stability
 - support Windows in VS Code IDE
 - improved compatibility with scalac
 - initial support for reproducible builds

## What's in the 0.3.0-RC2 technology preview?
This technology preview further improves stability and reliability. Some highlighted PRs are:

 - IDE bug fixes:
 [#2986](https://github.com/lampepfl/dotty/pull/2986),
 [#2932](https://github.com/lampepfl/dotty/pull/2932),
 [#2885](https://github.com/lampepfl/dotty/pull/2885),
 [#2876](https://github.com/lampepfl/dotty/pull/2876),
 [#2870](https://github.com/lampepfl/dotty/pull/2870),
 [#2872](https://github.com/lampepfl/dotty/pull/2872) by [@odersky] and [@smarter].

## How can you try it out?
We ship with tools that help you try out the Dotty platform:

 - [IDE features for Visual Studio Code](https://docs.scala-lang.org/scala3/getting-started.html#using-vscode-with-metals)
 - [sbt support, including retro-compatibility with Scala 2](https://github.com/lampepfl/dotty-example-project)

You have several alternatives; use the `sbt-dotty` plugin, get a standalone
installation, or try it online on [Scastie].

### sbt
Using sbt 0.13.13 or newer, do:

```
sbt new lampepfl/dotty.g8
```

This will setup a new sbt project with Dotty as compiler. For more details on
using Dotty with sbt, see the
[example project](https://github.com/lampepfl/dotty-example-project).

### Standalone installation
Releases are available for download on the _Releases_
section of the Dotty repository:
[https://github.com/lampepfl/dotty/releases](https://github.com/lampepfl/dotty/releases)

We also provide a [homebrew](https://brew.sh/) package that can be installed by running:

```
brew install lampepfl/brew/dotty
```

In case you have already installed Dotty via brew, you should instead update it:

```
brew upgrade dotty
```

### Scastie
[Scastie], the online Scala playground, supports Dotty.
You can try it out there without installing anything.

## What are the next steps?
Over the coming weeks and months, we plan to work on the following topics:

 - [Add support for using Dotty generated classes with Scala 2.12](https://github.com/lampepfl/dotty/pull/2827)
 - [Add Language-level support for HMaps and HLists](https://github.com/lampepfl/dotty/pull/2199);
 - Upstream more optimizations from Dotty Linker
 - [Add support for existing in the same classpath with Scala 2.12](https://github.com/lampepfl/dotty/pull/2827)
 - [Add native Dotty REPL](https://github.com/lampepfl/dotty/pull/2991)

## Questions / Reporting Bugs
If you have questions or any sort of feedback, feel free to send us a message on our
[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please
[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new).

## Contributing
Thank you to all the contributors who made this release possible!

According to `git shortlog -sn --no-merges 0.2.0-RC1..0.3.0-RC2` these are:

```
   138  Martin Odersky
    36  Nicolas Stucki
    12  Guillaume Martres
     7  Dmitry Petrashko
     5  liu fengyun
     4  Allan Renucci
     4  Felix Mulder
     2  Lorand Szakacs
     1  Lukas Ciszewski
     1  Max Ovsiankin
     1  Lanny Ripple
     1  Serhii Pererva
     1  Georg Schmid
```

If you want to get your hands dirty with any of this, now is a good moment to get involved!
You can have a look at our [Getting Started page](https://dotty.epfl.ch/docs/contributing/getting-started.html),
our [Awesome Error Messages](http://scala-lang.org/blog/2016/10/14/dotty-errors.html) or some of
the simple [Dotty issues](https://github.com/lampepfl/dotty/issues?q=is%3Aissue+is%3Aopen+label%3Aexp%3Anovice).
They make perfect entry-points into hacking on the compiler.

We are looking forward to having you join the team of contributors.

## Library authors: Join our community build
Dotty now has a set of libraries that are built against every nightly snapshot.
Currently this includes scalatest, squants and algebra.
Join our [community build](https://github.com/lampepfl/dotty-community-build)
to make sure that our regression suite includes your library.

To get started, see [https://github.com/lampepfl/dotty](https://github.com/lampepfl/dotty).

[Scastie]: https://scastie.scala-lang.org/?target=dotty

[@odersky]: https://github.com/odersky
[@DarkDimius]: https://github.com/DarkDimius
[@smarter]: https://github.com/smarter
[@felixmulder]: https://github.com/felixmulder
[@nicolasstucki]: https://github.com/nicolasstucki
[@liufengyun]: https://github.com/liufengyun
[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain
[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain
[@biboudis]: https://github.com/biboudis
[@biboudis]: https://github.com/biboudis
[@allanrenucci]: https://github.com/allanrenucci


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.pentaho.di.plugins</groupId>
    <artifactId>file-open-save-new</artifactId>
    <version>9.1.0.0-SNAPSHOT</version>
  </parent>

  <artifactId>file-open-save-new-api</artifactId>
  <version>9.1.0.0-SNAPSHOT</version>
  <packaging>bundle</packaging>

  <name>PDI File Open and Save New Plugin API</name>

  <dependencies>
    <dependency>
      <groupId>pentaho-kettle</groupId>
      <artifactId>kettle-ui-swt</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>bundle</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <includes>
            <include>**/*</include>
          </includes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.4.0</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Export-Package>
              org.pentaho.di.plugins.fileopensave.api.file,
              org.pentaho.di.plugins.fileopensave.api.providers,
              org.pentaho.di.plugins.fileopensave.api.providers.exception
            </Export-Package>
            <Import-Package>org.pentaho.di.osgi, *</Import-Package>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


text:
.class Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;
.super Landroid/content/BroadcastReceiver;
.source "WaterLockScreen.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/baidu/internal/keyguard/water/WaterLockScreen;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "MyBroadcastReceiver"
.end annotation

# instance fields
.field private mHandler:Landroid/os/Handler;

# direct methods
.method constructor <init>(Landroid/os/Handler;)V
    .locals 0
    .parameter "handler"

    .prologue
    .line 418
    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    .line 419
    iput-object p1, p0, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->mHandler:Landroid/os/Handler;

    .line 420
    return-void
.end method

.method private getMissCallCount(Landroid/content/Context;)I
    .locals 10
    .parameter "context"

    .prologue
    .line 444
    const/4 v8, 0x0

    .line 445
    .local v8, missCallCount:I
    const/4 v6, 0x0

    .line 447
    .local v6, c:Landroid/database/Cursor;
    :try_start_0
    const-string v3, "type=? and new=?"

    .line 448
    .local v3, selection:Ljava/lang/String;
    const/4 v0, 0x2

    new-array v4, v0, [Ljava/lang/String;

    const/4 v0, 0x0

    const/4 v1, 0x3

    invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v1

    aput-object v1, v4, v0

    const/4 v0, 0x1

    const/4 v1, 0x1

    invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v1

    aput-object v1, v4, v0

    .line 451
    .local v4, selectionArgs:[Ljava/lang/String;
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    sget-object v1, Landroid/provider/CallLog$Calls;->CONTENT_URI:Landroid/net/Uri;

    const/4 v2, 0x3

    new-array v2, v2, [Ljava/lang/String;

    const/4 v5, 0x0

    const-string v9, "number"

    aput-object v9, v2, v5

    const/4 v5, 0x1

    const-string v9, "type"

    aput-object v9, v2, v5

    const/4 v5, 0x2

    const-string v9, "new"

    aput-object v9, v2, v5

    const-string v5, "date DESC"

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 454
    if-eqz v6, :cond_0

    .line 455
    invoke-interface {v6}, Landroid/database/Cursor;->getCount()I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v8

    .line 460
    :cond_0
    if-eqz v6, :cond_1

    .line 461
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 464
    .end local v3           #selection:Ljava/lang/String;
    .end local v4           #selectionArgs:[Ljava/lang/String;
    :cond_1
    :goto_0
    const-string v0, "WaterLockScreen"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "miss call count:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v8}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 465
    return v8

    .line 457
    :catch_0
    move-exception v7

    .line 458
    .local v7, e:Ljava/lang/Exception;
    :try_start_1
    const-string v0, "WaterLockScreen"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "getMissedCallCount():Error happens in -"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1, v7}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 460
    if-eqz v6, :cond_1

    .line 461
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    goto :goto_0

    .line 460
    .end local v7           #e:Ljava/lang/Exception;
    :catchall_0
    move-exception v0

    if-eqz v6, :cond_2

    .line 461
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    :cond_2
    throw v0
.end method

.method private getMissMsgCount(Landroid/content/Context;)I
    .locals 10
    .parameter "context"

    .prologue
    .line 469
    const/4 v8, 0x0

    .line 470
    .local v8, missMsgCount:I
    const/4 v6, 0x0

    .line 472
    .local v6, c:Landroid/database/Cursor;
    :try_start_0
    const-string v0, "content://sms"

    invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    .line 474
    .local v1, uri:Landroid/net/Uri;
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const/4 v2, 0x0

    const-string v3, "read=0 AND type=1 AND thread_id IN (SELECT _id FROM threads)"

    const/4 v4, 0x0

    const/4 v5, 0x0

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 475
    if-eqz v6, :cond_0

    .line 476
    invoke-interface {v6}, Landroid/database/Cursor;->getCount()I

    move-result v8

    .line 477
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 478
    const/4 v6, 0x0

    .line 480
    :cond_0
    const-string v0, "content://mms"

    invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v1

    .line 482
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const/4 v2, 0x0

    const-string v3, "read=? AND m_type=? AND thread_id IN (SELECT _id FROM threads)"

    const/4 v4, 0x2

    new-array v4, v4, [Ljava/lang/String;

    const/4 v5, 0x0

    const-string v9, "0"

    aput-object v9, v4, v5

    const/4 v5, 0x1

    const-string v9, "132"

    aput-object v9, v4, v5

    const/4 v5, 0x0

    invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v6

    .line 485
    if-eqz v6, :cond_1

    .line 486
    invoke-interface {v6}, Landroid/database/Cursor;->getCount()I

    move-result v0

    add-int/2addr v8, v0

    .line 487
    invoke-interface {v6}, Landroid/database/Cursor;->close()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 488
    const/4 v6, 0x0

    .line 493
    :cond_1
    if-eqz v6, :cond_2

    .line 494
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    .line 497
    .end local v1           #uri:Landroid/net/Uri;
    :cond_2
    :goto_0
    const-string v0, "WaterLockScreen"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "miss msg count:"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v8}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 498
    return v8

    .line 490
    :catch_0
    move-exception v7

    .line 491
    .local v7, e:Ljava/lang/Exception;
    :try_start_1
    const-string v0, "WaterLockScreen"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "getMissSmsCount():Error happens in -"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 493
    if-eqz v6, :cond_2

    .line 494
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    goto :goto_0

    .line 493
    .end local v7           #e:Ljava/lang/Exception;
    :catchall_0
    move-exception v0

    if-eqz v6, :cond_3

    .line 494
    invoke-interface {v6}, Landroid/database/Cursor;->close()V

    :cond_3
    throw v0
.end method

# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 10
    .parameter "context"
    .parameter "intent"

    .prologue
    const/4 v9, 0x1

    const/4 v8, 0x0

    .line 424
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v0

    .line 425
    .local v0, action:Ljava/lang/String;
    const-string v7, "android.intent.action.BATTERY_CHANGED"

    invoke-virtual {v7, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_1

    .line 426
    const-string v7, "status"

    invoke-virtual {p2, v7, v9}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v6

    .line 427
    .local v6, status:I
    const-string v7, "plugged"

    invoke-virtual {p2, v7, v8}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v5

    .line 428
    .local v5, plugged:I
    const-string v7, "level"

    invoke-virtual {p2, v7, v8}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v3

    .line 429
    .local v3, level:I
    const-string v7, "health"

    invoke-virtual {p2, v7, v9}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v2

    .line 430
    .local v2, health:I
    iget-object v7, p0, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->mHandler:Landroid/os/Handler;

    const/16 v8, 0x67

    new-instance v9, Lcom/baidu/internal/keyguard/water/WaterLockScreen$BatteryStatus;

    invoke-direct {v9, v6, v3, v5, v2}, Lcom/baidu/internal/keyguard/water/WaterLockScreen$BatteryStatus;-><init>(IIII)V

    invoke-virtual {v7, v8, v9}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v4

    .line 431
    .local v4, msg:Landroid/os/Message;
    iget-object v7, p0, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->mHandler:Landroid/os/Handler;

    invoke-virtual {v7, v4}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    .line 441
    .end local v2           #health:I
    .end local v3           #level:I
    .end local v4           #msg:Landroid/os/Message;
    .end local v5           #plugged:I
    .end local v6           #status:I
    :cond_0
    :goto_0
    return-void

    .line 432
    :cond_1
    const-string v7, "com.baidu.keyguard.internal.SMS_MISS_UPDATED"

    invoke-virtual {v7, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_2

    .line 433
    invoke-direct {p0, p1}, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->getMissMsgCount(Landroid/content/Context;)I

    move-result v1

    .line 434
    .local v1, count:I
    iget-object v7, p0, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->mHandler:Landroid/os/Handler;

    const/16 v8, 0x65

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v9

    invoke-virtual {v7, v8, v9}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v4

    .line 435
    .restart local v4       #msg:Landroid/os/Message;
    iget-object v7, p0, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->mHandler:Landroid/os/Handler;

    invoke-virtual {v7, v4}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    goto :goto_0

    .line 436
    .end local v1           #count:I
    .end local v4           #msg:Landroid/os/Message;
    :cond_2
    const-string v7, "com.baidu.keyguard.internal.CALL_MISS_UPDATED"

    invoke-virtual {v7, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_0

    .line 437
    invoke-direct {p0, p1}, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->getMissCallCount(Landroid/content/Context;)I

    move-result v1

    .line 438
    .restart local v1       #count:I
    iget-object v7, p0, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->mHandler:Landroid/os/Handler;

    const/16 v8, 0x66

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v9

    invoke-virtual {v7, v8, v9}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v4

    .line 439
    .restart local v4       #msg:Landroid/os/Message;
    iget-object v7, p0, Lcom/baidu/internal/keyguard/water/WaterLockScreen$MyBroadcastReceiver;->mHandler:Landroid/os/Handler;

    invoke-virtual {v7, v4}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    goto :goto_0
.end method


text:
package com.libqa.web.controller;

import com.libqa.application.framework.ResponseData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

import static com.libqa.application.framework.ResponseData.createFailResult;

@Slf4j
@ControllerAdvice(annotations = RestController.class)
public class RestControllerAdvice {

    @ResponseBody
    @ExceptionHandler(RuntimeException.class)
    public ResponseData handleException(RuntimeException ex) {
        log.error("An error has occurred.", ex);
        return createFailResult();
    }

    @ExceptionHandler(AccessDeniedException.class)
    public void handleAccessDeniedException(AccessDeniedException ex) {
        Optional<AccessDeniedException> optional = Optional.ofNullable(ex);
        if (optional.isPresent()) {
            throw optional.get();
        }
    }
}


text:
package org.lukhnos.lucenestudy;

import org.apache.lucene.search.highlight.Encoder;

/**
 * A simplified version of Lucene's SimpleHTMLEncoder.
 *
 * This implementation only escapes three XML entity characters.
 */
public class MinimalHTMLEncoder implements Encoder {
  boolean newlineToBr = false;

  public void setNewlineToBr(boolean newlineToBr) {
    this.newlineToBr = newlineToBr;
  }

  @Override
  public String encodeText(String plainText) {
    if (plainText == null || plainText.length() == 0) {
      return "";
    }

    StringBuilder result = new StringBuilder(plainText.length());
    for (int index = 0; index < plainText.length(); index++) {
      char ch = plainText.charAt(index);

      switch (ch) {
        case '&':
          result.append("&");
          break;
        case '<':
          result.append("<");
          break;
        case '>':
          result.append(">");
          break;
        default:
          if (newlineToBr && ch == '\n') {
            result.append("<br>");
          } else {
            result.append(ch);
          }
      }
    }
    return result.toString();
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using RenderingLibrary.Content;
using Microsoft.Xna.Framework;

namespace RenderingLibrary.Graphics
{
    public class TextureFlipAnimation : IAnimation
    {
        #region Fields

        bool mLoops = true;
        double mTimeIntoAnimation;
        double mLastUpdate;

        #endregion

        #region Properties

        public bool Loops
        {
            get { return mLoops; }
            set { mLoops = value; }
        }

        double FrameLength
        {
            get
            {
                return .25f;
            }
        }

        public Texture2D CurrentTexture
        {
            get;
            private set;
        }

        public List<Texture2D> TextureList
        {
            get;
            private set;
        }

        public bool FlipHorizontal
        {
            get { return false; }
        }

        public bool FlipVertical
        {
            get { return false; }
        }

        double AnimationLength
        {
            get
            {
                return TextureList.Count * FrameLength;
            }
        }

        public Rectangle? SourceRectangle
        {
            get { return null; }
        }

        public int CurrentFrameIndex
        {
            get
            {
                int index = (int)(mTimeIntoAnimation / FrameLength);

                if (index > TextureList.Count - 1)
                {
                    index = TextureList.Count - 1;
                }
                return index;
            }
        }

        #endregion

        public static TextureFlipAnimation FromStringList(List<string> list, SystemManagers managers)
        {
            TextureFlipAnimation toReturn = new TextureFlipAnimation();

            foreach (string fileName in list)
            {
                toReturn.TextureList.Add(LoaderManager.Self.LoadContent<Texture2D>(fileName));
            }
            return toReturn;
        }

        public void AnimationActivity(double time)
        {
            mTimeIntoAnimation += time - mLastUpdate;
            mLastUpdate = time;
            while (mLoops && AnimationLength != 0 && mTimeIntoAnimation > AnimationLength)
            {
                mTimeIntoAnimation -= AnimationLength;
            }

            SetCurrentFrameFromTimeIntoAnimation();
        }

        private void SetCurrentFrameFromTimeIntoAnimation()
        {
            int index = CurrentFrameIndex;

            if (index != -1)
            {
                CurrentTexture = TextureList[index];
            }
        }

        public TextureFlipAnimation()
        {
            TextureList = new List<Texture2D>();
        }

    }
}


text:
/*****  I/O Service Driver Implementation  *****/

/***************************
 *****  Facility Name  *****
 ***************************/

#define FacilityName IOMServiceFacility

/******************************************
 *****  Header and Declaration Files  *****
 ******************************************/

/*****  System  *****/
#include "Vk.h"

/*****  Self  *****/
#include "IOMService.h"

/*****  Supporting *****/
#include "vfac.h"

#include "IOMStream.h"

#include "Vca_IListener.h"

#include "Vca_VBSConsumer.h"
#include "Vca_VBSProducer.h"

/***************************
 ***************************
 *****  Run Time Type  *****
 ***************************
 ***************************/

DEFINE_CONCRETE_RTT (IOMService);

/**************************
 **************************
 *****  Construction  *****
 **************************
 **************************/

IOMService::IOMService (
    Options const& rOptions, IListener *pListener
) : IOMDriver (rOptions), m_pListener (pListener), m_pIPipeSourceClient (this) {
}

/*************************
 *************************
 *****  Destruction  *****
 *************************
 *************************/

IOMService::~IOMService () {
    Close ();
}

/*******************
 *******************
 *****  Query  *****
 *******************
 *******************/

IOMChannelType IOMService::channelType () const {
    return IOMChannelType_Service;
}

int IOMService::getTcpNodelay (int* fOnOff) {
    *fOnOff = false;
    m_iStatus.MakeFailureStatus ();
    return -1;
}

/*********************
 *********************
 *****  Control  *****
 *********************
 *********************/

void IOMService::Close () {
    if (isClosing ())
	return;

//  Begin the close process, ...
    SetStateToClosing ();

//  ... and release resources:
    if (m_pListener) {
	m_pListener->Close ();
	m_pListener.clear ();
    }
}

int IOMService::EndTransmission () {
    m_iStatus.MakeFailureStatus ();
    return -1;
}

int IOMService::EndReception () {
    m_iStatus.MakeFailureStatus ();
    return -1;
}

int IOMService::SetTcpNodelay (int fOnOff) {
    m_iStatus.MakeFailureStatus ();
    return -1;
}

/*******************
 *******************
 *****  Input  *****
 *******************
 *******************/

void IOMService::OnData (
    Vca::IPipeSourceClient *pRole,
    Vca::VBSConsumer *pStdBSToPeer,
    Vca::VBSProducer *pStdBSToHere,
    Vca::VBSProducer *pErrBSToHere
) {
    m_pAcceptedStdBSToPeer.setTo (pStdBSToPeer);
    m_pAcceptedStdBSToHere.setTo (pStdBSToHere);
    m_pAcceptedErrBSToHere.setTo (pErrBSToHere);
    triggerAll ();
}

void IOMService::OnError (
    Vca::IClient *pRole, Vca::IError *pIError, VString const &rMessage
) {
    m_iStatus.MakeFailureStatus ();
    if (m_pListener) {
	m_pListener->Close ();
	m_pListener.clear ();
    }

    triggerAll ();
}

/*---------------------------------------------------------------------------
 *****  'GetConnection' Handler.
 *
 *  Arguments:
 *
 *  Returns:
 *	The address of the accepted connection or NULL if no connection
 *	was available to be accepted.
 *
 *****/
IOMDriver* IOMService::GetConnection () {
    if (m_pListener.isNil ())
	return NilOf (IOMDriver*);

    if (m_pAcceptedStdBSToHere.isNil () || m_pAcceptedStdBSToPeer.isNil ()) {
	m_iStatus.MakeBlockedStatus ();
	VReference<Vca::IPipeSourceClient> pRole;
	getRole (pRole);
	m_pListener->SupplyByteStreams (pRole, 1);
	return NilOf (IOMDriver*);
    }

    IOMStream *pStream = new IOMStream (m_iOptions, m_pAcceptedStdBSToHere, m_pAcceptedStdBSToPeer);
    m_pAcceptedErrBSToHere.clear ();
    m_pAcceptedStdBSToHere.clear ();
    m_pAcceptedStdBSToPeer.clear ();

    return pStream;
}

/*---------------------------------------------------------------------------
 *****  'GetByteCount' Handler.
 *
 *  Arguments:
 *	pHandle			- the handle used to access this driver.
 *				  Contains seek information.  Ignored by this
 *				  driver.
 *
 *  Returns:
 *	The number of bytes actually available for reading.  Always zero for this
 *	driver.
 *
 *****/
size_t IOMService::GetByteCount (IOMHandle const* Unused(pHandle)) {
    return 0;
}

/*---------------------------------------------------------------------------
 *****  'GetData' Handler.
 *
 *  Arguments:
 *	pHandle			- the handle used to access this driver.
 *				  Contains seek information.  Ignored by this
 *				  driver.
 *	pBuffer			- the address of the buffer to fill.
 *	cbMin			- the minimum number of bytes that must be
 *				  read.  No data is transferred and this
 *				  handler returns zero if at least 'cbMin'
 *				  bytes of data cannot be read.
 *	cbMax			- the maximum number of bytes that can be
 *				  read.
 *
 *  Returns:
 *	The actual number of bytes returned in '*pBuffer'.  Always zero for this
 *	driver.
 *
 *****/
size_t IOMService::GetData (
    IOMHandle const*		Unused(pHandle),
    void*			Unused(pBuffer),
    size_t			Unused(cbMin),
    size_t			Unused(cbMax)
)
{
    m_iStatus.MakeFailureStatus ();
    return 0;
}

/*---------------------------------------------------------------------------
 *****  'GetString' Handler.
 *
 *  Arguments:
 *	pHandle			- the handle used to access this driver.
 *				  Contains seek information.  Ignored by this
 *				  driver.
 *	cbMin			- the minimum number of bytes that must be
 *				  read.  No data is transferred and this
 *				  handler returns a failure code if at least
 *				  'cbMin' bytes of data cannot be read.
 *	cbMax			- the maximum number of bytes that can be
 *				  read.  If 'cbMax' is less than 'cbMin', all
 *				  currently available data will be read and
 *				  and returned.
 *	ppString		- the address of a 'char *' that will be set to
 *				  point a newly allocated string containing the
 *				  data read by this call.  The string will be
 *				  NULL terminated and must be freed by calling
 *				  'deallocate' on its address when it is no
 *				  longer needed.  '*ppString' is set to NULL if
 *				  no data was read.
 *	psString		- the length of the string returned in
 *				  '**ppString', exclusive of the terminating
 *				  NULL.
 *
 *  Returns:
 *	The driver status at the end of the call.  Always 'Failed' in this driver.
 *
 *****/
VkStatusType IOMService::GetString (
    IOMHandle const*		Unused(pHandle),
    size_t			Unused(cbMin),
    size_t			Unused(cbMax),
    char **			ppString,
    size_t *			psString
)
{
    *ppString = NilOf (char *);
    *psString = 0;

    m_iStatus.MakeFailureStatus ();
    return VkStatusType_Failed;
}

/*---------------------------------------------------------------------------
 *****  'GetLine' Handler.
 *
 *  Arguments:
 *	pHandle			- the handle used to access this driver.
 *				  Contains seek information.
 *	zPrompt			- the address of a NULL terminated string used
 *				  as an input prompt.  May be NULL if no prompt
 *				  is desired.
 *	ppLine			- the address of a 'char *' that will be set to
 *				  point a newly allocated string containing the
 *				  line read by this call.  The string will be
 *				  NULL terminated and must be freed by calling
 *				  'deallocate' on its address when it is no
 *				  longer needed.  '*ppLine' is set to NULL if
 *				  no data was read.
 *	psLine			- the length of the string returned in
 *				  '**ppLine', exclusive of the terminating
 *				  NULL.
 *
 *  Returns:
 *	The driver status at the end of the call.  Always 'Failed' in this driver.
 *
 *****/
VkStatusType IOMService::GetLine (
    IOMHandle const*		Unused(pHandle),
    char const*			Unused(zPrompt),
    char**			ppLine,
    size_t *			psLine
)
{
    *ppLine = NilOf (char *);
    *psLine = 0;

    m_iStatus.MakeFailureStatus ();
    return VkStatusType_Failed;
}

/********************
 ********************
 *****  Output  *****
 ********************
 ********************/

/*******************
 *****  Flush  *****
 *******************/

bool IOMService::PutBufferedData () {
    return true;
}

/*****************
 *****  Raw  *****
 *****************/

size_t IOMService::PutData (
    IOMHandle const* Unused(pHandle), void const* Unused(pBuffer), size_t Unused(sBuffer)
) {
    return (size_t)0;
}

/***********************
 *****  Character  *****
 ***********************/

size_t IOMService::PutString (char const* Unused(string)) {
    return (size_t)0;
}

size_t IOMService::VPrint (
    size_t Unused(sData), char const* Unused(pFormat), va_list Unused(pFormatArguments)
) {
    return (size_t)0;
}

/*********************************
 *********************************
 *****  Facility Definition  *****
 *********************************
 *********************************/

FAC_DefineFacility {
    switch (FAC_RequestTypeField) {
    FAC_FDFCase_FacilityIdAsString (IOMService);
    FAC_FDFCase_FacilityDescription ("I/O Service Driver");
    default:
        break;
    }
}


text:
package clients

import (
	"fmt"
	"time"

	etcd "github.com/coreos/etcd/clientv3"
	"github.com/pkg/errors"
	"golang.org/x/net/context"
)

// EtcdInterface defines etcd methods that are used in the project to enable mocking
type EtcdInterface interface {
	// Close shuts down the client's etcd connections.
	Close() error

	// Put puts a key-value pair into etcd.
	// Note that key,value can be plain bytes array and string is
	// an immutable representation of that bytes array.
	// To get a string of bytes, do string([]byte(0x10, 0x20)).
	Put(ctx context.Context, key, val string, opts ...etcd.OpOption) (*etcd.PutResponse, error)

	// Get retrieves keys.
	// By default, Get will return the value for "key", if any.
	// When passed WithRange(end), Get will return the keys in the range [key, end).
	// When passed WithFromKey(), Get returns keys greater than or equal to key.
	// When passed WithRev(rev) with rev > 0, Get retrieves keys at the given revision;
	// if the required revision is compacted, the request will fail with ErrCompacted .
	// When passed WithLimit(limit), the number of returned keys is bounded by limit.
	// When passed WithSort(), the keys will be sorted.
	Get(ctx context.Context, key string, opts ...etcd.OpOption) (*etcd.GetResponse, error)

	// Watch watches on a key or prefix. The watched events will be returned
	// through the returned channel.
	// If the watch is slow or the required rev is compacted, the watch request
	// might be canceled from the server-side and the chan will be closed.
	// 'opts' can be: 'WithRev' and/or 'WithPrefix'.
	Watch(ctx context.Context, key string, opts ...etcd.OpOption) etcd.WatchChan

	// Delete deletes a key, or optionally using WithRange(end), [key, end).
	Delete(ctx context.Context, key string, opts ...etcd.OpOption) (*etcd.DeleteResponse, error)
}

var _ EtcdInterface = (*etcd.Client)(nil)

const (
	dialTimeout = 5 * time.Second
)

// NewEtcdClient initializes an etcd client
func NewEtcdClient(endpoints []string) (*etcd.Client, error) {
	//TODO: attach a lease TTL
	if len(endpoints) == 0 {
		return nil, fmt.Errorf("etcd endpoints cannot be empty")
	}
	etcd, err := etcd.New(etcd.Config{
		Endpoints:   endpoints,
		DialTimeout: dialTimeout,
	})

	if err != nil {
		return nil, errors.Wrapf(err, "Etcd connection error connecting to '%v'", endpoints)
	}

	return etcd, nil
}


text:
package org.dcm4chee.web.war.tc.imageview;

import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.WebComponent;
import org.apache.wicket.markup.html.image.resource.LocalizedImageResource;
import org.apache.wicket.model.IModel;
import org.dcm4chee.icons.ImageManager;
import org.dcm4chee.web.war.common.WadoImage;
import org.dcm4chee.web.war.folder.delegate.WADODelegate;

/**
 * @author Bernhard Ableitinger <bernhard.ableitinger@agfa.com>
 * @version $Revision$ $Date$
 * @since Nov 30, 2011
 */
public class TCWadoImage extends WebComponent
{
        private static final long serialVersionUID = 1L;

        private TCWadoImageSize requestedSize;
        private TCWadoImageSize renderedSize;

        private LocalizedImageResource emptyImage;

        public TCWadoImage(final String id, IModel<TCImageViewImage> model, TCWadoImageSize requestedSize, TCWadoImageSize renderedSize) {
            super(id, model);
            setOutputMarkupId(true);
            this.requestedSize = requestedSize;
            this.renderedSize = renderedSize;
            this.emptyImage = new LocalizedImageResource(this);
            this.emptyImage.setResourceReference(ImageManager.IMAGE_TC_IMAGE_PLACEHOLDER);
        }

        public TCWadoImage(final String id, IModel<TCImageViewImage> model, TCWadoImageSize size) {
            this(id, model, size, size);
        }

        public TCWadoImage(final String id, IModel<TCImageViewImage> model) {
            this(id, model, null, null);
        }

        @SuppressWarnings("unchecked")
        public IModel<TCImageViewImage> getModel()
        {
            return (IModel<TCImageViewImage>) getDefaultModel();
        }

        public TCWadoImageSize getRequestedSize()
        {
            return requestedSize;
        }

        public TCWadoImageSize getRenderedSize()
        {
            return renderedSize;
        }

        /**
         * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
         */
        @Override
        protected void onComponentTag(final ComponentTag tag) {
                checkComponentTag(tag, "img");

                super.onComponentTag(tag);

                //set src-attribute
                if (isValid(getModel()))
                {
                    tag.put("src", getWadoUrl(requestedSize));
                }
                else
                {
                    emptyImage.setSrcAttribute(tag);
                }

                //set width attribute, if available
                if (renderedSize!=null)
                {
                    int width = renderedSize.getWidth();
                    int height = renderedSize.getHeight();
                    if (width>0)
                    {
                        tag.put("width", width);
                    }
                    if (height>0)
                    {
                        tag.put("height", height);
                    }
                }
        }

        /**
         * @see org.apache.wicket.Component#getStatelessHint()
         */
        @Override
        protected boolean getStatelessHint() {
                return false;
        }

        /**
         * @see org.apache.wicket.Component#onComponentTagBody(MarkupStream, ComponentTag)
         */
        @Override
        protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
        }

        protected final String getWadoUrl(TCWadoImageSize requestedSize)
        {
            TCImageViewImage image = getModel()!=null?getModel().getObject():null;

            if (image!=null)
            {
                return getWadoUrl(image.getSeries().getStudy().getStudyUID(),
                        image.getSeries().getSeriesUID(),
                        image.getInstanceUID(),
                        image.getFrameNumber(),
                        requestedSize);
            }

            return null;
        }

        public boolean isValid(IModel<TCImageViewImage> model)
        {
            if (model!=null)
            {
                TCImageViewImage image = model.getObject();

                if (image!=null)
                {
                    if (image.getClassUID()!=null && image.getInstanceUID()!=null &&
                        image.getSeries()!=null && image.getSeries().getStudy()!=null)
                    {
                        return WADODelegate.getInstance().getRenderType(
                            image.getClassUID()) == WADODelegate.IMAGE;
                    }
                }
            }
            return false;
        }

        public static String getWadoUrl(String stuid, String suid, String iuid)
        {
        	return getWadoUrl(stuid, suid, iuid, -1);
        }

        public static String getWadoUrl(String stuid, String suid, String iuid, int frameNumber)
        {
            return getWadoUrl(stuid, suid, iuid, frameNumber, null);
        }

        public static String getWadoUrl(String stuid, String suid, String iuid, int frameNumber, TCWadoImageSize requestedSize)
        {
            StringBuilder sb = new StringBuilder();
            sb.append(WadoImage.getDefaultWadoBaseUrl());
            if (sb.indexOf("?") == -1)
                sb.append("?requestType=WADO");
            sb.append("&studyUID=").append(stuid);
            sb.append("&seriesUID=").append(suid);
            sb.append("&objectUID=").append(iuid);

            if (frameNumber>0)
            {
            	sb.append("&frameNumber=").append(frameNumber);
            }

            if (requestedSize != null) {
                int width = requestedSize.getWidth();
                int height = requestedSize.getHeight();
                if (width>0)
                {
                    sb.append("&columns=").append(width);
                }
                if (height>0)
                {
                    sb.append("&rows=").append(height);
                }
            }

            return sb.toString();
        }
}