text:
'use strict';

angular.module('lemur')
  .controller('CertificateExportController', function ($scope, $uibModalInstance, CertificateApi, CertificateService, PluginService, FileSaver, Blob, toaster, editId) {
    CertificateApi.get(editId).then(function (certificate) {
      $scope.certificate = certificate;
    });

    PluginService.getByType('export').then(function (plugins) {
      $scope.plugins = plugins;
    });

    $scope.cancel = function () {
      $uibModalInstance.dismiss('cancel');
    };

    $scope.save = function (certificate) {
      CertificateService.export(certificate).then(
        function (response) {
            var byteCharacters = atob(response.data);
            var byteArrays = [];

            for (var offset = 0; offset < byteCharacters.length; offset += 512) {
              var slice = byteCharacters.slice(offset, offset + 512);

              var byteNumbers = new Array(slice.length);
              for (var i = 0; i < slice.length; i++) {
                byteNumbers[i] = slice.charCodeAt(i);
              }

              var byteArray = new Uint8Array(byteNumbers);

              byteArrays.push(byteArray);
            }

          var blob = new Blob(byteArrays, {type: 'application/octet-stream'});
          FileSaver.saveAs(blob, certificate.name + '.' + response.extension);
          $scope.passphrase = response.passphrase;
        },
        function (response) {
          toaster.pop({
            type: 'error',
            title: certificate.name,
            body: 'lemur-bad-request',
            bodyOutputType: 'directive',
            directiveData: response.data,
            timeout: 100000
          });
        });
    };
  })
  .controller('CertificateEditController', function ($scope, $uibModalInstance, CertificateApi, CertificateService, DestinationService, NotificationService, toaster, editId) {
    CertificateApi.get(editId).then(function (certificate) {
      $scope.certificate = certificate;
    });

    $scope.cancel = function () {
      $uibModalInstance.dismiss('cancel');
    };

    $scope.save = function (certificate) {
      CertificateService.update(certificate).then(
        function () {
          toaster.pop({
            type: 'success',
            title: certificate.name,
            body: 'Successfully updated!'
          });
          $uibModalInstance.close();
        },
        function (response) {
          toaster.pop({
            type: 'error',
            title: certificate.name,
            body: 'lemur-bad-request',
            bodyOutputType: 'directive',
            directiveData: response.data,
            timeout: 100000
          });
        });
    };

    $scope.certificateService = CertificateService;
    $scope.destinationService = DestinationService;
    $scope.notificationService = NotificationService;
  })

  .controller('CertificateCreateController', function ($scope, $uibModalInstance, CertificateApi, CertificateService, DestinationService, AuthorityService, AuthorityApi, PluginService, MomentService, WizardHandler, LemurRestangular, NotificationService, toaster) {
    $scope.certificate = LemurRestangular.restangularizeElement(null, {}, 'certificates');
    // set the defaults
    CertificateService.getDefaults($scope.certificate);

    $scope.cancel = function () {
      $uibModalInstance.dismiss('cancel');
    };

    $scope.getAuthoritiesByName = function (value) {
      return AuthorityService.findActiveAuthorityByName(value).then(function (authorities) {
        $scope.authorities = authorities;
      });
    };

    $scope.dateOptions = {
      formatYear: 'yy',
      maxDate: new Date(2020, 5, 22),
      minDate: new Date(),
      startingDay: 1
    };

    $scope.open1 = function() {
      $scope.popup1.opened = true;
    };

    $scope.open2 = function() {
      $scope.popup2.opened = true;
    };

    $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
    $scope.format = $scope.formats[0];
    $scope.altInputFormats = ['M!/d!/yyyy'];

    $scope.popup1 = {
      opened: false
    };

    $scope.popup2 = {
      opened: false
    };

    $scope.clearDates = function () {
      $scope.certificate.validityStart = null;
      $scope.certificate.validityEnd = null;
      $scope.certificate.validityYears = null;
    };

    $scope.create = function (certificate) {
      WizardHandler.wizard().context.loading = true;
      CertificateService.create(certificate).then(
        function () {
          toaster.pop({
            type: 'success',
            title: certificate.name,
            body: 'Successfully created!'
          });
          $uibModalInstance.close();
        },
        function (response) {
          toaster.pop({
            type: 'error',
            title: certificate.name,
            body: 'lemur-bad-request',
            bodyOutputType: 'directive',
            directiveData: response.data,
            timeout: 100000
          });

          WizardHandler.wizard().context.loading = false;
        });
    };

    $scope.templates = [
      {
        'name': 'Client Certificate',
        'description': '',
        'extensions': {
          'basicConstraints': {},
          'keyUsage': {
            'useDigitalSignature': true
          },
          'extendedKeyUsage': {
            'useClientAuthentication': true
          },
          'subjectKeyIdentifier': {
            'includeSKI': true
          }
        }
      },
      {
        'name': 'Server Certificate',
        'description': '',
        'extensions' : {
          'basicConstraints': {},
          'keyUsage': {
            'useKeyEncipherment': true,
            'useDigitalSignature': true
          },
          'extendedKeyUsage': {
            'useServerAuthentication': true
          },
          'subjectKeyIdentifier': {
            'includeSKI': true
          }
        }
      }
    ];

    PluginService.getByType('destination').then(function (plugins) {
        $scope.plugins = plugins;
    });

    $scope.certificateService = CertificateService;
    $scope.authorityService = AuthorityService;
    $scope.destinationService = DestinationService;
    $scope.notificationService = NotificationService;
  })

.controller('CertificateCloneController', function ($scope, $uibModalInstance, CertificateApi, CertificateService, DestinationService, AuthorityService, AuthorityApi, PluginService, MomentService, WizardHandler, LemurRestangular, NotificationService, toaster, editId) {
  CertificateApi.get(editId).then(function (certificate) {
    $scope.certificate = certificate;
    $scope.certificate.name = ''; // we should prefer the generated name
    $scope.certificate.validityStart = null;
    $scope.certificate.validityEnd = null;
    CertificateService.getDefaults($scope.certificate);
  });

  $scope.cancel = function () {
    $uibModalInstance.dismiss('cancel');
  };

  $scope.getAuthoritiesByName = function (value) {
    return AuthorityService.findAuthorityByName(value).then(function (authorities) {
      $scope.authorities = authorities;
    });
  };

  $scope.dateOptions = {
    formatYear: 'yy',
    maxDate: new Date(2020, 5, 22),
    minDate: new Date(),
    startingDay: 1
  };

  $scope.open1 = function() {
    $scope.popup1.opened = true;
  };

  $scope.open2 = function() {
    $scope.popup2.opened = true;
  };

  $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
  $scope.format = $scope.formats[0];
  $scope.altInputFormats = ['M!/d!/yyyy'];

  $scope.popup1 = {
    opened: false
  };

  $scope.popup2 = {
    opened: false
  };

  $scope.clearDates = function () {
    $scope.certificate.validityStart = null;
    $scope.certificate.validityEnd = null;
    $scope.certificate.validityYears = null;
  };

  $scope.create = function (certificate) {
    WizardHandler.wizard().context.loading = true;
    CertificateService.create(certificate).then(
      function () {
        toaster.pop({
          type: 'success',
          title: certificate.name,
          body: 'Successfully created!'
        });
        $uibModalInstance.close();
      },
      function (response) {
        toaster.pop({
          type: 'error',
          title: certificate.name,
          body: 'lemur-bad-request',
          bodyOutputType: 'directive',
          directiveData: response.data,
          timeout: 100000
        });

        WizardHandler.wizard().context.loading = false;
      });
  };

  $scope.templates = [
    {
      'name': 'Client Certificate',
      'description': '',
      'extensions': {
        'basicConstraints': {},
        'keyUsage': {
          'useDigitalSignature': true
        },
        'extendedKeyUsage': {
          'useClientAuthentication': true
        },
        'subjectKeyIdentifier': {
          'includeSKI': true
        }
      }
    },
    {
      'name': 'Server Certificate',
      'description': '',
      'extensions' : {
        'basicConstraints': {},
        'keyUsage': {
          'useKeyEncipherment': true,
          'useDigitalSignature': true
        },
        'extendedKeyUsage': {
          'useServerAuthentication': true
        },
        'subjectKeyIdentifier': {
          'includeSKI': true
        }
      }
    }
  ];

  PluginService.getByType('destination').then(function (plugins) {
    $scope.plugins = plugins;
  });

  $scope.certificateService = CertificateService;
  $scope.authorityService = AuthorityService;
  $scope.destinationService = DestinationService;
  $scope.notificationService = NotificationService;
})

.controller('CertificateRevokeController', function ($scope, $uibModalInstance, CertificateApi, CertificateService, LemurRestangular, NotificationService, toaster, revokeId) {
  CertificateApi.get(revokeId).then(function (certificate) {
    $scope.certificate = certificate;
  });

  $scope.cancel = function () {
    $uibModalInstance.dismiss('cancel');
  };

  $scope.revoke = function (certificate) {
   CertificateService.revoke(certificate).then(
      function () {
        toaster.pop({
          type: 'success',
          title: certificate.name,
          body: 'Successfully revoked!'
        });
        $uibModalInstance.close();
      },
      function (response) {
        toaster.pop({
          type: 'error',
          title: certificate.name,
          body: 'lemur-bad-request',
          bodyOutputType: 'directive',
          directiveData: response.data,
          timeout: 100000
        });
      });
  };
});


text:
package ws.antonov.config.consumer;

import com.google.protobuf.Message;
import ws.antonov.config.api.consumer.ConfigClient;
import ws.antonov.config.api.consumer.ConfigParamsBuilder;
import ws.antonov.config.api.provider.ConfigProvider;

import java.util.*;

