text:
Public Class Form1

    Dim nSize As New Size(700, 400)
    Dim CLEARLIST As Boolean = True

    Private WithEvents _server As Server
    Dim kommon As New Common

#Region "Form Delegates"

    Public Delegate Sub AddItemsToListBoxDelegate(ByVal ToListBox As ListBox, ByVal AddText As String)
    Public Delegate Sub updateItemsToListBoxDelegate(ByVal ToListBox As ListBox, ByVal AddText As String)
    Public Delegate Sub updateStatusDelegate(ByVal ToListBox As StatusStrip, ByVal AddText As String)
    Public Delegate Sub UpdateDataGridDelegate(ByVal DataGridView As DataGridView, ByVal DataSource As Object)
    Public Delegate Sub SelectRowDataGridDelegate(ByVal DataGridView As DataGridView, ByVal SelectIndex As Object)

    Private Sub AddItemsToListBox(ByVal ToListBox As ListBox, _
                                 ByVal AddText As String)
        If ToListBox.Items.Count > 1000 And CLEARLIST = True Then
            ToListBox.Items.Clear()
        End If

        ToListBox.Items.Add(AddText)
        ToListBox.SetSelected(ListBox1.Items.Count - 1, True)
        ToListBox.SetSelected(ListBox1.Items.Count - 1, False)
    End Sub

    Public Sub lstMsgs(ByVal item As Object, Optional ByVal source As Object = Nothing)
        If (ListBox1.InvokeRequired) Then
            ListBox1.Invoke( _
                    New AddItemsToListBoxDelegate(AddressOf AddItemsToListBox), _
                    New Object() {ListBox1, CStr(item)})
        Else
            If Me.ListBox1.Items.Count > 1000 And CLEARLIST = True Then
                ListBox1.Items.Clear()
            End If

            Me.ListBox1.Items.Add(CStr(item))
            Me.ListBox1.SetSelected(ListBox1.Items.Count - 1, True)
            Me.ListBox1.SetSelected(ListBox1.Items.Count - 1, False)
        End If

    End Sub

    Private Sub AddItemsToStatus(ByVal StatusStrips As StatusStrip, _
                             ByVal AddText As String)
        StatusStrips.Items.Clear()
        StatusStrips.Items.Add(AddText)
    End Sub

    Private Sub updateListBox(ByVal ToListBox As ListBox, _
                             ByVal AddText As String)
        ToListBox.Items(ToListBox.Items.Count - 1) = ToListBox.Items(ToListBox.Items.Count - 1) & " " & AddText
        ToListBox.SetSelected(ListBox1.Items.Count - 1, True)
        ToListBox.SetSelected(ListBox1.Items.Count - 1, False)
    End Sub

    Public Sub UpdateMsgs(ByVal item As Object, Optional ByVal source As Object = Nothing)
        If (ListBox1.InvokeRequired) Then
            ListBox1.Invoke( _
                    New updateItemsToListBoxDelegate(AddressOf updateListBox), _
                    New Object() {ListBox1, CStr(item)})
        Else
            Me.ListBox1.Items(Me.ListBox1.Items.Count - 1) = Me.ListBox1.Items(Me.ListBox1.Items.Count - 1) & " " & item
            Me.ListBox1.SetSelected(ListBox1.Items.Count - 1, True)
            Me.ListBox1.SetSelected(ListBox1.Items.Count - 1, False)
        End If

    End Sub

    Private Sub UpdateStatus(ByVal AddText As String)
        If (StatusStrip1.InvokeRequired) Then
            StatusStrip1.Invoke( _
                    New updateStatusDelegate(AddressOf AddItemsToStatus), _
                    New Object() {StatusStrip1, CStr(AddText)})
        Else
            Me.StatusStrip1.Items.Clear()
            Me.StatusStrip1.Items.Add(AddText)
        End If
    End Sub

    Private Sub updateDGV(ByVal dgv As DataGridView, _
                     ByVal DataSource As Object)
        dgv.DataSource = DataSource
        dgv.AutoResizeColumns()
    End Sub

    Private Sub UpdateDataGrid(ByVal DataSource As Object)

        If (DataGridView1.InvokeRequired) Then
            DataGridView1.Invoke( _
                    New UpdateDataGridDelegate(AddressOf updateDGV), _
                    New Object() {DataGridView1, DataSource})
        Else
            DataGridView1.DataSource = DataSource
            DataGridView1.AutoResizeColumns()
        End If

    End Sub

    Private Sub selectRowDGV(ByVal dgv As DataGridView, _
                 ByVal selectIndex As Object)
        For Each row As DataGridViewRow In dgv.Rows
            If row.Index = selectIndex Then
                row.Selected = True
                Exit For
            End If
        Next
        dgv.Focus()
    End Sub

    Private Sub DGVSelectRow(ByVal selectIndex As Integer)
        If (DataGridView1.InvokeRequired) Then
            DataGridView1.Invoke( _
                    New SelectRowDataGridDelegate(AddressOf selectRowDGV), _
                    New Object() {DataGridView1, selectIndex})
        Else
            Button1.Focus()
            For Each row As DataGridViewRow In DataGridView1.Rows
                If row.Index = selectIndex Then
                    row.Selected = True
                    Exit For
                End If
            Next
            DataGridView1.Focus()
        End If
    End Sub

#End Region

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Try
            If IsNothing(_server) = False Then
                _server.Stop()
                _server = Nothing
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            GC.Collect()
            End
        End Try
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Initialization()
        Me.Text = APPLICATION_NAME & " - server version " & kommon.ShowVersion
        Me.Size = nSize
        Me.MinimumSize = nSize
        Me.MaximumSize = nSize

        With Me.ListBox1
            .BackColor = Color.Black
            .ForeColor = Color.Lime
        End With

        DataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically
        DataGridView1.AllowUserToAddRows = False

        Dim minToTray As New emu_common.clsMinToTray(Me, APPLICATION_NAME & " is running...", Me.Icon)

        GetIPAddress()
        _server = New Server(Convert.ToInt64(SERVER_PORT))

        UpdateStatus("Ready")

        UpdateDataGrid(ClientGroup)

    End Sub

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Dim Top_Height As Double = 0.45
        Dim Bottom_Height As Double = 0.55
        Dim Width_Margin As Double = IIf(My.Computer.Info.OSVersion.StartsWith("5"), 3, 5) 'WIN7++ ADJUSTMENT

        Dim Left_Width As Double = 0.5
        Dim Right_Width As Double = 0.5

        With TabControl2
            .Location = New Point(Width_Margin, 0)
            .Width = Me.Width - (5 * Width_Margin)
            '.Height = (Me.Height * Bottom_Height) - (30 + StatusStrip1.Height)
            .Height = (Me.Height * Top_Height) - 5
        End With

        With GroupVerbose
            .Location = New Point(Width_Margin, Me.Height * Top_Height)
            .Width = Me.Width - (5 * Width_Margin)
            .Height = (Me.Height * Bottom_Height) - (30 + StatusStrip1.Height)
        End With

        DataGridView1.Height = TabClient.Height - (Button1.Height + 10)

    End Sub

    Private Sub _server_ClientEvent(ByVal client As emu_common.Client) Handles _server.ClientEvent
        updateDT(client)
        UpdateDataGrid(ClientGroup)
    End Sub

    Private Sub _server_OnEvent(ByVal nLog As Object, ByVal value As Common.TRX) Handles _server.OnEvent
        lstMsgs(nLog)
    End Sub

    Private Sub _server_ReceiveData(ByVal data As String) Handles _server.ReceiveData
        If data.StartsWith("22:00:") Then 'AVL DATA

            'lstMsgs(kommon.ParseData(data).GetTrackerID & vbTab & data.ToString)
            lstMsgs(ENTITY_OBU & "AVL " & data.ToString)

        ElseIf data.StartsWith("08:") Then 'OBU ACKNOWLEDGE

            lstMsgs(ENTITY_OBU & "ACK " & data.ToString)

        ElseIf data.StartsWith("23:") Then 'OBU Reply Rooftop Signage Message Request

            lstMsgs(ENTITY_OBU & "Rooftop " & data.ToString)

        ElseIf data.StartsWith("31:") Then 'OBU Send SALE Transaction Record to Server (Generic Protocol)

            lstMsgs(ENTITY_OBU & "Sale Transaction " & data.ToString)

        ElseIf data.StartsWith("32:") Then 'OBU Send VOID Transaction Record to Server (Generic Protocol)

            lstMsgs(ENTITY_OBU & "Void Transaction " & data.ToString)

        ElseIf data.StartsWith("41:") Then 'OBU Request Driver Information to Server

            lstMsgs(ENTITY_OBU & "Driver Info Request " & data.ToString)

        ElseIf data.StartsWith("42:") Then 'OBU Update Driver Information via FTP

            lstMsgs(ENTITY_OBU & "Driver Info " & data.ToString)

        ElseIf data.StartsWith("51:") Then 'OBU Send Taxi Profile Data to Server

            lstMsgs(ENTITY_OBU & "Taxi Profile " & data.ToString)

        ElseIf data.StartsWith("61:") Then 'OBU Send Driver Behaviour Data to Server

            lstMsgs(ENTITY_OBU & "Driver Behaviour " & data.ToString)

        ElseIf data.StartsWith("01:") Then 'OBU Send Connection Request

            lstMsgs(ENTITY_OBU & "PING " & data.ToString)

        ElseIf data.StartsWith("02:") Then 'OBU Send Ping

            lstMsgs(ENTITY_OBU & "PING " & data.ToString)

        Else 'UNKNOWN

            lstMsgs(ENTITY_OBU & "UNKNOWN " & data.ToString)

        End If
    End Sub

#Region "Private Methods"
    Private Sub GetIPAddress()
        Dim strHostName, strIPAddress As String
        strHostName = System.Net.Dns.GetHostName()
        strIPAddress = System.Net.Dns.GetHostEntry(strHostName).AddressList(0).ToString()
        lstMsgs("Host Name: " & strHostName & "; IP Address: " & strIPAddress & "; Port: " & SERVER_PORT)
        txtIPAddress.Text = strIPAddress
        txtPort.Text = SERVER_PORT
    End Sub

    Private Function updateDT(ByVal Client As emu_common.Client) As IncomingStatus
        Dim row() As DataRow = ClientGroup.Select("TrackerID='" & Client.TrackerID & "'")
        If row.Count > 0 Then
            row(0)("IPAddress") = Client.IPAddress
            row(0)("Timestamp") = Client.Timestamp
            Return IncomingStatus.Updated
        Else
            Dim _row As DataRow
            _row = ClientGroup.NewRow
            _row("TrackerID") = Client.TrackerID
            _row("IPAddress") = Client.IPAddress
            _row("Timestamp") = Client.Timestamp
            ClientGroup.Rows.Add(_row)
            Return IncomingStatus.Inserted
        End If
    End Function
