text:
require_relative 'justify'

describe 'justify' do

  context 'justify(text, width)' do

    it 'returns nil for nil text arg' do
      expect(justify(nil, 20)).to eq nil
    end

    it 'raises error if longest word is greater than width' do
      expect do
        justify("something something something", 8)
      end.to raise_error(
        RuntimeError,
        "Cannot justify to width 8 without word-splitting"
      )
    end

    it 'justifies short text by given width' do
      expect(justify('123 45 6', 7)).to eq "123  45\n6"
    end

    it 'justifies longer text by given width' do
      text = "Lorem ipsum dolor sit amet, consec adipiscing elit. Donec at soldales metus."
      width = 20

      justified =
        "Lorem   ipsum  dolor\n" +
        "sit   amet,   consec\n" +
        "adipiscing     elit.\n" +
        "Donec   at  soldales\n" +
        "metus."

      expect(justify(text, width)).to eq justified
    end

    it 'does not justify last line' do
      text = "Lorem ipsum dolor sit amet, consec adipiscing elit."
      width = 27

      justified =
        "Lorem ipsum dolor sit amet,\n" +
        "consec adipiscing elit."

      expect(justify(text, width)).to eq justified
    end

  end

  context 'justify_line(line, width)' do

    it 'does not justify a line with correct width already' do
      expect(justify_line("hello world", 11)).to eq "hello world"
    end

    it 'justifies a line with 2 words until width met' do
      expect(justify_line("hello world", 14)).to eq "hello    world"
    end

    it 'justifies a line with 3 words and a comma until width met' do
      expect(justify_line("sit amet, consec", 20)).to eq "sit   amet,   consec"
    end

    it 'does not add whitespace to a line with 1 word' do
      expect(justify_line("consectetur", 15)).to eq "consectetur"
    end

    it 'justifies a 4 word, 25 char width line correctly' do
      expect(justify_line("Lorem ipsum dolor sit", 25)).to eq "Lorem   ipsum  dolor  sit"
    end

  end
end


text:
import csv
import datetime

from collections import OrderedDict

from django.core.exceptions import FieldDoesNotExist
from django.http import HttpResponse, StreamingHttpResponse
from django.utils.dateformat import Formatter
from django.utils.encoding import force_str
from django.utils.formats import get_format
from django.utils.translation import gettext as _
from xlsxwriter.workbook import Workbook

from wagtail.admin.forms.search import SearchForm
from wagtail.core.utils import multigetattr
from wagtail.search.backends import get_search_backend
from wagtail.search.index import class_is_indexed

class SearchableListMixin:
    search_box_placeholder = _("Search")
    search_fields = None

    def get_search_form(self):
        return SearchForm(self.request.GET if self.request.GET.get('q') else None, placeholder=self.search_box_placeholder)

    def get_queryset(self):
        queryset = super().get_queryset()
        search_form = self.get_search_form()

        if search_form.is_valid():
            q = search_form.cleaned_data['q']

            if class_is_indexed(queryset.model):
                search_backend = get_search_backend()
                queryset = search_backend.search(q, queryset, fields=self.search_fields)
            else:
                filters = {
                    field + '__icontains': q
                    for field in self.search_fields or []
                }

                queryset = queryset.filter(**filters)

        return queryset

    def get_context_data(self, **kwargs):
        if 'search_form' not in kwargs:
            kwargs['search_form'] = self.get_search_form()
            kwargs['is_searching'] = bool(self.request.GET.get('q'))

        return super().get_context_data(**kwargs)

class Echo:
    """An object that implements just the write method of the file-like interface."""

    def write(self, value):
        """Write the value by returning it, instead of storing in a buffer."""
        return value.encode("UTF-8")

def list_to_str(value):
    return force_str(", ".join(value))

class ExcelDateFormatter(Formatter):
    data = None

    _formats = {
        "d": "DD",
        "j": "D",
        "D": "NN",
        "l": "NNNN",
        "S": "",
        "w": "",
        "z": "",
        "W": "",
        "m": "MM",
        "n": "M",
        "M": "MMM",
        "b": "MMM",
        "F": "MMMM",
        "E": "MMM",
        "N": "MMM.",
        "y": "YY",
        "Y": "YYYY",
        "L": "",
        "o": "",
        "g": "H",
        "G": "H",
        "h": "HH",
        "H": "HH",
        "i": "MM",
        "s": "SS",
        "u": "",
        "a": "AM/PM",
        "A": "AM/PM",
        "P": "HH:MM AM/PM",
        "e": "",
        "I": "",
        "O": "",
        "T": "",
        "Z": "",
        "c": "YYYY-MM-DD HH:MM:SS",
        "r": "NN, MMM D YY HH:MM:SS",
        "U": "[HH]:MM:SS",
    }

    def get(self):
        format = get_format("SHORT_DATETIME_FORMAT")
        return self.format(format)

    def __getattr__(self, name):
        if name in self._formats:
            return lambda: self._formats[name]
        raise AttributeError(
            f"'{type(self).__name__}' object has no attribute '{name}'"
        )

