text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package put.io2.nerdlounge;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

/**
 * Used by MeetingService class to access database.
 * @author Gopher
 */
@Repository
public class MeetingDAO
{
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private final RowMapper<Meeting> rowMapper;
    public MeetingDAO()
    {
        rowMapper = (ResultSet row, int rowNum) -> {
            Meeting meeting = new Meeting();
            meeting.setId((row.getInt("id")));
            meeting.setOrganiserID((row.getInt("organiser_ID")));
            meeting.setLocationID((row.getInt("location_ID")));
            meeting.setAvailability(Meeting.Availability.valueOf(
                    (row.getString("availability"))));
            meeting.setNum_people((row.getInt("num_people")));
            meeting.setAge_restr((row.getInt("age_restr")));
            meeting.setFormattedStart((row.getString("formattedStart")));
            meeting.setFormattedEnd((row.getString("formattedEnd")));
            return meeting;
        };
    }

    private String getAllColumnsQuery()
    {
        String query = "SELECT id, organiser_ID, location_ID, availability, num_people, "
                + "age_restr,"
                + "FORMATDATETIME(start, 'EEEE, d MMM yyyy, HH:mm') as formattedStart, "
                + "FORMATDATETIME(end, 'EEEE, d MMM yyyy, HH:mm') as formattedEnd FROM meetings";
        return query;
    }

    /**
     * Method accesses the database to retrieve meeting data.
     * @return List of all meetings in the database.
     */
    private List<Meeting> queryResultToMeetingsList(List<Map<String,Object>> rows)
    {
        List<Meeting> meetings = new ArrayList<>();
        for (Map row : rows)
        {
            Meeting meeting = new Meeting();
            meeting.setId((Integer) (row.get("id")));
            meeting.setOrganiserID((Integer) (row.get("organiser_ID")));
            meeting.setLocationID((Integer) (row.get("location_ID")));
            meeting.setAvailability(Meeting.Availability.valueOf(
                    (String)(row.get("availability"))));
            meeting.setNum_people((Integer) (row.get("num_people")));
            meeting.setAge_restr((Integer) (row.get("age_restr")));
            meeting.setFormattedStart((String) (row.get("formattedStart")));
            meeting.setFormattedEnd((String) (row.get("formattedEnd")));
            meetings.add(meeting);
        }
        return meetings;
    }

    public List<Meeting> getMeetingList()
    {
        String query = this.getAllColumnsQuery();
        List<Map<String, Object>> rows = jdbcTemplate.queryForList(query);
        return queryResultToMeetingsList(rows);
    }
    public Meeting getMeetingByID(int id)
    {
        String query = this.getAllColumnsQuery() + " WHERE id=?";
        Object meeting = jdbcTemplate.queryForObject(query,new Object[] {id},rowMapper);
        return (Meeting) meeting;
    }
    public List<Meeting> getMeetingsByLocationID(Integer id)
    {
        String query = this.getAllColumnsQuery() + " WHERE location_ID=?";
        List<Map<String, Object>> rows = jdbcTemplate.queryForList(query,id);
        return queryResultToMeetingsList(rows);
    }

    public List<Meeting> getMeetingsByOrganiserID(Integer id)
    {
        String query = this.getAllColumnsQuery() + " WHERE organiser_ID=?";
        List<Map<String, Object>> rows = jdbcTemplate.queryForList(query,id);
        return queryResultToMeetingsList(rows);
    }

    public List<Meeting> getSignupMeetings()
    {
        String query = this.getAllColumnsQuery() + " WHERE availability IN ('Potwierdzane','Publiczne')";
        List<Map<String, Object>> rows = jdbcTemplate.queryForList(query);
        return queryResultToMeetingsList(rows);
    }

    /**
     * This method is used to save a meeting object in the database.
     * The method does not check whether the meeting is already in the database.
     * A new row is created for each invocation.
     * @param meeting Meeting object to be saved in the database.
     */
    public void addMeeting(Meeting meeting)
    {
        jdbcTemplate.update("INSERT INTO meetings(organiser_ID, location_ID, "
                + "availability, num_people, age_restr, start, end) "
                + "VALUES(?, ?, ?, ?, ?, ?, ?)", meeting.getOrganiserID(),
                meeting.getLocationID(), meeting.getAvailability().name(),
                meeting.getNum_people(), meeting.getAge_restr(),
                meeting.getStart(), meeting.getEnd());
    }

    public void deleteMeeting(Integer id)
    {
        jdbcTemplate.update("DELETE FROM meetings WHERE id=?", id);
    }

    /**
     * This method checks if specified meeting's availability is public.
     * @param id of the meeting
     * @return boolean - true if meeting is public; false otherwise.
     */
    public boolean checkAvailability(Integer id)
    {
        String query = "SELECT availability FROM meetings WHERE id=?";
        Meeting meeting = (Meeting)jdbcTemplate.queryForObject(
                                query, new Object[] {id},
                                new BeanPropertyRowMapper(Meeting.class));
        return meeting.getAvailability() == Meeting.Availability.Publiczne;
    }

    /**
     * This method verifies if age param is greater or equal to meeting's age_restr.
     * @param id of the meeting
     * @param age as given by the user
     * @return boolean - true if age is greater or equal meeting's age_restr;
     *                   false otherwise.
     */
    public boolean checkAgeRestrictions(Integer id, Integer age)
    {
        String query = "SELECT age_restr FROM meetings WHERE id=?";
        Meeting meeting = (Meeting)jdbcTemplate.queryForObject(
                                query, new Object[] {id},
                                new BeanPropertyRowMapper(Meeting.class));
        return meeting.getAge_restr() <= age;
    }
}


text:
"""
    landscape_functions
    ~~~~~~~~~~~~~~~~~~~

    Wrapper for all landscape analysis functions.

    :author: Fahad Khalid
    :license: MIT, see LICENSE for more details.
"""

# import igraph
#
# from genonets.peak_functions import PeakAnalyzer
# from genonets.path_functions import PathAnalyzer
# from genonets.epistasis_functions import EpistasisAnalyzer
# from genonets.genonets_utils import Utils
#
#
# class Landscape :
#     # Constructor
#     def __init__(self, network, netUtils, seqToEscrDict, delta, bitManip) :
#         # Store reference to the network object
#         self.network = network
#
#         # Store reference to the netUtils object
#         self.netUtils = netUtils
#
#         # Create the peak analyzer
#         self.peakAnalyzer = PeakAnalyzer(network, netUtils, delta)
#
#         # Create the path analyzer
#         self.pathAnalyzer = PathAnalyzer(network, netUtils, delta)
#
#         # Create the epistasis analyzer
#         self.epiAnalyzer = EpistasisAnalyzer(network, netUtils,
#             seqToEscrDict, delta, bitManip)
#
#         # Get a reference to the BitSeqManipulator in use
#         self.bitManip = self.netUtils.bitManip
#
#     # ----------------------------------------------------------------
#     # Peak analysis methods
#     # ----------------------------------------------------------------
#
#     def getPeaks(self, recompute) :
#         return self.peakAnalyzer.getPeaks(recompute)
#
#     # ----------------------------------------------------------------
#     # Path analysis methods
#     # ----------------------------------------------------------------
#
#     def getAccessiblePaths(self, pathLength=0):
#         return self.pathAnalyzer.getAccessiblePaths(pathLength)
#
#     # ----------------------------------------------------------------
#     # Epistasis analysis methods
#     # ----------------------------------------------------------------
#
#     def getEpistasis(self) :
#         return self.epiAnalyzer.getEpiAll()
#
#     # ----------------------------------------------------------------
#     # Calculate mutational distances from summit for all vertices
#     # ----------------------------------------------------------------
#
#     def populateDistsToSummit(self):
#         # Get the summit sequence
#         summit = Utils.getSeqWithMaxScore(
#             self.network, self.bitManip.seqLength)
#
#         # Get vertex that represents summit
#         trgtVrtx = self.netUtils.getVertex(summit, self.network)
#
#         self.network.vs["Distance from Summit"] = [
#             len(
#                 self.network.get_shortest_paths(
#                     srcVrtx, to=trgtVrtx, weights=None,
#                     mode=igraph.OUT, output="epath")[0]
#             )
#             for srcVrtx in self.network.vs
#         ]

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>
<title>CSS Test Reference</title>


text:
package org.opensmartgridplatform.core.infra.jms.protocol.in.messageprocessors;

import javax.jms.JMSException;
import javax.jms.ObjectMessage;

import org.apache.commons.lang3.StringUtils;
import org.opensmartgridplatform.core.domain.model.protocol.ProtocolResponseService;
import org.opensmartgridplatform.core.infra.jms.protocol.in.ProtocolRequestMessageProcessor;
import org.opensmartgridplatform.domain.core.entities.Device;
import org.opensmartgridplatform.domain.core.entities.FirmwareFile;
import org.opensmartgridplatform.domain.core.entities.ProtocolInfo;
import org.opensmartgridplatform.domain.core.repositories.DeviceRepository;
import org.opensmartgridplatform.domain.core.repositories.FirmwareFileRepository;
import org.opensmartgridplatform.domain.core.valueobjects.DeviceFunction;
import org.opensmartgridplatform.dto.valueobjects.FirmwareFileDto;
import org.opensmartgridplatform.shared.exceptionhandling.ComponentType;
import org.opensmartgridplatform.shared.exceptionhandling.OsgpException;
import org.opensmartgridplatform.shared.infra.jms.DeviceMessageMetadata;
import org.opensmartgridplatform.shared.infra.jms.MessageMetadata;
import org.opensmartgridplatform.shared.infra.jms.MessageType;
import org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage;
import org.opensmartgridplatform.shared.infra.jms.RequestMessage;
import org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("getFirmwareFileMessageProcessor")
public class GetFirmwareFileMessageProcessor extends ProtocolRequestMessageProcessor {

    private static final Logger LOGGER = LoggerFactory.getLogger(GetFirmwareFileMessageProcessor.class);

    @Autowired
    private ProtocolResponseService protocolResponseMessageSender;

    @Autowired
    private DeviceRepository deviceRepository;

    @Autowired
    private FirmwareFileRepository firmwareFileRepository;

    protected GetFirmwareFileMessageProcessor() {
        super(MessageType.GET_FIRMWARE_FILE);
    }

    @Override
    public void processMessage(final ObjectMessage message) throws JMSException {

        MessageMetadata metadata = null;
        Device device = null;
        String firmwareFileIdentification = StringUtils.EMPTY;

        try {
            metadata = MessageMetadata.fromMessage(message);
            LOGGER.info(
                    "[{}] - Received message of messageType: {}, organisationIdentification: {}, deviceIdentification: {}",
                    metadata.getCorrelationUid(), metadata.getMessageType(), metadata.getOrganisationIdentification(),
                    metadata.getDeviceIdentification());

            device = this.deviceRepository.findByDeviceIdentification(metadata.getDeviceIdentification());

            final RequestMessage requestMessage = (RequestMessage) message.getObject();
            firmwareFileIdentification = (String) requestMessage.getRequest();

            final FirmwareFile firmwareFile = this.firmwareFileRepository
                    .findByIdentification(firmwareFileIdentification);

            final FirmwareFileDto firmwareFileDto = new FirmwareFileDto(firmwareFile.getIdentification(),
                    firmwareFile.getFile());

            this.sendSuccesResponse(metadata, device.getProtocolInfo(), firmwareFileDto);

        } catch (final Exception e) {
            LOGGER.error("Exception while retrieving firmware file: {}", firmwareFileIdentification);
            final OsgpException osgpException = new OsgpException(ComponentType.OSGP_CORE,
                    "Exception while retrieving firmware file.", e);
            this.sendFailureResponse(metadata, device.getProtocolInfo(), osgpException);
        }
    }