public class CachingConfigClientWrapper implements ConfigClient {
    private ConfigClient clientDelegate;
    private Map<CacheKey, Message> objectCache;
    private Set<CacheKey> negativeCache;

    public CachingConfigClientWrapper(ConfigClient clientDelegate) {
        this(clientDelegate, new HashMap<CacheKey, Message>(), new HashSet<CacheKey>());
    }

    public CachingConfigClientWrapper(ConfigClient clientDelegate, Map<CacheKey, Message> objectCache, Set<CacheKey> negativeCache) {
        this.clientDelegate = clientDelegate;
        this.objectCache = objectCache;
        this.negativeCache = negativeCache;
    }

    @SuppressWarnings({"unchecked"})
    @Override
    public <U extends Message> U getConfig(Class<U> configClass, ConfigParamsBuilder.ConfigParamsMap configParams) {
        CacheKey key = new CacheKey(configClass, configParams);
        Message data = objectCache.get(key);
        if (data == null) {
            if (!negativeCache.contains(key)) {
                data = clientDelegate.getConfig(configClass, configParams);
                if (data != null) {
                    objectCache.put(key, data);
                } else {
                    negativeCache.add(key);
                }
            }
        }
        return (U) data;
    }

    @Override
    public ConfigProvider getConfigProvider() {
        return clientDelegate.getConfigProvider();
    }

    public boolean reloadConfig() {
        this.clearCache();
        return true;
    }

    public synchronized void clearCache() {
        this.objectCache.clear();
        this.negativeCache.clear();
    }

    public ConfigClient getClientDelegate() {
        return clientDelegate;
    }

    /**
     * @return an immutable version of the underlying object cache
     */
    public Map<CacheKey, Message> getObjectCache() {
        return Collections.unmodifiableMap(objectCache);
    }

    /**
     * @return an immutable version of the underlying negative/missed request cache
     */
    public Set<CacheKey> getNegativeCache() {
        return Collections.unmodifiableSet(negativeCache);
    }

    public class CacheKey {
        private Class configClass;
        private ConfigParamsBuilder.ConfigParamsMap configParams;

        public CacheKey(Class configClass, ConfigParamsBuilder.ConfigParamsMap configParams) {
            this.configClass = configClass;
            this.configParams = configParams;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            CacheKey cacheKey = (CacheKey) o;

            if (configClass != null ? !configClass.equals(cacheKey.configClass) : cacheKey.configClass != null)
                return false;
            if (configParams != null ? !configParams.equals(cacheKey.configParams) : cacheKey.configParams != null)
                return false;

            return true;
        }

        @Override
        public int hashCode() {
            int result = configClass != null ? configClass.hashCode() : 0;
            result = 31 * result + (configParams != null ? configParams.hashCode() : 0);
            return result;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
class AddNewFieldsToServiceLearningPositions < ActiveRecord::Migration
  def self.up
    add_column :service_learning_positions, :context_description, :text
    add_column :service_learning_positions, :impact_description, :text
    add_column :service_learning_positions, :skills_requirement, :text
    add_column :service_learning_positions, :ideal_number_of_slots, :integer
    add_column :service_learning_positions, :background_check_required, :boolean
    add_column :service_learning_positions, :tb_test_required, :boolean
    add_column :service_learning_positions, :paperwork_requirement, :text
    add_column :service_learning_positions, :time_commitment_requirement, :string
    add_column :service_learning_orientations, :different_orientation_contact, :boolean
    add_column :service_learning_orientations, :organization_contact_id, :integer
    add_column :service_learning_orientations, :different_orientation_location, :boolean
    add_column :service_learning_positions, :in_progress, :boolean
    ServiceLearningPosition::Deleted.update_columns
    ServiceLearningOrientation::Deleted.update_columns
  end

  def self.down
    remove_column :service_learning_positions, :in_progress
    remove_column :service_learning_orientations, :different_orientation_location
    remove_column :service_learning_orientations, :organization_contact_id
    remove_column :service_learning_orientations, :different_orientation_contact
    remove_column :service_learning_positions, :time_commitment_requirement
    remove_column :service_learning_positions, :paperwork_requirement
    remove_column :service_learning_positions, :tb_test_required
    remove_column :service_learning_positions, :background_check_required
    remove_column :service_learning_positions, :ideal_number_of_slots
    remove_column :service_learning_positions, :skills_requirement
    remove_column :service_learning_positions, :impact_description
    remove_column :service_learning_positions, :context_description
    ServiceLearningPosition::Deleted.update_columns
    ServiceLearningOrientation::Deleted.update_columns
  end
end


text:
<?php

namespace Elektra\SeedBundle\Definition\Requests;

use Elektra\CrudBundle\Crud\Definition;

class RequestDefinition extends Definition
{

    public function __construct()
    {

        parent::__construct('Elektra', 'Seed', 'Requests', 'Request');

        // single route (add / view / edit / delete)
        $this->setRouteSingular('request');

        // root definition -> need a plural route
        $this->setRoot();
        $this->setRoutePlural('requests');
    }
}


text:
package org.kuali.kpme.pm.pstnqlfctnvl.dao;

import org.kuali.kpme.pm.pstnqlfctnvl.PositionQualificationValue;

public interface PositionQualificationValueDao {
	public PositionQualificationValue getPositionQualificationValueByValue(String value);

	public PositionQualificationValue getPositionQualificationValueById(String id);

}


text:
from django.conf.urls import patterns, include, url

from django.contrib import admin
import views
import formIns
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'HomeworkTasker.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$',views.index),
    url(r'^register/',views.register),
    url(r'^loginInput/',formIns.loginForm),
    url(r'^registerInput/',formIns.registerForm),
    url(r'^addSubject/',formIns.addSubject),
    url(r'^addAssignment/',formIns.addAssignment),
    url(r'^removeAssignment/',formIns.removeAssignment),
    url(r'^sortTasks/',formIns.sortTasks),
    url(r'^removeSubject/',formIns.removeSubject),
)


text:
package edu.teco.dnd.eclipse.appView;

import java.util.Collection;
import java.util.Collections;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

import edu.teco.dnd.eclipse.DisplayUtil;
import edu.teco.dnd.eclipse.TypecastingWidgetDataStore;
import edu.teco.dnd.module.ModuleID;
import edu.teco.dnd.network.ConnectionManager;
import edu.teco.dnd.network.UDPMulticastBeacon;
import edu.teco.dnd.server.ApplicationInformation;
import edu.teco.dnd.server.ApplicationManager;
import edu.teco.dnd.server.ApplicationManagerListener;
import edu.teco.dnd.server.BlockInformation;
import edu.teco.dnd.server.ServerState;
import edu.teco.dnd.server.ServerStateListener;

/**
 * This class is used to update the Tree used by {@link ApplicationView}.
 *
 * @author Philipp Adolf
 */
// TODO: Add module names
class ApplicationTreeUpdater implements ServerStateListener, ApplicationManagerListener {
	private static final Logger LOGGER = LogManager.getLogger(ApplicationTreeUpdater.class);

	public static final TypecastingWidgetDataStore<ApplicationInformation> APPLICATION_INFORMATION_STORE =
			new TypecastingWidgetDataStore<ApplicationInformation>(ApplicationInformation.class, "application");

	private ApplicationManager applicationManager = null;
	private volatile Tree applicationTree = null;

	/**
	 * Sets the ApplicationManager that should be used. This method is thread-safe and will update applicationTree if it
	 * has been set.
	 *
	 * @param applicationManager
	 *            the new ApplicationManager to use
	 * @see #setApplicationTree(Tree)
	 */
	synchronized void setApplicationManager(final ApplicationManager applicationManager) {
		LOGGER.entry(applicationManager);
		if (this.applicationManager != null) {
			this.applicationManager.removeApplicationListener(this);
		}

		this.applicationManager = applicationManager;
		if (this.applicationManager != null) {
			this.applicationManager.addApplicationListener(this);

			fillTree(this.applicationManager.getApplications());
		} else {
			fillTree(Collections.<ApplicationInformation> emptyList());
		}
		LOGGER.exit();
	}

	/**
	 * Sets the Tree object that should be filled with the Applications. If an ApplicationManager has been set, the Tree
	 * is automatically filled. This method is thread-safe.
	 *
	 * @param applicationTree
	 *            the Tree object that should be filled with the Application data
	 * @see #setApplicationManager(ApplicationManager)
	 */
	synchronized void setApplicationTree(final Tree applicationTree) {
		this.applicationTree = applicationTree;
		if (applicationManager == null) {
			fillTree(Collections.<ApplicationInformation> emptyList());
		} else {
			fillTree(applicationManager.getApplications());
		}
	}

	@Override
	public void applicationsResolved(final Collection<ApplicationInformation> apps) {
		LOGGER.entry(apps);
		fillTree(apps);
		LOGGER.exit();
	}

	@Override
	public synchronized void serverStateChanged(final ServerState state, final ConnectionManager connectionManager,
			final UDPMulticastBeacon beacon) {
		switch (state) {
		case STOPPING:
		case STOPPED:
			fillTree(Collections.<ApplicationInformation> emptyList());
		}
	}

	/**
	 * Fills the tree with the given ApplicationInformation. Old information is discarded first.
	 *
	 * @param applications
	 *            the Applications that should be displayed
	 */
	private void fillTree(final Collection<ApplicationInformation> applications) {
		LOGGER.entry(applications);
		assert applications != null;

		final Tree localApplicationTree;
		synchronized (this) {
			localApplicationTree = applicationTree;
		}

		if (localApplicationTree == null) {
			LOGGER.debug("applicationTree is null");
		} else {
			DisplayUtil.getDisplay().asyncExec(new Runnable() {
				@Override
				public void run() {
					localApplicationTree.removeAll();

					for (final ApplicationInformation application : applicationManager.getApplications()) {
						addApplication(localApplicationTree, application);
					}

					localApplicationTree.update();
				}
			});
		}
		LOGGER.exit();
	}

