text:
#include "include_platform/nativehelper/JniInvocation.h"

#define LOG_TAG "JniInvocation"
#include "ALog-priv.h"

#if defined(__ANDROID__)
#include <sys/system_properties.h>
#endif

#include <jni.h>
#include <stdbool.h>
#include <string.h>

#include "DlHelp.h"

// Name the default library providing the JNI Invocation API.
static const char* kDefaultJniInvocationLibrary = "libart.so";

struct JniInvocationImpl {
  // Name of library providing JNI_ method implementations.
  const char* jni_provider_library_name;

  // Opaque pointer to shared library from dlopen / LoadLibrary.
  void* jni_provider_library;

  // Function pointers to methods in JNI provider.
  jint (*JNI_GetDefaultJavaVMInitArgs)(void*);
  jint (*JNI_CreateJavaVM)(JavaVM**, JNIEnv**, void*);
  jint (*JNI_GetCreatedJavaVMs)(JavaVM**, jsize, jsize*);
};

static struct JniInvocationImpl g_impl;

//
// Internal helpers.
//

#define UNUSED(x) (x) = (x)

static bool IsDebuggable() {
#ifdef __ANDROID__
  char debuggable[PROP_VALUE_MAX] = {0};
  __system_property_get("ro.debuggable", debuggable);
  return strcmp(debuggable, "1") == 0;
#else
  // Host is always treated as debuggable, which allows choice of library to be overridden.
  return true;
#endif
}

static int GetLibrarySystemProperty(char* buffer) {
#ifdef __ANDROID__
  return __system_property_get("persist.sys.dalvik.vm.lib.2", buffer);
#else
  // Host does not use properties.
  UNUSED(buffer);
  return 0;
#endif
}

static DlSymbol FindSymbol(DlLibrary library, const char* symbol) {
  DlSymbol s = DlGetSymbol(library, symbol);
  if (s == NULL) {
    ALOGE("Failed to find symbol: %s", symbol);
  }
  return s;
}

//
// Exported functions for JNI based VM management from JNI spec.
//

jint JNI_GetDefaultJavaVMInitArgs(void* vmargs) {
  ALOG_ALWAYS_FATAL_IF(NULL == g_impl.JNI_GetDefaultJavaVMInitArgs, "Runtime library not loaded.");
  return g_impl.JNI_GetDefaultJavaVMInitArgs(vmargs);
}

jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
  ALOG_ALWAYS_FATAL_IF(NULL == g_impl.JNI_CreateJavaVM, "Runtime library not loaded.");
  return g_impl.JNI_CreateJavaVM(p_vm, p_env, vm_args);
}

jint JNI_GetCreatedJavaVMs(JavaVM** vms, jsize size, jsize* vm_count) {
  if (NULL == g_impl.JNI_GetCreatedJavaVMs) {
    *vm_count = 0;
    return JNI_OK;
  }
  return g_impl.JNI_GetCreatedJavaVMs(vms, size, vm_count);
}

//
// JniInvocation functions for setting up JNI functions.
//

const char* JniInvocationGetLibraryWith(const char* library,
                                        bool is_debuggable,
                                        const char* system_preferred_library) {
  if (is_debuggable) {
    // Debuggable property is set. Allow library providing JNI Invocation API to be overridden.

    // Choose the library parameter (if provided).
    if (library != NULL) {
      return library;
    }
    // Choose the system_preferred_library (if provided).
    if (system_preferred_library != NULL) {
      return system_preferred_library;
    }
  }
  return kDefaultJniInvocationLibrary;
}

const char* JniInvocationGetLibrary(const char* library, char* buffer) {
  bool debuggable = IsDebuggable();
  const char* system_preferred_library = NULL;
  if (buffer != NULL && (GetLibrarySystemProperty(buffer) > 0)) {
    system_preferred_library = buffer;
  }
  return JniInvocationGetLibraryWith(library, debuggable, system_preferred_library);
}

struct JniInvocationImpl* JniInvocationCreate() {
  // Android only supports a single JniInvocation instance and only a single JavaVM.
  if (g_impl.jni_provider_library != NULL) {
    return NULL;
  }
  return &g_impl;
}

bool JniInvocationInit(struct JniInvocationImpl* instance, const char* library_name) {
#ifdef __ANDROID__
  char buffer[PROP_VALUE_MAX];
#else
  char* buffer = NULL;
#endif
  library_name = JniInvocationGetLibrary(library_name, buffer);
  DlLibrary library = DlOpenLibrary(library_name);
  if (library == NULL) {
    if (strcmp(library_name, kDefaultJniInvocationLibrary) == 0) {
      // Nothing else to try.
      ALOGE("Failed to dlopen %s: %s", library_name, DlGetError());
      return false;
    }
    // Note that this is enough to get something like the zygote
    // running, we can't property_set here to fix this for the future
    // because we are root and not the system user. See
    // RuntimeInit.commonInit for where we fix up the property to
    // avoid future fallbacks. http://b/11463182
    ALOGW("Falling back from %s to %s after dlopen error: %s",
          library_name, kDefaultJniInvocationLibrary, DlGetError());
    library_name = kDefaultJniInvocationLibrary;
    library = DlOpenLibrary(library_name);
    if (library == NULL) {
      ALOGE("Failed to dlopen %s: %s", library_name, DlGetError());
      return false;
    }
  }

  DlSymbol JNI_GetDefaultJavaVMInitArgs_ = FindSymbol(library, "JNI_GetDefaultJavaVMInitArgs");
  if (JNI_GetDefaultJavaVMInitArgs_ == NULL) {
    return false;
  }

  DlSymbol JNI_CreateJavaVM_ = FindSymbol(library, "JNI_CreateJavaVM");
  if (JNI_CreateJavaVM_ == NULL) {
    return false;
  }

  DlSymbol JNI_GetCreatedJavaVMs_ = FindSymbol(library, "JNI_GetCreatedJavaVMs");
  if (JNI_GetCreatedJavaVMs_ == NULL) {
    return false;
  }

  instance->jni_provider_library_name = library_name;
  instance->jni_provider_library = library;
  instance->JNI_GetDefaultJavaVMInitArgs = (jint (*)(void *)) JNI_GetDefaultJavaVMInitArgs_;
  instance->JNI_CreateJavaVM = (jint (*)(JavaVM**, JNIEnv**, void*)) JNI_CreateJavaVM_;
  instance->JNI_GetCreatedJavaVMs = (jint (*)(JavaVM**, jsize, jsize*)) JNI_GetCreatedJavaVMs_;

  return true;
}

void JniInvocationDestroy(struct JniInvocationImpl* instance) {
  DlCloseLibrary(instance->jni_provider_library);
  memset(instance, 0, sizeof(*instance));
}


text:
(function() {
'use strict';

/**
 * @description
 * The NavController is a navigation stack View Controller modelled off of
 * UINavigationController from Cocoa Touch. With the Nav Controller, you can
 * "push" new "pages" on to the navigation stack, and then pop them off to go
 * back. The NavController controls a navigation bar with a back button and title
 * which updates as the pages switch.
 *
 * The NavController makes sure to not recycle scopes of old pages
 * so that a pop will still show the same state that the user left.
 *
 * However, once a page is popped, its scope is destroyed and will have to be
 * recreated then next time it is pushed.
 *
 */

var actualLocation = null;

angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])

.run(['$rootScope', function($rootScope) {
  $rootScope.stackCursorPosition = 0;
}])

.directive('navRouter', ['$rootScope', '$timeout', '$location', '$window', '$route', function($rootScope, $timeout, $location, $window, $route) {
  return {
    restrict: 'AC',
    // So you can require being under this
    controller: ['$scope', '$element', function($scope, $element) {
      this.navBar = {
        isVisible: true
      };
      $scope.navController = this;

      this.goBack = function() {
        $scope.direction = 'back';
      };
    }],

    link: function($scope, $element, $attr, ctrl) {
      if(!$element.length) return;

      $scope.animation = $attr.animation;

      $element[0].classList.add('noop-animation');

      var isFirst = true;
      // Store whether we did an animation yet, to know if
      // we should let the first state animate
      var didAnimate = false;

      var initTransition = function() {
        //$element.addClass($scope.animation);
      };

      var reverseTransition = function() {
        $element[0].classList.remove('noop-animation');
        $element[0].classList.add($scope.animation);
        $element[0].classList.add('reverse');
      };

      var forwardTransition = function() {
        $element[0].classList.remove('noop-animation');
        $element[0].classList.remove('reverse');
        $element[0].classList.add($scope.animation);
      };

      $scope.$on('$routeChangeSuccess', function(e, a) {
      });
      $scope.$on('$routeChangeStart', function(e, next, current) {
        var back, historyState = $window.history.state;

        back = $scope.direction == 'back' || (!!(historyState && historyState.position <= $rootScope.stackCursorPosition));

        if(isFirst || (next && next.$$route && next.$$route.originalPath === "")) {
          // Don't animate
          isFirst = false;
          return;
        }

        if(didAnimate || $rootScope.stackCursorPosition > 0) {
          didAnimate = true;
          if(back) {
            reverseTransition();
          } else {
            forwardTransition();
          }
        }
      });

      $scope.$on('$locationChangeSuccess', function(a, b, c) {
        // Store the new location
        $rootScope.actualLocation = $location.path();
        if(isFirst && $location.path() !== '/') {
          isFirst = false;
        }
      });

      $scope.$on('navRouter.goBack', function(e) {
        ctrl.goBack();
      });

      // Keep track of location changes and update a stack pointer that tracks whether we are
      // going forwards or back
      $scope.$watch(function () { return $location.path(); }, function (newLocation, oldLocation) {
        if($rootScope.actualLocation === newLocation) {
          if(oldLocation === '') {// || newLocation == '/') {
            // initial route, skip this
            return;
          }

          var back, historyState = $window.history.state;

          back = $scope.direction == 'back' || (!!(historyState && historyState.position <= $rootScope.stackCursorPosition));

          if (back) {
            //back button
            $rootScope.stackCursorPosition--;
          } else {
            //forward button
            $rootScope.stackCursorPosition++;
          }

          $scope.direction = 'forwards';

        } else {
          var currentRouteBeforeChange = $route.current;

          if (currentRouteBeforeChange) {

            $window.history.replaceState({
              position: $rootScope.stackCursorPosition
            });

            $rootScope.stackCursorPosition++;
          }
        }
      });
    }
  };
}])

