text:
/*-
 * 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.
 */

package net.harawata.appdirs.impl;

import static org.junit.Assert.*;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class WindowsAppDirTest {
  private static String origFileSeparator;

  private WindowsAppDirs appDirs;

  @BeforeClass
  public static void setUp() {
    origFileSeparator = System.setProperty("file.separator", "\\");
  }

  @Before
  public void pre() {
    appDirs = new WindowsAppDirs(new MockWindowsFolderResolver());
  }

  @Test
  public void testGetUserDataDir() {
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data",
        appDirs.getUserDataDir(null, null, null));
    assertEquals("C:\\Documents and Settings\\harawata\\Application Data",
        appDirs.getUserDataDir(null, null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp",
        appDirs.getUserDataDir("myapp", null, null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Application Data\\myapp",
        appDirs.getUserDataDir("myapp", null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp\\1.2.3",
        appDirs.getUserDataDir("myapp", "1.2.3", null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Application Data\\myapp\\1.2.3",
        appDirs.getUserDataDir("myapp", "1.2.3", null, true));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getUserDataDir("myapp", "1.2.3", "harawata"));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getUserDataDir("myapp", "1.2.3", "harawata", true));
  }

  @Test
  public void testGetUserConfigDir() {
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data",
        appDirs.getUserConfigDir(null, null, null));
    assertEquals("C:\\Documents and Settings\\harawata\\Application Data",
        appDirs.getUserConfigDir(null, null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp",
        appDirs.getUserConfigDir("myapp", null, null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Application Data\\myapp",
        appDirs.getUserConfigDir("myapp", null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp\\1.2.3",
        appDirs.getUserConfigDir("myapp", "1.2.3", null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Application Data\\myapp\\1.2.3",
        appDirs.getUserConfigDir("myapp", "1.2.3", null, true));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getUserConfigDir("myapp", "1.2.3", "harawata"));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getUserConfigDir("myapp", "1.2.3", "harawata", true));
  }

  @Test
  public void testGetUserCacheDir() {
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\Cache",
        appDirs.getUserCacheDir(null, null, null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp\\Cache",
        appDirs.getUserCacheDir("myapp", null, null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp\\Cache\\1.2.3",
        appDirs.getUserCacheDir("myapp", "1.2.3", null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\harawata\\myapp\\Cache\\1.2.3",
        appDirs.getUserCacheDir("myapp", "1.2.3", "harawata"));
  }

  @Test
  public void testGetUserLogDir() {
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\Logs",
        appDirs.getUserLogDir(null, null, null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp\\Logs",
        appDirs.getUserLogDir("myapp", null, null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\myapp\\Logs\\1.2.3",
        appDirs.getUserLogDir("myapp", "1.2.3", null));
    assertEquals(
        "C:\\Documents and Settings\\harawata\\Local Settings\\Application Data\\harawata\\myapp\\Logs\\1.2.3",
        appDirs.getUserLogDir("myapp", "1.2.3", "harawata"));
  }

  @Test
  public void testSiteDataDir() {
    assertEquals("C:\\Documents and Settings\\All Users\\Application Data",
        appDirs.getSiteDataDir(null, null, null));
    assertEquals("C:\\Documents and Settings\\All Users\\Application Data",
        appDirs.getSiteDataDir(null, null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp",
        appDirs.getSiteDataDir("myapp", null, null));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp",
        appDirs.getSiteDataDir("myapp", null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp\\1.2.3",
        appDirs.getSiteDataDir("myapp", "1.2.3", null));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp\\1.2.3",
        appDirs.getSiteDataDir("myapp", "1.2.3", null, true));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getSiteDataDir("myapp", "1.2.3", "harawata"));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getSiteDataDir("myapp", "1.2.3", "harawata", true));
  }

  @Test
  public void testSiteConfigDir() {
    assertEquals("C:\\Documents and Settings\\All Users\\Application Data",
        appDirs.getSiteConfigDir(null, null, null));
    assertEquals("C:\\Documents and Settings\\All Users\\Application Data",
        appDirs.getSiteConfigDir(null, null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp",
        appDirs.getSiteConfigDir("myapp", null, null));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp",
        appDirs.getSiteConfigDir("myapp", null, null, true));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp\\1.2.3",
        appDirs.getSiteConfigDir("myapp", "1.2.3", null));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp\\1.2.3",
        appDirs.getSiteConfigDir("myapp", "1.2.3", null, true));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getSiteConfigDir("myapp", "1.2.3", "harawata"));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getSiteConfigDir("myapp", "1.2.3", "harawata", true));
  }

  @Test
  public void testgetSharedDir() {
    assertEquals("C:\\Documents and Settings\\All Users\\Application Data",
        appDirs.getSharedDir(null, null, null));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp",
        appDirs.getSharedDir("myapp", null, null));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\myapp\\1.2.3",
        appDirs.getSharedDir("myapp", "1.2.3", null));
    assertEquals(
        "C:\\Documents and Settings\\All Users\\Application Data\\harawata\\myapp\\1.2.3",
        appDirs.getSharedDir("myapp", "1.2.3", "harawata"));
  }

  @AfterClass
  public static void tearDown() {
    if (origFileSeparator == null)
      System.clearProperty("file.separator");
    else
      System.setProperty("file.separator", origFileSeparator);
  }
}


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInited5491772c60fc7b7118b53551f4ca55::getLoader();

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Users\Form\RegisterForm;