	/**
	 * Adds a single Application to the tree.
	 *
	 * @param applicationInformation
	 *            the Application to add
	 */
	private void addApplication(final Tree tree, final ApplicationInformation applicationInformation) {
		LOGGER.entry(applicationInformation);
		assert tree != null;
		assert applicationInformation != null;

		LOGGER.debug("adding TableItem for {} to {}", applicationInformation, applicationTree);
		final TreeItem applicationItem = new TreeItem(tree, SWT.NONE);
		applicationItem.setText(0, applicationInformation.getName() + " (" + applicationInformation.getID().getUUID() + ")");
		APPLICATION_INFORMATION_STORE.store(applicationItem, applicationInformation);
		for (final ModuleID moduleID : applicationInformation.getModules()) {
			addModule(applicationItem, applicationInformation, moduleID);
		}

		LOGGER.exit();
	}

	/**
	 * Adds a single Module to an Application TreeItem.
	 *
	 * @param applicationItem
	 *            the TreeItem of the Application this Module TreeItem should be added to
	 * @param applicationInformation
	 *            the ApplicationInformation for the Application
	 * @param moduleID
	 *            the ID of the Module that should be added by this method
	 */
	private void addModule(final TreeItem applicationItem, final ApplicationInformation applicationInformation,
			final ModuleID moduleID) {
		LOGGER.trace("adding TableItem for module {} to {}", moduleID, applicationItem);
		final TreeItem moduleItem = new TreeItem(applicationItem, SWT.NONE);
		moduleItem.setText("" + moduleID);
		for (final BlockInformation block : applicationInformation.getBlocks(moduleID)) {
			addBlock(moduleItem, applicationInformation, block);
		}
	}

	/**
	 * Adds a single FunctionBlock to an Module TreeItem.
	 *
	 * @param moduleItem
	 *            the TreeItem of the Module this FunctionBlock TreeItem should be added to
	 * @param applicationInformation
	 *            the ApplicationInformation of the Application this block belongs to
	 * @param blockID
	 *            the ID of the FunctionBlock that should be added by this method
	 */
	private void addBlock(final TreeItem moduleItem, final ApplicationInformation applicationInformation,
			final BlockInformation block) {
		LOGGER.trace("adding TableItem for block {} to {}", block, moduleItem);
		final TreeItem blockItem = new TreeItem(moduleItem, SWT.NONE);
		blockItem.setText(block.getName() + " (" + block.getID() + ")");
	}
}


text:
public class Flight {

}


text:
require 'boundy/comparator'

module Boundy
  class Range
    class Comparator
      def self.type
        ::Range
      end

      include Boundy::Comparator

      def initialize(domain, range)
        if domain.nil?
          raise
        end

        if range.nil?
          raise
        end

        other = Boundy::Domain.new(range.begin, range.end)
        @comparator = Boundy::Domain::Comparator.new(domain, other)
      end

      def after?
        @comparator.after?
      end

      def before?
        @comparator.before?
      end

      def within?
        @comparator.within?
      end
    end
  end
end


text:
layout: default
title: Flex Box
subnav:
  - Container
  - Items
---

Flexbox is perfect for aligning items inside components. It typically isn't used for large scale layouts but for smaller parts of a page or component. All of the flex box utility classes can be used with our breakpoint suffixes. In some cases, adding an auto margin to a side is needed to align content. In that case, check out auto margins.

Flex Container

This is the parent of the items that will be laid out using flex box.

Display

Defines the flex container and enables a flex context for all of its direct children. To apply this to a container with block, use .flex-block-xs. To apply it with inline, use .flex-inline-xs

<div class="flex-block-xs">
  <!-- Children -->
</div>

<div class="flex-inline-xs">
  <!-- Children -->
</div>

Flex Direction

This establishes the main-axis, which defines the direction items are palces in the container. Flex lays out in a single direction, either horizontal or vertical.

        Class
        Description

        .flex-row-xs
        (Default) Left to right

        .flex-row-reverse-xs
        Right to left

        .flex-column-xs
        Same as .flex-row-xs but top to bottom

        .flex-column-reverse-xs
        Same as .flex-row-reverse-xs but bottom to top

1

2

3

4

1

2

3

4

<div class="flex-block-xs border-xs p-1-xs">
  <div class="border-dark-xs text-center-xs m-r-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-r-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-r-05-xs">3</div>
  <div class="border-dark-xs text-center-xs">4</div>
</div>
<div class="flex-block-xs flex-column-xs border-xs border-none-t-xs p-1-xs">
  <div class="border-dark-xs text-center-xs m-b-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-b-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-b-05-xs">3</div>
  <div class="border-dark-xs text-center-xs">4</div>
</div>

Flex Wrap

Flex items will all fit into one line by default. To change that behavior and allow them to wrap, you'll need to add some properties. Flex direction plays a role here by defining the direction new line are stacked.

        Class
        Description

        .flex-nowrap-xs
        (Default) Single-line with no wrapping

        .flex-wrap-xs
        Multi-line from left to right

        .flex-wrap-reverse-xs
        Multi-line from right to left

1

2

3

4

1

2

3

4

<div class="flex-block-xs flex-wrap-xs border-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs">4</div>
</div>
<div class="flex-block-xs flex-wrap-reverse-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs">4</div>
</div>

Justify Content

This defines the alignment along the main axis and helps distribute space around the flex items.

        Class
        Description

        .flex-justify-start-xs
        (Default) Items are packed toward the start line

        .flex-justify-end-xs
        Items are packed toward the end line

        .flex-justify-center-xs
        Items are centered along the line

        .flex-justify-between-xs
        Items are evenly distributed in the line. First item on the start line, last item on the end line.

        .flex-justify-around-xs
        Items are evently distributed in the line with equal space around them. Note that visually the spaces aren't equal because each item has equal space on both sides.

1

2

3

1

2

3

1

2

3

1

2

3

1

2

3

<div class="flex-block-xs flex-justify-start-xs border-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
</div>
<div class="flex-block-xs flex-justify-end-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
</div>
<div class="flex-block-xs flex-justify-center-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
</div>
<div class="flex-block-xs flex-justify-between-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
</div>
<div class="flex-block-xs flex-justify-around-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
</div>

Align Items

This defines how flex items are laid out along the cross axis on the current line.

        Class
        Description

        .flex-item-start-xs
        Cross-start margin edge of the items is placed on the cross-start line

        .flex-item-end-xs
        Cross-end margin edge of the items is placed on the cross-end line

        .flex-item-center-xs
        Items are centered in the cross-axis

        .flex-item-stretch-xs
        (Default) Stretch to fill the container but still respects min/max-width

        .flex-item-baseline-xs
        Items are aligned such as their baselines align

1
2

3

4
5

1
2

3

4
5

1
2

3

4
5

1
2

3

4
5

1
2

3

4
5

<div class="flex-block-xs flex-item-start-xs border-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs flex-item-end-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs flex-item-center-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs flex-item-stretch-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs flex-item-baseline-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 70px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 100px;">4<br>5</div>
</div>

Align Content

This aligns a flex container's lines within when there is extra space in the cross-axis, similar to how justify-content aligns items within the main axis. Note: this property has no effect when there is only one line of flex items.

        Class
        Description

        .flex-content-start-xs
        Lines packed to the start of the container

        .flex-content-end-xs
        Lines packed to the end of the container

        .flex-content-center-xs
        Lines packed to the center of the container

        .flex-content-around-xs
        Lines evenly distributed with the first line at the start and the last at the end of the container.

        .flex-content-between-xs
        Lines evenly distributed with equal space around each line.

