text:
package org.cavebeetle.blueprint;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import com.google.common.collect.Lists;

/**
 * The unit tests for {@code Misc}.
 */
public final class MiscTest
{
    // Misc#toLines
    /**
     * Tests that {@code Misc#toLines} works.
     */
    @Test
    public final void test_that_toLines_works()
    {
        final String text = "  \n    Hello\n  World\n";
        final List<String> result = Misc.toLines(text);
        assertEquals(2, result.size());
        assertEquals("  Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    // Misc#removeFirstEmptyAndLastEmptyLine
    /**
     * Tests that Misc#removeFirstEmptyAndLastEmptyLine handles {@code null} correctly.
     */
    @Test
    public final void test_that_removeFirstEmptyAndLastEmptyLine_handles_NULL_correctly()
    {
        try
        {
            Misc.removeFirstEmptyAndLastEmptyLine(null);
            fail("Expected a NullPointerException.");
        }
        catch (final NullPointerException e)
        {
            assertEquals("Missing 'lines'.", e.getMessage());
        }
    }

    /**
     * Tests that removing the first line of an empty list does nothing.
     */
    @Test
    public final void test_that_removing_the_first_line_of_an_empty_list_does_nothing()
    {
        final List<String> list = Collections.<String> emptyList();
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertTrue(result.isEmpty());
    }

    /**
     * Tests that removing the first line of a singleton list leaves an empty list.
     */
    @Test
    public final void test_that_removing_the_first_line_of_a_singleton_list_leaves_an_empty_list()
    {
        final List<String> list = Lists.newArrayList("");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertTrue(result.isEmpty());
    }

    /**
     * Tests that removing the first non empty line of a singleton list does nothing.
     */
    @Test
    public final void test_that_removing_the_non_empty_first_line_of_a_singleton_list_does_nothing()
    {
        final List<String> list = Lists.newArrayList("hello");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(1, result.size());
        assertSame(list.get(0), result.get(0));
    }

    /**
     * Tests that removing the first line works if it is a {@code null}.
     */
    @Test
    public final void test_that_removing_the_first_line_works_if_it_is_a_NULL()
    {
        final List<String> list = Lists.newArrayList(null, "Hello", "World");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(2, result.size());
        assertEquals("Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    /**
     * Tests that removing the first line works if it is a empty.
     */
    @Test
    public final void test_that_removing_the_first_line_works_if_it_is_empty()
    {
        final List<String> list = Lists.newArrayList("", "Hello", "World");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(2, result.size());
        assertEquals("Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    /**
     * Tests that removing the first line works if it is whitespace only.
     */
    @Test
    public final void test_that_removing_the_first_line_works_if_it_is_whitespace_only()
    {
        final List<String> list = Lists.newArrayList(" \t \f \n \r\n", "Hello", "World");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(2, result.size());
        assertEquals("Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    /**
     * Tests that removing the first line does nothing if it is not empty.
     */
    @Test
    public final void test_that_removing_the_first_line_does_nothing_if_it_is_not_empty()
    {
        final List<String> list = Lists.newArrayList("Hello", "World");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(2, result.size());
        assertEquals("Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    /**
     * Tests that removing the last line works if it is a {@code null}.
     */
    @Test
    public final void test_that_removing_the_last_line_works_if_it_is_a_NULL()
    {
        final List<String> list = Lists.newArrayList("Hello", "World", null);
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(2, result.size());
        assertEquals("Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    /**
     * Tests that removing the last line works if it is a empty.
     */
    @Test
    public final void test_that_removing_the_last_line_works_if_it_is_empty()
    {
        final List<String> list = Lists.newArrayList("Hello", "World", "");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(2, result.size());
        assertEquals("Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    /**
     * Tests that removing the last line works if it is whitespace only.
     */
    @Test
    public final void test_that_removing_the_last_line_works_if_it_is_whitespace_only()
    {
        final List<String> list = Lists.newArrayList("Hello", "World", " \t \f \n \f\n");
        final List<String> result = Misc.removeFirstEmptyAndLastEmptyLine(list);
        assertEquals(2, result.size());
        assertEquals("Hello", result.get(0));
        assertEquals("World", result.get(1));
    }

    // Misc#findSmallestIndentation
    /**
     * Tests that Misc#findSmallestIndentation handles {@code null} correctly.
     */
    @Test
    public final void test_that_findSmallestIndentation_handles_NULL_correctly()
    {
        try
        {
            Misc.findSmallestIndentation(null);
            fail("Expected a NullPointerException.");
        }
        catch (final NullPointerException e)
        {
            assertEquals("Missing 'lines'.", e.getMessage());
        }
    }

    /**
     * Tests that finding the smallest indentation in an empty list returns {@code 0}.
     */
    @Test
    public final void test_that_finding_the_smallest_indentation_in_an_empty_list_returns_0()
    {
        final List<String> emptyList = Collections.<String> emptyList();
        assertEquals(0, Misc.findSmallestIndentation(emptyList));
    }

    /**
     * Tests that finding the smallest indentation in a singleton list with an empty line works (zero).
     */
    @Test
    public final void test_that_finding_the_smallest_indentation_in_a_list_ignores_empty_lines()
    {
        final List<String> list = Lists.newArrayList(
                "",
                "\t",
                "    ");
        assertEquals(0, Misc.findSmallestIndentation(list));
    }

    /**
     * Tests that finding the smallest indentation in a singleton list works (zero).
     */
    @Test
    public final void test_that_finding_the_smallest_indentation_in_a_singleton_list_works_zero()
    {
        final List<String> list = Lists.newArrayList("Hello world!");
        assertEquals(0, Misc.findSmallestIndentation(list));
    }

    /**
     * Tests that finding the smallest indentation in a singleton list works (four).
     */
    @Test
    public final void test_that_finding_the_smallest_indentation_in_a_singleton_list_works_four()
    {
        final List<String> list = Lists.newArrayList("    Hello world!");
        assertEquals(4, Misc.findSmallestIndentation(list));
    }

    /**
     * Tests that finding the smallest indentation in a list works (zero).
     */
    @Test
    public final void test_that_finding_the_smallest_indentation_in_a_list_works_zero()
    {
        final List<String> list = Lists.newArrayList(
                "Hello",
                "world!");
        assertEquals(0, Misc.findSmallestIndentation(list));
    }

    /**
     * Tests that finding the smallest indentation in a list works (largest first).
     */
    @Test
    public final void test_that_finding_the_smallest_indentation_in_a_list_works_largest_first()
    {
        final List<String> list = Lists.newArrayList(
                "    Hello ",
                "  world!");
        assertEquals(2, Misc.findSmallestIndentation(list));
    }

    /**
     * Tests that finding the smallest indentation in a list works (smallest first).
     */
    @Test
    public final void test_that_finding_the_smallest_indentation_in_a_list_works_smallest_first()
    {
        final List<String> list = Lists.newArrayList(
                "  Hello ",
                "    world!");
        assertEquals(2, Misc.findSmallestIndentation(list));
    }

    // Misc#removeCommonIndentationAndTrailingWhitespace
    /**
     * Tests that {@code Misc#removeCommonIndentationAndTrailingWhitespace} handles {@code null} correctly.
     */
    @Test
    public final void test_that_removeCommonIndentationAndTrailingWhitespace_handles_NULL_correctly()
    {
        try
        {
            Misc.removeCommonIndentationAndTrailingWhitespace(null);
            fail("Expected a NullPointerException.");
        }
        catch (final NullPointerException e)
        {
            assertEquals("Missing 'lines'.", e.getMessage());
        }
    }

    /**
     * Tests that removing common indentation from an empty list does not change the list.
     */
    @Test
    public final void test_that_removing_common_indentation_from_an_empty_list_does_not_change_the_list()
    {
        final List<String> lines = Collections.<String> emptyList();
        Misc.removeCommonIndentationAndTrailingWhitespace(lines);
        assertTrue(lines.isEmpty());
    }

    /**
     * Tests that removing common indentation works.
     */
    @Test
    public final void test_that_removing_common_indentation_works()
    {
        final List<String> lines = Lists.newArrayList(
                "    Hello",
                "  World",
                "",
                "  !!!");
        final List<String> result = Misc.removeCommonIndentationAndTrailingWhitespace(lines);
        assertEquals(4, result.size());
        assertEquals("  Hello", result.get(0));
        assertEquals("World", result.get(1));
        assertEquals("", result.get(2));
        assertEquals("!!!", result.get(3));
    }

    // Misc#constructor
    /**
     * Calls the default constructor to satisfy code coverage.
     */
    @Test
    public final void includeDefaultConstructor()
    {
        new Misc();
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/api.css" />

<title>IFilter</title>

Yii Framework v1.1.7 Class Reference

IFilter

All Packages
| Methods

<colgroup>
	<col class="col-name" />
	<col class="col-value" />
</colgroup>

  Package
  system.base

  Inheritance
  interface IFilter

  Subclasses
  CAccessControlFilter, CContentDecorator, CFilter, CFilterWidget, CHtmlPurifier, CInlineFilter, CMarkdown, COutputCache, COutputProcessor, CTextHighlighter

  Since
  1.0

  Version
  $Id: interfaces.php 3058 2011-03-13 04:20:12Z qiang.xue $

  Source Code
  framework/base/interfaces.php

IFilter is the interface that must be implemented by action filters.

Public Methods

Hide inherited methods

<colgroup>
	<col class="col-method" />
	<col class="col-description" />
	<col class="col-defined" />
</colgroup>

  Method	Description	Defined By

  filter()
  Performs the filtering.
  IFilter

Method Details

filter()

method

abstract public void filter(CFilterChain $filterChain)

  $filterChain
  CFilterChain
  the filter chain that the filter is on.

Source Code: framework/base/interfaces.php#169 (show)

public function filter($filterChain);

Performs the filtering.
This method should be implemented to perform actual filtering.
If the filter wants to continue the action execution, it should call
$filterChain->run().

Copyright © 2008-2011 by Yii Software LLC

All Rights Reserved.

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Matsush. Mycol. Mem. 5: 13 (1987)

#### Original name
Irpicomyces bambusicola Matsush., 1980

### Remarks
null


text:
"""
Class 2, Exercise 1c
"""
def printhello():
    """
    my_func module
    This function prints 'hello'
    """
    print 'hello'


text:
const FerryExpense = require('../../../../../app/services/domain/expenses/ferry-expense')
const expect = require('chai').expect

describe('services/domain/expenses/ferry-expense', function () {
  const VALID_COST = '20'
  const VALID_FROM = 'some from'
  const VALID_TO = 'some to'
  const VALID_IS_RETURN = 'yes'
  const VALID_TICKET_TYPE = 'car passenger'
  const VALID_TICKET_OWNER = 'escort'
  const INVALID_COST = '0'

  it('should construct a domain object given valid input', function () {
    const expense = new FerryExpense(
      VALID_COST,
      VALID_FROM,
      VALID_TO,
      VALID_IS_RETURN,
      VALID_TICKET_TYPE,
      VALID_TICKET_OWNER
    )
    expect(expense.cost).to.equal(VALID_COST)
    expect(expense.from).to.equal(VALID_FROM)
    expect(expense.to).to.equal(VALID_TO)
    expect(expense.isReturn).to.equal(VALID_IS_RETURN)
    expect(expense.ticketType).to.equal(VALID_TICKET_TYPE)
    expect(expense.ticketOwner).to.equal(VALID_TICKET_OWNER)
  })

  it('should throw an error if passed invalid data', function () {
    expect(function () {
      new FerryExpense(
        INVALID_COST,
        VALID_FROM,
        VALID_TO,
        VALID_IS_RETURN,
        VALID_TICKET_TYPE,
        VALID_TICKET_OWNER
      ).isValid()
    }).to.throw()
  })
})


text:
using System;
using System.IO;
using System.Xml;
using Cuemon.Xml.Serialization.Converters;

namespace Cuemon.Xml.Serialization
{
    /// <summary>
    /// Serializes and deserializes objects into and from the XML format.
    /// </summary>
    public class XmlSerializer
    {
        /// <summary>
        /// Creates a new <see cref="XmlSerializer"/> instance using the specified <see cref="XmlSerializerOptions"/>.
        /// </summary>
        /// <param name="settings">The settings to be applied to the <see cref="XmlSerializer"/>.</param>
        /// <returns>
        /// A new <see cref="XmlSerializer"/> instance using the specified <see cref="XmlSerializerOptions"/>.
        /// </returns>
        /// <remarks>If <paramref name="settings"/> is <c>null</c>, <see cref="XmlConvert.DefaultSettings"/> is tried invoked. Otherwise, as a fallback, a default instance of <seealso cref="XmlSerializerOptions"/> is created.</remarks>
        public static XmlSerializer Create(XmlSerializerOptions settings)
        {
            var defaultSetup = settings ?? XmlConvert.DefaultSettings?.Invoke();
            return new XmlSerializer(defaultSetup ?? new XmlSerializerOptions());
        }

        /// <summary>
        /// Serializes the specified <paramref name="value"/> to a <see cref="Stream" />.
        /// </summary>
        /// <param name="value">The object to serialize to XML format.</param>
        /// <param name="objectType">The type of the object to serialize.</param>
        /// <returns>A stream of the serialized object.</returns>
        public Stream Serialize(object value, Type objectType)
        {
            return XmlStreamFactory.CreateStream(writer =>
            {
                Serialize(writer, value, objectType);
            }, settings =>
            {
                settings.Encoding = Settings.Writer.Encoding;
                settings.OmitXmlDeclaration = Settings.Writer.OmitXmlDeclaration;
                settings.CheckCharacters = Settings.Writer.CheckCharacters;
                settings.CloseOutput = Settings.Writer.CloseOutput;
                settings.ConformanceLevel = Settings.Writer.ConformanceLevel;
                settings.Indent = Settings.Writer.Indent;
                settings.IndentChars = Settings.Writer.IndentChars;
                settings.NamespaceHandling = Settings.Writer.NamespaceHandling;
                settings.NewLineChars = Settings.Writer.NewLineChars;
                settings.NewLineHandling = Settings.Writer.NewLineHandling;
                settings.NewLineOnAttributes = Settings.Writer.NewLineOnAttributes;
                settings.WriteEndDocumentOnClose = Settings.Writer.WriteEndDocumentOnClose;
                settings.Async = Settings.Writer.Async;
            });
        }

        internal void Serialize(XmlWriter writer, object value, Type objectType)
        {
            GetWriterConverter(objectType).WriteXml(writer, value);
        }

        /// <summary>
        /// Deserializes the specified <paramref name="value"/> into an object of <typeparamref name="T"/>.
        /// </summary>
        /// <typeparam name="T">The type of the object to deserialize.</typeparam>
        /// <param name="value">The object to deserialize from XML format.</param>
        /// <returns>An object of <typeparamref name="T"/>.</returns>
        public T Deserialize<T>(Stream value)
        {
            return (T)Deserialize(value, typeof(T));
        }

        /// <summary>
        /// Deserializes the specified <paramref name="value" /> into an object of <paramref name="objectType"/>.
        /// </summary>
        /// <param name="value">The object to deserialize from XML format.</param>
        /// <param name="objectType">The type of the object to deserialize.</param>
        /// <returns>An object of <paramref name="objectType"/>.</returns>
        public object Deserialize(Stream value, Type objectType)
        {
            using (var reader = Decorator.Enclose(value).ToXmlReader(null, settings =>
            {
                settings.ConformanceLevel = Settings.Reader.ConformanceLevel;
                settings.IgnoreComments = Settings.Reader.IgnoreComments;
                settings.IgnoreProcessingInstructions = Settings.Reader.IgnoreProcessingInstructions;
                settings.IgnoreWhitespace = Settings.Reader.IgnoreWhitespace;
                settings.LineNumberOffset = Settings.Reader.LineNumberOffset;
                settings.LinePositionOffset = Settings.Reader.LinePositionOffset;
                settings.MaxCharactersFromEntities = Settings.Reader.MaxCharactersFromEntities;
                settings.MaxCharactersInDocument = Settings.Reader.MaxCharactersInDocument;
                settings.NameTable = Settings.Reader.NameTable;
                settings.Async = Settings.Reader.Async;
                settings.DtdProcessing = Settings.Reader.DtdProcessing;
                settings.CloseInput = Settings.Reader.CloseInput;
                settings.CheckCharacters = Settings.Reader.CheckCharacters;
            }))
            {
                return Deserialize(reader, objectType);
            }
        }

        private object Deserialize(XmlReader reader, Type objectType)
        {
            return GetReaderConverter(objectType).ReadXml(reader, objectType);
        }

        private XmlSerializer(XmlSerializerOptions settings)
        {
            Settings = settings ?? new XmlSerializerOptions();
        }

        internal XmlSerializerOptions Settings { get; }

        internal XmlConverter GetReaderConverter(Type objectType)
        {
            var converter = Decorator.Enclose(Settings.Converters).FirstOrDefaultReaderConverter(objectType);
            return converter ?? new DefaultXmlConverter(Settings.RootName, Settings.Converters);
        }

        internal XmlConverter GetWriterConverter(Type objectType)
        {
            var converter = Decorator.Enclose(Settings.Converters).FirstOrDefaultWriterConverter(objectType);
            if (converter is DynamicXmlConverterCore dc)
            {
                if (Settings.RootName != null && dc.RootName == null) { dc.RootName = Settings.RootName; }
                return dc;
            }
            return converter ?? new DefaultXmlConverter(Settings.RootName, Settings.Converters);
        }
    }
}


text:
package com.linkedin.thirdeye.impl.storage;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.linkedin.thirdeye.api.MetricSchema;
import com.linkedin.thirdeye.api.MetricSpec;
import com.linkedin.thirdeye.api.MetricTimeSeries;
import com.linkedin.thirdeye.api.StarTreeConfig;
import com.linkedin.thirdeye.api.TimeRange;
import com.linkedin.thirdeye.impl.NumberUtils;
import com.linkedin.thirdeye.impl.StarTreeImpl;

public class MetricStoreImmutableImpl implements MetricStore, MetricStoreListener
{
  private static final Logger LOGGER = LoggerFactory.getLogger(MetricStoreImmutableImpl.class);

  private static final TimeRange EMPTY_TIME_RANGE = new TimeRange(-1L, -1L);

  private final StarTreeConfig config;
  private final MetricSchema metricSchema;

  private ConcurrentMap<TimeRange, List<ByteBuffer>> buffers;
  private final AtomicReference<TimeRange> minTime;
  private final AtomicReference<TimeRange> maxTime;
  private ConcurrentMap<TimeRange, Integer> timeRangeCount;

  private int sizePerEntry;
  private boolean useBinarySearch = false;;

  public MetricStoreImmutableImpl(StarTreeConfig config,
      ConcurrentMap<TimeRange, List<ByteBuffer>> buffers)
  {
    this.config = config;
    this.buffers = buffers;
    this.metricSchema = MetricSchema.fromMetricSpecs(config.getMetrics());
    this.minTime = new AtomicReference<TimeRange>(EMPTY_TIME_RANGE);
    this.maxTime = new AtomicReference<TimeRange>(EMPTY_TIME_RANGE);
    this.timeRangeCount = new ConcurrentHashMap<>();

    if (!buffers.isEmpty())
    {
      minTime.set(Collections.min(buffers.keySet()));
      maxTime.set(Collections.max(buffers.keySet()));
    }
    // bytes required to store one time value (long and all the metrics)
    sizePerEntry = (Long.SIZE / 8 + metricSchema.getRowSizeInBytes());
  }

  @Override
  public void update(int id, MetricTimeSeries timeSeries)
  {
    throw new UnsupportedOperationException("update not supported on immutable store");
  }

  @Override
  public void clear()
  {
    throw new UnsupportedOperationException("clear not supported on immutable store");
  }

  @Override
  public MetricTimeSeries getTimeSeries(List<Integer> logicalOffsets, TimeRange timeRange)
  {
    MetricTimeSeries timeSeries = new MetricTimeSeries(metricSchema);

    Set<Long> times = getTimes(timeRange);
    Collections.sort(logicalOffsets);
    for (Map.Entry<TimeRange, List<ByteBuffer>> entry : buffers.entrySet())
    {
      TimeRange bufferTimeRange = entry.getKey();
      if (bufferTimeRange.getStart() >= 0
          && (timeRange == null || !bufferTimeRange.isDisjoint(timeRange)))
      {
        for (ByteBuffer originalBuffer : entry.getValue())
        {
          ByteBuffer buffer = originalBuffer.duplicate();
          computeAggregateTimeSeries(logicalOffsets, timeRange, timeSeries, times, buffer);
        }
      }
    }

    return timeSeries;
  }

  private void computeAggregateTimeSeries(List<Integer> logicalOffsets, TimeRange timeRange,
      MetricTimeSeries timeSeries, Set<Long> times, ByteBuffer buffer)
  {
    buffer.rewind();
    for (Integer logicalOffset : logicalOffsets)
    {
      buffer.position(logicalOffset * (4 + 4));
      int startOffset = buffer.getInt();
      int length = buffer.getInt();
      if (length == 0)
      {
        continue;
      }
      buffer.position(startOffset);
      long minTime = buffer.getLong();
      int middle = 0;
      long timeRangeStartValue = timeRange.getStart();
      if (useBinarySearch)
      {
        middle = findStartIndex(buffer, startOffset, length, minTime, timeRangeStartValue);
      }
      if (middle == -1)
      {
        continue;
      }
      for (int i = middle; i < length; i++)
      {
        buffer.position(startOffset + (i * sizePerEntry));
        Long time = buffer.getLong();
        if (times.contains(time))
        {
          for (MetricSpec metricSpec : config.getMetrics())
          {
            Number value = NumberUtils.readFromBuffer(buffer, metricSpec.getType());
            timeSeries.increment(time, metricSpec.getName(), value);
          }
        }
        // since the times in buffer are sorted, if the time is greater the end of TimeRange
        // break
        if (time >= timeRange.getEnd())
        {
          break;
        }
      }
    }
  }

  private int findStartIndex(ByteBuffer buffer, int startOffset, int length, long minTime,
      long timeRangeStartValue)
  {
    int middle = -1;
    if (minTime >= timeRangeStartValue)
    {
      middle = 0;
    } else
    {
      // do a binary search to find the start Index
      int low = 0;
      int high = length - 1;
      boolean found = false;
      while (low <= high)
      {
        middle = (low + high) / 2;
        buffer.position(startOffset + (middle * sizePerEntry));
        final long midValue = buffer.getLong();
        if (timeRangeStartValue > midValue)
        {
          low = middle + 1;
        } else if (timeRangeStartValue < midValue)
        {
          high = middle - 1;
        } else
        {
          found = true;
          break;
        }
      }
    }
    return middle;
  }

  @Override
  public Long getMinTime()
  {
    return minTime.get().getStart();
  }

  @Override
  public Long getMaxTime()
  {
    return maxTime.get().getEnd();
  }

  @Override
  public Map<TimeRange, Integer> getTimeRangeCount()
  {

    for (Map.Entry<TimeRange, List<ByteBuffer>> entry : buffers.entrySet())
    {
      timeRangeCount.put(entry.getKey(), entry.getValue().size());
    }
    return timeRangeCount;
  }

  @Override
  public void notifyDelete(TimeRange timeRange)
  {
    Set<TimeRange> timeRanges = new HashSet<TimeRange>(buffers.keySet());
    timeRanges.remove(timeRange);
    this.minTime.set(timeRanges.isEmpty() ? EMPTY_TIME_RANGE : Collections.min(timeRanges));
    this.maxTime.set(timeRanges.isEmpty() ? EMPTY_TIME_RANGE : Collections.max(timeRanges));
    this.buffers.remove(timeRange);
  }

  @Override
  public void notifyCreate(TimeRange timeRange, ByteBuffer buffer)
  {
    this.buffers.putIfAbsent(timeRange, new CopyOnWriteArrayList<ByteBuffer>());
    this.buffers.get(timeRange).add(buffer);
    this.minTime.set(Collections.min(buffers.keySet()));
    this.maxTime.set(Collections.max(buffers.keySet()));
  }

  private Set<Long> getTimes(TimeRange timeRange)
  {
    if (timeRange != null)
    {
      Set<Long> times = new HashSet<Long>();
      for (long i = timeRange.getStart(); i <= timeRange.getEnd(); i++)
      {
        times.add(i);
      }
      return times;
    } else
    {
      Set<Long> times = new HashSet<Long>();
      for (long i = getMinTime(); i <= getMaxTime(); i++)
      {
        times.add(i);
      }
      return times;
    }
  }

}


text:
/*
* Furniture Node Dependencies:
* Node Tool Tip, Furniture Resize Adornment Template, Furniture Rotate Adornment Template, Invert Color
*/

// Node Tool Tip
function makeNodeToolTip() {
    var $ = go.GraphObject.make;
    return $(go.Adornment, "Auto",
            $(go.Shape, { fill: "#FFFFCC" }),
            $(go.TextBlock, { margin: 4 },
            new go.Binding("text", "", function (text, obj) {
                var data = obj.part.adornedObject.data;
                var name = (obj.part.adornedObject.category === "MultiPurposeNode") ? data.text : data.caption;
                return "Name: " + name + "\nNotes: " + data.notes;
            }).ofObject())
        )
}

// Furniture Resize Adornment
function makeFurnitureResizeAdornmentTemplate() {
    var $ = go.GraphObject.make;
    function makeHandle(alignment, cursor) {
        return $(go.Shape, { alignment: alignment, cursor: cursor, figure: "Rectangle", desiredSize: new go.Size(7, 7), fill: "#ffffff", stroke: "#808080" },
            new go.Binding("fill", "color"),
            new go.Binding("stroke", "stroke"));
    }

    return $(go.Adornment, "Spot", { locationSpot: go.Spot.Center },
      $(go.Placeholder),
      makeHandle(go.Spot.Top, "n-resize"),
      makeHandle(go.Spot.TopRight, "n-resize"),
      makeHandle(go.Spot.BottomRight, "se-resize"),
      makeHandle(go.Spot.Right, "e-resize"),
      makeHandle(go.Spot.Bottom, "s-resize"),
      makeHandle(go.Spot.BottomLeft, "sw-resize"),
      makeHandle(go.Spot.Left, "w-resize"),
      makeHandle(go.Spot.TopLeft, "nw-resize")
    );
}

// Furniture Rotate Adornment
function makeFurnitureRotateAdornmentTemplate() {
    var $ = go.GraphObject.make;
    return $(go.Adornment, { locationSpot: go.Spot.Center, locationObjectName: "CIRCLE" },
        $(go.Shape, "Circle", { name: "CIRCLE", cursor: "pointer", desiredSize: new go.Size(7, 7), fill: "#ffffff", stroke: "#808080" },
        new go.Binding("fill", "", function (obj) { return (obj.adornedPart === null) ? "#ffffff" : obj.adornedPart.data.color; }).ofObject(),
        new go.Binding("stroke", "", function (obj) { return (obj.adornedPart === null) ? "#000000" : obj.adornedPart.data.stroke; }).ofObject())
        );
}

// Return inverted color (in hex) of a given hex code color; used to determine furniture node stroke color
function invertColor(hexnum) {
    if (hexnum.includes('#')) hexnum = hexnum.substring(1);
    if (hexnum.length != 6) {
        console.error("Hex color must be six hex numbers in length.");
        return false;
    }

    hexnum = hexnum.toUpperCase();
    var splitnum = hexnum.split("");
    var resultnum = "";
    var simplenum = "FEDCBA9876".split("");
    var complexnum = new Array();
    complexnum.A = "5";
    complexnum.B = "4";
    complexnum.C = "3";
    complexnum.D = "2";
    complexnum.E = "1";
    complexnum.F = "0";

    for (i = 0; i < 6; i++) {
        if (!isNaN(splitnum[i])) {
            resultnum += simplenum[splitnum[i]];
        } else if (complexnum[splitnum[i]]) {
            resultnum += complexnum[splitnum[i]];
        } else {
            console.error("Hex colors must only include hex numbers 0-9, and A-F");
            return false;
        }
    }
    return '#' + resultnum;
}

/*
* Furniture Node Templates:
* Default Node, MultiPurpose Node
*/

// Default Node
function makeDefaultNode() {
    var $ = go.GraphObject.make;
    return $(go.Node, "Spot",
    {
        resizable: true,
        rotatable: true,
        toolTip: makeNodeToolTip(),
        resizeAdornmentTemplate: makeFurnitureResizeAdornmentTemplate(),
        rotateAdornmentTemplate: makeFurnitureRotateAdornmentTemplate(),
        contextMenu: makeContextMenu(),
        locationObjectName: "SHAPE",
        resizeObjectName: "SHAPE",
        rotateObjectName: "SHAPE",
        minSize: new go.Size(5, 5),
        locationSpot: go.Spot.Center,
        selectionAdorned: false,  // use a Binding on the Shape.stroke to show selection
        doubleClick: function (e) {
            if (e.diagram.floorplanUI) e.diagram.floorplanUI.hideShow("selectionInfoWindow")
        }
    },
    // remember Node location
    new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
    // move selected Node to Foreground layer so it's not obscuerd by non-selected Parts
    new go.Binding("layerName", "isSelected", function (s) {
        return s ? "Foreground" : "";
    }).ofObject(),
    $(go.Shape,
    {
        strokeWidth: 1,
        name: "SHAPE",
        stroke: "#000000",
        geometryString: "F1 M0 0 L20 0 20 20 0 20 z",
        fill: "rgba(128, 128, 128, 0.5)"
    },
    new go.Binding("geometryString", "geo"),
    new go.Binding("width", "width").makeTwoWay(),
    new go.Binding("height", "height").makeTwoWay(),
    new go.Binding("angle", "angle").makeTwoWay(),
    new go.Binding("figure", "shape").makeTwoWay(),
    new go.Binding("stroke", "isSelected", function (s, obj) {
        return s ? go.Brush.lightenBy(obj.stroke, .5) : invertColor(obj.part.data.color);
    }).ofObject(),
    new go.Binding("fill", "color"))
  )
}

// MultiPurpose Node
function makeMultiPurposeNode() {
    var $ = go.GraphObject.make;
    return $(go.Node, "Spot",
      {
          contextMenu: makeContextMenu(),
          toolTip: makeNodeToolTip(),
          locationSpot: go.Spot.Center,
          resizeAdornmentTemplate: makeFurnitureResizeAdornmentTemplate(),
          rotateAdornmentTemplate: makeFurnitureRotateAdornmentTemplate(),
          locationObjectName: "SHAPE",
          resizable: true,
          rotatable: true,
          resizeObjectName: "SHAPE",
          rotateObjectName: "SHAPE",
          minSize: new go.Size(5, 5),
          selectionAdorned: false,
          doubleClick: function (e) {
              if (e.diagram.floorplanUI) e.diagram.floorplanUI.hideShow("selectionInfoWindow")
          }
      },
      // remember location, angle, height, and width of the node
      new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      // move a selected part into the Foreground layer so it's not obscuerd by non-selected Parts
      new go.Binding("layerName", "isSelected", function (s) { return s ? "Foreground" : ""; }).ofObject(),
      $(go.Shape,
      { strokeWidth: 1, name: "SHAPE", fill: "rgba(128, 128, 128, 0.5)", },
      new go.Binding("angle", "angle").makeTwoWay(),
      new go.Binding("width", "width").makeTwoWay(),
      new go.Binding("height", "height").makeTwoWay(),
      new go.Binding("stroke", "isSelected", function (s, obj) {
          return s ? go.Brush.lightenBy(obj.stroke, .5) : invertColor(obj.part.data.color);
      }).ofObject(),
      new go.Binding("fill", "color")),
      $(go.TextBlock,
      {
          margin: 5,
          wrap: go.TextBlock.WrapFit,
          textAlign: "center",
          editable: true,
          isMultiline: false,
          stroke: '#454545',
          font: "10pt sans-serif"
      },
      new go.Binding("text").makeTwoWay(),
      new go.Binding("angle", "angle").makeTwoWay(),
      new go.Binding("font", "height", function (height) {
          if (height > 25) return "10pt sans-serif";
          if (height < 25 && height > 15) return "8pt sans-serif";
          else return "6pt sans-serif";
      }),
      new go.Binding("stroke", "color", function (color) { return invertColor(color); })
      )
    )
}


text:
    Select

  <select ref="selectContainer" multiple name="data[select]" type="text" class="form-control" lang="en" id="select-select" aria-required="false"></select>
  <input type="text" class="formio-select-autocomplete-input" ref="autocompleteInput" tabindex="-1" aria-label="autocomplete" />


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

$lang['pagination_first_link'] = '‹ В начало';
$lang['pagination_next_link'] = '>';
$lang['pagination_prev_link'] = '<';
$lang['pagination_last_link'] = 'В конец ›';

/* End of file pagination_lang.php */
/* Location: ./application/language/russian/pagination_lang.php */


text:
Alertables = (function() {
  var alertablesModule = {};

  alertablesModule.signUp = function (email, fullName, password) {
    var them = [{
      value: email, pattern: ValidEmail,
      alert: {message: "Your email doesn't look right"}
    },{
      value: fullName, pattern: NonEmptyString,
      alert: {message: "Please put in your name"}
    }];

    if (password !== undefined) {
      them.push({
        value: password, pattern: ValidPassword,
        alert: {message: "Password must be at least 6 characters"}
      });
    }
    return them;
  };

  alertablesModule.signIn = function (email, password) {
    return [{
      value: email, pattern: ValidEmail,
      alert: {message: "Your email doesn't look right"}
    },{
      value: password, pattern: NonEmptyString,
      alert: {message: "Enter your password to sign in"}
    }];
  };

  alertablesModule.inviteFriends = function (friends) {
    return [{
      value: friends, pattern: [{name: NonEmptyString,
                                 email: ValidEmail}],
      alert: {message: "A friend's email either doesn't look right "
              + "or needs a name to go with it"}
    }];
  };

  alertablesModule.comment = function (comment) {
    return [{value: comment, pattern: NonEmptyString,
             alert: {message: "Your comment must have value"}}];
  };

  return alertablesModule;
})();


text:
@interface BaseTextField ()

@end

@implementation BaseTextField

@synthesize isRequired = _isRequired;

- (void)dealloc {

    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (id)initWithCoder:(NSCoder *)aDecoder {

    self = [super initWithCoder:aDecoder];

    if (self) {

        [self customize];
    }
    return self;
}

#pragma mark - Public -

- (void)setPosition:(TextFieldPosition)position {

    _position = position;

    switch (position) {

        case kTextFieldPositionIsSingle:

            _hasTopSeparatorLine = YES;
            _hasBottomSeparatorLine = YES;

            break;

        case kTextFieldPositionIsFirst:

            _hasTopSeparatorLine = YES;

            break;

        case kTextFieldPositionIsMiddle:

            _hasMiddleSeparatorLine = YES;

            break;

        case kTextFieldPositionIsLast:

            _hasMiddleSeparatorLine = YES;
            _hasBottomSeparatorLine = YES;

            break;
    }
}

- (void)setFieldState:(TextFieldStateType)fieldState {

    _fieldState = fieldState;

    switch (fieldState) {

        case kTextFieldStateNormal:
            [self setStyleNormal];
            break;

        case kTextFieldStateValueMissing:
            [self setStyleValueMissing];
            break;
    }
}

#pragma mark - Overwritten methods

#pragma mark Main Rects

- (void)layoutSubviews {

    [super layoutSubviews];

    if (!_separatorsAlreadyAdded) {

        if (_hasTopSeparatorLine) {

            [self addTopSeparatorLine];
        }

        if (_hasMiddleSeparatorLine) {

            [self addMiddleSeparatorLine];
        }

        if (_hasBottomSeparatorLine) {

            [self addBottomSeparatorLine];
        }
    }
}

- (CGRect)clearButtonRectForBounds:(CGRect)bounds {

    CGRect clearButtonRect = [super clearButtonRectForBounds:bounds];
    clearButtonRect.origin.y = self.frame.size.height / 2 - clearButtonRect.size.height / 2;

    return clearButtonRect;
}

- (CGRect)placeholderRectForBounds:(CGRect)bounds {

    // You can control how much to move placeholder down and right if it's too high/left
    CGFloat placeholderOriginXFix = self.textOffset.x;
    CGFloat placeholderOriginYFix = self.textOffset.y;

    CGRect placeholderBounds = bounds;
    placeholderBounds.origin.y = self.frame.size.height / 2 - placeholderBounds.size.height / 2 + placeholderOriginYFix;
    placeholderBounds.origin.x += placeholderOriginXFix;

    return placeholderBounds;
}

- (CGRect)textRectForBounds:(CGRect)bounds {

    CGRect editedBounds = bounds;
    editedBounds.origin.x += self.textOffset.x;
    editedBounds.origin.y += self.textOffset.y;

    return editedBounds;
}

- (CGRect)editingRectForBounds:(CGRect)bounds {

    CGRect editedBounds = bounds;
    editedBounds.origin.x += self.textOffsetWhileEditing.x;
    editedBounds.origin.y += self.textOffsetWhileEditing.y;

    // Reduce width of text field editable area if clear button is shown, in order to overlap text with clear button
    if (self.clearButtonMode != UITextFieldViewModeNever) {

        editedBounds.size.width -= (self.textOffsetWhileEditing.x + self.textClearButtonSizeWhileEditing.width);
    }

    return editedBounds;
}

- (UIEdgeInsets)outsidePadding {

    return UIEdgeInsetsMake(5, 0, 5, 0);
}

- (UIEdgeInsets)insidePadding {

    CGFloat extraSizeToCompensateTooSmallHeight = 2;

    return UIEdgeInsetsMake(6 + extraSizeToCompensateTooSmallHeight, 0, 6 + extraSizeToCompensateTooSmallHeight, 0);
}

#pragma mark Other

- (void)setEnabled:(BOOL)enabled {

    // UI consistency: use the same text colors for all inputs
    [super setEnabled:enabled];

    self.textColor = enabled ? [UIColor darkGrayColor]:[UIColor lightGrayColor];
}

- (void)setText:(NSString *)text {

    [super setText:text];

    if (self.fieldState == kTextFieldStateValueMissing && text.length > 0) {
        self.fieldState = kTextFieldStateNormal;
    }
}

- (void)setPlaceholder:(NSString *)placeholder {

    [super setPlaceholder:placeholder];

    // Re'apply placeholder style
    [self setCommonStyle];
}

#pragma mark - Protected -

- (CGSize)intrinsicContentSize {

    // Height doesnt' matter because TextField is single line control
    CGSize size = [@"Text" sizeWithAttributes:@{NSFontAttributeName:self.font}];

    CGSize resultSize = CGSizeMake(size.width + self.insidePadding.left + self.insidePadding.right + self.outsidePadding.left + self.outsidePadding.right,
                                   size.height + self.insidePadding.top + self.insidePadding.bottom + self.outsidePadding.top + self.outsidePadding.bottom);

    return resultSize;
}

- (void)customize {

    [self setCommonStyle];
    [self customizeFloatingLabel];
    [self setStyleNormal];

    self.tintColor = self.textCursorColor;
    self.clearButtonMode = UITextFieldViewModeWhileEditing;

    // Add corner radius if defined
    if (self.borderCornerRadius) {

        self.layer.cornerRadius = self.borderCornerRadius;
        self.layer.masksToBounds = YES;
    }

    // Add border if defined
    if (self.borderWidth) {

        self.layer.borderColor = nil;//kTextFieldBorderColor;
        self.layer.borderWidth = self.borderWidth;
    }

    [self observeStateChanges];
}

#pragma mark Corners

- (CGFloat)borderCornerRadius {

    return 0.0f;
}

- (CGFloat)borderWidth {

    return 0.0f;
}

- (UIColor *)borderColor {

    return kColorGrayLight1;
}

#pragma mark Text

- (UIColor *)textBackgroundColor {

    return [UIColor clearColor];
}

- (UIColor *)textColor_ {

    return kColorGrayDark;
}

- (NSString *)textFont {

    return kFontNormal;
}

- (CGFloat)textSize {

    return 15.0f;
}

- (UIColor *)textCursorColor {

    return kColorGrayDark;
}

#pragma mark Text offsets

- (CGPoint)textOffset {

    return CGPointMake(12.0f, 5.0f);
}

- (CGPoint)textOffsetWhileEditing {

    return CGPointMake(12.0f, 5.0f);
}

- (CGSize)textClearButtonSizeWhileEditing {

    return CGSizeMake(20.0f, self.frame.size.height) ;
}

#pragma mark Placeholder

- (UIColor *)placeholderBackgroundColor {

    return [UIColor clearColor];
}

- (UIColor *)placeholderTextColor {

    return kColorGrayLight1;
}

- (UIColor *)placeholderTextColorWhileEditing {

    return kColorGreen;
}

- (NSString *)placeholderTextFont {

    return kFontNormal;
}

- (CGFloat)placeholderTextSize {

    return 12.0f;
}

- (CGFloat)placeholderTextOffsetY {

    return 5.0f;
}

- (CGFloat)separatorLineOffsetY {

    return 12.0f;
}

#pragma mark - Private -

- (void)setCommonStyle {

    self.backgroundColor = self.textBackgroundColor;

    // Check if empty
    if (!self.placeholder) {

        // Placeholder might not be set yet, but we need some not nil value in order to apply color
        self.placeholder = @" ";
    }

    self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder attributes:@{NSForegroundColorAttributeName:self.placeholderTextColor}];

    self.textColor = self.textColor_;
}

- (void)customizeFloatingLabel {

    self.floatingLabel.backgroundColor = self.placeholderBackgroundColor;
    self.floatingLabelActiveTextColor = self.placeholderTextColorWhileEditing;
    self.floatingLabelTextColor = self.placeholderTextColor;
    self.floatingLabelFont = [UIFont fontWithName:self.placeholderTextFont size:self.textSize];
    self.floatingLabelYPadding = self.placeholderTextOffsetY;
}

- (void)addTopSeparatorLine {

    // Add separator line
    SeparatorHorizontalLineView *lineView = [SeparatorHorizontalLineView autolayoutView];
     [lineView fitIntoContainerView:self color:nil alignTop:YES leftOffset:0 rightOffset:0];
     [self addSubview:lineView];
}

- (void)addMiddleSeparatorLine {

    // Add separator line
    SeparatorHorizontalLineView *lineView = [SeparatorHorizontalLineView autolayoutView];
     [lineView fitIntoContainerView:self color:nil alignTop:YES leftOffset:self.separatorLineOffsetY rightOffset:0];
     [self addSubview:lineView];
}

- (void)addBottomSeparatorLine {

    // Add separator line
    SeparatorHorizontalLineView *lineView = [SeparatorHorizontalLineView autolayoutView];
     [lineView fitIntoContainerView:self color:nil alignTop:NO leftOffset:0 rightOffset:0];
     [self addSubview:lineView];
}

- (void)observeStateChanges {

    [self addTarget:self action:@selector(textChanged:) forControlEvents:UIControlEventEditingChanged];
}

#pragma mark Style change handling

- (void)setStyleNormal {

    if (self.enabled) {

        self.textColor = self.textColor_;

        UIFont *font = [UIFont fontWithName:self.textFont size:self.textSize];
        self.font = font;

        // Apply color for placeholder if its not nil
        if (self.placeholder) {

            self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder attributes:@{NSForegroundColorAttributeName:self.placeholderTextColor, NSFontAttributeName:font}];
        }
    }
}

- (void)setStyleValueMissing {

    if (self.enabled) {

        self.textColor = kColorRed;
        // Apply color for placeholder if its not nil

        if (self.placeholder) {

            UIFont *font = [UIFont fontWithName:self.textFont size:self.textSize];

            self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder attributes:@{NSForegroundColorAttributeName:kColorRed, NSFontAttributeName:font}];
        }
    }
}

#pragma mark Change observation

- (void)validateValue {

    if (self.isRequired) {

        if (!self.text.length) {

            self.fieldState = kTextFieldStateValueMissing;
        }
    }
}

- (void)resetValidatedValues {

    self.fieldState = kTextFieldStateNormal;
}

- (void)textChanged:(UITextField *)textField {

    if (self.fieldState == kTextFieldStateValueMissing && textField.text.length > 0) {

        self.fieldState = kTextFieldStateNormal;
    }
}

@end


text:
#ifndef _HALDNAITERATOR_H
#define _HALDNAITERATOR_H
#include "halDefs.h"
#include "halDnaDriver.h"
#include "halGenome.h"

namespace hal {

    /**
     * Interface for general dna iterator
     */
    class DnaIterator {
      public:
        DnaIterator(Genome *genome, DnaAccessPtr dnaAccess, hal_index_t index)
            : _genome(genome), _dnaAccess(dnaAccess), _index(index), _reversed(false) {
        }

        /** Destructor */
        virtual ~DnaIterator() {
        }

        /** Ensure cache write data is flushed if needed.  This should be called
         * after a writing loop or an error will be generated.  This is not done
         * automatically on destruct, as error will be caught in DnaAccess.
         */
        void flush() {
            _dnaAccess->flush();
        }

        /** Get the DNA character at this position (if revsersed is set
        * the reverse compelement is returned */
        char getBase() const;

        /** Set the DNA character at this position (if revsersed is set
         * the reverse compelement is stored
         * @param c DNA character to set */
        void setBase(char c);

        /** Move to previous position (equiv. to toRight if reversed)*/
        void toLeft() {
            _reversed ? ++_index : --_index;
        }

        /** Move to next position (equiv. to toLeft if reversed)*/
        void toRight() {
            _reversed ? --_index : ++_index;
        }

        /** Jump to any point on the genome (can lead to
         * inefficient paging from disk if used irresponsibly)
         * @param index position in array to jump to */
        void jumpTo(hal_size_t index) {
            _index = index;
        }

        /** has the iterator reach the end of the traversal in the direction of
         * movement? */
        bool atEnd() const {
            if (not _reversed) {
                return _index >= (hal_index_t)_genome->getSequenceLength();
            } else {
                return _index < 0;
            }
        }

        /** switch to base's reverse complement */
        void toReverse() {
            _reversed = !_reversed;
        }

        /** Check whether iterator is on base's complement */
        bool getReversed() const {
            return _reversed;
        }

        /** Set the iterator's reverse complement status */
        void setReversed(bool reversed) {
            _reversed = reversed;
        }

        /** Get the containing (read-only) genome */
        const Genome *getGenome() const {
            return _genome;
        }

        /** Get the containing genome */
        Genome *getGenome() {
            return _genome;
        }

        /** Get the containing sequence */
        const Sequence *getSequence() const {
            return _genome->getSequenceBySite(_index);
        }

        /** Get the index of the base in the dna array */
        hal_index_t getArrayIndex() const {
            return _index;
        }

        /* read a DNA string */
        void readString(std::string &outString, hal_size_t length);

        /* write a DNA string */
        void writeString(const std::string &inString, hal_size_t length);

        /** Compare (array indexes) of two iterators */
        bool equals(DnaIteratorPtr &other) const;

        /** Compare (array indexes) of two iterators */
        bool leftOf(DnaIteratorPtr &other) const;

      private:
        bool inRange() const {
            return (_index >= 0) && (_index < (hal_index_t)_genome->getSequenceLength());
        }

        Genome *_genome;
        DnaAccessPtr _dnaAccess;
        hal_index_t _index;
        bool _reversed;
    };

    inline char DnaIterator::getBase() const {
        assert(inRange());
        char c = _dnaAccess->getBase(_index);
        if (_reversed) {
            c = reverseComplement(c);
        }
        return c;
    }

    inline void DnaIterator::setBase(char c) {
        if (not inRange()) {
            throw hal_exception("Trying to set character out of range");
        } else if (not isNucleotide(c)) {
            throw hal_exception(std::string("Trying to set invalid character: ") + c);
        }
        if (_reversed) {
            c = reverseComplement(c);
        }
        _dnaAccess->setBase(_index, c);
        assert(getBase() == !_reversed ? c : reverseComplement(c));
    }

    inline bool DnaIterator::equals(DnaIteratorPtr &other) const {
        const DnaIterator *mmOther = reinterpret_cast<const DnaIterator *>(other.get());
        assert(_genome == mmOther->_genome);
        return _index == mmOther->_index;
    }

    inline bool DnaIterator::leftOf(DnaIteratorPtr &other) const {
        const DnaIterator *mmOther = reinterpret_cast<const DnaIterator *>(other.get());
        assert(_genome == mmOther->_genome);
        return _index < mmOther->_index;
    }

    inline void DnaIterator::readString(std::string &outString, hal_size_t length) {
        assert(length == 0 || inRange() == true);
        outString.resize(length);

        for (hal_size_t i = 0; i < length; ++i) {
            outString[i] = getBase();
            toRight();
        }
    }

    inline void DnaIterator::writeString(const std::string &inString, hal_size_t length) {
        assert(length == 0 || inRange());
        for (hal_size_t i = 0; i < length; ++i) {
            setBase(inString[i]);
            toRight();
        }
        flush();
    }
}

#endif
// Local Variables:
// mode: c++
// End:


text:
<?xml version="1.0" encoding="utf-8"?>
<CrawlItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Text>Upravo dobili naruđbu a nema maslina, a naplaćene!</Text>
  <Rating>1</Rating>
  <Source>http://pauza.hr/menu/old-friends-pub</Source>
</CrawlItem>


text:
function squashTokens(tokens) {
    var squashedTokens = [];

    var token, lastToken;
    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
        token = tokens[i];

        if (token) {
            if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
                lastToken[1] += token[1];
                lastToken[3] = token[3];
            } else {
                squashedTokens.push(token);
                lastToken = token;
            }
        }
    }

    return squashedTokens;
}

function nestTokens(tokens) {
    var nestedTokens = [];
    var collector = nestedTokens;
    var sections = [];

    var token, section;
    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
        token = tokens[i];

        switch (token[0]) {
            case '#':
            case '^':
                collector.push(token);
                sections.push(token);
                collector = token[4] = [];
                break;
            case '/':
                section = sections.pop();
                section[5] = token[2];
                collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
                break;
            default:
                collector.push(token);
        }
    }

    return nestedTokens;
}


text:
package com.ociweb.grove;

import com.ociweb.iot.maker.*;

import static com.ociweb.iot.grove.simple_digital.SimpleDigitalTwig.*;
import static com.ociweb.iot.maker.Port.*;

public class IoTApp implements FogApp {

	public static final Port LED_PORT = D3;
	private int lightIntensity = 0;
	public static void main( String[] args) {
		FogRuntime.run(new IoTApp());
	}

	@Override
	public void declareConnections(Hardware hardware) {
		hardware.connect(LED, LED_PORT);
		hardware.setTimerPulseRate(50);
	}

	@Override
	public void declareBehavior(FogRuntime runtime) {
            runtime.registerListener(new VariableColorLEDBehavior(runtime));

	}
}


text:
@extends('layouts.master')

@section('content')

Detalles de la materia

Docente: {{ $group->teacher->user->name }}

Descripcion:
{!! $group->description !!}

Examenes de {{ $group->course->name }} Grupo {{ $group->nro }}

					@include('common.messages')
					@include('common.error')

							Descripcion
							Puntaje Examen
							Puntaje Ponderado
							Token Access

							Hora Inicio
							Hora Fin
							Estado
							Accion

							@foreach($exams as $exam)

									{{$exam->exam->title}}
									{{$exam->calification}}
									{{$exam->calification * $exam->exam->total / 100}}
									{{$exam->token_access}}
									{{$exam->start}}
									{{$exam->end}}
									@if($exam->pending == false)

											Terminado

									@else

											Pendiente

				id.'/exam/'.$exam->exam->id.'/eval/'.$exam->id) }}" class="btn  btn-xs bg-olive white">Iniciar Examen

									@endif

							@endforeach

@endsection


text: ActionController::Base.send :include, HttpTokenAuthentication::ControllerMethods


text:
(function() {
    'use strict';

    angular
        .module('congressApp')
        .controller('RegistrationController', RegistrationController);

    RegistrationController.$inject = ['$scope', '$timeout', 'RegistrationFactory'];
    function RegistrationController($scope, $timeout, RegistrationFactory) {
        $scope.typeInputPass = 'password';
        $scope.registrationOk = false;
        $scope.registrationError = false;
        $scope.groupError = false;
        $scope.emptyData = false;

        $scope.$watch('id', validate);
        $scope.$watch('pass', validate);
        $scope.$watch('name', validate);
        $scope.$watch('group', validate);
        $scope.$watch('email', validate);
        $scope.$watch('phone', validate);
        $scope.$watch('workplace', validate);;
        $scope.$watch('depositNumber', validate);
        $scope.$watch('informed.email', validate);
        $scope.$watch('informed.facebook', validate);
        $scope.$watch('informed.webSite', validate);
        $scope.$watch('informed.colleague', validate);
        $scope.$watch('informed.other', validate);
        $scope.$watch('population.elementary', validate);
        $scope.$watch('population.highSchool', validate);
        $scope.$watch('population.higherEducation', validate);
        $scope.$watch('population.other', validate);

        $scope.declare = declare;
        $scope.registration = registration;
        $scope.validateId = validateId;
        $scope.validateEmail = validateEmail;
        $scope.validateGroup = validateGroup;
		$scope.validatePhone = validatePhone;
        $scope.showPass = showPass;

        /*
        * Declares the variables.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function declare() {
            $scope.id = '';
            $scope.pass = '';
            $scope.name = '';
            $scope.group = 'General Public';
            $scope.email = '';
            $scope.phone = '';
            $scope.workplace = '';
            $scope.informed = {
                email: '',
                facebook: '',
                webSite: '',
                colleague: '',
                other: ''
            };
            $scope.academic = 'Student';
            $scope.population = {
                elementary: '',
                highSchool: '',
                higherEducation: '',
                other: ''
            };
            $scope.agreePay = false;
            $scope.agreeInfo = false;
        }

        declare();

        /*
        * Validates that the variables of the register doesn't empty.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function validate() {
            if (!$scope.id.length || !$scope.pass.length || !$scope.name.length || !$scope.group.length ||
                !$scope.email.length || !$scope.phone.length || !$scope.workplace.length || !($scope.informed.email.length ||
                    $scope.informed.facebook.length || $scope.informed.webSite.length || $scope.informed.colleague.length ||
                    $scope.informed.other.length) || !($scope.population.elementary.length ||
                    $scope.population.highSchool.length || $scope.population.higherEducation.length || $scope.population.other.length)) {
                $scope.emptyData = true;
            } else { // Habilita
                $scope.emptyData = false;
            }
        }

        /*
        * Concat the selected options for the user in informed variable.
        *
        * @param Nothing.
        * @return string All the options concatenated.
        */
        function concatInformed() {
            var string = '';
            var array = [$scope.informed.email, $scope.informed.facebook, $scope.informed.webSite,
                $scope.informed.colleague, $scope.informed.other
            ];

            array.forEach(function(value) {
                if (value !== '')
                    string += value + ', ';
            });

            return string.slice(0, string.length - 2);
        }

        /*
        * Concat the selected options for the user in population variable.
        *
        * @param Nothing.
        * @return string All the options concatenated.
        */
        function concatPopulation() {
            var string = '';
            var array = [$scope.population.elementary, $scope.population.highSchool,
                $scope.population.higherEducation, $scope.population.other
            ];

            array.forEach(function(value) {
                if (value !== '')
                    string += value + ', ';
            });

            return string.slice(0, string.length - 2);
        }

        /*
        * Decrements the capacity of a group.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function decrementCapacity() {
            var data = {
                action: "decrement",
                group: $scope.group
            };

            // Calls the decrement capacity method in the registration factory.
            RegistrationFactory.decrementCapacity(data)
            .then(function(response) {
                if (response == true) {
                    isThereCapacity();
                }
            });
        }

        /*
        * Register a new user in the database.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function registration() {
            $scope.registrationOk = false;
            $scope.registrationError = false;
            $scope.groupError = false;
            var data = {
                id: $scope.id,
                pass: calcMD5($scope.pass),
                fullName: $scope.name,
                regionGroup: $scope.group,
                email: $scope.email,
                phone: $scope.phone,
                workplace: $scope.workplace,
                informed: concatInformed(),
                academic: $scope.academic,
                population: concatPopulation(),
                type: "U",
                action: "insert"
            };

            // Calls the registration method in the registration factory.
            RegistrationFactory.registration(data)
            .then(function(response) {
                if (response == true) {
                    decrementCapacity();
                    $scope.registrationOk = true;
                    declare();

                    $timeout(function() {
                        $scope.registrationOk = false;
                    }, 5000);
                }
                else if(typeof(response) == 'string') {
                    $scope.registrationError = true;
                }
            });
        }

        /*
        * Validates an ID that doesn't exists.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function validateId() {
            $scope.errorId = false;
            var data = {
                action: "validateId",
                id: $scope.id
            };

            // Calls the validate ID method in the registration factory.
            RegistrationFactory.validateId(data)
            .then(function(response) {
                if(typeof(response) == 'string') {
                    $scope.errorId = true;
                    $scope.messageId = 'An unexpected error occurred while identification is validated. Please try again.';
                }
                else if (response[0]) {
                    $scope.errorId = true;
                    $scope.messageId = 'The identification is already registered.';
                }
            });
        }

        /*
        * Validates an a-mail address that doesn't exists and comply with the format.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function validateEmail() {
            $scope.errorEmail = false;
			if(!/^([\da-z_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/.test($scope.email)) {
				$scope.errorEmail = true;
                $scope.messageEmail = 'E-mail address has a wrong format.';
			}
			else {
				var data = {
					action: "validateEmail",
					email: $scope.email
				};

                // Calls the validate e-mail method in the registration factory.
                RegistrationFactory.validateEmail(data)
                .then(function(response) {
                    if(typeof(response) == 'string') {
                        $scope.errorEmail = true;
                        $scope.messageEmail = 'An unexpected error occurred while e-mail address is validated. Please try again.';
                    }
                    else if (response[0]) {
                        $scope.errorEmail = true;
                        $scope.messageEmail = 'E-mail address is already registered.';
                    }
                });
			}
        }

        /*
        * Validates that a group still have capacity and doen't empty.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function validateGroup() {
            $scope.errorGroup = false;

            if($scope.group !== '') {
                var data = {
                    action: "validateGroup",
                    group: $scope.group
                };

                // Calls the validate group method in the registration factory.
                RegistrationFactory.validateGroup(data)
                .then(function(response) {
                    if (typeof(response) == 'string') {
                        $scope.errorGroup = true;
                        $scope.messageGroup = 'An unexpected error occurred while group is validated. Please try again.';
                    }
                    else if (parseInt(response[0]) <= 0) {
                        $scope.errorGroup = true;
                        $scope.messageGroup = 'The selected group does not have capacity.';
                    }
                });
            }
        }

        /*
        * Validates that a phone number only have numbers.
        *
        * @param Nothing.
        * @return Nothing.
        */
		function validatePhone () {
			$scope.errorPhone = false;

			if(isNaN($scope.phone)) {
				$scope.errorPhone = true;
				$scope.messagePhone = "The phone number has a wrong format. It must be only numbers."
			}
		}

        /*
        * Shows and hides the password in the UI.
        *
        * @param Nothing.
        * @return Nothing.
        */
        function showPass() {
            if($scope.checkPass)
                $scope.typeInputPass = 'text';
            else
                $scope.typeInputPass = 'password';
        }

        /**
         * Get the capacity of a speccific group.
         */
        function isThereCapacity() {
            var data = {
                action: 'capacity',
                group: 'General Public'
            };

            RegistrationFactory.isThereCapacity(data)
            .then(function(response) {
                $scope.capacity = response;
            });
        }

        isThereCapacity();
    }
})();


text:
import sqlite3
import time
from flask import Flask, request, session, g, redirect, url_for, \
  abort, render_template, flash, _app_ctx_stack
from contextlib import closing
from werkzeug import check_password_hash, generate_password_hash

# konfigurasi umum
DATABASE = '/tmp/tweepy.db'
DEBUG = True
SECRET_KEY = 'abcdefghijklmnopqrstuvwxyz0123456789'
PER_PAGE = 30

# create application
app = Flask(__name__)
app.config.from_object(__name__)

# fungsi koneksi database
def connect_db():
  db = sqlite3.connect(app.config['DATABASE'])
  db.row_factory = sqlite3.Row
  return db

# fungsi inisialisasi tabel pada database
def init_db():
  with closing(connect_db()) as db:
    with app.open_resource('schema.sql', mode='r') as f:
      db.cursor().executescript(f.read())
    db.commit()

# fungsi untuk melakukan query
def query_db(query, args=(), one=False):
  db = connect_db()
  cur = db.execute(query, args)
  rv = cur.fetchall()
  db.close()
  return (rv[0] if rv else None) if one else rv

def get_user_id(username):
  rv = query_db('select id from users where username = ?',
                [username], one=True)
  return rv[0] if rv else None

def get_user_data(username):
  rv = query_db('select * from users where username = ?',
                [username], one=True)
  return rv if rv else None

def is_followed(user_id, follower_id):
  rv = query_db('select * from followers where user_id = ? and follower_id = ?',
                [user_id, follower_id], one=True)
  return True if rv else False

# routing
@app.route('/')
def home():
	if 'user_id' in session:
		return redirect(url_for('timeline'))
	return render_template('home.html')

@app.route('/timeline/')
def timeline():
  if 'user_id' not in session:
    return redirect(url_for('public_timeline'))

  return render_template('timeline.html', tweets=query_db('''
    select tweets.*, users.* from users
    inner join tweets on (tweets.user_id=users.id)
    where users.id in (select user_id from followers where follower_id=?)
    order by tweets.pub_date desc limit ?''',
    [session['user_id'], app.config['PER_PAGE']]), test=query_db('''
    select * from users where username = 'ambercat'
    '''))

@app.route('/public_timeline')
def public_timeline():
  return render_template('timeline.html', tweets=query_db('''
    select tweets.*, users.* from tweets, users
    where tweets.user_id = users.id order by tweets.pub_date desc limit ?''',
    [app.config['PER_PAGE']]))

@app.route('/add_tweet', methods=['POST'])
def add_tweet():
  if 'user_id' not in session:
    abort(401)
  if request.form['tweet']:
    db = connect_db()
    db.execute('''insert into tweets (user_id, tweet, pub_date)
      values (?, ?, ?)''', (session['user_id'], request.form['tweet'],
                            int(time.time())))
    db.commit()
    db.close()
    flash('Your tweet has been added')
  return redirect(url_for('timeline'))

@app.route('/login', methods=['GET', 'POST'])
def login():
  if 'user_id' in session:
    return redirect(url_for('timeline'))
  error = None
  if request.method == 'POST':
    user = query_db('''select * from users where username = ?''',
      [request.form['username']], one=True)
    if user is None:
      error = 'Invalid username'
    elif not check_password_hash(user[3], request.form['password']):
      error = 'Invalid password'
    else :
      flash('You were successfully logged in')
      session['user_id'] = user[0]
      session['username'] = user[1]
      return redirect(url_for('timeline'))
  return render_template('login.html', error=error)

@app.route('/register', methods=['POST'])
def register():
  if 'user_id' in session:
    return redirect(url_for('timeline'))
  error = None
  if request.method == 'POST':
    if not request.form['username']:
      error = 'Please enter your username'
    elif not request.form['fullname']:
      error = 'Please enter your fullname'
    elif not request.form['password']:
      error = 'Please enter your password'
    elif request.form['password'] != request.form['password2']:
      error = 'The two password that you entered didn\'t match'
    elif get_user_id(request.form['username']) is not None:
      error = 'The username is already taken'
    else:
      db = connect_db()
      db.execute('''insert into users (
        username, fullname, password) values (?, ?, ?)''',
        (request.form['username'], request.form['fullname'],
         generate_password_hash(request.form['password'])))
      db.commit()
      user_id = get_user_id(request.form['username'])
      db.execute('insert into followers (user_id, follower_id) values (?, ?)',
        (user_id, user_id))
      db.commit()
      db.close()
      flash('You were successfully registered')
      return redirect(url_for('login'))

@app.route('/logout')
def logout():
  session.pop('user_id', None)
  flash('You were successfully logged out')
  return redirect(url_for('public_timeline'))

@app.route('/profile/<username>')
def profile(username):
  if 'user_id' not in session:
    return redirect(url_for('public_timeline'))
  return render_template('timeline.html', tweets=query_db('''
    select * from users inner join tweets on (users.id = tweets.user_id)
    where users.username = ?''',
    [username]), user_data=get_user_data(username),
    followed=is_followed(get_user_id(username), session['user_id']))

@app.route('/follow/<username>')
def follow(username):
  if 'user_id' not in session:
    abort(401)
  db = connect_db()
  db.execute('''insert into followers (user_id, follower_id)
    values (?, ?)''', (get_user_id(username), session['user_id']))
  db.commit()
  db.close()
  flash('You have successfully followed @%s', username)
  return redirect(url_for('profile', username=username))

@app.route('/unfollow/<username>')
def unfollow(username):
  if 'user_id' not in session:
    abort(401)
  db = connect_db()
  db.execute('''delete from followers where user_id = ? and follower_id = ?''',
    (get_user_id(username), session['user_id']))
  db.commit()
  db.close()
  flash('You have successfully unfollowed @%s', username)
  return redirect(url_for('profile', username=username))

@app.route('/search', methods=['GET'])
def search():
  if 'user_id' not in session:
    return redirect(url_for('public_timeline'))
  else:
    return render_template('search.html',
                           results=query_db("select * from users where username like ?",
                                            ['%' + request.args.get('q') + '%'])
    )

if __name__ == '__main__':
  app.run()


text:
By [Joe Fallon](http://blog.joefallon.net)

A simple library of useful HTTP utilities. It has the following features:

*   Full suite of unit tests.
*   It can be integrated into any existing project.
*   Can be fully understood in just a few moments.

## Installation

The easiest way to install PhpDatabase is with
[Composer](https://getcomposer.org/). Create the following `composer.json` file
and run the `php composer.phar install` command to install it.

```json
{
    "require": {
        "joefallon/phphttp": "*"
    }
}
```

## Usage

There are four main classes contained in this library:

*   `Agent`
*   `HttpCodes`
*   `MimeType`
*   `PageRedirect`

### Agent

```
isBrowser()
isMobile()
isRobot()
isReferral()
getBrowserName()
getBrowserVersion()
getMobileDeviceName()
getRobotName()
getPlatformName()
getReferrer()
getAgentString()
getLanguages()
getCharsets()
acceptsLang($lang = 'en')
acceptsCharset($charset = 'utf-8')
```

### HttpCodes

```
getCodeMessage($code)
```

### MimeType

```
getMimeTypeFromFileName($filename = '')
getMimeTypeFromFileExtension($extension = '')
```

### PageRedirect

```
getRedirectDestination()
setRedirectDestination($destination)
redirect()
```


text:
using Grace.DependencyInjection;
using Grace.Tests.Classes.Attributes;
using Grace.Tests.Classes.Simple;
using Xunit;

namespace Grace.Tests.DependencyInjection.Decorator
{
    public class FuncDecoratorTests
    {
        [Fact]
        public void FuncDecorator_Initialize_Concrete()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.Export<BasicService>().As<IBasicService>();
                c.ExportDecorator<BasicService>(service =>
                {
                    service.Count = 5;

                    return service;
                });
            });

            var instance = container.Locate<IBasicService>();

            Assert.NotNull(instance);
            Assert.Equal(5, instance.Count);
        }

        [Fact]
        public void FuncDecorator_Initialize_Interface()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.Export<BasicService>().As<IBasicService>();
                c.ExportDecorator<IBasicService>(service =>
                {
                    service.Count = 5;

                    return service;
                });
            });

            var instance = container.Locate<IBasicService>();

            Assert.NotNull(instance);
            Assert.Equal(5, instance.Count);
        }

        [Fact]
        public void FuncDecorator_ApplyAfterLifestyle()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.Export<BasicService>().As<IBasicService>().Lifestyle.Singleton();
                c.ExportDecorator<IBasicService>(service =>
                {
                    service.Count++;

                    return service;
                }, applyAfterLifestyle: true);
            });

            var instance = container.Locate<IBasicService>();

            Assert.NotNull(instance);
            Assert.Equal(1, instance.Count);

            var instance2 = container.Locate<IBasicService>();

            Assert.NotNull(instance2);
            Assert.Equal(2, instance2.Count);

            Assert.Same(instance, instance2);
        }

        [Fact]
        public void FuncDecorator_ApplyBeforeLifestyle()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.Export<BasicService>().As<IBasicService>().Lifestyle.Singleton();
                c.ExportDecorator<IBasicService>(service =>
                {
                    service.Count++;

                    return service;
                }, applyAfterLifestyle: false);
            });