class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        $form= new RegisterForm();
    	$view = new  ViewModel(array('form' =>$form));
		return $view;
    }
}


text:
(function () {
    "use strict";
    var system = require("system");
    //var url = system.args[1];
    var url = "test.html";
    phantom.viewportSize = {width: 800, height: 600};

    console.log("Opening " + url);

    var page = new WebPage();

    // This is required because PhantomJS sandboxes the website and it does not
    // show up the console messages form that page by default
    page.onConsoleMessage = function (msg) {
        console.log(msg);

        // Exit as soon as the last test finishes.
        if (msg && msg.indexOf("##teamcity[testSuiteFinished name='testsuite'") !== -1) {
            phantom.exit();
        }
    };

    page.open(url, function (status) {
        if (status !== 'success') {
            console.log('Unable to load the address!');
            phantom.exit(-1);
        } else {
            // Timeout - kill PhantomJS if still not done after 2 minutes.
            window.setTimeout(function () {
                phantom.exit();
            }, 120 * 1000);
        }
    });
}());


text:
#import "SBBBBulletinInfo.h"

@class SBNotificationsSectionInfo, UIColor, UIImage;

@interface SBNotificationsBulletinInfo : SBBBBulletinInfo
{
    SBNotificationsSectionInfo *_sectionInfo;
    double _heightForReusableView;
    struct CGSize _referenceSize;
    UIImage *_icon;
    UIImage *_attachmentImage;
    struct CGSize _attachmentImageSize;
    double _secondaryTextHeight;
    _Bool _suppressingMessageForPrivacy;
    _Bool _isCachedMessageSuppressionValid;
    UIColor *_secondaryTextColor;
}

@property(readonly, nonatomic) UIColor *secondaryTextColor; // @synthesize secondaryTextColor=_secondaryTextColor;
@property(retain, nonatomic) SBNotificationsSectionInfo *sectionInfo; // @synthesize sectionInfo=_sectionInfo;
@property(nonatomic) struct CGSize attachmentImageSize; // @synthesize attachmentImageSize=_attachmentImageSize;
@property(retain, nonatomic) UIImage *attachmentImage; // @synthesize attachmentImage=_attachmentImage;
@property(retain, nonatomic) UIImage *icon; // @synthesize icon=_icon;
- (void)populateReusableView:(id)arg1;
- (double)heightForReusableViewInTableView:(id)arg1;
- (_Bool)_isLayoutValidWithReferenceSize:(struct CGSize)arg1;
- (struct CGSize)_effectiveAttachmentImageSize;
- (id)_attachmentImageToDisplay;
- (id)_eventDateLabelForDisplay;
- (id)_eventDateLabel;
- (void)_configureEventDateLabel:(id)arg1;
- (id)_relevanceDateLabel;
- (void)_configureRelevanceDateLabel:(id)arg1;
- (CDStruct_89ddc8e1)_relevanceDateLabelDescription;
- (id)_endDate;
- (id)_secondaryTextColor;
- (id)_secondaryTextToDisplay;
- (id)_secondaryText;
- (id)_subtitleTextColor;
- (id)_subtitleTextToDisplay;
- (id)_subtitleText;
- (id)_relevanceDateTextColor;
- (id)_primaryTextColor;
@property(readonly, nonatomic, getter=isSuppressingMessageForPrivacy) _Bool suppressingMessageForPrivacy; // @synthesize suppressingMessageForPrivacy=_suppressingMessageForPrivacy;
- (id)_primaryText;
- (void)invalidateCachedLayoutData;
- (Class)reusableViewClass;
- (id)identifier;
- (void)dealloc;

