text:
function CPO = classperf(CP,varargin)
%CLASSPERF evaluates the performance of data classifiers
%
%  CLASSPERF tracks performance measurements during the validation process
%  of classifiers. CLASSPERF creates and updates a CLASSPERFORMANCE object
%  which accumulates the results of the classifier. Classification
%  performance results can be accessed using the GET function or as fields in
%  structures. A CLASSPERFORMANCE object has the following properties:
%
%  Label:       User defined character string.
%  Description: User defined character string.
%  ClassLabels: Numeric vector or cell array of strings specifying a unique
%               set of class labels.
%  GroundTruth: Numeric vector or cell array of strings that specifies the
%               true class labels for each observation. The number of
%               elements is equal to NumberOfObservations.
%  NumberOfObservations: Positive integer specifying the number of
%               observations in the study.
%  ControlClasses: Indices to the ClassLabels vector or cell array,
%               indicating which classes to be considered as the control or
%               negative classes in a diagnostic test.
%  TargetClasses: Indices to the ClassLabels vector or cell array,
%               indicating which classes to be considered as the target or
%               positive classes in a diagnostic test.
%  ValidationCounter: Positive integer specifying the number of validations
%               performed.
%  SampleDistribution: Numeric vector indicating how many times each sample
%               was considered in the validation.
%  ErrorDistribution: Numeric vector indicating how many times each sample
%               was misclassified.
%  SampleDistributionByClass: Numeric vector indicating the frequency of
%               the true classes in the validation.
%  ErrorDistributionByClass: Numeric vector indicating the frequency of
%               errors for each class in the validation.
%  CountingMatrix: The classification confusion matrix. The order of rows
%               and columns is the same as grp2idx(GroundTruth). Columns
%               represent the true classes, and rows represent the
%               classifier prediction. The last row in CountingMatrix is
%               reserved to count inconclusive results. There are some
%               families of classifiers that can reserve the right to make
%               a hard class assignment; this can be based on metrics, such
%               as the posterior probabilities, or on how close a sample is
%               to the class boundaries.
%  CorrectRate: Correctly classified samples divided by the classified
%               samples. Inconclusive results are not counted.
%  ErrorRate:   Incorrectly classified samples divided by the
%               classified samples. Inconclusive results are not counted.
%  LastCorrectRate: Same as CorrectRate but only considering the samples
%               the last time the classifier performance object was updated.
%  LastErrorRate: Same as LastCorrectRate but only considering the samples
%               the last time the classifier performance object was updated.
%  InconclusiveRate: Nonclassified samples divided by the total number of
%               samples.
%  ClassifiedRate: Classified samples divided by the total number of
%               samples.
%  Sensitivity: Correctly classified positive samples divided by true
%               positive samples. Inconclusive results that are true
%               positives are counted as errors for computing Sensitivity
%               (following a conservative approach). This is the same as
%               being incorrectly classified as negatives.
%  Specificity: Correctly classified negative samples divided by the true
%               negative samples. Inconclusive results that are true
%               negatives are counted as errors for computing Specificity
%               (following a conservative approach). This is the same as
%               being incorrectly classified as positives.
%  PositivePredictiveValue: Correctly classified positive samples divided
%               by the positive classified samples. Inconclusive results
%               are classified as negatives when computing
%               PositivePredictiveValue.
%  NegativePredictiveValue: Correctly classified negative samples divided
%               by the negative classified samples. Inconclusive results
%               are classified as positives when computing
%               NegativePredictiveValue.
%  PositiveLikelihood:  Sensitivity / (1 - Specificity)
%  NegativeLikelihood:  (1 - Sensitivity) / Specificity
%  Prevalence:  True positive samples divided by the total number of
%               samples.
%  DiagnosticTable: A 2-by-2 numeric array with diagnostic counts. The
%               first row indicates the number of samples that were
%               classified as positive, with the number of true positives
%               in the first column, and the number of false positives in
%               the second column. The second row indicates the number of
%               samples that were classified as negative, with the number
%               of false negatives in the first column, and the number of
%               true negatives in the second column.
%               Correct classifications appear in the diagonal elements,
%               and errors appear in the off-diagonal elements.
%               Inconclusive results are considered errors and counted in
%               the off-diagonal elements.
%
%  CP = CLASSPERF(GROUNDTRUTH) creates and initializes an empty classifier
%  performance object. CP is the handle to the object. GROUNDTRUTH is a
%  vector with the true class labels for every observation. GROUNDTRUTH can
%  be either a numeric vector or a cell array of strings. When used in a
%  cross-validation design experiment, GROUNDTRUTH should have the same
%  size as the total number of observations.
%
%  CLASSPERF(CP,CLASSOUT) updates the CP object with the classifier output
%  CLASSOUT. CLASSOUT is the same size and type as GROUNDTRUTH. When
%  CLASSOUT is numeric and GROUNDTRUTH is a cell array of strings, GRP2IDX
%  is used to create the index vector that links CLASSOUT to the class
%  labels. When CLASSOUT is a cell array of strings, an empty string, '',
%  represents an inconclusive result of the classifier. For numeric arrays,
%  NaN represents an inconclusive result.
%
%  CLASSPERF(CP,CLASSOUT,TESTIDX) updates the CP object with the classifier
%  output CLASSOUT. CLASSOUT is smaller than GROUNDTRUTH. TESTIDX is an
%  index vector or a logical index vector of the same size as GROUNDTRUTH
%  that indicates which observations were used in the current validation.
%
%  CP = CLASSPERF(GROUNDTRUTH,CLASSOUT,...) creates and updates the CP
%  object with the first validation. This form is useful when you want to
%  know the performance of a single validation.
%
%  CP = CLASSPERF(...,'POSITIVE',P,'NEGATIVE',N) sets the 'POSITIVE' and
%  'NEGATIVE' labels to identify the target disorder and the control
%  classes. These labels are used to compute clinical diagnostic test
%  performance. P and N are disjoint subsets of UNIQUE(GROUNDTRUTH) and
%  they are the same type of input as GROUNDTRUTH. When omitted, P defaults
%  to the first class returned by GRP2IDX(GROUNDTRUTH) and N defaults to
%  all the others. In clinical tests, inconclusive values ('' or NaN) are
%  counted as false negatives for the computation of the specificity and as
%  false positives for the computation of the sensitivity. I.e.,
%  inconclusive results can decrease the diagnostic value of the test.
%  Tested observations whose true class is not within the union of P and N
%  are ignored. Tested observations whose true class is within the union of
%  P and N but were classified outside the union are counted as
%  inconclusive.
%
%  Examples:
%
%     % Classify the fisheriris data with a K-Nearest Neighbor classifier.
%     load fisheriris
%     c = knnclassify(meas,meas,species,4,'euclidean','Consensus');
%     cp = classperf(species,c)
%
%     % Create a 10-fold cross-validation on the fisheriris data using
%     % linear discriminant analysis and the third column as the only
%     % feature for classification.
%     load fisheriris
%     indices = crossvalind('Kfold',species,10);
%     cp = classperf(species); % initializes the CP object
%     for i = 1:10
%         test = (indices == i); train = ~test;
%         class = classify(meas(test,3),meas(train,3),species(train));
%         % updates the CP object with the current classification results
%         classperf(cp,class,test);
%     end
%     cp.CorrectRate % queries for the correct classification rate
%
%
%  See also CANCERDETECTDEMO, CROSSVALIND, CLASSIFY, GRP2IDX, KNNCLASSIFY,
%  SVMCLASSIFY.

% Copyright 2003-2010 The MathWorks, Inc.
% $Revision: 1.1.10.6.8.6 $  $Date: 2010/12/09 23:14:56 $

% References:
% [1] Nicoll D, McPhee SJ, Pigone M, Detmer WM, Chou TM. Pocket Guide to
%     Diagnostic Tests, Third Edition  University of California, San
%     Francisco
%
% [2] Theodoridis, S. and Koutroumbas, K.  (1999) Pattern Recognition,
%     Academic Press, pp. 341-342.

if nargin == 0
    if nargout
        error(message('bioinfo:classperf:TooManyOutputArguments'))
    end
    displayProperties
    return
end

% set some defaults
gpsWereGiven = false;