    private void sendSuccesResponse(final MessageMetadata metadata, final ProtocolInfo protocolInfo,
            final FirmwareFileDto firmwareFileDto) {

        final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage.Builder()
                .deviceMessageMetadata(new DeviceMessageMetadata(metadata)).domain(metadata.getDomain())
                .domainVersion(metadata.getDomainVersion()).result(ResponseMessageResultType.OK).osgpException(null)
                .dataObject(firmwareFileDto).retryCount(metadata.getRetryCount()).scheduled(metadata.isScheduled())
                .build();

        this.protocolResponseMessageSender.send(responseMessage, DeviceFunction.GET_FIRMWARE_FILE.name(), protocolInfo,
                metadata);
    }

    private void sendFailureResponse(final MessageMetadata metadata, final ProtocolInfo protocolInfo,
            final OsgpException exception) {

        final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage.Builder()
                .deviceMessageMetadata(new DeviceMessageMetadata(metadata)).domain(metadata.getDomain())
                .domainVersion(metadata.getDomainVersion()).result(ResponseMessageResultType.NOT_OK)
                .osgpException(exception).dataObject(null).retryCount(metadata.getRetryCount())
                .scheduled(metadata.isScheduled()).build();

        this.protocolResponseMessageSender.send(responseMessage, DeviceFunction.GET_FIRMWARE_FILE.name(), protocolInfo,
                metadata);
    }

}


text:
BOOST_STATIC_STRING_STANDARD_VERSION < 201703L) && \
defined(__clang__) && \
((__clang_major__ == 4) || (__clang_major__ == 5))
// This directive works on clang
#warning "C++14 constexpr is not supported in clang 4.x and 5.x due to a compiler bug."
#ifdef BOOST_STATIC_STRING_CPP14
#undef BOOST_STATIC_STRING_CPP14
#endif
#undef BOOST_STATIC_STRING_CPP14_CONSTEXPR
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR
#endif

// This is for compiler/library configurations
// that cannot use the library comparison function
// objects at all in constant expresssions. In these
// cases, we use whatever will make more constexpr work.
#if defined(__clang__) && \
(defined(__GLIBCXX__) || defined(_MSC_VER))
#define BOOST_STATIC_STRING_NO_PTR_COMP_FUNCTIONS
#endif

// In gcc-5, we cannot use throw expressions in a
// constexpr function. However, we have a workaround
// for this using constructors. Also, non-static member
// functions that return the class they are a member of
// causes an ICE during constant evaluation.
#if defined(__GNUC__) && (__GNUC__== 5) && \
defined(BOOST_STATIC_STRING_CPP14)
#define BOOST_STATIC_STRING_GCC5_BAD_CONSTEXPR
#endif

namespace boost {
namespace static_strings {

/// The type of `basic_string_view` used by the library
template<typename CharT, typename Traits>
using basic_string_view =
#ifndef BOOST_STATIC_STRING_STANDALONE
  boost::basic_string_view<CharT, Traits>;
#else
  std::basic_string_view<CharT, Traits>;
#endif
} // static_strings
} // boost
#endif


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SuperSocket.Imap.Server
{
    public interface IAuthenticationProvider<TUserKey>
    {
        bool Authenticate(string name, string password, out TUserKey userKey);
    }
}


text:
//go:build !ignore_autogenerated
// +build !ignore_autogenerated

// Code generated by conversion-gen. DO NOT EDIT.

package v1

import (
	unsafe "unsafe"

	v1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
	operators "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/operators"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	conversion "k8s.io/apimachinery/pkg/conversion"
	runtime "k8s.io/apimachinery/pkg/runtime"
)

func init() {
	localSchemeBuilder.Register(RegisterConversions)
}

// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(s *runtime.Scheme) error {
	if err := s.AddGeneratedConversionFunc((*AppLink)(nil), (*operators.AppLink)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_AppLink_To_operators_AppLink(a.(*AppLink), b.(*operators.AppLink), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.AppLink)(nil), (*AppLink)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_AppLink_To_v1_AppLink(a.(*operators.AppLink), b.(*AppLink), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*CSVDescription)(nil), (*operators.CSVDescription)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_CSVDescription_To_operators_CSVDescription(a.(*CSVDescription), b.(*operators.CSVDescription), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.CSVDescription)(nil), (*CSVDescription)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_CSVDescription_To_v1_CSVDescription(a.(*operators.CSVDescription), b.(*CSVDescription), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*ChannelEntry)(nil), (*operators.ChannelEntry)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_ChannelEntry_To_operators_ChannelEntry(a.(*ChannelEntry), b.(*operators.ChannelEntry), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.ChannelEntry)(nil), (*ChannelEntry)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_ChannelEntry_To_v1_ChannelEntry(a.(*operators.ChannelEntry), b.(*ChannelEntry), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*Icon)(nil), (*operators.Icon)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_Icon_To_operators_Icon(a.(*Icon), b.(*operators.Icon), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.Icon)(nil), (*Icon)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_Icon_To_v1_Icon(a.(*operators.Icon), b.(*Icon), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*Maintainer)(nil), (*operators.Maintainer)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_Maintainer_To_operators_Maintainer(a.(*Maintainer), b.(*operators.Maintainer), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.Maintainer)(nil), (*Maintainer)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_Maintainer_To_v1_Maintainer(a.(*operators.Maintainer), b.(*Maintainer), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*PackageChannel)(nil), (*operators.PackageChannel)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_PackageChannel_To_operators_PackageChannel(a.(*PackageChannel), b.(*operators.PackageChannel), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.PackageChannel)(nil), (*PackageChannel)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_PackageChannel_To_v1_PackageChannel(a.(*operators.PackageChannel), b.(*PackageChannel), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*PackageManifest)(nil), (*operators.PackageManifest)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_PackageManifest_To_operators_PackageManifest(a.(*PackageManifest), b.(*operators.PackageManifest), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.PackageManifest)(nil), (*PackageManifest)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_PackageManifest_To_v1_PackageManifest(a.(*operators.PackageManifest), b.(*PackageManifest), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*PackageManifestList)(nil), (*operators.PackageManifestList)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_PackageManifestList_To_operators_PackageManifestList(a.(*PackageManifestList), b.(*operators.PackageManifestList), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.PackageManifestList)(nil), (*PackageManifestList)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_PackageManifestList_To_v1_PackageManifestList(a.(*operators.PackageManifestList), b.(*PackageManifestList), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*PackageManifestSpec)(nil), (*operators.PackageManifestSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_PackageManifestSpec_To_operators_PackageManifestSpec(a.(*PackageManifestSpec), b.(*operators.PackageManifestSpec), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.PackageManifestSpec)(nil), (*PackageManifestSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_PackageManifestSpec_To_v1_PackageManifestSpec(a.(*operators.PackageManifestSpec), b.(*PackageManifestSpec), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*PackageManifestStatus)(nil), (*operators.PackageManifestStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_v1_PackageManifestStatus_To_operators_PackageManifestStatus(a.(*PackageManifestStatus), b.(*operators.PackageManifestStatus), scope)
	}); err != nil {
		return err
	}
	if err := s.AddGeneratedConversionFunc((*operators.PackageManifestStatus)(nil), (*PackageManifestStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
		return Convert_operators_PackageManifestStatus_To_v1_PackageManifestStatus(a.(*operators.PackageManifestStatus), b.(*PackageManifestStatus), scope)
	}); err != nil {
		return err
	}
	return nil
}

func autoConvert_v1_AppLink_To_operators_AppLink(in *AppLink, out *operators.AppLink, s conversion.Scope) error {
	out.Name = in.Name
	out.URL = in.URL
	return nil
}

// Convert_v1_AppLink_To_operators_AppLink is an autogenerated conversion function.
func Convert_v1_AppLink_To_operators_AppLink(in *AppLink, out *operators.AppLink, s conversion.Scope) error {
	return autoConvert_v1_AppLink_To_operators_AppLink(in, out, s)
}

func autoConvert_operators_AppLink_To_v1_AppLink(in *operators.AppLink, out *AppLink, s conversion.Scope) error {
	out.Name = in.Name
	out.URL = in.URL
	return nil
}

// Convert_operators_AppLink_To_v1_AppLink is an autogenerated conversion function.
func Convert_operators_AppLink_To_v1_AppLink(in *operators.AppLink, out *AppLink, s conversion.Scope) error {
	return autoConvert_operators_AppLink_To_v1_AppLink(in, out, s)
}

func autoConvert_v1_CSVDescription_To_operators_CSVDescription(in *CSVDescription, out *operators.CSVDescription, s conversion.Scope) error {
	out.DisplayName = in.DisplayName
	out.Icon = *(*[]operators.Icon)(unsafe.Pointer(&in.Icon))
	out.Version = in.Version
	if err := Convert_v1_AppLink_To_operators_AppLink(&in.Provider, &out.Provider, s); err != nil {
		return err
	}
	out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations))
	out.Keywords = *(*[]string)(unsafe.Pointer(&in.Keywords))
	out.Links = *(*[]operators.AppLink)(unsafe.Pointer(&in.Links))
	out.Maintainers = *(*[]operators.Maintainer)(unsafe.Pointer(&in.Maintainers))
	out.Maturity = in.Maturity
	out.LongDescription = in.LongDescription
	out.InstallModes = *(*[]v1alpha1.InstallMode)(unsafe.Pointer(&in.InstallModes))
	out.CustomResourceDefinitions = in.CustomResourceDefinitions
	out.APIServiceDefinitions = in.APIServiceDefinitions
	out.NativeAPIs = *(*[]metav1.GroupVersionKind)(unsafe.Pointer(&in.NativeAPIs))
	out.MinKubeVersion = in.MinKubeVersion
	out.RelatedImages = *(*[]string)(unsafe.Pointer(&in.RelatedImages))
	return nil
}

// Convert_v1_CSVDescription_To_operators_CSVDescription is an autogenerated conversion function.
func Convert_v1_CSVDescription_To_operators_CSVDescription(in *CSVDescription, out *operators.CSVDescription, s conversion.Scope) error {
	return autoConvert_v1_CSVDescription_To_operators_CSVDescription(in, out, s)
}