#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            test()
        Catch ex As Exception
            lstMsgs(ex.Message)
        End Try
    End Sub

    Private Sub test()
        'Console.WriteLine(DataGridView1.SelectedRows.Count)
        '_server.TestSend("192.168.9.178")
        'lstMsgs(_server.SendRoofTopMessage("TEKS1M", emu_common.Common.RooftopSignageColor.Green, emu_common.Common.RooftopSignageEffect.Blink, 1000))

        lstMsgs(_server.SendAcknowledge("123", emu_common.Common.Acknowledgement.Success))

    End Sub

    Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        If e.RowIndex >= 0 Then
            DGVSelectRow(e.RowIndex)
        End If
    End Sub

    Private Sub DataGridView1_RowsAdded(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles DataGridView1.RowsAdded
        Dim dgv As DataGridView = DirectCast(sender, DataGridView)
        If dgv.RowCount <= 0 Then
            Exit Sub
        Else
            Dim index As Integer = 0
            For Each row As DataGridViewRow In dgv.Rows
                For Each cell As DataGridViewCell In row.Cells
                    If cell.Selected = True Then
                        index = row.Index
                        DGVSelectRow(index)
                        Exit Sub
                    End If
                Next
            Next
        End If
    End Sub
End Class


text:
<!DOCTYPE html>

Prevention

What Can I do to Help Prevent Traumatic Brain Injury?

There are many ways to reduce the chances of sustaining a traumatic brain injury, including:

Buckling your child in the car using a child safety seat, booster seat, or seat belt (according to the child's height, weight, and age).

Know the Stages

± Birth up to Age 2

Rear-facing car seat. For the best possible protection, infants and children should be kept in a rear-facing car seat, in the back seat buckled with the seat's harness, until they reach the upper weight or height limits of their particular seat. Check the seat's owner's manual for weight and height limits.

± Age 2 up to at least Age 5

           Forward-facing car seat. When children outgrow their rear-facing seats they should ride in forward-facing car seats, in the back seat buckled with the seat's harness, until they reach the upper weight or height limit of their particular seat. Check the seat's owner's manual for weight and height limits.

± Age 5 up to at least Age 9

           Booster seat. Once children outgrow their forward-facing seats (by reaching the upper height and weight limits of their seat), they should ride in belt positioning booster seats. Remember to keep children in the back seat for the best possible protection.

± Once  Seat Belts Fit Properly

Children should use booster seats until  adult seat belts fit them properly. Seat belts fit properly when the lap belt  lays across the upper thighs (not the stomach) and the shoulder belt fits across  the chest (not the neck). The recommended height for proper seat belt fit is 57  inches tall. For the best possible protection keep children in the back seat  and use lap-and-shoulder belts.

± Remember

All children aged 12 and under should ride in the back seat. Airbags can kill young children riding in the front seat. Never place a rear-facing car seat in the front seat or in front of an air bag.

Wearing a seat belt every time you drive or ride in a motor vehicle.

Never driving while under the influence of alcohol or drugs.

Wearing a helmet and making sure your children wear helmets when:

Riding a bike, motorcycle, snowmobile, scooter, or all-terrain vehicle;

Playing a contact sport, such as football, ice hockey, or boxing;

Using in-line skates or riding a skateboard;

Batting and running bases in baseball or softball;

Riding a horse; or

Skiing or snowboarding.

Making living areas safer for seniors, by:

Removing tripping hazards such as throw rugs and clutter in walkways;

Using nonslip mats in the bathtub and on shower floors; Installing grab bars   next to the toilet and in the tub or shower;

Installing handrails on both sides of stairways;

Improving lighting throughout the home; and

Maintaining a regular physical activity program, if your doctor agrees, to   improve lower body strength and balance.1,2,3

Making living areas safer for children, by:

Installing window guards to keep young children from falling out of open   windows; and

Using safety gates at the top and bottom of stairs when young children are   around.

Making sure the surface on your child's playground is made of   shock-absorbing material, such as hardwood mulch or sand.4

Learn More About Preventing

Childhood       Injuries

Get educational resources on        preventing falls and playground safety

Get        educational resources on sports-related TBI

Injuries  from Violence

Get        educational resources on Shaken Baby Syndrome

Get        educational resources        on youth violence prevention

Injuries from Motor Vehicle       Crashes

Get        educational resources on teen driver        safety

Older  Adult Falls

Get        educational resources on TBIs among older adults

References

Judge JO, Lindsey C, Underwood M, Winsemius D. Balance improvements in older   women: effects of exercise training. Physical Therapy 1993;73(4):254–265.

Lord SR, Caplan GA, Ward JA. Balance, reaction time, and muscle strength in   exercising older women: a pilot study. Archives of Physical and Medical   Rehabilitation 1993;74(8):837–839.

Campbell AJ, Robertson MC, Gardner MM, Norton RN, Buchner DM. Falls   prevention over 2 years: a randomized controlled trial in women 80 years and   older. Age and Aging 1999;28:513–518.

Mack MG, Sacks JJ, Thompson D. Testing the impact attenuation of loose fill   playground surfaces. Injury Prevention 2000;6:141–144.

Related Links

Heads Up:   Concussion in Youth Sports

Heads Up: Concussion in High School Sports

Heads Up: Brain Injury in Your Practice

Heads Up: Preventing Concussion   fact sheet [PDF-238KB]

redpajama_set_name: RedPajamaGithub


text:
package com.tactfactory.my_qcm.view.menu;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.tactfactory.my_qcm.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class RulesFragment extends Fragment {

    public RulesFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_rules, container, false);
        // disable floating button
        FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
        fab.setVisibility(fab.INVISIBLE);

        return rootView;
    }

}


text:
This is the website of Jim Curran Information Designer.

- CMS: Siteleaf
- Markup: HTML, Liquid
- Run bundle install in the root
- Run compass watch in the sass directory
- CSS files are written to the stylesheets directory
- Run gem install siteleaf


text:
FROM nginx:1.13-alpine

RUN mkdir -p /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY dist /usr/share/nginx/html

EXPOSE 8080


text:
//
// Copyright 2014-21 Volker Sorge
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @file Interface and abstract class for semantic tree parsers.
 * @author volker.sorge@gmail.com (Volker Sorge)
 */

import { SemanticNode } from './semantic_node';

import { SemanticNodeFactory } from './semantic_node_factory';

export interface SemanticParser<T> {
  /**
   * The parse method of this parser.
   *
   * @param representation The representation from which a semantic
   * interpretation is constructed.
   * @returns The root of the constructed semantic tree.
   */
  parse(representation: T): SemanticNode;

  /**
   * Parse a list of element into a list of semantic nodes.
   *
   * @param list A list of elements.
   * @returns The list of resulting semantic
   *     node.
   */
  parseList(list: T[]): SemanticNode[];

  /**
   * @returns The node factory of the parser.
   */
  getFactory(): SemanticNodeFactory;

  /**
   * @param factory A new node factory for the parser.
   */
  setFactory(factory: SemanticNodeFactory): void;

  /**
   * @returns The type of the parser.
   */
  getType(): string;
}

export abstract class SemanticAbstractParser<T> implements SemanticParser<T> {
  private factory_: SemanticNodeFactory = new SemanticNodeFactory();

  /**
   * @param type The type of the parser.
   */
  constructor(private type: string) {}

  /**
   * @override
   */
  public abstract parse(representation: T): SemanticNode;

  /**
   * @override
   */
  public getFactory() {
    return this.factory_;
  }

  /**
   * @override
   */
  public setFactory(factory: SemanticNodeFactory) {
    this.factory_ = factory;
  }

  /**
   * @override
   */
  public getType() {
    return this.type;
  }

  /**
   * @override
   */
  public parseList(list: T[]) {
    const result = [];
    for (let i = 0, element; (element = list[i]); i++) {
      result.push(this.parse(element));
    }
    return result;
  }
}


text:
export class PromiseResolver<T> {
  private isFulfilled_;
  private promise_;
  resolve_: (resolution?: T|undefined) => void;
  reject_: (reason?: any|undefined) => void;
  set isFulfilled(arg: boolean);
  get isFulfilled(): boolean;
  set promise(arg: Promise<T>);
  get promise(): Promise<T>;
  set resolve(arg: (arg0?: T|undefined) => void);
  get resolve(): (arg0?: T|undefined) => void;
  set reject(arg: () => void);
  get reject(): () => void;
}


text:
<?php
      $this->breadcrumbs->push('Home', 'admin');
            $this->breadcrumbs->push('Profile', 'influencer/profile');
            $_POST['breadcrumb']= $this->breadcrumbs->show();
            ?>

<?php foreach($profile as $inf){?>

About Me

                    Email address

                    <?=$inf["email"]?>

                    Experience

                   <?=$inf["experience"]?>

                   Location

<?=$inf["country"]?>,<?=$inf["city"]?>

                  Contact Number

                    <?=$inf["contact"]?>

                   Account Number

<?=$inf["account_no"]?>

                   Payment Status

<?=$inf["payment"]?>

Settings

                    <form action="submitprofile" class="form-horizontal" method="post">

                        Name

                          <input type="Name" class="form-control" name="name" placeholder="Name" value="<?=$inf["name"]?>">

                        Country

                          <input type="text" class="form-control" name="country" value="<?=$inf["country"]?>">

                        City

                          <input type="text" class="form-control" name="city" placeholder="City" value="<?=$inf["city"]?>">

                        Experience

                          <textarea class="form-control" name="experience" placeholder="Experience"  value="<?=$inf["experience"]?>"><?=$inf["experience"]?></textarea>

                        Contact Number

                          <input type="tel" class="form-control" name="phone" placeholder="Contact Number" value="<?=$inf["contact"]?>">

                        Account Number

                          <input type="text" class="form-control" name="account_no"  value="<?=$inf["account_no"]?>">

                          <button type="submit" class="btn btn-danger">Submit</button>
                        <?php }  ?>

                    </form>