        .flex-content-stretch-xs
        (Default) Lines stretch to take up the remaining space

1

2

3

4

5

1

2

3

4

5

1

2

3

4

5

1

2

3

4

5

1

2

3

4

5

<div class="flex-block-xs flex-content-start-xs flex-wrap-xs border-xs p-05-xs" style="min-height:300px;">
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 500px; line-height: 50px;">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 150px; line-height: 50px;">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 200px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 300px; line-height: 50px;">4</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 400px; line-height: 50px;">5</div>
</div>
<div class="flex-block-xs flex-content-end-xs flex-wrap-xs border-xs p-05-xs" style="min-height:300px;">
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 500px; line-height: 50px;">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 150px; line-height: 50px;">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 200px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 300px; line-height: 50px;">4</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 400px; line-height: 50px;">5</div>
</div>
<div class="flex-block-xs flex-content-center-xs flex-wrap-xs border-xs p-05-xs" style="min-height:300px;">
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 500px; line-height: 50px;">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 150px; line-height: 50px;">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 200px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 300px; line-height: 50px;">4</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 400px; line-height: 50px;">5</div>
</div>
<div class="flex-block-xs flex-content-around-xs flex-wrap-xs border-xs p-05-xs" style="min-height:300px;">
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 500px; line-height: 50px;">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 150px; line-height: 50px;">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 200px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 300px; line-height: 50px;">4</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 400px; line-height: 50px;">5</div>
</div>
<div class="flex-block-xs flex-content-between-xs flex-wrap-xs border-xs p-05-xs" style="min-height:300px;">
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 500px; line-height: 50px;">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 150px; line-height: 50px;">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 200px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 300px; line-height: 50px;">4</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="height: 50px; width: 400px; line-height: 50px;">5</div>
</div>

Flex Items

These are the children of the parent container. Flex items are what take on the flexible box layout for components and pages.

Order

By default, items are laid out in source order. By using the order property, we can control the order inside the flex container. Leap contains built in ordering classes of .flex-order-[n]-xs, where n is an integer from 1 to 6. Any item without an order will default to 1 and matching orders will be grouped together in the appropriate order. You can rearrange the order across breakpoints with breakpoint suffixes.

1

2

3

4

1

2

3

4

1

2

3

4

<div class="flex-block-xs border-xs p-05-xs">
  <div class="flex-order-2-xs border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs">4</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="flex-order-4-xs border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-order-1-xs border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="flex-order-2-xs border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="flex-order-3-xs border-dark-xs text-center-xs m-05-xs">4</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="flex-order-2-lg border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-order-1-lg border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="flex-order-1-lg border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="flex-order-2-lg border-dark-xs text-center-xs m-05-xs">4</div>
</div>

Flex Grow

This property lets an item grow if necessary. It accepts a unitless value that serves as a proportion. The default is 0.

1

2

3

4

1

2

3

4

1

2

3

4

<div class="flex-block-xs border-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-grow-1-xs border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="flex-grow-2-xs border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs">4</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="flex-grow-6-xs border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-grow-3-xs border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="flex-grow-1-xs border-dark-xs text-center-xs m-05-xs">4</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-grow-2-lg border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="flex-grow-4-lg border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs">4</div>
</div>

Flex Shrink

This property lets an item shrink if necessary. It accepts a unitless value that serves as a proportion. The default is 1.

1

2

3

4

1

2

3

4

1

2

3

4

<div class="flex-block-xs border-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-shrink-2-xs border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="flex-shrink-2-xs border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs">4</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="flex-shrink-4-xs border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-shrink-3-xs border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="flex-shrink-2-xs border-dark-xs text-center-xs m-05-xs">4</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs">1</div>
  <div class="flex-shrink-2-lg border-dark-xs text-center-xs m-05-xs">2</div>
  <div class="flex-shrink-4-lg border-dark-xs text-center-xs m-05-xs">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs">4</div>
</div>

Flex Basis

This property defines the default size of an element before the remaining space is distributed. It can be a length or keyword, like "auto". The default is auto. To use percentages, use the same widths we have available in our .col classes, like .flex-basis-20-xs. To use our default spacing units, try .flex-basis-s2-xs.

1

2

3

1

2

3

<div class="flex-block-xs border-xs p-05-xs">
  <div class="flex-basis-33-xs flex-basis-20-lg border-dark-xs text-center-xs m-05-xs" style="height: 50px; line-height: 50px;">1</div>
  <div class="flex-basis-33-xs flex-basis-60-lg border-dark-xs text-center-xs m-05-xs" style="height: 50px; line-height: 50px;">2</div>
  <div class="flex-basis-33-xs flex-basis-20-lg border-dark-xs text-center-xs m-05-xs" style="height: 50px; line-height: 50px;">3</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="flex-basis-s2-xs border-dark-xs text-center-xs m-05-xs" style="height: 50px; line-height: 50px;">1</div>
  <div class="flex-basis-s4-xs border-dark-xs text-center-xs m-05-xs" style="height: 50px; line-height: 50px;">2</div>
  <div class="flex-basis-s6-xs border-dark-xs text-center-xs m-05-xs" style="height: 50px; line-height: 50px;">3</div>
</div>

Align Self

This allows individual flex items to have their own unique alignment within the container. This also overrides the container align-items property.

        Class
        Description

        .flex-self-auto-xs
        (Default) Auto align, which inherits the align-items property

        .flex-self-start-xs
        Cross-start margin edge of the flex item is placed on the cross-start line (align-self: flex-start)

        .flex-self-start-flush-xs
        Cross-start margin edge of the item is placed on the cross-start line (align-self: start)

        .flex-self-end-xs
        Cross-end margin edge of the flex item is placed on the cross-end line (align-self: flex-end)

        .flex-self-end-flush-xs
        Cross-end margin edge of the item is placed on the cross-end line (align-self: end)

        .flex-self-center-xs
        Items are centered in the cross-axis

        .flex-self-stretch-xs
        Stretch to fill the container but still respects min/max-width

        .flex-self-baseline-xs
        Items are aligned such as their baselines align

1
2

3

4
5

1
2

3

4
5

1
2

3

4
5

1
2

3

4
5

1
2

3

4
5

<div class="flex-block-xs border-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="flex-self-start-xs border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="flex-self-end-xs border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="flex-self-center-xs border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="flex-self-stretch-xs border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>
<div class="flex-block-xs border-xs border-none-t-xs p-05-xs">
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">1<br>2</div>
  <div class="flex-self-baseline-xs border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">3</div>
  <div class="border-dark-xs text-center-xs m-05-xs" style="width: 50px; line-height: 50px;">4<br>5</div>
</div>


text:
package org.apache.kafka.streams.integration;

import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.errors.TimeoutException;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.KeyValue;
import org.apache.kafka.streams.StreamsBuilder;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.ThreadMetadata;
import org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse;
import org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster;
import org.apache.kafka.streams.integration.utils.IntegrationTestUtils;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.Transformer;
import org.apache.kafka.streams.processor.ProcessorContext;
import org.apache.kafka.streams.processor.PunctuationType;
import org.apache.kafka.streams.processor.internals.testutil.LogCaptureAppender;
import org.apache.kafka.test.IntegrationTest;
import org.apache.kafka.test.TestUtils;

import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
import org.junit.rules.Timeout;

import java.io.IOException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import static org.apache.kafka.common.utils.Utils.mkEntry;
import static org.apache.kafka.common.utils.Utils.mkMap;
import static org.apache.kafka.common.utils.Utils.mkObjectProperties;
import static org.apache.kafka.streams.integration.utils.IntegrationTestUtils.purgeLocalStreamsState;
import static org.apache.kafka.streams.integration.utils.IntegrationTestUtils.safeUniqueTestName;
import static org.apache.kafka.test.TestUtils.waitForCondition;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

@Category(IntegrationTest.class)
public class AdjustStreamThreadCountTest {
    @Rule
    public Timeout globalTimeout = Timeout.seconds(600);

    public static final EmbeddedKafkaCluster CLUSTER = new EmbeddedKafkaCluster(1);

    @BeforeClass
    public static void startCluster() throws IOException {
        CLUSTER.start();
    }

    @AfterClass
    public static void closeCluster() {
        CLUSTER.stop();
    }

    @Rule
    public TestName testName = new TestName();

    private final List<KafkaStreams.State> stateTransitionHistory = new ArrayList<>();
    private static String inputTopic;
    private static StreamsBuilder builder;
    private static Properties properties;
    private static String appId = "";
    public static final Duration DEFAULT_DURATION = Duration.ofSeconds(30);

    @Before
    public void setup() {
        final String testId = safeUniqueTestName(getClass(), testName);
        appId = "appId_" + testId;
        inputTopic = "input" + testId;
        IntegrationTestUtils.cleanStateBeforeTest(CLUSTER, inputTopic);

        builder = new StreamsBuilder();
        builder.stream(inputTopic);

        properties  = mkObjectProperties(
            mkMap(
                mkEntry(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()),
                mkEntry(StreamsConfig.APPLICATION_ID_CONFIG, appId),
                mkEntry(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getPath()),
                mkEntry(StreamsConfig.NUM_STREAM_THREADS_CONFIG, 2),
                mkEntry(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.StringSerde.class),
                mkEntry(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.StringSerde.class),
                mkEntry(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, 10000)
            )
        );
    }

    private void startStreamsAndWaitForRunning(final KafkaStreams kafkaStreams) throws InterruptedException {
        kafkaStreams.start();
        waitForRunning();
    }

    @After
    public void teardown() throws IOException {
        purgeLocalStreamsState(properties);
    }

    private void addStreamStateChangeListener(final KafkaStreams kafkaStreams) {
        kafkaStreams.setStateListener(
            (newState, oldState) -> stateTransitionHistory.add(newState)
        );
    }

    private void waitForRunning() throws InterruptedException {
        waitForCondition(
            () -> !stateTransitionHistory.isEmpty() &&
                stateTransitionHistory.get(stateTransitionHistory.size() - 1).equals(KafkaStreams.State.RUNNING),
            DEFAULT_DURATION.toMillis(),
            () -> String.format("Client did not transit to state %s in %d seconds",
                KafkaStreams.State.RUNNING, DEFAULT_DURATION.toMillis() / 1000)
        );
    }

    private void waitForTransitionFromRebalancingToRunning() throws InterruptedException {
        waitForRunning();

        final int historySize = stateTransitionHistory.size();
        assertThat("Client did not transit from REBALANCING to RUNNING. The observed state transitions are: " + stateTransitionHistory,
            historySize >= 2 &&
                stateTransitionHistory.get(historySize - 2).equals(KafkaStreams.State.REBALANCING) &&
                stateTransitionHistory.get(historySize - 1).equals(KafkaStreams.State.RUNNING), is(true));
    }

    @Test
    public void shouldAddStreamThread() throws Exception {
        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);

            final int oldThreadCount = kafkaStreams.metadataForLocalThreads().size();
            assertThat(kafkaStreams.metadataForLocalThreads().stream().map(t -> t.threadName().split("-StreamThread-")[1]).sorted().toArray(), equalTo(new String[] {"1", "2"}));

            stateTransitionHistory.clear();
            final Optional<String> name = kafkaStreams.addStreamThread();

            assertThat(name, not(Optional.empty()));
            TestUtils.waitForCondition(
                () -> kafkaStreams.metadataForLocalThreads().stream().sequential()
                    .map(ThreadMetadata::threadName).anyMatch(t -> t.equals(name.orElse(""))),
                "Wait for the thread to be added"
            );
            assertThat(kafkaStreams.metadataForLocalThreads().size(), equalTo(oldThreadCount + 1));
            assertThat(
                kafkaStreams
                    .metadataForLocalThreads()
                    .stream()
                    .map(t -> t.threadName().split("-StreamThread-")[1])
                    .sorted().toArray(),
                equalTo(new String[] {"1", "2", "3"})
            );

