text:
package com.vaadin.data.util;

import java.lang.reflect.Field;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xgbi.vaadin.container.AliasBeanContainer;
import org.xgbi.vaadin.container.property.HierarchicalBeanBuilder;

import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.filter.UnsupportedFilterException;

/**
 * An extension of {@link BeanContainer} that is {@link Hierarchical}. This is
 * the Abstract class that define common stuff for all BeanContainer type (
 * {@link BeanContainer}, {@link BeanItemContainer}, {@link AliasBeanContainer},
 * ...)
 *
 * <p>
 * Behind the scene it uses {@link ContainerHierarchicalWrapper}.
 * </p>
 *
 * @author Vincent Demeester <vincent@shortbrain.org>
 *
 * @param <IDTYPE>
 *            The type of the item identifier
 * @param <BEANTYPE>
 *            The type of the Bean
 *
 * @since 0.2.0
 *
 * @see BeanContainer
 * @see ContainerHierarchicalWrapper
 * @see Hierarchical
 */
public abstract class AbstractHierarchicalBeanContainer<IDTYPE, BEANTYPE>
		extends BeanContainer<IDTYPE, BEANTYPE> implements
		Container.Hierarchical, Container.ItemSetChangeListener,
		Container.PropertySetChangeListener {

	private static final long serialVersionUID = 1L;

	private static final Logger log = LoggerFactory
			.getLogger(AbstractHierarchicalBeanContainer.class);

	private Field modelField;

	/**
	 * The {@link Hierarchical} wrapper.
	 */
	private ContainerHierarchicalWrapper wrapper;

	/**
	 * The wrapped {@link Container} ({@link BeanContainer})
	 */
	private AbstractBeanContainer<IDTYPE, BEANTYPE> container;

	private HierarchicalBeanBuilder<IDTYPE, BEANTYPE> hierarchicalBeanBuilder;

	/**
	 * Create a {@link HierarchicalBeanContainer} with the given IDTYPE and
	 * BEANTYPE.
	 *
	 * @param type
	 *            The type of the Bean
	 * @param container
	 *            The container to be wrapped
	 */
	public AbstractHierarchicalBeanContainer(Class<BEANTYPE> type,
			AbstractBeanContainer<IDTYPE, BEANTYPE> container) {
		super(type);
		this.container = container;
		wrapper = new ContainerHierarchicalWrapper(container);
		wrapper.addListener((Container.ItemSetChangeListener) this);
		wrapper.addListener((Container.PropertySetChangeListener) this);
		try {
			modelField = AbstractBeanContainer.class.getDeclaredField("model");
			modelField.setAccessible(true);
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			// e.printStackTrace();
		} catch (NoSuchFieldException e) {
			// TODO Auto-generated catch block
			// e.printStackTrace();
		}
	}

	@Override
	public void containerPropertySetChange(PropertySetChangeEvent event) {
		log.trace("PropertySet event {}", event);
	}

	@Override
	public void containerItemSetChange(ItemSetChangeEvent event) {
		// Working only if hierarchicalPropertyId is defined
		if (hierarchicalBeanBuilder != null) {
			// Map the parent and their children
			Map<IDTYPE, Collection<IDTYPE>> mapParent = new HashMap<IDTYPE, Collection<IDTYPE>>();
			// Walk the container
			for (IDTYPE itemId : container.getItemIds()) {
				BEANTYPE bean = container.getItem(itemId).getBean();
				Collection<IDTYPE> ids = hierarchicalBeanBuilder
						.getChildren(bean);
				if (ids != null && !ids.isEmpty()) {
					mapParent.put(itemId, ids);
				}
			}
			// Walk the map and set parents
			for (Entry<IDTYPE, Collection<IDTYPE>> entry : mapParent.entrySet()) {
				IDTYPE parent = entry.getKey();
				wrapper.setChildrenAllowed(parent, true);
				for (IDTYPE id : entry.getValue()) {
					wrapper.setParent(id, parent);
				}
			}
		}
		log.trace("ItemSet event {}", event);
	}

	// Getter and Setter
	/**
	 * Set the {@link HierarchicalBeanBuilder}
	 *
	 * @param hierarchicalBeanBuilder
	 */
	public void setHierarchicalBeanBuilder(
			HierarchicalBeanBuilder<IDTYPE, BEANTYPE> hierarchicalBeanBuilder) {
		this.hierarchicalBeanBuilder = hierarchicalBeanBuilder;
	}

	/**
	 * Get the {@link ContainerHierarchicalWrapper} wrapper
	 *
	 * @return the wrapper
	 */
	protected ContainerHierarchicalWrapper getWrapper() {
		return wrapper;
	}

	/**
	 * Get the wrapped container
	 *
	 * @return the container
	 */
	protected AbstractBeanContainer<IDTYPE, BEANTYPE> getContainer() {
		return container;
	}

	/**
	 * Get the {@link HierarchicalBeanBuilder}
	 *
	 * @return the {@link HierarchicalBeanBuilder}
	 */
	public HierarchicalBeanBuilder<IDTYPE, BEANTYPE> getHierarchicalBeanBuilder() {
		return hierarchicalBeanBuilder;
	}

	// wrapper forwarding
	@Override
	public Collection<?> getChildren(Object itemId) {
		return wrapper.getChildren(itemId);
	}

	@Override
	public Object getParent(Object itemId) {
		return wrapper.getParent(itemId);
	}

	@Override
	public Collection<?> rootItemIds() {
		return wrapper.rootItemIds();
	}

	@Override
	public boolean setParent(Object itemId, Object newParentId)
			throws UnsupportedOperationException {
		return wrapper.setParent(itemId, newParentId);
	}

	@Override
	public boolean areChildrenAllowed(Object itemId) {
		return wrapper.areChildrenAllowed(itemId);
	}

	@Override
	public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed)
			throws UnsupportedOperationException {
		return wrapper.setChildrenAllowed(itemId, areChildrenAllowed);
	}

	@Override
	public boolean isRoot(Object itemId) {
		return wrapper.isRoot(itemId);
	}

	@Override
	public boolean hasChildren(Object itemId) {
		return wrapper.hasChildren(itemId);
	}

	// container forwarding
	@Override
	public BeanItem<BEANTYPE> addItem(IDTYPE itemId, BEANTYPE bean) {
		return container.addItem(itemId, bean);
	}

	@Override
	public BeanItem<BEANTYPE> addItemAfter(IDTYPE previousItemId,
			IDTYPE newItemId, BEANTYPE bean) {
		return container.addItemAfter(previousItemId, newItemId, bean);
	}

	@Override
	public BeanItem<BEANTYPE> addItemAt(int index, IDTYPE newItemId,
			BEANTYPE bean) {
		return container.addItemAt(index, newItemId, bean);
	}

	@Override
	public abstract void setBeanIdProperty(Object propertyId);

	@Override
	public void setBeanIdResolver(
			com.vaadin.data.util.AbstractBeanContainer.BeanIdResolver<IDTYPE, BEANTYPE> beanIdResolver) {
		container.setBeanIdResolver(beanIdResolver);
	}

	@Override
	public BeanItem<BEANTYPE> addBean(BEANTYPE bean)
			throws IllegalStateException, IllegalArgumentException {
		return container.addBean(bean);
	}

	@Override
	public BeanItem<BEANTYPE> addBeanAfter(IDTYPE previousItemId, BEANTYPE bean)
			throws IllegalStateException, IllegalArgumentException {
		return container.addBeanAfter(previousItemId, bean);
	}

	@Override
	public BeanItem<BEANTYPE> addBeanAt(int index, BEANTYPE bean)
			throws IllegalStateException, IllegalArgumentException {
		return container.addBeanAt(index, bean);
	}

	@Override
	public void addAll(Collection<? extends BEANTYPE> collection)
			throws IllegalStateException {
		container.addAll(collection);
	}

	@Override
	public Class<?> getType(Object propertyId) {
		return container.getType(propertyId);
	}

	@Override
	public Class<? super BEANTYPE> getBeanType() {
		return container.getBeanType();
	}

	@Override
	public Collection<String> getContainerPropertyIds() {
		return container.getContainerPropertyIds();
	}

	@Override
	public boolean removeAllItems() {
		return container.removeAllItems();
	}

	@Override
	public BeanItem<BEANTYPE> getItem(Object itemId) {
		return container.getItem(itemId);
	}

	@Override
	public List<IDTYPE> getItemIds() {
		return container.getItemIds();
	}

	@Override
	public Property getContainerProperty(Object itemId, Object propertyId) {
		return container.getContainerProperty(itemId, propertyId);
	}

	@Override
	public boolean removeItem(Object itemId) {
		return container.removeItem(itemId);
	}

	@Override
	public void valueChange(ValueChangeEvent event) {
		container.valueChange(event);
	}

	@Override
	public void addContainerFilter(Object propertyId, String filterString,
			boolean ignoreCase, boolean onlyMatchPrefix) {
		container.addContainerFilter(propertyId, filterString, ignoreCase,
				onlyMatchPrefix);
	}

	@Override
	public void removeAllContainerFilters() {
		container.removeAllContainerFilters();
	}

	@Override
	public void removeContainerFilters(Object propertyId) {
		container.removeContainerFilters(propertyId);
	}

	@Override
	public void addContainerFilter(Filter filter)
			throws UnsupportedFilterException {
		container.addContainerFilter(filter);
	}

	@Override
	public void removeContainerFilter(Filter filter) {
		container.removeContainerFilter(filter);
	}

	@Override
	public Collection<?> getSortableContainerPropertyIds() {
		return container.getSortableContainerPropertyIds();
	}

	@Override
	public void sort(Object[] propertyId, boolean[] ascending) {
		container.sort(propertyId, ascending);
	}

	@Override
	public ItemSorter getItemSorter() {
		return container.getItemSorter();
	}

	@Override
	public void setItemSorter(ItemSorter itemSorter) {
		container.setItemSorter(itemSorter);
	}

	@Override
	public com.vaadin.data.util.AbstractBeanContainer.BeanIdResolver<IDTYPE, BEANTYPE> getBeanIdResolver() {
		return container.getBeanIdResolver();
	}

	@Override
	public void addListener(PropertySetChangeListener listener) {
		container.addListener(listener);
	}

	@Override
	public void removeListener(PropertySetChangeListener listener) {
		container.removeListener(listener);
	}

	@Override
	public boolean addNestedContainerProperty(String propertyId) {
		return container.addNestedContainerProperty(propertyId);
	}

	@Override
	public boolean removeContainerProperty(Object propertyId)
			throws UnsupportedOperationException {
		return container.removeContainerProperty(propertyId);
	}

	@Override
	public int size() {
		return container.size();
	}

	@Override
	public boolean containsId(Object itemId) {
		return container.containsId(itemId);
	}

	@Override
	public IDTYPE nextItemId(Object itemId) {
		return container.nextItemId(itemId);
	}

	@Override
	public IDTYPE prevItemId(Object itemId) {
		return container.prevItemId(itemId);
	}

	@Override
	public IDTYPE firstItemId() {
		return container.firstItemId();
	}

	@Override
	public IDTYPE lastItemId() {
		return container.lastItemId();
	}

	@Override
	public boolean isFirstId(Object itemId) {
		return container.isFirstId(itemId);
	}

	@Override
	public boolean isLastId(Object itemId) {
		return container.isLastId(itemId);
	}

	@Override
	public IDTYPE getIdByIndex(int index) {
		return container.getIdByIndex(index);
	}

	@Override
	public int indexOfId(Object itemId) {
		return container.indexOfId(itemId);
	}

	@Override
	public Object addItemAt(int index) throws UnsupportedOperationException {
		return container.addItemAt(index);
	}

	@Override
	public Item addItemAt(int index, Object newItemId)
			throws UnsupportedOperationException {
		return container.addItemAt(index, newItemId);
	}

	@Override
	public Object addItemAfter(Object previousItemId)
			throws UnsupportedOperationException {
		return container.addItemAfter(previousItemId);
	}

	@Override
	public Item addItemAfter(Object previousItemId, Object newItemId)
			throws UnsupportedOperationException {
		return container.addItemAfter(previousItemId, newItemId);
	}

	@Override
	public Item addItem(Object itemId) throws UnsupportedOperationException {
		return container.addItem(itemId);
	}

	@Override
	public Object addItem() throws UnsupportedOperationException {
		return container.addItem();
	}

	@Override
	public void addListener(ItemSetChangeListener listener) {
		container.addListener(listener);
	}

	@Override
	public void removeListener(ItemSetChangeListener listener) {
		container.removeListener(listener);
	}

	@Override
	public Collection<?> getListeners(Class<?> eventType) {
		return container.getListeners(eventType);
	}

	public boolean removeContainerProperty(String propertyId) {
		// FIXME handle things better.
		if (modelField != null) {
			try {
				Map<String, VaadinPropertyDescriptor<BEANTYPE>> model = (Map<String, VaadinPropertyDescriptor<BEANTYPE>>) modelField
						.get(this);
				if (model.containsKey(propertyId)) {
					model.remove(propertyId);
				}
				return true;
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return false;
	}
}


text:
export NODE_ENV=development;
export NODE_PATH=./\config/\;./\app/\;
mocha --reporter spec --timeout 10000 app/blog/test/blog.js

redpajama_set_name: RedPajamaGithub


text:
import { createRoutine } from 'redux-saga-routines';

export const fetchTeams = createRoutine('app/TeamsPage/FETCH_TEAMS');
export const createTeam = createRoutine('app/TeamsPage/CREATE_TEAM');
export const editTeam = createRoutine('app/TeamsPage/EDIT_TEAM');
export const deleteTeam = createRoutine('app/TeamsPage/DELETE_TEAM');


text:
<!DOCTYPE html>

	<title>Simon Console: Tree</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<link href="resource/css/start/jquery-ui.css" rel="stylesheet" type="text/css"/>
	<link href="resource/css/javasimon.css" rel="stylesheet" type="text/css"/>

Simon Console

List View

Tree View

					Time format

						<select id="timeFormatSelect" name="type">
							<option value="SECOND">s</option>
							<option value="MILLISECOND">ms</option>
							<option value="MICROSECOND">µs</option>
							<option value="NANOSECOND">ns</option>
						</select>

					Auto refresh

						<select id="autorefreshSelect" name="type">
							<option value="1 sec">1 sec</option>
							<option value="10 sec">10 sec</option>
							<option value="30 sec">30 sec</option>
							<option value="60 sec">60 sec</option>
							<option value="never">never</option>
						</select>

				<button id="refreshButton" name="refreshButton">Refresh</button>
				<button id="clearAllButton" name="clearAllButton">Clear All</button>
				Export:
				<button id="xmlButton" name="xmlButton">XML</button>


text:
package org.apache.hadoop.hdfs.server.blockmanagement;

import java.beans.ConstructorProperties;

import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;

/**
 * Statistics per StorageType.
 *
 */
@InterfaceAudience.Private
@InterfaceStability.Evolving
public class StorageTypeStats {
  private long capacityTotal = 0L;
  private long capacityUsed = 0L;
  private long capacityNonDfsUsed = 0L;
  private long capacityRemaining = 0L;
  private long blockPoolUsed = 0L;
  private int nodesInService = 0;

  @ConstructorProperties({"capacityTotal", "capacityUsed", "capacityNonDfsUsed",
      "capacityRemaining", "blockPoolUsed", "nodesInService"})
  public StorageTypeStats(
      long capacityTotal, long capacityUsed, long capacityNonDfsUsedUsed,
      long capacityRemaining, long blockPoolUsed, int nodesInService) {
    this.capacityTotal = capacityTotal;
    this.capacityUsed = capacityUsed;
    this.capacityNonDfsUsed = capacityNonDfsUsedUsed;
    this.capacityRemaining = capacityRemaining;
    this.blockPoolUsed = blockPoolUsed;
    this.nodesInService = nodesInService;
  }

  public long getCapacityTotal() {
    return capacityTotal;
  }

  public long getCapacityUsed() {
    return capacityUsed;
  }

  public long getCapacityNonDfsUsed() {
    return capacityNonDfsUsed;
  }

  public long getCapacityRemaining() {
    return capacityRemaining;
  }

  public long getBlockPoolUsed() {
    return blockPoolUsed;
  }

  public int getNodesInService() {
    return nodesInService;
  }

  StorageTypeStats() {}

  StorageTypeStats(StorageTypeStats other) {
    capacityTotal = other.capacityTotal;
    capacityUsed = other.capacityUsed;
    capacityNonDfsUsed = other.capacityNonDfsUsed;
    capacityRemaining = other.capacityRemaining;
    blockPoolUsed = other.blockPoolUsed;
    nodesInService = other.nodesInService;
  }

  void addStorage(final DatanodeStorageInfo info,
      final DatanodeDescriptor node) {
    capacityUsed += info.getDfsUsed();
    capacityNonDfsUsed += info.getNonDfsUsed();
    blockPoolUsed += info.getBlockPoolUsed();
    if (!(node.isDecommissionInProgress() || node.isDecommissioned())) {
      capacityTotal += info.getCapacity();
      capacityRemaining += info.getRemaining();
    } else {
      capacityTotal += info.getDfsUsed();
    }
  }

  void addNode(final DatanodeDescriptor node) {
    if (!(node.isDecommissionInProgress() || node.isDecommissioned())) {
      nodesInService++;
    }
  }

  void subtractStorage(final DatanodeStorageInfo info,
      final DatanodeDescriptor node) {
    capacityUsed -= info.getDfsUsed();
    capacityNonDfsUsed -= info.getNonDfsUsed();
    blockPoolUsed -= info.getBlockPoolUsed();
    if (!(node.isDecommissionInProgress() || node.isDecommissioned())) {
      capacityTotal -= info.getCapacity();
      capacityRemaining -= info.getRemaining();
    } else {
      capacityTotal -= info.getDfsUsed();
    }
  }

  void subtractNode(final DatanodeDescriptor node) {
    if (!(node.isDecommissionInProgress() || node.isDecommissioned())) {
      nodesInService--;
    }
  }
}


text:
const event = require('../event');
const store = require('../store');

let currentTest;
let currentHook;

/**
 * Register steps inside tests
 */
module.exports = function () {
  event.dispatcher.on(event.test.started, (test) => {
    currentTest = test;
    currentTest.steps = [];
    if (!('retryNum' in currentTest)) currentTest.retryNum = 0;
    else currentTest.retryNum += 1;
  });

  event.dispatcher.on(event.test.after, () => {
    currentTest = null;
  });

  event.dispatcher.on(event.hook.passed, () => {
    currentHook = null;
  });

  event.dispatcher.on(event.hook.started, (suite) => {
    currentHook = suite.ctx.test;
    currentHook.steps = [];
  });

  event.dispatcher.on(event.test.failed, (test) => {
    const cutSteps = function (current) {
      const failureIndex = current.steps.findIndex(el => el.status === 'failed');
      // To be sure that failed test will be failed in report
      current.state = 'failed';
      current.steps.length = failureIndex + 1;
      return current;
    };
    if (currentHook && Array.isArray(currentHook.steps) && currentHook.steps.length) {
      currentHook = cutSteps(currentHook);
      return currentHook = null;
    }
    if (!currentTest) return;
    // last step is failing step
    if (!currentTest.steps.length) return;
    return currentTest = cutSteps(currentTest);
  });

  event.dispatcher.on(event.test.passed, (test) => {
    // To be sure that passed test will be passed in report
    delete currentTest.err;
    currentTest.state = 'passed';
  });

  event.dispatcher.on(event.step.started, (step) => {
    if (store.debugMode) return;
    if (currentHook && Array.isArray(currentHook.steps)) {
      return currentHook.steps.push(step);
    }
    if (!currentTest || !currentTest.steps) return;
    currentTest.steps.push(step);
  });
};


text:
namespace Gu.Analyzers.Test.GU0007PreferInjectingTests
{
    using Gu.Roslyn.Asserts;
    using NUnit.Framework;

    internal partial class CodeFix
    {
        internal class Simple
        {
            private static readonly string BarCode = @"
namespace RoslynSandbox
{
    public class Bar
    {
        public void Baz()
        {
        }
    }
}";

            [Test]
            public void WhenNotInjectingFieldInitialization()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo()
        {
            this.bar = ↓new Bar();
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(Bar bar)
        {
            this.bar = bar;
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, BarCode }, fixedCode);
            }

            [Test]
            public void WhenNotInjectingChained()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(Bar bar)
        {
            this.bar = bar;
        }
    }
}";

                var mehCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh()
           : base(↓new Bar())
        {
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Bar bar)
           : base(bar)
        {
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, BarCode, mehCode }, fixedCode);
            }

            [Test]
            public void WhenNotInjectingChainedNameCollision()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(int value, Bar bar)
        {
            this.bar = bar;
        }
    }
}";

                var testCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(int bar)
           : base(bar, ↓new Bar())
        {
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(int bar, Bar bar_)
           : base(bar, bar_)
        {
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, BarCode, testCode }, fixedCode);
            }

            [Test]
            public void WhenNotInjectingOptional()
            {
                var testCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(int value = 1)
        {
            this.bar = ↓new Bar();
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(Bar bar, int value = 1)
        {
            this.bar = bar;
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { BarCode, testCode }, fixedCode);
            }

            [Test]
            public void WhenNotInjectingParams()
            {
                var testCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(params int[] values)
        {
            this.bar = ↓new Bar();
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(Bar bar, params int[] values)
        {
            this.bar = bar;
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { BarCode, testCode }, fixedCode);
            }

            [Test]
            public void WhenNotInjectingChainedGeneric()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar<int> bar;

        public Foo(Bar<int> bar)
        {
            this.bar = bar;
        }
    }
}";
                var barCode = @"