class SpreadsheetExportMixin:
    """ A mixin for views, providing spreadsheet export functionality in csv and xlsx formats """

    FORMAT_XLSX = "xlsx"
    FORMAT_CSV = "csv"
    FORMATS = (FORMAT_XLSX, FORMAT_CSV)

    # A list of fields or callables (without arguments) to export from each item in the queryset (dotted paths allowed)
    list_export = []
    # A dictionary of custom preprocessing functions by field and format (expected value would be of the form {field_name: {format: function}})
    # If a valid field preprocessing function is found, any applicable value preprocessing functions will not be used
    custom_field_preprocess = {}
    # A dictionary of preprocessing functions by value class and format
    custom_value_preprocess = {
        (datetime.date, datetime.time): {FORMAT_XLSX: None},
        list: {FORMAT_CSV: list_to_str, FORMAT_XLSX: list_to_str},
    }
    # A dictionary of column heading overrides in the format {field: heading}
    export_headings = {}

    def get_filename(self):
        """ Gets the base filename for the exported spreadsheet, without extensions """
        return "spreadsheet-export"

    def to_row_dict(self, item):
        """ Returns an OrderedDict (in the order given by list_export) of the exportable information for a model instance"""
        row_dict = OrderedDict(
            (field, multigetattr(item, field)) for field in self.list_export
        )
        return row_dict

    def get_preprocess_function(self, field, value, export_format):
        """ Returns the preprocessing function for a given field name, field value, and export format"""

        # Try to find a field specific function and return it
        format_dict = self.custom_field_preprocess.get(field, {})
        if export_format in format_dict:
            return format_dict[export_format]

        # Otherwise check for a value class specific function
        for value_classes, format_dict in self.custom_value_preprocess.items():
            if isinstance(value, value_classes) and export_format in format_dict:
                return format_dict[export_format]

        # Finally resort to force_str to prevent encoding errors
        return force_str

    def write_xlsx_row(self, worksheet, row_dict, row_number):
        for col_number, (field, value) in enumerate(row_dict.items()):
            preprocess_function = self.get_preprocess_function(
                field, value, self.FORMAT_XLSX
            )
            processed_value = (
                preprocess_function(value) if preprocess_function else value
            )
            worksheet.write(row_number, col_number, processed_value)

    def write_csv_row(self, writer, row_dict):
        processed_row = {}
        for field, value in row_dict.items():
            preprocess_function = self.get_preprocess_function(
                field, value, self.FORMAT_CSV
            )
            processed_value = (
                preprocess_function(value) if preprocess_function else value
            )
            processed_row[field] = processed_value
        return writer.writerow(processed_row)

    def get_heading(self, queryset, field):
        """ Get the heading label for a given field for a spreadsheet generated from queryset """
        heading_override = self.export_headings.get(field)
        if heading_override:
            return force_str(heading_override)
        try:
            return force_str(
                queryset.model._meta.get_field(field).verbose_name.title()
            )
        except (AttributeError, FieldDoesNotExist):
            return force_str(field)

    def stream_csv(self, queryset):
        """ Generate a csv file line by line from queryset, to be used in a StreamingHTTPResponse """
        writer = csv.DictWriter(Echo(), fieldnames=self.list_export)
        yield writer.writerow(
            {field: self.get_heading(queryset, field) for field in self.list_export}
        )

        for item in queryset:
            yield self.write_csv_row(writer, self.to_row_dict(item))

    def write_xlsx(self, queryset, output):
        """ Write an xlsx workbook from a queryset"""
        workbook = Workbook(
            output,
            {
                "in_memory": True,
                "constant_memory": True,
                "remove_timezone": True,
                "default_date_format": ExcelDateFormatter().get(),
            },
        )
        worksheet = workbook.add_worksheet()

        for col_number, field in enumerate(self.list_export):
            worksheet.write(0, col_number, self.get_heading(queryset, field))

        for row_number, item in enumerate(queryset):
            self.write_xlsx_row(worksheet, self.to_row_dict(item), row_number + 1)

        workbook.close()

    def write_xlsx_response(self, queryset):
        response = HttpResponse(
            content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        )
        response["Content-Disposition"] = 'attachment; filename="{}.xlsx"'.format(
            self.get_filename()
        )
        self.write_xlsx(queryset, response)

        return response

    def write_csv_response(self, queryset):
        stream = self.stream_csv(queryset)

        response = StreamingHttpResponse(stream, content_type="text/csv")
        response["Content-Disposition"] = 'attachment; filename="{}.csv"'.format(
            self.get_filename()
        )
        return response

    def as_spreadsheet(self, queryset, spreadsheet_format):
        """ Return a response with a spreadsheet representing the exported data from queryset, in the format specified"""
        if spreadsheet_format == self.FORMAT_CSV:
            return self.write_csv_response(queryset)
        elif spreadsheet_format == self.FORMAT_XLSX:
            return self.write_xlsx_response(queryset)

    def get_export_url(self, format):
        params = self.request.GET.copy()
        params['export'] = format
        return self.request.path + '?' + params.urlencode()

    @property
    def xlsx_export_url(self):
        return self.get_export_url('xlsx')

    @property
    def csv_export_url(self):
        return self.get_export_url('csv')

redpajama_set_name: RedPajamaGithub


text:
Public Class vxWebView

    Private Sub WebView_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Height = 538
        Me.Width = 924
    End Sub
End Class


text:
package controllers.camp

import scalaz._
import Scalaz._
import scalaz.Validation
import scalaz.Validation.FlatMap._
import net.liftweb.json._
import controllers.stack.Results

import models.tosca._
import io.megam.auth.funnel.{ FunnelResponse, FunnelResponses }
import io.megam.auth.funnel.FunnelErrors._
import play.api.mvc._

object Components extends Controller with controllers.stack.APIAuthElement {

  def show(id: String) = StackAction(parse.tolerantText) { implicit request =>
    (Validation.fromTryCatchThrowable[Result, Throwable] {
      reqFunneled match {
        case Success(succ) => {
          val freq = succ.getOrElse(throw new Error("Invalid header."))
          val email = freq.maybeEmail.getOrElse(throw new Error("Email not found (or) invalid."))
          models.tosca.Component.findById(List(id).some) match {
            case Success(succ) =>
             Ok(Results.resultset(models.Constants.COMPONENTSCOLLECTIONCLAZ, compactRender(Extraction.decompose(succ))))
            case Failure(err) =>
              val rn: FunnelResponse = new HttpReturningError(err)
              Status(rn.code)(rn.toJson(true))
          }
        }
        case Failure(err) => {
          val rn: FunnelResponse = new HttpReturningError(err)
          Status(rn.code)(rn.toJson(true))
        }
      }
    }).fold(succ = { a: Result => a }, fail = { t: Throwable => Status(BAD_REQUEST)(t.getMessage) })

  }

  def update = StackAction(parse.tolerantText) { implicit request =>
    (Validation.fromTryCatchThrowable[Result, Throwable] {
      reqFunneled match {
        case Success(succ) => {
          val freq = succ.getOrElse(throw new Error("Components wasn't funneled. Verify the header."))
          val email = freq.maybeEmail.getOrElse(throw new Error("Email not found (or) invalid."))
          val org = freq.maybeOrg.getOrElse(throw new Error("Org not found (or) invalid."))
          val clientAPIBody = freq.clientAPIBody.getOrElse(throw new Error("Body not found (or) invalid."))
          models.tosca.Component.update(org, clientAPIBody) match {
            case Success(succ) => Ok(Results.resultset(models.Constants.COMPONENTSCOLLECTIONCLAZ, compactRender(Extraction.decompose(succ)))) //Ok(ComponentsResults.toJson(succ, true))
            case Failure(err) =>
              val rn: FunnelResponse = new HttpReturningError(err)
              Status(rn.code)(rn.toJson(true))
          }
        }
        case Failure(err) => {
          val rn: FunnelResponse = new HttpReturningError(err)
          Status(rn.code)(rn.toJson(true))
        }
      }
    }).fold(succ = { a: Result => a }, fail = { t: Throwable => Status(BAD_REQUEST)(t.getMessage) })
  }

}


text:
@interface UIFont (RedactedScript)

+ (instancetype)redactedScriptBoldFontOfSize:(CGFloat)size;
+ (instancetype)redactedScriptRegularFontOfSize:(CGFloat)size;

@end


text:
package com.ugg.gdxjam.model.components;

import com.badlogic.ashley.core.Component;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.ai.fsm.DefaultStateMachine;
import com.badlogic.gdx.ai.fsm.State;
import com.badlogic.gdx.ai.fsm.StateMachine;
import com.badlogic.gdx.ai.msg.Telegram;
import com.badlogic.gdx.ai.msg.Telegraph;
import com.badlogic.gdx.utils.Pool;
import com.ugg.gdxjam.model.GameEntity;

public class FSMComponent implements Component,Telegraph, Pool.Poolable {

	public DefaultStateMachine stateMachine = new DefaultStateMachine();

	public void update () {
		stateMachine.update();
	}

	public void changeState (State<GameEntity> state) {
		stateMachine.changeState(state);
	}

	@Override
	public boolean handleMessage (Telegram msg) {
		return stateMachine.handleMessage(msg);
	}

	@Override
	public void reset() {
		this.stateMachine.changeState(null);
	}
}