            waitForTransitionFromRebalancingToRunning();
        }
    }

    @Test
    public void shouldRemoveStreamThread() throws Exception {
        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);

            final int oldThreadCount = kafkaStreams.metadataForLocalThreads().size();
            stateTransitionHistory.clear();
            assertThat(kafkaStreams.removeStreamThread().get().split("-")[0], equalTo(appId));
            assertThat(kafkaStreams.metadataForLocalThreads().size(), equalTo(oldThreadCount - 1));

            waitForTransitionFromRebalancingToRunning();
        }
    }

    @Test
    public void shouldRemoveStreamThreadWithStaticMembership() throws Exception {
        properties.put(ConsumerConfig.GROUP_INSTANCE_ID_CONFIG, "member-A");
        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);

            final int oldThreadCount = kafkaStreams.metadataForLocalThreads().size();
            stateTransitionHistory.clear();
            assertThat(kafkaStreams.removeStreamThread().get().split("-")[0], equalTo(appId));
            assertThat(kafkaStreams.metadataForLocalThreads().size(), equalTo(oldThreadCount - 1));

            waitForTransitionFromRebalancingToRunning();
        }
    }

    @Test
    public void shouldnNotRemoveStreamThreadWithinTimeout() throws Exception {
        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);
            assertThrows(TimeoutException.class, () -> kafkaStreams.removeStreamThread(Duration.ZERO.minus(DEFAULT_DURATION)));
        }
    }

    @Test
    public void shouldAddAndRemoveThreadsMultipleTimes() throws InterruptedException {
        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);

            final int oldThreadCount = kafkaStreams.metadataForLocalThreads().size();
            stateTransitionHistory.clear();

            final CountDownLatch latch = new CountDownLatch(2);
            final Thread one = adjustCountHelperThread(kafkaStreams, 4, latch);
            final Thread two = adjustCountHelperThread(kafkaStreams, 6, latch);
            two.start();
            one.start();
            latch.await(30, TimeUnit.SECONDS);
            assertThat(kafkaStreams.metadataForLocalThreads().size(), equalTo(oldThreadCount));

            waitForTransitionFromRebalancingToRunning();
        }
    }

    private Thread adjustCountHelperThread(final KafkaStreams kafkaStreams, final int count, final CountDownLatch latch) {
        return new Thread(() -> {
            for (int i = 0; i < count; i++) {
                kafkaStreams.addStreamThread();
                kafkaStreams.removeStreamThread();
            }
            latch.countDown();
        });
    }

    @Test
    public void shouldAddAndRemoveStreamThreadsWhileKeepingNamesCorrect() throws Exception {
        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);

            int oldThreadCount = kafkaStreams.metadataForLocalThreads().size();
            stateTransitionHistory.clear();

            assertThat(
                kafkaStreams.metadataForLocalThreads()
                    .stream()
                    .map(t -> t.threadName().split("-StreamThread-")[1])
                    .sorted()
                    .toArray(),
                equalTo(new String[] {"1", "2"})
            );

            final Optional<String> name = kafkaStreams.addStreamThread();

            assertThat("New thread has index 3", "3".equals(name.get().split("-StreamThread-")[1]));
            TestUtils.waitForCondition(
                () -> kafkaStreams
                    .metadataForLocalThreads()
                    .stream().sequential()
                    .map(ThreadMetadata::threadName)
                    .anyMatch(t -> t.equals(name.get())),
                "Stream thread has not been added"
            );
            assertThat(kafkaStreams.metadataForLocalThreads().size(), equalTo(oldThreadCount + 1));
            assertThat(
                kafkaStreams
                    .metadataForLocalThreads()
                    .stream()
                    .map(t -> t.threadName().split("-StreamThread-")[1])
                    .sorted()
                    .toArray(),
                equalTo(new String[] {"1", "2", "3"})
            );
            waitForTransitionFromRebalancingToRunning();

            oldThreadCount = kafkaStreams.metadataForLocalThreads().size();
            stateTransitionHistory.clear();

            final Optional<String> removedThread = kafkaStreams.removeStreamThread();

            assertThat(removedThread, not(Optional.empty()));
            assertThat(kafkaStreams.metadataForLocalThreads().size(), equalTo(oldThreadCount - 1));
            waitForTransitionFromRebalancingToRunning();

            stateTransitionHistory.clear();

            final Optional<String> name2 = kafkaStreams.addStreamThread();

            assertThat(name2, not(Optional.empty()));
            TestUtils.waitForCondition(
                () -> kafkaStreams.metadataForLocalThreads().stream().sequential()
                    .map(ThreadMetadata::threadName).anyMatch(t -> t.equals(name2.orElse(""))),
                "Wait for the thread to be added"
            );
            assertThat(kafkaStreams.metadataForLocalThreads().size(), equalTo(oldThreadCount));
            assertThat(
                kafkaStreams
                    .metadataForLocalThreads()
                    .stream()
                    .map(t -> t.threadName().split("-StreamThread-")[1])
                    .sorted()
                    .toArray(),
                equalTo(new String[] {"1", "2", "3"})
            );

            assertThat("the new thread should have received the old threads name", name2.equals(removedThread));
            waitForTransitionFromRebalancingToRunning();
        }
    }

    @Test
    public void testConcurrentlyAccessThreads() throws InterruptedException {
        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);
            final int oldThreadCount = kafkaStreams.metadataForLocalThreads().size();
            final int threadCount = 5;
            final int loop = 3;
            final AtomicReference<Throwable> lastException = new AtomicReference<>();
            final ExecutorService executor = Executors.newFixedThreadPool(threadCount);
            for (int threadIndex = 0; threadIndex < threadCount; ++threadIndex) {
                executor.execute(() -> {
                    try {
                        for (int i = 0; i < loop + 1; i++) {
                            if (!kafkaStreams.addStreamThread().isPresent())
                                throw new RuntimeException("failed to create stream thread");
                            kafkaStreams.metadataForLocalThreads();
                            if (!kafkaStreams.removeStreamThread().isPresent())
                                throw new RuntimeException("failed to delete a stream thread");
                        }
                    } catch (final Exception e) {
                        lastException.set(e);
                    }
                });
            }
            executor.shutdown();
            assertTrue(executor.awaitTermination(60, TimeUnit.SECONDS));
            assertNull(lastException.get());
            assertEquals(oldThreadCount, kafkaStreams.metadataForLocalThreads().size());
        }
    }

    @Test
    public void shouldResizeCacheAfterThreadRemovalTimesOut() throws InterruptedException {
        final long totalCacheBytes = 10L;
        final Properties props = new Properties();
        props.putAll(properties);
        props.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, 2);
        props.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, totalCacheBytes);

        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), props)) {
            addStreamStateChangeListener(kafkaStreams);
            startStreamsAndWaitForRunning(kafkaStreams);

            try (final LogCaptureAppender appender = LogCaptureAppender.createAndRegister(KafkaStreams.class)) {
                assertThrows(TimeoutException.class, () -> kafkaStreams.removeStreamThread(Duration.ofSeconds(0)));

                for (final String log : appender.getMessages()) {
                    // all 10 bytes should be available for remaining thread
                    if (log.endsWith("Resizing thread cache due to thread removal, new cache size per thread is 10")) {
                        return;
                    }
                }
            }
        }
        fail();
    }

    @Test
    @SuppressWarnings("deprecation")
    public void shouldResizeCacheAfterThreadReplacement() throws InterruptedException {
        final long totalCacheBytes = 10L;
        final Properties props = new Properties();
        props.putAll(properties);
        props.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, 2);
        props.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, totalCacheBytes);

        final AtomicBoolean injectError = new AtomicBoolean(false);

        final StreamsBuilder builder  = new StreamsBuilder();
        final KStream<String, String> stream = builder.stream(inputTopic);
        stream.transform(() -> new Transformer<String, String, KeyValue<String, String>>() {
                @Override
                public void init(final ProcessorContext context) {
                    context.schedule(Duration.ofSeconds(1), PunctuationType.WALL_CLOCK_TIME, timestamp -> {
                        if (Thread.currentThread().getName().endsWith("StreamThread-1") && injectError.get()) {
                            injectError.set(false);
                            throw new RuntimeException("BOOM");
                        }
                    });
                }

                @Override
                public KeyValue<String, String> transform(final String key, final String value) {
                    return new KeyValue<>(key, value);
                }

                @Override
                public void close() {
                }
            });

        try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), props)) {
            addStreamStateChangeListener(kafkaStreams);
            kafkaStreams.setUncaughtExceptionHandler(e -> StreamThreadExceptionResponse.REPLACE_THREAD);
            startStreamsAndWaitForRunning(kafkaStreams);

            stateTransitionHistory.clear();
            try (final LogCaptureAppender appender = LogCaptureAppender.createAndRegister()) {
                injectError.set(true);
                waitForCondition(() -> !injectError.get(), "StreamThread did not hit and reset the injected error");

                waitForTransitionFromRebalancingToRunning();

                for (final String log : appender.getMessages()) {
                    // after we replace the thread there should be two remaining threads with 5 bytes each
                    if (log.endsWith("Adding StreamThread-3, there will now be 2 live threads and the new cache size per thread is 5")) {
                        return;
                    }
                }
            }
        }
        fail();
    }
}


text: A Maven Archetype for Bukkit.


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

.. _ide:

IDE Integration
===============

.. toctree::
    :maxdepth: 2

    ide/atom
    ide/clion
    ide/codeblocks
    ide/eclipse
    ide/emacs
    ide/netbeans
    ide/qtcreator
    ide/sublimetext
    ide/vim
    ide/visualstudio