@end


text:
'use strict';

// A wrapper for the tooltip element, for modularizing the code and additional convenience.

// TODO: Strip out unneeded sections and consider simplification points.

module.exports = function() {
  return {
    el: function() {
      const _el = document.createElement('div');
      _el.classList.add('test-pkg');

      return _el;
    }(),

    // Utility Functions
    // Remove the tooltip.
    remove: function() {
      this.el.parentNode.removeChild(this.el);
    },

    // Add a class to the tooltip.
    addClass: function(className) {
      this.el.classList.add(className);
      return this;
    },

    // Remove a class from the tooltip.
    removeClass: function(className) {
      this.el.classList.remove(className);
      return this;
    },

    // Check if the tooltip contains the class.
    hasClass: function(className) {
      return this.el.classList.contains(className);
    },

    // Get the tooltip's width.
    width: function() {
      return this.el.offsetWidth;
    },

    // Get the tooltip's height.
    height: function( ){
      return this.el.offsetHeight;
    },

    // Set the tooltip's height.
    setHeight: function(height) {
      this.el.style.height = `${height}px`;
    },

    // Determine if the tooltip has a child element or not.
    hasChild: function(child) {
      if (child) {
        let _parent = child.parentNode;

        if (child === this.el) {
          return true;
        } else {
          return this.hasChild(_parent);
        }
      }

      return false;
    },

    // Determine if the tooltip is open or closed.
    isOpen: function() {
      return this.hasClass('is--open');
    },

    // Open the tooltip.
    open: function() {
      this.addClass('is--open');
    },

    // Close the tooltip.
    close: function() {
      this.removeClass('is--open');
    },

    // Determine if the tooltip is flipped or not. TODO Remove?
    isFlipped: function() {
      return this.hasClass('is--flipped');
    },

    // Flip and un-flip the tooltip. TODO: Remove?
    flip: function() {
      return this.addClass('is--flipped');
    },
    unflip: function() {
      return this.removeClass('is--flipped');
    },
    // Set tooltip position
    // - x {Number}
    // - y {Number}
    setPosition: function(x, y) {
      this.el.style.left = `${x}px`;
      this.el.style.top = `${y}px`;
      return this;
    },

    // Add a child on the tooltip element
    add: function(element) {
      this.el.appendChild(element);
      return this;
    },
  };
};


text:
package org.reactfx;

import java.util.function.Consumer;

class HookStream<T> extends EventStreamBase<T> {
    private final EventStream<T> source;
    private final Consumer<? super T> sideEffect;
    private boolean sideEffectInProgress = false;

    public HookStream(EventStream<T> source, Consumer<? super T> sideEffect) {
        this.source = source;
        this.sideEffect = sideEffect;
    }

    @Override
    protected Subscription observeInputs() {
        return source.subscribe(t -> {
            if(sideEffectInProgress) {
                throw new IllegalStateException("Side effect is not allowed to cause recursive event emission");
            }

            sideEffectInProgress = true;
            try {
                sideEffect.accept(t);
            } finally {
                sideEffectInProgress = false;
            }

            emit(t);
        });
    }
}