% if the first input is the GROUNDTRUTH we need to create and initialize
% the new CP object
if ~isequal(class(CP),'biolearning.classperformance')
    if isa(CP,'ordinal')||isa(CP,'nominal')
        CP = cellstr(CP(:));
    end
    % validate ground truth labels
    gT = CP(:);
    if iscell(gT)
        if any(~cellfun('isclass',gT,'char'))
            error(message('bioinfo:classperf:InvalidCellForGT'))
        end
        if ismember('',gT)
            error(message('bioinfo:classperf:EmptyCellForGT'))
        end
        [igT,validGroups] = grp2idx(gT);
    elseif isnumeric(gT) || islogical(gT)
        if islogical(gT)
            gT = double(gT);
        end
        if ~isreal(gT) || any(isnan(gT)) || any(rem(gT,1))
            error(message('bioinfo:classperf:InvalidNumericForGT'))
        end
        [validGroups,~,igT] = unique(gT);
    else
        error(message('bioinfo:classperf:InvalidTypeForGT'))
    end
    if max(igT)<2
         error(message('bioinfo:classperf:InvalidGroupsForGT'))
    end
    % Creates and initializes the CP object
    CP = biolearning.classperformance(validGroups,igT);
end

if nargin == 1
    CPO=CP;
    return;
end
nvarargin =  numel(varargin);

% check if the second input is CLASSOUT and validate it
if ~ischar(varargin{1})
    gps = varargin{1}(:);
    if isa(gps,'ordinal')||isa(gps,'nominal')
        gps = cellstr(gps(:));
    end
    nvarargin = nvarargin-1;
    varargin(1) = [];
    if CP.IsClassLabelTypeNumeric
        if islogical(gps)
            gps = double(gps); %allow gps is logical when groundTruth is double
        end
        if ~isnumeric(gps) || ~isreal(gps) || any(gps(~isnan(gps))<0) || any(rem(gps(~isnan(gps)),1))
            error('bioinfo:classperf:InvalidNumericForGRP',...
                ['When the class labels of the CP object are numeric, the output\n'...
                'of the classifier must be all non-negative integers or NaN''s.'])
        end
        [~,gps] = ismember(gps,CP.ClassLabels);
    elseif iscell(gps)
        if any(~cellfun('isclass',gps(:),'char'))
            error('bioinfo:classperf:InvalidCellForGRP',...
                  ['When the classifier output is a cell array of strings,\n',...
                   'all elements must have strings.'])
        end
        [~,gps] = ismember(gps,CP.ClassLabels);
    elseif isnumeric(gps)
        if ~isreal(gps) || any(gps(~isnan(gps))<0) || any(rem(gps(~isnan(gps)),1))
            error('bioinfo:classperf:InvalidIndicesForGRP',...
                ['When class labels of the CP object is a cell array of strings and\n',...
                 'the classifier output is a numeric array, it must contain valid\n',...
                 'indices of the class labels or NaNs for inconclusive results.'])
        end
    else
        error('bioinfo:classperf:InvalidTypeForGRP',...
              ['CLASSOUT should be the same type as the ground truth vector\n'...
               'or a vector index to the class labels.'])
    end
    gpsWereGiven = true;
end

% check if the third input is TESTIDX
if nvarargin && (islogical(varargin{1}) || isnumeric(varargin{1}))
    idx = varargin{1}(:);
    nvarargin = nvarargin-1;
    varargin(1) = [];
elseif gpsWereGiven
    if numel(gps)~=CP.NumberOfObservations
        error('bioinfo:classperf:IncorrectSizeForClassout',...
            ['The classifier output CLASSOUT does not have the same size\n',...
            'as the ground truth and there was not any TESTIDX provided.']);
    end
    idx = 1:CP.NumberOfObservations;
end

% the rest should can only be optional arguments (i.e. set
% negative/positive class labels)
if nvarargin
    positiveLabels = CP.TargetClasses;
    negativeLabels = CP.ControlClasses;
    if rem(nvarargin,2)
        error(message('bioinfo:classperf:IncorrectNumberOfArguments', mfilename));
    end
    okargs = {'positive','negative'};
    for j=1:2:nvarargin
        pname = varargin{j};
        pval = varargin{j+1};
        k = find(strncmpi(pname, okargs,length(pname)));
        if isempty(k)
            error(message('bioinfo:classperf:UnknownParameterName', pname));
        elseif length(k)>1
            error(message('bioinfo:classperf:AmbiguousParameterName', pname));
        else
            switch(k)
                case 1 % positiveLabels
                    if isa(pval,'ordinal')||isa(pval,'nominal')
                        pval = cellstr(pval(:));
                    end
                    if CP.IsClassLabelTypeNumeric
                        [tf,loc] = ismember(pval,CP.ClassLabels);
                        if any(~tf) || isempty(tf)
                            error('bioinfo:classperf:InvalidPositiveLabels',...
                                'At least one of the positive labels is not within the valid class labels.')
                        end
                        positiveLabels = loc;
                    else
                        if ischar(pval)
                            pval = {pval};
                        end
                        if ~iscell(pval) || ~all(cellfun('isclass',pval,'char'))
                            error('bioinfo:classperf:InvalidPositiveLabels',...
                                'Invalid type for the positive labels.')
                        end
                        [tf,loc] = ismember(pval,CP.ClassLabels);
                        if any(~tf) || isempty(tf)
                            error('bioinfo:classperf:InvalidPositiveLabels',...
                                'At least one of the positive labels is not within the valid class labels.')
                        end
                        positiveLabels = loc;
                    end
                case 2 % negativeLabels
                    if isa(pval,'ordinal')||isa(pval,'nominal')
                        pval = cellstr(pval(:));
                    end
                    if CP.IsClassLabelTypeNumeric
                        [tf,loc] = ismember(pval,CP.ClassLabels);
                        if any(~tf) || isempty(tf)
                            error('bioinfo:classperf:InvalidNegativeLabels',...
                                'At least one of the negative labels is not within the valid class labels.')
                        end
                        negativeLabels = loc;
                    else
                        if ischar(pval)
                            pval = {pval};
                        end
                        if ~iscell(pval) || ~all(cellfun('isclass',pval,'char'))
                            error('bioinfo:classperf:InvalidNegativeLabels',...
                                'Invalid type for negative labels.')
                        end
                        [tf,loc] = ismember(pval,CP.ClassLabels);
                        if any(~tf) || isempty(tf)
                            error('bioinfo:classperf:InvalidNegativeLabels',...
                                'At least one of the negative labels is not within the valid class labels.')
                        end
                        negativeLabels = loc;
                    end
            end
        end
    end
    % check that diagnostic test labels do not collide
    if ~isempty(intersect(positiveLabels,negativeLabels))
        error(message('bioinfo:classperf:InvalidPositiveNegativeLabels'))
    else
        CP.TargetClasses  = positiveLabels;
        CP.ControlClasses = negativeLabels;
    end
end

% I am done creating the object with new pos and neg, now I can leave
if ~gpsWereGiven
    CPO = CP;
    return
end

% validate idx
if islogical(idx)
    if numel(idx)~=CP.NumberOfObservations
        error('bioinfo:classperf:InvalidLogicalIndex',...
              'Size of the logical index vector must be [NumberOfObservations x 1].')
    end
    if sum(idx)~=numel(gps)
        error('bioinfo:classperf:InvalidLogicalIndex',...
              'There must be as many TRUE indices in TESTIDX as classifier outputs.')
    end
    idx = find(idx);
else % it is a vector of indices
    if numel(unique(idx))~=numel(idx) || max(idx)>CP.NumberOfObservations || min(idx)<0 || any(rem(idx,1)>0)
        error('bioinfo:classperf:InvalidNumericIndex',...
              'Index vector has invalid values.')
    end
    if numel(idx)~=numel(gps)
        error('bioinfo:classperf:InvalidNumericIndex',...
              'There must be as many indices in TESTIDX as classifier outputs.')
    end
end

% CP and all input arguments should be valid now, do the update
CP.updateValidation(gps,idx);

CPO = CP;

function displayProperties
blpk = findpackage('biolearning');
cls = findclass(blpk,'classperformance');
p = get(cls,'Properties');
names = get(p,'Name');
disp('CLASSPERFORMANCE object public properties:')
disp(names(strcmp(get(p,'Visible'),'on')))


text:
package com.vlitvak.todoapp.utils;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;

import com.vlitvak.todoapp.auth.BadUserAccessTokenException;
import com.vlitvak.todoapp.auth.User;
import com.vlitvak.todoapp.auth.UserAccessTokenNotFoundException;
import com.vlitvak.todoapp.auth.UserNotFoundException;

public interface ServletHelper {

  public String getBody(HttpServletRequest request) throws IOException;