text:
module OneviewCookbook
  module API1800
    module Synergy
      # ServerHardware API1800 Synergy provider
      class ServerHardwareProvider < API1600::Synergy::ServerHardwareProvider
      end
    end
  end
end


text:
require File.dirname(__FILE__) + '/test_helper.rb'

class AnnotationAttributeTest < ActiveSupport::TestCase

  def test_annotation_attribute_class_loaded
    assert_kind_of AnnotationAttribute, AnnotationAttribute.new
  end

  def test has_many_annotations_association
    assert_equal 6, annotations_attributes(:aa_tag).annotations.length
    assert_equal 1, annotations_attributes(:aa_contextualtag).annotations.length
  end

  def test_add_duplicates
    assert_not_nil AnnotationAttribute.find_by_name("tag")

    assert_raise ActiveRecord::RecordInvalid do
      AnnotationAttribute.create!(:name => 'Tag')
    end
  end

end


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.05.24 at 08:06:09 AM EDT
//

package com.billybyte.spanjava.generated;

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.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
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 ref="{}sSpread" maxOccurs="unbounded"/>
 *         <element ref="{}dSpread" maxOccurs="unbounded"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "sSpread",
    "dSpread"
})
@XmlRootElement(name = "superSpreads")
public class SuperSpreads {

    @XmlElement(required = true)
    protected List<SSpread> sSpread;
    @XmlElement(required = true)
    protected List<DSpread> dSpread;