namespace RoslynSandbox
{
    public class Bar<T>
    {
    }
}";

                var mehCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh()
           : base(↓new Bar<int>())
        {
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Bar<int> bar)
           : base(bar)
        {
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, barCode, mehCode }, fixedCode);
            }

            [Test]
            public void WhenNotInjectingChainedGenericParameterName()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public sealed class Foo
    {
        private readonly IsModuleReady<FooModule> isFooReady;

        public Foo()
        {
            this.isFooReady = ↓new IsModuleReady<FooModule>();
        }
    }
}";

                var moduleCode = @"
namespace RoslynSandbox
{
    public class IsModuleReady<TModule>
        where TModule : Module
    {
    }

    public abstract class Module { }

    public class FooModule : Module { }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public sealed class Foo
    {
        private readonly IsModuleReady<FooModule> isFooReady;

        public Foo(IsModuleReady<FooModule> isFooModuleReady)
        {
            this.isFooReady = isFooModuleReady;
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, moduleCode }, fixedCode);
            }

            [Test]
            public void WhenNotInjectingChainedNewWithInjectedArgument()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(Bar bar)
        {
            this.bar = bar;
        }
    }
}";
                var barCode = @"
namespace RoslynSandbox
{
    public class Bar
    {
        private readonly Baz baz;