text:
<?php
    require_once '../../../../config.php';
    require_once '../../classes/cRequest.php';

    /**
    * Test class for cRequest
    *
    * @author Dylan Pruitt
    */
    class cRequestTest extends PHPUnit_Framework_TestCase
    {
        protected $oRequest;

        public function setUp()
        {
            $this->oRequest = new cRequest();
        }

        public function tearDown()
        {
            unset( $this->oRequest );
        }

        public function testSendRequest()
        {
            $sReturn = $this->oRequest->SendRequest( 'GET', 'http://www.clemson.edu' );

            $this->assertNotNull( $sReturn );
        }
    }
?>


text:
@interface FLEXSubtitleTableViewCell : FLEXTableViewCell

@end


text:
January 15, 2018 16:25:08 Library.fmp12 - menuTest -1-
tagMenu: menuTest
#
#Admin tasks.
Allow User Abort [ Off ]
Set Error Capture [ On ]
#
#Prevent halting of script.
Set Variable [ $$doNotHaltOtherScripts; Value:1 ]
#
#If user is in tag field and has changed spelling
#exit this tag record, otherwise current reference record
#will get deleted by the spelling check script.
Go to Field [ ]
#
#Clear brainstorm and test tags.
If [ $$citationMatch = "brainstorm" ]
Select Window [ Name: "Learn"; Current file ]
Go to Field [ ]
Set Variable [ $$citationItem; Value:testlearn::kNodePrimary ]
Set Variable [ $$tagBrainstorm ]
Set Variable [ $$tagtest ]
Set Field [ TEMP::ktestSubsection; "" ]
Set Variable [ $$tagRecordID ]
Set Variable [ $$tagEdit ]
Select Window [ Name: "Tag Menus"; Current file ]
End If
#
#Clear testlearn records' order numbers.
Set Variable [ $$stopLoadTagRecord; Value:1 ]
New Window [ Height: 1; Width: 1; Style: Document; Close: "Yes"; Minimize: "Yes"; Maximize: "Yes"; Zoom Control Area: "Yes";
Resize: "Yes" ]
Go to Layout [ "learnSCRIPTloops" (testlearn) ]
Perform Find [ Specified Find Requests: Find Records; Criteria: testlearn::orderTestInformation: "###" ]
[ Restore ]
Loop
Set Field [ testlearn::orderTestInformation; "" ]
Go to Record/Request/Page
[ Next; Exit after last ]
End Loop
Close Window [ Current Window ]
Set Variable [ $$stopLoadTagRecord ]
Set Variable [ $$doNotHaltOtherScripts ]
#
#Conditionally format Tag Menu button.
Set Variable [ $$citationMatch; Value:"test" ]
#
#Turn off the loadtagrecord script to speed up the
#loop portion of the script.
Set Variable [ $$stopLoadTagRecord; Value:1 ]
#
#Goto correct layout.
If [ Left (Get (LayoutName) ; 1) = "l" ]
Go to Layout [ "learnTest" (testSubsectionTemplate) ]
If [ TEMP::InventoryLibraryYN ≠ "" ]
Go to Layout [ "learnSTest" (testSubsectionTemplate) ]
End If
Else If [ Left (Get (LayoutName) ; 1) = "r" ]
Go to Layout [ "learnTest" (testSubsectionTemplate) ]
If [ TEMP::InventoryLibraryYN ≠ "" ]
Go to Layout [ "learnSTest" (testSubsectionTemplate) ]
End If
Else If [ Left (Get (LayoutName) ; 1) = "t" ]
Go to Layout [ "learnTest" (testSubsectionTemplate) ]
If [ TEMP::InventoryLibraryYN ≠ "" ]
Go to Layout [ "learnSTest" (testSubsectionTemplate) ]
End If
End If
#
#Find test subsection tags.
If [ $$testSubsection = "" ]
Show All Records
Else
Enter Find Mode [ ]
Set Field [ testSubsectionTemplate::_LtestSubsection; $$testSubsection ]
Perform Find [ ]
Show Custom Dialog [ Message: "Learn records can ONLY be added and removed from the subsection being edited. To edit
ALL subsections' info, 1) click the back buttons until you return to Library Setup. 2) Click Learn, and 3) in the Tag Menus
window, click test."; Default Button: "OK", Commit: "Yes" ]
End If
#
#Sort into groups.
Sort Records [ Keep records in sorted order; Specified Sort Order: testSubsectionGroup::orderOrLibraryType; based on value list:
"order Pulldown List"
testSubsectionGroup::name; ascending
tagMenus::orderOrLock; based on value list: "order Pulldown List"
testSubsectionTemplate::order; ascending
testSubsectionTemplate::name; ascending ]
[ Restore; No dialog ]
#
#If user did not just come from the test
#module, go to current learn record's first
#listed test or the first test record.
Go to Record/Request/Page
[ First ]
Scroll Window
[ Home ]
#
If [ $$editTestInfo ≠ 1 ]
Loop
Set Variable [ $number; Value:1 ]
Go to Field [ ]
Loop
Exit Loop If [ Middle ( GetValue ( $$test ; $number ) ; 4 ; 42 ) & "¶" = testSubsectionTemplate::_LtestSubsection & ¶ ]
Exit Loop If [ Middle ( GetValue ( $$test ; $number ) ; 4 ; 42 ) = "" ]
Set Variable [ $add; Value:$number ]
Set Variable [ $number; Value:$add + 1 ]
End Loop
Exit Loop If [ Middle ( GetValue ( $$test ; $number ) ; 4 ; 42 ) & "¶" = testSubsectionTemplate::_LtestSubsection & ¶ ]
Go to Record/Request/Page
[ Next; Exit after last ]
End Loop
If [ Middle ( GetValue ( $$test ; $number ) ; 4 ; 42 ) & "¶" ≠ testSubsectionTemplate::_LtestSubsection & ¶ ]
Go to Record/Request/Page
[ First ]
Scroll Window
[ Home ]
End If
#
#If user just came from test module then loop
#to the test the user was interested in editing.
Else
Go to Record/Request/Page
[ First ]
Scroll Window
[ Home ]
Loop
Exit Loop If [ $$testSubsection = testSubsectionTemplate::_LtestSubsection ]
Go to Record/Request/Page
[ Next; Exit after last ]
End Loop
End If
#
#Turn loadtagrecord script back on and perform
#load-test-tag script to highlight any Learn records
#tagged with the current tag record.
Set Variable [ $$stopLoadTagRecord ]
Perform Script [ "loadTestTags" ]
#


text:
<?php

namespace Magento\Framework\View\Test\Unit\Layout\Generator;

use \Magento\Framework\View\Layout\Generator\UiComponent;

use Magento\Framework\View\Layout;
use Magento\Framework\View\Layout\ScheduledStructure;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;

class UiComponentTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ObjectManagerHelper
     */
    protected $objectManagerHelper;

    /**
     * @var ScheduledStructure|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $scheduledStructureMock;

    /**
     * @var Layout\Reader\Context|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $readerContextMock;

    /**
     * @var \Magento\Framework\View\Element\UiComponentFactory|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $uiComponentFactoryMock;

    /**
     * @var \Magento\Framework\Data\Argument\InterpreterInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $argumentInterpreterMock;

    /**
     * @var \Magento\Framework\View\Element\UiComponent\ContextFactory|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $contextFactoryMock;

    /**
     * @var \Magento\Framework\View\Element\BlockFactory|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $blockFactoryMock;

    /**
     * @var \Magento\Framework\View\Layout\Generator\UiComponent
     */
    protected $uiComponent;

    protected function setUp()
    {
        $this->objectManagerHelper = new ObjectManagerHelper($this);
        $this->argumentInterpreterMock = $this->getMockBuilder('Magento\Framework\Data\Argument\InterpreterInterface')
            ->disableOriginalConstructor()->getMockForAbstractClass();
        $this->uiComponentFactoryMock = $this->getMockBuilder('Magento\Framework\View\Element\UiComponentFactory')
            ->disableOriginalConstructor()->getMock();
        $this->scheduledStructureMock = $this->getMockBuilder('Magento\Framework\View\Layout\ScheduledStructure')
            ->disableOriginalConstructor()->getMock();
        $this->contextFactoryMock = $this->getMock(
            'Magento\Framework\View\Element\UiComponent\ContextFactory',
            [],
            [],
            '',
            false
        );
        $this->blockFactoryMock = $this->getMock(
            'Magento\Framework\View\Element\BlockFactory',
            [],
            [],
            '',
            false
        );

        $this->uiComponent = $this->objectManagerHelper->getObject(
            'Magento\Framework\View\Layout\Generator\UiComponent',
            [
                'uiComponentFactory' => $this->uiComponentFactoryMock,
                'blockFactory' => $this->blockFactoryMock,
                'contextFactory' => $this->contextFactoryMock
            ]
        );
    }

    public function testProcess()
    {
        $this->prepareScheduledStructure();

        $this->readerContextMock = $this->getMockBuilder('Magento\Framework\View\Layout\Reader\Context')
            ->disableOriginalConstructor()->getMock();

        $this->readerContextMock->expects($this->any())
            ->method('getScheduledStructure')
            ->willReturn($this->scheduledStructureMock);

        $generatorContextMock = $this->getMockBuilder('Magento\Framework\View\Layout\Generator\Context')
            ->disableOriginalConstructor()->getMock();

        $structureMock = $this->getMockBuilder('Magento\Framework\View\Layout\Data\Structure')
            ->disableOriginalConstructor()->getMock();

        $structureMock->expects($this->once())
            ->method('addToParentGroup')
            ->with(UiComponent::TYPE, 'new_group')
            ->willReturnSelf();

        $layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface')->getMockForAbstractClass();

        $generatorContextMock->expects($this->any())
            ->method('getStructure')
            ->willReturn($structureMock);
        $generatorContextMock->expects($this->any())
            ->method('getLayout')
            ->willReturn($layoutMock);

        $this->uiComponentFactoryMock->expects($this->any())
            ->method('setLayout')
            ->with($layoutMock)
            ->willReturnSelf();

        $componentMock = $this->getMockForAbstractClass(
            'Magento\Framework\View\Element\UiComponentInterface',
            [],
            '',
            false,
            true,
            true,
            []
        );

        $contextMock = $this->getMockForAbstractClass(
            'Magento\Framework\View\Element\UiComponent\ContextInterface',
            [],
            '',
            false
        );
        $blockMock = $this->getMockForAbstractClass(
            'Magento\Framework\View\Element\BlockInterface',
            [],
            '',
            false
        );

        $this->contextFactoryMock->expects($this->once())
            ->method('create')
            ->with(
                [
                    'namespace' => 'uiComponent',
                    'pageLayout' => $layoutMock
                ]
            )->willReturn($contextMock);

        $this->uiComponentFactoryMock->expects($this->any())
            ->method('create')
            ->with(
                'uiComponent',
                null,
                ['context' => $contextMock]
            )->willReturn($componentMock);

        $this->blockFactoryMock->expects($this->once())
            ->method('createBlock')
            ->with(UiComponent::CONTAINER, ['component' => $componentMock])
            ->willReturn($blockMock);

        $this->argumentInterpreterMock->expects($this->any())
            ->method('evaluate')
            ->will($this->returnValueMap([
                [['key_1' => 'value_1'], 'value_1'],
                [['key_2' => 'value_2'], 'value_2'],
            ]));

        $layoutMock->expects($this->any())
            ->method('setBlock')
            ->with(UiComponent::TYPE, $blockMock)
            ->willReturnSelf();

        $this->uiComponent->process($this->readerContextMock, $generatorContextMock);
    }

    protected function prepareScheduledStructure()
    {
        $this->scheduledStructureMock->expects($this->any())
            ->method('getElements')
            ->willReturn([
                UiComponent::TYPE => [
                    UiComponent::TYPE,
                    [
                        'attributes' => [
                            'group'   => 'new_group',
                            'component' => 'component_name',
                        ],
                        'arguments'  => [
                            'attribute_1' => ['key_1' => 'value_1'],
                            'attribute_2' => ['key_2' => 'value_2'],
                        ]
                    ],
                ],
            ]);
    }
}