text:
<?xml version="1.0"?><Module xmlns="http://clafer.org/ir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cl="http://clafer.org/ir" xsi:schemaLocation="http://clafer.org/ir https://github.com/gsdlab/clafer/blob/master/src/ClaferIR.xsd"><Name></Name>
<Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>6</IntLiteral>
<IntLiteral>1</IntLiteral>
</Start>
<End><IntLiteral>7</IntLiteral>
<IntLiteral>28</IntLiteral>
</End>
</Position>
<IsAbstract>true</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>IMeasurable</Id>
<UniqueId>c1_IMeasurable</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>0</IntLiteral>
<IntLiteral>0</IntLiteral>
</Start>
<End><IntLiteral>0</IntLiteral>
<IntLiteral>0</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>clafer</Id>
<IsTop>false</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>7</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>7</IntLiteral>
<IntLiteral>28</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>footprint</Id>
<UniqueId>c2_footprint</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>7</IntLiteral>
<IntLiteral>21</IntLiteral>
</Start>
<End><IntLiteral>7</IntLiteral>
<IntLiteral>28</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>integer</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>1</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>10</IntLiteral>
<IntLiteral>1</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>62</IntLiteral>
</End>
</Position>
<IsAbstract>true</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>BerkeleyDbC</Id>
<UniqueId>c3_BerkeleyDbC</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>0</IntLiteral>
<IntLiteral>0</IntLiteral>
</Start>
<End><IntLiteral>0</IntLiteral>
<IntLiteral>0</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>clafer</Id>
<IsTop>false</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>11</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>12</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>HAVE_CRYPTO</Id>
<UniqueId>c4_HAVE_CRYPTO</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>11</IntLiteral>
<IntLiteral>23</IntLiteral>
</Start>
<End><IntLiteral>11</IntLiteral>
<IntLiteral>34</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c5_exp</ParentId>
<Position><Start><IntLiteral>12</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>12</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c6_exp</ParentId>
<Position><Start><IntLiteral>12</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>12</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c7_exp</ParentId>
<Position><Start><IntLiteral>12</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>12</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c8_exp</ParentId>
<Position><Start><IntLiteral>12</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>12</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c9_exp</ParentId>
<Position><Start><IntLiteral>12</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>12</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>10</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>13</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>14</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>HAVE_HASH</Id>
<UniqueId>c10_HAVE_HASH</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>13</IntLiteral>
<IntLiteral>21</IntLiteral>
</Start>
<End><IntLiteral>13</IntLiteral>
<IntLiteral>32</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c11_exp</ParentId>
<Position><Start><IntLiteral>14</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>14</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c12_exp</ParentId>
<Position><Start><IntLiteral>14</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>14</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c13_exp</ParentId>
<Position><Start><IntLiteral>14</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>14</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c14_exp</ParentId>
<Position><Start><IntLiteral>14</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>14</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c15_exp</ParentId>
<Position><Start><IntLiteral>14</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>14</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>56</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>15</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>16</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>HAVE_QUEUE</Id>
<UniqueId>c16_HAVE_QUEUE</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>15</IntLiteral>
<IntLiteral>22</IntLiteral>
</Start>
<End><IntLiteral>15</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c17_exp</ParentId>
<Position><Start><IntLiteral>16</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>16</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c18_exp</ParentId>
<Position><Start><IntLiteral>16</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>16</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c19_exp</ParentId>
<Position><Start><IntLiteral>16</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>16</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c20_exp</ParentId>
<Position><Start><IntLiteral>16</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>16</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c21_exp</ParentId>
<Position><Start><IntLiteral>16</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>16</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>28</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>17</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>18</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>HAVE_REPLICATION</Id>
<UniqueId>c22_HAVE_REPLICATION</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>17</IntLiteral>
<IntLiteral>28</IntLiteral>
</Start>
<End><IntLiteral>17</IntLiteral>
<IntLiteral>39</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c23_exp</ParentId>
<Position><Start><IntLiteral>18</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>18</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c24_exp</ParentId>
<Position><Start><IntLiteral>18</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>18</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c25_exp</ParentId>
<Position><Start><IntLiteral>18</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>18</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c26_exp</ParentId>
<Position><Start><IntLiteral>18</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>18</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c27_exp</ParentId>
<Position><Start><IntLiteral>18</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>18</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>44</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>19</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>20</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>HAVE_VERIFY</Id>
<UniqueId>c28_HAVE_VERIFY</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>19</IntLiteral>
<IntLiteral>23</IntLiteral>
</Start>
<End><IntLiteral>19</IntLiteral>
<IntLiteral>34</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c29_exp</ParentId>
<Position><Start><IntLiteral>20</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>20</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c30_exp</ParentId>
<Position><Start><IntLiteral>20</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>20</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c31_exp</ParentId>
<Position><Start><IntLiteral>20</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>20</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c32_exp</ParentId>
<Position><Start><IntLiteral>20</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>20</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c33_exp</ParentId>
<Position><Start><IntLiteral>20</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>20</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>25</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>21</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>22</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>HAVE_SEQUENCE</Id>
<UniqueId>c34_HAVE_SEQUENCE</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>21</IntLiteral>
<IntLiteral>25</IntLiteral>
</Start>
<End><IntLiteral>21</IntLiteral>
<IntLiteral>36</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c35_exp</ParentId>
<Position><Start><IntLiteral>22</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>22</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c36_exp</ParentId>
<Position><Start><IntLiteral>22</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>22</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c37_exp</ParentId>
<Position><Start><IntLiteral>22</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>22</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c38_exp</ParentId>
<Position><Start><IntLiteral>22</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>22</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c39_exp</ParentId>
<Position><Start><IntLiteral>22</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>22</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>10</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>23</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>24</IntLiteral>
<IntLiteral>39</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>HAVE_STATISTICS</Id>
<UniqueId>c40_HAVE_STATISTICS</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>23</IntLiteral>
<IntLiteral>27</IntLiteral>
</Start>
<End><IntLiteral>23</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c41_exp</ParentId>
<Position><Start><IntLiteral>24</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>24</IntLiteral>
<IntLiteral>39</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c42_exp</ParentId>
<Position><Start><IntLiteral>24</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>24</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c43_exp</ParentId>
<Position><Start><IntLiteral>24</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>24</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c44_exp</ParentId>
<Position><Start><IntLiteral>24</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>24</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c45_exp</ParentId>
<Position><Start><IntLiteral>24</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>24</IntLiteral>
<IntLiteral>39</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>139</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>25</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>26</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>DIAGNOSTIC</Id>
<UniqueId>c46_DIAGNOSTIC</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>25</IntLiteral>
<IntLiteral>22</IntLiteral>
</Start>
<End><IntLiteral>25</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c47_exp</ParentId>
<Position><Start><IntLiteral>26</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>26</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c48_exp</ParentId>
<Position><Start><IntLiteral>26</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>26</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c49_exp</ParentId>
<Position><Start><IntLiteral>26</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>26</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c50_exp</ParentId>
<Position><Start><IntLiteral>26</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>26</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c51_exp</ParentId>
<Position><Start><IntLiteral>26</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>26</IntLiteral>
<IntLiteral>38</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>54</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>27</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>28</IntLiteral>
<IntLiteral>39</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>SYNTETHIC_BASE_FEATURE</Id>
<UniqueId>c52_SYNTETHIC_BASE_FEATURE</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>27</IntLiteral>
<IntLiteral>34</IntLiteral>
</Start>
<End><IntLiteral>27</IntLiteral>
<IntLiteral>45</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>1</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c53_exp</ParentId>
<Position><Start><IntLiteral>28</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>28</IntLiteral>
<IntLiteral>39</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c54_exp</ParentId>
<Position><Start><IntLiteral>28</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>28</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c55_exp</ParentId>
<Position><Start><IntLiteral>28</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>28</IntLiteral>
<IntLiteral>23</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c56_exp</ParentId>
<Position><Start><IntLiteral>28</IntLiteral>
<IntLiteral>24</IntLiteral>
</Start>
<End><IntLiteral>28</IntLiteral>
<IntLiteral>33</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c57_exp</ParentId>
<Position><Start><IntLiteral>28</IntLiteral>
<IntLiteral>36</IntLiteral>
</Start>
<End><IntLiteral>28</IntLiteral>
<IntLiteral>39</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IIntExp"><IntLiteral>881</IntLiteral>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>29</IntLiteral>
<IntLiteral>9</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>62</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>total_footprint</Id>
<UniqueId>c58_total_footprint</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>29</IntLiteral>
<IntLiteral>27</IntLiteral>
</Start>
<End><IntLiteral>29</IntLiteral>
<IntLiteral>34</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>integer</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>1</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</GlobalCard>
<Declaration xsi:type="cl:IConstraint"><IsHard>true</IsHard>
<ParentExp><Type xsi:type="cl:IBoolean" /><ParentId>c59_exp</ParentId>
<Position><Start><IntLiteral>30</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>62</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>=</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c60_exp</ParentId>
<Position><Start><IntLiteral>30</IntLiteral>
<IntLiteral>19</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>34</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>this</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c61_exp</ParentId>
<Position><Start><IntLiteral>30</IntLiteral>
<IntLiteral>37</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>62</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>sum</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c62_exp</ParentId>
<Position><Start><IntLiteral>30</IntLiteral>
<IntLiteral>41</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>62</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c63_exp</ParentId>
<Position><Start><IntLiteral>30</IntLiteral>
<IntLiteral>41</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>52</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c1_IMeasurable</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c64_exp</ParentId>
<Position><Start><IntLiteral>30</IntLiteral>
<IntLiteral>53</IntLiteral>
</Start>
<End><IntLiteral>30</IntLiteral>
<IntLiteral>62</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c2_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Declaration></Declaration><Declaration xsi:type="cl:IClafer"><Position><Start><IntLiteral>32</IntLiteral>
<IntLiteral>1</IntLiteral>
</Start>
<End><IntLiteral>32</IntLiteral>
<IntLiteral>27</IntLiteral>
</End>
</Position>
<IsAbstract>false</IsAbstract>
<GroupCard><IsKeyword>false</IsKeyword>
<Interval><Min><IntLiteral>0</IntLiteral>
</Min>
<Max><IntLiteral>-1</IntLiteral>
</Max>
</Interval>
</GroupCard>
<Id>simpleConfig</Id>
<UniqueId>c65_simpleConfig</UniqueId>
<Supers><IsOverlapping>false</IsOverlapping>
<Super><Type xsi:type="cl:ISet" /><ParentId></ParentId>
<Position><Start><IntLiteral>32</IntLiteral>
<IntLiteral>16</IntLiteral>
</Start>
<End><IntLiteral>32</IntLiteral>
<IntLiteral>27</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c3_BerkeleyDbC</Id>
<IsTop>true</IsTop>
</Exp></Super>
</Supers>
<Card><Min><IntLiteral>1</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</Card>
<GlobalCard><Min><IntLiteral>1</IntLiteral>
</Min>
<Max><IntLiteral>1</IntLiteral>
</Max>
</GlobalCard>
</Declaration><Declaration xsi:type="cl:IGoal"><IsMaximize>true</IsMaximize>
<ParentExp><Type xsi:type="cl:IInteger" /><ParentId>c66_exp</ParentId>
<Position><Start><IntLiteral>35</IntLiteral>
<IntLiteral>4</IntLiteral>
</Start>
<End><IntLiteral>35</IntLiteral>
<IntLiteral>36</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>min</Operation>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c67_exp</ParentId>
<Position><Start><IntLiteral>35</IntLiteral>
<IntLiteral>8</IntLiteral>
</Start>
<End><IntLiteral>35</IntLiteral>
<IntLiteral>36</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IFunctionExp"><Operation>.</Operation>
<Argument><Type xsi:type="cl:ISet" /><ParentId>c68_exp</ParentId>
<Position><Start><IntLiteral>35</IntLiteral>
<IntLiteral>8</IntLiteral>
</Start>
<End><IntLiteral>35</IntLiteral>
<IntLiteral>20</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c65_simpleConfig</Id>
<IsTop>true</IsTop>
</Exp></Argument>
<Argument><Type xsi:type="cl:IInteger" /><ParentId>c69_exp</ParentId>
<Position><Start><IntLiteral>35</IntLiteral>
<IntLiteral>21</IntLiteral>
</Start>
<End><IntLiteral>35</IntLiteral>
<IntLiteral>36</IntLiteral>
</End>
</Position>
<Exp xsi:type="cl:IClaferId"><ModuleName></ModuleName>
<Id>c58_total_footprint</Id>
<IsTop>false</IsTop>
</Exp></Argument>
</Exp></Argument>
</Exp></ParentExp>
</Declaration></Module>