        public Bar(Baz baz)
        {
            this.baz = baz;
        }
    }
}";

                var bazCode = @"
namespace RoslynSandbox
{
    public class Baz
    {
    }
}";
                var testCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Baz baz)
           : base(↓new Bar(baz))
        {
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Baz baz, Bar bar)
           : base(bar)
        {
        }
    }
}";
                AnalyzerAssert.FixAll(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, barCode, bazCode, testCode }, fixedCode);
            }

            [Test]
            public void UnsafeWhenNotInjectingChainedPassingInPropertyOfInjected()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(Bar bar)
        {
            this.bar = bar;
        }
    }
}";
                var barCode = @"
namespace RoslynSandbox
{
    public class Bar
    {
        private readonly int value;

        public Bar(int value)
        {
            this.value = value;
        }
    }
}";

                var bazCode = @"
namespace RoslynSandbox
{
    public class Baz
    {
        public int Value { get; } = 2;
    }
}";

                var mehCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Baz baz)
           : base(↓new Bar(baz.Value))
        {
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Baz baz, Bar bar)
           : base(bar)
        {
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, barCode, bazCode, mehCode }, fixedCode);
            }

            [Test]
            public void UnsafeWhenNotInjectingChainedPropertyOnInjected()
            {
                var fooCode = @"
namespace RoslynSandbox
{
    public class Foo
    {
        private readonly Bar bar;

        public Foo(Bar bar)
        {
            this.bar = bar;
        }
    }
}";
                var barCode = @"
namespace RoslynSandbox
{
    public class Bar
    {
    }
}";

                var bazCode = @"
namespace RoslynSandbox
{
    public class Baz
    {
        public Baz(Bar bar)
        {
            this.Bar = bar;
        }

        public Bar Bar { get; }
    }
}";

                var mehCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Baz baz)
           : base(baz.↓Bar)
        {
        }
    }
}";

                var fixedCode = @"