/**
 * Our Nav Bar directive which updates as the controller state changes.
 */
.directive('navBar', ['$rootScope', '$animate', '$compile', function($rootScope, $animate, $compile) {

  /**
   * Perform an animation between one tab bar state and the next.
   * Right now this just animates the titles.
   */
  var animate = function($scope, $element, oldTitle, data, cb) {
    var title, nTitle, oTitle, titles = $element[0].querySelectorAll('.title');

    var newTitle = data.title;
    if(!oldTitle || oldTitle === newTitle) {
      cb();
      return;
    }

    // Clone the old title and add a new one so we can show two animating in and out
    // add ng-leave and ng-enter during creation to prevent flickering when they are swapped during animation
    title = angular.element(titles[0]);
    oTitle = $compile('

')($scope);
    title.replaceWith(oTitle);
    nTitle = $compile('

')($scope);

    var insert = $element[0].firstElementChild || null;

    // Insert the new title
    $animate.enter(nTitle, $element, insert && angular.element(insert), function() {
      cb();
    });

    // Remove the old title
    $animate.leave(angular.element(oTitle), function() {
    });
  };

  return {
    restrict: 'E',
    require: '^navRouter',
    replace: true,
    scope: {
      type: '@',
      backButtonType: '@',
      backButtonLabel: '@',
      backButtonIcon: '@',
      alignTitle: '@'
    },
    template: '' +
        '
 ' +
          '<button nav-back class="button" ng-if="enableBackButton && showBackButton" ng-class="backButtonClass" ng-bind-html="backButtonLabel"></button>' +
          '<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
        '
' +
        '

' +
        '
 ' +
          '<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
        '
' +
      '',
    link: function($scope, $element, $attr, navCtrl) {
      var backButton;

      $element.addClass($attr.animation);

      // Create the back button content and show/hide it based on scope settings
      $scope.enableBackButton = true;
      $scope.backButtonClass = $attr.backButtonType;
      if($attr.backButtonIcon) {
        $scope.backButtonClass += ' icon ' + $attr.backButtonIcon;
      }

      // Listen for changes in the stack cursor position to indicate whether a back
      // button should be shown (this can still be disabled by the $scope.enableBackButton
      $rootScope.$watch('stackCursorPosition', function(value) {
        if(value > 0) {
          $scope.showBackButton = true;
        } else {
          $scope.showBackButton = false;
        }
      });

      // Store a reference to our nav controller
      $scope.navController = navCtrl;

      // Initialize our header bar view which will handle resizing and aligning our title labels
      var hb = new ionic.views.HeaderBar({
        el: $element[0],
        alignTitle: $scope.alignTitle || 'center'
      });
      $scope.headerBarView = hb;

      // Add the type of header bar class to this element
      $element.addClass($scope.type);

      var updateHeaderData = function(data) {
        var oldTitle = $scope.currentTitle;
        $scope.oldTitle = oldTitle;

        if(typeof data.title !== 'undefined') {
          $scope.currentTitle = data.title;
        }

        $scope.leftButtons = data.leftButtons;
        $scope.rightButtons = data.rightButtons;

        if(typeof data.hideBackButton !== 'undefined') {
          $scope.enableBackButton = data.hideBackButton !== true;
        }

        if(data.animate !== false && typeof data.title !== 'undefined') {
          animate($scope, $element, oldTitle, data, function() {
            hb.align();
          });
        } else {
          hb.align();
        }
      };

      $scope.$parent.$on('navRouter.showBackButton', function(e, data) {
        $scope.enableBackButton = true;
      });

      $scope.$parent.$on('navRouter.hideBackButton', function(e, data) {
        $scope.enableBackButton = false;
      });

      // Listen for changes on title change, and update the title
      $scope.$parent.$on('navRouter.pageChanged', function(e, data) {
        updateHeaderData(data);
      });

      $scope.$parent.$on('navRouter.pageShown', function(e, data) {
        updateHeaderData(data);
      });

      $scope.$parent.$on('navRouter.titleChanged', function(e, data) {
        var oldTitle = $scope.currentTitle;
        $scope.oldTitle = oldTitle;

         if(typeof data.title !== 'undefined') {
          $scope.currentTitle = data.title;
        }

        if(data.animate !== false && typeof data.title !== 'undefined') {
          animate($scope, $element, oldTitle, data, function() {
            hb.align();
          });
        } else {
          hb.align();
        }
      });

      // If a nav page changes the left or right buttons, update our scope vars
      $scope.$parent.$on('navRouter.leftButtonsChanged', function(e, data) {
        $scope.leftButtons = data;
      });
      $scope.$parent.$on('navRouter.rightButtonsChanged', function(e, data) {
        $scope.rightButtons = data;
      });

      /*
      $scope.$parent.$on('navigation.push', function() {
        backButton = angular.element($element[0].querySelector('.button'));
        backButton.addClass($scope.backButtonType);
        hb.align();
      });
      $scope.$parent.$on('navigation.pop', function() {
        hb.align();
      });
      */

      $scope.$on('$destroy', function() {
        //
      });
    }
  };
}])

.directive('navPage', ['$parse', function($parse) {
  return {
    restrict: 'E',
    require: '^navRouter',
    scope: {
      leftButtons: '=',
      rightButtons: '=',
      title: '=',
      icon: '@',
      iconOn: '@',
      iconOff: '@',
      type: '@',
      alignTitle: '@',
      hideBackButton: '@',
      hideNavBar: '@',
      animate: '@',
    },
    link: function($scope, $element, $attr, navCtrl) {
      $element.addClass('pane');

      // Should we hide a back button when this tab is shown
      $scope.hideBackButton = $scope.$eval($scope.hideBackButton);

      $scope.hideNavBar = $scope.$eval($scope.hideNavBar);

      navCtrl.navBar.isVisible = !$scope.hideNavBar;

      if($scope.hideBackButton === true) {
        $scope.$emit('navRouter.hideBackButton');
      } else {
        $scope.$emit('navRouter.showBackButton');
      }

      // Whether we should animate on tab change, also impacts whether we
      // tell any parent nav controller to animate
      $scope.animate = $scope.$eval($scope.animate);

      // watch for changes in the left buttons
      $scope.$watch('leftButtons', function(value) {
        $scope.$emit('navRouter.leftButtonsChanged', $scope.leftButtons);
      });

      $scope.$watch('rightButtons', function(val) {
        $scope.$emit('navRouter.rightButtonsChanged', $scope.rightButtons);
      });

      /*
      $scope.$watch('hideBackButton', function(value) {
        if(value === true) {
          navCtrl.hideBackButton();
        } else {
          navCtrl.showBackButton();
        }
      });
      */

      // watch for changes in the title
      $scope.$watch('title', function(value) {
        $scope.$emit('navRouter.titleChanged', {
          title: value,
          animate: $scope.animate
        });
      });
    }
  };
}])

.directive('navBack', ['$window', '$rootScope', 'Gesture', function($window, $rootScope, Gesture) {
  return {
    restrict: 'AC',
    link: function($scope, $element, $attr, navCtrl) {
      var goBack = function(e) {
        // Only trigger back if the stack is greater than zero
        if($rootScope.stackCursorPosition > 0) {
          $window.history.back();

          // Fallback for bad history supporting devices
          $scope.$emit('navRouter.goBack');
        }
        e.alreadyHandled = true;
        return false;
      };
      $element.bind('click', goBack);
    }
  };
}]);

})();

redpajama_set_name: RedPajamaGithub


text:
package kg.apc.jmeter.gui;

class TableModelEmul {

    public static final String[] columnIdentifiers = new String[]{
        "Start Threads Count", "Initial Delay, sec", "Startup Time, sec", "Hold Load For, sec", "Shutdown Time"
    };
    /**
     *
     */
    public static final Class[] columnClasses = new Class[]{
        String.class, String.class, String.class, String.class, String.class
    };
    public static final Integer[] defaultValues = new Integer[]{
        100, 0, 30, 60, 10
    };
}


