How to define states for window/operator base class?
Since the instances of the operators only exist for the duration of their execution, instance attributes aren't a suitable solution for storing the state. Once the execution is finished the operator is destroyed and subsequent calls to execute() or invoke() will not have access to the previous state. Class attributes, also known as static variable in other programming languages, could be used since all instances of the class access the very same variable. Therefore the state remains, even when one particular object ceased to exist.

The example below demonstrates the lifetime of an operator and the difference in using a class or instance attribute. Since the operator instance gets destroyed once it's finished executing, the instance attribute always remains "1" no matter how often the operator is called.

bl_info = {
    "name": "Class vs Instance Attribute",
    "author": "Robert Guetzkow",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "",
    "description": "Demonstrates the lifetime of the operator.",
    "warning": "",
    "wiki_url": "",
    "category": "3D View"}

import bpy


class EXAMPLE_OT_class_attribute(bpy.types.Operator):
    bl_idname = "example.class_attribute"
    bl_label = "Increment and print class attribute"
    bl_description = "Increment and print instance attribute"

    x = 0

    def execute(self, context):
        EXAMPLE_OT_class_attribute.x += 1
        print(f"EXAMPLE_OT_class_attribute: {EXAMPLE_OT_class_attribute.x}")
        return {"FINISHED"}

class EXAMPLE_OT_instance_attribute(bpy.types.Operator):
    bl_idname = "example.instance_attribute"
    bl_label = "Increment and print instance attribute"
    bl_description = "Increment and print instance attribute"

    def __init__(self):
        self.x = 0

    def execute(self, context):
        self.x += 1
        print(f"self.x: {self.x}")
        return {"FINISHED"}

classes = (EXAMPLE_OT_class_attribute, EXAMPLE_OT_instance_attribute)


def register():
    for cls in classes:
        bpy.utils.register_class(cls)


def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)


if __name__ == "__main__":
    register()

    for i in range(5):
        bpy.ops.example.class_attribute()

    for i in range(5):
        bpy.ops.example.instance_attribute()