text:
require 'spec_helper'

RSpec.describe SystemNoteService do
  include Gitlab::Routing
  include RepoHelpers
  include AssetsHelpers
  include DesignManagementTestHelpers

  let_it_be(:group)    { create(:group) }
  let_it_be(:project)  { create(:project, :repository, group: group) }
  let_it_be(:author)   { create(:user) }
  let(:noteable) { create(:issue, project: project) }
  let(:issue)    { noteable }

  describe '.add_commits' do
    let(:new_commits) { double }
    let(:old_commits) { double }
    let(:oldrev)      { double }

    it 'calls CommitService' do
      expect_next_instance_of(::SystemNotes::CommitService) do |service|
        expect(service).to receive(:add_commits).with(new_commits, old_commits, oldrev)
      end

      described_class.add_commits(noteable, project, author, new_commits, old_commits, oldrev)
    end
  end

  describe '.tag_commit' do
    let(:tag_name) { double }

    it 'calls CommitService' do
      expect_next_instance_of(::SystemNotes::CommitService) do |service|
        expect(service).to receive(:tag_commit).with(tag_name)
      end

      described_class.tag_commit(noteable, project, author, tag_name)
    end
  end

  describe '.change_assignee' do
    let(:assignee) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_assignee).with(assignee)
      end

      described_class.change_assignee(noteable, project, author, assignee)
    end
  end

  describe '.change_issuable_assignees' do
    let(:assignees) { [double, double] }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_issuable_assignees).with(assignees)
      end

      described_class.change_issuable_assignees(noteable, project, author, assignees)
    end
  end

  describe '.close_after_error_tracking_resolve' do
    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:close_after_error_tracking_resolve)
      end

      described_class.close_after_error_tracking_resolve(noteable, project, author)
    end
  end

  describe '.change_milestone' do
    let(:milestone) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_milestone).with(milestone)
      end

      described_class.change_milestone(noteable, project, author, milestone)
    end
  end

  describe '.relate_issue' do
    let(:noteable_ref) { double }
    let(:noteable) { double }

    before do
      allow(noteable).to receive(:project).and_return(double)
    end

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:relate_issue).with(noteable_ref)
      end

      described_class.relate_issue(noteable, noteable_ref, double)
    end
  end

  describe '.unrelate_issue' do
    let(:noteable_ref) { double }
    let(:noteable) { double }

    before do
      allow(noteable).to receive(:project).and_return(double)
    end

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:unrelate_issue).with(noteable_ref)
      end

      described_class.unrelate_issue(noteable, noteable_ref, double)
    end
  end

  describe '.change_due_date' do
    let(:due_date) { double }

    it 'calls TimeTrackingService' do
      expect_next_instance_of(::SystemNotes::TimeTrackingService) do |service|
        expect(service).to receive(:change_due_date).with(due_date)
      end

      described_class.change_due_date(noteable, project, author, due_date)
    end
  end

  describe '.change_status' do
    let(:status) { double }
    let(:source) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_status).with(status, source)
      end

      described_class.change_status(noteable, project, author, status, source)
    end
  end

  describe '.merge_when_pipeline_succeeds' do
    it 'calls MergeRequestsService' do
      sha = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:merge_when_pipeline_succeeds).with(sha)
      end

      described_class.merge_when_pipeline_succeeds(noteable, project, author, sha)
    end
  end

  describe '.cancel_merge_when_pipeline_succeeds' do
    it 'calls MergeRequestsService' do
      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:cancel_merge_when_pipeline_succeeds)
      end

      described_class.cancel_merge_when_pipeline_succeeds(noteable, project, author)
    end
  end

  describe '.abort_merge_when_pipeline_succeeds' do
    it 'calls MergeRequestsService' do
      reason = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:abort_merge_when_pipeline_succeeds).with(reason)
      end

      described_class.abort_merge_when_pipeline_succeeds(noteable, project, author, reason)
    end
  end

  describe '.change_title' do
    let(:title) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_title).with(title)
      end

      described_class.change_title(noteable, project, author, title)
    end
  end

  describe '.change_description' do
    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_description)
      end

      described_class.change_description(noteable, project, author)
    end
  end

  describe '.change_issue_confidentiality' do
    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_issue_confidentiality)
      end

      described_class.change_issue_confidentiality(noteable, project, author)
    end
  end

  describe '.change_branch' do
    it 'calls MergeRequestsService' do
      old_branch = double
      new_branch = double
      branch_type = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:change_branch).with(branch_type, old_branch, new_branch)
      end

      described_class.change_branch(noteable, project, author, branch_type, old_branch, new_branch)
    end
  end

  describe '.change_branch_presence' do
    it 'calls MergeRequestsService' do
      presence = double
      branch = double
      branch_type = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:change_branch_presence).with(branch_type, branch, presence)
      end

      described_class.change_branch_presence(noteable, project, author, branch_type, branch, presence)
    end
  end

  describe '.new_issue_branch' do
    it 'calls MergeRequestsService' do
      branch = double
      branch_project = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:new_issue_branch).with(branch, branch_project: branch_project)
      end

      described_class.new_issue_branch(noteable, project, author, branch, branch_project: branch_project)
    end
  end

  describe '.new_merge_request' do
    it 'calls MergeRequestsService' do
      merge_request = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:new_merge_request).with(merge_request)
      end

      described_class.new_merge_request(noteable, project, author, merge_request)
    end
  end

  describe '.zoom_link_added' do
    it 'calls ZoomService' do
      expect_next_instance_of(::SystemNotes::ZoomService) do |service|
        expect(service).to receive(:zoom_link_added)
      end

      described_class.zoom_link_added(noteable, project, author)
    end
  end

  describe '.zoom_link_removed' do
    it 'calls ZoomService' do
      expect_next_instance_of(::SystemNotes::ZoomService) do |service|
        expect(service).to receive(:zoom_link_removed)
      end

      described_class.zoom_link_removed(noteable, project, author)
    end
  end

  describe '.cross_reference' do
    let(:mentioner) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:cross_reference).with(mentioner)
      end

      described_class.cross_reference(double, mentioner, double)
    end
  end

  describe '.cross_reference_disallowed?' do
    let(:mentioner) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:cross_reference_disallowed?).with(mentioner)
      end

      described_class.cross_reference_disallowed?(double, mentioner)
    end
  end

  describe '.cross_reference_exists?' do
    let(:mentioner) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:cross_reference_exists?).with(mentioner)
      end

      described_class.cross_reference_exists?(double, mentioner)
    end
  end

  describe '.noteable_moved' do
    let(:noteable_ref) { double }
    let(:direction) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:noteable_moved).with(noteable_ref, direction)
      end

      described_class.noteable_moved(double, double, noteable_ref, double, direction: direction)
    end
  end

  describe 'Jira integration' do
    include JiraServiceHelper

    let(:project)         { create(:jira_project, :repository) }
    let(:author)          { create(:user) }
    let(:issue)           { create(:issue, project: project) }
    let(:merge_request)   { create(:merge_request, :simple, target_project: project, source_project: project) }
    let(:jira_issue)      { ExternalIssue.new("JIRA-1", project)}
    let(:jira_tracker)    { project.jira_service }
    let(:commit)          { project.commit }
    let(:comment_url)     { jira_api_comment_url(jira_issue.id) }
    let(:success_message) { "SUCCESS: Successfully posted to http://jira.example.net." }

    before do
      stub_jira_urls(jira_issue.id)
      jira_service_settings
    end

    def cross_reference(type, link_exists = false)
      noteable = type == 'commit' ? commit : merge_request

      links = []
      if link_exists
        url = if type == 'commit'
                "#{Settings.gitlab.base_url}/#{project.namespace.path}/#{project.path}/-/commit/#{commit.id}"
              else
                "#{Settings.gitlab.base_url}/#{project.namespace.path}/#{project.path}/-/merge_requests/#{merge_request.iid}"
              end

        link = double(object: { 'url' => url })
        links << link
        expect(link).to receive(:save!)
      end

      allow(JIRA::Resource::Remotelink).to receive(:all).and_return(links)

      described_class.cross_reference(jira_issue, noteable, author)
    end

    noteable_types = %w(merge_requests commit)

    noteable_types.each do |type|
      context "when noteable is a #{type}" do
        it "blocks cross reference when #{type.underscore}_events is false" do
          jira_tracker.update("#{type}_events" => false)

          expect(cross_reference(type)).to eq(s_('JiraService|Events for %{noteable_model_name} are disabled.') % { noteable_model_name: type.pluralize.humanize.downcase })
        end

        it "creates cross reference when #{type.underscore}_events is true" do
          jira_tracker.update("#{type}_events" => true)

          expect(cross_reference(type)).to eq(success_message)
        end
      end

      context 'when a new cross reference is created' do
        it 'creates a new comment and remote link' do
          cross_reference(type)

          expect(WebMock).to have_requested(:post, jira_api_comment_url(jira_issue))
          expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue))
        end
      end

      context 'when a link exists' do
        it 'updates a link but does not create a new comment' do
          expect(WebMock).not_to have_requested(:post, jira_api_comment_url(jira_issue))

          cross_reference(type, true)
        end
      end
    end

    describe "new reference" do
      let(:favicon_path) { "http://localhost/assets/#{find_asset('favicon.png').digest_path}" }

      before do
        allow(JIRA::Resource::Remotelink).to receive(:all).and_return([])
      end

      context 'for commits' do
        it "creates comment" do
          result = described_class.cross_reference(jira_issue, commit, author)

          expect(result).to eq(success_message)
        end

        it "creates remote link" do
          described_class.cross_reference(jira_issue, commit, author)

          expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with(
            body: hash_including(
              GlobalID: "GitLab",
              relationship: 'mentioned on',
              object: {
                url: project_commit_url(project, commit),
                title: "Commit - #{commit.title}",
                icon: { title: "GitLab", url16x16: favicon_path },
                status: { resolved: false }
              }
            )
          ).once
        end
      end

      context 'for issues' do
        let(:issue) { create(:issue, project: project) }

        it "creates comment" do
          result = described_class.cross_reference(jira_issue, issue, author)

          expect(result).to eq(success_message)
        end

        it "creates remote link" do
          described_class.cross_reference(jira_issue, issue, author)

          expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with(
            body: hash_including(
              GlobalID: "GitLab",
              relationship: 'mentioned on',
              object: {
                url: project_issue_url(project, issue),
                title: "Issue - #{issue.title}",
                icon: { title: "GitLab", url16x16: favicon_path },
                status: { resolved: false }
              }
            )
          ).once
        end
      end

      context 'for snippets' do
        let(:snippet) { create(:snippet, project: project) }

        it "creates comment" do
          result = described_class.cross_reference(jira_issue, snippet, author)

          expect(result).to eq(success_message)
        end

        it "creates remote link" do
          described_class.cross_reference(jira_issue, snippet, author)

          expect(WebMock).to have_requested(:post, jira_api_remote_link_url(jira_issue)).with(
            body: hash_including(
              GlobalID: "GitLab",
              relationship: 'mentioned on',
              object: {
                url: project_snippet_url(project, snippet),
                title: "Snippet - #{snippet.title}",
                icon: { title: "GitLab", url16x16: favicon_path },
                status: { resolved: false }
              }
            )
          ).once
        end
      end
    end

    describe "existing reference" do
      before do
        allow(JIRA::Resource::Remotelink).to receive(:all).and_return([])
        message = double('message')
        allow(message).to receive(:include?) { true }
        allow_next_instance_of(JIRA::Resource::Issue) do |instance|
          allow(instance).to receive(:comments).and_return([OpenStruct.new(body: message)])
        end
      end

      it "does not return success message" do
        result = described_class.cross_reference(jira_issue, commit, author)

        expect(result).not_to eq(success_message)
      end

      it 'does not try to create comment and remote link' do
        subject

        expect(WebMock).not_to have_requested(:post, jira_api_comment_url(jira_issue))
        expect(WebMock).not_to have_requested(:post, jira_api_remote_link_url(jira_issue))
      end
    end
  end

  describe '.change_time_estimate' do
    it 'calls TimeTrackingService' do
      expect_next_instance_of(::SystemNotes::TimeTrackingService) do |service|
        expect(service).to receive(:change_time_estimate)
      end

      described_class.change_time_estimate(noteable, project, author)
    end
  end

  describe '.discussion_continued_in_issue' do
    let(:discussion) { create(:diff_note_on_merge_request, project: project).to_discussion }
    let(:merge_request) { discussion.noteable }
    let(:issue) { create(:issue, project: project) }

    def reloaded_merge_request
      MergeRequest.find(merge_request.id)
    end

    subject { described_class.discussion_continued_in_issue(discussion, project, author, issue) }

    it_behaves_like 'a system note' do
      let(:expected_noteable) { discussion.first_note.noteable }
      let(:action)              { 'discussion' }
    end

    it 'creates a new note in the discussion' do
      # we need to completely rebuild the merge request object, or the `@discussions` on the merge request are not reloaded.
      expect { subject }.to change { reloaded_merge_request.discussions.first.notes.size }.by(1)
    end

    it 'mentions the created issue in the system note' do
      expect(subject.note).to include(issue.to_reference)
    end
  end

  describe '.change_time_spent' do
    it 'calls TimeTrackingService' do
      expect_next_instance_of(::SystemNotes::TimeTrackingService) do |service|
        expect(service).to receive(:change_time_spent)
      end

      described_class.change_time_spent(noteable, project, author)
    end
  end

  describe '.handle_merge_request_wip' do
    it 'calls MergeRequestsService' do
      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:handle_merge_request_wip)
      end

      described_class.handle_merge_request_wip(noteable, project, author)
    end
  end

  describe '.add_merge_request_wip_from_commit' do
    it 'calls MergeRequestsService' do
      commit = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:add_merge_request_wip_from_commit).with(commit)
      end

      described_class.add_merge_request_wip_from_commit(noteable, project, author, commit)
    end
  end

  describe '.change_task_status' do
    let(:new_task) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:change_task_status).with(new_task)
      end

      described_class.change_task_status(noteable, project, author, new_task)
    end
  end

  describe '.resolve_all_discussions' do
    it 'calls MergeRequestsService' do
      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:resolve_all_discussions)
      end

      described_class.resolve_all_discussions(noteable, project, author)
    end
  end

  describe '.diff_discussion_outdated' do
    it 'calls MergeRequestsService' do
      discussion = double
      change_position = double

      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:diff_discussion_outdated).with(discussion, change_position)
      end

      described_class.diff_discussion_outdated(discussion, project, author, change_position)
    end
  end

  describe '.mark_duplicate_issue' do
    let(:canonical_issue) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:mark_duplicate_issue).with(canonical_issue)
      end

      described_class.mark_duplicate_issue(noteable, project, author, canonical_issue)
    end
  end

  describe '.mark_canonical_issue_of_duplicate' do
    let(:duplicate_issue) { double }

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:mark_canonical_issue_of_duplicate).with(duplicate_issue)
      end

      described_class.mark_canonical_issue_of_duplicate(noteable, project, author, duplicate_issue)
    end
  end

  describe '.discussion_lock' do
    let(:issuable) { double }

    before do
      allow(issuable).to receive(:project).and_return(double)
    end

    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:discussion_lock)
      end

      described_class.discussion_lock(issuable, double)
    end
  end

  describe '.auto_resolve_prometheus_alert' do
    it 'calls IssuableService' do
      expect_next_instance_of(::SystemNotes::IssuablesService) do |service|
        expect(service).to receive(:auto_resolve_prometheus_alert)
      end

      described_class.auto_resolve_prometheus_alert(noteable, project, author)
    end
  end

  describe '.design_version_added' do
    let(:version) { create(:design_version) }

    it 'calls DesignManagementService' do
      expect_next_instance_of(SystemNotes::DesignManagementService) do |service|
        expect(service).to receive(:design_version_added).with(version)
      end

      described_class.design_version_added(version)
    end
  end

  describe '.design_discussion_added' do
    let(:discussion_note) { create(:diff_note_on_design) }

    it 'calls DesignManagementService' do
      expect_next_instance_of(SystemNotes::DesignManagementService) do |service|
        expect(service).to receive(:design_discussion_added).with(discussion_note)
      end

      described_class.design_discussion_added(discussion_note)
    end
  end

  describe '.approve_mr' do
    it 'calls MergeRequestsService' do
      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:approve_mr)
      end

      described_class.approve_mr(noteable, author)
    end
  end

  describe '.unapprove_mr' do
    it 'calls MergeRequestsService' do
      expect_next_instance_of(::SystemNotes::MergeRequestsService) do |service|
        expect(service).to receive(:unapprove_mr)
      end

      described_class.unapprove_mr(noteable, author)
    end
  end

  describe '.change_alert_status' do
    let(:alert) { build(:alert_management_alert) }

    it 'calls AlertManagementService' do
      expect_next_instance_of(SystemNotes::AlertManagementService) do |service|
        expect(service).to receive(:change_alert_status).with(alert)
      end

      described_class.change_alert_status(alert, author)
    end
  end

  describe '.new_alert_issue' do
    let(:alert) { build(:alert_management_alert, :with_issue) }

    it 'calls AlertManagementService' do
      expect_next_instance_of(SystemNotes::AlertManagementService) do |service|
        expect(service).to receive(:new_alert_issue).with(alert.issue)
      end

      described_class.new_alert_issue(alert, alert.issue, author)
    end
  end