func autoConvert_operators_CSVDescription_To_v1_CSVDescription(in *operators.CSVDescription, out *CSVDescription, s conversion.Scope) error {
	out.DisplayName = in.DisplayName
	out.Icon = *(*[]Icon)(unsafe.Pointer(&in.Icon))
	out.Version = in.Version
	if err := Convert_operators_AppLink_To_v1_AppLink(&in.Provider, &out.Provider, s); err != nil {
		return err
	}
	out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations))
	out.Keywords = *(*[]string)(unsafe.Pointer(&in.Keywords))
	out.Links = *(*[]AppLink)(unsafe.Pointer(&in.Links))
	out.Maintainers = *(*[]Maintainer)(unsafe.Pointer(&in.Maintainers))
	out.Maturity = in.Maturity
	out.LongDescription = in.LongDescription
	out.InstallModes = *(*[]v1alpha1.InstallMode)(unsafe.Pointer(&in.InstallModes))
	out.CustomResourceDefinitions = in.CustomResourceDefinitions
	out.APIServiceDefinitions = in.APIServiceDefinitions
	out.NativeAPIs = *(*[]metav1.GroupVersionKind)(unsafe.Pointer(&in.NativeAPIs))
	out.MinKubeVersion = in.MinKubeVersion
	out.RelatedImages = *(*[]string)(unsafe.Pointer(&in.RelatedImages))
	return nil
}

// Convert_operators_CSVDescription_To_v1_CSVDescription is an autogenerated conversion function.
func Convert_operators_CSVDescription_To_v1_CSVDescription(in *operators.CSVDescription, out *CSVDescription, s conversion.Scope) error {
	return autoConvert_operators_CSVDescription_To_v1_CSVDescription(in, out, s)
}

func autoConvert_v1_ChannelEntry_To_operators_ChannelEntry(in *ChannelEntry, out *operators.ChannelEntry, s conversion.Scope) error {
	out.Name = in.Name
	out.Version = in.Version
	return nil
}

// Convert_v1_ChannelEntry_To_operators_ChannelEntry is an autogenerated conversion function.
func Convert_v1_ChannelEntry_To_operators_ChannelEntry(in *ChannelEntry, out *operators.ChannelEntry, s conversion.Scope) error {
	return autoConvert_v1_ChannelEntry_To_operators_ChannelEntry(in, out, s)
}

func autoConvert_operators_ChannelEntry_To_v1_ChannelEntry(in *operators.ChannelEntry, out *ChannelEntry, s conversion.Scope) error {
	out.Name = in.Name
	out.Version = in.Version
	return nil
}

// Convert_operators_ChannelEntry_To_v1_ChannelEntry is an autogenerated conversion function.
func Convert_operators_ChannelEntry_To_v1_ChannelEntry(in *operators.ChannelEntry, out *ChannelEntry, s conversion.Scope) error {
	return autoConvert_operators_ChannelEntry_To_v1_ChannelEntry(in, out, s)
}

func autoConvert_v1_Icon_To_operators_Icon(in *Icon, out *operators.Icon, s conversion.Scope) error {
	out.Base64Data = in.Base64Data
	out.Mediatype = in.Mediatype
	return nil
}

// Convert_v1_Icon_To_operators_Icon is an autogenerated conversion function.
func Convert_v1_Icon_To_operators_Icon(in *Icon, out *operators.Icon, s conversion.Scope) error {
	return autoConvert_v1_Icon_To_operators_Icon(in, out, s)
}

func autoConvert_operators_Icon_To_v1_Icon(in *operators.Icon, out *Icon, s conversion.Scope) error {
	out.Base64Data = in.Base64Data
	out.Mediatype = in.Mediatype
	return nil
}

// Convert_operators_Icon_To_v1_Icon is an autogenerated conversion function.
func Convert_operators_Icon_To_v1_Icon(in *operators.Icon, out *Icon, s conversion.Scope) error {
	return autoConvert_operators_Icon_To_v1_Icon(in, out, s)
}

func autoConvert_v1_Maintainer_To_operators_Maintainer(in *Maintainer, out *operators.Maintainer, s conversion.Scope) error {
	out.Name = in.Name
	out.Email = in.Email
	return nil
}

// Convert_v1_Maintainer_To_operators_Maintainer is an autogenerated conversion function.
func Convert_v1_Maintainer_To_operators_Maintainer(in *Maintainer, out *operators.Maintainer, s conversion.Scope) error {
	return autoConvert_v1_Maintainer_To_operators_Maintainer(in, out, s)
}

func autoConvert_operators_Maintainer_To_v1_Maintainer(in *operators.Maintainer, out *Maintainer, s conversion.Scope) error {
	out.Name = in.Name
	out.Email = in.Email
	return nil
}

// Convert_operators_Maintainer_To_v1_Maintainer is an autogenerated conversion function.
func Convert_operators_Maintainer_To_v1_Maintainer(in *operators.Maintainer, out *Maintainer, s conversion.Scope) error {
	return autoConvert_operators_Maintainer_To_v1_Maintainer(in, out, s)
}

func autoConvert_v1_PackageChannel_To_operators_PackageChannel(in *PackageChannel, out *operators.PackageChannel, s conversion.Scope) error {
	out.Name = in.Name
	out.CurrentCSV = in.CurrentCSV
	if err := Convert_v1_CSVDescription_To_operators_CSVDescription(&in.CurrentCSVDesc, &out.CurrentCSVDesc, s); err != nil {
		return err
	}
	out.Entries = *(*[]operators.ChannelEntry)(unsafe.Pointer(&in.Entries))
	return nil
}

// Convert_v1_PackageChannel_To_operators_PackageChannel is an autogenerated conversion function.
func Convert_v1_PackageChannel_To_operators_PackageChannel(in *PackageChannel, out *operators.PackageChannel, s conversion.Scope) error {
	return autoConvert_v1_PackageChannel_To_operators_PackageChannel(in, out, s)
}

func autoConvert_operators_PackageChannel_To_v1_PackageChannel(in *operators.PackageChannel, out *PackageChannel, s conversion.Scope) error {
	out.Name = in.Name
	out.CurrentCSV = in.CurrentCSV
	if err := Convert_operators_CSVDescription_To_v1_CSVDescription(&in.CurrentCSVDesc, &out.CurrentCSVDesc, s); err != nil {
		return err
	}
	out.Entries = *(*[]ChannelEntry)(unsafe.Pointer(&in.Entries))
	return nil
}

// Convert_operators_PackageChannel_To_v1_PackageChannel is an autogenerated conversion function.
func Convert_operators_PackageChannel_To_v1_PackageChannel(in *operators.PackageChannel, out *PackageChannel, s conversion.Scope) error {
	return autoConvert_operators_PackageChannel_To_v1_PackageChannel(in, out, s)
}

func autoConvert_v1_PackageManifest_To_operators_PackageManifest(in *PackageManifest, out *operators.PackageManifest, s conversion.Scope) error {
	out.ObjectMeta = in.ObjectMeta
	if err := Convert_v1_PackageManifestSpec_To_operators_PackageManifestSpec(&in.Spec, &out.Spec, s); err != nil {
		return err
	}
	if err := Convert_v1_PackageManifestStatus_To_operators_PackageManifestStatus(&in.Status, &out.Status, s); err != nil {
		return err
	}
	return nil
}

// Convert_v1_PackageManifest_To_operators_PackageManifest is an autogenerated conversion function.
func Convert_v1_PackageManifest_To_operators_PackageManifest(in *PackageManifest, out *operators.PackageManifest, s conversion.Scope) error {
	return autoConvert_v1_PackageManifest_To_operators_PackageManifest(in, out, s)
}

func autoConvert_operators_PackageManifest_To_v1_PackageManifest(in *operators.PackageManifest, out *PackageManifest, s conversion.Scope) error {
	out.ObjectMeta = in.ObjectMeta
	if err := Convert_operators_PackageManifestSpec_To_v1_PackageManifestSpec(&in.Spec, &out.Spec, s); err != nil {
		return err
	}
	if err := Convert_operators_PackageManifestStatus_To_v1_PackageManifestStatus(&in.Status, &out.Status, s); err != nil {
		return err
	}
	return nil
}

// Convert_operators_PackageManifest_To_v1_PackageManifest is an autogenerated conversion function.
func Convert_operators_PackageManifest_To_v1_PackageManifest(in *operators.PackageManifest, out *PackageManifest, s conversion.Scope) error {
	return autoConvert_operators_PackageManifest_To_v1_PackageManifest(in, out, s)
}

func autoConvert_v1_PackageManifestList_To_operators_PackageManifestList(in *PackageManifestList, out *operators.PackageManifestList, s conversion.Scope) error {
	out.ListMeta = in.ListMeta
	out.Items = *(*[]operators.PackageManifest)(unsafe.Pointer(&in.Items))
	return nil
}

// Convert_v1_PackageManifestList_To_operators_PackageManifestList is an autogenerated conversion function.
func Convert_v1_PackageManifestList_To_operators_PackageManifestList(in *PackageManifestList, out *operators.PackageManifestList, s conversion.Scope) error {
	return autoConvert_v1_PackageManifestList_To_operators_PackageManifestList(in, out, s)
}

func autoConvert_operators_PackageManifestList_To_v1_PackageManifestList(in *operators.PackageManifestList, out *PackageManifestList, s conversion.Scope) error {
	out.ListMeta = in.ListMeta
	out.Items = *(*[]PackageManifest)(unsafe.Pointer(&in.Items))
	return nil
}

// Convert_operators_PackageManifestList_To_v1_PackageManifestList is an autogenerated conversion function.
func Convert_operators_PackageManifestList_To_v1_PackageManifestList(in *operators.PackageManifestList, out *PackageManifestList, s conversion.Scope) error {
	return autoConvert_operators_PackageManifestList_To_v1_PackageManifestList(in, out, s)
}

func autoConvert_v1_PackageManifestSpec_To_operators_PackageManifestSpec(in *PackageManifestSpec, out *operators.PackageManifestSpec, s conversion.Scope) error {
	return nil
}

// Convert_v1_PackageManifestSpec_To_operators_PackageManifestSpec is an autogenerated conversion function.
func Convert_v1_PackageManifestSpec_To_operators_PackageManifestSpec(in *PackageManifestSpec, out *operators.PackageManifestSpec, s conversion.Scope) error {
	return autoConvert_v1_PackageManifestSpec_To_operators_PackageManifestSpec(in, out, s)
}

func autoConvert_operators_PackageManifestSpec_To_v1_PackageManifestSpec(in *operators.PackageManifestSpec, out *PackageManifestSpec, s conversion.Scope) error {
	return nil
}

// Convert_operators_PackageManifestSpec_To_v1_PackageManifestSpec is an autogenerated conversion function.
func Convert_operators_PackageManifestSpec_To_v1_PackageManifestSpec(in *operators.PackageManifestSpec, out *PackageManifestSpec, s conversion.Scope) error {
	return autoConvert_operators_PackageManifestSpec_To_v1_PackageManifestSpec(in, out, s)
}