  public void handleException(Exception e, int httpStatusCode,
      HttpServletResponse response) throws IOException;

  public void handleConstraintViolationException(
      ConstraintViolationException cve, int httpStatusCode,
      HttpServletResponse response) throws IOException;

  public User getUserFromRequest(HttpServletRequest request)
    throws IOException, BadUserAccessTokenException,
      UserNotFoundException, UserAccessTokenNotFoundException;

}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace AdminBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class UnitCategoryType extends AbstractType {

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder
            ->add('name')
        ;
    }

    /**
     * @return string
     */
    public function getName() {
        return 'unitCategory';
    }

    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'AppBundle\Entity\UnitCategory',
            'cascade_validation' => true,
        ));
    }

}


text:
static const CGFloat c_originX = 5;
static const CGFloat c_originY = 8;
static const CGFloat c_width = 160;
static const CGFloat c_height = 40;

@implementation ApplicationViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self tableView].allowsSelection = NO;
}

- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath {
    return 50;
}

- (void)onTextFieldChange:(UITextField*)textField {
    [UIApplication sharedApplication].applicationIconBadgeNumber = textField.text.intValue;
}

- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
    UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"MenuCell"];
    if (nil == cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MenuCell"];
    }

    if (indexPath.row == 0) {
        UIUserNotificationSettings* settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

        // applicationIconBadgeNumber
        CGRect frame = CGRectMake(c_originX, c_originY, c_width, c_height);
        UITextField* textField = [[UITextField alloc] initWithFrame:frame];

        textField.borderStyle = UITextBorderStyleBezel;
        textField.textColor = [UIColor blackColor];
        textField.font = [UIFont systemFontOfSize:17.0];
        textField.placeholder = @"enter badge number";
        textField.backgroundColor = [UIColor whiteColor];
        textField.autocorrectionType = UITextAutocorrectionTypeNo;
        textField.keyboardType = UIKeyboardTypeDefault;
        textField.returnKeyType = UIReturnKeyDone;
        textField.clearButtonMode = UITextFieldViewModeWhileEditing;

        [textField addTarget:self action:@selector(onTextFieldChange:) forControlEvents:UIControlEventEditingChanged];

        cell.accessoryView = textField;
        cell.textLabel.text = @"Set badge number";
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }

    return cell;
}

@end


text:
package org.assertj.core.api;

import static org.assertj.core.api.Assertions.assertThatPredicate;
import static org.assertj.core.api.BDDAssertions.then;

import java.util.function.Predicate;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class Assertions_assertThatPredicate_Test {

  private Predicate<String> actual;

  @BeforeEach
  void before() {
    actual = value -> value.equals("something");
  }

  @Test
  void should_create_Assert() {
    // GIVEN
    PredicateAssert<String> assertions = assertThatPredicate(actual);
    // WHEN/THEN
    then(assertions).isNotNull();
  }

  @Test
  void should_pass_actual() {
    // GIVEN
    PredicateAssert<String> assertions = assertThatPredicate(actual);
    // WHEN/THEN
    then(actual).isSameAs(assertions.actual);
  }
}


text:
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
// All other rights reserved.

using System;
using System.Globalization;
using System.Windows.Automation;
using System.Windows;
using System.Collections;
using System.Windows.Forms;
using Drawing = System.Drawing;
using System.Threading;
using MS.Win32;

namespace InternalHelper.Tests.Patterns
{
	using InternalHelper;
	using InternalHelper.Tests;
	using InternalHelper.Enumerations;
	using Microsoft.Test.UIAutomation;
	using Microsoft.Test.UIAutomation.Core;
	using Microsoft.Test.UIAutomation.TestManager;
	using Microsoft.Test.UIAutomation.Interfaces;

    /// -----------------------------------------------------------------------
    ///
    /// -----------------------------------------------------------------------
    public class TransformPatternWrapper : PatternObject
    {
        #region Enums
        internal enum TrueFalseValues
        {
            True,
            False,
            Undetermined
        }
        internal enum WindowPosition
        {
            Exact,
            Within
        }
        internal enum HasFocus
        {
            Yes,
            No,
            DontCare
        }
        #endregion Enums

        #region Variables
        internal TransformPattern m_pattern = null;

        internal string argument_pattern = "m_pattern";
        #endregion

        #region constructor

        ///
        protected TransformPatternWrapper(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
            :
            base(element, testSuite, priority, typeOfControl, typeOfPattern, dirResults, testEvents, commands)
        {
            m_pattern = (TransformPattern)GetPattern(m_le, m_useCurrent, TransformPattern.Pattern);
        }

        #endregion

        #region Methods

        internal bool pCanMove
        {
            get
            {
                return m_pattern.Current.CanMove;
            }
        }

        internal bool pCanResize
        {
            get
            {
                return m_pattern.Current.CanResize;
            }
        }

        internal bool pCanRotate
        {
            get
            {
                return m_pattern.Current.CanRotate;
            }
        }

        internal void pattern_Rotate(double degrees, Type expectedException, CheckType checkType)
        {
            string call = "TransformPattern.Rotate(" + degrees + ")";

            Comment("Calling " + call);

            try
            {
                m_pattern.Rotate(degrees);
            }
            catch (Exception error)
            {
                if (expectedException != error.GetType())
                    ThrowMe(checkType, call + " threw an expection unexpectedly : " + error.Message);
                Comment("Successfully called " + call + " with exception thrown as expected");
                return;
            }

            if (expectedException != null)
                ThrowMe(checkType, call + " did not throw an expection(" + expectedException.GetType() + " as expected");

            Comment("Successfully called " + call + " without an exception thrown");
        }

        internal void pattern_Move(double x, double y, Type expectedException, CheckType checkType)
        {
            string call = "TransformPattern.Move(" + x + ", " + y + ")";

            Comment("Calling " + call);

            try
            {
                m_pattern.Move(x, y);
            }
            catch (Exception error)
            {
                if (expectedException != error.GetType())
                    ThrowMe(checkType, call + " threw an expection unexpectedly : " + error.Message);
                Comment("Successfully called " + call + " with exception thrown as expected");
                return;
            }

            if (expectedException != null)
                ThrowMe(checkType, call + " did not throw an expection(" + expectedException.GetType() + " as expected");

            Comment("Successfully called " + call + " without an exception thrown");

        }

        internal void pattern_Resize(double width, double height, Type expectedException, CheckType checkType)
        {
            string call = "TransformPattern.Resize(" + width + ", " + height + ")";

            Comment("Calling " + call);

            try
            {
                m_pattern.Resize(width, height);
            }
            catch (Exception error)
            {
                if (expectedException != error.GetType())
                    ThrowMe(checkType, call + " threw an expection unexpectedly : " + error.Message);
                Comment("Successfully called " + call + " with exception thrown as expected");
                return;
            }

            if (expectedException != null)
                ThrowMe(checkType, call + " did not throw an expection(" + expectedException.GetType() + " as expected");

            Comment("Successfully called " + call + " without an exception thrown");
        }

        #endregion Methods
    }
}

namespace Microsoft.Test.UIAutomation.Tests.Patterns
{
    using InternalHelper;
    using InternalHelper.Tests;
    using InternalHelper.Tests.Patterns;
    using InternalHelper.Enumerations;
    using Microsoft.Test.UIAutomation;
    using Microsoft.Test.UIAutomation.Core;
    using Microsoft.Test.UIAutomation.TestManager;
    using Microsoft.Test.UIAutomation.Interfaces;

    /// -----------------------------------------------------------------------
    ///
    /// -----------------------------------------------------------------------
	public sealed class TransformTests : TransformPatternWrapper
    {
        #region Member variables

        ///
        /// Specific interface associated with this pattern
        ///
        new TransformPattern m_pattern = null;

        #endregion Member variables
        const string THIS = "TransformTests";

		/// -------------------------------------------------------------------
		///
		/// -------------------------------------------------------------------
		public const string TestSuite = NAMESPACE + "." + THIS;

		/// -------------------------------------------------------------------
		///
		/// -------------------------------------------------------------------
		public static readonly string TestWhichPattern = Automation.PatternName(TransformPattern.Pattern);

		/// -------------------------------------------------------------------
		///
		/// -------------------------------------------------------------------
		public TransformTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
            :
            base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Transform, dirResults, testEvents, commands)
        {
            m_pattern = (TransformPattern)element.GetCurrentPattern(TransformPattern.Pattern);
            if (m_pattern == null)
                throw new Exception(Helpers.PatternNotSupported);
        }