end


text:
FROM fedora:25 as builder

# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#sort-multi-line-arguments
RUN dnf install -y \
    autoconf \
    automake \
    boost-devel \
    cmake \
    dnf-plugins-core \
    file \
    gcc \
    gcc-c++ \
    git-core \
    hostname \
    libtool \
    mariadb-devel-3:10.1.26-2.fc25.x86_64 \
    mariadb-server-3:10.1.26-2.fc25.x86_64 \
    rpm-build

RUN	dnf builddep -y \
    mariadb

RUN         useradd builder -u 1000 -m -G users,wheel && \
            mkdir /home/builder/rpm && \
            chown -R builder /home/builder

COPY        --chown=builder:root ./docker/.rpmmacros /home/builder/.rpmmacros
COPY        --chown=root:root ./docker/sudoers /etc/sudoers

USER		builder
WORKDIR		/home/builder

RUN			dnf download --source mariadb-10.1.26-2.fc25.src
RUN			rpm -i mariadb*.rpm

WORKDIR		/home/builder/rpm
RUN			rpmbuild --nocheck -bi mariadb.spec

USER 		root
WORKDIR		/root

# TODO: Create v1.0.0 release and use it instead
RUN git clone --branch master --single-branch --depth 1 https://github.com/anton-povarov/meow /_src/meow
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#using-pipes
# TODO: Set SHELL instead
RUN set -o pipefail && curl -L https://github.com/nanomsg/nanomsg/archive/1.1.5.tar.gz | tar xvz -C /tmp && mv -v /tmp/nanomsg-1.1.5 /_src/nanomsg
RUN set -o pipefail && curl -L https://github.com/lz4/lz4/archive/v1.9.1.tar.gz | tar xvz -C /tmp && mv -v /tmp/lz4-1.9.1 /_src/lz4
COPY . /_src/pinba2
RUN /_src/pinba2/docker/build-from-source.sh