text:
package homework_generics;

import java.util.LinkedList;

/**
 * Created by Duan Guanhua on 2017/10/13.
 */
public class LinkedStack<T> {
    private LinkedList<T> linkedList = null;

    public LinkedStack() {
        linkedList = new LinkedList<T>();
    }

    public void push(T t) {
        linkedList.addFirst(t);
    }

    public T pop() {
        return linkedList.removeFirst();
    }

    public T peek() {
        return linkedList.peekFirst();

    }

    public int size() {
        return linkedList.size();
    }

    void clear() {
        linkedList.clear();
    }

    public boolean isEmpty() {
        return linkedList.size() == 0;
    }
}


text:
package com.gersion.superlock.utils;

import android.util.Log;

/**
 * ClassName:LogUtils

 * Function: TODO ADD FUNCTION.

 * Date: 2016-7-22改良版,能传入Object类型的数据

 *
 * @author Alpha
 */
public final class LogUtils {
    /**
     * Log defaulticon tag.
     */
    private static String sTagDefault = "Gersy";

    /**
     * Log toggle for release, defaulticon value is false.
     */
    private static boolean sToggleRelease = false;

    /**
     * Log toggle for print Throwable info, defaulticon value is true.
     */
    private static boolean sToggleThrowable = true;

    /**
     * Log toggle for print thread name, defaulticon value is false.
     */
    private static boolean sToggleThread = false;

    /**
     * Log toggle for print class name and method name, defaulticon value is false.
     */
    private static boolean sToggleClassMethod = true;

    /**
     * Log toggle for print file name and code line number, defaulticon value is false.
     */
    private static boolean sToggleFileLineNumber = true;

    public static void e(String tag, String msg, Throwable e) {
        printLog(Log.ERROR, tag, msg, e);
    }

    public static void e(String msg, Throwable e) {
        printLog(Log.ERROR, null, msg, e);
    }

    public static void e(String msg) {
        printLog(Log.ERROR, null, msg, null);
    }

    /**
     * DESC : 如果传入的是Object 类型就加上一个空串 .

     *
     * @param msg
     */
    public static void e(Object msg) {
        printLog(Log.ERROR, null, msg + "", null);
    }

    public static void w(String tag, String msg, Throwable e) {
        printLog(Log.WARN, tag, msg, e);
    }

    public static void w(String msg, Throwable e) {
        printLog(Log.WARN, null, msg, e);
    }

    public static void w(String msg) {
        printLog(Log.WARN, null, msg, null);
    }

    /**
     * DESC : 如果传入的是Object 类型就加上一个空串 .

     *
     * @param msg
     */
    public static void w(Object msg) {
        printLog(Log.WARN, null, msg + "", null);
    }

    /**
     * DESC : 如果传入的是Object 类型就加上一个空串 .

     *
     * @param msg
     */

    public static void i(String tag, String msg, Throwable e) {
        printLog(Log.INFO, tag, msg, e);
    }

    public static void i(String msg) {
        printLog(Log.INFO, null, msg, null);
    }

    /**
     * DESC : 如果传入的是Object 类型就加上一个空串 .

     *
     * @param msg
     */
    public static void i(Object msg) {
        printLog(Log.INFO, null, msg + "", null);
    }

    public static void d(String tag, String msg, Throwable e) {
        printLog(Log.DEBUG, tag, msg, e);
    }

    public static void d(String msg, Throwable e) {
        printLog(Log.DEBUG, null, msg, e);
    }

    public static void d(String tag, String msg) {
        printLog(Log.DEBUG, tag, msg, null);
    }

    public static void d(String msg) {
        printLog(Log.DEBUG, null, msg, null);
    }

    /**
     * DESC : 如果传入的是Object 类型就加上一个空串 .

     *
     * @param msg
     */
    public static void d(Object msg) {
        printLog(Log.DEBUG, null, msg + "", null);
    }

    public static void v(String tag, String msg, Throwable e) {
        printLog(Log.VERBOSE, tag, msg, e);
    }

    public static void v(String tag, String msg) {
        printLog(Log.VERBOSE, tag, msg, null);
    }

    public static void v(String msg) {
        printLog(Log.VERBOSE, null, msg, null);
    }

    /**
     * DESC : 如果传入的是Object 类型就加上一个空串 .

     *
     * @param msg
     */
    public static void v(Object msg) {
        printLog(Log.VERBOSE, null, msg + "", null);
    }

    private static void printLog(int logType, String tag, String msg, Throwable e) {
        String tagStr = (tag == null) ? sTagDefault : tag;
        if (sToggleRelease) {
            if (logType < Log.INFO) {
                return;
            }
            String msgStr =
                    (e == null) ? msg : (msg + "\n" + Log.getStackTraceString(e));

            switch (logType) {
                case Log.ERROR:
                    Log.e(tagStr, msgStr);

                    break;
                case Log.WARN:
                    Log.w(tagStr, msgStr);

                    break;
                case Log.INFO:
                    Log.i(tagStr, msgStr);

                    break;
                default:
                    break;
            }

        } else {
            StringBuilder msgStr = new StringBuilder();

            if (sToggleThread || sToggleClassMethod || sToggleFileLineNumber) {
                Thread currentThread = Thread.currentThread();

                if (sToggleThread) {
                    msgStr.append("<");
                    msgStr.append(currentThread.getName());
                    msgStr.append("> ");
                }

                if (sToggleClassMethod) {
                    StackTraceElement ste = currentThread.getStackTrace()[4];
                    String className = ste.getClassName();
                    msgStr.append("[类名");
                    msgStr.append(className == null ? null
                            : className.substring(className.lastIndexOf('.') + 1));
                    msgStr.append("方法名");
                    msgStr.append(ste.getMethodName());
                    msgStr.append(" ] ");
                }

                if (sToggleFileLineNumber) {
                    StackTraceElement ste = currentThread.getStackTrace()[4];
                    msgStr.append("[文件名");
                    msgStr.append(ste.getFileName());
                    msgStr.append("行数");
                    msgStr.append(ste.getLineNumber());
                    msgStr.append(" ] ");
                }
            }

            msgStr.append(" 日志内容");
            msgStr.append(msg);
            if (e != null && sToggleThrowable) {
                msgStr.append('\n');
                msgStr.append(Log.getStackTraceString(e));
            }

            switch (logType) {
                case Log.ERROR:
                    Log.e(tagStr, msgStr.toString());

                    break;
                case Log.WARN:
                    Log.w(tagStr, msgStr.toString());

                    break;
                case Log.INFO:
                    Log.i(tagStr, msgStr.toString());

                    break;
                case Log.DEBUG:
                    Log.d(tagStr, msgStr.toString());

                    break;
                case Log.VERBOSE:
                    Log.v(tagStr, msgStr.toString());

                    break;
                default:
                    break;
            }
        }
    }

}


text:
using DotNetCommands;
using FluentAssertions;
using NUnit.Framework;
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using static IntegrationTests.Retrier;

namespace IntegrationTests
{
    [TestFixture]
    public class DownloadNugetTestWithoutPackageSources
    {
        private NugetDownloader downloader;
        private CommandDirectoryCleanup commandDirectoryCleanup;
        private string tempPath;
        private string currentDirectoryWhenTestStarted;

        [OneTimeSetUp]
        public void OneTimeSetUp()
        {
            currentDirectoryWhenTestStarted = Directory.GetCurrentDirectory();
            tempPath = Path.Combine(Path.GetTempPath(), "DotNetTempPath" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10));
            Directory.CreateDirectory(tempPath);
            Directory.SetCurrentDirectory(tempPath);
            commandDirectoryCleanup = new CommandDirectoryCleanup();
            downloader = new NugetDownloader(commandDirectoryCleanup.CommandDirectory);
        }

        [OneTimeTearDown]
        public void ClassCleanup()
        {
            Directory.SetCurrentDirectory(currentDirectoryWhenTestStarted);
            downloader.Dispose();
            commandDirectoryCleanup.Dispose();
            try
            {
                Directory.Delete(tempPath, true);
            }
#pragma warning disable CC0004 // Catch block cannot be empty
            catch { }
#pragma warning restore CC0004 // Catch block cannot be empty
        }

        [Test, Retry]
        public async Task DownloadDotNetFooWithoutPackageSourcesAsync()
        {
            var packageInfo = await downloader.DownloadAndExtractNugetAsync("dotnet-foo", null, force: false, includePreRelease: false);
            Directory.Exists(packageInfo.PackageDir).Should().BeTrue();
            var cmd = Directory.EnumerateFiles(packageInfo.PackageDir, "dotnet-foo.cmd", SearchOption.AllDirectories).FirstOrDefault();
            cmd.Should().NotBeNull();
            Directory.GetParent(cmd).Name.Should().Be("tools");
        }
    }
}


