text:
"""
"""

# Created on 2014.01.06
#
# Author: Giovanni Cannata
#
# Copyright 2014, 2015, 2016, 2017 Giovanni Cannata
#
# This file is part of ldap3.
#
# ldap3 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ldap3 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with ldap3 in the COPYING and COPYING.LESSER files.
# If not, see <http://www.gnu.org/licenses/>.
from collections import namedtuple
from copy import deepcopy
from datetime import datetime
from os import linesep
from time import sleep

from ldap3.abstract import STATUS_PENDING_CHANGES
from .. import SUBTREE, LEVEL, DEREF_ALWAYS, DEREF_NEVER, BASE, SEQUENCE_TYPES, STRING_TYPES, get_config_parameter
from .attribute import Attribute, OperationalAttribute, WritableAttribute
from .attrDef import AttrDef
from .objectDef import ObjectDef
from .entry import Entry, WritableEntry
from ..core.exceptions import LDAPCursorError
from ..core.results import RESULT_SUCCESS
from ..utils.ciDict import CaseInsensitiveWithAliasDict
from ..utils.dn import safe_dn, safe_rdn
from ..utils.conv import to_raw
from . import STATUS_VIRTUAL, STATUS_READ, STATUS_WRITABLE

Operation = namedtuple('Operation', ('request', 'result', 'response'))

def _ret_search_value(value):
    return value[0] + '=' + value[1:] if value[0] in '<>~' and value[1] != '=' else value

def _create_query_dict(query_text):
    """
    Create a dictionary with query key:value definitions
    query_text is a comma delimited key:value sequence
    """
    query_dict = dict()
    if query_text:
        for arg_value_str in query_text.split(','):
            if ':' in arg_value_str:
                arg_value_list = arg_value_str.split(':')
                query_dict[arg_value_list[0].strip()] = arg_value_list[1].strip()

    return query_dict

class Cursor(object):
    # entry_class and attribute_class define the type of entry and attribute used by the cursor
    # entry_initial_status defines the initial status of a entry
    # entry_class = Entry, must be defined in subclasses
    # attribute_class = Attribute, must be defined in subclasses
    # entry_initial_status = STATUS, must be defined in subclasses

    def __init__(self, connection, object_def, get_operational_attributes=False, attributes=None, controls=None):
        self.connection = connection

        if connection._deferred_bind or connection._deferred_open:  # probably a lazy connection, tries to bind
            connection._fire_deferred()

        if isinstance(object_def, STRING_TYPES):
            object_def = ObjectDef(object_def, connection.server.schema)
        self.definition = object_def
        if attributes:  # checks if requested attributes are defined in ObjectDef
            not_defined_attributes = []
            if isinstance(attributes, STRING_TYPES):
                attributes = [attributes]

            for attribute in attributes:
                if attribute not in self.definition._attributes:
                    not_defined_attributes.append(attribute)

            if not_defined_attributes:
                raise LDAPCursorError('Attributes \'%s\' non in definition' % ', '.join(not_defined_attributes))

        self.attributes = set(attributes) if attributes else set([attr.name for attr in self.definition])
        self.get_operational_attributes = get_operational_attributes
        self.controls = controls
        self.execution_time = None
        self.entries = []
        self.schema = self.connection.server.schema
        self._do_not_reset = False  # used for refreshing entry in entry_refresh() without removing all entries from the Cursor
        self._operation_history = list()  # a list storing all the requests, results and responses for the last cursor operation

    def __repr__(self):
        r = 'CURSOR : ' + self.__class__.__name__ + linesep
        r += 'CONN   : ' + str(self.connection) + linesep
        r += 'DEFS   : ' + repr(self.definition._object_class) + ' ['
        for attr_def in sorted(self.definition):
            r += (attr_def.key if attr_def.key == attr_def.name else (attr_def.key + ' <' + attr_def.name + '>')) + ', '
        if r[-2] == ',':
            r = r[:-2]
        r += ']' + linesep
        r += 'ATTRS  : ' + repr(sorted(self.attributes)) + (' [OPERATIONAL]' if self.get_operational_attributes else '') + linesep
        if isinstance(self, Reader):
            r += 'BASE   : ' + repr(self.base) + (' [SUB]' if self.sub_tree else ' [LEVEL]') + linesep
            if self._query:
                r += 'QUERY  : ' + repr(self._query) + ('' if '(' in self._query else (' [AND]' if self.components_in_and else ' [OR]')) + linesep
            if self.validated_query:
                r += 'PARSED : ' + repr(self.validated_query) + ('' if '(' in self._query else (' [AND]' if self.components_in_and else ' [OR]')) + linesep
            if self.query_filter:
                r += 'FILTER : ' + repr(self.query_filter) + linesep

        if self.execution_time:
            r += 'ENTRIES: ' + str(len(self.entries))
            r += ' [executed at: ' + str(self.execution_time.isoformat()) + ']' + linesep

        if self.failed:
            r += 'LAST OPERATION FAILED [' + str(len(self.errors)) + ' failure' + ('s' if len(self.errors) > 1 else '') + ' at operation' + ('s ' if len(self.errors) > 1 else ' ') + ', '.join([str(i) for i, error in enumerate(self.operations) if error.result['result'] != RESULT_SUCCESS]) + ']'

        return r

    def __str__(self):
        return self.__repr__()

    def __iter__(self):
        return self.entries.__iter__()

    def __getitem__(self, item):
        """Return indexed item, if index is not found then try to sequentially search in DN of entries.
        If only one entry is found return it else raise a KeyError exception. The exception message
        includes the number of entries that matches, if less than 10 entries match then show the DNs
        in the exception message.
        """
        try:
            return self.entries[item]
        except TypeError:
            pass

        if isinstance(item, STRING_TYPES):
            found = self.match_dn(item)

            if len(found) == 1:
                return found[0]
            elif len(found) > 1:
                raise KeyError('Multiple entries found: %d entries match the text in dn' % len(found) + ('' if len(found) > 10 else (' [' + '; '.join([e.entry_dn for e in found]) + ']')))

        raise KeyError('no entry found')

    def __len__(self):
        return len(self.entries)

    if str is not bytes:  # Python 3
        def __bool__(self):  # needed to make the cursor appears as existing in "if cursor:" even if there are no entries
            return True
    else:  # Python 2
        def __nonzero__(self):
            return True

    def _get_attributes(self, response, attr_defs, entry):
        """Assign the result of the LDAP query to the Entry object dictionary.

        If the optional 'post_query' callable is present in the AttrDef it is called with each value of the attribute and the callable result is stored in the attribute.

        Returns the default value for missing attributes.
        If the 'dereference_dn' in AttrDef is a ObjectDef then the attribute values are treated as distinguished name and the relevant entry is retrieved and stored in the attribute value.

        """
        attributes = CaseInsensitiveWithAliasDict()
        used_attribute_names = set()
        for attr_def in attr_defs:
            attribute_name = None
            for attr_name in response['attributes']:
                if attr_def.name.lower() == attr_name.lower():
                    attribute_name = attr_name
                    break

            if attribute_name or attr_def.default is not NotImplemented:  # attribute value found in result or default value present - NotImplemented allows use of None as default
                attribute = self.attribute_class(attr_def, entry, self)
                attribute.response = response
                attribute.raw_values = response['raw_attributes'][attribute_name] if attribute_name else None
                if attr_def.post_query and attr_def.name in response['attributes'] and response['raw_attributes'] != list():
                    attribute.values = attr_def.post_query(attr_def.key, response['attributes'][attribute_name])
                else:
                    if attr_def.default is NotImplemented or (attribute_name and response['raw_attributes'][attribute_name] != list()):
                        attribute.values = response['attributes'][attribute_name]
                    else:
                        attribute.values = attr_def.default if isinstance(attr_def.default, SEQUENCE_TYPES) else [attr_def.default]
                if not isinstance(attribute.values, list):  # force attribute values to list (if attribute is single-valued)
                    attribute.values = [attribute.values]
                if attr_def.dereference_dn:  # try to get object referenced in value
                    if attribute.values:
                        temp_reader = Reader(self.connection, attr_def.dereference_dn, base='', get_operational_attributes=self.get_operational_attributes, controls=self.controls)
                        temp_values = []
                        for element in attribute.values:
                            temp_values.append(temp_reader.search_object(element))
                        del temp_reader  # remove the temporary Reader
                        attribute.values = temp_values
                attributes[attribute.key] = attribute
                if attribute.other_names:
                    attributes.set_alias(attribute.key, attribute.other_names)
                used_attribute_names.add(attribute_name)

        if self.attributes:
            used_attribute_names.update(self.attributes)

        for attribute_name in response['attributes']:
            if attribute_name not in used_attribute_names:
                if attribute_name not in attr_defs:
                    raise LDAPCursorError('attribute \'%s\' not in object class \'%s\' for entry %s' % (attribute_name, ', '.join(entry.entry_definition._object_class), entry.entry_dn))
                attribute = OperationalAttribute(AttrDef(get_config_parameter('ABSTRACTION_OPERATIONAL_ATTRIBUTE_PREFIX') + attribute_name), entry, self)
                attribute.raw_values = response['raw_attributes'][attribute_name]
                attribute.values = response['attributes'][attribute_name]
                if (get_config_parameter('ABSTRACTION_OPERATIONAL_ATTRIBUTE_PREFIX') + attribute_name) not in attributes:
                    attributes[get_config_parameter('ABSTRACTION_OPERATIONAL_ATTRIBUTE_PREFIX') + attribute_name] = attribute

        return attributes

    def match_dn(self, dn):
        """Return entries with text in DN"""
        matched = []
        for entry in self.entries:
            if dn.lower() in entry.entry_dn.lower():
                matched.append(entry)
        return matched

    def match(self, attributes, value):
        """Return entries with text in one of the specified attributes"""
        matched = []
        if not isinstance(attributes, SEQUENCE_TYPES):
            attributes = [attributes]

        for entry in self.entries:
            found = False
            for attribute in attributes:
                if attribute in entry:
                    for attr_value in entry[attribute].values:
                        if hasattr(attr_value, 'lower') and hasattr(value, 'lower') and value.lower() in attr_value.lower():
                            found = True
                        elif value == attr_value:
                            found = True
                        if found:
                            matched.append(entry)
                            break
                    if found:
                        break
                    # checks raw values, tries to convert value to byte
                    raw_value = to_raw(value)
                    if isinstance(raw_value, (bytes, bytearray)):
                        for attr_value in entry[attribute].raw_values:
                            if hasattr(attr_value, 'lower') and hasattr(raw_value, 'lower') and raw_value.lower() in attr_value.lower():
                                found = True
                            elif raw_value == attr_value:
                                found = True
                            if found:
                                matched.append(entry)
                                break
                        if found:
                            break
        return matched

    def _create_entry(self, response):
        if not response['type'] == 'searchResEntry':
            return None

        entry = self.entry_class(response['dn'], self)  # define an Entry (writable or readonly), as specified in the cursor definition
        entry._state.attributes = self._get_attributes(response, self.definition, entry)
        entry._state.entry_raw_attributes = deepcopy(response['raw_attributes'])

        entry._state.response = response
        entry._state.read_time = datetime.now()
        entry._state.set_status(self.entry_initial_status)
        for attr in entry:  # returns the whole attribute object
            entry.__dict__[attr.key] = attr

        return entry

    def _execute_query(self, query_scope, attributes):
        if not self.connection:
            raise LDAPCursorError('no connection established')
        old_query_filter = None
        if query_scope == BASE:  # requesting a single object so an always-valid filter is set
            if hasattr(self, 'query_filter'):  # only Reader has a query filter
                old_query_filter = self.query_filter
            self.query_filter = '(objectclass=*)'
        else:
            self._create_query_filter()
        with self.connection:
            result = self.connection.search(search_base=self.base,
                                            search_filter=self.query_filter,
                                            search_scope=query_scope,
                                            dereference_aliases=self.dereference_aliases,
                                            attributes=attributes if attributes else self.attributes,
                                            get_operational_attributes=self.get_operational_attributes,
                                            controls=self.controls)
            if not self.connection.strategy.sync:
                response, result, request = self.connection.get_response(result, get_request=True)
            else:
                response = self.connection.response
                result = self.connection.result
                request = self.connection.request

        self._store_operation_in_history(request, result, response)

        if self._do_not_reset:  # trick to not remove entries when using _refresh()
            return self._create_entry(response[0])

        self.entries = []
        for r in response:
            entry = self._create_entry(r)
            if entry is not None:
                self.entries.append(entry)

        self.execution_time = datetime.now()

        if old_query_filter:  # requesting a single object so an always-valid filter is set
            self.query_filter = old_query_filter

    def remove(self, entry):
        self.entries.remove(entry)

    def _reset_history(self):
        self._operation_history = list()

    def _store_operation_in_history(self, request, result, response):
        self._operation_history.append(Operation(request, result, response))

    @property
    def operations(self):
        return self._operation_history

    @property
    def errors(self):
        return [error for error in self._operation_history if error.result['result'] != RESULT_SUCCESS]

    @property
    def failed(self):
        return any([error.result['result'] != RESULT_SUCCESS for error in self._operation_history])