text:
/*
 * PentaxisArmKdlFK.h
 *
 *  Created on: Oct 29, 2014
 *      Author: raha, Moises Estrada
 */

#ifndef PENTAXISARMKDLFK_H_
#define PENTAXISARMKDLFK_H_

#include "PentaxisArmFK.h"

namespace pentaxis_kinematics
{

class PentaxisArmKdlFK: public PentaxisArmFK
{
public:
  /**
   * Ctor.
   *
   * @brief Initialize the solver by providing a urdf::Model and a root and tip name.
   * @param robot_model A urdf::Model representation of the Pentaxis robot model
   * @param robot_description The XML string that of a urdf::Model which represents the Pentaxis robot model
   * @param root_name The root joint name of the arm
   * @param joint_name The tip joint name of the arm
   */
  PentaxisArmKdlFK(const urdf::Model &robot_model,
                 const std::string &robot_description,
                 const std::string &root_name,
                 const std::string &tip_name);

  /**
   * Dtor.
   */
  virtual
  ~PentaxisArmKdlFK();

  /**
   * @see ForwardKinematics::JntToCart
   */
  int
  JntToCart(const KDL::JntArray &q_in,
            KDL::Frame &p_out,
            int segmentNr = -1);

  /**
   * @see ForwardKinematics::getSolverInfo
   */
  void
  getSolverInfo(moveit_msgs::KinematicSolverInfo &response) const;