text:
package com.cisco.axl.api._8;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for ListCallingPartyTransformationPatternRes complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="ListCallingPartyTransformationPatternRes">
 *   <complexContent>
 *     <extension base="{http://www.cisco.com/AXL/API/8.0}APIResponse">
 *       <sequence>
 *         <element name="return">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="callingPartyTransformationPattern" type="{http://www.cisco.com/AXL/API/8.0}LCallingPartyTransformationPattern" maxOccurs="unbounded" minOccurs="0"/>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ListCallingPartyTransformationPatternRes", propOrder = {
    "_return"
})
public class ListCallingPartyTransformationPatternRes
    extends APIResponse
{

    @XmlElement(name = "return", required = true)
    protected ListCallingPartyTransformationPatternRes.Return _return;

    /**
     * Gets the value of the return property.
     *
     * @return
     *     possible object is
     *     {@link ListCallingPartyTransformationPatternRes.Return }
     *
     */
    public ListCallingPartyTransformationPatternRes.Return getReturn() {
        return _return;
    }

    /**
     * Sets the value of the return property.
     *
     * @param value
     *     allowed object is
     *     {@link ListCallingPartyTransformationPatternRes.Return }
     *
     */
    public void setReturn(ListCallingPartyTransformationPatternRes.Return value) {
        this._return = value;
    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="callingPartyTransformationPattern" type="{http://www.cisco.com/AXL/API/8.0}LCallingPartyTransformationPattern" maxOccurs="unbounded" minOccurs="0"/>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "callingPartyTransformationPattern"
    })
    public static class Return {

        protected List<LCallingPartyTransformationPattern> callingPartyTransformationPattern;

        /**
         * Gets the value of the callingPartyTransformationPattern property.
         *
         *

         * This accessor method returns a reference to the live list,
         * not a snapshot. Therefore any modification you make to the
         * returned list will be present inside the JAXB object.
         * This is why there is not a set method for the callingPartyTransformationPattern property.
         *
         *

         * For example, to add a new item, do as follows:
         *

         *    getCallingPartyTransformationPattern().add(newItem);
         *

         *
         *
         *

         * Objects of the following type(s) are allowed in the list
         * {@link LCallingPartyTransformationPattern }
         *
         *
         */
        public List<LCallingPartyTransformationPattern> getCallingPartyTransformationPattern() {
            if (callingPartyTransformationPattern == null) {
                callingPartyTransformationPattern = new ArrayList<LCallingPartyTransformationPattern>();
            }
            return this.callingPartyTransformationPattern;
        }

    }

}


text:
/* Placeholder CSS File */