func autoConvert_v1_PackageManifestStatus_To_operators_PackageManifestStatus(in *PackageManifestStatus, out *operators.PackageManifestStatus, s conversion.Scope) error {
	out.CatalogSource = in.CatalogSource
	out.CatalogSourceDisplayName = in.CatalogSourceDisplayName
	out.CatalogSourcePublisher = in.CatalogSourcePublisher
	out.CatalogSourceNamespace = in.CatalogSourceNamespace
	if err := Convert_v1_AppLink_To_operators_AppLink(&in.Provider, &out.Provider, s); err != nil {
		return err
	}
	out.PackageName = in.PackageName
	out.Channels = *(*[]operators.PackageChannel)(unsafe.Pointer(&in.Channels))
	out.DefaultChannel = in.DefaultChannel
	return nil
}

// Convert_v1_PackageManifestStatus_To_operators_PackageManifestStatus is an autogenerated conversion function.
func Convert_v1_PackageManifestStatus_To_operators_PackageManifestStatus(in *PackageManifestStatus, out *operators.PackageManifestStatus, s conversion.Scope) error {
	return autoConvert_v1_PackageManifestStatus_To_operators_PackageManifestStatus(in, out, s)
}

func autoConvert_operators_PackageManifestStatus_To_v1_PackageManifestStatus(in *operators.PackageManifestStatus, out *PackageManifestStatus, s conversion.Scope) error {
	out.CatalogSource = in.CatalogSource
	out.CatalogSourceDisplayName = in.CatalogSourceDisplayName
	out.CatalogSourcePublisher = in.CatalogSourcePublisher
	out.CatalogSourceNamespace = in.CatalogSourceNamespace
	if err := Convert_operators_AppLink_To_v1_AppLink(&in.Provider, &out.Provider, s); err != nil {
		return err
	}
	out.PackageName = in.PackageName
	out.Channels = *(*[]PackageChannel)(unsafe.Pointer(&in.Channels))
	out.DefaultChannel = in.DefaultChannel
	return nil
}

// Convert_operators_PackageManifestStatus_To_v1_PackageManifestStatus is an autogenerated conversion function.
func Convert_operators_PackageManifestStatus_To_v1_PackageManifestStatus(in *operators.PackageManifestStatus, out *PackageManifestStatus, s conversion.Scope) error {
	return autoConvert_operators_PackageManifestStatus_To_v1_PackageManifestStatus(in, out, s)
}


text:
"""
  Udacity CS253 - Lesson 5 - Homework 1
"""
import webapp2, handlers

app = webapp2.WSGIApplication([
  ('/', handlers.HomePage),
  ('/newpost', handlers.NewPostPage),
  ('/signup', handlers.SignupPage),
  ('/login', handlers.LoginPage),
  ('/logout', handlers.LogoutPage),
  ('/welcome', handlers.WelcomePage),
  ('/flush', handlers.FlushCachePage),
  ('/.json', handlers.JsonPage),
  (r'/(\d+)\.json', handlers.JsonPage),
  (r'/(\d+)', handlers.HomePage)
  ], debug=True)


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Roslyn.Utilities;
using System;
using System.Reflection;

namespace Microsoft.CodeAnalysis
{
    /// <summary>
    /// Shim for APIs available only on CoreCLR.
    /// </summary>
    internal static class CoreClrShim
    {
        internal static bool IsRunningOnCoreClr => AssemblyLoadContext.Type != null;

        internal static class AssemblyLoadContext
        {
            internal static readonly Type Type = ReflectionUtilities.TryGetType(
               "System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
        }

        internal static class AppContext
        {
            internal static readonly Type Type = ReflectionUtilities.TryGetType(
                "System.AppContext, System.AppContext, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");

            // only available in netstandard 1.6+
            internal static readonly Func<string, object> GetData =
                Type.GetTypeInfo().GetDeclaredMethod("GetData")?.CreateDelegate<Func<string, object>>();
        }
    }
}


text:
const fs = require('fs');

require('required_env')(fs.readdirSync('./env').reduce((r, file) => {
  return r.concat(require('./env/'+file));
}, []))

const restify = require('restify');

const app = restify.createServer();
const io = require('socket.io').listen(app.server);

app.use(restify.bodyParser());
app.use(restify.queryParser());

fs.readdirSync('./middleware').map(name => {
  require('./middleware/'+name)(app);
});

fs.readdirSync('./routes').map(name => {
  const route = require('./routes/'+name);
  route.http(app);
  route.ws(io);
});

process.on('unhandledRejection', function(reason, p) {
  console.error("Unhandled Rejection at: Promise ", p, " reason: ", reason);
});

module.exports = app;


text:
package hu.sch.services.exceptions;

/**
 *
 * @author Adam Lantos
 */
public class InvalidPasswordException extends Exception {

    public InvalidPasswordException() {
    }

    public InvalidPasswordException(String message) {
        super(message);
    }

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <name>Flowable - Camel CDI</name>
  <artifactId>flowable-camel-cdi</artifactId>
  <packaging>bundle</packaging>

  <parent>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-root</artifactId>
    <relativePath>../..</relativePath>
    <version>6.5.0-SNAPSHOT</version>
  </parent>

  <dependencies>
      <dependency>
          <groupId>org.flowable</groupId>
          <artifactId>flowable-engine</artifactId>
      </dependency>
      <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-camel</artifactId>
      </dependency>
      <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-cdi</artifactId>
      </dependency>
      <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cdi</artifactId>
      </dependency>
      <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <scope>test</scope>
      </dependency>
      <dependency>
          <groupId>org.jboss.arquillian.junit</groupId>
          <artifactId>arquillian-junit-container</artifactId>
          <scope>test</scope>
      </dependency>
      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <scope>test</scope>
      </dependency>
      <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>test</scope>
      </dependency>
      <dependency>
          <groupId>org.jboss.spec</groupId>
          <artifactId>jboss-javaee-6.0</artifactId>
          <version>2.0.0.Final</version>
          <type>pom</type>
          <scope>provided</scope>
          <exclusions>
              <exclusion>
                  <artifactId>xalan</artifactId>
                  <groupId>org.apache.xalan</groupId>
              </exclusion>
          </exclusions>
      </dependency>
  </dependencies>

  <properties>
    <flowable.osgi.import.pkg>*</flowable.osgi.import.pkg>
    <flowable.artifact>
      org.flowable.camel.cdi
    </flowable.artifact>
  </properties>

  <profiles>
    <profile>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <id>distro</id>
      <dependencies>
        <dependency>
          <groupId>org.jboss.arquillian.container</groupId>
          <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-core</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.weld</groupId>
          <artifactId>weld-api</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-simple</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-core-bom</artifactId>
            <version>1.1.33.Final</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>


text:
package com.intel.mtwilson.wlm.business;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.persistence.EntityManagerFactory;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doReturn;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;

import com.intel.mtwilson.as.controller.MwMleSourceJpaController;
import com.intel.mtwilson.as.controller.TblMleJpaController;
import com.intel.mtwilson.as.controller.TblOemJpaController;
import com.intel.mtwilson.as.controller.TblOsJpaController;
import com.intel.mtwilson.as.controller.TblPcrManifestJpaController;
import com.intel.mtwilson.as.data.TblMle;
import com.intel.mtwilson.as.data.TblOem;
import com.intel.mtwilson.as.data.TblOs;
import com.intel.mtwilson.as.data.TblPcrManifest;
import com.intel.mtwilson.datatypes.ManifestData;
import com.intel.mtwilson.datatypes.MleData;
import com.intel.mtwilson.datatypes.PCRWhiteList;
import com.intel.mtwilson.datatypes.MleData.AttestationType;
import com.intel.mtwilson.datatypes.MleData.MleType;

@RunWith(MockitoJUnitRunner.class)
public class MleBOTest {
	@Mock
    private TblMleJpaController tblMleJpaController;

	@Mock
    private TblPcrManifestJpaController tblPcrManifestJpaController;

	@Mock
    private TblOemJpaController tblOemJpaController;

	@Mock
    private TblOsJpaController tblOsJpaController;

	@Mock
	private MwMleSourceJpaController mleSourceJpaController;

    @Mock
    private EntityManagerFactory emf;

    @Spy
    private MleBO mleBO = new MleBO();

    private int MLE_ID1 = 1;

    private int MLE_ID2 = 2;

    private int OEM_ID = 1;

    private int OS_ID = 1;

    private int PcrManifest_ID1 = 1;

    private int PcrManifest_ID2 = 2;

	@Before
	public void setUp() throws Exception {
		doReturn(emf).when(mleBO).getEntityManagerFactory();
        doReturn(tblMleJpaController).when(mleBO).getTblMleJpaController();
        doReturn(tblPcrManifestJpaController).when(mleBO).getTblPcrManifestJpaController();
        doReturn(tblOemJpaController).when(mleBO).getTblOemJpaController();
        doReturn(tblOsJpaController).when(mleBO).getTblOsJpaController();
        doReturn(mleSourceJpaController).when(mleBO).getMleSourceJpaController();
	}

	@After
	public void tearDown() throws Exception {
		if (emf != null)
            emf.close();
	}

	@Test
	public void testAddMLe() {
		TblMle biosMle = null;
		TblMle vmmMle = null;
		TblOem tblOem = new TblOem();
		tblOem.setId(OEM_ID);
		tblOem.setName("DELL");
		TblOs tblOs = new TblOs(OS_ID, "Fedora", "20");
		doReturn(tblOem).when(tblOemJpaController).findTblOemByName(anyString());
		doReturn(tblOs).when(tblOsJpaController).findTblOsByNameVersion(anyString(), anyString());
		doReturn(biosMle).when(tblMleJpaController).findBiosMle(anyString(), anyString(), anyString());
		doReturn(vmmMle).when(tblMleJpaController).findVmmMle(anyString(), anyString(), anyString(), anyString());
		List<ManifestData> biosManifestList = new ArrayList<ManifestData>();
		biosManifestList.add(new ManifestData("0", "31B97D97B4679917EC3C1D943635693FFBAB4143"));
        MleData biosMleData = new MleData("DELL", "A08", MleType.BIOS, AttestationType.PCR, biosManifestList, "", "", "", "DELL");
        List<ManifestData> vmmManifestList = new ArrayList<ManifestData>();
		vmmManifestList.add(new ManifestData("18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"));
		MleData vmmMleData = new MleData("XEN", "4.3", MleType.VMM, AttestationType.PCR, vmmManifestList, "", "Fedora", "20", "");
		String biosResult = mleBO.addMLe(biosMleData);
    	assertEquals("true", biosResult);
    	String vmmResult = mleBO.addMLe(vmmMleData);
    	assertEquals("true", vmmResult);
	}

	@Test
	public void testUpdateMle() {
		TblMle biosMle = new TblMle(MLE_ID1, "DELL", "A08", "PCR", "BIOS", "0");
		TblMle vmmMle = new TblMle(MLE_ID2, "XEN", "4.3", "PCR", "VMM", "18");
		doReturn(biosMle).when(tblMleJpaController).findBiosMle(anyString(), anyString(), anyString());
		doReturn(vmmMle).when(tblMleJpaController).findVmmMle(anyString(), anyString(), anyString(), anyString());
		List<ManifestData> biosManifestList = new ArrayList<ManifestData>();
		biosManifestList.add(new ManifestData("0", "31B97D97B4679917EC3C1D943635693FFBAB4143"));
        MleData biosMleData = new MleData("DELL", "A08", MleType.BIOS, AttestationType.PCR, biosManifestList, "", "", "", "DELL");
        List<ManifestData> vmmManifestList = new ArrayList<ManifestData>();
		vmmManifestList.add(new ManifestData("18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"));
		MleData vmmMleData = new MleData("XEN", "4.3", MleType.VMM, AttestationType.PCR, vmmManifestList, "", "Fedora", "20", "");
		String biosResult = mleBO.updateMle(biosMleData);
        assertEquals("true", biosResult);
        String vmmResult = mleBO.updateMle(vmmMleData);
    	assertEquals("true", vmmResult);
	}