        #region Rotate 1.X

        ///TestCase: CanRotate.1.6
        [TestCaseAttribute("CanRotate.1.6",
            TestSummary = "If an element can rotate, call Transform.Rotate and verify that the BoundingRect property change event was fired",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri0,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: TransformPattern.CanRotate == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Rotate with the random degree is called successfully",
                "Verify: The BoundingRectangle PropertyChange event is fired",
                "Step: Move the element back to it's orginal location",
        })]
        public void CanRotate16(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Rect oldRect = m_le.Current.BoundingRectangle;

			int degree = (int)Helpers.RandomValue((int)0, (int)359);

            try
            {
                //"Precondition: TransformPattern.CanRotate == true",
                TSC_VerifyProperty(pCanRotate, true, true, TransformPattern.CanRotateProperty, CheckType.IncorrectElementConfiguration);

                //"Step: Setup a BoundingRectangle PropertyChange event",
                TSC_AddPropertyChangedListener(m_le, TreeScope.Element, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);

                //"Step: Verify that Rotate with the random degree is called successfully",
                TS_Rotate(degree, null, CheckType.Verification);

                //"Verify: The BoundingRectangle PropertyChange event is fired",
                TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { EventFired.True }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);
            }
            finally // incase we throw, we can come back in here and clean up
            {
                //"Step: Move the element back to it's orginal location",
                if (m_pattern.Current.CanRotate == true)
                    TS_Rotate(-degree, null, CheckType.Verification);
            }
        }

        #endregion Rotate

        #region Move 2.X

        ///TestCase: Move.2.1
        [TestCaseAttribute("Move.2.1",
            TestSummary = "Move the element to position (0,0) which is not the current location",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri0,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: TransformPattern.CanMove == true",
                "Precondition: If the element is at position (0,0), then move it to (10,10)",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move(0,0) is called successfully",
                "Step: Wait for event to occur",
                "Verify: The BoundingRectangle PropertyChange event is fired",
                "Verify: Element's BoundingRectangle is correct",
                "Step: Move the window back to it's original position",
        })]
        public void Move21(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point oldPoint = new Point(m_le.Current.BoundingRectangle.Left, m_le.Current.BoundingRectangle.Top);

            try
            {
                //"Precondition: TransformPattern.CanMove == true",
                TSC_VerifyProperty(pCanMove, true, true, TransformPattern.CanMoveProperty, CheckType.IncorrectElementConfiguration);

                //"Step: Move the element to some position other than zero. If position is (0,0) move to (10,10)",
                if (oldPoint.X == 0 & oldPoint.Y == 0)
                    TS_Move(new Point(10, 10), null, CheckType.Verification);
                else
                {
                    Comment("Element is not at position (0,0)");
                    m_TestStep++;
                }

                //"Step: Setup a BoundingRectangle PropertyChange event",
                TSC_AddPropertyChangedListener(m_le, TreeScope.Element, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);

                //"Step: Verify that Move(0,0) is called successfully",
                TS_Move(new Point(0, 0), null, CheckType.Verification);

                // Step: Wait for event to occur
                TSC_WaitForEvents(2);

                //"Verify: The BoundingRectangle PropertyChange event is fired",
                TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { EventFired.True }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);

                // Verify BoundingRect is correct
                TS_VerifyBoundingRect(new Rect(0, 0, m_le.Current.BoundingRectangle.Width, m_le.Current.BoundingRectangle.Height), m_le.Current.BoundingRectangle, CheckType.Verification);
            }
            finally // incase we throw expection, come back and clean up
            {
                if (oldPoint.X != m_le.Current.BoundingRectangle.Left || oldPoint.Y != m_le.Current.BoundingRectangle.Top)
                {
                    //"Step: Move the window back to it's original position",
                    Comment("Moving element back to it's original position");
                    TS_Move(oldPoint, null, CheckType.Verification);
                }
                else
                {
                    m_TestStep++;
                }
            }
        }

        ///TestCase: Move.2.2
        [TestCaseAttribute("Move.2.2",
            TestSummary = "Move the element to a random location on the desktop",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri0,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Step: Obtain a random point on the desktop",
                "Precondition: TransformPattern.CanMove == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point is called successfully",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is fired",
                "Verify: Element was moved to the correct position by validating the BoundingRectangle",
                "Step: Move the window back to it's original position",
        })]
        public void Move22(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point point = new Point();

            //"Step: Obtain a random point on the desktop",
            TS_GetRandomOtherScreenLocation(out point, true, CheckType.Verification);
            TestMove1(true, CheckType.IncorrectElementConfiguration, null, WindowPosition.Exact, EventFired.True, point, true, HasFocus.DontCare);
        }

        ///TestCase: Move.2.3
        [TestCaseAttribute("Move.2.3",
            TestSummary = "Move the element to it's current location",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: TransformPattern.CanMove == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the current location is called successfully",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is not fired",
                "Verify: Element was still at the current location",
        })]
        public void Move23(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);
            TestMove1(true, CheckType.IncorrectElementConfiguration, null, WindowPosition.Exact, EventFired.False, new Point(m_le.Current.BoundingRectangle.X, m_le.Current.BoundingRectangle.Y), false, HasFocus.DontCare);
        }

        ///TestCase: Move.2.4
        [TestCaseAttribute("Move.2.4",
            TestSummary = "Move to point where the element results in partially outside of screen and partially inside screen",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: Obtain a position on the screen where the element will be partially off the parent's viewport",
                "Precondition: TransformPattern.CanMove == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the the current locations is called successfully",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is fired",
                "Verify: Element has moved to the desired location",
                "Step: Move the element back to it's original position"
        })]
        public void Move24(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);
            Rect rect = new Rect();

            TS_GetRandomOverlappingParentViewport(out rect, CheckType.IncorrectElementConfiguration);
            TestMove1(true, CheckType.IncorrectElementConfiguration, null, WindowPosition.Exact, EventFired.True, new Point(rect.X, rect.Y), true, HasFocus.DontCare);
        }

        ///TestCase: Move.2.5
        [TestCaseAttribute("Move.2.5",
            TestSummary = "Move to point where the element is entirely outside of screen",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: Obtain a random position where the element intirely off the screen",
                "Precondition: TransformPattern.CanMove == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point is called successfully",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is fired if the element is moved",
                "Verify: Element is within the screen cordinates",
                "Step: Move the element back to it's original position"
        })]
        public void Move25(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Rect rect = new Rect();

            TS_GetRandomEntirelyOutsideParentViewport(out rect, CheckType.IncorrectElementConfiguration);
            TestMove1(true, CheckType.IncorrectElementConfiguration, null, WindowPosition.Within, EventFired.False, new Point(rect.X, rect.Y), true, HasFocus.DontCare);
        }

        ///TestCase: Move.2.8
        [TestCaseAttribute("Move.2.8",
            TestSummary = "Non-movable element, call Move and verify that it does not move",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri0,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: Obtain a random position on the desktop",
                "Precondition: TransformPattern.CanMove == false",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point throws InvalidOperationException",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is not fired",
                "Verify: Element has not moved",
        })]
        public void Move28(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point point = new Point();

            TS_GetRandomOtherScreenLocation(out point, true, CheckType.IncorrectElementConfiguration);
            TestMove1(false, CheckType.IncorrectElementConfiguration, typeof(InvalidOperationException), WindowPosition.Exact, EventFired.False, point, false, HasFocus.DontCare);
        }

        ///TestCase: Move.2.12
        [TestCaseAttribute("Move.2.12",
            TestSummary = "Element is maximized, but does not cover entire desktop (Console window)",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1,
            Status = TestStatus.Problem, // Need to verify that the window is maximizable 1st
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: Verify that window supports maximizing",
                "Verify: Call WindowPattern.SetWindowVisualState(WindowVisualState.Maximize)",
                "Verify: WindowVisualState = WindowVisualState.Maximize",
                "Precondition: Element does not cover enitire current screen",
                "Precondition: TransformPattern.CanMove == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point throws InvalidOperationException",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is not fired",
                "Verify: Element has not moved",
        })]
        public void Move212(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point point = new Point();

            TSC_VerifyProperty(m_le.GetCurrentPropertyValue(WindowPattern.CanMaximizeProperty), true, true, WindowPattern.CanMaximizeProperty, CheckType.IncorrectElementConfiguration);
            TS_SetWindowVisualState(m_le, WindowVisualState.Maximized, CheckType.Verification);
            TS_VerifyWindowVisualState(m_le, WindowVisualState.Maximized, CheckType.Verification);
            TS_WindowNotCoveredEntireScreen(CheckType.IncorrectElementConfiguration);
            TestMove1(true, CheckType.Verification, typeof(InvalidOperationException), WindowPosition.Exact, EventFired.False, point, false, HasFocus.DontCare);
        }

        ///TestCase: Move.2.13
        [TestCaseAttribute("Move.2.13",
            TestSummary = "Element does not have the focus",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Step: Obtain a random location on the screen other than current location",
                "Step: Ensure the AutomationElement does not have focus by calling SetFocus(AutomationElement.RootElement.FirstChild) - OS's Start Button",
                "Precondition: TransformPattern.CanMove == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point is called successfully",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is fired",
                "Verify: Element has moved to the new location",
                "Step: Move the element back to it's original position"
        })]
        public void Move213(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point point = new Point();

            //"Step: Obtain a random point on the desktop",
            TS_GetRandomOtherScreenLocation(out point, true, CheckType.Verification);
            TestMove1(true, CheckType.IncorrectElementConfiguration, null, WindowPosition.Exact, EventFired.True, point, true, HasFocus.No);
        }

        ///TestCase: Move.2.17
        [TestCaseAttribute("Move.2.17",
            TestSummary = "Move a minimized non-movable element(ie. window minimized to task bar)",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1, Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: Verify that window supports minimizing",
                "Step: Obtain a random location on the screen other than current location",
                "Step: Miminimize the element",
                /* TestMove1 */
                "Verify: TransformPattern.CanMove == false",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point is called successfully",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is not fired",
                "Verify: Element has not moved to the new location",
                "Step: Move the element back to it's original position if previous steps failed",
                "Step: Set the element's WindowVisualState back to it's original state"
        })]
        public void Move217(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point point = new Point();

            TSC_VerifyProperty(m_le.GetCurrentPropertyValue(WindowPattern.CanMinimizeProperty), true, true, WindowPattern.CanMinimizeProperty, CheckType.IncorrectElementConfiguration);
            WindowVisualState originalState = ((WindowPattern)m_le.GetCurrentPattern(WindowPattern.Pattern)).Current.WindowVisualState;

            try
            {
                //"Step: Obtain a random point on the desktop",
                TS_GetRandomOtherScreenLocation(out point, true, CheckType.Verification);
                TS_SetWindowVisualState(m_le, WindowVisualState.Minimized, CheckType.IncorrectElementConfiguration);
                TestMove1(false, CheckType.Verification, typeof(InvalidOperationException),  WindowPosition.Exact, EventFired.False, point, true, HasFocus.DontCare);
            }
            finally
            {
                TS_SetWindowVisualState(m_le, originalState, CheckType.IncorrectElementConfiguration);
            }
        }

        ///TestCase: Move.2.18
        [TestCaseAttribute("Move.2.18",
            TestSummary = "Move a minimized movable element(ie. MDI window minimized)",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: Verify that window supports minimizing",
                "Step: Obtain a random location on the screen other than current location",
                "Step: Miminimize the element",
                /* TestMove1 */
                "Verify: TransformPattern.CanMove == true",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point is called successfully",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is fired",
                "Verify: Element has moved to the new location",
                "Step: Move the element back to it's original position",
                "Step: Set the element's WindowVisualState back to it's original state"
        })]
        public void Move218(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point point = new Point();
            TSC_VerifyProperty(m_le.GetCurrentPropertyValue(WindowPattern.CanMinimizeProperty), true, true, WindowPattern.CanMinimizeProperty, CheckType.IncorrectElementConfiguration);
            WindowVisualState originalState = ((WindowPattern)m_le.GetCurrentPattern(WindowPattern.Pattern)).Current.WindowVisualState;

            try
            {
                //"Step: Obtain a random point on the desktop",
                TS_GetRandomOtherScreenLocation(out point, true, CheckType.Verification);
                TS_SetWindowVisualState(m_le, WindowVisualState.Minimized, CheckType.IncorrectElementConfiguration);
                TestMove1(true, CheckType.Verification, null, WindowPosition.Exact, EventFired.True, point, true, HasFocus.DontCare);
            }
            finally
            {
                TS_SetWindowVisualState(m_le, originalState, CheckType.IncorrectElementConfiguration);
            }
        }

        ///TestCase: Move.2.19
        [TestCaseAttribute("Move.2.19",
            TestSummary = "Element is maximized, and covers entire screen",
            TestCaseType = TestCaseType.Events, EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri1, Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: Verify that window supports maximizing",
                "Precondition: Call WindowPattern.SetWindowVisualState(WindowVisualState.Maximize)",
                "Verify:  WindowVisualState = WindowVisualState.Maximize",
                "Precondition: Element does cover enitire current screen",
                /* TestMove1 */
                "Verify: TransformPattern.CanMove == false",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Move() with the random point throws InvalidOperationException",
                "Step: Wait for event to get fired",
                "Verify: The BoundingRectangle PropertyChange event is not fired",
                "Verify: Element has not moved",
                "Step: Move the element back to it's original position",
                "Step: Set the element's WindowVisualState back to it's original state",
        })]
        public void Move219(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Point point = new Point();

            TSC_VerifyProperty(m_le.GetCurrentPropertyValue(WindowPattern.CanMaximizeProperty), true, true, WindowPattern.CanMaximizeProperty, CheckType.IncorrectElementConfiguration);
            WindowVisualState originalState = ((WindowPattern)m_le.GetCurrentPattern(WindowPattern.Pattern)).Current.WindowVisualState;

            try
            {
                TS_SetWindowVisualState(m_le, WindowVisualState.Maximized, CheckType.IncorrectElementConfiguration);
                TS_VerifyWindowVisualState(m_le, WindowVisualState.Maximized, CheckType.IncorrectElementConfiguration);
                TS_WindowCoversEntireScreen(CheckType.IncorrectElementConfiguration);
                TestMove1(false, CheckType.Verification, typeof(InvalidOperationException), WindowPosition.Exact, EventFired.False, point, true, HasFocus.DontCare);
            }
            finally
            {
                TS_SetWindowVisualState(m_le, originalState, CheckType.IncorrectElementConfiguration);
            }
        }

        /// -------------------------------------------------------------------
        ///
        /// -------------------------------------------------------------------
        void TestMove1(bool canMove, CheckType checkType, Type expectedException, WindowPosition placement, EventFired eventFired, Point point, bool moveWindowBackToOriginalPostion, HasFocus hasFocus)
        {
            Point oldPoint = new Point(m_le.Current.BoundingRectangle.Left, m_le.Current.BoundingRectangle.Top);

            try
            {
                //"Precondition: TransformPattern.CanMove == true",
                TSC_VerifyPropertyEqual(pCanMove, canMove, TransformPattern.CanMoveProperty, CheckType.IncorrectElementConfiguration);

                //"Step: Ensure the AutomationElement does not have focus by calling SetFocus(AutomationElement.RootElement.FirstChild) - "OS's Start Button"",
                switch (hasFocus)
                {
                    case HasFocus.No:
                        TSC_SetFocusVerifyWithEvent(ControlFirstChild(AutomationElement.RootElement), CheckType.Verification);
                        break;

                    case HasFocus.DontCare:
                        break;

                    default:
                        throw new ArgumentException("Need to handle a HasFocus enum");
                }

                //"Step: Setup a BoundingRectangle PropertyChange event",
                TSC_AddPropertyChangedListener(m_le, TreeScope.Element, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);

                //"Step: Verify that Move with the random point is called successfully",
                TS_Move(point, expectedException, CheckType.Verification);

                //"Step: Wait for event to get fired",
                TSC_WaitForEvents(2);

                if (placement == WindowPosition.Exact)
                {
                    //"Verify: The BoundingRectangle PropertyChange event is fired",
                    TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { eventFired }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);
                    if (eventFired == EventFired.True)
                    {
                        // Verify element was moved to the correct position by validating the BoundingRectangle
                        TS_VerifyBoundingRect(new Rect(point.X, point.Y, m_le.Current.BoundingRectangle.Width, m_le.Current.BoundingRectangle.Height), m_le.Current.BoundingRectangle, CheckType.Verification);
                    }
                    else
                    {
                        // Verify element was not moved to the correct position by validating the BoundingRectangle
                        TS_VerifyBoundingRect(new Rect(oldPoint.X, oldPoint.Y, m_le.Current.BoundingRectangle.Width, m_le.Current.BoundingRectangle.Height), m_le.Current.BoundingRectangle, CheckType.Verification);
                    }
                }
                else if (placement == WindowPosition.Within)
                {
                    // "Verify: The BoundingRectangle PropertyChange event is fired if the element is moved",
                    if (m_le.Current.BoundingRectangle.Left == point.X && m_le.Current.BoundingRectangle.Top == point.Y)
                    {
                        TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { EventFired.False }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);
                    }
                    else
                    {
                        TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { EventFired.True }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);
                    }

                    // OS does not allow off the screen so will move it back to a good location
                    TS_VerifyPlacedWithinScreen(CheckType.Verification);

                }

            }
            finally // incase we throw expection, come back and clean up
            {
                if (moveWindowBackToOriginalPostion)
                {
                    //"Step: Move the window back to it's original position",
                    Comment("Moving window back to it's original position");
                    if (oldPoint != new Point(m_le.Current.BoundingRectangle.Left, m_le.Current.BoundingRectangle.Top))
                        TS_Move(oldPoint, null, CheckType.Verification);
                    else
                        m_TestStep++;
                }
            }
        }
        #endregion Move

        #region Resize 3.X
        ///TestCase: Resize.3.2
        [TestCaseAttribute("Resize.3.2",
            TestSummary = "If a element is sizable, then call Transform.Resize on the window and verify that it resized and that the events were fired",
            TestCaseType = TestCaseType.Events,
            EventTested = "AutomationPropertyChangedEventHandler(AutomationElement.BoundingRectangleProperty)",
            Priority = TestPriorities.Pri0,
            ProblemDescription = "Cannot determine exact corrdinates of a window, there may be some 'steping' of valid locations",
            Status = TestStatus.Problem,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Precondition: TransformPattern.CanResize == true",
                "Precondition: Obtain a random width/height of the element",
                "Step: Setup a BoundingRectangle PropertyChange event",
                "Step: Verify that Resize with the random point is called successfully",
                "Verify: The BoundingRectangle PropertyChange event is fired",
                "Verify: BoundingRect is correct",
                "Step: Move the window back to it's original position",
        })]
        public void Resize32(TestCaseAttribute testCase)
        {
            HeaderComment(testCase);

            Rect oldRect = m_le.Current.BoundingRectangle;
            int Height = 0, Width = 0;
            try
            {
                //"Precondition: TransformPattern.CanResize == true",
                TSC_VerifyProperty(pCanResize, true, true, TransformPattern.CanResizeProperty, CheckType.IncorrectElementConfiguration);

                //"Precondition: Obtain a random width/height of the element",
                TS_GetRandomWindowSize(out Width, out Height, CheckType.IncorrectElementConfiguration);

                //"Step: Setup a BoundingRectangle PropertyChange event",
                TSC_AddPropertyChangedListener(m_le, TreeScope.Element, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);

                //"Step: Verify that Resize with the random point is called successfully",
                TS_Resize(Width, Height, null, CheckType.Verification);

                //"Verify: The BoundingRectangle PropertyChange event is fired",
                TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { EventFired.True }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);

                // Verify BoundingRect is correct
                TS_VerifyBoundingRect(new Rect(oldRect.Left, oldRect.Top, Width, Height), m_le.Current.BoundingRectangle, CheckType.Verification);
            }
            finally // incase we throw, we can come back in here and clean up
            {
                //"Step: Move the window back to it's original position",
                TS_Resize(oldRect.Width, oldRect.Height, null, CheckType.Verification);
            }
        }
        #endregion Resize

        #region CanRotateProperty 4.X

        ///TestCase: CanRotate.4.1
        [TestCaseAttribute("CanRotateProperty.4.1",
            TestSummary = "Verify that the value of CanRotate is correct",
            TestCaseType = TestCaseType.Scenario | TestCaseType.Arguments,
            Priority = TestPriorities.Pri0,
            Client = Client.ATG,
            Status = TestStatus.Works,
            Author = "Microsoft Corp.",
            Description = new string[] {
                "Verify: The value of CanRotate is equal the expected value",
        })]
        public void CanRotateProperty41(TestCaseAttribute testCase, object[] argument)
        {
            HeaderComment(testCase);
            if (argument.Length != 1)
                throw new ArgumentException();

            // Get the value passed into the test case
            bool expectedValue = (bool)(argument[0]);

            // Get the actual value
            bool actual = m_pattern.Current.CanRotate;

            Comment("TransformPattern.CanRotate == " + actual);

            if (actual != expectedValue)
                ThrowMe(CheckType.Verification, "TransformPattern.CanRotate != " + actual);
        }
        #endregion CanRotate

        #region TS_

        /// ----------------------------------------------------------------------------
        void TS_Resize(double width, double height, Type expectedException, CheckType checkType)
        {
            pattern_Resize(width, height, expectedException, checkType);
            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_Rotate(double degree, Type expectedException, CheckType checkType)
        {
            pattern_Rotate(degree, expectedException, checkType);
            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_GetRandomWindowSize(out int Width, out int Height, CheckType checkType)
        {

            object objHwnd = m_le.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty);
            //			object objHwnd = m_le.RawElement.GetPropertyValue(RawElement.NativeWindowHandleProperty);
            IntPtr ptr = IntPtr.Zero;

            if (objHwnd is IntPtr)
                ptr = (IntPtr)objHwnd;
            else
                ptr = new IntPtr(Convert.ToInt64(objHwnd, CultureInfo.CurrentCulture));

            if (ptr == IntPtr.Zero)
                ThrowMe(checkType, "Could not get the handle to the element(window)");

            NativeMethods.RECT originalRect = new NativeMethods.RECT();
            NativeMethods.RECT smallRect = new NativeMethods.RECT();

            // get original size so we can restore after
            SafeNativeMethods.GetWindowRect(ptr, ref originalRect);

            // try to move it to it's smallest size so we can determine the smallest size this can be
            SafeNativeMethods.MoveWindow(ptr, 1, 1, 1, 1, 0);

            // get the random window size
            SafeNativeMethods.GetWindowRect(ptr, ref smallRect);
            Width = (int)Helpers.RandomValue(smallRect.right - smallRect.left, originalRect.right - originalRect.left);
            Height = (int)Helpers.RandomValue(smallRect.bottom - smallRect.top, originalRect.bottom - originalRect.top);

            // put the window back.
            SafeNativeMethods.MoveWindow(ptr, (int)originalRect.left, (int)originalRect.top, (int)(originalRect.right - originalRect.left), (int)(originalRect.bottom - originalRect.top), -1);
            Comment("Found random window size of (" + Width + " x " + Height + ")");
            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_Move(Point point, Type expectedException, CheckType checkType)
        {
            pattern_Move(point.X, point.Y, expectedException, checkType);
            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_VerifyPlacedWithinScreen(CheckType checkType)
        {
            Rect rect = m_le.Current.BoundingRectangle;
            Screen screen = Screen.FromPoint(new System.Drawing.Point((int)rect.Left, (int)rect.Top));
            Drawing.Rectangle dRect = new System.Drawing.Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);

            ThrowMeAssert(checkType,
                Drawing.Rectangle.Intersect(screen.WorkingArea, dRect).Equals(dRect),
                "Verify element is withing working area",
                String.Format("Element {0} is not withing {1}", dRect, screen.WorkingArea));

            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_WindowNotCoveredEntireScreen(CheckType checkType)
        {
            Rect rect = m_le.Current.BoundingRectangle;
            Screen screen = Screen.FromPoint(new System.Drawing.Point((int)(rect.Left + ((rect.Right - rect.Left) / 2)), (int)(rect.Top + ((rect.Bottom - rect.Top) / 2))));
            Drawing.Rectangle AppRect = new System.Drawing.Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);

            // Normal maximized window that fills entire selected screen
            if (Drawing.Rectangle.Intersect(screen.WorkingArea, AppRect).Equals(screen.WorkingArea))
                ThrowMe(checkType, "Element fills the entire screen");

            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_WindowCoversEntireScreen(CheckType checkType)
        {
            Rect rect = m_le.Current.BoundingRectangle;
            Screen screen = Screen.FromPoint(new System.Drawing.Point((int)(rect.Left + ((rect.Right - rect.Left) / 2)), (int)(rect.Top + ((rect.Bottom - rect.Top) / 2))));
            Drawing.Rectangle AppRect = new System.Drawing.Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);

            // Normal maximized window that fills entire selected screen
            if (Drawing.Rectangle.Intersect(screen.WorkingArea, AppRect).Equals(AppRect))
                ThrowMe(checkType, "Element does not fill the entire screen");

            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_GetRandomEntirelyOutsideParentViewport(out Rect rect, CheckType checkType)
        {
            int xLeft = 0, yTop = 0;
            Rect meRect = m_le.Current.BoundingRectangle;

            Comment("Element.BoundingRectangle = " + meRect);

            // determine if it is a top level window
            // TODO: Should check that if this is not a top level window there on a differnet path
            WindowPattern wp = m_le.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;

            if (wp == null)
                throw new Exception("Object does not support WindowPattern...not sure what to do.  May be a case where it is within a window application and not a topmost");

            // Brain dead, just get the exents
            Screen[] screens = Screen.AllScreens;
            Drawing.Rectangle rectScreen = new Drawing.Rectangle();

            // Build up and intersection of all screens
            foreach (Screen screen in screens)
            {
                rectScreen = System.Drawing.Rectangle.Union(rectScreen, screen.WorkingArea);
            }

            Comment("Union of all screen working areas is = (" + rectScreen + ")");

            Drawing.Rectangle intersectRect;

            do
            {
                xLeft = (int)Helpers.RandomValue(int.MinValue, int.MaxValue);
                yTop = (int)Helpers.RandomValue(int.MinValue, int.MaxValue);
                intersectRect = Drawing.Rectangle.Intersect(rectScreen, new Drawing.Rectangle(xLeft, yTop, (int)meRect.Width, (int)meRect.Height));
            } while (!intersectRect.IsEmpty);

            rect = new Rect(xLeft, yTop, meRect.Width, meRect.Height);
            Comment("Random screen area returned is (" + rect + ")");
            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_GetRandomOverlappingParentViewport(out Rect rect, CheckType checkType)
        {
            int xLeft = 0, yTop = 0;
            Rect meRect = m_le.Current.BoundingRectangle;

            Comment("Element.BoundingRectangle = " + meRect);

            // determine if it is a top level window
            // TODO: Should check that if this is not a top level window there on a differnet path
            WindowPattern wp = m_le.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
            if (wp == null)
                throw new Exception("Object does not support WindowPattern...not sure what to do.  May be a case where it is within a window application and not a topmost");

            Screen[] screens = Screen.AllScreens;
            int randomScreen = (int)Helpers.RandomValue(0, screens.Length);
            System.Drawing.Rectangle rectScreen = screens[randomScreen].WorkingArea;

            Comment("Selection screen[" + randomScreen + "].WorkingArea = " + rectScreen);

            // Use 2 since we are taking off one pixel overlapp on each side
            double CYCAPTION = SafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CYCAPTION);
            double CXBORDER = SafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CXBORDER);
            double CYBORDER = SafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CYBORDER);

            rect = new Rect(
                rectScreen.Left - meRect.Width + (CXBORDER * 1.2),
                rectScreen.Top - CYCAPTION / 2,
                rectScreen.Width + (meRect.Width - (CXBORDER * 1.2)),
                rectScreen.Height + (CYCAPTION / 2) - CXBORDER * 1.2);

            // When we have at least two corners outside of the viewport, we have it
            int count;

            do
            {
                count = 0;
                xLeft = (int)Convert.ToDouble(Helpers.RandomValue(rect.Left, rect.Right));
                yTop = (int)Convert.ToDouble(Helpers.RandomValue(rect.Top, rect.Bottom));
                count += xLeft < rectScreen.Left ? 1 : 0;
                count += yTop < rectScreen.Top ? 1 : 0;
                count += xLeft + meRect.Width > rectScreen.Right ? 1 : 0;
                count += yTop + meRect.Height > rectScreen.Bottom ? 1 : 0;

            } while (count < 2);

            rect = new Rect(xLeft, yTop, meRect.Width, meRect.Height);
            //_move(rect.X, rect.Y);
            Comment("Found random location overlapping parent viewport : " + rect);
            m_TestStep++;
        }

        /// ----------------------------------------------------------------------------
        void TS_GetRandomOtherScreenLocation(out Point point, bool AllowOrigin, CheckType checkType)
        {
            Screen[] screens = Screen.AllScreens;
            int randomScreen = (int)Helpers.RandomValue(0, screens.Length);
            System.Drawing.Rectangle rectScreen = screens[randomScreen].WorkingArea;

            Comment("Selection screen[" + randomScreen + "].WorkingArea = " + rectScreen);

            int xLeft, yTop;
            double currentX = m_le.Current.BoundingRectangle.Left;
            double currentY = m_le.Current.BoundingRectangle.Top;

            // Can't just use 0 or 1 since Left/Top may be negative numbers
            if (AllowOrigin)
            {
                xLeft = (int)Helpers.RandomValue(rectScreen.Left, rectScreen.Right);
                yTop = (int)Helpers.RandomValue(rectScreen.Top, rectScreen.Bottom);
            }
            else
            {
                // I assume Left/Top and Right/Bottom will allow a valid location so won't get endless loop<yikes>
                // Don't allow current position, or 0
                do
                {
                    xLeft = (int)Helpers.RandomValue(rectScreen.Left, rectScreen.Right);
                } while (xLeft == currentX | xLeft == 0);

                do
                {
                    yTop = (int)Helpers.RandomValue(rectScreen.Top, rectScreen.Bottom);
                } while (yTop == currentY | yTop == 0);
            }

            point = new Point(xLeft, yTop);
            Comment("Random screen location = " + point);
            m_TestStep++;
        }

        #endregion TS_

    }
}