    /**
     * Gets the value of the sSpread 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 sSpread property.
     *
     *

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

     *    getSSpread().add(newItem);
     *

     *
     *
     *

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

    /**
     * Gets the value of the dSpread 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 dSpread property.
     *
     *

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

     *    getDSpread().add(newItem);
     *

     *
     *
     *

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

}


text:
from unittest import TestCase
from datetime import timedelta, datetime
from chatterbot import parsing

class DateTimeParsingFunctionIntegrationTestCases(TestCase):
    """
    Test the datetime parseing module.

    Output of the parser is an array of tuples
    [match, value, (start, end)]
    """

    def setUp(self):
        super(DateTimeParsingFunctionIntegrationTestCases, self).setUp()
        self.base_date = datetime.now()

    def test_captured_pattern_is_on_date(self):
        input_text = 'The event is on Monday 12 January 2012'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn('Monday 12 January 2012', parser[0])
        self.assertEqual(parser[0][1], datetime(2012, 1, 12))
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_this_weekday(self):
        input_text = 'This monday'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d-%m-%y'),
            parsing.this_week_day(self.base_date, 0).strftime('%d-%m-%y')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_last_weekday(self):
        input_text = 'Last monday'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d-%m-%y'),
            parsing.previous_week_day(self.base_date, 0).strftime('%d-%m-%y')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_next_weekday(self):
        input_text = 'Next monday'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d-%m-%y'),
            parsing.next_week_day(self.base_date, 0).strftime('%d-%m-%y')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_minutes_from_now(self):
        input_text = '25 minutes from now'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d-%m-%y'),
            parsing.date_from_duration(
                self.base_date, 25, 'minutes', 'from now'
            ).strftime('%d-%m-%y')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_days_later(self):
        input_text = '10 days later'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d-%m-%y'),
            parsing.date_from_duration(self.base_date, 10, 'days', 'later').strftime('%d-%m-%y')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_year(self):
        input_text = '2010'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(parser[0][1].strftime('%Y'), input_text)
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_today(self):
        input_text = 'today'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(parser[0][1].strftime('%d'), datetime.today().strftime('%d'))
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_tomorrow(self):
        input_text = 'tomorrow'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d'),
            (datetime.today() + timedelta(days=1)).strftime('%d')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_yesterday(self):
        input_text = 'yesterday'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d'),
            (datetime.today() - timedelta(days=1)).strftime('%d')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_before_yesterday(self):
        input_text = 'day before yesterday'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d'),
            (datetime.today() - timedelta(days=2)).strftime('%d')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_before_today(self):
        input_text = 'day before today'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d'),
            (datetime.today() - timedelta(days=1)).strftime('%d')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_before_tomorrow(self):
        input_text = 'day before tomorrow'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d'),
            (datetime.today() - timedelta(days=0)).strftime('%d')
        )
        self.assertEqual(len(parser), 1)

        input_text = '2 days before'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(
            parser[0][1].strftime('%d'),
            (datetime.today() - timedelta(days=2)).strftime('%d')
        )
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_two_days(self):
        input_text = 'Monday and Friday'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn('Monday', parser[0])
        self.assertIn('Friday', parser[1])
        self.assertEqual(
            parser[0][1].strftime('%d'),
            parsing.this_week_day(self.base_date, 0).strftime('%d')
        )
        self.assertEqual(
            parser[1][1].strftime('%d'),
            parsing.this_week_day(self.base_date, 4).strftime('%d')
        )
        self.assertEqual(len(parser), 2)

    def test_captured_pattern_first_quarter_of_year(self):
        input_text = 'First quarter of 2016'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(parser[0][1][0].strftime('%d-%m-%Y'), '01-01-2016')
        self.assertEqual(parser[0][1][1].strftime('%d-%m-%Y'), '31-03-2016')
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_last_quarter_of_year(self):
        input_text = 'Last quarter of 2015'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn(input_text, parser[0])
        self.assertEqual(parser[0][1][0].strftime('%d-%m-%Y'), '01-09-2015')
        self.assertEqual(parser[0][1][1].strftime('%d-%m-%Y'), '31-12-2015')
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_is_on_day(self):
        input_text = 'My birthday is on January 2nd.'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn('January 2nd', parser[0])
        self.assertEqual(parser[0][1].month, 1)
        self.assertEqual(parser[0][1].day, 2)
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_is_on_day_of_year_variation1(self):
        input_text = 'My birthday is on January 1st 2014.'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn('January 1st 2014', parser[0])
        self.assertEqual(parser[0][1].strftime('%d-%m-%Y'), '01-01-2014')
        self.assertEqual(len(parser), 1)

    def test_captured_pattern_is_on_day_of_year_variation2(self):
        input_text = 'My birthday is on 2nd January 2014.'
        parser = parsing.datetime_parsing(input_text)
        self.assertIn('2nd January 2014', parser[0])
        self.assertEqual(parser[0][1].strftime('%d-%m-%Y'), '02-01-2014')
        self.assertEqual(len(parser), 1)

class DateTimeParsingTestCases(TestCase):
    """
    Unit tests for datetime parsing functions.
    """

    def test_next_week_day(self):
        base_date = datetime(2016, 12, 7, 10, 10, 52, 85280)
        weekday = 2 # Wednesday
        result = parsing.next_week_day(base_date, weekday)

        self.assertEqual(result, datetime(2016, 12, 14, 10, 10, 52, 85280))

    def test_previous_week_day(self):
        base_date = datetime(2016, 12, 14, 10, 10, 52, 85280)
        weekday = 2 # Wednesday
        result = parsing.previous_week_day(base_date, weekday)

        self.assertEqual(result, datetime(2016, 12, 7, 10, 10, 52, 85280))

    def test_this_week_day_before_day(self):
        base_date = datetime(2016, 12, 5, 10, 10, 52, 85280) # Monday
        weekday = 2 # Wednesday
        result = parsing.this_week_day(base_date, weekday)

        self.assertEqual(result, datetime(2016, 12, 7, 10, 10, 52, 85280))

    def test_this_week_day_after_day(self):
        base_date = datetime(2016, 12, 9, 10, 10, 52, 85280) # Friday
        weekday = 2 # Wednesday
        result = parsing.this_week_day(base_date, weekday)

        self.assertEqual(result, datetime(2016, 12, 14, 10, 10, 52, 85280))


text:
package InputParsing

import CommandExecution.RunRobotScript

import scala.io.Source
import scala.util.{Failure, Success, Try}

object ReadingFromFile {
  def Read(fromFile: String): Unit = {
    println("Reading file " + fromFile)
    Try(Source.fromFile(fromFile).getLines()) match {
      case Success(lines: TraversableOnce[String]) =>
        RunRobotScript.execute(CommandParsing.toRobotCommands(lines))
      case Failure(e: Throwable) =>
        println("Encountered exception: " + e.getMessage)
    }

  }
}


text:
This is the main development environment for working on the Firefox Marketplace.

See the
[Marketplace backend installation instructions](https://marketplace.readthedocs.org/en/latest/topics/backend.html)
for the full backend installation docs, or start at the beginning of the
[Marketplace documentation](https://marketplace.readthedocs.org).


text:
"""Variation fonts interpolation models."""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *

__all__ = ['normalizeValue', 'normalizeLocation', 'supportScalar', 'VariationModel']

def normalizeValue(v, triple):
	"""Normalizes value based on a min/default/max triple.
	>>> normalizeValue(400, (100, 400, 900))
	0.0
	>>> normalizeValue(100, (100, 400, 900))
	-1.0
	>>> normalizeValue(650, (100, 400, 900))
	0.5
	"""
	lower, default, upper = triple
	assert lower <= default <= upper, "invalid axis values: %3.3f, %3.3f %3.3f"%(lower, default, upper)
	v = max(min(v, upper), lower)
	if v == default:
		v = 0.
	elif v < default:
		v = (v - default) / (default - lower)
	else:
		v = (v - default) / (upper - default)
	return v

def normalizeLocation(location, axes):
	"""Normalizes location based on axis min/default/max values from axes.
	>>> axes = {"wght": (100, 400, 900)}
	>>> normalizeLocation({"wght": 400}, axes)
	{'wght': 0.0}
	>>> normalizeLocation({"wght": 100}, axes)
	{'wght': -1.0}
	>>> normalizeLocation({"wght": 900}, axes)
	{'wght': 1.0}
	>>> normalizeLocation({"wght": 650}, axes)
	{'wght': 0.5}
	>>> normalizeLocation({"wght": 1000}, axes)
	{'wght': 1.0}
	>>> normalizeLocation({"wght": 0}, axes)
	{'wght': -1.0}
	>>> axes = {"wght": (0, 0, 1000)}
	>>> normalizeLocation({"wght": 0}, axes)
	{'wght': 0.0}
	>>> normalizeLocation({"wght": -1}, axes)
	{'wght': 0.0}
	>>> normalizeLocation({"wght": 1000}, axes)
	{'wght': 1.0}
	>>> normalizeLocation({"wght": 500}, axes)
	{'wght': 0.5}
	>>> normalizeLocation({"wght": 1001}, axes)
	{'wght': 1.0}
	>>> axes = {"wght": (0, 1000, 1000)}
	>>> normalizeLocation({"wght": 0}, axes)
	{'wght': -1.0}
	>>> normalizeLocation({"wght": -1}, axes)
	{'wght': -1.0}
	>>> normalizeLocation({"wght": 500}, axes)
	{'wght': -0.5}
	>>> normalizeLocation({"wght": 1000}, axes)
	{'wght': 0.0}
	>>> normalizeLocation({"wght": 1001}, axes)
	{'wght': 0.0}
	"""
	out = {}
	for tag,triple in axes.items():
		v = location.get(tag, triple[1])
		out[tag] = normalizeValue(v, triple)
	return out

def supportScalar(location, support, ot=True):
	"""Returns the scalar multiplier at location, for a master
	with support.  If ot is True, then a peak value of zero
	for support of an axis means "axis does not participate".  That
	is how OpenType Variation Font technology works.
	>>> supportScalar({}, {})
	1.0
	>>> supportScalar({'wght':.2}, {})
	1.0
	>>> supportScalar({'wght':.2}, {'wght':(0,2,3)})
	0.1
	>>> supportScalar({'wght':2.5}, {'wght':(0,2,4)})
	0.75
	>>> supportScalar({'wght':2.5, 'wdth':0}, {'wght':(0,2,4), 'wdth':(-1,0,+1)})
	0.75
	>>> supportScalar({'wght':2.5, 'wdth':.5}, {'wght':(0,2,4), 'wdth':(-1,0,+1)}, ot=False)
	0.375
	>>> supportScalar({'wght':2.5, 'wdth':0}, {'wght':(0,2,4), 'wdth':(-1,0,+1)})
	0.75
	>>> supportScalar({'wght':2.5, 'wdth':.5}, {'wght':(0,2,4), 'wdth':(-1,0,+1)})
	0.75
	"""
	scalar = 1.
	for axis,(lower,peak,upper) in support.items():
		if ot:
			# OpenType-specific case handling
			if peak == 0.:
				continue
			if lower > peak or peak > upper:
				continue
			if lower < 0. and upper > 0.:
				continue
			v = location.get(axis, 0.)
		else:
			assert axis in location
			v = location[axis]
		if v == peak:
			continue
		if v <= lower or upper <= v:
			scalar = 0.
			break;
		if v < peak:
			scalar *= (v - lower) / (peak - lower)
		else: # v > peak
			scalar *= (v - upper) / (peak - upper)
	return scalar

class VariationModel(object):

	"""
	Locations must be in normalized space.  Ie. base master
	is at origin (0).
	>>> from pprint import pprint
	>>> locations = [ \
	{'wght':100}, \
	{'wght':-100}, \
	{'wght':-180}, \
	{'wdth':+.3}, \
	{'wght':+120,'wdth':.3}, \
	{'wght':+120,'wdth':.2}, \
	{}, \
	{'wght':+180,'wdth':.3}, \
	{'wght':+180}, \
	]
	>>> model = VariationModel(locations, axisOrder=['wght'])
	>>> pprint(model.locations)
	[{},
	 {'wght': -100},
	 {'wght': -180},
	 {'wght': 100},
	 {'wght': 180},
	 {'wdth': 0.3},
	 {'wdth': 0.3, 'wght': 180},
	 {'wdth': 0.3, 'wght': 120},
	 {'wdth': 0.2, 'wght': 120}]
	>>> pprint(model.deltaWeights)
	[{},
	 {0: 1.0},
	 {0: 1.0},
	 {0: 1.0},
	 {0: 1.0},
	 {0: 1.0},
	 {0: 1.0, 4: 1.0, 5: 1.0},
	 {0: 1.0, 3: 0.75, 4: 0.25, 5: 1.0, 6: 0.25},
	 {0: 1.0,
	  3: 0.75,
	  4: 0.25,
	  5: 0.6666666666666667,
	  6: 0.16666666666666669,
	  7: 0.6666666666666667}]
	"""

	def __init__(self, locations, axisOrder=[]):
		locations = [{k:v for k,v in loc.items() if v != 0.} for loc in locations]
		keyFunc = self.getMasterLocationsSortKeyFunc(locations, axisOrder=axisOrder)
		axisPoints = keyFunc.axisPoints
		self.locations = sorted(locations, key=keyFunc)
		# TODO Assert that locations are unique.
		self.mapping = [self.locations.index(l) for l in locations] # Mapping from user's master order to our master order
		self.reverseMapping = [locations.index(l) for l in self.locations] # Reverse of above

		self._computeMasterSupports(axisPoints)

	@staticmethod
	def getMasterLocationsSortKeyFunc(locations, axisOrder=[]):
		assert {} in locations, "Base master not found."
		axisPoints = {}
		for loc in locations:
			if len(loc) != 1:
				continue
			axis = next(iter(loc))
			value = loc[axis]
			if axis not in axisPoints:
				axisPoints[axis] = {0.}
			assert value not in axisPoints[axis]
			axisPoints[axis].add(value)

		def getKey(axisPoints, axisOrder):
			def sign(v):
				return -1 if v < 0 else +1 if v > 0 else 0
			def key(loc):
				rank = len(loc)
				onPointAxes = [axis for axis,value in loc.items() if value in axisPoints[axis]]
				orderedAxes = [axis for axis in axisOrder if axis in loc]
				orderedAxes.extend([axis for axis in sorted(loc.keys()) if axis not in axisOrder])
				return (
					rank, # First, order by increasing rank
					-len(onPointAxes), # Next, by decreasing number of onPoint axes
					tuple(axisOrder.index(axis) if axis in axisOrder else 0x10000 for axis in orderedAxes), # Next, by known axes
					tuple(orderedAxes), # Next, by all axes
					tuple(sign(loc[axis]) for axis in orderedAxes), # Next, by signs of axis values
					tuple(abs(loc[axis]) for axis in orderedAxes), # Next, by absolute value of axis values
				)
			return key

		ret = getKey(axisPoints, axisOrder)
		ret.axisPoints = axisPoints
		return ret

	@staticmethod
	def lowerBound(value, lst):
		if any(v < value for v in lst):
			return max(v for v in lst if v < value)
		else:
			return value
	@staticmethod
	def upperBound(value, lst):
		if any(v > value for v in lst):
			return min(v for v in lst if v > value)
		else:
			return value

	def _computeMasterSupports(self, axisPoints):
		supports = []
		deltaWeights = []
		locations = self.locations
		for i,loc in enumerate(locations):
			box = {}

			# Account for axisPoints first
			for axis,values in axisPoints.items():
				if not axis in loc:
					continue
				locV = loc[axis]
				box[axis] = (self.lowerBound(locV, values), locV, self.upperBound(locV, values))

			locAxes = set(loc.keys())
			# Walk over previous masters now
			for j,m in enumerate(locations[:i]):
				# Master with extra axes do not participte
				if not set(m.keys()).issubset(locAxes):
					continue
				# If it's NOT in the current box, it does not participate
				relevant = True
				for axis, (lower,_,upper) in box.items():
					if axis in m and not (lower < m[axis] < upper):
						relevant = False
						break
				if not relevant:
					continue
				# Split the box for new master
				for axis,val in m.items():
					assert axis in box
					lower,locV,upper = box[axis]
					if val < locV:
						lower = val
					elif locV < val:
						upper = val
					box[axis] = (lower,locV,upper)
			supports.append(box)

			deltaWeight = {}
			# Walk over previous masters now, populate deltaWeight
			for j,m in enumerate(locations[:i]):
				scalar = supportScalar(loc, supports[j])
				if scalar:
					deltaWeight[j] = scalar
			deltaWeights.append(deltaWeight)

		self.supports = supports
		self.deltaWeights = deltaWeights

	def getDeltas(self, masterValues):
		assert len(masterValues) == len(self.deltaWeights)
		mapping = self.reverseMapping
		out = []
		for i,weights in enumerate(self.deltaWeights):
			delta = masterValues[mapping[i]]
			for j,weight in weights.items():
				delta -= out[j] * weight
			out.append(delta)
		return out

	def getScalars(self, loc):
		return [supportScalar(loc, support) for support in self.supports]

	@staticmethod
	def interpolateFromDeltasAndScalars(deltas, scalars):
		v = None
		assert len(deltas) == len(scalars)
		for i,(delta,scalar) in enumerate(zip(deltas, scalars)):
			if not scalar: continue
			contribution = delta * scalar
			if v is None:
				v = contribution
			else:
				v += contribution
		return v

	def interpolateFromDeltas(self, loc, deltas):
		scalars = self.getScalars(loc)
		return self.interpolateFromDeltasAndScalars(deltas, scalars)

	def interpolateFromMasters(self, loc, masterValues):
		deltas = self.getDeltas(masterValues)
		return self.interpolateFromDeltas(loc, deltas)

	def interpolateFromMastersAndScalars(self, masterValues, scalars):
		deltas = self.getDeltas(masterValues)
		return self.interpolateFromDeltasAndScalars(deltas, scalars)

if __name__ == "__main__":
	import doctest, sys
	sys.exit(doctest.testmod().failed)


text:
CREATE OR REPLACE FUNCTION pge_upsert_$DBNAME$_view(streamId UUID, evt JSON) RETURNS VOID AS
$$
BEGIN
	UPDATE pge_projections_$DBNAME$ set data = pge_apply_projection('$NAME$', data, evt) where id = streamId;

	-- TODO -- have it check for unique violation maybe?
	IF NOT FOUND THEN
		insert into pge_projections_$DBNAME$ (id, data) values (streamId, pge_apply_projection('$NAME$', null, evt));
	END IF;
END;
$$ LANGUAGE plpgsql;


text:
package cache

import (
	"sync"

	"github.com/spaolacci/murmur3"
)

var (
	// PlanCacheEnabled stores the global config "plan-cache-enabled".
	PlanCacheEnabled bool
	// PlanCacheShards stores the global config "plan-cache-shards".
	PlanCacheShards int64
	// PlanCacheCapacity stores the global config "plan-cache-capacity".
	PlanCacheCapacity int64
	// GlobalPlanCache stores the global plan cache for every session in a tidb-server.
	GlobalPlanCache *ShardedLRUCache
)

// ShardedLRUCache is a sharded LRU Cache, thread safe.
type ShardedLRUCache struct {
	shards []*SimpleLRUCache
	locks  []sync.RWMutex
}

// NewShardedLRUCache creates a ShardedLRUCache.
func NewShardedLRUCache(capacity, shardCount int64) *ShardedLRUCache {
	shardedLRUCache := &ShardedLRUCache{
		shards: make([]*SimpleLRUCache, 0, shardCount),
		locks:  make([]sync.RWMutex, shardCount),
	}
	for i := int64(0); i < shardCount; i++ {
		shardedLRUCache.shards = append(shardedLRUCache.shards, NewSimpleLRUCache(capacity/shardCount))
	}
	return shardedLRUCache
}

// Get gets a value from a ShardedLRUCache.
func (s *ShardedLRUCache) Get(key Key) (Value, bool) {
	id := int(murmur3.Sum32(key.Hash())) % len(s.shards)

	s.locks[id].Lock()
	value, ok := s.shards[id].Get(key)
	s.locks[id].Unlock()

	return value, ok
}

// Put puts a (key, value) pair to a ShardedLRUCache.
func (s *ShardedLRUCache) Put(key Key, value Value) {
	id := int(murmur3.Sum32(key.Hash())) % len(s.shards)

	s.locks[id].Lock()
	s.shards[id].Put(key, value)
	s.locks[id].Unlock()
}


text:
/**
 * Check whether a type selector is standard
 *
 * @param {Node} postcss-selector-parser node (of type tag)
 * @return {boolean} If `true`, the type selector is standard
 */

import {
  aNPlusBNotationPseudoClasses,
  linguisticPseudoClasses,
} from "../reference/keywordSets"

export default function (node) {

  // postcss-selector-parser includes the arguments to nth-child() functions
  // as "tags", so we need to ignore them ourselves.
  // The fake-tag's "parent" is actually a selector node, whose parent
  // should be the :nth-child pseudo node.
  const { parent: { parent: { type: parentType, value: parentValue } } } = node
  if (parentValue) {
    const normalisedParentName = parentValue.toLowerCase().replace(/:+/, "")
    if (
      parentType === "pseudo" && (
        aNPlusBNotationPseudoClasses.has(normalisedParentName)
        || linguisticPseudoClasses.has(normalisedParentName)
      )
    ) { return false }
  }

  // &-bar is a nesting selector combined with a suffix
  if (node.prev() && node.prev().type === "nesting") { return false }

  return true
}


text:
package com.cube.geojson.test;

import com.google.gson.Gson;

import com.cube.geojson.GeoJson;
import com.cube.geojson.LngLatAlt;
import com.cube.geojson.MultiPoint;
import org.junit.Assert;
import org.junit.Test;

import java.util.List;

import static org.junit.Assert.assertNotNull;

public class MultiPointTest
{
	private Gson mapper = GeoJson.getGson();