FROM fedora:25
MAINTAINER Anton Povarov "anton.povarov@gmail.com"

RUN dnf install -y \
    file \
    hostname \
    jemalloc \
    mariadb-server-3:10.1.26-2.fc25.x86_64

COPY --from=builder /_src/pinba2/mysql_engine/.libs/libpinba_engine2.so /usr/lib64/mysql/plugin/libpinba_engine2.so
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
# TODO: Add bats based health check for exposed ports
EXPOSE 3002/udp
EXPOSE 3306/tcp
CMD ["mysqld"]


text:
<?php

namespace Application\Model\Entity;

use DateTime;
use Doctrine\ORM\Mapping as ORM;

/**
 * Nome: KleoEntity.php
 * @author Leonardo Pereira Magalhães <falecomleonardopereira@gmail.com>
 * Descricao: Entidade anotada base
 */

class KleoEntity {

    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer")
     */
    protected $id;
    /** @ORM\Column(type="datetime", name="data_criacao") */
    protected $data_criacao;
    /** @ORM\Column(type="string") */
    protected $hora_criacao;
    /** @ORM\Column(type="datetime", name="data_inativacao") */
    protected $data_inativacao;
    /** @ORM\Column(type="string") */
    protected $hora_inativacao;
    /**
     * Seta data e hora de criação
     */
    function setDataEHoraDeCriacao() {
        $timeNow = new DateTime();
        $this->setData_criacao($timeNow);
        $this->setHora_criacao($timeNow->format('H:s:i'));
    }
    /**
     * Verificar se a data de inativação está nula
     * @return boolean
     */
    public function verificarSeEstaAtivo() {
        $resposta = false;
        if (is_null($this->getData_inativacao())) {
            $resposta = true;
        }
        return $resposta;
    }