  /**
   * @see ForwardKinematics::getSegmentIndex
   */
  int
  getSegmentIndex(const std::string &name) const;

private:
  /**
   * Add a joint that is described by URDF to a kinematic chain description.
   * @param joint The joint in URDF description.
   * @param info The information about the IK solver which will be extended.
   */
  void
  addJointToChainInfo(boost::shared_ptr<const urdf::Joint> joint,
                      moveit_msgs::KinematicSolverInfo &info);

private:
  /**
   * The chain that the inverse kinematics is solved for.
   */
  KDL::Chain _chain;

  /**
   * Minimum joint limits.
   */
  std::vector<double> _min_angles;

  /**
   * Maximum joint limits.
   */
  std::vector<double> _max_angles;

  /**
   * Information about the IK solver.
   */
  moveit_msgs::KinematicSolverInfo _solver_info;
};

} /* namespace pentaxis_kinematics */

#endif /* PENTAXISARMKDLFK_H_ */


text:
package org.apache.flink.runtime.state.heap;

import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.core.memory.DataInputView;

import java.io.IOException;

/**
 * This class provides a static factory method to create different implementations of {@link StateTableByKeyGroupReader}
 * depending on the provided serialization format version.
 * <p>
 * The implementations are also located here as inner classes.
 */
class StateTableByKeyGroupReaders {