            var instance = container.Locate<IBasicService>();

            Assert.NotNull(instance);
            Assert.Equal(1, instance.Count);

            var instance2 = container.Locate<IBasicService>();

            Assert.NotNull(instance2);
            Assert.Equal(1, instance2.Count);

            Assert.Same(instance, instance2);
        }

        [Fact]
        public void FuncDecorator_ExportFactory()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.ExportFactory(() => new BasicService { Count = 5 }).As<IBasicService>();
                c.ExportDecorator<IBasicService>(service =>
                {
                    service.Count += 5;
                    return service;
                });
            });

            var instance = container.Locate<IBasicService>();

            Assert.NotNull(instance);
            Assert.Equal(10, instance.Count);
        }

        [Fact]
        public void FuncDecorator_ExportFactory_When()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c =>
            {
                c.ExportFactory(() => new BasicService { Count = 5 }).As<IBasicService>();
                c.ExportDecorator<IBasicService>(service =>
                {
                    service.Count += 5;
                    return service;
                }).When.ClassHas<TestAttribute>();
                c.ExportDecorator<IBasicService>(service =>
                {
                    service.Count += 15;
                    return service;
                }).When.ClassHas<SomeTestAttribute>();
            });

            var instance = container.Locate<DependencyOne>();

            Assert.NotNull(instance);
            Assert.Equal(10, instance.BasicService.Count);

            var instance2 = container.Locate<DependencyTwo>();

            Assert.NotNull(instance2);
            Assert.Equal(20, instance2.BasicService.Count);
        }

        [Test]
        public class DependencyOne
        {
            public DependencyOne(IBasicService basicService)
            {
                BasicService = basicService;
            }

            public IBasicService BasicService { get; }
        }

        [SomeTest]
        public class DependencyTwo
        {
            public DependencyTwo(IBasicService basicService)
            {
                BasicService = basicService;
            }

            public IBasicService BasicService { get; }
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Interface dollar.api.Scope (Dollar 0.4.5195 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="date" content="2017-09-28">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

SEARCH:
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">

JavaScript is disabled on your browser.

Uses of Interface
dollar.api.Scope

Packages that use Scope

Package
Description

dollar.api

dollar.api.script

dollar.api.scripting

dollar.internal.runtime.script

dollar.internal.runtime.script.api

dollar.internal.runtime.script.api.exceptions

dollar.internal.runtime.script.parser

dollar.internal.runtime.script.parser.scope

dollar.java

Uses of Scope in dollar.api

Methods in dollar.api that return Scope

Modifier and Type
Method
Description

@NotNull Scope
Scope.copy()

Returns a deep copy of this scope

@Nullable Scope
Scope.parent()

Return the parent scope or null if it does not have one.

@Nullable Scope
Scope.scopeForKey(@NotNull VarKey key)

Find which ancestor scope, or this scope, that contains a variable with the name.

Methods in dollar.api with parameters of type Scope

Modifier and Type
Method
Description

boolean
Scope.hasParent(@Nullable Scope scope)

Returns true if the supplied scope is this, or an ancestor of this, scope.

Uses of Scope in dollar.api.script

Methods in dollar.api.script with parameters of type Scope

Modifier and Type
Method
Description

@NotNull Value
DollarParser.parse(@NotNull Scope scope,
     @NotNull String source)

@NotNull Value
DollarParser.parse(@NotNull InputStream in,
     boolean parallel,
     @NotNull Scope scope)

Uses of Scope in dollar.api.scripting

Methods in dollar.api.scripting with parameters of type Scope

Modifier and Type
Method
Description

@NotNull Value
ScriptingLanguage.compile(@NotNull String java,
       @NotNull Scope scope)

static @NotNull Value
ScriptingSupport.compile(@NotNull String language,
       @NotNull String script,
       @NotNull Scope scope)

Uses of Scope in dollar.internal.runtime.script

Methods in dollar.internal.runtime.script that return Scope

Modifier and Type
Method
Description

@NotNull Scope
DollarUtilFactory.endScope(boolean runtime)

@NotNull Scope
DollarUtilFactory.getRootScope()

@Nullable Scope
DollarUtilFactory.getScopeForVar(boolean pure,
              @NotNull VarKey key,
              boolean numeric,
              @Nullable Scope initialScope)

@NotNull Scope
DollarUtilFactory.scope()

Methods in dollar.internal.runtime.script that return types with arguments of type Scope

Modifier and Type
Method
Description

@NotNull List<Scope>
DollarUtilFactory.scopes()

Methods in dollar.internal.runtime.script with parameters of type Scope

Modifier and Type
Method
Description

void
DollarUtilFactory.addParameterstoCurrentScope(@NotNull Scope scope,
                           @NotNull List<Value> parameters)

void
DollarUtilFactory.addScope(boolean runtime,
        @NotNull Scope scope)

@NotNull Value
DollarUtilFactory.constrain(@NotNull Scope scope,
         @NotNull Value value,
         @Nullable Value constraint,
         @Nullable SubType label)

@Nullable Scope
DollarUtilFactory.getScopeForVar(boolean pure,
              @NotNull VarKey key,
              boolean numeric,
              @Nullable Scope initialScope)

@NotNull Value
DollarUtilFactory.getVar(@NotNull VarKey key,
      @NotNull UUID id,
      @NotNull Scope scopeForKey,
      @NotNull Source sourceCode,
      boolean pure,
      @NotNull Value node)

@NotNull Value
ErrorHandlerFactory.handle(@NotNull Scope scope,
      @Nullable Source source,
      @NotNull DollarException e)

@NotNull Value
ErrorHandlerFactory.handle(@NotNull Scope scope,
      @Nullable Source source,
      @NotNull DollarAssertionException e)

@NotNull Value
ErrorHandlerFactory.handle(@NotNull Scope scope,
      @Nullable Source source,
      @NotNull Exception e)

<T> @NotNull Optional<T>
DollarUtilFactory.inScope(boolean runtime,
       @NotNull Scope parent,
       boolean pure,
       @NotNull String scopeName,
       @NotNull ScopeExecutable<T> r)

<T> @NotNull Optional<T>
DollarUtilFactory.inScope(boolean runtime,
       @NotNull Scope scope,
       @NotNull ScopeExecutable<T> r)

void
DollarUtilFactory.popScope(@NotNull Scope scope)

void
DollarUtilFactory.pushScope(@NotNull Scope scope)

@NotNull Variable
DollarUtilFactory.setVariable(@NotNull Scope scope,
           @NotNull VarKey key,
           @NotNull Value value,
           @Nullable DollarParser parser,
           @NotNull org.jparsec.Token token,
           @Nullable Value useConstraint,
           @Nullable SubType useSource,
           @NotNull VarFlags varFlags)

@NotNull Variable
DollarUtilFactory.updateVariable(@NotNull Scope scope,
              @NotNull VarKey key,
              @NotNull Value value,
              @NotNull VarFlags varFlags,
              @Nullable Value useConstraint,
              @Nullable SubType useSource)

Uses of Scope in dollar.internal.runtime.script.api

Methods in dollar.internal.runtime.script.api that return Scope

Modifier and Type
Method
Description

@NotNull Scope
DollarUtil.endScope(boolean runtime)

@NotNull Scope
DollarUtil.getRootScope()

@Nullable Scope
DollarUtil.getScopeForVar(boolean pure,
              @NotNull VarKey key,
              boolean numeric,
              @Nullable Scope initialScope)

@NotNull Scope
DollarUtil.scope()

Methods in dollar.internal.runtime.script.api that return types with arguments of type Scope

Modifier and Type
Method
Description

@NotNull List<Scope>
DollarUtil.scopes()

Methods in dollar.internal.runtime.script.api with parameters of type Scope

Modifier and Type
Method
Description

void
DollarUtil.addParameterstoCurrentScope(@NotNull Scope scope,
                           @NotNull List<Value> parameters)

void
DollarUtil.addScope(boolean runtime,
        @NotNull Scope scope)

@NotNull Value
DollarUtil.constrain(@NotNull Scope scope,
         @NotNull Value value,
         @Nullable Value constraint,
         @Nullable SubType label)

@NotNull Value
Builtin.BuiltinImpl.execute(boolean pure,
       @NotNull List<Value> args,
       @NotNull Scope scope)

@NotNull Value
Builtin.DollarStyle.execute(boolean pure,
       @NotNull List<Value> args,
       @NotNull Scope scope)

T
Builtin.execute(boolean pure,
       @NotNull List<Value> args,
       @NotNull Scope scope)

T
Builtin.JavaStyle.execute(boolean pure,
       @NotNull List<Value> args,
       @NotNull Scope scope)

T
ScopeExecutable.execute(@NotNull Scope scope)

@Nullable Scope
DollarUtil.getScopeForVar(boolean pure,
              @NotNull VarKey key,
              boolean numeric,
              @Nullable Scope initialScope)

@NotNull Value
DollarUtil.getVar(@NotNull VarKey key,
      @NotNull UUID id,
      @NotNull Scope scopeForKey,
      @NotNull Source sourceCode,
      boolean pure,
      @NotNull Value node)

@NotNull Value
ParserErrorHandler.handle(@NotNull Scope scope,
      @Nullable Source source,
      @NotNull DollarException e)

@NotNull Value
ParserErrorHandler.handle(@NotNull Scope scope,
      @Nullable Source source,
      @NotNull DollarAssertionException e)

@NotNull Value
ParserErrorHandler.handle(@NotNull Scope scope,
      @Nullable Source source,
      @NotNull Exception e)

<T> @NotNull Optional<T>
DollarUtil.inScope(boolean runtime,
       @NotNull Scope parent,
       boolean pure,
       @NotNull String scopeName,
       @NotNull ScopeExecutable<T> r)

<T> @NotNull Optional<T>
DollarUtil.inScope(boolean runtime,
       @NotNull Scope scope,
       @NotNull ScopeExecutable<T> r)

void
DollarUtil.popScope(@NotNull Scope scope)

void
DollarUtil.pushScope(@NotNull Scope scope)

@NotNull Variable
DollarUtil.setVariable(@NotNull Scope scope,
           @NotNull VarKey key,
           @NotNull Value value,
           @Nullable DollarParser parser,
           @NotNull org.jparsec.Token token,
           @Nullable Value useConstraint,
           @Nullable SubType useSource,
           @NotNull VarFlags varFlags)

@NotNull Variable
DollarUtil.updateVariable(@NotNull Scope scope,
              @NotNull VarKey key,
              @NotNull Value value,
              @NotNull VarFlags varFlags,
              @Nullable Value useConstraint,
              @Nullable SubType useSource)

Uses of Scope in dollar.internal.runtime.script.api.exceptions

Constructors in dollar.internal.runtime.script.api.exceptions with parameters of type Scope

Constructor
Description

VariableNotFoundException(@NotNull VarKey variable,
                         @NotNull Scope scope,
                         @NotNull SourceImpl sourceCode)

VariableNotFoundException(VarKey variable,
                         @NotNull Scope scope)

Uses of Scope in dollar.internal.runtime.script.parser

Methods in dollar.internal.runtime.script.parser with parameters of type Scope

Modifier and Type
Method
Description

@NotNull Value
DollarParserImpl.parse(@NotNull Scope scope,
     @NotNull String source)

@NotNull Value
DollarParserImpl.parse(@NotNull InputStream in,
     boolean parallel,
     @NotNull Scope scope)

Constructors in dollar.internal.runtime.script.parser with parameters of type Scope

Constructor
Description

SourceImpl(@NotNull Scope scope,
          @NotNull org.jparsec.Token t)

Uses of Scope in dollar.internal.runtime.script.parser.scope

Classes in dollar.internal.runtime.script.parser.scope that implement Scope

Modifier and Type
Class
Description

class
FileScope

class
PureScope

class
ScriptScope

Methods in dollar.internal.runtime.script.parser.scope that return Scope

Modifier and Type
Method
Description

@NotNull Scope
ScriptScope.copy()

Scope
ScriptScope.parent()

@Nullable Scope
ScriptScope.scopeForKey(@NotNull VarKey key)

Methods in dollar.internal.runtime.script.parser.scope with parameters of type Scope

Modifier and Type
Method
Description

boolean
ScriptScope.hasParent(Scope scope)

Constructors in dollar.internal.runtime.script.parser.scope with parameters of type Scope

Constructor
Description

ClassScopeFactory(@NotNull Scope parent,
                 @NotNull String name,
                 @NotNull List<Value> expression,
                 boolean root,
                 boolean parallel)

FileScope(@NotNull Scope scope,
         @NotNull String fileAbsolutePath,
         @NotNull String content,
         @NotNull String name,
         boolean root,
         boolean classScope)

PureScope(@NotNull Scope parent,
         @NotNull String source,
         @NotNull String name,
         @Nullable String file)

ScriptScope(@NotNull Scope parent,
           @NotNull String name,
           boolean root,
           boolean classScope)

ScriptScope(@NotNull Scope parent,
           @Nullable String source,
           @NotNull String name,
           boolean root,
           boolean classScope)

Uses of Scope in dollar.java

Methods in dollar.java with parameters of type Scope

Modifier and Type
Method
Description

@NotNull Value
Java9ScriptingLanguage.compile(@NotNull String script,
       @NotNull Scope scope)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

JavaScript is disabled on your browser.

Copyright © 2017. All rights reserved.


text:
package org.kuali.kra.irb.protocol.participant;

import org.kuali.kra.rule.BusinessRuleInterface;

/**
 * This interface addresses the adds rule for adding a new ProtocolParticipant.
 *
 * @author Kuali Research Administration Team (kc.dev@kuali.org)
 */
public class AddProtocolParticipantRule extends ProtocolParticipantRuleBase implements BusinessRuleInterface<AddProtocolParticipantEvent> {

    /**
     * {@inheritDoc}
     * @see org.kuali.kra.rule.BusinessRuleInterface#processRules(org.kuali.kra.rule.event.KraDocumentEventBaseExtension)
     */
    public boolean processRules(AddProtocolParticipantEvent event) {
        return processAddProtocolParticipantEvent(event);
    }

}


text:
package fcntl

var CAPI = map[string]struct{}{}


text:
from mahjong.hand_calculating.yaku import Yaku

class Sashikomi(Yaku):
    """
    Yaku situation
    """

    def __init__(self, yaku_id):
        super(Sashikomi, self).__init__(yaku_id)

    def set_attributes(self):
        self.name = "Sashikomi"

        self.han_open = None
        self.han_closed = 13

        self.is_yakuman = True

    def is_condition_met(self, hand, *args):
        # was it here or not is controlling by superior code
        return True


text:
#include "paddle/fluid/operators/gather_op.h"
#include "paddle/fluid/framework/ddim.h"

namespace paddle {
namespace operators {

class GatherOp : public framework::OperatorWithKernel {
 public:
  using framework::OperatorWithKernel::OperatorWithKernel;

  void InferShape(framework::InferShapeContext* ctx) const override {
    PADDLE_ENFORCE(ctx->HasInput("X"),
                   "Input(X) of GatherOp should not be null.");
    PADDLE_ENFORCE(ctx->HasInput("Index"),
                   "Input(Index) of GatherOp should not be null.");
    PADDLE_ENFORCE(ctx->HasOutput("Out"),
                   "Output(Out) of GatherOp should not be null.");

    auto index_dims = ctx->GetInputDim("Index");
    PADDLE_ENFORCE(index_dims.size() == 1);
    int batch_size = ctx->GetInputDim("Index")[0];
    framework::DDim output_dims(ctx->GetInputDim("X"));
    output_dims[0] = batch_size;
    ctx->SetOutputDim("Out", output_dims);
  }

 protected:
  framework::OpKernelType GetExpectedKernelType(
      const framework::ExecutionContext& ctx) const override {
    return framework::OpKernelType(
        framework::ToDataType(ctx.Input<Tensor>("X")->type()),
        ctx.device_context());
  }
};

class GatherGradOp : public framework::OperatorWithKernel {
 public:
  using framework::OperatorWithKernel::OperatorWithKernel;

  void InferShape(framework::InferShapeContext* ctx) const override {
    ctx->SetOutputDim(framework::GradVarName("X"), ctx->GetInputDim("X"));
  }

 protected:
  framework::OpKernelType GetExpectedKernelType(
      const framework::ExecutionContext& ctx) const override {
    return framework::OpKernelType(
        framework::ToDataType(ctx.Input<Tensor>("X")->type()),
        ctx.device_context());
  }
};

class GatherOpMaker : public framework::OpProtoAndCheckerMaker {
 public:
  void Make() override {
    AddInput("X", "The source input of gather op");
    AddInput("Index", "The index input of gather op");
    AddOutput("Out", "The output of gather op");
    AddComment(R"DOC(
Gather Operator.

$Out = X[Index]$

Out is obtained by gathering entries of the outer-most dimension
of X indexed by Index and concatenate them together.

Example:

X = [[1, 2],
     [3, 4],
     [5, 6]]

Index = [[1, 2]]

Then:

Out = [[3, 4],
       [5, 6]]

)DOC");
  }
};
}  // namespace operators
}  // namespace paddle

namespace ops = paddle::operators;
REGISTER_OPERATOR(gather, ops::GatherOp, ops::GatherOpMaker,
                  paddle::framework::DefaultGradOpDescMaker<true>);
REGISTER_OPERATOR(gather_grad, ops::GatherGradOp);
REGISTER_OP_CPU_KERNEL(gather, ops::GatherOpKernel<float>);
REGISTER_OP_CPU_KERNEL(gather_grad, ops::GatherGradientOpKernel<float>);


text:
<?xml version="1.0"?>
<script>
  <title>activate-config.slax</title>
  <author>dsatya</author>
  <synopsis>
	Event-based script to automatically activate/deactivate specific groups
  </synopsis>
  <coe>event</coe>
  <type>support</type>

  <description>
Based on receiving a event this script would trigger the activation of one config
group and the deactivation of another config group, so contents of thechanged
config live in the normal config file, after successful execution of this event script.
  </description>

  <keyword>support</keyword>
  <example>
    <title>Configuration</title>
    <description>Configuration required for this event script.</description>
    <config>example-1.conf</config>
  </example>

  <xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml"
                src="../../../../../web/leaf.js"
	        type="text/javascript"/>
</script>