class Reader(Cursor):
    """Reader object to perform searches:

    :param connection: the LDAP connection object to use
    :type connection: LDAPConnection
    :param object_def: the ObjectDef of the LDAP object returned
    :type object_def: ObjectDef
    :param query: the simplified query (will be transformed in an LDAP filter)
    :type query: str
    :param base: starting base of the search
    :type base: str
    :param components_in_and: specify if assertions in the query must all be satisfied or not (AND/OR)
    :type components_in_and: bool
    :param sub_tree: specify if the search must be performed ad Single Level (False) or Whole SubTree (True)
    :type sub_tree: bool
    :param get_operational_attributes: specify if operational attributes are returned or not
    :type get_operational_attributes: bool
    :param controls: controls to be used in search
    :type controls: tuple

    """
    entry_class = Entry  # entries are read_only
    attribute_class = Attribute  # attributes are read_only
    entry_initial_status = STATUS_READ

    def __init__(self, connection, object_def, base, query='', components_in_and=True, sub_tree=True, get_operational_attributes=False, attributes=None, controls=None):
        Cursor.__init__(self, connection, object_def, get_operational_attributes, attributes, controls)
        self._components_in_and = components_in_and
        self.sub_tree = sub_tree
        self._query = query
        self.base = base
        self.dereference_aliases = DEREF_ALWAYS
        self.validated_query = None
        self._query_dict = dict()
        self._validated_query_dict = dict()
        self.query_filter = None
        self.reset()

    @property
    def query(self):
        return self._query

    @query.setter
    def query(self, value):
        self._query = value
        self.reset()

    @property
    def components_in_and(self):
        return self._components_in_and

    @components_in_and.setter
    def components_in_and(self, value):
        self._components_in_and = value
        self.reset()

    def clear(self):
        """Clear the Reader search parameters

        """
        self.dereference_aliases = DEREF_ALWAYS
        self._reset_history()

    def reset(self):
        """Clear all the Reader parameters

        """
        self.clear()
        self.validated_query = None
        self._query_dict = dict()
        self._validated_query_dict = dict()
        self.execution_time = None
        self.query_filter = None
        self.entries = []
        self._create_query_filter()

    def _validate_query(self):
        """Processes the text query and verifies that the requested friendly names are in the Reader dictionary
        If the AttrDef has a 'validate' property the callable is executed and if it returns False an Exception is raised

        """
        if not self._query_dict:
            self._query_dict = _create_query_dict(self._query)

        query = ''
        for d in sorted(self._query_dict):
            attr = d[1:] if d[0] in '&|' else d
            for attr_def in self.definition:
                if ''.join(attr.split()).lower() == attr_def.key.lower():
                    attr = attr_def.key
                    break
            if attr in self.definition:
                vals = sorted(self._query_dict[d].split(';'))

                query += (d[0] + attr if d[0] in '&|' else attr) + ': '
                for val in vals:
                    val = val.strip()
                    val_not = True if val[0] == '!' else False
                    val_search_operator = '='  # default
                    if val_not:
                        if val[1:].lstrip()[0] not in '=<>~':
                            value = val[1:].lstrip()
                        else:
                            val_search_operator = val[1:].lstrip()[0]
                            value = val[1:].lstrip()[1:]
                    else:
                        if val[0] not in '=<>~':
                            value = val.lstrip()
                        else:
                            val_search_operator = val[0]
                            value = val[1:].lstrip()

                    if self.definition[attr].validate:
                        validated = self.definition[attr].validate(value)  # returns True, False or a value to substitute to the actual values
                        if validated is False:
                            raise LDAPCursorError('validation failed for attribute %s and value %s' % (d, val))
                        elif validated is not True:  # a valid LDAP value equivalent to the actual values
                                value = validated
                    if val_not:
                        query += '!' + val_search_operator + value
                    else:
                        query += val_search_operator + value

                    query += ';'
                query = query[:-1] + ', '
            else:
                raise LDAPCursorError('attribute \'%s\' not in definition' % attr)
        self.validated_query = query[:-2]
        self._validated_query_dict = _create_query_dict(self.validated_query)

    def _create_query_filter(self):
        """Converts the query dictionary to the filter text"""
        self.query_filter = ''

        if self.definition._object_class:
            self.query_filter += '(&'
            if isinstance(self.definition._object_class, SEQUENCE_TYPES) and len(self.definition._object_class) == 1:
                self.query_filter += '(objectClass=' + self.definition._object_class[0] + ')'
            elif isinstance(self.definition._object_class, SEQUENCE_TYPES):
                self.query_filter += '(&'
                for object_class in self.definition._object_class:
                    self.query_filter += '(objectClass=' + object_class + ')'
                self.query_filter += ')'
            else:
                raise LDAPCursorError('object class must be a string or a list')

        if self._query and self._query.startswith('(') and self._query.endswith(')'):  # query is already an LDAP filter
            if 'objectclass' not in self._query.lower():
                self.query_filter += self._query + ')'  # if objectclass not in filter adds from definition
            else:
                self.query_filter = self._query
            return
        elif self._query:  # if a simplified filter is present
            if not self.components_in_and:
                self.query_filter += '(|'
            elif not self.definition._object_class:
                self.query_filter += '(&'

            self._validate_query()

            attr_counter = 0
            for attr in sorted(self._validated_query_dict):
                attr_counter += 1
                multi = True if ';' in self._validated_query_dict[attr] else False
                vals = sorted(self._validated_query_dict[attr].split(';'))
                attr_def = self.definition[attr[1:]] if attr[0] in '&|' else self.definition[attr]
                if attr_def.pre_query:
                    modvals = []
                    for val in vals:
                        modvals.append(val[0] + attr_def.pre_query(attr_def.key, val[1:]))
                    vals = modvals
                if multi:
                    if attr[0] in '&|':
                        self.query_filter += '(' + attr[0]
                    else:
                        self.query_filter += '(|'

                for val in vals:
                    if val[0] == '!':
                        self.query_filter += '(!(' + attr_def.name + _ret_search_value(val[1:]) + '))'
                    else:
                        self.query_filter += '(' + attr_def.name + _ret_search_value(val) + ')'
                if multi:
                    self.query_filter += ')'

            if not self.components_in_and:
                self.query_filter += '))'
            else:
                self.query_filter += ')'

            if not self.definition._object_class and attr_counter == 1:  # remove unneeded starting filter
                self.query_filter = self.query_filter[2: -1]

            if self.query_filter == '(|)' or self.query_filter == '(&)':  # remove empty filter
                self.query_filter = ''
        else:  # no query, remove unneeded leading (&
            self.query_filter = self.query_filter[2:]

    def search(self, attributes=None):
        """Perform the LDAP search

        :return: Entries found in search

        """
        self.clear()
        query_scope = SUBTREE if self.sub_tree else LEVEL
        self._execute_query(query_scope, attributes)

        return self.entries

    def search_object(self, entry_dn=None, attributes=None):  # base must be a single dn
        """Perform the LDAP search operation SINGLE_OBJECT scope

        :return: Entry found in search

        """
        self.clear()
        if entry_dn:
            old_base = self.base
            self.base = entry_dn
            self._execute_query(BASE, attributes)
            self.base = old_base
        else:
            self._execute_query(BASE, attributes)

        return self.entries[0] if len(self.entries) > 0 else None

    def search_level(self, attributes=None):
        """Perform the LDAP search operation with SINGLE_LEVEL scope

        :return: Entries found in search

        """
        self.clear()
        self._execute_query(LEVEL, attributes)

        return self.entries

    def search_subtree(self, attributes=None):
        """Perform the LDAP search operation WHOLE_SUBTREE scope

        :return: Entries found in search

        """
        self.clear()
        self._execute_query(SUBTREE, attributes)

        return self.entries

    def search_paged(self, paged_size, paged_criticality=True, generator=True, attributes=None):
        """Perform a paged search, can be called as an Iterator

        :param attributes: optional attributes to search
        :param paged_size: number of entries returned in each search
        :type paged_size: int
        :param paged_criticality: specify if server must not execute the search if it is not capable of paging searches
        :type paged_criticality: bool
        :param generator: if True the paged searches are executed while generating the entries,
                          if False all the paged searches are execute before returning the generator
        :type generator: bool
        :return: Entries found in search

        """
        if not self.connection:
            raise LDAPCursorError('no connection established')

        self.clear()
        self._create_query_filter()
        self.entries = []
        self.execution_time = datetime.now()
        for response in self.connection.extend.standard.paged_search(search_base=self.base,
                                                                     search_filter=self.query_filter,
                                                                     search_scope=SUBTREE if self.sub_tree else LEVEL,
                                                                     dereference_aliases=self.dereference_aliases,
                                                                     attributes=attributes if attributes else self.attributes,
                                                                     get_operational_attributes=self.get_operational_attributes,
                                                                     controls=self.controls,
                                                                     paged_size=paged_size,
                                                                     paged_criticality=paged_criticality,
                                                                     generator=generator):
            yield self._create_entry(response)