	@Test
	public void testDeleteMle() {
		TblMle biosMle = mockFindBiosMle();
		TblMle vmmMle = mockFindVmmMle();
		doReturn(mockFindBiosMle()).when(tblMleJpaController).findBiosMle(anyString(), anyString(), anyString());
		doReturn(mockFindVmmMle()).when(tblMleJpaController).findVmmMle(anyString(), anyString(), anyString(), anyString());
		String biosResult = mleBO.deleteMle(biosMle.getName(), biosMle.getVersion(), biosMle.getOsId().getName(),
				biosMle.getOsId().getVersion(), biosMle.getOemId().getName());
		assertEquals("true", biosResult);
		String vmmResult = mleBO.deleteMle(vmmMle.getName(), vmmMle.getVersion(), vmmMle.getOsId().getName(),
				vmmMle.getOsId().getVersion(), vmmMle.getOemId().getName());
		assertEquals("true", vmmResult);
	}

	@Test
	public void testAddPCRWhiteList() {
		PCRWhiteList biosPcrData = new PCRWhiteList("0", "31B97D97B4679917EC3C1D943635693FFBAB4143", "DELL", "A08",
				"", "", "DELL");
		PCRWhiteList vmmPcrData = new PCRWhiteList("18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "XEN", "4.3",
				"Fedora", "20", "");
		doReturn(new TblMle(MLE_ID1, "DELL", "A08", "PCR", "BIOS", "0")).when(tblMleJpaController).findBiosMle(biosPcrData.getMleName(),
				biosPcrData.getMleVersion(), biosPcrData.getOemName());
		doReturn(new TblMle(MLE_ID2, "XEN", "4.3", "PCR", "VMM", "18")).when(tblMleJpaController).findVmmMle(vmmPcrData.getMleName(),
				vmmPcrData.getMleVersion(), vmmPcrData.getOsName(), vmmPcrData.getOsVersion());
		doReturn(null).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID1, biosPcrData.getPcrName());
		doReturn(null).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID2,vmmPcrData.getPcrName());
		String biosResult = mleBO.addPCRWhiteList(biosPcrData);
		assertEquals("true", biosResult);
		String vmmResult = mleBO.addPCRWhiteList(vmmPcrData);
		assertEquals("true", vmmResult);

	}

	@Test
	public void testUpdatePCRWhiteList() {
		PCRWhiteList biosPcrData = new PCRWhiteList("0", "31B97D97B4679917EC3C1D943635693FFBAB4143", "DELL", "A08",
				"", "", "DELL");
		PCRWhiteList vmmPcrData = new PCRWhiteList("18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "XEN", "4.3",
				"Fedora", "20", "");
		doReturn(new TblMle(MLE_ID1, "DELL", "A08", "PCR", "BIOS", "0")).when(tblMleJpaController).findBiosMle(biosPcrData.getMleName(),
				biosPcrData.getMleVersion(), biosPcrData.getOemName());
		doReturn(new TblMle(MLE_ID2, "XEN", "4.3", "PCR", "VMM", "18")).when(tblMleJpaController).findVmmMle(vmmPcrData.getMleName(),
				vmmPcrData.getMleVersion(), vmmPcrData.getOsName(), vmmPcrData.getOsVersion());
		doReturn(new TblPcrManifest(PcrManifest_ID1, biosPcrData.getPcrName(), biosPcrData.getPcrDigest()))
		        .when(tblPcrManifestJpaController).findByMleIdName(MLE_ID1, biosPcrData.getPcrName());
		doReturn(new TblPcrManifest(PcrManifest_ID2, vmmPcrData.getPcrName(), vmmPcrData.getPcrDigest()))
		        .when(tblPcrManifestJpaController).findByMleIdName(MLE_ID2,vmmPcrData.getPcrName());
		String biosResult = mleBO.updatePCRWhiteList(biosPcrData);
		assertEquals("true", biosResult);
		String vmmResult = mleBO.updatePCRWhiteList(vmmPcrData);
		assertEquals("true", vmmResult);
	}

	@Test
	public void testDeletePCRWhiteList() {
		doReturn(new TblMle(MLE_ID1, "DELL", "A08", "PCR", "BIOS", "0")).when(tblMleJpaController).findBiosMle("DELL", "A08", "DELL");
		doReturn(new TblMle(MLE_ID2, "XEN", "4.3", "PCR", "VMM", "18")).when(tblMleJpaController).findVmmMle("XEN", "4.3", "Fedora", "20");
		doReturn(new TblPcrManifest(PcrManifest_ID1, "0", "31B97D97B4679917EC3C1D943635693FFBAB4143")).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID1, "0");
		doReturn(new TblPcrManifest(PcrManifest_ID2, "18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")).when(tblPcrManifestJpaController).findByMleIdName(MLE_ID2, "18");
		String biosResult = mleBO.deletePCRWhiteList("0", "DELL", "A08", "", "", "DELL");
		assertEquals("true", biosResult);
		String vmmResult = mleBO.deletePCRWhiteList("18", "XEN", "4.3", "Fedora", "20", "");
		assertEquals("true", vmmResult);
	}

	public TblMle mockFindBiosMle() {
		String biosName = "DELL";
		String biosVersion = "A08";
		String oemName = "DELL";
	    TblMle biosMle = new TblMle();
	    biosMle.setId(MLE_ID1);
	    biosMle.setName(biosName);
	    biosMle.setVersion(biosVersion);
	    TblOem oem = new TblOem();
	    oem.setId(1);
	    oem.setName(oemName);
	    biosMle.setOemId(oem);
	    biosMle.setOsId(new TblOs());
	    Collection<TblPcrManifest> tblPcrManifestCollection = new ArrayList<TblPcrManifest>();
	    TblPcrManifest tblPcrManifest = new TblPcrManifest();
	    tblPcrManifest.setId(1);
	    tblPcrManifest.setName("0");
	    tblPcrManifest.setValue("31B97D97B4679917EC3C1D943635693FFBAB4143");
	    tblPcrManifestCollection.add(tblPcrManifest);
	    biosMle.setTblPcrManifestCollection(tblPcrManifestCollection);
	    return biosMle;
	}

	public TblMle mockFindVmmMle() {
		String vmmName = "XEN";
		String vmmVersion = "4.3";
		String osName = "Fedora";
		String osVersion = "20";
	    TblMle vmmMle = new TblMle();
	    vmmMle.setId(MLE_ID2);
	    vmmMle.setName(vmmName);
	    vmmMle.setVersion(vmmVersion);
	    vmmMle.setOemId(new TblOem());
	    TblOs os = new TblOs();
	    os.setId(1);
	    os.setName(osName);
	    os.setVersion(osVersion);
	    vmmMle.setOsId(os);
	    Collection<TblPcrManifest> tblPcrManifestCollectionVMM = new ArrayList<TblPcrManifest>();
        TblPcrManifest tblPcrManifestVMM = new TblPcrManifest();
        tblPcrManifestVMM.setId(2);
        tblPcrManifestVMM.setName("18");
        tblPcrManifestVMM.setValue("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
        tblPcrManifestCollectionVMM.add(tblPcrManifestVMM);
        vmmMle.setTblPcrManifestCollection(tblPcrManifestCollectionVMM);
        return vmmMle;
	}
}


text:
.. _events:
.. _properties:

Events and Properties
=====================

Events are an important part of Kivy programming. That may not be surprising to
those with GUI development experience, but it's an important concept for
newcomers. Once you understand how events work and how to bind to them, you
will see them everywhere in Kivy. They make it easy to build whatever behavior
you want into Kivy.

The following illustration shows how events are handled in the Kivy framework.

.. image:: images/Events.*

Introduction to the Event Dispatcher
------------------------------------

One of the most important base classes of the framework is the
:class:`~kivy.event.EventDispatcher` class. This class allows you to register
event types, and to dispatch them to interested parties (usually other event
dispatchers). The :class:`~kivy.uix.widget.Widget`,
:class:`~kivy.animation.Animation` and :obj:`~kivy.clock.Clock` classes are
examples of event dispatchers.

EventDispatcher objects depend on the main loop to generate and
handle events.

Main loop
---------

As outlined in the illustration above, Kivy has a `main loop`. This loop is
running during all of the application's lifetime and only quits when exiting
the application.

Inside the loop, at every iteration, events are generated from user input,
hardware sensors or a couple of other sources, and frames are rendered to the
display.

Your application will specify callbacks (more on this later), which are called
by the main loop. If a callback takes too long or doesn't quit at all, the main
loop is broken and your app doesn't work properly anymore.

In Kivy applications, you have to avoid long/infinite loops or sleeping.
For example the following code does both::

    while True:
        animate_something()
        time.sleep(.10)

When you run this, the program will never exit your loop, preventing Kivy from
doing all of the other things that need doing. As a result, all you'll see is a
black window which you won't be able to interact with. Instead, you need to
"schedule" your ``animate_something()`` function to be called repeatedly.

Scheduling a repetitive event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can call a function or a method every X times per second using
:meth:`~kivy.clock.Clock.schedule_interval`. Here is an example of calling a
function named my_callback 30 times per second::

    def my_callback(dt):
        print 'My callback is called', dt
    Clock.schedule_interval(my_callback, 1 / 30.)

You have two ways of unscheduling a previously scheduled event. The first would be
to use :meth:`~kivy.clock.Clock.unschedule`::

    Clock.unschedule(my_callback)

Or, you can return False in your callback, and your event will be automatically
unscheduled::

    count = 0
    def my_callback(dt):
        global count
        count += 1
        if count == 10:
            print 'Last call of my callback, bye bye !'
            return False
        print 'My callback is called'
    Clock.schedule_interval(my_callback, 1 / 30.)

Scheduling a one-time event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Using :meth:`~kivy.clock.Clock.schedule_once`, you can call a function "later",
like in the next frame, or in X seconds::

    def my_callback(dt):
        print 'My callback is called !'
    Clock.schedule_once(my_callback, 1)

This will call ``my_callback`` in one second. The second argument is the amount
of time to wait before calling the function, in seconds. However, you can
achieve some other results with special values for the second argument:

- If X is greater than 0, the callback will be called in X seconds
- If X is 0, the callback will be called after the next frame
- If X is -1, the callback will be called before the next frame

The -1 is mostly used when you are already in a scheduled event, and if you
want to schedule a call BEFORE the next frame is happening.

A second method for repeating a function call is to first schedule a callback once
with :meth:`~kivy.clock.Clock.schedule_once`, and a second call to this function
inside the callback itself::

    def my_callback(dt):
        print 'My callback is called !'
        Clock.schedule_once(my_callback, 1)
    Clock.schedule_once(my_callback, 1)