text:
@class MJRefreshComponent;
@interface SANetworkRefreshAccessory : NSObject<SANetworkAccessoryProtocol>

- (instancetype)initWithRefreshView:(MJRefreshComponent *)refreshView;

@end


text:
namespace content {

class MockTapSuppressionController : public TapSuppressionController {
 public:
  using TapSuppressionController::DISABLED;
  using TapSuppressionController::NOTHING;
  using TapSuppressionController::LAST_CANCEL_STOPPED_FLING;
  using TapSuppressionController::SUPPRESSING_TAPS;

  enum Action {
    NONE = 0,
    TAP_DOWN_FORWARDED = 1 << 0,
    TAP_DOWN_SUPPRESSED = 1 << 1,
    TAP_UP_SUPPRESSED = 1 << 2,
    TAP_UP_FORWARDED = 1 << 3,
  };

  MockTapSuppressionController(const TapSuppressionController::Config& config)
      : TapSuppressionController(config), last_actions_(NONE), time_() {}

  MockTapSuppressionController(const MockTapSuppressionController&) = delete;
  MockTapSuppressionController& operator=(const MockTapSuppressionController&) =
      delete;

  ~MockTapSuppressionController() override {}

  void NotifyGestureFlingCancelStoppedFling() {
    last_actions_ = NONE;
    GestureFlingCancelStoppedFling();
  }

  void SendTapDown() {
    last_actions_ = NONE;
    if (ShouldSuppressTapDown())
      last_actions_ |= TAP_DOWN_SUPPRESSED;
    else
      last_actions_ |= TAP_DOWN_FORWARDED;
  }

  void SendTapUp() {
    last_actions_ = NONE;
    if (ShouldSuppressTapEnd())
      last_actions_ |= TAP_UP_SUPPRESSED;
    else
      last_actions_ |= TAP_UP_FORWARDED;
  }

  void AdvanceTime(const base::TimeDelta& delta) {
    last_actions_ = NONE;
    time_ += delta;
  }

  State state() { return state_; }

  int last_actions() { return last_actions_; }

 protected:
  base::TimeTicks Now() override { return time_; }

 private:

  // Hiding some derived public methods
  using TapSuppressionController::GestureFlingCancelStoppedFling;
  using TapSuppressionController::ShouldSuppressTapDown;
  using TapSuppressionController::ShouldSuppressTapEnd;

  int last_actions_;

  base::TimeTicks time_;
};

class TapSuppressionControllerTest : public testing::Test {
 public:
  TapSuppressionControllerTest() {
  }
  ~TapSuppressionControllerTest() override {}

 protected:
  // testing::Test
  void SetUp() override {
    tap_suppression_controller_ =
        std::make_unique<MockTapSuppressionController>(GetConfig());
  }

  void TearDown() override { tap_suppression_controller_.reset(); }

  static TapSuppressionController::Config GetConfig() {
    TapSuppressionController::Config config;
    config.enabled = true;
    config.max_cancel_to_down_time = base::Milliseconds(10);
    return config;
  }

  std::unique_ptr<MockTapSuppressionController> tap_suppression_controller_;
};

// Test TapSuppressionController for when GestureFlingCancel actually stops
// fling and the tap down event arrives without any delay.
TEST_F(TapSuppressionControllerTest, GFCAckBeforeTapFast) {
  // Notify the controller that the GFC has stooped an active fling.
  tap_suppression_controller_->NotifyGestureFlingCancelStoppedFling();
  EXPECT_EQ(MockTapSuppressionController::NONE,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::LAST_CANCEL_STOPPED_FLING,
            tap_suppression_controller_->state());

  // Send TapDown. This TapDown should be suppressed.
  tap_suppression_controller_->SendTapDown();
  EXPECT_EQ(MockTapSuppressionController::TAP_DOWN_SUPPRESSED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::SUPPRESSING_TAPS,
            tap_suppression_controller_->state());

  // Send TapUp. This TapUp should be suppressed.
  tap_suppression_controller_->SendTapUp();
  EXPECT_EQ(MockTapSuppressionController::TAP_UP_SUPPRESSED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::SUPPRESSING_TAPS,
            tap_suppression_controller_->state());
}

// Test TapSuppressionController for when GestureFlingCancel actually stops
// fling but there is a small delay between the Ack and TapDown.
TEST_F(TapSuppressionControllerTest, GFCAckBeforeTapInsufficientlyLateTapDown) {
  // Notify the controller that the GFC has stooped an active fling.
  tap_suppression_controller_->NotifyGestureFlingCancelStoppedFling();
  EXPECT_EQ(MockTapSuppressionController::NONE,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::LAST_CANCEL_STOPPED_FLING,
            tap_suppression_controller_->state());

  // Wait less than allowed delay between GestureFlingCancel and TapDown, so the
  // TapDown is still considered associated with the GestureFlingCancel.
  tap_suppression_controller_->AdvanceTime(base::Milliseconds(7));
  EXPECT_EQ(MockTapSuppressionController::NONE,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::LAST_CANCEL_STOPPED_FLING,
            tap_suppression_controller_->state());

  // Send TapDown. This TapDown should be suppressed.
  tap_suppression_controller_->SendTapDown();
  EXPECT_EQ(MockTapSuppressionController::TAP_DOWN_SUPPRESSED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::SUPPRESSING_TAPS,
            tap_suppression_controller_->state());

  // Send TapUp. This TapUp should be suppressed.
  tap_suppression_controller_->SendTapUp();
  EXPECT_EQ(MockTapSuppressionController::TAP_UP_SUPPRESSED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::SUPPRESSING_TAPS,
            tap_suppression_controller_->state());
}

// Test TapSuppressionController for when GestureFlingCancel actually stops
// fling but there is a long delay between the Ack and TapDown.
TEST_F(TapSuppressionControllerTest, GFCAckBeforeTapSufficientlyLateTapDown) {
  // Notify the controller that the GFC has stooped an active fling.
  tap_suppression_controller_->NotifyGestureFlingCancelStoppedFling();
  EXPECT_EQ(MockTapSuppressionController::NONE,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::LAST_CANCEL_STOPPED_FLING,
            tap_suppression_controller_->state());

  // Wait more than allowed delay between GestureFlingCancel and TapDown, so the
  // TapDown is not considered associated with the GestureFlingCancel.
  tap_suppression_controller_->AdvanceTime(base::Milliseconds(13));
  EXPECT_EQ(MockTapSuppressionController::NONE,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::LAST_CANCEL_STOPPED_FLING,
            tap_suppression_controller_->state());

  // Send TapDown. This TapDown should not be suppressed.
  tap_suppression_controller_->SendTapDown();
  EXPECT_EQ(MockTapSuppressionController::TAP_DOWN_FORWARDED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::NOTHING,
            tap_suppression_controller_->state());

  // Send MouseUp. This MouseUp should not be suppressed.
  tap_suppression_controller_->SendTapUp();
  EXPECT_EQ(MockTapSuppressionController::TAP_UP_FORWARDED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::NOTHING,
            tap_suppression_controller_->state());
}

// Test that no suppression occurs if the TapSuppressionController is disabled.
TEST_F(TapSuppressionControllerTest, NoSuppressionIfDisabled) {
  TapSuppressionController::Config disabled_config;
  disabled_config.enabled = false;
  tap_suppression_controller_ =
      std::make_unique<MockTapSuppressionController>(disabled_config);

  // Send GestureFlingCancel Ack.
  tap_suppression_controller_->NotifyGestureFlingCancelStoppedFling();
  EXPECT_EQ(MockTapSuppressionController::NONE,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::DISABLED,
            tap_suppression_controller_->state());

  // Send TapDown. This TapDown should not be suppressed.
  tap_suppression_controller_->SendTapDown();
  EXPECT_EQ(MockTapSuppressionController::TAP_DOWN_FORWARDED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::DISABLED,
            tap_suppression_controller_->state());

  // Send TapUp. This TapUp should not be suppressed.
  tap_suppression_controller_->SendTapUp();
  EXPECT_EQ(MockTapSuppressionController::TAP_UP_FORWARDED,
            tap_suppression_controller_->last_actions());
  EXPECT_EQ(MockTapSuppressionController::DISABLED,
            tap_suppression_controller_->state());
}

}  // namespace content


text:
package com.criteo.dev.cluster

import com.criteo.dev.cluster.aws.AwsUtilities
import com.criteo.dev.cluster.aws.AwsUtilities.NodeRole
import com.criteo.dev.cluster.aws.AwsUtilities.NodeRole.NodeRole
import com.criteo.dev.cluster.command.{ScpAction, SshAction}
import org.slf4j.LoggerFactory

/**
 * Start hadoop and other services on a given node.
 */
object StartServiceAction {

  private val logger = LoggerFactory.getLogger(StartServiceAction.getClass)

  def apply(node: Node, nodeRole: NodeRole): Unit = {
    val startScript = AwsUtilities.getStartServiceScript(nodeRole)
    logger.info(s"Running $startScript on node ${node.ip}")
    ScpAction(
      sourceN = None,
      srcPath = s"${GeneralConstants.setupScriptDir}/$startScript",
      targetN = Some(node),
      targetPath = "~/start.sh")
    SshAction(node, s"source start.sh")
    SshAction(node, "rm start.sh")
  }
}


text:
<?php
/**
 * @see https://developers.podio.com/doc/reference
 */
class PodioReference extends PodioObject {
  public function __construct($attributes = array()) {
    $this->property('type', 'string');
    $this->property('id', 'integer');
    $this->property('title', 'string');
    $this->property('link', 'string');
    $this->property('data', 'hash');
    $this->property('created_on', 'datetime');

    $this->has_one('created_by', 'ByLine');
    $this->has_one('created_via', 'Via');

    $this->init($attributes);
  }

  /**
   * @see https://developers.podio.com/doc/reference/get-reference-10661022
   */
  public static function get_for($ref_type, $ref_id, $attributes = array()) {
    return self::member(Podio::get("/reference/{$ref_type}/{$ref_id}", $attributes));
  }

  /**
   * @see https://developers.podio.com/doc/reference/search-references-13312595
   */
  public static function search($attributes = array()) {
    return Podio::post("/reference/search", $attributes)->json_body();
  }

  /**
   * @see https://developers.podio.com/doc/reference/resolve-url-66839423
   */
  public static function resolve($attributes = array()) {
    return self::member(Podio::get("/reference/resolve", $attributes));
  }

}


