text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.

/**
 * This package contains the implementation classes for ContentModeratorClient.
 * You use the API to scan your content as it is generated. Content Moderator then processes your content and sends the results along with relevant information either back to your systems or to the built-in review tool. You can use this information to take decisions e.g. take it down, send to human judge, etc.
 When using the API, images need to have a minimum of 128 pixels and a maximum file size of 4MB.
 Text can be at most 1024 characters long.
 If the content passed to the text API or the image API exceeds the size limits, the API will return an error code that informs about the issue.
 This API is currently available in:
 * West US - westus.api.cognitive.microsoft.com
 * East US 2 - eastus2.api.cognitive.microsoft.com
 * West Central US - westcentralus.api.cognitive.microsoft.com
 * West Europe - westeurope.api.cognitive.microsoft.com
 * Southeast Asia - southeastasia.api.cognitive.microsoft.com .
 */
package com.microsoft.azure.cognitiveservices.vision.contentmoderator.implementation;

redpajama_set_name: RedPajamaGithub


text:
package com.fancypixel.spacebunny.vdevicedemo;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.skyfishjy.library.RippleBackground;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Calendar;

import io.spacebunny.SpaceBunny;
import io.spacebunny.vdevicedemo.R;

public class SendData extends AppCompatActivity implements SensorEventListener {

    private String code = "";
    private SpaceBunny.Client spaceBunny = null;
    private Handler handler;
    private SensorManager mSensorManager;
    private ArrayList<SensorEvent> sensor_data_list = new ArrayList<>();
    private long timestamp = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_send_data);

        code = getIntent().getStringExtra(Constants.CODE_EXTRA_INTENT);
        if (code.equals(""))
            finish();

        mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        handler = new Handler();

        findViewById(R.id.action_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

        final Thread sendthread = new Thread() {
            @Override
            public void run() {
                try {
                    while (true) {
                        sendData();
                        Thread.sleep(Constants.TIME_TO_SEND, 0);
                    }
                } catch (Exception ex) {
                    //ex.printStackTrace();
                }
            }
        };

        sendthread.setDaemon(true);

        new Thread() {
            @Override
            public void run() {
                try {
                    spaceBunny = new SpaceBunny.Client(Constants.DEVICE_KEY);
                    spaceBunny.connect(new SpaceBunny.OnConnectedListener() {
                        @Override
                        public void onConnected() throws SpaceBunny.ConnectionException {
                            handler.post(new Runnable() {
                                @Override
                                public void run() {
                                    showUI();
                                }
                            });
                            sendthread.start();
                            timestamp = Calendar.getInstance().getTimeInMillis();
                        }
                    });

                } catch (Exception e) {
                    try {
                        spaceBunny.close();
                    } catch (Exception ex) {
                        //ex.printStackTrace();
                    } finally {
                        finish();
                    }
                }
            }
        }.start();

    }

    public void showUI() {
        ((RippleBackground) findViewById(R.id.ripple_background)).startRippleAnimation();

        if (mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null)
            mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
        if (mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null)
            mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_NORMAL);
    }

    @Override
    public void onStop() {
        super.onStop();
        mSensorManager.unregisterListener(this);
        try {
            spaceBunny.close();
        } catch (Exception e) {
            //e.printStackTrace();
        }
    }

    @Override
    public void onSensorChanged(final SensorEvent event) {
        new Thread() {
            @Override
            public void run() {
                updateData(event);
            }
        }.start();
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {

    }

    public void updateData(SensorEvent event) {
        long new_time = Calendar.getInstance().getTimeInMillis();
        if ((timestamp + Constants.TIME_TO_UPDATE) < new_time) {
            timestamp = new_time;
            for(SensorEvent sensorEvent : sensor_data_list) {
                if (sensorEvent.sensor.getType() == event.sensor.getType()) {
                    sensor_data_list.remove(sensorEvent);
                    sensor_data_list.add(event);
                    return;
                }
            }
            sensor_data_list.add(event);
        }
    }

    public void sendData() {
        try {

            JSONObject data = new JSONObject();
            data.put(Constants.JSON_KEY_ID, code);
            data.put(Constants.JSON_KEY_TIME, Calendar.getInstance().getTimeInMillis());
            data.put(Constants.JSON_KEY_DEVICE_NAME, Build.MODEL);
            data.put(Constants.JSON_KEY_DEVICE_TYPE, Build.DEVICE);

            JSONArray sensor_data = new JSONArray();

            for (SensorEvent event : sensor_data_list) {
                JSONObject sensor = new JSONObject();
                sensor.put(Constants.JSON_KEY_SENSOR_NAME, "" + event.sensor.getType());
                sensor.put(Constants.JSON_KEY_SENSOR_VALUE_X, event.values[0]);
                sensor.put(Constants.JSON_KEY_SENSOR_VALUE_Y, event.values[1]);
                sensor.put(Constants.JSON_KEY_SENSOR_VALUE_Z, event.values[2]);
                sensor_data.put(sensor);
            }

            data.put(Constants.JSON_KEY_SENSOR, sensor_data);
            spaceBunny.publish("device_data", data.toString(), null, null);

        } catch (Exception e) {
            //e.printStackTrace();
            Thread.currentThread().interrupt();
        }
    }
}


text:
layout: default
title: EEE'17 - Site Map
meta: The site mape of EEE
keyword: electrical engineering conference, electronics conference, power systems conference, automation conference, circuits conference, control system conference, wireless network conference, robotics conference, electrical engineering, electronics, power systems, automation, circuits, control system, wireless network, robotics
---