   /**
     * Seta data e hora de inativação
     */
    function setDataEHoraDeInativacao() {
        $timeNow = new DateTime();
        $this->setData_inativacao($timeNow);
        $this->setHora_inativacao($timeNow->format('H:s:i'));
    }

   /**
     * Gera um token com data e hora atual em md5
     * @return String
     */
    function gerarToken() {
        $timeNow = new DateTime();
        $data = $timeNow->format('Ymd');
        $hora = $timeNow->format('His');
        $token = md5($dataEnvio . $hora);
        return $token;
    }

    function getId() {
        return $this->id;
    }
    function getData_criacao() {
        return $this->data_criacao;
    }
    function getData_criacaoFormatada() {
        return $this->data_criacao->format('d/m/Y');
    }
    function getHora_criacao() {
        return $this->hora_criacao;
    }
    function getData_inativacao() {
        return $this->data_inativacao;
    }
    function getHora_inativacao() {
        return $this->hora_inativacao;
    }
    function setId($id) {
        $this->id = $id;
    }
    function setData_criacao($data_criacao) {
        $this->data_criacao = $data_criacao;
    }
    function setHora_criacao($hora_criacao) {
        $this->hora_criacao = $hora_criacao;
    }
    function setData_inativacao($data_inativacao) {
        $this->data_inativacao = $data_inativacao;
    }
    function setHora_inativacao($hora_inativacao) {
        $this->hora_inativacao = $hora_inativacao;
    }
}


text:
package org.elasticsearch.client.watcher.hlrc;

import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;

import java.io.IOException;

import static org.hamcrest.Matchers.equalTo;

public class ExecuteWatchResponseTests extends AbstractResponseTestCase<
    ExecuteWatchResponse, org.elasticsearch.client.watcher.ExecuteWatchResponse> {

    @Override
    protected ExecuteWatchResponse createServerTestInstance(XContentType xContentType) {
        String id = "my_watch_0-2015-06-02T23:17:55.124Z";
        try {
            XContentBuilder builder = XContentFactory.jsonBuilder();
            builder.startObject();
            builder.field("watch_id", "my_watch");
            builder.field("node", "my_node");
            builder.startArray("messages");
            builder.endArray();
            builder.startObject("trigger_event");
            builder.field("type", "manual");
            builder.endObject();
            builder.field("state", "executed");
            builder.endObject();
            BytesReference bytes = BytesReference.bytes(builder);
            return new ExecuteWatchResponse(id, bytes, XContentType.JSON);
        }
        catch (IOException e) {
            throw new AssertionError(e);
        }
    }

    @Override
    protected org.elasticsearch.client.watcher.ExecuteWatchResponse doParseToClientInstance(XContentParser parser) throws IOException {
        return org.elasticsearch.client.watcher.ExecuteWatchResponse.fromXContent(parser);
    }

    @Override
    protected void assertInstances(ExecuteWatchResponse serverTestInstance,
                                   org.elasticsearch.client.watcher.ExecuteWatchResponse clientInstance) {
        assertThat(clientInstance.getRecordId(), equalTo(serverTestInstance.getRecordId()));
        assertThat(clientInstance.getRecordAsMap(), equalTo(serverTestInstance.getRecordSource().getAsMap()));
    }
}


text:
<!DOCTYPE html>

  <title>Ivy Vetor</title>
  <link rel="stylesheet" type="text/css" href="../stylesheets/default.css">
  <link rel="stylesheet" type="text/css" href="../stylesheets/blog.css">

Ivy's Blog about DBC

And how she survives it

About

Home

Projects

Contact

End of Week 3

January, 18, 2016

So what *is* the difference between margin, border, and padding?  Think of a square on a piece of paper.  A very stretcy square... Lets say the square is NORMALLY a 4 X 4.  Then someone comes around and decides to stretch to square and make it a 6 x 6. The square looks bigger now but its contents are still the same.  That's padding!

  As for the border, it is just the outline of the square.  You can make the outline solid or dashed or double lined.  The outline can also be made thicker or thinner.

  Now lets say the square is sick of not having any privacy so now it wants space.  Specifically, it wants nobody to get any closer than 20px. In CSS, this would be "margin: 20px 20px 20px 20px;", which goes top, right, bottom, left of the square, respectively.  For example, "margin: 25px 50px 100px 75px;" means the square will have a space of 25px on top, 50px on the right, 100px on the bottom, and 75px on the left.

  If only one side needs margin space, it can be specified by using "margin-right: 20px;", "margin-bottom: 20px;", and so on.

  Now... the important thing is to remember is that the square is a representation of a piece of content.  If you add padding to a paragraph section, you are adding space 'inside' the paragraph and giving the text more room.  Adding a border around the paragraph will help you see where the padding ends and the margin begins.  Adding margin means adding space 'outside' the paragraph and gives the paragraph section clearance from other contents on the page.

  I hope my analogy helps so please let me know if I can do anything to improve.