	/**
	 * Creates a new StateTableByKeyGroupReader that inserts de-serialized mappings into the given table, using the
	 * de-serialization algorithm that matches the given version.
	 *
	 * @param table the {@link StateTable} into which de-serialized mappings are inserted.
	 * @param version version for the de-serialization algorithm.
	 * @param <K> type of key.
	 * @param <N> type of namespace.
	 * @param <S> type of state.
	 * @return the appropriate reader.
	 */
	static <K, N, S> StateTableByKeyGroupReader readerForVersion(StateTable<K, N, S> table, int version) {
		switch (version) {
			case 1:
				return new StateTableByKeyGroupReaderV1<>(table);
			case 2:
				return new StateTableByKeyGroupReaderV2<>(table);
			default:
				throw new IllegalArgumentException("Unknown version: " + version);
		}
	}

	static abstract class AbstractStateTableByKeyGroupReader<K, N, S>
			implements StateTableByKeyGroupReader {

		protected final StateTable<K, N, S> stateTable;

		AbstractStateTableByKeyGroupReader(StateTable<K, N, S> stateTable) {
			this.stateTable = stateTable;
		}

		@Override
		public abstract void readMappingsInKeyGroup(DataInputView div, int keyGroupId) throws IOException;

		protected TypeSerializer<K> getKeySerializer() {
			return stateTable.keyContext.getKeySerializer();
		}

		protected TypeSerializer<N> getNamespaceSerializer() {
			return stateTable.getNamespaceSerializer();
		}

		protected TypeSerializer<S> getStateSerializer() {
			return stateTable.getStateSerializer();
		}
	}