class Writer(Cursor):
    entry_class = WritableEntry
    attribute_class = WritableAttribute
    entry_initial_status = STATUS_WRITABLE

    @staticmethod
    def from_cursor(cursor, connection=None, object_def=None, custom_validator=None):
        if connection is None:
            connection = cursor.connection
        if object_def is None:
            object_def = cursor.definition
        writer = Writer(connection, object_def, attributes=cursor.attributes)
        for entry in cursor.entries:
            if isinstance(cursor, Reader):
                entry.entry_writable(object_def, writer, custom_validator=custom_validator)
            elif isinstance(cursor, Writer):
                pass
            else:
                raise LDAPCursorError('unknown cursor type %s' % str(type(cursor)))
        writer.execution_time = cursor.execution_time
        return writer

    @staticmethod
    def from_response(connection, object_def, response=None):
        if response is None:
            if not connection.strategy.sync:
                raise LDAPCursorError(' with asynchronous strategies response must be specified')
            elif connection.response:
                response = connection.response
            else:
                raise LDAPCursorError('response not present')
        writer = Writer(connection, object_def)

        for resp in response:
            if resp['type'] == 'searchResEntry':
                entry = writer._create_entry(resp)
                writer.entries.append(entry)
        return writer

    def __init__(self, connection, object_def, get_operational_attributes=False, attributes=None, controls=None):
        Cursor.__init__(self, connection, object_def, get_operational_attributes, attributes, controls)
        self.dereference_aliases = DEREF_NEVER

    def commit(self, refresh=True):
        self._reset_history()
        successful = True
        for entry in self.entries:
            if not entry.entry_commit_changes(refresh=refresh, controls=self.controls, clear_history=False):
                successful = False

        self.execution_time = datetime.now()

        return successful

    def discard(self):
        for entry in self.entries:
            entry.entry_discard_changes()

    def _refresh_object(self, entry_dn, attributes=None, tries=4, seconds=2, controls=None):  # base must be a single dn
        """Performs the LDAP search operation SINGLE_OBJECT scope

        :return: Entry found in search

        """
        if not self.connection:
            raise LDAPCursorError('no connection established')

        response = []
        with self.connection:
            counter = 0
            while counter < tries:
                result = self.connection.search(search_base=entry_dn,
                                                search_filter='(objectclass=*)',
                                                search_scope=BASE,
                                                dereference_aliases=DEREF_NEVER,
                                                attributes=attributes if attributes else self.attributes,
                                                get_operational_attributes=self.get_operational_attributes,
                                                controls=controls)
                if not self.connection.strategy.sync:
                    response, result, request = self.connection.get_response(result, get_request=True)
                else:
                    response = self.connection.response
                    result = self.connection.result
                    request = self.connection.request

                if result['result'] in [RESULT_SUCCESS]:
                    break
                sleep(seconds)
                counter += 1
                self._store_operation_in_history(request, result, response)

        if len(response) == 1:
            return self._create_entry(response[0])
        elif len(response) == 0:
            return None

        raise LDAPCursorError('more than 1 entry returned for a single object search')

    def new(self, dn):
        dn = safe_dn(dn)
        for entry in self.entries:  # checks if dn is already used in an cursor entry
            if entry.entry_dn == dn:
                raise LDAPCursorError('dn already present in cursor')
        rdns = safe_rdn(dn, decompose=True)
        entry = self.entry_class(dn, self)  # defines a new empty Entry
        for attr in entry.entry_mandatory_attributes:  # defines all mandatory attributes as virtual
                entry._state.attributes[attr] = self.attribute_class(entry._state.definition[attr], entry, self)
                entry.__dict__[attr] = entry._state.attributes[attr]
        entry.objectclass.set(self.definition._object_class)
        for rdn in rdns:  # adds virtual attributes from rdns in entry name (should be more than one with + syntax)
            if rdn[0] in entry._state.definition._attributes:
                rdn_name = entry._state.definition._attributes[rdn[0]].name  # normalize case folding
                if rdn_name not in entry._state.attributes:
                    entry._state.attributes[rdn_name] = self.attribute_class(entry._state.definition[rdn_name], entry, self)
                    entry.__dict__[rdn_name] = entry._state.attributes[rdn_name]
                entry.__dict__[rdn_name].set(rdn[1])
            else:
                raise LDAPCursorError('rdn type \'%s\' not in object class definition' % rdn[0])
        entry._state.set_status(STATUS_VIRTUAL)  # set intial status
        entry._state.set_status(STATUS_PENDING_CHANGES)  # tries to change status to PENDING_CHANGES. If mandatory attributes are missing status is reverted to MANDATORY_MISSING
        self.entries.append(entry)
        return entry

    def refresh_entry(self, entry, tries=4, seconds=2):
        self._do_not_reset = True
        temp_entry = self._refresh_object(entry.entry_dn, entry.entry_attributes, tries, seconds=seconds)  # if any attributes is added adds only to the entry not to the definition
        self._do_not_reset = False
        if temp_entry:
            temp_entry._state.origin = entry._state.origin
            entry.__dict__.clear()
            entry.__dict__['_state'] = temp_entry._state
            for attr in entry._state.attributes:  # returns the attribute key
                entry.__dict__[attr] = entry._state.attributes[attr]

            for attr in entry.entry_attributes:  # if any attribute of the class was deleted make it virtual
                if attr not in entry._state.attributes and attr in entry.entry_definition._attributes:
                    entry._state.attributes[attr] = WritableAttribute(entry.entry_definition[attr], entry, self)
                    entry.__dict__[attr] = entry._state.attributes[attr]
            entry._state.set_status(entry._state._initial_status)
            return True
        return False