text:
package de.flexiprovider.common.exceptions;

/**
 * This exception is thrown, when trying to use a polynom as field polynom,
 * which is not irreducible.
 */
public class PolynomialIsNotIrreducibleException extends GFException {

    private static final String diagnostic = "The given fieldpolynomial is not irreducible.";

    /**
     * Default constructor. Calls the parent-constructor with the message "The
     * given fieldpolynomial is not irreducible."
     */
    public PolynomialIsNotIrreducibleException() {
	super(diagnostic);
    }

}


text:
module.exports = (data) => {
    return {
        home(req, res) {
            Promise.all([
                    data.advertsData.getAllAdvertsByCategory('car', 3),
                    data.advertsData.getAllAdvertsByCategory('truck', 3),
                    data.advertsData.getAllAdvertsByCategory('motorcycle', 3),
                ])
                .then(([reqCars, reqTrucks, reqMotors]) => {
                    return res.render('home/home', {
                        user: req.user,
                        cars: reqCars,
                        trucks: reqTrucks,
                        motorcycles: reqMotors,
                    });
                });
        },
    };
};


text:
require_relative '../lib/manejadores_mensajes/mensajero'
require_relative '../config/trabajos_periodicos'

#require 'daemons'

#options = {
#  :app_name   => "pradobot",
#}

#Daemons.call(options) do
   #Server loop:

TrabajosPeriodicos.actualizar_tutorias
bot =Mensajero.new(ENV['TOKEN_BOT'])
bot.empezar_recibir_mensajes

#end


text:
package environment

import (
	"fmt"
)