While the main loop will try to keep to the schedule as requested, there is some
uncertainty as to when exactly a scheduled callback will be called. Sometimes
another callback or some other task in the application will take longer than
anticipated and thus the timing can be a little off.

In the latter solution to the repetitive callback problem, the next iteration will
be called at least one second after the last iteration ends. With
:meth:`~kivy.clock.Clock.schedule_interval` however, the callback is called
every second.

Trigger events
~~~~~~~~~~~~~~

If you want to schedule a function to be called only once for the next frame,
like a trigger, you might be tempted to achieve that like so::

    Clock.unschedule(my_callback)
    Clock.schedule_once(my_callback, 0)

This way of programming a trigger is expensive, since you'll always call
unschedule, whether or not you've even scheduled it. In addition, unschedule
needs to iterate the weakref list of the Clock in order to find your callback
and remove it. Use a trigger instead::

    trigger = Clock.create_trigger(my_callback)
    # later
    trigger()

Each time you call trigger(), it will schedule a single call of your callback. If
it was already scheduled, it will not be rescheduled.

Widget events
-------------

A widget has 2 default types of events:

- Property event: if your widget changes its position or size, an event is fired.
- Widget-defined event: e.g. an event will be fired for a Button when it's pressed or
  released.

Creating custom events
----------------------

To create an event dispatcher with custom events, you need to register the name
of the event in the class and then create a method of the same name.

See the following example::

    class MyEventDispatcher(EventDispatcher):
        def __init__(self, **kwargs):
            self.register_event_type('on_test')
            super(MyEventDispatcher, self).__init__(**kwargs)

        def do_something(self, value):
            # when do_something is called, the 'on_test' event will be
            # dispatched with the value
            self.dispatch('on_test', value)

        def on_test(self, *args):
            print "I am dispatched", args

Attaching callbacks
-------------------

To use events, you have to bind callbacks to them. When the event is
dispatched, your callbacks will be called with the parameters relevant to
that specific event.

A callback can be any python callable, but you need to ensure it accepts
the arguments that the event emits. For this, it's usually safest to accept the
`*args` argument, which will catch all arguments in the `args` list.

Example::

    def my_callback(value, *args):
        print "Hello, I got an event!", args

    ev = MyEventDispatcher()
    ev.bind(on_test=my_callback)
    ev.do_something('test')

Introduction to Properties
--------------------------

Properties are an awesome way to define events and bind to them. Essentially,
they produce events such that when an attribute of your object changes,
all properties that reference that attribute are automatically updated.

There are different kinds of properties to describe the type of data you want to
handle.

- :class:`~kivy.properties.StringProperty`
- :class:`~kivy.properties.NumericProperty`
- :class:`~kivy.properties.BoundedNumericProperty`
- :class:`~kivy.properties.ObjectProperty`
- :class:`~kivy.properties.DictProperty`
- :class:`~kivy.properties.ListProperty`
- :class:`~kivy.properties.OptionProperty`
- :class:`~kivy.properties.AliasProperty`
- :class:`~kivy.properties.BooleanProperty`
- :class:`~kivy.properties.ReferenceListProperty`

Declaration of a Property
-------------------------

To declare properties, you must declare them at the class level. The class will then do
the work to instantiate the real attributes when your object is created. These properties
are not attributes: they are mechanisms for creating events based on your
attributes::

    class MyWidget(Widget):

        text = StringProperty('')

When overriding `__init__`, *always* accept `**kwargs` and use `super()` to call
the parent's `__init__` method, passing in your class instance::

        def __init__(self, **kwargs):
            super(MyWidget, self).__init__(**kwargs)

Dispatching a Property event
----------------------------

Kivy properties, by default, provide an `on_<property_name>` event. This event is
called when the value of the property is changed.

.. note::
    If the new value for the property is equal to the current value, then the
    `on_<property_name>` event will not be called.

For example, consider the following code:

.. code-block:: python
   :linenos:

    class CustomBtn(Widget):

        pressed = ListProperty([0, 0])

        def on_touch_down(self, touch):
            if self.collide_point(*touch.pos):
                self.pressed = touch.pos
                return True
            return super(CustomBtn, self).on_touch_down(touch)

        def on_pressed(self, instance, pos):
            print ('pressed at {pos}'.format(pos=pos))

In the code above at line 3::

    pressed = ListProperty([0, 0])

We define the `pressed` Property of type :class:`~kivy.properties.ListProperty`,
giving it a default value of `[0, 0]`. From this point forward, the `on_pressed`
event will be called whenever the value of this property is changed.

At Line 5::

    def on_touch_down(self, touch):
        if self.collide_point(*touch.pos):
            self.pressed = touch.pos
            return True
        return super(CustomBtn, self).on_touch_down(touch)

We override the :meth:`on_touch_down` method of the Widget class. Here, we check
for collision of the `touch` with our widget.

If the touch falls inside of our widget, we change the value of `pressed` to touch.pos
and return True, indicating that we have consumed the touch and don't want it to
propagate any further.

Finally, if the touch falls outside our widget, we call the original event
using `super(...)` and return the result. This allows the touch event propagation
to continue as it would normally have occured.

Finally on line 11::

    def on_pressed(self, instance, pos):
        print ('pressed at {pos}'.format(pos=pos))

We define an `on_pressed` function that will be called by the property whenever the
property value is changed.

.. Note::
    This `on_<prop_name>` event is called within the class where the property is
    defined. To monitor/observe any change to a property outside of the class
    where it's defined, you should bind to the property as shown below.

**Binding to the property**

How to monitor changes to a property when all you have access to is a widget
instance? You *bind* to the property::

    your_widget_instance.bind(property_name=function_name)

For example, consider the following code:

.. code-block:: python
   :linenos:

    class RootWidget(BoxLayout):

        def __init__(self, **kwargs):
            super(RootWidget, self).__init__(**kwargs)
            self.add_widget(Button(text='btn 1'))
            cb = CustomBtn()
            cb.bind(pressed=self.btn_pressed)
            self.add_widget(cb)
            self.add_widget(Button(text='btn 2'))

        def btn_pressed(self, instance, pos):
            print ('pos: printed from root widget: {pos}'.format(pos=.pos))

If you run the code as is, you will notice two print statements in the console.
One from the `on_pressed` event that is called inside the `CustomBtn` class and
another from the `btn_pressed` function that we bind to the property change.

The reason that both functions are called is simple. Binding doesn't mean
overriding. Having both of these functions is redundant and you should generally
only use one of the methods of listening/reacting to property changes.

You should also take note of the parameters that are passed to the
`on_<property_name>` event or the function bound to the property.

.. code-block:: python

    def btn_pressed(self, instance, pos):

The first parameter is `self`, which is the instance of the class where this
function is defined. You can use an in-line function as follows:

.. code-block:: python
   :linenos:

    cb = CustomBtn()

    def _local_func(instance, pos):
        print ('pos: printed from root widget: {pos}'.format(pos=.pos))

    cb.bind(pressed=_local_func)
    self.add_widget(cb)

The first parameter would be the `instance` of the class the property is
defined.

The second parameter would be the `value`, which is the new value of the property.

Here is the complete example, derived from the snippets above, that you can
use to copy and paste into an editor to experiment.

.. code-block:: python
   :linenos:

    from kivy.app import App
    from kivy.uix.widget import Widget
    from kivy.uix.button import Button
    from kivy.uix.boxlayout import BoxLayout
    from kivy.properties import ListProperty

    class RootWidget(BoxLayout):

        def __init__(self, **kwargs):
            super(RootWidget, self).__init__(**kwargs)
            self.add_widget(Button(text='btn 1'))
            cb = CustomBtn()
            cb.bind(pressed=self.btn_pressed)
            self.add_widget(cb)
            self.add_widget(Button(text='btn 2'))

        def btn_pressed(self, instance, pos):
            print ('pos: printed from root widget: {pos}'.format(pos=pos))

    class CustomBtn(Widget):

        pressed = ListProperty([0, 0])

        def on_touch_down(self, touch):
            if self.collide_point(*touch.pos):
                self.pressed = touch.pos
                # we consumed the touch. return False here to propagate
                # the touch further to the children.
                return True
            return super(CustomBtn, self).on_touch_down(touch)

        def on_pressed(self, instance, pos):
            print ('pressed at {pos}'.format(pos=pos))

    class TestApp(App):

        def build(self):
            return RootWidget()

    if __name__ == '__main__':
        TestApp().run()

Running the code above will give you the following output:

.. image:: images/property_events_binding.png

Our CustomBtn has no visual representation and thus appears black. You can
touch/click on the black area to see the output on your console.

Compound Properties
-------------------

When defining an :class:`~kivy.properties.AliasProperty`, you normally define
a getter and a setter function yourself. Here, it falls on to you to define
when the getter and the setter functions are called using the `bind` argument.

Consider the following code.

.. code-block:: python
   :linenos:

    cursor_pos = AliasProperty(_get_cursor_pos, None, bind=(
        'cursor', 'padding', 'pos', 'size', 'focus',
        'scroll_x', 'scroll_y'))
    '''Current position of the cursor, in (x, y).

    :attr:`cursor_pos` is a :class:`~kivy.properties.AliasProperty`, read-only.
    '''

Here `cursor_pos` is a :class:`~kivy.properties.AliasProperty` which uses the
`getter` `_get_cursor_pos` with the `setter` part set to None, implying this
is a read only Property.

The bind argument at the end defines that `on_cursor_pos` event is dispatched
when any of the properties used in the `bind=` argument change.


text:
package com.github.mybatis.helper.page.dialect.helper;

import org.apache.ibatis.session.RowBounds;

/**
 * oracle断言.
 * @author will
 */
public class OracleDialect implements Dialect {

    @Override
    public String buildPageSql(String sql, RowBounds rowBounds) {
        StringBuilder sqlBuilder = new StringBuilder();
        sqlBuilder.append("select * from (select h.*,rownum rn from (");
        sqlBuilder.append(sql);
        sqlBuilder.append(" ) h where rownum <=").append(rowBounds.getOffset()+rowBounds.getLimit()).append(") where rn> ").append(rowBounds.getOffset());
        return sqlBuilder.toString();
    }
}


text:
"""Testing v0x04 FlowRemoved message."""
from pyof.v0x04.asynchronous.flow_removed import FlowRemoved, FlowRemovedReason
from pyof.v0x04.common.flow_match import (
    Match, MatchType, OxmClass, OxmOfbMatchField, OxmTLV)
from tests.unit.test_struct import TestStruct

class TestFlowRemovedMsg(TestStruct):
    """FlowRemoved message tests (also those in :class:`.TestDump`)."""

    @classmethod
    def setUpClass(cls):
        """Configure raw file and its object in parent class (TestDump)."""
        super().setUpClass()
        super().set_raw_dump_file('v0x04', 'ofpt_flow_removed')
        super().set_raw_dump_object(FlowRemoved, xid=0,
                                    cookie=0x0000000000000000, priority=1000,
                                    reason=FlowRemovedReason.OFPRR_DELETE,
                                    table_id=0, duration_sec=77,
                                    duration_nsec=559000000, idle_timeout=0,
                                    hard_timeout=0, packet_count=0,
                                    byte_count=0, match=_new_match())
        super().set_minimum_size(56)

