initBlocks: ->
    Blockly.Blocks['discriminator'] = init:() ->
          @jsonInit(
            type: "discriminator"
            message0: "Discriminator %1 %2"
            args0: [
              {
                "type": "input_dummy"
              },
              {
                type: "input_statement"
                name: "new_level"
                check: "aggregator_core"
              }
            ]
            tooltip: ""
            helpUrl: ""
            )
    Blockly.Blocks['aggregator_core'] = init:() ->
          @jsonInit(
            type: "aggregator_core"
            message0: "Aggregator %1 %2 Who to Heed or Aggregator %3 %5 %4"
            args0: [
              {
                type: "field_dropdown"
                name: "agg_function"
                options: [
                  [
                    "Minimum",
                    "MIN"
                  ],
                  [
                    "Maximum",
                    "MAX"
                  ],
                  [
                    "Average",
                    "AVG"
                  ],
                  [
                    "Earliest",
                    "EARLIEST"
                  ],
                  [
                    "Latest",
                    "LATEST"
                  ]
                ]
              }
              {
                type: "input_dummy"
                class: "test-blockly"
              }
              {
                type: "input_statement"
                name: "new_level"
                check: [
                  "who_to_heed"
                  "aggregator"
                  ]
              }
              {
                type: "input_statement"
                name: "criteria"
                check: "criteria"
                align: "RIGHT"
              }
              {
                type: "field_label"
                text: "for Criteria"
                class: "block-criteria"
              }
            ]
            previousStatement: "aggregator_core"
            nextStatement: "aggregator_core"
            colour: 230,
            tooltip: ""
            helpUrl: ""
            )
    Blockly.Blocks['aggregators'] = init:() ->
          @jsonInit(
            type: "aggregator"
            message0: "Aggregator %1 %2 %3"
            args0: [
              {
                type: "field_dropdown"
                name: "agg_function"
                options: [
                  [
                    "Minimum",
                    "MIN"
                  ],
                  [
                    "Maximum",
                    "MAX"
                  ],
                  [
                    "Average",
                    "AVG"
                  ],
                  [
                    "Earliest",
                    "EARLIEST"
                  ],
                  [
                    "Latest",
                    "LATEST"
                  ]
                ]
              }
              {
                type: "input_dummy"
              }
              {
                type: "input_statement"
                name: "new_level"
                check: [
                  "who_to_heed"
                  "aggregator"
                  ]
              }
            ]
            previousStatement: "aggregator"
            colour: 210,
            tooltip: ""
            helpUrl: ""
          )
    Blockly.Blocks['who_to_heed'] = init:() ->
        @jsonInit(
          message0: "Who To Heed %1 Heed %2 NOT %3 OR %4"
          type: "who_to_heed"
          args0: [
            {
              type: "input_dummy"
            },
            {
              type: "input_statement",
              name: "include",
              check: "a_user",
              align: "RIGHT"
            },
            {
              type: "input_statement",
              name: "exclude",
              check: "a_user",
              align: "RIGHT"
            },
            {
              type: "input_statement",
              name: "otherwise",
              check: "who_to_heed",
              align: "RIGHT"
            }
          ]
          previousStatement: "who_to_heed"
          colour: 65,
          tooltip: "Returns filter function"
          helpUrl: "http://www.w3schools.com/jsref/jsref_length_string.asp"
          )
    Blockly.Blocks['who_to_heed_or'] = init:() ->
        @jsonInit(
          message0: "OR Who To Heed %1 Heed %2 NOT %3 OR %4"
          type: "who_to_heed_or"
          args0: [
            {
              type: "input_dummy"
            },
            {
              type: "input_statement"
              name: "include"
              check: "a_user"
              align: "RIGHT"
            },
            {
              type: "input_statement"
              name: "exclude"
              check: "a_user"
              align: "RIGHT"
            },
            {
              type: "input_value"
              name: "otherwise"
              check: "who_to_heed_or"
              align: "RIGHT"
            }
          ]
          output: "who_to_heed_or"
          colour: 45,
          tooltip: ""
          helpUrl: ""
          )
    Blockly.Blocks['predicate_reducer'] = init:() ->
        @jsonInit(
          type: "predicatereducer"
          message0: "%1 %2 %3 %4"
          args0: [
            {
              type: "field_input",
              name: "NAME",
              text: "usesReducer"
            },
            {
              type: "input_value",
              name: "dataReducer",
              check: "DataReducer",
              align: "RIGHT"
            },
            {
              type: "field_input",
              name: "forCriterion",
              text: "forCriterion"
            },
            {
              type: "input_value",
              name: "criteria",
              check: "Criterion",
              align: "RIGHT"
            }
          ]
          inputsInline: false,
          output: "PredicateReducer"
          colour: 315,
          tooltip: ""
          helpUrl: ""
          )
    Blockly.Blocks['a_user'] = init:() ->
          @jsonInit(
            type: "a_user"
            message0: "@ %1"
            args0: [
              {
                type: "field_input",
                name: "userName",
                text: "default"
              }
            ]
            inputsInline: true,
            previousStatement: "a_user"
            nextStatement: "a_user"
            colour: 120,
            tooltip: ""
            helpUrl: ""
            )
    Blockly.Blocks['user_sel'] = init:() ->
        @jsonInit(
          type: "user_sel"
          message0: "%1"
          args0: [
            {
              type: "field_dropdown",
              name: "userName",
              options: [
                [
                  "me",
                  "me"
                ],
                [
                  "others",
                  "others"
                ],
                [
                  "everyone",
                  "everyone"
                ]
              ]
            }
          ]
          inputsInline: true,
          previousStatement: "a_user"
          nextStatement: "a_user"
          colour: 120,
          tooltip: ""
          helpUrl: ""
          )
    Blockly.Blocks['predicate_reducer_2'] = init:() ->
        @jsonInit(
          type: "predicatereducer"
          message0: "PredicateReducer %1 %2 %3 %4 %5"
          args0: [
              {
                type: "input_dummy"
              },
              {
                type: "field_input",
                name: "NAME",
                text: "usesDataReducer"
              },
              {
                type: "input_value",
                name: "dataReducer",
                check: "DataReducer",
                align: "RIGHT"
              },
              {
                type: "field_input",
                name: "forCriteria",
                text: "forCriteria"
              },
              {
                type: "input_statement",
                name: "NAME",
                check: "Criterion",
                align: "RIGHT"
              }
            ]
          inputsInline: false
          output: "PredicateReducer"
          colour: 315
          tooltip: ""
          helpUrl: ""
          )
    Blockly.Blocks['data_set'] = init:() ->
          @jsonInit(
            message0: "Data Set: %1"
            args0: [
                {
                  type: "field_input"
                  name: "data_set"
                  text: "test"
                }
              ]
            output: "string"
            colour: 160
            tooltip: "Returns number of letters in the provided text."
            helpUrl: "http://www.w3schools.com/jsref/jsref_length_string.asp"
            )
    Blockly.Blocks['dscrm_picker'] = init:() ->
          @jsonInit(
            message0: "%1"
            type: "dscrm_picker"
            args0: [
                {
                  type: "field_dropdown"
                  name: "dscrm_type"
                  options: [
                    [
                      "Minimum",
                      "MIN"
                    ],
                    [
                      "Maximum",
                      "MAX"
                    ],
                    [
                      "Average",
                      "AVG"
                    ],
                    [
                      "Earliest",
                      "EARLIEST"
                    ],
                    [
                      "Latest",
                      "LATEST"
                    ]
                  ]
                }
              ]
            output: "filter"
            colour: 280
            tooltip: "Returns filter function"
            helpUrl: "http://www.w3schools.com/jsref/jsref_length_string.asp"
            )
    Blockly.Blocks['criteria'] = init:() ->
          @jsonInit(
            type: "criteria"
            message0: "%1"
            args0: [
              {
                type: "field_input",
                name: "CriteriaName",
                text: "Criteria"
              }
            ]
            inputsInline: true,
            previousStatement: "criteria"
            nextStatement: "criteria"
            colour: 20,
            tooltip: ""
            helpUrl: ""
            )