// Returns the OS specific value for the OnOutOfMemoryError command to execute.
func (self *OutOfMemoryErrorRestarter) createOOMErrorTriggerCommand() string {
	return fmt.Sprintf("/bin/echo 1 > \"%s\"", self.outOfMemoryErrorMarker)
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<notification xmlns='http://calendarserver.org/ns/'>
  <dtstamp></dtstamp>
  <invite-reply shared-type='addressbook' xmlns='http://calendarserver.org/ns/'>
    <href xmlns='DAV:'>$cuaddrurn2:</href>
    <invite-accepted/>
    <hosturl>
      <href xmlns='DAV:'>$addressbookpath1:</href>
    </hosturl>
    <in-reply-to>$inviteuid:</in-reply-to>
    <summary>My Shared Address Book</summary>
    <common-name>$username2:</common-name>
  </invite-reply>
</notification>


text:
<?php

abstract class Sabre_DAV_Node implements Sabre_DAV_INode {

    /**
     * Returns the last modification time
     *
     * In this case, it will simply return the current time
     *
     * @return int
     */
    public function getLastModified() {

        return time();

    }

    /**
     * Deletes the current node
     *
     * @throws Sabre_DAV_Exception_Forbidden
     * @return void
     */
    public function delete() {

        throw new Sabre_DAV_Exception_Forbidden('Permission denied to delete node');

    }

    /**
     * Renames the node
     *
     * @throws Sabre_DAV_Exception_Forbidden
     * @param string $name The new name
     * @return void
     */
    public function setName($name) {

        throw new Sabre_DAV_Exception_Forbidden('Permission denied to rename file');

    }

}


text:
using Microsoft.UI.Xaml;
using Windows.Foundation;
using Windows.UI.Popups;

namespace Demo.HelloSpecialValues
{
    //WORKAROUND https://github.com/microsoft/microsoft-ui-xaml/issues/4167
    internal static class DialogHelper
    {
        public static IAsyncOperation<IUICommand> ShowAsyncEx(this MessageDialog dialog, Window parent)
        {
            var handle = WinRT.Interop.WindowNative.GetWindowHandle(parent);
            WinRT.Interop.InitializeWithWindow.Initialize(dialog, handle);

            return dialog.ShowAsync();
        }

        public static IAsyncOperation<IUICommand> ShowAsyncEx(this MessageDialog dialog)
        {
            var application = (App) Application.Current;
            return ShowAsyncEx(dialog, application.MainWindow);
        }
    }
}


text:
layout: global
title: Hierarchical storage on Tachyon
---

The hierarchical storage introduces more storage layers besides the existing memory layer. Each
layer contains one or more storage directories, where each directory stores block files.

When writing data into Tachyon, client needs to request space from a worker, and the worker
allocates space on hierarchical storage, Currently the newly coming data is always stored onto top
level storage layer for high speed, and the space is allocated among storage directories in one
storage layer by a configured strategy. If the upper level storage runs out of space, its block
files will be evicted to successor storage layer by a configured strategy to get enough space. If
the storage layer is the bottom tier, the block files will be deleted. The location change and
deletion information will be sent to master during heartbeat with master. After a block file is
written, the client requests the worker to cache the block. Then the worker will update the block
caching information to master after it is cached. When reading data from Tachyon, client first gets
the block information from master. If the block exists on local worker, the client requests worker
to lock the block and get the path of the block file. After reading the data, the client requests
worker to update the block access time and unlock it. If the block does not exist on local worker,
the client will try to get the block data from remote workers which contain the block.

## Configuring hierarchical storage

Use tachyon-env.sh to configure the hierarchical storage by adding properties into
Tachyon_JAVA_OPTS, there are six configuration parameters for hierarchical storage:

    $ tachyon.worker.hierarchystore.level.max
The maximum level of storage tier sets the number of storage layers in Tachyon. Its default
value is 1, which means there is only one storage layer.

    $ tachyon.worker.hierarchystore.level{x}.alias
The alias of each storage tier, x represents the number of storage layers (starts from 0). There
are pre-defined alias names in StorageLevelAlias, such as MEM, SSD, and HDD etc. Currently only
local file system is supported, more types of storage layer will be added later.

    $ tachyon.worker.hierarchystore.level{x}.dirs.path
The paths of storage directories in each storage layer, which are delimited by comma. x represents
the storage layer. It is okay to have one directory for the memory layer. It is suggested to have
one storage directory per hardware device for SSD and HDD.

    $ tachyon.worker.hierarchystore.level{x}.dirs.quota
The quotas for all storage directories in a storage layer, which are also be delimited by comma. x
represents the storage layer. Workers use the corresponding quota in the configuration for storage
directories. If the quota for some storage directories are not set, the last quota will be used.
There is default quota(128MB) for storage layer with alias MEM, if the quota for any other storage
layer is not set, the system will report the error and exit the initialization.

    $ tachyon.worker.allocate.strategy
Space allocation strategy defines how workers allocate space in storage directories in certain
storage layer. There are three pre-defined strategies: RANDOM, ROUND_ROBIN, and MAX_FREE. RANDOM
means that workers allocate space randomly among storage directories; ROUND_ROBIN means workers
allocate space by round robin among storage directories. MAX_FREE means workers allocate space
in storage directory which has maximum free space, and it is the default strategy used.

    $ tachyon.worker.evict.strategy
Block file eviction strategy, it defines how workers evict block files when a storage layer runs
out of space. Supported strategies are LRU and PARTIAL_LRU. LRU means workers evict blocks by LRU
among storage directories in certain layer, and it is the default strategy. PARTIAL_LRU means
workers evict blocks by LRU in some storage directory selected. More strategies will be added in
future.

For example:

    -Dtachyon.worker.hierarchystore.level.max=2
    -Dtachyon.worker.hierarchystore.level0.alias=MEM
    -Dtachyon.worker.hierarchystore.level0.dirs.path=/mnt/ramdisk
    -Dtachyon.worker.hierarchystore.level0.dirs.quota=10G
    -Dtachyon.worker.hierarchystore.level1.alias=SSD
    -Dtachyon.worker.hierarchystore.level1.dirs.path=/mnt/ssd1,/mnt/ssd2
    -Dtachyon.worker.hierarchystore.level1.dirs.quota=60G,80G
    -Dtachyon.worker.allocate.strategy=MAX_FREE
    -Dtachyon.worker.evict.strategy=LRU

In this example, there are two storage layers. The alias of the first layer is MEM with one
directory. The path is /mnt/ramdisk with 10GB quota. The alias of the second layer is SSD with two
directories. The paths are /mnt/ssd1 and /mnt/ssd2, with 60GB and 80GB quotas respectively. The
space allocation strategy is MAX_FREE and the block eviction strategy is LRU.

Currently only synchronous eviction is supported by hierarchical storage, it is recommended to use
small block size (less than 64MB), to reduce the latency of block eviction. this restriction will
not exist when asynchronous eviction is introduced.


text:
package fr.openwide.core.wicket.more.link.descriptor.builder.impl.parameter;

import java.util.Collection;

import javax.annotation.Nullable;

import org.springframework.core.convert.TypeDescriptor;

import com.google.common.base.Supplier;

import fr.openwide.core.commons.util.functional.SerializableSupplier;

public class LinkParameterTypeInformation<T> {

	/**
	 * We must wrap the typedescriptor in a supplier, since it is not serializable, and clients are serializable (so
	 * they cannot hold references to non-serializable objects).
	 */
	private final Supplier<? extends TypeDescriptor> typeDescriptorSupplier;

	private final Supplier<? extends T> emptyValueSupplier;

	public static <T> LinkParameterTypeInformation<T> valueOf(final Class<T> clazz) {
		return new LinkParameterTypeInformation<T>(
				new SerializableSupplier<TypeDescriptor>() {
					private static final long serialVersionUID = 1L;
					@Override
					public TypeDescriptor get() {
						return TypeDescriptor.valueOf(clazz);
					}
				},
				null
		);
	}

	public static <T extends Collection<TElement>, TElement> LinkParameterTypeInformation<T> collection(
			final Class<? super T> clazz, final Class<TElement> elementType) {
		return new LinkParameterTypeInformation<T>(
				new SerializableSupplier<TypeDescriptor>() {
					private static final long serialVersionUID = 1L;
					@Override
					public TypeDescriptor get() {
						return TypeDescriptor.collection(clazz, TypeDescriptor.valueOf(elementType));
					}
				},
				null
		);
	}

	public static <T extends Collection<?>> LinkParameterTypeInformation<T> collection(
			final Class<? super T> clazz, final TypeDescriptor elementType) {
		return new LinkParameterTypeInformation<T>(
				new SerializableSupplier<TypeDescriptor>() {
					private static final long serialVersionUID = 1L;
					@Override
					public TypeDescriptor get() {
						return TypeDescriptor.collection(clazz, elementType);
					}
				},
				null
		);
	}

	public static <T extends Collection<?>> LinkParameterTypeInformation<T> collection(
			final Class<? super T> clazz, final TypeDescriptor elementType, Supplier<? extends T> emptyValueSupplier) {
		return new LinkParameterTypeInformation<T>(
				new SerializableSupplier<TypeDescriptor>() {
					private static final long serialVersionUID = 1L;
					@Override
					public TypeDescriptor get() {
						return TypeDescriptor.collection(clazz, elementType);
					}
				},
				emptyValueSupplier
		);
	}

	private LinkParameterTypeInformation(Supplier<? extends TypeDescriptor> typeDescriptorSupplier,
			Supplier<? extends T> emptyValueSupplier) {
		super();
		this.typeDescriptorSupplier = typeDescriptorSupplier;
		this.emptyValueSupplier = emptyValueSupplier;
	}

	public Supplier<? extends TypeDescriptor> getTypeDescriptorSupplier() {
		return typeDescriptorSupplier;
	}

	@Nullable
	public Supplier<? extends T> getEmptyValueSupplier() {
		return emptyValueSupplier;
	}

}


text:
url: /services
classes: topic-page
title: Auth0 Professional Services
toc: true
description: Professional Services offered by Auth0.
---

Auth0 Professional Services

    The Auth0 Professional Services Portfolio consists of innovative, specialized service offerings designed to optimize customers investments on the Auth0 Platform. These offerings help customers deploy, implement and maintain solutions based on proven practices, avoiding common pitfalls and reducing risk.

## Assess & Plan

<%= include('../_includes/_topic-links', { links: [
  'services/architectural-design',
  'services/performance-scalability',
  'services/geo-ha',
  'services/scenario-guidance',
  'services/code-review'
] }) %>

## Maintain & Improve

<%= include('../_includes/_topic-links', { links: [
  'services/pair-programming',
  'services/private-saas-configuration',
  'services/code-review',
  'services/custom-extensions'
] }) %>

## Educate

<%= include('../_includes/_topic-links', { links: [
  'services/auth0-introduction',
  'services/auth0-advanced',
  'services/private-saas-introduction',
  'services/private-saas-management'
] }) %>

## Jumpstart

<%= include('../_includes/_topic-links', { links: [
  'services/jumpstart'
] }) %>


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;

namespace Microsoft.CodeAnalysis.Storage
{
    /// <summary>
    /// Obsolete.  Roslyn no longer supports a mechanism to perform arbitrary persistence of data.  If such functionality
    /// is needed, consumers are responsible for providing it themselves with whatever semantics are needed.
    /// </summary>
    [Obsolete("Roslyn no longer exports a mechanism to perform persistence.", error: true)]
    internal sealed class LegacyPersistentStorageService : IPersistentStorageService
    {
        [ExportWorkspaceServiceFactory(typeof(IPersistentStorageService)), Shared]
        internal sealed class Factory : IWorkspaceServiceFactory
        {
            [ImportingConstructor]
            [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
            public Factory()
            {
            }

            public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
                => new LegacyPersistentStorageService();
        }

        public LegacyPersistentStorageService()
        {
        }

        public IPersistentStorage GetStorage(Solution solution)
            => NoOpPersistentStorage.GetOrThrow(throwOnFailure: false);
    }
}


text:
<?php declare(strict_types=1);
/**
 * This file is part of morpho-os/framework
 * It is distributed under the 'Apache License Version 2.0' license.
 * See the https://github.com/morpho-os/framework/blob/master/LICENSE for the full license text.
 */
namespace Morpho\Test\Unit\App\Web;

use Morpho\App\Web\RouteMetaProvider;
use Morpho\Base\IFn;
use Morpho\Testing\TestCase;

use function iterator_to_array;
use function Morpho\Base\dasherize;

class RouteMetaProviderTest extends TestCase {
    private RouteMetaProvider $routeMetaProvider;

    public function setUp(): void {
        parent::setUp();
        $this->routeMetaProvider = new RouteMetaProvider();
    }

    public function testInterface() {
        $this->assertInstanceOf(IFn::class, new RouteMetaProvider());
    }

    public function dataInvoke_RestActions() {
        return [
            [
                'index',
                'GET',
                null,
            ],
            [
                'list',
                'GET',
                'list',
            ],
            [
                'new',
                'GET',
                'new',
            ],
            [
                'create',
                'POST',
                null,
            ],
            [
                'show',
                'GET',
                '{id}',
            ],
            [
                'edit',
                'GET',
                '{id}/edit',
            ],
            [
                'update',
                'PATCH',
                '{id}',
            ],
            [
                'delete',
                'DELETE',
                '{id}',
            ],
        ];
    }

    /**
     * @dataProvider dataInvoke_RestActions
     */
    public function testInvoke_RestActions(string $action, string $expectedHttpMethod, ?string $expectedActionPath) {
        $actionMetas = [
            [
                'module' => 'capture/group',
                'method' => $action,
                'class'  => 'Foo\\Bar\\Web\\My\\Nested\\VerySimpleController',
            ],
        ];
        /** @noinspection PhpParamsInspection */
        $actual = iterator_to_array($this->routeMetaProvider->__invoke($actionMetas));

        $expectedControllerPath = 'my/nested/very-simple';
        $expectedUri = '/' . explode(
                                 '/',
                                 $actionMetas[0]['module']
                             )[1] . '/' . $expectedControllerPath . (null === $expectedActionPath ? '' : '/' . $expectedActionPath);
        $this->assertEquals(
            [
                [
                    'module'         => $actionMetas[0]['module'],
                    'method'         => $actionMetas[0]['method'],
                    'class'          => $actionMetas[0]['class'],
                    'httpMethod'     => $expectedHttpMethod,
                    'uri'            => $expectedUri,
                    'modulePath'     => explode('/', $actionMetas[0]['module'])[1],
                    'controllerPath' => $expectedControllerPath,
                    'actionPath'     => $expectedActionPath,
                ],
            ],
            $actual
        );
    }

    public function testInvoke_DocCommentsWithMultipleHttpMethodsWithCustomPath() {
        $module = 'my-vendor/foo-mod';
        $method = 'doIt';
        $relUriPath = '/some/custom/{id}/edit';
        $actionMetas = [
            [
                'module'     => $module,
                'method'     => $method,
                'docComment' => "/** @POST|PATCH $relUriPath */",
                'class'      => 'Foo\\Bar\\Web\\MySimpleController',
            ],
        ];
        /** @noinspection PhpParamsInspection */
        $actual = iterator_to_array($this->routeMetaProvider->__invoke($actionMetas));
        $this->assertEquals(
            [
                [
                    'module'         => $module,
                    'class'          => $actionMetas[0]['class'],
                    'method'         => $method,
                    'docComment'     => $actionMetas[0]['docComment'],
                    'httpMethod'     => 'POST',
                    'uri'            => $relUriPath,
                    'modulePath'     => 'foo-mod',
                    'controllerPath' => 'my-simple',
                    'actionPath'     => dasherize($method),
                ],
                [
                    'module'         => $module,
                    'class'          => $actionMetas[0]['class'],
                    'method'         => $method,
                    'docComment'     => $actionMetas[0]['docComment'],
                    'httpMethod'     => 'PATCH',
                    'uri'            => $relUriPath,
                    'modulePath'     => 'foo-mod',
                    'controllerPath' => 'my-simple',
                    'actionPath'     => dasherize($method),
                ],
            ],
            $actual
        );
    }

    public function dataDocComments() {
        yield [
            '/**
              * @GET|POST
              */',
            [
                [
                    'httpMethods' => ['GET', 'POST'],
                ],
            ],
        ];

        yield [
            '/**
             * @GET /
             */',
            [
                [
                    'httpMethods' => ['GET'],
                    'uri'         => '/',
                ],
            ],
        ];

        yield [
            '/**
             * @GET /some/path
             */',
            [
                [
                    'httpMethods' => ['GET'],
                    'uri'         => '/some/path',
                ],
            ],
        ];

        yield [
            '/**
              *
              */',
            [
            ],
        ];

        yield [
            '/**
              * @GET /foo/bar
              * @POST|PATCH /baz
              */',
            [
                [
                    'httpMethods' => ['GET'],
                    'uri'         => '/foo/bar',
                ],
                [
                    'httpMethods' => ['POST', 'PATCH'],
                    'uri'         => '/baz',
                ],
            ],
        ];
    }

    /**
     * @dataProvider dataDocComments
     */
    public function testDocComments(string $docComment, array $expected) {
        $this->assertSame($expected, RouteMetaProvider::parseDocComment($docComment));
    }
}


text:
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.psi.formatter.java;

import com.intellij.JavaTestUtil;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;

/**
 * Is intended to hold specific java formatting tests for 'spacing' settings.
 *
 * @author Denis Zhdanov
 */
public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(JavaTestUtil.getMaxRegisteredLanguageLevel());
  }

  public void testSpacingBetweenTypeParameters() {
    // Implied by IDEADEV-3666
    getSettings().SPACE_AFTER_COMMA = true;

    doTextTest("""
                 class Foo {
                 Map<String,String> map() {}
                 }""",
               """
                 class Foo {
                     Map<String, String> map() {
                     }
                 }""");
  }

  @SuppressWarnings("SpellCheckingInspection")
  public void testDoNotPlaceStatementsOnOneLineIfFirstEndsWithSingleLineComment() {
    getSettings().KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE = true;
    getSettings().KEEP_LINE_BREAKS = false;
    String before = """
      public class Reproduce {
          public void start() {
              if (true)
                  return; // comment
              final int count = 5;
              for (int i = 0; i < count; i++) {
                  System.out.println("AAA!");
                  System.out.println("BBB!"); // ololol
                  System.out.println("asda"); /* ololo */
                  System.out.println("booo");
              }
          }
      }""";
    String after = """
      public class Reproduce {
          public void start() {
              if (true) return; // comment
              final int count = 5; for (int i = 0; i < count; i++) {
                  System.out.println("AAA!"); System.out.println("BBB!"); // ololol
                  System.out.println("asda"); /* ololo */ System.out.println("booo");
              }
          }
      }""";
    doTextTest(before, after);
  }

  public void testSpaceBeforeAnnotationParamArray() {
    // Inspired by IDEA-24329
    getSettings().SPACE_BEFORE_ANNOTATION_ARRAY_INITIALIZER_LBRACE = true;

    String text =
      """
        @SuppressWarnings( {"ALL"})
        public class FormattingTest {
        }""";

    // Don't expect the space to be 'ate'
    doTextTest(text, text);
  }

  public void testCommaInTypeArguments() {
    // Inspired by IDEA-31681
    getSettings().SPACE_AFTER_COMMA = false;

    getSettings().SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = false;
    String initial =
      """
        interface TestInterface<A,B> {

            <X,Y> void foo(X x,Y y);
        }

        public class FormattingTest implements TestInterface<String,Integer> {

            public <X,Y> void foo(X x,Y y) {
                Map<String,Integer> map = new HashMap<String,Integer>();
            }
        }""";

    doTextTest(initial, initial); // Don't expect the comma to be inserted

    getSettings().SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = true;
    String formatted =
      """
        interface TestInterface<A,B> {

            <X,Y> void foo(X x,Y y);
        }

        public class FormattingTest implements TestInterface<String, Integer> {

            public <X,Y> void foo(X x,Y y) {
                Map<String, Integer> map = new HashMap<String, Integer>();
            }
        }""";
    doTextTest(initial, formatted); // Expect the comma to be inserted between type arguments
  }

  public void testUnaryOperators() {
    // Inspired by IDEA-52127
    getSettings().SPACE_AROUND_UNARY_OPERATOR = false;

    String initial =
      """
        public class FormattingTest {
            public void foo() {
                int i = 1;
                System.out.println(-i);
                System.out.println(+i);
                System.out.println(++i);
                System.out.println(i++);
                System.out.println(--i);
                System.out.println(i--);
                boolean b = true;
                System.out.println(!b);
            }
        }""";

    doTextTest(initial, initial); // Don't expect spaces to be inserted after unary operators

    getSettings().SPACE_AROUND_UNARY_OPERATOR = true;
    String formatted =
      """
        public class FormattingTest {
            public void foo() {
                int i = 1;
                System.out.println(- i);
                System.out.println(+ i);
                System.out.println(++ i);
                System.out.println(i++);
                System.out.println(-- i);
                System.out.println(i--);
                boolean b = true;
                System.out.println(! b);
            }
        }""";
    doTextTest(initial, formatted); // Expect spaces to be inserted after unary operators
  }

  @SuppressWarnings("unused")
  public void _testJavadocMethodParams() {
    // Inspired by IDEA-42167
    // Disabled because the contents of the {@code tag} is not necessarily Java code and
    // therefore it's incorrect to modify it when formatting
    getSettings().SPACE_AFTER_COMMA = false;

    String initial =
      """
        public class FormattingTest {
            /**
             * This is a convenience method for {@code doTest(test,   new      Object[0]);}
             */
            void doTest() {
            }
        }""";

    // Expect single space to left between 'new' and Object[0].
    doTextTest(initial,
               """
                 public class FormattingTest {
                     /**
                      * This is a convenience method for {@code doTest(test,new Object[0]);}
                      */
                     void doTest() {
                     }
                 }""");

    // Expect space to be inserted between ',' and 'new'.
    getSettings().SPACE_AFTER_COMMA = true;
    doTextTest(initial,
               """
                 public class FormattingTest {
                     /**
                      * This is a convenience method for {@code doTest(test, new Object[0]);}
                      */
                     void doTest() {
                     }
                 }""");

    // Expect space to be inserted between 'test' and ','.
    getSettings().SPACE_BEFORE_COMMA = true;
    doTextTest(initial,
               """
                 public class FormattingTest {
                     /**
                      * This is a convenience method for {@code doTest(test , new Object[0]);}
                      */
                     void doTest() {
                     }
                 }""");
  }

  public void testSpaceWithArrayBrackets() {
    // Inspired by IDEA-58510
    getSettings().SPACE_WITHIN_BRACKETS = true;
    doMethodTest(
      """
        int[] i = new int[1]
        i[0] = 1;
        int[] i2 = new int[]{1}""",
      """
        int[] i = new int[ 1 ]
        i[ 0 ] = 1;
        int[] i2 = new int[]{1}"""
    );
  }

  public void testSpaceBeforeElse() {
    // Inspired by IDEA-58068
    getSettings().ELSE_ON_NEW_LINE = false;

    getSettings().SPACE_BEFORE_ELSE_KEYWORD = false;
    doMethodTest(
      """
        if (true) {
        } else {
        }""",
      """
        if (true) {
        }else {
        }"""
    );

    getSettings().SPACE_BEFORE_ELSE_KEYWORD = true;
    doMethodTest(
      """
        if (true) {
        }else {
        }""",
      """
        if (true) {
        } else {
        }"""
    );
  }

  public void testSpaceBeforeWhile() {
    // Inspired by IDEA-58068
    getSettings().WHILE_ON_NEW_LINE = false;

    getSettings().SPACE_BEFORE_WHILE_KEYWORD = false;
    doMethodTest(
      "do {\n" +
      "} while (true);",
      "do {\n" +
      "}while (true);"
    );

    getSettings().SPACE_BEFORE_WHILE_KEYWORD = true;
    doMethodTest(
      "do {\n" +
      "}while (true);",
      "do {\n" +
      "} while (true);"
    );
  }

  public void testSpaceBeforeCatch() {
    // Inspired by IDEA-58068
    getSettings().CATCH_ON_NEW_LINE = false;

    getSettings().SPACE_BEFORE_CATCH_KEYWORD = false;
    doMethodTest(
      """
        try {
        } catch (Exception e) {
        }""",
      """
        try {
        }catch (Exception e) {
        }"""
    );

    getSettings().SPACE_BEFORE_CATCH_KEYWORD = true;
    doMethodTest(
      """
        try {
        }catch (Exception e) {
        }""",
      """
        try {
        } catch (Exception e) {
        }"""
    );
  }

  public void testSpaceBeforeFinally() {
    // Inspired by IDEA-58068
    getSettings().FINALLY_ON_NEW_LINE = false;

    getSettings().SPACE_BEFORE_FINALLY_KEYWORD = false;
    doMethodTest(
      """
        try {
        } finally {
        }""",
      """
        try {
        }finally {
        }"""
    );

    getSettings().SPACE_BEFORE_FINALLY_KEYWORD = true;
    doMethodTest(
      """
        try {
        }finally {
        }""",
      """
        try {
        } finally {
        }"""
    );
  }

  public void testEmptyIterationAtFor() {
    // Inspired by IDEA-58293

    getSettings().SPACE_AFTER_SEMICOLON = true;
    getSettings().SPACE_WITHIN_FOR_PARENTHESES = false;

    doMethodTest(
      "for (   ; ;         )",
      "for (; ; )"
    );
  }

  public void testSpacesInDisjunctiveType() {
    getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
    getSettings().CATCH_ON_NEW_LINE = false;

    getSettings().SPACE_AROUND_BITWISE_OPERATORS = true;
    doMethodTest("try { } catch (E1|E2 e) { }",
                 "try {} catch (E1 | E2 e) {}");

    getSettings().SPACE_AROUND_BITWISE_OPERATORS = false;
    doMethodTest("try { } catch (E1 | E2 e) { }",
                 "try {} catch (E1|E2 e) {}");
  }

  public void testSpacesInsideLambda() {
    getSettings().KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE = true;
    getSettings().SPACE_AROUND_LAMBDA_ARROW = true;

    doMethodTest("()->{}",
                 "() -> {}");

    getSettings().SPACE_AROUND_LAMBDA_ARROW = false;
    doMethodTest("() -> {}",
                 "()->{}");
  }

  public void testSpacesInsideMethodRef() {
    getSettings().SPACE_AROUND_METHOD_REF_DBL_COLON = true;

    //expr
    doMethodTest("Runnable r = this::foo",
                 "Runnable r = this :: foo");

    //class ref
    doMethodTest("Runnable r = Foo::foo",
                 "Runnable r = Foo :: foo");

    getSettings().SPACE_AROUND_METHOD_REF_DBL_COLON = false;
    doMethodTest("Runnable r = this::foo",
                 "Runnable r = this::foo");
  }

  public void testSpacesBeforeResourceList() {
    getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
    getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;

    getSettings().SPACE_BEFORE_TRY_PARENTHESES = true;
    getSettings().SPACE_BEFORE_TRY_LBRACE = true;
    doMethodTest("try(AutoCloseable r = null){ }",
                 "try (AutoCloseable r = null) {}");

    getSettings().SPACE_BEFORE_TRY_PARENTHESES = false;
    getSettings().SPACE_BEFORE_TRY_LBRACE = false;
    doMethodTest("try (AutoCloseable r = null) { }",
                 "try(AutoCloseable r = null){}");
  }

  public void testSpacesWithinResourceList() {
    getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;

    getSettings().SPACE_WITHIN_TRY_PARENTHESES = false;
    doMethodTest("try (  R r = null  ) { }",
                 "try (R r = null) {}");
    getSettings().SPACE_AFTER_SEMICOLON = false;
    doMethodTest("try (  R r1 = null    ; R r2 = null; ) { }",
                 "try (R r1 = null;R r2 = null;) {}");

    getSettings().SPACE_WITHIN_TRY_PARENTHESES = true;
    doMethodTest("try (R r = null) { }",
                 "try ( R r = null ) {}");
    getSettings().SPACE_AFTER_SEMICOLON = true;
    doMethodTest("try (R r1 = null    ; R r2 = null;) { }",
                 "try ( R r1 = null; R r2 = null; ) {}");
  }

  public void testSpacesBetweenResources() {
    getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;

    getSettings().SPACE_BEFORE_SEMICOLON = false;
    getSettings().SPACE_AFTER_SEMICOLON = true;
    doMethodTest("try (R r1 = null    ; R r2 = null;) { }",
                 "try (R r1 = null; R r2 = null;) {}");

    getSettings().SPACE_BEFORE_SEMICOLON = true;
    getSettings().SPACE_AFTER_SEMICOLON = false;
    doMethodTest("try (R r1 = null;   R r2 = null;) { }",
                 "try (R r1 = null ;R r2 = null ;) {}");
  }

  public void testSpacesInResourceAssignment() {
    getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;

    getSettings().SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
    doMethodTest("try (R r=null) { }",
                 "try (R r = null) {}");

    getSettings().SPACE_AROUND_ASSIGNMENT_OPERATORS = false;
    doMethodTest("try (R r =  null) { }",
                 "try (R r=null) {}");
  }

  public void testBetweenMethodCallArguments() {
    // Inspired by IDEA-71823
    getSettings().SPACE_AFTER_COMMA = false;

    doMethodTest(
      "foo(1, 2, 3);",
      "foo(1,2,3);"
    );
  }

  public void testBeforeAnonymousClassConstructor() {
    // Inspired by IDEA-72321.
    getSettings().SPACE_BEFORE_METHOD_CALL_PARENTHESES = true;

    doMethodTest(
      """
        actions.add(new Action(this) {
            public void run() {
            }
        });""",
      """
        actions.add (new Action (this) {
            public void run() {
            }
        });"""
    );
  }

  public void testBeforeAnnotationArrayInitializer() {
    // Inspired by IDEA-72317
    getSettings().SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = false;
    getSettings().SPACE_BEFORE_ANNOTATION_ARRAY_INITIALIZER_LBRACE = true;

    doClassTest(
      """
        @SuppressWarnings({"HardCodedStringLiteral"})
        void test() {
            int[] data = new int[] {1, 2, 3};
        }""",
      """
        @SuppressWarnings( {"HardCodedStringLiteral"})
        void test() {
            int[] data = new int[]{1, 2, 3};
        }"""
    );
  }

  public void testBetweenParenthesesOfNoArgsMethod() {
    // Inspired by IDEA-74751
    getSettings().SPACE_WITHIN_METHOD_CALL_PARENTHESES = false;
    getSettings().SPACE_WITHIN_EMPTY_METHOD_CALL_PARENTHESES = false;
    getSettings().SPACE_WITHIN_METHOD_PARENTHESES = true;
    getSettings().SPACE_WITHIN_EMPTY_METHOD_PARENTHESES = true;
    doClassTest(
      """
        void test() {
            foo();
        }""",
      """
        void test( ) {
            foo();
        }"""
    );

    getSettings().SPACE_WITHIN_METHOD_CALL_PARENTHESES = true;
    getSettings().SPACE_WITHIN_EMPTY_METHOD_CALL_PARENTHESES = true;
    getSettings().SPACE_WITHIN_METHOD_PARENTHESES = false;
    getSettings().SPACE_WITHIN_EMPTY_METHOD_PARENTHESES = false;
    doClassTest(
      """
        void test() {
            foo();
        }""",
      """
        void test() {
            foo( );
        }"""
    );
  }

  public void testIncompleteCastExpression() {
    // Inspired by IDEA-75043.
    String text = """
      void test(int i) {
          (() i)
      }""";
    doClassTest(text, text);
  }

  public void testSpacesWithinAngleBrackets() {
    getJavaSettings().SPACES_WITHIN_ANGLE_BRACKETS = true;

    String beforeMethod = "static <      T             > void    fromArray(  T  [   ]   a ,   Collection<  T  >  c) {\n}";
    doClassTest(beforeMethod, "static < T > void fromArray(T[] a, Collection< T > c) {\n}");

    String beforeLocal = "Map<    String,   String     > map = new HashMap<   String,   String   >();";
    doMethodTest(beforeLocal, "Map< String, String > map = new HashMap< String, String >();");

    String beforeClass = "class  A <   U    > {\n}";
    doTextTest(beforeClass, "class A< U > {\n}");

    getJavaSettings().SPACES_WITHIN_ANGLE_BRACKETS = false;
    doMethodTest(beforeLocal, "Map<String, String> map = new HashMap<String, String>();");
    doClassTest(beforeMethod, "static <T> void fromArray(T[] a, Collection<T> c) {\n}");
    doTextTest(beforeClass, "class A<U> {\n}");
  }

  public void testSpaceAfterClosingAngleBracket_InTypeArgument() {
    String before = "Bar.<String, Integer>    mess(null);";

    getJavaSettings().SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT = false;
    doMethodTest(before, "Bar.<String, Integer>mess(null);");

    getJavaSettings().SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT = true;
    doMethodTest(before, "Bar.<String, Integer> mess(null);");
  }

  public void testSpaceBeforeOpeningAngleBracket_InTypeParameter() {
    String before = "class        A<T> {\n}";

    getJavaSettings().SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETER = false;
    doTextTest(before, "class A<T> {\n}");

    getJavaSettings().SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETER = true;
    doTextTest(before, "class A <T> {\n}");
  }

  public void testSpaceAroundTypeBounds() {
    String before = "public class     Foo<T extends Bar & Abba, U> {\n}";

    getJavaSettings().SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS = true;
    doTextTest(before, "public class Foo<T extends Bar & Abba, U> {\n}");

    getJavaSettings().SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS = false;
    doTextTest(before, "public class Foo<T extends Bar&Abba, U> {\n}");
  }

  public void testInnerTypeAnnotations() {
    doTextTest(
      """
        class C<@TA(1)T> {
            L<@TA(2)A> f = (@TA(3)  A) new @TA(4)  A() {
                void m(@TA(6) int  @TA(7)[] p) {
                }
            };
        }""",

      """
        class C<@TA(1) T> {
            L<@TA(2) A> f = (@TA(3) A) new @TA(4) A() {
                void m(@TA(6) int @TA(7) [] p) {
                }
            };
        }"""
    );
  }

  public void testClassObjectAccessExpression_BeforeDot() {
    String before = "Test       \n         .class";

    getSettings().KEEP_LINE_BREAKS = true;
    doMethodTest(before, "Test\n        .class");

    getSettings().KEEP_LINE_BREAKS = false;
    doMethodTest(before, "Test.class");
  }

  public void testClassObjectAccessExpression_AfterDot() {
    String before = "Test.      \n     class";

    getSettings().KEEP_LINE_BREAKS = true;
    doMethodTest(before, "Test.\n        class");

    getSettings().KEEP_LINE_BREAKS = false;
    doMethodTest(before, "Test.class");
  }

  public void testMultipleFieldDeclaration_InAnonymousClass() {
    doMethodTest(
      """
        new Object() {
        boolean one, two;
        };""",
      """
        new Object() {
            boolean one, two;
        };"""
    );
  }

  public void testCommentBetweenAnnotationAndModifierList() {
    getSettings().KEEP_LINE_BREAKS = false;
    getSettings().KEEP_FIRST_COLUMN_COMMENT = false;
    doClassTest("""
                  @Override
                  //FIX me this stupid stuff
                  public void run() {
                          int a = 2;
                  }""",

                """
                  @Override
                  //FIX me this stupid stuff
                  public void run() {
                      int a = 2;
                  }""");
  }

  public void testSpace_BeforeSemicolon_InsideFor() {
    getSettings().SPACE_BEFORE_SEMICOLON = true;
    doMethodTest(
      """
        int i = 0;
        for (; i < 10 ; i++) {
        }
        """,
      """
        int i = 0;
        for ( ; i < 10 ; i++) {
        }
        """
    );
  }

  public void testSpace_BeforeSemicolon_InsideFor_IfSpacesWithinForIsOn() {
    getSettings().SPACE_WITHIN_FOR_PARENTHESES = true;
    doMethodTest(
      """
        int i = 0;
        for (; i < 10 ; i++) {
        }
        """,
      """
        int i = 0;
        for ( ; i < 10; i++ ) {
        }
        """
    );
  }

  public void testSpaceBeforeTypeArgumentList() {
    getSettings().SPACE_BEFORE_TYPE_PARAMETER_LIST = true;
    doMethodTest(
      "Map<Int, String> map = new HashMap<Int, String>();",
      "Map <Int, String> map = new HashMap <Int, String>();"
    );
    doMethodTest(
      "Bar.<Int, String>call();",
      "Bar. <Int, String>call();"
    );
  }

  public void testKeepLineBreaksWorks_InsidePolyExpression() {
    getSettings().KEEP_LINE_BREAKS = false;
    doMethodTest(
      "int x = (1 + 2 + 3) *\n" +
      "        (1 + 2 + 2) * (1 + 2);",
      "int x = (1 + 2 + 3) * (1 + 2 + 2) * (1 + 2);"
    );
  }

  public void testKeepFinalOnLine() {
    doClassTest(
      "public    static void bar(@NonNls final String[] args) {\n" +
      "}",
      "public static void bar(@NonNls final String[] args) {\n" +
      "}");
  }

  public void testEnumAnnotations() {
    doTextTest("""
                 enum SampleEnum {
                     @Annotation("1")ONE,
                     @Annotation("2")TWO,
                     @Annotation THREE
                 }""",
               """
                 enum SampleEnum {
                     @Annotation("1") ONE,
                     @Annotation("2") TWO,
                     @Annotation THREE
                 }""");
  }

  public void testSpaceBeforeComma() {
    getSettings().SPACE_BEFORE_COMMA = true;
    doClassTest(
      """
        public void main(String[] args, String xxx) {
          foo(100, 200);
        }""",
      """
        public void main(String[] args , String xxx) {
            foo(100 , 200);
        }""");
  }

  public void testSpacingAroundVarKeyword() {
    doMethodTest("for (  var  path :  paths) ;", "for (var path : paths) ;");
    doMethodTest("try ( @A  var  r  =  open()) { }", "try (@A var r = open()) {\n}");
  }

  public void testSpacingBeforeColonInForeach() {
    getJavaSettings().SPACE_BEFORE_COLON_IN_FOREACH = false;
    doMethodTest("for (int i:arr) ;", "for (int i: arr) ;");
    getJavaSettings().SPACE_BEFORE_COLON_IN_FOREACH = true;
    doMethodTest("for (int i:arr) ;", "for (int i : arr) ;");
  }

  public void testOneLineEnumSpacing() {
    getJavaSettings().SPACE_INSIDE_ONE_LINE_ENUM_BRACES = true;
    doTextTest("enum E {E1, E2}",
               "enum E { E1, E2 }");
  }

  public void testSwitchLabelSpacing() {
    doMethodTest("switch (i) { case\n1\n:break;\ndefault\n:break; }",
                 """
                   switch (i) {
                       case 1:
                           break;
                       default:
                           break;
                   }""");
  }

  public void testSwitchLabeledRuleSpacing() {
    doMethodTest("switch (i) { case\n1\n->\nfoo();\ncase\n2->{bar()};\ndefault->throw new Exception(); }",
                 """
                   switch (i) {
                       case 1 -> foo();
                       case 2 -> {
                           bar()
                       };
                       default -> throw new Exception();
                   }""");
  }

  public void testMultiValueLabel() {
    doMethodTest("switch(i) { case 1,2,  3: break; }",
                 """
                   switch (i) {
                       case 1, 2, 3:
                           break;
                   }""");
  }

  public void testMultiValueLabeledRule() {
    doMethodTest("switch(i) { case 1,2,  3 -> foo(); }",
                 """
                   switch (i) {
                       case 1, 2, 3 -> foo();
                   }""");
  }

  public void testSwitchExpression() {
    doMethodTest("String s = switch\n(i   ){default -> null;}",
                 """
                   String s = switch (i) {
                       default -> null;
                   }""");
  }

  public void testBreakStatementSpacing() {
    getSettings().CASE_STATEMENT_ON_NEW_LINE = false;
    doMethodTest("""
                   String s = switch (i) {
                       case 1: break
                           label ;
                       case 3: break  label ;
                       case 4: break  ;
                   }""",
                 """
                   String s = switch (i) {
                       case 1: break label;
                       case 3: break label;
                       case 4: break;
                   }""");
  }

  public void testYieldStatementSpacing() {
    getSettings().CASE_STATEMENT_ON_NEW_LINE = false;
    doMethodTest("""
                   String s = switch (i) {
                       case 0: yield(foo) ;
                       case 1: yield
                           42 ;
                       case 3: yield  label ;
                       case 4: yield  ;
                   }""",
                 """
                   String s = switch (i) {
                       case 0: yield (foo);
                       case 1: yield 42;
                       case 3: yield label;
                       case 4: yield ;
                   }""");
  }

  public void testSpaceAfterCommaInRecordHeader() {
    getSettings().SPACE_AFTER_COMMA = true;
    doMethodTest("record R(String s,int i){}",
                 "record R(String s, int i) {\n" +
                 "}");
  }

  public void testSpaceBeforeCommaInRecordHeader() {
    getSettings().SPACE_AFTER_COMMA = false;
    getSettings().SPACE_BEFORE_COMMA = true;
    doMethodTest("record R(String s,int i){}",
                 "record R(String s ,int i) {\n" +
                 "}");
  }

  public void testSpaceBetweenGenericsAndName() {
    doTextTest("record A(List<String> string){}",
                 "record A(List<String> string) {\n" +
                 "}");
  }

  public void testSpaceWithinRecordHeader() {
    getJavaSettings().SPACE_WITHIN_RECORD_HEADER = true;
    doTextTest("record A(String string){}",
               "record A( String string ) {\n" +
               "}");
  }

  public void testSpaceBetweenAnnotationAndType() {
    doTextTest("record A(@Foo()String string) {}",
               "record A(@Foo() String string) {\n" +
               "}");
  }

  public void testSpacesAroundRelationalOperators() {
    getSettings().SPACE_AROUND_RELATIONAL_OPERATORS = true;
    doMethodTest(
      """
        if (x >= 1 && y < 100) {
                 if (x<=5 && y>50) {
                    System.out.println("1..5");
                 }
              }""",

      """
        if (x >= 1 && y < 100) {
            if (x <= 5 && y > 50) {
                System.out.println("1..5");
            }
        }"""
    );
    getSettings().SPACE_AROUND_RELATIONAL_OPERATORS = false;
    doMethodTest(
      """
        if (x   >=   1 && y    <  100) {
                 if (x  <=  5 && y   >   50) {
                    System.out.println("1..5");
                 }
              }""",

      """
        if (x>=1 && y<100) {
            if (x<=5 && y>50) {
                System.out.println("1..5");
            }
        }"""
    );
  }

  public void testIdea250968() {
    getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
    getSettings().SPACE_WITHIN_BRACES = true;
    doClassTest(
      "public Long getId (){return id;}",

      "public Long getId() { return id; }"
    );
  }

  public void testAndAndInGuardedPattern() {
    doClassTest(
      """
        void test(Object obj){
          switch(obj){
          case String s&&s.isEmpty()->System.out.println();
          }
        }
        """,

      """
        void test(Object obj) {
            switch (obj) {
                case String s && s.isEmpty() -> System.out.println();
            }
        }
        """);
  }

  public void testSnippet() {
    doTextTest(
      """
        /**
         * {@snippet lang=java}
         **/
        class {}""",

      """
        /**
         * {@snippet lang = java}
         **/
        class {}""");
  }

  public void testLeftShiftExpressionSpacing() {
    getSettings().SPACE_AROUND_SHIFT_OPERATORS = false;
    doMethodTest(
      "int x = a << 2;",
      "int x = a<<2;");
  }

  public void testRightShiftExpressionSpacing() {
    getSettings().SPACE_AROUND_SHIFT_OPERATORS = false;
    doMethodTest(
      "int x = a >> 2;",
      "int x = a>>2;");
  }

  public void testNamedRecordPatternSpacing() {
    doMethodTest(
      "return o instanceof Rec(int i)r",
      "return o instanceof Rec(int i) r");
  }

  public void testDeconstructionPatternSpacing() {
    doMethodTest(
      """
        switch (a) {
         case R  ( int x , String y  , char [ ] chs, List < A > list) -> {}
        }""",
      """
        switch (a) {
            case R(int x, String y, char[] chs, List<A> list) -> {
            }
        }""");
  }

  public void testDeconstructionPatternSpacingBeforeComma() {
    getSettings().SPACE_BEFORE_COMMA = true;
    doMethodTest(
      """
        switch (a) {
         case R  (int x,String y,char [ ] chs,List < A > list) -> {}
        }""",
      """
        switch (a) {
            case R(int x , String y , char[] chs , List<A> list) -> {
            }
        }""");
  }

  public void testDeconstructionPatternSpacingWithin() {
    getJavaSettings().SPACE_WITHIN_DECONSTRUCTION_LIST = true;
    doMethodTest(
      """
        switch (a) {
         case R(int x,String y) -> {}
        }""",
      """
        switch (a) {
            case R( int x, String y ) -> {
            }
        }""");
  }

  public void testDeconstructionPatternSpacingBefore() {
    getJavaSettings().SPACE_BEFORE_DECONSTRUCTION_LIST = true;
    doMethodTest(
      """
        switch (a) {
         case R(int x,String y) -> {}
        }""",
      """
        switch (a) {
            case R (int x, String y) -> {
            }
        }""");
  }

  public void testDeconstructionPatternNewLineAfterLpar() {
    getJavaSettings().NEW_LINE_AFTER_LPAREN_IN_DECONSTRUCTION_PATTERN = true;
    getJavaSettings().DECONSTRUCTION_LIST_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
    doMethodTest(
      """
        switch (a) {
         case R(int x, String y) -> {}
        }""",
      """
        switch (a) {
            case R(
                    int x,
                    String y
            ) -> {
            }
        }""");
  }

  public void testDeconstructionPatternNewLineBeforeRpar() {
    getJavaSettings().RPAREN_ON_NEW_LINE_IN_DECONSTRUCTION_PATTERN = true;
    getJavaSettings().DECONSTRUCTION_LIST_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
    doMethodTest(
      """
        switch (a) {
         case R(int x, String y) -> {}
        }""",
      """
        switch (a) {
            case R(
                    int x,
                    String y
            ) -> {
            }
        }""");
  }
}