def _new_match():
    """Crate new Match instance."""
    tlv1 = OxmTLV(oxm_class=OxmClass.OFPXMC_OPENFLOW_BASIC,
                  oxm_field=OxmOfbMatchField.OFPXMT_OFB_ETH_TYPE,
                  oxm_hasmask=False, oxm_value=b'\x88\xcc')
    tlv2 = OxmTLV(oxm_class=OxmClass.OFPXMC_OPENFLOW_BASIC,
                  oxm_field=OxmOfbMatchField.OFPXMT_OFB_VLAN_VID,
                  oxm_hasmask=False, oxm_value=b'\x1e\xd7')
    return Match(match_type=MatchType.OFPMT_OXM,
                 oxm_match_fields=[tlv1, tlv2])


text:
'use strict';

let angular = require('angular');

module.exports = angular.module('spinnaker.amazon.serverGroup.details.resize.controller', [
  require('../../../../core/account/account.service.js'),
  require('../../../../core/application/modal/platformHealthOverride.directive.js'),
  require('../../../../core/serverGroup/serverGroup.write.service.js'),
  require('../../../../core/task/monitor/taskMonitorService.js'),
  require('../../report/reservationReport.directive.js'),
])
  .controller('awsResizeServerGroupCtrl', function($scope, $modalInstance, accountService, serverGroupWriter,
                                                   taskMonitorService, reservationReportReader,
                                                   application, serverGroup) {
    $scope.serverGroup = serverGroup;
    $scope.currentSize = {
      min: serverGroup.asg.minSize,
      max: serverGroup.asg.maxSize,
      desired: serverGroup.asg.desiredCapacity,
      newSize: null
    };

    $scope.verification = {
      required: accountService.challengeDestructiveActions(serverGroup.account)
    };

    $scope.command = angular.copy($scope.currentSize);
    $scope.command.advancedMode = serverGroup.asg.minSize !== serverGroup.asg.maxSize;

    if (application && application.attributes) {
      if (application.attributes.platformHealthOnly) {
        $scope.command.interestingHealthProviderNames = ["Amazon"];
      }

      $scope.command.platformHealthOnlyShowOverride = application.attributes.platformHealthOnlyShowOverride;
    }

    this.isValid = function () {
      var command = $scope.command;
      if ($scope.verification.required && $scope.verification.verifyAccount !== serverGroup.account.toUpperCase()) {
        return false;
      }
      return command.advancedMode ?
        command.min <= command.max && command.desired >= command.min && command.desired <= command.max :
        command.newSize !== null;
    };

    this.resize = function () {
      if (!this.isValid()) {
        return;
      }
      var capacity = { min: $scope.command.min, max: $scope.command.max, desired: $scope.command.desired };
      if (!$scope.command.advancedMode) {
        capacity = { min: $scope.command.newSize, max: $scope.command.newSize, desired: $scope.command.newSize };
      }

      var submitMethod = function() {
        return serverGroupWriter.resizeServerGroup(serverGroup, application, {
          capacity: capacity,
          interestingHealthProviderNames: $scope.command.interestingHealthProviderNames,
        });
      };

      var taskMonitorConfig = {
        modalInstance: $modalInstance,
        application: application,
        title: 'Resizing ' + serverGroup.name,
        submitMethod: submitMethod
      };

      $scope.taskMonitor = taskMonitorService.buildTaskMonitor(taskMonitorConfig);

      $scope.taskMonitor.submit(submitMethod);
    };

    this.cancel = function () {
      $modalInstance.dismiss();
    };
  }).name;


text:
package com.hazelcast.config;

import com.hazelcast.internal.config.ConfigDataSerializerHook;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static com.hazelcast.internal.serialization.impl.SerializationUtil.readNullableList;
import static com.hazelcast.internal.serialization.impl.SerializationUtil.writeNullableList;
import static com.hazelcast.internal.util.Preconditions.checkFalse;
import static com.hazelcast.internal.util.Preconditions.checkHasText;
import static com.hazelcast.internal.util.Preconditions.checkNotNegative;
import static com.hazelcast.internal.util.Preconditions.checkNotNull;
import static com.hazelcast.internal.util.Preconditions.checkPositive;

/**
 * Contains configuration for {@code QueryCache}.
 *
 * @since 3.5
 */

@SuppressWarnings("checkstyle:methodcount")
public class QueryCacheConfig implements IdentifiedDataSerializable {

    /**
     * By default, after reaching this minimum size, node immediately sends buffered events to {@code QueryCache}.
     */
    public static final int DEFAULT_BATCH_SIZE = 1;

    /**
     * By default, only buffer last {@code DEFAULT_BUFFER_SIZE} events fired from a partition.
     */
    public static final int DEFAULT_BUFFER_SIZE = 16;

    /**
     * Default value of delay seconds which an event wait in the buffer of a node, before sending to {@code QueryCache}.
     */
    public static final int DEFAULT_DELAY_SECONDS = 0;

    /**
     * By default, also cache values of entries besides keys.
     */
    public static final boolean DEFAULT_INCLUDE_VALUE = true;

    /**
     * By default, execute an initial population query prior to creation of the {@code QueryCache}.
     */
    public static final boolean DEFAULT_POPULATE = true;

    /**
     * Default value of coalesce property.
     */
    public static final boolean DEFAULT_COALESCE = false;

    /**
     * By default, hold values of entries in {@code QueryCache} as binary.
     */
    public static final InMemoryFormat DEFAULT_IN_MEMORY_FORMAT = InMemoryFormat.BINARY;

    /**
     * After reaching this minimum size, node immediately sends buffered events to {@code QueryCache}.
     */
    private int batchSize = DEFAULT_BATCH_SIZE;

    /**
     * Maximum number of events which can be stored in a buffer of partition.
     */
    private int bufferSize = DEFAULT_BUFFER_SIZE;

    /**
     * The minimum number of delay seconds which an event waits in the buffer of node.
     */
    private int delaySeconds = DEFAULT_DELAY_SECONDS;

    /**
     * Flag to enable/disable value caching.
     */
    private boolean includeValue = DEFAULT_INCLUDE_VALUE;

    /**
     * Flag to enable/disable initial population of the {@code QueryCache}.
     */
    private boolean populate = DEFAULT_POPULATE;

    /**
     * Flag to enable/disable coalescing.
     *
     * @see #setCoalesce
     */
    private boolean coalesce = DEFAULT_COALESCE;

    /**
     * Memory format of values of entries in {@code QueryCache}.
     */
    private InMemoryFormat inMemoryFormat = DEFAULT_IN_MEMORY_FORMAT;

    /**
     * The name of {@code QueryCache}.
     */
    private String name;

    /**
     * The predicate to filter events which wil be applied to the {@code QueryCache}.
     */
    private PredicateConfig predicateConfig = new PredicateConfig();

    private EvictionConfig evictionConfig = new EvictionConfig();

    private List<EntryListenerConfig> entryListenerConfigs;

    private List<IndexConfig> indexConfigs;

    public QueryCacheConfig() {
    }

    public QueryCacheConfig(String name) {
        setName(name);
    }

    public QueryCacheConfig(QueryCacheConfig other) {
        this.batchSize = other.batchSize;
        this.bufferSize = other.bufferSize;
        this.delaySeconds = other.delaySeconds;
        this.includeValue = other.includeValue;
        this.populate = other.populate;
        this.coalesce = other.coalesce;
        this.inMemoryFormat = other.inMemoryFormat;
        this.name = other.name;
        this.predicateConfig = other.predicateConfig;
        this.evictionConfig = other.evictionConfig;
        this.entryListenerConfigs = other.entryListenerConfigs;
        this.indexConfigs = other.indexConfigs;
    }

    /**
     * Returns the name of {@code QueryCache}.
     *
     * @return the name of {@code QueryCache}
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name of {@code QueryCache}.
     *
     * @param name the name of {@code QueryCache}
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setName(String name) {
        checkHasText(name, "name");

        this.name = name;
        return this;
    }

    /**
     * Returns the predicate of {@code QueryCache}.
     *
     * @return the predicate of {@code QueryCache}
     */
    public PredicateConfig getPredicateConfig() {
        return predicateConfig;
    }

    /**
     * Sets the predicate of {@code QueryCache}.
     *
     * @param predicateConfig config for predicate
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setPredicateConfig(PredicateConfig predicateConfig) {
        this.predicateConfig = checkNotNull(predicateConfig, "predicateConfig can not be null");
        return this;
    }

    /**
     * After reaching this size, node sends buffered events to {@code QueryCache}.
     *
     * @return the batch size
     */
    public int getBatchSize() {
        return batchSize;
    }

    /**
     * Sets the batch size which will be used to determine number of events to be sent in a batch to {@code QueryCache}
     *
     * @param batchSize the batch size
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setBatchSize(int batchSize) {
        this.batchSize = checkPositive(batchSize, "batchSize");
        return this;
    }

    /**
     * Returns the maximum number of events which can be stored in a buffer of partition.
     *
     * @return the maximum number of events which can be stored in a buffer of partition
     */
    public int getBufferSize() {
        return bufferSize;
    }

    /**
     * Sets the maximum number of events which can be stored in a buffer of partition.
     *
     * @param bufferSize the buffer size
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setBufferSize(int bufferSize) {
        this.bufferSize = checkPositive(bufferSize, "bufferSize");
        return this;
    }

    /**
     * Returns the minimum number of delay seconds which an event waits in the buffer of node
     * before sending to a {@code QueryCache}
     *
     * @return delay seconds
     */
    public int getDelaySeconds() {
        return delaySeconds;
    }

    /**
     * Sets the minimum number of delay seconds which an event waits in the buffer of node
     * before sending to a {@code QueryCache}
     *
     * @param delaySeconds the delay seconds
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setDelaySeconds(int delaySeconds) {
        this.delaySeconds = checkNotNegative(delaySeconds, "delaySeconds");
        return this;
    }

    /**
     * Returns memory format of values of entries in {@code QueryCache}.
     *

     * Default value is binary.
     *
     * @return memory format of values of entries in {@code QueryCache}
     */
    public InMemoryFormat getInMemoryFormat() {
        return inMemoryFormat;
    }

    /**
     * Sets memory format of values of entries in {@code QueryCache}.
     *

     * Default value is binary.
     *
     * @param inMemoryFormat the memory format
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setInMemoryFormat(InMemoryFormat inMemoryFormat) {
        checkNotNull(inMemoryFormat, "inMemoryFormat cannot be null");
        checkFalse(inMemoryFormat == InMemoryFormat.NATIVE, "InMemoryFormat." + inMemoryFormat + " is not supported.");

        this.inMemoryFormat = inMemoryFormat;
        return this;
    }

    /**
     * Returns {@code true} if value caching enabled, otherwise returns {@code false}.
     *

     * Default value is {@value #DEFAULT_INCLUDE_VALUE}.
     *
     * @return {@code true} if value caching enabled, otherwise returns {@code false}
     */
    public boolean isIncludeValue() {
        return includeValue;
    }