	@Test
	public void itShouldSerializeMultiPoint() throws Exception
	{
		MultiPoint multiPoint = new MultiPoint(new LngLatAlt(100, 0), new LngLatAlt(101, 1));
		Assert.assertEquals("{\"coordinates\":[[100.0,0.0],[101.0,1.0]],\"type\":\"MultiPoint\"}", mapper.toJson(multiPoint));
	}

	@Test
	public void itShouldDeserializeMultiPoint() throws Exception
	{
		MultiPoint multiPoint = mapper.fromJson("{\"coordinates\":[[100.0,0.0],[101.0,1.0]],\"type\":\"MultiPoint\"}", MultiPoint.class);
		assertNotNull(multiPoint);
		List<LngLatAlt> coordinates = multiPoint.getCoordinates();
		PointTest.assertLngLatAlt(100, 0, Double.NaN, coordinates.get(0));
		PointTest.assertLngLatAlt(101, 1, Double.NaN, coordinates.get(1));
	}
}


text:
<?php

namespace Choi\Doctrine;

use Exception;

class InvalidDriverException extends Exception
{
    //
}


text:
#ifndef HASH_MEM_H_
#define HASH_MEM_H_

#define REHASH_LIMIT 20
#define IDEAL_OCCUPANCY 0.75f
#define WARN_OCCUPANCY 0.9f
// bucket size must be <256
#define MAX_BUCKET_SIZE 48

// Hash table capacity is x*(2^y) where x and y are parameters
// memory is x*(2^y)*sizeof(BinaryKmer) + (2^y) * 2
static inline size_t ht_mem(size_t bktsize, size_t nbkts, size_t nbits) {
  return (bktsize * nbkts * nbits)/8 + (nbkts) * sizeof(uint8_t[2]);
}

// Returns capacity of a hash table that holds at least nkmers
size_t hash_table_cap(uint64_t nkmers, uint64_t *num_bkts_ptr, uint8_t *bkt_size_ptr);

// Returns memory required to hold nkmers
size_t hash_table_mem(uint64_t nkmers, size_t entrybits, uint64_t *nkmers_ptr);

// Returns memory used for hashtable no more than some memory limit
size_t hash_table_mem_limit(size_t memlimit, size_t entrybits, uint64_t *nkmers_ptr);

#endif /* HASH_MEM_H_ */


text:
package org.nustaq.serialization.serializers;

/**
 * Created by ruedi on 07.03.14.
 */
import org.nustaq.serialization.FSTBasicObjectSerializer;
import org.nustaq.serialization.FSTClazzInfo;
import org.nustaq.serialization.FSTObjectInput;
import org.nustaq.serialization.FSTObjectOutput;
import org.nustaq.serialization.util.FSTUtil;

import java.io.IOException;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: ruedi
 * Date: 10.11.12
 * Time: 15:55
 * To change this template use File | Settings | File Templates.
 */
public class FSTArrayListSerializer extends FSTBasicObjectSerializer {

    @Override
    public void writeObject(FSTObjectOutput out, Object toWrite, FSTClazzInfo clzInfo, FSTClazzInfo.FSTFieldInfo referencedBy, int streamPosition) throws IOException {
        ArrayList col = (ArrayList)toWrite;
        int size = col.size();
        out.writeInt(size);
        Class lastClz = null;
        FSTClazzInfo lastInfo = null;
        for (int i = 0; i < size; i++) {
            Object o = col.get(i);
            if ( o != null ) {
                lastInfo = out.writeObjectInternal(o, o.getClass() == lastClz ? lastInfo : null, null);
                lastClz = o.getClass();
            } else
                out.writeObjectInternal(o, null, null);
        }
    }

    @Override
    public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPositioin) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
        try {
            int len = in.readInt();
            ArrayList res = new ArrayList(len);
            in.registerObject(res, streamPositioin,serializationInfo, referencee);
            for ( int i = 0; i < len; i++ ) {
                final Object o = in.readObjectInternal(null);
                res.add(o);
            }
            return res;
        } catch (Throwable th) {
            throw FSTUtil.rethrow(th);
        }
    }

}


text:
#pragma once
#include <aws/macie/Macie_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

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

  /**
   *
(Discontinued) You do not have required permissions to access the requested
   * resource.

See Also:
   AWS
   * API Reference

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

    inline const Aws::String& GetMessage() const{ return m_message; }

    inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; }

    inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; }

    inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); }

    inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); }

    inline AccessDeniedException& WithMessage(const Aws::String& value) { SetMessage(value); return *this;}

    inline AccessDeniedException& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;}

    inline AccessDeniedException& WithMessage(const char* value) { SetMessage(value); return *this;}

    inline const Aws::String& GetResourceType() const{ return m_resourceType; }

    inline bool ResourceTypeHasBeenSet() const { return m_resourceTypeHasBeenSet; }

    inline void SetResourceType(const Aws::String& value) { m_resourceTypeHasBeenSet = true; m_resourceType = value; }

    inline void SetResourceType(Aws::String&& value) { m_resourceTypeHasBeenSet = true; m_resourceType = std::move(value); }

    inline void SetResourceType(const char* value) { m_resourceTypeHasBeenSet = true; m_resourceType.assign(value); }

    inline AccessDeniedException& WithResourceType(const Aws::String& value) { SetResourceType(value); return *this;}

    inline AccessDeniedException& WithResourceType(Aws::String&& value) { SetResourceType(std::move(value)); return *this;}

    inline AccessDeniedException& WithResourceType(const char* value) { SetResourceType(value); return *this;}

  private:

    Aws::String m_message;
    bool m_messageHasBeenSet;

    Aws::String m_resourceType;
    bool m_resourceTypeHasBeenSet;
  };

} // namespace Model
} // namespace Macie
} // namespace Aws