text:
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
require 'win_gui'
require 'spec/expectations'
require 'spec/stubs/cucumber'

require 'pathname'
BASE_PATH = Pathname.new(__FILE__).dirname + '../..'


text:
package com.camnter.newlife.widget.webview;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * Description:JsResponseWebView
 * Created by:CaMnter
 * Time:2016-01-12 11:36
 */
public class JsResponseWebView extends WebView {

    private static final String INTERFACE_NAME = "jsResponseInterface";
    private static final String ON_CLICK_PICTURE = "onClickPicture";
    private static final String ON_CLICK_TAG = "onClickTag";

    private String javascript;

    public JsResponseWebView(Context context) {
        super(context);
        this.initWebView();
    }

    public JsResponseWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.initWebView();
    }

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public JsResponseWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
        super(context, attrs, defStyleAttr);
        this.initWebView();
    }

    public JsResponseWebView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.initWebView();
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public JsResponseWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        this.initWebView();
    }

    @SuppressLint("SetJavaScriptEnabled") private void initWebView() {
        WebSettings settings = this.getSettings();
        settings.setJavaScriptEnabled(true);
        this.setWebViewClient(new JsResponseViewClient());
        this.javascript = "javascript:(function(){" +
            "   // 图片   " +
            "   var images = document.getElementsByTagName('img');" +
            "   for(var i=0;i<images.length;i++){" +
            "       images[i].onclick=function(){" +
            "           window." + INTERFACE_NAME + "." + ON_CLICK_PICTURE +
            "(images[i].src);" +
            "       }" +
            "   }" +
            "   // 标签   " +
            "   var tags = document.getElementsByClassName('video');" +
            "   for(var i=0;i<tags.length;i++){" +
            "       tags[i].onclick=function(){" +
            "           window." + INTERFACE_NAME + "." + ON_CLICK_TAG + "(tags[i].id,i);" +
            "       }" +
            "   }" +
            "})()";
    }

    /**
     * inject your java script
     */
    private void injectJavaScript() {
        if (TextUtils.isEmpty(this.javascript)) return;
        this.loadUrl(this.javascript);
    }

    public void setJavascript(String javascript) {
        this.javascript = javascript;
    }

    @SuppressLint("AddJavascriptInterface")
    public void setJsResponseInterface(JsResponseInterface jsResponseInterface) {
        if (jsResponseInterface == null) return;
        this.addJavascriptInterface(jsResponseInterface, INTERFACE_NAME);
    }

    /**
     * 继承此类实现自己逻辑
     * 并且调用setJsResponseInterface
     */
    public interface JsResponseInterface {
        /**
         * 标签点击
         *
         * @param name name
         */
        @JavascriptInterface void onClickTag(String name);

        /**
         * 图片点击
         *
         * @param url url
         * @param position position
         */
        @JavascriptInterface void onClickPicture(String url, int position);
    }

    private class JsResponseViewClient extends WebViewClient {
        @Override public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            JsResponseWebView.this.injectJavaScript();
        }
    }
}


text:
import { octave } from './transpose-chord'

const getKeyDiff = (keyFrom, keyTo) => {
	if (!keyFrom || !keyTo) return 0

	const diff = octave.indexOf(keyTo) - octave.indexOf(keyFrom)

	//console.log(`getKeyDiff - from '${keyFrom}' to '${keyTo}'`, diff)

	return diff < 0 ? diff + octave.length : diff
}

export default getKeyDiff