	static final class StateTableByKeyGroupReaderV1<K, N, S>
			extends AbstractStateTableByKeyGroupReader<K, N, S> {

		StateTableByKeyGroupReaderV1(StateTable<K, N, S> stateTable) {
			super(stateTable);
		}

		@Override
		public void readMappingsInKeyGroup(DataInputView inView, int keyGroupId) throws IOException {

			if (inView.readByte() == 0) {
				return;
			}

			final TypeSerializer<K> keySerializer = getKeySerializer();
			final TypeSerializer<N> namespaceSerializer = getNamespaceSerializer();
			final TypeSerializer<S> stateSerializer = getStateSerializer();

			// V1 uses kind of namespace compressing format
			int numNamespaces = inView.readInt();
			for (int k = 0; k < numNamespaces; k++) {
				N namespace = namespaceSerializer.deserialize(inView);
				int numEntries = inView.readInt();
				for (int l = 0; l < numEntries; l++) {
					K key = keySerializer.deserialize(inView);
					S state = stateSerializer.deserialize(inView);
					stateTable.put(key, keyGroupId, namespace, state);
				}
			}
		}
	}

	private static final class StateTableByKeyGroupReaderV2<K, N, S>
			extends AbstractStateTableByKeyGroupReader<K, N, S> {

		StateTableByKeyGroupReaderV2(StateTable<K, N, S> stateTable) {
			super(stateTable);
		}

		@Override
		public void readMappingsInKeyGroup(DataInputView inView, int keyGroupId) throws IOException {

			final TypeSerializer<K> keySerializer = getKeySerializer();
			final TypeSerializer<N> namespaceSerializer = getNamespaceSerializer();
			final TypeSerializer<S> stateSerializer = getStateSerializer();

			int numKeys = inView.readInt();
			for (int i = 0; i < numKeys; ++i) {
				N namespace = namespaceSerializer.deserialize(inView);
				K key = keySerializer.deserialize(inView);
				S state = stateSerializer.deserialize(inView);
				stateTable.put(key, keyGroupId, namespace, state);
			}
		}
	}
}


text:
/* eslint no-param-reassign: 0 */

const fs = require('fs');
const readline = require('readline');

const minTab = (file, path, speciesIDs, skip) => (
  new Promise((resolve, reject) => {
    if (skip) {
      resolve();
    } else {
      const streams = Object.values(speciesIDs).reduce((accum, specie) => {
        const writeStream = fs.createWriteStream(`${path}/${specie}.tab`, { flags: 'w' });
        accum[specie] = writeStream;
        return accum;
      }, {});

      let isHeader = true;
      const lineReader = readline.createInterface({
        input: fs.createReadStream(file),
      });
      lineReader.on('line', (line) => {
        if (!isHeader) {
          const fields = line.split('\t');
          const organismA = fields[15];
          const organismB = fields[16];
          const organisms = [];
          if (speciesIDs[organismA]) {
            organisms.push(speciesIDs[organismA]);
          }
          if (speciesIDs[organismB]) {
            organisms.push(speciesIDs[organismB]);
          }
          const uniqueOrganisms = [...new Set(organisms)];
          if (uniqueOrganisms.length > 0) {
            const geneA = fields[7];
            const geneB = fields[8];
            const method = fields[11].toLowerCase().replace(/-/, ' ');
            uniqueOrganisms.forEach((organism) => {
              streams[organism].write(`biogrid\t${geneA}\t${geneB}\t${method}\n`);
            });
          }
        }
        isHeader = false;
      });
      lineReader.on('close', () => {
        Object.values(streams).forEach((stream) => {
          stream.end();
        });
        resolve();
      });
      lineReader.on('error', (err) => {
        reject(err);
      });
    }
  })
);

module.exports = minTab;