text:
import {Operator} from '../Operator';
import {Subscriber} from '../Subscriber';
import {Observable} from '../Observable';

/**
 * buffers the incoming observable values until the passed `closingNotifier` emits a value, at which point
 * it emits the buffer on the returned observable and starts a new buffer internally, awaiting the
 * next time `closingNotifier` emits
 *
 * @param {Observable<any>} closingNotifier an observable, that signals the buffer to be emitted} from the returned observable
 * @returns {Observable<T[]>} an observable of buffers, which are arrays of values
 */
export function buffer<T>(closingNotifier: Observable<any>): Observable<T[]> {
  return this.lift(new BufferOperator(closingNotifier));
}

class BufferOperator<T, R> implements Operator<T, R> {

  constructor(private closingNotifier: Observable<any>) {
  }

  call(subscriber: Subscriber<T>): Subscriber<T> {
    return new BufferSubscriber(subscriber, this.closingNotifier);
  }
}

class BufferSubscriber<T> extends Subscriber<T> {
  private buffer: T[] = [];
  private notifierSubscriber: BufferClosingNotifierSubscriber<any> = null;

  constructor(destination: Subscriber<T>, closingNotifier: Observable<any>) {
    super(destination);
    this.notifierSubscriber = new BufferClosingNotifierSubscriber(this);
    this.add(closingNotifier._subscribe(this.notifierSubscriber));
  }

  _next(value: T) {
    this.buffer.push(value);
  }

  _error(err: any) {
    this.destination.error(err);
  }

  _complete() {
    this.destination.complete();
  }

  flushBuffer() {
    const buffer = this.buffer;
    this.buffer = [];
    this.destination.next(buffer);

    if (this.isUnsubscribed) {
      this.notifierSubscriber.unsubscribe();
    }
  }
}

class BufferClosingNotifierSubscriber<T> extends Subscriber<T> {
  constructor(private parent: BufferSubscriber<any>) {
    super(null);
  }

  _next(value: T) {
    this.parent.flushBuffer();
  }

  _error(err: any) {
    this.parent.error(err);
  }