body {
	background-color: #fff;
	color: #666;
	border-radius: 6px;
	box-shadow: 2px 2px 6px #fff;
}
.gradient {
	background: -webkit-linear-gradient(bottom, #000, #fff);
	background: linear-gradient(bottom, #000, #fff);
}
.box-sizing {
	box-sizing: border-box;
}
.text-adjust {
	-webkit-text-size-adjust: 100%;
	    -ms-text-size-adjust: 100%;
	        text-size-adjust: 100%;
}
.opacity {
	opacity: .5;
}
:-webkit-full-screen a {
	-webkit-transition: -webkit-transform 1s;
	        transition: transform 1s;
}
:-moz-full-screen a {
	transition: transform 1s;
}
:-ms-fullscreen a {
	transition: transform 1s;
}
:fullscreen a {
	-webkit-transition: -webkit-transform 1s;
	        transition: transform 1s;
}
.flex {
	display: -webkit-flex;
	display: -ms-flexbox;
	display: flex;
}
.cool {}
/*# sourceMappingURL=style.min.css.map */


text:
{% extends "layout.html" %}

{% block head %}

  {{ super() }}

  {% assets "css_professions" %}
    <link rel="stylesheet" href="{{ ASSET_URL }}">
  {% endassets %}

{% endblock %}

{% block body_end %}

  {{ super() }}

  {% assets "js_professions" %}
    <script type="text/javascript" src="{{ ASSET_URL }}"></script>
  {% endassets %}

{% endblock %}


text:
/*
 * This is not the original file distributed by the Apache Software Foundation
 * It has been modified by the Hipparchus project
 */
package org.hipparchus.analysis.differentiation;

import java.io.Serializable;

import org.hipparchus.Field;
import org.hipparchus.exception.MathIllegalArgumentException;
import org.hipparchus.exception.MathRuntimeException;
import org.hipparchus.util.FastMath;
import org.hipparchus.util.FieldSinCos;
import org.hipparchus.util.FieldSinhCosh;
import org.hipparchus.util.MathArrays;
import org.hipparchus.util.MathUtils;

/** Class representing both the value and the differentials of a function.
 *
This class is the workhorse of the differentiation package.

 *
This class is an implementation of the extension to Rall's
 * numbers described in Dan Kalman's paper Doubly
 * Recursive Multivariate Automatic Differentiation, Mathematics Magazine, vol. 75,
 * no. 3, June 2002. Rall's numbers are an extension to the real numbers used
 * throughout mathematical expressions; they hold the derivative together with the
 * value of a function. Dan Kalman's derivative structures hold all partial derivatives
 * up to any specified order, with respect to any number of free parameters. Rall's
 * numbers therefore can be seen as derivative structures for order one derivative and
 * one free parameter, and real numbers can be seen as derivative structures with zero
 * order derivative and no free parameters.

 *
{@link DerivativeStructure} instances can be used directly thanks to
 * the arithmetic operators to the mathematical functions provided as
 * methods by this class (+, -, *, /, %, sin, cos ...).

 *
Implementing complex expressions by hand using these classes is
 * a tedious and error-prone task but has the advantage of having no limitation
 * on the derivation order despite not requiring users to compute the derivatives by
 * themselves. Implementing complex expression can also be done by developing computation
 * code using standard primitive double values and to use {@link
 * UnivariateFunctionDifferentiator differentiators} to create the {@link
 * DerivativeStructure}-based instances. This method is simpler but may be limited in
 * the accuracy and derivation orders and may be computationally intensive (this is
 * typically the case for {@link FiniteDifferencesDifferentiator finite differences
 * differentiator}.

 *
Instances of this class are guaranteed to be immutable.

 * @see DSCompiler
 * @see FieldDerivativeStructure
 */
public class DerivativeStructure implements Derivative<DerivativeStructure>, Serializable {

    /** Serializable UID. */
    private static final long serialVersionUID = 20161220L;

    /** Factory that built the instance. */
    private final DSFactory factory;

    /** Combined array holding all values. */
    private final double[] data;

    /** Build an instance with all values and derivatives set to 0.
     * @param factory factory that built the instance
     * @param data combined array holding all values
     */
    DerivativeStructure(final DSFactory factory, final double[] data) {
        this.factory = factory;
        this.data    = data.clone();
    }

    /** Build an instance with all values and derivatives set to 0.
     * @param factory factory that built the instance
     * @since 1.4
     */
    DerivativeStructure(final DSFactory factory) {
        this.factory = factory;
        this.data    = new double[factory.getCompiler().getSize()];
    }

    /** {@inheritDoc} */
    @Override
    public DerivativeStructure newInstance(final double value) {
        return factory.constant(value);
    }

    /** Get the factory that built the instance.
     * @return factory that built the instance
     */
    public DSFactory getFactory() {
        return factory;
    }

    @Override
    /** {@inheritDoc} */
    public int getFreeParameters() {
        return getFactory().getCompiler().getFreeParameters();
    }

    @Override
    /** {@inheritDoc} */
    public int getOrder() {
        return getFactory().getCompiler().getOrder();
    }

    /** Set a derivative component.
     *

     * This method is package-private (no modifier specified), as it is intended
     * to be used only by {@link DSFactory} since it relied on the ordering of
     * derivatives within the class. This allows avoiding checks on the index,
     * for performance reasons.
     *

     * @param index index of the derivative
     * @param value of the derivative to set
     * @since 1.4
     */
    void setDerivativeComponent(final int index, final double value) {
        data[index] = value;
    }

    /** {@inheritDoc}
     */
    @Override
    public double getReal() {
        return data[0];
    }

    /** Get the value part of the derivative structure.
     * @return value part of the derivative structure
     * @see #getPartialDerivative(int...)
     */
    @Override
    public double getValue() {
        return data[0];
    }

    /** {@inheritDoc} */
    @Override
    public double getPartialDerivative(final int ... orders)
        throws MathIllegalArgumentException {
        return data[getFactory().getCompiler().getPartialDerivativeIndex(orders)];
    }

    /** Get all partial derivatives.
     * @return a fresh copy of partial derivatives, in an array sorted according to
     * {@link DSCompiler#getPartialDerivativeIndex(int...)}
     */
    public double[] getAllDerivatives() {
        return data.clone();
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure add(final double a) {
        final DerivativeStructure ds = factory.build();
        System.arraycopy(data, 0, ds.data, 0, data.length);
        ds.data[0] += a;
        return ds;
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure add(final DerivativeStructure a)
        throws MathIllegalArgumentException {
        factory.checkCompatibility(a.factory);
        final DerivativeStructure ds = factory.build();
        factory.getCompiler().add(data, 0, a.data, 0, ds.data, 0);
        return ds;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure subtract(final double a) {
        return add(-a);
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure subtract(final DerivativeStructure a)
        throws MathIllegalArgumentException {
        factory.checkCompatibility(a.factory);
        final DerivativeStructure ds = factory.build();
        factory.getCompiler().subtract(data, 0, a.data, 0, ds.data, 0);
        return ds;
    }

    /** {@inheritDoc} */
    @Override
    public DerivativeStructure multiply(final int n) {
        return multiply((double) n);
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure multiply(final double a) {
        final DerivativeStructure ds = factory.build();
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = data[i] * a;
        }
        return ds;
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure multiply(final DerivativeStructure a)
        throws MathIllegalArgumentException {
        factory.checkCompatibility(a.factory);
        final DerivativeStructure result = factory.build();
        factory.getCompiler().multiply(data, 0, a.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure divide(final double a) {
        final DerivativeStructure ds = factory.build();
        final double inv = 1.0 / a;
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = data[i] * inv;
        }
        return ds;
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure divide(final DerivativeStructure a)
        throws MathIllegalArgumentException {
        factory.checkCompatibility(a.factory);
        final DerivativeStructure result = factory.build();
        factory.getCompiler().divide(data, 0, a.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    @Override
    public DerivativeStructure remainder(final double a) {
        final DerivativeStructure ds = factory.build();
        System.arraycopy(data, 0, ds.data, 0, data.length);
        ds.data[0] = FastMath.IEEEremainder(ds.data[0], a);
        return ds;
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure remainder(final DerivativeStructure a)
        throws MathIllegalArgumentException {
        factory.checkCompatibility(a.factory);
        final DerivativeStructure result = factory.build();
        factory.getCompiler().remainder(data, 0, a.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    @Override
    public DerivativeStructure negate() {
        final DerivativeStructure ds = factory.build();
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = -data[i];
        }
        return ds;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure abs() {
        if (Double.doubleToLongBits(data[0]) < 0) {
            // we use the bits representation to also handle -0.0
            return negate();
        } else {
            return this;
        }
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure ceil() {
        return factory.constant(FastMath.ceil(data[0]));
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure floor() {
        return factory.constant(FastMath.floor(data[0]));
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure rint() {
        return factory.constant(FastMath.rint(data[0]));
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure sign() {
        return factory.constant(FastMath.signum(data[0]));
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure copySign(final DerivativeStructure sign) {
        long m = Double.doubleToLongBits(data[0]);
        long s = Double.doubleToLongBits(sign.data[0]);
        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
            return this;
        }
        return negate(); // flip sign
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure copySign(final double sign) {
        long m = Double.doubleToLongBits(data[0]);
        long s = Double.doubleToLongBits(sign);
        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
            return this;
        }
        return negate(); // flip sign
    }

    /**
     * Return the exponent of the instance value, removing the bias.
     *

     * For double numbers of the form 2x, the unbiased
     * exponent is exactly x.
     *

     * @return exponent for instance in IEEE754 representation, without bias
     */
    @Override
    public int getExponent() {
        return FastMath.getExponent(data[0]);
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure scalb(final int n) {
        final DerivativeStructure ds = factory.build();
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = FastMath.scalb(data[i], n);
        }
        return ds;
    }

    /** {@inheritDoc}
     *

     * The {@code ulp} function is a step function, hence all its derivatives are 0.
     *

     * @since 2.0
     */
    @Override
    public DerivativeStructure ulp() {
        final DerivativeStructure ds = factory.build();
        ds.data[0] = FastMath.ulp(data[0]);
        return ds;
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure hypot(final DerivativeStructure y)
        throws MathIllegalArgumentException {

        factory.checkCompatibility(y.factory);

        if (Double.isInfinite(data[0]) || Double.isInfinite(y.data[0])) {
            return factory.constant(Double.POSITIVE_INFINITY);
        } else if (Double.isNaN(data[0]) || Double.isNaN(y.data[0])) {
            return factory.constant(Double.NaN);
        } else {

            final int expX = getExponent();
            final int expY = y.getExponent();
            if (expX > expY + 27) {
                // y is neglectible with respect to x
                return abs();
            } else if (expY > expX + 27) {
                // x is neglectible with respect to y
                return y.abs();
            } else {

                // find an intermediate scale to avoid both overflow and underflow
                final int middleExp = (expX + expY) / 2;

                // scale parameters without losing precision
                final DerivativeStructure scaledX = scalb(-middleExp);
                final DerivativeStructure scaledY = y.scalb(-middleExp);

                // compute scaled hypotenuse
                final DerivativeStructure scaledH =
                        scaledX.multiply(scaledX).add(scaledY.multiply(scaledY)).sqrt();

                // remove scaling
                return scaledH.scalb(middleExp);

            }

        }
    }

    /**
     * Returns the hypotenuse of a triangle with sides {@code x} and {@code y}
     * - sqrt(x2 +y2)
     * avoiding intermediate overflow or underflow.
     *
     *

     *
 If either argument is infinite, then the result is positive infinity.

     *
 else, if either argument is NaN then the result is NaN.

     *

     *
     * @param x a value
     * @param y a value
     * @return sqrt(x2 +y2)
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    public static DerivativeStructure hypot(final DerivativeStructure x, final DerivativeStructure y)
        throws MathIllegalArgumentException {
        return x.hypot(y);
    }

    /** Compute composition of the instance by a univariate function.
     * @param f array of value and derivatives of the function at
     * the current point (i.e. [f({@link #getValue()}),
     * f'({@link #getValue()}), f''({@link #getValue()})...]).
     * @return f(this)
     * @exception MathIllegalArgumentException if the number of derivatives
     * in the array is not equal to {@link #getOrder() order} + 1
     */
    @Override
    public DerivativeStructure compose(final double ... f)
        throws MathIllegalArgumentException {

        MathUtils.checkDimension(f.length, getOrder() + 1);
        final DerivativeStructure result = factory.build();
        factory.getCompiler().compose(data, 0, f, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    @Override
    public DerivativeStructure reciprocal() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().pow(data, 0, -1, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure sqrt() {
        return rootN(2);
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure cbrt() {
        return rootN(3);
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure rootN(final int n) {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().rootN(data, 0, n, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    @Override
    public Field<DerivativeStructure> getField() {
        return factory.getDerivativeField();
    }

    /** Compute ax where a is a double and x a {@link DerivativeStructure}
     * @param a number to exponentiate
     * @param x power to apply
     * @return ax
     */
    public static DerivativeStructure pow(final double a, final DerivativeStructure x) {
        final DerivativeStructure result = x.factory.build();
        x.factory.getCompiler().pow(a, x.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure pow(final double p) {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().pow(data, 0, p, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure pow(final int n) {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().pow(data, 0, n, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure pow(final DerivativeStructure e)
        throws MathIllegalArgumentException {
        factory.checkCompatibility(e.factory);
        final DerivativeStructure result = factory.build();
        factory.getCompiler().pow(data, 0, e.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure exp() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().exp(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure expm1() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().expm1(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure log() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().log(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure log1p() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().log1p(data, 0, result.data, 0);
        return result;
    }

    /** Base 10 logarithm.
     * @return base 10 logarithm of the instance
     */
    @Override
    public DerivativeStructure log10() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().log10(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure cos() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().cos(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure sin() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().sin(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public FieldSinCos<DerivativeStructure> sinCos() {
        final DerivativeStructure sin = factory.build();
        final DerivativeStructure cos = factory.build();
        factory.getCompiler().sinCos(data, 0, sin.data, 0, cos.data, 0);
        return new FieldSinCos<>(sin, cos);
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure tan() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().tan(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure acos() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().acos(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure asin() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().asin(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure atan() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().atan(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure atan2(final DerivativeStructure x)
        throws MathIllegalArgumentException {
        factory.checkCompatibility(x.factory);
        final DerivativeStructure result = factory.build();
        factory.getCompiler().atan2(data, 0, x.data, 0, result.data, 0);
        return result;
    }

    /** Two arguments arc tangent operation.
     * @param y first argument of the arc tangent
     * @param x second argument of the arc tangent
     * @return atan2(y, x)
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    public static DerivativeStructure atan2(final DerivativeStructure y, final DerivativeStructure x)
        throws MathIllegalArgumentException {
        return y.atan2(x);
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure cosh() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().cosh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure sinh() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().sinh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public FieldSinhCosh<DerivativeStructure> sinhCosh() {
        final DerivativeStructure sinh = factory.build();
        final DerivativeStructure cosh = factory.build();
        factory.getCompiler().sinhCosh(data, 0, sinh.data, 0, cosh.data, 0);
        return new FieldSinhCosh<>(sinh, cosh);
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure tanh() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().tanh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure acosh() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().acosh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure asinh() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().asinh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure atanh() {
        final DerivativeStructure result = factory.build();
        factory.getCompiler().atanh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    @Override
    public DerivativeStructure toDegrees() {
        final DerivativeStructure ds = factory.build();
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = FastMath.toDegrees(data[i]);
        }
        return ds;
    }

    /** {@inheritDoc} */
    @Override
    public DerivativeStructure toRadians() {
        final DerivativeStructure ds = factory.build();
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = FastMath.toRadians(data[i]);
        }
        return ds;
    }

    /** Evaluate Taylor expansion a derivative structure.
     * @param delta parameters offsets (Δx, Δy, ...)
     * @return value of the Taylor expansion at x + Δx, y + Δy, ...
     * @throws MathRuntimeException if factorials becomes too large
     */
    public double taylor(final double ... delta) throws MathRuntimeException {
        return factory.getCompiler().taylor(data, 0, delta);
    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final DerivativeStructure[] a, final DerivativeStructure[] b)
        throws MathIllegalArgumentException {

        // compute an accurate value, taking care of cancellations
        final double[] aDouble = new double[a.length];
        for (int i = 0; i < a.length; ++i) {
            aDouble[i] = a[i].getValue();
        }
        final double[] bDouble = new double[b.length];
        for (int i = 0; i < b.length; ++i) {
            bDouble[i] = b[i].getValue();
        }
        final double accurateValue = MathArrays.linearCombination(aDouble, bDouble);

        // compute a simple value, with all partial derivatives
        DerivativeStructure simpleValue = a[0].getField().getZero();
        for (int i = 0; i < a.length; ++i) {
            simpleValue = simpleValue.add(a[i].multiply(b[i]));
        }

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return factory.build(all);

    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final double[] a, final DerivativeStructure[] b)
        throws MathIllegalArgumentException {

        // compute an accurate value, taking care of cancellations
        final double[] bDouble = new double[b.length];
        for (int i = 0; i < b.length; ++i) {
            bDouble[i] = b[i].getValue();
        }
        final double accurateValue = MathArrays.linearCombination(a, bDouble);

        // compute a simple value, with all partial derivatives
        DerivativeStructure simpleValue = b[0].getField().getZero();
        for (int i = 0; i < a.length; ++i) {
            simpleValue = simpleValue.add(b[i].multiply(a[i]));
        }

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return factory.build(all);

    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
                                                 final DerivativeStructure a2, final DerivativeStructure b2)
        throws MathIllegalArgumentException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
                                                                  a2.getValue(), b2.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return factory.build(all);

    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
                                                 final double a2, final DerivativeStructure b2)
        throws MathIllegalArgumentException {

        factory.checkCompatibility(b1.factory);
        factory.checkCompatibility(b2.factory);

        final DerivativeStructure ds = factory.build();
        factory.getCompiler().linearCombination(a1, b1.data, 0,
                                                a2, b2.data, 0,
                                                ds.data, 0);

        return ds;

    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
                                                 final DerivativeStructure a2, final DerivativeStructure b2,
                                                 final DerivativeStructure a3, final DerivativeStructure b3)
        throws MathIllegalArgumentException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
                                                                  a2.getValue(), b2.getValue(),
                                                                  a3.getValue(), b3.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return factory.build(all);

    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
                                                 final double a2, final DerivativeStructure b2,
                                                 final double a3, final DerivativeStructure b3)
        throws MathIllegalArgumentException {

        factory.checkCompatibility(b1.factory);
        factory.checkCompatibility(b2.factory);
        factory.checkCompatibility(b3.factory);

        final DerivativeStructure ds = factory.build();
        factory.getCompiler().linearCombination(a1, b1.data, 0,
                                                a2, b2.data, 0,
                                                a3, b3.data, 0,
                                                ds.data, 0);

        return ds;

    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
                                                 final DerivativeStructure a2, final DerivativeStructure b2,
                                                 final DerivativeStructure a3, final DerivativeStructure b3,
                                                 final DerivativeStructure a4, final DerivativeStructure b4)
        throws MathIllegalArgumentException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
                                                                  a2.getValue(), b2.getValue(),
                                                                  a3.getValue(), b3.getValue(),
                                                                  a4.getValue(), b4.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3)).add(a4.multiply(b4));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return factory.build(all);

    }

    /** {@inheritDoc}
     * @exception MathIllegalArgumentException if number of free parameters
     * or orders do not match
     */
    @Override
    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
                                                 final double a2, final DerivativeStructure b2,
                                                 final double a3, final DerivativeStructure b3,
                                                 final double a4, final DerivativeStructure b4)
        throws MathIllegalArgumentException {

        factory.checkCompatibility(b1.factory);
        factory.checkCompatibility(b2.factory);
        factory.checkCompatibility(b3.factory);
        factory.checkCompatibility(b4.factory);

        final DerivativeStructure ds = factory.build();
        factory.getCompiler().linearCombination(a1, b1.data, 0,
                                                a2, b2.data, 0,
                                                a3, b3.data, 0,
                                                a4, b4.data, 0,
                                                ds.data, 0);

        return ds;

    }

    /** {@inheritDoc}
     */
    @Override
    public DerivativeStructure getPi() {
        return factory.getDerivativeField().getPi();
    }

    /**
     * Test for the equality of two derivative structures.
     *

     * Derivative structures are considered equal if they have the same number
     * of free parameters, the same derivation order, and the same derivatives.
     *

     * @param other Object to test for equality to this
     * @return true if two derivative structures are equal
     */
    @Override
    public boolean equals(Object other) {

        if (this == other) {
            return true;
        }

        if (other instanceof DerivativeStructure) {
            final DerivativeStructure rhs = (DerivativeStructure)other;
            return (getFreeParameters() == rhs.getFreeParameters()) &&
                   (getOrder() == rhs.getOrder()) &&
                   MathArrays.equals(data, rhs.data);
        }

        return false;

    }

    /**
     * Get a hashCode for the derivative structure.
     * @return a hash code value for this object
     */
    @Override
    public int hashCode() {
        return 227 + 229 * getFreeParameters() + 233 * getOrder() + 239 * MathUtils.hash(data);
    }

}


text:
package org.projectfloodlight.openflow.protocol.ver15;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.stat.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.oxs.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.Before;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import java.util.List;
import com.google.common.collect.ImmutableList;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.hamcrest.CoreMatchers;

public class OFBundleCtrlMsgVer15Test {
    OFFactory factory;

    final static byte[] BUNDLE_CTRL_MSG_SERIALIZED =
        new byte[] { 0x6, 0x21, 0x0, 0x28, 0x12, 0x34, 0x56, 0x78, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x3b, (byte) 0x9a, (byte) 0xca, 0x0, 0x0, 0x0, 0x0, 0x0 };

    @Before
    public void setup() {
        factory = OFFactoryVer15.INSTANCE;
    }

    @Test
    public void testWrite() {
        OFBundleCtrlMsg.Builder builder = factory.buildBundleCtrlMsg();
        builder
        .setXid(0x12345678)
        .setBundleId(BundleId.of(1))
        .setBundleCtrlType(OFBundleCtrlType.OPEN_REQUEST)
        .setFlags(ImmutableSet.<OFBundleFlags>of(OFBundleFlags.ATOMIC))
        .setProperties(ImmutableList.<OFBundleProp>of(factory.buildBundlePropTime().setScheduledTime(ImmutableList.<OFTime>of(factory.buildTime().setSeconds(U64.of(1)).setNanoseconds(1000000000L).build())).build()))
        .build();
        OFBundleCtrlMsg bundleCtrlMsg = builder.build();
        ByteBuf bb = Unpooled.buffer();
        bundleCtrlMsg.writeTo(bb);
        byte[] written = new byte[bb.readableBytes()];
        bb.readBytes(written);

        assertThat(written, CoreMatchers.equalTo(BUNDLE_CTRL_MSG_SERIALIZED));
    }

    @Test
    public void testRead() throws Exception {
        OFBundleCtrlMsg.Builder builder = factory.buildBundleCtrlMsg();
        builder
        .setXid(0x12345678)
        .setBundleId(BundleId.of(1))
        .setBundleCtrlType(OFBundleCtrlType.OPEN_REQUEST)
        .setFlags(ImmutableSet.<OFBundleFlags>of(OFBundleFlags.ATOMIC))
        .setProperties(ImmutableList.<OFBundleProp>of(factory.buildBundlePropTime().setScheduledTime(ImmutableList.<OFTime>of(factory.buildTime().setSeconds(U64.of(1)).setNanoseconds(1000000000L).build())).build()))
        .build();
        OFBundleCtrlMsg bundleCtrlMsgBuilt = builder.build();

        ByteBuf input = Unpooled.copiedBuffer(BUNDLE_CTRL_MSG_SERIALIZED);

        // FIXME should invoke the overall reader once implemented
        OFBundleCtrlMsg bundleCtrlMsgRead = OFBundleCtrlMsgVer15.READER.readFrom(input);
        assertEquals(BUNDLE_CTRL_MSG_SERIALIZED.length, input.readerIndex());

        assertEquals(bundleCtrlMsgBuilt, bundleCtrlMsgRead);
   }

   @Test
   public void testReadWrite() throws Exception {
       ByteBuf input = Unpooled.copiedBuffer(BUNDLE_CTRL_MSG_SERIALIZED);

       // FIXME should invoke the overall reader once implemented
       OFBundleCtrlMsg bundleCtrlMsg = OFBundleCtrlMsgVer15.READER.readFrom(input);
       assertEquals(BUNDLE_CTRL_MSG_SERIALIZED.length, input.readerIndex());

       // write message again
       ByteBuf bb = Unpooled.buffer();
       bundleCtrlMsg.writeTo(bb);
       byte[] written = new byte[bb.readableBytes()];
       bb.readBytes(written);

       assertThat(written, CoreMatchers.equalTo(BUNDLE_CTRL_MSG_SERIALIZED));
   }

}


text:
package org.apache.camel.component.jdbc;

/**
 * A mapper to map row names to java bean setter names, when using the <tt>outputClass</tt> option.
 */
public interface BeanRowMapper {

    String map(String row, Object value);
}


text:
package middleware

import (
	"net/http"
	"regexp"

	"github.com/goadesign/goa"

	"golang.org/x/net/context"
)

// RequireHeader requires a request header to match a value pattern. If the
// header is missing or does not match then the failureStatus is the response
// (e.g. http.StatusUnauthorized). If pathPattern is nil then any path is
// included. If requiredHeaderValue is nil then any value is accepted so long as
// the header is non-empty.
func RequireHeader(
	service *goa.Service,
	pathPattern *regexp.Regexp,
	requiredHeaderName string,
	requiredHeaderValue *regexp.Regexp,
	failureStatus int) goa.Middleware {

	return func(h goa.Handler) goa.Handler {
		return func(ctx context.Context, rw http.ResponseWriter, req *http.Request) (err error) {
			if pathPattern == nil || pathPattern.MatchString(req.URL.Path) {
				matched := false
				headerValue := req.Header.Get(requiredHeaderName)
				if len(headerValue) > 0 {
					if requiredHeaderValue == nil {
						matched = true
					} else {
						matched = requiredHeaderValue.MatchString(headerValue)
					}
				}
				if matched {
					err = h(ctx, rw, req)
				} else {
					err = service.Send(ctx, failureStatus, http.StatusText(failureStatus))
				}
			} else {
				err = h(ctx, rw, req)
			}
			return
		}
	}
}


text:
#pragma once
#include <aws/guardduty/GuardDuty_EXPORTS.h>
#include <aws/guardduty/model/DataSourceStatus.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace GuardDuty
{
namespace Model
{

  /**
   *
Describes whether Kubernetes audit logs are enabled as a data
   * source.

See Also:
   AWS
   * API Reference

   */
  class AWS_GUARDDUTY_API KubernetesAuditLogsConfigurationResult
  {
  public:
    KubernetesAuditLogsConfigurationResult();
    KubernetesAuditLogsConfigurationResult(Aws::Utils::Json::JsonView jsonValue);
    KubernetesAuditLogsConfigurationResult& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
A value that describes whether Kubernetes audit logs are enabled as a data
     * source.

     */
    inline const DataSourceStatus& GetStatus() const{ return m_status; }

    /**
     *
A value that describes whether Kubernetes audit logs are enabled as a data
     * source.

     */
    inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; }

    /**
     *
A value that describes whether Kubernetes audit logs are enabled as a data
     * source.

     */
    inline void SetStatus(const DataSourceStatus& value) { m_statusHasBeenSet = true; m_status = value; }

    /**
     *
A value that describes whether Kubernetes audit logs are enabled as a data
     * source.

     */
    inline void SetStatus(DataSourceStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); }

    /**
     *
A value that describes whether Kubernetes audit logs are enabled as a data
     * source.

     */
    inline KubernetesAuditLogsConfigurationResult& WithStatus(const DataSourceStatus& value) { SetStatus(value); return *this;}

    /**
     *
A value that describes whether Kubernetes audit logs are enabled as a data
     * source.

     */
    inline KubernetesAuditLogsConfigurationResult& WithStatus(DataSourceStatus&& value) { SetStatus(std::move(value)); return *this;}

  private:

    DataSourceStatus m_status;
    bool m_statusHasBeenSet = false;
  };

} // namespace Model
} // namespace GuardDuty
} // namespace Aws


text:
package org.zaproxy.addon.automation.tests;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Stream;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.control.Control;
import org.parosproxy.paros.extension.ExtensionLoader;
import org.parosproxy.paros.model.Model;
import org.zaproxy.addon.automation.AutomationEnvironment;
import org.zaproxy.addon.automation.AutomationProgress;
import org.zaproxy.addon.automation.jobs.ActiveScanJob;
import org.zaproxy.zap.extension.stats.ExtensionStats;
import org.zaproxy.zap.extension.stats.InMemoryStats;
import org.zaproxy.zap.testutils.TestUtils;
import org.zaproxy.zap.utils.I18N;

class AutomationStatisticTestUnitTest extends TestUtils {

    private ExtensionStats extStats;

    @BeforeEach
    void setUp() {
        Constant.messages = new I18N(Locale.ENGLISH);
        ExtensionLoader extensionLoader = mock(ExtensionLoader.class);
        Control.initSingletonForTesting(mock(Model.class), extensionLoader);
        extStats = mock(ExtensionStats.class);
        when(extensionLoader.getExtension(ExtensionStats.class)).thenReturn(extStats);
        InMemoryStats inMemoryStats = mock(InMemoryStats.class);
        when(extStats.getInMemoryStats()).thenReturn(inMemoryStats);
    }

    static Stream<Arguments> shouldPassTestParamsSource() {
        return Stream.of(
                Arguments.of("<", 1, 2),
                Arguments.of(">", 4, 3),
                Arguments.of("<=", 5, 5),
                Arguments.of("<=", 5, 6),
                Arguments.of(">=", 7, 7),
                Arguments.of(">=", 8, 7),
                Arguments.of("==", 9, 9),
                Arguments.of("!=", 10, 11));
    }

    @ParameterizedTest
    @MethodSource("shouldPassTestParamsSource")
    void shouldPassTestIfSpecifiedConditionIsSatisfied(
            String operator, long statValue, long value) {
        // Given
        AutomationProgress progress = new AutomationProgress();
        String name = "example name";
        String key = "stats.job.something";
        String onFail = "warn";
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, name, operator, value, onFail, new ActiveScanJob(), progress);
        test.getJob().setEnv(new AutomationEnvironment(progress));

        // When
        boolean hasRunFirst = test.hasRun();
        when(extStats.getInMemoryStats().getStat(key)).thenReturn(statValue);
        test.logToProgress(progress);

        // Then
        assertThat(hasRunFirst, is(false));
        assertThat(test.getName(), is(name));
        assertThat(test.getTestType(), is(AutomationStatisticTest.TEST_TYPE));
        assertThat(test.getJobType(), is("activeScan"));
        assertThat(progress.hasWarnings(), is(false));
        assertThat(progress.hasErrors(), is(false));
        assertThat(progress.getInfos().size(), is(7));
        assertThat(progress.getInfos().get(6), is("!automation.tests.pass!"));
        assertThat(test.hasRun(), is(true));
        assertThat(test.hasPassed(), is(true));
    }

    static Stream<Arguments> shouldFailTestParamsSource() {
        return Stream.of(
                Arguments.of("<", 2, 1),
                Arguments.of(">", 3, 4),
                Arguments.of("<=", 6, 5),
                Arguments.of(">=", 7, 8),
                Arguments.of("==", 10, 9),
                Arguments.of("!=", 11, 11));
    }

    @ParameterizedTest
    @MethodSource("shouldFailTestParamsSource")
    void shouldFailTestIfSpecifiedConditionIsNotSatisfied(
            String operator, long statValue, long value) {
        // Given
        AutomationProgress progress = new AutomationProgress();
        String name = "example name";
        String key = "stats.job.something";
        String onFail = "warn";
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, name, operator, value, onFail, new ActiveScanJob(), progress);
        test.getJob().setEnv(new AutomationEnvironment(progress));

        // When
        when(extStats.getInMemoryStats().getStat(key)).thenReturn(statValue);
        test.logToProgress(progress);

        // Then
        assertThat(progress.hasErrors(), is(false));
        assertThat(progress.hasWarnings(), is(true));
        assertThat(progress.getWarnings().size(), is(1));
        assertThat(progress.getWarnings().get(0), is("!automation.tests.fail!"));
        assertThat(test.hasRun(), is(true));
        assertThat(test.hasPassed(), is(false));
    }

    @Test
    void shouldResetTestStatus() {
        // Given
        AutomationProgress progress = new AutomationProgress();
        String key = "stats.job.something";
        long value = 5;
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, "example name", "==", value, "warn", new ActiveScanJob(), progress);
        test.getJob().setEnv(new AutomationEnvironment(progress));

        // When
        when(extStats.getInMemoryStats().getStat(key)).thenReturn(value);
        test.logToProgress(progress);
        boolean ran = test.hasRun();
        boolean passed = test.hasPassed();
        test.reset();

        // Then
        assertThat(ran, is(true));
        assertThat(passed, is(true));
        assertThat(test.hasRun(), is(false));
        assertThat(test.hasPassed(), is(false));
    }

    @Test
    void shouldLogWarningsIfSpecifiedWarnOnFail() {
        // Given
        AutomationProgress progress = new AutomationProgress();
        String name = "example name";
        String key = "stats.job.something";
        String operator = "==";
        String onFail = "warn";
        long value = 10;
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, name, operator, value, onFail, new ActiveScanJob(), progress);
        test.getJob().setEnv(new AutomationEnvironment(progress));

        // When
        when(extStats.getInMemoryStats().getStat(key)).thenReturn(value - 1);
        test.logToProgress(progress);

        // Then
        assertThat(progress.hasErrors(), is(false));
        assertThat(progress.hasWarnings(), is(true));
        assertThat(progress.getWarnings().size(), is(1));
        assertThat(progress.getWarnings().get(0), is("!automation.tests.fail!"));
    }

    @Test
    void shouldLogErrorsIfSpecifiedErrorOnFail() {
        // Given
        AutomationProgress progress = new AutomationProgress();
        String name = "example name";
        String key = "stats.job.something";
        String operator = "==";
        String onFail = "error";
        long value = 10;
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, name, operator, value, onFail, new ActiveScanJob(), progress);
        test.getJob().setEnv(new AutomationEnvironment(progress));

        // When
        when(extStats.getInMemoryStats().getStat(key)).thenReturn(value - 1);
        test.logToProgress(progress);

        // Then
        assertThat(progress.hasWarnings(), is(false));
        assertThat(progress.hasErrors(), is(true));
        assertThat(progress.getErrors().size(), is(1));
        assertThat(progress.getErrors().get(0), is("!automation.tests.fail!"));
    }

    @Test
    void shouldLogInfoIfSpecifiedInfoOnFail() {
        // Given
        AutomationProgress progress = new AutomationProgress();
        String name = "example name";
        String key = "stats.job.something";
        String operator = "==";
        String onFail = "info";
        long value = 10;
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, name, operator, value, onFail, new ActiveScanJob(), progress);
        test.getJob().setEnv(new AutomationEnvironment(progress));

        // When
        when(extStats.getInMemoryStats().getStat(key)).thenReturn(value - 1);
        test.logToProgress(progress);

        // Then
        assertThat(progress.hasWarnings(), is(false));
        assertThat(progress.hasErrors(), is(false));
        assertThat(progress.getInfos().size(), is(7));
        assertThat(progress.getInfos().get(6), is("!automation.tests.fail!"));
    }

    @Test
    void shouldReturnZeroForUnknownStat() {
        // Given
        AutomationProgress progress = new AutomationProgress();
        String name = "example name";
        String key = "stats.unknown";
        String operator = "==";
        String onFail = "warn";
        long value = 0;
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, name, operator, value, onFail, new ActiveScanJob(), progress);
        test.getJob().setEnv(new AutomationEnvironment(progress));

        // When
        test.logToProgress(progress);

        // Then
        assertThat(progress.hasErrors(), is(false));
        assertThat(progress.hasWarnings(), is(false));
        assertThat(test.hasPassed(), is(true));
    }

    @Test
    void shouldReplaceSiteEnvVar() {
        // Given
        AutomationProgress progress = new AutomationProgress();
        AutomationEnvironment env = new AutomationEnvironment(progress);
        Map<String, String> map = new HashMap<>();
        map.put("site", "www.example");
        String name = "example name";
        String site = "https://${site}.com";
        String key = "stats.job.something";
        String operator = "==";
        String onFail = "warn";
        long value = 7;
        AutomationStatisticTest test =
                new AutomationStatisticTest(
                        key, name, site, operator, value, onFail, new ActiveScanJob(), progress);
        test.getJob().setEnv(env);

        // When
        when(extStats.getInMemoryStats().getStat("https://www.example.com", key)).thenReturn(value);
        env.getData().setVars(map);
        test.logToProgress(progress);

        // Then
        assertThat(progress.hasErrors(), is(false));
        assertThat(progress.hasWarnings(), is(false));
        assertThat(test.hasPassed(), is(true));
    }
}


text:
My personal blog, made with Jekyll.

View at http://laisvarejao.github.io/


text:
@interface MSMasterViewController () {
    MSWebReferenceModel *_webRefModel;
}

- (void)loadModel;
@end

@implementation MSMasterViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    NSLog(@"MSMasterViewController::initWithNibName");
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [self setEditing:NO animated:YES];
        self.title = NSLocalizedString(@"TFS & iOS", @"TFS & iOS");
        self.clearsSelectionOnViewWillAppear = NO;
        self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);

        [self loadModel];
    }
    return self;
}

- (void)loadModel
{
    NSLog(@"initializeModel");
    if (!_webRefModel)
    {
        _webRefModel = [[MSWebReferenceModel alloc] init];

        [_webRefModel addWebReferenceNamed:@"VisualStudio.com"
                             withURLString:@"http://www.visualstudio.com/"];

        [_webRefModel addWebReferenceNamed:@"XcodeBuild Man"
                             withURLString:@"https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html"];

        [_webRefModel addWebReferenceNamed:@"node.js"
                             withURLString:@"http://nodejs.org"];

        [_webRefModel addWebReferenceNamed:@"bharry"
                       withURLString:@"http://blogs.msdn.com/b/bharry"];
    }
}

- (void)initialize
{
    NSLog(@"_webRefModel.count: %ld", (long)_webRefModel.count);
    if (_webRefModel.count > 0) {
        MSWebReference *webRef = [_webRefModel webReferenceAtIndex:0];
        self.detailViewController.detailItem = webRef;
    }
}

- (void)dealloc
{
    [_detailViewController release];
    [_webRefModel release];
    [super dealloc];
}

- (void)viewDidLoad
{
    NSLog(@"MSMasterViewController::viewDidLoad");
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

///////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark UITableViewDelegate
#pragma mark -
///////////////////////////////////////////////////////////////////////////
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _webRefModel.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                         reuseIdentifier:CellIdentifier] autorelease];
    }

    MSWebReference *webRef = [_webRefModel webReferenceAtIndex:indexPath.row];
    cell.textLabel.text = [webRef description];
    return cell;
}

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return NO ;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"selected: %ld", (long)[indexPath row]);
    _webRefModel.selectedIndex = indexPath.row;
    MSWebReference *webRef = [_webRefModel webReferenceAtIndex:indexPath.row];
    NSLog(@"selected: %@", [webRef description]);
    self.detailViewController.detailItem = webRef;
}

@end


text:
#ifndef CLICK_BLOCK_HH
#define CLICK_BLOCK_HH
#include <click/element.hh>
CLICK_DECLS

/*
 * =c
 * Block(THRESH)
 * =s shaping
 * drops packets with high rate
 * =d
 * THRESH is an integer.
 *
 * Splits packets based on the dst rate annotation set by Monitor. If the
 * annotation is less or equal to THRESH, the packet is pushed on output 0,
 * otherwise on 1.
 *
 * Is THRESH is 0 then all packets are pushed on output 0.
 *
 * =e
 *   b :: Block(500);
 *
 *   ... -> Monitor(...) ->
 *   ... -> b[0] -> ...
 *   ... -> b[1] -> Discard;
 *
 * Discards all packets that are preceded by more than 500 siblings.
 *
 * =h thresh read/write
 * value of THRESH
 *
 * =a IPFlexMonitor
 */

class Block : public Element {

 public:

  Block() CLICK_COLD;

  const char *class_name() const		{ return "Block"; }
  const char *port_count() const		{ return "1/2"; }
  void add_handlers() CLICK_COLD;

  int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
  // bool can_live_reconfigure() const		{ return true; }

  void push(int port, Packet *);
  // Packet *pull(int port);

 private:

  int _thresh;

  static int thresh_write_handler(const String &conf, Element *e, void *, ErrorHandler *errh) CLICK_COLD;
  static String thresh_read_handler(Element *e, void *) CLICK_COLD;

};

CLICK_ENDDECLS
#endif


text:
using System;
using System.Collections.Generic;
using Rikrop.Core.Data.Entities.Contracts;

namespace Rikrop.Core.Data.Repositories.Contracts
{
    public interface IRepository
    {}

    /// <summary>
    /// Репозиторий.
    /// </summary>
    public interface IRepository<TEntity, in TId> : IRepository
        where TEntity : class, IRetrievableEntity<TEntity, TId>, IEntity<TId>
        where TId : struct
    {
        /// <summary>
        /// Загрузка по ID.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        TEntity Get(TId id);

        /// <summary>
        /// Загрузить данные по запросу
        /// </summary>
        /// <param name="query">Переметры запроса</param>
        /// <param name="totalCount">Количество записей без учета Take и Skip</param>
        IList<TEntity> Get(Action<RepositoryQuery<TEntity>> query, out int totalCount);

        /// <summary>
        /// Загрузить данные по запросу
        /// </summary>
        /// <param name="query">Переметры запроса</param>
        IList<TEntity> Get(Action<RepositoryQuery<TEntity>> query);

        /// <summary>
        /// Загрузить всю таблицу
        /// </summary>
        /// <returns></returns>
        IList<TEntity> GetAll();
        /// <summary>
        /// Сохранить запись в БД
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        TEntity Save(TEntity entity);
        /// <summary>
        /// Удалить запись
        /// </summary>
        /// <param name="entity"></param>
        void Delete(TEntity entity);
        /// <summary>
        /// Удалить коллекцию записей
        /// </summary>
        /// <param name="entities"></param>
        void Delete(IEnumerable<TEntity> entities);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace Xamarin.Forms.Platform.LibUI.Drawing
{
    public struct Size
    {
        public int Width;
        public int Height;

        public Size(int width, int height)
        {
            Width = width;
            Height = height;
        }
    }
}