Previous Post

Next Post

 Ⓒ 2016 Ivy Vetor


text:
using System.Reflection;

public static partial class Extensions
{
    /// <summary>
    ///     A T extension method that shallow copy.
    /// </summary>
    /// <typeparam name="T">Generic type parameter.</typeparam>
    /// <param name="this">The @this to act on.</param>
    /// <returns>A T.</returns>
    public static T ShallowCopy<T>(this T @this)
    {
        MethodInfo method = @this.GetType().GetMethod("MemberwiseClone", BindingFlags.NonPublic | BindingFlags.Instance);
        return (T) method.Invoke(@this, null);
    }
}


text:
package main

import (
	"fmt"
	"os"
	"math"
	"github.com/go-gl/gl"
	"github.com/go-gl/glfw"
	"github.com/go-gl/mathgl/mgl64"
)

func main() {
	var err error
	if err = glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	// Ensure glfw is cleanly terminated on exit.
	defer glfw.Terminate()

	if err = glfw.OpenWindow(640, 640, 8, 8, 8, 0, 0, 0, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	// Ensure window is cleanly closed on exit.
	defer glfw.CloseWindow()

	// Enable vertical sync on cards that support it.
	glfw.SetSwapInterval(1)

	// Set window title
	glfw.SetWindowTitle("Simple GLFW window")

	// Hook some events to demonstrate use of callbacks.
	// These are not necessary if you don't need them.
	glfw.SetWindowSizeCallback(onResize)
	glfw.SetWindowCloseCallback(onClose)
	glfw.SetMouseButtonCallback(onMouseBtn)
	glfw.SetMouseWheelCallback(onMouseWheel)
	glfw.SetKeyCallback(onKey)
	glfw.SetCharCallback(onChar)

	inits()
	// Start loop
	running := true
	var time Time
	for running {
		time.Set(glfw.Time())
		handleInputs()
		physics(time)
		render()

		// Swap front and back rendering buffers. This also implicitly calls
		// glfw.PollEvents(), so we have valid key/mouse/joystick states after
		// this. This behavior can be disabled by calling glfw.Disable with the
		// argument glfw.AutoPollEvents. You must be sure to manually call
		// PollEvents() or WaitEvents() in this case.
		glfw.SwapBuffers()

		// Break out of loop when Escape key is pressed, or window is closed.
		running = glfw.Key(glfw.KeyEsc) == 0 && glfw.WindowParam(glfw.Opened) == 1
	}
}

func onResize(w, h int) {
	fmt.Printf("resized: %dx%d\n", w, h)
	gl.Viewport(0, 0, w, h)
	camera.Aspect = float64(w)/float64(h)
}

func onClose() int {
	fmt.Println("closed")
	return 1 // return 0 to keep window open.
}

func onMouseBtn(button, state int) {
	//fmt.Printf("mouse button: %d, %d\n", button, state)
}

func onMouseWheel(delta int) {
	//fmt.Printf("mouse wheel: %d\n", delta)
}

var keys [1024]bool

func onKey(key, state int) {
	keys[key] = state == 1;
	//fmt.Printf("key: %d, %d\n", key, state)
}

func onChar(key, state int) {
	//fmt.Printf("char: %d, %d\n", key, state)
}

var terrain *Terrain
var camera Camera
var ball *Ball

func inits() {
	ball = NewBall(.1,.1,.7)
	ball.Pos = mgl64.Vec3{1,2,1}
	terrain = CreateTerrain(mgl64.Vec3{.2,1,.2}, 65)
	//terrain = ReadTerrain(mgl64.Vec3{1,-1,1})

	gl.ShadeModel(gl.SMOOTH)
	gl.ClearColor(.52, .81, .98, 0)
	gl.ClearDepth(-1)
	gl.DepthMask(true)
	gl.Enable(gl.DEPTH_TEST)
	gl.DepthFunc(gl.LEQUAL)
	//gl.DepthRangef(0,1)
	gl.Disable(gl.BLEND)
	//gl.Enable(gl.BLEND);
	//gl.BlendFunc(gl.ONE, gl.ZERO);
	gl.Hint(gl.PERSPECTIVE_CORRECTION_HINT, gl.NICEST)

	gl.Enable(gl.LIGHTING)
	gl.Enable(gl.LIGHT0)
	setLights()
}

var camYaw float64 = 4.5
var camPitch float64 = .5
const gravity float64 = -0.00982

func handleInputs() {
	if keys['W'] {camPitch += .01}
	if keys['A'] {camYaw += .01}
	if keys['S'] {camPitch -= .01}
	if keys['D'] {camYaw -= .01}

	if keys['U'] {ball.Velocity[0] += .01}
	if keys['H'] {ball.Velocity[2] -= .01}
	if keys['J'] {ball.Velocity[0] -= .01}
	if keys['K'] {ball.Velocity[2] += .01}

	if keys['R'] {ball.Pos = mgl64.Vec3{5,2,5}}
	terrain.DrawAsSurface = !keys['L']

	camera.Pos[1] = math.Sin(camPitch)*3
	camera.Pos[0] = math.Cos(camPitch)*math.Cos(camYaw)*3
	camera.Pos[2] = math.Cos(camPitch)*math.Sin(camYaw)*3

	camera.Pos = camera.Pos.Add(ball.Pos)
}

func physics(time Time) {
	ball.Velocity[1] += gravity*time.Delta;
	ball.Pos = ball.Pos.Add(ball.Velocity)

	for y := -ball.Radius; y < ball.Radius; y += ball.Radius/5 {
		for x := -ball.Radius; x < ball.Radius; x += ball.Radius/5 {
			tri := terrain.GetTriangleUnder(ball.Pos.Add(mgl64.Vec3{x,0,y}))
			if tri[0].X() != math.NaN() && tri.Distance(ball.Pos) < ball.Radius {
				bounce := VectorProjection(ball.Velocity, tri.Normal())
				ball.Velocity = ball.Velocity.Sub(bounce.Mul(1+ball.Bounciness))
				posPassThrough := VectorProjection(ball.Pos.Sub(tri[0]), tri.Normal())
				bottomPassThrough := posPassThrough.Sub(tri.Normal().Mul(ball.Radius))
				ball.Pos = ball.Pos.Sub(bottomPassThrough.Mul(1+ball.Bounciness))
				//return
			}
		}
	}
}

func render() {
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	camera.SetupCameraLook()
	terrain.Draw()
	ball.Draw()
}

func setLights() {
	whiteSpecularLight := []float32{ 1,1,1 }
	blackAmbientLight := []float32{ 0,0,0 }
	whiteDiffuseLight := []float32{ 1,1,1 }

	mat_specular := []float32{1.0, 1.0, 1.0}
	mat_shininess := []float32{ 125.0 }
	light_position := []float32{ 0.0, 10.0, 1 }

	gl.Lightfv(gl.LIGHT0, gl.SPECULAR, whiteSpecularLight);
	gl.Lightfv(gl.LIGHT0, gl.AMBIENT, blackAmbientLight);
	gl.Lightfv(gl.LIGHT0, gl.DIFFUSE, whiteDiffuseLight);
	gl.Lightfv(gl.LIGHT0, gl.POSITION, light_position)

	gl.Materialfv(gl.FRONT, gl.SPECULAR, mat_specular)
	gl.Materialfv(gl.FRONT, gl.SHININESS, mat_shininess)
}