    /**
     * Set {@code true} to enable value caching, otherwise set {@code false}
     *

     * Default value is {@value #DEFAULT_INCLUDE_VALUE}.
     *
     * @param includeValue Set {@code true} if value caching is enabled, otherwise set {@code false}
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setIncludeValue(boolean includeValue) {
        this.includeValue = includeValue;
        return this;
    }

    /**
     * Returns {@code true} if initial population of {@code QueryCache} is enabled, otherwise returns {@code false}.
     *

     * Default value is {@value #DEFAULT_POPULATE}.
     *
     * @return {@code true} if initial population of {@code QueryCache} is enabled, otherwise returns {@code false}
     */
    public boolean isPopulate() {
        return populate;
    }

    /**
     * Set {@code true} to enable initial population, otherwise set {@code false}.
     *

     * Default value is {@value #DEFAULT_POPULATE}.
     *
     * @param populate set {@code true} to enable initial population, otherwise set {@code false}
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setPopulate(boolean populate) {
        this.populate = populate;
        return this;
    }

    /**
     * Returns {@code true} if coalescing is is enabled, otherwise returns {@code false}.
     *

     * Default value is {@value #DEFAULT_COALESCE}.
     *
     * @return {@code true} if coalescing is is enabled, otherwise returns {@code false}
     * @see #setCoalesce
     */
    public boolean isCoalesce() {
        return coalesce;
    }

    /**
     * Set {@code true} to enable coalescing, otherwise set {@code false}.
     * This setting is only valid if {@code QueryCacheConfig#delaySeconds} is greater than 0.
     *

     * Default value is {@value #DEFAULT_COALESCE}.
     *
     * @param coalesce set {@code true} to enable, otherwise set {@code false}
     */
    public QueryCacheConfig setCoalesce(boolean coalesce) {
        this.coalesce = coalesce;
        return this;
    }

    /**
     * Returns {@link EvictionConfig} instance for this {@code QueryCache}
     *
     * @return the {@link EvictionConfig} instance for this {@code QueryCache}
     */
    public EvictionConfig getEvictionConfig() {
        return evictionConfig;
    }

    /**
     * Sets the {@link EvictionConfig} instance for this {@code QueryCache}
     *
     * @param evictionConfig the {@link EvictionConfig} instance for eviction configuration to set
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig setEvictionConfig(EvictionConfig evictionConfig) {
        checkNotNull(evictionConfig, "evictionConfig cannot be null");

        this.evictionConfig = evictionConfig;
        return this;
    }

    /**
     * Adds {@link EntryListenerConfig} to this {@code QueryCacheConfig}.
     *
     * @param listenerConfig the {@link EntryListenerConfig} to add
     * @return this {@code QueryCacheConfig} instance
     */
    public QueryCacheConfig addEntryListenerConfig(EntryListenerConfig listenerConfig) {
        checkNotNull(listenerConfig, "listenerConfig cannot be null");

        getEntryListenerConfigs().add(listenerConfig);
        return this;
    }

    public List<EntryListenerConfig> getEntryListenerConfigs() {
        if (entryListenerConfigs == null) {
            entryListenerConfigs = new ArrayList<EntryListenerConfig>();
        }
        return entryListenerConfigs;
    }

    public QueryCacheConfig setEntryListenerConfigs(List<EntryListenerConfig> listenerConfigs) {
        checkNotNull(listenerConfigs, "listenerConfig cannot be null");

        this.entryListenerConfigs = listenerConfigs;
        return this;
    }

    public QueryCacheConfig addIndexConfig(IndexConfig indexConfig) {
        getIndexConfigs().add(indexConfig);
        return this;
    }

    public List<IndexConfig> getIndexConfigs() {
        if (indexConfigs == null) {
            indexConfigs = new ArrayList<>();
        }
        return indexConfigs;
    }

    public QueryCacheConfig setIndexConfigs(List<IndexConfig> indexConfigs) {
        this.indexConfigs = indexConfigs;
        return this;
    }

    @Override
    public String toString() {
        return "QueryCacheConfig{"
                + "batchSize=" + batchSize
                + ", bufferSize=" + bufferSize
                + ", delaySeconds=" + delaySeconds
                + ", includeValue=" + includeValue
                + ", populate=" + populate
                + ", coalesce=" + coalesce
                + ", inMemoryFormat=" + inMemoryFormat
                + ", name='" + name + '\''
                + ", predicateConfig=" + predicateConfig
                + ", evictionConfig=" + evictionConfig
                + ", entryListenerConfigs=" + entryListenerConfigs
                + ", indexConfigs=" + indexConfigs
                + '}';
    }

    @Override
    public int getFactoryId() {
        return ConfigDataSerializerHook.F_ID;
    }

    @Override
    public int getClassId() {
        return ConfigDataSerializerHook.QUERY_CACHE_CONFIG;
    }

    @Override
    public void writeData(ObjectDataOutput out) throws IOException {
        out.writeInt(batchSize);
        out.writeInt(bufferSize);
        out.writeInt(delaySeconds);
        out.writeBoolean(includeValue);
        out.writeBoolean(populate);
        out.writeBoolean(coalesce);
        out.writeUTF(inMemoryFormat.name());
        out.writeUTF(name);
        out.writeObject(predicateConfig);
        out.writeObject(evictionConfig);
        writeNullableList(entryListenerConfigs, out);
        writeNullableList(indexConfigs, out);
    }

    @Override
    public void readData(ObjectDataInput in) throws IOException {
        batchSize = in.readInt();
        bufferSize = in.readInt();
        delaySeconds = in.readInt();
        includeValue = in.readBoolean();
        populate = in.readBoolean();
        coalesce = in.readBoolean();
        inMemoryFormat = InMemoryFormat.valueOf(in.readUTF());
        name = in.readUTF();
        predicateConfig = in.readObject();
        evictionConfig = in.readObject();
        entryListenerConfigs = readNullableList(in);
        indexConfigs = readNullableList(in);
    }

    @Override
    @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
    public final boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof QueryCacheConfig)) {
            return false;
        }

        QueryCacheConfig that = (QueryCacheConfig) o;

        if (batchSize != that.batchSize) {
            return false;
        }
        if (bufferSize != that.bufferSize) {
            return false;
        }
        if (delaySeconds != that.delaySeconds) {
            return false;
        }
        if (includeValue != that.includeValue) {
            return false;
        }
        if (populate != that.populate) {
            return false;
        }
        if (coalesce != that.coalesce) {
            return false;
        }
        if (inMemoryFormat != that.inMemoryFormat) {
            return false;
        }
        if (name != null ? !name.equals(that.name) : that.name != null) {
            return false;
        }
        if (predicateConfig != null ? !predicateConfig.equals(that.predicateConfig) : that.predicateConfig != null) {
            return false;
        }
        if (evictionConfig != null ? !evictionConfig.equals(that.evictionConfig) : that.evictionConfig != null) {
            return false;
        }
        if (entryListenerConfigs != null
                ? !entryListenerConfigs.equals(that.entryListenerConfigs) : that.entryListenerConfigs != null) {
            return false;
        }
        return indexConfigs != null ? indexConfigs.equals(that.indexConfigs) : that.indexConfigs == null;
    }

    @Override
    @SuppressWarnings("checkstyle:npathcomplexity")
    public final int hashCode() {
        int result = batchSize;
        result = 31 * result + bufferSize;
        result = 31 * result + delaySeconds;
        result = 31 * result + (includeValue ? 1 : 0);
        result = 31 * result + (populate ? 1 : 0);
        result = 31 * result + (coalesce ? 1 : 0);
        result = 31 * result + (inMemoryFormat != null ? inMemoryFormat.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (predicateConfig != null ? predicateConfig.hashCode() : 0);
        result = 31 * result + (evictionConfig != null ? evictionConfig.hashCode() : 0);
        result = 31 * result + (entryListenerConfigs != null ? entryListenerConfigs.hashCode() : 0);
        result = 31 * result + (indexConfigs != null ? indexConfigs.hashCode() : 0);
        return result;
    }
}


text:
import {Component, OnDestroy} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Subscription} from 'rxjs/Subscription';
import {LoginService} from './login.service';
import {UserProfileService} from '../core/user-profile.service';
import {LocalStorageService} from '../core/local-storage.service';
import {SpinnerService} from '../core/spinner/spinner.service';

import {User} from '../models/user';

@Component({
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.scss'],
  providers: [LoginService, LocalStorageService]
})
export class LoginComponent implements OnDestroy {
  private loginSub: Subscription;
  private user = new User('', '');
  private active: boolean = true;
  private invalidCreds: boolean = false;
  private showLoading: boolean = false;
  constructor(private loginService: LoginService,
              private route: ActivatedRoute,
              private router: Router,
              private userProfileService: UserProfileService,
              private localStorage: LocalStorageService,
              private spinner: SpinnerService) {
  }

  public get isLoggedIn(): boolean {
    return this.userProfileService.isLoggedIn;
  }

  public ngOnDestroy() {
    if (this.loginSub) {
      this.loginSub.unsubscribe();
    }
  }

  private login() {
    this.spinner.show();
    this.showLoading = true;
    let loginResults = null;
   /// {"login": "QB_4453JHSF", "password": "ERB577WAU"}
    this.loginSub = this.loginService
      .login(this.user)
      .mergeMap((loginResult) => {
        loginResults = JSON.parse(loginResult._body);
        return this.route.queryParams
      })
      .map((qp) => qp['redirectTo'])
      .subscribe((redirectTo) => {
        if (loginResults && loginResults.hasOwnProperty('status')) {
          this.invalidCreds = true;
        } else {
          this.localStorage.set('token', loginResults.token);
          this.userProfileService.isLoggedIn = true;
          let url = redirectTo ? [redirectTo] : ['/dashboard'];
          this.router.navigate(url);
        }
        this.showLoading = false;
        this.spinner.hide();
      });
  }

}


text:
class CreateTrips < ActiveRecord::Migration
  def change
    create_table :trips do |t|
      t.string :trip_name
      t.string :location
      t.string :date
      t.integer :user_id
      t.text :to_pack
      t.text :to_do
      t.integer :budget
      t.text :things_i_did
      t.text :things_i_liked
      t.text :things_i_didnt_like

      t.timestamps
    end
  end
end


text:
package java.lang.reflect;

public interface Member {
  public static final int PUBLIC = 0;
  public static final int DECLARED = 1;

  public Class getDeclaringClass();

  public int getModifiers();

  public String getName();
}


text:
<?php

namespace DirectokiBundle\InternalAPI\V1\Model;

/**
 *  @license 3-clause BSD
 *  @link https://github.com/Directoki/Directoki-Core/blob/master/LICENSE.txt
 */
abstract class BaseFieldValue {

    protected $publicID;

    protected $title;

    /**
     * @return mixed
     */
    public function getPublicID() {
        return $this->publicID;
    }

    /**
     * @return mixed
     */
    public function getTitle() {
        return $this->title;
    }

}