text:
package org.apache.ignite.internal;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.ObjectStreamException;
import java.util.Collection;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceConfiguration;
import org.apache.ignite.services.ServiceDescriptor;
import org.jetbrains.annotations.Nullable;

/**
 * {@link org.apache.ignite.IgniteCompute} implementation.
 */
public class IgniteServicesImpl extends AsyncSupportAdapter implements IgniteServices, Externalizable {
    /** */
    private static final long serialVersionUID = 0L;

    /** */
    private GridKernalContext ctx;

    /** */
    private ClusterGroupAdapter prj;

    /**
     * Required by {@link Externalizable}.
     */
    public IgniteServicesImpl() {
        // No-op.
    }

    /**
     * @param ctx Kernal context.
     * @param prj Projection.
     * @param async Async support flag.
     */
    public IgniteServicesImpl(GridKernalContext ctx, ClusterGroupAdapter prj, boolean async) {
        super(async);

        this.ctx = ctx;
        this.prj = prj;
    }

    /** {@inheritDoc} */
    @Override public ClusterGroup clusterGroup() {
        return prj;
    }

    /** {@inheritDoc} */
    @Override public void deployNodeSingleton(String name, Service svc) {
        A.notNull(name, "name");
        A.notNull(svc, "svc");

        guard();

        try {
            saveOrGet(ctx.service().deployNodeSingleton(prj, name, svc));
        }
        catch (IgniteCheckedException e) {
            throw U.convertException(e);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public void deployClusterSingleton(String name, Service svc) {
        A.notNull(name, "name");
        A.notNull(svc, "svc");

        guard();

        try {
            saveOrGet(ctx.service().deployClusterSingleton(prj, name, svc));
        }
        catch (IgniteCheckedException e) {
            throw U.convertException(e);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public void deployMultiple(String name, Service svc, int totalCnt, int maxPerNodeCnt) {
        A.notNull(name, "name");
        A.notNull(svc, "svc");

        guard();

        try {
            saveOrGet(ctx.service().deployMultiple(prj, name, svc, totalCnt, maxPerNodeCnt));
        }
        catch (IgniteCheckedException e) {
            throw U.convertException(e);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public void deployKeyAffinitySingleton(String name, Service svc, @Nullable String cacheName,
        Object affKey) {
        A.notNull(name, "name");
        A.notNull(svc, "svc");
        A.notNull(affKey, "affKey");

        guard();

        try {
            saveOrGet(ctx.service().deployKeyAffinitySingleton(name, svc, cacheName, affKey));
        }
        catch (IgniteCheckedException e) {
            throw U.convertException(e);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public void deploy(ServiceConfiguration cfg) {
        A.notNull(cfg, "cfg");

        guard();

        try {
            saveOrGet(ctx.service().deploy(cfg));
        }
        catch (IgniteCheckedException e) {
            throw U.convertException(e);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public void cancel(String name) {
        A.notNull(name, "name");

        guard();

        try {
            saveOrGet(ctx.service().cancel(name));
        }
        catch (IgniteCheckedException e) {
            throw U.convertException(e);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public void cancelAll() {
        guard();

        try {
            saveOrGet(ctx.service().cancelAll());
        }
        catch (IgniteCheckedException e) {
            throw U.convertException(e);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public Collection<ServiceDescriptor> serviceDescriptors() {
        guard();

        try {
            return ctx.service().serviceDescriptors();
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public <T> T service(String name) {
        guard();

        try {
            return ctx.service().service(name);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public <T> T serviceProxy(String name, Class<? super T> svcItf, boolean sticky)
        throws IgniteException {
        A.notNull(name, "name");
        A.notNull(svcItf, "svcItf");
        A.ensure(svcItf.isInterface(), "Service class must be an interface: " + svcItf);

        guard();

        try {
            return ctx.service().serviceProxy(prj, name, svcItf, sticky);
        }
        finally {
            unguard();
        }
    }

    /** {@inheritDoc} */
    @Override public <T> Collection<T> services(String name) {
        guard();

        try {
            return ctx.service().services(name);
        }
        finally {
            unguard();
        }
    }

    /**
     * <tt>ctx.gateway().readLock()</tt>
     */
    private void guard() {
        ctx.gateway().readLock();
    }

    /**
     * <tt>ctx.gateway().readUnlock()</tt>
     */
    private void unguard() {
        ctx.gateway().readUnlock();
    }

    /** {@inheritDoc} */
    @Override public IgniteServices withAsync() {
        if (isAsync())
            return this;

        return new IgniteServicesImpl(ctx, prj, true);
    }

    /** {@inheritDoc} */
    @Override public void writeExternal(ObjectOutput out) throws IOException {
        out.writeObject(prj);
    }

    /** {@inheritDoc} */
    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        prj = (ClusterGroupAdapter)in.readObject();
    }

    /**
     * Reconstructs object on unmarshalling.
     *
     * @return Reconstructed object.
     * @throws ObjectStreamException Thrown in case of unmarshalling error.
     */
    protected Object readResolve() throws ObjectStreamException {
        return prj.services();
    }
}


text:
package com.tqmars.cardrecycle.webapi.controller.security;

import com.tqmars.cardrecycle.application.security.ISecurityAppService;
import com.tqmars.cardrecycle.application.security.dto.ChangeWithdrawPwdInput;
import com.tqmars.cardrecycle.application.security.dto.RealNameAuthInput;
import com.tqmars.cardrecycle.infrastructure.serialization.Serialization;
import com.tqmars.cardrecycle.webapi.controller.ControllerBase;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by jjh on 1/16/17.
 */
@RestController
@RequestMapping(value = "/security",method = {RequestMethod.POST,RequestMethod.GET})
public class SecurityController extends ControllerBase {
    private ISecurityAppService _securityAppService;

    public SecurityController(HttpServletRequest request, HttpServletResponse response) {
        super(request, response);

        this._securityAppService = getService("SecurityAppService",ISecurityAppService.class);
    }

    /**
     * 实名认证
     * @param uinfo -- {idNum(身份证),name(姓名),token,id(用户id)}
     * @return void
     */
    @RequestMapping(value = "/realNameAuth")
    public String realNameAuth(@RequestParam(value = "uinfo") String uinfo){
        RealNameAuthInput _uinfo = Serialization.toObject(uinfo, RealNameAuthInput.class);
        boolean r = _securityAppService.realNameAuth(_uinfo);

        if(r){
            return toSucessMsg();
        }else {
            return toFailMsg("认证失败,已存在的身份证号");
        }

    }

    /**
     * 修改提现密码
     * @param uinfo -- {newPwd,token,id}
     * @return void
     */
    @RequestMapping(value = "/changeWithDrawPwd")
    public String changeWithDrawPwd(@RequestParam(value = "uinfo") String uinfo){
        ChangeWithdrawPwdInput _input = Serialization.toObject(uinfo, ChangeWithdrawPwdInput.class);
        boolean r = _securityAppService.changeWithdrawPwd(_input);
        if(r){
            return toSucessMsg();
        }else {
            return toFailMsg("修改密码失败");
        }
    }

}


text:
import argumentFunction = require( './index' );

// TESTS //

// The function returns a function...
{
	argumentFunction( 1 ); // $ExpectType Function
	argumentFunction( 2 ); // $ExpectType Function
}

// The compiler throws an error if the function is not provided a string...
{
	argumentFunction( 'abc' ); // $ExpectError
	argumentFunction( true ); // $ExpectError
	argumentFunction( false ); // $ExpectError
	argumentFunction( ( x: number ): number => x ); // $ExpectError
	argumentFunction( [] ); // $ExpectError
	argumentFunction( {} ); // $ExpectError
}

// The compiler throws an error if the function is provided an incorrect number of arguments...
{
	argumentFunction(); // $ExpectError
	argumentFunction( 1, 2 ); // $ExpectError
}


text:
package org.apereo.cas.configuration.model.support.trusted;

import org.apereo.cas.configuration.model.core.authentication.PersonDirectoryPrincipalResolverProperties;
import org.apereo.cas.configuration.support.RequiresModule;

/**
 * This is {@link TrustedAuthenticationProperties}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@RequiresModule(name = "cas-server-support-trusted-webflow")
public class TrustedAuthenticationProperties extends PersonDirectoryPrincipalResolverProperties {
    private static final long serialVersionUID = 279410895614233349L;

    /**
     * Indicates the name of the request header that may be extracted from the request
     * as the indicated authenticated userid from the remote authn system.
     */
    private String remotePrincipalHeader;

    /**
     * Indicates the name of the authentication handler.
     */
    private String name;

    public String getName() {
        return name;
    }

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

    public String getRemotePrincipalHeader() {
        return remotePrincipalHeader;
    }

    public void setRemotePrincipalHeader(final String remotePrincipalHeader) {
        this.remotePrincipalHeader = remotePrincipalHeader;
    }
}


text:
import pie

@pie.eventhandler('pie.PlayerConnect')
async def on_player_connect(server, player):

    server.chat_send('Welcome ' + player.nickname)

@pie.chatcommand('/welcome')
async def cmd_welcome(server, player):

    server.chat_send('Welcome ' + player.nickname, player)
    await server.rpc.sdfsfsdf()

@pie.chatcommand('/muffin')
async def cmd_muffin(server, player, login):

    server.chat_send('Muffin for ' + server.player_from_login(login).nickname)


text:
WRAP_CLASS("itk::VectorContainer")
WRAP_TEMPLATE("UCD" "unsigned char,double")
WRAP_TEMPLATE("UID" "unsigned int,double")
WRAP_TEMPLATE("UIVD1" "unsigned int,Templates::VectorD1")
WRAP_TEMPLATE("UIVD2" "unsigned int,Templates::VectorD2")
WRAP_TEMPLATE("UIVF1" "unsigned int,Templates::VectorF1")
WRAP_TEMPLATE("UIVF2" "unsigned int,Templates::VectorF2")
WRAP_TEMPLATE("UIVUC1" "unsigned int,Templates::VectorUC1")
WRAP_TEMPLATE("ULD" "unsigned long,double")
WRAP_TEMPLATE("ULF" "unsigned long,float")
WRAP_TEMPLATE("ULSI" "unsigned long,int")
WRAP_TEMPLATE("ULPD1" "unsigned long,Templates::PointD1")
WRAP_TEMPLATE("ULPD2" "unsigned long,Templates::PointD2")
WRAP_TEMPLATE("ULPD3" "unsigned long,Templates::PointD3")
WRAP_TEMPLATE("ULPD4" "unsigned long,Templates::PointD4")
WRAP_TEMPLATE("ULPF2" "unsigned long,Templates::PointF2")
WRAP_TEMPLATE("ULPF3" "unsigned long,Templates::PointF3")
WRAP_TEMPLATE("ULVD2" "unsigned long,Templates::VectorD2")
WRAP_TEMPLATE("ULVD3" "unsigned long,Templates::VectorD3")
WRAP_TEMPLATE("ULVD4" "unsigned long,Templates::VectorD4")
WRAP_TEMPLATE("ULUL" "unsigned long,unsigned long")
WRAP_TEMPLATE("ULUS" "unsigned long,unsigned short")
END_WRAP_CLASS()


text:
void addDelayFunction(void (*funct)(), int ms);
void removeDelayFunction(void (*funct)());
void delayedFunctInit();
void execDelayFunction();