The sitemap for the 3rd International Conference on Electrical Engineering and Electronics (EEE'17) are as follows:

Paper Submission

Program

Important Dates

Registration

Committee

Sponsors

Venue

Accommodation

Symposiums

Contact Us


text:
module Api
  class TagsController < BaseController
    def create_resource(type, _id, data)
      assert_id_not_specified(data, type)
      category_data = data.delete("category") { {} }
      category = fetch_category(category_data)
      unless category
        category_rep = category_data.map { |k, v| "#{k} = #{v}" }.join(', ')
        raise BadRequestError, "Could not find category with data #{category_rep}"
      end
      begin
        entry = category.add_entry(data)
        raise BadRequestError, entry.errors.full_messages.join(', ') unless entry.valid?
        entry.tag
      rescue => err
        raise BadRequestError, "Could not create a new tag - #{err}"
      end
    end

    def edit_resource(type, id, data)
      klass = collection_class(type)
      tag = resource_search(id, type, klass)
      entry = Classification.find_by_tag_id(tag.id)
      raise BadRequestError, "Failed to find tag/#{id} resource" unless entry

      if data["name"].present?
        tag.update_attribute(:name, Classification.name2tag(data["name"], entry.parent_id, TAG_NAMESPACE))
      end
      entry.update_attributes(data.except(*ID_ATTRS))
      entry.tag
    end

    def delete_resource(_type, id, _data = {})
      destroy_tag_and_classification(id)
      action_result(true, "tags id: #{id} deleting")
    rescue ActiveRecord::RecordNotFound
      raise
    rescue => err
      action_result(false, err.to_s)
    end

    private

    def fetch_category(data)
      category_id = parse_id(data, :categories)
      category_id ||= collection_class(:categories).find_by_name(data["name"]).try(:id) if data["name"]
      unless category_id
        raise BadRequestError, "Category id, href or name needs to be specified for creating a new tag resource"
      end
      Category.find_by_id(category_id)
    end

    def destroy_tag_and_classification(tag_id)
      entry_or_tag = Classification.find_by_tag_id(tag_id) || Tag.find(tag_id)
      entry_or_tag.destroy!
    end
  end
end


text:
package dan.dit.whatsthat.testsubject.shopping.sortiment;

import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.widget.TextView;

import dan.dit.whatsthat.R;
import dan.dit.whatsthat.riddle.types.PracticalRiddleType;
import dan.dit.whatsthat.testsubject.shopping.SubProduct;

/**
 * Created by daniel on 30.07.15.
 */
public class HintProduct extends SubProduct {
    private static final int STATE_SHORT_LENGTH = 15;
    private boolean mStateFullyVisible;
    private PracticalRiddleType mType;
    private int mHintNumber;
    private boolean mAlreadyRead;
    private int mDefaultTextColor;

    public HintProduct(PracticalRiddleType type, int hintNumber, boolean alreadyRead) {
        super(R.layout.hint_product);
        mType = type;
        mHintNumber = hintNumber;
        mAlreadyRead = alreadyRead;
    }

    public void setAlreadyRead(boolean alreadyRead) {
        mAlreadyRead = alreadyRead;
        setText();
    }

    @Override
    public void inflateView(LayoutInflater inflater) {
        super.inflateView(inflater);
        mDefaultTextColor = ((TextView) mView.findViewById(R.id.hint_text)).getCurrentTextColor();
        setText();
    }

    private void setText() {
        TextView view = ((TextView) mView.findViewById(R.id.hint_text));
        CharSequence text = mType.getRiddleHint(mView.getResources(), mHintNumber);
        if (!mAlreadyRead) {
            view.setTextColor(view.getResources().getColor(R.color.important_on_main_background));
            view.setText(R.string.article_hint_not_yet_read);
            return;
        } else if (TextUtils.isEmpty(text)) {
            view.setTextColor(Color.YELLOW);
            view.setText(R.string.article_hint_no_translation);
            return;
        }
        view.setTextColor(mDefaultTextColor);
        if (mStateFullyVisible || text.length() <= STATE_SHORT_LENGTH) {
            view.setText(text);
        } else {
            view.setText(text.subSequence(0, STATE_SHORT_LENGTH) + "...");
        }
    }

    @Override
    public void onClick() {
        if (hasNoView()) {
            return;
        }
        mStateFullyVisible = !mStateFullyVisible;
        setText();
    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using wojilu.Members.Users.Interface;
using wojilu.Members.Users.Domain;
using wojilu.Web.Mvc;
using wojilu.Members.Users.Service;

namespace wojilu.Common.Microblogs.Parser {

    public class MicroblogBinder : IMicroblogBinder {

        private List<User> _users = new List<User>();
        private List<String> _names = new List<String>();

        public IUserService userService { get; set; }

        public MicroblogBinder() {
            userService = new UserService();
        }

        public String GetLink( String userName ) {

            if (strUtil.IsNullOrEmpty( userName )) return "@";

            User u = userService.GetByName( userName.Trim() );
            if (u == null) return "@" + userName;

            if (_names.Contains( u.Name )==false) {
                _users.Add( u );
                _names.Add( u.Name );
            }

            // TODO 此处可配置,是指向用户空间,还是用户微博
            return string.Format( "@{0}", userName, Link.ToMember( u ) );
        }

        public String GetTagLink( String tag ) {

            String lnk = alink.ToTag( tag.Trim() );
            return string.Format( "#{0}#", tag.Trim(), lnk );
        }

        public String GetUrlLink( String url ) {
            return string.Format( "{0}", url.Trim() );
        }

        public List<User> GetValidUsers() {
            return _users;
        }

    }

}


text:
// <copyright file="BuildProviderViewModel{T1,T2}.cs" company="Logikfabrik">
//   Copyright (c) 2016-2018 anton(at)logikfabrik.se. Licensed under the MIT license.
// </copyright>

namespace Logikfabrik.Overseer.WPF.ViewModels
{
    using Caliburn.Micro;
    using EnsureThat;
    using Navigation;
    using Settings;

    /// <summary>
    /// The <see cref="BuildProviderViewModel{T1,T2}" /> class.
    /// </summary>
    /// <typeparam name="T1">The <see cref="ConnectionSettings" /> type.</typeparam>
    /// <typeparam name="T2">The <see cref="EditConnectionSettingsViewModel{T}" /> type.</typeparam>
    // ReSharper disable once InheritdocConsiderUsage
    public class BuildProviderViewModel<T1, T2> : PropertyChangedBase, IBuildProviderViewModel
        where T1 : ConnectionSettings
        where T2 : EditConnectionSettingsViewModel<T1>, new()
    {
        private readonly IEventAggregator _eventAggregator;
        private readonly INavigationMessageFactory<AddConnectionViewModel<T1, T2>> _navigationMessageFactory;

        /// <summary>
        /// Initializes a new instance of the <see cref="BuildProviderViewModel{T1,T2}" /> class.
        /// </summary>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="navigationMessageFactory">The navigation message factory.</param>
        /// <param name="providerName">The provider name.</param>
        // ReSharper disable once InheritdocConsiderUsage
        public BuildProviderViewModel(IEventAggregator eventAggregator, INavigationMessageFactory<AddConnectionViewModel<T1, T2>> navigationMessageFactory, string providerName)
        {
            Ensure.That(eventAggregator).IsNotNull();
            Ensure.That(navigationMessageFactory).IsNotNull();
            Ensure.That(providerName).IsNotNullOrWhiteSpace();

            _eventAggregator = eventAggregator;
            _navigationMessageFactory = navigationMessageFactory;
            ProviderName = providerName;
        }

        /// <summary>
        /// Gets the provider name.
        /// </summary>
        /// <value>
        /// The provider name.
        /// </value>
        public string ProviderName { get; }

        /// <summary>
        /// Navigates to the view to add connection.
        /// </summary>
        public void AddConnection()
        {
            var message = _navigationMessageFactory.Create();

            _eventAggregator.PublishOnUIThread(message);
        }
    }
}


text:
#include <Core/Datatypes/Field.h>
#include <Core/Algorithms/Fields/FieldData/CalculateLatVolGradientsAtNodes.h>

#include <Dataflow/Network/Ports/FieldPort.h>
#include <Dataflow/Network/Module.h>

namespace SCIRun {

/// @class CalculateLatVolGradientsAtNodes
/// @brief Compute the derivative of a scalar lattice and output it as a vector lattice.

class CalculateLatVolGradientsAtNodes : public Module
{
  public:
    CalculateLatVolGradientsAtNodes(GuiContext* ctx);
    virtual ~CalculateLatVolGradientsAtNodes() {}

    virtual void execute();

  private:
    SCIRunAlgo::CalculateLatVolGradientsAtNodesAlgo algo_;
};

DECLARE_MAKER(CalculateLatVolGradientsAtNodes)

CalculateLatVolGradientsAtNodes::CalculateLatVolGradientsAtNodes(GuiContext* ctx)
  : Module("CalculateLatVolGradientsAtNodes", ctx, Filter, "ChangeFieldData", "SCIRun")
{
  algo_.set_progress_reporter(this);
}

void
CalculateLatVolGradientsAtNodes::execute()
{
  FieldHandle input, output;
  get_input_handle("Input Field", input, true);

  if (inputs_changed_ || !oport_cached("Output Gradient"))
  {
    update_state(Executing);

    if (!(algo_.run(input,output))) return;
    send_output_handle("Output Gradient", output);
  }
}

} // End namespace SCIRun


text:
<?php

declare(strict_types=1);

namespace PH7\Test\Unit\Framework\Util;

use PH7\Framework\Registry\Registry;
use PH7\Framework\Translate\Lang;
use PHPUnit\Framework\TestCase;

final class LangTest extends TestCase
{
    protected function setUp(): void
    {
        new Lang; // Load "Lang" class
        Registry::getInstance()->lang = [];
    }

    public function testTranslate(): void
    {
        $sName = 'Pierre-Henry';
        $this->assertSame('Hello Pierre-Henry', t('Hello %0%', $sName));
    }

    public function testIsoCodeWithDefaultIsoCodePosition(): void
    {
        $sLocaleName = 'nl_NL';
        $sLangCode = Lang::getIsoCode($sLocaleName);

        $this->assertSame('nl', $sLangCode);
    }

    public function testIsoCodeWithFirstIsoCode(): void
    {
        $sLocaleName = 'en_US';
        $sLangCode = Lang::getIsoCode($sLocaleName, Lang::FIRST_ISO_CODE);

        $this->assertSame('en', $sLangCode);
    }

    public function testIsoCodeWithLastIsoCode(): void
    {
        $sLocaleName = 'en_US';
        $sLangCode = Lang::getIsoCode($sLocaleName, Lang::LAST_ISO_CODE);

        $this->assertSame('us', $sLangCode);
    }
}


text:
#import <iWorkImport/TSCH3DChartAnimation.h>

@interface TSCH3DChartAnimation (Pie)
- (box_e9f23397)pieDelayedLabelsRange;
@end


text:
    /**
     * @author mrdoob / http://mrdoob.com/
     */

var EventDispatcher = function () {
};

EventDispatcher.prototype = {

    constructor: EventDispatcher,

    addEventListener: function (type, listener) {

        if (this._listeners === undefined) this._listeners = {};

        var listeners = this._listeners;

        if (listeners[ type ] === undefined) {

            listeners[ type ] = [];

        }

        if (listeners[ type ].indexOf(listener) === -1) {

            listeners[ type ].push(listener);

        }

    },

    hasEventListener: function (type, listener) {

        if (this._listeners === undefined) return false;

        var listeners = this._listeners;

        if (listeners[ type ] !== undefined && listeners[ type ].indexOf(listener) !== -1) {

            return true;

        }

        return false;

    },

    removeEventListener: function (type, listener) {

        if (this._listeners === undefined) return;

        var listeners = this._listeners;
        var index = listeners[ type ].indexOf(listener);

        if (index !== -1) {

            listeners[ type ].splice(index, 1);

        }

    },

    dispatchEvent: function (event) {

        if (this._listeners === undefined) return;

        var listeners = this._listeners;
        var listenerArray = listeners[ event.type ];

        if (listenerArray !== undefined) {

            event.target = this;

            for (var i = 0, l = listenerArray.length; i < l; i++) {

                listenerArray[ i ].call(this, event);

            }

        }

    }

};

module.exports = EventDispatcher;


text:
package rescala.reactives

import rescala.core.Reactive

import scala.util.control.ControlThrowable

object RExceptions {
  object EmptySignalControlThrowable extends ControlThrowable
  class UnhandledFailureException(location: Reactive[_], cause: Throwable) extends RuntimeException(s"a failure was observed but not handled by: $location", cause)
}


text:
package com.fenixinfotech.database.common.entities;

import javax.persistence.*;

@Entity
public class ChildEntity
{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    private String name;

    @ManyToOne
    @JoinColumn(name = "parentId")
    private ParentEntity parentEntity;

    public ChildEntity() {
    }

    @Override
    public String toString() {
        return "ChildEntity{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", parentEntity=" + parentEntity +
                '}';
    }

    public long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ParentEntity getParentEntity() {
        return parentEntity;
    }

    public void setParentEntity(ParentEntity parentEntity) {
        this.parentEntity = parentEntity;
    }
}


text:
package io.pravega.test.integration;

import io.pravega.client.ByteStreamClientFactory;
import io.pravega.client.ClientConfig;
import io.pravega.client.admin.StreamManager;
import io.pravega.client.admin.impl.StreamManagerImpl;
import io.pravega.client.byteStream.ByteStreamReader;
import io.pravega.client.byteStream.ByteStreamWriter;
import io.pravega.client.byteStream.impl.ByteStreamClientImpl;
import io.pravega.client.connection.impl.ConnectionFactory;
import io.pravega.client.connection.impl.ConnectionPool;
import io.pravega.client.connection.impl.ConnectionPoolImpl;
import io.pravega.client.connection.impl.SocketConnectionFactoryImpl;
import io.pravega.client.segment.impl.SegmentInputStreamFactoryImpl;
import io.pravega.client.segment.impl.SegmentMetadataClientFactoryImpl;
import io.pravega.client.segment.impl.SegmentOutputStreamFactoryImpl;
import io.pravega.client.segment.impl.SegmentTruncatedException;
import io.pravega.client.stream.StreamConfiguration;
import io.pravega.client.stream.impl.PendingEvent;
import io.pravega.common.io.StreamHelpers;
import io.pravega.test.common.AssertExtensions;
import io.pravega.test.common.LeakDetectorTestSuite;
import java.io.IOException;
import java.util.Arrays;
import lombok.Cleanup;
import lombok.SneakyThrows;
import lombok.val;
import lombok.extern.slf4j.Slf4j;
import org.junit.ClassRule;
import org.junit.Test;
import org.mockito.Mockito;

import static io.pravega.test.common.AssertExtensions.assertThrows;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@Slf4j
public class ByteStreamTest extends LeakDetectorTestSuite {

    @ClassRule
    public static final PravegaResource PRAVEGA = new PravegaResource();

    @Test(timeout = 30000)
    public void readWriteTest() throws IOException {
        String scope = "ByteStreamTest";
        String stream = "readWriteTest";

        StreamConfiguration config = StreamConfiguration.builder().build();
        @Cleanup
        StreamManager streamManager = new StreamManagerImpl(PRAVEGA.getLocalController(), Mockito.mock(ConnectionPool.class));
        // create a scope
        Boolean createScopeStatus = streamManager.createScope(scope);
        log.info("Create scope status {}", createScopeStatus);
        // create a stream
        Boolean createStreamStatus = streamManager.createStream(scope, stream, config);
        log.info("Create stream status {}", createStreamStatus);
        @Cleanup
        ByteStreamClientFactory client = createClientFactory(scope);

        byte[] payload = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
        byte[] readBuffer = new byte[10];

        @Cleanup
        ByteStreamWriter writer = client.createByteStreamWriter(stream);
        @Cleanup
        ByteStreamReader reader = client.createByteStreamReader(stream);

        AssertExtensions.assertBlocks(() -> reader.read(readBuffer), () -> writer.write(payload));
        assertArrayEquals(payload, readBuffer);
        Arrays.fill(readBuffer, (byte) 0);
        writer.write(payload);
        writer.write(payload);
        writer.write(payload);
        writer.closeAndSeal();
        assertEquals(10, reader.read(readBuffer));
        assertArrayEquals(payload, readBuffer);
        for (int i = 0; i < 10; i++) {
            assertEquals(i, reader.read());
        }
        Arrays.fill(readBuffer, (byte) -1);
        assertEquals(5, reader.read(readBuffer, 0, 5));
        assertEquals(5, reader.read(readBuffer, 5, 5));
        assertArrayEquals(payload, readBuffer);
        assertEquals(-1, reader.read());
        assertEquals(-1, reader.read(readBuffer));
    }

    @Test(timeout = 30000)
    public void readWriteTestTruncate() throws IOException {
        String scope = "ByteStreamTest";
        String stream = "readWriteTestTruncate";

        StreamConfiguration config = StreamConfiguration.builder().build();
        @Cleanup
        StreamManager streamManager = new StreamManagerImpl(PRAVEGA.getLocalController(), Mockito.mock(ConnectionPool.class));
        // create a scope
        Boolean createScopeStatus = streamManager.createScope(scope);
        log.info("Create scope status {}", createScopeStatus);
        // create a stream
        Boolean createStreamStatus = streamManager.createStream(scope, stream, config);
        log.info("Create stream status {}", createStreamStatus);
        @Cleanup
        ByteStreamClientFactory client = createClientFactory(scope);

        byte[] payload = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        byte[] readBuffer = new byte[10];

        @Cleanup
        ByteStreamWriter writer = client.createByteStreamWriter(stream);
        @Cleanup
        ByteStreamReader reader = client.createByteStreamReader(stream);
        // Verify reads and writes.
        AssertExtensions.assertBlocks(() -> reader.read(readBuffer), () -> writer.write(payload));
        assertArrayEquals(payload, readBuffer);

        //Truncate data before offset 5
        writer.truncateDataBefore(5);

        // seek to an invalid truncated offset and verify if truncation is successful.
        reader.seekToOffset(reader.fetchHeadOffset() - 1);
        assertThrows(SegmentTruncatedException.class, reader::read);

        // seek to the new head and verify if we are able to read the data.
        byte[] data = new byte[]{5, 6, 7, 8, 9};
        reader.seekToOffset(reader.fetchHeadOffset());
        byte[] readBuffer1 = new byte[5];
        int bytesRead = reader.read(readBuffer1);
        assertEquals(5, bytesRead);
        assertArrayEquals(readBuffer1, data);

        // create a new byteStream Reader.
        ByteStreamReader reader1 = client.createByteStreamReader(stream);
        // verify it is able to read
        readBuffer1 = new byte[5];
        bytesRead = reader1.read(readBuffer1);
        //verify if all the bytes are read.
        assertEquals(5, bytesRead);
        assertArrayEquals(readBuffer1, data);
    }

    @Test(timeout = 30000)
    public void readLargeWrite() throws IOException {
        String scope = "ByteStreamTest";
        String stream = "readLargeWrite";

        StreamConfiguration config = StreamConfiguration.builder().build();
        @Cleanup
        StreamManager streamManager = new StreamManagerImpl(PRAVEGA.getLocalController(), Mockito.mock(ConnectionPool.class));
        // create a scope
        Boolean createScopeStatus = streamManager.createScope(scope);
        log.info("Create scope status {}", createScopeStatus);
        // create a stream
        Boolean createStreamStatus = streamManager.createStream(scope, stream, config);
        log.info("Create stream status {}", createStreamStatus);
        @Cleanup
        ByteStreamClientFactory client = createClientFactory(scope);

        byte[] payload = new byte[2 * PendingEvent.MAX_WRITE_SIZE + 2];
        Arrays.fill(payload, (byte) 7);
        byte[] readBuffer = new byte[PendingEvent.MAX_WRITE_SIZE];
        Arrays.fill(readBuffer, (byte) 0);

        @Cleanup
        ByteStreamWriter writer = client.createByteStreamWriter(stream);
        @Cleanup
        ByteStreamReader reader = client.createByteStreamReader(stream);
        writer.write(payload);
        writer.closeAndSeal();
        assertEquals(PendingEvent.MAX_WRITE_SIZE, StreamHelpers.readAll(reader, readBuffer, 0, readBuffer.length));
        assertEquals(7, readBuffer[readBuffer.length - 1]);
        Arrays.fill(readBuffer, (byte) 0);
        assertEquals(PendingEvent.MAX_WRITE_SIZE, StreamHelpers.readAll(reader, readBuffer, 0, readBuffer.length));
        assertEquals(7, readBuffer[readBuffer.length - 1]);
        Arrays.fill(readBuffer, (byte) 0);
        assertEquals(2, reader.read(readBuffer));
        assertEquals(7, readBuffer[0]);
        assertEquals(7, readBuffer[1]);
        assertEquals(0, readBuffer[2]);
        assertEquals(-1, reader.read(readBuffer));
    }

    @Test(timeout = 30000)
    public void testBlockingRead() throws IOException {
        String scope = "ByteStreamTest";
        String stream = "testBlockingRead";

        StreamConfiguration config = StreamConfiguration.builder().build();
        @Cleanup
        StreamManager streamManager = new StreamManagerImpl(PRAVEGA.getLocalController(), Mockito.mock(ConnectionPool.class));
        // create a scope
        Boolean createScopeStatus = streamManager.createScope(scope);
        log.info("Create scope status {}", createScopeStatus);
        // create a stream
        Boolean createStreamStatus = streamManager.createStream(scope, stream, config);
        log.info("Create stream status {}", createStreamStatus);
        @Cleanup
        ByteStreamClientFactory client = createClientFactory(scope);

        byte[] payload = new byte[100];
        Arrays.fill(payload, (byte) 1);
        byte[] readBuffer = new byte[200];
        Arrays.fill(readBuffer, (byte) 0);

        @Cleanup
        ByteStreamWriter writer = client.createByteStreamWriter(stream);
        @Cleanup
        ByteStreamReader reader = client.createByteStreamReader(stream);
        AssertExtensions.assertBlocks(() -> {
            assertEquals(100, reader.read(readBuffer));
        }, () -> writer.write(payload));
        assertEquals(1, readBuffer[99]);
        assertEquals(0, readBuffer[100]);
        Arrays.fill(readBuffer, (byte) 0);
        writer.write(payload);
        assertEquals(100, reader.read(readBuffer));
        assertEquals(1, readBuffer[99]);
        assertEquals(0, readBuffer[100]);
        writer.write(payload);
        writer.write(payload);
        assertEquals(200, StreamHelpers.readAll(reader, readBuffer, 0, readBuffer.length));
        AssertExtensions.assertBlocks(() -> {
            assertEquals(100, reader.read(readBuffer));
        }, () -> writer.write(payload));
        writer.closeAndSeal();
        assertEquals(-1, reader.read());
    }

    @Test(timeout = 30000)
    public void testRecreateStream() {
        String scope = "ByteStreamTest";
        String stream = "testRecreateStream";

        StreamConfiguration config = StreamConfiguration.builder().build();
        @Cleanup
        StreamManager streamManager = new StreamManagerImpl(PRAVEGA.getLocalController(), Mockito.mock(ConnectionPool.class));
        // create a scope
        streamManager.createScope(scope);
        // create a stream
        assertTrue("Create stream failed", streamManager.createStream(scope, stream, config));
        // verify read and write.
        verifyByteClientReadWrite(scope, stream);
        // delete the stream and recreate
        assertTrue("Seal stream operation failed", streamManager.sealStream(scope, stream));
        assertTrue("Delete Stream operation failed", streamManager.deleteStream(scope, stream));
        assertTrue("Recreate stream failed", streamManager.createStream(scope, stream, config));
        // verify read and write.
        verifyByteClientReadWrite(scope, stream);
    }

    @SneakyThrows(IOException.class)
    private void verifyByteClientReadWrite(String scope, String stream) {
        @Cleanup
        ByteStreamClientFactory client = createClientFactory(scope);

        byte[] payload = new byte[100];
        Arrays.fill(payload, (byte) 1);
        byte[] readBuffer = new byte[200];
        Arrays.fill(readBuffer, (byte) 0);

        @Cleanup
        ByteStreamWriter writer = client.createByteStreamWriter(stream);
        @Cleanup
        ByteStreamReader reader = client.createByteStreamReader(stream);
        AssertExtensions.assertBlocks(() -> {
            assertEquals(100, reader.read(readBuffer));
        }, () -> writer.write(payload));
        assertEquals(1, readBuffer[99]);
        assertEquals(0, readBuffer[100]);
    }

    ByteStreamClientFactory createClientFactory(String scope) {
        ClientConfig config = ClientConfig.builder().build();
        ConnectionFactory connectionFactory = new SocketConnectionFactoryImpl(config);
        ConnectionPool pool = new ConnectionPoolImpl(config, connectionFactory);
        val inputStreamFactory = new SegmentInputStreamFactoryImpl(PRAVEGA.getLocalController(), pool);
        val outputStreamFactory = new SegmentOutputStreamFactoryImpl(PRAVEGA.getLocalController(), pool);
        val metaStreamFactory = new SegmentMetadataClientFactoryImpl(PRAVEGA.getLocalController(), pool);
        return new ByteStreamClientImpl(scope, PRAVEGA.getLocalController(), pool, inputStreamFactory, outputStreamFactory, metaStreamFactory);
    }

}


text:
<?php

/* BloggerBlogBundle::layout.html.twig */
class __TwigTemplate_1ff8c4854825c4d46fab59e032c63f5b2eb8434991977f089660d11ff63e10f4 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = $this->env->loadTemplate("::base.html.twig");

        $this->blocks = array(
            'stylesheets' => array($this, 'block_stylesheets'),
            'sidebar' => array($this, 'block_sidebar'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "::base.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_stylesheets($context, array $blocks = array())
    {
        // line 4
        echo "    ";
        $this->displayParentBlock("stylesheets", $context, $blocks);
        echo "
    <link href=\"";
        // line 5
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/bloggerblog/css/blog.css"), "html", null, true);
        echo "\" type=\"text/css\" rel=\"stylesheet\" />
    <link href=\"";
        // line 6
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/bloggerblog/css/sidebar.css"), "html", null, true);
        echo "\" type=\"text/css\" rel=\"stylesheet\" />
";
    }

    // line 9
    public function block_sidebar($context, array $blocks = array())
    {
        // line 10
        echo "    ";
        echo $this->env->getExtension('http_kernel')->renderFragment($this->env->getExtension('http_kernel')->controller("BloggerBlogBundle:Page:sidebar"));
        echo "
";
    }

    public function getTemplateName()
    {
        return "BloggerBlogBundle::layout.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  50 => 10,  41 => 6,  32 => 4,  29 => 3,  92 => 24,  83 => 20,  77 => 19,  71 => 18,  64 => 14,  60 => 13,  55 => 11,  47 => 9,  40 => 6,  37 => 5,  31 => 4,  28 => 3,);
    }
}


text:
import React from 'react'
import { render } from 'react-dom'

import { AppContainer } from 'react-hot-loader'
import App from './layouts/App'

const renderer = (Component) => {
  render(
    <AppContainer >
      <Component />
    </AppContainer>,
    document.getElementById('app')
  )
}

renderer(App)
if (module.hot)
  module.hot.accept('./layouts/App', () => {
    console.log('HOT RELOADING VIEW')
    renderer(require('./layouts/App').default)
  })


text:
package cn.learn.spring.batch.writer;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.WriteFailedException;
import org.springframework.beans.factory.annotation.Autowired;

import cn.learn.spring.batch.domain.Player;
import cn.learn.spring.batch.mapper.PlayerMapper;

public class SkipItemWriter  implements ItemWriter<Player> {
    private static Log log = LogFactory.getLog(PersonWriter.class);

	@Autowired
	public PlayerMapper playerMapper;

	private List<String> failingPlayer = new ArrayList<String>();

    @Override
	public void write(List<? extends Player> players) {
        for (Player player : players) {
            log.info("Processing: " + player.toString());
            if (this.failingPlayer.contains(player.getId())) {
            	throw new WriteFailedException("Something unexpected happened!");
            }
            Map<String,Object> map = new HashMap<String,Object>();
            map.put("id", player.getId());
            Player p = playerMapper.selectById(map);
            if (p != null && StringUtils.isNotBlank(p.getId())) {
                playerMapper.insertPlayer(player);
            }

		}
    }

	/**
	 * Public setter for the the player on which failure should occur.
	 *
	 */
	public void setFailingPlayer(List<String> failingPlayer) {
		this.failingPlayer = failingPlayer;
	}
}


text:
require 'torch'
require 'base'

params = {model_granularity = "character"}
ptb = require('data')

traindata = ptb.traindataset(20)
for k,v in pairs(ptb.vocab_map) do
  print(k .. " " .. v)
end


text:
angular.module('paperworkNotes').controller('ConstructorController',
  function($scope, $rootScope, $location, $routeParams, NetService, paperworkDbAllId) {
    if($rootScope.initDone) {
      return;
    }
    $rootScope.initDone = true;

    // We need to close popovers, else they will hang up if the ng-view is being switched.
    $('body').on('mousedown', function(e) {
      $('[data-toggle="popover"]').each(function() {
        if(!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
          $(this).popover('hide');
        }
      });
    });

    NetService.apiGet('/i18n', function(status, data) {
      if(status == 200) {
        $rootScope.i18n = data.response;
      }
    });

    $rootScope.modal = {
      'active': false,
      'next':   []
    };

    $rootScope.$on('paperworkModalVisible', function(ev, data) {
      $rootScope.modal.active = true;
    });

    $rootScope.$on('paperworkModalHidden', function(ev, data) {
      $rootScope.modal.active = false;

      if($rootScope.modal.next.length > 0) {
        if($rootScope.modal.next[0].callback) {
          $rootScope.modal.next[0].callback();
        }
        $rootScope.modal.next.splice(0, 1);
      }
    });

    $('#modalNotebook').on('hidden.bs.modal', function(e) {
      $(this).find('input[name="title"]').parents('.form-group').removeClass('has-warning');
    });

    var $modal = $('.modal');

    $modal.on('hidden.bs.modal', function(e) {
      $rootScope.$broadcast('paperworkModalHidden', e);
    });

     $rootScope.menuItemNotebookClass = function() {
       if($rootScope.getNotebookSelectedId() != paperworkDbAllId) {
         return '';
       } else {
         return 'disabled';
       }
     };

    $rootScope.menuItemNotebookClass = function() {
      if($rootScope.getNotebookSelectedId() != 0) {
        return '';
      } else {
        return 'disabled';
      }
    };

    $rootScope.menuItemNoteClass = function(availabilityType) {
      if($rootScope.getNoteSelectedId(true) != null && typeof $rootScope.notes != "undefined" && $rootScope.notes.length > 0) {
        if(availabilityType == 'single' && $rootScope.editMultipleNotes == true) {
          return 'disabled';
        } else {
          return '';
        }
      } else {
        return 'disabled';
      }
    };

    $rootScope.getVersionSelectedId = function(asObject) {
      if(asObject === true) {
        return $rootScope.versionSelectedId;
      }
      return $rootScope.versionSelectedId.notebookId + "-" + $rootScope.versionSelectedId.noteId + "-" + $rootScope.versionSelectedId.versionId;
    };

    $rootScope.modalGeneric = function(modalId, modalData) {
      var callback = function(data) {
        $rootScope.modalMessageBox = data;
        $('#' + modalId).modal('show');
      };
      if($rootScope.modal.active === false) {
        callback(modalData);
      } else {
        $rootScope.modal.next.push({
          'id':       modalId,
          'callback': function() {
            callback(modalData);
          }
        });
      }
    };

    $rootScope.messageBox = function(messageBoxData) {
      $rootScope.modalGeneric('modalMessageBox', messageBoxData);
    };

    $rootScope.modalNotebookSelect = function(modalData) {
      $rootScope.modalGeneric('modalNotebookSelect', modalData);
    };

    $rootScope.modalUsersSelect = function(modalData){
      if (!('noteId' in modalData)) {
        $rootScope.modalGeneric('modalUsersNotebookSelect',modalData);
      }else{
        $rootScope.modalGeneric('modalUsersSelect',modalData);
      }
    };

  });


text:
/*
 * Module dependencies
 */

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

/**
 * Patient schema
 */

var PatientSchema = new Schema({
  name: {
    first: {type: String, default: ''},
    second: {type: String, default: ''},
    last: {type: String, default: ''},
  },
  pesel: {type: Number, default: null},
  birthdate: {type: Date, default: Date.now},
  email: {type: String, default: ''},
  occupation: {type: String, default: ''}
});

/**
 * Methods
 */

PatientSchema.method({

});

/**
 * Statics
 */

PatientSchema.static({

});

/**
 * Virtuals
 */

PatientSchema
  .virtual('name.full')
  .get(function () {
    return this.name.first + ' '
        + (this.name.second ? (this.name.second + ' ') : '')
        + this.name.last;
});

/**
 * Validations
 */
// validate empty first and last names (second name can be empty)
PatientSchema.path('name.first').validate(function (first) {
    return first && first.length > 0;
}, 'First name cannot be empty.');

PatientSchema.path('name.last').validate(function (last) {
    return last && last.length > 0;
}, 'Last name cannot be empty.');

// validate PESEL length different than 11
PatientSchema.path('pesel').validate(function (num) {
    return num && num.toString().length === 11;
}, 'PESEL number has to be defined and be 11 digits long.');

// // validate empty address
// PatientSchema.path('address').validate(function (addr) {
//     return addr.length > 0;
// }, 'Address cannot be empty.');

// mongoose.model('Patient', PatientSchema);

/**
 * Register model
 */

mongoose.model('Patient', PatientSchema);


text:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class JumpTime : MonoBehaviour
{

    public int levelCount = 1;

    public float jTime;

    float timer;

    public Button jumpButton;

    private Slider jumpSlider;

    public Material spaceMat1;

    // Use this for initialization
    void Start()
    {
        jumpSlider = GameObject.Find("Jump Slider").GetComponent<Slider>();

        jumpButton.gameObject.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {

        timer += Time.fixedDeltaTime;

        jumpSlider.value = timer;

        //timer += Time.fixedDeltaTime;

        if (timer <= jTime)
        {
            jumpButton.gameObject.SetActive(false);

           // jumpSlider.value = timer;

        }
        else
        {
            //print("Jump"

            jumpButton.gameObject.SetActive(true);

        }

        //print(timer);

    }

    public void JumpClick()
    {
        levelCount++;

        jumpSlider.value = 0;

        timer = 0;

        if (levelCount == 2)
        {
            RenderSettings.skybox = spaceMat1;
        }

        if (levelCount == 3)
        {
            Application.LoadLevel(2);
        }

    }
}


text:
package es.ucm.fdi.iw.validation;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import es.ucm.fdi.iw.model.Medico;

public class MedicoForm {

	//Estado inicial 0 (Validacion)
	private final int estado=0;
	//Role del usuario
	private final String role="MED";

	//Variables de entrada que validar
	@NotEmpty(message = Patrones.menVacio)
	@Pattern(regexp = Patrones.textoEspecial ,message = Patrones.menTextoEspecial)
	private String nombre;

	@NotEmpty(message = Patrones.menVacio)
	@Pattern(regexp = Patrones.textoEspecial ,message = Patrones.menTextoEspecial)
	private String apellidos;

	@NotEmpty(message = Patrones.menVacio)
	@Email(message = Patrones.menEmail)
	private String email;

	@NotEmpty(message = Patrones.menVacio)
	@Pattern(regexp = "[0-9]*",message = Patrones.menNumero)
	@Size(min=9,max=9,message = Patrones.menTelefono)
	private String telefono;

	@NotEmpty(message = Patrones.menVacio)
	@Pattern(regexp = Patrones.usuario ,message = Patrones.menUsuario)
	private String usuario;

	@Size(min=4,max=8,message = Patrones.menContrasenia)
	@Pattern(regexp = Patrones.usuario ,message = Patrones.menUsuario)
	private String contrasenia;

	@Size(min=4,max=8,message = Patrones.menContrasenia)
	@Pattern(regexp = Patrones.usuario ,message = Patrones.menUsuario)
	private String contraseniaRep;

	@NotEmpty(message = Patrones.menVacio)
	@Pattern(regexp = Patrones.numColegiado,message = Patrones.menNumColegiado)
	private String numColMedico;

	@NotEmpty(message = Patrones.menVacio)
	@Pattern(regexp = Patrones.textoEspecial ,message = Patrones.menTextoEspecial)
	private String centroTrabajo;

	//Devuelve un medico con los datos extraidos del form
	public Medico getMedico()
	{
		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
		Medico medico= new Medico();
		//Datos genericos
		medico.setNombre(nombre);
		medico.setApellidos(apellidos);
		medico.setTelefono(telefono);
		medico.setEmail(email);
		//Datos usuario y estado y role
		medico.setRole(role);
		medico.setEstado(estado);
		medico.setUsuario(usuario);
		medico.setContrasenia(passwordEncoder.encode(contrasenia));
		//Datos especificos
		medico.setNumColMedico(numColMedico);
		medico.setCentroTrabajo(centroTrabajo);
		return medico;
	}

	//Getters y setters
	public String getNombre() {
		return nombre;
	}
	public void setNombre(String nombre) {
		this.nombre = nombre;
	}
	public String getApellidos() {
		return apellidos;
	}
	public void setApellidos(String apellidos) {
		this.apellidos = apellidos;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getTelefono() {
		return telefono;
	}
	public void setTelefono(String telefono) {
		this.telefono = telefono;
	}
	public String getUsuario() {
		return usuario;
	}
	public void setUsuario(String usuario) {
		this.usuario = usuario;
	}
	public String getContrasenia() {
		return contrasenia;
	}
	public void setContrasenia(String contrasenia) {
		this.contrasenia = contrasenia;
	}
	public String getcontraseniaRep() {
		return contraseniaRep;
	}
	public void setcontraseniaRep(String contraseniaRep) {
		this.contraseniaRep = contraseniaRep;
	}
	public String getNumColMedico() {
		return numColMedico;
	}
	public void setNumColMedico(String numColMedico) {
		this.numColMedico = numColMedico;
	}
	public String getCentroTrabajo() {
		return centroTrabajo;
	}
	public void setCentroTrabajo(String centroTrabajo) {
		this.centroTrabajo = centroTrabajo;
	}
}


text:
package org.eclipse.rdf4j.rio.nquads;

import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;

import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.rio.AbstractParserHandlingTest;
import org.eclipse.rdf4j.rio.RDFParser;
import org.eclipse.rdf4j.rio.RDFWriter;

/**
 * Test for error handling by N-Quads Parser.
 *
 * @author Peter Ansell
 */
public class NQuadsHandlingTest extends AbstractParserHandlingTest {

	@Override
	protected InputStream getRDFLangStringWithNoLanguageStream(Model model) throws Exception {
		InputStream RDFLangStringWithNoLanguageStatements = new FileInputStream(
				"src/test/resources/testcases/nquads/nquads-RDF-langString-no-language-test.nq");
		return RDFLangStringWithNoLanguageStatements;
	}

	@Override
	protected RDFParser getParser() {
		return new NQuadsParser();
	}

	@Override
	protected RDFWriter createWriter(OutputStream output) {
		return new NQuadsWriter(output);
	}
}


text:
<?xml version="1.0"?>
<!DOCTYPE dia:diagram [
<!ELEMENT dia:diagram (dia:diagramdata, (dia:layer)*) >
<!ATTLIST dia:diagram
          xmlns:dia CDATA #FIXED "http://www.lysator.liu.se/~alla/dia/">

<!ELEMENT dia:diagramdata (dia:attribute)* >

<!ELEMENT dia:layer (dia:object | dia:group)*>
<!ATTLIST dia:layer
   dia:name CDATA #REQUIRED
   dia:visible (true|false) #REQUIRED >

<!ELEMENT dia:object ((dia:attribute)*, dia:connections?)>
<!ATTLIST dia:object
   dia:type CDATA #REQUIRED
   dia:version NMTOKEN #REQUIRED
   dia:id ID #REQUIRED >

<!ELEMENT dia:connections (dia:connection)*>

<!ELEMENT dia:connection EMPTY>
<!ATTLIST dia:connection
   dia:handle NMTOKEN #REQUIRED
   dia:to IDREF #REQUIRED
   dia:connection NMTOKEN #REQUIRED>

<!ELEMENT dia:group (dia:object | dia:group)*>

<!ELEMENT dia:attribute (dia:composite | dia:int | dia:enum | dia:real | dia:boolean |
                     dia:color | dia:point | dia:rectangle | dia:string | dia:font)*>
<!ATTLIST dia:attribute  dia:name CDATA #REQUIRED >

<!ELEMENT dia:composite (dia:attribute)*>
<!ATTLIST dia:composite  dia:type CDATA #IMPLIED>

<!ELEMENT dia:int EMPTY>
<!ATTLIST dia:int  dia:val NMTOKEN #REQUIRED>

<!ELEMENT dia:enum EMPTY>
<!ATTLIST dia:enum  dia:val NMTOKEN #REQUIRED>

<!ELEMENT dia:real EMPTY>
<!ATTLIST dia:real  dia:val CDATA #REQUIRED>

<!ELEMENT dia:boolean EMPTY>
<!ATTLIST dia:boolean  dia:val (true|false) #REQUIRED>

<!ELEMENT dia:color EMPTY>
<!ATTLIST dia:color  dia:val CDATA #REQUIRED>

<!ELEMENT dia:point EMPTY>
<!ATTLIST dia:point  dia:val CDATA #REQUIRED>

<!ELEMENT dia:rectangle EMPTY>
<!ATTLIST dia:rectangle  dia:val CDATA #REQUIRED>

<!ELEMENT dia:string EMPTY>
<!ATTLIST dia:string  dia:val CDATA #IMPLIED>

<!ELEMENT dia:font EMPTY>
<!ATTLIST dia:font dia:name CDATA #REQUIRED>
]>

<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
  <dia:diagramdata>
    <dia:attribute dia:name="background">
      <dia:color dia:val="#ffffff"/>
    </dia:attribute>
  </dia:diagramdata>
  <dia:layer dia:name="Background" dia:visible="true">
    <dia:object dia:type="Standard - Line" dia:version="0" dia:id="O0">
      <dia:attribute dia:name="obj_pos">
        <dia:point dia:val="1.95,6.85"/>
      </dia:attribute>
      <dia:attribute dia:name="obj_bb">
        <dia:rectangle dia:val="1.9,6.8;11,8.55"/>
      </dia:attribute>
      <dia:attribute dia:name="conn_endpoints">
        <dia:point dia:val="1.95,6.85"/>
        <dia:point dia:val="10.95,8.5"/>
      </dia:attribute>
      <dia:attribute dia:name="line_color">
        <dia:color dia:val="#000000"/>
      </dia:attribute>
      <dia:attribute dia:name="line_width">
        <dia:real dia:val="0.1"/>
      </dia:attribute>
      <dia:attribute dia:name="line_style">
        <dia:enum dia:val="0"/>
      </dia:attribute>
      <dia:attribute dia:name="start_arrow">
        <dia:enum dia:val="0"/>
      </dia:attribute>
      <dia:attribute dia:name="end_arrow">
        <dia:enum dia:val="0"/>
      </dia:attribute>
      <dia:connections>
        <dia:connection dia:handle="1" dia:to="O2" dia:connection="3"/>
      </dia:connections>
    </dia:object>
    <dia:object dia:type="Standard - Text" dia:version="0" dia:id="O1">
      <dia:attribute dia:name="obj_pos">
        <dia:point dia:val="4.8,4.75"/>
      </dia:attribute>
      <dia:attribute dia:name="obj_bb">
        <dia:rectangle dia:val="2.579,3.96359;7.021,4.96359"/>
      </dia:attribute>
      <dia:attribute dia:name="text">
        <dia:composite dia:type="text">
          <dia:attribute dia:name="string">
            <dia:string dia:val="sdfsdfg"/>
          </dia:attribute>
          <dia:attribute dia:name="font">
            <dia:font dia:name="Courier"/>
          </dia:attribute>
          <dia:attribute dia:name="height">
            <dia:real dia:val="1"/>
          </dia:attribute>
          <dia:attribute dia:name="pos">
            <dia:point dia:val="4.8,4.75"/>
          </dia:attribute>
          <dia:attribute dia:name="color">
            <dia:color dia:val="#000000"/>
          </dia:attribute>
          <dia:attribute dia:name="alignment">
            <dia:enum dia:val="1"/>
          </dia:attribute>
        </dia:composite>
      </dia:attribute>
    </dia:object>
    <dia:object dia:type="Standard - Box" dia:version="0" dia:id="O2">
      <dia:attribute dia:name="obj_pos">
        <dia:point dia:val="10.95,7.5"/>
      </dia:attribute>
      <dia:attribute dia:name="obj_bb">
        <dia:rectangle dia:val="10.9,7.45;13.05,9.55"/>
      </dia:attribute>
      <dia:attribute dia:name="elem_corner">
        <dia:point dia:val="10.95,7.5"/>
      </dia:attribute>
      <dia:attribute dia:name="elem_width">
        <dia:real dia:val="2.05"/>
      </dia:attribute>
      <dia:attribute dia:name="elem_height">
        <dia:real dia:val="2"/>
      </dia:attribute>
      <dia:attribute dia:name="border_width">
        <dia:real dia:val="0.1"/>
      </dia:attribute>
      <dia:attribute dia:name="border_color">
        <dia:color dia:val="#000000"/>
      </dia:attribute>
      <dia:attribute dia:name="inner_color">
        <dia:color dia:val="#ffffff"/>
      </dia:attribute>
      <dia:attribute dia:name="line_style">
        <dia:enum dia:val="0"/>
      </dia:attribute>
    </dia:object>
  </dia:layer>
</dia:diagram>


text:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_UNDO_H
#define BITCOIN_UNDO_H

#include <coins.h>
#include <compressor.h>
#include <consensus/consensus.h>
#include <primitives/transaction.h>
#include <serialize.h>
#include <version.h>

/** Formatter for undo information for a CTxIn
 *
 *  Contains the prevout's CTxOut being spent, and its metadata as well
 *  (coinbase or not, height). The serialization contains a dummy value of
 *  zero. This is compatible with older versions which expect to see
 *  the transaction version there.
 */
struct TxInUndoFormatter
{
    template<typename Stream>
    void Ser(Stream &s, const Coin& txout) {
        ::Serialize(s, VARINT(txout.nHeight * uint32_t{2} + txout.fCoinBase ));
        if (txout.nHeight > 0) {
            // Required to maintain compatibility with older undo format.
            ::Serialize(s, (unsigned char)0);
        }
        ::Serialize(s, Using<TxOutCompression>(txout.out));
    }

    template<typename Stream>
    void Unser(Stream &s, Coin& txout) {
        uint32_t nCode = 0;
        ::Unserialize(s, VARINT(nCode));
        txout.nHeight = nCode >> 1;
        txout.fCoinBase = nCode & 1;
        if (txout.nHeight > 0) {
            // Old versions stored the version number for the last spend of
            // a transaction's outputs. Non-final spends were indicated with
            // height = 0.
            unsigned int nVersionDummy;
            ::Unserialize(s, VARINT(nVersionDummy));
        }
        ::Unserialize(s, Using<TxOutCompression>(txout.out));
    }
};

/** Undo information for a CTransaction */
class CTxUndo
{
public:
    // undo information for all txins
    std::vector<Coin> vprevout;

    SERIALIZE_METHODS(CTxUndo, obj) { READWRITE(Using<VectorFormatter<TxInUndoFormatter>>(obj.vprevout)); }
};

/** Undo information for a CBlock */
class CBlockUndo
{
public:
    std::vector<CTxUndo> vtxundo; // for all but the coinbase

    SERIALIZE_METHODS(CBlockUndo, obj) { READWRITE(obj.vtxundo); }
};

#endif // BITCOIN_UNDO_H


text:
#ifndef GRPC_CORE_LIB_CHANNEL_CHANNELZ_H
#define GRPC_CORE_LIB_CHANNEL_CHANNELZ_H

#include <grpc/impl/codegen/port_platform.h>

#include <grpc/grpc.h>

#include <string>

#include "absl/container/inlined_vector.h"

#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/atomic.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/json/json.h"

// Channel arg key for channelz node.
#define GRPC_ARG_CHANNELZ_CHANNEL_NODE "grpc.channelz_channel_node"

// Channel arg key to encode the channelz uuid of the channel's parent.
#define GRPC_ARG_CHANNELZ_PARENT_UUID "grpc.channelz_parent_uuid"

/** This is the default value for whether or not to enable channelz. If
 * GRPC_ARG_ENABLE_CHANNELZ is set, it will override this default value. */
#define GRPC_ENABLE_CHANNELZ_DEFAULT true

/** This is the default value for the maximum amount of memory used by trace
 * events per channel trace node. If
 * GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE is set, it will override
 * this default value. */
#define GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT 1024 * 4

namespace grpc_core {

namespace channelz {

// Helpers for getting and setting GRPC_ARG_CHANNELZ_PARENT_UUID.
grpc_arg MakeParentUuidArg(intptr_t parent_uuid);
intptr_t GetParentUuidFromArgs(const grpc_channel_args& args);

class SocketNode;
class ListenSocketNode;

namespace testing {
class CallCountingHelperPeer;
class ChannelNodePeer;
}  // namespace testing

// base class for all channelz entities
class BaseNode : public RefCounted<BaseNode> {
 public:
  // There are only four high level channelz entities. However, to support
  // GetTopChannelsRequest, we split the Channel entity into two different
  // types. All children of BaseNode must be one of these types.
  enum class EntityType {
    kTopLevelChannel,
    kInternalChannel,
    kSubchannel,
    kServer,
    kSocket,
  };

 protected:
  BaseNode(EntityType type, std::string name);

 public:
  virtual ~BaseNode();

  // All children must implement this function.
  virtual Json RenderJson() = 0;

  // Renders the json and returns allocated string that must be freed by the
  // caller.
  std::string RenderJsonString();

  EntityType type() const { return type_; }
  intptr_t uuid() const { return uuid_; }
  const std::string& name() const { return name_; }

 private:
  // to allow the ChannelzRegistry to set uuid_ under its lock.
  friend class ChannelzRegistry;
  const EntityType type_;
  intptr_t uuid_;
  std::string name_;
};

// This class is a helper class for channelz entities that deal with Channels,
// Subchannels, and Servers, since those have similar proto definitions.
// This class has the ability to:
//   - track calls_{started,succeeded,failed}
//   - track last_call_started_timestamp
//   - perform rendering of the above items
class CallCountingHelper {
 public:
  CallCountingHelper();

  void RecordCallStarted();
  void RecordCallFailed();
  void RecordCallSucceeded();

  // Common rendering of the call count data and last_call_started_timestamp.
  void PopulateCallCounts(Json::Object* json);

 private:
  // testing peer friend.
  friend class testing::CallCountingHelperPeer;

  // TODO(soheil): add a proper PerCPU helper and use it here.
  struct AtomicCounterData {
    // Define the ctors so that we can use this structure in InlinedVector.
    AtomicCounterData() = default;
    AtomicCounterData(const AtomicCounterData& that)
        : calls_started(that.calls_started.Load(MemoryOrder::RELAXED)),
          calls_succeeded(that.calls_succeeded.Load(MemoryOrder::RELAXED)),
          calls_failed(that.calls_failed.Load(MemoryOrder::RELAXED)),
          last_call_started_cycle(
              that.last_call_started_cycle.Load(MemoryOrder::RELAXED)) {}

    Atomic<int64_t> calls_started{0};
    Atomic<int64_t> calls_succeeded{0};
    Atomic<int64_t> calls_failed{0};
    Atomic<gpr_cycle_counter> last_call_started_cycle{0};
    // Make sure the size is exactly one cache line.
    uint8_t padding[GPR_CACHELINE_SIZE - 3 * sizeof(Atomic<intptr_t>) -
                    sizeof(Atomic<gpr_cycle_counter>)];
  };
  // TODO(soheilhy,veblush): Revist this after abseil integration.
  // This has a problem when using abseil inlined_vector because it
  // carries an alignment attribute properly but our allocator doesn't
  // respect this. To avoid UBSAN errors, this should be removed with
  // abseil inlined_vector.
  // GPR_ALIGN_STRUCT(GPR_CACHELINE_SIZE);

  struct CounterData {
    int64_t calls_started = 0;
    int64_t calls_succeeded = 0;
    int64_t calls_failed = 0;
    gpr_cycle_counter last_call_started_cycle = 0;
  };

  // collects the sharded data into one CounterData struct.
  void CollectData(CounterData* out);

  // Really zero-sized, but 0-sized arrays are illegal on MSVC.
  absl::InlinedVector<AtomicCounterData, 1> per_cpu_counter_data_storage_;
  size_t num_cores_ = 0;
};

// Handles channelz bookkeeping for channels
class ChannelNode : public BaseNode {
 public:
  ChannelNode(std::string target, size_t channel_tracer_max_nodes,
              intptr_t parent_uuid);

  // Returns the string description of the given connectivity state.
  static const char* GetChannelConnectivityStateChangeString(
      grpc_connectivity_state state);

  intptr_t parent_uuid() const { return parent_uuid_; }

  Json RenderJson() override;

  // proxy methods to composed classes.
  void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice& data) {
    trace_.AddTraceEvent(severity, data);
  }
  void AddTraceEventWithReference(ChannelTrace::Severity severity,
                                  const grpc_slice& data,
                                  RefCountedPtr<BaseNode> referenced_channel) {
    trace_.AddTraceEventWithReference(severity, data,
                                      std::move(referenced_channel));
  }
  void RecordCallStarted() { call_counter_.RecordCallStarted(); }
  void RecordCallFailed() { call_counter_.RecordCallFailed(); }
  void RecordCallSucceeded() { call_counter_.RecordCallSucceeded(); }

  void SetConnectivityState(grpc_connectivity_state state);

  // TODO(roth): take in a RefCountedPtr to the child channel so we can retrieve
  // the human-readable name.
  void AddChildChannel(intptr_t child_uuid);
  void RemoveChildChannel(intptr_t child_uuid);

  // TODO(roth): take in a RefCountedPtr to the child subchannel so we can
  // retrieve the human-readable name.
  void AddChildSubchannel(intptr_t child_uuid);
  void RemoveChildSubchannel(intptr_t child_uuid);

 private:
  void PopulateChildRefs(Json::Object* json);

  // to allow the channel trace test to access trace_.
  friend class testing::ChannelNodePeer;

  std::string target_;
  CallCountingHelper call_counter_;
  ChannelTrace trace_;
  const intptr_t parent_uuid_;

  // Least significant bit indicates whether the value is set.  Remaining
  // bits are a grpc_connectivity_state value.
  Atomic<int> connectivity_state_{0};

  Mutex child_mu_;  // Guards child maps below.
  // TODO(roth): We don't actually use the values here, only the keys, so
  // these should be sets instead of maps, but we don't currently have a set
  // implementation.  Change this if/when we have one.
  std::map<intptr_t, bool> child_channels_;
  std::map<intptr_t, bool> child_subchannels_;
};

// Handles channelz bookkeeping for servers
class ServerNode : public BaseNode {
 public:
  explicit ServerNode(size_t channel_tracer_max_nodes);

  ~ServerNode() override;

  Json RenderJson() override;

  std::string RenderServerSockets(intptr_t start_socket_id,
                                  intptr_t max_results);

  void AddChildSocket(RefCountedPtr<SocketNode> node);

  void RemoveChildSocket(intptr_t child_uuid);

  void AddChildListenSocket(RefCountedPtr<ListenSocketNode> node);

  void RemoveChildListenSocket(intptr_t child_uuid);

  // proxy methods to composed classes.
  void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice& data) {
    trace_.AddTraceEvent(severity, data);
  }
  void AddTraceEventWithReference(ChannelTrace::Severity severity,
                                  const grpc_slice& data,
                                  RefCountedPtr<BaseNode> referenced_channel) {
    trace_.AddTraceEventWithReference(severity, data,
                                      std::move(referenced_channel));
  }
  void RecordCallStarted() { call_counter_.RecordCallStarted(); }
  void RecordCallFailed() { call_counter_.RecordCallFailed(); }
  void RecordCallSucceeded() { call_counter_.RecordCallSucceeded(); }

 private:
  CallCountingHelper call_counter_;
  ChannelTrace trace_;
  Mutex child_mu_;  // Guards child maps below.
  std::map<intptr_t, RefCountedPtr<SocketNode>> child_sockets_;
  std::map<intptr_t, RefCountedPtr<ListenSocketNode>> child_listen_sockets_;
};

// Handles channelz bookkeeping for sockets
class SocketNode : public BaseNode {
 public:
  SocketNode(std::string local, std::string remote, std::string name);
  ~SocketNode() override {}

  Json RenderJson() override;

  void RecordStreamStartedFromLocal();
  void RecordStreamStartedFromRemote();
  void RecordStreamSucceeded() {
    streams_succeeded_.FetchAdd(1, MemoryOrder::RELAXED);
  }
  void RecordStreamFailed() {
    streams_failed_.FetchAdd(1, MemoryOrder::RELAXED);
  }
  void RecordMessagesSent(uint32_t num_sent);
  void RecordMessageReceived();
  void RecordKeepaliveSent() {
    keepalives_sent_.FetchAdd(1, MemoryOrder::RELAXED);
  }

  const std::string& remote() { return remote_; }

 private:
  Atomic<int64_t> streams_started_{0};
  Atomic<int64_t> streams_succeeded_{0};
  Atomic<int64_t> streams_failed_{0};
  Atomic<int64_t> messages_sent_{0};
  Atomic<int64_t> messages_received_{0};
  Atomic<int64_t> keepalives_sent_{0};
  Atomic<gpr_cycle_counter> last_local_stream_created_cycle_{0};
  Atomic<gpr_cycle_counter> last_remote_stream_created_cycle_{0};
  Atomic<gpr_cycle_counter> last_message_sent_cycle_{0};
  Atomic<gpr_cycle_counter> last_message_received_cycle_{0};
  std::string local_;
  std::string remote_;
};

// Handles channelz bookkeeping for listen sockets
class ListenSocketNode : public BaseNode {
 public:
  ListenSocketNode(std::string local_addr, std::string name);
  ~ListenSocketNode() override {}

  Json RenderJson() override;

 private:
  std::string local_addr_;
};

}  // namespace channelz
}  // namespace grpc_core

#endif /* GRPC_CORE_LIB_CHANNEL_CHANNELZ_H */


text:
package com.packagename.myapp;

public class Person implements Cloneable {
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Person(int id, String name, String surname, int age) {
        this.id = id;
        this.name = name;
        this.surname = surname;
        this.age = age;
    }

    private int id;
    private String name;
    private String surname;
    private int age;

    public Person() {

    }
}


text:
package controllers.supervision

import org.joda.time.LocalDate
import connectors.DataCacheConnector
import controllers.{AmlsBaseController, CommonPlayDependencies}
import forms.{EmptyForm, Form2, InvalidForm, ValidForm}
import javax.inject.Inject
import models.supervision._
import play.api.mvc.MessagesControllerComponents
import utils.AuthAction

import views.html.supervision.supervision_start

import scala.concurrent.Future

class SupervisionStartController @Inject()(val dataCacheConnector: DataCacheConnector,
                                           val authAction: AuthAction,
                                           val ds: CommonPlayDependencies,
                                           val cc: MessagesControllerComponents,
                                           supervision_start: supervision_start) extends AmlsBaseController(ds, cc) {

  def get(edit: Boolean = false) = authAction.async {
      implicit request =>
        dataCacheConnector.fetch[Supervision](request.credId, Supervision.key) map {
          case Some(Supervision(anotherBody, _, _, _, _, _)) if getStartDate(anotherBody).isDefined
          => Ok(supervision_start(Form2[SupervisionStart](SupervisionStart(getStartDate(anotherBody).get)), edit))
          case _ => Ok(supervision_start(EmptyForm, edit))
        }
  }

  private def getStartDate(anotherBody: Option[AnotherBody]): Option[LocalDate] = {
    anotherBody match {
      case Some(body) if body.isInstanceOf[AnotherBodyYes] => body.asInstanceOf[AnotherBodyYes].startDate match {
        case Some(sup) => Option(sup.startDate)
        case _ => None
      }
      case _ => None
    }
  }

  def post(edit: Boolean = false) = authAction.async {
      implicit request =>

        dataCacheConnector.fetch[Supervision](request.credId, Supervision.key) flatMap { supervision =>
          def extraFields: Map[String, Seq[String]] = supervision match {
            case Some(s) => getExtraFields(s)
            case _ => Map()
          }

          def getExtraFields(s: Supervision): Map[String, Seq[String]] = {
            s.anotherBody match {
              case Some(data) if data.isInstanceOf[AnotherBodyYes] =>
                Map("extraEndDate" -> Seq(data.asInstanceOf[AnotherBodyYes].endDate match {
                  case Some(date) => date.endDate.toString("yyyy-MM-dd")
                  case None => ""
                }))
              case None => Map()
            }
          }

          Form2[SupervisionStart](request.body.asFormUrlEncoded.get ++ extraFields) match {
            case f: InvalidForm => Future.successful(BadRequest(supervision_start(f, edit)))
            case ValidForm(_, data) =>
              dataCacheConnector.fetchAll(request.credId) flatMap {
                optMap =>
                  val result = for {
                    cache <- optMap
                    supervision <- cache.getEntry[Supervision](Supervision.key)
                    anotherBody <- supervision.anotherBody
                  } yield {
                    dataCacheConnector.save[Supervision](request.credId, Supervision.key,
                      supervision.copy(anotherBody = Some(updateData(anotherBody, data)))) map {
                      _ => redirect(edit)
                    }
                  }
                  result getOrElse Future.failed(new Exception("Unable to retrieve sufficient data"))
              }
          }
        }
  }

  private def updateData(anotherBody: AnotherBody, data: SupervisionStart): AnotherBody = {
    val updatedAnotherBody = anotherBody match {
      case a@AnotherBodyYes(_, _, _, _) => a.startDate(data)
      case _ => throw new Exception("An UnknownException has occurred : SupervisionStartReasonsController")
    }
    updatedAnotherBody
  }

  private def redirect(edit: Boolean) = {
    edit match {
      case true => Redirect(routes.SummaryController.get)
      case false => Redirect(routes.SupervisionEndController.get())
    }
  }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.network.fluent;

import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.network.fluent.models.VirtualWanInner;
import com.azure.resourcemanager.network.models.TagsObject;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsGet;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsListing;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/** An instance of this class provides access to all the operations defined in VirtualWansClient. */
public interface VirtualWansClient
    extends InnerSupportsGet<VirtualWanInner>, InnerSupportsListing<VirtualWanInner>, InnerSupportsDelete<Void> {
    /**
     * Retrieves the details of a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being retrieved.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<Response<VirtualWanInner>> getByResourceGroupWithResponseAsync(
        String resourceGroupName, String virtualWanName);

    /**
     * Retrieves the details of a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being retrieved.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<VirtualWanInner> getByResourceGroupAsync(String resourceGroupName, String virtualWanName);

    /**
     * Retrieves the details of a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being retrieved.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<VirtualWanInner> getByResourceGroupWithResponse(
        String resourceGroupName, String virtualWanName, Context context);

    /**
     * Retrieves the details of a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being retrieved.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    VirtualWanInner getByResourceGroup(String resourceGroupName, String virtualWanName);

    /**
     * Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being created or updated.
     * @param wanParameters Parameters supplied to create or update VirtualWAN.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
        String resourceGroupName, String virtualWanName, VirtualWanInner wanParameters);

    /**
     * Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being created or updated.
     * @param wanParameters Parameters supplied to create or update VirtualWAN.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of virtualWAN Resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    PollerFlux<PollResult<VirtualWanInner>, VirtualWanInner> beginCreateOrUpdateAsync(
        String resourceGroupName, String virtualWanName, VirtualWanInner wanParameters);

    /**
     * Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being created or updated.
     * @param wanParameters Parameters supplied to create or update VirtualWAN.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of virtualWAN Resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<VirtualWanInner>, VirtualWanInner> beginCreateOrUpdate(
        String resourceGroupName, String virtualWanName, VirtualWanInner wanParameters);

    /**
     * Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being created or updated.
     * @param wanParameters Parameters supplied to create or update VirtualWAN.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of virtualWAN Resource.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<VirtualWanInner>, VirtualWanInner> beginCreateOrUpdate(
        String resourceGroupName, String virtualWanName, VirtualWanInner wanParameters, Context context);

    /**
     * Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being created or updated.
     * @param wanParameters Parameters supplied to create or update VirtualWAN.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<VirtualWanInner> createOrUpdateAsync(
        String resourceGroupName, String virtualWanName, VirtualWanInner wanParameters);

    /**
     * Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being created or updated.
     * @param wanParameters Parameters supplied to create or update VirtualWAN.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    VirtualWanInner createOrUpdate(String resourceGroupName, String virtualWanName, VirtualWanInner wanParameters);

    /**
     * Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being created or updated.
     * @param wanParameters Parameters supplied to create or update VirtualWAN.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    VirtualWanInner createOrUpdate(
        String resourceGroupName, String virtualWanName, VirtualWanInner wanParameters, Context context);

    /**
     * Updates a VirtualWAN tags.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being updated.
     * @param wanParameters Parameters supplied to Update VirtualWAN tags.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<Response<VirtualWanInner>> updateTagsWithResponseAsync(
        String resourceGroupName, String virtualWanName, TagsObject wanParameters);

    /**
     * Updates a VirtualWAN tags.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being updated.
     * @param wanParameters Parameters supplied to Update VirtualWAN tags.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<VirtualWanInner> updateTagsAsync(String resourceGroupName, String virtualWanName, TagsObject wanParameters);

    /**
     * Updates a VirtualWAN tags.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being updated.
     * @param wanParameters Parameters supplied to Update VirtualWAN tags.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Response<VirtualWanInner> updateTagsWithResponse(
        String resourceGroupName, String virtualWanName, TagsObject wanParameters, Context context);

    /**
     * Updates a VirtualWAN tags.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being updated.
     * @param wanParameters Parameters supplied to Update VirtualWAN tags.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return virtualWAN Resource.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    VirtualWanInner updateTags(String resourceGroupName, String virtualWanName, TagsObject wanParameters);

    /**
     * Deletes a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being deleted.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String virtualWanName);

    /**
     * Deletes a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being deleted.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    PollerFlux<PollResult<Void>, Void> beginDeleteAsync(String resourceGroupName, String virtualWanName);

    /**
     * Deletes a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being deleted.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String virtualWanName);

    /**
     * Deletes a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being deleted.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String virtualWanName, Context context);

    /**
     * Deletes a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being deleted.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    Mono<Void> deleteAsync(String resourceGroupName, String virtualWanName);

    /**
     * Deletes a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being deleted.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    void delete(String resourceGroupName, String virtualWanName);

    /**
     * Deletes a VirtualWAN.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param virtualWanName The name of the VirtualWAN being deleted.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    void delete(String resourceGroupName, String virtualWanName, Context context);

    /**
     * Lists all the VirtualWANs in a resource group.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list VirtualWANs as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedFlux<VirtualWanInner> listByResourceGroupAsync(String resourceGroupName);

    /**
     * Lists all the VirtualWANs in a resource group.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list VirtualWANs as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<VirtualWanInner> listByResourceGroup(String resourceGroupName);

    /**
     * Lists all the VirtualWANs in a resource group.
     *
     * @param resourceGroupName The resource group name of the VirtualWan.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list VirtualWANs as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<VirtualWanInner> listByResourceGroup(String resourceGroupName, Context context);

    /**
     * Lists all the VirtualWANs in a subscription.
     *
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list VirtualWANs as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedFlux<VirtualWanInner> listAsync();

    /**
     * Lists all the VirtualWANs in a subscription.
     *
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list VirtualWANs as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<VirtualWanInner> list();

    /**
     * Lists all the VirtualWANs in a subscription.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list VirtualWANs as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    PagedIterable<VirtualWanInner> list(Context context);
}


text:
@class OBAStopWK;
@class OBAStopBookmarkWK;

@interface OBAInterfaceController : WKInterfaceController

@property (weak, nonatomic) IBOutlet WKInterfaceLabel *messageLabel;
@property (weak, nonatomic) IBOutlet WKInterfaceTable *arrivalsAndDeparturesTable;

@property (nonatomic) NSMutableDictionary *stops;
@property (nonatomic) NSArray *bookmarks;
@property (nonatomic) NSMutableArray *arrivalsAndDepartures;

@property (nonatomic) NSUInteger minutesBefore;
@property (nonatomic) NSUInteger minutesAfter;
@property (nonatomic) NSInteger maxCount;

- (void)fetchStopInfoForBookmark:(OBAStopBookmarkWK *)bookmark completion:(void(^)(void))completion;

- (void)refreshArrivalsAndDepartures;
- (void)fetchArrivalsAndDeparturesForBookmark:(OBAStopBookmarkWK *)bookmark completion:(void(^)(void))completion;
- (void)updateArrivalsAndDeparturesTable:(BOOL)isLoading;

@end