namespace RoslynSandbox
{
    public class Meh : Foo
    {
        public Meh(Baz baz, Bar bar)
           : base(bar)
        {
        }
    }
}";
                AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, new[] { fooCode, barCode, bazCode, mehCode }, fixedCode);
            }
        }
    }
}


text:
'''
Created on 29 de oct. de 2015

@author: cgimenop
'''
import unittest
from  TLCase import TLCase

class TLCaseUnitTest(unittest.TestCase):

    def setUp(self):

        pass

    def tearDown(self):

        pass

    def test_importance(self):
        case = TLCase()

        self.assertEqual(case.importance_value(TLCase.EXCEL_IMPORTANCE_LOW.lower()), case.IMPORTANCE_LOW, "Low lower case priority wrong parsed")
        self.assertEqual(case.importance_value(TLCase.EXCEL_IMPORTANCE_MEDIUM.lower()), case.IMPORTANCE_MEDIUM, "Medium lower case priority wrong parsed")
        self.assertEqual(case.importance_value(TLCase.EXCEL_IMPORTANCE_HIGH.lower()), case.IMPORTANCE_HIGH, "High lower case priority wrong parsed")
        self.assertEqual(case.importance_value(TLCase.EXCEL_IMPORTANCE_LOW), case.IMPORTANCE_LOW, "Low upper case priority wrong parsed")
        self.assertEqual(case.importance_value(TLCase.EXCEL_IMPORTANCE_MEDIUM), case.IMPORTANCE_MEDIUM, "Medium upper case priority wrong parsed")
        self.assertEqual(case.importance_value(TLCase.EXCEL_IMPORTANCE_HIGH), case.IMPORTANCE_HIGH, "High upper case priority wrong parsed")
        #TODO: Add random character check
        self.assertEqual(case.importance_value(""), case.IMPORTANCE_MEDIUM, "Empty priority case not treated")
        self.assertEqual(case.importance_value(None), case.IMPORTANCE_MEDIUM, "None priority case not treated")