  _complete() {
    this.parent.complete();
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends MY_Controller {
	function __construct()
  {
		 parent::__construct();
	}

	public function index()
	{
		$data = array('page_title'=>'Dashboard', 'page_subtitle'=>'','page_breadcrumb'=>array('dashboard'));
		$content = array('content'=>"");
		$this->control_view($data, $content);
	}

}


text:
package com.zxh.ssm.module.whole.pojo;

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

public class WeatherDataExample {
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    protected String orderByClause;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    protected boolean distinct;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    protected List<Criteria> oredCriteria;

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public WeatherDataExample() {
        oredCriteria = new ArrayList<Criteria>();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public void setOrderByClause(String orderByClause) {
        this.orderByClause = orderByClause;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public String getOrderByClause() {
        return orderByClause;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public void setDistinct(boolean distinct) {
        this.distinct = distinct;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public boolean isDistinct() {
        return distinct;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public List<Criteria> getOredCriteria() {
        return oredCriteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public Criteria or() {
        Criteria criteria = createCriteriaInternal();
        oredCriteria.add(criteria);
        return criteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.size() == 0) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    protected Criteria createCriteriaInternal() {
        Criteria criteria = new Criteria();
        return criteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public void clear() {
        oredCriteria.clear();
        orderByClause = null;
        distinct = false;
    }

    /**
     * This class was generated by MyBatis Generator.
     * This class corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    protected abstract static class GeneratedCriteria {
        protected List<Criterion> criteria;

        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<Criterion>();
        }

        public boolean isValid() {
            return criteria.size() > 0;
        }

        public List<Criterion> getAllCriteria() {
            return criteria;
        }

        public List<Criterion> getCriteria() {
            return criteria;
        }

        protected void addCriterion(String condition) {
            if (condition == null) {
                throw new RuntimeException("Value for condition cannot be null");
            }
            criteria.add(new Criterion(condition));
        }

        protected void addCriterion(String condition, Object value, String property) {
            if (value == null) {
                throw new RuntimeException("Value for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value));
        }

        protected void addCriterion(String condition, Object value1, Object value2, String property) {
            if (value1 == null || value2 == null) {
                throw new RuntimeException("Between values for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value1, value2));
        }

        public Criteria andDistrictstationnumIsNull() {
            addCriterion("districtStationNum is null");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumIsNotNull() {
            addCriterion("districtStationNum is not null");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumEqualTo(Integer value) {
            addCriterion("districtStationNum =", value, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumNotEqualTo(Integer value) {
            addCriterion("districtStationNum <>", value, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumGreaterThan(Integer value) {
            addCriterion("districtStationNum >", value, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumGreaterThanOrEqualTo(Integer value) {
            addCriterion("districtStationNum >=", value, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumLessThan(Integer value) {
            addCriterion("districtStationNum <", value, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumLessThanOrEqualTo(Integer value) {
            addCriterion("districtStationNum <=", value, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumIn(List<Integer> values) {
            addCriterion("districtStationNum in", values, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumNotIn(List<Integer> values) {
            addCriterion("districtStationNum not in", values, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumBetween(Integer value1, Integer value2) {
            addCriterion("districtStationNum between", value1, value2, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andDistrictstationnumNotBetween(Integer value1, Integer value2) {
            addCriterion("districtStationNum not between", value1, value2, "districtstationnum");
            return (Criteria) this;
        }

        public Criteria andWeatheryearIsNull() {
            addCriterion("weatherYear is null");
            return (Criteria) this;
        }

        public Criteria andWeatheryearIsNotNull() {
            addCriterion("weatherYear is not null");
            return (Criteria) this;
        }

        public Criteria andWeatheryearEqualTo(Integer value) {
            addCriterion("weatherYear =", value, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearNotEqualTo(Integer value) {
            addCriterion("weatherYear <>", value, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearGreaterThan(Integer value) {
            addCriterion("weatherYear >", value, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearGreaterThanOrEqualTo(Integer value) {
            addCriterion("weatherYear >=", value, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearLessThan(Integer value) {
            addCriterion("weatherYear <", value, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearLessThanOrEqualTo(Integer value) {
            addCriterion("weatherYear <=", value, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearIn(List<Integer> values) {
            addCriterion("weatherYear in", values, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearNotIn(List<Integer> values) {
            addCriterion("weatherYear not in", values, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearBetween(Integer value1, Integer value2) {
            addCriterion("weatherYear between", value1, value2, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeatheryearNotBetween(Integer value1, Integer value2) {
            addCriterion("weatherYear not between", value1, value2, "weatheryear");
            return (Criteria) this;
        }

        public Criteria andWeathermonthIsNull() {
            addCriterion("weatherMonth is null");
            return (Criteria) this;
        }

        public Criteria andWeathermonthIsNotNull() {
            addCriterion("weatherMonth is not null");
            return (Criteria) this;
        }

        public Criteria andWeathermonthEqualTo(Integer value) {
            addCriterion("weatherMonth =", value, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthNotEqualTo(Integer value) {
            addCriterion("weatherMonth <>", value, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthGreaterThan(Integer value) {
            addCriterion("weatherMonth >", value, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthGreaterThanOrEqualTo(Integer value) {
            addCriterion("weatherMonth >=", value, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthLessThan(Integer value) {
            addCriterion("weatherMonth <", value, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthLessThanOrEqualTo(Integer value) {
            addCriterion("weatherMonth <=", value, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthIn(List<Integer> values) {
            addCriterion("weatherMonth in", values, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthNotIn(List<Integer> values) {
            addCriterion("weatherMonth not in", values, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthBetween(Integer value1, Integer value2) {
            addCriterion("weatherMonth between", value1, value2, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeathermonthNotBetween(Integer value1, Integer value2) {
            addCriterion("weatherMonth not between", value1, value2, "weathermonth");
            return (Criteria) this;
        }

        public Criteria andWeatherdayIsNull() {
            addCriterion("weatherDay is null");
            return (Criteria) this;
        }

        public Criteria andWeatherdayIsNotNull() {
            addCriterion("weatherDay is not null");
            return (Criteria) this;
        }

        public Criteria andWeatherdayEqualTo(Integer value) {
            addCriterion("weatherDay =", value, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayNotEqualTo(Integer value) {
            addCriterion("weatherDay <>", value, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayGreaterThan(Integer value) {
            addCriterion("weatherDay >", value, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayGreaterThanOrEqualTo(Integer value) {
            addCriterion("weatherDay >=", value, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayLessThan(Integer value) {
            addCriterion("weatherDay <", value, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayLessThanOrEqualTo(Integer value) {
            addCriterion("weatherDay <=", value, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayIn(List<Integer> values) {
            addCriterion("weatherDay in", values, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayNotIn(List<Integer> values) {
            addCriterion("weatherDay not in", values, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayBetween(Integer value1, Integer value2) {
            addCriterion("weatherDay between", value1, value2, "weatherday");
            return (Criteria) this;
        }

        public Criteria andWeatherdayNotBetween(Integer value1, Integer value2) {
            addCriterion("weatherDay not between", value1, value2, "weatherday");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020IsNull() {
            addCriterion("precipitation2020 is null");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020IsNotNull() {
            addCriterion("precipitation2020 is not null");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020EqualTo(String value) {
            addCriterion("precipitation2020 =", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020NotEqualTo(String value) {
            addCriterion("precipitation2020 <>", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020GreaterThan(String value) {
            addCriterion("precipitation2020 >", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020GreaterThanOrEqualTo(String value) {
            addCriterion("precipitation2020 >=", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020LessThan(String value) {
            addCriterion("precipitation2020 <", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020LessThanOrEqualTo(String value) {
            addCriterion("precipitation2020 <=", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020Like(String value) {
            addCriterion("precipitation2020 like", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020NotLike(String value) {
            addCriterion("precipitation2020 not like", value, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020In(List<String> values) {
            addCriterion("precipitation2020 in", values, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020NotIn(List<String> values) {
            addCriterion("precipitation2020 not in", values, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020Between(String value1, String value2) {
            addCriterion("precipitation2020 between", value1, value2, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andPrecipitation2020NotBetween(String value1, String value2) {
            addCriterion("precipitation2020 not between", value1, value2, "precipitation2020");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedIsNull() {
            addCriterion("maximumWindSpeed is null");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedIsNotNull() {
            addCriterion("maximumWindSpeed is not null");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedEqualTo(Integer value) {
            addCriterion("maximumWindSpeed =", value, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedNotEqualTo(Integer value) {
            addCriterion("maximumWindSpeed <>", value, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedGreaterThan(Integer value) {
            addCriterion("maximumWindSpeed >", value, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedGreaterThanOrEqualTo(Integer value) {
            addCriterion("maximumWindSpeed >=", value, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedLessThan(Integer value) {
            addCriterion("maximumWindSpeed <", value, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedLessThanOrEqualTo(Integer value) {
            addCriterion("maximumWindSpeed <=", value, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedIn(List<Integer> values) {
            addCriterion("maximumWindSpeed in", values, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedNotIn(List<Integer> values) {
            addCriterion("maximumWindSpeed not in", values, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedBetween(Integer value1, Integer value2) {
            addCriterion("maximumWindSpeed between", value1, value2, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaximumwindspeedNotBetween(Integer value1, Integer value2) {
            addCriterion("maximumWindSpeed not between", value1, value2, "maximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedIsNull() {
            addCriterion("directionMaximumWindSpeed is null");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedIsNotNull() {
            addCriterion("directionMaximumWindSpeed is not null");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedEqualTo(String value) {
            addCriterion("directionMaximumWindSpeed =", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedNotEqualTo(String value) {
            addCriterion("directionMaximumWindSpeed <>", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedGreaterThan(String value) {
            addCriterion("directionMaximumWindSpeed >", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedGreaterThanOrEqualTo(String value) {
            addCriterion("directionMaximumWindSpeed >=", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedLessThan(String value) {
            addCriterion("directionMaximumWindSpeed <", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedLessThanOrEqualTo(String value) {
            addCriterion("directionMaximumWindSpeed <=", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedLike(String value) {
            addCriterion("directionMaximumWindSpeed like", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedNotLike(String value) {
            addCriterion("directionMaximumWindSpeed not like", value, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedIn(List<String> values) {
            addCriterion("directionMaximumWindSpeed in", values, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedNotIn(List<String> values) {
            addCriterion("directionMaximumWindSpeed not in", values, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedBetween(String value1, String value2) {
            addCriterion("directionMaximumWindSpeed between", value1, value2, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaximumwindspeedNotBetween(String value1, String value2) {
            addCriterion("directionMaximumWindSpeed not between", value1, value2, "directionmaximumwindspeed");
            return (Criteria) this;
        }

        public Criteria andAvepressureIsNull() {
            addCriterion("avePressure is null");
            return (Criteria) this;
        }

        public Criteria andAvepressureIsNotNull() {
            addCriterion("avePressure is not null");
            return (Criteria) this;
        }

        public Criteria andAvepressureEqualTo(Integer value) {
            addCriterion("avePressure =", value, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureNotEqualTo(Integer value) {
            addCriterion("avePressure <>", value, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureGreaterThan(Integer value) {
            addCriterion("avePressure >", value, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureGreaterThanOrEqualTo(Integer value) {
            addCriterion("avePressure >=", value, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureLessThan(Integer value) {
            addCriterion("avePressure <", value, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureLessThanOrEqualTo(Integer value) {
            addCriterion("avePressure <=", value, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureIn(List<Integer> values) {
            addCriterion("avePressure in", values, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureNotIn(List<Integer> values) {
            addCriterion("avePressure not in", values, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureBetween(Integer value1, Integer value2) {
            addCriterion("avePressure between", value1, value2, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvepressureNotBetween(Integer value1, Integer value2) {
            addCriterion("avePressure not between", value1, value2, "avepressure");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedIsNull() {
            addCriterion("aveWindSpeed is null");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedIsNotNull() {
            addCriterion("aveWindSpeed is not null");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedEqualTo(Integer value) {
            addCriterion("aveWindSpeed =", value, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedNotEqualTo(Integer value) {
            addCriterion("aveWindSpeed <>", value, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedGreaterThan(Integer value) {
            addCriterion("aveWindSpeed >", value, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedGreaterThanOrEqualTo(Integer value) {
            addCriterion("aveWindSpeed >=", value, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedLessThan(Integer value) {
            addCriterion("aveWindSpeed <", value, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedLessThanOrEqualTo(Integer value) {
            addCriterion("aveWindSpeed <=", value, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedIn(List<Integer> values) {
            addCriterion("aveWindSpeed in", values, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedNotIn(List<Integer> values) {
            addCriterion("aveWindSpeed not in", values, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedBetween(Integer value1, Integer value2) {
            addCriterion("aveWindSpeed between", value1, value2, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvewindspeedNotBetween(Integer value1, Integer value2) {
            addCriterion("aveWindSpeed not between", value1, value2, "avewindspeed");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureIsNull() {
            addCriterion("aveTemperature is null");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureIsNotNull() {
            addCriterion("aveTemperature is not null");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureEqualTo(Integer value) {
            addCriterion("aveTemperature =", value, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureNotEqualTo(Integer value) {
            addCriterion("aveTemperature <>", value, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureGreaterThan(Integer value) {
            addCriterion("aveTemperature >", value, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureGreaterThanOrEqualTo(Integer value) {
            addCriterion("aveTemperature >=", value, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureLessThan(Integer value) {
            addCriterion("aveTemperature <", value, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureLessThanOrEqualTo(Integer value) {
            addCriterion("aveTemperature <=", value, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureIn(List<Integer> values) {
            addCriterion("aveTemperature in", values, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureNotIn(List<Integer> values) {
            addCriterion("aveTemperature not in", values, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureBetween(Integer value1, Integer value2) {
            addCriterion("aveTemperature between", value1, value2, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvetemperatureNotBetween(Integer value1, Integer value2) {
            addCriterion("aveTemperature not between", value1, value2, "avetemperature");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureIsNull() {
            addCriterion("aveVaporPressure is null");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureIsNotNull() {
            addCriterion("aveVaporPressure is not null");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureEqualTo(Integer value) {
            addCriterion("aveVaporPressure =", value, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureNotEqualTo(Integer value) {
            addCriterion("aveVaporPressure <>", value, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureGreaterThan(Integer value) {
            addCriterion("aveVaporPressure >", value, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureGreaterThanOrEqualTo(Integer value) {
            addCriterion("aveVaporPressure >=", value, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureLessThan(Integer value) {
            addCriterion("aveVaporPressure <", value, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureLessThanOrEqualTo(Integer value) {
            addCriterion("aveVaporPressure <=", value, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureIn(List<Integer> values) {
            addCriterion("aveVaporPressure in", values, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureNotIn(List<Integer> values) {
            addCriterion("aveVaporPressure not in", values, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureBetween(Integer value1, Integer value2) {
            addCriterion("aveVaporPressure between", value1, value2, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAvevaporpressureNotBetween(Integer value1, Integer value2) {
            addCriterion("aveVaporPressure not between", value1, value2, "avevaporpressure");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityIsNull() {
            addCriterion("aveRelativeHumidity is null");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityIsNotNull() {
            addCriterion("aveRelativeHumidity is not null");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityEqualTo(Integer value) {
            addCriterion("aveRelativeHumidity =", value, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityNotEqualTo(Integer value) {
            addCriterion("aveRelativeHumidity <>", value, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityGreaterThan(Integer value) {
            addCriterion("aveRelativeHumidity >", value, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityGreaterThanOrEqualTo(Integer value) {
            addCriterion("aveRelativeHumidity >=", value, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityLessThan(Integer value) {
            addCriterion("aveRelativeHumidity <", value, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityLessThanOrEqualTo(Integer value) {
            addCriterion("aveRelativeHumidity <=", value, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityIn(List<Integer> values) {
            addCriterion("aveRelativeHumidity in", values, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityNotIn(List<Integer> values) {
            addCriterion("aveRelativeHumidity not in", values, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityBetween(Integer value1, Integer value2) {
            addCriterion("aveRelativeHumidity between", value1, value2, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andAverelativehumidityNotBetween(Integer value1, Integer value2) {
            addCriterion("aveRelativeHumidity not between", value1, value2, "averelativehumidity");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeIsNull() {
            addCriterion("sunshineTime is null");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeIsNotNull() {
            addCriterion("sunshineTime is not null");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeEqualTo(Integer value) {
            addCriterion("sunshineTime =", value, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeNotEqualTo(Integer value) {
            addCriterion("sunshineTime <>", value, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeGreaterThan(Integer value) {
            addCriterion("sunshineTime >", value, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeGreaterThanOrEqualTo(Integer value) {
            addCriterion("sunshineTime >=", value, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeLessThan(Integer value) {
            addCriterion("sunshineTime <", value, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeLessThanOrEqualTo(Integer value) {
            addCriterion("sunshineTime <=", value, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeIn(List<Integer> values) {
            addCriterion("sunshineTime in", values, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeNotIn(List<Integer> values) {
            addCriterion("sunshineTime not in", values, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeBetween(Integer value1, Integer value2) {
            addCriterion("sunshineTime between", value1, value2, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andSunshinetimeNotBetween(Integer value1, Integer value2) {
            addCriterion("sunshineTime not between", value1, value2, "sunshinetime");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureIsNull() {
            addCriterion("dailyMinPressure is null");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureIsNotNull() {
            addCriterion("dailyMinPressure is not null");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureEqualTo(Integer value) {
            addCriterion("dailyMinPressure =", value, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureNotEqualTo(Integer value) {
            addCriterion("dailyMinPressure <>", value, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureGreaterThan(Integer value) {
            addCriterion("dailyMinPressure >", value, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureGreaterThanOrEqualTo(Integer value) {
            addCriterion("dailyMinPressure >=", value, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureLessThan(Integer value) {
            addCriterion("dailyMinPressure <", value, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureLessThanOrEqualTo(Integer value) {
            addCriterion("dailyMinPressure <=", value, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureIn(List<Integer> values) {
            addCriterion("dailyMinPressure in", values, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureNotIn(List<Integer> values) {
            addCriterion("dailyMinPressure not in", values, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureBetween(Integer value1, Integer value2) {
            addCriterion("dailyMinPressure between", value1, value2, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailyminpressureNotBetween(Integer value1, Integer value2) {
            addCriterion("dailyMinPressure not between", value1, value2, "dailyminpressure");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureIsNull() {
            addCriterion("dailyMinTemperature is null");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureIsNotNull() {
            addCriterion("dailyMinTemperature is not null");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureEqualTo(Integer value) {
            addCriterion("dailyMinTemperature =", value, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureNotEqualTo(Integer value) {
            addCriterion("dailyMinTemperature <>", value, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureGreaterThan(Integer value) {
            addCriterion("dailyMinTemperature >", value, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureGreaterThanOrEqualTo(Integer value) {
            addCriterion("dailyMinTemperature >=", value, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureLessThan(Integer value) {
            addCriterion("dailyMinTemperature <", value, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureLessThanOrEqualTo(Integer value) {
            addCriterion("dailyMinTemperature <=", value, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureIn(List<Integer> values) {
            addCriterion("dailyMinTemperature in", values, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureNotIn(List<Integer> values) {
            addCriterion("dailyMinTemperature not in", values, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureBetween(Integer value1, Integer value2) {
            addCriterion("dailyMinTemperature between", value1, value2, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymintemperatureNotBetween(Integer value1, Integer value2) {
            addCriterion("dailyMinTemperature not between", value1, value2, "dailymintemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureIsNull() {
            addCriterion("dailyMaxPressure is null");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureIsNotNull() {
            addCriterion("dailyMaxPressure is not null");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureEqualTo(Integer value) {
            addCriterion("dailyMaxPressure =", value, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureNotEqualTo(Integer value) {
            addCriterion("dailyMaxPressure <>", value, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureGreaterThan(Integer value) {
            addCriterion("dailyMaxPressure >", value, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureGreaterThanOrEqualTo(Integer value) {
            addCriterion("dailyMaxPressure >=", value, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureLessThan(Integer value) {
            addCriterion("dailyMaxPressure <", value, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureLessThanOrEqualTo(Integer value) {
            addCriterion("dailyMaxPressure <=", value, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureIn(List<Integer> values) {
            addCriterion("dailyMaxPressure in", values, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureNotIn(List<Integer> values) {
            addCriterion("dailyMaxPressure not in", values, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureBetween(Integer value1, Integer value2) {
            addCriterion("dailyMaxPressure between", value1, value2, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxpressureNotBetween(Integer value1, Integer value2) {
            addCriterion("dailyMaxPressure not between", value1, value2, "dailymaxpressure");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureIsNull() {
            addCriterion("dailyMaxTemperature is null");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureIsNotNull() {
            addCriterion("dailyMaxTemperature is not null");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureEqualTo(Integer value) {
            addCriterion("dailyMaxTemperature =", value, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureNotEqualTo(Integer value) {
            addCriterion("dailyMaxTemperature <>", value, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureGreaterThan(Integer value) {
            addCriterion("dailyMaxTemperature >", value, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureGreaterThanOrEqualTo(Integer value) {
            addCriterion("dailyMaxTemperature >=", value, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureLessThan(Integer value) {
            addCriterion("dailyMaxTemperature <", value, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureLessThanOrEqualTo(Integer value) {
            addCriterion("dailyMaxTemperature <=", value, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureIn(List<Integer> values) {
            addCriterion("dailyMaxTemperature in", values, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureNotIn(List<Integer> values) {
            addCriterion("dailyMaxTemperature not in", values, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureBetween(Integer value1, Integer value2) {
            addCriterion("dailyMaxTemperature between", value1, value2, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andDailymaxtemperatureNotBetween(Integer value1, Integer value2) {
            addCriterion("dailyMaxTemperature not between", value1, value2, "dailymaxtemperature");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedIsNull() {
            addCriterion("maxWindSpeed is null");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedIsNotNull() {
            addCriterion("maxWindSpeed is not null");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedEqualTo(Integer value) {
            addCriterion("maxWindSpeed =", value, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedNotEqualTo(Integer value) {
            addCriterion("maxWindSpeed <>", value, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedGreaterThan(Integer value) {
            addCriterion("maxWindSpeed >", value, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedGreaterThanOrEqualTo(Integer value) {
            addCriterion("maxWindSpeed >=", value, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedLessThan(Integer value) {
            addCriterion("maxWindSpeed <", value, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedLessThanOrEqualTo(Integer value) {
            addCriterion("maxWindSpeed <=", value, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedIn(List<Integer> values) {
            addCriterion("maxWindSpeed in", values, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedNotIn(List<Integer> values) {
            addCriterion("maxWindSpeed not in", values, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedBetween(Integer value1, Integer value2) {
            addCriterion("maxWindSpeed between", value1, value2, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMaxwindspeedNotBetween(Integer value1, Integer value2) {
            addCriterion("maxWindSpeed not between", value1, value2, "maxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedIsNull() {
            addCriterion("directionMaxWindSpeed is null");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedIsNotNull() {
            addCriterion("directionMaxWindSpeed is not null");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedEqualTo(String value) {
            addCriterion("directionMaxWindSpeed =", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedNotEqualTo(String value) {
            addCriterion("directionMaxWindSpeed <>", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedGreaterThan(String value) {
            addCriterion("directionMaxWindSpeed >", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedGreaterThanOrEqualTo(String value) {
            addCriterion("directionMaxWindSpeed >=", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedLessThan(String value) {
            addCriterion("directionMaxWindSpeed <", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedLessThanOrEqualTo(String value) {
            addCriterion("directionMaxWindSpeed <=", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedLike(String value) {
            addCriterion("directionMaxWindSpeed like", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedNotLike(String value) {
            addCriterion("directionMaxWindSpeed not like", value, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedIn(List<String> values) {
            addCriterion("directionMaxWindSpeed in", values, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedNotIn(List<String> values) {
            addCriterion("directionMaxWindSpeed not in", values, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedBetween(String value1, String value2) {
            addCriterion("directionMaxWindSpeed between", value1, value2, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andDirectionmaxwindspeedNotBetween(String value1, String value2) {
            addCriterion("directionMaxWindSpeed not between", value1, value2, "directionmaxwindspeed");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityIsNull() {
            addCriterion("minRelativeHumidity is null");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityIsNotNull() {
            addCriterion("minRelativeHumidity is not null");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityEqualTo(Integer value) {
            addCriterion("minRelativeHumidity =", value, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityNotEqualTo(Integer value) {
            addCriterion("minRelativeHumidity <>", value, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityGreaterThan(Integer value) {
            addCriterion("minRelativeHumidity >", value, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityGreaterThanOrEqualTo(Integer value) {
            addCriterion("minRelativeHumidity >=", value, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityLessThan(Integer value) {
            addCriterion("minRelativeHumidity <", value, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityLessThanOrEqualTo(Integer value) {
            addCriterion("minRelativeHumidity <=", value, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityIn(List<Integer> values) {
            addCriterion("minRelativeHumidity in", values, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityNotIn(List<Integer> values) {
            addCriterion("minRelativeHumidity not in", values, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityBetween(Integer value1, Integer value2) {
            addCriterion("minRelativeHumidity between", value1, value2, "minrelativehumidity");
            return (Criteria) this;
        }

        public Criteria andMinrelativehumidityNotBetween(Integer value1, Integer value2) {
            addCriterion("minRelativeHumidity not between", value1, value2, "minrelativehumidity");
            return (Criteria) this;
        }
    }

    /**
     * This class was generated by MyBatis Generator.
     * This class corresponds to the database table weather_data
     *
     * @mbggenerated do_not_delete_during_merge
     */
    public static class Criteria extends GeneratedCriteria {

        protected Criteria() {
            super();
        }
    }

    /**
     * This class was generated by MyBatis Generator.
     * This class corresponds to the database table weather_data
     *
     * @mbggenerated
     */
    public static class Criterion {
        private String condition;

        private Object value;

        private Object secondValue;

        private boolean noValue;

        private boolean singleValue;

        private boolean betweenValue;

        private boolean listValue;

        private String typeHandler;

        public String getCondition() {
            return condition;
        }

        public Object getValue() {
            return value;
        }

        public Object getSecondValue() {
            return secondValue;
        }

        public boolean isNoValue() {
            return noValue;
        }

        public boolean isSingleValue() {
            return singleValue;
        }

        public boolean isBetweenValue() {
            return betweenValue;
        }

        public boolean isListValue() {
            return listValue;
        }

        public String getTypeHandler() {
            return typeHandler;
        }

        protected Criterion(String condition) {
            super();
            this.condition = condition;
            this.typeHandler = null;
            this.noValue = true;
        }

        protected Criterion(String condition, Object value, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.typeHandler = typeHandler;
            if (value instanceof List<?>) {
                this.listValue = true;
            } else {
                this.singleValue = true;
            }
        }

        protected Criterion(String condition, Object value) {
            this(condition, value, null);
        }

        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.secondValue = secondValue;
            this.typeHandler = typeHandler;
            this.betweenValue = true;
        }

        protected Criterion(String condition, Object value, Object secondValue) {
            this(condition, value, secondValue, null);
        }
    }
}


text:
//
//  LGProblems.h
//  LV Konverter
//
//  Created by Luis Gerhorst on 17.02.14.

#import <Foundation/Foundation.h>

extern NSInteger const LGUnrecognizeableLineSummarized;
extern NSInteger const LGUnrecognizeableLineWithOrdinalNumberSummarized;
extern NSInteger const LGDeadFieldsWithTextInServiceTextChunkLineSummarized;
extern NSInteger const LGServiceGroupTitleTooLongSummarized;
extern NSInteger const LGServiceUnitTooLongSummarized;
extern NSInteger const LGServiceTitleTooLongSummarized;
extern NSInteger const LGInvalidServiceTypeSummarized;

extern NSString * const LGErrorPriorityKey;
extern NSString * const LGErrorPriorityFatal;
extern NSString * const LGErrorPriorityWarning;

@interface LGErrors : NSObject

- (void)addError:(NSError *)error;
- (void)addErrors:(LGErrors *)errors;

- (BOOL)errorsExist;
- (NSArray *)summarizedErrors;

@end


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;

namespace VC.UI
{
    [ToolboxItem(true)]
    public class DxButton : SimpleButton
    {

    }

    [ToolboxItem(true)]
    public class DxTextEdit : TextEdit
    {

    }

    [ToolboxItem(true)]
    public class DxTextDisplayEdit : TextEdit
    {
        public DxTextDisplayEdit()
        {
            Properties.ReadOnly = true;
        }
    }

    [ToolboxItem(true)]
    public class DxLabel : LabelControl
    {

    }

    [ToolboxItem(true)]
    public class DxTestDisplayEdit : TextEdit
    {
        public DxTestDisplayEdit()
        {
            Properties.ReadOnly = true;
        }
    }

    [ToolboxItem(true)]
    public class DxComboBox : ComboBoxEdit
    {
        //public ComboBoxItemCollection Items
        //{
        //    get
        //    {
        //        return Properties.Items;
        //    }
        //}

        public void AddItem(object value)
        {
            Properties.Items.Add(value);
        }

        public void AddEnumValues(Type enumType)
        {
            foreach (object ttype in Enum.GetValues(enumType))
            {
                Properties.Items.Add(ttype);
            }
        }
    }

    [ToolboxItem(true)]
    public class DxMemoEdit : MemoEdit
    {

    }

    [ToolboxItem(true)]
    public class DxDateEdit : DateEdit
    {

    }

    [ToolboxItem(true)]
    public class DxCheckedListBoxControl : CheckedListBoxControl
    {

    }
}


text:
module GovKit
  module OpenCongress
    class PersonStat < OpenCongressObject

      attr_accessor :votes_most_often_with_id, :opposing_party_votes_most_often_with_id, :votes_least_often_with_id, :same_party_votes_least_often_with_id, :party_votes_percentage, :abstains_percentage, :abstains_percentage_rank, :party_votes_percentage_rank, :sponsored_bills, :cosponsored_bills, :abstains, :sponsored_bills_passed_rank, :cosponsored_bills_passed_rank, :sponsored_bills_passed, :cosponsored_bills_passed, :sponsored_bills_rank, :cosponsored_bills_rank

      def initialize(params)
        super PersonStat, params
      end
    end

  end
end


text: """Module for the chunker's adapter"""


text:
ROOT = ../../../../..

DIR = Providers/ManagedSystem/UNIXProviders/MemoryError

include $(ROOT)/mak/config.mak

LIBRARY = UNIX_MemoryErrorProvider

EXTRA_INCLUDES += -I/usr/local/include -I./..

SOURCES = \
	../CIMHelper.cpp \
	UNIX_MemoryErrorMain.cpp \
	UNIX_MemoryError.cpp \
	UNIX_MemoryErrorProvider.cpp

ifeq ($(OS), aix)
	SOURCES += UNIX_MemoryError_AIX.cpp
endif
ifeq ($(OS), darwin)
	SOURCES += UNIX_MemoryError_DARWIN.cpp
endif
ifeq ($(OS), freebsd)
	SOURCES += UNIX_MemoryError_FREEBSD.cpp
endif
ifeq ($(OS), hpux)
	SOURCES += UNIX_MemoryError_HPUX.cpp
endif
ifeq ($(OS), linux)
	SOURCES += UNIX_MemoryError_LINUX.cpp
endif
ifeq ($(OS), solaris)
	SOURCES += UNIX_MemoryError_SOLARIS.cpp
endif
ifeq ($(OS), tru64)
	SOURCES += UNIX_MemoryError_TRU64.cpp
endif
ifeq ($(OS), vms)
	SOURCES += UNIX_MemoryError_VMS.cpp
endif
ifeq ($(OS), win32)
	SOURCES += UNIX_MemoryError_WIN32.cpp
endif
ifeq ($(OS), zos)
	SOURCES += UNIX_MemoryError_ZOS.cpp
endif
ifeq (, $(filter aix,darwin,freebsd,hpux,linux,solaris,tru64,vms,win32,zos $(OS)))

else
	SOURCES += UNIX_MemoryError_STUB.cpp
endif

LIBRARIES = \
	pegprovider \
	pegclient \
	pegcommon \
	pegquerycommon \
	pegqueryexpression \
	pegcql \
	pegwql

EXTRA_LIBRARIES = \
	-pthread \
	-lutil \
	-lgeom \
	-lkvm \
	-lcam

include $(ROOT)/mak/dynamic-library.mak


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

namespace _4
{
    class Program
    {
        static void Main(string[] args)
        {
            var inherated = double.Parse(Console.ReadLine());
            var year = int.Parse(Console.ReadLine());
            double sum = inherated;
            var years = 17;

            for (int i = 1800; i <= year; i++)
            {
                years++;
                if (i%2==0)
                {
                    sum -= 12000;
                }
                else if (i%2!=0)
                {
                    sum -= 12000 + 50 * years;
                }
            }
            if (sum >= 0) Console.WriteLine("Yes! He will live a carefree life and will have {0:f2} dollars left.", sum);
            else if (sum < 0) Console.WriteLine("He will need {0:f2} dollars to survive.",Math.Abs(sum));
        }
    }
}


text:
namespace std { template<typename T> class complex; }

struct para_eom
{
  int iphi;              // index of phi
  struct parameters *ps; // parameters of system
  // std::complex<double> **rho;
  double **rho;

  // temporary heap object for running eom
  double** Rr;
  double** Ir;
  double** w;
  double** V;
  double*  ef;
  double**** R;
  double*  y;
};

void equation_of_motion_ini( para_eom* peom );
void equation_of_motion_del( para_eom* peom );
void equation_of_motion_out( int it, para_eom* peom );

int equation_of_motion_run_2( double t, const double y[], double* dy, void* peom );
int equation_of_motion_run_3( double t, const double y[], double* dy, void* peom );
int equation_of_motion_run_4( double t, const double y[], double* dy, void* peom );
int equation_of_motion_run_5( double t, const double y[], double* dy, void* peom );
int equation_of_motion_run_6( double t, const double y[], double* dy, void* peom );

#endif