code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
<div class="pure-g"> <div class="island3 pure-u-1 pure-u-lg-2-3"> <h3>Speed up your <strong>AngularJS</strong> development with a complete and scalable build system that scaffolds the project for you. Just focus on writing code and tests, <code>angular-kickstart</code> will take care of the rest.</h3> </div> <div class="island3 pure-u-1 pure-u-lg-1-3"> <a href="https://github.com/castle-dev/angular-kickstart/releases/latest" class="pure-button button-xlarge button-expanded"> Download </a> <a href="https://github.com/castle-dev/angular-kickstart/#readme" target="_blank" class="pure-button button-xlarge button-expanded pure-button-primary"> Docs on GitHub </a> </div> </div> <hr/> <div class="pure-g island"> <div class="pure-u-1 pure-u-lg-1-3 island"> <div class="text-center"> <img class="pure-img" src="assets/images/angular-logo.png"> </div> <h3>AngularJS</h3> <p>The best JavaScript framework out there will power up your awesome app. </p> </div> <div class="pure-u-1 pure-u-lg-1-3 island"> <div class="text-center"> <img class="pure-img" src="assets/images/gulp-logo.png"> </div> <h3>Gulpjs</h3> <p>A smart and scalable <a href="http://gulpjs.com" target="_blank">gulpjs</a> based build system will take care of your development and testing workflow, as well as the optimization process for production release. <a href ui-sref="root.getting-started">Read more...</a> </p> </div> <div class="pure-u-1 pure-u-lg-1-3 island"> <div class="text-center"> <img class="pure-img" src="assets/images/browserify-logo.png" style="padding: 30px 0px"> </div> <h3>Browserify</h3> <p><a href="http://browserify.org/" target="_blank">Browserify</a> allows you to require <a href="https://www.npmjs.com/" target="_blank">npm modules</a> in your client-side JavaScript.</p> </div> </div> <div class="pure-g island"> <div class="pure-u-1 pure-u-lg-1-3 island"> <h4>Sass + SMACSS</h4> <p><a href="http://sass-lang.com/" target="_blank">Sass</a> is the most mature, stable, and powerful professional grade CSS extension language. The project is structured following the <a href="http://smacss.com/" target="_blank">SMACSS</a> architecture. Write your CSS in a modular and scalable way, the build system will compile your <code>.scss</code> files into a single css files. It should be easy to integrate less, stylus or any other preprocessor if you prefer. <a href="http://purecss.io/" target="_blank">Pure</a> is the default CSS framework, by you can easily plug your own.</p> </div> <div class="pure-u-1 pure-u-lg-1-3 island"> <h4>Generators</h4> <p>angular-kickstart comes with three awesome generators–<code>gulp new:page</code>, <code>gulp new:component</code>, and <code>gulp new:service</code>–that puts new files where they're supposed to go and injects them into app.js and index.html so you can focus on the important stuff: your business logic.</p> </div> <div class="pure-u-1 pure-u-lg-1-3 island"> <h4>Keep Your Code Reusable</h4> <p>Every general purpose directive, service or filter, should be placed into the <code>common</code> directory, in this way you can copy and paste the directory into another project, require the module you need, and you are ready to go with your new project. </p> </div> </div> <div class="pure-g"> <div class="pure-u-1 pure-u-lg-1-3 island"> <h4>Unit testing</h4> <p>The build system comes with a special task for running tests by using <a href="http://karma-runner.github.io/" target="_blank">Karma Test Runner</a>. </p> </div> <div class="pure-u-1 pure-u-lg-1-3 island"> <h4>e2e testing</h4> <p>end-to-end testing support is provided by the build system. Tests can be executed using <a href="http://angular.github.io/protractor/" target="_blank">protractor</a>.</p> </div> <div class="pure-u-1 pure-u-lg-1-3 island"> <h4>Build for production with ease</h4> <p>Easily optimize css, js, and images files for production with <code>gulp build:dist</code>.</p> </div> </div>
castle-dev/angular-kickstart
client/src/app/home/home.tpl.html
HTML
mit
4,157
// Copyright (c) 2015 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. 'use strict'; var os = require('os'); // TODO use better implementation. This sometimes fails when you move around // and change wifi networks. function localIp() { var ifaces = os.networkInterfaces(); var keys = Object.keys(ifaces); for (var i = 0; i < keys.length; i++) { var iface = ifaces[keys[i]]; for (var j in iface) { if (iface[j].family === 'IPv4' && !iface[j].internal) { return iface[j].address; } } } } module.exports = localIp;
uber/hyperbahn
lib/local_ip.js
JavaScript
mit
1,647
using System.Reflection; using System.Web; using NUnit.Framework; namespace DavidLievrouw.Voter.Composition { [TestFixture] public class HttpRequestPhysicalRootPathResolverTests { HttpRuntimePhysicalRootPathResolver _sut; const string ApplicationPath = "c:\\test\\ApplicationPath"; [SetUp] public void SetUp() { InitHttpRuntimeWithApplicationPath(); _sut = new HttpRuntimePhysicalRootPathResolver(); } [Test] public void DeterminesRootPath_BasedOnRequestData() { var actual = _sut.ResolvePhysicalRootPath(); Assert.That(actual, Is.Not.Null); Assert.That(actual, Is.EqualTo(ApplicationPath)); } static void InitHttpRuntimeWithApplicationPath() { var field = typeof(HttpRuntime).GetField("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static); var appDomainAppPath = field.GetValue(null).GetType().GetField("_appDomainAppPath", BindingFlags.NonPublic | BindingFlags.Instance); appDomainAppPath.SetValue(field.GetValue(null), ApplicationPath); } } }
DavidLievrouw/Voter
src/Voter.Tests/Composition/HttpRequestPhysicalRootPathResolverTests.cs
C#
mit
1,053
RSpec.describe Review do it { should belong_to :user } it { should belong_to :restaurant} end
richmondwatkins/restaurantpicker
spec/model/review_spec.rb
Ruby
mit
98
#ifndef GOAL_EVALUATOR_HPP #define GOAL_EVALUATOR_HPP #include <memory> namespace agent { class Agent; namespace goal { ////////////////////////////////////////////////////////////////// // Name: Evaluator <<interface>> // Desc: Interface for "...Evaluator" classes ////////////////////////////////////////////////////////////////// class Evaluator { protected: std::weak_ptr<Agent> owner_; double biasForGoal_; public: Evaluator(std::weak_ptr<Agent> owner, double bias) : owner_(owner), biasForGoal_(bias) {} virtual ~Evaluator() {} // returns a score between 0 and 1 representing the desirability // of the strategy the concrete subclass represents virtual double calculateDesirability() = 0; // adds the goal to the owner_ virtual void setGoal() = 0; }; } // namespace goal } // namespace agent #endif
motxx/project_cyan
agent/goal/evaluator.hpp
C++
mit
939
package com.netease.nim.uikit.common.util.storage; public enum StorageType { TYPE_LOG(DirectoryName.LOG_DIRECTORY_NAME), TYPE_TEMP(DirectoryName.TEMP_DIRECTORY_NAME), TYPE_FILE(DirectoryName.FILE_DIRECTORY_NAME), TYPE_AUDIO(DirectoryName.AUDIO_DIRECTORY_NAME), TYPE_IMAGE(DirectoryName.IMAGE_DIRECTORY_NAME), TYPE_VIDEO(DirectoryName.VIDEO_DIRECTORY_NAME), TYPE_THUMB_IMAGE(DirectoryName.THUMB_DIRECTORY_NAME), TYPE_THUMB_VIDEO(DirectoryName.THUMB_DIRECTORY_NAME), ; private DirectoryName storageDirectoryName; private long storageMinSize; public String getStoragePath() { return storageDirectoryName.getPath(); } public long getStorageMinSize() { return storageMinSize; } StorageType(DirectoryName dirName) { this(dirName, StorageUtil.THRESHOLD_MIN_SPCAE); } StorageType(DirectoryName dirName, long storageMinSize) { this.storageDirectoryName = dirName; this.storageMinSize = storageMinSize; } enum DirectoryName { AUDIO_DIRECTORY_NAME("audio/"), DATA_DIRECTORY_NAME("data/"), FILE_DIRECTORY_NAME("file/"), LOG_DIRECTORY_NAME("log/"), TEMP_DIRECTORY_NAME("temp/"), IMAGE_DIRECTORY_NAME("image/"), THUMB_DIRECTORY_NAME("thumb/"), VIDEO_DIRECTORY_NAME("video/"), ; private String path; public String getPath() { return path; } private DirectoryName(String path) { this.path = path; } } }
leiming19877/nim_demo
uikit/src/com/netease/nim/uikit/common/util/storage/StorageType.java
Java
mit
1,602
export interface UserModel { id: number; login: string; money: number; registrationInstant: string; }
redboul/ponyracer-ng2
src/app/models/user.model.ts
TypeScript
mit
110
package com.tobe.excelutils.test; import java.util.List; import com.tobe.excelutils.ExcelRunner; import com.tobe.excelutils.SelectSQL; import com.tobe.excelutils.handler.BeanHandler; import com.tobe.excelutils.handler.BeanListHandler; public class TestExcelUtils { public static void main(String[] args) throws Exception { SelectSQL sql = new SelectSQL(); // sql.ignore("name").ignore("start"); // sql.select("singledesc"); sql.where("name", "单笔充值"); ExcelRunner runner = new ExcelRunner("/商业活动.xlsx"); ActivityVO vo = runner.query(sql, new BeanHandler<ActivityVO>(ActivityVO.class)); runner = new ExcelRunner("/商业活动.xlsx"); List<ActivityVO> query = runner.query(sql, new BeanListHandler<ActivityVO>(ActivityVO.class)); System.out.println(""); } }
qifanyang/tool
tool/src/main/java/com/tobe/excelutils/test/TestExcelUtils.java
Java
mit
815
</div><!-- span9 --> </div><!-- row fluid --> </div><!-- fluid container --> <hr> <footer> <p>SmartOS Previews</p> </footer> <script src="bootstrap/js/bootstrap.min.js"></script> </body> </html> <!-- vim: set syntax=html ts=8 sts=8 sw=8 noet: -->
rmustacc/preview-docs
assets/trailer.html
HTML
mit
268
<?php class JSRedirector { public static function analyze(string $html) { return false; // $html = str_replace("\n", "", $html); // $html = str_replace('"\r', "", $html); // // <script type='text/javascript' // if(preg_match("/<script type='text\/javascript' src='http:\/\/.{1,150}<\/body>/", $html, $match)) // { // $match = $match[0]; // $js_url = explode("'", explode("src='", $match)[1])[0]; // $js = Request::get($js_url); // if($js['status'] >= 200 && $js['status'] < 400) // { // $js = $js['body']; // // document.write('<script src="http://www.example.com/m84MRmlBh.js"><\x2fscript>'); // $js = str_replace("\n", "", $js); // $js = str_replace('"\r', "", $js); // if(preg_match("/document\.write\('<script src=\"http:\/\/.{1,100}\">/", $js)) // { // return ['is_malicious' => true, 'js' => $js_url, 'content' => $js]; // } // } // } // return ['is_malicious' => false, 'js' => null, 'content' => null]; } }
koike/ayumi
lib/Campaign/JSRedirector.php
PHP
mit
1,246
module ConfigurableExt def keys self.defaults.collect { |k,v| k.to_s }.sort end def groups @groups = defaults.select { |key, value| value['type'].to_s.downcase == 'group' } @groups.collect { |k,v| k.to_s }.sort end def values @values = defaults.select { |key, value| value['type'].to_s.downcase != 'group' } @values.collect { |k,v| k.to_s }.sort end def []=(key, value) key = value_key(key) exisiting = Configurable.find_by_name(key) if exisiting exisiting.update_attribute(:value, value) else Configurable.create(:name => key.to_s, :value => value) end end def [](key) return defaults[key][:default] unless Configurable.table_exists? value = Configurable.find_by_name(value_key(key)).try(:value) || defaults[key][:default] case defaults[key][:type] when 'boolean' [true, 1, "1", "t", "true"].include?(value) when 'decimal' BigDecimal.new(value.to_s) when 'integer' value.to_i when 'list' return value if value.is_a?(Array) value.split("\n").collect{ |v| v.split(',') } else value end end def method_missing(name, *args) name_stripped = name.to_s.sub(/[\?=]$/, '') if values.include?(name_stripped) if name.to_s.end_with?('=') self[name_stripped] = args.first else self[name_stripped] end elsif groups.include?(name_stripped) ConfigurableGroup.new(name_stripped, self) else super end end def value_key(key) if @parent [@parent.value_key(@group), key].join('/') else key end end alias_method :form_key, :value_key end
fuCtor/configurable_engine
app/models/configurable_ext.rb
Ruby
mit
1,766
/* * Copyright 2014 Greg Kopff * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.fatboyindustrial.gsonjavatime; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import java.lang.reflect.Type; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; /** * GSON serialiser/deserialiser for converting {@link LocalDateTime} objects. */ public class LocalDateTimeConverter implements JsonSerializer<LocalDateTime>, JsonDeserializer<LocalDateTime> { /** Formatter. */ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE_TIME; /** * Gson invokes this call-back method during serialization when it encounters a field of the * specified type. <p> * * In the implementation of this call-back method, you should consider invoking * {@link JsonSerializationContext#serialize(Object, Type)} method to create JsonElements for any * non-trivial field of the {@code src} object. However, you should never invoke it on the * {@code src} object itself since that will cause an infinite loop (Gson will call your * call-back method again). * * @param src the object that needs to be converted to Json. * @param typeOfSrc the actual type (fully genericized version) of the source object. * @return a JsonElement corresponding to the specified object. */ @Override public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(FORMATTER.format(src)); } /** * Gson invokes this call-back method during deserialization when it encounters a field of the * specified type. <p> * * In the implementation of this call-back method, you should consider invoking * {@link JsonDeserializationContext#deserialize(JsonElement, Type)} method to create objects * for any non-trivial field of the returned object. However, you should never invoke it on the * the same type passing {@code json} since that will cause an infinite loop (Gson will call your * call-back method again). * * @param json The Json data being deserialized * @param typeOfT The type of the Object to deserialize to * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T} * @throws JsonParseException if json is not in the expected format of {@code typeOfT} */ @Override public LocalDateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return FORMATTER.parse(json.getAsString(), LocalDateTime::from); } }
gkopff/gson-javatime-serialisers
src/main/java/com/fatboyindustrial/gsonjavatime/LocalDateTimeConverter.java
Java
mit
3,899
/* * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion * Copyright (C) 2016-2021 ViaVersion and contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.viaversion.viaversion.api.minecraft.chunks; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.BitSet; import java.util.List; // TODO specialized sub interfaces public interface Chunk { /** * Returns the chunk x coordinate. * * @return chunk x coordinate */ int getX(); /** * Returns the chunk z coordinate. * * @return chunk z coordinate */ int getZ(); /** * Returns whether this chunk holds biome data, always true for 1.17+ chunks. * * @return true if this chunk holds biome data */ boolean isBiomeData(); /** * Returns whether this is a full chunk, always true for 1.17+ chunks. * * @return true if this is a full chunk */ boolean isFullChunk(); boolean isIgnoreOldLightData(); void setIgnoreOldLightData(boolean ignoreOldLightData); /** * Returns the chunk section bit mask for chunks &lt; 1.17. * * @return chunk section bit mask for chunks &lt; 1.17 * @see #getChunkMask() */ int getBitmask(); void setBitmask(int bitmask); /** * Returns the chunk section bit mask, only non-null for 1.17+ chunks. * * @return chunk section bit mask, only non-null for 1.17+ chunks * @see #getBitmask() */ @Nullable BitSet getChunkMask(); void setChunkMask(BitSet chunkSectionMask); /** * Returns an array of nullable chunk section entries. * * @return array of nullable chunk sections */ @Nullable ChunkSection[] getSections(); void setSections(ChunkSection[] sections); /** * Returns the chunk's raw biome data. The format the biomes are stored may vary. * * @return raw biome data */ int @Nullable [] getBiomeData(); void setBiomeData(int @Nullable [] biomeData); /** * Returns a compoundtag containing the chunk's heightmaps if present. * * @return compoundtag containing heightmaps if present */ @Nullable CompoundTag getHeightMap(); void setHeightMap(@Nullable CompoundTag heightMap); /** * Returns a list of block entities. * * @return list of block entities */ List<CompoundTag> getBlockEntities(); }
MylesIsCool/ViaVersion
api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/Chunk.java
Java
mit
3,552
#!/bin/sh # Used for testing geth --datadir ../testchain --unlock 0x8ae386892b59bd2a7546a9468e8e847d61955991 --password ./testpassword --rpc --rpcapi "eth,net,web3,debug" --rpccorsdomain '*' --rpcport 8646 --ws --wsport 8647 --wsaddr "localhost" --wsorigins="*" --port 32323 --mine --minerthreads 1 --maxpeers 0 --cache 1024 --targetgaslimit 994712388 --verbosity 2 console # used for production #geth --unlock 6 --ws --wsport 8647 --wsaddr "localhost" --wsorigins="*" --verbosity 2 console
SydEthereum/meetup-token
scripts/startGeth.sh
Shell
mit
494
Imports System.Text Public Class Editor Dim FileNameQ As String 'Путь и имя файла базы вопросов Dim currentBlock0(,) As String 'Временный массив Public currentBlock2(,) As String 'Массив вопросов Dim rightAnswerNumber As Integer 'Номер правильного ответа (1-4) Dim rightAnswerText As String 'Текст правильного ответа РЕЖИССЁРУ Private Sub Editor_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.MaximizeBox = False Dim currentField As String Dim currentRow As String() Dim i0 As Integer Dim i1 As Integer OpenFileDialog1.InitialDirectory = Project.sourcePath FileNameQ = Project.FileNameQ Label1.Text = Project.FileNameQ OpenFileDialog1.FileName = FileNameQ If FileNameQ <> "*.questions" Then ListBox1.Enabled = True REM **************************** REM Считывание базы данных вопросов из выбранного файла i1 = 0 i0 = 0 Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(FileNameQ, System.Text.Encoding.Default) MyReader.TextFieldType = FileIO.FieldType.Delimited MyReader.SetDelimiters("|") ReDim currentRow(15) ReDim currentBlock0(100, 15) While Not MyReader.EndOfData Try currentRow = MyReader.ReadFields() If currentRow(2) <> "" Then i0 = i0 + 1 i1 = 0 For Each currentField In currentRow i1 = i1 + 1 currentBlock0(i0, i1) = "" currentBlock0(i0, i1) = currentField If currentBlock0(i0, i1) = "" And i1 > 0 Then Project.maxCow = i1 - 1 End If Next End If Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException End Try End While ReDim currentBlock2(i0, Project.maxCow) For i2 = 0 To i0 For i1 = 0 To Project.maxCow currentBlock2(i2, i1) = currentBlock0(i2, i1) Next Next End Using REM /Считывание базы данных вопросов из выбранного файла REM /********************** 'Приравнивание массивов For i1 = 1 To Project.currentBlock2.GetUpperBound(0) For i2 = 1 To Project.maxCow If Project.currentBlock2(i1, i2) <> Nothing Then currentBlock2(i1, i2) = Project.currentBlock2(i1, i2) End If Next Next REM *********************** REM Заполнение ListBox1 ListBox1.Items.Clear() For i1 = 1 To currentBlock2.GetUpperBound(0) If (currentBlock2(1, 3)) <> Nothing Then ListBox1.Items.Add(currentBlock2(i1, 2) & ": " & currentBlock2(i1, 3).Replace(Chr(13) & Chr(10), " ")) End If Next REM /Заполнение ListBox1 REM /*********************** ListBox1.SelectedIndex = Project.ListBox1.SelectedIndex Else ListBox1.Enabled = False ListBox1.Items.Clear() MsgBox("You don't choosed question base file! Please, press ""Open"" button.") Button3.BackColor = Color.FromArgb(255, 128, 0) 'Open button -> Orange Label1.Text = "Question File Adress (Choose question base file with format ""*.question"")" End If 'Перевод "F" Editor Me.Text = Project.currentBlock1(117, 3) '0 Label2.Text = Project.currentBlock1(118, 3) '1 Button1.Text = Project.currentBlock1(119, 3) '2 Button2.Text = Project.currentBlock1(120, 3) '3 Button3.Text = Project.currentBlock1(121, 3) '4 Button4.Text = Project.currentBlock1(122, 3) '5 End Sub Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged rightAnswerNumber = Int(currentBlock2(ListBox1.SelectedIndex + 1, 8)) 'Выбор номера правильного ответа из массива rightAnswerText = currentBlock2(ListBox1.SelectedIndex + 1, rightAnswerNumber + 3) 'Текст ответа из массива (номер ответа + 3) For x = 1 To 5 Me.Controls("TextBox" & x).Text = currentBlock2(ListBox1.SelectedIndex + 1, x + 2) Next Select Case rightAnswerNumber Case 1 RadioButton1.Checked = True Case 2 RadioButton2.Checked = True Case 3 RadioButton3.Checked = True Case 4 RadioButton4.Checked = True End Select TextBox6.Text = currentBlock2(ListBox1.SelectedIndex + 1, 9) End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 'Save temporarily If TextBox1.Text <> "" Then Project.ListBox1.SelectedIndex = ListBox1.SelectedIndex Project.currentBlock2(ListBox1.SelectedIndex + 1, 3) = TextBox1.Text 'Временное сохранение текста вопроса Project.currentBlock2(ListBox1.SelectedIndex + 1, 4) = TextBox2.Text 'Временное сохранение текста ответа A Project.currentBlock2(ListBox1.SelectedIndex + 1, 5) = TextBox3.Text 'Временное сохранение текста ответа B Project.currentBlock2(ListBox1.SelectedIndex + 1, 6) = TextBox4.Text 'Временное сохранение текста ответа C Project.currentBlock2(ListBox1.SelectedIndex + 1, 7) = TextBox5.Text 'Временное сохранение текста ответа D If RadioButton1.Checked = True Then Project.currentBlock2(ListBox1.SelectedIndex + 1, 8) = 1 'Временное сохранение правильного ответа 1 End If If RadioButton2.Checked = True Then Project.currentBlock2(ListBox1.SelectedIndex + 1, 8) = 2 'Временное сохранение правильного ответа 2 End If If RadioButton3.Checked = True Then Project.currentBlock2(ListBox1.SelectedIndex + 1, 8) = 3 'Временное сохранение правильного ответа 3 End If If RadioButton4.Checked = True Then Project.currentBlock2(ListBox1.SelectedIndex + 1, 8) = 4 'Временное сохранение правильного ответа 4 End If Project.currentBlock2(ListBox1.SelectedIndex + 1, 9) = TextBox6.Text 'Временное сохранение текста комментария 'Перезагрузка Project.ListBox1 Project.ListBox1.Items.Clear() For i1 = 1 To Project.currentBlock2.GetUpperBound(0) If (Project.currentBlock2(1, 3)) <> Nothing Then Project.ListBox1.Items.Add(Project.currentBlock2(i1, 2) & ": " & Project.currentBlock2(i1, 3).Replace(Chr(13) & Chr(10), " ")) End If Next Project.ListBox1.SelectedIndex = ListBox1.SelectedIndex 'Приравнивание массивов For i1 = 1 To Project.currentBlock2.GetUpperBound(0) For i2 = 1 To Project.maxCow If Project.currentBlock2(i1, i2) <> Nothing Then currentBlock2(i1, i2) = Project.currentBlock2(i1, i2) End If Next Next 'Перезагрузка ListBox1 ListBox1.Items.Clear() For i1 = 1 To currentBlock2.GetUpperBound(0) If (currentBlock2(1, 3)) <> Nothing Then ListBox1.Items.Add(currentBlock2(i1, 2) & ": " & currentBlock2(i1, 3).Replace(Chr(13) & Chr(10), " ")) End If Next ListBox1.SelectedIndex = Project.ListBox1.SelectedIndex Project.Label5.Text = Project.currentBlock2(Project.ListBox1.SelectedIndex + 1, 3) & Chr(13) & "A: " & Project.currentBlock2(Project.ListBox1.SelectedIndex + 1, 4) & " B: " & Project.currentBlock2(Project.ListBox1.SelectedIndex + 1, 5) & " C: " & Project.currentBlock2(Project.ListBox1.SelectedIndex + 1, 6) & " D: " & Project.currentBlock2(Project.ListBox1.SelectedIndex + 1, 7) & ". " & Project.currentBlock1(143, 3) & " " & Project.rightAnswerText If ListBox1.SelectedIndex = Project.questionNumber - 1 And Project.Button1.BackColor <> Color.Yellow Then 'Если редактируемый вопрос = задаваемому и Кнопка "Задать выбранный вопрос" не жёлтая, то... Project.questionText = Project.currentBlock2(ListBox1.SelectedIndex + 1, 3) Project.textAnswerA = Project.currentBlock2(ListBox1.SelectedIndex + 1, 4) Project.textAnswerB = Project.currentBlock2(ListBox1.SelectedIndex + 1, 5) Project.textAnswerC = Project.currentBlock2(ListBox1.SelectedIndex + 1, 6) Project.textAnswerD = Project.currentBlock2(ListBox1.SelectedIndex + 1, 7) Project.Label16.Text = Project.questionText Project.Label17.Text = Project.textAnswerA Project.Label18.Text = Project.textAnswerB Project.Label19.Text = Project.textAnswerC Project.Label20.Text = Project.textAnswerD Project.numberRightAnswer = Project.currentBlock2(ListBox1.SelectedIndex + 1, 8) Host.Label11.Text = Project.currentBlock2(ListBox1.SelectedIndex + 1, 9) 'Сеть If Project.Button7.BackColor = Color.Green Then Dim NetworkInfo As New IONetwork With NetworkInfo .Command = "@button6|" & Project.questionText & "|" & Project.textAnswerA & "|" & Project.textAnswerB & "|" & Project.textAnswerC & "|" & Project.textAnswerD & "|" & Project.numberRightAnswer & "|" & Project.currentBlock2(ListBox1.SelectedIndex + 1, 9) & "|" End With Project.Client_SendIONetwork(NetworkInfo) End If End If Else My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation) End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 'Save base file If TextBox1.Text <> "" Then Dim tmpText As String Dim listSelect As Integer If Button1.Enabled = False Then listSelect = ListBox1.SelectedIndex currentBlock2(ListBox1.SelectedIndex + 1, 3) = TextBox1.Text 'Временное сохранение текста вопроса currentBlock2(ListBox1.SelectedIndex + 1, 4) = TextBox2.Text 'Временное сохранение текста ответа A currentBlock2(ListBox1.SelectedIndex + 1, 5) = TextBox3.Text 'Временное сохранение текста ответа B currentBlock2(ListBox1.SelectedIndex + 1, 6) = TextBox4.Text 'Временное сохранение текста ответа C currentBlock2(ListBox1.SelectedIndex + 1, 7) = TextBox5.Text 'Временное сохранение текста ответа D If RadioButton1.Checked = True Then currentBlock2(ListBox1.SelectedIndex + 1, 8) = 1 'Временное сохранение правильного ответа 1 End If If RadioButton2.Checked = True Then currentBlock2(ListBox1.SelectedIndex + 1, 8) = 2 'Временное сохранение правильного ответа 2 End If If RadioButton3.Checked = True Then currentBlock2(ListBox1.SelectedIndex + 1, 8) = 3 'Временное сохранение правильного ответа 3 End If If RadioButton4.Checked = True Then currentBlock2(ListBox1.SelectedIndex + 1, 8) = 4 'Временное сохранение правильного ответа 4 End If currentBlock2(ListBox1.SelectedIndex + 1, 9) = TextBox6.Text 'Временное сохранение текста комментария ListBox1.Items.Clear() For i1 = 1 To currentBlock2.GetUpperBound(0) If (currentBlock2(1, 3)) <> Nothing Then ListBox1.Items.Add(currentBlock2(i1, 2) & ": " & currentBlock2(i1, 3)) End If Next ListBox1.SelectedIndex = listSelect Else Button1.PerformClick() End If SaveFileDialog1.FileName = OpenFileDialog1.FileName FileClose(1) FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output) For i1 = 1 To currentBlock2.GetUpperBound(0) tmpText = "" For i2 = 1 To Project.maxCow 'Сохранение в файл If currentBlock2(i1, i2) <> "" Then 'Замена переноса строки и "|" currentBlock2(i1, i2) = currentBlock2(i1, i2).Replace(Chr(13) & Chr(10), "¶") currentBlock2(i1, i2) = currentBlock2(i1, i2).Replace("|", "") End If tmpText = tmpText & currentBlock2(i1, i2) & "|" If currentBlock2(i1, i2) <> "" Then currentBlock2(i1, i2) = currentBlock2(i1, i2).Replace("¶", Chr(13) & Chr(10)) 'Замена переноса строки Next Print(1, tmpText & Chr(13) & Chr(10)) Next FileClose(1) Else My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Exclamation) End If End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click 'Open file... OpenFileDialog1.FileName = "*.questions" OpenFileDialog1.InitialDirectory = CurDir() & "\Bases" OpenFileDialog1.CheckFileExists = True If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then FileNameQ = OpenFileDialog1.FileName Call openfilesdata(FileNameQ) If OpenFileDialog1.FileName <> Project.OpenFileDialog1.FileName Then Button1.Enabled = False Else Button1.Enabled = True End If End If End Sub Private Sub openfilesdata(sender As Object) Dim currentField As String Dim currentRow As String() Dim i0 As Integer Dim i1 As Integer Label1.Text = FileNameQ If FileNameQ <> "*.questions" Then ListBox1.Enabled = True REM **************************** REM Считывание базы данных вопросов из выбранного файла i1 = 0 i0 = 0 Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(FileNameQ, System.Text.Encoding.Default) MyReader.TextFieldType = FileIO.FieldType.Delimited MyReader.SetDelimiters("|") ReDim currentRow(15) ReDim currentBlock0(100, 15) While Not MyReader.EndOfData Try currentRow = MyReader.ReadFields() If currentRow(2) <> "" Then i0 = i0 + 1 i1 = 0 For Each currentField In currentRow i1 = i1 + 1 currentBlock0(i0, i1) = "" currentBlock0(i0, i1) = currentField Next End If Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException End Try End While ReDim currentBlock2(i0, 15) For i2 = 0 To i0 For i1 = 0 To 15 currentBlock2(i2, i1) = currentBlock0(i2, i1) 'Замена переноса строки и "|" If currentBlock0(i2, i1) <> "" Then currentBlock0(i2, i1) = currentBlock0(i2, i1).Replace("¶", " ") currentBlock0(i2, i1) = currentBlock0(i2, i1).Replace("|", "") End If If currentBlock2(i2, i1) <> "" Then currentBlock2(i2, i1) = currentBlock2(i2, i1).Replace("¶", Chr(13) & Chr(10)) currentBlock2(i2, i1) = currentBlock2(i2, i1).Replace("|", "") End If Next Next End Using REM /Считывание базы данных вопросов из выбранного файла REM /********************** REM *********************** REM Заполнение ListBox1 ListBox1.Items.Clear() For i1 = 1 To currentBlock2.GetUpperBound(0) 'Можно 15, но мы сделали резерв If (currentBlock2(1, 3)) <> Nothing Then ListBox1.Items.Add(currentBlock0(i1, 2) & ": " & currentBlock0(i1, 3).Replace(Chr(13) & Chr(10), " ")) End If Next REM /Заполнение ListBox1 REM /*********************** Button3.BackColor = Color.White ListBox1.SelectedIndex = 0 Else ListBox1.Enabled = False ListBox1.Items.Clear() MsgBox("You don't choosed question base file! Please, press ""Open file..."" button.") Button3.BackColor = Color.FromArgb(255, 128, 0) 'Open button -> Orange Label1.Text = "Question File Adress (Choose question base file with format ""*.question"")" End If End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click 'Create new file... Dim n As Integer While My.Computer.FileSystem.FileExists(CurDir() & "\Bases\NewBase" & n & ".questions") = True n = n + 1 End While SaveFileDialog1.FileName = "NewBase" & n & ".questions" SaveFileDialog1.InitialDirectory = CurDir() & "\Bases" SaveFileDialog1.CreatePrompt = False SaveFileDialog1.OverwritePrompt = True SaveFileDialog1.CheckPathExists = True If SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then Try FileCopy(CurDir() & "\Bases\" & Project.currentBlock1(2, 3) & "Base_Example.questions", SaveFileDialog1.FileName) Catch FileClose(1) FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output) Print(1, "|1|First question?|Answer A1|Answer B1|Answer C1|Answer D1|1|Comment for question number 1.|" & Chr(13) & Chr(10) & _ "|2|Second question?|Answer A2|Answer B2|Answer C2|Answer D2|1|Comment for question number 2.|" & Chr(13) & Chr(10) & _ "|3|Third question?|Answer A3|Answer B3|Answer C3|Answer D3|1|Comment for question number 3.|" & Chr(13) & Chr(10) & _ "|4|Fourth question?|Answer A4|Answer B4|Answer C4|Answer D4|1|Comment for question number 4.|" & Chr(13) & Chr(10) & _ "|5|Fifth question?|Answer A5|Answer B5|Answer C5|Answer D5|1|Comment for question number 5.|" & Chr(13) & Chr(10) & _ "|6|Sixth question?|Answer A6|Answer B6|Answer C6|Answer D6|1|Comment for question number 6.|" & Chr(13) & Chr(10) & _ "|7|Seventh question?|Answer A7|Answer B7|Answer C7|Answer D7|1|Comment for question number 7.|" & Chr(13) & Chr(10) & _ "|8|Eighth question?|Answer A8|Answer B8|Answer C8|Answer D8|1|Comment for question number 8.|" & Chr(13) & Chr(10) & _ "|9|Ninth question?|Answer A9|Answer B9|Answer C9|Answer D9|1|Comment for question number 9.|" & Chr(13) & Chr(10) & _ "|10|Tenth question?|Answer A10|Answer B10|Answer C10|Answer D10|1|Comment for question number 10.|" & Chr(13) & Chr(10) & _ "|11|Eleventh question?|Answer A11|Answer B11|Answer C11|Answer D11|1|Comment for question number 11.|" & Chr(13) & Chr(10) & _ "|12|Twelfth question?|Answer A12|Answer B12|Answer C12|Answer D12|1|Comment for question number 12.|" & Chr(13) & Chr(10) & _ "|13|Thirteenth question?|Answer A13|Answer B13|Answer C13|Answer D13|1|Comment for question number 13.|" & Chr(13) & Chr(10) & _ "|14|Fourteenth question?|Answer A14|Answer B14|Answer C14|Answer D14|1|Comment for question number 14.|" & Chr(13) & Chr(10) & _ "|15|Fifteenth question?|Answer A15|Answer B15|Answer C15|Answer D15|1|Comment for question number 15.|" & Chr(13) & Chr(10)) FileClose(1) End Try OpenFileDialog1.FileName = SaveFileDialog1.FileName FileNameQ = OpenFileDialog1.FileName Call openfilesdata(FileNameQ) If OpenFileDialog1.FileName <> Project.OpenFileDialog1.FileName Then Button1.Enabled = False Else Button1.Enabled = True End If End If End Sub End Class
Denchick777/wwtbam_control_program
WindowsApplication1/WindowsApplication1/Editor.vb
Visual Basic
mit
22,881
// Copyright (c) 2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <string> #include "version.h" // Name of client reported in the 'version' message. Report the same name // for both bitcoind and bitcoin-qt, to make it harder for attackers to // target servers or GUI users specifically. const std::string CLIENT_NAME("METH"); // Client version number #define CLIENT_VERSION_SUFFIX "-beta" // The following part of the code determines the CLIENT_BUILD variable. // Several mechanisms are used for this: // * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is // generated by the build environment, possibly containing the output // of git-describe in a macro called BUILD_DESC // * secondly, if this is an exported version of the code, GIT_ARCHIVE will // be defined (automatically using the export-subst git attribute), and // GIT_COMMIT will contain the commit id. // * then, three options exist for determining CLIENT_BUILD: // * if BUILD_DESC is defined, use that literally (output of git-describe) // * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit] // * otherwise, use v[maj].[min].[rev].[build]-unk // finally CLIENT_VERSION_SUFFIX is added // First, include build.h if requested #ifdef HAVE_BUILD_INFO # include "build.h" #endif // git will put "#define GIT_ARCHIVE 1" on the next line inside archives. #define GIT_ARCHIVE 1 #ifdef GIT_ARCHIVE # define GIT_COMMIT_ID "" # define GIT_COMMIT_DATE "" #endif #define BUILD_DESC_FROM_COMMIT(maj,min,rev,build,commit) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" commit #define BUILD_DESC_FROM_UNKNOWN(maj,min,rev,build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" #ifndef BUILD_DESC # ifdef GIT_COMMIT_ID # define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID) # else # define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) # endif #endif #ifndef BUILD_DATE # ifdef GIT_COMMIT_DATE # define BUILD_DATE GIT_COMMIT_DATE # else # define BUILD_DATE __DATE__ ", " __TIME__ # endif #endif const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX); const std::string CLIENT_DATE(BUILD_DATE);
cryptometh/cryptometh
src/version.cpp
C++
mit
2,594
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" #import "NSCoding.h" @class NSMutableDictionary; @interface MemSigManager : NSObject <NSCoding> { NSMutableDictionary *sigDict; } - (id)initWithCoder:(id)arg1; - (void)encodeWithCoder:(id)arg1; - (void)printSig; - (id)sigByName:(id)arg1; - (void)addSig:(id)arg1; - (void)dealloc; - (id)init; @end
walkdianzi/DashengHook
WeChat-Headers/MemSigManager.h
C
mit
467
require 'xml/mapping/base' class ValueArrayNode < XML::Mapping::ArrayNode def initialize(*args) *args = super(*args) @options[:marshaller] = proc{ |xml, value| xml.text = value } @options[:unmarshaller] = proc{ |xml| xml.text } args end end
plzen/ebay
lib/support/xml_mapping/value_array_node.rb
Ruby
mit
261
(function () { 'use strict'; registerModule('admin.core'); registerModule('admin.core.routes', ['ui.router']); registerModule('admin.core.services'); }());
THe-LearningSystem/frontend
app/modules/admin/core/admin.core.module.js
JavaScript
mit
173
// Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #include "qtipcserver.h" #include "guiconstants.h" #include "ui_interface.h" #include "util.h" #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/interprocess/ipc/message_queue.hpp> #include <boost/version.hpp> #if defined(WIN32) && (!defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) || BOOST_VERSION < 104900) #warning Compiling without BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME and BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME uncommented in boost/interprocess/detail/tmp_dir_helpers.hpp or using a boost version before 1.49 may have unintended results see svn.boost.org/trac/boost/ticket/5392 #endif using namespace boost; using namespace boost::interprocess; using namespace boost::posix_time; static void ipcThread2(void* pArg); #ifdef MAC_OSX // URI handling not implemented on OSX yet void ipcInit() { } #else static void ipcThread(void* pArg) { IMPLEMENT_RANDOMIZE_STACK(ipcThread(pArg)); // Make this thread recognisable as the GUI-IPC thread RenameThread("bitcoin-gui-ipc"); try { ipcThread2(pArg); } catch (std::exception& e) { PrintExceptionContinue(&e, "ipcThread()"); } catch (...) { PrintExceptionContinue(NULL, "ipcThread()"); } printf("ipcThread exited\n"); } static void ipcThread2(void* pArg) { printf("ipcThread started\n"); message_queue* mq = (message_queue*)pArg; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; loop { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); Sleep(1000); } if (fShutdown) break; } // Remove message queue message_queue::remove(BITCOINURI_QUEUE_NAME); // Cleanup allocated memory delete mq; } void ipcInit() { message_queue* mq = NULL; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; try { mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); // Make sure we don't lose any imoney: URIs for (int i = 0; i < 2; i++) { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); } else break; } // Make sure only one instance is listening message_queue::remove(BITCOINURI_QUEUE_NAME); delete mq; mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); } catch (interprocess_exception &ex) { printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); return; } if (!CreateThread(ipcThread, mq)) { delete mq; return; } } #endif
IMoney/IMoney
src/qt/qtipcserver.cpp
C++
mit
3,371
Rails.application.configure do # Conficuring action cable URI config.action_cable.url = "ws://localhost:3000/cable" config.action_cable.allowed_request_origins = ['http://localhost:3000'] # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. if Rails.root.join('tmp/caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=172800' } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker end
crabsolutions/2016.2-Owla
config/environments/development.rb
Ruby
mit
2,046
#include <rtthread.h> #include "tc_comm.h" static rt_sem_t sem; static rt_uint8_t t1_count, t2_count; static rt_thread_t t1, t2, worker; static void thread1_entry(void* parameter) { rt_err_t result; while (1) { result = rt_sem_take(sem, RT_WAITING_FOREVER); if (result != RT_EOK) { tc_done(TC_STAT_FAILED); return; } t1_count ++; rt_kprintf("thread1: got semaphore, count: %d\n", t1_count); } } static void thread2_entry(void* parameter) { rt_err_t result; while (1) { result = rt_sem_take(sem, RT_WAITING_FOREVER); if (result != RT_EOK) { tc_done(TC_STAT_FAILED); return; } t2_count ++; rt_kprintf("thread2: got semaphore, count: %d\n", t2_count); } } static void worker_thread_entry(void* parameter) { rt_thread_delay(10); while (1) { rt_sem_release(sem); rt_thread_delay(5); } } int semaphore_priority_init() { sem = rt_sem_create("sem", 0, RT_IPC_FLAG_PRIO); if (sem == RT_NULL) { tc_stat(TC_STAT_END | TC_STAT_FAILED); return 0; } t1_count = t2_count = 0; t1 = rt_thread_create("t1", thread1_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY + 1, THREAD_TIMESLICE); if (t1 != RT_NULL) rt_thread_startup(t1); else tc_stat(TC_STAT_END | TC_STAT_FAILED); t2 = rt_thread_create("t2", thread2_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY - 1, THREAD_TIMESLICE); if (t2 != RT_NULL) rt_thread_startup(t2); else tc_stat(TC_STAT_END | TC_STAT_FAILED); worker = rt_thread_create("worker", worker_thread_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE); if (worker != RT_NULL) rt_thread_startup(worker); else tc_stat(TC_STAT_END | TC_STAT_FAILED); return 0; } #ifdef RT_USING_TC static void _tc_cleanup() { /* lock scheduler */ rt_enter_critical(); /* delete t1, t2 and worker thread */ rt_thread_delete(t1); rt_thread_delete(t2); rt_thread_delete(worker); if (sem) { rt_sem_delete(sem); sem = RT_NULL; } if (t1_count > t2_count) tc_done(TC_STAT_FAILED); else tc_done(TC_STAT_PASSED); /* unlock scheduler */ rt_exit_critical(); } int _tc_semaphore_priority() { /* set tc cleanup */ tc_cleanup(_tc_cleanup); semaphore_priority_init(); return 50; } FINSH_FUNCTION_EXPORT(_tc_semaphore_priority, a priority semaphore test); #else int rt_application_init() { semaphore_priority_init(); return 0; } #endif
cedar-renjun/air-conditioning-assistant
rt-thread/examples/kernel/semaphore_priority.c
C
mit
2,983
package main import ( "fmt" "github.com/TuftsBCB/io/fasta" "github.com/TuftsBCB/tools/util" ) func init() { util.FlagParse("fasta-file", "Quickly count the number of sequences in a fasta file.") util.AssertNArg(1) } func main() { rfasta := util.OpenFasta(util.Arg(0)) count, err := fasta.QuickSequenceCount(rfasta) util.Assert(err) fmt.Println(count) }
TuftsBCB/tools
fasta-count/main.go
GO
mit
368
import pytest from datetime import datetime import mock from app import create_app, db import os from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.script import Manager from alembic.command import upgrade from alembic.config import Config from sqlalchemy.schema import MetaData from app.models import Organisation, Service, Job, Token, User, Notification from config import configs from app.main.encryption import generate_password_hash @pytest.fixture(scope='session') def notify_api(request): app = create_app('test') ctx = app.app_context() ctx.push() def teardown(): ctx.pop() request.addfinalizer(teardown) return app @pytest.fixture(scope='session') def notify_db(notify_api, request): Migrate(notify_api, db) Manager(db, MigrateCommand) BASE_DIR = os.path.dirname(os.path.dirname(__file__)) ALEMBIC_CONFIG = os.path.join(BASE_DIR, 'migrations') config = Config(ALEMBIC_CONFIG + '/alembic.ini') config.set_main_option("script_location", ALEMBIC_CONFIG) with notify_api.app_context(): upgrade(config, 'head') def teardown(): db.session.remove() db.drop_all() db.engine.execute("drop table alembic_version") db.get_engine(notify_api).dispose() request.addfinalizer(teardown) @pytest.fixture(scope='function') def notify_db_session(request): meta = MetaData(bind=db.engine, reflect=True) # Set up dummy org, with a service and a job org = Organisation(id=1234, name="org test") token = Token(id=1234, token="1234", type='admin') service = Service( id=1234, name="service test", created_at=datetime.utcnow(), token=token, active=True, restricted=False, limit=100 ) job = Job(id=1234, name="job test", created_at=datetime.utcnow(), service=service) notification = Notification( id=1234, to="phone-number", message="this is a message", job=job, status="created", method="sms", created_at=datetime.utcnow() ) # Setup a dummy user for tests user = User( id=1234, email_address="[email protected]", mobile_number="+449999234234", password=generate_password_hash('valid-password'), active=True, created_at=datetime.utcnow(), updated_at=datetime.utcnow(), password_changed_at=datetime.utcnow(), role='admin' ) service.users.append(user) db.session.add(token) db.session.add(org) db.session.add(service) db.session.add(notification) db.session.add(job) db.session.add(user) db.session.commit() def teardown(): db.session.remove() for tbl in reversed(meta.sorted_tables): db.engine.execute(tbl.delete()) request.addfinalizer(teardown) @pytest.fixture(scope='function') def notify_config(notify_api): notify_api.config['NOTIFY_API_ENVIRONMENT'] = 'test' notify_api.config.from_object(configs['test']) @pytest.fixture def os_environ(request): env_patch = mock.patch('os.environ', {}) request.addfinalizer(env_patch.stop) return env_patch.start() @pytest.fixture(autouse=True) def no_sms(monkeypatch): monkeypatch.delattr("app.connectors.sms.clients.TwilioClient.send") @pytest.fixture(autouse=True) def no_email(monkeypatch): monkeypatch.delattr("app.connectors.sms.clients.SendGridClient.send") @pytest.fixture(scope='function') def notify_email_db_session(request): meta = MetaData(bind=db.engine, reflect=True) # Set up dummy org, with a service and a job org = Organisation(id=1234, name="org test for email") token = Token(id=1234, token="1234", type='admin') service = Service( id=1234, name="email service test", created_at=datetime.utcnow(), token=token, active=True, restricted=False, limit=100 ) job = Job(id=1234, name="email job test", created_at=datetime.utcnow(), service=service) notification = Notification( id=1234, to="[email protected]", message="this is an email message", job=job, status="created", method="email", created_at=datetime.utcnow() ) # Setup a dummy user for tests user = User( id=1234, email_address="[email protected]", mobile_number="+449999234234", password=generate_password_hash('valid-password'), active=True, created_at=datetime.utcnow(), updated_at=datetime.utcnow(), password_changed_at=datetime.utcnow(), role='admin' ) service.users.append(user) db.session.add(token) db.session.add(org) db.session.add(service) db.session.add(notification) db.session.add(job) db.session.add(user) db.session.commit() def teardown(): db.session.remove() for tbl in reversed(meta.sorted_tables): db.engine.execute(tbl.delete()) request.addfinalizer(teardown)
alphagov/notify-api
tests/conftest.py
Python
mit
5,072
/*global define:false, window:false, document:false, console: false, setInterval:false, setTimeout:false, clearInterval:false, CustomEvent:false */ define(["config"], function (config) { "use strict"; var context = {}, scale, sel, // current selection cfg = config.draw, fieldSize = config.game.size; var animPathTimer, animSelectTimer; var noPathWarn; function _drawField(c, field) { var grad, i, offset, ctx; if (!c) { return; } ctx = c.getContext("2d"); // draw the field grid ctx.beginPath(); ctx.lineWidth = cfg.cellMargin; ctx.strokeStyle = "#eee"; ctx.shadowColor = "#999"; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = (cfg.cellMargin / 2) * scale; for (i = 0, offset = cfg.cellMargin / 2; i < field.m + 1; i++, offset += cfg.cellMargin + cfg.cellSize) { ctx.moveTo(0, offset); ctx.lineTo(c.width / scale, offset); ctx.stroke(); } ctx.shadowOffsetX = (cfg.cellMargin / 2) * scale; ctx.shadowOffsetY = 0; for (i = 0, offset = cfg.cellMargin / 2; i < field.n + 1; i++, offset += cfg.cellMargin + cfg.cellSize) { ctx.moveTo(offset, 0); ctx.lineTo(offset, c.height / scale); ctx.stroke(); } ctx.closePath(); // final touch -- the rightmost border and the bottom one ctx.beginPath(); ctx.lineWidth = cfg.cellMargin; ctx.shadowOffsetX = cfg.cellMargin; ctx.shadowOffsetY = 0; ctx.strokeStyle = "#eee"; ctx.shadowColor = "#999"; ctx.moveTo(c.width / scale - cfg.cellMargin, 0); ctx.lineTo(c.width / scale - cfg.cellMargin, c.height / scale); ctx.stroke(); ctx.shadowOffsetX = 0; ctx.shadowOffsetY = cfg.cellMargin; ctx.moveTo(0, c.height / scale - cfg.cellMargin); ctx.lineTo(c.width / scale, c.height / scale - cfg.cellMargin); ctx.stroke(); ctx.closePath(); } function _initCanvas(field) { // calculate size var cnvs = document.getElementById(field.id), w = field.n * (cfg.cellSize + cfg.cellMargin) + cfg.cellMargin * 1.5, h = field.m * (cfg.cellSize + cfg.cellMargin) + cfg.cellMargin * 1.5, pixRatio = window.devicePixelRatio || 1, ctx; if (!cnvs) { return; } scale = pixRatio; ctx = cnvs.getContext("2d"); cnvs.width = w * pixRatio; cnvs.height = h * pixRatio; cnvs.style.width = w + 'px'; cnvs.style.height = h + 'px'; if (pixRatio !== 1) { ctx.scale(pixRatio, pixRatio); } ctx.lineJoin = "bevel"; ctx.lineCap = "square"; ctx.fillStyle = "#ddd"; ctx.fillRect(0, 0, w, h); _drawField(cnvs, field); context[field.id] = { field: field, canvas: cnvs, ctx: ctx }; } function initCanvas(mfield, nfield) { _initCanvas(mfield); _initCanvas(nfield); } function drawBall(id, x, y, r, color) { var ctx = context[id].ctx, grd = ctx.createRadialGradient(x - r * 0.2, y - r * 0.2, 0, x - r * 0.2, y - r * 0.2, r / 2); grd.addColorStop(0.0, "#f5f5f5"); try { grd.addColorStop(1.0, color); } catch (e) { console.error("Color", color, e); } ctx.shadowOffsetX = r * 0.1; ctx.shadowOffsetY = r * 0.1; ctx.shadowBlur = r * 0.1; ctx.strokeStyle = color; ctx.fillStyle = grd; ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(x, y, r, 0, 2 * Math.PI); ctx.stroke(); ctx.fill(); ctx.closePath(); } function eraseCell(id, i, j) { var ctx = context[id].ctx, cell = context[id].field.$(i, j); var x, y; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; ctx.shadowBlur = 0; ctx.strokeStyle = "#ddd"; ctx.fillStyle = "#ddd"; ctx.lineWidth = 0; ctx.beginPath(); ctx.arc(cell.ballX, cell.ballY, cfg.cellSize / 2 - cfg.cellMargin - 1, 0, 2 * Math.PI); ctx.stroke(); ctx.fill(); ctx.closePath(); } function drawNewBalls(colors, field) { var i, cell; for (i = 0; i < 3; i++) { cell = field.$(0, i); eraseCell(config.NEW_BALLS_CANVAS, 0, i); drawBall(config.NEW_BALLS_CANVAS, cell.ballX, cell.ballY, 3 / 10 * cfg.cellSize, colors[i]); } } var animPathState = { r: 0, path: null, color: null, stop: true }; var evnt = new CustomEvent( "moveCompleted", { detail: { ball: null }, bubbles: true, cancelable: true } ); function animatePath() { var r = --animPathState.r, cpath = animPathState.path, color = animPathState.color, k, c, cnvs = context[config.MAIN_CANVAS].canvas; if (r < 0 && r + 2 > 0) { if (cpath && cpath[0]) { evnt.detail.ball = cpath[0]; cnvs.dispatchEvent(evnt); for (k = 1; k < cpath.length; k++) { c = cpath[k]; if (!c.color) { eraseCell(config.MAIN_CANVAS, c.i, c.j); } } } } else if (r > 0) { for (k = 1; k < cpath.length; k++) { c = cpath[k]; if (!c.color) { eraseCell(config.MAIN_CANVAS, c.i, c.j); drawBall(config.MAIN_CANVAS, c.ballX, c.ballY, animPathState.r, color); } } } } var animSelState = { ch: 0, dir: -1 }; function animateSelected() { var cell = sel, height, dir = -1, ch = animSelState.ch, // current height x, y, grd, ctx = context[config.MAIN_CANVAS].ctx, r = 3 / 10 * cfg.cellSize; if (!cell) { return; } height = Math.floor(5 * r / 12); x = cell.ballX; y = cell.ballY; eraseCell(config.MAIN_CANVAS, cell.i, cell.j); ch++; if (ch === height) { ch = 0; dir *= -1; } animSelState.ch = ch; animSelState.dir = dir; y += ch * dir; grd = ctx.createRadialGradient(x - r * 0.2, y - r * 0.2, 0, x - r * 0.2, y - r * 0.2, r / 2); grd.addColorStop(0.0, "#f5f5f5"); try { grd.addColorStop(1.0, cell.color); } catch (e) { console.error("Cell", cell, e); } ctx.shadowOffsetX = r * 0.1; ctx.shadowOffsetY = r * 0.1 + ch; ctx.shadowBlur = r * 0.1; ctx.strokeStyle = cell.color; ctx.fillStyle = grd; ctx.lineWidth = 0; ctx.beginPath(); ctx.arc(x, y, r, 0, 2 * Math.PI); ctx.stroke(); ctx.fill(); ctx.closePath(); } function moveBall(i, j, path) { var start = context[config.MAIN_CANVAS].field.$(i, j); var color = start.color; var h; var dest = path[0]; start.color = null; eraseCell(config.MAIN_CANVAS, i, j); dest.color = color; drawBall(config.MAIN_CANVAS, dest.ballX, dest.ballY, 3 / 10 * cfg.cellSize, color); path.push(start); animPathState.r = Math.floor(3 / 10 * cfg.cellSize / 2); animPathState.path = path; animPathState.color = color; animPathState.stop = false; animPathTimer = setInterval(animatePath, 100); } function _offset() { var elem = document.getElementById("playground"), elemBounds = elem.getBoundingClientRect(), body = window.document.body, offsetTop, offsetLeft; if (window.getComputedStyle(body).position === "static") { offsetLeft = elemBounds.left + window.pageXOffset; offsetTop = elemBounds.top + window.pageYOffset; } else { var bodyBounds = body.getBoundingClientRect(); offsetLeft = elemBounds.left - bodyBounds.left; offsetTop = elemBounds.top - bodyBounds.top; } return { left: offsetLeft, top: offsetTop }; } function warnNoPath() { var offset = _offset(); if (noPathWarn) { return; } noPathWarn = document.createElement("div"); noPathWarn.style.position = "absolute"; noPathWarn.style.width = context[config.MAIN_CANVAS].canvas.style.width; noPathWarn.style.height = context[config.MAIN_CANVAS].canvas.style.height; noPathWarn.style.display = "flex"; noPathWarn.style.justifyContent = "center"; noPathWarn.style.alignItems = "center"; noPathWarn.style.fontWeight = "bold"; noPathWarn.style.fontSize = "25px"; noPathWarn.innerHTML = "Cannot move"; noPathWarn.style.color = "rgb(255, 0, 0)"; noPathWarn.style.backgroundColor = "rgba(255, 125, 125, 0.5)"; noPathWarn.style.transitionProperty = "opacity"; noPathWarn.style.transitionDuration = "1s"; noPathWarn.style.left = offset.left + "px"; noPathWarn.style.top = offset.top + "px"; document.body.appendChild(noPathWarn); setTimeout(function () { document.body.removeChild(noPathWarn); noPathWarn = null; }, 1000); setTimeout(function () { noPathWarn.style.opacity = 0; }, 20); } document.getElementById(config.MAIN_CANVAS).addEventListener("moveCompleted", function () { clearInterval(animPathTimer); }); function startAnimateSelection(cell) { if (sel) { console.log("selection exists", sel, "new: ", cell); return; } sel = cell; animSelectTimer = setInterval(animateSelected, 100); } function stopAnimateSelection() { sel = null; clearInterval(animSelectTimer); } return { initCanvas: initCanvas, drawBall: drawBall, eraseCell: eraseCell, moveBall: moveBall, drawNewBalls: drawNewBalls, startAnimateSelection: startAnimateSelection, stopAnimateSelection: stopAnimateSelection, warnNoPath: warnNoPath }; });
freekai/lines
www/js/draw.js
JavaScript
mit
10,801
import { Component, Pipe, PipeTransform } from '@angular/core'; import { AngularFire, FirebaseListObservable } from 'angularfire2'; import 'rxjs/Rx'; import { Observable } from 'rxjs/Rx'; import { RefirebasePipe } from '../shared/refirebase.pipe'; import { Resource } from '../shared/models'; import { ResourceFormComponent } from './resource-form.component' @Component({ selector: 'resource-new', templateUrl: 'resource-submit.component.html', styleUrls: ['../developers/expert-form.component.scss'] }) export class ResourceSubmitComponent { resource: Resource = new Resource(); constructor(private af: AngularFire) { } save(item: Resource) { console.log("new resource submission", item); if (item.validate()) { delete item.$key; this.af.database.list('/queues/resources') .push(item); this.resource = new Resource(); } else { console.warn('Invalid submission'); } } }
amitafr/ames
src/app/resources/resource-submit.component.ts
TypeScript
mit
1,000
<p>Crew Member Details</p> <table class="table table-striped"> <thead> <tr> <!--<th><input type="checkbox" ng-model="toggle" ng-click="toggleSelectAll()" /> Action</th>--> <th>Name</th> <th>Clan</th> <th>Class</th> <th class="hidden">ID</th> <th>Level</th> <th>BDH Role</th> <th>Forge Group</th> </tr> </thead> <tbody> <tr ng-repeat="member_detail in member_details"> <!--<td><input type="checkbox" ng-model="member.Checked" /></td>--> <td>{{member_detail.name}}</td> <td>{{member_detail.clan}}</td> <td>{{member_detail.class}}</td> <td class="hidden">{{member_detail.id}}</td> <td>{{member_detail.level}}</td> <td>{{member_detail.bdh_role}}</td> <td>{{member_detail.forge_group}}</td> </tr> </tbody> </table>
pshouse/BDH
app/partials/member-details.html
HTML
mit
976
#pragma once #include "Manager/Manager.h" class TimeMgr : public Manager { public: TimeMgr(); ~TimeMgr(); void init(); void process(const float dt); void end(); const float GetDeltaTime() const; private: };
WeHaveCookie/EnchantedForest
Classes/Manager/Time/TimeMgr.h
C
mit
225
# Neekon iOS Application
neekon/ios
README.md
Markdown
mit
27
require 'devise' module Fae class Engine < ::Rails::Engine isolate_namespace Fae # include libraries require 'simple_form' require 'remotipart' require 'jquery-rails' require 'jquery-ui-rails' require 'judge' require 'judge/simple_form' require 'acts_as_list' require 'slim' require 'kaminari' require 'fae/version' config.autoload_paths += %W(#{config.root}/lib) config.to_prepare do ApplicationController.helper(ApplicationHelper) end config.generators do |g| g.test_framework :rspec, fixture: false g.fixture_replacement :factory_girl, dir: 'spec/factories' g.assets false g.helper false end end end
tshedor/fae
lib/fae/engine.rb
Ruby
mit
710
// +build 215_1 package main func closeStrings(word1 string, word2 string) bool { if len(word1) != len(word2) { return false } letterCnt1 := make(map[byte]int) letterCnt2 := make(map[byte]int) for i := 0; i < len(word1); i++ { letterCnt1[word1[i]]++ letterCnt2[word2[i]]++ } if len(word1) != len(word2) { return false } for b := range letterCnt1 { if _, ok := letterCnt2[b]; !ok { return false } } cnt1 := make(map[int]int) cnt2 := make(map[int]int) for _, cnt := range letterCnt1 { cnt1[cnt]++ } for _, cnt := range letterCnt2 { cnt2[cnt]++ } for k, v := range cnt1 { if cnt2[k] != v { return false } } return true } func main() { println(closeStrings("bca", "abc")) println(closeStrings("a", "aa")) println(closeStrings("cabbba", "abbccc")) println(closeStrings("cabbba", "aabbss")) }
MrHuxu/leetcode
weekly-contest/215/determine-if-two-strings-are-close.go
GO
mit
843
bootstrapng =========== reliable angular bootstrap
sulmanen/bootstrapng
README.md
Markdown
mit
52
const nodeStatic = require('node-static'); const http = require('http'); const utils = require('../utils'); const config = require('../config'); exports.start = () => { return new Promise((resolve, reject) => { const staticServer = new nodeStatic.Server(config.dist, config.server.header); utils.logging.logInfoSync('has started'); http.createServer((request, response) => { request.addListener('end', () => { staticServer.serve(request, response, (error) => { if (error) { utils.logging.logWarningSync(`url not found: ${request.url}`); response.writeHead(error.status, error.headers); response.write(`url not found: ${request.url}`); response.end(); } else { utils.logging.logInfoSync(`url served: ${request.url}`); } }); }).resume(); }).listen(config.server.port); resolve(); }); };
oliverlukesch/shb-public
scripts/servers/dist.js
JavaScript
mit
942
<?php namespace Ma27\ApiKeyAuthenticationBundle\Tests\Resources\Controller; use Symfony\Component\HttpFoundation\Response; class TestController { public function helloAction() { return new Response('hello world!'); } }
Ma27/Ma27ApiKeyAuthenticationBundle
Tests/Resources/Controller/TestController.php
PHP
mit
242
--- layout: page title: Now tagline: What I am doing permalink: /now.html ref: now order: 3 --- ## 博客 - [x] 如何让你的代码跑遍世界 - [x] 《人类群星闪耀时》总结 ## 网站 - [ ] about页面初版 \[======>====\] - [x] 大框架 - [x] 细节描述 - [ ] ~~格式调整~~ ## 阅读 - [ ] 《构建之法》 \[=>=========\] 45/420 - [ ] ~~《昨日的世界》 \[===>=======\] 301/1094~~ - [x] 《富爸爸穷爸爸》 - [x] 《富爸爸穷爸爸 投资指南》 - [x] 《乔布斯传》 - [x] 《林肯传》 - [x] 《刻意练习》 - [x] 《OKR工作法》 - [ ] 《刷屏》 \[===>=======\] 132/391 ## 音乐 - [x] 《Rhapsody in Blue》 - [x] 《回家》 - [x] 《红莲之弓矢》 - [ ] 《疾如猛火》 - [ ] 《秒五》 - [ ] 《Reflection》 - [ ] 《火花》(《你的名字》) ## 学习 - [ ] Electron
ZacharyHuang/ZacharyHuang.github.io
now.md
Markdown
mit
895
/** * jscolor - JavaScript Color Picker * * @link http://jscolor.com * @license For open source use: GPLv3 * For commercial use: JSColor Commercial License * @author Jan Odvarko * @version 2.0.4 * * See usage examples at http://jscolor.com/examples/ */ "use strict"; if (!window.jscolor) { window.jscolor = (function () { var jsc = { register : function () { jsc.attachDOMReadyEvent(jsc.init); jsc.attachEvent(document, 'mousedown', jsc.onDocumentMouseDown); jsc.attachEvent(document, 'touchstart', jsc.onDocumentTouchStart); jsc.attachEvent(window, 'resize', jsc.onWindowResize); }, init : function () { if (jsc.jscolor.lookupClass) { jsc.jscolor.installByClassName(jsc.jscolor.lookupClass); } }, tryInstallOnElements : function (elms, className) { var matchClass = new RegExp('(^|\\s)(' + className + ')(\\s*(\\{[^}]*\\})|\\s|$)', 'i'); for (var i = 0; i < elms.length; i += 1) { if (elms[i].type !== undefined && elms[i].type.toLowerCase() == 'color') { if (jsc.isColorAttrSupported) { // skip inputs of type 'color' if supported by the browser continue; } } var m; if (!elms[i].jscolor && elms[i].className && (m = elms[i].className.match(matchClass))) { var targetElm = elms[i]; var optsStr = null; var dataOptions = jsc.getDataAttr(targetElm, 'jscolor'); if (dataOptions !== null) { optsStr = dataOptions; } else if (m[4]) { optsStr = m[4]; } var opts = {}; if (optsStr) { try { opts = (new Function ('return (' + optsStr + ')'))(); } catch(eParseError) { jsc.warn('Error parsing jscolor options: ' + eParseError + ':\n' + optsStr); } } targetElm.jscolor = new jsc.jscolor(targetElm, opts); } } }, isColorAttrSupported : (function () { var elm = document.createElement('input'); if (elm.setAttribute) { elm.setAttribute('type', 'color'); if (elm.type.toLowerCase() == 'color') { return true; } } return false; })(), isCanvasSupported : (function () { var elm = document.createElement('canvas'); return !!(elm.getContext && elm.getContext('2d')); })(), fetchElement : function (mixed) { return typeof mixed === 'string' ? document.getElementById(mixed) : mixed; }, isElementType : function (elm, type) { return elm.nodeName.toLowerCase() === type.toLowerCase(); }, getDataAttr : function (el, name) { var attrName = 'data-' + name; var attrValue = el.getAttribute(attrName); if (attrValue !== null) { return attrValue; } return null; }, attachEvent : function (el, evnt, func) { if (el.addEventListener) { el.addEventListener(evnt, func, false); } else if (el.attachEvent) { el.attachEvent('on' + evnt, func); } }, detachEvent : function (el, evnt, func) { if (el.removeEventListener) { el.removeEventListener(evnt, func, false); } else if (el.detachEvent) { el.detachEvent('on' + evnt, func); } }, _attachedGroupEvents : {}, attachGroupEvent : function (groupName, el, evnt, func) { if (!jsc._attachedGroupEvents.hasOwnProperty(groupName)) { jsc._attachedGroupEvents[groupName] = []; } jsc._attachedGroupEvents[groupName].push([el, evnt, func]); jsc.attachEvent(el, evnt, func); }, detachGroupEvents : function (groupName) { if (jsc._attachedGroupEvents.hasOwnProperty(groupName)) { for (var i = 0; i < jsc._attachedGroupEvents[groupName].length; i += 1) { var evt = jsc._attachedGroupEvents[groupName][i]; jsc.detachEvent(evt[0], evt[1], evt[2]); } delete jsc._attachedGroupEvents[groupName]; } }, attachDOMReadyEvent : function (func) { var fired = false; var fireOnce = function () { if (!fired) { fired = true; func(); } }; if (document.readyState === 'complete') { setTimeout(fireOnce, 1); // async return; } if (document.addEventListener) { document.addEventListener('DOMContentLoaded', fireOnce, false); // Fallback window.addEventListener('load', fireOnce, false); } else if (document.attachEvent) { // IE document.attachEvent('onreadystatechange', function () { if (document.readyState === 'complete') { document.detachEvent('onreadystatechange', arguments.callee); fireOnce(); } }) // Fallback window.attachEvent('onload', fireOnce); // IE7/8 if (document.documentElement.doScroll && window == window.top) { var tryScroll = function () { if (!document.body) { return; } try { document.documentElement.doScroll('left'); fireOnce(); } catch (e) { setTimeout(tryScroll, 1); } }; tryScroll(); } } }, warn : function (msg) { if (window.console && window.console.warn) { window.console.warn(msg); } }, preventDefault : function (e) { if (e.preventDefault) { e.preventDefault(); } e.returnValue = false; }, captureTarget : function (target) { // IE if (target.setCapture) { jsc._capturedTarget = target; jsc._capturedTarget.setCapture(); } }, releaseTarget : function () { // IE if (jsc._capturedTarget) { jsc._capturedTarget.releaseCapture(); jsc._capturedTarget = null; } }, fireEvent : function (el, evnt) { if (!el) { return; } if (document.createEvent) { var ev = document.createEvent('HTMLEvents'); ev.initEvent(evnt, true, true); el.dispatchEvent(ev); } else if (document.createEventObject) { var ev = document.createEventObject(); el.fireEvent('on' + evnt, ev); } else if (el['on' + evnt]) { // alternatively use the traditional event model el['on' + evnt](); } }, classNameToList : function (className) { return className.replace(/^\s+|\s+$/g, '').split(/\s+/); }, // The className parameter (str) can only contain a single class name hasClass : function (elm, className) { if (!className) { return false; } return -1 != (' ' + elm.className.replace(/\s+/g, ' ') + ' ').indexOf(' ' + className + ' '); }, // The className parameter (str) can contain multiple class names separated by whitespace setClass : function (elm, className) { var classList = jsc.classNameToList(className); for (var i = 0; i < classList.length; i += 1) { if (!jsc.hasClass(elm, classList[i])) { elm.className += (elm.className ? ' ' : '') + classList[i]; } } }, // The className parameter (str) can contain multiple class names separated by whitespace unsetClass : function (elm, className) { var classList = jsc.classNameToList(className); for (var i = 0; i < classList.length; i += 1) { var repl = new RegExp( '^\\s*' + classList[i] + '\\s*|' + '\\s*' + classList[i] + '\\s*$|' + '\\s+' + classList[i] + '(\\s+)', 'g' ); elm.className = elm.className.replace(repl, '$1'); } }, getStyle : function (elm) { return window.getComputedStyle ? window.getComputedStyle(elm) : elm.currentStyle; }, setStyle : (function () { var helper = document.createElement('div'); var getSupportedProp = function (names) { for (var i = 0; i < names.length; i += 1) { if (names[i] in helper.style) { return names[i]; } } }; var props = { borderRadius: getSupportedProp(['borderRadius', 'MozBorderRadius', 'webkitBorderRadius']), boxShadow: getSupportedProp(['boxShadow', 'MozBoxShadow', 'webkitBoxShadow']) }; return function (elm, prop, value) { switch (prop.toLowerCase()) { case 'opacity': var alphaOpacity = Math.round(parseFloat(value) * 100); elm.style.opacity = value; elm.style.filter = 'alpha(opacity=' + alphaOpacity + ')'; break; default: elm.style[props[prop]] = value; break; } }; })(), setBorderRadius : function (elm, value) { jsc.setStyle(elm, 'borderRadius', value || '0'); }, setBoxShadow : function (elm, value) { jsc.setStyle(elm, 'boxShadow', value || 'none'); }, getElementPos : function (e, relativeToViewport) { var x=0, y=0; var rect = e.getBoundingClientRect(); x = rect.left; y = rect.top; if (!relativeToViewport) { var viewPos = jsc.getViewPos(); x += viewPos[0]; y += viewPos[1]; } return [x, y]; }, getElementSize : function (e) { return [e.offsetWidth, e.offsetHeight]; }, // get pointer's X/Y coordinates relative to viewport getAbsPointerPos : function (e) { if (!e) { e = window.event; } var x = 0, y = 0; if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) { // touch devices x = e.changedTouches[0].clientX; y = e.changedTouches[0].clientY; } else if (typeof e.clientX === 'number') { x = e.clientX; y = e.clientY; } return { x: x, y: y }; }, // get pointer's X/Y coordinates relative to target element getRelPointerPos : function (e) { if (!e) { e = window.event; } var target = e.target || e.srcElement; var targetRect = target.getBoundingClientRect(); var x = 0, y = 0; var clientX = 0, clientY = 0; if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) { // touch devices clientX = e.changedTouches[0].clientX; clientY = e.changedTouches[0].clientY; } else if (typeof e.clientX === 'number') { clientX = e.clientX; clientY = e.clientY; } x = clientX - targetRect.left; y = clientY - targetRect.top; return { x: x, y: y }; }, getViewPos : function () { var doc = document.documentElement; return [ (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) ]; }, getViewSize : function () { var doc = document.documentElement; return [ (window.innerWidth || doc.clientWidth), (window.innerHeight || doc.clientHeight), ]; }, redrawPosition : function () { if (jsc.picker && jsc.picker.owner) { var thisObj = jsc.picker.owner; var tp, vp; if (thisObj.fixed) { // Fixed elements are positioned relative to viewport, // therefore we can ignore the scroll offset tp = jsc.getElementPos(thisObj.targetElement, true); // target pos vp = [0, 0]; // view pos } else { tp = jsc.getElementPos(thisObj.targetElement); // target pos vp = jsc.getViewPos(); // view pos } var ts = jsc.getElementSize(thisObj.targetElement); // target size var vs = jsc.getViewSize(); // view size var ps = jsc.getPickerOuterDims(thisObj); // picker size var a, b, c; switch (thisObj.position.toLowerCase()) { case 'left': a=1; b=0; c=-1; break; case 'right':a=1; b=0; c=1; break; case 'top': a=0; b=1; c=-1; break; default: a=0; b=1; c=1; break; } var l = (ts[b]+ps[b])/2; // compute picker position if (!thisObj.smartPosition) { var pp = [ tp[a], tp[b]+ts[b]-l+l*c ]; } else { var pp = [ -vp[a]+tp[a]+ps[a] > vs[a] ? (-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) : tp[a], -vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ? (-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) : (tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c) ]; } var x = pp[a]; var y = pp[b]; var positionValue = thisObj.fixed ? 'fixed' : 'absolute'; var contractShadow = (pp[0] + ps[0] > tp[0] || pp[0] < tp[0] + ts[0]) && (pp[1] + ps[1] < tp[1] + ts[1]); jsc._drawPosition(thisObj, x, y, positionValue, contractShadow); } }, _drawPosition : function (thisObj, x, y, positionValue, contractShadow) { var vShadow = contractShadow ? 0 : thisObj.shadowBlur; // px jsc.picker.wrap.style.position = positionValue; jsc.picker.wrap.style.left = x + 'px'; jsc.picker.wrap.style.top = y + 'px'; jsc.setBoxShadow( jsc.picker.boxS, thisObj.shadow ? new jsc.BoxShadow(0, vShadow, thisObj.shadowBlur, 0, thisObj.shadowColor) : null); }, getPickerDims : function (thisObj) { var displaySlider = !!jsc.getSliderComponent(thisObj); var dims = [ 2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.width + (displaySlider ? 2 * thisObj.insetWidth + jsc.getPadToSliderPadding(thisObj) + thisObj.sliderSize : 0), 2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.height + (thisObj.closable ? 2 * thisObj.insetWidth + thisObj.padding + thisObj.buttonHeight : 0) ]; return dims; }, getPickerOuterDims : function (thisObj) { var dims = jsc.getPickerDims(thisObj); return [ dims[0] + 2 * thisObj.borderWidth, dims[1] + 2 * thisObj.borderWidth ]; }, getPadToSliderPadding : function (thisObj) { return Math.max(thisObj.padding, 1.5 * (2 * thisObj.pointerBorderWidth + thisObj.pointerThickness)); }, getPadYComponent : function (thisObj) { switch (thisObj.mode.charAt(1).toLowerCase()) { case 'v': return 'v'; break; } return 's'; }, getSliderComponent : function (thisObj) { if (thisObj.mode.length > 2) { switch (thisObj.mode.charAt(2).toLowerCase()) { case 's': return 's'; break; case 'v': return 'v'; break; } } return null; }, onDocumentMouseDown : function (e) { if (!e) { e = window.event; } var target = e.target || e.srcElement; if (target._jscLinkedInstance) { if (target._jscLinkedInstance.showOnClick) { target._jscLinkedInstance.show(); } } else if (target._jscControlName) { jsc.onControlPointerStart(e, target, target._jscControlName, 'mouse'); } else { // Mouse is outside the picker controls -> hide the color picker! if (jsc.picker && jsc.picker.owner) { jsc.picker.owner.hide(); } } }, onDocumentTouchStart : function (e) { if (!e) { e = window.event; } var target = e.target || e.srcElement; if (target._jscLinkedInstance) { if (target._jscLinkedInstance.showOnClick) { target._jscLinkedInstance.show(); } } else if (target._jscControlName) { jsc.onControlPointerStart(e, target, target._jscControlName, 'touch'); } else { if (jsc.picker && jsc.picker.owner) { jsc.picker.owner.hide(); } } }, onWindowResize : function (e) { jsc.redrawPosition(); }, onParentScroll : function (e) { // hide the picker when one of the parent elements is scrolled if (jsc.picker && jsc.picker.owner) { jsc.picker.owner.hide(); } }, _pointerMoveEvent : { mouse: 'mousemove', touch: 'touchmove' }, _pointerEndEvent : { mouse: 'mouseup', touch: 'touchend' }, _pointerOrigin : null, _capturedTarget : null, onControlPointerStart : function (e, target, controlName, pointerType) { var thisObj = target._jscInstance; jsc.preventDefault(e); jsc.captureTarget(target); var registerDragEvents = function (doc, offset) { jsc.attachGroupEvent('drag', doc, jsc._pointerMoveEvent[pointerType], jsc.onDocumentPointerMove(e, target, controlName, pointerType, offset)); jsc.attachGroupEvent('drag', doc, jsc._pointerEndEvent[pointerType], jsc.onDocumentPointerEnd(e, target, controlName, pointerType)); }; registerDragEvents(document, [0, 0]); if (window.parent && window.frameElement) { var rect = window.frameElement.getBoundingClientRect(); var ofs = [-rect.left, -rect.top]; registerDragEvents(window.parent.window.document, ofs); } var abs = jsc.getAbsPointerPos(e); var rel = jsc.getRelPointerPos(e); jsc._pointerOrigin = { x: abs.x - rel.x, y: abs.y - rel.y }; switch (controlName) { case 'pad': // if the slider is at the bottom, move it up switch (jsc.getSliderComponent(thisObj)) { case 's': if (thisObj.hsv[1] === 0) { thisObj.fromHSV(null, 100, null); }; break; case 'v': if (thisObj.hsv[2] === 0) { thisObj.fromHSV(null, null, 100); }; break; } jsc.setPad(thisObj, e, 0, 0); break; case 'sld': jsc.setSld(thisObj, e, 0); break; } jsc.dispatchFineChange(thisObj); }, onDocumentPointerMove : function (e, target, controlName, pointerType, offset) { return function (e) { var thisObj = target._jscInstance; switch (controlName) { case 'pad': if (!e) { e = window.event; } jsc.setPad(thisObj, e, offset[0], offset[1]); jsc.dispatchFineChange(thisObj); break; case 'sld': if (!e) { e = window.event; } jsc.setSld(thisObj, e, offset[1]); jsc.dispatchFineChange(thisObj); break; } } }, onDocumentPointerEnd : function (e, target, controlName, pointerType) { return function (e) { var thisObj = target._jscInstance; jsc.detachGroupEvents('drag'); jsc.releaseTarget(); // Always dispatch changes after detaching outstanding mouse handlers, // in case some user interaction will occur in user's onchange callback // that would intrude with current mouse events jsc.dispatchChange(thisObj); }; }, dispatchChange : function (thisObj) { if (thisObj.valueElement) { if (jsc.isElementType(thisObj.valueElement, 'input')) { jsc.fireEvent(thisObj.valueElement, 'change'); } } }, dispatchFineChange : function (thisObj) { if (thisObj.onFineChange) { var callback; if (typeof thisObj.onFineChange === 'string') { callback = new Function (thisObj.onFineChange); } else { callback = thisObj.onFineChange; } callback.call(thisObj); } }, setPad : function (thisObj, e, ofsX, ofsY) { var pointerAbs = jsc.getAbsPointerPos(e); var x = ofsX + pointerAbs.x - jsc._pointerOrigin.x - thisObj.padding - thisObj.insetWidth; var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth; var xVal = x * (360 / (thisObj.width - 1)); var yVal = 100 - (y * (100 / (thisObj.height - 1))); switch (jsc.getPadYComponent(thisObj)) { case 's': thisObj.fromHSV(xVal, yVal, null, jsc.leaveSld); break; case 'v': thisObj.fromHSV(xVal, null, yVal, jsc.leaveSld); break; } }, setSld : function (thisObj, e, ofsY) { var pointerAbs = jsc.getAbsPointerPos(e); var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth; var yVal = 100 - (y * (100 / (thisObj.height - 1))); switch (jsc.getSliderComponent(thisObj)) { case 's': thisObj.fromHSV(null, yVal, null, jsc.leavePad); break; case 'v': thisObj.fromHSV(null, null, yVal, jsc.leavePad); break; } }, _vmlNS : 'jsc_vml_', _vmlCSS : 'jsc_vml_css_', _vmlReady : false, initVML : function () { if (!jsc._vmlReady) { // init VML namespace var doc = document; if (!doc.namespaces[jsc._vmlNS]) { doc.namespaces.add(jsc._vmlNS, 'urn:schemas-microsoft-com:vml'); } if (!doc.styleSheets[jsc._vmlCSS]) { var tags = ['shape', 'shapetype', 'group', 'background', 'path', 'formulas', 'handles', 'fill', 'stroke', 'shadow', 'textbox', 'textpath', 'imagedata', 'line', 'polyline', 'curve', 'rect', 'roundrect', 'oval', 'arc', 'image']; var ss = doc.createStyleSheet(); ss.owningElement.id = jsc._vmlCSS; for (var i = 0; i < tags.length; i += 1) { ss.addRule(jsc._vmlNS + '\\:' + tags[i], 'behavior:url(#default#VML);'); } } jsc._vmlReady = true; } }, createPalette : function () { var paletteObj = { elm: null, draw: null }; if (jsc.isCanvasSupported) { // Canvas implementation for modern browsers var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); var drawFunc = function (width, height, type) { canvas.width = width; canvas.height = height; ctx.clearRect(0, 0, canvas.width, canvas.height); var hGrad = ctx.createLinearGradient(0, 0, canvas.width, 0); hGrad.addColorStop(0 / 6, '#F00'); hGrad.addColorStop(1 / 6, '#FF0'); hGrad.addColorStop(2 / 6, '#0F0'); hGrad.addColorStop(3 / 6, '#0FF'); hGrad.addColorStop(4 / 6, '#00F'); hGrad.addColorStop(5 / 6, '#F0F'); hGrad.addColorStop(6 / 6, '#F00'); ctx.fillStyle = hGrad; ctx.fillRect(0, 0, canvas.width, canvas.height); var vGrad = ctx.createLinearGradient(0, 0, 0, canvas.height); switch (type.toLowerCase()) { case 's': vGrad.addColorStop(0, 'rgba(255,255,255,0)'); vGrad.addColorStop(1, 'rgba(255,255,255,1)'); break; case 'v': vGrad.addColorStop(0, 'rgba(0,0,0,0)'); vGrad.addColorStop(1, 'rgba(0,0,0,1)'); break; } ctx.fillStyle = vGrad; ctx.fillRect(0, 0, canvas.width, canvas.height); }; paletteObj.elm = canvas; paletteObj.draw = drawFunc; } else { // VML fallback for IE 7 and 8 jsc.initVML(); var vmlContainer = document.createElement('div'); vmlContainer.style.position = 'relative'; vmlContainer.style.overflow = 'hidden'; var hGrad = document.createElement(jsc._vmlNS + ':fill'); hGrad.type = 'gradient'; hGrad.method = 'linear'; hGrad.angle = '90'; hGrad.colors = '16.67% #F0F, 33.33% #00F, 50% #0FF, 66.67% #0F0, 83.33% #FF0' var hRect = document.createElement(jsc._vmlNS + ':rect'); hRect.style.position = 'absolute'; hRect.style.left = -1 + 'px'; hRect.style.top = -1 + 'px'; hRect.stroked = false; hRect.appendChild(hGrad); vmlContainer.appendChild(hRect); var vGrad = document.createElement(jsc._vmlNS + ':fill'); vGrad.type = 'gradient'; vGrad.method = 'linear'; vGrad.angle = '180'; vGrad.opacity = '0'; var vRect = document.createElement(jsc._vmlNS + ':rect'); vRect.style.position = 'absolute'; vRect.style.left = -1 + 'px'; vRect.style.top = -1 + 'px'; vRect.stroked = false; vRect.appendChild(vGrad); vmlContainer.appendChild(vRect); var drawFunc = function (width, height, type) { vmlContainer.style.width = width + 'px'; vmlContainer.style.height = height + 'px'; hRect.style.width = vRect.style.width = (width + 1) + 'px'; hRect.style.height = vRect.style.height = (height + 1) + 'px'; // Colors must be specified during every redraw, otherwise IE won't display // a full gradient during a subsequential redraw hGrad.color = '#F00'; hGrad.color2 = '#F00'; switch (type.toLowerCase()) { case 's': vGrad.color = vGrad.color2 = '#FFF'; break; case 'v': vGrad.color = vGrad.color2 = '#000'; break; } }; paletteObj.elm = vmlContainer; paletteObj.draw = drawFunc; } return paletteObj; }, createSliderGradient : function () { var sliderObj = { elm: null, draw: null }; if (jsc.isCanvasSupported) { // Canvas implementation for modern browsers var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); var drawFunc = function (width, height, color1, color2) { canvas.width = width; canvas.height = height; ctx.clearRect(0, 0, canvas.width, canvas.height); var grad = ctx.createLinearGradient(0, 0, 0, canvas.height); grad.addColorStop(0, color1); grad.addColorStop(1, color2); ctx.fillStyle = grad; ctx.fillRect(0, 0, canvas.width, canvas.height); }; sliderObj.elm = canvas; sliderObj.draw = drawFunc; } else { // VML fallback for IE 7 and 8 jsc.initVML(); var vmlContainer = document.createElement('div'); vmlContainer.style.position = 'relative'; vmlContainer.style.overflow = 'hidden'; var grad = document.createElement(jsc._vmlNS + ':fill'); grad.type = 'gradient'; grad.method = 'linear'; grad.angle = '180'; var rect = document.createElement(jsc._vmlNS + ':rect'); rect.style.position = 'absolute'; rect.style.left = -1 + 'px'; rect.style.top = -1 + 'px'; rect.stroked = false; rect.appendChild(grad); vmlContainer.appendChild(rect); var drawFunc = function (width, height, color1, color2) { vmlContainer.style.width = width + 'px'; vmlContainer.style.height = height + 'px'; rect.style.width = (width + 1) + 'px'; rect.style.height = (height + 1) + 'px'; grad.color = color1; grad.color2 = color2; }; sliderObj.elm = vmlContainer; sliderObj.draw = drawFunc; } return sliderObj; }, leaveValue : 1<<0, leaveStyle : 1<<1, leavePad : 1<<2, leaveSld : 1<<3, BoxShadow : (function () { var BoxShadow = function (hShadow, vShadow, blur, spread, color, inset) { this.hShadow = hShadow; this.vShadow = vShadow; this.blur = blur; this.spread = spread; this.color = color; this.inset = !!inset; }; BoxShadow.prototype.toString = function () { var vals = [ Math.round(this.hShadow) + 'px', Math.round(this.vShadow) + 'px', Math.round(this.blur) + 'px', Math.round(this.spread) + 'px', this.color ]; if (this.inset) { vals.push('inset'); } return vals.join(' '); }; return BoxShadow; })(), // // Usage: // var myColor = new jscolor(<targetElement> [, <options>]) // jscolor : function (targetElement, options) { // General options // this.value = false; // initial HEX color. To change it later, use methods fromString(), fromHSV() and fromRGB() this.valueElement = targetElement; // element that will be used to display and input the color code this.styleElement = null; // element that will preview the picked color using CSS backgroundColor this.required = true; // whether the associated text <input> can be left empty this.refine = true; // whether to refine the entered color code (e.g. uppercase it and remove whitespace) this.hash = false; // whether to prefix the HEX color code with # symbol this.uppercase = true; // whether to uppercase the color code this.onFineChange = null; // called instantly every time the color changes (value can be either a function or a string with javascript code) this.activeClass = 'jscolor-active'; // class to be set to the target element when a picker window is open on it this.minS = 0; // min allowed saturation (0 - 100) this.maxS = 100; // max allowed saturation (0 - 100) this.minV = 0; // min allowed value (brightness) (0 - 100) this.maxV = 100; // max allowed value (brightness) (0 - 100) // Accessing the picked color // this.hsv = [0, 0, 100]; // read-only [0-360, 0-100, 0-100] this.rgb = [255, 255, 255]; // read-only [0-255, 0-255, 0-255] // Color Picker options // this.width = 200; // width of color palette (in px) this.height = 101; // height of color palette (in px) this.showOnClick = true; // whether to display the color picker when user clicks on its target element this.mode = 'HSV'; // HSV | HVS | HS | HV - layout of the color picker controls this.position = 'bottom'; // left | right | top | bottom - position relative to the target element this.smartPosition = true; // automatically change picker position when there is not enough space for it this.sliderSize = 16; // px this.crossSize = 8; // px this.closable = false; // whether to display the Close button this.closeText = 'Close'; this.buttonColor = '#000000'; // CSS color this.buttonHeight = 18; // px this.padding = 10; // px this.backgroundColor = 'rgba(255,255,255,0.5)'; // CSS color this.borderWidth = 0; // px this.borderColor = '#BBBBBB'; // CSS color this.borderRadius = 0; // px this.insetWidth = 1; // px this.insetColor = '#BBBBBB'; // CSS color this.shadow = false; // whether to display shadow this.shadowBlur = 15; // px this.shadowColor = 'rgba(0,0,0,0.2)'; // CSS color this.pointerColor = '#4C4C4C'; // px this.pointerBorderColor = '#FFFFFF'; // px this.pointerBorderWidth = 1; // px this.pointerThickness = 2; // px this.zIndex = 1000; this.container = null; // where to append the color picker (BODY element by default) for (var opt in options) { if (options.hasOwnProperty(opt)) { this[opt] = options[opt]; } } this.hide = function () { if (isPickerOwner()) { detachPicker(); } }; this.show = function () { drawPicker(); }; this.redraw = function () { if (isPickerOwner()) { drawPicker(); } }; this.importColor = function () { if (!this.valueElement) { this.exportColor(); } else { if (jsc.isElementType(this.valueElement, 'input')) { if (!this.refine) { if (!this.fromString(this.valueElement.value, jsc.leaveValue)) { if (this.styleElement) { this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage; this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor; this.styleElement.style.color = this.styleElement._jscOrigStyle.color; } this.exportColor(jsc.leaveValue | jsc.leaveStyle); } } else if (!this.required && /^\s*$/.test(this.valueElement.value)) { this.valueElement.value = ''; if (this.styleElement) { this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage; this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor; this.styleElement.style.color = this.styleElement._jscOrigStyle.color; } this.exportColor(jsc.leaveValue | jsc.leaveStyle); } else if (this.fromString(this.valueElement.value)) { // managed to import color successfully from the value -> OK, don't do anything } else { this.exportColor(); } } else { // not an input element -> doesn't have any value this.exportColor(); } } }; this.exportColor = function (flags) { if (!(flags & jsc.leaveValue) && this.valueElement) { var value = this.toString(); if (this.uppercase) { value = value.toUpperCase(); } if (this.hash) { value = '#' + value; } if (jsc.isElementType(this.valueElement, 'input')) { this.valueElement.value = value; } else { this.valueElement.innerHTML = value; } } if (!(flags & jsc.leaveStyle)) { if (this.styleElement) { this.styleElement.style.backgroundImage = 'none'; this.styleElement.style.backgroundColor = '#' + this.toString(); this.styleElement.style.color = this.isLight() ? '#000' : '#FFF'; } } if (!(flags & jsc.leavePad) && isPickerOwner()) { redrawPad(); } if (!(flags & jsc.leaveSld) && isPickerOwner()) { redrawSld(); } }; // h: 0-360 // s: 0-100 // v: 0-100 // this.fromHSV = function (h, s, v, flags) { // null = don't change if (h !== null) { if (isNaN(h)) { return false; } h = Math.max(0, Math.min(360, h)); } if (s !== null) { if (isNaN(s)) { return false; } s = Math.max(0, Math.min(100, this.maxS, s), this.minS); } if (v !== null) { if (isNaN(v)) { return false; } v = Math.max(0, Math.min(100, this.maxV, v), this.minV); } this.rgb = HSV_RGB( h===null ? this.hsv[0] : (this.hsv[0]=h), s===null ? this.hsv[1] : (this.hsv[1]=s), v===null ? this.hsv[2] : (this.hsv[2]=v) ); this.exportColor(flags); }; // r: 0-255 // g: 0-255 // b: 0-255 // this.fromRGB = function (r, g, b, flags) { // null = don't change if (r !== null) { if (isNaN(r)) { return false; } r = Math.max(0, Math.min(255, r)); } if (g !== null) { if (isNaN(g)) { return false; } g = Math.max(0, Math.min(255, g)); } if (b !== null) { if (isNaN(b)) { return false; } b = Math.max(0, Math.min(255, b)); } var hsv = RGB_HSV( r===null ? this.rgb[0] : r, g===null ? this.rgb[1] : g, b===null ? this.rgb[2] : b ); if (hsv[0] !== null) { this.hsv[0] = Math.max(0, Math.min(360, hsv[0])); } if (hsv[2] !== 0) { this.hsv[1] = hsv[1]===null ? null : Math.max(0, this.minS, Math.min(100, this.maxS, hsv[1])); } this.hsv[2] = hsv[2]===null ? null : Math.max(0, this.minV, Math.min(100, this.maxV, hsv[2])); // update RGB according to final HSV, as some values might be trimmed var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]); this.rgb[0] = rgb[0]; this.rgb[1] = rgb[1]; this.rgb[2] = rgb[2]; this.exportColor(flags); }; this.fromString = function (str, flags) { var m; if (m = str.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i)) { // HEX notation // if (m[1].length === 6) { // 6-char notation this.fromRGB( parseInt(m[1].substr(0,2),16), parseInt(m[1].substr(2,2),16), parseInt(m[1].substr(4,2),16), flags ); } else { // 3-char notation this.fromRGB( parseInt(m[1].charAt(0) + m[1].charAt(0),16), parseInt(m[1].charAt(1) + m[1].charAt(1),16), parseInt(m[1].charAt(2) + m[1].charAt(2),16), flags ); } return true; } else if (m = str.match(/^\W*rgba?\(([^)]*)\)\W*$/i)) { var params = m[1].split(','); var re = /^\s*(\d*)(\.\d+)?\s*$/; var mR, mG, mB; if ( params.length >= 3 && (mR = params[0].match(re)) && (mG = params[1].match(re)) && (mB = params[2].match(re)) ) { var r = parseFloat((mR[1] || '0') + (mR[2] || '')); var g = parseFloat((mG[1] || '0') + (mG[2] || '')); var b = parseFloat((mB[1] || '0') + (mB[2] || '')); this.fromRGB(r, g, b, flags); return true; } } return false; }; this.toString = function () { return ( (0x100 | Math.round(this.rgb[0])).toString(16).substr(1) + (0x100 | Math.round(this.rgb[1])).toString(16).substr(1) + (0x100 | Math.round(this.rgb[2])).toString(16).substr(1) ); }; this.toHEXString = function () { return '#' + this.toString().toUpperCase(); }; this.toRGBString = function () { return ('rgb(' + Math.round(this.rgb[0]) + ',' + Math.round(this.rgb[1]) + ',' + Math.round(this.rgb[2]) + ')' ); }; this.isLight = function () { return ( 0.213 * this.rgb[0] + 0.715 * this.rgb[1] + 0.072 * this.rgb[2] > 255 / 2 ); }; this._processParentElementsInDOM = function () { if (this._linkedElementsProcessed) { return; } this._linkedElementsProcessed = true; var elm = this.targetElement; do { // If the target element or one of its parent nodes has fixed position, // then use fixed positioning instead // // Note: In Firefox, getComputedStyle returns null in a hidden iframe, // that's why we need to check if the returned style object is non-empty var currStyle = jsc.getStyle(elm); if (currStyle && currStyle.position.toLowerCase() === 'fixed') { this.fixed = true; } if (elm !== this.targetElement) { // Ensure to attach onParentScroll only once to each parent element // (multiple targetElements can share the same parent nodes) // // Note: It's not just offsetParents that can be scrollable, // that's why we loop through all parent nodes if (!elm._jscEventsAttached) { jsc.attachEvent(elm, 'scroll', jsc.onParentScroll); elm._jscEventsAttached = true; } } } while ((elm = elm.parentNode) && !jsc.isElementType(elm, 'body')); }; // r: 0-255 // g: 0-255 // b: 0-255 // // returns: [ 0-360, 0-100, 0-100 ] // function RGB_HSV (r, g, b) { r /= 255; g /= 255; b /= 255; var n = Math.min(Math.min(r,g),b); var v = Math.max(Math.max(r,g),b); var m = v - n; if (m === 0) { return [ null, 0, 100 * v ]; } var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m); return [ 60 * (h===6?0:h), 100 * (m/v), 100 * v ]; } // h: 0-360 // s: 0-100 // v: 0-100 // // returns: [ 0-255, 0-255, 0-255 ] // function HSV_RGB (h, s, v) { var u = 255 * (v / 100); if (h === null) { return [ u, u, u ]; } h /= 60; s /= 100; var i = Math.floor(h); var f = i%2 ? h-i : 1-(h-i); var m = u * (1 - s); var n = u * (1 - s * f); switch (i) { case 6: case 0: return [u,n,m]; case 1: return [n,u,m]; case 2: return [m,u,n]; case 3: return [m,n,u]; case 4: return [n,m,u]; case 5: return [u,m,n]; } } function detachPicker () { jsc.unsetClass(THIS.targetElement, THIS.activeClass); jsc.picker.wrap.parentNode.removeChild(jsc.picker.wrap); delete jsc.picker.owner; } function drawPicker () { // At this point, when drawing the picker, we know what the parent elements are // and we can do all related DOM operations, such as registering events on them // or checking their positioning THIS._processParentElementsInDOM(); if (!jsc.picker) { jsc.picker = { owner: null, wrap : document.createElement('div'), box : document.createElement('div'), boxS : document.createElement('div'), // shadow area boxB : document.createElement('div'), // border pad : document.createElement('div'), padB : document.createElement('div'), // border padM : document.createElement('div'), // mouse/touch area padPal : jsc.createPalette(), cross : document.createElement('div'), crossBY : document.createElement('div'), // border Y crossBX : document.createElement('div'), // border X crossLY : document.createElement('div'), // line Y crossLX : document.createElement('div'), // line X sld : document.createElement('div'), sldB : document.createElement('div'), // border sldM : document.createElement('div'), // mouse/touch area sldGrad : jsc.createSliderGradient(), sldPtrS : document.createElement('div'), // slider pointer spacer sldPtrIB : document.createElement('div'), // slider pointer inner border sldPtrMB : document.createElement('div'), // slider pointer middle border sldPtrOB : document.createElement('div'), // slider pointer outer border btn : document.createElement('div'), btnT : document.createElement('span') // text }; jsc.picker.pad.appendChild(jsc.picker.padPal.elm); jsc.picker.padB.appendChild(jsc.picker.pad); jsc.picker.cross.appendChild(jsc.picker.crossBY); jsc.picker.cross.appendChild(jsc.picker.crossBX); jsc.picker.cross.appendChild(jsc.picker.crossLY); jsc.picker.cross.appendChild(jsc.picker.crossLX); jsc.picker.padB.appendChild(jsc.picker.cross); jsc.picker.box.appendChild(jsc.picker.padB); jsc.picker.box.appendChild(jsc.picker.padM); jsc.picker.sld.appendChild(jsc.picker.sldGrad.elm); jsc.picker.sldB.appendChild(jsc.picker.sld); jsc.picker.sldB.appendChild(jsc.picker.sldPtrOB); jsc.picker.sldPtrOB.appendChild(jsc.picker.sldPtrMB); jsc.picker.sldPtrMB.appendChild(jsc.picker.sldPtrIB); jsc.picker.sldPtrIB.appendChild(jsc.picker.sldPtrS); jsc.picker.box.appendChild(jsc.picker.sldB); jsc.picker.box.appendChild(jsc.picker.sldM); jsc.picker.btn.appendChild(jsc.picker.btnT); jsc.picker.box.appendChild(jsc.picker.btn); jsc.picker.boxB.appendChild(jsc.picker.box); jsc.picker.wrap.appendChild(jsc.picker.boxS); jsc.picker.wrap.appendChild(jsc.picker.boxB); } var p = jsc.picker; var displaySlider = !!jsc.getSliderComponent(THIS); var dims = jsc.getPickerDims(THIS); var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize); var padToSliderPadding = jsc.getPadToSliderPadding(THIS); var borderRadius = Math.min( THIS.borderRadius, Math.round(THIS.padding * Math.PI)); // px var padCursor = 'crosshair'; // wrap p.wrap.style.clear = 'both'; p.wrap.style.width = (dims[0] + 2 * THIS.borderWidth) + 'px'; p.wrap.style.height = (dims[1] + 2 * THIS.borderWidth) + 'px'; p.wrap.style.zIndex = THIS.zIndex; // picker p.box.style.width = dims[0] + 'px'; p.box.style.height = dims[1] + 'px'; p.boxS.style.position = 'absolute'; p.boxS.style.left = '0'; p.boxS.style.top = '0'; p.boxS.style.width = '100%'; p.boxS.style.height = '100%'; jsc.setBorderRadius(p.boxS, borderRadius + 'px'); // picker border p.boxB.style.position = 'relative'; p.boxB.style.border = THIS.borderWidth + 'px solid'; p.boxB.style.borderColor = THIS.borderColor; p.boxB.style.background = THIS.backgroundColor; jsc.setBorderRadius(p.boxB, borderRadius + 'px'); // IE hack: // If the element is transparent, IE will trigger the event on the elements under it, // e.g. on Canvas or on elements with border p.padM.style.background = p.sldM.style.background = '#FFF'; jsc.setStyle(p.padM, 'opacity', '0'); jsc.setStyle(p.sldM, 'opacity', '0'); // pad p.pad.style.position = 'relative'; p.pad.style.width = THIS.width + 'px'; p.pad.style.height = THIS.height + 'px'; // pad palettes (HSV and HVS) p.padPal.draw(THIS.width, THIS.height, jsc.getPadYComponent(THIS)); // pad border p.padB.style.position = 'absolute'; p.padB.style.left = THIS.padding + 'px'; p.padB.style.top = THIS.padding + 'px'; p.padB.style.border = THIS.insetWidth + 'px solid'; p.padB.style.borderColor = THIS.insetColor; // pad mouse area p.padM._jscInstance = THIS; p.padM._jscControlName = 'pad'; p.padM.style.position = 'absolute'; p.padM.style.left = '0'; p.padM.style.top = '0'; p.padM.style.width = (THIS.padding + 2 * THIS.insetWidth + THIS.width + padToSliderPadding / 2) + 'px'; p.padM.style.height = dims[1] + 'px'; p.padM.style.cursor = padCursor; // pad cross p.cross.style.position = 'absolute'; p.cross.style.left = p.cross.style.top = '0'; p.cross.style.width = p.cross.style.height = crossOuterSize + 'px'; // pad cross border Y and X p.crossBY.style.position = p.crossBX.style.position = 'absolute'; p.crossBY.style.background = p.crossBX.style.background = THIS.pointerBorderColor; p.crossBY.style.width = p.crossBX.style.height = (2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px'; p.crossBY.style.height = p.crossBX.style.width = crossOuterSize + 'px'; p.crossBY.style.left = p.crossBX.style.top = (Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2) - THIS.pointerBorderWidth) + 'px'; p.crossBY.style.top = p.crossBX.style.left = '0'; // pad cross line Y and X p.crossLY.style.position = p.crossLX.style.position = 'absolute'; p.crossLY.style.background = p.crossLX.style.background = THIS.pointerColor; p.crossLY.style.height = p.crossLX.style.width = (crossOuterSize - 2 * THIS.pointerBorderWidth) + 'px'; p.crossLY.style.width = p.crossLX.style.height = THIS.pointerThickness + 'px'; p.crossLY.style.left = p.crossLX.style.top = (Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2)) + 'px'; p.crossLY.style.top = p.crossLX.style.left = THIS.pointerBorderWidth + 'px'; // slider p.sld.style.overflow = 'hidden'; p.sld.style.width = THIS.sliderSize + 'px'; p.sld.style.height = THIS.height + 'px'; // slider gradient p.sldGrad.draw(THIS.sliderSize, THIS.height, '#000', '#000'); // slider border p.sldB.style.display = displaySlider ? 'block' : 'none'; p.sldB.style.position = 'absolute'; p.sldB.style.right = THIS.padding + 'px'; p.sldB.style.top = THIS.padding + 'px'; p.sldB.style.border = THIS.insetWidth + 'px solid'; p.sldB.style.borderColor = THIS.insetColor; // slider mouse area p.sldM._jscInstance = THIS; p.sldM._jscControlName = 'sld'; p.sldM.style.display = displaySlider ? 'block' : 'none'; p.sldM.style.position = 'absolute'; p.sldM.style.right = '0'; p.sldM.style.top = '0'; p.sldM.style.width = (THIS.sliderSize + padToSliderPadding / 2 + THIS.padding + 2 * THIS.insetWidth) + 'px'; p.sldM.style.height = dims[1] + 'px'; p.sldM.style.cursor = 'default'; // slider pointer inner and outer border p.sldPtrIB.style.border = p.sldPtrOB.style.border = THIS.pointerBorderWidth + 'px solid ' + THIS.pointerBorderColor; // slider pointer outer border p.sldPtrOB.style.position = 'absolute'; p.sldPtrOB.style.left = -(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px'; p.sldPtrOB.style.top = '0'; // slider pointer middle border p.sldPtrMB.style.border = THIS.pointerThickness + 'px solid ' + THIS.pointerColor; // slider pointer spacer p.sldPtrS.style.width = THIS.sliderSize + 'px'; p.sldPtrS.style.height = sliderPtrSpace + 'px'; // the Close button function setBtnBorder () { var insetColors = THIS.insetColor.split(/\s+/); var outsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1]; p.btn.style.borderColor = outsetColor; } p.btn.style.display = THIS.closable ? 'block' : 'none'; p.btn.style.position = 'absolute'; p.btn.style.left = THIS.padding + 'px'; p.btn.style.bottom = THIS.padding + 'px'; p.btn.style.padding = '0 15px'; p.btn.style.height = THIS.buttonHeight + 'px'; p.btn.style.border = THIS.insetWidth + 'px solid'; setBtnBorder(); p.btn.style.color = THIS.buttonColor; p.btn.style.font = '12px sans-serif'; p.btn.style.textAlign = 'center'; try { p.btn.style.cursor = 'pointer'; } catch(eOldIE) { p.btn.style.cursor = 'hand'; } p.btn.onmousedown = function () { THIS.hide(); }; p.btnT.style.lineHeight = THIS.buttonHeight + 'px'; p.btnT.innerHTML = ''; p.btnT.appendChild(document.createTextNode(THIS.closeText)); // place pointers redrawPad(); redrawSld(); // If we are changing the owner without first closing the picker, // make sure to first deal with the old owner if (jsc.picker.owner && jsc.picker.owner !== THIS) { jsc.unsetClass(jsc.picker.owner.targetElement, THIS.activeClass); } // Set the new picker owner jsc.picker.owner = THIS; // The redrawPosition() method needs picker.owner to be set, that's why we call it here, // after setting the owner if (jsc.isElementType(container, 'body')) { jsc.redrawPosition(); } else { jsc._drawPosition(THIS, 0, 0, 'relative', false); } if (p.wrap.parentNode != container) { container.appendChild(p.wrap); } jsc.setClass(THIS.targetElement, THIS.activeClass); } function redrawPad () { // redraw the pad pointer switch (jsc.getPadYComponent(THIS)) { case 's': var yComponent = 1; break; case 'v': var yComponent = 2; break; } var x = Math.round((THIS.hsv[0] / 360) * (THIS.width - 1)); var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1)); var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize); var ofs = -Math.floor(crossOuterSize / 2); jsc.picker.cross.style.left = (x + ofs) + 'px'; jsc.picker.cross.style.top = (y + ofs) + 'px'; // redraw the slider switch (jsc.getSliderComponent(THIS)) { case 's': var rgb1 = HSV_RGB(THIS.hsv[0], 100, THIS.hsv[2]); var rgb2 = HSV_RGB(THIS.hsv[0], 0, THIS.hsv[2]); var color1 = 'rgb(' + Math.round(rgb1[0]) + ',' + Math.round(rgb1[1]) + ',' + Math.round(rgb1[2]) + ')'; var color2 = 'rgb(' + Math.round(rgb2[0]) + ',' + Math.round(rgb2[1]) + ',' + Math.round(rgb2[2]) + ')'; jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2); break; case 'v': var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 100); var color1 = 'rgb(' + Math.round(rgb[0]) + ',' + Math.round(rgb[1]) + ',' + Math.round(rgb[2]) + ')'; var color2 = '#000'; jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2); break; } } function redrawSld () { var sldComponent = jsc.getSliderComponent(THIS); if (sldComponent) { // redraw the slider pointer switch (sldComponent) { case 's': var yComponent = 1; break; case 'v': var yComponent = 2; break; } var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1)); jsc.picker.sldPtrOB.style.top = (y - (2 * THIS.pointerBorderWidth + THIS.pointerThickness) - Math.floor(sliderPtrSpace / 2)) + 'px'; } } function isPickerOwner () { return jsc.picker && jsc.picker.owner === THIS; } function blurValue () { THIS.importColor(); } // Find the target element if (typeof targetElement === 'string') { var id = targetElement; var elm = document.getElementById(id); if (elm) { this.targetElement = elm; } else { jsc.warn('Could not find target element with ID \'' + id + '\''); } } else if (targetElement) { this.targetElement = targetElement; } else { jsc.warn('Invalid target element: \'' + targetElement + '\''); } if (this.targetElement._jscLinkedInstance) { jsc.warn('Cannot link jscolor twice to the same element. Skipping.'); return; } this.targetElement._jscLinkedInstance = this; // Find the value element this.valueElement = jsc.fetchElement(this.valueElement); // Find the style element this.styleElement = jsc.fetchElement(this.styleElement); var THIS = this; var container = this.container ? jsc.fetchElement(this.container) : document.getElementsByTagName('body')[0]; var sliderPtrSpace = 3; // px // For BUTTON elements it's important to stop them from sending the form when clicked // (e.g. in Safari) if (jsc.isElementType(this.targetElement, 'button')) { if (this.targetElement.onclick) { var origCallback = this.targetElement.onclick; this.targetElement.onclick = function (evt) { origCallback.call(this, evt); return false; }; } else { this.targetElement.onclick = function () { return false; }; } } /* var elm = this.targetElement; do { // If the target element or one of its offsetParents has fixed position, // then use fixed positioning instead // // Note: In Firefox, getComputedStyle returns null in a hidden iframe, // that's why we need to check if the returned style object is non-empty var currStyle = jsc.getStyle(elm); if (currStyle && currStyle.position.toLowerCase() === 'fixed') { this.fixed = true; } if (elm !== this.targetElement) { // attach onParentScroll so that we can recompute the picker position // when one of the offsetParents is scrolled if (!elm._jscEventsAttached) { jsc.attachEvent(elm, 'scroll', jsc.onParentScroll); elm._jscEventsAttached = true; } } } while ((elm = elm.offsetParent) && !jsc.isElementType(elm, 'body')); */ // valueElement if (this.valueElement) { if (jsc.isElementType(this.valueElement, 'input')) { var updateField = function () { THIS.fromString(THIS.valueElement.value, jsc.leaveValue); jsc.dispatchFineChange(THIS); }; jsc.attachEvent(this.valueElement, 'keyup', updateField); jsc.attachEvent(this.valueElement, 'input', updateField); jsc.attachEvent(this.valueElement, 'blur', blurValue); this.valueElement.setAttribute('autocomplete', 'off'); } } // styleElement if (this.styleElement) { this.styleElement._jscOrigStyle = { backgroundImage : this.styleElement.style.backgroundImage, backgroundColor : this.styleElement.style.backgroundColor, color : this.styleElement.style.color }; } if (this.value) { // Try to set the color from the .value option and if unsuccessful, // export the current color this.fromString(this.value) || this.exportColor(); } else { //this.importColor(); } } }; //================================ // Public properties and methods //================================ // By default, search for all elements with class="jscolor" and install a color picker on them. // // You can change what class name will be looked for by setting the property jscolor.lookupClass // anywhere in your HTML document. To completely disable the automatic lookup, set it to null. // jsc.jscolor.lookupClass = 'jscolor'; jsc.jscolor.installByClassName = function (className) { var inputElms = document.getElementsByTagName('input'); var buttonElms = document.getElementsByTagName('button'); jsc.tryInstallOnElements(inputElms, className); jsc.tryInstallOnElements(buttonElms, className); }; jsc.register(); return jsc.jscolor; })(); }
czechmate777/FullPicker
jscolor.js
JavaScript
mit
53,731
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end require_relative 'helper' require 'configparser' require_relative '../lib/passivedns/client/cli.rb' class TestCLI < Minitest::Test def test_letter_map letter_map = PassiveDNS::CLI.get_letter_map assert_equal("3bcdmprtv", letter_map.keys.sort.join("")) end def test_help_text helptext = PassiveDNS::CLI.run(["--help"]) helptext.gsub!(/Usage: .*?\[/, "Usage: [") assert_equal( "Usage: [-d [3bcdmprtv]] [-g|-v|-m|-c|-x|-y|-j|-t] [-os <sep>] [-f <file>] [-r#|-w#|-v] [-l <count>] <ip|domain|cidr> Passive DNS Providers -d3bcdmprtv uses all of the available passive dns database -d3 use 360.cn -db use BFK.de -dc use CIRCL -dd use DNSDB -dm use Mnemonic -dp use PassiveTotal -dr use RiskIQ -dt use TCPIPUtils -dv use VirusTotal -dvt uses VirusTotal and TCPIPUtils (for example) Output Formatting -g link-nodal GDF visualization definition -z link-nodal graphviz visualization definition -m link-nodal graphml visualization definition -c CSV -x XML -y YAML -j JSON -t ASCII text (default) -s <sep> specifies a field separator for text output, default is tab State and Recursion -f[file] specifies a sqlite3 database used to read the current state - useful for large result sets and generating graphs of previous runs. -r# specifies the levels of recursion to pull. **WARNING** This is quite taxing on the pDNS servers, so use judiciously (never more than 3 or so) or find yourself blocked! -w# specifies the amount of time to wait, in seconds, between queries (Default: 0) -l <count> limits the number of records returned per passive dns database queried. Getting Help -h hello there. This option produces this helpful help information on how to access help. -v debugging information ", helptext) end def test_provider_parsing options_target = { :pdnsdbs => ["bfk"], :format => "text", :sep => "\t", :recursedepth => 1, :wait => 0, :res => nil, :debug => false, :sqlitedb => nil, :limit => nil, :help => false } options, items = PassiveDNS::CLI.parse_command_line([]) assert_equal(options_target, options) assert_equal([], items) options_target[:pdnsdbs] = ["cn360"] options, items = PassiveDNS::CLI.parse_command_line(["-d3"]) assert_equal(options_target, options) assert_equal([], items) options_target[:pdnsdbs] = ["bfk"] options, items = PassiveDNS::CLI.parse_command_line(["-db"]) assert_equal(options_target, options) assert_equal([], items) options_target[:pdnsdbs] = ["circl", "dnsdb", "mnemonic", "riskiq"] options, items = PassiveDNS::CLI.parse_command_line(["-dcdmr"]) assert_equal(options_target, options) assert_equal([], items) options_target[:pdnsdbs] = ["passivetotal", "tcpiputils", "virustotal"] options, items = PassiveDNS::CLI.parse_command_line(["-dptv"]) assert_equal(options_target, options) assert_equal([], items) end def test_output_parsing options_target = { :pdnsdbs => ["passivetotal", "tcpiputils", "virustotal"], :format => "text", :sep => "\t", :recursedepth => 1, :wait => 0, :res => nil, :debug => false, :sqlitedb => nil, :limit => nil, :help => false } options_target[:sep] = "," options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-c", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:sep] = "|" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-s", "|", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:sep] = "\t" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-t", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:format] = "json" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-j", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:format] = "xml" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-x", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:format] = "yaml" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-y", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:format] = "gdf" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-g", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:format] = "graphviz" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-z", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:format] = "graphml" options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-m", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:format] = "text" end def test_help_debug_parsing options_target = { :pdnsdbs => ["passivetotal", "tcpiputils", "virustotal"], :format => "text", :sep => "\t", :recursedepth => 1, :wait => 0, :res => nil, :debug => false, :sqlitedb => nil, :limit => nil, :help => true } options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-h", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) options_target[:debug] = true options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-h", "-v", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) end def test_state_recursion_parsing options_target = { :pdnsdbs => ["passivetotal", "tcpiputils", "virustotal"], :format => "text", :sep => "\t", :recursedepth => 5, :wait => 30, :res => nil, :debug => false, :sqlitedb => "test.db", :limit => 10, :help => false } options, items = PassiveDNS::CLI.parse_command_line(["-dptv", "-f", "test.db", "-r", "5", "-w", "30", "-l", "10", "8.8.8.8"]) assert_equal(options_target, options) assert_equal(["8.8.8.8"], items) end end
SYNchroACK/passivedns-client
test/test_cli.rb
Ruby
mit
6,624
<?php namespace AppBundle\DataFixtures\ORM; use Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use AppBundle\Entity\Game; use AppBundle\Entity\ContentRating; class Load_Game_ContentRating extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface { /** * @var ContainerInterface */ private $container; public function setContainer(ContainerInterface $container = null) { $this->container = $container; } public function getOrder() { // the order in which fixtures will be loaded // the lower the number, the sooner that this fixture is loaded return 9; } public function load(ObjectManager $manager) { $manager = $this->container->get('doctrine')->getEntityManager('default'); $manager->getConnection()->getConfiguration()->setSQLLogger(null); $import = $this->container->get('AppBundle.importcsv'); $fileContent = $import->CSV_to_array('game_contentRating.csv'); $batchSize = 20; $i = 1; foreach ($fileContent as $numRow => $row) { if ($numRow != 1) { $i = $i + 1; $entity = new Game(); $entity = $this->getReference("Game_" . $row[0]); $entity3 = $this->getReference("ContentRating_" . $row[2]); $entity->addContentRating($entity3); $manager->persist($entity); if (($i % $batchSize) === 0) { $manager->flush(); $manager->clear(); // Detaches all objects from Doctrine! } } } $manager->flush(); //Persist objects that did not make up an entire batch $manager->clear(); } }
Ilikebunny/openGameDB
src/AppBundle/DataFixtures/ORM/Load_Game_ContentRating.php
PHP
mit
2,046
scene_spec = [ (:fill, Any, nothing), (:fillOpacity, Any, nothing), (:stroke, Any, nothing), (:strokeOpacity, Any, nothing), (:strokeWidth, Any, nothing), (:strokeDash, Any, nothing), (:strokeDashOffset, Any, nothing), ] primitivefactory(:VegaScene, scene_spec)
JuliaPackageMirrors/Vega.jl
src/primitives/scene.jl
Julia
mit
291
namespace NativeBrowsers.Services { public interface IDependencyService { T Get<T>() where T : class; } }
davidbritch/xamarin-forms
NativeBrowsers/NativeBrowsers/Services/IDependencyService.cs
C#
mit
129
<?php require_once("connection/conn.php"); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); session_start(); $erro = false; //verifica se houve input de dados no formulario de login if (isset($_POST['username'])) { # caso exista input de dados, verifica o login //prevent to mysql injection $username = mysqli_real_escape_string($link, $_POST['username']); $password = $_POST['password']; $query = "SELECT * FROM tbl_users WHERE email_address = '$username' AND password = '$password'"; $result = mysqli_query($link,$query); if (mysqli_num_rows($result) == 1) { // get data from the user logged in /* fetch associative array */ while ($row = mysqli_fetch_object($result)) { //save data in sessions variables $_SESSION['firstname'] = $row->first_name; $_SESSION['lastname'] = utf8_decode($row->last_name); $_SESSION['iduser'] = $row->id_user; $_SESSION['tipouser'] = $row->tbl_tipo_users_id_tipo_user; $_SESSION['fullname'] = $_SESSION['firstname']." ".$_SESSION['lastname']; $_SESSION['fotouser'] = $row->photo_profile_name; header('Location: starter.php'); // echo $_SESSION['fullname']; } //Pass - validou e envia para o dashboard } else { //Fail $erro = true; // $error = "houve um erro na sua autenticação"; //echo $error; } } // else{ // #indicar que nao houve input de dados // echo "nao existem dados para validar."; // } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Realbase Qualidade | Entrar</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <!-- Bootstrap 3.3.5 --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <!-- Font Awesome --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <!-- Ionicons --> <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <!-- Theme style --> <link rel="stylesheet" href="dist/css/AdminLTE.min.css"> <!-- iCheck --> <link rel="stylesheet" href="plugins/iCheck/square/blue.css"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body class="hold-transition login-page"> <div class="login-box"> <div class="login-logo"> <a href="index.php"><b>Portal</b>Realbase</a> </div><!-- /.login-logo --> <div class="login-box-body"> <p class="login-box-msg">Inicie sessão com os seus dados de acesso</p> <form action="index.php" method="post"> <div class="form-group has-feedback"> <input type="email" class="form-control" name="username" placeholder="Email"> <span class="glyphicon glyphicon-envelope form-control-feedback"></span> </div> <div class="form-group has-feedback"> <input type="password" name="password" class="form-control" placeholder="Password"> <span class="glyphicon glyphicon-lock form-control-feedback"></span> </div> <div class="row"> <div class="col-xs-8"> <div class="checkbox icheck"> <label> <input type="checkbox"> Lembrar-me </label> </div> </div><!-- /.col --> <div class="col-xs-4"> <button type="submit" class="btn btn-primary btn-block btn-flat">Entrar</button> </div><!-- /.col --> </div> </form> <!-- <div class="social-auth-links text-center"> <p>- OR -</p> <a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-facebook"></i> Sign in using Facebook</a> <a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-google-plus"></i> Sign in using Google+</a> </div> --><!-- /.social-auth-links --> <?php if ($erro){ ?><div class="alert alert-danger alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <h4><i class="icon fa fa-ban"></i> Erro</h4> Os dados introduzidos estão incorrectos. </div> <?php } ?> <center>Caso não consiga aceder, por favor entre em contacto com o <a href="mailto:[email protected]">Suporte Realbase.</a></center> <!-- <a href="" class="text-center">caso não consiga aceder, por favor contacte o suporte Realbase</a> --> </div><!-- /.login-box-body --> </div><!-- /.login-box --> <!-- jQuery 2.1.4 --> <script src="plugins/jQuery/jQuery-2.1.4.min.js"></script> <!-- Bootstrap 3.3.5 --> <script src="bootstrap/js/bootstrap.min.js"></script> <!-- iCheck --> <script src="plugins/iCheck/icheck.min.js"></script> <script> $(function () { $('input').iCheck({ checkboxClass: 'icheckbox_square-blue', radioClass: 'iradio_square-blue', increaseArea: '20%' // optional }); }); </script> </body> </html>
luisalmeidarealbase/prbgit
index.php
PHP
mit
5,771
require 'spec_helper' describe Brainstem::Presenter do describe "class behavior" do describe "implicit namespacing" do module V1 class SomePresenter < Brainstem::Presenter end end it "uses the closest module name as the presenter namespace" do V1::SomePresenter.presents String expect(Brainstem.presenter_collection('v1').for(String)).to be_a(V1::SomePresenter) expect(V1::SomePresenter.namespace).to eq 'v1' end it "does not map namespaced presenters into the default namespace" do V1::SomePresenter.presents String expect(Brainstem.presenter_collection.for(String)).to be_nil end end describe '.presents' do let!(:presenter_class) { Class.new(Brainstem::Presenter) } it 'records itself as the presenter for the given class' do presenter_class.presents String expect(Brainstem.presenter_collection.for(String)).to be_a(presenter_class) end it 'records itself as the presenter for the given classes' do presenter_class.presents String, Array expect(Brainstem.presenter_collection.for(String)).to be_a(presenter_class) expect(Brainstem.presenter_collection.for(Array)).to be_a(presenter_class) end it 'can be called more than once' do presenter_class.presents String presenter_class.presents Array expect(Brainstem.presenter_collection.for(String)).to be_a(presenter_class) expect(Brainstem.presenter_collection.for(Array)).to be_a(presenter_class) end it 'returns the set of presented classes' do expect(presenter_class.presents(String)).to eq([String]) expect(presenter_class.presents(Array)).to eq([String, Array]) expect(presenter_class.presents).to eq([String, Array]) end it 'removes duplicates when called more then once' do expect(presenter_class.presents(Array)).to eq([Array]) expect(presenter_class.presents(Array, Array)).to eq([Array]) end it 'should not be inherited' do presenter_class.presents(String) expect(presenter_class.presents).to eq [String] subclass = Class.new(presenter_class) expect(subclass.presents).to eq [] subclass.presents(Array) expect(subclass.presents).to eq [Array] expect(presenter_class.presents).to eq [String] end it 'raises an error when given a string' do expect(lambda { presenter_class.presents 'Array' }).to raise_error(/Brainstem Presenter#presents now expects a Class instead of a class name/) end end describe ".possible_brainstem_keys" do let(:presented_class) { Class.new } let(:other_presented_class) { Class.new } let(:presenter_class) { Class.new(Brainstem::Presenter) } before do presenter_class.presents presented_class, other_presented_class end context "when has brainstem key" do before do presenter_class.brainstem_key "presented_class" end it "returns the set of only its brainstem key" do expect(presenter_class.possible_brainstem_keys.to_a).to eq ["presented_class"] end end context "when has no brainstem key" do before do stub(presented_class).table_name { "t1" } stub(other_presented_class).table_name { "t2" } end it "returns the set of keys of its presented classes" do expect(presenter_class.possible_brainstem_keys.to_a.sort).to eq ["t1", "t2"] end end end describe '#evaluate_count?' do it 'is true when configuration has an evaluator' do my_class = Class.new(Brainstem::Presenter) my_class.count_evaluator { |_| 3 } expect(my_class.new.evaluate_count?).to eq true end it 'is false when there is no evaluator' do my_class = Class.new(Brainstem::Presenter) expect(my_class.new.evaluate_count?).to eq false end end describe "#evaluate_count" do module CountHelper def count 4 end end it 'evaluates in the context of a helper' do my_class = Class.new(Brainstem::Presenter) my_class.count_evaluator { |_| count } my_class.helper CountHelper expect(my_class.new.evaluate_count(0)).to eq 4 end it 'evaluates without any helper' do my_class = Class.new(Brainstem::Presenter) my_class.count_evaluator { |count_scope| count_scope.count } count_scope = OpenStruct.new(count: 42) expect(my_class.new.evaluate_count(count_scope)).to eq 42 end end end describe "#group_present" do let(:presenter_class) do Class.new(Brainstem::Presenter) do presents Workspace helper do def helper_method(model) Task.where(:workspace_id => model.id)[0..1] end end fields do field :updated_at, :datetime end associations do association :tasks, Task association :user, User association :missing_user, User association :something, User, via: :user association :lead_user, User association :lead_user_with_lambda, User, dynamic: lambda { |model| model.user } association :tasks_with_lambda, Task, dynamic: lambda { |model| Task.where(:workspace_id => model.id) } association :tasks_with_helper_lambda, Task, dynamic: lambda { |model| helper_method(model) } association :tasks_with_lookup, Task, lookup: lambda { |models| Task.where(workspace_id: models.map(&:id)).group_by { |task| task.workspace_id } } association :tasks_with_lookup_fetch, Task, lookup: lambda { |models| Task.where(workspace_id: models.map(&:id)).group_by { |task| task.workspace_id } }, lookup_fetch: lambda { |lookup, model| lookup[model.id] } association :synthetic, :polymorphic end end end let(:workspace) { Workspace.find_by_title("bob workspace 1") } let(:presenter) { presenter_class.new } describe "the field DSL" do let(:presenter_class) { Class.new(WorkspacePresenter) } let(:presenter) { presenter_class.new } let(:model) { Workspace.find(1) } it 'calls named methods' do expect(presenter.group_present([model]).first['title']).to eq model.title end it 'can call methods with :via' do presenter.configuration[:fields][:title].options[:via] = :description expect(presenter.group_present([model]).first['title']).to eq model.description end it 'can call a dynamic lambda' do expect(presenter.group_present([model]).first['dynamic_title']).to eq "title: #{model.title}" end it 'can call a lookup lambda' do expect(presenter.group_present([model]).first['lookup_title']).to eq "lookup_title: #{model.title}" end it 'can call a lookup_fetch lambda' do expect(presenter.group_present([model]).first['lookup_fetch_title']).to eq "lookup_fetch_title: #{model.title}" end it 'handles nesting' do expect(presenter.group_present([model]).first['permissions']['access_level']).to eq 2 end describe 'handling of conditional fields' do it 'does not return conditional fields when their :if conditionals do not match' do expect(presenter.group_present([model]).first['secret']).to be_nil expect(presenter.group_present([model]).first['bob_title']).to be_nil end it 'returns conditional fields when their :if matches' do model.title = 'hello' expect(presenter.group_present([model]).first['hello_title']).to eq 'title is hello' end it 'returns fields with the :if option only when all of the conditionals in that :if are true' do model.title = 'hello' presenter.class.helper do def current_user 'not bob' end end expect(presenter.group_present([model]).first['secret']).to be_nil presenter.class.helper do def current_user 'bob' end end expect(presenter.group_present([model]).first['secret']).to eq model.secret_info end describe "caching of conditional evaluations" do it 'only runs model conditionals once per model' do model_id_call_count = { 1 => 0, 2 => 0 } presenter_class.conditionals do model :model_id_is_two, lambda { |model| model_id_call_count[model.id] += 1; model.id == 2 } end presenter_class.fields do field :only_on_model_two, :string, dynamic: lambda { "some value" }, if: :model_id_is_two field :another_only_on_model_two, :string, dynamic: lambda { "some value" }, if: :model_id_is_two end results = presenter.group_present([Workspace.find(1), Workspace.find(2)]) expect(results.first['only_on_model_two']).not_to be_present expect(results.last['only_on_model_two']).to be_present expect(results.first['another_only_on_model_two']).not_to be_present expect(results.last['another_only_on_model_two']).to be_present expect(results.first['id']).to eq '1' expect(results.last['id']).to eq '2' expect(model_id_call_count).to eq({ 1 => 1, 2 => 1 }) end it 'only runs request conditionals once per request' do call_count = 0 presenter_class.conditionals do request :new_request_conditional, lambda { call_count += 1 } end presenter_class.fields do field :new_field, :string, dynamic: lambda { "new_field value" }, if: :new_request_conditional field :new_field2, :string, dynamic: lambda { "new_field2 value" }, if: :new_request_conditional end presenter.group_present([Workspace.find(1), Workspace.find(2)]) expect(call_count).to eq 1 end end end describe 'helpers in dynamic fields' do let(:presenter_class) do Class.new(Brainstem::Presenter) do helper do def counter @count ||= 0 @count += 1 end end fields do field :memoized_helper_value1, :integer, dynamic: lambda { |model| counter } field :memoized_helper_value2, :integer, dynamic: lambda { |model| counter } field :memoized_helper_value3, :integer, dynamic: lambda { |model| counter } field :memoized_helper_value4, :integer, dynamic: lambda { |model| counter } end end end let(:presenter) { presenter_class.new } it 'shares the helper instance across fields, but not across instances' do fields = presenter.group_present([model, model]) expect(fields[0].slice(*%w[memoized_helper_value1 memoized_helper_value2 memoized_helper_value3 memoized_helper_value4]).values).to match_array [1, 2, 3, 4] expect(fields[1].slice(*%w[memoized_helper_value1 memoized_helper_value2 memoized_helper_value3 memoized_helper_value4]).values).to match_array [1, 2, 3, 4] end end describe 'handling of optional fields' do it 'does not include optional fields by default' do expect(presenter.group_present([model]).first).not_to have_key('expensive_title') end it 'includes optional fields when explicitly requested' do presented_workspace = presenter.group_present([model], [], optional_fields: ['expensive_title', 'expensive_title2']).first expect(presented_workspace).to have_key('expensive_title') expect(presented_workspace).to have_key('expensive_title2') expect(presented_workspace).not_to have_key('expensive_title3') end context 'handling of conditional' do it 'does not include field when condition is not met' do model.title = 'Not hello' presented_workspace = presenter.group_present([model], [], optional_fields: ['conditional_expensive_title']).first expect(presented_workspace).not_to have_key('conditional_expensive_title') end it 'includes field when condition is met' do model.title = 'hello' presented_workspace = presenter.group_present([model], [], optional_fields: ['conditional_expensive_title']).first expect(presented_workspace).to have_key('conditional_expensive_title') end end end describe 'handling nested hash block fields' do let(:presenter_class) do Class.new(Brainstem::Presenter) do presents Workspace helper do def current_user 'jane' end end conditionals do request :user_is_bob, lambda { current_user == 'bob' }, info: 'visible only to bob' end fields do fields :participant, :hash, via: :lead_user, if: :user_is_bob do field :username, :string end fields :lead_user do field :username, :string, dynamic: lambda { |workspace| workspace.lead_user.username } end end end end let(:presenter) { presenter_class.new } before do stub.any_instance_of(Brainstem::DSL::Field).presentable?(model, anything) { presentable } end context 'when field is presentable' do let(:presentable) { true } it 'includes the executable hash block field' do presented_workspace = presenter.group_present([model], []).first expect(presented_workspace.keys).to include('participant') end it 'includes the non executable hash block field' do presented_workspace = presenter.group_present([model], []).first expect(presented_workspace.keys).to include('lead_user') end end context 'when field is not presentable' do let(:presentable) { false } it 'does not include executable hash block fields' do presented_workspace = presenter.group_present([model], []).first expect(presented_workspace.keys).to_not include('participant') end it 'always includes non-executable hash block fields' do presented_workspace = presenter.group_present([model], []).first expect(presented_workspace.keys).to include('lead_user') end end end describe 'handling of nested array fields' do let(:array_values) { [OpenStruct.new(name: 1), OpenStruct.new(name: 2)] } let(:presenter_class) do Class.new(Brainstem::Presenter) do presents Workspace fields do fields :participants, :array, via: :members do field :username, :string end fields :accessible_by, :array, dynamic: -> { [OpenStruct.new(name: 1), OpenStruct.new(name: 2)] } do field :name, :string field :full_name, :string, via: :name field :formatted_name, :string, dynamic: -> (model) { model.name * 2 } end end end end let(:presenter) { presenter_class.new } context 'when dynamic option is specified' do def extract_values(fields, field_name, nested_field_name) fields[field_name].map { |data| data[nested_field_name] } end it 'calls named methods' do fields = presenter.group_present([model]).first expect(fields).to have_key('accessible_by') expect(extract_values(fields, 'accessible_by', 'name')).to eq([1, 2]) end it 'can call methods with :via' do fields = presenter.group_present([model]).first expect(fields).to have_key('accessible_by') expect(extract_values(fields, 'accessible_by', 'full_name')).to eq([1, 2]) end it 'can call a dynamic lambda' do fields = presenter.group_present([model]).first expect(fields).to have_key('accessible_by') expect(extract_values(fields, 'accessible_by', 'formatted_name')).to eq([2, 4]) end end context 'when via option is specified' do let(:participants) { [model.user] } let(:presented_field_data) { participants.map { |user| { 'username' => user.username } } } it 'returns an array of hashes with the specified field' do fields = presenter.group_present([model]).first expect(fields).to have_key('participants') expect(fields['participants']).to eq(presented_field_data) end end describe 'when nested fields specify not using the parent value' do let(:presenter_class) do Class.new(Brainstem::Presenter) do presents Workspace fields do fields :tasks, :array, via: :tasks do field :name, :string field :secret, :string, info: 'a secret, via secret_info', via: :secret_info, use_parent_value: false end end end end let(:tasks) { Task.where(workspace_id: model.id).order(:id).to_a } let(:presented_field_data) { tasks.map { |task| { 'name' => task.name, 'secret' => model.secret_info } } } it 'returns an array of hashes while using the correct model to evaluate the properties' do fields = presenter.group_present([model]).first expect(fields).to have_key('tasks') expect(fields['tasks']).to eq(presented_field_data) end end describe 'handling of conditional fields' do let(:presenter_class) do Class.new(Brainstem::Presenter) do presents Workspace helper do def current_user 'jane' end end conditionals do model :title_is_hello, lambda { |model| model.title == 'hello' }, info: 'visible when the title is hello' request :user_is_bob, lambda { current_user == 'bob' }, info: 'visible only to bob' end fields do with_options if: :user_is_bob do fields :tasks, :array, dynamic: lambda { |workspace| workspace.tasks.to_a } do field :name, :string end end fields :members, :array, via: :members, if: :title_is_hello do field :hello_title, :string, info: 'the title, when hello', dynamic: lambda { 'title is hello' } field :foo, :string, info: 'a secret, via secret_info', dynamic: lambda { 'foo' }, if: [:user_is_bob] end end end end it 'does not return conditional fields when their :if conditionals do not match' do fields = presenter.group_present([model]).first expect(fields).to_not have_key('tasks') expect(fields).to_not have_key('members') end it 'returns conditional fields when their :if matches' do model.title = 'hello' fields = presenter.group_present([model]).first expect(fields).to_not have_key('tasks') expect(fields).to have_key('members') expect(fields['members'][0]).to_not have_key('foo') expect(fields['members'][0]['hello_title']).to eq 'title is hello' end it 'returns fields with the :if option only when all of the conditionals in that :if are true' do model.title = 'hello' presenter.class.helper do def current_user 'bob' end end fields = presenter.group_present([model]).first expect(fields).to have_key('tasks') expect(fields).to have_key('members') expect(fields['members'][0]['foo']).to eq('foo') expect(fields['members'][0]['hello_title']).to eq('title is hello') end end end end describe "adding object ids as strings" do before do post_presenter = Class.new(Brainstem::Presenter) do presents Post fields do field :body, :string end end @presenter = post_presenter.new @post = Post.first end it "outputs the associated object's id and type" do data = @presenter.group_present([@post]).first expect(data['id']).to eq(@post.id.to_s) expect(data['body']).to eq(@post.body) end end describe "converting dates and times" do it "should convert all Time-and-date-like objects to iso8601" do presenter = Class.new(Brainstem::Presenter) do fields do field :time, :datetime, dynamic: lambda { Time.now } field :date, :date, dynamic: lambda { Date.new } fields :recursion do field :time, :datetime, dynamic: lambda { Time.now } field :something, :datetime, dynamic: lambda { [Time.now, :else] } field :foo, :string, dynamic: lambda { :bar } end end end iso8601_time = /\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}[-+]\d{2}:\d{2}/ iso8601_date = /\d{4}-\d{2}-\d{2}/ struct = presenter.new.group_present([Workspace.first]).first expect(struct['time']).to match(iso8601_time) expect(struct['date']).to match(iso8601_date) expect(struct['recursion']['time']).to match(iso8601_time) expect(struct['recursion']['something'].first).to match(iso8601_time) expect(struct['recursion']['something'].last).to eq(:else) expect(struct['recursion']['foo']).to eq(:bar) end end describe "outputting associations" do it "should not convert or return non-included associations, but should return <association>_id for belongs_to relationships, plus all fields" do json = presenter.group_present([workspace], []).first expect(json.keys).to match_array %w[id updated_at something_id user_id] end it "should convert requested has_many associations (includes) into the <association>_ids format" do expect(workspace.tasks.length).to be > 0 expect(presenter.group_present([workspace], ['tasks']).first['task_ids']).to match_array(workspace.tasks.map(&:id).map(&:to_s)) end it "should ignore unknown associations" do result = presenter.group_present(Workspace.all.to_a, ['tasks', 'unknown']) expect(result.length).to eq Workspace.count expect(result.last['task_ids']).to eq Workspace.last.tasks.pluck(:id).map(&:to_s) end it "should allow has_many associations to work on groups of models" do result = presenter.group_present(Workspace.all.to_a, ['tasks']) expect(result.length).to eq Workspace.count first_workspace_tasks = Workspace.first.tasks.pluck(:id).map(&:to_s) last_workspace_tasks = Workspace.last.tasks.pluck(:id).map(&:to_s) expect(last_workspace_tasks.length).to eq 1 expect(result.last['task_ids']).to eq last_workspace_tasks expect(result.first['task_ids']).to eq first_workspace_tasks end it "should convert requested belongs_to and has_one associations into the <association>_id format when requested" do expect(presenter.group_present([workspace], ['user']).first['user_id']).to eq(workspace.user.id.to_s) end it "should convert requested belongs_to and has_one associations into the <association>_id format when requested, even if they're not found" do expect(presenter.group_present([workspace], ['missing_user']).first).to have_key('missing_user_id') expect(presenter.group_present([workspace], ['missing_user']).first['missing_user_id']).to eq(nil) end it "converts non-association models into <model>_id format when they are requested" do expect(presenter.group_present([workspace], ['lead_user']).first['lead_user_id']).to eq(workspace.lead_user.id.to_s) end it "handles associations provided with lambdas" do expect(presenter.group_present([workspace], ['lead_user_with_lambda']).first['lead_user_with_lambda_id']).to eq(workspace.lead_user.id.to_s) expect(presenter.group_present([workspace], ['tasks_with_lambda']).first['tasks_with_lambda_ids']).to eq(workspace.tasks.map(&:id).map(&:to_s)) end it "handles associations provided with a lookup" do expect(presenter.group_present([workspace], ['tasks_with_lookup']).first['tasks_with_lookup_ids']).to eq(workspace.tasks.map(&:id).map(&:to_s)) end it "handles associations provided with a lookup_fetch" do expect(presenter.group_present([workspace], ['tasks_with_lookup_fetch']).first['tasks_with_lookup_fetch_ids']).to eq(workspace.tasks.map(&:id).map(&:to_s)) end it "handles helpers method calls in association lambdas" do expect(presenter.group_present([workspace], ['tasks_with_helper_lambda']).first['tasks_with_helper_lambda_ids']).to eq(workspace.tasks.map(&:id).map(&:to_s)[0..1]) end it "should return <association>_id fields when the given association ids exist on the model whether it is requested or not" do expect(presenter.group_present([workspace], ['user']).first['user_id']).to eq(workspace.user_id.to_s) json = presenter.group_present([workspace], []).first expect(json.keys).to match_array %w[user_id something_id id updated_at] expect(json['user_id']).to eq(workspace.user_id.to_s) expect(json['something_id']).to eq(workspace.user_id.to_s) end it "should return null, not empty string when ids are missing" do workspace.user = nil workspace.tasks = [] expect(presenter.group_present([workspace], ['lead_user_with_lambda']).first['lead_user_with_lambda_id']).to eq(nil) expect(presenter.group_present([workspace], ['user']).first['user_id']).to eq(nil) expect(presenter.group_present([workspace], ['something']).first['something_id']).to eq(nil) expect(presenter.group_present([workspace], ['tasks']).first['task_ids']).to eq([]) end describe "polymorphic associations" do let(:some_presenter) do Class.new(Brainstem::Presenter) do presents Post fields do field :body, :string end associations do association :subject, :polymorphic association :another_subject, :polymorphic, via: :subject association :forced_model, Workspace, via: :subject association :things, :polymorphic end end end let(:presenter) { some_presenter.new } context "when asking for the association" do let(:presented_data) { presenter.group_present([post], %w[subject another_subject forced_model things]).first } context "when polymorphic association exists" do let(:post) { Post.find(1) } it "outputs the object as a hash with the id & class table name" do expect(presented_data['subject_ref']).to eq({ 'id' => post.subject.id.to_s, 'key' => 'workspaces' }) end it "outputs custom names for the object as a hash with the id & class table name" do expect(presented_data['another_subject_ref']).to eq({ 'id' => post.subject.id.to_s, 'key' => 'workspaces' }) end context "presenting a mixture of things" do it 'will return a *_refs array' do expect(presented_data['thing_refs']).to eq [ { 'id' => '1', 'key' => 'workspaces' }, { 'id' => '1', 'key' => 'posts' }, { 'id' => '1', 'key' => 'tasks' } ] end end context "for STI targets" do let(:post) { Post.create!(subject: Attachments::PostAttachment.first, user: User.first, body: '1 2 3') } it "uses the brainstem_key from the presenter" do expect(presented_data['subject_ref']).to eq({ 'id' => post.subject_id.to_s, 'key' => 'attachments' }) end it "uses the correct namespace when finding a presenter" do module V2 class NewPostPresenter < Brainstem::Presenter presents Post associations do association :subject, :polymorphic end end end expect { V2::NewPostPresenter.new.group_present([post], %w[subject]).first }.to raise_error(/Unable to find a presenter for class Attachments::PostAttachment/) end end it "skips the polymorphic handling when a model is given" do expect(presented_data['forced_model_id']).to eq(post.subject.id.to_s) expect(presented_data).not_to have_key('forced_model_type') expect(presented_data).not_to have_key('forced_model_ref') end describe "the legacy :always_return_ref_with_sti_base option" do before do some_presenter.associations do association :always_subject, :polymorphic, via: :subject, always_return_ref_with_sti_base: true end end let(:post) { Post.create!(subject: Attachments::PostAttachment.first, user: User.first, body: '1 2 3') } describe 'when the presenter can be found' do before do Class.new(Brainstem::Presenter) do presents Attachments::Base brainstem_key :foo end end it "always returns the *_ref object, even when not included" do expect(presented_data['always_subject_ref']).to eq({ 'id' => post.subject.id.to_s, 'key' => 'foo' }) end end # It tries to find the key based on the *_type value in the DB (which will be the STI base class, and may error if no presenter exists) describe 'when the presenter cannot be found' do it "raises an error" do expect { presented_data['always_subject_ref'] }.to raise_error(/Unable to find a presenter for class Attachments::Base/) end end end end context "when polymorphic association does not exist" do let(:post) { Post.find(3) } it "outputs nil" do expect(presented_data).to have_key('subject_ref') expect(presented_data['subject_ref']).to be_nil end it "outputs nil" do expect(presented_data).to have_key('another_subject_ref') expect(presented_data['another_subject_ref']).to be_nil end end end context "when not asking for the association" do let(:presented_data) { presenter.group_present([post]).first } let(:post) { Post.find(1) } it "does not include the reference" do expect(presented_data).to_not have_key('subject_ref') expect(presented_data).to_not have_key('another_subject_ref') end end end context "when the model has an <association>_id method but no column" do it "does not include the <association>_id field" do def workspace.synthetic_id raise "this explodes because it's not an association" end expect(presenter.group_present([workspace], []).first).not_to have_key('synthetic_id') end end end describe "preloading" do # # We have three strategies for introspecting what the AR Preloader # receives: # # 1. Actually looking at what AR receives. # # This is sub-optimal because AR works differently between versions # 3 and 4, so introspecting is difficult. # # 2. Looking at what the proc that encapsulates the AR methods is # called with. # # This is difficult to do because we don't control the instantiation # of the Preloader, which makes injecting this hard. # # 3. Intercept the instantiating parent function and append the # inspectable proc. # # This is probably the grossest of all the above options, and I # suspect it's the greatest indication that we're testing # inappropriately here -- a fact that I think bears weight given # we're making unit-level assertions in an integration spec. # However, there's also some value in asserting that these are # passed through without digging into Rails internals. However, # further 'purity' improvements could be made by introspecting on # AR's actual data structures. # # That's about three shades on the side of overkill, though. # def preloader_should_receive(hsh) preload_method = Object.new mock(preload_method).call(anything, anything) do |models, args| expect(args).to eq(hsh) end stub(Brainstem::Preloader).preload(anything, anything, anything) do |*args| args << preload_method Brainstem::Preloader.new(*args).call end end it "preloads associations when they are full model-level associations" do preloader_should_receive("tasks" => [], "user" => []) presenter.group_present(Workspace.order('id desc'), %w[tasks user lead_user tasks_with_lambda]) end it "includes any associations declared via the preload DSL directive" do preloader_should_receive("tasks" => [], "posts" => []) presenter_class.preload :posts presenter.group_present(Workspace.order('id desc'), %w[tasks lead_user tasks_with_lambda]) end it "includes any string associations declared via the preload DSL directive" do preloader_should_receive("tasks" => [], "user" => []) presenter_class.preload 'user' presenter.group_present(Workspace.order('id desc'), %w[tasks user lead_user tasks_with_lambda]) end it "includes any nested hash associations declared via the preload DSL directive" do preloader_should_receive("tasks" => [], "user" => [:workspaces], "posts" => ["subject", "user"]) presenter_class.preload :tasks, "user", "unknown", { "posts" => "subject", "foo" => "bar" },{ :user => :workspaces, "posts" => "user" } presenter.group_present(Workspace.order('id desc'), %w[tasks user lead_user tasks_with_lambda]) end end end describe "#extract_filters" do let(:presenter_class) { WorkspacePresenter } let(:presenter) { presenter_class.new } it 'returns only known filters' do presenter_class.filter :owned_by, :integer presenter_class.filter(:bar, :string) { |scope| scope } expect(presenter.extract_filters({ 'foo' => 'hi' })).to eq({}) expect(presenter.extract_filters({ 'owned_by' => '2' })).to eq({ 'owned_by' => '2' }) expect(presenter.extract_filters({ 'owned_by' => [2] })).to eq({ 'owned_by' => [2] }) expect(presenter.extract_filters({ 'owned_by' => { :ids => [2], 2 => [1] }})).to eq({ 'owned_by' => { :ids => [2], 2 => [1] }}) end it "converts 'true' and 'false' into true and false" do presenter_class.filter :owned_by, :boolean expect(presenter.extract_filters({ 'owned_by' => 'true' })).to eq({ 'owned_by' => true }) expect(presenter.extract_filters({ 'owned_by' => 'TRUE' })).to eq({ 'owned_by' => true }) expect(presenter.extract_filters({ 'owned_by' => 'false' })).to eq({ 'owned_by' => false }) expect(presenter.extract_filters({ 'owned_by' => 'FALSE' })).to eq({ 'owned_by' => false }) expect(presenter.extract_filters({ 'owned_by' => 'hi' })).to eq({ 'owned_by' => 'hi' }) end it 'defaults to applying default filters' do presenter_class.filter :owned_by, :integer, default: '2' expect(presenter.extract_filters({ 'owned_by' => '3' })).to eq({ 'owned_by' => '3' }) expect(presenter.extract_filters({})).to eq({ 'owned_by' => '2' }) end it 'will skip default filters when asked' do presenter_class.filter :owned_by, :integer, default: '2' expect(presenter.extract_filters({ 'owned_by' => '3' }, apply_default_filters: false)).to eq({ 'owned_by' => '3' }) expect(presenter.extract_filters({}, apply_default_filters: false)).to eq({}) end it 'ignores nil and blank values' do presenter_class.filter :owned_by, :integer expect(presenter.extract_filters({ 'owned_by' => nil })).to eq({}) expect(presenter.extract_filters({ 'owned_by' => '' })).to eq({}) end end describe "#apply_filters_to_scope" do let(:presenter_class) { WorkspacePresenter } let(:presenter) { presenter_class.new } let(:scope) { Workspace.where(nil) } let(:params) { { 'bar' => 'foo' } } let(:options) { { apply_default_filters: true } } before do presenter_class.filter :owned_by, :integer, default: '2' presenter_class.filter(:bar, :string) { |scope| scope.where(id: 6) } mock(presenter).extract_filters(params, options) { { 'bar' => 'foo', 'owned_by' => '2' } } end it 'extracts valid filters from the params' do presenter.apply_filters_to_scope(scope, params, options) end it 'runs lambdas in the scope of the helper instance' do expect(presenter.apply_filters_to_scope(scope, params, options).to_sql).to match(/id.\s*=\s*6/) end it 'sends symbols to the scope' do expect(presenter.apply_filters_to_scope(scope, params, options).to_sql).to match(/id.\s*=\s*2/) end end describe '#apply_ordering_to_scope' do let(:presenter_class) { WorkspacePresenter } let(:presenter) { presenter_class.new } let(:scope) { Workspace.where(nil) } it 'uses #calculate_sort_name_and_direction to extract a sort name and direction from user params' do presenter_class.sort_order :title, 'workspaces.title' mock(presenter).calculate_sort_name_and_direction('order' => 'title:desc') { ['title', 'desc'] } presenter.apply_ordering_to_scope(scope, 'order' => 'title:desc') end context 'when the sort is a proc' do it 'runs procs in the context of any helpers' do presenter_class.helper do def some_method end end direction = nil presenter_class.sort_order(:title) do |scope, d| some_method direction = d scope end presenter.apply_ordering_to_scope(scope, 'order' => 'title:asc') expect(direction).to eq 'asc' end it 'can chain multiple sorts together' do presenter_class.sort_order(:title) do |scope| scope.order('workspaces.title desc').order('workspaces.id desc') end sql = presenter.apply_ordering_to_scope(scope, 'order' => 'title').to_sql # match SQLite and MySQL quotes expect(sql).to match(/order by workspaces\.title desc, workspaces.id desc, [`"]workspaces[`"]\.[`"]id[`"] ASC/i) # this should be ok, since the first id sort will never have a tie end it 'chains the primary key onto the end' do presenter_class.sort_order(:title) do |scope| scope.order('workspaces.title desc') end sql = presenter.apply_ordering_to_scope(scope, 'order' => 'title').to_sql # match SQLite and MySQL quotes expect(sql).to match(/order by workspaces\.title desc, [`"]workspaces[`"]\.[`"]id[`"] ASC/i) end end context 'when the sort is not a proc' do before do presenter_class.sort_order :title, 'workspaces.title' presenter_class.sort_order :id, 'workspaces.id' end context 'and is a string' do let(:order) { { 'order' => 'title:asc' } } it 'applies the named ordering in the given direction and adds the primary key as a fallback sort' do sql = presenter.apply_ordering_to_scope(scope, order).to_sql # match SQLite and MySQL quotes expect(sql).to match(/ORDER BY workspaces\.title asc, [`"]workspaces[`"]\.[`"]id[`"] ASC/i) end context 'when sorting by associated models' do let(:scope) { Workspace.where(nil).joins(:tasks) } let(:order) { { 'order' => 'tasks:asc' } } before do presenter_class.sort_order :tasks, 'COALECE(tasks.name, tasks.created_at)' end it 'applies the named ordering in the given direction and adds the primary key as a fallback sort' do sql = presenter.apply_ordering_to_scope(scope, order).to_sql # match SQLite and MySQL quotes expect(sql).to match(/ORDER BY COALECE\(tasks\.name, tasks\.created_at\) asc, [`"]workspaces[`"]\.[`"]id[`"] ASC/i) end end end context 'and is a symbol' do let(:order) { { 'order' => :title } } it 'applies the named ordering in the given direction and adds the primary key as a fallback sort' do sql = presenter.apply_ordering_to_scope(scope, order).to_sql # match SQLite and MySQL quotes expect(sql).to match(/order by workspaces\.title asc, [`"]workspaces[`"]\.[`"]id[`"] ASC/i) end end end context 'when the sort is not present' do let(:order) { '' } it 'orders by the primary key' do sql = presenter.apply_ordering_to_scope(scope, order).to_sql # match SQLite and MySQL quotes expect(sql).to match(/order by [`"]workspaces[`"]\.[`"]id[`"] ASC/i) end end context 'when the table has no primary key' do let(:scope) { Cthulhu.where(nil) } let(:order) { { 'order' => 'updated_at:asc' } } before do class Cthulhu < Workspace self.primary_key = nil end presenter_class.sort_order :updated_at, 'workspaces.updated_at' end it 'does not add a fallback deterministic sort, and you deserve whatever fate befalls you' do sql = presenter.apply_ordering_to_scope(scope, order).to_sql.squish expect(sql).to match(/SELECT [`"]workspaces[`"]\.\* FROM [`"]workspaces[`"] WHERE [`"]workspaces[`"]\.[`"]type[`"] (IN \('Cthulhu'\)|= 'Cthulhu') ORDER BY workspaces\.updated_at asc/i) end end end describe "#calculate_sort_name_and_direction" do let(:presenter_class) { WorkspacePresenter } let(:presenter) { presenter_class.new } it 'uses default_sort_order by default when present' do presenter_class.default_sort_order 'foo:asc' expect(presenter.calculate_sort_name_and_direction).to eq ['foo', 'asc'] end it 'uses updated_at:desc when no default has been set' do expect(presenter.calculate_sort_name_and_direction).to eq ['updated_at', 'desc'] end it 'ignores unknown sorts' do presenter_class.sort_order :foo, 'workspaces.foo' expect(presenter.calculate_sort_name_and_direction('order' => 'hello:desc')).to eq ['updated_at', 'desc'] expect(presenter.calculate_sort_name_and_direction('order' => 'foo:desc')).to eq ['foo', 'desc'] end it 'sanitizes the direction' do presenter_class.sort_order :foo, 'workspaces.foo' expect(presenter.calculate_sort_name_and_direction('order' => 'foo:drop table')).to eq ['foo', 'asc'] expect(presenter.calculate_sort_name_and_direction('order' => 'foo:')).to eq ['foo', 'asc'] expect(presenter.calculate_sort_name_and_direction('order' => 'foo:hi')).to eq ['foo', 'asc'] expect(presenter.calculate_sort_name_and_direction('order' => 'foo:DESCE')).to eq ['foo', 'asc'] expect(presenter.calculate_sort_name_and_direction('order' => 'foo:asc')).to eq ['foo', 'asc'] expect(presenter.calculate_sort_name_and_direction('order' => 'foo:;;;droptable::;;')).to eq ['foo', 'asc'] end end describe '#allowed_associations' do let(:presenter_class) do Class.new(Brainstem::Presenter) do associations do association :user, User association :workspace, Workspace association :task, Task, restrict_to_only: true end end end let(:presenter_instance) { presenter_class.new } it 'returns all associations that are not restrict_to_only' do expect(presenter_instance.allowed_associations(is_only_query = false).keys).to match_array %w[user workspace] end it 'returns associations that are restrict_to_only if is_only_query is true' do expect(presenter_instance.allowed_associations(is_only_query = true).keys).to match_array %w[user workspace task] end end end
mavenlink/brainstem
spec/brainstem/presenter_spec.rb
Ruby
mit
46,539
{ "date": "2017-08-31", "type": "post", "title": "Report for Thursday 31st of August 2017", "slug": "2017\/08\/31", "categories": [ "Daily report" ], "images": [ "\/photos\/2017-08-31\/20170831_161200.jpg", "\/photos\/2017-08-31\/20170831_171155.jpg" ], "health": { "weight": 79, "height": 173, "age": 13406 }, "nutrition": { "calories": 1458.58, "fat": 124.01, "carbohydrates": 22.95, "protein": 62.41 }, "exercise": { "pushups": 0, "crunches": 20, "steps": 5827 }, "media": { "books": [], "podcast": [], "youtube": [ { "id": "40046", "url": "http:\/\/cast.writtn.com\/episode\/40046\/quantified", "image": "https:\/\/i3.ytimg.com\/vi\/VZ-2xS3wgoI\/hqdefault.jpg", "channel_title": "sexplanations", "type": 2, "title": "DIY Dildos", "duration": "0" }, { "id": "38396", "url": "http:\/\/cast.writtn.com\/episode\/38396\/quantified", "image": "https:\/\/i3.ytimg.com\/vi\/j2qMen-2k1U\/hqdefault.jpg", "channel_title": "pocket83", "type": 2, "title": "BB packing problem on a cylinder (& the water paraboloid)", "duration": "0" }, { "id": "40043", "url": "http:\/\/cast.writtn.com\/episode\/40043\/quantified", "image": "https:\/\/i2.ytimg.com\/vi\/1FkGX3xGlog\/hqdefault.jpg", "channel_title": "Food Wishes", "type": 2, "title": "Sourdough Bread - Part 1: The Starter", "duration": "0" }, { "id": "39988", "url": "http:\/\/cast.writtn.com\/episode\/39988\/quantified", "image": "https:\/\/i2.ytimg.com\/vi\/uHbhH7ISL_Y\/hqdefault.jpg", "channel_title": "The 8-Bit Guy", "type": 2, "title": "Commodore PET Repair and Restore", "duration": "0" } ], "photos": [ "\/photos\/2017-08-31\/20170831_161200.jpg", "\/photos\/2017-08-31\/20170831_171155.jpg" ] } } Today I am <strong>13406 days</strong> old and my weight is <strong>79 kg</strong>. During the day, I consumed <strong>1458.58 kcal</strong> coming from <strong>124.01 g</strong> fat, <strong>22.95 g</strong> carbohydrates and <strong>62.41 g</strong> protein. Managed to do <strong>0 push-ups</strong>, <strong>20 crunches</strong> and walked <strong>5827 steps</strong> during the day which is approximately <strong>4.44 km</strong>.
aquilax/quantified.avtobiografia.com
content/post/2017-08-31.md
Markdown
mit
2,873
/** * @module 编辑模式, * @author: * @date: 2015/12/15 */ define([ "core/js/CommonConstant", "core/js/layout/Container", "text!core/resources/tmpl/EditWrap.html", "core/js/wrap/WrapAbstract" ], function (CommonConstant, Container,LayoutTemplate,WrapAbstract) { var EditWrap = Container.extend(WrapAbstract).extend({ xtype:$Component.EDITWRAP, wrapSelector:"div>div.view", /** * 清空模板 */ template:LayoutTemplate, /*------------------------------- 初始化及私有方法 start ---------------------------------------------------*/ render:function(container, triggerEvent){ this._super(container, triggerEvent); var children = this.$(this.wrapSelector); this.setWrapEl(children); }, /*------------------------------- 公有有方法 start ---------------------------------------------------*/ }); return EditWrap; });
huangfeng19820712/hfast
core/js/wrap/EditWrap.js
JavaScript
mit
985
POPULATION = 2500 GENERATIONS = 500 RETAINED_PCT = 0.1 NEW_PCT = 0.2 MUTATION_PCT = 0.02
EvilScott/tspga
values.py
Python
mit
89
/** * Decorator class using HTML elements: it displays information * by injecting or removing elements inside the DOM. * * https://github.com/RobertoPrevato/DataEntry * * Copyright 2019, Roberto Prevato * https://robertoprevato.github.io * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT */ import _ from "../../../scripts/utils" import $ from "../../../scripts/dom" const each = _.each; const extend = _.extend; const isString = _.isString; const append = $.append; const addClass = $.addClass; const removeClass = $.removeClass; const removeElement = $.remove.bind($); const next = $.next; const createElement = $.createElement; const isRadioButton = $.isRadioButton; const findFirst = $.findFirst; const after = $.after; const attr = $.attr; // support for explicitly defined targets through data attributes function checkSpecificTarget(element) { var specificTarget = element.dataset.validationTarget; if (specificTarget) return document.getElementById(specificTarget); } // when a field relates to a group, then it make sense to display information only on the first element of the group. // a common case for this situation are radio buttons: if a value coming from a group of radio buttons is required, // then it makes sense to display information only on the first one; function checkGroup(element) { if (isRadioButton(element)) { // return the first radio button appearing in DOM return this.dataentry && this.dataentry.element ? this.dataentry.element.querySelectorAll($.nameSelector(element))[0] : element; } return element; } function checkElement(element) { var specificTarget = checkSpecificTarget(element); if (specificTarget) return specificTarget; var re = checkGroup.call(this, element); // support radio and checkboxes before labels (decorate after labels) if (/^radio|checkbox$/i.test(element.type)) { var nx = next(element); if (nx && /label/i.test(nx.tagName) && element.id == attr(nx, "for")) { return nx; } } return re; } const TOOLTIPS = "tooltips" class DomDecorator { /** * Creates a new instance of DomDecorator associated with the given dataentry. * * @param dataentry: instance of DataEntry. */ constructor(dataentry) { this.dataentry = dataentry; // default to tooltips if not specified otherwise this.markStyle = dataentry ? (dataentry.options.markStyle || TOOLTIPS) : TOOLTIPS; this.options = _.extend({}, DomDecorator.defaults, dataentry && dataentry.options ? dataentry.options.decoratorOptions : {}); this._elements = []; } create(tagname) { var el = $.createElement(tagname); this._elements.push(el); return el; } checkElement(element) { return checkElement(element) } bindDecoratorElement(field, markerElement) { if ($.attr(markerElement, 'id') === field.dataset.markerId) { // elements are already bound return; } let uniqueId = _.uniqueId('ug-dataentry-marker'); $.setAttr(markerElement, {'id': uniqueId}); field.dataset.markerId = uniqueId; } getCurrentMessageElement(field) { let markerId = field.dataset.markerId; if (markerId) { return document.getElementById(markerId); } } /** * Gets an element to display validation information about the given field. * If the element already exists, it is returned. * * @param f * @param create * @returns {*} */ getMessageElement(f, create, options) { var self = this; if (self.markStyle == TOOLTIPS) { var l = self.getCurrentMessageElement(f); if (l) return l; if (create) { l = self.getTooltipElement(f, create, options); // assign an unique id to this element; self.bindDecoratorElement(f, l); return l; } else { return null; } } var l = self.getCurrentMessageElement(f); if (l) return l; if (!create) return null; l = self.create("span"); addClass(l, "ug-message-element"); self.bindDecoratorElement(f, l); return l; } /** * Gets the options to display a message on the given field. * * @param f * @returns {*} */ getOptions(f, options) { var de = this.dataentry, schema = de ? de.schema : null, fs = schema ? schema[f.name] : null, defaults = this.defaults, messageOptions = fs ? fs.message : "right"; if (isString(messageOptions)) messageOptions = { position: messageOptions }; return extend({}, defaults, messageOptions, options); } /** * Gets an element that can be styled as tooltip * * @param f * @param create * @returns {*} */ getTooltipElement(f, create, options) { var divtag = "div", o = this.getOptions(f, options), wrapper = this.create(divtag), tooltip = createElement(divtag), arrow = createElement(divtag), p = createElement("p"); addClass(wrapper, "ug-validation-wrapper"); addClass(tooltip, "tooltip validation-tooltip in " + (o.position || "right")); addClass(arrow, "tooltip-arrow"); addClass(p, "tooltip-inner"); append(wrapper, tooltip); append(tooltip, arrow); append(tooltip, p); return wrapper; } /** * Sets the text to display in the marker element. * * @param marker element * @param message */ setElementText(el, message) { var textContent = "textContent"; if (this.markStyle == "tooltips") { findFirst(el, ".tooltip-inner")[textContent] = message; return; } el[textContent] = message; } /** * Removes the element used to display information for the given field. * * @param f * @returns {DomMarker} */ removeMessageElement(f) { var self = this; f = checkElement.call(self, f); var l = self.getMessageElement(f, false); if (l) removeElement(l); return self; } /** * Marks the field in neuter state (no success/no error) * * @param f * @returns {DomMarker|*} */ markFieldNeutrum(f) { var self = this, options = self.options; f = checkElement.call(self, f); removeClass(f, `${options.invalidClass} ${options.validClass}`); return self.removeMessageElement(f); } /** * Marks the given field in valid state * * @param f * @returns {DomMarker|*} */ markFieldValid(f) { var self = this, options = self.options; f = checkElement.call(self, f); addClass(removeClass(f, options.invalidClass), options.validClass); return self.removeMessageElement(f); } /** * Marks a field with some information. * * @param {*} f * @param {*} options */ markField(f, options, css) { var self = this; f = checkElement.call(self, f); var l = self.getMessageElement(f, true, options); self.setElementText(addClass(l, css), options.message); after(f, l); return self; } /** * Displays information about the given field * * @param f * @param options * @returns {DomMarker} */ markFieldInfo(f, options) { var self = this, o = self.options; addClass(removeClass(f, o.invalidClass), o.validClass); return self.markField(f, options, "ug-info"); } /** * Marks the given field in invalid state * * @param f * @param options * @returns {DomMarker} */ markFieldInvalid(f, options) { var self = this, o = self.options; addClass(removeClass(f, o.validClass), o.invalidClass); return self.markField(f, options, "ug-error"); } /** * Marks the given field as `touched` by the user * * @param f * @returns {DomMarker} */ markFieldTouched(f) { f = checkElement.call(this, f); addClass(f, "ug-touched"); return this; } /** * Removes all the marker elements created by this DomDecorator. */ removeElements() { each(this._elements, element => $.remove(element)); return this; } /** * Disposes of this decorator. */ dispose() { this.dataentry = null; this.removeElements(); return this; } } DomDecorator.defaults = { position: "right", invalidClass: "ug-field-invalid", validClass: "ug-field-valid" } export default DomDecorator
RobertoPrevato/DataEntry
source/code/scripts/forms/decoration/domdecorator.js
JavaScript
mit
8,236
import GoogleMapLoader from 'google-maps'; import Promise from 'bluebird'; import { forEach } from 'ramda'; import config from './config'; import { VIEW_STATES, updateState } from './wedux'; import wispAsset from './assets/wisp.png'; import userAsset from './assets/user-marker.png'; let googleObj; let map; let geocoder; let mapIcon; let userIcon; let player; let placeService; const minZoom = 18; export const getUserLocation = () => new Promise((resolve, reject) => { if (navigator.geolocation) { navigator.geolocation .getCurrentPosition(({ coords }) => resolve(coords)); } }); export const getPlayerLocation = () => new Promise((resolve, reject) => { const pos = player.getPosition(); resolve({ lat: pos.lat(), lng: pos.lng() }); }); const makePlayerMarker = (position) => { player = new googleObj.maps.Marker({ position, map, draggable: true, icon: userIcon, }) player.addListener('dragend', () => getPlayerLocation().then(findCurrentPlace)); }; export const setMapLocation = ({ maps }) => getUserLocation() .then(({ latitude, longitude }) => { const center = new maps.LatLng(latitude, longitude); map.setCenter(center); makePlayerMarker(center); console.log(center); findCurrentPlace({ lat: center.lat(), lng: center.lng() }); }); const findCurrentPlace = (({ lat, lng}) => { geocoder.geocode({ location:{ lat, lng } }, (res, status) => { if(status === 'OK'){ let temp = { placeId: res[0]['place_id'] }; placeService.getDetails(temp, handlePlaceResponse); } }); }); const handlePlaceResponse = (res, status) => { if(status === 'OK'){ updateState({currentLocation: res.name}); }else{ console.log(status); } } export const createWispMarker = ({ lat, lng, message, datetime }) => new googleObj.maps.Marker({ position: { lat, lng }, map, icon: mapIcon, }) .addListener('click', () => updateState({ listenText: message, datetime, view: VIEW_STATES.LISTENING,}) ); export const init = config => new Promise(resolve => { // init google maps GoogleMapLoader.KEY = config.apiKey; GoogleMapLoader.LIBRARIES = ['places']; GoogleMapLoader.load(google => { googleObj = google; mapIcon = { url: wispAsset, size: new google.maps.Size(45, 45), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(0, 0), scaledSize: new google.maps.Size(25, 25) }; userIcon = { url: userAsset, size: new google.maps.Size(66, 92), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(12.5, 33), scaledSize: new google.maps.Size(25, 32) }; map = new googleObj.maps.Map(document.querySelector('#map'), config.options); geocoder = new googleObj.maps.Geocoder; placeService = new googleObj.maps.places.PlacesService(map); googleObj.maps.event.addListener(map, 'zoom_changed', () => { if(map.getZoom() < minZoom) map.setZoom(minZoom); }); resolve(googleObj); }); });
brfrederick/wisp
src/location.js
JavaScript
mit
3,136
import React from 'react' import styled from 'styled-components' import { RaceChar } from '../../common/races' import RandomIcon from '../icons/material/ic_casino_black_24px.svg' import ZergIcon from '../icons/starcraft/hydra_24px.svg' import TerranIcon from '../icons/starcraft/marine_24px.svg' import ProtossIcon from '../icons/starcraft/zealot_24px.svg' import { getRaceColor } from '../styles/colors' const ICONS: Record<RaceChar, React.ComponentType<any>> = { r: RandomIcon, p: ProtossIcon, t: TerranIcon, z: ZergIcon, } const StyledIcon = styled.svg<{ $race: RaceChar }>` fill: ${props => getRaceColor(props.$race)}; ` export interface RaceIconProps { race: RaceChar className?: string ariaLabel?: string } export const RaceIcon = React.memo(({ race, className, ariaLabel }: RaceIconProps) => { const icon = ICONS[race] return <StyledIcon className={className} as={icon} $race={race} aria-label={ariaLabel} /> })
ShieldBattery/ShieldBattery
client/lobbies/race-icon.tsx
TypeScript
mit
943
import React from 'react'; import ReactDOM from 'react-dom'; import App from 'frontend'; import configureStore from 'frontend/configureStore'; const store = configureStore(); if (DEVSERVER) { const AppContainer = require('react-hot-loader').AppContainer; ReactDOM.render( <AppContainer> <App store={store} /> </AppContainer>, document.getElementById('root') ); if (module.hot) { module.hot.accept('frontend', () => { const NextApp = require('frontend').default; ReactDOM.render( <AppContainer> <NextApp store={store} /> </AppContainer>, document.getElementById('root') ); }); } } else { ReactDOM.render(<App store={store} />, document.getElementById('root')); }
resummed/resummed
src/index.js
JavaScript
mit
721
<?php require_once 'inc/common.php'; require_once 'templates/blocks/lessons.helpers.php'; ?> <section class="links"> <div class="section__title"> <?= $title ?> <?php if (isset($total_results_url) && $total_results_url) { ?> <div class="additional-info"> <a href="<?= $total_results_url ?>">Общие результаты</a> </div> <?php } ?> </div> <div class="section__body"> <?php foreach (array_reverse($lessons) as $lesson) { print_lesson($lesson); } ?> </div> </section>
andgein/sis-interfaces
core/templates/blocks/lessons.php
PHP
mit
709
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). registrar1 = Registrar.where( name: 'Registrar First AS', reg_no: '10300220', street: 'Pärnu mnt 2', city: 'Tallinn', state: 'Harju maakond', zip: '11415', email: '[email protected]', country_code: 'EE', code: 'REG1' ).first_or_create! @api_user1 = ApiUser.where( username: 'registrar1', ).first_or_create!( password: 'password', identity_code: '51001091072', active: true, registrar: registrar1, roles: ['super'] ) registrar2 = Registrar.where( name: 'Registrar Second AS', reg_no: '10529229', street: 'Vabaduse pst 32', city: 'Tallinn', state: 'Harju maakond', zip: '11315', email: '[email protected]', country_code: 'EE', code: 'REG2' ).first_or_create! @api_user2 = ApiUser.where( username: 'registrar2', ).first_or_create!( password: 'password', identity_code: '11412090004', active: true, registrar: registrar2, roles: ['super'] ) Registrar.all.each do |x| x.accounts.where(account_type: Account::CASH, currency: 'EUR').first_or_create! end admin1 = { username: 'user1', email: '[email protected]', identity_code: '37810013855', country_code: 'EE' } admin2 = { username: 'user2', email: '[email protected]', identity_code: '37810010085', country_code: 'EE' } admin3 = { username: 'user3', email: '[email protected]', identity_code: '37810010727', country_code: 'EE' } [admin1, admin2, admin3].each do |at| admin = AdminUser.where(at) next if admin.present? admin = AdminUser.new(at.merge({ password_confirmation: 'testtest' })) admin.roles = ['admin'] admin.save end ZonefileSetting.where({ origin: 'ee', ttl: 43200, refresh: 3600, retry: 900, expire: 1209600, minimum_ttl: 3600, email: 'hostmaster.eestiinternet.ee', master_nameserver: 'ns.tld.ee' }).first_or_create! ZonefileSetting.where({ origin: 'pri.ee', ttl: 43200, refresh: 3600, retry: 900, expire: 1209600, minimum_ttl: 3600, email: 'hostmaster.eestiinternet.ee', master_nameserver: 'ns.tld.ee' }).first_or_create! # Registrar.where( # name: 'EIS', # reg_no: '90010019', # phone: '+3727271000', # country_code: 'EE', # vat_no: 'EE101286464', # email: '[email protected]', # state: 'Harjumaa', # city: 'Tallinn', # street: 'Paldiski mnt 80', # zip: '10617', # url: 'www.internet.ee', # code: 'EIS' # ).first_or_create!
teadur/registry
db/seeds.rb
Ruby
mit
2,556
<?php namespace Acme\BugBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\Form\Test\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Acme\BugBundle\Form\Type; use Acme\BugBundle\Repository; use Acme\BugBundle\Entity\User; class AdminController extends Controller { /** * @Route("/admin", name="admin") */ public function adminAction(Request $request) { $users = $this->getDoctrine() ->getRepository('AcmeBugBundle:User') ->findAll(); return $this->render('AcmeBugBundle:Admin:admin.html.twig', array( 'users' => $users, )); } /** * @param Request $request * @return RedirectResponse|Response * @Route("/admin/{id}/edit_profile", name="edit_profile") */ public function editprofileAction($id,Request $request) { $user = $this->getDoctrine() ->getRepository('AcmeBugBundle:User') ->find($id); $form = $this->container->get('admin.edit.profile')->Admineditprofile($request,$user); if ( $form instanceof FormInterface ) { return $this->render('AcmeBugBundle:Admin:admin_change_profile.html.twig', array( 'form' => $form->createView(), 'user' => $user )); } return $this->redirectToRoute('main'); } /** * @Route("/admin/{id}", name="admin_user_view") */ public function viewuserAction($id) { $user = $this->getDoctrine() ->getRepository('AcmeBugBundle:User') ->find($id); return $this->render('AcmeBugBundle:Admin:viewuser.html.twig', array( 'user'=>$user )); } }
Roman-Savchenko/Bug_Tracker
src/Acme/BugBundle/Controller/AdminController.php
PHP
mit
1,928
#include "PSCS/Semantics/Actions/impl/ActionsPackageImpl.hpp" #include <cassert> #include "abstractDataTypes/SubsetUnion.hpp" //metametamodel classes #include "ecore/EParameter.hpp" #include "ecore/EOperation.hpp" #include "ecore/EDataType.hpp" #include "ecore/EAnnotation.hpp" #include "ecore/EClass.hpp" #include "ecore/EReference.hpp" #include "ecore/EStringToStringMapEntry.hpp" #include "ecore/EGenericType.hpp" // metametamodel factory #include "ecore/ecoreFactory.hpp" //depending model packages #include "fUML/Semantics/Actions/ActionsPackage.hpp" #include "fUML/Semantics/CommonBehavior/CommonBehaviorPackage.hpp" #include "fUML/Semantics/Loci/LociPackage.hpp" #include "PSCS/PSCSPackage.hpp" #include "fUML/Semantics/SimpleClassifiers/SimpleClassifiersPackage.hpp" #include "PSCS/Semantics/StructuredClassifiers/StructuredClassifiersPackage.hpp" #include "fUML/Semantics/StructuredClassifiers/StructuredClassifiersPackage.hpp" #include "fUML/Semantics/Values/ValuesPackage.hpp" #include "ecore/ecorePackage.hpp" #include "fUML/fUMLPackage.hpp" #include "uml/umlPackage.hpp" using namespace PSCS::Semantics::Actions; void ActionsPackageImpl::initializePackageContents() { if (isInitialized) { return; } isInitialized = true; // Initialize package setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); // Add supertypes to classes m_cS_AcceptCallActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getAcceptCallActionActivation_Class()); m_cS_AcceptEventActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getAcceptEventActionActivation_Class()); m_cS_AddStructuralFeatureValueActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getAddStructuralFeatureValueActionActivation_Class()); m_cS_CallOperationActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getCallOperationActionActivation_Class()); m_cS_ClearStructuralFeatureActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getClearStructuralFeatureActionActivation_Class()); m_cS_ConstructStrategy_Class->getESuperTypes()->push_back(fUML::Semantics::Loci::LociPackage::eInstance()->getSemanticStrategy_Class()); m_cS_CreateLinkActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getCreateLinkActionActivation_Class()); m_cS_CreateObjectActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getCreateObjectActionActivation_Class()); m_cS_DefaultConstructStrategy_Class->getESuperTypes()->push_back(getCS_ConstructStrategy_Class()); m_cS_ReadExtentActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getReadExtentActionActivation_Class()); m_cS_ReadSelfActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getReadSelfActionActivation_Class()); m_cS_RemoveStructuralFeatureValueActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getRemoveStructuralFeatureValueActivation_Class()); m_cS_SendSignalActionActivation_Class->getESuperTypes()->push_back(fUML::Semantics::Actions::ActionsPackage::eInstance()->getSendSignalActionActivation_Class()); // Initialize classes and features; add operations and parameters initializeCS_AcceptCallActionActivationContent(); initializeCS_AcceptEventActionActivationContent(); initializeCS_AddStructuralFeatureValueActionActivationContent(); initializeCS_CallOperationActionActivationContent(); initializeCS_ClearStructuralFeatureActionActivationContent(); initializeCS_ConstructStrategyContent(); initializeCS_CreateLinkActionActivationContent(); initializeCS_CreateObjectActionActivationContent(); initializeCS_DefaultConstructStrategyContent(); initializeCS_ReadExtentActionActivationContent(); initializeCS_ReadSelfActionActivationContent(); initializeCS_RemoveStructuralFeatureValueActionActivationContent(); initializeCS_SendSignalActionActivationContent(); initializePackageEDataTypes(); } void ActionsPackageImpl::initializeCS_AcceptCallActionActivationContent() { m_cS_AcceptCallActionActivation_Class->setName("CS_AcceptCallActionActivation"); m_cS_AcceptCallActionActivation_Class->setAbstract(false); m_cS_AcceptCallActionActivation_Class->setInterface(false); m_cS_AcceptCallActionActivation_Operation_accept_EventOccurrence->setName("accept"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_AcceptCallActionActivation_Operation_accept_EventOccurrence->setEType(unknownClass); } m_cS_AcceptCallActionActivation_Operation_accept_EventOccurrence->setLowerBound(1); m_cS_AcceptCallActionActivation_Operation_accept_EventOccurrence->setUpperBound(1); m_cS_AcceptCallActionActivation_Operation_accept_EventOccurrence->setUnique(true); m_cS_AcceptCallActionActivation_Operation_accept_EventOccurrence->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_AcceptCallActionActivation_Operation_accept_EventOccurrence); parameter->setName("eventOccurrence"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } } void ActionsPackageImpl::initializeCS_AcceptEventActionActivationContent() { m_cS_AcceptEventActionActivation_Class->setName("CS_AcceptEventActionActivation"); m_cS_AcceptEventActionActivation_Class->setAbstract(false); m_cS_AcceptEventActionActivation_Class->setInterface(false); m_cS_AcceptEventActionActivation_Operation_accept_EventOccurrence->setName("accept"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_AcceptEventActionActivation_Operation_accept_EventOccurrence->setEType(unknownClass); } m_cS_AcceptEventActionActivation_Operation_accept_EventOccurrence->setLowerBound(1); m_cS_AcceptEventActionActivation_Operation_accept_EventOccurrence->setUpperBound(1); m_cS_AcceptEventActionActivation_Operation_accept_EventOccurrence->setUnique(true); m_cS_AcceptEventActionActivation_Operation_accept_EventOccurrence->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_AcceptEventActionActivation_Operation_accept_EventOccurrence); parameter->setName("eventOccurrence"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } } void ActionsPackageImpl::initializeCS_AddStructuralFeatureValueActionActivationContent() { m_cS_AddStructuralFeatureValueActionActivation_Class->setName("CS_AddStructuralFeatureValueActionActivation"); m_cS_AddStructuralFeatureValueActionActivation_Class->setAbstract(false); m_cS_AddStructuralFeatureValueActionActivation_Class->setInterface(false); m_cS_AddStructuralFeatureValueActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_AddStructuralFeatureValueActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_AddStructuralFeatureValueActionActivation_Operation_doAction->setLowerBound(1); m_cS_AddStructuralFeatureValueActionActivation_Operation_doAction->setUpperBound(1); m_cS_AddStructuralFeatureValueActionActivation_Operation_doAction->setUnique(true); m_cS_AddStructuralFeatureValueActionActivation_Operation_doAction->setOrdered(false); m_cS_AddStructuralFeatureValueActionActivation_Operation_doActionDefault->setName("doActionDefault"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_AddStructuralFeatureValueActionActivation_Operation_doActionDefault->setEType(unknownClass); } m_cS_AddStructuralFeatureValueActionActivation_Operation_doActionDefault->setLowerBound(1); m_cS_AddStructuralFeatureValueActionActivation_Operation_doActionDefault->setUpperBound(1); m_cS_AddStructuralFeatureValueActionActivation_Operation_doActionDefault->setUnique(true); m_cS_AddStructuralFeatureValueActionActivation_Operation_doActionDefault->setOrdered(false); } void ActionsPackageImpl::initializeCS_CallOperationActionActivationContent() { m_cS_CallOperationActionActivation_Class->setName("CS_CallOperationActionActivation"); m_cS_CallOperationActionActivation_Class->setAbstract(false); m_cS_CallOperationActionActivation_Class->setInterface(false); m_cS_CallOperationActionActivation_Operation__isCreate_Operation->setName("_isCreate"); m_cS_CallOperationActionActivation_Operation__isCreate_Operation->setEType(ecore::ecorePackage::eInstance()->getEBoolean_Class()); m_cS_CallOperationActionActivation_Operation__isCreate_Operation->setLowerBound(1); m_cS_CallOperationActionActivation_Operation__isCreate_Operation->setUpperBound(1); m_cS_CallOperationActionActivation_Operation__isCreate_Operation->setUnique(true); m_cS_CallOperationActionActivation_Operation__isCreate_Operation->setOrdered(true); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_CallOperationActionActivation_Operation__isCreate_Operation); parameter->setName("operation"); parameter->setEType(uml::umlPackage::eInstance()->getOperation_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_CallOperationActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_CallOperationActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_CallOperationActionActivation_Operation_doAction->setLowerBound(1); m_cS_CallOperationActionActivation_Operation_doAction->setUpperBound(1); m_cS_CallOperationActionActivation_Operation_doAction->setUnique(true); m_cS_CallOperationActionActivation_Operation_doAction->setOrdered(false); m_cS_CallOperationActionActivation_Operation_getCallExecution->setName("getCallExecution"); m_cS_CallOperationActionActivation_Operation_getCallExecution->setEType(fUML::Semantics::CommonBehavior::CommonBehaviorPackage::eInstance()->getExecution_Class()); m_cS_CallOperationActionActivation_Operation_getCallExecution->setLowerBound(1); m_cS_CallOperationActionActivation_Operation_getCallExecution->setUpperBound(1); m_cS_CallOperationActionActivation_Operation_getCallExecution->setUnique(true); m_cS_CallOperationActionActivation_Operation_getCallExecution->setOrdered(false); m_cS_CallOperationActionActivation_Operation_isCreate_Operation->setName("isCreate"); m_cS_CallOperationActionActivation_Operation_isCreate_Operation->setEType(ecore::ecorePackage::eInstance()->getEBoolean_Class()); m_cS_CallOperationActionActivation_Operation_isCreate_Operation->setLowerBound(1); m_cS_CallOperationActionActivation_Operation_isCreate_Operation->setUpperBound(1); m_cS_CallOperationActionActivation_Operation_isCreate_Operation->setUnique(true); m_cS_CallOperationActionActivation_Operation_isCreate_Operation->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_CallOperationActionActivation_Operation_isCreate_Operation); parameter->setName("operation"); parameter->setEType(uml::umlPackage::eInstance()->getOperation_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation->setName("isOperationProvided"); m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation->setEType(ecore::ecorePackage::eInstance()->getEBoolean_Class()); m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation->setLowerBound(1); m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation->setUpperBound(1); m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation->setUnique(true); m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation); parameter->setName("port"); parameter->setEType(uml::umlPackage::eInstance()->getPort_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_CallOperationActionActivation_Operation_isOperationProvided_Port_Operation); parameter->setName("operation"); parameter->setEType(uml::umlPackage::eInstance()->getOperation_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation->setName("isOperationRequired"); m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation->setEType(ecore::ecorePackage::eInstance()->getEBoolean_Class()); m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation->setLowerBound(1); m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation->setUpperBound(1); m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation->setUnique(true); m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation); parameter->setName("port"); parameter->setEType(uml::umlPackage::eInstance()->getPort_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_CallOperationActionActivation_Operation_isOperationRequired_Port_Operation); parameter->setName("operation"); parameter->setEType(uml::umlPackage::eInstance()->getOperation_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } } void ActionsPackageImpl::initializeCS_ClearStructuralFeatureActionActivationContent() { m_cS_ClearStructuralFeatureActionActivation_Class->setName("CS_ClearStructuralFeatureActionActivation"); m_cS_ClearStructuralFeatureActionActivation_Class->setAbstract(false); m_cS_ClearStructuralFeatureActionActivation_Class->setInterface(false); m_cS_ClearStructuralFeatureActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_ClearStructuralFeatureActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_ClearStructuralFeatureActionActivation_Operation_doAction->setLowerBound(1); m_cS_ClearStructuralFeatureActionActivation_Operation_doAction->setUpperBound(1); m_cS_ClearStructuralFeatureActionActivation_Operation_doAction->setUnique(true); m_cS_ClearStructuralFeatureActionActivation_Operation_doAction->setOrdered(true); m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature->setName("getLinksToDestroy"); m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Link_Class()); m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature->setLowerBound(0); m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature->setUpperBound(-1); m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature->setUnique(true); m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature->setOrdered(true); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature); parameter->setName("value"); parameter->setEType(fUML::Semantics::SimpleClassifiers::SimpleClassifiersPackage::eInstance()->getStructuredValue_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_ClearStructuralFeatureActionActivation_Operation_getLinksToDestroy_StructuredValue_StructuralFeature); parameter->setName("feature"); parameter->setEType(uml::umlPackage::eInstance()->getStructuralFeature_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setName("getPotentialLinkEnds"); m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setEType(fUML::Semantics::Values::ValuesPackage::eInstance()->getValue_Class()); m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setLowerBound(0); m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setUpperBound(-1); m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setUnique(true); m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setOrdered(true); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature); parameter->setName("context"); parameter->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Reference_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_ClearStructuralFeatureActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature); parameter->setName("feature"); parameter->setEType(uml::umlPackage::eInstance()->getStructuralFeature_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } } void ActionsPackageImpl::initializeCS_ConstructStrategyContent() { m_cS_ConstructStrategy_Class->setName("CS_ConstructStrategy"); m_cS_ConstructStrategy_Class->setAbstract(true); m_cS_ConstructStrategy_Class->setInterface(false); m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object->setName("construct"); m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object->setEType(fUML::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getObject_Class()); m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object->setLowerBound(1); m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object->setUpperBound(1); m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object->setUnique(true); m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object); parameter->setName("constructor"); parameter->setEType(uml::umlPackage::eInstance()->getOperation_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_ConstructStrategy_Operation_construct_Operation_CS_Object); parameter->setName("context"); parameter->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Object_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_ConstructStrategy_Operation_getName->setName("getName"); m_cS_ConstructStrategy_Operation_getName->setEType(ecore::ecorePackage::eInstance()->getEString_Class()); m_cS_ConstructStrategy_Operation_getName->setLowerBound(1); m_cS_ConstructStrategy_Operation_getName->setUpperBound(1); m_cS_ConstructStrategy_Operation_getName->setUnique(true); m_cS_ConstructStrategy_Operation_getName->setOrdered(false); } void ActionsPackageImpl::initializeCS_CreateLinkActionActivationContent() { m_cS_CreateLinkActionActivation_Class->setName("CS_CreateLinkActionActivation"); m_cS_CreateLinkActionActivation_Class->setAbstract(false); m_cS_CreateLinkActionActivation_Class->setInterface(false); m_cS_CreateLinkActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_CreateLinkActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_CreateLinkActionActivation_Operation_doAction->setLowerBound(1); m_cS_CreateLinkActionActivation_Operation_doAction->setUpperBound(1); m_cS_CreateLinkActionActivation_Operation_doAction->setUnique(true); m_cS_CreateLinkActionActivation_Operation_doAction->setOrdered(false); } void ActionsPackageImpl::initializeCS_CreateObjectActionActivationContent() { m_cS_CreateObjectActionActivation_Class->setName("CS_CreateObjectActionActivation"); m_cS_CreateObjectActionActivation_Class->setAbstract(false); m_cS_CreateObjectActionActivation_Class->setInterface(false); m_cS_CreateObjectActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_CreateObjectActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_CreateObjectActionActivation_Operation_doAction->setLowerBound(1); m_cS_CreateObjectActionActivation_Operation_doAction->setUpperBound(1); m_cS_CreateObjectActionActivation_Operation_doAction->setUnique(true); m_cS_CreateObjectActionActivation_Operation_doAction->setOrdered(false); } void ActionsPackageImpl::initializeCS_DefaultConstructStrategyContent() { m_cS_DefaultConstructStrategy_Class->setName("CS_DefaultConstructStrategy"); m_cS_DefaultConstructStrategy_Class->setAbstract(false); m_cS_DefaultConstructStrategy_Class->setInterface(false); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setName("defaultAssociation"); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setEType(uml::umlPackage::eInstance()->getAssociation_Class()); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setLowerBound(1); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setUpperBound(1); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setTransient(false); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setVolatile(false); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setChangeable(true); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setUnsettable(false); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setUnique(true); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setDerived(false); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setOrdered(false); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setContainment(true); m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setResolveProxies(true); { std::string defaultValue = ""; if (!defaultValue.empty()) { m_cS_DefaultConstructStrategy_Attribute_defaultAssociation->setDefaultValueLiteral(defaultValue); } //undefined otherEnd std::shared_ptr<ecore::EReference> otherEnd = nullptr; } m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setName("generatedRealizingClasses"); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setEType(uml::umlPackage::eInstance()->getClass_Class()); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setLowerBound(0); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setUpperBound(-1); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setTransient(false); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setVolatile(false); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setChangeable(true); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setUnsettable(false); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setUnique(true); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setDerived(false); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setOrdered(false); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setContainment(true); m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setResolveProxies(true); { std::string defaultValue = ""; if (!defaultValue.empty()) { m_cS_DefaultConstructStrategy_Attribute_generatedRealizingClasses->setDefaultValueLiteral(defaultValue); } //undefined otherEnd std::shared_ptr<ecore::EReference> otherEnd = nullptr; } m_cS_DefaultConstructStrategy_Attribute_locus->setName("locus"); m_cS_DefaultConstructStrategy_Attribute_locus->setEType(fUML::Semantics::Loci::LociPackage::eInstance()->getLocus_Class()); m_cS_DefaultConstructStrategy_Attribute_locus->setLowerBound(1); m_cS_DefaultConstructStrategy_Attribute_locus->setUpperBound(1); m_cS_DefaultConstructStrategy_Attribute_locus->setTransient(false); m_cS_DefaultConstructStrategy_Attribute_locus->setVolatile(false); m_cS_DefaultConstructStrategy_Attribute_locus->setChangeable(true); m_cS_DefaultConstructStrategy_Attribute_locus->setUnsettable(false); m_cS_DefaultConstructStrategy_Attribute_locus->setUnique(true); m_cS_DefaultConstructStrategy_Attribute_locus->setDerived(false); m_cS_DefaultConstructStrategy_Attribute_locus->setOrdered(false); m_cS_DefaultConstructStrategy_Attribute_locus->setContainment(false); m_cS_DefaultConstructStrategy_Attribute_locus->setResolveProxies(true); { std::string defaultValue = ""; if (!defaultValue.empty()) { m_cS_DefaultConstructStrategy_Attribute_locus->setDefaultValueLiteral(defaultValue); } //undefined otherEnd std::shared_ptr<ecore::EReference> otherEnd = nullptr; } m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value->setName("addStructuralFeatureValue"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value->setEType(unknownClass); } m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value->setUnique(true); m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value); parameter->setName("context"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value); parameter->setName("feature"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_addStructuralFeatureValue_CS_Reference_Value); parameter->setName("value"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_canInstantiate_Property->setName("canInstantiate"); m_cS_DefaultConstructStrategy_Operation_canInstantiate_Property->setEType(ecore::ecorePackage::eInstance()->getEBoolean_Class()); m_cS_DefaultConstructStrategy_Operation_canInstantiate_Property->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_canInstantiate_Property->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_canInstantiate_Property->setUnique(true); m_cS_DefaultConstructStrategy_Operation_canInstantiate_Property->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_canInstantiate_Property); parameter->setName("p"); parameter->setEType(uml::umlPackage::eInstance()->getProperty_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object->setName("construct"); m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object->setEType(fUML::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getObject_Class()); m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object->setLowerBound(0); m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object->setUnique(true); m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object->setOrdered(true); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object); parameter->setName("constructor"); parameter->setEType(uml::umlPackage::eInstance()->getOperation_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_construct_Operation_CS_Object); parameter->setName("context"); parameter->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Object_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class->setName("constructObject"); m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class->setEType(fUML::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getObject_Class()); m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class->setUnique(true); m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class); parameter->setName("context"); parameter->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Object_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_constructObject_CS_Object_Class); parameter->setName("type"); parameter->setEType(uml::umlPackage::eInstance()->getClass_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector->setName("generateArrayPattern"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector->setEType(unknownClass); } m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector->setUnique(true); m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector); parameter->setName("context"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_generateArrayPattern_CS_Reference_Connector); parameter->setName("connector"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString->setName("generateRealizingClass"); m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString->setEType(uml::umlPackage::eInstance()->getClass_Class()); m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString->setUnique(true); m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString); parameter->setName("interface_"); parameter->setEType(uml::umlPackage::eInstance()->getInterface_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_generateRealizingClass_Interface_EString); parameter->setName("className"); parameter->setEType(ecore::ecorePackage::eInstance()->getEString_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector->setName("generateStarPattern"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector->setEType(unknownClass); } m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector->setUnique(true); m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector); parameter->setName("context"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_generateStarPattern_CS_Reference_Connector); parameter->setName("connector"); parameter->setEType(nullptr); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_getCardinality_ConnectorEnd->setName("getCardinality"); m_cS_DefaultConstructStrategy_Operation_getCardinality_ConnectorEnd->setEType(ecore::ecorePackage::eInstance()->getEInt_Class()); m_cS_DefaultConstructStrategy_Operation_getCardinality_ConnectorEnd->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_getCardinality_ConnectorEnd->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_getCardinality_ConnectorEnd->setUnique(true); m_cS_DefaultConstructStrategy_Operation_getCardinality_ConnectorEnd->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_getCardinality_ConnectorEnd); parameter->setName("end"); parameter->setEType(uml::umlPackage::eInstance()->getConnectorEnd_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_getDefaultAssociation->setName("getDefaultAssociation"); m_cS_DefaultConstructStrategy_Operation_getDefaultAssociation->setEType(uml::umlPackage::eInstance()->getAssociation_Class()); m_cS_DefaultConstructStrategy_Operation_getDefaultAssociation->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_getDefaultAssociation->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_getDefaultAssociation->setUnique(true); m_cS_DefaultConstructStrategy_Operation_getDefaultAssociation->setOrdered(false); m_cS_DefaultConstructStrategy_Operation_getRealizingClass_Interface->setName("getRealizingClass"); m_cS_DefaultConstructStrategy_Operation_getRealizingClass_Interface->setEType(uml::umlPackage::eInstance()->getClass_Class()); m_cS_DefaultConstructStrategy_Operation_getRealizingClass_Interface->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_getRealizingClass_Interface->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_getRealizingClass_Interface->setUnique(true); m_cS_DefaultConstructStrategy_Operation_getRealizingClass_Interface->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_getRealizingClass_Interface); parameter->setName("interface_"); parameter->setEType(uml::umlPackage::eInstance()->getInterface_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd->setName("getValuesFromConnectorEnd"); m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd->setEType(fUML::Semantics::Values::ValuesPackage::eInstance()->getValue_Class()); m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd->setLowerBound(0); m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd->setUpperBound(-1); m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd->setUnique(true); m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd); parameter->setName("context"); parameter->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Reference_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_getValuesFromConnectorEnd_CS_Reference_ConnectorEnd); parameter->setName("end"); parameter->setEType(uml::umlPackage::eInstance()->getConnectorEnd_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus->setName("instantiateInterface"); m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus->setEType(fUML::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getObject_Class()); m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus->setUnique(true); m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus); parameter->setName("interface"); parameter->setEType(uml::umlPackage::eInstance()->getInterface_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_instantiateInterface_Interface_Locus); parameter->setName("locus"); parameter->setEType(fUML::Semantics::Loci::LociPackage::eInstance()->getLocus_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_isArrayPattern_Connector->setName("isArrayPattern"); m_cS_DefaultConstructStrategy_Operation_isArrayPattern_Connector->setEType(ecore::ecorePackage::eInstance()->getEBoolean_Class()); m_cS_DefaultConstructStrategy_Operation_isArrayPattern_Connector->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_isArrayPattern_Connector->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_isArrayPattern_Connector->setUnique(true); m_cS_DefaultConstructStrategy_Operation_isArrayPattern_Connector->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_isArrayPattern_Connector); parameter->setName("c"); parameter->setEType(uml::umlPackage::eInstance()->getConnector_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_DefaultConstructStrategy_Operation_isStarPattern_Connector->setName("isStarPattern"); m_cS_DefaultConstructStrategy_Operation_isStarPattern_Connector->setEType(ecore::ecorePackage::eInstance()->getEBoolean_Class()); m_cS_DefaultConstructStrategy_Operation_isStarPattern_Connector->setLowerBound(1); m_cS_DefaultConstructStrategy_Operation_isStarPattern_Connector->setUpperBound(1); m_cS_DefaultConstructStrategy_Operation_isStarPattern_Connector->setUnique(true); m_cS_DefaultConstructStrategy_Operation_isStarPattern_Connector->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_DefaultConstructStrategy_Operation_isStarPattern_Connector); parameter->setName("c"); parameter->setEType(uml::umlPackage::eInstance()->getConnector_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } } void ActionsPackageImpl::initializeCS_ReadExtentActionActivationContent() { m_cS_ReadExtentActionActivation_Class->setName("CS_ReadExtentActionActivation"); m_cS_ReadExtentActionActivation_Class->setAbstract(false); m_cS_ReadExtentActionActivation_Class->setInterface(false); m_cS_ReadExtentActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_ReadExtentActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_ReadExtentActionActivation_Operation_doAction->setLowerBound(1); m_cS_ReadExtentActionActivation_Operation_doAction->setUpperBound(1); m_cS_ReadExtentActionActivation_Operation_doAction->setUnique(true); m_cS_ReadExtentActionActivation_Operation_doAction->setOrdered(false); } void ActionsPackageImpl::initializeCS_ReadSelfActionActivationContent() { m_cS_ReadSelfActionActivation_Class->setName("CS_ReadSelfActionActivation"); m_cS_ReadSelfActionActivation_Class->setAbstract(false); m_cS_ReadSelfActionActivation_Class->setInterface(false); m_cS_ReadSelfActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_ReadSelfActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_ReadSelfActionActivation_Operation_doAction->setLowerBound(1); m_cS_ReadSelfActionActivation_Operation_doAction->setUpperBound(1); m_cS_ReadSelfActionActivation_Operation_doAction->setUnique(true); m_cS_ReadSelfActionActivation_Operation_doAction->setOrdered(false); } void ActionsPackageImpl::initializeCS_RemoveStructuralFeatureValueActionActivationContent() { m_cS_RemoveStructuralFeatureValueActionActivation_Class->setName("CS_RemoveStructuralFeatureValueActionActivation"); m_cS_RemoveStructuralFeatureValueActionActivation_Class->setAbstract(false); m_cS_RemoveStructuralFeatureValueActionActivation_Class->setInterface(false); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_RemoveStructuralFeatureValueActionActivation_Operation_doAction->setLowerBound(1); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_doAction->setUpperBound(1); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_doAction->setUnique(true); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_doAction->setOrdered(false); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value->setName("getLinksToDestroy"); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Link_Class()); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value->setLowerBound(0); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value->setUpperBound(-1); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value->setUnique(true); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value); parameter->setName("value"); parameter->setEType(fUML::Semantics::SimpleClassifiers::SimpleClassifiersPackage::eInstance()->getStructuredValue_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value); parameter->setName("feature"); parameter->setEType(uml::umlPackage::eInstance()->getStructuralFeature_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getLinksToDestroy_StructuredValue_Value); parameter->setName("removedValue"); parameter->setEType(fUML::Semantics::Values::ValuesPackage::eInstance()->getValue_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setName("getPotentialLinkEnds"); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setEType(fUML::Semantics::Values::ValuesPackage::eInstance()->getValue_Class()); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setLowerBound(0); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setUpperBound(-1); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setUnique(true); m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature->setOrdered(false); { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature); parameter->setName("context"); parameter->setEType(PSCS::Semantics::StructuredClassifiers::StructuredClassifiersPackage::eInstance()->getCS_Reference_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } { std::shared_ptr<ecore::EParameter> parameter = ecore::ecoreFactory::eInstance()->createEParameter_as_eParameters_in_EOperation(m_cS_RemoveStructuralFeatureValueActionActivation_Operation_getPotentialLinkEnds_CS_Reference_StructuralFeature); parameter->setName("feature"); parameter->setEType(uml::umlPackage::eInstance()->getStructuralFeature_Class()); parameter->setLowerBound(0); parameter->setUpperBound(1); parameter->setUnique(true); parameter->setOrdered(true); } } void ActionsPackageImpl::initializeCS_SendSignalActionActivationContent() { m_cS_SendSignalActionActivation_Class->setName("CS_SendSignalActionActivation"); m_cS_SendSignalActionActivation_Class->setAbstract(false); m_cS_SendSignalActionActivation_Class->setInterface(false); m_cS_SendSignalActionActivation_Operation_doAction->setName("doAction"); { std::shared_ptr<ecore::ecoreFactory> factory = ecore::ecoreFactory::eInstance(); std::shared_ptr<ecore::EClass> unknownClass = factory ->createEClass(-1); unknownClass->setName("invalid"); unknownClass->setAbstract(true); unknownClass->setInterface(true); m_cS_SendSignalActionActivation_Operation_doAction->setEType(unknownClass); } m_cS_SendSignalActionActivation_Operation_doAction->setLowerBound(1); m_cS_SendSignalActionActivation_Operation_doAction->setUpperBound(1); m_cS_SendSignalActionActivation_Operation_doAction->setUnique(true); m_cS_SendSignalActionActivation_Operation_doAction->setOrdered(false); } void ActionsPackageImpl::initializePackageEDataTypes() { }
MDE4CPP/MDE4CPP
src/pscs/src_gen/PSCS/Semantics/Actions/impl/ActionsPackageImpl_Initialization.cpp
C++
mit
57,135
<?php /* Unsafe sample input : backticks interpretation, reading the file /tmp/tainted.txt sanitize : regular expression accepts everything construction : use of sprintf via a %s with simple quote */ /*Copyright 2015 Bertrand STIVALET Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.*/ $tainted = `cat /tmp/tainted.txt`; $re = "/^.*$/"; if(preg_match($re, $tainted) == 1){ $tainted = $tainted; } else{ $tainted = ""; } //flaw $var = require(sprintf("'%s'.php", $tainted)); ?>
stivalet/PHP-Vulnerability-test-suite
Injection/CWE_98/unsafe/CWE_98__backticks__func_preg_match-no_filtering__require_file_name-sprintf_%s_simple_quote.php
PHP
mit
1,311
const SuperPlug = require('superplug'); const debug = require('debug')('genie-router:plugins/Loader'); const path = require('path'); const os = require('os'); const Promise = require('bluebird'); const stat = Promise.promisify(require('fs').stat); const mkdir = Promise.promisify(require('fs').mkdir); const writeFile = Promise.promisify(require('fs').writeFile); const npmUtils = require('npm-utils'); const express = require('express'); const http = require('../http'); const getFromObject = require('../utils/getFromObject'); const objectGenerator = require('./objectGenerator'); class Loader { constructor(config, clientStartObjectGenerator, brainSelector, eventEmitter) { this.config = config; this.plugins = {}; this.clients = {}; this.clientStartObjectGenerator = clientStartObjectGenerator; this.brainSelector = brainSelector; this.eventEmitter = eventEmitter; } setHttpEnabled(value) { this.httpEnabled = value; } /** * Returns a promise that resolves when all plugins are loaded. * @return {Promise} */ async startPlugins() { try { this.location = await this._getPluginStoreLocation(); await stat(path.join(this.location, 'node_modules')); } catch (err) { if (err.code !== 'ENOENT') { throw err; } // TODO this is to to check if node_modules does not exist, but if a parent folder // also does not exist, it fails with weird errors. await this._npmInstall(); } this._superPlug = new SuperPlug({ location: this.location, packageProperty: 'genieRouterPlugin', }); await this._loadPlugins(); await this._startPlugins(); } /** * If this a configured path, make sure we can access it, if it is the default, create it if it does not exists. * @return Promise */ async _getPluginStoreLocation() { const configuredPath = getFromObject(this.config, 'pluginStore.location', false); if (configuredPath) { debug('Found configured path', configuredPath); await this._checkConfiguredPath(configuredPath); return configuredPath; } return this._useDefaultConfigurationPath(); } /** * Make sure that we can access the configured path. * @return Promise */ async _checkConfiguredPath(configuredPath) { const result = await stat(configuredPath); if (!result.isDirectory()) { throw new Error('Configured pluginStore location is not a directory.'); } await this._checkPluginLocation(configuredPath); } /** * Check if the default configuration path ($HOME/.genie-router) exists, * if not, create it. */ async _useDefaultConfigurationPath() { const defaultPath = path.join(os.homedir(), '.genie-router'); try { const result = await stat(defaultPath); debug(defaultPath, 'found'); if (!result.isDirectory()) { throw new Error(`${defaultPath} exists, but is not a directory`); } } catch (err) { if (err.code !== 'ENOENT') { throw err; } debug(defaultPath, 'did not exist.'); // Attempt to create the folder await mkdir(defaultPath); debug('Created', defaultPath); } await this._checkPluginLocation(defaultPath); return defaultPath; } async _checkPluginLocation(pluginPath) { debug(`Checking if ${pluginPath}/package.json exists`); try { const statResult = await stat(path.join(pluginPath, 'package.json')); if (!statResult.isFile()) { throw new Error(`${pluginPath}/package.json is not a file.`); } debug('Found package.json in ', pluginPath); return pluginPath; // It exists, we can return the Promise } catch (err) { if (err.code !== 'ENOENT') { throw err; } } // Create package.json debug('Creating package.json in folder', pluginPath); await writeFile( path.join(pluginPath, 'package.json'), JSON.stringify({ name: 'genie-router-plugins', dependencies: { // Default dependencies 'genie-router-cli-local': 'github:matueranet/genie-router-plugin-cli-local', 'genie-router-plugin-echo': 'github:matueranet/genie-router-plugin-echo', 'genie-router-plugin-brain-mentions': 'github:matueranet/genie-router-plugin-brain-mentions', }, }), ); return pluginPath; } getClients() { return this.clients; } _startPlugins() { const plugins = Object.keys(this.plugins); debug('Found plugins: ', plugins); const promises = []; const brains = {}; plugins.forEach((pluginName) => { const config = getFromObject(this.config, `plugins.${pluginName}`); const plugin = this.plugins[pluginName]; if (plugin.setRouter) { this.plugins[pluginName].setRouter(objectGenerator(this.config, pluginName)); } if (plugin.brain) { promises.push(this.plugins[pluginName].brain.start(config) .then((brain) => { brains[pluginName] = brain; })); } if (plugin.client) { // thing here is that the startObject needs the speak function, which // is only available after the start function has been invoked. Needed // some trickery to make it work. const startObject = this.clientStartObjectGenerator(pluginName, plugin); promises.push(this.plugins[pluginName].client.start( config, startObject, ).then((client) => { this.clients[pluginName] = client; })); } if (plugin.brainSelector) { promises.push(this.plugins[pluginName].brainSelector.start(config) .then((brainSelector) => { this.brainSelector.use(pluginName, brainSelector); })); } if (plugin.http) { if (!this.httpEnabled) { debug('HTTP is not enabled, Ignoring http component of plugin', pluginName); } else { promises.push(http() .then(app => this.plugins[pluginName].http.start(config, app, express))); } } if (plugin.listener) { promises.push(this.plugins[pluginName].listener.start(config, this.eventEmitter)); } }); return Promise.all(promises) .then(() => { this.brainSelector.setBrains(brains); }); } async _loadPlugins() { const foundPlugins = await this._superPlug.getPlugins(); const promises = []; foundPlugins.forEach((foundPlugin) => { // Only load the plugins which have a configuration if (getFromObject(this.config, `plugins.${foundPlugin.getName()}`) !== undefined) { const p = foundPlugin.getPlugin(); p.then((pluginModule) => { this.plugins[foundPlugin.getName()] = pluginModule; }); promises.push(p); } else { debug('Skipping loading plugin', foundPlugin.getName(), 'configuration is missing.'); } }); return Promise.all(promises); } /** * Runs 'npm install' without a module name, so that the modules are installed/updated. * @return Promise */ async _npmInstall() { const cwd = process.cwd(); process.chdir(this.location); await npmUtils.install({ name: '', flags: ['--quiet', '--production'], }); // move back to the old current dir process.chdir(cwd); } } module.exports = Loader;
matueranet/genie-router
lib/plugins/loader.js
JavaScript
mit
8,371
// testing iterating over an array various ways var arr = [] , i = 100000 , j = 0 exports.countPerLap = i while (i--) arr.push(i) exports.compare = { "i < arr.length" : function () { j = 0 for (var i = 0; i < arr.length; i ++) { j ++ } } , "i < l" : function () { j = 0 for (var i = 0, l = arr.length; i < l; i ++) { j ++ } } , "arr.forEach arity=1" : function () { j = 0 arr.forEach(function (_) { j ++ }) } , "arr.forEach arity=3" : function () { j = 0 arr.forEach(function (_,__,___) { j ++ }) } } require("../").runMain() /* Scores: (bigger is better) i < l Raw: > 251889.16876574306 > 251046.0251046025 > 251466.8901927913 > 251677.8523489933 > 234558.24863174354 Average (mean) 248127.63700877473 i < arr.length Raw: > 193423.59767891682 > 186219.739292365 > 193610.8422071636 > 193610.8422071636 > 174367.91630340018 Average (mean) 188246.58753780182 arr.forEach arity=3 Raw: > 43591.979075850046 > 43516.10095735422 > 43402.77777777778 > 43554.006968641115 > 42936.88278231001 Average (mean) 43400.34951238664 arr.forEach arity=1 Raw: > 35112.3595505618 > 35236.08174770966 > 35149.3848857645 > 35211.2676056338 > 33590.86328518643 Average (mean) 34859.991414971235 Winner: i < l Compared with next highest (i < arr.length), it's: 24.13% faster 1.32 times as fast 0.12 order(s) of magnitude faster Compared with the slowest (arr.forEach arity=1), it's: 85.95% faster 7.12 times as fast 0.85 order(s) of magnitude faster */
robashton/zombify
src/node_modules/zombie/node_modules/html5/node_modules/bench/examples/array-iteration.js
JavaScript
mit
1,646
import './highlightPvpProtection.css'; import getTextTrim from '../common/getTextTrim'; import { pointsUrl } from '../support/constants'; import querySelector from '../common/querySelector'; export default function highlightPvpProtection() { const pvpp = querySelector(`#profileLeftColumn a[href="${pointsUrl}"]`); if (pvpp && getTextTrim(pvpp.parentNode.nextSibling) !== 'N/A') { // Text Node pvpp.parentNode.parentNode.classList.add('fshPvpWarn'); } }
fallenswordhelper/fallenswordhelper
src/modules/profile/highlightPvpProtection.js
JavaScript
mit
465
<!DOCTYPE html> <html> <head> <title>{% block title %}Sprout {% endblock %}</title> {% block head %} <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="icon" href="/images/SproutLogo.png" type="image/x-icon"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <link rel="stylesheet" href="/css/kube.min.css" /> <link rel="stylesheet" href="/css/styles.css" /> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script> <script src="/scripts/vendors/kube.js"></script> <script src="/scripts/lessonsAccordion.js"></script> {% endblock %} </head> <body> {% block nav%} <header class="group"> <nav class="navbar navbar-left"> <ul> <li><a href="/">Home</a></li> <li><a href="/classes">Classes</a></li> {% if user %} <li><a href="/dashboard">Dashboard</a></li> {% else %} <li><a href="/purpose">/Purpose</a></li> <li><a href="/contact">Get In Touch</a></li> {% endif %} </ul> </nav> <nav class="navbar navbar-right"> <ul class="layout-auth"> {% if user %} <li><a href="/logout">Sign Out</a></li> {% else %} <li><a href="/register">Sign up</a></li> <li><a href="/login">Login</a></li> {% endif %} </ul> </nav> </header> {% endblock %} {% block content %}{% endblock %} {% block scripts %}{% endblock %} </body> </html>
NathanBland/Sprout
views/layout.html
HTML
mit
1,764
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title> Challenge Evaluation </title> <meta name="description" /> <meta name="author" /> <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=2.0;" /> <link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css"> <link rel="stylesheet" href="css/siteDefaults.css" /> <!-- Favicon --> <link rel="icon" href="imgs/favicons/favicon.ico"> <!-- Roboto Font --> <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/sprites.css" /> <link rel="stylesheet" href="css/challengeevaluation.css" /> <link media="all" rel="stylesheet" href="bower_components/pro-bars/assets/css/pro-bars.min.css" type="text/css" /> </head> <body class="bodyContainer"> <div class="siteHeader"> <div class="navContainerDiv container-fluid"> <div class="row"> <div class="col-sm-2 col-xs-offset-4 col-sm-offset-0"> <h1 class="siteLogo">C#er</h1> </div> <div class="col-sm-1 col-sm-offset-1 col-xs-1 col-xs-offset-1"> <div class="navBarItems"> <a class="scoreboardButton" href="scoreboard.html"></a> <p>Scoreboard</p> </div> </div> <div class="col-sm-1 col-sm-offset-1 col-xs-1 col-xs-offset-1"> <div class="navBarItems"> <a class="challengesButton" href="challenges.html"></a> <p>Challenges</p> </div> </div> <div class="col-sm-1 col-sm-offset-1 col-xs-1 col-xs-offset-1"> <div class="navBarItems"> <a class="skillsButton" href="skills.html"></a> <p>Skills</p> </div> </div> <div class="col-sm-1 col-sm-offset-1 col-xs-1 col-xs-offset-1"> <div class="navBarItems"> <a class="optionsButton" href="options.html"></a> <p>Options</p> </div> </div> <div class="col-sm-1 col-sm-offset-1 col-xs-1 col-xs-offset-1"> <div class="navBarItems"> <a class="dashboardButton" href="dashboard.html"></a> <p>Dashboard</p> </div> </div> </div> </div> </div> <div class="mainSectionContainer container-fluid"> <div class="col-sm-5"> <div class="row"> <div class="col-sm-1 col-xs-1"> <h2 id="rankField">Rank</h2> </div> </div> <div class="row"> <div class="col-sm-1 col-xs-1"> <h2 id="levelField">Level</h2> </div> </div> <div class="row"> <div class="col-sm-1 col-xs-1"> <h2 id="rankField">Skill </h2> </div> </div> <div id="skillCircle"> <strong> </strong> </div> <div class="row"> <div class="col-sm-1 col-xs-1"> <h2 id="rankField">Score</h2> </div> </div> <div id="scoreCircle"> <strong> </strong> </div> <div class="row"> <div class="col-sm-3 col-xs-1"> <h2 id="rankField">Progress</h2> </div> </div> <div class="col-sm-11 row"> <div class="pro-bar-container color-silver"> <div id="progressbarField" style="width: 0%;" class="pro-bar bar-20 color-midnight-blue animated" data-pro-bar-percent="0" data-pro-bar-delay="800"> <div class="pro-bar-candy candy-rtl"></div> </div> </div> </div> </div> <div class="col-sm-offset-5 col-xs-offset-3"> <img id="profilePicture" src="./imgs/dashboard/profileImage.png" /></div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript" src="bower_components/jquery/jquery.min.js"></script> <script type="text/javascript" src="js/challengeevaluation.js"></script> <script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.4.0.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> <script src="bower_components/backbone/backbone-min.js"></script> <script src="bower_components/smoothscroll/SmoothScroll.js" type="text/javascript"></script> <script src="assets/js/appear.min.js" type="text/javascript"></script> <script src="bower_components/jquery-circle-progress/dist/circle-progress.js"></script> <script src="assets/js/pro-bars.min.js" type="text/javascript"></script> </body> </html>
brandondrichards12/test2
challengeevaluation.html
HTML
mit
5,333
#include <GLUT/GLUT.h> #include <stdlib.h> #include <iostream> #include <vector> #include <math.h> #include <string> #include "ball.hpp" #include "paddle.hpp" #include "brick.hpp" #include "gm.hpp" #include "text3d.h" #define RIGHT 1 #define LEFT -1 #define UP 1 #define DOWN -1 #define ROWS 3 #define COLUMNS 5 static int flag=1; float camX=0.0, camY=0.0, camZ=24.0; int angles[2] = {45,-45}; int pause = 1; //ball(speed,x,y,dx,dy); Ball ball(0.0,0.0,0.01,0.05); //paddle(speed,x,y); Paddle paddle(1.0,0.0,-5.0); //enemy(speed,x,y); Paddle enemy(0.06,0.0,25.0); GM gameManager; std::vector<Brick*> list; float _angle = -30.0f; float _scale; void init(void) { GLfloat mat_specular[] = { 0.6, 0.6, 0.6, 1.0 }; GLfloat mat_ambient[] = {1.0,0.0,0.0,1.0}; GLfloat mat_shininess[] = { 0.0 }; GLfloat light_position[] = { 0.0, 5.0, 5.0, 1.0 }; glClearColor (0.0, 0.0, 0.0, 1.0); glShadeModel (GL_SMOOTH); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glLightfv(GL_LIGHT0, GL_POSITION, light_position); glShadeModel (GL_FLAT); glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_NORMALIZE); glShadeModel(GL_SMOOTH); t3dInit(); //We create the bricks and push them into a list Brick *ptrBrick; for (int i =0; i < ROWS; i++) { for (int j =0; j < COLUMNS; j++) { ptrBrick = new Brick (i+1 , j*2-4, i+3); list.push_back(ptrBrick); } } } void deleteFromList(int i) { //We delete the bircks from the list (1 less brick to destroy) list.erase(list.begin()+i); //winning condition if (list.empty()) { std::cout<<"Winner"<<std::endl; std::cout<<"Total Points: "<<gameManager.getPoints()<<std::endl; if (gameManager.getELives() <= 0) { exit(0); } } } double radian(double deg){ return deg * (3.14159265/ 180); } void checkCollisionUp(float x, float y) { for (int i =0; i < list.size(); i++) { if ((y-ball.getRadius()) <= list[i]->getSizeUp() && (y+ball.getRadius()) >= list[i]->getSizeDown() && x <= list[i]->getSizeRight() && x >= list[i]->getSizeLeft()){ //we add some points gameManager.setPoints(gameManager.getPoints()+list[i]->getPoints()); //if there is a collision with the brick delete the brick from the list deleteFromList(i); flag=0; } } if ((y-ball.getRadius()) <= enemy.getSizeUp() && (y+ball.getRadius()) >= enemy.getSizeDown() && x <= enemy.getSizeRight() && x >= enemy.getSizeLeft()){ float collisionPoint = paddle.getX()-ball.getX(); if (collisionPoint >= -1.5 && collisionPoint < -0.9) { ball.setVelocityX(0.1); }else if (collisionPoint >= -0.9 && collisionPoint < -0.3) { ball.setVelocityX(-0.05); }else if (collisionPoint >= -0.3 && collisionPoint < 0.0) { ball.setVelocityX(-0.01); } else if (collisionPoint >= 0.0 && collisionPoint < 0.3) { ball.setVelocityX(0.01); } else if (collisionPoint > 0.3 && collisionPoint <= 0.6) { ball.setVelocityX(0.05); } else if (collisionPoint > 0.6 && collisionPoint <= 1.5) { ball.setVelocityX(-0.1); } flag=0; } if(y>10.0) { flag=0; gameManager.setPoints(gameManager.getPoints()+3); gameManager.modifyELives(-1); if (gameManager.getELives() <= 0) { std::cout<<"Winner, Chicken Dinner"<<std::endl; std::cout<<"Points: " << gameManager.getPoints() <<std::endl; if (list.empty()){ exit(0); } } ball.reset(0.0,0.0,0.05,0.05); } } void checkCollisionDown(float x, float y) { for (int i =0; i < list.size(); i++) { if ((y+ball.getRadius()) <= list[i]->getSizeUp() && (y-ball.getRadius()) >= list[i]->getSizeDown() && x <= list[i]->getSizeRight() && x >= list[i]->getSizeLeft()) { deleteFromList(i); flag=1; } } //if the ball is in the border or inside the paddle throw it up if (y <= paddle.getSizeUp() && y >= paddle.getSizeDown() && x <= paddle.getSizeRight() && x >= paddle.getSizeLeft()){ float collisionPoint = paddle.getX()-ball.getX(); if (collisionPoint >= -1.5 && collisionPoint < -0.9) { ball.setVelocityX(0.1); }else if (collisionPoint >= -0.9 && collisionPoint < -0.3) { ball.setVelocityX(0.05); }else if (collisionPoint >= -0.3 && collisionPoint < 0.0) { ball.setVelocityX(-0.01); } else if (collisionPoint >= 0.0 && collisionPoint < 0.3) { ball.setVelocityX(0.01); } else if (collisionPoint > 0.3 && collisionPoint <= 0.6) { ball.setVelocityX(-0.05); } else if (collisionPoint > 0.6 && collisionPoint <= 1.5) { ball.setVelocityX(-0.1); } flag=1; }else if(y<-6.5) { gameManager.modifyLives(-1); //Reset Ball position ball.reset(0.0,0.0,0.05,0.05); //Check if game is over if (gameManager.getLives() == 0){ exit(0); } //Maybe add a timer here for the ball to wait } } void moveEnemy() { if (ball.getX()>enemy.getX()){ enemy.setX(RIGHT); }else { enemy.setX(LEFT); } } void drawBricks() { for (int i =0; i < list.size(); i++) { list[i]->drawBrick(); } } void update() { //direction managmentcc if(flag) { moveEnemy(); ball.setY(UP); ball.setX(UP); checkCollisionUp(ball.getX(),ball.getY()); }else if(!flag) { ball.setY(DOWN); ball.setX(DOWN); checkCollisionDown(ball.getX(),ball.getY()); } } void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f (1.0, 1.0, 1.0); glPushMatrix(); //Erase Later gluLookAt (camX, camY, camZ, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); gameManager.createScene(); if (list.empty()) { camY = gameManager.updateCam(); } glTranslatef(0.0, -1.5, 0.0); drawBricks(); //Put into bricks class later glColor3f (1.0, 0.0, 0.0); enemy.drawPaddle(); glColor3f (0.0, 0.0, 1.0); paddle.drawPaddle(); ball.drawBall(); glPopMatrix(); //we set this outside of the pop so we can keep it next to the camara gameManager.drawScoreboard(); glutSwapBuffers (); } void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluPerspective(45.0, (GLfloat) w/(GLfloat) h, 1.0, 100.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef (0.0, 0.0, -5.0); } void simulate() { if(pause != -1){ update(); glutPostRedisplay(); }else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glColor3f (1.0, 1.0, 1.0); glTranslatef(6.0f, 0.0f, -3.0f); GLfloat ambientColor[] = {0.4f, 0.4f, 0.4f, 1.0f}; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientColor); GLfloat lightColor0[] = {0.6f, 0.6f, 0.6f, 1.0f}; GLfloat lightPos0[] = {-0.5f, 0.5f, 1.0f, 0.0f}; glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor0); glLightfv(GL_LIGHT0, GL_POSITION, lightPos0); std::string p = "Pause"; glPushMatrix(); glTranslatef(-6, 0.0, 0.0f); glScalef(1, 1, 1); t3dDraw3D(p, 0, 0, 0.2f); glPopMatrix(); glPopMatrix(); glutSwapBuffers (); } } void keyboard(unsigned char key, int x, int y) { switch (key) { case 'q': exit(0); break; case 'c': camX++; glutPostRedisplay(); break; case 'C': camX--; glutPostRedisplay(); break; case 'v': camY++; glutPostRedisplay(); break; case 'V': camY--; glutPostRedisplay(); break; case 'b': camZ++; glutPostRedisplay(); break; case 'B': camZ--; glutPostRedisplay(); break; case 'd': case 'D': paddle.setX(RIGHT*.5); glutPostRedisplay(); break; case 'a': case 'A': paddle.setX(LEFT*.5); glutPostRedisplay(); break; case 'p': case 'P': pause = -pause; break; } } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize (500, 500); glutInitWindowPosition (100, 100); glutCreateWindow (argv[0]); init (); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutIdleFunc(simulate); glutMainLoop(); return 0; }
pzebadua/Breakout
Breakout/main.cpp
C++
mit
9,792
<?php /** * DAO class for the Mapping domain object. * * @license http://opensource.org/licenses/MIT The MIT License (MIT) */ namespace Skyflow\DAO; use Doctrine\DBAL\Connection; use Skyflow\DAO\AbstractUserOwnedDAO; use Skyflow\DAO\EventDAO; use Skyflow\DAO\FlowDAO; use Skyflow\Domain\AbstractModel; /** * DAO class for the Mapping domain object. */ class MappingDAO extends AbstractUserOwnedDAO { /** * The related Event DAO object. * * The event DAO is used when binding the mapping object event using * mapping->setEvent(). * * @var EventDAO */ private $eventDAO; /** * The related Flow DAO object. * * The flow DAO is used when binding the mapping object flow using * mapping->setFlow(). * * @var FlowDAO */ private $flowDAO; /** * {@inheritdoc} */ public function __construct( Connection $db, $objectType = 'mapping', $domainObjectClass = 'Skyflow\\Domain\\Mapping' ) { parent::__construct($db, $objectType, $domainObjectClass); } /** * Set the related Event DAO object. * * @param EventDAO $eventDAO The related Event DAO object. */ public function setEventDAO(EventDAO $eventDAO) { $this->eventDAO = $eventDAO; } /** * Get the related Event DAO object. * * @return EventDAO The related Event DAO object. */ public function getEventDAO() { return $this->eventDAO; } /** * Set the related Flow DAO object. * * @param FlowDAO $flowDAO The related Flow DAO object. */ public function setFlowDAO(FlowDAO $flowDAO) { $this->flowDAO = $flowDAO; } /** * Get the related Flow DAO object. * * @return FlowDAO The related Flow DAO object. */ public function getFlowDAO() { return $this->flowDAO; } /** * {@inheritdoc} */ public function getData(AbstractModel $model) { $data = parent::getData($model); $data['id_event'] = $model->getEvent()->getId(); $data['id_flow'] = $model->getFlow()->getId(); return $data; } /** * {@inheritdoc} */ protected function buildDomainObject($row) { $mapping = parent::buildDomainObject($row); if (array_key_exists('id_event', $row)) { // Find and set the associated article $eventId = $row['id_event']; $event = $this->getEventDAO()->findOneById($eventId); $mapping->setEvent($event); } if (array_key_exists('id_flow', $row)) { $flowId = $row['id_flow']; $flow = $this->getFlowDAO()->findOneById($flowId); $mapping->setFlow($flow); } return $mapping; } /** * Find a Mapping from it's User id and related Event id. * * @param string $eventId The id of the related Event. * @param string $userId The id of the User who owns the Mapping. * @return Mapping|null The found Mapping or null if none found. */ public function findByEventUser($eventId, $userId) { $sql = $this->getDb()->prepare("select * from mapping where id_event = ? and id_user = ?"); $sql->bindValue(1, $eventId); $sql->bindValue(2, $userId); $sql->execute(); $row = $sql->fetch(); if ($row) { return $this->buildDomainObject($row); } } }
Sylpheo/skyflow.io
src/Skyflow/DAO/MappingDAO.php
PHP
mit
3,507
This is the BRAND NEW release of Google Play Music Desktop Player. A lot of things have changed.<br> Here is a quick run down of all the cool new things. <ul style="padding-left: 20px"> <li style="list-style-type: disc">We now support Mac OSX!!!</li> <li style="list-style-type: disc">We have a whole bunch of new features</li> <li> <ul style="padding-left: 20px"> <li style="list-style-type: disc">Hands free voice controls! (Just try saying "hey music can you pause" or "hey music let's mix it up")</li> <li style="list-style-type: disc">Customizable hotkeys</li> <li style="list-style-type: disc">HTML5 Audio - NO MORE FLASH!!!!</li> <li style="list-style-type: disc">Minimize the app to task bar for background audio</li> <li style="list-style-type: disc">And a whole lot more, explore the new app!</li> </ul> </li> <li style="list-style-type: disc">Are you a developer? We are now exposing an API for you guys to use, check it out on our GitHub page</li> </ul> I've put a lot of work into the new version so I hope you love it :)
clatour/Google-Play-Music-Desktop-Player-UNOFFICIAL-
MR_CHANGELOG.html
HTML
mit
1,087
module.exports = function(grunt) { grunt.initConfig({ uglify: { core: { files: [{ expand: true, cwd: 'src/main/resources', src: 'public/js/**/*.js', dest: "target/classes", ext: '.min.js' }] } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.registerTask('default', ['uglify']); };
infsci2560fa16/getting-started-on-heroku-with-java-howelljoshua
gruntfile.js
JavaScript
mit
383
import { module, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; import { visit, click, currentURL, find, settled } from '@ember/test-helpers'; import { timeout } from 'ember-concurrency'; module('Acceptance | sidebar navigation', function (hooks) { setupApplicationTest(hooks); test('can navigate to namespace from sidebar', async function (assert) { await visit('/ember/1.0'); await click(find(`[data-test-namespace="Ember.String"] a`)); await timeout(10); await settled(); assert.equal( currentURL(), '/ember/1.0/namespaces/Ember.String', 'navigated to namespace' ); }); test('can navigate to module from sidebar', async function (assert) { await visit('/ember/1.0'); await click(find(`[data-test-module="ember-application"] a`)); await timeout(10); await settled(); assert.equal( currentURL(), '/ember/1.0/modules/ember-application', 'navigated to module' ); }); test('can navigate to class from sidebar', async function (assert) { await visit('/ember/1.0'); await click(find(`[data-test-class="Ember.Component"] a`)); await timeout(10); await settled(); assert.equal( currentURL(), '/ember/1.0/classes/Ember.Component', 'navigated to class' ); }); test('can navigate to home landing page', async function (assert) { await visit('/ember-data/2.12'); await click('[data-test-home] a'); await timeout(10); await settled(); assert.equal(currentURL(), '/ember/release', 'navigated to landing page'); }); });
ember-learn/ember-api-docs
tests/acceptance/sidebar-nav-test.js
JavaScript
mit
1,610
namespace TWS.Models { using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Security.Claims; using System.Threading.Tasks; public class User : IdentityUser { private ICollection<Assignment> assignments; private ICollection<TeamWorkRequest> teamWorkRequests; private ICollection<TeamWork> teamWorks; private ICollection<Message> messages; private ICollection<Resource> resources; public User() { this.assignments = new HashSet<Assignment>(); this.teamWorkRequests = new HashSet<TeamWorkRequest>(); this.teamWorks = new HashSet<TeamWork>(); this.messages = new HashSet<Message>(); this.resources = new HashSet<Resource>(); } public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<User> manager, string authenticationType) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, authenticationType); // Add custom user claims here return userIdentity; } [MaxLength(20)] [MinLength(2)] public string FirstName { get; set; } [MaxLength(20)] [MinLength(2)] public string LastName { get; set; } public bool IsOnline { get; set; } public virtual ICollection<Assignment> Assignments { get { return this.assignments; } set { this.assignments = value; } } public virtual ICollection<TeamWorkRequest> TeamWorkRequests { get { return this.teamWorkRequests; } set { this.teamWorkRequests = value; } } public virtual ICollection<TeamWork> TeamWorks { get { return this.teamWorks; } set { this.teamWorks = value; } } public virtual ICollection<Message> Messages { get { return this.messages; } set { this.messages = value; } } public virtual ICollection<Resource> Resources { get { return this.resources; } set { this.resources = value; } } } }
Telerik-Team-Lychee/TeamWorkSystem
TeamWorkSystem/TWS.Models/USer.cs
C#
mit
2,239
/*--- iGeo - http://igeo.jp Copyright (c) 2002-2013 Satoru Sugihara This file is part of iGeo. iGeo is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3. iGeo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with iGeo. If not, see <http://www.gnu.org/licenses/>. ---*/ package igeo; /** 3D vector filed agent. @author Satoru Sugihara */ public class I3DField extends IField implements I3DFieldI{ public I3DFieldI field; public I3DField(I3DFieldI f){ field=f; } public IVecI get(IVecI pt){ if(field==null){ return null; } return field.get(pt); } public IVecI get(IVecI pt, IVecI vel){ if(field==null){ return null; } return field.get(pt,vel); } //public void applyField(IParticleI p){ p.push(get(p.pos())); } public void applyField(IParticleI p){ p.push(get(p.pos(),p.vel())); //IVecI force = get(p.pos(),p.vel()); //IG.p("force = "+force); //p.push(force); } public I3DFieldI field(){ return field; } /** set no decay */ public I3DField noDecay(){ if(field!=null){ field.noDecay(); } return this; } /** set linear decay with threshold; When distance is equal to threshold, output is zero.*/ public I3DField linearDecay(double threshold){ if(field!=null){ field.linearDecay(threshold); } return this; } /** alias of linearDecay */ public I3DField linear(double threshold){ return linearDecay(threshold); } /** set Gaussian decay with threshold; Threshold is used as double of standard deviation (when distance is eqaul to threshold, output is 13.5% of original). */ public I3DField gaussianDecay(double threshold){ if(field!=null){ field.gaussianDecay(threshold); } return this; } /** alias of gaussianDecay */ public I3DField gaussian(double threshold){ return gaussianDecay(threshold); } /** alias of gaussianDecay */ public I3DField gauss(double threshold){ return gaussianDecay(threshold); } /** this returns current decay type */ //public Decay decay(); /** if output vector is besed on constant length (intensity) or variable depending geometry when curve or surface tangent is used */ public I3DField constantIntensity(boolean b){ if(field!=null){ field.constantIntensity(b); } return this; } /** if bidirectional is on, field force vector is flipped when velocity of particle is going opposite */ public I3DField bidirectional(boolean b){ if(field!=null){ field.bidirectional(b); } return this; } /** set decay threshold */ public I3DField threshold(double t){ if(field!=null){ field.threshold(t); } return this; } /** get decay threshold */ public double threshold(){ if(field==null){ return 0; } return field.threshold(); } /** set output intensity */ public I3DField intensity(double i){ if(field!=null){ field.intensity(i); } return this; } /** get output intensity */ public double intensity(){ if(field==null){ return 0; } return field.intensity(); } public void del(){ if(field!=null){ field.del(); } super.del(); } /** stop agent with option of deleting/keeping the geometry the agent owns */ public void del(boolean deleteGeometry){ if(deleteGeometry && field!=null) field.del(); super.del(deleteGeometry); } }
manorius/Processing
libraries/igeo/src/igeo/I3DField.java
Java
mit
3,696
class AddOauthSecretToAuthenticationProvider < ActiveRecord::Migration def change add_column :authentication_providers, :secret, :string, null: false end end
Linkastor/Linkastor
db/migrate/20150413094451_add_oauth_secret_to_authentication_provider.rb
Ruby
mit
166
unixdate: 1415912066 title: Welcome to Crisp! tags: ["crisp", "default-post"] --- :D Congratulations! You have successfully installed the Crisp blogging engine. To start blogging, you can go into the posts folder and delete this post. Then you can add your first post! It's very simple. In Crisp, posts are written in Markdown, which is really easy to start writing.
minizatic/crisp
posts/welcome-to-crisp.md
Markdown
mit
368
/******************************************************************************* Copyright (c) The Taichi Authors (2016- ). All Rights Reserved. The use of this software is governed by the LICENSE file. *******************************************************************************/ #pragma once #include <vector> #include <string> #include "taichi/common/interface.h" TI_NAMESPACE_BEGIN class Task : public Unit { public: virtual std::string run(const std::vector<std::string> &parameters) { TI_ASSERT_INFO(parameters.size() == 0, "No parameters supported."); return this->run(); } virtual std::string run() { return this->run(std::vector<std::string>()); } ~Task() override { } }; TI_INTERFACE(Task) template <typename T> inline std::enable_if_t< std::is_same<std::result_of_t<T(const std::vector<std::string> &)>, void>::value || std::is_same<std::result_of_t<T(const std::vector<std::string> &)>, const char *>::value, std::string> task_invoke(const T &func, const std::vector<std::string> &params) { func(params); return ""; } template <typename T> inline std::enable_if_t< std::is_same<std::result_of_t<T(const std::vector<std::string> &)>, std::string>::value, std::string> task_invoke(const T &func, const std::vector<std::string> &params) { return func(params); } template <typename T> inline std::enable_if_t<std::is_same<std::result_of_t<T()>, void>::value, std::string> task_invoke(const T &func, const std::vector<std::string> &params) { func(); return ""; } template <typename T> inline std::enable_if_t< std::is_same<std::result_of_t<T()>, std::string>::value || std::is_same<std::result_of_t<T()>, const char *>::value, std::string> task_invoke(const T &func, const std::vector<std::string> &params) { return func(); } #define TI_REGISTER_TASK(task) \ class Task_##task : public taichi::Task { \ std::string run(const std::vector<std::string> &parameters) override { \ return taichi::task_invoke<decltype(task)>(task, parameters); \ } \ }; \ TI_IMPLEMENTATION(Task, Task_##task, #task) TI_NAMESPACE_END
yuanming-hu/taichi
taichi/common/task.h
C
mit
2,439
using System; using System.Collections.Generic; using System.Linq.Expressions; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; using MvcCoreBootstrap.Rendering; using MvcCoreBootstrapForm.Builders; using MvcCoreBootstrapForm.Config; using MvcCoreBootstrapForm.Rendering; namespace MvcCoreBootstrapForm { public static class HtmlHelperSelectExtensions { /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">Html helper instance.</param> /// <param name="expression">Model property expression.</param> /// <param name="selectList">List containing the possible choices.</param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> public static IHtmlContent MvcCoreBootstrapDropdownFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList}; return(htmlHelper.ControlFor(expression, configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config)); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">Html helper instance.</param> /// <param name="expression">Model property expression.</param> /// <param name="selectList">List containing the possible choices.</param> /// <param name="htmlAttributes"> /// An <see cref="T:System.Object" /> that contains the HTML attributes for the &lt;select&gt; element. Alternatively, an /// <see cref="T:System.Collections.Generic.IDictionary`2" /> instance containing the HTML attributes. /// </param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> public static IHtmlContent MvcCoreBootstrapDropdownFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, object htmlAttributes, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList, HtmlAttributes = htmlAttributes}; return(htmlHelper.ControlFor(expression, configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config)); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">Html helper instance.</param> /// <param name="expression">Model property expression.</param> /// <param name="selectList">List containing the possible choices.</param> /// <param name="optionLabel"> /// The text for a default empty item. Does not include such an item if argument is <c>null</c>. /// Defaults to empty. /// </param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> public static IHtmlContent MvcCoreBootstrapDropdownFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, string optionLabel, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList, Default = optionLabel}; return(htmlHelper.ControlFor(expression, configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config)); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">Html helper instance.</param> /// <param name="expression">Model property expression.</param> /// <param name="selectList">List containing the possible choices.</param> /// <param name="optionLabel"> /// The text for a default empty item. Does not include such an item if argument is <c>null</c>. /// Defaults to empty. /// </param> /// <param name="htmlAttributes"> /// An <see cref="T:System.Object" /> that contains the HTML attributes for the &lt;select&gt; element. Alternatively, an /// <see cref="T:System.Collections.Generic.IDictionary`2" /> instance containing the HTML attributes. /// </param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> public static IHtmlContent MvcCoreBootstrapDropdownFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, string optionLabel, object htmlAttributes, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList, Default = optionLabel, HtmlAttributes = htmlAttributes}; return(htmlHelper.ControlFor(expression, configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config)); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> /// <remarks> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// &lt;select&gt; element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </remarks> public static IHtmlContent MvcCoreBootstrapDropdown(this IHtmlHelper htmlHelper, string expression, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig(); return(htmlHelper.Control(configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config, htmlHelper.DropDownList(expression))); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="optionLabel"> /// The text for a default empty item. Does not include such an item if argument is <c>null</c>. /// </param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> /// <remarks> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// &lt;select&gt; element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </remarks> public static IHtmlContent MvcCoreBootstrapDropdown(this IHtmlHelper htmlHelper, string expression, string optionLabel, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig(); return(htmlHelper.Control(configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config, htmlHelper.DropDownList(expression, optionLabel))); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="selectList"> /// A collection of <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.SelectListItem" /> objects used to populate the &lt;select&gt; element with /// &lt;optgroup&gt; and &lt;option&gt; elements. /// </param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> /// <remarks> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// &lt;select&gt; element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </remarks> public static IHtmlContent MvcCoreBootstrapDropdown(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList}; return(htmlHelper.Control(configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config, htmlHelper.DropDownList(expression, selectList))); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="selectList"> /// A collection of <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.SelectListItem" /> objects used to populate the &lt;select&gt; element with /// &lt;optgroup&gt; and &lt;option&gt; elements. /// </param> /// <param name="htmlAttributes"> /// An <see cref="T:System.Object" /> that contains the HTML attributes for the &lt;select&gt; element. Alternatively, an /// <see cref="T:System.Collections.Generic.IDictionary`2" /> instance containing the HTML attributes. /// </param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> /// <remarks> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// &lt;select&gt; element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </remarks> public static IHtmlContent MvcCoreBootstrapDropdown(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList, object htmlAttributes, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList, HtmlAttributes = htmlAttributes}; return(htmlHelper.Control(configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config, htmlHelper.DropDownList(expression, selectList, htmlAttributes))); } /// <summary> /// Renders a Bootstrap dropdown. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="selectList"> /// A collection of <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.SelectListItem" /> objects used to populate the &lt;select&gt; element with /// &lt;optgroup&gt; and &lt;option&gt; elements. /// </param> /// <param name="optionLabel"> /// The text for a default empty item. Does not include such an item if argument is <c>null</c>. /// </param> /// <param name="configAction">Action that implements dropdown configuration.</param> /// <returns>Dropdown html markup.</returns> /// <remarks> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// &lt;select&gt; element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </remarks> public static IHtmlContent MvcCoreBootstrapDropdown(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList, string optionLabel, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList, Default = optionLabel}; return(htmlHelper.Control(configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config, htmlHelper.DropDownList(expression, selectList, optionLabel))); } /// <summary> /// Renders a Bootstrap multiple select listbox. /// </summary> /// <param name="htmlHelper">Html helper instance.</param> /// <param name="expression">Model property expression.</param> /// <param name="selectList">List containing the possible choices.</param> /// <param name="configAction">Action that implements listbox configuration.</param> /// <returns>Listbox html markup.</returns> public static IHtmlContent MvcCoreBootstrapListboxFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Items = selectList, Multiple = true}; return(htmlHelper.ControlFor(expression, configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config)); } /// <summary> /// Renders a Bootstrap multiple select listbox. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="configAction">Action that implements listbox configuration.</param> /// <returns>Listbox html markup.</returns> /// <remarks> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// &lt;select&gt; element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </remarks> public static IHtmlContent MvcCoreBootstrapListbox(this IHtmlHelper htmlHelper, string expression, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Multiple = true}; return(htmlHelper.Control(configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config, htmlHelper.DropDownList(expression))); } /// <summary> /// Renders a Bootstrap multiple select listbox. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="selectList"> /// A collection of <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.SelectListItem" /> objects used to populate the &lt;select&gt; element with /// &lt;optgroup&gt; and &lt;option&gt; elements. /// </param> /// <param name="configAction">Action that implements listbox configuration.</param> /// <returns>Listbox html markup.</returns> /// <remarks> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// &lt;select&gt; element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </remarks> public static IHtmlContent MvcCoreBootstrapListbox(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList, Action<MvcCoreBootstrapDropdownBuilder> configAction = null) { DropdownConfig config = new DropdownConfig {Multiple = true, Items = selectList}; return(htmlHelper.Control(configAction, new MvcCoreBootstrapDropdownBuilder(config), new DropdownRenderer(config, new TooltipRenderer()), config, htmlHelper.DropDownList(expression, selectList))); } } }
Robelind/MvcCoreBootstrap
src/MvcCoreBootstrapForm/HtmlHelperSelectExtensions.cs
C#
mit
17,971
# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/
technekes/nib
.github/CODE_OF_CONDUCT.md
Markdown
mit
3,218
/** * Copyright 2000-2010 Geometria Contributors * http://geocentral.net/geometria * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License * http://www.gnu.org/licenses */ package net.geocentral.geometria.action; import java.awt.Color; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.Set; import javax.vecmath.Matrix3d; import javax.vecmath.Vector3d; import net.geocentral.geometria.model.GCamera; import net.geocentral.geometria.model.GDocument; import net.geocentral.geometria.model.GFace; import net.geocentral.geometria.model.GFigure; import net.geocentral.geometria.model.GPoint3d; import net.geocentral.geometria.model.GSelectable; import net.geocentral.geometria.model.GSolid; import net.geocentral.geometria.model.GStick; import net.geocentral.geometria.util.GDictionary; import net.geocentral.geometria.util.GMath; import net.geocentral.geometria.view.GCutDialog; import org.apache.log4j.Logger; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class GCutAction implements GLoggable, GActionWithHelp { private String figureName; private String[] childFigureNames; private String[] pLabels; private GDocument document; private GFigure figure; private GSolid solid; private String helpId; private static Logger logger = Logger.getLogger("net.geocentral.geometria"); public boolean execute(GDocumentHandler documentHandler, boolean quietMode) { logger.info(quietMode); document = documentHandler.getActiveDocument(); if (quietMode) { try { validateApply(); } catch (Exception exception) { return false; } } else { GFigure figure = document.getSelectedFigure(); figureName = figure.getName(); GSolid solid = figure.getSolid(); Set<GSelectable> selection = solid.getSelection(); prefill(selection); try { validateApply(); } catch (Exception exception) { GCutDialog dialog = new GCutDialog(documentHandler .getOwnerFrame(), this); dialog.prefill(pLabels[0], pLabels[1], pLabels[2]); dialog.setVisible(true); if (!dialog.getResult()) return false; } solid.clearSelection(); } document.setSelectedFigure(childFigureNames[1]); if (!quietMode) documentHandler.setDocumentModified(true); logger.info(figureName + ", " + Arrays.asList(pLabels) + ", " + Arrays.asList(childFigureNames)); return true; } private void prefill(Set<GSelectable> selection) { logger.info(""); GDocument document = GDocumentHandler.getInstance().getActiveDocument(); GFigure figure = document.getSelectedFigure(); GSolid solid = figure.getSolid(); pLabels = new String[3]; Iterator<GSelectable> it = selection.iterator(); if (selection.size() == 2) { GSelectable element1 = it.next(); GSelectable element2 = it.next(); if (element1 instanceof GStick && element2 instanceof GStick) { pLabels[0] = ((GStick)element1).label1; pLabels[1] = ((GStick)element1).label2; pLabels[2] = ((GStick)element2).label1; Collection<GFace> faces = solid.facesThroughPoints(pLabels); if (!faces.isEmpty()) pLabels[2] = ((GStick)element2).label2; } else if (element1 instanceof GPoint3d && element2 instanceof GStick || element2 instanceof GPoint3d && element1 instanceof GStick) { GPoint3d p; GStick s; if (element1 instanceof GPoint3d && element2 instanceof GStick) { p = (GPoint3d)element1; s = (GStick)element2; pLabels = new String[] { p.getLabel(), s.label1, s.label2 }; } else { p = (GPoint3d)element2; s = (GStick)element1; pLabels = new String[] { p.getLabel(), s.label1, s.label2 }; } } } else if (selection.size() == 3) { GSelectable element1 = it.next(); GSelectable element2 = it.next(); GSelectable element3 = it.next(); if (element1 instanceof GPoint3d && element2 instanceof GPoint3d && element3 instanceof GPoint3d) pLabels = new String[] { ((GPoint3d)element1).getLabel(), ((GPoint3d)element2).getLabel(), ((GPoint3d)element3).getLabel() }; } } public void validateApply() throws Exception { logger.info(""); figure = document.getFigure(figureName); solid = figure.getSolid(); // Validate reference points GPoint3d[] ps = new GPoint3d[3]; for (int i = 0; i < 3; i++) { if (pLabels[i].length() == 0) { logger.info("No end points: " + Arrays.asList(pLabels)); throw new Exception(GDictionary.get("EnterEndPoints")); } ps[i] = solid.getPoint(pLabels[i]); if (ps[i] == null) { logger.info("No point: " + pLabels[i]); throw new Exception(GDictionary.get("FigureContainsNoPoint", figureName, pLabels[i])); } } Collection<GFace> faces = solid.facesThroughPoints(pLabels); if (!faces.isEmpty()) { logger.info("No face: " + Arrays.asList(pLabels)); throw new Exception(GDictionary.get("PointsBelongToSameFace", pLabels[0], pLabels[1], pLabels[2])); } // Apply GDocumentHandler documentHandler = GDocumentHandler.getInstance(); GFigure[] childFigures = new GFigure[2]; childFigureNames = new String[2]; Vector3d v1 = new Vector3d(ps[1].coords); v1.sub(ps[0].coords); Vector3d v2 = new Vector3d(ps[2].coords); v2.sub(ps[0].coords); Vector3d n = new Vector3d(); n.cross(v1, v2); n.normalize(); if (n.z < - GMath.EPSILON) n.scale(-1); else if (n.z < GMath.EPSILON) { if (n.y < - GMath.EPSILON) n.scale(-1); else if (n.y < GMath.EPSILON) { if (n.x < - GMath.EPSILON) n.scale(-1); } } GSolid[] childSolids = new GSolid[2]; for (int i = 0; i < 2; i++) { childSolids[i] = solid.clone(); childSolids[i].cutOff(pLabels[0], n); n.scale(-1); childSolids[i].makeConfig(); double zoomFactor = childSolids[i].getBoundingSphere().getRadius() / solid.getBoundingSphere().getRadius(); childFigures[i] = documentHandler.newFigure(childSolids[i], zoomFactor); childFigures[i].setTransparent(figure.isTransparent()); childFigures[i].setLabelled(figure.isLabelled()); GCamera camera = figure.getCamera(); GCamera c = childFigures[i].getCamera(); c.setAttitude(new Matrix3d(camera.getAttitude())); c.setInitialAttitude(new Matrix3d(camera.getInitialAttitude())); Color baseColor = figure.getBaseColor(); childFigures[i].setBaseColor(new Color(baseColor.getRGB())); childFigureNames[i] = childFigures[i].getName(); } } public void undo(GDocumentHandler documentHandler) { logger.info(""); solid.clearSelection(); for (int i = 0; i < 2; i++) { documentHandler.removeFigure(childFigureNames[i]); document.removeFigure(childFigureNames[i]); } document.setSelectedFigure(figureName); logger.info("Cut figure " + figureName + " into figures " + childFigureNames[0] + ", " + childFigureNames[1] + " undone"); logger.info(figureName); } public GLoggable clone() { GCutAction action = new GCutAction(); action.figureName = figureName; action.childFigureNames = childFigureNames.clone(); action.pLabels = pLabels.clone(); return action; } public String toLogString() { StringBuffer buf = new StringBuffer(); buf.append(GDictionary.get("CutFigureThroughPoints", figureName, pLabels[1], pLabels[0], pLabels[2])); return String.valueOf(buf); } public void make(Element node) throws Exception { logger.info(""); NodeList ns = node.getElementsByTagName("figureName"); if (ns.getLength() == 0) { logger.error("No figure name"); throw new Exception(); } figureName = ns.item(0).getTextContent(); pLabels = new String[3]; ns = node.getElementsByTagName("p0Label"); if (ns.getLength() == 0) { logger.error("No p0Label"); throw new Exception(); } pLabels[0] = ns.item(0).getTextContent(); ns = node.getElementsByTagName("p1Label"); if (ns.getLength() == 0) { logger.error("No p1Label"); throw new Exception(); } pLabels[1] = ns.item(0).getTextContent(); ns = node.getElementsByTagName("p2Label"); if (ns.getLength() == 0) { logger.error("No p2Label"); throw new Exception(); } pLabels[2] = ns.item(0).getTextContent(); } public void serialize(StringBuffer buf) { logger.info(""); buf.append("\n<action>"); buf.append("\n<className>"); buf.append(this.getClass().getSimpleName()); buf.append("</className>"); buf.append("\n<figureName>"); buf.append(figureName); buf.append("</figureName>"); buf.append("\n<p0Label>"); buf.append(pLabels[0]); buf.append("</p0Label>"); buf.append("\n<p1Label>"); buf.append(pLabels[1]); buf.append("</p1Label>"); buf.append("\n<p2Label>"); buf.append(pLabels[2]); buf.append("</p2Label>"); buf.append("\n</action>"); } public void setInput(String p0String, String p1String, String p2String) { logger.info(p0String + ", " + p1String + ", " + p2String); this.pLabels[0] = p0String.toUpperCase(); this.pLabels[1] = p1String.toUpperCase(); this.pLabels[2] = p2String.toUpperCase(); } public String getShortDescription() { return GDictionary.get("cutFigure", figureName); } public String getHelpId() { return helpId; } public void setHelpId(String helpId) { this.helpId = helpId; } }
stelian56/geometria
archive/3.0/src/net/geocentral/geometria/action/GCutAction.java
Java
mit
11,317
#include <iostream> #include <vector> #include <cstdlib> using namespace std; class IntSet { public: // Contstructs a new set IntSet(); // Returns the number of (distinct) elements in the set. int size(); // Returns true if and only if the set contains 'item'. bool contains(int item); // Inserts 'item' into the set. // If 'item' is already a member of the set, this operation has no // effect. void insert(int item); // Removes 'item' from the set. // If 'item' is not a member of the set, this operation has no effect. void remove(int item); private: vector<int> vec; int index(int item); }; IntSet::IntSet() { } int IntSet::size() { return vec.size(); } int IntSet::index(int item) { for(size_t i = 0; i != vec.size(); i++) { if(vec[i] == item) { return i; } } return -1; } bool IntSet::contains(int item) { return (index(item) != -1); } void IntSet::insert(int item) { vec.push_back(item); } void IntSet::remove(int item) { int ind = index(item); while(ind != -1) { vec.erase(vec.begin() + ind); ind = index(item); } } int main() { srand(1337); IntSet s; for(int i = 0; i != 20; i++) { s.insert(rand() % 30); } for(int i = 0; i != 30; i++) { cout << i << ": " << (s.contains(i) ? "Yes" : "No") << endl; if (i % 2 == 0) { s.remove(i); } } cout << endl; for(int i = 0; i != 30; i++) { cout << i << ": " << (s.contains(i) ? "Yes" : "No") << endl; } for(int i = 0; i != 100000; i++) { s.insert(rand() % 55789127); } cout << "Done inserting" << endl; for(int i = 0; i != 1000000; i++) { s.contains(i); } }
hjalti/gagnaskipan-lectures
week05/code/set_vector.cpp
C++
mit
1,861
package deployer type Broadcaster struct { listeners map[int]chan interface{} incr int } func NewBroadcaster() *Broadcaster { b := &Broadcaster{ listeners: make(map[int]chan interface{}), } return b } func (b *Broadcaster) Write(message interface{}) { for _, channel := range b.listeners { channel <- message } } func (b *Broadcaster) Listen() (int, chan interface{}) { channel := make(chan interface{}) b.incr++ b.listeners[b.incr] = channel return b.incr, channel } func (b *Broadcaster) Unregister(index int) { delete(b.listeners, index) }
jsdir/deployer
broadcaster.go
GO
mit
569
--- layout: post title: Rule Number 1 date: 2012-06-15 20:40 author: admin comments: true --- You'd think that with the painting I did <a title="You’re Going WHERE?" href="http://tidyhusband.com/youre-going-where/">earlier this week</a> I would be all done with painting for a while, but guys you would be so wrong. I would now like to take this moment to introduce you to the <strong>first rule of husband club:</strong> <strong>Nobody volunteers to do stuff while their wife is away</strong> Guys, think about it - you have an opportunity here:  Play the stereo as loud as you want, go for coffee, drink beer, - anything you want to do and I'm going to guess that your idea of a good time is  not painting  - even if it does give you an excuse to drink beer. You can have the beverage of your choice without the work because <strong>she who is in charge  - is gone</strong>. Apparently,<strong> I didn't get the memo in time</strong> because I volunteered my services. <strong>Oh, yes I did.</strong> I remember it plain as day: We were at dinner when she was talking about her trip and I said "I'll paint the deck and lawn furniture while you're gone".  Her eyes lit up, and I think her heart grew three sizes that day.  It was too late - the words left my mouth. I volunteered. Kiss my couch surfing, remote flipping, week of do nothing with no chores goodbye. Then I went to Home Depot and stocked up on paint brushes. Then today  I realized: <em> <strong>holycrapshecomeshometommorrow</strong></em> and I havent stained the lawn furniture yet!!!  I put down the remote, picked up my paintbrush, kept the dog inside  - and got to work: <a href="http://tidyhusband.com/rule-number-1/furniture1/" rel="attachment wp-att-772"><img class="alignnone size-full wp-image-772" title="furniture1" src="http://tidyhusband.com/images/2012/06/furniture1.png" alt="" width="630" height="419" /></a> The table already had one coat on it and it still looked pretty dry so I added one more ooat a bit later. <a href="http://tidyhusband.com/rule-number-1/drying/" rel="attachment wp-att-773"><img class="alignnone size-full wp-image-773" title="drying" src="http://tidyhusband.com/images/2012/06/drying.png" alt="" width="630" height="414" /></a> Getting there..waiting for it to dry. <a href="http://tidyhusband.com/rule-number-1/bee/" rel="attachment wp-att-774"><img class="alignnone size-full wp-image-774" title="bee" src="http://tidyhusband.com/images/2012/06/bee.png" alt="" width="630" height="431" /></a> <strong>Wait! What's this?!!</strong>  I had to stop and put down my brush and send this little guy an eviction notice - with my boot. This explains why B kept getting stung last year. <a href="http://tidyhusband.com/rule-number-1/alldone1/" rel="attachment wp-att-775"><img class="alignnone size-full wp-image-775" title="alldone1" src="http://tidyhusband.com/images/2012/06/alldone1.png" alt="" width="630" height="406" /></a> And before you can say "Honey, I have been thinking", <strong>I was done.</strong> (OK, it took me all freakin' day) <a href="http://tidyhusband.com/rule-number-1/dogdone/" rel="attachment wp-att-776"><img class="alignnone size-full wp-image-776" title="dogdone" src="http://tidyhusband.com/images/2012/06/dogdone.png" alt="" width="630" height="425" /></a> But now we have the furniture and deck stained by yours truly and I'll try to remember<strong> husband club rule number 1</strong> for the future..maybe if I'm good I'll get to sit down and relax on our freshly painted deck and lawn furniture. I'm biased but I think it looks pretty good.  :)  And, thedog likes it. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
ramseeker/newjims
_posts/2012-06-15-rule-number-1.md
Markdown
mit
3,738
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * Jquery Class * * @package CodeIgniter * @subpackage Libraries * @category Loader * @author EllisLab Dev Team * @link https://codeigniter.com/user_guide/libraries/javascript.html */ class CI_Jquery extends CI_Javascript { /** * JavaScript directory location * * @var string */ protected $_javascript_folder = 'js'; /** * JQuery code for load * * @var array */ public $jquery_code_for_load = array(); /** * JQuery code for compile * * @var array */ public $jquery_code_for_compile = array(); /** * JQuery corner active flag * * @var bool */ public $jquery_corner_active = FALSE; /** * JQuery table sorter active flag * * @var bool */ public $jquery_table_sorter_active = FALSE; /** * JQuery table sorter pager active * * @var bool */ public $jquery_table_sorter_pager_active = FALSE; /** * JQuery AJAX image * * @var string */ public $jquery_ajax_img = ''; // -------------------------------------------------------------------- /** * Constructor * * @param array $params * @return void */ public function __construct($params) { $this->CI =& get_instance(); extract($params); if ($autoload === TRUE) { $this->script(); } log_message('info', 'Jquery Class Initialized'); } // -------------------------------------------------------------------- // Event Code // -------------------------------------------------------------------- /** * Blur * * Outputs a jQuery blur event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _blur($element = 'this', $js = '') { return $this->_add_event($element, $js, 'blur'); } // -------------------------------------------------------------------- /** * Change * * Outputs a jQuery change event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _change($element = 'this', $js = '') { return $this->_add_event($element, $js, 'change'); } // -------------------------------------------------------------------- /** * Click * * Outputs a jQuery click event * * @param string The element to attach the event to * @param string The code to execute * @param bool whether or not to return false * @return string */ protected function _click($element = 'this', $js = '', $ret_false = TRUE) { is_array($js) OR $js = array($js); if ($ret_false) { $js[] = 'return false;'; } return $this->_add_event($element, $js, 'click'); } // -------------------------------------------------------------------- /** * Double Click * * Outputs a jQuery dblclick event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _dblclick($element = 'this', $js = '') { return $this->_add_event($element, $js, 'dblclick'); } // -------------------------------------------------------------------- /** * Error * * Outputs a jQuery error event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _error($element = 'this', $js = '') { return $this->_add_event($element, $js, 'error'); } // -------------------------------------------------------------------- /** * Focus * * Outputs a jQuery focus event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _focus($element = 'this', $js = '') { return $this->_add_event($element, $js, 'focus'); } // -------------------------------------------------------------------- /** * Hover * * Outputs a jQuery hover event * * @param string - element * @param string - Javascript code for mouse over * @param string - Javascript code for mouse out * @return string */ protected function _hover($element = 'this', $over = '', $out = '') { $event = "\n\t$(".$this->_prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; $this->jquery_code_for_compile[] = $event; return $event; } // -------------------------------------------------------------------- /** * Keydown * * Outputs a jQuery keydown event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _keydown($element = 'this', $js = '') { return $this->_add_event($element, $js, 'keydown'); } // -------------------------------------------------------------------- /** * Keyup * * Outputs a jQuery keydown event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _keyup($element = 'this', $js = '') { return $this->_add_event($element, $js, 'keyup'); } // -------------------------------------------------------------------- /** * Load * * Outputs a jQuery load event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _load($element = 'this', $js = '') { return $this->_add_event($element, $js, 'load'); } // -------------------------------------------------------------------- /** * Mousedown * * Outputs a jQuery mousedown event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _mousedown($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mousedown'); } // -------------------------------------------------------------------- /** * Mouse Out * * Outputs a jQuery mouseout event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _mouseout($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mouseout'); } // -------------------------------------------------------------------- /** * Mouse Over * * Outputs a jQuery mouseover event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _mouseover($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mouseover'); } // -------------------------------------------------------------------- /** * Mouseup * * Outputs a jQuery mouseup event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _mouseup($element = 'this', $js = '') { return $this->_add_event($element, $js, 'mouseup'); } // -------------------------------------------------------------------- /** * Output * * Outputs script directly * * @param array $array_js = array() * @return void */ protected function _output($array_js = array()) { if ( ! is_array($array_js)) { $array_js = array($array_js); } foreach ($array_js as $js) { $this->jquery_code_for_compile[] = "\t".$js."\n"; } } // -------------------------------------------------------------------- /** * Resize * * Outputs a jQuery resize event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _resize($element = 'this', $js = '') { return $this->_add_event($element, $js, 'resize'); } // -------------------------------------------------------------------- /** * Scroll * * Outputs a jQuery scroll event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _scroll($element = 'this', $js = '') { return $this->_add_event($element, $js, 'scroll'); } // -------------------------------------------------------------------- /** * Unload * * Outputs a jQuery unload event * * @param string The element to attach the event to * @param string The code to execute * @return string */ protected function _unload($element = 'this', $js = '') { return $this->_add_event($element, $js, 'unload'); } // -------------------------------------------------------------------- // Effects // -------------------------------------------------------------------- /** * Add Class * * Outputs a jQuery addClass event * * @param string $element * @param string $class * @return string */ protected function _addClass($element = 'this', $class = '') { $element = $this->_prep_element($element); return '$('.$element.').addClass("'.$class.'");'; } // -------------------------------------------------------------------- /** * Animate * * Outputs a jQuery animate event * * @param string $element * @param array $params * @param string $speed 'slow', 'normal', 'fast', or time in milliseconds * @param string $extra * @return string */ protected function _animate($element = 'this', $params = array(), $speed = '', $extra = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); $animations = "\t\t\t"; foreach ($params as $param => $value) { $animations .= $param.": '".$value."', "; } $animations = substr($animations, 0, -2); // remove the last ", " if ($speed !== '') { $speed = ', '.$speed; } if ($extra !== '') { $extra = ', '.$extra; } return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.');'; } // -------------------------------------------------------------------- /** * Fade In * * Outputs a jQuery hide event * * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ protected function _fadeIn($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } return "$({$element}).fadeIn({$speed}{$callback});"; } // -------------------------------------------------------------------- /** * Fade Out * * Outputs a jQuery hide event * * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ protected function _fadeOut($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } return '$('.$element.').fadeOut('.$speed.$callback.');'; } // -------------------------------------------------------------------- /** * Hide * * Outputs a jQuery hide action * * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ protected function _hide($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } return "$({$element}).hide({$speed}{$callback});"; } // -------------------------------------------------------------------- /** * Remove Class * * Outputs a jQuery remove class event * * @param string $element * @param string $class * @return string */ protected function _removeClass($element = 'this', $class = '') { $element = $this->_prep_element($element); return '$('.$element.').removeClass("'.$class.'");'; } // -------------------------------------------------------------------- /** * Slide Up * * Outputs a jQuery slideUp event * * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ protected function _slideUp($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } return '$('.$element.').slideUp('.$speed.$callback.');'; } // -------------------------------------------------------------------- /** * Slide Down * * Outputs a jQuery slideDown event * * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ protected function _slideDown($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } return '$('.$element.').slideDown('.$speed.$callback.');'; } // -------------------------------------------------------------------- /** * Slide Toggle * * Outputs a jQuery slideToggle event * * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ protected function _slideToggle($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } return '$('.$element.').slideToggle('.$speed.$callback.');'; } // -------------------------------------------------------------------- /** * Toggle * * Outputs a jQuery toggle event * * @param string - element * @return string */ protected function _toggle($element = 'this') { $element = $this->_prep_element($element); return '$('.$element.').toggle();'; } // -------------------------------------------------------------------- /** * Toggle Class * * Outputs a jQuery toggle class event * * @param string $element * @param string $class * @return string */ protected function _toggleClass($element = 'this', $class = '') { $element = $this->_prep_element($element); return '$('.$element.').toggleClass("'.$class.'");'; } // -------------------------------------------------------------------- /** * Show * * Outputs a jQuery show event * * @param string - element * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds * @param string - Javascript callback function * @return string */ protected function _show($element = 'this', $speed = '', $callback = '') { $element = $this->_prep_element($element); $speed = $this->_validate_speed($speed); if ($callback !== '') { $callback = ", function(){\n{$callback}\n}"; } return '$('.$element.').show('.$speed.$callback.');'; } // -------------------------------------------------------------------- /** * Updater * * An Ajax call that populates the designated DOM node with * returned content * * @param string The element to attach the event to * @param string the controllers to run the call against * @param string optional parameters * @return string */ protected function _updater($container = 'this', $controller = '', $options = '') { $container = $this->_prep_element($container); $controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller); // ajaxStart and ajaxStop are better choices here... but this is a stop gap if ($this->CI->config->item('javascript_ajax_img') === '') { $loading_notifier = 'Loading...'; } else { $loading_notifier = '<img src="'.$this->CI->config->slash_item('base_url').$this->CI->config->item('javascript_ajax_img').'" alt="Loading" />'; } $updater = '$('.$container.").empty();\n" // anything that was in... get it out ."\t\t$(".$container.').prepend("'.$loading_notifier."\");\n"; // to replace with an image $request_options = ''; if ($options !== '') { $request_options .= ', {' .(is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(':', "':'", $options)."'") .'}'; } return $updater."\t\t$($container).load('$controller'$request_options);"; } // -------------------------------------------------------------------- // Pre-written handy stuff // -------------------------------------------------------------------- /** * Zebra tables * * @param string $class * @param string $odd * @param string $hover * @return string */ protected function _zebraTables($class = '', $odd = 'odd', $hover = '') { $class = ($class !== '') ? '.'.$class : ''; $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; $this->jquery_code_for_compile[] = $zebra; if ($hover !== '') { $hover = $this->hover("table{$class} tbody tr", "$(this).addClass('hover');", "$(this).removeClass('hover');"); } return $zebra; } // -------------------------------------------------------------------- // Plugins // -------------------------------------------------------------------- /** * Corner Plugin * * @link http://www.malsup.com/jquery/corner/ * @param string $element * @param string $corner_style * @return string */ public function corner($element = '', $corner_style = '') { // may want to make this configurable down the road $corner_location = '/plugins/jquery.corner.js'; if ($corner_style !== '') { $corner_style = '"'.$corner_style.'"'; } return '$('.$this->_prep_element($element).').corner('.$corner_style.');'; } // -------------------------------------------------------------------- /** * Modal window * * Load a thickbox modal window * * @param string $src * @param bool $relative * @return void */ public function modal($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } // -------------------------------------------------------------------- /** * Effect * * Load an Effect library * * @param string $src * @param bool $relative * @return void */ public function effect($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } // -------------------------------------------------------------------- /** * Plugin * * Load a plugin library * * @param string $src * @param bool $relative * @return void */ public function plugin($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } // -------------------------------------------------------------------- /** * UI * * Load a user interface library * * @param string $src * @param bool $relative * @return void */ public function ui($src, $relative = FALSE) { $this->jquery_code_for_load[] = $this->external($src, $relative); } // -------------------------------------------------------------------- /** * Sortable * * Creates a jQuery sortable * * @param string $element * @param array $options * @return string */ public function sortable($element, $options = array()) { if (count($options) > 0) { $sort_options = array(); foreach ($options as $k=>$v) { $sort_options[] = "\n\t\t".$k.': '.$v; } $sort_options = implode(',', $sort_options); } else { $sort_options = ''; } return '$('.$this->_prep_element($element).').sortable({'.$sort_options."\n\t});"; } // -------------------------------------------------------------------- /** * Table Sorter Plugin * * @param string table name * @param string plugin location * @return string */ public function tablesorter($table = '', $options = '') { $this->jquery_code_for_compile[] = "\t$(".$this->_prep_element($table).').tablesorter('.$options.");\n"; } // -------------------------------------------------------------------- // Class functions // -------------------------------------------------------------------- /** * Add Event * * Constructs the syntax for an event, and adds to into the array for compilation * * @param string The element to attach the event to * @param string The code to execute * @param string The event to pass * @return string */ protected function _add_event($element, $js, $event) { if (is_array($js)) { $js = implode("\n\t\t", $js); } $event = "\n\t$(".$this->_prep_element($element).').'.$event."(function(){\n\t\t{$js}\n\t});\n"; $this->jquery_code_for_compile[] = $event; return $event; } // -------------------------------------------------------------------- /** * Compile * * As events are specified, they are stored in an array * This function compiles them all for output on a page * * @param string $view_var * @param bool $script_tags * @return void */ protected function _compile($view_var = 'script_foot', $script_tags = TRUE) { // External references $external_scripts = implode('', $this->jquery_code_for_load); $this->CI->load->vars(array('library_src' => $external_scripts)); if (count($this->jquery_code_for_compile) === 0) { // no inline references, let's just return return; } // Inline references $script = '$(document).ready(function() {'."\n" .implode('', $this->jquery_code_for_compile) .'});'; $output = ($script_tags === FALSE) ? $script : $this->inline($script); $this->CI->load->vars(array($view_var => $output)); } // -------------------------------------------------------------------- /** * Clear Compile * * Clears the array of script events collected for output * * @return void */ protected function _clear_compile() { $this->jquery_code_for_compile = array(); } // -------------------------------------------------------------------- /** * Document Ready * * A wrapper for writing document.ready() * * @param array $js * @return void */ protected function _document_ready($js) { is_array($js) OR $js = array($js); foreach ($js as $script) { $this->jquery_code_for_compile[] = $script; } } // -------------------------------------------------------------------- /** * Script Tag * * Outputs the script tag that loads the jquery.js file into an HTML document * * @param string $library_src * @param bool $relative * @return string */ public function script($library_src = '', $relative = FALSE) { $library_src = $this->external($library_src, $relative); $this->jquery_code_for_load[] = $library_src; return $library_src; } // -------------------------------------------------------------------- /** * Prep Element * * Puts HTML element in quotes for use in jQuery code * unless the supplied element is the Javascript 'this' * object, in which case no quotes are added * * @param string * @return string */ protected function _prep_element($element) { if ($element !== 'this') { $element = '"'.$element.'"'; } return $element; } // -------------------------------------------------------------------- /** * Validate Speed * * Ensures the speed parameter is valid for jQuery * * @param string * @return string */ protected function _validate_speed($speed) { if (in_array($speed, array('slow', 'normal', 'fast'))) { return '"'.$speed.'"'; } elseif (preg_match('/[^0-9]/', $speed)) { return ''; } return $speed; } }
thamerbelfkihthamer/repo
system/libraries/Javascript/Jquery.php
PHP
mit
25,524
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const chalk_1 = require("chalk"); const cli_utils_1 = require("@ionic/cli-utils"); const command_1 = require("@ionic/cli-utils/lib/command"); const common_1 = require("./common"); let PackageInfoCommand = class PackageInfoCommand extends command_1.Command { run(inputs, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const { PackageClient } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/package')); const { columnar } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/utils/format')); const [id] = inputs; const { json } = options; let buildId = isNaN(Number(id)) ? undefined : Number(id); const token = yield this.env.session.getAppUserToken(); const pkg = new PackageClient(token, this.env.client); if (buildId) { if (!json) { this.env.tasks.next(`Retrieving information about build ${chalk_1.default.bold(String(buildId))}`); } } else { if (!json) { this.env.tasks.next('Retrieving latest build information'); } const latestBuilds = yield pkg.getBuilds({ pageSize: 1 }); if (latestBuilds.length === 0) { if (json) { process.stdout.write(JSON.stringify(undefined)); return; } else { this.env.tasks.end(); return this.env.log.warn(`You don't have any builds yet! Run ${chalk_1.default.green('ionic package build --help')} to learn how.`); } } buildId = latestBuilds[0].id; } const build = yield pkg.getBuild(buildId, { 'fields': ['output'] }); if (json) { process.stdout.write(JSON.stringify(build)); } else { const formattedBuild = pkg.formatBuildValues(build); this.env.tasks.end(); const attrs = ['id', 'status', 'platform', 'mode', 'security_profile_tag', 'created', 'completed']; const formatAttr = (attr) => { let r = attr; if (attr === 'created') { r = 'started'; } else if (attr === 'completed') { r = 'finished'; } else if (attr === 'security_profile_tag') { r = 'profile'; } return chalk_1.default.bold(r); }; const table = columnar(attrs.map(attr => [formatAttr(attr), formattedBuild[attr] || '']), {}); this.env.log.nl(); this.env.log.msg(table); this.env.log.nl(); if (build.status === 'FAILED') { if (build.output) { this.env.log.msg(`${chalk_1.default.bold('output')}:\n`); this.env.log.msg(build.output); } else { this.env.log.msg('no output'); } } } }); } }; PackageInfoCommand = tslib_1.__decorate([ command_1.CommandMetadata({ name: 'info', type: 'project', backends: [cli_utils_1.BACKEND_LEGACY], deprecated: true, description: 'Get info about a build', longDescription: ` ${chalk_1.default.bold.yellow('WARNING')}: ${common_1.DEPRECATION_NOTICE} Ionic Package makes it easy to build a native binary of your app in the cloud. Full documentation can be found here: ${chalk_1.default.bold('https://docs.ionic.io/services/package/')} `, inputs: [ { name: 'id', description: 'The build ID. Defaults to the latest build', required: false, }, ], options: [ { name: 'json', description: 'Output build info in JSON', type: Boolean, }, ], exampleCommands: ['', '15'], }) ], PackageInfoCommand); exports.PackageInfoCommand = PackageInfoCommand;
pocketpimps/pocketpimps-app
node_modules/ionic/dist/commands/package/info.js
JavaScript
mit
4,511
--- title: 混乱的 Markdown 世界 date: '2017-08-24' slug: markdown-flavors --- 经过十个月的奋战,终于发布了 blogdown 的第一个 [CRAN 版本](https://cran.rstudio.com/package=blogdown)。就在发布前夕,我突然注意到 Hugo [开始支持](https://gohugo.io/content-management/formats/)另一个 Markdown 变种,叫 Mmark。于是我看了一下 Mmark 的文档,惊喜地发现它竟然支持数学公式,但看完文档后觉得快疯了。这特么又是一种奇怪的 Markdown 方言。 比如数学公式只能用双美元符号写,包括行内公式(按 LaTeX 常规语法来说应该用一对单美元符号)。这种要求用双美元符号的语法纯粹是出于开发者的自私:因为他想避免文档解析的潜在歧义,也就是说,双美元符号比较奇怪,所以通常不会发生误写的事件;只要出现一对双美元符号,十之八九一定是数学公式。单美元符号的撞车概率就高多了,它可能真的表示美元。 用双美元符号写公式会让文档的可移植性变差,我想这也是大多数 Markdown 方言开发者没考虑的事情。他们只想着生成 HTML 页面,而没想过输出 LaTeX / PDF 的可能。Pandoc 是少有的业界良心,它多花了一些心思支持单美元符号,这样可以跟 LaTeX 靠得更近。Pandoc 花的心思其实并不复杂,比如要求起始美元符号后面不可以跟空格、结束美元符号前面不能是空格,等等。这样就大大减少了美元符号被误判为数学公式的可能性。我在 xaringan 包中[学习了这一点](https://github.com/yihui/xaringan/blob/32fd94f8f/R/utils.R#L78-L105),为用户节省了两个反引号的输入(这里的几个正则表达式是这个包里我比较得意的伎俩,不过我没写注释)。 因为被 Mmark 的语法吓到了,我开始琢磨为什么大家不能以 Pandoc 为标杆开发自己的方言。Pandoc 的作者和另一伙人发起了 CommonMark,有志于标准化 Markdown 语法,省得日复一日大家重复发明奇怪的鸟语方言。然而我发现 CommonMark 的语法设定中并没有包含数学公式,于是我放狗搜了一下,发现了[这个讨论帖](https://talk.commonmark.org/t/1926)。读了楼主最后给的两个链接之后,我实在是对这个世界感到森森的绝望。对[第一个链接](http://cwoebker.com/posts/latex-math-magic),我已经给出了我的[究极解决方案](/cn/2017/04/mathjax-markdown/),我觉得比伊高明多了;对[第二个链接](https://github.com/cben/mathdown/wiki/math-in-markdown),我的老天,世上竟然已经有这么多 Markdown 鸟语方言,而且各自有各自奇怪的数学公式语法。 所以当客官们看到神马软件说“支持 Markdown”的时候,一定要研究一下到底它支持的是哪种方言。目前我能接受的只有两种:一种自然是 Pandoc,另一种是 remark.js。后一种虽说也很离经叛道,但它有它独特的妙用,所以我可以谅解作者发明了很不一样的方言。其它不遵守 CommonMark 的方言我觉得都难以原谅。
yihui/yihui.name
content/cn/2017-08-24-markdown-flavors.md
Markdown
mit
3,148
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /* | ------------------------------------------------------------------- | DATABASE CONNECTIVITY SETTINGS | ------------------------------------------------------------------- | This file will contain the settings needed to access your database. | | For complete instructions please consult the 'Database Connection' | page of the User Guide. | | ------------------------------------------------------------------- | EXPLANATION OF VARIABLES | ------------------------------------------------------------------- | | ['dsn'] The full DSN string describe a connection to the database. | ['hostname'] The hostname of your database server. | ['username'] The username used to connect to the database | ['password'] The password used to connect to the database | ['database'] The name of the database you want to connect to | ['dbdriver'] The database driver. e.g.: mysqli. | Currently supported: | cubrid, ibase, mssql, mysql, mysqli, oci8, | odbc, pdo, postgre, sqlite, sqlite3, sqlsrv | ['dbprefix'] You can add an optional prefix, which will be added | to the table name when using the Query Builder class | ['pconnect'] TRUE/FALSE - Whether to use a persistent connection | ['db_debug'] TRUE/FALSE - Whether database errors should be displayed. | ['cache_on'] TRUE/FALSE - Enables/disables query caching | ['cachedir'] The path to the folder where cache files should be stored | ['char_set'] The character set used in communicating with the database | ['dbcollat'] The character collation used in communicating with the database | NOTE: For MySQL and MySQLi databases, this setting is only used | as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7 | (and in table creation queries made with DB Forge). | There is an incompatibility in PHP with mysql_real_escape_string() which | can make your site vulnerable to SQL injection if you are using a | multi-byte character set and are running versions lower than these. | Sites using Latin-1 or UTF-8 database character set and collation are unaffected. | ['swap_pre'] A default table prefix that should be swapped with the dbprefix | ['encrypt'] Whether or not to use an encrypted connection. | | 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE | 'mysqli' and 'pdo/mysql' drivers accept an array with the following options: | | 'ssl_key' - Path to the private key file | 'ssl_cert' - Path to the public key certificate file | 'ssl_ca' - Path to the certificate authority file | 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format | 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':') | 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only) | | ['compress'] Whether or not to use client compression (MySQL only) | ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections | - good for ensuring strict SQL while developing | ['ssl_options'] Used to set various SSL options that can be used when making SSL connections. | ['failover'] array - A array with 0 or more data for connections if the main should fail. | ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries. | NOTE: Disabling this will also effectively disable both | $this->db->last_query() and profiling of DB queries. | When you run a query, with this setting set to TRUE (default), | CodeIgniter will store the SQL statement for debugging purposes. | However, this may cause high memory usage, especially if you run | a lot of SQL queries ... disable this to avoid that problem. | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the 'default' group). | | The $query_builder variables lets you determine whether or not to load | the query builder class. */ /* | |注解 |对于 PDO 驱动,你应该使用 $config['dsn'] 取代 'hostname' 和 'database' 参数: |$config['dsn'] = 'mysql:host=localhost;dbname=mydatabase'; */ $active_group = 'default'; $query_builder = TRUE; $db['default'] = array( //'dsn' => 'mysql:host=localhost;dbname=chef', 'dsn' => '', 'hostname' => '', 'username' => '', 'password' => '', 'database' => '', 'dbdriver' => 'mysqli', //'dbdriver' => 'PDO', 'dbprefix' => '', 'pconnect' => FALSE, 'db_debug' => (ENVIRONMENT !== 'production'), 'cache_on' => FALSE, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => FALSE, 'compress' => FALSE, 'stricton' => FALSE, 'failover' => array(), 'save_queries' => TRUE );
kerenTeam/WX_Chef-dev
wxchef/config/database.php
PHP
mit
4,750
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("08.Logs-Aggregator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("08.Logs-Aggregator")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("065fea0f-f56e-4d8f-a2c1-82265f402ba0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
kriss98/Softuni-Tech-Module-September-2017-Programming-Fundamentals
Programming-Fundamentals/17.Dictionaries-Lambda-Expressions-And-LINQ-Exercises/08.Logs-Aggregator/Properties/AssemblyInfo.cs
C#
mit
1,407
#region File Description //----------------------------------------------------------------------------- // Tank.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; #endregion namespace SplitScreenSample { /// <summary> /// Helper class for drawing a tank model with animated wheels and turret. This class /// was borrowed from the Simple Animation Sample. /// </summary> public class Tank { #region Fields // The XNA framework Model object that we are going to display. Model tankModel; // Shortcut references to the bones that we are going to animate. // We could just look these up inside the Draw method, but it is more // efficient to do the lookups while loading and cache the results. ModelBone leftBackWheelBone; ModelBone rightBackWheelBone; ModelBone leftFrontWheelBone; ModelBone rightFrontWheelBone; ModelBone leftSteerBone; ModelBone rightSteerBone; ModelBone turretBone; ModelBone cannonBone; ModelBone hatchBone; // Store the original transform matrix for each animating bone. Matrix leftBackWheelTransform; Matrix rightBackWheelTransform; Matrix leftFrontWheelTransform; Matrix rightFrontWheelTransform; Matrix leftSteerTransform; Matrix rightSteerTransform; Matrix turretTransform; Matrix cannonTransform; Matrix hatchTransform; // Array holding all the bone transform matrices for the entire model. // We could just allocate this locally inside the Draw method, but it // is more efficient to reuse a single array, as this avoids creating // unnecessary garbage. Matrix[] boneTransforms; // Current animation positions. float wheelRotationValue; float steerRotationValue; float turretRotationValue; float cannonRotationValue; float hatchRotationValue; #endregion #region Properties /// <summary> /// Gets or sets the wheel rotation amount. /// </summary> public float WheelRotation { get { return wheelRotationValue; } set { wheelRotationValue = value; } } /// <summary> /// Gets or sets the steering rotation amount. /// </summary> public float SteerRotation { get { return steerRotationValue; } set { steerRotationValue = value; } } /// <summary> /// Gets or sets the turret rotation amount. /// </summary> public float TurretRotation { get { return turretRotationValue; } set { turretRotationValue = value; } } /// <summary> /// Gets or sets the cannon rotation amount. /// </summary> public float CannonRotation { get { return cannonRotationValue; } set { cannonRotationValue = value; } } /// <summary> /// Gets or sets the entry hatch rotation amount. /// </summary> public float HatchRotation { get { return hatchRotationValue; } set { hatchRotationValue = value; } } #endregion /// <summary> /// Loads the tank model. /// </summary> public void Load(ContentManager content) { // Load the tank model from the ContentManager. tankModel = content.Load<Model>("tank"); // Look up shortcut references to the bones we are going to animate. leftBackWheelBone = tankModel.Bones["l_back_wheel_geo"]; rightBackWheelBone = tankModel.Bones["r_back_wheel_geo"]; leftFrontWheelBone = tankModel.Bones["l_front_wheel_geo"]; rightFrontWheelBone = tankModel.Bones["r_front_wheel_geo"]; leftSteerBone = tankModel.Bones["l_steer_geo"]; rightSteerBone = tankModel.Bones["r_steer_geo"]; turretBone = tankModel.Bones["turret_geo"]; cannonBone = tankModel.Bones["canon_geo"]; hatchBone = tankModel.Bones["hatch_geo"]; // Store the original transform matrix for each animating bone. leftBackWheelTransform = leftBackWheelBone.Transform; rightBackWheelTransform = rightBackWheelBone.Transform; leftFrontWheelTransform = leftFrontWheelBone.Transform; rightFrontWheelTransform = rightFrontWheelBone.Transform; leftSteerTransform = leftSteerBone.Transform; rightSteerTransform = rightSteerBone.Transform; turretTransform = turretBone.Transform; cannonTransform = cannonBone.Transform; hatchTransform = hatchBone.Transform; // Allocate the transform matrix array. boneTransforms = new Matrix[tankModel.Bones.Count]; } /// <summary> /// Draws the tank model, using the current animation settings. /// </summary> public void Draw(Matrix world, Matrix view, Matrix projection) { // Set the world matrix as the root transform of the model. tankModel.Root.Transform = world; // Calculate matrices based on the current animation position. Matrix wheelRotation = Matrix.CreateRotationX(wheelRotationValue); Matrix steerRotation = Matrix.CreateRotationY(steerRotationValue); Matrix turretRotation = Matrix.CreateRotationY(turretRotationValue); Matrix cannonRotation = Matrix.CreateRotationX(cannonRotationValue); Matrix hatchRotation = Matrix.CreateRotationX(hatchRotationValue); // Apply matrices to the relevant bones. leftBackWheelBone.Transform = wheelRotation * leftBackWheelTransform; rightBackWheelBone.Transform = wheelRotation * rightBackWheelTransform; leftFrontWheelBone.Transform = wheelRotation * leftFrontWheelTransform; rightFrontWheelBone.Transform = wheelRotation * rightFrontWheelTransform; leftSteerBone.Transform = steerRotation * leftSteerTransform; rightSteerBone.Transform = steerRotation * rightSteerTransform; turretBone.Transform = turretRotation * turretTransform; cannonBone.Transform = cannonRotation * cannonTransform; hatchBone.Transform = hatchRotation * hatchTransform; // Look up combined bone matrices for the entire model. tankModel.CopyAbsoluteBoneTransformsTo(boneTransforms); // Draw the model. foreach (ModelMesh mesh in tankModel.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = boneTransforms[mesh.ParentBone.Index]; effect.View = view; effect.Projection = projection; effect.EnableDefaultLighting(); } mesh.Draw(); } } } }
DDReaper/XNAGameStudio
Samples/SplitScreenSample_4_0/SplitScreenSample/SplitScreenSample/Tank.cs
C#
mit
7,488
namespace InMemoryBus { public interface ICommandHandler<T> : IMessageHandler<T> where T : ICommand { } }
sakowiczm/InMemoryBus
InMemoryBus/Interfaces/ICommandHandler.cs
C#
mit
109
<?php namespace Ratchet\Resource\Command; use Ratchet\Component\ComponentInterface; /** * Socket implementation of the Command Pattern * User created applications are to return a Command to the server for execution */ interface CommandInterface { /** * The Server class will call the execution * @param Ratchet\ComponentInterface Scope to execute the command under * @return CommandInterface|NULL */ function execute(ComponentInterface $scope = null); }
thinq4yourself/Ratchet
src/Ratchet/Resource/Command/CommandInterface.php
PHP
mit
485
\begin{tabular}{ l r } One & 0 (0.00 \%)\\ Two & 2091 (71.51 \%)\\ Three & 824 (28.18 \%)\\ Four & 1 (0.03 \%)\\ Five & 3 (0.10 \%)\\ Six & 5 (0.17 \%)\\ \end{tabular}
massimo-nocentini/neural-networks-exam
documentation/original-gradient-descent-histogram.tex
TeX
mit
175
/** * @author : Adarsh Pastakia * @version : 5.0.0 * @copyright : 2019 * @license : MIT */ import { customElement, inlineView } from "aurelia-framework"; import ResizeObserver from "resize-observer-polyfill"; import { UIInternal } from "../utils/ui-internal"; @customElement("ui-content") @inlineView(`<template class="ui-section__content" ref="vmElement"><slot></slot></template>`) export class UIContent { private obResize: ResizeObserver; constructor(private element: Element) {} protected attached() { this.obResize = new ResizeObserver(() => this.element.dispatchEvent( UIInternal.createEvent("resize", this.element.getBoundingClientRect()) ) ); this.obResize.observe(this.element); } protected detached() { this.obResize.disconnect(); } }
adarshpastakia/aurelia-ui-framework
src/page/ui-content.ts
TypeScript
mit
810
// // UIButton+KaKa.h // KaKa // // Created by 郭 健 on 15/1/26. // Copyright (c) 2015年 YiXin. All rights reserved. // #import <UIKit/UIKit.h> @interface UIButton (KaKa) -(id)initWithTitle:(NSString*)title withFont:(UIFont*)font withColor:(UIColor*)color; -(id)initWithBgImageName:(NSString*)name; -(id)initWithBgImageName:(NSString*)name withSize:(CGSize)size; -(void)setImageWithName:(NSString*)name; @end
Richardlihui/KKFoundation
Sources/Category/UIButton+KaKa.h
C
mit
419
--- title: モーダルコンポーネント updated: 2017-06-26 00:00:00 type: examples order: 6 --- > コンポーネント、プロパティの伝達、コンテンツ挿入、トランジションの機能が使われています。 <iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/mwLbw11k/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
potato4d/jp.vuejs.org
src/v2/examples/modal.md
Markdown
mit
407
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_dploy_session'
damien/dploy
config/initializers/session_store.rb
Ruby
mit
137
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <link href="css/panes.css" rel="stylesheet" type="text/css" /> <link href="css/tablet.css" rel="stylesheet" type="text/css" /> <style type="text/css"> /* Pane configuration */ .left.col { width: 250px; } .right.col { left: 250px; right: 0; } .header.row { height: 75px; line-height: 75px; } .body.row { top: 75px; bottom: 50px; } .footer.row { height: 50px; bottom: 0; line-height: 50px; } </style> </head> <body> <div class="left col"> <div class="header row"> Navigation </div> <div class="body row scroll-y"> <ul class="listview"> <li class="selected">One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> <li>One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> <li>One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> <li>One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> </ul> </div> <div class="footer row"> Icons go here </div> </div> <div class="right col"> <div class="header row"> View or edit something </div> <div class="body row scroll-y"> <div> <h3>Here are some other controls</h3> <ul class="listview inset"> <li>One</li><li>Two</li><li>Three</li> </ul> <p>... and here's a horizontally-scrollable thing:</p> <div class="scroll-x tiles"> <ul> <li>Asia</li> <li>Africa</li> <li>America</li> <li>Antarctica</li> <li>Australia</li> <li>Europe</li> </ul> </div> <p>That's enough.</p><p>That's enough.</p><p>That's enough.</p> </div> </div> <div class="footer row"> Some status text here </div> </div> <script src="script/iemobile-fix.js" type="text/javascript"></script> <link href="css/panes.css" rel="stylesheet" type="text/css" /> <link href="css/tablet.css" rel="stylesheet" type="text/css" /> <style type="text/css"> /* Pane configuration */ .left.col { width: 250px; } .right.col { left: 250px; right: 0; } .header.row { height: 75px; line-height: 75px; } .body.row { top: 75px; bottom: 50px; } .footer.row { height: 50px; bottom: 0; line-height: 50px; } </style> </head> <body> <div class="left col"> <div class="header row"> Navigation </div> <div class="body row scroll-y"> <ul class="listview"> <li class="selected">One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> <li>One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> <li>One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> <li>One</li><li>Two</li><li>Three</li><li>One</li><li>Two</li><li>Three</li> </ul> </div> <div class="footer row"> Icons go here </div> </div> <div class="right col"> <div class="header row"> View or edit something </div> <div class="body row scroll-y"> <div> <h3>Here are some other controls</h3> <ul class="listview inset"> <li>One</li><li>Two</li><li>Three</li> </ul> <p>... and here's a horizontally-scrollable thing:</p> <div class="scroll-x tiles"> <ul> <li>Asia</li> <li>Africa</li> <li>America</li> <li>Antarctica</li> <li>Australia</li> <li>Europe</li> </ul> </div> <p>That's enough.</p><p>That's enough.</p><p>That's enough.</p> </div> </div> <div class="footer row"> Some status text here </div> </div> <script src="script/iemobile-fix.js" type="text/javascript"></script> <!-- Touch scrolling --> <!--[if !IE]><!--> <script src="script/iscroll.js" type="text/javascript"></script> <script type="text/javascript"> if (typeof document.body.style.webkitOverflowScrolling === "undefined") { var xScrollers = document.getElementsByClassName("scroll-x"); for (var i = 0; i < xScrollers.length; i++) new iScroll(xScrollers[i], { vScroll: false }); var yScrollers = document.getElementsByClassName("scroll-y"); for (var i = 0; i < yScrollers.length; i++) new iScroll(yScrollers[i], { hScroll: false }); } </script> <!--<![endif]--> </body> </html> <!-- Touch scrolling --> <!--[if !IE]><!--> <script src="script/iscroll.js" type="text/javascript"></script> <script type="text/javascript"> if (typeof document.body.style.webkitOverflowScrolling === "undefined") { var xScrollers = document.getElementsByClassName("scroll-x"); for (var i = 0; i < xScrollers.length; i++) new iScroll(xScrollers[i], { vScroll: false }); var yScrollers = document.getElementsByClassName("scroll-y"); for (var i = 0; i < yScrollers.length; i++) new iScroll(yScrollers[i], { hScroll: false }); } </script> <!--<![endif]--> </body> </html>
weolopez/Recursive
old/pages/mobile/touch-scrolling.html
HTML
mit
6,609
import numpy as np import matplotlib.pyplot as plt from astropy import units as u from astropy.constants import au, c, G from MulensModel.mulensobjects.lens import Lens from MulensModel.mulensobjects.source import Source from MulensModel.model import Model class MulensSystem(object): """ A microlensing system consisting of a lens and a source. """ def __init__(self, lens=None, source=None, mu_rel=None): self._lens = None self._source = None if lens is not None: if source is None: raise AttributeError( 'If lens is specified, source must also be specified.') else: self.lens = lens self.source = source if source is not None and lens is None: raise AttributeError( 'If source is specified, lens must also be specified.') if mu_rel is not None: self.mu_rel = mu_rel else: self._mu_rel = None def __repr__(self): output_str = '------\n{0}\n{1}\ntheta_E = {2}\n'.format( self.lens, self.source, self.theta_E) if self._mu_rel is not None: mu_rel_str = 'mu_rel = {0}\n'.format(self._mu_rel) t_E_str = 't_E = {0}\n'.format(self.t_E) output_str += mu_rel_str + t_E_str return output_str + '------' @property def lens(self): """ A :py:class:`~MulensModel.mulensobjects.lens.Lens` object. Physical properties of the lens. Note: lens mass must be in solMasses. """ return self._lens @lens.setter def lens(self, value): if isinstance(value, Lens): self._lens = value else: raise TypeError("lens must be a Lens object") if (self.source is not None and self.source.distance is not None and self.lens.distance is not None and self.source.distance.value < self.lens.distance.value): msg = 'Source cannot be closer than lens: {:} {:}' raise ValueError( msg.format(self.source.distance, self.lens.distance)) @property def source(self): """ :py:class:`~MulensModel.mulensobjects.source.Source` object. Physical properties of the source. """ return self._source @source.setter def source(self, value): if isinstance(value, Source): self._source = value else: raise TypeError( "source must be a MulensModel.mulensobjects.source.Source" + "object") if (self.lens is not None and self.source.distance is not None and self.lens.distance is not None and self.source.distance.value < self.lens.distance.value): msg = 'Source cannot be closer than lens: {:} {:}' raise ValueError(msg.format( self.source.distance, self.lens.distance)) @property def mu_rel(self): """ *astropy.Quantity* Relative proper motion between the source and lens stars. If set as a *float*, units are assumed to be mas/yr. """ return self._mu_rel @mu_rel.setter def mu_rel(self, value): if isinstance(value, u.Quantity): self._mu_rel = value else: self._mu_rel = value * u.mas / u.yr @property def t_E(self): """ *astropy.Quantity* The Einstein crossing time (in days). If set as a *float*, assumes units are in days. """ try: t_E = self.theta_E/self.mu_rel return t_E.to(u.day) except Exception: return None @t_E.setter def t_E(self, t_E): if isinstance(t_E, u.Quantity): self.mu_rel = self.theta_E / t_E.to(u.year) else: self.mu_rel = self.theta_E / t_E * u.year @property def pi_rel(self): """ *astropy.Quantity*, read-only The source-lens relative parallax in milliarcseconds. """ return self.lens.pi_L.to(u.mas) - self.source.pi_S.to(u.mas) @property def pi_E(self): """ *float*, read-only The Einstein ring radius. It's equal to pi_rel / theta_E. Dimensionless. """ return (self.pi_rel / self.theta_E).decompose().value @property def theta_E(self): """ *astropy.Quantity*, read-only The angular Einstein Radius in milliarcseconds. """ kappa = (4. * G / (c**2 * au)).to( u.mas/u.Msun, equivalencies=u.dimensionless_angles()) return np.sqrt( kappa * self.lens.total_mass.to(u.solMass) * self.pi_rel.to(u.mas)) @property def r_E(self): """ *astropy.Quantity*, read-only The physical size of the Einstein Radius in the Lens plane (in AU). """ return (self.lens.distance * self.theta_E.to( '', equivalencies=u.dimensionless_angles())).to(u.au) @property def r_E_tilde(self): """ *astropy.Quantity*, read-only The physical size of the Einstein Radius projected onto the Observer plane (in AU). """ return self.r_E * self.source.distance / ( self.source.distance - self.lens.distance) def plot_magnification(self, u_0=None, alpha=None, **kwargs): """ Plot the magnification curve for the lens. u_0 must always be specified. If the lens has more than one body, alpha must also be specified. Parameters : u_0: *float* Impact parameter between the source and the lens (as a fraction of the Einstein ring) alpha: *astropy.Quantity*, *float* If *float* then degrees are assumed as a unit. See :py:obj:`MulensModel.modelparameters.ModelParameters.alpha` ``**kwargs``: See :py:func:`MulensModel.model.Model.plot_magnification()` """ if u_0 is None: raise AttributeError('u_0 is required') else: parameters = {'t_0': 0., 'u_0': u_0} if self.t_E is not None: parameters['t_E'] = self.t_E xtitle = 'Time (days)' else: parameters['t_E'] = 1. xtitle = 'Time (tE)' if self.source.angular_radius is not None: parameters['rho'] = (self.source.angular_radius.to(u.mas) / self.theta_E.to(u.mas)) if self.lens.n_masses > 1: parameters['q'] = self.lens.q parameters['s'] = self.lens.s if alpha is None: raise AttributeError( 'alpha is required for 2-body lenses.') else: parameters['alpha'] = alpha model = Model(parameters=parameters) model.plot_magnification(**kwargs) plt.xlabel(xtitle) def plot_caustics(self, n_points=5000, **kwargs): """ Plot the caustics structure using `Pyplot scatter`_. See :py:func:`MulensModel.caustics.Caustics.plot()` Parameters : n_points: *int* Number of points be plotted. ``**kwargs``: Keyword arguments passed to `Pyplot scatter` .. _Pyplot scatter: https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter """ self.lens.plot_caustics(n_points=n_points, **kwargs)
rpoleski/MulensModel
source/MulensModel/mulensobjects/mulenssystem.py
Python
mit
7,706
'use strict'; var Dispatcher = require('flux').Dispatcher, assign = require('object-assign'); var DragDropDispatcher = assign(new Dispatcher(), { handleAction(action) { this.dispatch({ action: action }); } }); module.exports = DragDropDispatcher;
RallySoftware/react-dnd
modules/dispatcher/DragDropDispatcher.js
JavaScript
mit
272
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Manual changes to this file may cause unexpected behavior in your application. // Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace IHLoader { using System; using System.Collections.Generic; public partial class price { public price() { this.price_service = new HashSet<price_service>(); this.price_SpecialOffer = new HashSet<price_SpecialOffer>(); } public int ID { get; set; } public string code { get; set; } public System.DateTime startdate { get; set; } public System.DateTime enddate { get; set; } public double rentalprice { get; set; } public double minrentalprice { get; set; } public double maxrentalprice { get; set; } public Nullable<double> midweekrentalprice { get; set; } public Nullable<double> weekendrentalprice { get; set; } public Nullable<double> fixprice { get; set; } public short Interval { get; set; } public int accomodationID { get; set; } public Nullable<System.DateTime> lastUpdate { get; set; } public virtual accomodation accomodation { get; set; } public virtual ICollection<price_service> price_service { get; set; } public virtual ICollection<price_SpecialOffer> price_SpecialOffer { get; set; } } }
sdimons/Danko2016
InterHome/IHLoader/price.cs
C#
mit
1,647
// Compiled by ClojureScript 0.0-2657 {} if(!goog.isProvided_('cljs.core.async')) { goog.provide('cljs.core.async'); } goog.require('cljs.core'); goog.require('cljs.core.async.impl.channels'); goog.require('cljs.core.async.impl.dispatch'); goog.require('cljs.core.async.impl.ioc_helpers'); goog.require('cljs.core.async.impl.protocols'); goog.require('cljs.core.async.impl.buffers'); goog.require('cljs.core.async.impl.timers'); cljs.core.async.fn_handler = (function fn_handler(f){ if(typeof cljs.core.async.t9535 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t9535 = (function (f,fn_handler,meta9536){ this.f = f; this.fn_handler = fn_handler; this.meta9536 = meta9536; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t9535.prototype.cljs$core$async$impl$protocols$Handler$ = true; cljs.core.async.t9535.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return true; }); cljs.core.async.t9535.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return self__.f; }); cljs.core.async.t9535.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_9537){ var self__ = this; var _9537__$1 = this; return self__.meta9536; }); cljs.core.async.t9535.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_9537,meta9536__$1){ var self__ = this; var _9537__$1 = this; return (new cljs.core.async.t9535(self__.f,self__.fn_handler,meta9536__$1)); }); cljs.core.async.t9535.cljs$lang$type = true; cljs.core.async.t9535.cljs$lang$ctorStr = "cljs.core.async/t9535"; cljs.core.async.t9535.cljs$lang$ctorPrWriter = (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t9535"); }); cljs.core.async.__GT_t9535 = (function __GT_t9535(f__$1,fn_handler__$1,meta9536){ return (new cljs.core.async.t9535(f__$1,fn_handler__$1,meta9536)); }); } return (new cljs.core.async.t9535(f,fn_handler,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),20,new cljs.core.Keyword(null,"end-line","end-line",1837326455),16,new cljs.core.Keyword(null,"column","column",2078222095),3,new cljs.core.Keyword(null,"line","line",212345235),13,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); }); /** * Returns a fixed buffer of size n. When full, puts will block/park. */ cljs.core.async.buffer = (function buffer(n){ return cljs.core.async.impl.buffers.fixed_buffer.call(null,n); }); /** * Returns a buffer of size n. When full, puts will complete but * val will be dropped (no transfer). */ cljs.core.async.dropping_buffer = (function dropping_buffer(n){ return cljs.core.async.impl.buffers.dropping_buffer.call(null,n); }); /** * Returns a buffer of size n. When full, puts will complete, and be * buffered, but oldest elements in buffer will be dropped (not * transferred). */ cljs.core.async.sliding_buffer = (function sliding_buffer(n){ return cljs.core.async.impl.buffers.sliding_buffer.call(null,n); }); /** * Returns true if a channel created with buff will never block. That is to say, * puts into this buffer will never cause the buffer to be full. */ cljs.core.async.unblocking_buffer_QMARK_ = (function unblocking_buffer_QMARK_(buff){ var G__9539 = buff; if(G__9539){ var bit__4420__auto__ = null; if(cljs.core.truth_((function (){var or__3739__auto__ = bit__4420__auto__; if(cljs.core.truth_(or__3739__auto__)){ return or__3739__auto__; } else { return G__9539.cljs$core$async$impl$protocols$UnblockingBuffer$; } })())){ return true; } else { if((!G__9539.cljs$lang$protocol_mask$partition$)){ return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.async.impl.protocols.UnblockingBuffer,G__9539); } else { return false; } } } else { return cljs.core.native_satisfies_QMARK_.call(null,cljs.core.async.impl.protocols.UnblockingBuffer,G__9539); } }); /** * Creates a channel with an optional buffer, an optional transducer (like (map f), * (filter p) etc or a composition thereof), and an optional exception handler. * If buf-or-n is a number, will create and use a fixed buffer of that size. If a * transducer is supplied a buffer must be specified. ex-handler must be a * fn of one argument - if an exception occurs during transformation it will be called * with the thrown value as an argument, and any non-nil return value will be placed * in the channel. */ cljs.core.async.chan = (function() { var chan = null; var chan__0 = (function (){ return chan.call(null,null); }); var chan__1 = (function (buf_or_n){ return chan.call(null,buf_or_n,null,null); }); var chan__2 = (function (buf_or_n,xform){ return chan.call(null,buf_or_n,xform,null); }); var chan__3 = (function (buf_or_n,xform,ex_handler){ var buf_or_n__$1 = ((cljs.core._EQ_.call(null,buf_or_n,(0)))?null:buf_or_n); if(cljs.core.truth_(xform)){ if(cljs.core.truth_(buf_or_n__$1)){ } else { throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str("buffer must be supplied when transducer is"),cljs.core.str("\n"),cljs.core.str(cljs.core.pr_str.call(null,new cljs.core.Symbol(null,"buf-or-n","buf-or-n",-1646815050,null)))].join(''))); } } else { } return cljs.core.async.impl.channels.chan.call(null,((typeof buf_or_n__$1 === 'number')?cljs.core.async.buffer.call(null,buf_or_n__$1):buf_or_n__$1),xform,ex_handler); }); chan = function(buf_or_n,xform,ex_handler){ switch(arguments.length){ case 0: return chan__0.call(this); case 1: return chan__1.call(this,buf_or_n); case 2: return chan__2.call(this,buf_or_n,xform); case 3: return chan__3.call(this,buf_or_n,xform,ex_handler); } throw(new Error('Invalid arity: ' + arguments.length)); }; chan.cljs$core$IFn$_invoke$arity$0 = chan__0; chan.cljs$core$IFn$_invoke$arity$1 = chan__1; chan.cljs$core$IFn$_invoke$arity$2 = chan__2; chan.cljs$core$IFn$_invoke$arity$3 = chan__3; return chan; })() ; /** * Returns a channel that will close after msecs */ cljs.core.async.timeout = (function timeout(msecs){ return cljs.core.async.impl.timers.timeout.call(null,msecs); }); /** * takes a val from port. Must be called inside a (go ...) block. Will * return nil if closed. Will park if nothing is available. * Returns true unless port is already closed */ cljs.core.async._LT__BANG_ = (function _LT__BANG_(port){ throw (new Error("<! used not in (go ...) block")); }); /** * Asynchronously takes a val from port, passing to fn1. Will pass nil * if closed. If on-caller? (default true) is true, and value is * immediately available, will call fn1 on calling thread. * Returns nil. */ cljs.core.async.take_BANG_ = (function() { var take_BANG_ = null; var take_BANG___2 = (function (port,fn1){ return take_BANG_.call(null,port,fn1,true); }); var take_BANG___3 = (function (port,fn1,on_caller_QMARK_){ var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.fn_handler.call(null,fn1)); if(cljs.core.truth_(ret)){ var val_9540 = cljs.core.deref.call(null,ret); if(cljs.core.truth_(on_caller_QMARK_)){ fn1.call(null,val_9540); } else { cljs.core.async.impl.dispatch.run.call(null,((function (val_9540,ret){ return (function (){ return fn1.call(null,val_9540); });})(val_9540,ret)) ); } } else { } return null; }); take_BANG_ = function(port,fn1,on_caller_QMARK_){ switch(arguments.length){ case 2: return take_BANG___2.call(this,port,fn1); case 3: return take_BANG___3.call(this,port,fn1,on_caller_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; take_BANG_.cljs$core$IFn$_invoke$arity$2 = take_BANG___2; take_BANG_.cljs$core$IFn$_invoke$arity$3 = take_BANG___3; return take_BANG_; })() ; cljs.core.async.nop = (function nop(_){ return null; }); cljs.core.async.fhnop = cljs.core.async.fn_handler.call(null,cljs.core.async.nop); /** * puts a val into port. nil values are not allowed. Must be called * inside a (go ...) block. Will park if no buffer space is available. * Returns true unless port is already closed. */ cljs.core.async._GT__BANG_ = (function _GT__BANG_(port,val){ throw (new Error(">! used not in (go ...) block")); }); /** * Asynchronously puts a val into port, calling fn0 (if supplied) when * complete. nil values are not allowed. Will throw if closed. If * on-caller? (default true) is true, and the put is immediately * accepted, will call fn0 on calling thread. Returns nil. */ cljs.core.async.put_BANG_ = (function() { var put_BANG_ = null; var put_BANG___2 = (function (port,val){ var temp__4124__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fhnop); if(cljs.core.truth_(temp__4124__auto__)){ var ret = temp__4124__auto__; return cljs.core.deref.call(null,ret); } else { return true; } }); var put_BANG___3 = (function (port,val,fn1){ return put_BANG_.call(null,port,val,fn1,true); }); var put_BANG___4 = (function (port,val,fn1,on_caller_QMARK_){ var temp__4124__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,port,val,cljs.core.async.fn_handler.call(null,fn1)); if(cljs.core.truth_(temp__4124__auto__)){ var retb = temp__4124__auto__; var ret = cljs.core.deref.call(null,retb); if(cljs.core.truth_(on_caller_QMARK_)){ fn1.call(null,ret); } else { cljs.core.async.impl.dispatch.run.call(null,((function (ret,retb,temp__4124__auto__){ return (function (){ return fn1.call(null,ret); });})(ret,retb,temp__4124__auto__)) ); } return ret; } else { return true; } }); put_BANG_ = function(port,val,fn1,on_caller_QMARK_){ switch(arguments.length){ case 2: return put_BANG___2.call(this,port,val); case 3: return put_BANG___3.call(this,port,val,fn1); case 4: return put_BANG___4.call(this,port,val,fn1,on_caller_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; put_BANG_.cljs$core$IFn$_invoke$arity$2 = put_BANG___2; put_BANG_.cljs$core$IFn$_invoke$arity$3 = put_BANG___3; put_BANG_.cljs$core$IFn$_invoke$arity$4 = put_BANG___4; return put_BANG_; })() ; cljs.core.async.close_BANG_ = (function close_BANG_(port){ return cljs.core.async.impl.protocols.close_BANG_.call(null,port); }); cljs.core.async.random_array = (function random_array(n){ var a = (new Array(n)); var n__4626__auto___9541 = n; var x_9542 = (0); while(true){ if((x_9542 < n__4626__auto___9541)){ (a[x_9542] = (0)); var G__9543 = (x_9542 + (1)); x_9542 = G__9543; continue; } else { } break; } var i = (1); while(true){ if(cljs.core._EQ_.call(null,i,n)){ return a; } else { var j = cljs.core.rand_int.call(null,i); (a[i] = (a[j])); (a[j] = i); var G__9544 = (i + (1)); i = G__9544; continue; } break; } }); cljs.core.async.alt_flag = (function alt_flag(){ var flag = cljs.core.atom.call(null,true); if(typeof cljs.core.async.t9548 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t9548 = (function (flag,alt_flag,meta9549){ this.flag = flag; this.alt_flag = alt_flag; this.meta9549 = meta9549; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t9548.prototype.cljs$core$async$impl$protocols$Handler$ = true; cljs.core.async.t9548.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = ((function (flag){ return (function (_){ var self__ = this; var ___$1 = this; return cljs.core.deref.call(null,self__.flag); });})(flag)) ; cljs.core.async.t9548.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = ((function (flag){ return (function (_){ var self__ = this; var ___$1 = this; cljs.core.reset_BANG_.call(null,self__.flag,null); return true; });})(flag)) ; cljs.core.async.t9548.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (flag){ return (function (_9550){ var self__ = this; var _9550__$1 = this; return self__.meta9549; });})(flag)) ; cljs.core.async.t9548.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (flag){ return (function (_9550,meta9549__$1){ var self__ = this; var _9550__$1 = this; return (new cljs.core.async.t9548(self__.flag,self__.alt_flag,meta9549__$1)); });})(flag)) ; cljs.core.async.t9548.cljs$lang$type = true; cljs.core.async.t9548.cljs$lang$ctorStr = "cljs.core.async/t9548"; cljs.core.async.t9548.cljs$lang$ctorPrWriter = ((function (flag){ return (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t9548"); });})(flag)) ; cljs.core.async.__GT_t9548 = ((function (flag){ return (function __GT_t9548(flag__$1,alt_flag__$1,meta9549){ return (new cljs.core.async.t9548(flag__$1,alt_flag__$1,meta9549)); });})(flag)) ; } return (new cljs.core.async.t9548(flag,alt_flag,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),15,new cljs.core.Keyword(null,"end-line","end-line",1837326455),146,new cljs.core.Keyword(null,"column","column",2078222095),5,new cljs.core.Keyword(null,"line","line",212345235),141,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); }); cljs.core.async.alt_handler = (function alt_handler(flag,cb){ if(typeof cljs.core.async.t9554 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t9554 = (function (cb,flag,alt_handler,meta9555){ this.cb = cb; this.flag = flag; this.alt_handler = alt_handler; this.meta9555 = meta9555; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t9554.prototype.cljs$core$async$impl$protocols$Handler$ = true; cljs.core.async.t9554.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.active_QMARK_.call(null,self__.flag); }); cljs.core.async.t9554.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){ var self__ = this; var ___$1 = this; cljs.core.async.impl.protocols.commit.call(null,self__.flag); return self__.cb; }); cljs.core.async.t9554.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_9556){ var self__ = this; var _9556__$1 = this; return self__.meta9555; }); cljs.core.async.t9554.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_9556,meta9555__$1){ var self__ = this; var _9556__$1 = this; return (new cljs.core.async.t9554(self__.cb,self__.flag,self__.alt_handler,meta9555__$1)); }); cljs.core.async.t9554.cljs$lang$type = true; cljs.core.async.t9554.cljs$lang$ctorStr = "cljs.core.async/t9554"; cljs.core.async.t9554.cljs$lang$ctorPrWriter = (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t9554"); }); cljs.core.async.__GT_t9554 = (function __GT_t9554(cb__$1,flag__$1,alt_handler__$1,meta9555){ return (new cljs.core.async.t9554(cb__$1,flag__$1,alt_handler__$1,meta9555)); }); } return (new cljs.core.async.t9554(cb,flag,alt_handler,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),11,new cljs.core.Keyword(null,"end-line","end-line",1837326455),154,new cljs.core.Keyword(null,"column","column",2078222095),3,new cljs.core.Keyword(null,"line","line",212345235),149,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); }); /** * returns derefable [val port] if immediate, nil if enqueued */ cljs.core.async.do_alts = (function do_alts(fret,ports,opts){ var flag = cljs.core.async.alt_flag.call(null); var n = cljs.core.count.call(null,ports); var idxs = cljs.core.async.random_array.call(null,n); var priority = new cljs.core.Keyword(null,"priority","priority",1431093715).cljs$core$IFn$_invoke$arity$1(opts); var ret = (function (){var i = (0); while(true){ if((i < n)){ var idx = (cljs.core.truth_(priority)?i:(idxs[i])); var port = cljs.core.nth.call(null,ports,idx); var wport = ((cljs.core.vector_QMARK_.call(null,port))?port.call(null,(0)):null); var vbox = (cljs.core.truth_(wport)?(function (){var val = port.call(null,(1)); return cljs.core.async.impl.protocols.put_BANG_.call(null,wport,val,cljs.core.async.alt_handler.call(null,flag,((function (i,val,idx,port,wport,flag,n,idxs,priority){ return (function (p1__9557_SHARP_){ return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__9557_SHARP_,wport], null)); });})(i,val,idx,port,wport,flag,n,idxs,priority)) )); })():cljs.core.async.impl.protocols.take_BANG_.call(null,port,cljs.core.async.alt_handler.call(null,flag,((function (i,idx,port,wport,flag,n,idxs,priority){ return (function (p1__9558_SHARP_){ return fret.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [p1__9558_SHARP_,port], null)); });})(i,idx,port,wport,flag,n,idxs,priority)) ))); if(cljs.core.truth_(vbox)){ return cljs.core.async.impl.channels.box.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.deref.call(null,vbox),(function (){var or__3739__auto__ = wport; if(cljs.core.truth_(or__3739__auto__)){ return or__3739__auto__; } else { return port; } })()], null)); } else { var G__9559 = (i + (1)); i = G__9559; continue; } } else { return null; } break; } })(); var or__3739__auto__ = ret; if(cljs.core.truth_(or__3739__auto__)){ return or__3739__auto__; } else { if(cljs.core.contains_QMARK_.call(null,opts,new cljs.core.Keyword(null,"default","default",-1987822328))){ var temp__4126__auto__ = (function (){var and__3727__auto__ = cljs.core.async.impl.protocols.active_QMARK_.call(null,flag); if(cljs.core.truth_(and__3727__auto__)){ return cljs.core.async.impl.protocols.commit.call(null,flag); } else { return and__3727__auto__; } })(); if(cljs.core.truth_(temp__4126__auto__)){ var got = temp__4126__auto__; return cljs.core.async.impl.channels.box.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"default","default",-1987822328).cljs$core$IFn$_invoke$arity$1(opts),new cljs.core.Keyword(null,"default","default",-1987822328)], null)); } else { return null; } } else { return null; } } }); /** * Completes at most one of several channel operations. Must be called * inside a (go ...) block. ports is a vector of channel endpoints, * which can be either a channel to take from or a vector of * [channel-to-put-to val-to-put], in any combination. Takes will be * made as if by <!, and puts will be made as if by >!. Unless * the :priority option is true, if more than one port operation is * ready a non-deterministic choice will be made. If no operation is * ready and a :default value is supplied, [default-val :default] will * be returned, otherwise alts! will park until the first operation to * become ready completes. Returns [val port] of the completed * operation, where val is the value taken for takes, and a * boolean (true unless already closed, as per put!) for puts. * * opts are passed as :key val ... Supported options: * * :default val - the value to use if none of the operations are immediately ready * :priority true - (default nil) when true, the operations will be tried in order. * * Note: there is no guarantee that the port exps or val exprs will be * used, nor in what order should they be, so they should not be * depended upon for side effects. * @param {...*} var_args */ cljs.core.async.alts_BANG_ = (function() { var alts_BANG___delegate = function (ports,p__9560){ var map__9562 = p__9560; var map__9562__$1 = ((cljs.core.seq_QMARK_.call(null,map__9562))?cljs.core.apply.call(null,cljs.core.hash_map,map__9562):map__9562); var opts = map__9562__$1; throw (new Error("alts! used not in (go ...) block")); }; var alts_BANG_ = function (ports,var_args){ var p__9560 = null; if (arguments.length > 1) { p__9560 = cljs.core.array_seq(Array.prototype.slice.call(arguments, 1),0); } return alts_BANG___delegate.call(this,ports,p__9560);}; alts_BANG_.cljs$lang$maxFixedArity = 1; alts_BANG_.cljs$lang$applyTo = (function (arglist__9563){ var ports = cljs.core.first(arglist__9563); var p__9560 = cljs.core.rest(arglist__9563); return alts_BANG___delegate(ports,p__9560); }); alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = alts_BANG___delegate; return alts_BANG_; })() ; /** * Takes elements from the from channel and supplies them to the to * channel. By default, the to channel will be closed when the from * channel closes, but can be determined by the close? parameter. Will * stop consuming the from channel if the to channel closes */ cljs.core.async.pipe = (function() { var pipe = null; var pipe__2 = (function (from,to){ return pipe.call(null,from,to,true); }); var pipe__3 = (function (from,to,close_QMARK_){ var c__6769__auto___9658 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___9658){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___9658){ return (function (state_9634){ var state_val_9635 = (state_9634[(1)]); if((state_val_9635 === (7))){ var inst_9630 = (state_9634[(2)]); var state_9634__$1 = state_9634; var statearr_9636_9659 = state_9634__$1; (statearr_9636_9659[(2)] = inst_9630); (statearr_9636_9659[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (1))){ var state_9634__$1 = state_9634; var statearr_9637_9660 = state_9634__$1; (statearr_9637_9660[(2)] = null); (statearr_9637_9660[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (4))){ var inst_9613 = (state_9634[(7)]); var inst_9613__$1 = (state_9634[(2)]); var inst_9614 = (inst_9613__$1 == null); var state_9634__$1 = (function (){var statearr_9638 = state_9634; (statearr_9638[(7)] = inst_9613__$1); return statearr_9638; })(); if(cljs.core.truth_(inst_9614)){ var statearr_9639_9661 = state_9634__$1; (statearr_9639_9661[(1)] = (5)); } else { var statearr_9640_9662 = state_9634__$1; (statearr_9640_9662[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (13))){ var state_9634__$1 = state_9634; var statearr_9641_9663 = state_9634__$1; (statearr_9641_9663[(2)] = null); (statearr_9641_9663[(1)] = (14)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (6))){ var inst_9613 = (state_9634[(7)]); var state_9634__$1 = state_9634; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_9634__$1,(11),to,inst_9613); } else { if((state_val_9635 === (3))){ var inst_9632 = (state_9634[(2)]); var state_9634__$1 = state_9634; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_9634__$1,inst_9632); } else { if((state_val_9635 === (12))){ var state_9634__$1 = state_9634; var statearr_9642_9664 = state_9634__$1; (statearr_9642_9664[(2)] = null); (statearr_9642_9664[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (2))){ var state_9634__$1 = state_9634; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_9634__$1,(4),from); } else { if((state_val_9635 === (11))){ var inst_9623 = (state_9634[(2)]); var state_9634__$1 = state_9634; if(cljs.core.truth_(inst_9623)){ var statearr_9643_9665 = state_9634__$1; (statearr_9643_9665[(1)] = (12)); } else { var statearr_9644_9666 = state_9634__$1; (statearr_9644_9666[(1)] = (13)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (9))){ var state_9634__$1 = state_9634; var statearr_9645_9667 = state_9634__$1; (statearr_9645_9667[(2)] = null); (statearr_9645_9667[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (5))){ var state_9634__$1 = state_9634; if(cljs.core.truth_(close_QMARK_)){ var statearr_9646_9668 = state_9634__$1; (statearr_9646_9668[(1)] = (8)); } else { var statearr_9647_9669 = state_9634__$1; (statearr_9647_9669[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (14))){ var inst_9628 = (state_9634[(2)]); var state_9634__$1 = state_9634; var statearr_9648_9670 = state_9634__$1; (statearr_9648_9670[(2)] = inst_9628); (statearr_9648_9670[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (10))){ var inst_9620 = (state_9634[(2)]); var state_9634__$1 = state_9634; var statearr_9649_9671 = state_9634__$1; (statearr_9649_9671[(2)] = inst_9620); (statearr_9649_9671[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9635 === (8))){ var inst_9617 = cljs.core.async.close_BANG_.call(null,to); var state_9634__$1 = state_9634; var statearr_9650_9672 = state_9634__$1; (statearr_9650_9672[(2)] = inst_9617); (statearr_9650_9672[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } });})(c__6769__auto___9658)) ; return ((function (switch__6713__auto__,c__6769__auto___9658){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_9654 = [null,null,null,null,null,null,null,null]; (statearr_9654[(0)] = state_machine__6714__auto__); (statearr_9654[(1)] = (1)); return statearr_9654; }); var state_machine__6714__auto____1 = (function (state_9634){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_9634); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e9655){if((e9655 instanceof Object)){ var ex__6717__auto__ = e9655; var statearr_9656_9673 = state_9634; (statearr_9656_9673[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_9634); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e9655; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__9674 = state_9634; state_9634 = G__9674; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_9634){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_9634); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___9658)) })(); var state__6771__auto__ = (function (){var statearr_9657 = f__6770__auto__.call(null); (statearr_9657[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___9658); return statearr_9657; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___9658)) ); return to; }); pipe = function(from,to,close_QMARK_){ switch(arguments.length){ case 2: return pipe__2.call(this,from,to); case 3: return pipe__3.call(this,from,to,close_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; pipe.cljs$core$IFn$_invoke$arity$2 = pipe__2; pipe.cljs$core$IFn$_invoke$arity$3 = pipe__3; return pipe; })() ; cljs.core.async.pipeline_STAR_ = (function pipeline_STAR_(n,to,xf,from,close_QMARK_,ex_handler,type){ if((n > (0))){ } else { throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str(cljs.core.pr_str.call(null,cljs.core.list(new cljs.core.Symbol(null,"pos?","pos?",-244377722,null),new cljs.core.Symbol(null,"n","n",-2092305744,null))))].join(''))); } var jobs = cljs.core.async.chan.call(null,n); var results = cljs.core.async.chan.call(null,n); var process = ((function (jobs,results){ return (function (p__9858){ var vec__9859 = p__9858; var v = cljs.core.nth.call(null,vec__9859,(0),null); var p = cljs.core.nth.call(null,vec__9859,(1),null); var job = vec__9859; if((job == null)){ cljs.core.async.close_BANG_.call(null,results); return null; } else { var res = cljs.core.async.chan.call(null,(1),xf,ex_handler); var c__6769__auto___10041 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___10041,res,vec__9859,v,p,job,jobs,results){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___10041,res,vec__9859,v,p,job,jobs,results){ return (function (state_9864){ var state_val_9865 = (state_9864[(1)]); if((state_val_9865 === (2))){ var inst_9861 = (state_9864[(2)]); var inst_9862 = cljs.core.async.close_BANG_.call(null,res); var state_9864__$1 = (function (){var statearr_9866 = state_9864; (statearr_9866[(7)] = inst_9861); return statearr_9866; })(); return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_9864__$1,inst_9862); } else { if((state_val_9865 === (1))){ var state_9864__$1 = state_9864; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_9864__$1,(2),res,v); } else { return null; } } });})(c__6769__auto___10041,res,vec__9859,v,p,job,jobs,results)) ; return ((function (switch__6713__auto__,c__6769__auto___10041,res,vec__9859,v,p,job,jobs,results){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_9870 = [null,null,null,null,null,null,null,null]; (statearr_9870[(0)] = state_machine__6714__auto__); (statearr_9870[(1)] = (1)); return statearr_9870; }); var state_machine__6714__auto____1 = (function (state_9864){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_9864); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e9871){if((e9871 instanceof Object)){ var ex__6717__auto__ = e9871; var statearr_9872_10042 = state_9864; (statearr_9872_10042[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_9864); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e9871; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10043 = state_9864; state_9864 = G__10043; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_9864){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_9864); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___10041,res,vec__9859,v,p,job,jobs,results)) })(); var state__6771__auto__ = (function (){var statearr_9873 = f__6770__auto__.call(null); (statearr_9873[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___10041); return statearr_9873; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___10041,res,vec__9859,v,p,job,jobs,results)) ); cljs.core.async.put_BANG_.call(null,p,res); return true; } });})(jobs,results)) ; var async = ((function (jobs,results,process){ return (function (p__9874){ var vec__9875 = p__9874; var v = cljs.core.nth.call(null,vec__9875,(0),null); var p = cljs.core.nth.call(null,vec__9875,(1),null); var job = vec__9875; if((job == null)){ cljs.core.async.close_BANG_.call(null,results); return null; } else { var res = cljs.core.async.chan.call(null,(1)); xf.call(null,v,res); cljs.core.async.put_BANG_.call(null,p,res); return true; } });})(jobs,results,process)) ; var n__4626__auto___10044 = n; var __10045 = (0); while(true){ if((__10045 < n__4626__auto___10044)){ var G__9876_10046 = (((type instanceof cljs.core.Keyword))?type.fqn:null); switch (G__9876_10046) { case "async": var c__6769__auto___10048 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (__10045,c__6769__auto___10048,G__9876_10046,n__4626__auto___10044,jobs,results,process,async){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (__10045,c__6769__auto___10048,G__9876_10046,n__4626__auto___10044,jobs,results,process,async){ return (function (state_9889){ var state_val_9890 = (state_9889[(1)]); if((state_val_9890 === (7))){ var inst_9885 = (state_9889[(2)]); var state_9889__$1 = state_9889; var statearr_9891_10049 = state_9889__$1; (statearr_9891_10049[(2)] = inst_9885); (statearr_9891_10049[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9890 === (6))){ var state_9889__$1 = state_9889; var statearr_9892_10050 = state_9889__$1; (statearr_9892_10050[(2)] = null); (statearr_9892_10050[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9890 === (5))){ var state_9889__$1 = state_9889; var statearr_9893_10051 = state_9889__$1; (statearr_9893_10051[(2)] = null); (statearr_9893_10051[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9890 === (4))){ var inst_9879 = (state_9889[(2)]); var inst_9880 = async.call(null,inst_9879); var state_9889__$1 = state_9889; if(cljs.core.truth_(inst_9880)){ var statearr_9894_10052 = state_9889__$1; (statearr_9894_10052[(1)] = (5)); } else { var statearr_9895_10053 = state_9889__$1; (statearr_9895_10053[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9890 === (3))){ var inst_9887 = (state_9889[(2)]); var state_9889__$1 = state_9889; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_9889__$1,inst_9887); } else { if((state_val_9890 === (2))){ var state_9889__$1 = state_9889; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_9889__$1,(4),jobs); } else { if((state_val_9890 === (1))){ var state_9889__$1 = state_9889; var statearr_9896_10054 = state_9889__$1; (statearr_9896_10054[(2)] = null); (statearr_9896_10054[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } });})(__10045,c__6769__auto___10048,G__9876_10046,n__4626__auto___10044,jobs,results,process,async)) ; return ((function (__10045,switch__6713__auto__,c__6769__auto___10048,G__9876_10046,n__4626__auto___10044,jobs,results,process,async){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_9900 = [null,null,null,null,null,null,null]; (statearr_9900[(0)] = state_machine__6714__auto__); (statearr_9900[(1)] = (1)); return statearr_9900; }); var state_machine__6714__auto____1 = (function (state_9889){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_9889); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e9901){if((e9901 instanceof Object)){ var ex__6717__auto__ = e9901; var statearr_9902_10055 = state_9889; (statearr_9902_10055[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_9889); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e9901; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10056 = state_9889; state_9889 = G__10056; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_9889){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_9889); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(__10045,switch__6713__auto__,c__6769__auto___10048,G__9876_10046,n__4626__auto___10044,jobs,results,process,async)) })(); var state__6771__auto__ = (function (){var statearr_9903 = f__6770__auto__.call(null); (statearr_9903[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___10048); return statearr_9903; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(__10045,c__6769__auto___10048,G__9876_10046,n__4626__auto___10044,jobs,results,process,async)) ); break; case "compute": var c__6769__auto___10057 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (__10045,c__6769__auto___10057,G__9876_10046,n__4626__auto___10044,jobs,results,process,async){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (__10045,c__6769__auto___10057,G__9876_10046,n__4626__auto___10044,jobs,results,process,async){ return (function (state_9916){ var state_val_9917 = (state_9916[(1)]); if((state_val_9917 === (7))){ var inst_9912 = (state_9916[(2)]); var state_9916__$1 = state_9916; var statearr_9918_10058 = state_9916__$1; (statearr_9918_10058[(2)] = inst_9912); (statearr_9918_10058[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9917 === (6))){ var state_9916__$1 = state_9916; var statearr_9919_10059 = state_9916__$1; (statearr_9919_10059[(2)] = null); (statearr_9919_10059[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9917 === (5))){ var state_9916__$1 = state_9916; var statearr_9920_10060 = state_9916__$1; (statearr_9920_10060[(2)] = null); (statearr_9920_10060[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9917 === (4))){ var inst_9906 = (state_9916[(2)]); var inst_9907 = process.call(null,inst_9906); var state_9916__$1 = state_9916; if(cljs.core.truth_(inst_9907)){ var statearr_9921_10061 = state_9916__$1; (statearr_9921_10061[(1)] = (5)); } else { var statearr_9922_10062 = state_9916__$1; (statearr_9922_10062[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9917 === (3))){ var inst_9914 = (state_9916[(2)]); var state_9916__$1 = state_9916; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_9916__$1,inst_9914); } else { if((state_val_9917 === (2))){ var state_9916__$1 = state_9916; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_9916__$1,(4),jobs); } else { if((state_val_9917 === (1))){ var state_9916__$1 = state_9916; var statearr_9923_10063 = state_9916__$1; (statearr_9923_10063[(2)] = null); (statearr_9923_10063[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } });})(__10045,c__6769__auto___10057,G__9876_10046,n__4626__auto___10044,jobs,results,process,async)) ; return ((function (__10045,switch__6713__auto__,c__6769__auto___10057,G__9876_10046,n__4626__auto___10044,jobs,results,process,async){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_9927 = [null,null,null,null,null,null,null]; (statearr_9927[(0)] = state_machine__6714__auto__); (statearr_9927[(1)] = (1)); return statearr_9927; }); var state_machine__6714__auto____1 = (function (state_9916){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_9916); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e9928){if((e9928 instanceof Object)){ var ex__6717__auto__ = e9928; var statearr_9929_10064 = state_9916; (statearr_9929_10064[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_9916); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e9928; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10065 = state_9916; state_9916 = G__10065; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_9916){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_9916); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(__10045,switch__6713__auto__,c__6769__auto___10057,G__9876_10046,n__4626__auto___10044,jobs,results,process,async)) })(); var state__6771__auto__ = (function (){var statearr_9930 = f__6770__auto__.call(null); (statearr_9930[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___10057); return statearr_9930; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(__10045,c__6769__auto___10057,G__9876_10046,n__4626__auto___10044,jobs,results,process,async)) ); break; default: throw (new Error([cljs.core.str("No matching clause: "),cljs.core.str(type)].join(''))); } var G__10066 = (__10045 + (1)); __10045 = G__10066; continue; } else { } break; } var c__6769__auto___10067 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___10067,jobs,results,process,async){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___10067,jobs,results,process,async){ return (function (state_9952){ var state_val_9953 = (state_9952[(1)]); if((state_val_9953 === (9))){ var inst_9945 = (state_9952[(2)]); var state_9952__$1 = (function (){var statearr_9954 = state_9952; (statearr_9954[(7)] = inst_9945); return statearr_9954; })(); var statearr_9955_10068 = state_9952__$1; (statearr_9955_10068[(2)] = null); (statearr_9955_10068[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9953 === (8))){ var inst_9938 = (state_9952[(8)]); var inst_9943 = (state_9952[(2)]); var state_9952__$1 = (function (){var statearr_9956 = state_9952; (statearr_9956[(9)] = inst_9943); return statearr_9956; })(); return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_9952__$1,(9),results,inst_9938); } else { if((state_val_9953 === (7))){ var inst_9948 = (state_9952[(2)]); var state_9952__$1 = state_9952; var statearr_9957_10069 = state_9952__$1; (statearr_9957_10069[(2)] = inst_9948); (statearr_9957_10069[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9953 === (6))){ var inst_9933 = (state_9952[(10)]); var inst_9938 = (state_9952[(8)]); var inst_9938__$1 = cljs.core.async.chan.call(null,(1)); var inst_9939 = cljs.core.PersistentVector.EMPTY_NODE; var inst_9940 = [inst_9933,inst_9938__$1]; var inst_9941 = (new cljs.core.PersistentVector(null,2,(5),inst_9939,inst_9940,null)); var state_9952__$1 = (function (){var statearr_9958 = state_9952; (statearr_9958[(8)] = inst_9938__$1); return statearr_9958; })(); return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_9952__$1,(8),jobs,inst_9941); } else { if((state_val_9953 === (5))){ var inst_9936 = cljs.core.async.close_BANG_.call(null,jobs); var state_9952__$1 = state_9952; var statearr_9959_10070 = state_9952__$1; (statearr_9959_10070[(2)] = inst_9936); (statearr_9959_10070[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9953 === (4))){ var inst_9933 = (state_9952[(10)]); var inst_9933__$1 = (state_9952[(2)]); var inst_9934 = (inst_9933__$1 == null); var state_9952__$1 = (function (){var statearr_9960 = state_9952; (statearr_9960[(10)] = inst_9933__$1); return statearr_9960; })(); if(cljs.core.truth_(inst_9934)){ var statearr_9961_10071 = state_9952__$1; (statearr_9961_10071[(1)] = (5)); } else { var statearr_9962_10072 = state_9952__$1; (statearr_9962_10072[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_9953 === (3))){ var inst_9950 = (state_9952[(2)]); var state_9952__$1 = state_9952; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_9952__$1,inst_9950); } else { if((state_val_9953 === (2))){ var state_9952__$1 = state_9952; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_9952__$1,(4),from); } else { if((state_val_9953 === (1))){ var state_9952__$1 = state_9952; var statearr_9963_10073 = state_9952__$1; (statearr_9963_10073[(2)] = null); (statearr_9963_10073[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } });})(c__6769__auto___10067,jobs,results,process,async)) ; return ((function (switch__6713__auto__,c__6769__auto___10067,jobs,results,process,async){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_9967 = [null,null,null,null,null,null,null,null,null,null,null]; (statearr_9967[(0)] = state_machine__6714__auto__); (statearr_9967[(1)] = (1)); return statearr_9967; }); var state_machine__6714__auto____1 = (function (state_9952){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_9952); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e9968){if((e9968 instanceof Object)){ var ex__6717__auto__ = e9968; var statearr_9969_10074 = state_9952; (statearr_9969_10074[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_9952); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e9968; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10075 = state_9952; state_9952 = G__10075; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_9952){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_9952); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___10067,jobs,results,process,async)) })(); var state__6771__auto__ = (function (){var statearr_9970 = f__6770__auto__.call(null); (statearr_9970[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___10067); return statearr_9970; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___10067,jobs,results,process,async)) ); var c__6769__auto__ = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto__,jobs,results,process,async){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto__,jobs,results,process,async){ return (function (state_10008){ var state_val_10009 = (state_10008[(1)]); if((state_val_10009 === (7))){ var inst_10004 = (state_10008[(2)]); var state_10008__$1 = state_10008; var statearr_10010_10076 = state_10008__$1; (statearr_10010_10076[(2)] = inst_10004); (statearr_10010_10076[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (20))){ var state_10008__$1 = state_10008; var statearr_10011_10077 = state_10008__$1; (statearr_10011_10077[(2)] = null); (statearr_10011_10077[(1)] = (21)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (1))){ var state_10008__$1 = state_10008; var statearr_10012_10078 = state_10008__$1; (statearr_10012_10078[(2)] = null); (statearr_10012_10078[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (4))){ var inst_9973 = (state_10008[(7)]); var inst_9973__$1 = (state_10008[(2)]); var inst_9974 = (inst_9973__$1 == null); var state_10008__$1 = (function (){var statearr_10013 = state_10008; (statearr_10013[(7)] = inst_9973__$1); return statearr_10013; })(); if(cljs.core.truth_(inst_9974)){ var statearr_10014_10079 = state_10008__$1; (statearr_10014_10079[(1)] = (5)); } else { var statearr_10015_10080 = state_10008__$1; (statearr_10015_10080[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (15))){ var inst_9986 = (state_10008[(8)]); var state_10008__$1 = state_10008; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_10008__$1,(18),to,inst_9986); } else { if((state_val_10009 === (21))){ var inst_9999 = (state_10008[(2)]); var state_10008__$1 = state_10008; var statearr_10016_10081 = state_10008__$1; (statearr_10016_10081[(2)] = inst_9999); (statearr_10016_10081[(1)] = (13)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (13))){ var inst_10001 = (state_10008[(2)]); var state_10008__$1 = (function (){var statearr_10017 = state_10008; (statearr_10017[(9)] = inst_10001); return statearr_10017; })(); var statearr_10018_10082 = state_10008__$1; (statearr_10018_10082[(2)] = null); (statearr_10018_10082[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (6))){ var inst_9973 = (state_10008[(7)]); var state_10008__$1 = state_10008; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_10008__$1,(11),inst_9973); } else { if((state_val_10009 === (17))){ var inst_9994 = (state_10008[(2)]); var state_10008__$1 = state_10008; if(cljs.core.truth_(inst_9994)){ var statearr_10019_10083 = state_10008__$1; (statearr_10019_10083[(1)] = (19)); } else { var statearr_10020_10084 = state_10008__$1; (statearr_10020_10084[(1)] = (20)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (3))){ var inst_10006 = (state_10008[(2)]); var state_10008__$1 = state_10008; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_10008__$1,inst_10006); } else { if((state_val_10009 === (12))){ var inst_9983 = (state_10008[(10)]); var state_10008__$1 = state_10008; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_10008__$1,(14),inst_9983); } else { if((state_val_10009 === (2))){ var state_10008__$1 = state_10008; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_10008__$1,(4),results); } else { if((state_val_10009 === (19))){ var state_10008__$1 = state_10008; var statearr_10021_10085 = state_10008__$1; (statearr_10021_10085[(2)] = null); (statearr_10021_10085[(1)] = (12)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (11))){ var inst_9983 = (state_10008[(2)]); var state_10008__$1 = (function (){var statearr_10022 = state_10008; (statearr_10022[(10)] = inst_9983); return statearr_10022; })(); var statearr_10023_10086 = state_10008__$1; (statearr_10023_10086[(2)] = null); (statearr_10023_10086[(1)] = (12)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (9))){ var state_10008__$1 = state_10008; var statearr_10024_10087 = state_10008__$1; (statearr_10024_10087[(2)] = null); (statearr_10024_10087[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (5))){ var state_10008__$1 = state_10008; if(cljs.core.truth_(close_QMARK_)){ var statearr_10025_10088 = state_10008__$1; (statearr_10025_10088[(1)] = (8)); } else { var statearr_10026_10089 = state_10008__$1; (statearr_10026_10089[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (14))){ var inst_9988 = (state_10008[(11)]); var inst_9986 = (state_10008[(8)]); var inst_9986__$1 = (state_10008[(2)]); var inst_9987 = (inst_9986__$1 == null); var inst_9988__$1 = cljs.core.not.call(null,inst_9987); var state_10008__$1 = (function (){var statearr_10027 = state_10008; (statearr_10027[(11)] = inst_9988__$1); (statearr_10027[(8)] = inst_9986__$1); return statearr_10027; })(); if(inst_9988__$1){ var statearr_10028_10090 = state_10008__$1; (statearr_10028_10090[(1)] = (15)); } else { var statearr_10029_10091 = state_10008__$1; (statearr_10029_10091[(1)] = (16)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (16))){ var inst_9988 = (state_10008[(11)]); var state_10008__$1 = state_10008; var statearr_10030_10092 = state_10008__$1; (statearr_10030_10092[(2)] = inst_9988); (statearr_10030_10092[(1)] = (17)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (10))){ var inst_9980 = (state_10008[(2)]); var state_10008__$1 = state_10008; var statearr_10031_10093 = state_10008__$1; (statearr_10031_10093[(2)] = inst_9980); (statearr_10031_10093[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (18))){ var inst_9991 = (state_10008[(2)]); var state_10008__$1 = state_10008; var statearr_10032_10094 = state_10008__$1; (statearr_10032_10094[(2)] = inst_9991); (statearr_10032_10094[(1)] = (17)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10009 === (8))){ var inst_9977 = cljs.core.async.close_BANG_.call(null,to); var state_10008__$1 = state_10008; var statearr_10033_10095 = state_10008__$1; (statearr_10033_10095[(2)] = inst_9977); (statearr_10033_10095[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } } } } } } } });})(c__6769__auto__,jobs,results,process,async)) ; return ((function (switch__6713__auto__,c__6769__auto__,jobs,results,process,async){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_10037 = [null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_10037[(0)] = state_machine__6714__auto__); (statearr_10037[(1)] = (1)); return statearr_10037; }); var state_machine__6714__auto____1 = (function (state_10008){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_10008); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e10038){if((e10038 instanceof Object)){ var ex__6717__auto__ = e10038; var statearr_10039_10096 = state_10008; (statearr_10039_10096[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_10008); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e10038; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10097 = state_10008; state_10008 = G__10097; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_10008){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_10008); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto__,jobs,results,process,async)) })(); var state__6771__auto__ = (function (){var statearr_10040 = f__6770__auto__.call(null); (statearr_10040[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto__); return statearr_10040; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto__,jobs,results,process,async)) ); return c__6769__auto__; }); /** * Takes elements from the from channel and supplies them to the to * channel, subject to the async function af, with parallelism n. af * must be a function of two arguments, the first an input value and * the second a channel on which to place the result(s). af must close! * the channel before returning. The presumption is that af will * return immediately, having launched some asynchronous operation * whose completion/callback will manipulate the result channel. Outputs * will be returned in order relative to the inputs. By default, the to * channel will be closed when the from channel closes, but can be * determined by the close? parameter. Will stop consuming the from * channel if the to channel closes. */ cljs.core.async.pipeline_async = (function() { var pipeline_async = null; var pipeline_async__4 = (function (n,to,af,from){ return pipeline_async.call(null,n,to,af,from,true); }); var pipeline_async__5 = (function (n,to,af,from,close_QMARK_){ return cljs.core.async.pipeline_STAR_.call(null,n,to,af,from,close_QMARK_,null,new cljs.core.Keyword(null,"async","async",1050769601)); }); pipeline_async = function(n,to,af,from,close_QMARK_){ switch(arguments.length){ case 4: return pipeline_async__4.call(this,n,to,af,from); case 5: return pipeline_async__5.call(this,n,to,af,from,close_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; pipeline_async.cljs$core$IFn$_invoke$arity$4 = pipeline_async__4; pipeline_async.cljs$core$IFn$_invoke$arity$5 = pipeline_async__5; return pipeline_async; })() ; /** * Takes elements from the from channel and supplies them to the to * channel, subject to the transducer xf, with parallelism n. Because * it is parallel, the transducer will be applied independently to each * element, not across elements, and may produce zero or more outputs * per input. Outputs will be returned in order relative to the * inputs. By default, the to channel will be closed when the from * channel closes, but can be determined by the close? parameter. Will * stop consuming the from channel if the to channel closes. * * Note this is supplied for API compatibility with the Clojure version. * Values of N > 1 will not result in actual concurrency in a * single-threaded runtime. */ cljs.core.async.pipeline = (function() { var pipeline = null; var pipeline__4 = (function (n,to,xf,from){ return pipeline.call(null,n,to,xf,from,true); }); var pipeline__5 = (function (n,to,xf,from,close_QMARK_){ return pipeline.call(null,n,to,xf,from,close_QMARK_,null); }); var pipeline__6 = (function (n,to,xf,from,close_QMARK_,ex_handler){ return cljs.core.async.pipeline_STAR_.call(null,n,to,xf,from,close_QMARK_,ex_handler,new cljs.core.Keyword(null,"compute","compute",1555393130)); }); pipeline = function(n,to,xf,from,close_QMARK_,ex_handler){ switch(arguments.length){ case 4: return pipeline__4.call(this,n,to,xf,from); case 5: return pipeline__5.call(this,n,to,xf,from,close_QMARK_); case 6: return pipeline__6.call(this,n,to,xf,from,close_QMARK_,ex_handler); } throw(new Error('Invalid arity: ' + arguments.length)); }; pipeline.cljs$core$IFn$_invoke$arity$4 = pipeline__4; pipeline.cljs$core$IFn$_invoke$arity$5 = pipeline__5; pipeline.cljs$core$IFn$_invoke$arity$6 = pipeline__6; return pipeline; })() ; /** * Takes a predicate and a source channel and returns a vector of two * channels, the first of which will contain the values for which the * predicate returned true, the second those for which it returned * false. * * The out channels will be unbuffered by default, or two buf-or-ns can * be supplied. The channels will close after the source channel has * closed. */ cljs.core.async.split = (function() { var split = null; var split__2 = (function (p,ch){ return split.call(null,p,ch,null,null); }); var split__4 = (function (p,ch,t_buf_or_n,f_buf_or_n){ var tc = cljs.core.async.chan.call(null,t_buf_or_n); var fc = cljs.core.async.chan.call(null,f_buf_or_n); var c__6769__auto___10198 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___10198,tc,fc){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___10198,tc,fc){ return (function (state_10173){ var state_val_10174 = (state_10173[(1)]); if((state_val_10174 === (7))){ var inst_10169 = (state_10173[(2)]); var state_10173__$1 = state_10173; var statearr_10175_10199 = state_10173__$1; (statearr_10175_10199[(2)] = inst_10169); (statearr_10175_10199[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (1))){ var state_10173__$1 = state_10173; var statearr_10176_10200 = state_10173__$1; (statearr_10176_10200[(2)] = null); (statearr_10176_10200[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (4))){ var inst_10150 = (state_10173[(7)]); var inst_10150__$1 = (state_10173[(2)]); var inst_10151 = (inst_10150__$1 == null); var state_10173__$1 = (function (){var statearr_10177 = state_10173; (statearr_10177[(7)] = inst_10150__$1); return statearr_10177; })(); if(cljs.core.truth_(inst_10151)){ var statearr_10178_10201 = state_10173__$1; (statearr_10178_10201[(1)] = (5)); } else { var statearr_10179_10202 = state_10173__$1; (statearr_10179_10202[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (13))){ var state_10173__$1 = state_10173; var statearr_10180_10203 = state_10173__$1; (statearr_10180_10203[(2)] = null); (statearr_10180_10203[(1)] = (14)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (6))){ var inst_10150 = (state_10173[(7)]); var inst_10156 = p.call(null,inst_10150); var state_10173__$1 = state_10173; if(cljs.core.truth_(inst_10156)){ var statearr_10181_10204 = state_10173__$1; (statearr_10181_10204[(1)] = (9)); } else { var statearr_10182_10205 = state_10173__$1; (statearr_10182_10205[(1)] = (10)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (3))){ var inst_10171 = (state_10173[(2)]); var state_10173__$1 = state_10173; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_10173__$1,inst_10171); } else { if((state_val_10174 === (12))){ var state_10173__$1 = state_10173; var statearr_10183_10206 = state_10173__$1; (statearr_10183_10206[(2)] = null); (statearr_10183_10206[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (2))){ var state_10173__$1 = state_10173; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_10173__$1,(4),ch); } else { if((state_val_10174 === (11))){ var inst_10150 = (state_10173[(7)]); var inst_10160 = (state_10173[(2)]); var state_10173__$1 = state_10173; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_10173__$1,(8),inst_10160,inst_10150); } else { if((state_val_10174 === (9))){ var state_10173__$1 = state_10173; var statearr_10184_10207 = state_10173__$1; (statearr_10184_10207[(2)] = tc); (statearr_10184_10207[(1)] = (11)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (5))){ var inst_10153 = cljs.core.async.close_BANG_.call(null,tc); var inst_10154 = cljs.core.async.close_BANG_.call(null,fc); var state_10173__$1 = (function (){var statearr_10185 = state_10173; (statearr_10185[(8)] = inst_10153); return statearr_10185; })(); var statearr_10186_10208 = state_10173__$1; (statearr_10186_10208[(2)] = inst_10154); (statearr_10186_10208[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (14))){ var inst_10167 = (state_10173[(2)]); var state_10173__$1 = state_10173; var statearr_10187_10209 = state_10173__$1; (statearr_10187_10209[(2)] = inst_10167); (statearr_10187_10209[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (10))){ var state_10173__$1 = state_10173; var statearr_10188_10210 = state_10173__$1; (statearr_10188_10210[(2)] = fc); (statearr_10188_10210[(1)] = (11)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10174 === (8))){ var inst_10162 = (state_10173[(2)]); var state_10173__$1 = state_10173; if(cljs.core.truth_(inst_10162)){ var statearr_10189_10211 = state_10173__$1; (statearr_10189_10211[(1)] = (12)); } else { var statearr_10190_10212 = state_10173__$1; (statearr_10190_10212[(1)] = (13)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } });})(c__6769__auto___10198,tc,fc)) ; return ((function (switch__6713__auto__,c__6769__auto___10198,tc,fc){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_10194 = [null,null,null,null,null,null,null,null,null]; (statearr_10194[(0)] = state_machine__6714__auto__); (statearr_10194[(1)] = (1)); return statearr_10194; }); var state_machine__6714__auto____1 = (function (state_10173){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_10173); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e10195){if((e10195 instanceof Object)){ var ex__6717__auto__ = e10195; var statearr_10196_10213 = state_10173; (statearr_10196_10213[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_10173); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e10195; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10214 = state_10173; state_10173 = G__10214; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_10173){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_10173); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___10198,tc,fc)) })(); var state__6771__auto__ = (function (){var statearr_10197 = f__6770__auto__.call(null); (statearr_10197[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___10198); return statearr_10197; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___10198,tc,fc)) ); return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [tc,fc], null); }); split = function(p,ch,t_buf_or_n,f_buf_or_n){ switch(arguments.length){ case 2: return split__2.call(this,p,ch); case 4: return split__4.call(this,p,ch,t_buf_or_n,f_buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; split.cljs$core$IFn$_invoke$arity$2 = split__2; split.cljs$core$IFn$_invoke$arity$4 = split__4; return split; })() ; /** * f should be a function of 2 arguments. Returns a channel containing * the single result of applying f to init and the first item from the * channel, then applying f to that result and the 2nd item, etc. If * the channel closes without yielding items, returns init and f is not * called. ch must close before reduce produces a result. */ cljs.core.async.reduce = (function reduce(f,init,ch){ var c__6769__auto__ = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto__){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto__){ return (function (state_10261){ var state_val_10262 = (state_10261[(1)]); if((state_val_10262 === (7))){ var inst_10257 = (state_10261[(2)]); var state_10261__$1 = state_10261; var statearr_10263_10279 = state_10261__$1; (statearr_10263_10279[(2)] = inst_10257); (statearr_10263_10279[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10262 === (6))){ var inst_10247 = (state_10261[(7)]); var inst_10250 = (state_10261[(8)]); var inst_10254 = f.call(null,inst_10247,inst_10250); var inst_10247__$1 = inst_10254; var state_10261__$1 = (function (){var statearr_10264 = state_10261; (statearr_10264[(7)] = inst_10247__$1); return statearr_10264; })(); var statearr_10265_10280 = state_10261__$1; (statearr_10265_10280[(2)] = null); (statearr_10265_10280[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10262 === (5))){ var inst_10247 = (state_10261[(7)]); var state_10261__$1 = state_10261; var statearr_10266_10281 = state_10261__$1; (statearr_10266_10281[(2)] = inst_10247); (statearr_10266_10281[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10262 === (4))){ var inst_10250 = (state_10261[(8)]); var inst_10250__$1 = (state_10261[(2)]); var inst_10251 = (inst_10250__$1 == null); var state_10261__$1 = (function (){var statearr_10267 = state_10261; (statearr_10267[(8)] = inst_10250__$1); return statearr_10267; })(); if(cljs.core.truth_(inst_10251)){ var statearr_10268_10282 = state_10261__$1; (statearr_10268_10282[(1)] = (5)); } else { var statearr_10269_10283 = state_10261__$1; (statearr_10269_10283[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10262 === (3))){ var inst_10259 = (state_10261[(2)]); var state_10261__$1 = state_10261; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_10261__$1,inst_10259); } else { if((state_val_10262 === (2))){ var state_10261__$1 = state_10261; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_10261__$1,(4),ch); } else { if((state_val_10262 === (1))){ var inst_10247 = init; var state_10261__$1 = (function (){var statearr_10270 = state_10261; (statearr_10270[(7)] = inst_10247); return statearr_10270; })(); var statearr_10271_10284 = state_10261__$1; (statearr_10271_10284[(2)] = null); (statearr_10271_10284[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } });})(c__6769__auto__)) ; return ((function (switch__6713__auto__,c__6769__auto__){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_10275 = [null,null,null,null,null,null,null,null,null]; (statearr_10275[(0)] = state_machine__6714__auto__); (statearr_10275[(1)] = (1)); return statearr_10275; }); var state_machine__6714__auto____1 = (function (state_10261){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_10261); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e10276){if((e10276 instanceof Object)){ var ex__6717__auto__ = e10276; var statearr_10277_10285 = state_10261; (statearr_10277_10285[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_10261); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e10276; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10286 = state_10261; state_10261 = G__10286; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_10261){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_10261); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto__)) })(); var state__6771__auto__ = (function (){var statearr_10278 = f__6770__auto__.call(null); (statearr_10278[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto__); return statearr_10278; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto__)) ); return c__6769__auto__; }); /** * Puts the contents of coll into the supplied channel. * * By default the channel will be closed after the items are copied, * but can be determined by the close? parameter. * * Returns a channel which will close after the items are copied. */ cljs.core.async.onto_chan = (function() { var onto_chan = null; var onto_chan__2 = (function (ch,coll){ return onto_chan.call(null,ch,coll,true); }); var onto_chan__3 = (function (ch,coll,close_QMARK_){ var c__6769__auto__ = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto__){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto__){ return (function (state_10360){ var state_val_10361 = (state_10360[(1)]); if((state_val_10361 === (7))){ var inst_10342 = (state_10360[(2)]); var state_10360__$1 = state_10360; var statearr_10362_10385 = state_10360__$1; (statearr_10362_10385[(2)] = inst_10342); (statearr_10362_10385[(1)] = (6)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (1))){ var inst_10336 = cljs.core.seq.call(null,coll); var inst_10337 = inst_10336; var state_10360__$1 = (function (){var statearr_10363 = state_10360; (statearr_10363[(7)] = inst_10337); return statearr_10363; })(); var statearr_10364_10386 = state_10360__$1; (statearr_10364_10386[(2)] = null); (statearr_10364_10386[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (4))){ var inst_10337 = (state_10360[(7)]); var inst_10340 = cljs.core.first.call(null,inst_10337); var state_10360__$1 = state_10360; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_10360__$1,(7),ch,inst_10340); } else { if((state_val_10361 === (13))){ var inst_10354 = (state_10360[(2)]); var state_10360__$1 = state_10360; var statearr_10365_10387 = state_10360__$1; (statearr_10365_10387[(2)] = inst_10354); (statearr_10365_10387[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (6))){ var inst_10345 = (state_10360[(2)]); var state_10360__$1 = state_10360; if(cljs.core.truth_(inst_10345)){ var statearr_10366_10388 = state_10360__$1; (statearr_10366_10388[(1)] = (8)); } else { var statearr_10367_10389 = state_10360__$1; (statearr_10367_10389[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (3))){ var inst_10358 = (state_10360[(2)]); var state_10360__$1 = state_10360; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_10360__$1,inst_10358); } else { if((state_val_10361 === (12))){ var state_10360__$1 = state_10360; var statearr_10368_10390 = state_10360__$1; (statearr_10368_10390[(2)] = null); (statearr_10368_10390[(1)] = (13)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (2))){ var inst_10337 = (state_10360[(7)]); var state_10360__$1 = state_10360; if(cljs.core.truth_(inst_10337)){ var statearr_10369_10391 = state_10360__$1; (statearr_10369_10391[(1)] = (4)); } else { var statearr_10370_10392 = state_10360__$1; (statearr_10370_10392[(1)] = (5)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (11))){ var inst_10351 = cljs.core.async.close_BANG_.call(null,ch); var state_10360__$1 = state_10360; var statearr_10371_10393 = state_10360__$1; (statearr_10371_10393[(2)] = inst_10351); (statearr_10371_10393[(1)] = (13)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (9))){ var state_10360__$1 = state_10360; if(cljs.core.truth_(close_QMARK_)){ var statearr_10372_10394 = state_10360__$1; (statearr_10372_10394[(1)] = (11)); } else { var statearr_10373_10395 = state_10360__$1; (statearr_10373_10395[(1)] = (12)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (5))){ var inst_10337 = (state_10360[(7)]); var state_10360__$1 = state_10360; var statearr_10374_10396 = state_10360__$1; (statearr_10374_10396[(2)] = inst_10337); (statearr_10374_10396[(1)] = (6)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (10))){ var inst_10356 = (state_10360[(2)]); var state_10360__$1 = state_10360; var statearr_10375_10397 = state_10360__$1; (statearr_10375_10397[(2)] = inst_10356); (statearr_10375_10397[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10361 === (8))){ var inst_10337 = (state_10360[(7)]); var inst_10347 = cljs.core.next.call(null,inst_10337); var inst_10337__$1 = inst_10347; var state_10360__$1 = (function (){var statearr_10376 = state_10360; (statearr_10376[(7)] = inst_10337__$1); return statearr_10376; })(); var statearr_10377_10398 = state_10360__$1; (statearr_10377_10398[(2)] = null); (statearr_10377_10398[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } });})(c__6769__auto__)) ; return ((function (switch__6713__auto__,c__6769__auto__){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_10381 = [null,null,null,null,null,null,null,null]; (statearr_10381[(0)] = state_machine__6714__auto__); (statearr_10381[(1)] = (1)); return statearr_10381; }); var state_machine__6714__auto____1 = (function (state_10360){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_10360); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e10382){if((e10382 instanceof Object)){ var ex__6717__auto__ = e10382; var statearr_10383_10399 = state_10360; (statearr_10383_10399[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_10360); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e10382; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10400 = state_10360; state_10360 = G__10400; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_10360){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_10360); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto__)) })(); var state__6771__auto__ = (function (){var statearr_10384 = f__6770__auto__.call(null); (statearr_10384[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto__); return statearr_10384; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto__)) ); return c__6769__auto__; }); onto_chan = function(ch,coll,close_QMARK_){ switch(arguments.length){ case 2: return onto_chan__2.call(this,ch,coll); case 3: return onto_chan__3.call(this,ch,coll,close_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; onto_chan.cljs$core$IFn$_invoke$arity$2 = onto_chan__2; onto_chan.cljs$core$IFn$_invoke$arity$3 = onto_chan__3; return onto_chan; })() ; /** * Creates and returns a channel which contains the contents of coll, * closing when exhausted. */ cljs.core.async.to_chan = (function to_chan(coll){ var ch = cljs.core.async.chan.call(null,cljs.core.bounded_count.call(null,(100),coll)); cljs.core.async.onto_chan.call(null,ch,coll); return ch; }); cljs.core.async.Mux = (function (){var obj10402 = {}; return obj10402; })(); cljs.core.async.muxch_STAR_ = (function muxch_STAR_(_){ if((function (){var and__3727__auto__ = _; if(and__3727__auto__){ return _.cljs$core$async$Mux$muxch_STAR_$arity$1; } else { return and__3727__auto__; } })()){ return _.cljs$core$async$Mux$muxch_STAR_$arity$1(_); } else { var x__4383__auto__ = (((_ == null))?null:_); return (function (){var or__3739__auto__ = (cljs.core.async.muxch_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.muxch_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mux.muxch*",_); } } })().call(null,_); } }); cljs.core.async.Mult = (function (){var obj10404 = {}; return obj10404; })(); cljs.core.async.tap_STAR_ = (function tap_STAR_(m,ch,close_QMARK_){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mult$tap_STAR_$arity$3; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mult$tap_STAR_$arity$3(m,ch,close_QMARK_); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.tap_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.tap_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mult.tap*",m); } } })().call(null,m,ch,close_QMARK_); } }); cljs.core.async.untap_STAR_ = (function untap_STAR_(m,ch){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mult$untap_STAR_$arity$2; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mult$untap_STAR_$arity$2(m,ch); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.untap_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.untap_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mult.untap*",m); } } })().call(null,m,ch); } }); cljs.core.async.untap_all_STAR_ = (function untap_all_STAR_(m){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mult$untap_all_STAR_$arity$1; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mult$untap_all_STAR_$arity$1(m); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.untap_all_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.untap_all_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mult.untap-all*",m); } } })().call(null,m); } }); /** * Creates and returns a mult(iple) of the supplied channel. Channels * containing copies of the channel can be created with 'tap', and * detached with 'untap'. * * Each item is distributed to all taps in parallel and synchronously, * i.e. each tap must accept before the next item is distributed. Use * buffering/windowing to prevent slow taps from holding up the mult. * * Items received when there are no taps get dropped. * * If a tap puts to a closed channel, it will be removed from the mult. */ cljs.core.async.mult = (function mult(ch){ var cs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY); var m = (function (){ if(typeof cljs.core.async.t10626 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t10626 = (function (cs,ch,mult,meta10627){ this.cs = cs; this.ch = ch; this.mult = mult; this.meta10627 = meta10627; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t10626.prototype.cljs$core$async$Mult$ = true; cljs.core.async.t10626.prototype.cljs$core$async$Mult$tap_STAR_$arity$3 = ((function (cs){ return (function (_,ch__$1,close_QMARK_){ var self__ = this; var ___$1 = this; cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.assoc,ch__$1,close_QMARK_); return null; });})(cs)) ; cljs.core.async.t10626.prototype.cljs$core$async$Mult$untap_STAR_$arity$2 = ((function (cs){ return (function (_,ch__$1){ var self__ = this; var ___$1 = this; cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.dissoc,ch__$1); return null; });})(cs)) ; cljs.core.async.t10626.prototype.cljs$core$async$Mult$untap_all_STAR_$arity$1 = ((function (cs){ return (function (_){ var self__ = this; var ___$1 = this; cljs.core.reset_BANG_.call(null,self__.cs,cljs.core.PersistentArrayMap.EMPTY); return null; });})(cs)) ; cljs.core.async.t10626.prototype.cljs$core$async$Mux$ = true; cljs.core.async.t10626.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (cs){ return (function (_){ var self__ = this; var ___$1 = this; return self__.ch; });})(cs)) ; cljs.core.async.t10626.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs){ return (function (_10628){ var self__ = this; var _10628__$1 = this; return self__.meta10627; });})(cs)) ; cljs.core.async.t10626.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs){ return (function (_10628,meta10627__$1){ var self__ = this; var _10628__$1 = this; return (new cljs.core.async.t10626(self__.cs,self__.ch,self__.mult,meta10627__$1)); });})(cs)) ; cljs.core.async.t10626.cljs$lang$type = true; cljs.core.async.t10626.cljs$lang$ctorStr = "cljs.core.async/t10626"; cljs.core.async.t10626.cljs$lang$ctorPrWriter = ((function (cs){ return (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t10626"); });})(cs)) ; cljs.core.async.__GT_t10626 = ((function (cs){ return (function __GT_t10626(cs__$1,ch__$1,mult__$1,meta10627){ return (new cljs.core.async.t10626(cs__$1,ch__$1,mult__$1,meta10627)); });})(cs)) ; } return (new cljs.core.async.t10626(cs,ch,mult,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),48,new cljs.core.Keyword(null,"end-line","end-line",1837326455),397,new cljs.core.Keyword(null,"column","column",2078222095),11,new cljs.core.Keyword(null,"line","line",212345235),390,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); })() ; var dchan = cljs.core.async.chan.call(null,(1)); var dctr = cljs.core.atom.call(null,null); var done = ((function (cs,m,dchan,dctr){ return (function (_){ if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){ return cljs.core.async.put_BANG_.call(null,dchan,true); } else { return null; } });})(cs,m,dchan,dctr)) ; var c__6769__auto___10847 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___10847,cs,m,dchan,dctr,done){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___10847,cs,m,dchan,dctr,done){ return (function (state_10759){ var state_val_10760 = (state_10759[(1)]); if((state_val_10760 === (7))){ var inst_10755 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10761_10848 = state_10759__$1; (statearr_10761_10848[(2)] = inst_10755); (statearr_10761_10848[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (20))){ var inst_10660 = (state_10759[(7)]); var inst_10670 = cljs.core.first.call(null,inst_10660); var inst_10671 = cljs.core.nth.call(null,inst_10670,(0),null); var inst_10672 = cljs.core.nth.call(null,inst_10670,(1),null); var state_10759__$1 = (function (){var statearr_10762 = state_10759; (statearr_10762[(8)] = inst_10671); return statearr_10762; })(); if(cljs.core.truth_(inst_10672)){ var statearr_10763_10849 = state_10759__$1; (statearr_10763_10849[(1)] = (22)); } else { var statearr_10764_10850 = state_10759__$1; (statearr_10764_10850[(1)] = (23)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (27))){ var inst_10707 = (state_10759[(9)]); var inst_10631 = (state_10759[(10)]); var inst_10702 = (state_10759[(11)]); var inst_10700 = (state_10759[(12)]); var inst_10707__$1 = cljs.core._nth.call(null,inst_10700,inst_10702); var inst_10708 = cljs.core.async.put_BANG_.call(null,inst_10707__$1,inst_10631,done); var state_10759__$1 = (function (){var statearr_10765 = state_10759; (statearr_10765[(9)] = inst_10707__$1); return statearr_10765; })(); if(cljs.core.truth_(inst_10708)){ var statearr_10766_10851 = state_10759__$1; (statearr_10766_10851[(1)] = (30)); } else { var statearr_10767_10852 = state_10759__$1; (statearr_10767_10852[(1)] = (31)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (1))){ var state_10759__$1 = state_10759; var statearr_10768_10853 = state_10759__$1; (statearr_10768_10853[(2)] = null); (statearr_10768_10853[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (24))){ var inst_10660 = (state_10759[(7)]); var inst_10677 = (state_10759[(2)]); var inst_10678 = cljs.core.next.call(null,inst_10660); var inst_10640 = inst_10678; var inst_10641 = null; var inst_10642 = (0); var inst_10643 = (0); var state_10759__$1 = (function (){var statearr_10769 = state_10759; (statearr_10769[(13)] = inst_10643); (statearr_10769[(14)] = inst_10641); (statearr_10769[(15)] = inst_10677); (statearr_10769[(16)] = inst_10642); (statearr_10769[(17)] = inst_10640); return statearr_10769; })(); var statearr_10770_10854 = state_10759__$1; (statearr_10770_10854[(2)] = null); (statearr_10770_10854[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (39))){ var state_10759__$1 = state_10759; var statearr_10774_10855 = state_10759__$1; (statearr_10774_10855[(2)] = null); (statearr_10774_10855[(1)] = (41)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (4))){ var inst_10631 = (state_10759[(10)]); var inst_10631__$1 = (state_10759[(2)]); var inst_10632 = (inst_10631__$1 == null); var state_10759__$1 = (function (){var statearr_10775 = state_10759; (statearr_10775[(10)] = inst_10631__$1); return statearr_10775; })(); if(cljs.core.truth_(inst_10632)){ var statearr_10776_10856 = state_10759__$1; (statearr_10776_10856[(1)] = (5)); } else { var statearr_10777_10857 = state_10759__$1; (statearr_10777_10857[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (15))){ var inst_10643 = (state_10759[(13)]); var inst_10641 = (state_10759[(14)]); var inst_10642 = (state_10759[(16)]); var inst_10640 = (state_10759[(17)]); var inst_10656 = (state_10759[(2)]); var inst_10657 = (inst_10643 + (1)); var tmp10771 = inst_10641; var tmp10772 = inst_10642; var tmp10773 = inst_10640; var inst_10640__$1 = tmp10773; var inst_10641__$1 = tmp10771; var inst_10642__$1 = tmp10772; var inst_10643__$1 = inst_10657; var state_10759__$1 = (function (){var statearr_10778 = state_10759; (statearr_10778[(13)] = inst_10643__$1); (statearr_10778[(14)] = inst_10641__$1); (statearr_10778[(18)] = inst_10656); (statearr_10778[(16)] = inst_10642__$1); (statearr_10778[(17)] = inst_10640__$1); return statearr_10778; })(); var statearr_10779_10858 = state_10759__$1; (statearr_10779_10858[(2)] = null); (statearr_10779_10858[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (21))){ var inst_10681 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10783_10859 = state_10759__$1; (statearr_10783_10859[(2)] = inst_10681); (statearr_10783_10859[(1)] = (18)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (31))){ var inst_10707 = (state_10759[(9)]); var inst_10711 = done.call(null,null); var inst_10712 = cljs.core.async.untap_STAR_.call(null,m,inst_10707); var state_10759__$1 = (function (){var statearr_10784 = state_10759; (statearr_10784[(19)] = inst_10711); return statearr_10784; })(); var statearr_10785_10860 = state_10759__$1; (statearr_10785_10860[(2)] = inst_10712); (statearr_10785_10860[(1)] = (32)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (32))){ var inst_10701 = (state_10759[(20)]); var inst_10699 = (state_10759[(21)]); var inst_10702 = (state_10759[(11)]); var inst_10700 = (state_10759[(12)]); var inst_10714 = (state_10759[(2)]); var inst_10715 = (inst_10702 + (1)); var tmp10780 = inst_10701; var tmp10781 = inst_10699; var tmp10782 = inst_10700; var inst_10699__$1 = tmp10781; var inst_10700__$1 = tmp10782; var inst_10701__$1 = tmp10780; var inst_10702__$1 = inst_10715; var state_10759__$1 = (function (){var statearr_10786 = state_10759; (statearr_10786[(20)] = inst_10701__$1); (statearr_10786[(21)] = inst_10699__$1); (statearr_10786[(22)] = inst_10714); (statearr_10786[(11)] = inst_10702__$1); (statearr_10786[(12)] = inst_10700__$1); return statearr_10786; })(); var statearr_10787_10861 = state_10759__$1; (statearr_10787_10861[(2)] = null); (statearr_10787_10861[(1)] = (25)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (40))){ var inst_10727 = (state_10759[(23)]); var inst_10731 = done.call(null,null); var inst_10732 = cljs.core.async.untap_STAR_.call(null,m,inst_10727); var state_10759__$1 = (function (){var statearr_10788 = state_10759; (statearr_10788[(24)] = inst_10731); return statearr_10788; })(); var statearr_10789_10862 = state_10759__$1; (statearr_10789_10862[(2)] = inst_10732); (statearr_10789_10862[(1)] = (41)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (33))){ var inst_10718 = (state_10759[(25)]); var inst_10720 = cljs.core.chunked_seq_QMARK_.call(null,inst_10718); var state_10759__$1 = state_10759; if(inst_10720){ var statearr_10790_10863 = state_10759__$1; (statearr_10790_10863[(1)] = (36)); } else { var statearr_10791_10864 = state_10759__$1; (statearr_10791_10864[(1)] = (37)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (13))){ var inst_10650 = (state_10759[(26)]); var inst_10653 = cljs.core.async.close_BANG_.call(null,inst_10650); var state_10759__$1 = state_10759; var statearr_10792_10865 = state_10759__$1; (statearr_10792_10865[(2)] = inst_10653); (statearr_10792_10865[(1)] = (15)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (22))){ var inst_10671 = (state_10759[(8)]); var inst_10674 = cljs.core.async.close_BANG_.call(null,inst_10671); var state_10759__$1 = state_10759; var statearr_10793_10866 = state_10759__$1; (statearr_10793_10866[(2)] = inst_10674); (statearr_10793_10866[(1)] = (24)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (36))){ var inst_10718 = (state_10759[(25)]); var inst_10722 = cljs.core.chunk_first.call(null,inst_10718); var inst_10723 = cljs.core.chunk_rest.call(null,inst_10718); var inst_10724 = cljs.core.count.call(null,inst_10722); var inst_10699 = inst_10723; var inst_10700 = inst_10722; var inst_10701 = inst_10724; var inst_10702 = (0); var state_10759__$1 = (function (){var statearr_10794 = state_10759; (statearr_10794[(20)] = inst_10701); (statearr_10794[(21)] = inst_10699); (statearr_10794[(11)] = inst_10702); (statearr_10794[(12)] = inst_10700); return statearr_10794; })(); var statearr_10795_10867 = state_10759__$1; (statearr_10795_10867[(2)] = null); (statearr_10795_10867[(1)] = (25)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (41))){ var inst_10718 = (state_10759[(25)]); var inst_10734 = (state_10759[(2)]); var inst_10735 = cljs.core.next.call(null,inst_10718); var inst_10699 = inst_10735; var inst_10700 = null; var inst_10701 = (0); var inst_10702 = (0); var state_10759__$1 = (function (){var statearr_10796 = state_10759; (statearr_10796[(20)] = inst_10701); (statearr_10796[(21)] = inst_10699); (statearr_10796[(27)] = inst_10734); (statearr_10796[(11)] = inst_10702); (statearr_10796[(12)] = inst_10700); return statearr_10796; })(); var statearr_10797_10868 = state_10759__$1; (statearr_10797_10868[(2)] = null); (statearr_10797_10868[(1)] = (25)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (43))){ var state_10759__$1 = state_10759; var statearr_10798_10869 = state_10759__$1; (statearr_10798_10869[(2)] = null); (statearr_10798_10869[(1)] = (44)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (29))){ var inst_10743 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10799_10870 = state_10759__$1; (statearr_10799_10870[(2)] = inst_10743); (statearr_10799_10870[(1)] = (26)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (44))){ var inst_10752 = (state_10759[(2)]); var state_10759__$1 = (function (){var statearr_10800 = state_10759; (statearr_10800[(28)] = inst_10752); return statearr_10800; })(); var statearr_10801_10871 = state_10759__$1; (statearr_10801_10871[(2)] = null); (statearr_10801_10871[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (6))){ var inst_10691 = (state_10759[(29)]); var inst_10690 = cljs.core.deref.call(null,cs); var inst_10691__$1 = cljs.core.keys.call(null,inst_10690); var inst_10692 = cljs.core.count.call(null,inst_10691__$1); var inst_10693 = cljs.core.reset_BANG_.call(null,dctr,inst_10692); var inst_10698 = cljs.core.seq.call(null,inst_10691__$1); var inst_10699 = inst_10698; var inst_10700 = null; var inst_10701 = (0); var inst_10702 = (0); var state_10759__$1 = (function (){var statearr_10802 = state_10759; (statearr_10802[(20)] = inst_10701); (statearr_10802[(21)] = inst_10699); (statearr_10802[(30)] = inst_10693); (statearr_10802[(29)] = inst_10691__$1); (statearr_10802[(11)] = inst_10702); (statearr_10802[(12)] = inst_10700); return statearr_10802; })(); var statearr_10803_10872 = state_10759__$1; (statearr_10803_10872[(2)] = null); (statearr_10803_10872[(1)] = (25)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (28))){ var inst_10699 = (state_10759[(21)]); var inst_10718 = (state_10759[(25)]); var inst_10718__$1 = cljs.core.seq.call(null,inst_10699); var state_10759__$1 = (function (){var statearr_10804 = state_10759; (statearr_10804[(25)] = inst_10718__$1); return statearr_10804; })(); if(inst_10718__$1){ var statearr_10805_10873 = state_10759__$1; (statearr_10805_10873[(1)] = (33)); } else { var statearr_10806_10874 = state_10759__$1; (statearr_10806_10874[(1)] = (34)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (25))){ var inst_10701 = (state_10759[(20)]); var inst_10702 = (state_10759[(11)]); var inst_10704 = (inst_10702 < inst_10701); var inst_10705 = inst_10704; var state_10759__$1 = state_10759; if(cljs.core.truth_(inst_10705)){ var statearr_10807_10875 = state_10759__$1; (statearr_10807_10875[(1)] = (27)); } else { var statearr_10808_10876 = state_10759__$1; (statearr_10808_10876[(1)] = (28)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (34))){ var state_10759__$1 = state_10759; var statearr_10809_10877 = state_10759__$1; (statearr_10809_10877[(2)] = null); (statearr_10809_10877[(1)] = (35)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (17))){ var state_10759__$1 = state_10759; var statearr_10810_10878 = state_10759__$1; (statearr_10810_10878[(2)] = null); (statearr_10810_10878[(1)] = (18)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (3))){ var inst_10757 = (state_10759[(2)]); var state_10759__$1 = state_10759; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_10759__$1,inst_10757); } else { if((state_val_10760 === (12))){ var inst_10686 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10811_10879 = state_10759__$1; (statearr_10811_10879[(2)] = inst_10686); (statearr_10811_10879[(1)] = (9)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (2))){ var state_10759__$1 = state_10759; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_10759__$1,(4),ch); } else { if((state_val_10760 === (23))){ var state_10759__$1 = state_10759; var statearr_10812_10880 = state_10759__$1; (statearr_10812_10880[(2)] = null); (statearr_10812_10880[(1)] = (24)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (35))){ var inst_10741 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10813_10881 = state_10759__$1; (statearr_10813_10881[(2)] = inst_10741); (statearr_10813_10881[(1)] = (29)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (19))){ var inst_10660 = (state_10759[(7)]); var inst_10664 = cljs.core.chunk_first.call(null,inst_10660); var inst_10665 = cljs.core.chunk_rest.call(null,inst_10660); var inst_10666 = cljs.core.count.call(null,inst_10664); var inst_10640 = inst_10665; var inst_10641 = inst_10664; var inst_10642 = inst_10666; var inst_10643 = (0); var state_10759__$1 = (function (){var statearr_10814 = state_10759; (statearr_10814[(13)] = inst_10643); (statearr_10814[(14)] = inst_10641); (statearr_10814[(16)] = inst_10642); (statearr_10814[(17)] = inst_10640); return statearr_10814; })(); var statearr_10815_10882 = state_10759__$1; (statearr_10815_10882[(2)] = null); (statearr_10815_10882[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (11))){ var inst_10660 = (state_10759[(7)]); var inst_10640 = (state_10759[(17)]); var inst_10660__$1 = cljs.core.seq.call(null,inst_10640); var state_10759__$1 = (function (){var statearr_10816 = state_10759; (statearr_10816[(7)] = inst_10660__$1); return statearr_10816; })(); if(inst_10660__$1){ var statearr_10817_10883 = state_10759__$1; (statearr_10817_10883[(1)] = (16)); } else { var statearr_10818_10884 = state_10759__$1; (statearr_10818_10884[(1)] = (17)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (9))){ var inst_10688 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10819_10885 = state_10759__$1; (statearr_10819_10885[(2)] = inst_10688); (statearr_10819_10885[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (5))){ var inst_10638 = cljs.core.deref.call(null,cs); var inst_10639 = cljs.core.seq.call(null,inst_10638); var inst_10640 = inst_10639; var inst_10641 = null; var inst_10642 = (0); var inst_10643 = (0); var state_10759__$1 = (function (){var statearr_10820 = state_10759; (statearr_10820[(13)] = inst_10643); (statearr_10820[(14)] = inst_10641); (statearr_10820[(16)] = inst_10642); (statearr_10820[(17)] = inst_10640); return statearr_10820; })(); var statearr_10821_10886 = state_10759__$1; (statearr_10821_10886[(2)] = null); (statearr_10821_10886[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (14))){ var state_10759__$1 = state_10759; var statearr_10822_10887 = state_10759__$1; (statearr_10822_10887[(2)] = null); (statearr_10822_10887[(1)] = (15)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (45))){ var inst_10749 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10823_10888 = state_10759__$1; (statearr_10823_10888[(2)] = inst_10749); (statearr_10823_10888[(1)] = (44)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (26))){ var inst_10691 = (state_10759[(29)]); var inst_10745 = (state_10759[(2)]); var inst_10746 = cljs.core.seq.call(null,inst_10691); var state_10759__$1 = (function (){var statearr_10824 = state_10759; (statearr_10824[(31)] = inst_10745); return statearr_10824; })(); if(inst_10746){ var statearr_10825_10889 = state_10759__$1; (statearr_10825_10889[(1)] = (42)); } else { var statearr_10826_10890 = state_10759__$1; (statearr_10826_10890[(1)] = (43)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (16))){ var inst_10660 = (state_10759[(7)]); var inst_10662 = cljs.core.chunked_seq_QMARK_.call(null,inst_10660); var state_10759__$1 = state_10759; if(inst_10662){ var statearr_10827_10891 = state_10759__$1; (statearr_10827_10891[(1)] = (19)); } else { var statearr_10828_10892 = state_10759__$1; (statearr_10828_10892[(1)] = (20)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (38))){ var inst_10738 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10829_10893 = state_10759__$1; (statearr_10829_10893[(2)] = inst_10738); (statearr_10829_10893[(1)] = (35)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (30))){ var state_10759__$1 = state_10759; var statearr_10830_10894 = state_10759__$1; (statearr_10830_10894[(2)] = null); (statearr_10830_10894[(1)] = (32)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (10))){ var inst_10643 = (state_10759[(13)]); var inst_10641 = (state_10759[(14)]); var inst_10649 = cljs.core._nth.call(null,inst_10641,inst_10643); var inst_10650 = cljs.core.nth.call(null,inst_10649,(0),null); var inst_10651 = cljs.core.nth.call(null,inst_10649,(1),null); var state_10759__$1 = (function (){var statearr_10831 = state_10759; (statearr_10831[(26)] = inst_10650); return statearr_10831; })(); if(cljs.core.truth_(inst_10651)){ var statearr_10832_10895 = state_10759__$1; (statearr_10832_10895[(1)] = (13)); } else { var statearr_10833_10896 = state_10759__$1; (statearr_10833_10896[(1)] = (14)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (18))){ var inst_10684 = (state_10759[(2)]); var state_10759__$1 = state_10759; var statearr_10834_10897 = state_10759__$1; (statearr_10834_10897[(2)] = inst_10684); (statearr_10834_10897[(1)] = (12)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (42))){ var state_10759__$1 = state_10759; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_10759__$1,(45),dchan); } else { if((state_val_10760 === (37))){ var inst_10631 = (state_10759[(10)]); var inst_10727 = (state_10759[(23)]); var inst_10718 = (state_10759[(25)]); var inst_10727__$1 = cljs.core.first.call(null,inst_10718); var inst_10728 = cljs.core.async.put_BANG_.call(null,inst_10727__$1,inst_10631,done); var state_10759__$1 = (function (){var statearr_10835 = state_10759; (statearr_10835[(23)] = inst_10727__$1); return statearr_10835; })(); if(cljs.core.truth_(inst_10728)){ var statearr_10836_10898 = state_10759__$1; (statearr_10836_10898[(1)] = (39)); } else { var statearr_10837_10899 = state_10759__$1; (statearr_10837_10899[(1)] = (40)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_10760 === (8))){ var inst_10643 = (state_10759[(13)]); var inst_10642 = (state_10759[(16)]); var inst_10645 = (inst_10643 < inst_10642); var inst_10646 = inst_10645; var state_10759__$1 = state_10759; if(cljs.core.truth_(inst_10646)){ var statearr_10838_10900 = state_10759__$1; (statearr_10838_10900[(1)] = (10)); } else { var statearr_10839_10901 = state_10759__$1; (statearr_10839_10901[(1)] = (11)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } });})(c__6769__auto___10847,cs,m,dchan,dctr,done)) ; return ((function (switch__6713__auto__,c__6769__auto___10847,cs,m,dchan,dctr,done){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_10843 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_10843[(0)] = state_machine__6714__auto__); (statearr_10843[(1)] = (1)); return statearr_10843; }); var state_machine__6714__auto____1 = (function (state_10759){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_10759); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e10844){if((e10844 instanceof Object)){ var ex__6717__auto__ = e10844; var statearr_10845_10902 = state_10759; (statearr_10845_10902[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_10759); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e10844; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__10903 = state_10759; state_10759 = G__10903; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_10759){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_10759); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___10847,cs,m,dchan,dctr,done)) })(); var state__6771__auto__ = (function (){var statearr_10846 = f__6770__auto__.call(null); (statearr_10846[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___10847); return statearr_10846; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___10847,cs,m,dchan,dctr,done)) ); return m; }); /** * Copies the mult source onto the supplied channel. * * By default the channel will be closed when the source closes, * but can be determined by the close? parameter. */ cljs.core.async.tap = (function() { var tap = null; var tap__2 = (function (mult,ch){ return tap.call(null,mult,ch,true); }); var tap__3 = (function (mult,ch,close_QMARK_){ cljs.core.async.tap_STAR_.call(null,mult,ch,close_QMARK_); return ch; }); tap = function(mult,ch,close_QMARK_){ switch(arguments.length){ case 2: return tap__2.call(this,mult,ch); case 3: return tap__3.call(this,mult,ch,close_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; tap.cljs$core$IFn$_invoke$arity$2 = tap__2; tap.cljs$core$IFn$_invoke$arity$3 = tap__3; return tap; })() ; /** * Disconnects a target channel from a mult */ cljs.core.async.untap = (function untap(mult,ch){ return cljs.core.async.untap_STAR_.call(null,mult,ch); }); /** * Disconnects all target channels from a mult */ cljs.core.async.untap_all = (function untap_all(mult){ return cljs.core.async.untap_all_STAR_.call(null,mult); }); cljs.core.async.Mix = (function (){var obj10905 = {}; return obj10905; })(); cljs.core.async.admix_STAR_ = (function admix_STAR_(m,ch){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mix$admix_STAR_$arity$2; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mix$admix_STAR_$arity$2(m,ch); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.admix_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.admix_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mix.admix*",m); } } })().call(null,m,ch); } }); cljs.core.async.unmix_STAR_ = (function unmix_STAR_(m,ch){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mix$unmix_STAR_$arity$2; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mix$unmix_STAR_$arity$2(m,ch); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.unmix_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.unmix_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mix.unmix*",m); } } })().call(null,m,ch); } }); cljs.core.async.unmix_all_STAR_ = (function unmix_all_STAR_(m){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mix$unmix_all_STAR_$arity$1; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mix$unmix_all_STAR_$arity$1(m); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.unmix_all_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.unmix_all_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mix.unmix-all*",m); } } })().call(null,m); } }); cljs.core.async.toggle_STAR_ = (function toggle_STAR_(m,state_map){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mix$toggle_STAR_$arity$2; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mix$toggle_STAR_$arity$2(m,state_map); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.toggle_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.toggle_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mix.toggle*",m); } } })().call(null,m,state_map); } }); cljs.core.async.solo_mode_STAR_ = (function solo_mode_STAR_(m,mode){ if((function (){var and__3727__auto__ = m; if(and__3727__auto__){ return m.cljs$core$async$Mix$solo_mode_STAR_$arity$2; } else { return and__3727__auto__; } })()){ return m.cljs$core$async$Mix$solo_mode_STAR_$arity$2(m,mode); } else { var x__4383__auto__ = (((m == null))?null:m); return (function (){var or__3739__auto__ = (cljs.core.async.solo_mode_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.solo_mode_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Mix.solo-mode*",m); } } })().call(null,m,mode); } }); /** * @param {...*} var_args */ cljs.core.async.ioc_alts_BANG_ = (function() { var ioc_alts_BANG___delegate = function (state,cont_block,ports,p__10906){ var map__10911 = p__10906; var map__10911__$1 = ((cljs.core.seq_QMARK_.call(null,map__10911))?cljs.core.apply.call(null,cljs.core.hash_map,map__10911):map__10911); var opts = map__10911__$1; var statearr_10912_10915 = state; (statearr_10912_10915[cljs.core.async.impl.ioc_helpers.STATE_IDX] = cont_block); var temp__4126__auto__ = cljs.core.async.do_alts.call(null,((function (map__10911,map__10911__$1,opts){ return (function (val){ var statearr_10913_10916 = state; (statearr_10913_10916[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = val); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state); });})(map__10911,map__10911__$1,opts)) ,ports,opts); if(cljs.core.truth_(temp__4126__auto__)){ var cb = temp__4126__auto__; var statearr_10914_10917 = state; (statearr_10914_10917[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = cljs.core.deref.call(null,cb)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } }; var ioc_alts_BANG_ = function (state,cont_block,ports,var_args){ var p__10906 = null; if (arguments.length > 3) { p__10906 = cljs.core.array_seq(Array.prototype.slice.call(arguments, 3),0); } return ioc_alts_BANG___delegate.call(this,state,cont_block,ports,p__10906);}; ioc_alts_BANG_.cljs$lang$maxFixedArity = 3; ioc_alts_BANG_.cljs$lang$applyTo = (function (arglist__10918){ var state = cljs.core.first(arglist__10918); arglist__10918 = cljs.core.next(arglist__10918); var cont_block = cljs.core.first(arglist__10918); arglist__10918 = cljs.core.next(arglist__10918); var ports = cljs.core.first(arglist__10918); var p__10906 = cljs.core.rest(arglist__10918); return ioc_alts_BANG___delegate(state,cont_block,ports,p__10906); }); ioc_alts_BANG_.cljs$core$IFn$_invoke$arity$variadic = ioc_alts_BANG___delegate; return ioc_alts_BANG_; })() ; /** * Creates and returns a mix of one or more input channels which will * be put on the supplied out channel. Input sources can be added to * the mix with 'admix', and removed with 'unmix'. A mix supports * soloing, muting and pausing multiple inputs atomically using * 'toggle', and can solo using either muting or pausing as determined * by 'solo-mode'. * * Each channel can have zero or more boolean modes set via 'toggle': * * :solo - when true, only this (ond other soloed) channel(s) will appear * in the mix output channel. :mute and :pause states of soloed * channels are ignored. If solo-mode is :mute, non-soloed * channels are muted, if :pause, non-soloed channels are * paused. * * :mute - muted channels will have their contents consumed but not included in the mix * :pause - paused channels will not have their contents consumed (and thus also not included in the mix) */ cljs.core.async.mix = (function mix(out){ var cs = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY); var solo_modes = new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"pause","pause",-2095325672),null,new cljs.core.Keyword(null,"mute","mute",1151223646),null], null), null); var attrs = cljs.core.conj.call(null,solo_modes,new cljs.core.Keyword(null,"solo","solo",-316350075)); var solo_mode = cljs.core.atom.call(null,new cljs.core.Keyword(null,"mute","mute",1151223646)); var change = cljs.core.async.chan.call(null); var changed = ((function (cs,solo_modes,attrs,solo_mode,change){ return (function (){ return cljs.core.async.put_BANG_.call(null,change,true); });})(cs,solo_modes,attrs,solo_mode,change)) ; var pick = ((function (cs,solo_modes,attrs,solo_mode,change,changed){ return (function (attr,chs){ return cljs.core.reduce_kv.call(null,((function (cs,solo_modes,attrs,solo_mode,change,changed){ return (function (ret,c,v){ if(cljs.core.truth_(attr.call(null,v))){ return cljs.core.conj.call(null,ret,c); } else { return ret; } });})(cs,solo_modes,attrs,solo_mode,change,changed)) ,cljs.core.PersistentHashSet.EMPTY,chs); });})(cs,solo_modes,attrs,solo_mode,change,changed)) ; var calc_state = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick){ return (function (){ var chs = cljs.core.deref.call(null,cs); var mode = cljs.core.deref.call(null,solo_mode); var solos = pick.call(null,new cljs.core.Keyword(null,"solo","solo",-316350075),chs); var pauses = pick.call(null,new cljs.core.Keyword(null,"pause","pause",-2095325672),chs); return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"solos","solos",1441458643),solos,new cljs.core.Keyword(null,"mutes","mutes",1068806309),pick.call(null,new cljs.core.Keyword(null,"mute","mute",1151223646),chs),new cljs.core.Keyword(null,"reads","reads",-1215067361),cljs.core.conj.call(null,(((cljs.core._EQ_.call(null,mode,new cljs.core.Keyword(null,"pause","pause",-2095325672))) && (!(cljs.core.empty_QMARK_.call(null,solos))))?cljs.core.vec.call(null,solos):cljs.core.vec.call(null,cljs.core.remove.call(null,pauses,cljs.core.keys.call(null,chs)))),change)], null); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick)) ; var m = (function (){ if(typeof cljs.core.async.t11038 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t11038 = (function (change,mix,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,meta11039){ this.change = change; this.mix = mix; this.solo_mode = solo_mode; this.pick = pick; this.cs = cs; this.calc_state = calc_state; this.out = out; this.changed = changed; this.solo_modes = solo_modes; this.attrs = attrs; this.meta11039 = meta11039; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t11038.prototype.cljs$core$async$Mix$ = true; cljs.core.async.t11038.prototype.cljs$core$async$Mix$admix_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_,ch){ var self__ = this; var ___$1 = this; cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.assoc,ch,cljs.core.PersistentArrayMap.EMPTY); return self__.changed.call(null); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.prototype.cljs$core$async$Mix$unmix_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_,ch){ var self__ = this; var ___$1 = this; cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.dissoc,ch); return self__.changed.call(null); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.prototype.cljs$core$async$Mix$unmix_all_STAR_$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_){ var self__ = this; var ___$1 = this; cljs.core.reset_BANG_.call(null,self__.cs,cljs.core.PersistentArrayMap.EMPTY); return self__.changed.call(null); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.prototype.cljs$core$async$Mix$toggle_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_,state_map){ var self__ = this; var ___$1 = this; cljs.core.swap_BANG_.call(null,self__.cs,cljs.core.partial.call(null,cljs.core.merge_with,cljs.core.merge),state_map); return self__.changed.call(null); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.prototype.cljs$core$async$Mix$solo_mode_STAR_$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_,mode){ var self__ = this; var ___$1 = this; if(cljs.core.truth_(self__.solo_modes.call(null,mode))){ } else { throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str([cljs.core.str("mode must be one of: "),cljs.core.str(self__.solo_modes)].join('')),cljs.core.str("\n"),cljs.core.str(cljs.core.pr_str.call(null,cljs.core.list(new cljs.core.Symbol(null,"solo-modes","solo-modes",882180540,null),new cljs.core.Symbol(null,"mode","mode",-2000032078,null))))].join(''))); } cljs.core.reset_BANG_.call(null,self__.solo_mode,mode); return self__.changed.call(null); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.prototype.cljs$core$async$Mux$ = true; cljs.core.async.t11038.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_){ var self__ = this; var ___$1 = this; return self__.out; });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_11040){ var self__ = this; var _11040__$1 = this; return self__.meta11039; });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (_11040,meta11039__$1){ var self__ = this; var _11040__$1 = this; return (new cljs.core.async.t11038(self__.change,self__.mix,self__.solo_mode,self__.pick,self__.cs,self__.calc_state,self__.out,self__.changed,self__.solo_modes,self__.attrs,meta11039__$1)); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.t11038.cljs$lang$type = true; cljs.core.async.t11038.cljs$lang$ctorStr = "cljs.core.async/t11038"; cljs.core.async.t11038.cljs$lang$ctorPrWriter = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t11038"); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; cljs.core.async.__GT_t11038 = ((function (cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state){ return (function __GT_t11038(change__$1,mix__$1,solo_mode__$1,pick__$1,cs__$1,calc_state__$1,out__$1,changed__$1,solo_modes__$1,attrs__$1,meta11039){ return (new cljs.core.async.t11038(change__$1,mix__$1,solo_mode__$1,pick__$1,cs__$1,calc_state__$1,out__$1,changed__$1,solo_modes__$1,attrs__$1,meta11039)); });})(cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state)) ; } return (new cljs.core.async.t11038(change,mix,solo_mode,pick,cs,calc_state,out,changed,solo_modes,attrs,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),25,new cljs.core.Keyword(null,"end-line","end-line",1837326455),510,new cljs.core.Keyword(null,"column","column",2078222095),11,new cljs.core.Keyword(null,"line","line",212345235),499,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); })() ; var c__6769__auto___11157 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___11157,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___11157,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){ return (function (state_11110){ var state_val_11111 = (state_11110[(1)]); if((state_val_11111 === (7))){ var inst_11054 = (state_11110[(7)]); var inst_11059 = cljs.core.apply.call(null,cljs.core.hash_map,inst_11054); var state_11110__$1 = state_11110; var statearr_11112_11158 = state_11110__$1; (statearr_11112_11158[(2)] = inst_11059); (statearr_11112_11158[(1)] = (9)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (20))){ var inst_11069 = (state_11110[(8)]); var state_11110__$1 = state_11110; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_11110__$1,(23),out,inst_11069); } else { if((state_val_11111 === (1))){ var inst_11044 = (state_11110[(9)]); var inst_11044__$1 = calc_state.call(null); var inst_11045 = cljs.core.seq_QMARK_.call(null,inst_11044__$1); var state_11110__$1 = (function (){var statearr_11113 = state_11110; (statearr_11113[(9)] = inst_11044__$1); return statearr_11113; })(); if(inst_11045){ var statearr_11114_11159 = state_11110__$1; (statearr_11114_11159[(1)] = (2)); } else { var statearr_11115_11160 = state_11110__$1; (statearr_11115_11160[(1)] = (3)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (24))){ var inst_11062 = (state_11110[(10)]); var inst_11054 = inst_11062; var state_11110__$1 = (function (){var statearr_11116 = state_11110; (statearr_11116[(7)] = inst_11054); return statearr_11116; })(); var statearr_11117_11161 = state_11110__$1; (statearr_11117_11161[(2)] = null); (statearr_11117_11161[(1)] = (5)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (4))){ var inst_11044 = (state_11110[(9)]); var inst_11050 = (state_11110[(2)]); var inst_11051 = cljs.core.get.call(null,inst_11050,new cljs.core.Keyword(null,"reads","reads",-1215067361)); var inst_11052 = cljs.core.get.call(null,inst_11050,new cljs.core.Keyword(null,"mutes","mutes",1068806309)); var inst_11053 = cljs.core.get.call(null,inst_11050,new cljs.core.Keyword(null,"solos","solos",1441458643)); var inst_11054 = inst_11044; var state_11110__$1 = (function (){var statearr_11118 = state_11110; (statearr_11118[(11)] = inst_11053); (statearr_11118[(12)] = inst_11052); (statearr_11118[(13)] = inst_11051); (statearr_11118[(7)] = inst_11054); return statearr_11118; })(); var statearr_11119_11162 = state_11110__$1; (statearr_11119_11162[(2)] = null); (statearr_11119_11162[(1)] = (5)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (15))){ var state_11110__$1 = state_11110; var statearr_11120_11163 = state_11110__$1; (statearr_11120_11163[(2)] = null); (statearr_11120_11163[(1)] = (16)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (21))){ var inst_11062 = (state_11110[(10)]); var inst_11054 = inst_11062; var state_11110__$1 = (function (){var statearr_11121 = state_11110; (statearr_11121[(7)] = inst_11054); return statearr_11121; })(); var statearr_11122_11164 = state_11110__$1; (statearr_11122_11164[(2)] = null); (statearr_11122_11164[(1)] = (5)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (13))){ var inst_11106 = (state_11110[(2)]); var state_11110__$1 = state_11110; var statearr_11123_11165 = state_11110__$1; (statearr_11123_11165[(2)] = inst_11106); (statearr_11123_11165[(1)] = (6)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (22))){ var inst_11104 = (state_11110[(2)]); var state_11110__$1 = state_11110; var statearr_11124_11166 = state_11110__$1; (statearr_11124_11166[(2)] = inst_11104); (statearr_11124_11166[(1)] = (13)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (6))){ var inst_11108 = (state_11110[(2)]); var state_11110__$1 = state_11110; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_11110__$1,inst_11108); } else { if((state_val_11111 === (25))){ var state_11110__$1 = state_11110; var statearr_11125_11167 = state_11110__$1; (statearr_11125_11167[(2)] = null); (statearr_11125_11167[(1)] = (26)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (17))){ var inst_11084 = (state_11110[(14)]); var state_11110__$1 = state_11110; var statearr_11126_11168 = state_11110__$1; (statearr_11126_11168[(2)] = inst_11084); (statearr_11126_11168[(1)] = (19)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (3))){ var inst_11044 = (state_11110[(9)]); var state_11110__$1 = state_11110; var statearr_11127_11169 = state_11110__$1; (statearr_11127_11169[(2)] = inst_11044); (statearr_11127_11169[(1)] = (4)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (12))){ var inst_11070 = (state_11110[(15)]); var inst_11084 = (state_11110[(14)]); var inst_11065 = (state_11110[(16)]); var inst_11084__$1 = inst_11065.call(null,inst_11070); var state_11110__$1 = (function (){var statearr_11128 = state_11110; (statearr_11128[(14)] = inst_11084__$1); return statearr_11128; })(); if(cljs.core.truth_(inst_11084__$1)){ var statearr_11129_11170 = state_11110__$1; (statearr_11129_11170[(1)] = (17)); } else { var statearr_11130_11171 = state_11110__$1; (statearr_11130_11171[(1)] = (18)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (2))){ var inst_11044 = (state_11110[(9)]); var inst_11047 = cljs.core.apply.call(null,cljs.core.hash_map,inst_11044); var state_11110__$1 = state_11110; var statearr_11131_11172 = state_11110__$1; (statearr_11131_11172[(2)] = inst_11047); (statearr_11131_11172[(1)] = (4)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (23))){ var inst_11095 = (state_11110[(2)]); var state_11110__$1 = state_11110; if(cljs.core.truth_(inst_11095)){ var statearr_11132_11173 = state_11110__$1; (statearr_11132_11173[(1)] = (24)); } else { var statearr_11133_11174 = state_11110__$1; (statearr_11133_11174[(1)] = (25)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (19))){ var inst_11092 = (state_11110[(2)]); var state_11110__$1 = state_11110; if(cljs.core.truth_(inst_11092)){ var statearr_11134_11175 = state_11110__$1; (statearr_11134_11175[(1)] = (20)); } else { var statearr_11135_11176 = state_11110__$1; (statearr_11135_11176[(1)] = (21)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (11))){ var inst_11069 = (state_11110[(8)]); var inst_11075 = (inst_11069 == null); var state_11110__$1 = state_11110; if(cljs.core.truth_(inst_11075)){ var statearr_11136_11177 = state_11110__$1; (statearr_11136_11177[(1)] = (14)); } else { var statearr_11137_11178 = state_11110__$1; (statearr_11137_11178[(1)] = (15)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (9))){ var inst_11062 = (state_11110[(10)]); var inst_11062__$1 = (state_11110[(2)]); var inst_11063 = cljs.core.get.call(null,inst_11062__$1,new cljs.core.Keyword(null,"reads","reads",-1215067361)); var inst_11064 = cljs.core.get.call(null,inst_11062__$1,new cljs.core.Keyword(null,"mutes","mutes",1068806309)); var inst_11065 = cljs.core.get.call(null,inst_11062__$1,new cljs.core.Keyword(null,"solos","solos",1441458643)); var state_11110__$1 = (function (){var statearr_11138 = state_11110; (statearr_11138[(17)] = inst_11064); (statearr_11138[(16)] = inst_11065); (statearr_11138[(10)] = inst_11062__$1); return statearr_11138; })(); return cljs.core.async.ioc_alts_BANG_.call(null,state_11110__$1,(10),inst_11063); } else { if((state_val_11111 === (5))){ var inst_11054 = (state_11110[(7)]); var inst_11057 = cljs.core.seq_QMARK_.call(null,inst_11054); var state_11110__$1 = state_11110; if(inst_11057){ var statearr_11139_11179 = state_11110__$1; (statearr_11139_11179[(1)] = (7)); } else { var statearr_11140_11180 = state_11110__$1; (statearr_11140_11180[(1)] = (8)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (14))){ var inst_11070 = (state_11110[(15)]); var inst_11077 = cljs.core.swap_BANG_.call(null,cs,cljs.core.dissoc,inst_11070); var state_11110__$1 = state_11110; var statearr_11141_11181 = state_11110__$1; (statearr_11141_11181[(2)] = inst_11077); (statearr_11141_11181[(1)] = (16)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (26))){ var inst_11100 = (state_11110[(2)]); var state_11110__$1 = state_11110; var statearr_11142_11182 = state_11110__$1; (statearr_11142_11182[(2)] = inst_11100); (statearr_11142_11182[(1)] = (22)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (16))){ var inst_11080 = (state_11110[(2)]); var inst_11081 = calc_state.call(null); var inst_11054 = inst_11081; var state_11110__$1 = (function (){var statearr_11143 = state_11110; (statearr_11143[(18)] = inst_11080); (statearr_11143[(7)] = inst_11054); return statearr_11143; })(); var statearr_11144_11183 = state_11110__$1; (statearr_11144_11183[(2)] = null); (statearr_11144_11183[(1)] = (5)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (10))){ var inst_11070 = (state_11110[(15)]); var inst_11069 = (state_11110[(8)]); var inst_11068 = (state_11110[(2)]); var inst_11069__$1 = cljs.core.nth.call(null,inst_11068,(0),null); var inst_11070__$1 = cljs.core.nth.call(null,inst_11068,(1),null); var inst_11071 = (inst_11069__$1 == null); var inst_11072 = cljs.core._EQ_.call(null,inst_11070__$1,change); var inst_11073 = (inst_11071) || (inst_11072); var state_11110__$1 = (function (){var statearr_11145 = state_11110; (statearr_11145[(15)] = inst_11070__$1); (statearr_11145[(8)] = inst_11069__$1); return statearr_11145; })(); if(cljs.core.truth_(inst_11073)){ var statearr_11146_11184 = state_11110__$1; (statearr_11146_11184[(1)] = (11)); } else { var statearr_11147_11185 = state_11110__$1; (statearr_11147_11185[(1)] = (12)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (18))){ var inst_11070 = (state_11110[(15)]); var inst_11064 = (state_11110[(17)]); var inst_11065 = (state_11110[(16)]); var inst_11087 = cljs.core.empty_QMARK_.call(null,inst_11065); var inst_11088 = inst_11064.call(null,inst_11070); var inst_11089 = cljs.core.not.call(null,inst_11088); var inst_11090 = (inst_11087) && (inst_11089); var state_11110__$1 = state_11110; var statearr_11148_11186 = state_11110__$1; (statearr_11148_11186[(2)] = inst_11090); (statearr_11148_11186[(1)] = (19)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11111 === (8))){ var inst_11054 = (state_11110[(7)]); var state_11110__$1 = state_11110; var statearr_11149_11187 = state_11110__$1; (statearr_11149_11187[(2)] = inst_11054); (statearr_11149_11187[(1)] = (9)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } } } } } } } } } } } } });})(c__6769__auto___11157,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m)) ; return ((function (switch__6713__auto__,c__6769__auto___11157,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_11153 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_11153[(0)] = state_machine__6714__auto__); (statearr_11153[(1)] = (1)); return statearr_11153; }); var state_machine__6714__auto____1 = (function (state_11110){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_11110); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e11154){if((e11154 instanceof Object)){ var ex__6717__auto__ = e11154; var statearr_11155_11188 = state_11110; (statearr_11155_11188[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11110); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e11154; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__11189 = state_11110; state_11110 = G__11189; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_11110){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_11110); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___11157,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m)) })(); var state__6771__auto__ = (function (){var statearr_11156 = f__6770__auto__.call(null); (statearr_11156[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___11157); return statearr_11156; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___11157,cs,solo_modes,attrs,solo_mode,change,changed,pick,calc_state,m)) ); return m; }); /** * Adds ch as an input to the mix */ cljs.core.async.admix = (function admix(mix,ch){ return cljs.core.async.admix_STAR_.call(null,mix,ch); }); /** * Removes ch as an input to the mix */ cljs.core.async.unmix = (function unmix(mix,ch){ return cljs.core.async.unmix_STAR_.call(null,mix,ch); }); /** * removes all inputs from the mix */ cljs.core.async.unmix_all = (function unmix_all(mix){ return cljs.core.async.unmix_all_STAR_.call(null,mix); }); /** * Atomically sets the state(s) of one or more channels in a mix. The * state map is a map of channels -> channel-state-map. A * channel-state-map is a map of attrs -> boolean, where attr is one or * more of :mute, :pause or :solo. Any states supplied are merged with * the current state. * * Note that channels can be added to a mix via toggle, which can be * used to add channels in a particular (e.g. paused) state. */ cljs.core.async.toggle = (function toggle(mix,state_map){ return cljs.core.async.toggle_STAR_.call(null,mix,state_map); }); /** * Sets the solo mode of the mix. mode must be one of :mute or :pause */ cljs.core.async.solo_mode = (function solo_mode(mix,mode){ return cljs.core.async.solo_mode_STAR_.call(null,mix,mode); }); cljs.core.async.Pub = (function (){var obj11191 = {}; return obj11191; })(); cljs.core.async.sub_STAR_ = (function sub_STAR_(p,v,ch,close_QMARK_){ if((function (){var and__3727__auto__ = p; if(and__3727__auto__){ return p.cljs$core$async$Pub$sub_STAR_$arity$4; } else { return and__3727__auto__; } })()){ return p.cljs$core$async$Pub$sub_STAR_$arity$4(p,v,ch,close_QMARK_); } else { var x__4383__auto__ = (((p == null))?null:p); return (function (){var or__3739__auto__ = (cljs.core.async.sub_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.sub_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Pub.sub*",p); } } })().call(null,p,v,ch,close_QMARK_); } }); cljs.core.async.unsub_STAR_ = (function unsub_STAR_(p,v,ch){ if((function (){var and__3727__auto__ = p; if(and__3727__auto__){ return p.cljs$core$async$Pub$unsub_STAR_$arity$3; } else { return and__3727__auto__; } })()){ return p.cljs$core$async$Pub$unsub_STAR_$arity$3(p,v,ch); } else { var x__4383__auto__ = (((p == null))?null:p); return (function (){var or__3739__auto__ = (cljs.core.async.unsub_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.unsub_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Pub.unsub*",p); } } })().call(null,p,v,ch); } }); cljs.core.async.unsub_all_STAR_ = (function() { var unsub_all_STAR_ = null; var unsub_all_STAR___1 = (function (p){ if((function (){var and__3727__auto__ = p; if(and__3727__auto__){ return p.cljs$core$async$Pub$unsub_all_STAR_$arity$1; } else { return and__3727__auto__; } })()){ return p.cljs$core$async$Pub$unsub_all_STAR_$arity$1(p); } else { var x__4383__auto__ = (((p == null))?null:p); return (function (){var or__3739__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Pub.unsub-all*",p); } } })().call(null,p); } }); var unsub_all_STAR___2 = (function (p,v){ if((function (){var and__3727__auto__ = p; if(and__3727__auto__){ return p.cljs$core$async$Pub$unsub_all_STAR_$arity$2; } else { return and__3727__auto__; } })()){ return p.cljs$core$async$Pub$unsub_all_STAR_$arity$2(p,v); } else { var x__4383__auto__ = (((p == null))?null:p); return (function (){var or__3739__auto__ = (cljs.core.async.unsub_all_STAR_[goog.typeOf(x__4383__auto__)]); if(or__3739__auto__){ return or__3739__auto__; } else { var or__3739__auto____$1 = (cljs.core.async.unsub_all_STAR_["_"]); if(or__3739__auto____$1){ return or__3739__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"Pub.unsub-all*",p); } } })().call(null,p,v); } }); unsub_all_STAR_ = function(p,v){ switch(arguments.length){ case 1: return unsub_all_STAR___1.call(this,p); case 2: return unsub_all_STAR___2.call(this,p,v); } throw(new Error('Invalid arity: ' + arguments.length)); }; unsub_all_STAR_.cljs$core$IFn$_invoke$arity$1 = unsub_all_STAR___1; unsub_all_STAR_.cljs$core$IFn$_invoke$arity$2 = unsub_all_STAR___2; return unsub_all_STAR_; })() ; /** * Creates and returns a pub(lication) of the supplied channel, * partitioned into topics by the topic-fn. topic-fn will be applied to * each value on the channel and the result will determine the 'topic' * on which that value will be put. Channels can be subscribed to * receive copies of topics using 'sub', and unsubscribed using * 'unsub'. Each topic will be handled by an internal mult on a * dedicated channel. By default these internal channels are * unbuffered, but a buf-fn can be supplied which, given a topic, * creates a buffer with desired properties. * * Each item is distributed to all subs in parallel and synchronously, * i.e. each sub must accept before the next item is distributed. Use * buffering/windowing to prevent slow subs from holding up the pub. * * Items received when there are no matching subs get dropped. * * Note that if buf-fns are used then each topic is handled * asynchronously, i.e. if a channel is subscribed to more than one * topic it should not expect them to be interleaved identically with * the source. */ cljs.core.async.pub = (function() { var pub = null; var pub__2 = (function (ch,topic_fn){ return pub.call(null,ch,topic_fn,cljs.core.constantly.call(null,null)); }); var pub__3 = (function (ch,topic_fn,buf_fn){ var mults = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY); var ensure_mult = ((function (mults){ return (function (topic){ var or__3739__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,mults),topic); if(cljs.core.truth_(or__3739__auto__)){ return or__3739__auto__; } else { return cljs.core.get.call(null,cljs.core.swap_BANG_.call(null,mults,((function (or__3739__auto__,mults){ return (function (p1__11192_SHARP_){ if(cljs.core.truth_(p1__11192_SHARP_.call(null,topic))){ return p1__11192_SHARP_; } else { return cljs.core.assoc.call(null,p1__11192_SHARP_,topic,cljs.core.async.mult.call(null,cljs.core.async.chan.call(null,buf_fn.call(null,topic)))); } });})(or__3739__auto__,mults)) ),topic); } });})(mults)) ; var p = (function (){ if(typeof cljs.core.async.t11315 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t11315 = (function (ensure_mult,mults,buf_fn,topic_fn,ch,pub,meta11316){ this.ensure_mult = ensure_mult; this.mults = mults; this.buf_fn = buf_fn; this.topic_fn = topic_fn; this.ch = ch; this.pub = pub; this.meta11316 = meta11316; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t11315.prototype.cljs$core$async$Pub$ = true; cljs.core.async.t11315.prototype.cljs$core$async$Pub$sub_STAR_$arity$4 = ((function (mults,ensure_mult){ return (function (p,topic,ch__$1,close_QMARK_){ var self__ = this; var p__$1 = this; var m = self__.ensure_mult.call(null,topic); return cljs.core.async.tap.call(null,m,ch__$1,close_QMARK_); });})(mults,ensure_mult)) ; cljs.core.async.t11315.prototype.cljs$core$async$Pub$unsub_STAR_$arity$3 = ((function (mults,ensure_mult){ return (function (p,topic,ch__$1){ var self__ = this; var p__$1 = this; var temp__4126__auto__ = cljs.core.get.call(null,cljs.core.deref.call(null,self__.mults),topic); if(cljs.core.truth_(temp__4126__auto__)){ var m = temp__4126__auto__; return cljs.core.async.untap.call(null,m,ch__$1); } else { return null; } });})(mults,ensure_mult)) ; cljs.core.async.t11315.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$1 = ((function (mults,ensure_mult){ return (function (_){ var self__ = this; var ___$1 = this; return cljs.core.reset_BANG_.call(null,self__.mults,cljs.core.PersistentArrayMap.EMPTY); });})(mults,ensure_mult)) ; cljs.core.async.t11315.prototype.cljs$core$async$Pub$unsub_all_STAR_$arity$2 = ((function (mults,ensure_mult){ return (function (_,topic){ var self__ = this; var ___$1 = this; return cljs.core.swap_BANG_.call(null,self__.mults,cljs.core.dissoc,topic); });})(mults,ensure_mult)) ; cljs.core.async.t11315.prototype.cljs$core$async$Mux$ = true; cljs.core.async.t11315.prototype.cljs$core$async$Mux$muxch_STAR_$arity$1 = ((function (mults,ensure_mult){ return (function (_){ var self__ = this; var ___$1 = this; return self__.ch; });})(mults,ensure_mult)) ; cljs.core.async.t11315.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (mults,ensure_mult){ return (function (_11317){ var self__ = this; var _11317__$1 = this; return self__.meta11316; });})(mults,ensure_mult)) ; cljs.core.async.t11315.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (mults,ensure_mult){ return (function (_11317,meta11316__$1){ var self__ = this; var _11317__$1 = this; return (new cljs.core.async.t11315(self__.ensure_mult,self__.mults,self__.buf_fn,self__.topic_fn,self__.ch,self__.pub,meta11316__$1)); });})(mults,ensure_mult)) ; cljs.core.async.t11315.cljs$lang$type = true; cljs.core.async.t11315.cljs$lang$ctorStr = "cljs.core.async/t11315"; cljs.core.async.t11315.cljs$lang$ctorPrWriter = ((function (mults,ensure_mult){ return (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t11315"); });})(mults,ensure_mult)) ; cljs.core.async.__GT_t11315 = ((function (mults,ensure_mult){ return (function __GT_t11315(ensure_mult__$1,mults__$1,buf_fn__$1,topic_fn__$1,ch__$1,pub__$1,meta11316){ return (new cljs.core.async.t11315(ensure_mult__$1,mults__$1,buf_fn__$1,topic_fn__$1,ch__$1,pub__$1,meta11316)); });})(mults,ensure_mult)) ; } return (new cljs.core.async.t11315(ensure_mult,mults,buf_fn,topic_fn,ch,pub,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),65,new cljs.core.Keyword(null,"end-line","end-line",1837326455),603,new cljs.core.Keyword(null,"column","column",2078222095),14,new cljs.core.Keyword(null,"line","line",212345235),591,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); })() ; var c__6769__auto___11437 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___11437,mults,ensure_mult,p){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___11437,mults,ensure_mult,p){ return (function (state_11389){ var state_val_11390 = (state_11389[(1)]); if((state_val_11390 === (7))){ var inst_11385 = (state_11389[(2)]); var state_11389__$1 = state_11389; var statearr_11391_11438 = state_11389__$1; (statearr_11391_11438[(2)] = inst_11385); (statearr_11391_11438[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (20))){ var state_11389__$1 = state_11389; var statearr_11392_11439 = state_11389__$1; (statearr_11392_11439[(2)] = null); (statearr_11392_11439[(1)] = (21)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (1))){ var state_11389__$1 = state_11389; var statearr_11393_11440 = state_11389__$1; (statearr_11393_11440[(2)] = null); (statearr_11393_11440[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (24))){ var inst_11368 = (state_11389[(7)]); var inst_11377 = cljs.core.swap_BANG_.call(null,mults,cljs.core.dissoc,inst_11368); var state_11389__$1 = state_11389; var statearr_11394_11441 = state_11389__$1; (statearr_11394_11441[(2)] = inst_11377); (statearr_11394_11441[(1)] = (25)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (4))){ var inst_11320 = (state_11389[(8)]); var inst_11320__$1 = (state_11389[(2)]); var inst_11321 = (inst_11320__$1 == null); var state_11389__$1 = (function (){var statearr_11395 = state_11389; (statearr_11395[(8)] = inst_11320__$1); return statearr_11395; })(); if(cljs.core.truth_(inst_11321)){ var statearr_11396_11442 = state_11389__$1; (statearr_11396_11442[(1)] = (5)); } else { var statearr_11397_11443 = state_11389__$1; (statearr_11397_11443[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (15))){ var inst_11362 = (state_11389[(2)]); var state_11389__$1 = state_11389; var statearr_11398_11444 = state_11389__$1; (statearr_11398_11444[(2)] = inst_11362); (statearr_11398_11444[(1)] = (12)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (21))){ var inst_11382 = (state_11389[(2)]); var state_11389__$1 = (function (){var statearr_11399 = state_11389; (statearr_11399[(9)] = inst_11382); return statearr_11399; })(); var statearr_11400_11445 = state_11389__$1; (statearr_11400_11445[(2)] = null); (statearr_11400_11445[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (13))){ var inst_11344 = (state_11389[(10)]); var inst_11346 = cljs.core.chunked_seq_QMARK_.call(null,inst_11344); var state_11389__$1 = state_11389; if(inst_11346){ var statearr_11401_11446 = state_11389__$1; (statearr_11401_11446[(1)] = (16)); } else { var statearr_11402_11447 = state_11389__$1; (statearr_11402_11447[(1)] = (17)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (22))){ var inst_11374 = (state_11389[(2)]); var state_11389__$1 = state_11389; if(cljs.core.truth_(inst_11374)){ var statearr_11403_11448 = state_11389__$1; (statearr_11403_11448[(1)] = (23)); } else { var statearr_11404_11449 = state_11389__$1; (statearr_11404_11449[(1)] = (24)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (6))){ var inst_11368 = (state_11389[(7)]); var inst_11370 = (state_11389[(11)]); var inst_11320 = (state_11389[(8)]); var inst_11368__$1 = topic_fn.call(null,inst_11320); var inst_11369 = cljs.core.deref.call(null,mults); var inst_11370__$1 = cljs.core.get.call(null,inst_11369,inst_11368__$1); var state_11389__$1 = (function (){var statearr_11405 = state_11389; (statearr_11405[(7)] = inst_11368__$1); (statearr_11405[(11)] = inst_11370__$1); return statearr_11405; })(); if(cljs.core.truth_(inst_11370__$1)){ var statearr_11406_11450 = state_11389__$1; (statearr_11406_11450[(1)] = (19)); } else { var statearr_11407_11451 = state_11389__$1; (statearr_11407_11451[(1)] = (20)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (25))){ var inst_11379 = (state_11389[(2)]); var state_11389__$1 = state_11389; var statearr_11408_11452 = state_11389__$1; (statearr_11408_11452[(2)] = inst_11379); (statearr_11408_11452[(1)] = (21)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (17))){ var inst_11344 = (state_11389[(10)]); var inst_11353 = cljs.core.first.call(null,inst_11344); var inst_11354 = cljs.core.async.muxch_STAR_.call(null,inst_11353); var inst_11355 = cljs.core.async.close_BANG_.call(null,inst_11354); var inst_11356 = cljs.core.next.call(null,inst_11344); var inst_11330 = inst_11356; var inst_11331 = null; var inst_11332 = (0); var inst_11333 = (0); var state_11389__$1 = (function (){var statearr_11409 = state_11389; (statearr_11409[(12)] = inst_11331); (statearr_11409[(13)] = inst_11355); (statearr_11409[(14)] = inst_11332); (statearr_11409[(15)] = inst_11333); (statearr_11409[(16)] = inst_11330); return statearr_11409; })(); var statearr_11410_11453 = state_11389__$1; (statearr_11410_11453[(2)] = null); (statearr_11410_11453[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (3))){ var inst_11387 = (state_11389[(2)]); var state_11389__$1 = state_11389; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_11389__$1,inst_11387); } else { if((state_val_11390 === (12))){ var inst_11364 = (state_11389[(2)]); var state_11389__$1 = state_11389; var statearr_11411_11454 = state_11389__$1; (statearr_11411_11454[(2)] = inst_11364); (statearr_11411_11454[(1)] = (9)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (2))){ var state_11389__$1 = state_11389; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_11389__$1,(4),ch); } else { if((state_val_11390 === (23))){ var state_11389__$1 = state_11389; var statearr_11412_11455 = state_11389__$1; (statearr_11412_11455[(2)] = null); (statearr_11412_11455[(1)] = (25)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (19))){ var inst_11370 = (state_11389[(11)]); var inst_11320 = (state_11389[(8)]); var inst_11372 = cljs.core.async.muxch_STAR_.call(null,inst_11370); var state_11389__$1 = state_11389; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_11389__$1,(22),inst_11372,inst_11320); } else { if((state_val_11390 === (11))){ var inst_11344 = (state_11389[(10)]); var inst_11330 = (state_11389[(16)]); var inst_11344__$1 = cljs.core.seq.call(null,inst_11330); var state_11389__$1 = (function (){var statearr_11413 = state_11389; (statearr_11413[(10)] = inst_11344__$1); return statearr_11413; })(); if(inst_11344__$1){ var statearr_11414_11456 = state_11389__$1; (statearr_11414_11456[(1)] = (13)); } else { var statearr_11415_11457 = state_11389__$1; (statearr_11415_11457[(1)] = (14)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (9))){ var inst_11366 = (state_11389[(2)]); var state_11389__$1 = state_11389; var statearr_11416_11458 = state_11389__$1; (statearr_11416_11458[(2)] = inst_11366); (statearr_11416_11458[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (5))){ var inst_11327 = cljs.core.deref.call(null,mults); var inst_11328 = cljs.core.vals.call(null,inst_11327); var inst_11329 = cljs.core.seq.call(null,inst_11328); var inst_11330 = inst_11329; var inst_11331 = null; var inst_11332 = (0); var inst_11333 = (0); var state_11389__$1 = (function (){var statearr_11417 = state_11389; (statearr_11417[(12)] = inst_11331); (statearr_11417[(14)] = inst_11332); (statearr_11417[(15)] = inst_11333); (statearr_11417[(16)] = inst_11330); return statearr_11417; })(); var statearr_11418_11459 = state_11389__$1; (statearr_11418_11459[(2)] = null); (statearr_11418_11459[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (14))){ var state_11389__$1 = state_11389; var statearr_11422_11460 = state_11389__$1; (statearr_11422_11460[(2)] = null); (statearr_11422_11460[(1)] = (15)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (16))){ var inst_11344 = (state_11389[(10)]); var inst_11348 = cljs.core.chunk_first.call(null,inst_11344); var inst_11349 = cljs.core.chunk_rest.call(null,inst_11344); var inst_11350 = cljs.core.count.call(null,inst_11348); var inst_11330 = inst_11349; var inst_11331 = inst_11348; var inst_11332 = inst_11350; var inst_11333 = (0); var state_11389__$1 = (function (){var statearr_11423 = state_11389; (statearr_11423[(12)] = inst_11331); (statearr_11423[(14)] = inst_11332); (statearr_11423[(15)] = inst_11333); (statearr_11423[(16)] = inst_11330); return statearr_11423; })(); var statearr_11424_11461 = state_11389__$1; (statearr_11424_11461[(2)] = null); (statearr_11424_11461[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (10))){ var inst_11331 = (state_11389[(12)]); var inst_11332 = (state_11389[(14)]); var inst_11333 = (state_11389[(15)]); var inst_11330 = (state_11389[(16)]); var inst_11338 = cljs.core._nth.call(null,inst_11331,inst_11333); var inst_11339 = cljs.core.async.muxch_STAR_.call(null,inst_11338); var inst_11340 = cljs.core.async.close_BANG_.call(null,inst_11339); var inst_11341 = (inst_11333 + (1)); var tmp11419 = inst_11331; var tmp11420 = inst_11332; var tmp11421 = inst_11330; var inst_11330__$1 = tmp11421; var inst_11331__$1 = tmp11419; var inst_11332__$1 = tmp11420; var inst_11333__$1 = inst_11341; var state_11389__$1 = (function (){var statearr_11425 = state_11389; (statearr_11425[(12)] = inst_11331__$1); (statearr_11425[(17)] = inst_11340); (statearr_11425[(14)] = inst_11332__$1); (statearr_11425[(15)] = inst_11333__$1); (statearr_11425[(16)] = inst_11330__$1); return statearr_11425; })(); var statearr_11426_11462 = state_11389__$1; (statearr_11426_11462[(2)] = null); (statearr_11426_11462[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (18))){ var inst_11359 = (state_11389[(2)]); var state_11389__$1 = state_11389; var statearr_11427_11463 = state_11389__$1; (statearr_11427_11463[(2)] = inst_11359); (statearr_11427_11463[(1)] = (15)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11390 === (8))){ var inst_11332 = (state_11389[(14)]); var inst_11333 = (state_11389[(15)]); var inst_11335 = (inst_11333 < inst_11332); var inst_11336 = inst_11335; var state_11389__$1 = state_11389; if(cljs.core.truth_(inst_11336)){ var statearr_11428_11464 = state_11389__$1; (statearr_11428_11464[(1)] = (10)); } else { var statearr_11429_11465 = state_11389__$1; (statearr_11429_11465[(1)] = (11)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } } } } } } } } } } } });})(c__6769__auto___11437,mults,ensure_mult,p)) ; return ((function (switch__6713__auto__,c__6769__auto___11437,mults,ensure_mult,p){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_11433 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_11433[(0)] = state_machine__6714__auto__); (statearr_11433[(1)] = (1)); return statearr_11433; }); var state_machine__6714__auto____1 = (function (state_11389){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_11389); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e11434){if((e11434 instanceof Object)){ var ex__6717__auto__ = e11434; var statearr_11435_11466 = state_11389; (statearr_11435_11466[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11389); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e11434; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__11467 = state_11389; state_11389 = G__11467; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_11389){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_11389); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___11437,mults,ensure_mult,p)) })(); var state__6771__auto__ = (function (){var statearr_11436 = f__6770__auto__.call(null); (statearr_11436[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___11437); return statearr_11436; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___11437,mults,ensure_mult,p)) ); return p; }); pub = function(ch,topic_fn,buf_fn){ switch(arguments.length){ case 2: return pub__2.call(this,ch,topic_fn); case 3: return pub__3.call(this,ch,topic_fn,buf_fn); } throw(new Error('Invalid arity: ' + arguments.length)); }; pub.cljs$core$IFn$_invoke$arity$2 = pub__2; pub.cljs$core$IFn$_invoke$arity$3 = pub__3; return pub; })() ; /** * Subscribes a channel to a topic of a pub. * * By default the channel will be closed when the source closes, * but can be determined by the close? parameter. */ cljs.core.async.sub = (function() { var sub = null; var sub__3 = (function (p,topic,ch){ return sub.call(null,p,topic,ch,true); }); var sub__4 = (function (p,topic,ch,close_QMARK_){ return cljs.core.async.sub_STAR_.call(null,p,topic,ch,close_QMARK_); }); sub = function(p,topic,ch,close_QMARK_){ switch(arguments.length){ case 3: return sub__3.call(this,p,topic,ch); case 4: return sub__4.call(this,p,topic,ch,close_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; sub.cljs$core$IFn$_invoke$arity$3 = sub__3; sub.cljs$core$IFn$_invoke$arity$4 = sub__4; return sub; })() ; /** * Unsubscribes a channel from a topic of a pub */ cljs.core.async.unsub = (function unsub(p,topic,ch){ return cljs.core.async.unsub_STAR_.call(null,p,topic,ch); }); /** * Unsubscribes all channels from a pub, or a topic of a pub */ cljs.core.async.unsub_all = (function() { var unsub_all = null; var unsub_all__1 = (function (p){ return cljs.core.async.unsub_all_STAR_.call(null,p); }); var unsub_all__2 = (function (p,topic){ return cljs.core.async.unsub_all_STAR_.call(null,p,topic); }); unsub_all = function(p,topic){ switch(arguments.length){ case 1: return unsub_all__1.call(this,p); case 2: return unsub_all__2.call(this,p,topic); } throw(new Error('Invalid arity: ' + arguments.length)); }; unsub_all.cljs$core$IFn$_invoke$arity$1 = unsub_all__1; unsub_all.cljs$core$IFn$_invoke$arity$2 = unsub_all__2; return unsub_all; })() ; /** * Takes a function and a collection of source channels, and returns a * channel which contains the values produced by applying f to the set * of first items taken from each source channel, followed by applying * f to the set of second items from each channel, until any one of the * channels is closed, at which point the output channel will be * closed. The returned channel will be unbuffered by default, or a * buf-or-n can be supplied */ cljs.core.async.map = (function() { var map = null; var map__2 = (function (f,chs){ return map.call(null,f,chs,null); }); var map__3 = (function (f,chs,buf_or_n){ var chs__$1 = cljs.core.vec.call(null,chs); var out = cljs.core.async.chan.call(null,buf_or_n); var cnt = cljs.core.count.call(null,chs__$1); var rets = cljs.core.object_array.call(null,cnt); var dchan = cljs.core.async.chan.call(null,(1)); var dctr = cljs.core.atom.call(null,null); var done = cljs.core.mapv.call(null,((function (chs__$1,out,cnt,rets,dchan,dctr){ return (function (i){ return ((function (chs__$1,out,cnt,rets,dchan,dctr){ return (function (ret){ (rets[i] = ret); if((cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec) === (0))){ return cljs.core.async.put_BANG_.call(null,dchan,rets.slice((0))); } else { return null; } }); ;})(chs__$1,out,cnt,rets,dchan,dctr)) });})(chs__$1,out,cnt,rets,dchan,dctr)) ,cljs.core.range.call(null,cnt)); var c__6769__auto___11604 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___11604,chs__$1,out,cnt,rets,dchan,dctr,done){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___11604,chs__$1,out,cnt,rets,dchan,dctr,done){ return (function (state_11574){ var state_val_11575 = (state_11574[(1)]); if((state_val_11575 === (7))){ var state_11574__$1 = state_11574; var statearr_11576_11605 = state_11574__$1; (statearr_11576_11605[(2)] = null); (statearr_11576_11605[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (1))){ var state_11574__$1 = state_11574; var statearr_11577_11606 = state_11574__$1; (statearr_11577_11606[(2)] = null); (statearr_11577_11606[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (4))){ var inst_11538 = (state_11574[(7)]); var inst_11540 = (inst_11538 < cnt); var state_11574__$1 = state_11574; if(cljs.core.truth_(inst_11540)){ var statearr_11578_11607 = state_11574__$1; (statearr_11578_11607[(1)] = (6)); } else { var statearr_11579_11608 = state_11574__$1; (statearr_11579_11608[(1)] = (7)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (15))){ var inst_11570 = (state_11574[(2)]); var state_11574__$1 = state_11574; var statearr_11580_11609 = state_11574__$1; (statearr_11580_11609[(2)] = inst_11570); (statearr_11580_11609[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (13))){ var inst_11563 = cljs.core.async.close_BANG_.call(null,out); var state_11574__$1 = state_11574; var statearr_11581_11610 = state_11574__$1; (statearr_11581_11610[(2)] = inst_11563); (statearr_11581_11610[(1)] = (15)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (6))){ var state_11574__$1 = state_11574; var statearr_11582_11611 = state_11574__$1; (statearr_11582_11611[(2)] = null); (statearr_11582_11611[(1)] = (11)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (3))){ var inst_11572 = (state_11574[(2)]); var state_11574__$1 = state_11574; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_11574__$1,inst_11572); } else { if((state_val_11575 === (12))){ var inst_11560 = (state_11574[(8)]); var inst_11560__$1 = (state_11574[(2)]); var inst_11561 = cljs.core.some.call(null,cljs.core.nil_QMARK_,inst_11560__$1); var state_11574__$1 = (function (){var statearr_11583 = state_11574; (statearr_11583[(8)] = inst_11560__$1); return statearr_11583; })(); if(cljs.core.truth_(inst_11561)){ var statearr_11584_11612 = state_11574__$1; (statearr_11584_11612[(1)] = (13)); } else { var statearr_11585_11613 = state_11574__$1; (statearr_11585_11613[(1)] = (14)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (2))){ var inst_11537 = cljs.core.reset_BANG_.call(null,dctr,cnt); var inst_11538 = (0); var state_11574__$1 = (function (){var statearr_11586 = state_11574; (statearr_11586[(7)] = inst_11538); (statearr_11586[(9)] = inst_11537); return statearr_11586; })(); var statearr_11587_11614 = state_11574__$1; (statearr_11587_11614[(2)] = null); (statearr_11587_11614[(1)] = (4)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (11))){ var inst_11538 = (state_11574[(7)]); var _ = cljs.core.async.impl.ioc_helpers.add_exception_frame.call(null,state_11574,(10),Object,null,(9)); var inst_11547 = chs__$1.call(null,inst_11538); var inst_11548 = done.call(null,inst_11538); var inst_11549 = cljs.core.async.take_BANG_.call(null,inst_11547,inst_11548); var state_11574__$1 = state_11574; var statearr_11588_11615 = state_11574__$1; (statearr_11588_11615[(2)] = inst_11549); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11574__$1); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (9))){ var inst_11538 = (state_11574[(7)]); var inst_11551 = (state_11574[(2)]); var inst_11552 = (inst_11538 + (1)); var inst_11538__$1 = inst_11552; var state_11574__$1 = (function (){var statearr_11589 = state_11574; (statearr_11589[(10)] = inst_11551); (statearr_11589[(7)] = inst_11538__$1); return statearr_11589; })(); var statearr_11590_11616 = state_11574__$1; (statearr_11590_11616[(2)] = null); (statearr_11590_11616[(1)] = (4)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (5))){ var inst_11558 = (state_11574[(2)]); var state_11574__$1 = (function (){var statearr_11591 = state_11574; (statearr_11591[(11)] = inst_11558); return statearr_11591; })(); return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_11574__$1,(12),dchan); } else { if((state_val_11575 === (14))){ var inst_11560 = (state_11574[(8)]); var inst_11565 = cljs.core.apply.call(null,f,inst_11560); var state_11574__$1 = state_11574; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_11574__$1,(16),out,inst_11565); } else { if((state_val_11575 === (16))){ var inst_11567 = (state_11574[(2)]); var state_11574__$1 = (function (){var statearr_11592 = state_11574; (statearr_11592[(12)] = inst_11567); return statearr_11592; })(); var statearr_11593_11617 = state_11574__$1; (statearr_11593_11617[(2)] = null); (statearr_11593_11617[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (10))){ var inst_11542 = (state_11574[(2)]); var inst_11543 = cljs.core.swap_BANG_.call(null,dctr,cljs.core.dec); var state_11574__$1 = (function (){var statearr_11594 = state_11574; (statearr_11594[(13)] = inst_11542); return statearr_11594; })(); var statearr_11595_11618 = state_11574__$1; (statearr_11595_11618[(2)] = inst_11543); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11574__$1); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11575 === (8))){ var inst_11556 = (state_11574[(2)]); var state_11574__$1 = state_11574; var statearr_11596_11619 = state_11574__$1; (statearr_11596_11619[(2)] = inst_11556); (statearr_11596_11619[(1)] = (5)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } } });})(c__6769__auto___11604,chs__$1,out,cnt,rets,dchan,dctr,done)) ; return ((function (switch__6713__auto__,c__6769__auto___11604,chs__$1,out,cnt,rets,dchan,dctr,done){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_11600 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_11600[(0)] = state_machine__6714__auto__); (statearr_11600[(1)] = (1)); return statearr_11600; }); var state_machine__6714__auto____1 = (function (state_11574){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_11574); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e11601){if((e11601 instanceof Object)){ var ex__6717__auto__ = e11601; var statearr_11602_11620 = state_11574; (statearr_11602_11620[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11574); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e11601; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__11621 = state_11574; state_11574 = G__11621; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_11574){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_11574); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___11604,chs__$1,out,cnt,rets,dchan,dctr,done)) })(); var state__6771__auto__ = (function (){var statearr_11603 = f__6770__auto__.call(null); (statearr_11603[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___11604); return statearr_11603; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___11604,chs__$1,out,cnt,rets,dchan,dctr,done)) ); return out; }); map = function(f,chs,buf_or_n){ switch(arguments.length){ case 2: return map__2.call(this,f,chs); case 3: return map__3.call(this,f,chs,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; map.cljs$core$IFn$_invoke$arity$2 = map__2; map.cljs$core$IFn$_invoke$arity$3 = map__3; return map; })() ; /** * Takes a collection of source channels and returns a channel which * contains all values taken from them. The returned channel will be * unbuffered by default, or a buf-or-n can be supplied. The channel * will close after all the source channels have closed. */ cljs.core.async.merge = (function() { var merge = null; var merge__1 = (function (chs){ return merge.call(null,chs,null); }); var merge__2 = (function (chs,buf_or_n){ var out = cljs.core.async.chan.call(null,buf_or_n); var c__6769__auto___11729 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___11729,out){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___11729,out){ return (function (state_11705){ var state_val_11706 = (state_11705[(1)]); if((state_val_11706 === (7))){ var inst_11684 = (state_11705[(7)]); var inst_11685 = (state_11705[(8)]); var inst_11684__$1 = (state_11705[(2)]); var inst_11685__$1 = cljs.core.nth.call(null,inst_11684__$1,(0),null); var inst_11686 = cljs.core.nth.call(null,inst_11684__$1,(1),null); var inst_11687 = (inst_11685__$1 == null); var state_11705__$1 = (function (){var statearr_11707 = state_11705; (statearr_11707[(7)] = inst_11684__$1); (statearr_11707[(8)] = inst_11685__$1); (statearr_11707[(9)] = inst_11686); return statearr_11707; })(); if(cljs.core.truth_(inst_11687)){ var statearr_11708_11730 = state_11705__$1; (statearr_11708_11730[(1)] = (8)); } else { var statearr_11709_11731 = state_11705__$1; (statearr_11709_11731[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11706 === (1))){ var inst_11676 = cljs.core.vec.call(null,chs); var inst_11677 = inst_11676; var state_11705__$1 = (function (){var statearr_11710 = state_11705; (statearr_11710[(10)] = inst_11677); return statearr_11710; })(); var statearr_11711_11732 = state_11705__$1; (statearr_11711_11732[(2)] = null); (statearr_11711_11732[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11706 === (4))){ var inst_11677 = (state_11705[(10)]); var state_11705__$1 = state_11705; return cljs.core.async.ioc_alts_BANG_.call(null,state_11705__$1,(7),inst_11677); } else { if((state_val_11706 === (6))){ var inst_11701 = (state_11705[(2)]); var state_11705__$1 = state_11705; var statearr_11712_11733 = state_11705__$1; (statearr_11712_11733[(2)] = inst_11701); (statearr_11712_11733[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11706 === (3))){ var inst_11703 = (state_11705[(2)]); var state_11705__$1 = state_11705; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_11705__$1,inst_11703); } else { if((state_val_11706 === (2))){ var inst_11677 = (state_11705[(10)]); var inst_11679 = cljs.core.count.call(null,inst_11677); var inst_11680 = (inst_11679 > (0)); var state_11705__$1 = state_11705; if(cljs.core.truth_(inst_11680)){ var statearr_11714_11734 = state_11705__$1; (statearr_11714_11734[(1)] = (4)); } else { var statearr_11715_11735 = state_11705__$1; (statearr_11715_11735[(1)] = (5)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11706 === (11))){ var inst_11677 = (state_11705[(10)]); var inst_11694 = (state_11705[(2)]); var tmp11713 = inst_11677; var inst_11677__$1 = tmp11713; var state_11705__$1 = (function (){var statearr_11716 = state_11705; (statearr_11716[(11)] = inst_11694); (statearr_11716[(10)] = inst_11677__$1); return statearr_11716; })(); var statearr_11717_11736 = state_11705__$1; (statearr_11717_11736[(2)] = null); (statearr_11717_11736[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11706 === (9))){ var inst_11685 = (state_11705[(8)]); var state_11705__$1 = state_11705; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_11705__$1,(11),out,inst_11685); } else { if((state_val_11706 === (5))){ var inst_11699 = cljs.core.async.close_BANG_.call(null,out); var state_11705__$1 = state_11705; var statearr_11718_11737 = state_11705__$1; (statearr_11718_11737[(2)] = inst_11699); (statearr_11718_11737[(1)] = (6)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11706 === (10))){ var inst_11697 = (state_11705[(2)]); var state_11705__$1 = state_11705; var statearr_11719_11738 = state_11705__$1; (statearr_11719_11738[(2)] = inst_11697); (statearr_11719_11738[(1)] = (6)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11706 === (8))){ var inst_11677 = (state_11705[(10)]); var inst_11684 = (state_11705[(7)]); var inst_11685 = (state_11705[(8)]); var inst_11686 = (state_11705[(9)]); var inst_11689 = (function (){var c = inst_11686; var v = inst_11685; var vec__11682 = inst_11684; var cs = inst_11677; return ((function (c,v,vec__11682,cs,inst_11677,inst_11684,inst_11685,inst_11686,state_val_11706,c__6769__auto___11729,out){ return (function (p1__11622_SHARP_){ return cljs.core.not_EQ_.call(null,c,p1__11622_SHARP_); }); ;})(c,v,vec__11682,cs,inst_11677,inst_11684,inst_11685,inst_11686,state_val_11706,c__6769__auto___11729,out)) })(); var inst_11690 = cljs.core.filterv.call(null,inst_11689,inst_11677); var inst_11677__$1 = inst_11690; var state_11705__$1 = (function (){var statearr_11720 = state_11705; (statearr_11720[(10)] = inst_11677__$1); return statearr_11720; })(); var statearr_11721_11739 = state_11705__$1; (statearr_11721_11739[(2)] = null); (statearr_11721_11739[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } });})(c__6769__auto___11729,out)) ; return ((function (switch__6713__auto__,c__6769__auto___11729,out){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_11725 = [null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_11725[(0)] = state_machine__6714__auto__); (statearr_11725[(1)] = (1)); return statearr_11725; }); var state_machine__6714__auto____1 = (function (state_11705){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_11705); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e11726){if((e11726 instanceof Object)){ var ex__6717__auto__ = e11726; var statearr_11727_11740 = state_11705; (statearr_11727_11740[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11705); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e11726; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__11741 = state_11705; state_11705 = G__11741; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_11705){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_11705); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___11729,out)) })(); var state__6771__auto__ = (function (){var statearr_11728 = f__6770__auto__.call(null); (statearr_11728[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___11729); return statearr_11728; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___11729,out)) ); return out; }); merge = function(chs,buf_or_n){ switch(arguments.length){ case 1: return merge__1.call(this,chs); case 2: return merge__2.call(this,chs,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; merge.cljs$core$IFn$_invoke$arity$1 = merge__1; merge.cljs$core$IFn$_invoke$arity$2 = merge__2; return merge; })() ; /** * Returns a channel containing the single (collection) result of the * items taken from the channel conjoined to the supplied * collection. ch must close before into produces a result. */ cljs.core.async.into = (function into(coll,ch){ return cljs.core.async.reduce.call(null,cljs.core.conj,coll,ch); }); /** * Returns a channel that will return, at most, n items from ch. After n items * have been returned, or ch has been closed, the return chanel will close. * * The output channel is unbuffered by default, unless buf-or-n is given. */ cljs.core.async.take = (function() { var take = null; var take__2 = (function (n,ch){ return take.call(null,n,ch,null); }); var take__3 = (function (n,ch,buf_or_n){ var out = cljs.core.async.chan.call(null,buf_or_n); var c__6769__auto___11834 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___11834,out){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___11834,out){ return (function (state_11811){ var state_val_11812 = (state_11811[(1)]); if((state_val_11812 === (7))){ var inst_11793 = (state_11811[(7)]); var inst_11793__$1 = (state_11811[(2)]); var inst_11794 = (inst_11793__$1 == null); var inst_11795 = cljs.core.not.call(null,inst_11794); var state_11811__$1 = (function (){var statearr_11813 = state_11811; (statearr_11813[(7)] = inst_11793__$1); return statearr_11813; })(); if(inst_11795){ var statearr_11814_11835 = state_11811__$1; (statearr_11814_11835[(1)] = (8)); } else { var statearr_11815_11836 = state_11811__$1; (statearr_11815_11836[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (1))){ var inst_11788 = (0); var state_11811__$1 = (function (){var statearr_11816 = state_11811; (statearr_11816[(8)] = inst_11788); return statearr_11816; })(); var statearr_11817_11837 = state_11811__$1; (statearr_11817_11837[(2)] = null); (statearr_11817_11837[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (4))){ var state_11811__$1 = state_11811; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_11811__$1,(7),ch); } else { if((state_val_11812 === (6))){ var inst_11806 = (state_11811[(2)]); var state_11811__$1 = state_11811; var statearr_11818_11838 = state_11811__$1; (statearr_11818_11838[(2)] = inst_11806); (statearr_11818_11838[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (3))){ var inst_11808 = (state_11811[(2)]); var inst_11809 = cljs.core.async.close_BANG_.call(null,out); var state_11811__$1 = (function (){var statearr_11819 = state_11811; (statearr_11819[(9)] = inst_11808); return statearr_11819; })(); return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_11811__$1,inst_11809); } else { if((state_val_11812 === (2))){ var inst_11788 = (state_11811[(8)]); var inst_11790 = (inst_11788 < n); var state_11811__$1 = state_11811; if(cljs.core.truth_(inst_11790)){ var statearr_11820_11839 = state_11811__$1; (statearr_11820_11839[(1)] = (4)); } else { var statearr_11821_11840 = state_11811__$1; (statearr_11821_11840[(1)] = (5)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (11))){ var inst_11788 = (state_11811[(8)]); var inst_11798 = (state_11811[(2)]); var inst_11799 = (inst_11788 + (1)); var inst_11788__$1 = inst_11799; var state_11811__$1 = (function (){var statearr_11822 = state_11811; (statearr_11822[(8)] = inst_11788__$1); (statearr_11822[(10)] = inst_11798); return statearr_11822; })(); var statearr_11823_11841 = state_11811__$1; (statearr_11823_11841[(2)] = null); (statearr_11823_11841[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (9))){ var state_11811__$1 = state_11811; var statearr_11824_11842 = state_11811__$1; (statearr_11824_11842[(2)] = null); (statearr_11824_11842[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (5))){ var state_11811__$1 = state_11811; var statearr_11825_11843 = state_11811__$1; (statearr_11825_11843[(2)] = null); (statearr_11825_11843[(1)] = (6)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (10))){ var inst_11803 = (state_11811[(2)]); var state_11811__$1 = state_11811; var statearr_11826_11844 = state_11811__$1; (statearr_11826_11844[(2)] = inst_11803); (statearr_11826_11844[(1)] = (6)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11812 === (8))){ var inst_11793 = (state_11811[(7)]); var state_11811__$1 = state_11811; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_11811__$1,(11),out,inst_11793); } else { return null; } } } } } } } } } } } });})(c__6769__auto___11834,out)) ; return ((function (switch__6713__auto__,c__6769__auto___11834,out){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_11830 = [null,null,null,null,null,null,null,null,null,null,null]; (statearr_11830[(0)] = state_machine__6714__auto__); (statearr_11830[(1)] = (1)); return statearr_11830; }); var state_machine__6714__auto____1 = (function (state_11811){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_11811); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e11831){if((e11831 instanceof Object)){ var ex__6717__auto__ = e11831; var statearr_11832_11845 = state_11811; (statearr_11832_11845[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11811); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e11831; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__11846 = state_11811; state_11811 = G__11846; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_11811){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_11811); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___11834,out)) })(); var state__6771__auto__ = (function (){var statearr_11833 = f__6770__auto__.call(null); (statearr_11833[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___11834); return statearr_11833; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___11834,out)) ); return out; }); take = function(n,ch,buf_or_n){ switch(arguments.length){ case 2: return take__2.call(this,n,ch); case 3: return take__3.call(this,n,ch,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; take.cljs$core$IFn$_invoke$arity$2 = take__2; take.cljs$core$IFn$_invoke$arity$3 = take__3; return take; })() ; /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.map_LT_ = (function map_LT_(f,ch){ if(typeof cljs.core.async.t11854 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t11854 = (function (ch,f,map_LT_,meta11855){ this.ch = ch; this.f = f; this.map_LT_ = map_LT_; this.meta11855 = meta11855; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t11854.prototype.cljs$core$async$impl$protocols$WritePort$ = true; cljs.core.async.t11854.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1); }); cljs.core.async.t11854.prototype.cljs$core$async$impl$protocols$ReadPort$ = true; cljs.core.async.t11854.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){ var self__ = this; var ___$1 = this; var ret = cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,(function (){ if(typeof cljs.core.async.t11857 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t11857 = (function (fn1,_,meta11855,map_LT_,f,ch,meta11858){ this.fn1 = fn1; this._ = _; this.meta11855 = meta11855; this.map_LT_ = map_LT_; this.f = f; this.ch = ch; this.meta11858 = meta11858; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t11857.prototype.cljs$core$async$impl$protocols$Handler$ = true; cljs.core.async.t11857.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = ((function (___$1){ return (function (___$1){ var self__ = this; var ___$2 = this; return cljs.core.async.impl.protocols.active_QMARK_.call(null,self__.fn1); });})(___$1)) ; cljs.core.async.t11857.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = ((function (___$1){ return (function (___$1){ var self__ = this; var ___$2 = this; var f1 = cljs.core.async.impl.protocols.commit.call(null,self__.fn1); return ((function (f1,___$2,___$1){ return (function (p1__11847_SHARP_){ return f1.call(null,(((p1__11847_SHARP_ == null))?null:self__.f.call(null,p1__11847_SHARP_))); }); ;})(f1,___$2,___$1)) });})(___$1)) ; cljs.core.async.t11857.prototype.cljs$core$IMeta$_meta$arity$1 = ((function (___$1){ return (function (_11859){ var self__ = this; var _11859__$1 = this; return self__.meta11858; });})(___$1)) ; cljs.core.async.t11857.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = ((function (___$1){ return (function (_11859,meta11858__$1){ var self__ = this; var _11859__$1 = this; return (new cljs.core.async.t11857(self__.fn1,self__._,self__.meta11855,self__.map_LT_,self__.f,self__.ch,meta11858__$1)); });})(___$1)) ; cljs.core.async.t11857.cljs$lang$type = true; cljs.core.async.t11857.cljs$lang$ctorStr = "cljs.core.async/t11857"; cljs.core.async.t11857.cljs$lang$ctorPrWriter = ((function (___$1){ return (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t11857"); });})(___$1)) ; cljs.core.async.__GT_t11857 = ((function (___$1){ return (function __GT_t11857(fn1__$1,___$2,meta11855__$1,map_LT___$1,f__$1,ch__$1,meta11858){ return (new cljs.core.async.t11857(fn1__$1,___$2,meta11855__$1,map_LT___$1,f__$1,ch__$1,meta11858)); });})(___$1)) ; } return (new cljs.core.async.t11857(fn1,___$1,self__.meta11855,self__.map_LT_,self__.f,self__.ch,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),46,new cljs.core.Keyword(null,"end-line","end-line",1837326455),737,new cljs.core.Keyword(null,"column","column",2078222095),10,new cljs.core.Keyword(null,"line","line",212345235),731,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); })() ); if(cljs.core.truth_((function (){var and__3727__auto__ = ret; if(cljs.core.truth_(and__3727__auto__)){ return !((cljs.core.deref.call(null,ret) == null)); } else { return and__3727__auto__; } })())){ return cljs.core.async.impl.channels.box.call(null,self__.f.call(null,cljs.core.deref.call(null,ret))); } else { return ret; } }); cljs.core.async.t11854.prototype.cljs$core$async$impl$protocols$Channel$ = true; cljs.core.async.t11854.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch); }); cljs.core.async.t11854.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch); }); cljs.core.async.t11854.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_11856){ var self__ = this; var _11856__$1 = this; return self__.meta11855; }); cljs.core.async.t11854.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_11856,meta11855__$1){ var self__ = this; var _11856__$1 = this; return (new cljs.core.async.t11854(self__.ch,self__.f,self__.map_LT_,meta11855__$1)); }); cljs.core.async.t11854.cljs$lang$type = true; cljs.core.async.t11854.cljs$lang$ctorStr = "cljs.core.async/t11854"; cljs.core.async.t11854.cljs$lang$ctorPrWriter = (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t11854"); }); cljs.core.async.__GT_t11854 = (function __GT_t11854(ch__$1,f__$1,map_LT___$1,meta11855){ return (new cljs.core.async.t11854(ch__$1,f__$1,map_LT___$1,meta11855)); }); } return (new cljs.core.async.t11854(ch,f,map_LT_,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),46,new cljs.core.Keyword(null,"end-line","end-line",1837326455),743,new cljs.core.Keyword(null,"column","column",2078222095),3,new cljs.core.Keyword(null,"line","line",212345235),722,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); }); /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.map_GT_ = (function map_GT_(f,ch){ if(typeof cljs.core.async.t11863 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t11863 = (function (ch,f,map_GT_,meta11864){ this.ch = ch; this.f = f; this.map_GT_ = map_GT_; this.meta11864 = meta11864; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t11863.prototype.cljs$core$async$impl$protocols$WritePort$ = true; cljs.core.async.t11863.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,self__.f.call(null,val),fn1); }); cljs.core.async.t11863.prototype.cljs$core$async$impl$protocols$ReadPort$ = true; cljs.core.async.t11863.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1); }); cljs.core.async.t11863.prototype.cljs$core$async$impl$protocols$Channel$ = true; cljs.core.async.t11863.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch); }); cljs.core.async.t11863.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_11865){ var self__ = this; var _11865__$1 = this; return self__.meta11864; }); cljs.core.async.t11863.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_11865,meta11864__$1){ var self__ = this; var _11865__$1 = this; return (new cljs.core.async.t11863(self__.ch,self__.f,self__.map_GT_,meta11864__$1)); }); cljs.core.async.t11863.cljs$lang$type = true; cljs.core.async.t11863.cljs$lang$ctorStr = "cljs.core.async/t11863"; cljs.core.async.t11863.cljs$lang$ctorPrWriter = (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t11863"); }); cljs.core.async.__GT_t11863 = (function __GT_t11863(ch__$1,f__$1,map_GT___$1,meta11864){ return (new cljs.core.async.t11863(ch__$1,f__$1,map_GT___$1,meta11864)); }); } return (new cljs.core.async.t11863(ch,f,map_GT_,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),34,new cljs.core.Keyword(null,"end-line","end-line",1837326455),757,new cljs.core.Keyword(null,"column","column",2078222095),3,new cljs.core.Keyword(null,"line","line",212345235),748,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); }); /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.filter_GT_ = (function filter_GT_(p,ch){ if(typeof cljs.core.async.t11869 !== 'undefined'){ } else { /** * @constructor */ cljs.core.async.t11869 = (function (ch,p,filter_GT_,meta11870){ this.ch = ch; this.p = p; this.filter_GT_ = filter_GT_; this.meta11870 = meta11870; this.cljs$lang$protocol_mask$partition1$ = 0; this.cljs$lang$protocol_mask$partition0$ = 393216; }) cljs.core.async.t11869.prototype.cljs$core$async$impl$protocols$WritePort$ = true; cljs.core.async.t11869.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (_,val,fn1){ var self__ = this; var ___$1 = this; if(cljs.core.truth_(self__.p.call(null,val))){ return cljs.core.async.impl.protocols.put_BANG_.call(null,self__.ch,val,fn1); } else { return cljs.core.async.impl.channels.box.call(null,cljs.core.not.call(null,cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch))); } }); cljs.core.async.t11869.prototype.cljs$core$async$impl$protocols$ReadPort$ = true; cljs.core.async.t11869.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (_,fn1){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.take_BANG_.call(null,self__.ch,fn1); }); cljs.core.async.t11869.prototype.cljs$core$async$impl$protocols$Channel$ = true; cljs.core.async.t11869.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.close_BANG_.call(null,self__.ch); }); cljs.core.async.t11869.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){ var self__ = this; var ___$1 = this; return cljs.core.async.impl.protocols.closed_QMARK_.call(null,self__.ch); }); cljs.core.async.t11869.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_11871){ var self__ = this; var _11871__$1 = this; return self__.meta11870; }); cljs.core.async.t11869.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_11871,meta11870__$1){ var self__ = this; var _11871__$1 = this; return (new cljs.core.async.t11869(self__.ch,self__.p,self__.filter_GT_,meta11870__$1)); }); cljs.core.async.t11869.cljs$lang$type = true; cljs.core.async.t11869.cljs$lang$ctorStr = "cljs.core.async/t11869"; cljs.core.async.t11869.cljs$lang$ctorPrWriter = (function (this__4326__auto__,writer__4327__auto__,opt__4328__auto__){ return cljs.core._write.call(null,writer__4327__auto__,"cljs.core.async/t11869"); }); cljs.core.async.__GT_t11869 = (function __GT_t11869(ch__$1,p__$1,filter_GT___$1,meta11870){ return (new cljs.core.async.t11869(ch__$1,p__$1,filter_GT___$1,meta11870)); }); } return (new cljs.core.async.t11869(ch,p,filter_GT_,new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"end-column","end-column",1425389514),48,new cljs.core.Keyword(null,"end-line","end-line",1837326455),774,new cljs.core.Keyword(null,"column","column",2078222095),3,new cljs.core.Keyword(null,"line","line",212345235),762,new cljs.core.Keyword(null,"file","file",-1269645878),"/home/jwaag/dev/clj/bingo/out/cljs/core/async.cljs"], null))); }); /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.remove_GT_ = (function remove_GT_(p,ch){ return cljs.core.async.filter_GT_.call(null,cljs.core.complement.call(null,p),ch); }); /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.filter_LT_ = (function() { var filter_LT_ = null; var filter_LT___2 = (function (p,ch){ return filter_LT_.call(null,p,ch,null); }); var filter_LT___3 = (function (p,ch,buf_or_n){ var out = cljs.core.async.chan.call(null,buf_or_n); var c__6769__auto___11954 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___11954,out){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___11954,out){ return (function (state_11933){ var state_val_11934 = (state_11933[(1)]); if((state_val_11934 === (7))){ var inst_11929 = (state_11933[(2)]); var state_11933__$1 = state_11933; var statearr_11935_11955 = state_11933__$1; (statearr_11935_11955[(2)] = inst_11929); (statearr_11935_11955[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (1))){ var state_11933__$1 = state_11933; var statearr_11936_11956 = state_11933__$1; (statearr_11936_11956[(2)] = null); (statearr_11936_11956[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (4))){ var inst_11915 = (state_11933[(7)]); var inst_11915__$1 = (state_11933[(2)]); var inst_11916 = (inst_11915__$1 == null); var state_11933__$1 = (function (){var statearr_11937 = state_11933; (statearr_11937[(7)] = inst_11915__$1); return statearr_11937; })(); if(cljs.core.truth_(inst_11916)){ var statearr_11938_11957 = state_11933__$1; (statearr_11938_11957[(1)] = (5)); } else { var statearr_11939_11958 = state_11933__$1; (statearr_11939_11958[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (6))){ var inst_11915 = (state_11933[(7)]); var inst_11920 = p.call(null,inst_11915); var state_11933__$1 = state_11933; if(cljs.core.truth_(inst_11920)){ var statearr_11940_11959 = state_11933__$1; (statearr_11940_11959[(1)] = (8)); } else { var statearr_11941_11960 = state_11933__$1; (statearr_11941_11960[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (3))){ var inst_11931 = (state_11933[(2)]); var state_11933__$1 = state_11933; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_11933__$1,inst_11931); } else { if((state_val_11934 === (2))){ var state_11933__$1 = state_11933; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_11933__$1,(4),ch); } else { if((state_val_11934 === (11))){ var inst_11923 = (state_11933[(2)]); var state_11933__$1 = state_11933; var statearr_11942_11961 = state_11933__$1; (statearr_11942_11961[(2)] = inst_11923); (statearr_11942_11961[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (9))){ var state_11933__$1 = state_11933; var statearr_11943_11962 = state_11933__$1; (statearr_11943_11962[(2)] = null); (statearr_11943_11962[(1)] = (10)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (5))){ var inst_11918 = cljs.core.async.close_BANG_.call(null,out); var state_11933__$1 = state_11933; var statearr_11944_11963 = state_11933__$1; (statearr_11944_11963[(2)] = inst_11918); (statearr_11944_11963[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (10))){ var inst_11926 = (state_11933[(2)]); var state_11933__$1 = (function (){var statearr_11945 = state_11933; (statearr_11945[(8)] = inst_11926); return statearr_11945; })(); var statearr_11946_11964 = state_11933__$1; (statearr_11946_11964[(2)] = null); (statearr_11946_11964[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_11934 === (8))){ var inst_11915 = (state_11933[(7)]); var state_11933__$1 = state_11933; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_11933__$1,(11),out,inst_11915); } else { return null; } } } } } } } } } } } });})(c__6769__auto___11954,out)) ; return ((function (switch__6713__auto__,c__6769__auto___11954,out){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_11950 = [null,null,null,null,null,null,null,null,null]; (statearr_11950[(0)] = state_machine__6714__auto__); (statearr_11950[(1)] = (1)); return statearr_11950; }); var state_machine__6714__auto____1 = (function (state_11933){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_11933); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e11951){if((e11951 instanceof Object)){ var ex__6717__auto__ = e11951; var statearr_11952_11965 = state_11933; (statearr_11952_11965[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_11933); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e11951; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__11966 = state_11933; state_11933 = G__11966; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_11933){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_11933); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___11954,out)) })(); var state__6771__auto__ = (function (){var statearr_11953 = f__6770__auto__.call(null); (statearr_11953[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___11954); return statearr_11953; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___11954,out)) ); return out; }); filter_LT_ = function(p,ch,buf_or_n){ switch(arguments.length){ case 2: return filter_LT___2.call(this,p,ch); case 3: return filter_LT___3.call(this,p,ch,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; filter_LT_.cljs$core$IFn$_invoke$arity$2 = filter_LT___2; filter_LT_.cljs$core$IFn$_invoke$arity$3 = filter_LT___3; return filter_LT_; })() ; /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.remove_LT_ = (function() { var remove_LT_ = null; var remove_LT___2 = (function (p,ch){ return remove_LT_.call(null,p,ch,null); }); var remove_LT___3 = (function (p,ch,buf_or_n){ return cljs.core.async.filter_LT_.call(null,cljs.core.complement.call(null,p),ch,buf_or_n); }); remove_LT_ = function(p,ch,buf_or_n){ switch(arguments.length){ case 2: return remove_LT___2.call(this,p,ch); case 3: return remove_LT___3.call(this,p,ch,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; remove_LT_.cljs$core$IFn$_invoke$arity$2 = remove_LT___2; remove_LT_.cljs$core$IFn$_invoke$arity$3 = remove_LT___3; return remove_LT_; })() ; cljs.core.async.mapcat_STAR_ = (function mapcat_STAR_(f,in$,out){ var c__6769__auto__ = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto__){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto__){ return (function (state_12132){ var state_val_12133 = (state_12132[(1)]); if((state_val_12133 === (7))){ var inst_12128 = (state_12132[(2)]); var state_12132__$1 = state_12132; var statearr_12134_12175 = state_12132__$1; (statearr_12134_12175[(2)] = inst_12128); (statearr_12134_12175[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (20))){ var inst_12098 = (state_12132[(7)]); var inst_12109 = (state_12132[(2)]); var inst_12110 = cljs.core.next.call(null,inst_12098); var inst_12084 = inst_12110; var inst_12085 = null; var inst_12086 = (0); var inst_12087 = (0); var state_12132__$1 = (function (){var statearr_12135 = state_12132; (statearr_12135[(8)] = inst_12087); (statearr_12135[(9)] = inst_12084); (statearr_12135[(10)] = inst_12109); (statearr_12135[(11)] = inst_12086); (statearr_12135[(12)] = inst_12085); return statearr_12135; })(); var statearr_12136_12176 = state_12132__$1; (statearr_12136_12176[(2)] = null); (statearr_12136_12176[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (1))){ var state_12132__$1 = state_12132; var statearr_12137_12177 = state_12132__$1; (statearr_12137_12177[(2)] = null); (statearr_12137_12177[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (4))){ var inst_12073 = (state_12132[(13)]); var inst_12073__$1 = (state_12132[(2)]); var inst_12074 = (inst_12073__$1 == null); var state_12132__$1 = (function (){var statearr_12138 = state_12132; (statearr_12138[(13)] = inst_12073__$1); return statearr_12138; })(); if(cljs.core.truth_(inst_12074)){ var statearr_12139_12178 = state_12132__$1; (statearr_12139_12178[(1)] = (5)); } else { var statearr_12140_12179 = state_12132__$1; (statearr_12140_12179[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (15))){ var state_12132__$1 = state_12132; var statearr_12144_12180 = state_12132__$1; (statearr_12144_12180[(2)] = null); (statearr_12144_12180[(1)] = (16)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (21))){ var state_12132__$1 = state_12132; var statearr_12145_12181 = state_12132__$1; (statearr_12145_12181[(2)] = null); (statearr_12145_12181[(1)] = (23)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (13))){ var inst_12087 = (state_12132[(8)]); var inst_12084 = (state_12132[(9)]); var inst_12086 = (state_12132[(11)]); var inst_12085 = (state_12132[(12)]); var inst_12094 = (state_12132[(2)]); var inst_12095 = (inst_12087 + (1)); var tmp12141 = inst_12084; var tmp12142 = inst_12086; var tmp12143 = inst_12085; var inst_12084__$1 = tmp12141; var inst_12085__$1 = tmp12143; var inst_12086__$1 = tmp12142; var inst_12087__$1 = inst_12095; var state_12132__$1 = (function (){var statearr_12146 = state_12132; (statearr_12146[(8)] = inst_12087__$1); (statearr_12146[(9)] = inst_12084__$1); (statearr_12146[(11)] = inst_12086__$1); (statearr_12146[(14)] = inst_12094); (statearr_12146[(12)] = inst_12085__$1); return statearr_12146; })(); var statearr_12147_12182 = state_12132__$1; (statearr_12147_12182[(2)] = null); (statearr_12147_12182[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (22))){ var state_12132__$1 = state_12132; var statearr_12148_12183 = state_12132__$1; (statearr_12148_12183[(2)] = null); (statearr_12148_12183[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (6))){ var inst_12073 = (state_12132[(13)]); var inst_12082 = f.call(null,inst_12073); var inst_12083 = cljs.core.seq.call(null,inst_12082); var inst_12084 = inst_12083; var inst_12085 = null; var inst_12086 = (0); var inst_12087 = (0); var state_12132__$1 = (function (){var statearr_12149 = state_12132; (statearr_12149[(8)] = inst_12087); (statearr_12149[(9)] = inst_12084); (statearr_12149[(11)] = inst_12086); (statearr_12149[(12)] = inst_12085); return statearr_12149; })(); var statearr_12150_12184 = state_12132__$1; (statearr_12150_12184[(2)] = null); (statearr_12150_12184[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (17))){ var inst_12098 = (state_12132[(7)]); var inst_12102 = cljs.core.chunk_first.call(null,inst_12098); var inst_12103 = cljs.core.chunk_rest.call(null,inst_12098); var inst_12104 = cljs.core.count.call(null,inst_12102); var inst_12084 = inst_12103; var inst_12085 = inst_12102; var inst_12086 = inst_12104; var inst_12087 = (0); var state_12132__$1 = (function (){var statearr_12151 = state_12132; (statearr_12151[(8)] = inst_12087); (statearr_12151[(9)] = inst_12084); (statearr_12151[(11)] = inst_12086); (statearr_12151[(12)] = inst_12085); return statearr_12151; })(); var statearr_12152_12185 = state_12132__$1; (statearr_12152_12185[(2)] = null); (statearr_12152_12185[(1)] = (8)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (3))){ var inst_12130 = (state_12132[(2)]); var state_12132__$1 = state_12132; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_12132__$1,inst_12130); } else { if((state_val_12133 === (12))){ var inst_12118 = (state_12132[(2)]); var state_12132__$1 = state_12132; var statearr_12153_12186 = state_12132__$1; (statearr_12153_12186[(2)] = inst_12118); (statearr_12153_12186[(1)] = (9)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (2))){ var state_12132__$1 = state_12132; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_12132__$1,(4),in$); } else { if((state_val_12133 === (23))){ var inst_12126 = (state_12132[(2)]); var state_12132__$1 = state_12132; var statearr_12154_12187 = state_12132__$1; (statearr_12154_12187[(2)] = inst_12126); (statearr_12154_12187[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (19))){ var inst_12113 = (state_12132[(2)]); var state_12132__$1 = state_12132; var statearr_12155_12188 = state_12132__$1; (statearr_12155_12188[(2)] = inst_12113); (statearr_12155_12188[(1)] = (16)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (11))){ var inst_12098 = (state_12132[(7)]); var inst_12084 = (state_12132[(9)]); var inst_12098__$1 = cljs.core.seq.call(null,inst_12084); var state_12132__$1 = (function (){var statearr_12156 = state_12132; (statearr_12156[(7)] = inst_12098__$1); return statearr_12156; })(); if(inst_12098__$1){ var statearr_12157_12189 = state_12132__$1; (statearr_12157_12189[(1)] = (14)); } else { var statearr_12158_12190 = state_12132__$1; (statearr_12158_12190[(1)] = (15)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (9))){ var inst_12120 = (state_12132[(2)]); var inst_12121 = cljs.core.async.impl.protocols.closed_QMARK_.call(null,out); var state_12132__$1 = (function (){var statearr_12159 = state_12132; (statearr_12159[(15)] = inst_12120); return statearr_12159; })(); if(cljs.core.truth_(inst_12121)){ var statearr_12160_12191 = state_12132__$1; (statearr_12160_12191[(1)] = (21)); } else { var statearr_12161_12192 = state_12132__$1; (statearr_12161_12192[(1)] = (22)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (5))){ var inst_12076 = cljs.core.async.close_BANG_.call(null,out); var state_12132__$1 = state_12132; var statearr_12162_12193 = state_12132__$1; (statearr_12162_12193[(2)] = inst_12076); (statearr_12162_12193[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (14))){ var inst_12098 = (state_12132[(7)]); var inst_12100 = cljs.core.chunked_seq_QMARK_.call(null,inst_12098); var state_12132__$1 = state_12132; if(inst_12100){ var statearr_12163_12194 = state_12132__$1; (statearr_12163_12194[(1)] = (17)); } else { var statearr_12164_12195 = state_12132__$1; (statearr_12164_12195[(1)] = (18)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (16))){ var inst_12116 = (state_12132[(2)]); var state_12132__$1 = state_12132; var statearr_12165_12196 = state_12132__$1; (statearr_12165_12196[(2)] = inst_12116); (statearr_12165_12196[(1)] = (12)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12133 === (10))){ var inst_12087 = (state_12132[(8)]); var inst_12085 = (state_12132[(12)]); var inst_12092 = cljs.core._nth.call(null,inst_12085,inst_12087); var state_12132__$1 = state_12132; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_12132__$1,(13),out,inst_12092); } else { if((state_val_12133 === (18))){ var inst_12098 = (state_12132[(7)]); var inst_12107 = cljs.core.first.call(null,inst_12098); var state_12132__$1 = state_12132; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_12132__$1,(20),out,inst_12107); } else { if((state_val_12133 === (8))){ var inst_12087 = (state_12132[(8)]); var inst_12086 = (state_12132[(11)]); var inst_12089 = (inst_12087 < inst_12086); var inst_12090 = inst_12089; var state_12132__$1 = state_12132; if(cljs.core.truth_(inst_12090)){ var statearr_12166_12197 = state_12132__$1; (statearr_12166_12197[(1)] = (10)); } else { var statearr_12167_12198 = state_12132__$1; (statearr_12167_12198[(1)] = (11)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } } } } } } } } } });})(c__6769__auto__)) ; return ((function (switch__6713__auto__,c__6769__auto__){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_12171 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_12171[(0)] = state_machine__6714__auto__); (statearr_12171[(1)] = (1)); return statearr_12171; }); var state_machine__6714__auto____1 = (function (state_12132){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_12132); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e12172){if((e12172 instanceof Object)){ var ex__6717__auto__ = e12172; var statearr_12173_12199 = state_12132; (statearr_12173_12199[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_12132); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e12172; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__12200 = state_12132; state_12132 = G__12200; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_12132){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_12132); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto__)) })(); var state__6771__auto__ = (function (){var statearr_12174 = f__6770__auto__.call(null); (statearr_12174[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto__); return statearr_12174; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto__)) ); return c__6769__auto__; }); /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.mapcat_LT_ = (function() { var mapcat_LT_ = null; var mapcat_LT___2 = (function (f,in$){ return mapcat_LT_.call(null,f,in$,null); }); var mapcat_LT___3 = (function (f,in$,buf_or_n){ var out = cljs.core.async.chan.call(null,buf_or_n); cljs.core.async.mapcat_STAR_.call(null,f,in$,out); return out; }); mapcat_LT_ = function(f,in$,buf_or_n){ switch(arguments.length){ case 2: return mapcat_LT___2.call(this,f,in$); case 3: return mapcat_LT___3.call(this,f,in$,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; mapcat_LT_.cljs$core$IFn$_invoke$arity$2 = mapcat_LT___2; mapcat_LT_.cljs$core$IFn$_invoke$arity$3 = mapcat_LT___3; return mapcat_LT_; })() ; /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.mapcat_GT_ = (function() { var mapcat_GT_ = null; var mapcat_GT___2 = (function (f,out){ return mapcat_GT_.call(null,f,out,null); }); var mapcat_GT___3 = (function (f,out,buf_or_n){ var in$ = cljs.core.async.chan.call(null,buf_or_n); cljs.core.async.mapcat_STAR_.call(null,f,in$,out); return in$; }); mapcat_GT_ = function(f,out,buf_or_n){ switch(arguments.length){ case 2: return mapcat_GT___2.call(this,f,out); case 3: return mapcat_GT___3.call(this,f,out,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; mapcat_GT_.cljs$core$IFn$_invoke$arity$2 = mapcat_GT___2; mapcat_GT_.cljs$core$IFn$_invoke$arity$3 = mapcat_GT___3; return mapcat_GT_; })() ; /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.unique = (function() { var unique = null; var unique__1 = (function (ch){ return unique.call(null,ch,null); }); var unique__2 = (function (ch,buf_or_n){ var out = cljs.core.async.chan.call(null,buf_or_n); var c__6769__auto___12297 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___12297,out){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___12297,out){ return (function (state_12272){ var state_val_12273 = (state_12272[(1)]); if((state_val_12273 === (7))){ var inst_12267 = (state_12272[(2)]); var state_12272__$1 = state_12272; var statearr_12274_12298 = state_12272__$1; (statearr_12274_12298[(2)] = inst_12267); (statearr_12274_12298[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12273 === (1))){ var inst_12249 = null; var state_12272__$1 = (function (){var statearr_12275 = state_12272; (statearr_12275[(7)] = inst_12249); return statearr_12275; })(); var statearr_12276_12299 = state_12272__$1; (statearr_12276_12299[(2)] = null); (statearr_12276_12299[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12273 === (4))){ var inst_12252 = (state_12272[(8)]); var inst_12252__$1 = (state_12272[(2)]); var inst_12253 = (inst_12252__$1 == null); var inst_12254 = cljs.core.not.call(null,inst_12253); var state_12272__$1 = (function (){var statearr_12277 = state_12272; (statearr_12277[(8)] = inst_12252__$1); return statearr_12277; })(); if(inst_12254){ var statearr_12278_12300 = state_12272__$1; (statearr_12278_12300[(1)] = (5)); } else { var statearr_12279_12301 = state_12272__$1; (statearr_12279_12301[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12273 === (6))){ var state_12272__$1 = state_12272; var statearr_12280_12302 = state_12272__$1; (statearr_12280_12302[(2)] = null); (statearr_12280_12302[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12273 === (3))){ var inst_12269 = (state_12272[(2)]); var inst_12270 = cljs.core.async.close_BANG_.call(null,out); var state_12272__$1 = (function (){var statearr_12281 = state_12272; (statearr_12281[(9)] = inst_12269); return statearr_12281; })(); return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_12272__$1,inst_12270); } else { if((state_val_12273 === (2))){ var state_12272__$1 = state_12272; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_12272__$1,(4),ch); } else { if((state_val_12273 === (11))){ var inst_12252 = (state_12272[(8)]); var inst_12261 = (state_12272[(2)]); var inst_12249 = inst_12252; var state_12272__$1 = (function (){var statearr_12282 = state_12272; (statearr_12282[(10)] = inst_12261); (statearr_12282[(7)] = inst_12249); return statearr_12282; })(); var statearr_12283_12303 = state_12272__$1; (statearr_12283_12303[(2)] = null); (statearr_12283_12303[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12273 === (9))){ var inst_12252 = (state_12272[(8)]); var state_12272__$1 = state_12272; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_12272__$1,(11),out,inst_12252); } else { if((state_val_12273 === (5))){ var inst_12249 = (state_12272[(7)]); var inst_12252 = (state_12272[(8)]); var inst_12256 = cljs.core._EQ_.call(null,inst_12252,inst_12249); var state_12272__$1 = state_12272; if(inst_12256){ var statearr_12285_12304 = state_12272__$1; (statearr_12285_12304[(1)] = (8)); } else { var statearr_12286_12305 = state_12272__$1; (statearr_12286_12305[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12273 === (10))){ var inst_12264 = (state_12272[(2)]); var state_12272__$1 = state_12272; var statearr_12287_12306 = state_12272__$1; (statearr_12287_12306[(2)] = inst_12264); (statearr_12287_12306[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12273 === (8))){ var inst_12249 = (state_12272[(7)]); var tmp12284 = inst_12249; var inst_12249__$1 = tmp12284; var state_12272__$1 = (function (){var statearr_12288 = state_12272; (statearr_12288[(7)] = inst_12249__$1); return statearr_12288; })(); var statearr_12289_12307 = state_12272__$1; (statearr_12289_12307[(2)] = null); (statearr_12289_12307[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } });})(c__6769__auto___12297,out)) ; return ((function (switch__6713__auto__,c__6769__auto___12297,out){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_12293 = [null,null,null,null,null,null,null,null,null,null,null]; (statearr_12293[(0)] = state_machine__6714__auto__); (statearr_12293[(1)] = (1)); return statearr_12293; }); var state_machine__6714__auto____1 = (function (state_12272){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_12272); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e12294){if((e12294 instanceof Object)){ var ex__6717__auto__ = e12294; var statearr_12295_12308 = state_12272; (statearr_12295_12308[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_12272); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e12294; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__12309 = state_12272; state_12272 = G__12309; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_12272){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_12272); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___12297,out)) })(); var state__6771__auto__ = (function (){var statearr_12296 = f__6770__auto__.call(null); (statearr_12296[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___12297); return statearr_12296; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___12297,out)) ); return out; }); unique = function(ch,buf_or_n){ switch(arguments.length){ case 1: return unique__1.call(this,ch); case 2: return unique__2.call(this,ch,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; unique.cljs$core$IFn$_invoke$arity$1 = unique__1; unique.cljs$core$IFn$_invoke$arity$2 = unique__2; return unique; })() ; /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.partition = (function() { var partition = null; var partition__2 = (function (n,ch){ return partition.call(null,n,ch,null); }); var partition__3 = (function (n,ch,buf_or_n){ var out = cljs.core.async.chan.call(null,buf_or_n); var c__6769__auto___12444 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___12444,out){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___12444,out){ return (function (state_12414){ var state_val_12415 = (state_12414[(1)]); if((state_val_12415 === (7))){ var inst_12410 = (state_12414[(2)]); var state_12414__$1 = state_12414; var statearr_12416_12445 = state_12414__$1; (statearr_12416_12445[(2)] = inst_12410); (statearr_12416_12445[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (1))){ var inst_12377 = (new Array(n)); var inst_12378 = inst_12377; var inst_12379 = (0); var state_12414__$1 = (function (){var statearr_12417 = state_12414; (statearr_12417[(7)] = inst_12379); (statearr_12417[(8)] = inst_12378); return statearr_12417; })(); var statearr_12418_12446 = state_12414__$1; (statearr_12418_12446[(2)] = null); (statearr_12418_12446[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (4))){ var inst_12382 = (state_12414[(9)]); var inst_12382__$1 = (state_12414[(2)]); var inst_12383 = (inst_12382__$1 == null); var inst_12384 = cljs.core.not.call(null,inst_12383); var state_12414__$1 = (function (){var statearr_12419 = state_12414; (statearr_12419[(9)] = inst_12382__$1); return statearr_12419; })(); if(inst_12384){ var statearr_12420_12447 = state_12414__$1; (statearr_12420_12447[(1)] = (5)); } else { var statearr_12421_12448 = state_12414__$1; (statearr_12421_12448[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (15))){ var inst_12404 = (state_12414[(2)]); var state_12414__$1 = state_12414; var statearr_12422_12449 = state_12414__$1; (statearr_12422_12449[(2)] = inst_12404); (statearr_12422_12449[(1)] = (14)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (13))){ var state_12414__$1 = state_12414; var statearr_12423_12450 = state_12414__$1; (statearr_12423_12450[(2)] = null); (statearr_12423_12450[(1)] = (14)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (6))){ var inst_12379 = (state_12414[(7)]); var inst_12400 = (inst_12379 > (0)); var state_12414__$1 = state_12414; if(cljs.core.truth_(inst_12400)){ var statearr_12424_12451 = state_12414__$1; (statearr_12424_12451[(1)] = (12)); } else { var statearr_12425_12452 = state_12414__$1; (statearr_12425_12452[(1)] = (13)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (3))){ var inst_12412 = (state_12414[(2)]); var state_12414__$1 = state_12414; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_12414__$1,inst_12412); } else { if((state_val_12415 === (12))){ var inst_12378 = (state_12414[(8)]); var inst_12402 = cljs.core.vec.call(null,inst_12378); var state_12414__$1 = state_12414; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_12414__$1,(15),out,inst_12402); } else { if((state_val_12415 === (2))){ var state_12414__$1 = state_12414; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_12414__$1,(4),ch); } else { if((state_val_12415 === (11))){ var inst_12394 = (state_12414[(2)]); var inst_12395 = (new Array(n)); var inst_12378 = inst_12395; var inst_12379 = (0); var state_12414__$1 = (function (){var statearr_12426 = state_12414; (statearr_12426[(7)] = inst_12379); (statearr_12426[(10)] = inst_12394); (statearr_12426[(8)] = inst_12378); return statearr_12426; })(); var statearr_12427_12453 = state_12414__$1; (statearr_12427_12453[(2)] = null); (statearr_12427_12453[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (9))){ var inst_12378 = (state_12414[(8)]); var inst_12392 = cljs.core.vec.call(null,inst_12378); var state_12414__$1 = state_12414; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_12414__$1,(11),out,inst_12392); } else { if((state_val_12415 === (5))){ var inst_12379 = (state_12414[(7)]); var inst_12382 = (state_12414[(9)]); var inst_12387 = (state_12414[(11)]); var inst_12378 = (state_12414[(8)]); var inst_12386 = (inst_12378[inst_12379] = inst_12382); var inst_12387__$1 = (inst_12379 + (1)); var inst_12388 = (inst_12387__$1 < n); var state_12414__$1 = (function (){var statearr_12428 = state_12414; (statearr_12428[(12)] = inst_12386); (statearr_12428[(11)] = inst_12387__$1); return statearr_12428; })(); if(cljs.core.truth_(inst_12388)){ var statearr_12429_12454 = state_12414__$1; (statearr_12429_12454[(1)] = (8)); } else { var statearr_12430_12455 = state_12414__$1; (statearr_12430_12455[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (14))){ var inst_12407 = (state_12414[(2)]); var inst_12408 = cljs.core.async.close_BANG_.call(null,out); var state_12414__$1 = (function (){var statearr_12432 = state_12414; (statearr_12432[(13)] = inst_12407); return statearr_12432; })(); var statearr_12433_12456 = state_12414__$1; (statearr_12433_12456[(2)] = inst_12408); (statearr_12433_12456[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (10))){ var inst_12398 = (state_12414[(2)]); var state_12414__$1 = state_12414; var statearr_12434_12457 = state_12414__$1; (statearr_12434_12457[(2)] = inst_12398); (statearr_12434_12457[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12415 === (8))){ var inst_12387 = (state_12414[(11)]); var inst_12378 = (state_12414[(8)]); var tmp12431 = inst_12378; var inst_12378__$1 = tmp12431; var inst_12379 = inst_12387; var state_12414__$1 = (function (){var statearr_12435 = state_12414; (statearr_12435[(7)] = inst_12379); (statearr_12435[(8)] = inst_12378__$1); return statearr_12435; })(); var statearr_12436_12458 = state_12414__$1; (statearr_12436_12458[(2)] = null); (statearr_12436_12458[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } });})(c__6769__auto___12444,out)) ; return ((function (switch__6713__auto__,c__6769__auto___12444,out){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_12440 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_12440[(0)] = state_machine__6714__auto__); (statearr_12440[(1)] = (1)); return statearr_12440; }); var state_machine__6714__auto____1 = (function (state_12414){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_12414); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e12441){if((e12441 instanceof Object)){ var ex__6717__auto__ = e12441; var statearr_12442_12459 = state_12414; (statearr_12442_12459[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_12414); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e12441; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__12460 = state_12414; state_12414 = G__12460; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_12414){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_12414); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___12444,out)) })(); var state__6771__auto__ = (function (){var statearr_12443 = f__6770__auto__.call(null); (statearr_12443[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___12444); return statearr_12443; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___12444,out)) ); return out; }); partition = function(n,ch,buf_or_n){ switch(arguments.length){ case 2: return partition__2.call(this,n,ch); case 3: return partition__3.call(this,n,ch,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; partition.cljs$core$IFn$_invoke$arity$2 = partition__2; partition.cljs$core$IFn$_invoke$arity$3 = partition__3; return partition; })() ; /** * Deprecated - this function will be removed. Use transducer instead */ cljs.core.async.partition_by = (function() { var partition_by = null; var partition_by__2 = (function (f,ch){ return partition_by.call(null,f,ch,null); }); var partition_by__3 = (function (f,ch,buf_or_n){ var out = cljs.core.async.chan.call(null,buf_or_n); var c__6769__auto___12603 = cljs.core.async.chan.call(null,(1)); cljs.core.async.impl.dispatch.run.call(null,((function (c__6769__auto___12603,out){ return (function (){ var f__6770__auto__ = (function (){var switch__6713__auto__ = ((function (c__6769__auto___12603,out){ return (function (state_12573){ var state_val_12574 = (state_12573[(1)]); if((state_val_12574 === (7))){ var inst_12569 = (state_12573[(2)]); var state_12573__$1 = state_12573; var statearr_12575_12604 = state_12573__$1; (statearr_12575_12604[(2)] = inst_12569); (statearr_12575_12604[(1)] = (3)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (1))){ var inst_12532 = []; var inst_12533 = inst_12532; var inst_12534 = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123); var state_12573__$1 = (function (){var statearr_12576 = state_12573; (statearr_12576[(7)] = inst_12534); (statearr_12576[(8)] = inst_12533); return statearr_12576; })(); var statearr_12577_12605 = state_12573__$1; (statearr_12577_12605[(2)] = null); (statearr_12577_12605[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (4))){ var inst_12537 = (state_12573[(9)]); var inst_12537__$1 = (state_12573[(2)]); var inst_12538 = (inst_12537__$1 == null); var inst_12539 = cljs.core.not.call(null,inst_12538); var state_12573__$1 = (function (){var statearr_12578 = state_12573; (statearr_12578[(9)] = inst_12537__$1); return statearr_12578; })(); if(inst_12539){ var statearr_12579_12606 = state_12573__$1; (statearr_12579_12606[(1)] = (5)); } else { var statearr_12580_12607 = state_12573__$1; (statearr_12580_12607[(1)] = (6)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (15))){ var inst_12563 = (state_12573[(2)]); var state_12573__$1 = state_12573; var statearr_12581_12608 = state_12573__$1; (statearr_12581_12608[(2)] = inst_12563); (statearr_12581_12608[(1)] = (14)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (13))){ var state_12573__$1 = state_12573; var statearr_12582_12609 = state_12573__$1; (statearr_12582_12609[(2)] = null); (statearr_12582_12609[(1)] = (14)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (6))){ var inst_12533 = (state_12573[(8)]); var inst_12558 = inst_12533.length; var inst_12559 = (inst_12558 > (0)); var state_12573__$1 = state_12573; if(cljs.core.truth_(inst_12559)){ var statearr_12583_12610 = state_12573__$1; (statearr_12583_12610[(1)] = (12)); } else { var statearr_12584_12611 = state_12573__$1; (statearr_12584_12611[(1)] = (13)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (3))){ var inst_12571 = (state_12573[(2)]); var state_12573__$1 = state_12573; return cljs.core.async.impl.ioc_helpers.return_chan.call(null,state_12573__$1,inst_12571); } else { if((state_val_12574 === (12))){ var inst_12533 = (state_12573[(8)]); var inst_12561 = cljs.core.vec.call(null,inst_12533); var state_12573__$1 = state_12573; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_12573__$1,(15),out,inst_12561); } else { if((state_val_12574 === (2))){ var state_12573__$1 = state_12573; return cljs.core.async.impl.ioc_helpers.take_BANG_.call(null,state_12573__$1,(4),ch); } else { if((state_val_12574 === (11))){ var inst_12541 = (state_12573[(10)]); var inst_12537 = (state_12573[(9)]); var inst_12551 = (state_12573[(2)]); var inst_12552 = []; var inst_12553 = inst_12552.push(inst_12537); var inst_12533 = inst_12552; var inst_12534 = inst_12541; var state_12573__$1 = (function (){var statearr_12585 = state_12573; (statearr_12585[(11)] = inst_12551); (statearr_12585[(7)] = inst_12534); (statearr_12585[(8)] = inst_12533); (statearr_12585[(12)] = inst_12553); return statearr_12585; })(); var statearr_12586_12612 = state_12573__$1; (statearr_12586_12612[(2)] = null); (statearr_12586_12612[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (9))){ var inst_12533 = (state_12573[(8)]); var inst_12549 = cljs.core.vec.call(null,inst_12533); var state_12573__$1 = state_12573; return cljs.core.async.impl.ioc_helpers.put_BANG_.call(null,state_12573__$1,(11),out,inst_12549); } else { if((state_val_12574 === (5))){ var inst_12541 = (state_12573[(10)]); var inst_12534 = (state_12573[(7)]); var inst_12537 = (state_12573[(9)]); var inst_12541__$1 = f.call(null,inst_12537); var inst_12542 = cljs.core._EQ_.call(null,inst_12541__$1,inst_12534); var inst_12543 = cljs.core.keyword_identical_QMARK_.call(null,inst_12534,new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123)); var inst_12544 = (inst_12542) || (inst_12543); var state_12573__$1 = (function (){var statearr_12587 = state_12573; (statearr_12587[(10)] = inst_12541__$1); return statearr_12587; })(); if(cljs.core.truth_(inst_12544)){ var statearr_12588_12613 = state_12573__$1; (statearr_12588_12613[(1)] = (8)); } else { var statearr_12589_12614 = state_12573__$1; (statearr_12589_12614[(1)] = (9)); } return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (14))){ var inst_12566 = (state_12573[(2)]); var inst_12567 = cljs.core.async.close_BANG_.call(null,out); var state_12573__$1 = (function (){var statearr_12591 = state_12573; (statearr_12591[(13)] = inst_12566); return statearr_12591; })(); var statearr_12592_12615 = state_12573__$1; (statearr_12592_12615[(2)] = inst_12567); (statearr_12592_12615[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (10))){ var inst_12556 = (state_12573[(2)]); var state_12573__$1 = state_12573; var statearr_12593_12616 = state_12573__$1; (statearr_12593_12616[(2)] = inst_12556); (statearr_12593_12616[(1)] = (7)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { if((state_val_12574 === (8))){ var inst_12541 = (state_12573[(10)]); var inst_12537 = (state_12573[(9)]); var inst_12533 = (state_12573[(8)]); var inst_12546 = inst_12533.push(inst_12537); var tmp12590 = inst_12533; var inst_12533__$1 = tmp12590; var inst_12534 = inst_12541; var state_12573__$1 = (function (){var statearr_12594 = state_12573; (statearr_12594[(14)] = inst_12546); (statearr_12594[(7)] = inst_12534); (statearr_12594[(8)] = inst_12533__$1); return statearr_12594; })(); var statearr_12595_12617 = state_12573__$1; (statearr_12595_12617[(2)] = null); (statearr_12595_12617[(1)] = (2)); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { return null; } } } } } } } } } } } } } } } });})(c__6769__auto___12603,out)) ; return ((function (switch__6713__auto__,c__6769__auto___12603,out){ return (function() { var state_machine__6714__auto__ = null; var state_machine__6714__auto____0 = (function (){ var statearr_12599 = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]; (statearr_12599[(0)] = state_machine__6714__auto__); (statearr_12599[(1)] = (1)); return statearr_12599; }); var state_machine__6714__auto____1 = (function (state_12573){ while(true){ var ret_value__6715__auto__ = (function (){try{while(true){ var result__6716__auto__ = switch__6713__auto__.call(null,state_12573); if(cljs.core.keyword_identical_QMARK_.call(null,result__6716__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ continue; } else { return result__6716__auto__; } break; } }catch (e12600){if((e12600 instanceof Object)){ var ex__6717__auto__ = e12600; var statearr_12601_12618 = state_12573; (statearr_12601_12618[(5)] = ex__6717__auto__); cljs.core.async.impl.ioc_helpers.process_exception.call(null,state_12573); return new cljs.core.Keyword(null,"recur","recur",-437573268); } else { throw e12600; } }})(); if(cljs.core.keyword_identical_QMARK_.call(null,ret_value__6715__auto__,new cljs.core.Keyword(null,"recur","recur",-437573268))){ var G__12619 = state_12573; state_12573 = G__12619; continue; } else { return ret_value__6715__auto__; } break; } }); state_machine__6714__auto__ = function(state_12573){ switch(arguments.length){ case 0: return state_machine__6714__auto____0.call(this); case 1: return state_machine__6714__auto____1.call(this,state_12573); } throw(new Error('Invalid arity: ' + arguments.length)); }; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$0 = state_machine__6714__auto____0; state_machine__6714__auto__.cljs$core$IFn$_invoke$arity$1 = state_machine__6714__auto____1; return state_machine__6714__auto__; })() ;})(switch__6713__auto__,c__6769__auto___12603,out)) })(); var state__6771__auto__ = (function (){var statearr_12602 = f__6770__auto__.call(null); (statearr_12602[cljs.core.async.impl.ioc_helpers.USER_START_IDX] = c__6769__auto___12603); return statearr_12602; })(); return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state__6771__auto__); });})(c__6769__auto___12603,out)) ); return out; }); partition_by = function(f,ch,buf_or_n){ switch(arguments.length){ case 2: return partition_by__2.call(this,f,ch); case 3: return partition_by__3.call(this,f,ch,buf_or_n); } throw(new Error('Invalid arity: ' + arguments.length)); }; partition_by.cljs$core$IFn$_invoke$arity$2 = partition_by__2; partition_by.cljs$core$IFn$_invoke$arity$3 = partition_by__3; return partition_by; })() ; //# sourceMappingURL=async.js.map
jaw977/bingo-cljs-om
out/cljs/core/async.js
JavaScript
mit
256,550
package com.sunilson.pro4.fragments; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import com.sunilson.pro4.activities.ChannelActivity; import butterknife.Unbinder; /** * @author Linus Weiss */ public abstract class BaseFragment extends Fragment { protected Unbinder unbinder; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onDestroy() { super.onDestroy(); } public void openChannel(String authorID) { if (authorID != null) { Intent i = new Intent(getActivity(), ChannelActivity.class); i.putExtra("type", "view"); i.putExtra("authorID", authorID); startActivity(i); } } }
sunilson/My-Ticker-Android
Android App/app/src/main/java/com/sunilson/pro4/fragments/BaseFragment.java
Java
mit
878
import _numberJs from "../number.js"; import _assert from "assert"; var module = { exports: {} }; var exports = module.exports; var assert = _assert; var number = _numberJs; describe("knumber", function() { it('two equal numbers should be equal', function() { var result = number.equal(1 / 3, 1 / 90 * 30); assert.strictEqual(result, true); }); it('two different numbers should be equal', function() { var result = number.equal(1 / 3, 1.333333); assert.strictEqual(result, false); }); it('Infinity should equal Infinity', function() { var result = number.equal( Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY ); assert.strictEqual(result, true); }); it('+Infinity should not equal -Infinity', function() { var result = number.equal( Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY ); assert.strictEqual(result, false); }); it('sign(0) should be 0', function() { assert.strictEqual(number.sign(0), 0); }); it('sign(-0.0) should be 0', function() { assert.strictEqual(number.sign(-0.0), 0); }); it('sign(3.2) should be 1', function() { assert.strictEqual(number.sign(3.2), 1); }); it('sign(-2.8) should be -1', function() { assert.strictEqual(number.sign(-2.8), -1); }); it('isInteger(-2.8) should be false', function() { assert.strictEqual(number.isInteger(-2.8), false); }); it('isInteger(-2) should be true', function() { assert.strictEqual(number.isInteger(-2), true); }); it('toFraction(-2) should be -2/1', function() { assert.deepEqual(number.toFraction(-2), [-2, 1]); }); it('toFraction(-2.5) should be -5/2', function() { assert.deepEqual(number.toFraction(-2.5), [-5, 2]); }); it('toFraction(2/3) should be 2/3', function() { assert.deepEqual(number.toFraction(2/3), [2, 3]); }); it('toFraction(283.33...) should be 850/3', function() { assert.deepEqual(number.toFraction(283 + 1/3), [850, 3]); }); it('toFraction(0) should be 0/1', function() { assert.deepEqual(number.toFraction(0), [0, 1]); }); it('toFraction(pi) should be pi/1', function() { assert.deepEqual(number.toFraction(Math.PI), [Math.PI, 1]); }); it('toFraction(0.66) should be 33/50', function() { assert.deepEqual(number.toFraction(0.66), [33, 50]); }); it('toFraction(0.66, 0.01) should be 2/3', function() { assert.deepEqual(number.toFraction(0.66, 0.01), [2, 3]); }); }); export default module.exports;
ariabuckles/perseus
src/node_modules/kmath/__tests__/number.js
JavaScript
mit
2,696
$(document).ready(function () { $(".selectTrigger").change(function () { selectClicked($(this)); }); }); function selectClicked(select) { var data = select.val(); var container = select.attr("container"); $(container).find(".selectActor").each(function () { var actorId = $(this).attr("data"); if (actorId == data) $(this).removeClass("hidden"); else $(this).addClass("hidden"); }); }
Rikmuld/Programming-Hub
public/scripts/includes/selectTrigger.js
JavaScript
mit
453
<!DOCTYPE html> <?xml version="1.0" encoding="UTF-8"?> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Earth Negotiations Bulletin: SB-18</title> <link href="../assets/style/bulletin.css" rel="stylesheet" /> </head> <body> <h1>Earth Negotiations Bulletin: SB-18</h1> <p><b>18th Session of the Subsidiary Bodies</b></p> <p>04-Jun-03 &mdash; <a href="http://www.iisd.ca/vol12/enb12211e.html">original report</a></p> <div id="section_enb12211e_1"> <h2>A BRIEF HISTORY OF THE UNFCCC AND THE KYOTO PROTOCOL</h2> <small>SBI/SBSTA — history</small> <p>Climate change is considered one of the most serious threats to the global environment, with negative impacts expected on human health, food security, economic activity, water and other natural resources, and physical infrastructure.</p> <p>Global climate varies naturally, but scientists agree that rising concentrations of anthropogenically emitted greenhouse gases in the Earth's atmosphere are leading to a change in the climate.</p> <p>According to the Intergovernmental Panel on Climate Change (IPCC), the effects of climate change have already been observed, and a majority of scientists believe that precautionary and prompt action is necessary. The international political response to climate change began with the adoption of the UNFCCC in 1992.</p> <p>The UNFCCC sets out a framework for action aimed at stabilizing atmospheric concentrations of greenhouse gases to avoid 'dangerous interference' with the climate system.</p> <p>Controlled gases include methane, nitrous oxide, and, in particular, carbon dioxide.</p> <p>The UNFCCC entered into force on 21 March 1994.</p> <p>It now has 188 Parties.</p> </div> <div id="section_enb12211e_10"> <h2>WORKSHOP ON ADJUSTMENTS UNDER PROTOCOL ARTICLE 5.2</h2> <p>This workshop took place from 7-9 April 2003, in Lisbon, Portugal, and assessed case studies undertaken by the UNFCCC Secretariat for simulating the calculation of adjustments under Article 5.2.</p> <p>The outcome was refined draft technical guidance on methodologies for adjustments under Article 5.2.</p> <p>SBSTA-18 is expected to complete the technical guidance.</p> </div> <div id="section_enb12211e_11"> <h2>WORKSHOP ON THE USE OF THE GUIDELINES FOR THE PREPARATION OF NON- ANNEX I NATIONAL COMMUNICATIONS</h2> <p>This workshop, held in Port Luis, Mauritius, from 8-11 April 2003, examined the guidelines for the preparation of non-Annex I national communications agreed at COP-8.</p> <p>Participants heard a number of presentations on the guidelines, and other reporting guides and programmes for facilitating the preparation of non-Annex I national communications.</p> </div> <div id="section_enb12211e_12"> <h2>WORKSHOP ON ENABLING ENVIRONMENTS FOR TECHNOLOGY TRANSFER</h2> <p>This workshop was convened from 9-10 April 2003, in Ghent, Belgium.</p> <p>The workshop provided an overview of technology transfer, reviewed the draft technical paper on enabling environments for transfer of environmentally-sound technology for consideration by the Expert Group on Technology Transfer (EGTT) at its third meeting, and examined barriers and opportunities to technology transfer.</p> <p>Working groups discussed ways in which governments could identify and remove barriers to technology transfer; and how multilateral lending institutions, bilateral programmes and the private sector could assist governments.</p> </div> <div id="section_enb12211e_13"> <h2>WORKSHOPS ON INSURANCE AND RISK ASSESSMENT IN THE CONTEXT OF CLIMATE CHANGE AND EXTREME WEATHER EVENTS, AND ON INSURANCE- RELATED ACTIONS TO ADDRESS ADVERSE EFFECTS</h2> <p>These two workshops were held back-to-back from 12-13 May and 14-15 May 2003, in Bonn.</p> <p>The first workshop heard presentations from reinsurance companies, researchers and multilateral bodies on the possible roles of insurance and risk assessment in responding to climate change.</p> <p>The second workshop focused on insurance-related actions for addressing the adverse effects of climate change and from the impact of the implementation of response measures.</p> </div> <div id="section_enb12211e_14"> <h2>MEETINGS OF CONSTITUTED BODIES</h2> <p>The following UNFCCC constituted bodies held meetings since COP-8.</p> <p>The LDC Expert Group held its third meeting from 3-5 March 2003, in Samoa.</p> <p>The CDM Executive Board held its seventh and eighth meetings in Bonn from 20-21 January 2003 and 20-21 March 2003, respectively.</p> <p>The EGTT held its third meeting from 30-31 May 2003.</p> <p>In addition, pre-sessional consultations were held on 2 June to discuss registries, and the Global Climate Observing System second adequacy report.</p> </div> <div id="section_enb12211e_2"> <h2>THE KYOTO PROTOCOL</h2> <p>In 1995, the first meeting of the Conference of the Parties (COP-1) established the Ad Hoc Group on the Berlin Mandate, and charged it with reaching agreement on strengthening efforts to combat climate change.</p> <p>Following intense negotiations culminating at COP-3 in Kyoto, Japan, in December 1997, delegates agreed to a Protocol to the UNFCCC that commits developed countries and countries making the transition to a market economy (EITs) to achieve quantified emission reduction targets.</p> <p>These countries, known under the UNFCCC as Annex I Parties, agreed to reduce their overall emissions of six greenhouse gases by at least 5% below 1990 levels between 2008 and 2012 (the first commitment period), with specific targets varying from country to country.</p> <p>The Protocol also established three mechanisms to assist Annex I Parties in meeting their national targets cost-effectively - an emissions trading system, joint implementation (JI) of emissions- reduction projects between Annex I Parties, and a Clean Development Mechanism (CDM) that encourages projects in non-Annex I (developing country) Parties. At subsequent meetings, Parties negotiated most of the rules and operational details determining how countries will cut emissions and measure and assess emissions reductions.</p> <p>To enter into force, the Protocol must be ratified by 55 Parties to the UNFCCC, and by Annex I Parties representing at least 55% of the total carbon dioxide emissions for 1990.</p> <p>To date, 109 Parties have ratified the Protocol, including 31 Annex I Parties, representing 43.9% of the emissions.</p> </div> <div id="section_enb12211e_3"> <h2>THE BUENOS AIRES PLAN OF ACTION</h2> <p>In November 1998, Parties met at COP-4 in Buenos Aires, Argentina, and agreed a decision known as the Buenos Aires Plan of Action (BAPA).</p> <p>The BAPA set COP-6 as the deadline for reaching agreement on the operational details of the Protocol and on strengthening implementation of the UNFCCC.</p> <p>Issues to be addressed include rules relating to the mechanisms, a regime for assessing Parties' compliance, accounting methods for national emissions and emissions reductions, and rules on crediting countries for carbon sinks.</p> <p>Issues under the UNFCCC requiring resolution included questions of capacity building, the development and transfer of technology, and assistance to those developing countries particularly vulnerable to the adverse effects of climate change or to actions taken by industrialized countries to combat climate change.</p> </div> <div id="section_enb12211e_4"> <h2>COP-6 PART I</h2> <p>COP-6 and the resumed SB-13 were held in The Hague, the Netherlands, in November 2000.</p> <p>Positions on the key issues remained entrenched, with little indication of a willingness to compromise.</p> <p>During the second week of negotiations, COP-6 President Jan Pronk (the Netherlands) attempted to facilitate negotiations on the many disputed political and technical issues by convening high-level informal Plenary sessions.</p> <p>After almost 36 hours of intense talks in the final two days of COP-6, negotiators could not agree on a range of issues, particularly financial issues, supplementarity in the use of the mechanisms, compliance and land use, land-use change and forestry (LULUCF).</p> <p>On Saturday afternoon, 25 November, President Pronk announced that delegates had failed to reach agreement.</p> <p>Delegates agreed to suspend COP-6 and resume negotiations in 2001.</p> </div> <div id="section_enb12211e_5"> <h2>COP-6 PART II</h2> <p>In March 2001, the US administration repudiated the Protocol, stating that it considered the Protocol to be 'fatally flawed,' as it would damage its economy and exempt developing countries from emission reduction targets.</p> <p>Parties reconvened at COP-6 Part II and SB-14, in July 2001, in Bonn, Germany.</p> <p>After protracted consultations, President Pronk presented his proposal for a draft political decision.</p> <p>Despite support from several Parties, disagreements surfaced over the nature of the compliance regime.</p> <p>After several days of consultations, ministers agreed to adopt President Pronk's political decision, with a revised section on compliance on 25 July 2001.</p> <p>The political decision - or 'Bonn Agreements' - needed to be operationalized through COP decisions.</p> <p>These decisions were considered a 'package,' and since no agreement was reached on the mechanisms, compliance and LULUCF, all draft decisions were forwarded to COP-7.</p> </div> <div id="section_enb12211e_6"> <h2>COP-7</h2> <p>Delegates continued discussions on the Bonn Agreements at COP-7 and SB-15 in Marrakesh, Morocco, from 29 October to 10 November 2001.</p> <p>After lengthy negotiations, a package deal on LULUCF, mechanisms, Protocol Articles 5 (methodological issues), 7 (communication of information) and 8 (review of information), and input to the World Summit on Sustainable Development (WSSD) was proposed on 8 November.</p> <p>Although the deal was accepted by most regional groups, some Annex I Parties, including Australia, Canada, Japan, New Zealand, and the Russian Federation, did not join the consensus.</p> <p>They disputed, among other things, eligibility requirements and credit banking under the mechanisms.</p> <p>However, following extensive negotiations, the 'Marrakesh Accords' were agreed, with key features including consideration of LULUCF Principles and limited banking of units generated by sinks under the CDM.</p> </div> <div id="section_enb12211e_7"> <h2>SB-16</h2> <p>Parties met at SB-16 in Bonn from 5-14 June 2002.</p> <p>Participants considered several issues previously left off the agenda due to the pressing BAPA negotiations.</p> <p>Views on the direction of the climate process differed, with some Parties looking back to recent debates and others looking ahead toward the next commitment period.</p> <p>Many hoped the Protocol could enter into force by the WSSD in August 2002.</p> <p>The EU and Japan announced their Protocol ratifications just prior to the WSSD.</p> </div> <div id="section_enb12211e_8"> <h2>COP-8</h2> <p>Delegates to COP-8 and SB-17 met from 23 October to 1 November 2002, in New Delhi, India.</p> <p>On the final day of COP-8, they adopted the Delhi Declaration on Climate Change and Sustainable Development.</p> <p>The Declaration reaffirms development and poverty eradication as overriding priorities in developing counties, and recognizes Parties' common but differentiated responsibilities and national development priorities and circumstances in the implementation of UNFCCC commitments.</p> <p>Parties at COP-8 considered institutional and procedural issues under the Protocol and adopted several decisions, including on the rules and procedures for the CDM.</p> </div> <div id="section_enb12211e_9"> <h2>WORKSHOP ON DEFINITIONS AND MODALITIES FOR INCLUDING AFFORESTATION AND REFORESTATION PROJECT ACTIVITIES UNDER PROTOCOL ARTICLE 12</h2> <p>This workshop was held from 12-14 February 2003, in Foz do Iguaçu, Brazil.</p> <p>In addition to considering issues associated with afforestation and reforestation in the CDM, the workshop assisted governments in the preparation of draft text for modalities for including afforestation and reforestation project activities under the CDM in the first commitment period.</p> <p>Key themes included non- permanence, baselines, additionality, leakage; socio-economic and environmental impacts, including impacts on biodiversity and natural ecosystems; and cross-cutting issues.</p> </div> <script type="text/javascript" src="../assets/src/bulletin.js"></script> </body> </html>
medialab/climateDebateExplorer
ENB-data/enb_pages/enb12211e.html
HTML
mit
13,055
// Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2018 The PIVX developers // Copyright (c) 2018 The Ion Core developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include "config/ion-config.h" #endif #include "optionsmodel.h" #include "bitcoinunits.h" #include "guiutil.h" #include "amount.h" #include "init.h" #include "main.h" #include "net.h" #include "txdb.h" // for -dbcache defaults #include "util.h" #ifdef ENABLE_WALLET #include "masternodeconfig.h" #include "wallet.h" #include "walletdb.h" #endif #include <QNetworkProxy> #include <QSettings> #include <QStringList> OptionsModel::OptionsModel(QObject* parent) : QAbstractListModel(parent) { Init(); } void OptionsModel::addOverriddenOption(const std::string& option) { strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(mapArgs[option]) + " "; } // Writes all missing QSettings with their default values void OptionsModel::Init() { resetSettings = false; QSettings settings; // Ensure restart flag is unset on client startup setRestartRequired(false); // These are Qt-only settings: // Window if (!settings.contains("fMinimizeToTray")) settings.setValue("fMinimizeToTray", false); fMinimizeToTray = settings.value("fMinimizeToTray").toBool(); if (!settings.contains("fMinimizeOnClose")) settings.setValue("fMinimizeOnClose", false); fMinimizeOnClose = settings.value("fMinimizeOnClose").toBool(); // Display if (!settings.contains("nDisplayUnit")) settings.setValue("nDisplayUnit", BitcoinUnits::ION); nDisplayUnit = settings.value("nDisplayUnit").toInt(); if (!settings.contains("strThirdPartyTxUrls")) settings.setValue("strThirdPartyTxUrls", ""); strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString(); if (!settings.contains("fHideZeroBalances")) settings.setValue("fHideZeroBalances", true); fHideZeroBalances = settings.value("fHideZeroBalances").toBool(); if (!settings.contains("fCoinControlFeatures")) settings.setValue("fCoinControlFeatures", false); fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool(); if (!settings.contains("fZeromintEnable")) settings.setValue("fZeromintEnable", true); fEnableZeromint = settings.value("fZeromintEnable").toBool(); if (!settings.contains("nZeromintPercentage")) settings.setValue("nZeromintPercentage", 10); nZeromintPercentage = settings.value("nZeromintPercentage").toLongLong(); if (!settings.contains("nPreferredDenom")) settings.setValue("nPreferredDenom", 0); nPreferredDenom = settings.value("nPreferredDenom", "0").toLongLong(); if (!settings.contains("nAnonymizeIONAmount")) settings.setValue("nAnonymizeIONAmount", 1000); nAnonymizeIONAmount = settings.value("nAnonymizeIONAmount").toLongLong(); if (!settings.contains("fShowMasternodesTab")) settings.setValue("fShowMasternodesTab", masternodeConfig.getCount()); // These are shared with the core or have a command-line parameter // and we want command-line parameters to overwrite the GUI settings. // // If setting doesn't exist create it with defaults. // // If SoftSetArg() or SoftSetBoolArg() return false we were overridden // by command-line and show this in the UI. // Main if (!settings.contains("nDatabaseCache")) settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache); if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString())) addOverriddenOption("-dbcache"); if (!settings.contains("nThreadsScriptVerif")) settings.setValue("nThreadsScriptVerif", DEFAULT_SCRIPTCHECK_THREADS); if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString())) addOverriddenOption("-par"); // Wallet #ifdef ENABLE_WALLET if (!settings.contains("bSpendZeroConfChange")) settings.setValue("bSpendZeroConfChange", false); if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool())) addOverriddenOption("-spendzeroconfchange"); #endif if (!settings.contains("nStakeSplitThreshold")) settings.setValue("nStakeSplitThreshold", 1); // Network if (!settings.contains("fUseUPnP")) settings.setValue("fUseUPnP", DEFAULT_UPNP); if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) addOverriddenOption("-upnp"); if (!settings.contains("fListen")) settings.setValue("fListen", DEFAULT_LISTEN); if (!SoftSetBoolArg("-listen", settings.value("fListen").toBool())) addOverriddenOption("-listen"); if (!settings.contains("fUseProxy")) settings.setValue("fUseProxy", false); if (!settings.contains("addrProxy")) settings.setValue("addrProxy", "127.0.0.1:9050"); // Only try to set -proxy, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString())) addOverriddenOption("-proxy"); else if (!settings.value("fUseProxy").toBool() && !GetArg("-proxy", "").empty()) addOverriddenOption("-proxy"); // Display if (!settings.contains("digits")) settings.setValue("digits", "2"); if (!settings.contains("theme")) settings.setValue("theme", ""); if (!settings.contains("fCSSexternal")) settings.setValue("fCSSexternal", false); if (!settings.contains("language")) settings.setValue("language", ""); if (!SoftSetArg("-lang", settings.value("language").toString().toStdString())) addOverriddenOption("-lang"); if (settings.contains("fZeromintEnable")) SoftSetBoolArg("-enablezeromint", settings.value("fZeromintEnable").toBool()); if (settings.contains("nZeromintPercentage")) SoftSetArg("-zeromintpercentage", settings.value("nZeromintPercentage").toString().toStdString()); if (settings.contains("nPreferredDenom")) SoftSetArg("-preferredDenom", settings.value("nPreferredDenom").toString().toStdString()); if (settings.contains("nAnonymizeIONAmount")) SoftSetArg("-anonymizeionamount", settings.value("nAnonymizeIONAmount").toString().toStdString()); language = settings.value("language").toString(); } void OptionsModel::Reset() { QSettings settings; // Remove all entries from our QSettings object settings.clear(); resetSettings = true; // Needed in ion.cpp during shotdown to also remove the window positions // default setting for OptionsModel::StartAtStartup - disabled if (GUIUtil::GetStartOnSystemStartup()) GUIUtil::SetStartOnSystemStartup(false); } int OptionsModel::rowCount(const QModelIndex& parent) const { return OptionIDRowCount; } // read QSettings values and return them QVariant OptionsModel::data(const QModelIndex& index, int role) const { if (role == Qt::EditRole) { QSettings settings; switch (index.row()) { case StartAtStartup: return GUIUtil::GetStartOnSystemStartup(); case MinimizeToTray: return fMinimizeToTray; case MapPortUPnP: #ifdef USE_UPNP return settings.value("fUseUPnP"); #else return false; #endif case MinimizeOnClose: return fMinimizeOnClose; // default proxy case ProxyUse: return settings.value("fUseProxy", false); case ProxyIP: { // contains IP at index 0 and port at index 1 QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); return strlIpPort.at(0); } case ProxyPort: { // contains IP at index 0 and port at index 1 QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); return strlIpPort.at(1); } #ifdef ENABLE_WALLET case SpendZeroConfChange: return settings.value("bSpendZeroConfChange"); case ShowMasternodesTab: return settings.value("fShowMasternodesTab"); #endif case StakeSplitThreshold: if (pwalletMain) return QVariant((int)pwalletMain->nStakeSplitThreshold); return settings.value("nStakeSplitThreshold"); case DisplayUnit: return nDisplayUnit; case ThirdPartyTxUrls: return strThirdPartyTxUrls; case Digits: return settings.value("digits"); case Theme: return settings.value("theme"); case Language: return settings.value("language"); case CoinControlFeatures: return fCoinControlFeatures; case DatabaseCache: return settings.value("nDatabaseCache"); case ThreadsScriptVerif: return settings.value("nThreadsScriptVerif"); case HideZeroBalances: return settings.value("fHideZeroBalances"); case ZeromintEnable: return QVariant(fEnableZeromint); case ZeromintPercentage: return QVariant(nZeromintPercentage); case ZeromintPrefDenom: return QVariant(nPreferredDenom); case AnonymizeIONAmount: return QVariant(nAnonymizeIONAmount); case Listen: return settings.value("fListen"); default: return QVariant(); } } return QVariant(); } // write QSettings values bool OptionsModel::setData(const QModelIndex& index, const QVariant& value, int role) { bool successful = true; /* set to false on parse error */ if (role == Qt::EditRole) { QSettings settings; switch (index.row()) { case StartAtStartup: successful = GUIUtil::SetStartOnSystemStartup(value.toBool()); break; case MinimizeToTray: fMinimizeToTray = value.toBool(); settings.setValue("fMinimizeToTray", fMinimizeToTray); break; case MapPortUPnP: // core option - can be changed on-the-fly settings.setValue("fUseUPnP", value.toBool()); MapPort(value.toBool()); break; case MinimizeOnClose: fMinimizeOnClose = value.toBool(); settings.setValue("fMinimizeOnClose", fMinimizeOnClose); break; // default proxy case ProxyUse: if (settings.value("fUseProxy") != value) { settings.setValue("fUseProxy", value.toBool()); setRestartRequired(true); } break; case ProxyIP: { // contains current IP at index 0 and current port at index 1 QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); // if that key doesn't exist or has a changed IP if (!settings.contains("addrProxy") || strlIpPort.at(0) != value.toString()) { // construct new value from new IP and current port QString strNewValue = value.toString() + ":" + strlIpPort.at(1); settings.setValue("addrProxy", strNewValue); setRestartRequired(true); } } break; case ProxyPort: { // contains current IP at index 0 and current port at index 1 QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); // if that key doesn't exist or has a changed port if (!settings.contains("addrProxy") || strlIpPort.at(1) != value.toString()) { // construct new value from current IP and new port QString strNewValue = strlIpPort.at(0) + ":" + value.toString(); settings.setValue("addrProxy", strNewValue); setRestartRequired(true); } } break; #ifdef ENABLE_WALLET case SpendZeroConfChange: if (settings.value("bSpendZeroConfChange") != value) { settings.setValue("bSpendZeroConfChange", value); setRestartRequired(true); } break; case ShowMasternodesTab: if (settings.value("fShowMasternodesTab") != value) { settings.setValue("fShowMasternodesTab", value); setRestartRequired(true); } break; #endif case StakeSplitThreshold: settings.setValue("nStakeSplitThreshold", value.toInt()); setStakeSplitThreshold(value.toInt()); break; case DisplayUnit: setDisplayUnit(value); break; case ThirdPartyTxUrls: if (strThirdPartyTxUrls != value.toString()) { strThirdPartyTxUrls = value.toString(); settings.setValue("strThirdPartyTxUrls", strThirdPartyTxUrls); setRestartRequired(true); } break; case Digits: if (settings.value("digits") != value) { settings.setValue("digits", value); setRestartRequired(true); } break; case Theme: if (settings.value("theme") != value) { settings.setValue("theme", value); setRestartRequired(true); } break; case Language: if (settings.value("language") != value) { settings.setValue("language", value); setRestartRequired(true); } break; case ZeromintEnable: fEnableZeromint = value.toBool(); settings.setValue("fZeromintEnable", fEnableZeromint); emit zeromintEnableChanged(fEnableZeromint); break; case ZeromintPercentage: nZeromintPercentage = value.toInt(); settings.setValue("nZeromintPercentage", nZeromintPercentage); emit zeromintPercentageChanged(nZeromintPercentage); break; case ZeromintPrefDenom: nPreferredDenom = value.toInt(); settings.setValue("nPreferredDenom", nPreferredDenom); emit preferredDenomChanged(nPreferredDenom); break; case HideZeroBalances: fHideZeroBalances = value.toBool(); settings.setValue("fHideZeroBalances", fHideZeroBalances); emit hideZeroBalancesChanged(fHideZeroBalances); break; case AnonymizeIONAmount: nAnonymizeIONAmount = value.toInt(); settings.setValue("nAnonymizeIONAmount", nAnonymizeIONAmount); emit anonymizeIONAmountChanged(nAnonymizeIONAmount); break; case CoinControlFeatures: fCoinControlFeatures = value.toBool(); settings.setValue("fCoinControlFeatures", fCoinControlFeatures); emit coinControlFeaturesChanged(fCoinControlFeatures); break; case DatabaseCache: if (settings.value("nDatabaseCache") != value) { settings.setValue("nDatabaseCache", value); setRestartRequired(true); } break; case ThreadsScriptVerif: if (settings.value("nThreadsScriptVerif") != value) { settings.setValue("nThreadsScriptVerif", value); setRestartRequired(true); } break; case Listen: if (settings.value("fListen") != value) { settings.setValue("fListen", value); setRestartRequired(true); } break; default: break; } } emit dataChanged(index, index); return successful; } /** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */ void OptionsModel::setDisplayUnit(const QVariant& value) { if (!value.isNull()) { QSettings settings; nDisplayUnit = value.toInt(); settings.setValue("nDisplayUnit", nDisplayUnit); emit displayUnitChanged(nDisplayUnit); } } /* Update StakeSplitThreshold's value in wallet */ void OptionsModel::setStakeSplitThreshold(int value) { // XXX: maybe it's worth to wrap related stuff with WALLET_ENABLE ? uint64_t nStakeSplitThreshold; nStakeSplitThreshold = value; if (pwalletMain && pwalletMain->nStakeSplitThreshold != nStakeSplitThreshold) { CWalletDB walletdb(pwalletMain->strWalletFile); LOCK(pwalletMain->cs_wallet); { pwalletMain->nStakeSplitThreshold = nStakeSplitThreshold; if (pwalletMain->fFileBacked) walletdb.WriteStakeSplitThreshold(nStakeSplitThreshold); } } } bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const { // Directly query current base proxy, because // GUI settings can be overridden with -proxy. proxyType curProxy; if (GetProxy(NET_IPV4, curProxy)) { proxy.setType(QNetworkProxy::Socks5Proxy); proxy.setHostName(QString::fromStdString(curProxy.proxy.ToStringIP())); proxy.setPort(curProxy.proxy.GetPort()); return true; } else proxy.setType(QNetworkProxy::NoProxy); return false; } void OptionsModel::setRestartRequired(bool fRequired) { QSettings settings; return settings.setValue("fRestartRequired", fRequired); } bool OptionsModel::isRestartRequired() { QSettings settings; return settings.value("fRestartRequired", false).toBool(); }
mitchellcash/ion
src/qt/optionsmodel.cpp
C++
mit
17,849
<?php namespace App\Model\Entity; use Cake\ORM\Entity; /** * Question Entity * * @property int $id * @property string $name * @property string $label * @property string $type * @property int $form_id * @property string $choices * @property bool $required * @property string $conditional * @property string $columns * @property string $rows * @property \Cake\I18n\FrozenTime $created * @property \Cake\I18n\FrozenTime $modified * * @property \App\Model\Entity\Form $form * @property \App\Model\Entity\User[] $users */ class Question extends Entity { /** * Fields that can be mass assigned using newEntity() or patchEntity(). * * Note that when '*' is set to true, this allows all unspecified fields to * be mass assigned. For security purposes, it is advised to set '*' to false * (or remove it), and explicitly make individual fields accessible as needed. * * @var array */ protected $_accessible = [ 'name' => true, 'label' => true, 'type' => true, 'form_id' => true, 'choices' => true, 'required' => true, 'conditional' => true, 'columns' => true, 'rows' => true, 'created' => true, 'modified' => true, 'form' => true, 'users' => true ]; }
nerthux/EgresadosV2
src/Model/Entity/Question.php
PHP
mit
1,319
/** * Created by vladi on 05-Feb-17. */ import Event from "../src/Event" import { __testGetCurrentUid, __testGetCurrentListenerRegistry, __testGetCurrentDispatchRegistry, EventException, getUid, listenerExists, dispatchRegistryExists, isListenerSuspended, setActiveState, removeListener, getListenerType, filterRemovedListeners, isEventStateUpdated, updateDispatcherRegistryByType, addEventListener, canFireEventHandler, dispatchEvent, removeEventListenersByType, removeEventListenerById, suspendEventListenerById, restoreEventListenerById, systemSuspendEventListenerById, systemRestoreEventListenerById, DEFAULT_FILTER } from '../src/EventsControl'; const testGlobalListenerRegistry = __testGetCurrentListenerRegistry(), testGlobalDispatchRegistry = __testGetCurrentDispatchRegistry(), getEventListenerInfo = (uid, onStateUpdate, active, handler) => ({ _onStateUpdate: !!onStateUpdate, _active: !!active, _eventUid: uid, _handler: handler === undefined ? noop : handler, _isFiltered: false, _filters: {} }); const noop = () => undefined; class TestFakeEvent { } class TestEvent extends Event { defaultEventState = {} } class TestEvent3 extends Event { defaultEventState = {} } test('initial tests', () => { expect(__testGetCurrentUid()).toEqual(0); expect(__testGetCurrentListenerRegistry()).toEqual({}); expect(__testGetCurrentDispatchRegistry()).toEqual({}); }); test('check basic functionality', () => { expect(getUid()).toEqual(1); expect(getUid()).toEqual(2); expect(isEventStateUpdated({a: 1}, {a: 2})).toEqual(true); expect(isEventStateUpdated({a: 1}, {b: 1})).toEqual(true); expect(isEventStateUpdated({a: 1}, {a: 2, b: 2})).toEqual(true); expect(isEventStateUpdated({a: 1}, {a: 1})).toEqual(false); }); test('check listeners control basic add/remove/exists/suspended functionality', () => { const eventListener = TestEvent.addEventListener(noop); const eventListener2 = TestEvent.addEventListener(noop); const listenersList = [eventListener.listenerUid, eventListener2.listenerUid]; const expectBeforeRemove = [eventListener.listenerUid, eventListener2.listenerUid]; const expectedAfterRemove = [eventListener2.listenerUid]; expect(listenersList).not.toBe(expectBeforeRemove); expect(listenersList).toEqual(expectBeforeRemove); expect(eventListener.listenerUid).not.toEqual(eventListener2.listenerUid); expect(getListenerType(-1)).toEqual(false); expect(listenerExists(eventListener.listenerUid)).toEqual(true); expect(isListenerSuspended(eventListener.listenerUid)).toEqual(false); expect(dispatchRegistryExists(TestEvent.uid)).toEqual(true); expect(getListenerType(eventListener.listenerUid)).toEqual(TestEvent.uid); expect(filterRemovedListeners(listenersList)).toEqual(expectBeforeRemove); eventListener.suspend(); expect(listenerExists(eventListener.listenerUid)).toEqual(true); expect(isListenerSuspended(eventListener.listenerUid)).toEqual(true); expect(dispatchRegistryExists(TestEvent.uid)).toEqual(true); expect(getListenerType(eventListener.listenerUid)).toEqual(TestEvent.uid); expect(filterRemovedListeners(listenersList)).toEqual(expectBeforeRemove); eventListener.remove(); expect(listenerExists(eventListener.listenerUid)).toEqual(false); expect(isListenerSuspended(eventListener.listenerUid)).toEqual(true); expect(dispatchRegistryExists(TestEvent.uid)).toEqual(true); expect(filterRemovedListeners(listenersList)).toEqual(expectedAfterRemove); expect(listenerExists(eventListener2.listenerUid)).toEqual(true); expect(isListenerSuspended(eventListener2.listenerUid)).toEqual(false); eventListener2.remove(); expect(dispatchRegistryExists(TestEvent.uid)).toEqual(false); expect(filterRemovedListeners(listenersList)).toEqual([]); const listener = TestEvent.addEventListener(noop); const listener2 = TestEvent.addEventListener(noop); const listener3 = TestEvent3.addEventListener(noop); const eventListenerList = [listener.listenerUid, listener2.listenerUid, listener3.listenerUid]; removeEventListenersByType(TestEvent.uid); expect(filterRemovedListeners(eventListenerList)).toEqual(eventListenerList); removeEventListenersByType(TestEvent.uid, eventListenerList); expect(filterRemovedListeners(eventListenerList)).toEqual([listener3.listenerUid]); expect(testGlobalListenerRegistry[listener.listenerUid]).toBe(undefined); expect(testGlobalListenerRegistry[listener2.listenerUid]).toBe(undefined); expect(testGlobalListenerRegistry[listener3.listenerUid]).not.toBe(undefined); listener3.remove(); }); test('helper functions test', () => { const {listenerUid} = TestEvent.addEventListener(noop); expect(testGlobalDispatchRegistry[TestEvent.uid]).toEqual([listenerUid]); expect(testGlobalListenerRegistry[listenerUid]).toEqual(getEventListenerInfo(TestEvent.uid, false, true)); expect(testGlobalDispatchRegistry[listenerUid]).toBe(undefined); removeEventListenerById(-1); expect(testGlobalListenerRegistry[listenerUid]).not.toBe(undefined) setActiveState(listenerUid, false); expect(testGlobalListenerRegistry[listenerUid]._active).toBe(false); removeListener(listenerUid); expect(testGlobalListenerRegistry[listenerUid]).toBe(undefined); expect(testGlobalDispatchRegistry[TestEvent.uid]).toEqual([listenerUid]); updateDispatcherRegistryByType(-1); expect(testGlobalDispatchRegistry[TestEvent.uid]).toEqual([listenerUid]); updateDispatcherRegistryByType(TestEvent.uid); expect(testGlobalDispatchRegistry[TestEvent.uid]).toBe(undefined); const listener = TestEvent.addEventListener(noop); removeEventListenerById(listener.listenerUid); expect(testGlobalListenerRegistry[listener.listenerUid]).toBe(undefined); expect(testGlobalDispatchRegistry[TestEvent.uid]).toBe(undefined); let testInfo = getEventListenerInfo(TestEvent.uid, false, true); let testInfoUpdate = getEventListenerInfo(TestEvent.uid, true, true); expect(canFireEventHandler(testInfo, false, DEFAULT_FILTER)).toBe(true); expect(canFireEventHandler(testInfoUpdate, false, DEFAULT_FILTER)).toBe(false); expect(canFireEventHandler(testInfo, true, DEFAULT_FILTER)).toBe(true); expect(canFireEventHandler(testInfoUpdate, true, DEFAULT_FILTER)).toBe(true); }); test('test suspend/restore/systemSuspend/systemRestore', () => { const {listenerUid} = TestEvent.addEventListener(noop); expect(testGlobalListenerRegistry[listenerUid]._active).toBe(true); suspendEventListenerById(listenerUid); expect(testGlobalListenerRegistry[listenerUid]._active).toBe(false); restoreEventListenerById(listenerUid); expect(testGlobalListenerRegistry[listenerUid]._active).toBe(true); systemSuspendEventListenerById(listenerUid); expect(testGlobalListenerRegistry[listenerUid]._active).toBe(null); systemRestoreEventListenerById(listenerUid); expect(testGlobalListenerRegistry[listenerUid]._active).toBe(true); suspendEventListenerById(listenerUid); systemRestoreEventListenerById(listenerUid); expect(testGlobalListenerRegistry[listenerUid]._active).toBe(false); removeEventListenerById(listenerUid); }); test('test add and dispatch functionality', () => { expect(testGlobalListenerRegistry).toEqual({}); expect(testGlobalDispatchRegistry).toEqual({}); let eventListenerActiveCb = jest.fn(); let eventListenerActiveUpdateCb = jest.fn(); let eventListenerInactiveCb = jest.fn(); let eventListenerInactiveUpdateCb = jest.fn(); let otherEventListenerActiveCb = jest.fn(); const eventListenerActive = addEventListener(getEventListenerInfo(TestEvent.uid, false, true, eventListenerActiveCb)); const eventListenerActiveUpdate = addEventListener(getEventListenerInfo(TestEvent.uid, true, true, eventListenerActiveUpdateCb)); const eventListenerInactive = addEventListener(getEventListenerInfo(TestEvent.uid, false, false, eventListenerInactiveCb)); const eventListenerInactiveUpdate = addEventListener(getEventListenerInfo(TestEvent.uid, true, false, eventListenerInactiveUpdateCb)); const otherEventListenerActive = addEventListener(getEventListenerInfo(TestEvent3.uid, false, true, otherEventListenerActiveCb)); expect(addEventListener(getEventListenerInfo(TestEvent.uid, false, true, null))).toBe(null); dispatchEvent(new TestFakeEvent()); expect(eventListenerActiveCb).not.toHaveBeenCalled(); expect(eventListenerActiveUpdateCb).not.toHaveBeenCalled(); expect(eventListenerInactiveCb).not.toHaveBeenCalled(); expect(eventListenerInactiveUpdateCb).not.toHaveBeenCalled(); expect(otherEventListenerActiveCb).not.toHaveBeenCalled(); dispatchEvent(new TestEvent3()); expect(eventListenerActiveCb).not.toHaveBeenCalled(); expect(eventListenerActiveUpdateCb).not.toHaveBeenCalled(); expect(eventListenerInactiveCb).not.toHaveBeenCalled(); expect(eventListenerInactiveUpdateCb).not.toHaveBeenCalled(); expect(otherEventListenerActiveCb).toHaveBeenCalled(); dispatchEvent(new TestEvent()); expect(eventListenerActiveCb).toHaveBeenCalled(); expect(eventListenerActiveUpdateCb).not.toHaveBeenCalled(); expect(eventListenerInactiveCb).not.toHaveBeenCalled(); expect(eventListenerInactiveUpdateCb).not.toHaveBeenCalled(); expect(otherEventListenerActiveCb).toHaveBeenCalledTimes(1); dispatchEvent(new TestEvent(), true); expect(eventListenerActiveCb).toHaveBeenCalledTimes(2); expect(eventListenerActiveUpdateCb).toHaveBeenCalled(); expect(eventListenerInactiveCb).not.toHaveBeenCalled(); expect(eventListenerInactiveUpdateCb).not.toHaveBeenCalled(); expect(otherEventListenerActiveCb).toHaveBeenCalledTimes(1); }); test('test dispatch-seption exeption', () => { expect(new EventException("test")).toEqual({message: "test", name: "EventException"}); });
howtoclient/react-evix
tests/event-control.test.js
JavaScript
mit
10,121