text:
(function($) {

  $.fn.featureCarousel = function (options) {

    // override the default options with user defined options
    options = $.extend({}, $.fn.featureCarousel.defaults, options || {});

    return $(this).each(function () {

      /* These are univeral values that are used throughout the plugin. Do not modify them
       * unless you know what you're doing. Most of them feed off the options
       * so most customization can be achieved by modifying the options values */
      var pluginData = {
        currentCenterNum:     options.startingFeature,
        containerWidth:       0,
        containerHeight:      0,
        largeFeatureWidth:    0,
        largeFeatureHeight:   0,
        smallFeatureWidth:    0,
        smallFeatureHeight:   0,
        totalFeatureCount:    $(this).children("div").length,
        currentlyMoving:      false,
        featuresContainer:    $(this),
        featuresArray:        [],
        containerIDTag:       "#"+$(this).attr("id"),
        timeoutVar:           null,
        rotationsRemaining:   0,
        itemsToAnimate:       0,
        borderWidth:			    0
      };

      preload(function () {
      	setupFeatureDimensions();
        setupCarousel();
        setupFeaturePositions();
        setupBlips();
        initiateMove(true,1);
      });

      /**
       * Function to preload the images in the carousel if desired.
       * This is not recommended if there are a lot of images in the carousel because
       * it may take a while. Functionality does not depend on preloading the images
       */
      function preload(callback) {
        // user may not want to preload images
        if (options.preload == true) {
          var $imageElements = pluginData.featuresContainer.find("img");
          var loadedImages = 0;
          var totalImages = $imageElements.length;

          $imageElements.each(function () {
            // Attempt to load the images
            $(this).load(function () {
              // Add to number of images loaded and see if they are all done yet
              loadedImages++;
              if (loadedImages == totalImages) {
                // All done, perform callback
                callback();
              }
            });
            // The images may already be cached in the browser, in which case they
            // would have a 'true' complete value and the load callback would never be
            // fired. This will fire it manually.
            if (this.complete) {
              $(this).trigger('load');
            }
          });
        } else {
          // if user doesn't want preloader, then just go right to callback
          callback();
        }
      }

      // Gets the feature container based on the number
      function getContainer(featureNum) {
        return pluginData.featuresArray[featureNum-1];
      }

      // get a feature given it's set position (the position that doesn't change)
      function getBySetPos(position) {
        $.each(pluginData.featuresArray, function () {
          if ($(this).data().setPosition == position)
            return $(this);
        });
      }

      // get previous feature number
      function getPreviousNum(num) {
        if ((num - 1) == 0) {
          return pluginData.totalFeatureCount;
        } else {
          return num - 1;
        }
      }

      // get next feature number
      function getNextNum(num) {
        if ((num + 1) > pluginData.totalFeatureCount) {
          return 1;
        } else {
          return num + 1;
        }
      }

      /**
       * Because there are several options the user can set for the width and height
       * of the feature images, this function is used to determine which options were set
       * and to set the appropriate dimensions used for a small and large feature
       */
      function setupFeatureDimensions() {
        // Set the height and width of the entire carousel container
        pluginData.containerWidth = pluginData.featuresContainer.width();
        pluginData.containerHeight = pluginData.featuresContainer.height();

        // Grab the first image for reference
        var $firstFeatureImage = $(pluginData.containerIDTag).find(".carousel-image:first");

        // Large Feature Width
        if (options.largeFeatureWidth > 1)
          pluginData.largeFeatureWidth = options.largeFeatureWidth;
        else if (options.largeFeatureWidth > 0 && options.largeFeatureWidth < 1)
          pluginData.largeFeatureWidth = $firstFeatureImage.width() * options.largeFeatureWidth;
        else
          pluginData.largeFeatureWidth = $firstFeatureImage.outerWidth();
        // Large Feature Height
        if (options.largeFeatureHeight > 1)
          pluginData.largeFeatureHeight = options.largeFeatureHeight;
        else if (options.largeFeatureHeight > 0 && options.largeFeatureHeight < 1)
          pluginData.largeFeatureHeight = $firstFeatureImage.height() * options.largeFeatureHeight;
        else
          pluginData.largeFeatureHeight = $firstFeatureImage.outerHeight();
        // Small Feature Width
        if (options.smallFeatureWidth > 1)
          pluginData.smallFeatureWidth = options.smallFeatureWidth;
        else if (options.smallFeatureWidth > 0 && options.smallFeatureWidth < 1)
          pluginData.smallFeatureWidth = $firstFeatureImage.width() * options.smallFeatureWidth;
        else
          pluginData.smallFeatureWidth = $firstFeatureImage.outerWidth() / 2;
        // Small Feature Height
        if (options.smallFeatureHeight > 1)
          pluginData.smallFeatureHeight = options.smallFeatureHeight;
        else if (options.smallFeatureHeight > 0 && options.smallFeatureHeight < 1)
          pluginData.smallFeatureHeight = $firstFeatureImage.height() * options.smallFeatureHeight;
        else
          pluginData.smallFeatureHeight = $firstFeatureImage.outerHeight() / 2;
      }

      /**
       * Function to take care of setting up various aspects of the carousel,
       * most importantly the default positions for the features
       */
      function setupCarousel() {
        // Set the total feature count to the amount the user wanted to cutoff
        if (options.displayCutoff > 0 && options.displayCutoff < pluginData.totalFeatureCount) {
          pluginData.totalFeatureCount = options.displayCutoff;
        }

        // fill in the features array
        pluginData.featuresContainer.find(".carousel-feature").each(function (index) {
          if (index < pluginData.totalFeatureCount) {
            pluginData.featuresArray[index] = $(this);
          }
        });

        // Determine the total border width around the feature if there is one
        if (pluginData.featuresContainer.find(".carousel-feature").first().css("borderLeftWidth") != "medium") {
          pluginData.borderWidth = parseInt(pluginData.featuresContainer.find(".carousel-feature").first().css("borderLeftWidth"))*2;
        }

        // Place all the features in a center hidden position to start off
        pluginData.featuresContainer
          // Have to make the container relative positioning
          .find(".carousel-feature").each(function () {
            // Center all the features in the middle and hide them
            $(this).css({
              'left': (pluginData.containerWidth / 2) - (pluginData.smallFeatureWidth / 2) - (pluginData.borderWidth / 2),
              'width': pluginData.smallFeatureWidth,
              'height': pluginData.smallFeatureHeight,
              'top': options.smallFeatureOffset + options.topPadding,
              'opacity': 0
            });
          })
          // Set all the images to small feature size
          .find(".carousel-image").css({
            'width': pluginData.smallFeatureWidth
          });

        // figure out number of items that will rotate each time
        if (pluginData.totalFeatureCount < 4) {
          pluginData.itemsToAnimate = pluginData.totalFeatureCount;
        } else {
          pluginData.itemsToAnimate = 4;
        }

        // Hide story info and set the proper positioning
        pluginData.featuresContainer.find(".carousel-caption")
          .hide();
      }

      /**
       * Here all the position data is set for the features.
       * This is an important part of the carousel to keep track of where
       * each feature within the carousel is
       */
      function setupFeaturePositions() {
        // give all features a set number that won't change so they remember their
        // original order
        $.each(pluginData.featuresArray, function (i) {
          $(this).data('setPosition',i+1);
        });

        // Go back one - This is done because we call the move function right away, which
        // shifts everything to the right. So we set the current center back one, so that
        // it displays in the center when that happens
        var oneBeforeStarting = getPreviousNum(options.startingFeature);
        pluginData.currentCenterNum = oneBeforeStarting;

        // Center feature will be position 1
        var $centerFeature = getContainer(oneBeforeStarting);
        $centerFeature.data('position',1);

        // Everything before that center feature...
        var $prevFeatures = $centerFeature.prevAll();
        $prevFeatures.each(function (i) {
          $(this).data('position',(pluginData.totalFeatureCount - i));
        });

        // And everything after that center feature...
        var $nextFeatures = $centerFeature.nextAll();
        $nextFeatures.each(function (i) {
          if ($(this).data('setPosition') != undefined) {
            $(this).data('position',(i + 2));
          }
        });

        // if the counter style is for including number tags in description...
        if (options.counterStyle == 3) {
          $.each(pluginData.featuresArray, function () {
            var pos = getPreviousNum($(this).data('position'));
            var $numberTag = $("");
            $numberTag.addClass("numberTag");
            $numberTag.html("("+ pos + " of " + pluginData.totalFeatureCount + ") ");
            $(this).find('.carousel-caption p').prepend($numberTag);
          });
        }
      }

      /**
       * The blips are built using this function. The position and look
       * of the blips are completely determined by the CSS file
       */
      function setupBlips()
      {
        // Only setup the blips if the counter style is 1 or 2
        if (options.counterStyle == 1 || options.counterStyle == 2) {
          // construct the blip list
		  var $blips_wrapper = $("

");
		  $blips_wrapper.addClass("blips_wrapper");
          var $list = $("

");
          $list.addClass("blipsContainer");
          for (var i = 0; i < pluginData.totalFeatureCount; i++) {
            // Counter style 1 has no numbers, while 2 does
            var counter;
            if (options.counterStyle == 2)
              counter = "";
            else
              counter = i+1;

            // Build the DOM for the blip list
            var $blip = $("
"+counter+"
");
            $blip.addClass("blip");
            $blip.css("cursor","pointer");
            $blip.attr("id","blip_"+(i+1));
            var $listEntry = $("

");
            $listEntry.append($blip);
            $listEntry.css('float', 'left');
            $listEntry.css('');
            $list.append($listEntry);
			$blips_wrapper.append($list);
          }
          // add the blip list and then make sure it's visible
          $(pluginData.containerIDTag).append($blips_wrapper);
          $blips_wrapper.hide().show();
        }
      }

      // Move the highlighted blip to the currently centered feature
      function changeBlip(oldCenter, newCenter)
      {
        // get selectors for the two blips
        var $blipsContainer = pluginData.featuresContainer.find(".blipsContainer");
        var $oldCenter = $blipsContainer.find("#blip_"+oldCenter);
        var $newCenter = $blipsContainer.find("#blip_"+newCenter);

        // change classes
        $oldCenter.removeClass("blipSelected");
        $newCenter.addClass("blipSelected");
      }

      /**
       * This function will set the autoplay for the carousel to
       * automatically rotate it given the time in the options
       */
      function autoPlay() {
        // clear the timeout var if it exists
        if (pluginData.timeoutVar != null) {
          pluginData.timeoutVar = clearTimeout(pluginData.timeoutVar);
        }

        // set interval for moving if autoplay is set
        if (options.autoPlay != 0) {
          var autoTime = (Math.abs(options.autoPlay) < options.carouselSpeed) ? options.carouselSpeed : Math.abs(options.autoPlay);
          pluginData.timeoutVar = setTimeout(function () {
            if (options.autoPlay > 0)
              initiateMove(true,1);
            else if (options.autoPlay < 0)
              initiateMove(false,1);
          }, 5000); //Set autoplay interval
        }
      }

      // This is a helper function for the animateFeature function that
      // will update the positions of all the features based on the direction
      function rotatePositions(direction) {
        $.each(pluginData.featuresArray, function () {
          var newPos;
          if (direction == false) {
            newPos = getNextNum($(this).data().position);
          } else {
            newPos = getPreviousNum($(this).data().position);
          }
          $(this).data('position',newPos);
        });
      }

      /**
       * This function is used to animate the given feature to the given
       * location. Valid locations are "left", "right", "center", "hidden"
       */
      function animateFeature($feature, direction)
      {
        var new_width, new_height, new_top, new_left, new_zindex, new_padding, new_fade;

        // Determine the old and new positions of the feature
        var oldPosition = $feature.data('position');
        var newPosition;
        if (direction == true)
          newPosition = getPreviousNum(oldPosition);
        else
          newPosition = getNextNum(oldPosition);

        // Caculate new new css values depending on where the feature will be located
        if (newPosition == 1) {
          new_width = pluginData.largeFeatureWidth;
          new_height = pluginData.largeFeatureHeight;
          new_top = options.topPadding;
          new_zindex = $feature.css("z-index");
          new_left = (pluginData.containerWidth / 2) - (pluginData.largeFeatureWidth / 2) - (pluginData.borderWidth / 2);
          new_fade = 1.0;
        } else {
          new_width = pluginData.smallFeatureWidth;
          new_height = pluginData.smallFeatureHeight;
          new_top = options.smallFeatureOffset + options.topPadding;
          new_zindex = 1;
          new_fade = 1.0;
          // some info is different for the left, right, and hidden positions
          // left
          if (newPosition == pluginData.totalFeatureCount) {
            new_left = options.sidePadding;
          // right
          } else if (newPosition == 2) {
            new_left = pluginData.containerWidth - pluginData.smallFeatureWidth - options.sidePadding - pluginData.borderWidth;
          // hidden
          } else {
            new_left = (pluginData.containerWidth / 2) - (pluginData.smallFeatureWidth / 2) - (pluginData.borderWidth / 2);
            new_fade = 0;
          }
        }
        // This code block takes care of hiding the feature information if the feature is
        // NO LONGER going to be in the center
        if (newPosition != 1) {
          // Slide up the story information
          $feature.find(".carousel-caption")
            .hide();
        }

        // Animate the feature div to its new location
        $feature
          .animate(
            {
              width: new_width,
              height: new_height,
              top: new_top,
              left: new_left,
              opacity: new_fade
            },
            options.carouselSpeed,
            options.animationEasing,
            function () {
              // Take feature info out of hiding if new position is center
              if (newPosition == 1) {
                // fade in the feature information
                $feature.find(".carousel-caption")
                  .fadeTo("fast",0.85);
              }
              // decrement the animation queue
              pluginData.rotationsRemaining = pluginData.rotationsRemaining - 1;
              // have to change the z-index after the animation is done
              $feature.css("z-index", new_zindex);
              // change blips if using them
              if (options.counterStyle == 1 || options.counterStyle == 2) {
                if (newPosition == 1) {
                  // figure out what item was just in the center, and what item is now in the center
                  var newCenterItemNum = pluginData.featuresContainer.find(".carousel-feature").index($feature) + 1;
                  var oldCenterItemNum;
                  if (direction == false)
                    oldCenterItemNum = getNextNum(newCenterItemNum);
                  else
                    oldCenterItemNum = getPreviousNum(newCenterItemNum);
                  // now change the active blip
                  changeBlip(oldCenterItemNum, newCenterItemNum);
                }
              }

              // did all the the animations finish yet?
              var divide = pluginData.rotationsRemaining / pluginData.itemsToAnimate;
              if (divide % 1 == 0) {
                // if so, set moving to false...
                pluginData.currentlyMoving = false;
                // change positions for all items...
                rotatePositions(direction);

                // and move carousel again if queue is not empty
                if (pluginData.rotationsRemaining > 0)
                  move(direction);
              }

              // call autoplay again
              autoPlay();
            }
          )
          // select the image within the feature
          .find("img:first")
            // animate its size down
            .animate({
              width: new_width,
              height: new_height
            },
            options.carouselSpeed,
            options.animationEasing)
          .end();
      }

      /**
       * move the carousel to the left or to the right. The features that
       * will move into the four positions are calculated and then animated
       * rotate to the RIGHT when direction is TRUE and
       * rotate to the LEFT when direction is FALSE
       */
      function move(direction)
      {
        // Set the carousel to currently moving
        pluginData.currentlyMoving = true;

        // Obtain the new feature positions based on the direction that the carousel is moving
        var $newCenter, $newLeft, $newRight, $newHidden;
        if (direction == true) {
          // Shift features to the left
          $newCenter = getContainer(getNextNum(pluginData.currentCenterNum));
          $newLeft = getContainer(pluginData.currentCenterNum);
          $newRight = getContainer(getNextNum(getNextNum(pluginData.currentCenterNum)));
          $newHidden = getContainer(getPreviousNum(pluginData.currentCenterNum));
          pluginData.currentCenterNum = getNextNum(pluginData.currentCenterNum);
        } else {
          $newCenter = getContainer(getPreviousNum(pluginData.currentCenterNum));
          $newLeft = getContainer(getPreviousNum(getPreviousNum(pluginData.currentCenterNum)));
          $newRight = getContainer(pluginData.currentCenterNum);
          $newHidden = getContainer(getNextNum(pluginData.currentCenterNum));
          pluginData.currentCenterNum = getPreviousNum(pluginData.currentCenterNum);
        }

        // The z-index must be set before animations take place for certain movements
        // this makes the animations look nicer
        if (direction) {
          $newLeft.css("z-index", 3);
        } else {
          $newRight.css("z-index", 3);
        }
        $newCenter.css("z-index", 4);

        // Animate the features into their new positions
        animateFeature($newLeft, direction);
        animateFeature($newCenter, direction);
        animateFeature($newRight, direction);
        // Only want to animate the "hidden" feature if there are more than three
        if (pluginData.totalFeatureCount > 3) {
          animateFeature($newHidden, direction);
        }
      }

      // This is used to relegate carousel movement throughout the plugin
      // It will only initiate a move if the carousel isn't currently moving
      // It will set the animation queue to the number of rotations given
      function initiateMove(direction, rotations) {
        if (pluginData.currentlyMoving == false) {
          var queue = rotations * pluginData.itemsToAnimate;
          pluginData.rotationsRemaining = queue;
          move(direction);
        }
      }

      /**
       * This will find the shortest distance to travel the carousel from
       * one position to another position. It will return the shortest distance
       * in number form, and will be positive to go to the right and negative for left
       */
      function findShortestDistance(from, to) {
        var goingToLeft = 1, goingToRight = 1, tracker;
        tracker = from;
        // see how long it takes to go to the left
        while ((tracker = getPreviousNum(tracker)) != to) {
          goingToLeft++;
        }

        tracker = from;
        // see how long it takes to to to the right
        while ((tracker = getNextNum(tracker)) != to) {
          goingToRight++;
        }

        // whichever is shorter
        return (goingToLeft < goingToRight) ? goingToLeft*-1 : goingToRight;
      }

      // Move to the left if left button clicked
      $(".leftButton").click(function () {
        initiateMove(false,1);
      });

      // Move to right if right button clicked
      $(".rightButton").click(function () {
        initiateMove(true,1);
      });

      // These are the click and hover events for the features
      pluginData.featuresContainer.find("carousel-feature")
        .click(function () {
          var position = $(this).data('position');
          if (position == 2) {
            initiateMove(true,1);
          } else if (position == pluginData.totalFeatureCount) {
            initiateMove(false,1);
          }
        })
        .mouseover(function () {
          if (pluginData.currentlyMoving == false) {
            var position = $(this).data('position');
            if (position == 2 || position == pluginData.totalFeatureCount) {
              $(this).css("opacity",0.8);
            }
          }
        })
        .mouseout(function () {
          if (pluginData.currentlyMoving == false) {
            var position = $(this).data('position');
            if (position == 2 || position == pluginData.totalFeatureCount) {
              $(this).css("opacity",0.4);
            }
          }
        });

      // Add event listener to all clicks within the features container
      // This is done to disable any links that aren't within the center feature
      $("a", pluginData.containerIDTag).live("click", function (event) {
        // travel up to the container
        var $parents = $(this).parentsUntil(pluginData.containerIDTag);
        // now check each of the feature divs within it
        $parents.each(function () {
          var position = $(this).data('position');
          // if there are more than just feature divs within the container, they will
          // not have a position and it may come back as undefined. Throw these out
          if (position != undefined) {
            // if any of the links on a feature OTHER THAN the center feature were clicked,
            // initiate a carousel move but then throw the link action away
            // if the position WAS the center (i.e. 1), then do nothing and let the link pass
            if (position != 1) {
              if (position == pluginData.totalFeatureCount) {
                initiateMove(false,1);
              } else if (position == 2) {
                initiateMove(true,1);
              }
              event.preventDefault();
              return false;
            }
          }
        });
      });

      $(".blip").live("click",function () {
        // grab the position # that was clicked
        var goTo = $(this).attr("id").substring(5);
        // find out where that feature # actually is in the carousel right now
        var whereIsIt = pluginData.featuresContainer.find(".carousel-feature").eq(goTo-1).data('position');
        // which feature # is currently in the center
        var currentlyAt = pluginData.currentCenterNum;
        // if the blip was clicked for the current center feature, do nothing
        if (goTo != currentlyAt) {
          // find the shortest distance to move the carousel
          var shortest = findShortestDistance(1, whereIsIt);
          // initiate a move in that direction with given number of rotations
          if (shortest < 0) {
            initiateMove(false,(shortest*-1));
          } else {
            initiateMove(true,shortest);
          }
        }

      });
    });
  };

  $.fn.featureCarousel.defaults = {
    // If zero, take original width and height of image
    // If between 0 and 1, multiply by original width and height (to get smaller size)
    // If greater than one, use in place of original pixel dimensions
    largeFeatureWidth :   0,
    largeFeatureHeight:		0,
    smallFeatureWidth:    .7,
    smallFeatureHeight:		.7,
    // how much to pad the top of the carousel
    topPadding:           45,
    // spacing between the sides of the container (pixels)
    sidePadding:          0,
    // the additional offset to pad the side features from the top of the carousel
    smallFeatureOffset:		50,
    // indicates which feature to start the carousel at
    startingFeature:      1,
    // speed in milliseconds it takes to rotate the carousel
    carouselSpeed:        1000,
    // time in milliseconds to set interval to autorotate the carousel
    // set to zero to disable it, negative to go left
    autoPlay:             1,
    // set to true to enable the creation of blips to indicate how many
    // features there are
    counterStyle:         1,
    // true to preload all images in the carousel before displaying anything
    preload:              true,
    // Will only display this many features in the carousel
    // set to zero to disable
    displayCutoff:        0,
    // an easing can be specified for the animation of the carousel
    animationEasing:      'swing'
  };

})(jQuery);

redpajama_set_name: RedPajamaGithub


text:
namespace PoliceUk.Tests.Unit
{
    using FakeItEasy;
    using NUnit.Framework;
    using PoliceUk;
    using Entities;
    using Request;
    using CustomAssertions;
    using CustomAssertions.Equality;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;

    [TestFixture]
    public class CrimeCategoriesTests : BaseMethodTests
    {
        #region Dummy data

        private static readonly Category CategoryOne =
            new Category
            {
                Url = "burglary",
                Name = "Burglary"
            };

        private static readonly Category CategoryTwo =
            new Category
            {
                Url = "all-crime",
                Name = "All crime and ASB"
            };

        #endregion

        private static readonly object[] NoCategory =
            {
                new object[]
                {
                    EmptyArrayTestDataResource,
                    new Category[]{}
                }
            };

        private static readonly object[] DummyCategory =
            {
                new object[]
                {
                    "PoliceUK.Tests.Unit.TestData.CrimeCatagories.Single.json",
                    new Category[]
                    {
                        CategoryOne
                    }
                }
            };

        private static readonly object[] DummyCategories =
            {
                new object[]
                {
                    "PoliceUK.Tests.Unit.TestData.CrimeCatagories.Multiple.json",
                    new Category[]
                    {
                        CategoryOne,
                        CategoryTwo
                    }
                }
            };

        [Test]
        [ExpectedException(typeof(Exceptions.InvalidDataException))]
        public void Call_With_Malformed_Response_Throwns_InvalidDataException()
        {
            using (Stream stream = GetTestDataFromResource(MalformedTestDataResource))
            {
                var policeApi = new PoliceUkClient
                {
                    RequestFactory = CreateRequestFactory(stream)
                };

                policeApi.CrimeCategories(DateTime.Now);
            }
        }

        [Test]
        public void Call_Contains_Date_In_Request()
        {
            using (Stream stream = GetTestDataFromResource(EmptyArrayTestDataResource))
            {
                var policeApi = new PoliceUkClient
                {
                    RequestFactory = CreateRequestFactory(stream)
                };

                DateTime nowDateTime = DateTime.Now;
                string formattedDateTime = nowDateTime.ToString("yyyy'-'MM");

                policeApi.CrimeCategories(nowDateTime);

                // Assert
                IHttpWebRequestFactory factory = policeApi.RequestFactory;
                A.CallTo(() => factory.Create(A<string>.That.Contains(formattedDateTime))).MustHaveHappened();
            }
        }

        [Test, TestCaseSource("NoCategory"), TestCaseSource("DummyCategory"), TestCaseSource("DummyCategories")]
        public void Call_Parses_Elements_From_Json_Repsonse(string jsonResourceName, Category[] expectedCategorys)
        {
            using (Stream stream = GetTestDataFromResource(jsonResourceName))
            {
                var policeApi = new PoliceUkClient
                {
                    RequestFactory = CreateRequestFactory(stream)
                };
                IEnumerable<Category> categories = policeApi.CrimeCategories(DateTime.Now);

                // Assert
                Assert.That(categories, Is.Not.Null.And.Length.EqualTo(expectedCategorys.Length));

                int total = categories.Count();
                for (int i = 0; i < total; i++)
                {
                    Category expected = expectedCategorys[i];
                    Category actual   = categories.ElementAtOrDefault(i);

                    CustomAssert.AreEqual(expected, actual, new CategoryEqualityComparer());
                }
            }
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Xml;

namespace SerializableClasses
{
    [Serializable]
    public class ProgrammatronProject
    {
        //path to source code file
        public String ListingFileName;
        public String ProjectName;
        public String VisibleProjectName;
        public bool QuickLightRun;
        public bool SaveReports;
        public ProgrammatronProject()
        {
            ListingFileName = "program.pgt";
            ProjectName = "default project";
            VisibleProjectName = "Default Project";
            QuickLightRun = true;
            SaveReports = false;
        }

        public String GetProjectPropertiesFileName()
        {
            return ProjectName + @".pgtp";
        }
    }

    [Serializable]
    public class IDESettings
    {
        public ProgrammatronProject LastProject;
        public String ProjectsPath;
        public IDESettings()
        {
            LastProject = new ProgrammatronProject();
            ProjectsPath = Environment.GetEnvironmentVariable("SYSTEMDRIVE") + Environment.GetEnvironmentVariable("HOMEPATH") + @"\Programmatron Projects";
        }
        /// <summary>
        /// Use for first run
        /// </summary>
        /// <param name="listingFileName"></param>
        public IDESettings(ProgrammatronProject listingFileName,String projectsPath)
        {
            LastProject = listingFileName;
            ProjectsPath = projectsPath;
        }
    }

}


text:
/*
 * This file is auto-generated, do not modify directly.
 */

using System.Collections.Generic;
using Jurassic;

namespace Jurassic.Library
{

	public partial class JSONObject
	{
		private static List<PropertyNameAndValue> GetDeclarativeProperties(ScriptEngine engine)
		{
			return new List<PropertyNameAndValue>(6)
			{
				new PropertyNameAndValue("parse", new ClrStubFunction(engine, "parse", 2, __STUB__Parse), PropertyAttributes.NonEnumerable),
				new PropertyNameAndValue("stringify", new ClrStubFunction(engine, "stringify", 3, __STUB__Stringify), PropertyAttributes.NonEnumerable),
			};
		}

		private static object __STUB__Parse(ScriptEngine engine, object thisObj, object[] args)
		{
			switch (args.Length)
			{
				case 0:
					return Parse(engine, "undefined", null);
				case 1:
					return Parse(engine, TypeConverter.ToString(args[0]), null);
				default:
					return Parse(engine, TypeConverter.ToString(args[0]), TypeUtilities.IsUndefined(args[1]) ? null : args[1]);
			}
		}

		private static object __STUB__Stringify(ScriptEngine engine, object thisObj, object[] args)
		{
			switch (args.Length)
			{
				case 0:
					return Stringify(engine, Undefined.Value, null, null);
				case 1:
					return Stringify(engine, args[0], null, null);
				case 2:
					return Stringify(engine, args[0], TypeUtilities.IsUndefined(args[1]) ? null : args[1], null);
				default:
					return Stringify(engine, args[0], TypeUtilities.IsUndefined(args[1]) ? null : args[1], TypeUtilities.IsUndefined(args[2]) ? null : args[2]);
			}
		}
	}

}


text:
import {DataSet, MetadataInfo, PCA_SAMPLE_DIM, Projection, SAMPLE_SIZE} from './data';
import * as vector from './vector';
import {Projector} from './vz-projector';
import {ProjectorInput} from './vz-projector-input';
// tslint:disable-next-line:no-unused-variable
import {PolymerElement, PolymerHTMLElement} from './vz-projector-util';

// tslint:disable-next-line
export let ProjectionsPanelPolymer = PolymerElement({
  is: 'vz-projector-projections-panel',
  properties: {
    is3d: {type: Boolean, observer: '_dimensionsObserver'},
    // PCA projection.
    pcaComponents: {type: Array, value: d3.range(1, 11)},
    pcaX: {type: Number, value: 1, observer: 'showPCAIfEnabled'},
    pcaY: {type: Number, value: 2, observer: 'showPCAIfEnabled'},
    pcaZ: {type: Number, value: 3, observer: 'showPCAIfEnabled'},
    // Custom projection.
    selectedSearchByMetadataOption: {
      type: String,
      value: 'label',
      observer: '_searchByMetadataOptionChanged'
    },
  }
});

type InputControlName = 'xLeft' | 'xRight' | 'yUp' | 'yDown';

/**
 * A polymer component which handles the projection tabs in the projector.
 */
export class ProjectionsPanel extends ProjectionsPanelPolymer {
  selectedSearchByMetadataOption: string;
  is3d: boolean;

  private projector: Projector;
  private currentProjection: Projection;
  private polymerChangesTriggerReprojection: boolean;

  // The working subset of the data source's original data set.
  private currentDataSet: DataSet;
  private dim: number;

  /** T-SNE perplexity. Roughly how many neighbors each point influences. */
  private perplexity: number;
  /** T-SNE learning rate. */
  private learningRate: number;

  private searchByMetadataOptions: string[];

  /** Centroids for custom projections. */
  private centroidValues: any;
  private centroids: Centroids;
  /** The centroid across all points. */
  private allCentroid: number[];

  /** Polymer properties. */
  private pcaX: number;
  private pcaY: number;
  private pcaZ: number;

  /** Polymer elements. */
  private runTsneButton: d3.Selection<HTMLButtonElement>;
  private stopTsneButton: d3.Selection<HTMLButtonElement>;

  private dom: d3.Selection<any>;

  private zDropdown: d3.Selection<HTMLElement>;

  initialize(projector: Projector) {
    this.polymerChangesTriggerReprojection = true;
    this.projector = projector;

    this.is3d = true;

    // Set up TSNE projections.
    this.perplexity = 30;
    this.learningRate = 10;

    // Setup Custom projections.
    this.centroidValues = {xLeft: null, xRight: null, yUp: null, yDown: null};
    this.clearCentroids();

    this.setupUIControls();
  }

  ready() {
    this.dom = d3.select(this);
    this.zDropdown = this.dom.select('#z-dropdown');
    this.searchByMetadataOptions = ['label'];
  }

  disablePolymerChangesTriggerReprojection() {
    this.polymerChangesTriggerReprojection = false;
  }

  enablePolymerChangesTriggerReprojection() {
    this.polymerChangesTriggerReprojection = true;
  }

  private setupUIControls() {
    // Tabs
    const self = this;
    this.dom.selectAll('.ink-tab').on('click', function() {
      let id = this.getAttribute('data-tab');
      self.showTab(id);
    });

    this.runTsneButton = this.dom.select('.run-tsne');
    this.runTsneButton.on('click', () => this.runTSNE());
    this.stopTsneButton = this.dom.select('.stop-tsne');
    this.stopTsneButton.on('click', () => {
      this.projector.currentDataSet.stopTSNE();
    });

    let perplexitySlider = this.$$('#perplexity-slider') as HTMLInputElement;
    let updatePerplexity = () => {
      this.perplexity = +perplexitySlider.value;
      this.dom.select('.tsne-perplexity span').text(this.perplexity);
    };
    perplexitySlider.value = this.perplexity.toString();
    perplexitySlider.addEventListener('change', updatePerplexity);
    updatePerplexity();

    let learningRateInput =
        this.$$('#learning-rate-slider') as HTMLInputElement;
    let updateLearningRate = () => {
      this.learningRate = Math.pow(10, +learningRateInput.value);
      this.dom.select('.tsne-learning-rate span').text(this.learningRate);
    };
    learningRateInput.addEventListener('change', updateLearningRate);
    updateLearningRate();
    this.setupAllInputsInCustomTab();
    // TODO: figure out why `--paper-input-container-input` css mixin didn't
    // work.
    this.dom.selectAll('paper-dropdown-menu paper-input input')
      .style('font-size', '14px');
  }

  setPCAComponentUIValues(componentDimensions: number[]) {
    this.pcaX = componentDimensions[0];
    this.pcaY = componentDimensions[1];

    if (componentDimensions.length === 3) {
      this.pcaZ = componentDimensions[2];
    }

    this.setZDropdownEnabled(componentDimensions.length === 3);
  }

  getPCAComponentUIValues(): number[] {
    const componentDimensions = [this.pcaX, this.pcaY];
    if (this.is3d) {
      componentDimensions.push(this.pcaZ);
    }
    return componentDimensions;
  }

  private setZDropdownEnabled(enabled: boolean) {
    if (this.zDropdown) {
      this.zDropdown.attr('disabled', enabled ? null : true);
    }
  }

  dataSetUpdated(dataSet: DataSet, dim: number) {
    this.currentDataSet = dataSet;
    this.dim = dim;
    this.clearCentroids();

    this.dom.select('#tsne-sampling')
        .style('display', dataSet.points.length > SAMPLE_SIZE ? null : 'none');
    this.dom.select('#pca-sampling')
        .style('display', dataSet.dim[1] > PCA_SAMPLE_DIM ? null : 'none');
    this.showTab('pca');
  }

  _dimensionsObserver() {
    this.setZDropdownEnabled(this.is3d);
    this.beginProjection(this.currentProjection);
  }

  metadataChanged(metadata: MetadataInfo) {
    // Project by options for custom projections.
    let searchByMetadataIndex = -1;
    if (metadata.stats.length > 1) {
      this.searchByMetadataOptions = metadata.stats.map((stats, i) => {
        // Make the default label by the first non-numeric column.
        if (!stats.isNumeric && searchByMetadataIndex === -1) {
          searchByMetadataIndex = i;
        }
        return stats.name;
      });
    } else {
      this.searchByMetadataOptions = ['label'];
    }
    this.selectedSearchByMetadataOption =
        this.searchByMetadataOptions[Math.max(0, searchByMetadataIndex)];
  }

  public showTab(id: Projection) {
    this.currentProjection = id;

    let tab = this.dom.select('.ink-tab[data-tab="' + id + '"]');
    this.dom.selectAll('.ink-tab').classed('active', false);
    tab.classed('active', true);
    this.dom.selectAll('.ink-panel-content').classed('active', false);
    this.dom.select('.ink-panel-content[data-panel="' + id + '"]')
        .classed('active', true);

    // In order for the projections panel to animate its height, we need to set
    // it explicitly.
    requestAnimationFrame(() => {
      this.style.height = this.$['main'].clientHeight + 'px';
    });

    this.beginProjection(id);
  }

  private beginProjection(projection: string) {
    if (this.polymerChangesTriggerReprojection) {
      if (projection === 'pca') {
        this.currentDataSet.stopTSNE();
        this.showPCA();
      } else if (projection === 'tsne') {
        this.showTSNE();
      } else if (projection === 'custom') {
        this.currentDataSet.stopTSNE();
        this.computeAllCentroids();
        this.reprojectCustom();
      }
    }
  }

  private showTSNE() {
    const dataSet = this.currentDataSet;
    if (dataSet == null) {
      return;
    }
    const accessors =
        dataSet.getPointAccessors('tsne', [0, 1, this.is3d ? 2 : null]);
    this.projector.setProjection('tsne', this.is3d ? 3 : 2, accessors);

    if (!this.currentDataSet.hasTSNERun) {
      this.runTSNE();
    } else {
      this.projector.notifyProjectionsUpdated();
    }
  }

  private runTSNE() {
    this.runTsneButton.attr('disabled', true);
    this.stopTsneButton.attr('disabled', null);
    this.currentDataSet.projectTSNE(
        this.perplexity, this.learningRate, this.is3d ? 3 : 2,
        (iteration: number) => {
          if (iteration != null) {
            this.dom.select('.run-tsne-iter').text(iteration);
            this.projector.notifyProjectionsUpdated();
          } else {
            this.runTsneButton.attr('disabled', null);
            this.stopTsneButton.attr('disabled', true);
          }
        });
  }

  // tslint:disable-next-line:no-unused-variable
  private showPCAIfEnabled() {
    if (this.polymerChangesTriggerReprojection) {
      this.showPCA();
    }
  }

  private showPCA() {
    if (this.currentDataSet == null) {
      return;
    }
    this.currentDataSet.projectPCA().then(() => {
      // Polymer properties are 1-based.
      const accessors = this.currentDataSet.getPointAccessors(
          'pca', [this.pcaX - 1, this.pcaY - 1, this.pcaZ - 1]);

      this.projector.setProjection('pca', this.is3d ? 3 : 2, accessors);
    });
  }

  private reprojectCustom() {
    if (this.centroids == null || this.centroids.xLeft == null ||
        this.centroids.xRight == null || this.centroids.yUp == null ||
        this.centroids.yDown == null) {
      return;
    }
    const xDir = vector.sub(this.centroids.xRight, this.centroids.xLeft);
    this.currentDataSet.projectLinear(xDir, 'linear-x');

    const yDir = vector.sub(this.centroids.yUp, this.centroids.yDown);
    this.currentDataSet.projectLinear(yDir, 'linear-y');

    const accessors =
        this.currentDataSet.getPointAccessors('custom', ['x', 'y']);

    this.projector.setProjection('custom', 2, accessors);
  }

  clearCentroids(): void {
    this.centroids = {xLeft: null, xRight: null, yUp: null, yDown: null};
    this.allCentroid = null;
  }

  _searchByMetadataOptionChanged(newVal: string, oldVal: string) {
    if (this.currentProjection === 'custom') {
      this.computeAllCentroids();
      this.reprojectCustom();
    }
  }

  private setupAllInputsInCustomTab() {
    this.setupInputUIInCustomTab('xLeft');
    this.setupInputUIInCustomTab('xRight');
    this.setupInputUIInCustomTab('yUp');
    this.setupInputUIInCustomTab('yDown');
  }

  private computeAllCentroids() {
    this.computeCentroid('xLeft');
    this.computeCentroid('xRight');
    this.computeCentroid('yUp');
    this.computeCentroid('yDown');
  }

  private computeCentroid(name: InputControlName) {
    let input = this.querySelector('#' + name) as ProjectorInput;
    let value = input.getValue();
    let inRegexMode = input.getInRegexMode();

    if (value == null) {
      return;
    }
    let result = this.getCentroid(value, inRegexMode);
    if (result.numMatches === 0) {
      input.message = '0 matches. Using a random vector.';
      result.centroid = vector.rn(this.dim);
    } else {
      input.message = `${result.numMatches} matches.`;
    }
    this.centroids[name] = result.centroid;
    this.centroidValues[name] = value;
  }

  private setupInputUIInCustomTab(name: InputControlName) {
    let input = this.querySelector('#' + name) as ProjectorInput;
    // Setup the input text.
    input.onInputChanged((input, inRegexMode) => {
      this.computeCentroid(name);
      this.reprojectCustom();
    });
  }

  private getCentroid(pattern: string, inRegexMode: boolean): CentroidResult {
    if (pattern == null || pattern === '') {
      return {numMatches: 0};
    }
    let accessor = (i: number) => this.currentDataSet.points[i].vector;
    let r = this.projector.currentDataSet.query(
        pattern, inRegexMode, this.selectedSearchByMetadataOption);
    return {centroid: vector.centroid(r, accessor), numMatches: r.length};
  }

  getPcaSampledDim() {
    return PCA_SAMPLE_DIM.toLocaleString();
  }

  getTsneSampleSize() {
    return SAMPLE_SIZE.toLocaleString();
  }
}

type CentroidResult = {
  centroid?: number[]; numMatches?: number;
};

type Centroids = {
  [key: string]: number[]; xLeft: number[]; xRight: number[]; yUp: number[];
  yDown: number[];
};

document.registerElement(ProjectionsPanel.prototype.is, ProjectionsPanel);


text:
   ```
   "{"errors":{".properties.networking_point_of_entry.external_ssl.ssl_ciphers":["Value can't be blank"]}}"
   ```

   **Solution:** pcf-pipelines is not compatible with ERT 1.11.14. Redeploy with a [compatible](https://github.com/pivotal-cf/pcf-pipelines#install-pcf-pipelines) version.

#### Error message: ####

    Error
    pcf-pipelines/tasks/stage-product/task.sh: line 19: ./pivnet-product/metadata.json: No such file or directory

  **Solution:** You are not using the PivNet resource, and are most likely using a different repository manager like Artifactory. For more information, and a possible workaround, see this github [issue](https://github.com/pivotal-cf/pcf-pipelines/issues/192).


text:
title: 'Gubitak Povjerenja Nastavak'
date: 28/05/2019
---

Drugi način na koji se može izgubiti povjerenje jest obiteljsko nasilje. Iako je to nezamislivo, istraživanja pokazuju da je dom mjesto u društvu u kojem ima najviše nasilja. Obiteljsko nasilje pogađa različite obitelji, uključujući i kršćanske domove. Nasilje je napad bilo kakve vrste — verbalni, fizički, emocionalni, seksualni ili aktivno ili pasivno zanemarivanje — koji vrši jedna ili više osoba u obitelji u odnosu na drugu.

Biblija sadrži izvještaje o obiteljskom nasilju, čak i među Božjim narodom. Kakve su vaše misli i osjećaji dok čitate sljedeće retke? Što mislite zašto su ovi izvještaji sačuvani u Pismu?

`Postanak 37,17-28`

`2. Samuelova 13,1-22`

`2. o kraljevima 16,3; 17,17; 21,6`

Zlostavljanje je svjestan izbor osobe da primjenjuje silu i vlast nad drugom osobom. Ne može se objasniti ni opravdati alkoholizmom, stresom, potrebom za ispunjavanjem seksualnih želja, potrebom za boljim upravljanjem gnjevom ili bilo kakvim ponašanjem žrtve. Žrtva nije odgovorna za postupke zlostavljača. Zlostavljač iskrivljuje i izopačuje ljubav jer "ljubav ne čini bližnjemu zla" (Rimljanima 13,10).

Stručno liječenje može omogućiti promjenu u ponašanju zlostavljača, ali jedino ako on preuzme odgovornost za svoje ponašanje i potraži pomoć. Onima koji se otvore za Njegovu prisutnost, Bog može pružiti neizmjernu i obilnu pomoć da prestanu sa zlostavljanjem, da se pokaju zbog svojih stavova i ponašanja, da na svaki mogući način izvrše promjenu i prihvate osobine agape ljubavi kako bi izliječili svoje srce i pokazali ljubav prema drugima (usporedite Efežanima 3,20).

`Pokušajte se staviti na mjesto nekoga tko je bio žrtva nasilja. Kakve biste riječi prihvaćanja, utjehe i nade željeli čuti? Zašto je važno prije pružiti sigurnost, zaštitu i prihvaćanje nego savjet kako podnositi zlostavljača?`


text:
//

// Implementation adapted and enhanced from https://github.com/Esri/arcgis-toolkit-sl-wpf
using System;
using System.Collections.Generic;
using System.Linq;
using Esri.ArcGISRuntime.Toolkit.Internal;
#if NETFX_CORE
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Media;
#elif __IOS__
using System.Drawing;
using Brush = UIKit.UIColor;
using ContentPresenter = UIKit.UIView;
using FrameworkElement = UIKit.UIView;
using Rect = CoreGraphics.CGRect;
using Size = CoreGraphics.CGSize;
using UIElement = UIKit.UIView;
#elif __ANDROID__
using System.Drawing;
using Android.Content;
using Brush = Android.Graphics.Color;
using ContentPresenter = Android.Views.View;
using FrameworkElement = Android.Views.View;
using Rect = Android.Graphics.RectF;
using Size = Android.Util.SizeF;
using UIElement = Android.Views.View;
#else
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Markup;
using System.Windows.Media;
#endif

namespace Esri.ArcGISRuntime.Toolkit.Primitives
{
    /// <summary>
    /// *FOR INTERNAL USE ONLY* Tickbar control used for placing a specified amount of tick marks evenly spread out.
    /// </summary>
    /// <exclude/>
    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
    public partial class Tickbar
    {
        private List<ContentPresenter> _majorTickmarks = new List<ContentPresenter>();
        private List<ContentPresenter> _minorTickmarks = new List<ContentPresenter>();

        /// <summary>
        /// Initializes a new instance of the <see cref="Tickbar"/> class.
        /// </summary>
#if __ANDROID__
        public Tickbar(Context context)
            : base(context)
#else
        public Tickbar()
            : base()
#endif
        {
#if __IOS__ || __ANDROID__
            Initialize();
#endif
        }

        private Size OnArrange(Size finalSize)
        {
            if (TickmarkPositions == null || TickmarkPositions.Count() < 2)
            {
                return finalSize;
            }

            var majorTickmarksBounds = new List<Rect>();
            var minorTickmarksBounds = new List<Rect>();

            // Iterate all child ticks and calculate bounds for each
#if NETCOREAPP && WINDOWS && !NET5_0_OR_GREATER
            foreach (UIElement? child in Children)
#else
            foreach (UIElement child in Children)
#endif
            {
                FrameworkElement? c = child as FrameworkElement;
                if (c == null)
                {
                    continue;
                }

                double position = GetPosition(c);
                var isMajorTickmark = GetIsMajorTickmark(c);

                if (isMajorTickmark && !ShowTickLabels)
                {
                    continue; // Don't worry about calculating bounds for major ticks if labels are hidden
                }

                // Calculate the bounds of the tick mark
                position = finalSize.Width * position;
                var desiredSize = GetDesiredSize(c);
                var x = position - (desiredSize.Width * .5);
#if __ANDROID__
                // In the implementation of the Android time slider, the tickbar is aligned horizontally with its parent to allow
                // tick labels to use the entire space within the control.  The TickInset property defines how much extra room is
                // available outside the bounds of the Tickbar and needs to be taken into account in the placement of ticks.
                // This inset also needs to be adjusted slightly, as it yields a position that is slightly offset for reasons as
                // yet unknown.
                var pixelsPerDip = Android.Util.TypedValue.ApplyDimension(Android.Util.ComplexUnitType.Dip, 1, ViewExtensions.GetDisplayMetrics(Context));
                x += TickInset - (2 * pixelsPerDip);
#endif
                var childBounds = new Rect(0, 0, desiredSize.Width, finalSize.Height);
                childBounds.SetX(x);

                // Store the bounds for application later once tick (i.e. label) collision has been accounted for
                if (isMajorTickmark)
                {
                    majorTickmarksBounds.Add(childBounds);
                }
                else
                {
                    minorTickmarksBounds.Add(childBounds);
                }
            }

            if (ShowTickLabels)
            {
                // Calculate positioning of tick labels and major/minor ticks
                var minimumLabelSpacing = 6;

                var majorTickInterval = 2;
                var doMajorTicksCollide = false;
                var firstMajorTickIndex = 0;
                var tickCount = _minorTickmarks.Count;

                // Calculate the largest number of ticks to allow between major ticks.  This prevents scenarios where
                // there are two major ticks placed undesirably close to the end of the tick bar.
                var maxMajorTickInterval = Math.Ceiling(tickCount / 2d);

                // Calculate the number of ticks between each major tick and the index of the first major tick
                for (int i = majorTickInterval; i <= maxMajorTickInterval; i++)
                {
                    var prospectiveInterval = i;
                    var allowsEqualNumberOfTicksOnEnds = false;

                    // Check that the prospective interval between major ticks results in an equal number of minor
                    // ticks on both ends of the tick bar
                    for (int m = prospectiveInterval; m < tickCount; m += prospectiveInterval)
                    {
                        var totalNumberOfTicksOnEnds = tickCount - m + 1;

                        // If the total number of minor ticks on both ends of the tick bar (i.e. before and after the
                        // first and last major ticks) is less than the major tick interval being tested, then we've
                        // found the number of minor ticks that would be on the ends if we use this major tick interval.
                        // If that total is divisible by two, then the major tick interval under test allows for an
                        // equal number of minor ticks on the ends.
                        if (totalNumberOfTicksOnEnds / 2 < prospectiveInterval && totalNumberOfTicksOnEnds % 2 == 0)
                        {
                            allowsEqualNumberOfTicksOnEnds = true;
                            break;
                        }
                    }

                    // Only consider intervals that leave an equal number of ticks on the ends
                    if (!allowsEqualNumberOfTicksOnEnds)
                    {
                        continue;
                    }

                    // Calculate the tick index of the first major tick if we were to use the prospective interval.
                    // The index is calculated such that there will be an equal number of minor ticks before and
                    // after the first and last major tick mark.
                    firstMajorTickIndex = (int)Math.Truncate(((tickCount - 1) % prospectiveInterval) / 2d);
                    doMajorTicksCollide = false;

                    // With the given positioning of major tick marks, check whether they (i.e. their labels) will overlap
                    for (var j = firstMajorTickIndex; j < tickCount - prospectiveInterval; j += i)
                    {
                        // Get the bounds of the major tick marks at index j and the one subsequent to that
                        var currentBounds = majorTickmarksBounds[j];
                        var nextBounds = majorTickmarksBounds[j + i];

                        if (currentBounds.Right + minimumLabelSpacing > nextBounds.Left)
                        {
                            doMajorTicksCollide = true;
                            break;
                        }
                    }

                    if (!doMajorTicksCollide)
                    {
                        // The ticks don't at the given interval, so use that
                        majorTickInterval = prospectiveInterval;
                        break;
                    }
                }

                if (doMajorTicksCollide)
                {
                    // Multiple major ticks (and their labels) won't fit without overlapping.  Display one major tick
                    // in the middle instead
                    majorTickInterval = tickCount;

                    // Calculate the index of the middle tick.  Note that, if there are an even number of ticks, there
                    // is not one perfectly centered.  This logic takes the one before the true center of the tick bar.
                    if (tickCount % 2 == 0)
                    {
                        firstMajorTickIndex = (int)Math.Truncate(tickCount / 2d) - 1;
                    }
                    else
                    {
                        firstMajorTickIndex = (int)Math.Truncate(tickCount / 2d);
                    }
                }

                // Apply the ticks' layouts
                for (var i = 0; i < tickCount; i++)
                {
                    // Check whether the current tick index refers to a major or minor tick
                    var isMajorTickIndex = (i - firstMajorTickIndex) % majorTickInterval == 0;

                    // Arrange either the major or minor tick for the current index
                    if (isMajorTickIndex)
                    {
                        _majorTickmarks[i].Arrange(majorTickmarksBounds[i]);
                        _minorTickmarks[i].Arrange(new Rect(0, 0, 0, 0));
                    }
                    else
                    {
                        _minorTickmarks[i].Arrange(minorTickmarksBounds[i]);
                        _majorTickmarks[i].Arrange(new Rect(0, 0, 0, 0));
                    }
                }
            }
            else
            {
                // !ShowTickLabels
                for (var i = 0; i < _minorTickmarks.Count; i++)
                {
                    _minorTickmarks[i].Arrange(minorTickmarksBounds[i]);
                }

                foreach (var majorTick in _majorTickmarks)
                {
                    majorTick.Arrange(new Rect(0, 0, 0, 0));
                }
            }

            return finalSize;
        }

        private Size OnMeasure(Size availableSize)
        {
            var width = availableSize.Width == double.PositiveInfinity || availableSize.IsEmpty() ?
                Width : availableSize.Width;
            var height = availableSize.Height == double.PositiveInfinity || availableSize.IsEmpty() ?
                Height : availableSize.Height;

            // Get the set of ticks that we want to measure.  This could either be all ticks or only minor ticks
            var measuredChildren = ShowTickLabels ? Children.Cast<UIElement>() : Children.Cast<UIElement>().Where(el => !GetIsMajorTickmark(el));
#if !__IOS__
            foreach (UIElement d in measuredChildren)
            {
                d.Measure(availableSize);
            }
#endif

            if (double.IsNaN(height))
            {
                height = 0;
                foreach (UIElement d in measuredChildren)
                {
                    var maxHeight = Math.Max(GetDesiredSize(d).Height, height);
                    height =
#if __IOS__
                        (nfloat)maxHeight;
#else
                        maxHeight;
#endif
                }
            }

            width = double.IsNaN(width) ? 0 : width;

            return new Size(width, height);
        }

        /// <summary>
        /// Gets or sets the tick mark positions.
        /// </summary>
        /// <value>The tick mark positions.</value>
        /// <remarks>The tick mark position values should be between 0 and 1.  They represent proportional positions along the tick bar.</remarks>
        public IEnumerable<double>? TickmarkPositions
        {
            get => TickmarkPositionsImpl;
            set => TickmarkPositionsImpl = value;
        }

        private void OnTickmarkPositionsPropertyChanged(IEnumerable<double>? newTickPositions, IEnumerable<double>? oldTickPositions)
        {
#if !XAMARIN
            if (MinorTickmarkTemplate == null)
            {
                MinorTickmarkTemplate = _defaultTickmarkTemplate;
            }
#endif

            var newTickCount = newTickPositions == null ? 0 : newTickPositions.Count();
            var oldTickCount = oldTickPositions == null ? 0 : oldTickPositions.Count();

            if (newTickCount < oldTickCount)
            {
                // Reduce the number of ticks to the number of positions specified
                for (var i = oldTickCount; i > newTickCount; i--)
                {
                    var tickToRemove = _majorTickmarks[i - 1];
                    this.RemoveChild(tickToRemove);
                    _majorTickmarks.Remove(tickToRemove);

                    tickToRemove = _minorTickmarks[i - 1];
                    this.RemoveChild(tickToRemove);
                    _minorTickmarks.Remove(tickToRemove);
                }

                // Update the positions of the remaining ticks
                if (newTickPositions != null)
                {
                    for (var i = 0; i < _minorTickmarks.Count; i++)
                    {
                        SetPosition(_minorTickmarks[i], newTickPositions.ElementAt(i));
                        SetPosition(_majorTickmarks[i], newTickPositions.ElementAt(i));
                    }
                }
            }
            else if (newTickPositions != null)
            {
                for (var i = 0; i < newTickCount; i++)
                {
                    if (i < oldTickCount)
                    {
                        // Update positions of existing ticks
                        SetPosition(_minorTickmarks[i], newTickPositions.ElementAt(i));
                        SetPosition(_majorTickmarks[i], newTickPositions.ElementAt(i));
                    }
                    else
                    {
                        // Add new ticks to bring the number of ticks up to the number of positions specified
                        var tickDataSource = TickmarkDataSources == null || i >= TickmarkDataSources.Count() ? null : TickmarkDataSources.ElementAt(i);
                        AddTickmark(newTickPositions.ElementAt(i), tickDataSource);
                    }
                }
            }

            InvalidateMeasureAndArrange();
        }

        /// <summary>
        /// Gets or sets the data sources for the tick marks.  These can be bound to in the tick bar's tick templates.
        /// </summary>
        /// <value>The data source objects.</value>
        public IEnumerable<object>? TickmarkDataSources
        {
            get => TickmarkDataSourcesImpl;
            set => TickmarkDataSourcesImpl = value;
        }

        private void OnTickmarkDataSourcesPropertyChanged(IEnumerable<object>? dataSources)
        {
            var newDataSources = dataSources ?? new List<object>();

#if !XAMARIN
            for (var i = 0; i < _majorTickmarks.Count; i++)
            {
                _majorTickmarks[i].Content = i < newDataSources.Count() ? newDataSources.ElementAt(i) : null;
            }
#endif
        }

        /// <summary>
        /// Gets or sets the fill color for each tick mark.
        /// </summary>
#if __IOS__ || __ANDROID__
        public Brush TickFill
#else
        public Brush? TickFill
#endif
        {
            get => TickFillImpl;
            set => TickFillImpl = value;
        }

        /// <summary>
        /// Gets or sets the fill color for each tick mark.
        /// </summary>
#if __IOS__ || __ANDROID__
        public Brush TickLabelColor
#else
        public Brush? TickLabelColor
#endif
        {
            get => TickLabelColorImpl;
            set => TickLabelColorImpl = value;
        }

        /// <summary>
        /// Gets or sets a value indicating whether gets or sets whether to display labels on the ticks.
        /// </summary>
        public bool ShowTickLabels
        {
            get => ShowTickLabelsImpl;
            set => ShowTickLabelsImpl = value;
        }

        private void OnShowTickLabelsPropertyChanged() => InvalidateMeasureAndArrange();

        /// <summary>
        /// Gets or sets the string format to use for displaying the tick labels.
        /// </summary>
        public string? TickLabelFormat
        {
            get => TickLabelFormatImpl;
            set => TickLabelFormatImpl = value;
        }

        private void OnTickLabelFormatPropertyChanged(string? labelFormat)
        {
            if (_majorTickmarks == null)
            {
                return;
            }

            // Update the label format string for each of the major ticks
            foreach (var majorTick in _majorTickmarks)
            {
                ApplyTickLabelFormat(majorTick, labelFormat);
            }

            // Invoke a layout pass to accommodate new label sizes
            InvalidateMeasureAndArrange();
        }
    }
}


text:
// Copyright (c) 2009-2011, Anton Korenyushkin
// All rights reserved.

// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of the author nor the names of contributors may be
//       used to endorse or promote products derived from this software
//       without specific prior written permission.

// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

var core = require('core');
var Binary = require('binary').Binary;
var base = require('base');
var utils = require('utils');
var aspect = require('aspect');
var template = require('template');
var rest = require('rest');

////////////////////////////////////////////////////////////////////////////////
// Classes
////////////////////////////////////////////////////////////////////////////////

exports.TestResult = Object.subclass(
  function () {
    this.errors = [];
    this.failures = [];
    this.testsRun = 0;
  },
  {
    wasSuccessful: function () {
      return this.errors.length == 0 && this.failures.length == 0;
    },

    startTest: function (test) {
      ++this.testsRun;
    },

    stopTest: function (test) {},

    addError: function (test, error) {
      this.errors.push([test, error]);
    },

    addFailure: function (test, failure) {
      this.failures.push([test, failure]);
    },

    addSuccess: function (test) {}
  });

exports.TestSuite = Object.subclass(
  function (tests/* = [] */) {
    this._tests = tests || [];
  },
  {
    run: function (result) {
      this._tests.map(function (test) { test.run(result); });
    },

    addTest: function (test) {
      this._tests.push(test);
    },

    countTestCases: function () {
      return utils.sum(
        this._tests.map(function (test) { return test.countTestCases(); }));
    },

    toString: function () {
      var strings = [];
      this._tests.forEach(
        function (test) {
          var string = test + '';
          if (string)
            strings.push(string);
        });
      return strings.join(', ');
    },

    __repr__: function () {
      return '<TestSuite ' + this + '>';
    }
  });

exports.TestCase = Object.subclass(
  function (methodName) {
    if (typeof(this[methodName]) != 'function')
      throw core.ValueError(
        'Test method ' + base.repr(methodName) + ' not found');
    this._methodName = methodName;
  },
  {
    countTestCases: function () {
      return 1;
    },

    setUp: function () {},

    tearDown: function () {},

    run: function (result) {
      result.startTest(this);
      try {
        try {
          this.setUp();
        } catch (error) {
          result.addError(this, error);
          return;
        }
        var ok = false;
        try {
          this[this._methodName]();
          ok = true;
        } catch (error) {
          if (error instanceof base.AssertionError)
            result.addFailure(this, error);
          else
            result.addError(this, error);
        }
        try {
          this.tearDown();
        } catch (error) {
          result.addError(this, error);
          ok = false;
        }
        if (ok)
          result.addSuccess(this);
      } finally {
        result.stopTest(this);
      }
    },

    toString: function () {
      var result = this._methodName;
      if (this.name)
        result += '(' + this.name + ')';
      return result;
    },

    __repr__: function () {
      return '<TestCase ' + this + '>';
    }
  });

exports.StreamTestResult = exports.TestResult.subclass(
  function (stream) {
    exports.TestResult.call(this);
    this._stream = stream;
  },
  {
    startTest: function (test) {
      exports.TestResult.prototype.startTest.call(this, test);
      this._stream.write(test);
    },

    addError: function (test, error) {
      exports.TestResult.prototype.addError.call(this, test, error);
      this._stream.write(' ERROR\n');
    },

    addFailure: function (test, error) {
      exports.TestResult.prototype.addFailure.call(this, test, error);
      this._stream.write(' FAIL\n');
    },

    addSuccess: function (test) {
      exports.TestResult.prototype.addSuccess.call(this, test);
      this._stream.write(' ok\n');
    }
  });

////////////////////////////////////////////////////////////////////////////////
// Functions
////////////////////////////////////////////////////////////////////////////////

function doLoadTestSuite(source) {
  if (source instanceof exports.TestSuite)
    return source;
  if (source instanceof exports.TestCase)
    return new exports.TestSuite([source]);
  if (typeof(source) == 'function' && source.subclassOf(exports.TestCase)) {
    var testMethodNames = [];
    for (var name in source.prototype) {
      if (name.startsWith('test') &&
          typeof(source.prototype[name]) == 'function')
        testMethodNames.push(name);
    }
    return new exports.TestSuite(
      testMethodNames.map(function (name) { return new source(name); }));
  }
  return null;
}

exports.loadTestSuite = function (source) {
  var result = doLoadTestSuite(source);
  if (result)
    return result;
  if (typeof(source) != 'object')
    throw TypeError('Can not load TestSuite from ' + base.repr(source));
  if (source instanceof Array)
    return new exports.TestSuite(Array.map(source, arguments.callee));
  result = new exports.TestSuite();
  for (var name in source) {
    var suite = doLoadTestSuite(source[name]);
    if (suite)
      result.addTest(suite);
  };
  return result;
};

function getErrorDescription(error) {
  return (error && error.stack
          ? error.stack
          : error);
}

exports.runTestViaStream = function (test, stream/* = utils.out */) {
  stream = stream || utils.out;
  var result = new exports.StreamTestResult(stream);
  test.run(result);
  result.errors.forEach(
    function (error) {
      stream.write('=====\nERROR: ' + error[0] + '\n' +
                   getErrorDescription(error[1]) + '\n');
    });
  result.failures.forEach(
    function (failure) {
      stream.write('=====\nFAIL: ' + failure[0] + '\n' +
                   getErrorDescription(failure[1]) + '\n');
    });
  stream.write('-----\n' + 'Ran ' + test.countTestCases() + ' tests\n');
  if (result.wasSuccessful()) {
    stream.write('OK');
  } else {
    stream.write('FAILED (');
    if (result.failures.length)
      stream.write('failures=' + result.failures.length);
    if (result.errors.length) {
      if (result.failures.length)
        stream.write(', ');
      stream.write('errors=' + result.errors.length);
    }
    stream.write(')');
  }
  return result;
};

exports.test = function (source/* = require.main.exports.tests */,
                         stream/* = utils.out */) {
  stream = stream || utils.out;
  exports.runTestViaStream(
    exports.loadTestSuite(source || require.main.exports.tests),
    stream);
  var result = stream.get();
  stream.reset();
  return result;
};

////////////////////////////////////////////////////////////////////////////////
// TestClient
////////////////////////////////////////////////////////////////////////////////

function makeRequester(method) {
  return function (request) {
    request = {__proto__: request};
    request.method = method;
    return this.request(request);
  };
}

exports.TestClient = Object.subclass(
  {
    request: function (request/* = {} */) {
      request = request ? {__proto__: request} : {};
      base.update(
        request,
        {
          method: request.method || 'get',
          path: request.path || '/',
          get: request.get || {},
          post: request.post || {},
          headers: request.headers || {},
          data:
            request.data instanceof Binary
            ? request.data
            : new Binary(request.data || '')
        });
      var contexts = {};
      var aspects = new aspect.AspectArray();
      aspects.push(
        aspect.weave(
          aspect.After, template.Template, 'render',
          function (result, args) {
            contexts[result] = args[0];
            return result;
          }),
        aspect.weave(
          aspect.After, require.main.exports, 'main',
          function (result) {
            if (result &&
                typeof(result) == 'object' &&
                contexts.hasOwnProperty(result.content))
              result.context = contexts[result.content];
            return result;
          }),
        aspect.weave(
          aspect.After, rest.Handler, 'handle',
          function (result) {
            result.handler = this.constructor;
            return result;
          }));
      try {
        return require.main.exports.main(request);
      } finally {
        aspects.unweave();
      }
    },

    get: makeRequester('get'),
    post: makeRequester('post'),
    head: makeRequester('head'),
    put: makeRequester('put'),
    del: makeRequester('delete')
  });


text:
package com.amazonaws.services.imagebuilder;

import javax.annotation.Generated;

import com.amazonaws.services.imagebuilder.model.*;
import com.amazonaws.*;

/**
 * Abstract implementation of {@code AWSimagebuilder}. Convenient method forms pass through to the corresponding
 * overload that takes a request object, which throws an {@code UnsupportedOperationException}.
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AbstractAWSimagebuilder implements AWSimagebuilder {

    protected AbstractAWSimagebuilder() {
    }

    @Override
    public CancelImageCreationResult cancelImageCreation(CancelImageCreationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public CreateComponentResult createComponent(CreateComponentRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public CreateContainerRecipeResult createContainerRecipe(CreateContainerRecipeRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public CreateDistributionConfigurationResult createDistributionConfiguration(CreateDistributionConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public CreateImageResult createImage(CreateImageRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public CreateImagePipelineResult createImagePipeline(CreateImagePipelineRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public CreateImageRecipeResult createImageRecipe(CreateImageRecipeRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public CreateInfrastructureConfigurationResult createInfrastructureConfiguration(CreateInfrastructureConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public DeleteComponentResult deleteComponent(DeleteComponentRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public DeleteContainerRecipeResult deleteContainerRecipe(DeleteContainerRecipeRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public DeleteDistributionConfigurationResult deleteDistributionConfiguration(DeleteDistributionConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public DeleteImageResult deleteImage(DeleteImageRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public DeleteImagePipelineResult deleteImagePipeline(DeleteImagePipelineRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public DeleteImageRecipeResult deleteImageRecipe(DeleteImageRecipeRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public DeleteInfrastructureConfigurationResult deleteInfrastructureConfiguration(DeleteInfrastructureConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetComponentResult getComponent(GetComponentRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetComponentPolicyResult getComponentPolicy(GetComponentPolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetContainerRecipeResult getContainerRecipe(GetContainerRecipeRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetContainerRecipePolicyResult getContainerRecipePolicy(GetContainerRecipePolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetDistributionConfigurationResult getDistributionConfiguration(GetDistributionConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetImageResult getImage(GetImageRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetImagePipelineResult getImagePipeline(GetImagePipelineRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetImagePolicyResult getImagePolicy(GetImagePolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetImageRecipeResult getImageRecipe(GetImageRecipeRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetImageRecipePolicyResult getImageRecipePolicy(GetImageRecipePolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public GetInfrastructureConfigurationResult getInfrastructureConfiguration(GetInfrastructureConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ImportComponentResult importComponent(ImportComponentRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ImportVmImageResult importVmImage(ImportVmImageRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListComponentBuildVersionsResult listComponentBuildVersions(ListComponentBuildVersionsRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListComponentsResult listComponents(ListComponentsRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListContainerRecipesResult listContainerRecipes(ListContainerRecipesRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListDistributionConfigurationsResult listDistributionConfigurations(ListDistributionConfigurationsRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListImageBuildVersionsResult listImageBuildVersions(ListImageBuildVersionsRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListImagePackagesResult listImagePackages(ListImagePackagesRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListImagePipelineImagesResult listImagePipelineImages(ListImagePipelineImagesRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListImagePipelinesResult listImagePipelines(ListImagePipelinesRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListImageRecipesResult listImageRecipes(ListImageRecipesRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListImagesResult listImages(ListImagesRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListInfrastructureConfigurationsResult listInfrastructureConfigurations(ListInfrastructureConfigurationsRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public PutComponentPolicyResult putComponentPolicy(PutComponentPolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public PutContainerRecipePolicyResult putContainerRecipePolicy(PutContainerRecipePolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public PutImagePolicyResult putImagePolicy(PutImagePolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public PutImageRecipePolicyResult putImageRecipePolicy(PutImageRecipePolicyRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public StartImagePipelineExecutionResult startImagePipelineExecution(StartImagePipelineExecutionRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public TagResourceResult tagResource(TagResourceRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public UntagResourceResult untagResource(UntagResourceRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public UpdateDistributionConfigurationResult updateDistributionConfiguration(UpdateDistributionConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public UpdateImagePipelineResult updateImagePipeline(UpdateImagePipelineRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public UpdateInfrastructureConfigurationResult updateInfrastructureConfiguration(UpdateInfrastructureConfigurationRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public void shutdown() {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public com.amazonaws.ResponseMetadata getCachedResponseMetadata(com.amazonaws.AmazonWebServiceRequest request) {
        throw new java.lang.UnsupportedOperationException();
    }

}


text:
package org.apache.servicecomb.it.testcase;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.HashMap;
import java.util.Map;

import org.apache.servicecomb.it.Consumers;
import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
import org.junit.Test;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;

public class TestAnnotatedAttribute {
  interface AnnotatedAttributeIntf {
    String fromHeader(String inputs);
  }

  private static Consumers<AnnotatedAttributeIntf> consumersSpringmvc =
      new Consumers<>("annotatedAttributeSpringmvc", AnnotatedAttributeIntf.class);

  @Test
  public void fromHeader_springmvc_rt() {
    fromHeader_rt(consumersSpringmvc);
  }

  @Test
  public void fromQuery_springmvc_rt() {
    fromQuery_rt(consumersSpringmvc);
  }

  @Test
  public void fromCookie_springmvc_rt() {
    fromCookie_rt(consumersSpringmvc);
  }

  @Test
  public void fromCookieRequired_springmvc_rt() {
    should_throw_exception_when_required_cookie_parameter_not_set_value_call_by_restTemplate(consumersSpringmvc);
  }

  @Test
  public void fromCookieDefaultValue_springmvc_rt() {
    fromCookieDefaultValue_rt(consumersSpringmvc);
  }

  @Test
  public void fromPath_springmvc_rt() {
    fromPath_rt(consumersSpringmvc);
  }

//  @Test
//  public void fromPart_springmvc_rt() {
//    fromPart_rt(consumersSpringmvc);
//  }

  @Test
  public void fromAttribute_springmvc_rt() {
    fromAttribute_rt(consumersSpringmvc);
  }

  protected void fromHeader_rt(Consumers<AnnotatedAttributeIntf> consumers) {
    HttpHeaders headers = new HttpHeaders();
    headers.add("input", "default");
    headers.add("input2", "fromValue");
    headers.add("input3", "fromName");

    @SuppressWarnings("rawtypes")
    HttpEntity entity = new HttpEntity<>(null, headers);
    ResponseEntity<String> response = consumers.getSCBRestTemplate()
        .exchange("/fromHeader",
            HttpMethod.GET,
            entity,
            String.class);
    assertEquals("default,fromValue,fromName", response.getBody());
  }

  protected void fromQuery_rt(Consumers<AnnotatedAttributeIntf> consumers) {
    String result = consumers.getSCBRestTemplate()
        .getForObject("/fromQuery?input={1}&input2={2}&input3={3}",
            String.class,
            "default",
            "fromValue",
            "fromName");
    assertEquals("default,fromValue,fromName", result);
  }

  protected void fromCookie_rt(Consumers<AnnotatedAttributeIntf> consumers) {
    HttpHeaders headers = new HttpHeaders();
    headers.add(HttpHeaders.COOKIE, "input=default");
    headers.add(HttpHeaders.COOKIE, "input2=fromValue");
    headers.add(HttpHeaders.COOKIE, "input3=fromName");

    HttpEntity<?> requestEntity = new HttpEntity<>(headers);
    ResponseEntity<String> result = consumers.getSCBRestTemplate()
        .exchange("/fromCookie",
            HttpMethod.GET,
            requestEntity,
            String.class);
    assertEquals("default,fromValue,fromName", result.getBody());
  }

  protected void should_throw_exception_when_required_cookie_parameter_not_set_value_call_by_restTemplate(
      Consumers<AnnotatedAttributeIntf> consumers) {
    HttpHeaders headers = new HttpHeaders();
    HttpEntity<?> requestEntity = new HttpEntity<>(headers);
    try {
      consumers.getSCBRestTemplate()
          .exchange("/fromCookieRequired",
              HttpMethod.GET,
              requestEntity,
              String.class);
      assertEquals("required is true, throw exception", "but not throw exception");
    } catch (InvocationException e) {
      assertEquals(400, e.getStatusCode());
      assertTrue(
          e.getMessage()
              .contains("InvocationException: code=400;msg=CommonExceptionData [message=Parameter is not valid"));
    }
    headers.add(HttpHeaders.COOKIE, "input1=default1");
    requestEntity = new HttpEntity<>(headers);
    try {
      consumers.getSCBRestTemplate()
          .exchange("/fromCookieRequired",
              HttpMethod.GET,
              requestEntity,
              String.class);
      assertEquals("required is true, throw exception", "but not throw exception");
    } catch (InvocationException e) {
      assertEquals(400, e.getStatusCode());
      assertTrue(
          e.getMessage()
              .contains("InvocationException: code=400;msg=CommonExceptionData [message=Parameter is not valid"));
    }
    headers.add(HttpHeaders.COOKIE, "input=joker");
    requestEntity = new HttpEntity<>(headers);
    ResponseEntity<String> result = consumers.getSCBRestTemplate()
        .exchange("/fromCookieRequired",
            HttpMethod.GET,
            requestEntity,
            String.class);
    assertEquals("joker", result.getBody());
  }

  protected void fromCookieDefaultValue_rt(Consumers<AnnotatedAttributeIntf> consumers) {
    HttpHeaders headers = new HttpHeaders();
    HttpEntity<?> requestEntity = new HttpEntity<>(headers);
    ResponseEntity<String> result = consumers.getSCBRestTemplate()
        .exchange("/fromCookieDefaultValue",
            HttpMethod.GET,
            requestEntity,
            String.class);
    assertEquals("default", result.getBody());

    headers.add(HttpHeaders.COOKIE, "input1=jokers");
    requestEntity = new HttpEntity<>(headers);
    result = consumers.getSCBRestTemplate()
        .exchange("/fromCookieDefaultValue",
            HttpMethod.GET,
            requestEntity,
            String.class);
    assertEquals("default", result.getBody());

    headers.add(HttpHeaders.COOKIE, "input=joker");
    requestEntity = new HttpEntity<>(headers);
    result = consumers.getSCBRestTemplate()
        .exchange("/fromCookieDefaultValue",
            HttpMethod.GET,
            requestEntity,
            String.class);
    assertEquals("joker", result.getBody());
  }

  protected void fromPath_rt(Consumers<AnnotatedAttributeIntf> consumers) {
    String result = consumers.getSCBRestTemplate()
        .getForObject("/fromPath/{1}/{2}/{3}",
            String.class,
            "default",
            "fromValue",
            "fromName");
    assertEquals("default,fromValue,fromName", result);
  }

//  protected void fromPart_rt(Consumers<AnnotatedAttributeIntf> consumers) {
//    MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
//    map.add("input", "default");
//    map.add("input2", "fromValue");
//    map.add("input3", "fromName");
//
//    String result = consumers.getSCBRestTemplate()
//        .postForObject("/fromPart",
//            new HttpEntity<>(map),
//            String.class);
//    assertEquals("default,fromValue,fromName", result);
//  }

  protected void fromAttribute_rt(Consumers<AnnotatedAttributeIntf> consumers) {
    Map<String, Object> body = new HashMap<>();
    body.put("input", "default");
    body.put("input2", "fromValue");
    body.put("input3", "fromName");
    ResponseEntity<String> result = consumers.getSCBRestTemplate()
        .exchange("/fromAttribute",
            HttpMethod.POST,
            new HttpEntity<>(body),
            String.class);
    assertEquals("default,fromValue,fromName", result.getBody());
  }
}


text:
module.exports = function(config) {
  'use strict';

  config.set({

    basePath: './',

    frameworks: ["jasmine"],

    files: [
      'bower_components/angular/angular.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'src/**/*.js',
      'test/**/*.js'
    ],

    autoWatch: true,

    browsers: ['PhantomJS']

  });
};


text:
require "spec_helper"

module Doorkeeper::OAuth::Authorization
  describe URIBuilder do
    subject { URIBuilder }

    describe :uri_with_query do
      it "returns the uri with query" do
        uri = subject.uri_with_query "http://example.com/", parameter: "value"
        expect(uri).to eq("http://example.com/?parameter=value")
      end

      it "rejects nil values" do
        uri = subject.uri_with_query "http://example.com/", parameter: ""
        expect(uri).to eq("http://example.com/?")
      end

      it "preserves original query parameters" do
        uri = subject.uri_with_query "http://example.com/?query1=value", parameter: "value"
        expect(uri).to match(/query1=value/)
        expect(uri).to match(/parameter=value/)
      end
    end

    describe :uri_with_fragment do
      it "returns uri with parameters as fragments" do
        uri = subject.uri_with_fragment "http://example.com/", parameter: "value"
        expect(uri).to eq("http://example.com/#parameter=value")
      end

      it "preserves original query parameters" do
        uri = subject.uri_with_fragment "http://example.com/?query1=value1", parameter: "value"
        expect(uri).to eq("http://example.com/?query1=value1#parameter=value")
      end
    end
  end
end


text:
package gui.simpleUI;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;

/**
 * This class is a subclass of {@link BaseAdapter} and allows to create a simple
 * to use {@link ListAdapter} for any {@link ListView}. Updates in the list will
 * be detected by the adapter automatically, so the list can be used as usual
 *
 * <br>
 *
 * The items in the list have to implement the {@link HasItsOwnView} interface.
 * This allows much more flexible {@link ListView} designs with custom UI for
 * each list element.
 *
 * @author Spobo
 *
 */
public class SimpleBaseAdapter extends BaseAdapter {

	public interface HasItsOwnView {

		/**
		 * @param context
		 *            This object is needed to create new views
		 * @param convertView
		 *            it might be possible to use this view if it is not null
		 *            and the correct type
		 * @param parent
		 *            the parent view the item view will be contained in. The
		 *            item view does not have to be added to the parent manually
		 * @param simpleBaseAdapter
		 *            if the displayed list is changed call
		 *            {@link SimpleBaseAdapter#notifyDataSetChanged()}
		 * @param containerList
		 *            the list where the item is contained in
		 * @param positionInList
		 *            the position in the list
		 * @return
		 */
		public View getView(Context context, View convertView,
				ViewGroup parent, SimpleBaseAdapter simpleBaseAdapter,
				List<HasItsOwnView> containerList, int positionInList);
	}

	private static final int UPDATE_SPEED = 1000;
	private List<HasItsOwnView> myList;
	private int oldSize;
	private boolean keepUpdaterRunning = true;

	/**
	 * @param activity
	 *            if the {@link ListView} should auto-update itself when the
	 *            {@link List} is changed pass the {@link Activity} which
	 *            displays the {@link ListView}, otherwise if auto-updates are
	 *            not necessary because the list does not change or the notify
	 *            method of the adapter is called manually on each change pass
	 *            null
	 * @param listToDisplay
	 *            the {@link List} that should be displayed
	 */
	public SimpleBaseAdapter(final Activity activity,
			List<HasItsOwnView> listToDisplay) {
		myList = listToDisplay;
		if (activity != null)
			createAutoUpdaterForTheListAdapter(activity);
	}

	/**
	 * call this method when the auto-update thread should be stopped
	 */
	public void stopAutoUpdatesOfTheListView() {
		keepUpdaterRunning = false;
	}

	private void createAutoUpdaterForTheListAdapter(final Activity a) {
		new Thread(new Runnable() {
			@Override
			public void run() {
				while (keepUpdaterRunning) {
					try {
						Thread.sleep(UPDATE_SPEED);
						a.runOnUiThread(new Runnable() {
							@Override
							public void run() {
								try {
									refreshCount(myList.size());
								} catch (Exception e) {
									keepUpdaterRunning = false;
								}
							}
						});
					} catch (InterruptedException e) {
						keepUpdaterRunning = false;
					}
				}
			}
		}).start();
	}

	@Override
	public int getCount() {
		return refreshCount(myList.size());
	}

	@Override
	public Object getItem(int position) {
		refreshCount(myList.size());
		return myList.get(position);
	}

	@Override
	public long getItemId(int position) {
		refreshCount(myList.size());
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		refreshCount(myList.size());
		return myList.get(position).getView(parent.getContext(), convertView,
				parent, this, myList, position);
	}

	/**
	 * This should allow the modification of the adapters list without a manual
	 * call for {@link SimpleBaseAdapter#notifyDataSetChanged()} each time
	 *
	 * @param currentSize
	 * @return the old size if it changed. This is needed for the
	 *         {@link SimpleBaseAdapter#getCount()} method! Do not modify!
	 */
	private int refreshCount(int currentSize) {
		if (oldSize != currentSize) {
			int result = oldSize;
			oldSize = currentSize;
			notifyDataSetChanged();
			return result;
		}
		return currentSize;
	}

}