if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testImportance']
    unittest.main()


text:
class Admin::PagesController < ApplicationController

  skip_before_action :require_admin!,
    only: %w(index edit update) # users can update, but not create or destroy
  skip_before_action :require_sysadmin!

  def index
    @pages = Simplec::Admin::Page.includes(:subdomain).
      order("simplec_subdomains.name ASC, simplec_pages.path ASC")
  end

  def new
    @page = Simplec::Page.type(params[:type] || "TODO list dir contents").new
  end

  def create
    @page = Simplec::Page.type(params[:page][:type]).new(page_params)

    if @page.save
      redirect_to edit_admin_page_url(@page)
    else
      render :new
    end
  end

  def edit
    @page = Simplec::Page.find(params[:id])
  end

  def update
    @page = Simplec::Page.find(params[:id])

    if @page.update(page_params)
      redirect_to edit_admin_page_url(@page)
    else
      render :edit
    end
  end

  def destroy
    @page = Simplec::Page.find(params[:id])
    if @page.destroy
      redirect_to admin_pages_url
    else
      render :edit
    end
  end

  private

  def page_params
    cls = Simplec::Page.type(params[:page][:type])
    attributes = [
      :type, :subdomain_id, :parent_id, :slug,
      :title, :meta_description, :layout
    ] +
			cls.field_names +
			cls.field_names(:file).inject(Array.new) {|memo, name|
				memo << :"remove_#{name}"
				memo << :"retained_#{name}"
				memo
			}
    attributes += [permissible_user_ids: []] if current_user.admin? ||
      current_user.sysadmin?

    params.require(:page).permit(*attributes)
  end

end


text:
/**
 * @fileoverview This file is generated by the Angular 2 template compiler.
 * Do not edit.
 * @suppress {suspiciousCode,uselessCode,missingProperties}
 */
 /* tslint:disable */

import * as import0 from '../../../../../../src/app/gallery/view-content/content-details-sidebar/content-details-sidebar.component';
import * as import1 from '@angular/core/src/change_detection/change_detection_util';
import * as import2 from '@angular/core/src/linker/view';
import * as import3 from '@angular/core/src/linker/view_utils';
import * as import4 from '@angular/core/src/render/api';
import * as import5 from '@angular/core/src/metadata/view';
import * as import6 from '@angular/core/src/linker/view_type';
import * as import7 from '@angular/core/src/change_detection/constants';
import * as import8 from '@angular/core/src/linker/component_factory';
import * as import9 from '../../../../../../src/app/app.service';
import * as import10 from './content-details-sidebar.component.css.shim.ngstyle';
import * as import11 from '@angular/core/src/animation/animation_transition';
import * as import12 from '@angular/core/src/animation/animation_sequence_player';
import * as import13 from '@angular/core/src/animation/animation_styles';
import * as import14 from '@angular/core/src/animation/animation_style_util';
import * as import15 from '@angular/core/src/animation/animation_keyframe';
import * as import16 from '@angular/core/src/animation/animation_player';
import * as import17 from '@angular/core/src/linker/view_container';
import * as import18 from '../../../../../node_modules/@angular/common/src/directives/ng_if.ngfactory';
import * as import19 from '@angular/core/src/linker/template_ref';
import * as import20 from '@angular/common/src/directives/ng_if';
export class Wrapper_ContentDetailsSidebar {
  /*private*/ _eventHandler:Function;
  context:import0.ContentDetailsSidebar;
  /*private*/ _changed:boolean;
  /*private*/ _expr_0:any;
  /*private*/ _expr_1:any;
  constructor(p0:any) {
    this._changed = false;
    this.context = new import0.ContentDetailsSidebar(p0);
    this._expr_0 = import1.UNINITIALIZED;
    this._expr_1 = import1.UNINITIALIZED;
  }
  ngOnDetach(view:import2.AppView<any>,componentView:import2.AppView<any>,el:any):void {
  }
  ngOnDestroy():void {
  }
  check_visible(currValue:any,throwOnChange:boolean,forceUpdate:boolean):void {
    if ((forceUpdate || import3.checkBinding(throwOnChange,this._expr_0,currValue))) {
      this._changed = true;
      this.context.visible = currValue;
      this._expr_0 = currValue;
    }
  }
  check_selectedItem(currValue:any,throwOnChange:boolean,forceUpdate:boolean):void {
    if ((forceUpdate || import3.checkBinding(throwOnChange,this._expr_1,currValue))) {
      this._changed = true;
      this.context.selectedItem = currValue;
      this._expr_1 = currValue;
    }
  }
  ngDoCheck(view:import2.AppView<any>,el:any,throwOnChange:boolean):boolean {
    var changed:any = this._changed;
    this._changed = false;
    if (!throwOnChange) { if ((view.numberOfChecks === 0)) { this.context.ngOnInit(); } }
    return changed;
  }
  checkHost(view:import2.AppView<any>,componentView:import2.AppView<any>,el:any,throwOnChange:boolean):void {
  }
  handleEvent(eventName:string,$event:any):boolean {
    var result:boolean = true;
    return result;
  }
  subscribe(view:import2.AppView<any>,_eventHandler:any):void {
    this._eventHandler = _eventHandler;
  }
}
var renderType_ContentDetailsSidebar_Host:import4.RenderComponentType = import3.createRenderComponentType('',0,import5.ViewEncapsulation.None,([] as any[]),{});
class View_ContentDetailsSidebar_Host0 extends import2.AppView<any> {
  _el_0:any;
  compView_0:import2.AppView<import0.ContentDetailsSidebar>;
  _ContentDetailsSidebar_0_3:Wrapper_ContentDetailsSidebar;
  constructor(viewUtils:import3.ViewUtils,parentView:import2.AppView<any>,parentIndex:number,parentElement:any) {
    super(View_ContentDetailsSidebar_Host0,renderType_ContentDetailsSidebar_Host,import6.ViewType.HOST,viewUtils,parentView,parentIndex,parentElement,import7.ChangeDetectorStatus.CheckAlways);
  }
  createInternal(rootSelector:string):import8.ComponentRef<any> {
    this._el_0 = import3.selectOrCreateRenderHostElement(this.renderer,'content-details-sidebar',import3.EMPTY_INLINE_ARRAY,rootSelector,(null as any));
    this.compView_0 = new View_ContentDetailsSidebar0(this.viewUtils,this,0,this._el_0);
    this._ContentDetailsSidebar_0_3 = new Wrapper_ContentDetailsSidebar(this.injectorGet(import9.AppState,this.parentIndex));
    this.compView_0.create(this._ContentDetailsSidebar_0_3.context);
    this.init(this._el_0,((<any>this.renderer).directRenderer? (null as any): [this._el_0]),(null as any));
    return new import8.ComponentRef_<any>(0,this,this._el_0,this._ContentDetailsSidebar_0_3.context);
  }
  injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any {
    if (((token === import0.ContentDetailsSidebar) && (0 === requestNodeIndex))) { return this._ContentDetailsSidebar_0_3.context; }
    return notFoundResult;
  }
  detectChangesInternal(throwOnChange:boolean):void {
    this._ContentDetailsSidebar_0_3.ngDoCheck(this,this._el_0,throwOnChange);
    this.compView_0.internalDetectChanges(throwOnChange);
  }
  destroyInternal():void {
    this.compView_0.destroy();
  }
  visitRootNodesInternal(cb:any,ctx:any):void {
    cb(this._el_0,ctx);
  }
}
export const ContentDetailsSidebarNgFactory:import8.ComponentFactory<import0.ContentDetailsSidebar> = new import8.ComponentFactory<import0.ContentDetailsSidebar>('content-details-sidebar',View_ContentDetailsSidebar_Host0,import0.ContentDetailsSidebar);
const styles_ContentDetailsSidebar:any[] = [import10.styles];
var ContentDetailsSidebar_slideInOut_states:any = {
  'hidden': {'width': '0px'},
  'visible': {'width': '200px'},
  '*': {}
}
;
function ContentDetailsSidebar_slideInOut_factory(view:import2.AppView<any>,element:any,currentState:any,nextState:any):import11.AnimationTransition {
  var previousPlayers:any = view.animationContext.getAnimationPlayers(element,((nextState == 'void')? (null as any): 'slideInOut'));
  var collectedStyles:any = {};
  var player:any = (null as any);
  var totalTime:any = 0;
  var defaultStateStyles:any = ContentDetailsSidebar_slideInOut_states['*'];
  var startStateStyles:any = ContentDetailsSidebar_slideInOut_states[currentState];
  if ((startStateStyles == (null as any))) { (startStateStyles = defaultStateStyles); }
  var endStateStyles:any = ContentDetailsSidebar_slideInOut_states[nextState];
  if ((endStateStyles == (null as any))) { (endStateStyles = defaultStateStyles); }
  if (((player == (null as any)) && ((currentState == 'hidden') && (nextState == 'visible')))) {
      player = new import12.AnimationSequencePlayer([view.renderer.animate(element,new import13.AnimationStyles(import14.collectAndResolveStyles(collectedStyles,[startStateStyles])),import14.balanceAnimationKeyframes(collectedStyles,endStateStyles,[
        new import15.AnimationKeyframe(0,new import13.AnimationStyles(import14.collectAndResolveStyles(collectedStyles,[{}]))),
        new import15.AnimationKeyframe(1,new import13.AnimationStyles(import14.collectAndResolveStyles(collectedStyles,[{}])))
      ]
    ),300,0,'ease-in-out',previousPlayers)]);
    totalTime = 300;
  }
  if (((player == (null as any)) && ((currentState == 'visible') && (nextState == 'hidden')))) {
      player = new import12.AnimationSequencePlayer([view.renderer.animate(element,new import13.AnimationStyles(import14.collectAndResolveStyles(collectedStyles,[startStateStyles])),import14.balanceAnimationKeyframes(collectedStyles,endStateStyles,[
        new import15.AnimationKeyframe(0,new import13.AnimationStyles(import14.collectAndResolveStyles(collectedStyles,[{}]))),
        new import15.AnimationKeyframe(1,new import13.AnimationStyles(import14.collectAndResolveStyles(collectedStyles,[{}])))
      ]
    ),300,0,'ease-in-out',previousPlayers)]);
    totalTime = 300;
  }
  if ((player == (null as any))) { (player = new import16.NoOpAnimationPlayer()); }
  player.onDone(():void => {
    player.destroy();
    import14.renderStyles(element,view.renderer,import14.prepareFinalAnimationStyles(startStateStyles,endStateStyles));
  });
  new import12.AnimationSequencePlayer(previousPlayers).destroy();
  import14.renderStyles(element,view.renderer,import14.clearStyles(startStateStyles));
  view.animationContext.queueAnimation(element,'slideInOut',player);
  return new import11.AnimationTransition(player,currentState,nextState,totalTime);
}
class View_ContentDetailsSidebar1 extends import2.AppView<any> {
  _el_0:any;
  _text_1:any;
  _el_2:any;
  _text_3:any;
  _text_4:any;
  _el_5:any;
  _text_6:any;
  _el_7:any;
  _text_8:any;
  _text_9:any;
  _el_10:any;
  _text_11:any;
  _text_12:any;
  _el_13:any;
  _text_14:any;
  _text_15:any;
  _text_16:any;
  /*private*/ _expr_17:any;
  /*private*/ _expr_18:any;
  /*private*/ _expr_19:any;
  /*private*/ _expr_20:any;
  constructor(viewUtils:import3.ViewUtils,parentView:import2.AppView<any>,parentIndex:number,parentElement:any,declaredViewContainer:import17.ViewContainer) {
    super(View_ContentDetailsSidebar1,renderType_ContentDetailsSidebar,import6.ViewType.EMBEDDED,viewUtils,parentView,parentIndex,parentElement,import7.ChangeDetectorStatus.CheckAlways,declaredViewContainer);
    this._expr_17 = import1.UNINITIALIZED;
    this._expr_18 = import1.UNINITIALIZED;
    this._expr_19 = import1.UNINITIALIZED;
    this._expr_20 = import1.UNINITIALIZED;
  }
  createInternal(rootSelector:string):import8.ComponentRef<any> {
    this._el_0 = import3.createRenderElement(this.renderer,(null as any),'div',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_1 = this.renderer.createText(this._el_0,'\n                    ',(null as any));
    this._el_2 = import3.createRenderElement(this.renderer,this._el_0,'h3',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_3 = this.renderer.createText(this._el_2,'',(null as any));
    this._text_4 = this.renderer.createText(this._el_0,'\n                    ',(null as any));
    this._el_5 = import3.createRenderElement(this.renderer,this._el_0,'ul',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_6 = this.renderer.createText(this._el_5,'\n                        ',(null as any));
    this._el_7 = import3.createRenderElement(this.renderer,this._el_5,'li',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_8 = this.renderer.createText(this._el_7,'',(null as any));
    this._text_9 = this.renderer.createText(this._el_5,'\n                        ',(null as any));
    this._el_10 = import3.createRenderElement(this.renderer,this._el_5,'li',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_11 = this.renderer.createText(this._el_10,'',(null as any));
    this._text_12 = this.renderer.createText(this._el_5,'\n                        ',(null as any));
    this._el_13 = import3.createRenderElement(this.renderer,this._el_5,'li',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_14 = this.renderer.createText(this._el_13,'',(null as any));
    this._text_15 = this.renderer.createText(this._el_5,'\n                    ',(null as any));
    this._text_16 = this.renderer.createText(this._el_0,'\n                ',(null as any));
    this.init(this._el_0,((<any>this.renderer).directRenderer? (null as any): [
      this._el_0,
      this._text_1,
      this._el_2,
      this._text_3,
      this._text_4,
      this._el_5,
      this._text_6,
      this._el_7,
      this._text_8,
      this._text_9,
      this._el_10,
      this._text_11,
      this._text_12,
      this._el_13,
      this._text_14,
      this._text_15,
      this._text_16
    ]
    ),(null as any));
    return (null as any);
  }
  detectChangesInternal(throwOnChange:boolean):void {
    const currVal_17:any = import3.inlineInterpolate(1,'',this.parentView.context.selectedItem.name,'');
    if (import3.checkBinding(throwOnChange,this._expr_17,currVal_17)) {
      this.renderer.setText(this._text_3,currVal_17);
      this._expr_17 = currVal_17;
    }
    const currVal_18:any = import3.inlineInterpolate(1,'',this.parentView.context.selectedItem.dateAdded,'');
    if (import3.checkBinding(throwOnChange,this._expr_18,currVal_18)) {
      this.renderer.setText(this._text_8,currVal_18);
      this._expr_18 = currVal_18;
    }
    const currVal_19:any = import3.inlineInterpolate(1,'',this.parentView.context.selectedItem.type,'');
    if (import3.checkBinding(throwOnChange,this._expr_19,currVal_19)) {
      this.renderer.setText(this._text_11,currVal_19);
      this._expr_19 = currVal_19;
    }
    const currVal_20:any = import3.inlineInterpolate(1,'',this.parentView.context.selectedItem.description,'');
    if (import3.checkBinding(throwOnChange,this._expr_20,currVal_20)) {
      this.renderer.setText(this._text_14,currVal_20);
      this._expr_20 = currVal_20;
    }
  }
  visitRootNodesInternal(cb:any,ctx:any):void {
    cb(this._el_0,ctx);
  }
}
class View_ContentDetailsSidebar2 extends import2.AppView<any> {
  _el_0:any;
  _text_1:any;
  _el_2:any;
  _text_3:any;
  _text_4:any;
  constructor(viewUtils:import3.ViewUtils,parentView:import2.AppView<any>,parentIndex:number,parentElement:any,declaredViewContainer:import17.ViewContainer) {
    super(View_ContentDetailsSidebar2,renderType_ContentDetailsSidebar,import6.ViewType.EMBEDDED,viewUtils,parentView,parentIndex,parentElement,import7.ChangeDetectorStatus.CheckAlways,declaredViewContainer);
  }
  createInternal(rootSelector:string):import8.ComponentRef<any> {
    this._el_0 = import3.createRenderElement(this.renderer,(null as any),'div',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_1 = this.renderer.createText(this._el_0,'\n                    ',(null as any));
    this._el_2 = import3.createRenderElement(this.renderer,this._el_0,'p',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._text_3 = this.renderer.createText(this._el_2,'Select an item to view its details',(null as any));
    this._text_4 = this.renderer.createText(this._el_0,'\n        \n                ',(null as any));
    this.init(this._el_0,((<any>this.renderer).directRenderer? (null as any): [
      this._el_0,
      this._text_1,
      this._el_2,
      this._text_3,
      this._text_4
    ]
    ),(null as any));
    return (null as any);
  }
  visitRootNodesInternal(cb:any,ctx:any):void {
    cb(this._el_0,ctx);
  }
}
var renderType_ContentDetailsSidebar:import4.RenderComponentType = import3.createRenderComponentType('',0,import5.ViewEncapsulation.Emulated,styles_ContentDetailsSidebar,{'slideInOut': ContentDetailsSidebar_slideInOut_factory});
export class View_ContentDetailsSidebar0 extends import2.AppView<import0.ContentDetailsSidebar> {
  _el_0:any;
  _text_1:any;
  _el_2:any;
  _text_3:any;
  _el_4:any;
  _text_5:any;
  _el_6:any;
  _text_7:any;
  _el_8:any;
  _el_9:any;
  _text_10:any;
  _text_11:any;
  _el_12:any;
  _text_13:any;
  _anchor_14:any;
  /*private*/ _vc_14:import17.ViewContainer;
  _TemplateRef_14_5:any;
  _NgIf_14_6:import18.Wrapper_NgIf;
  _text_15:any;
  _anchor_16:any;
  /*private*/ _vc_16:import17.ViewContainer;
  _TemplateRef_16_5:any;
  _NgIf_16_6:import18.Wrapper_NgIf;
  _text_17:any;
  _text_18:any;
  _text_19:any;
  _text_20:any;
  /*private*/ _expr_27:any;
  constructor(viewUtils:import3.ViewUtils,parentView:import2.AppView<any>,parentIndex:number,parentElement:any) {
    super(View_ContentDetailsSidebar0,renderType_ContentDetailsSidebar,import6.ViewType.COMPONENT,viewUtils,parentView,parentIndex,parentElement,import7.ChangeDetectorStatus.CheckAlways);
    this._expr_27 = import1.UNINITIALIZED;
  }
  createInternal(rootSelector:string):import8.ComponentRef<any> {
    const parentRenderNode:any = this.renderer.createViewRoot(this.parentElement);
    this._el_0 = import3.createRenderElement(this.renderer,parentRenderNode,'div',new import3.InlineArray2(2,'class','cg-sidebar'),(null as any));
    this._text_1 = this.renderer.createText(this._el_0,'\n    ',(null as any));
    this._el_2 = import3.createRenderElement(this.renderer,this._el_0,'div',new import3.InlineArray2(2,'class','container'),(null as any));
    this._text_3 = this.renderer.createText(this._el_2,'\n        ',(null as any));
    this._el_4 = import3.createRenderElement(this.renderer,this._el_2,'div',new import3.InlineArray2(2,'class','row'),(null as any));
    this._text_5 = this.renderer.createText(this._el_4,'\n            ',(null as any));
    this._el_6 = import3.createRenderElement(this.renderer,this._el_4,'div',new import3.InlineArray2(2,'class','col-xs-12'),(null as any));
    this._text_7 = this.renderer.createText(this._el_6,'\n                ',(null as any));
    this._el_8 = import3.createRenderElement(this.renderer,this._el_6,'a',import3.EMPTY_INLINE_ARRAY,(null as any));
    this._el_9 = import3.createRenderElement(this.renderer,this._el_8,'i',new import3.InlineArray2(2,'class','fa fa-close fa-2x'),(null as any));
    this._text_10 = this.renderer.createText(this._el_6,'\n            ',(null as any));
    this._text_11 = this.renderer.createText(this._el_4,'\n            ',(null as any));
    this._el_12 = import3.createRenderElement(this.renderer,this._el_4,'div',new import3.InlineArray2(2,'class','col-xs-12'),(null as any));
    this._text_13 = this.renderer.createText(this._el_12,'\n\n                ',(null as any));
    this._anchor_14 = this.renderer.createTemplateAnchor(this._el_12,(null as any));
    this._vc_14 = new import17.ViewContainer(14,12,this,this._anchor_14);
    this._TemplateRef_14_5 = new import19.TemplateRef_(this,14,this._anchor_14);
    this._NgIf_14_6 = new import18.Wrapper_NgIf(this._vc_14.vcRef,this._TemplateRef_14_5);
    this._text_15 = this.renderer.createText(this._el_12,'\n                ',(null as any));
    this._anchor_16 = this.renderer.createTemplateAnchor(this._el_12,(null as any));
    this._vc_16 = new import17.ViewContainer(16,12,this,this._anchor_16);
    this._TemplateRef_16_5 = new import19.TemplateRef_(this,16,this._anchor_16);
    this._NgIf_16_6 = new import18.Wrapper_NgIf(this._vc_16.vcRef,this._TemplateRef_16_5);
    this._text_17 = this.renderer.createText(this._el_12,'\n\n\n            ',(null as any));
    this._text_18 = this.renderer.createText(this._el_4,'\n        ',(null as any));
    this._text_19 = this.renderer.createText(this._el_2,'\n    ',(null as any));
    this._text_20 = this.renderer.createText(this._el_0,'\n',(null as any));
    this.init((null as any),((<any>this.renderer).directRenderer? (null as any): [
      this._el_0,
      this._text_1,
      this._el_2,
      this._text_3,
      this._el_4,
      this._text_5,
      this._el_6,
      this._text_7,
      this._el_8,
      this._el_9,
      this._text_10,
      this._text_11,
      this._el_12,
      this._text_13,
      this._anchor_14,
      this._text_15,
      this._anchor_16,
      this._text_17,
      this._text_18,
      this._text_19,
      this._text_20
    ]
    ),(null as any));
    return (null as any);
  }
  injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any {
    if (((token === import19.TemplateRef) && (14 === requestNodeIndex))) { return this._TemplateRef_14_5; }
    if (((token === import20.NgIf) && (14 === requestNodeIndex))) { return this._NgIf_14_6.context; }
    if (((token === import19.TemplateRef) && (16 === requestNodeIndex))) { return this._TemplateRef_16_5; }
    if (((token === import20.NgIf) && (16 === requestNodeIndex))) { return this._NgIf_16_6.context; }
    return notFoundResult;
  }
  detectChangesInternal(throwOnChange:boolean):void {
    const currVal_27:any = (this.context.visible? 'visible': 'hidden');
    if (import3.checkBinding(throwOnChange,this._expr_27,currVal_27)) {
      var animationTransition_slideInOut:any = this.componentType.animations['slideInOut'](this,this._el_0,((this._expr_27 == import1.UNINITIALIZED)? 'void': this._expr_27),((currVal_27 == import1.UNINITIALIZED)? 'void': currVal_27));
      this._expr_27 = currVal_27;
    }
    const currVal_14_0_0:any = this.context.selectedItem;
    this._NgIf_14_6.check_ngIf(currVal_14_0_0,throwOnChange,false);
    this._NgIf_14_6.ngDoCheck(this,this._anchor_14,throwOnChange);
    const currVal_16_0_0:boolean = !this.context.selectedItem;
    this._NgIf_16_6.check_ngIf(currVal_16_0_0,throwOnChange,false);
    this._NgIf_16_6.ngDoCheck(this,this._anchor_16,throwOnChange);
    this._vc_14.detectChangesInNestedViews(throwOnChange);
    this._vc_16.detectChangesInNestedViews(throwOnChange);
  }
  destroyInternal():void {
    this._vc_14.destroyNestedViews();
    this._vc_16.destroyNestedViews();
  }
  detachInternal():void {
    var animationTransition_slideInOut:any = this.componentType.animations['slideInOut'](this,this._el_0,this._expr_27,'void');
  }
  createEmbeddedViewInternal(nodeIndex:number):import2.AppView<any> {
    if ((nodeIndex == 14)) { return new View_ContentDetailsSidebar1(this.viewUtils,this,14,this._anchor_14,this._vc_14); }
    if ((nodeIndex == 16)) { return new View_ContentDetailsSidebar2(this.viewUtils,this,16,this._anchor_16,this._vc_16); }
    return (null as any);
  }
}


text:
using System;

class XExpression
{
    static void Main()
    {
        string expression = Console.ReadLine();
        decimal result = 0;
        decimal currentBracketResult = 0;
        char currentOperator = '+';
        char currentBracketOperator = '+';
        bool inBracket = false;

        foreach (char symbol in expression)
        {
            if (symbol == '(')
            {
                inBracket = true;
                continue;
            }
            if ((symbol == '+') || (symbol == '-') || (symbol == '*') || (symbol == '/'))
            {
                if (inBracket)
                {
                    currentBracketOperator = symbol;
                }
                else
                    currentOperator = symbol;
            }

            if (char.IsDigit(symbol))
            {
                int currentNumber = symbol - '0';

                if (inBracket)
                {
                    switch (currentBracketOperator)
                    {
                        case '+': currentBracketResult += currentNumber; break;
                        case '-': currentBracketResult -= currentNumber; break;
                        case '*': currentBracketResult *= currentNumber; break;
                        case '/': currentBracketResult /= currentNumber; break;
                    }
                }
                else
                {
                    switch (currentOperator)
                    {
                        case '+': result += currentNumber; break;
                        case '-': result -= currentNumber; break;
                        case '*': result *= currentNumber; break;
                        case '/': result /= currentNumber; break;
                    }
                }
            }

            if (symbol == ')')
            {
                switch (currentOperator)
                {
                    case '+': result += currentBracketResult; break;
                    case '-': result -= currentBracketResult; break;
                    case '*': result *= currentBracketResult; break;
                    case '/': result /= currentBracketResult; break;
                }
                currentBracketOperator = '+';
                currentBracketResult = 0;
                inBracket = false;

            }
        }
        Console.WriteLine("{0:F2}", result);
    }
}