text:
layout: global
title: DROP DATABASE
displayTitle: DROP DATABASE
license: |
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
---

### Description

Drop a database and delete the directory associated with the database from the file system. An
exception will be thrown if the database does not exist in the system.

### Syntax

{% highlight sql %}
DROP (DATABASE|SCHEMA) [IF EXISTS] dbname [RESTRICT|CASCADE];
{% endhighlight %}

### Parameters

DATABASE|SCHEMA

`DATABASE` and `SCHEMA` mean the same thing, either of them can be used.

IF EXISTS

If specified, no exception is thrown when the database does not exist.

RESTRICT

If specified, will restrict dropping a non-empty database and is enabled by default.

CASCADE

If specified, will drop all the associated tables and functions.

### Example
{% highlight sql %}
-- Create `inventory_db` Database
CREATE DATABASE inventory_db COMMENT 'This database is used to maintain Inventory';

-- Drop the database and it's tables
DROP DATABASE inventory_db CASCADE;
+---------+
| Result  |
+---------+
+---------+

-- Drop the database using IF EXISTS
DROP DATABASE IF EXISTS inventory_db CASCADE;
+---------+
| Result  |
+---------+
+---------+

{% endhighlight %}

### Related statements
- [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html)
- [DESCRIBE DATABASE](sql-ref-syntax-aux-describe-database.html)
- [SHOW DATABASES](sql-ref-syntax-aux-show-databases.html)


text:
<?xml version="1.0"?>
<!DOCTYPE function SYSTEM 'function-submission.dtd'>
<?xml-stylesheet type="text/xsl" href="submissions.xsl"?>
<function date="2001-06-09">
   <module>datetime</module>
   <name>weekInYear</name>
   <meta>
      <author email="chris@bayes.co.uk" url="http://www.bayes.co.uk">Chris Bayes</author>
      <summary>Returns the current number of week in the year. If a date is supplied it returns the number of week in year of date arguement</summary>
   </meta>
   <definition>
        <return type="number"/>
   </definition>
</function>

redpajama_set_name: RedPajamaGithub


text:
require_relative 'node.rb'
require_relative '../processors/strip_unused_constant.rb'

class DabNodeConstant < DabNode
  strip_with StripUnusedConstant

  attr_accessor :asm_position

  def initialize(value)
    super()
    insert(value)
    @references = []
  end

  def remove!
    root.will_remove_constant(self)
    super
  end

  def extra_dump
    "$#{index} (#{references.count} refs)"
  end

  def index
    root.constant_index(self)
  end

  def symbol_index
    root.symbol_index(self)
  end

  def symbol_arg
    "S#{symbol_index}"
  end

  def value
    @children[0]
  end

  def asm_length
    value.asm_length
  end

  def compile_string(output)
    value.compile_string(output)
  end

  def compile_symbol(output)
    output.comment(extra_value)
    output.print("W_SYMBOL _SDAT + #{asm_position}")
  end

  def compile(output)
    value.compile_constant(output)
  end

  def extra_value
    value.extra_value
  end

  def real_value
    value.real_value
  end

  def my_type
    value.my_type
  end

  def constant?
    value.constant?
  end

  def constant_value
    value.constant_value if constant?
  end

  def register_reference(reference)
    @references << reference
  end

  def unregister_reference(reference)
    @references.delete(reference)
  end

  def references
    @references
  end

  def formatted_source(options)
    'const[' + value.formatted_source(options) + ']'
  end

  def upper_ring?
    value.upper_ring?
  end

  def source_ring_index
    value.source_ring_index
  end
end


text:
package fr.landel.utils.commons.function;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

import org.junit.Test;

import fr.landel.utils.commons.exception.FunctionException;
import fr.landel.utils.commons.tuple.Octo;

/**
 * Check {@link OctoSupplier}
 *
 * @since Nov 18, 2017
 * @author Gilles
 *
 */
public class OctoSupplierTest {

    private static final Octo<String, String, String, String, String, String, String, String> OCTO = Octo.of("a", "b", "c", "d", "e", "f",
            "g", "h");

    private static final String EXPECTED_TO_STRING = "(a,b,c,d,e,f,g,h)";

    /**
     * Test method for {@link OctoSupplier#get()}.
     */
    @Test
    public void testGet() {
        boolean test = false;
        final String error = "error";

        final OctoSupplier<String, String, String, String, String, String, String, String> s1 = () -> OCTO;
        final OctoSupplier<String, String, String, String, String, String, String, String> s2 = () -> {
            if (test) {
                return OCTO;
            }
            throw new IllegalArgumentException(error);
        };

        try {
            assertEquals(EXPECTED_TO_STRING, s1.get().toString());
        } catch (FunctionException e) {
            fail("Supplier failed");
        }

        try {
            s2.get();
            fail("Supplier has to fail");
        } catch (IllegalArgumentException e) {
            assertNotNull(e);
            assertEquals(error, e.getMessage());
        }
    }
}


text:
import { Foo } from "./module1";
import { Bar } from "./module2";

export const foo: Foo = {};
export const bar = Bar;


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

<TITLE>
XMLElement
</TITLE>

<META NAME="keywords" CONTENT="processing.xml.XMLElement class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

processing.xml

Class XMLElement

java.lang.Object
  processing.xml.XMLElement

All Implemented Interfaces:
java.io.Serializable

public class XMLElement
extends java.lang.Object
implements java.io.Serializable

XMLElement is an XML element. This is the base class used for the
 Processing XML library, representing a single node of an XML tree.

 This code is based on a modified version of NanoXML by Marc De Scheemaecker.

See Also:
Serialized Form

Field Summary

static int
NO_LINE

          No line number defined.

Constructor Summary

XMLElement()

          Creates an empty element to be used for #PCDATA content.

XMLElement(PApplet parent,
           java.lang.String filename)

          Begin parsing XML data passed in from a PApplet.

XMLElement(java.io.Reader r)

XMLElement(java.lang.String xml)

XMLElement(java.lang.String fullName,
           java.lang.String namespace,
           java.lang.String systemID,
           int lineNr)

          Creates an empty element.

Method Summary

 void
addChild(XMLElement child)

          Adds a child element.

 XMLElement
createElement(java.lang.String fullName,
              java.lang.String namespace)

          Creates an empty element.

 XMLElement
createElement(java.lang.String fullName,
              java.lang.String namespace,
              java.lang.String systemID,
              int lineNr)

          Creates an empty element.

 XMLElement
createPCDataElement()

          Creates an element to be used for #PCDATA content.

 java.util.Enumeration<java.lang.String>
enumerateAttributeNames()

          Returns an enumeration of all attribute names.

 java.util.Enumeration<XMLElement>
enumerateChildren()

          Returns an enumeration of all child elements.

 boolean
equals(java.lang.Object rawElement)

          Returns true if the element equals another element.

 boolean
equalsXMLElement(XMLElement rawElement)

          Returns true if the element equals another element.

 java.lang.String
getAttribute(java.lang.String name)

          Returns the value of an attribute.

 java.lang.String
getAttribute(java.lang.String name,
             java.lang.String defaultValue)

          Returns the value of an attribute.

 java.lang.String
getAttribute(java.lang.String name,
             java.lang.String namespace,
             java.lang.String defaultValue)

          Returns the value of an attribute.

 int
getAttributeCount()

          Returns the number of attributes.

 java.lang.String
getAttributeNamespace(java.lang.String name)

          Returns the namespace of an attribute.

 java.util.Properties
getAttributes()

          Returns all attributes as a Properties object.

 java.util.Properties
getAttributesInNamespace(java.lang.String namespace)

          Returns all attributes in a specific namespace as a Properties object.

 java.lang.String
getAttributeType(java.lang.String name)

          Returns the type of an attribute.

 java.lang.String
getAttributeType(java.lang.String name,
                 java.lang.String namespace)

          Returns the type of an attribute.

 XMLElement
getChild(int which)

          Quick accessor for an element at a particular index.

 XMLElement
getChild(java.lang.String name)

          Get a child by its name or path.

 XMLElement
getChildAtIndex(int index)

          Returns the child at a specific index.

 int
getChildCount()

          Returns the number of children.

 XMLElement[]
getChildren()

          Returns an array containing all the child elements.

 XMLElement[]
getChildren(java.lang.String name)

          Get any children that match this name or path.

 java.lang.String
getContent()

          Return the #PCDATA content of the element.

 double
getDoubleAttribute(java.lang.String name)

 double
getDoubleAttribute(java.lang.String name,
                   double defaultValue)

          Returns the value of an attribute.

 double
getDoubleAttribute(java.lang.String name,
                   java.lang.String namespace,
                   double defaultValue)

          Returns the value of an attribute.

 float
getFloatAttribute(java.lang.String name)

 float
getFloatAttribute(java.lang.String name,
                  float defaultValue)

          Returns the value of an attribute.

 float
getFloatAttribute(java.lang.String name,
                  java.lang.String namespace,
                  float defaultValue)

          Returns the value of an attribute.

 int
getIntAttribute(java.lang.String name)

 int
getIntAttribute(java.lang.String name,
                int defaultValue)

          Returns the value of an attribute.

 int
getIntAttribute(java.lang.String name,
                java.lang.String namespace,
                int defaultValue)

          Returns the value of an attribute.

 int
getLineNr()

          Returns the line number in the data where the element started.

 java.lang.String
getLocalName()

          Returns the name of the element.

 java.lang.String
getName()

          Returns the full name (i.e.

 java.lang.String
getNamespace()

          Returns the namespace of the element.

 XMLElement
getParent()

          Returns the parent element.

 java.lang.String
getStringAttribute(java.lang.String name)

 java.lang.String
getStringAttribute(java.lang.String name,
                   java.lang.String defaultValue)

 java.lang.String
getStringAttribute(java.lang.String name,
                   java.lang.String namespace,
                   java.lang.String defaultValue)

 java.lang.String
getSystemID()

          Returns the system ID of the data where the element started.

 boolean
hasAttribute(java.lang.String name)

          Returns whether an attribute exists.

 boolean
hasAttribute(java.lang.String name,
             java.lang.String namespace)

          Returns whether an attribute exists.

 boolean
hasChildren()

          Returns whether the element has children.

 void
insertChild(XMLElement child,
            int index)

          Inserts a child element.

 boolean
isLeaf()

          Returns whether the element is a leaf element.

 java.lang.String[]
listChildren()

          Put the names of all children into an array.

 void
removeAttribute(java.lang.String name)

          Removes an attribute.

 void
removeAttribute(java.lang.String name,
                java.lang.String namespace)

          Removes an attribute.

 void
removeChild(XMLElement child)

          Removes a child element.

 void
removeChildAtIndex(int index)

          Removes the child located at a certain index.

 void
setAttribute(java.lang.String name,
             java.lang.String value)

          Sets an attribute.

 void
setAttribute(java.lang.String fullName,
             java.lang.String namespace,
             java.lang.String value)

          Sets an attribute.

 void
setContent(java.lang.String content)

          Sets the #PCDATA content.

 void
setName(java.lang.String name)

          Sets the full name.

 void
setName(java.lang.String fullName,
        java.lang.String namespace)

          Sets the name.

 java.lang.String
toString(boolean pretty)

Methods inherited from class java.lang.Object

getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

NO_LINE

public static final int NO_LINE

No line number defined.

See Also:
Constant Field Values

Constructor Detail

XMLElement

public XMLElement()

Creates an empty element to be used for #PCDATA content.

XMLElement

public XMLElement(java.lang.String fullName,
                  java.lang.String namespace,
                  java.lang.String systemID,
                  int lineNr)

Creates an empty element.

Parameters:
fullName - the full name of the element
namespace - the namespace URI.
systemID - the system ID of the XML data where the element starts.
lineNr - the line in the XML data where the element starts.

XMLElement

public XMLElement(PApplet parent,
                  java.lang.String filename)

Begin parsing XML data passed in from a PApplet. This code
 wraps exception handling, for more advanced exception handling,
 use the constructor that takes a Reader or InputStream.

Parameters:
filename -
parent -

XMLElement

public XMLElement(java.io.Reader r)

XMLElement

public XMLElement(java.lang.String xml)

Method Detail

createPCDataElement

public XMLElement createPCDataElement()

Creates an element to be used for #PCDATA content.

createElement

public XMLElement createElement(java.lang.String fullName,
                                java.lang.String namespace)

Creates an empty element.

Parameters:
fullName - the full name of the element
namespace - the namespace URI.

createElement

public XMLElement createElement(java.lang.String fullName,
                                java.lang.String namespace,
                                java.lang.String systemID,
                                int lineNr)

Creates an empty element.

Parameters:
fullName - the full name of the element
namespace - the namespace URI.
systemID - the system ID of the XML data where the element starts.
lineNr - the line in the XML data where the element starts.

getParent

public XMLElement getParent()

Returns the parent element. This method returns null for the root
 element.

getName

public java.lang.String getName()

Returns the full name (i.e. the name including an eventual namespace
 prefix) of the element.

Returns:
the name, or null if the element only contains #PCDATA.

getLocalName

public java.lang.String getLocalName()

Returns the name of the element.

Returns:
the name, or null if the element only contains #PCDATA.

getNamespace

public java.lang.String getNamespace()

Returns the namespace of the element.

Returns:
the namespace, or null if no namespace is associated with the
         element.

setName

public void setName(java.lang.String name)

Sets the full name. This method also sets the short name and clears the
 namespace URI.

Parameters:
name - the non-null name.

setName

public void setName(java.lang.String fullName,
                    java.lang.String namespace)

Sets the name.

Parameters:
fullName - the non-null full name.
namespace - the namespace URI, which may be null.

addChild

public void addChild(XMLElement child)

Adds a child element.

Parameters:
child - the non-null child to add.

insertChild

public void insertChild(XMLElement child,
                        int index)

Inserts a child element.

Parameters:
child - the non-null child to add.
index - where to put the child.

removeChild

public void removeChild(XMLElement child)

Removes a child element.

Parameters:
child - the non-null child to remove.

removeChildAtIndex

public void removeChildAtIndex(int index)

Removes the child located at a certain index.

Parameters:
index - the index of the child, where the first child has index 0.

enumerateChildren

public java.util.Enumeration<XMLElement> enumerateChildren()

Returns an enumeration of all child elements.

Returns:
the non-null enumeration

isLeaf

public boolean isLeaf()

Returns whether the element is a leaf element.

Returns:
true if the element has no children.

hasChildren

public boolean hasChildren()

Returns whether the element has children.

Returns:
true if the element has children.

getChildCount

public int getChildCount()

Returns the number of children.

Returns:
the count.

listChildren

public java.lang.String[] listChildren()

Put the names of all children into an array. Same as looping through
 each child and calling getName() on each XMLElement.

getChildren

public XMLElement[] getChildren()

Returns an array containing all the child elements.

getChild

public XMLElement getChild(int which)

Quick accessor for an element at a particular index.

getChild

public XMLElement getChild(java.lang.String name)

Get a child by its name or path.

Parameters:
name - element name or path/to/element

Returns:
the element

getChildAtIndex

public XMLElement getChildAtIndex(int index)
                           throws java.lang.ArrayIndexOutOfBoundsException

Returns the child at a specific index.

Parameters:
index - the index of the child

Returns:
the non-null child

Throws:

java.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds.

getChildren

public XMLElement[] getChildren(java.lang.String name)

Get any children that match this name or path. Similar to getChild(),
 but will grab multiple matches rather than only the first.

Parameters:
name - element name or path/to/element

Returns:
array of child elements that match

getAttributeCount

public int getAttributeCount()

Returns the number of attributes.

getAttribute

public java.lang.String getAttribute(java.lang.String name)

Returns the value of an attribute.

Parameters:
name - the non-null name of the attribute.

Returns:
the value, or null if the attribute does not exist.

getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String namespace,
                                     java.lang.String defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String name)

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String name,
                                           java.lang.String defaultValue)

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String name,
                                           java.lang.String namespace,
                                           java.lang.String defaultValue)

getIntAttribute

public int getIntAttribute(java.lang.String name)

getIntAttribute

public int getIntAttribute(java.lang.String name,
                           int defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getIntAttribute

public int getIntAttribute(java.lang.String name,
                           java.lang.String namespace,
                           int defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getFloatAttribute

public float getFloatAttribute(java.lang.String name)

getFloatAttribute

public float getFloatAttribute(java.lang.String name,
                               float defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getFloatAttribute

public float getFloatAttribute(java.lang.String name,
                               java.lang.String namespace,
                               float defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getDoubleAttribute

public double getDoubleAttribute(java.lang.String name)

getDoubleAttribute

public double getDoubleAttribute(java.lang.String name,
                                 double defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null full name of the attribute.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getDoubleAttribute

public double getDoubleAttribute(java.lang.String name,
                                 java.lang.String namespace,
                                 double defaultValue)

Returns the value of an attribute.

Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.
defaultValue - the default value of the attribute.

Returns:
the value, or defaultValue if the attribute does not exist.

getAttributeType

public java.lang.String getAttributeType(java.lang.String name)

Returns the type of an attribute.

Parameters:
name - the non-null full name of the attribute.

Returns:
the type, or null if the attribute does not exist.

getAttributeNamespace

public java.lang.String getAttributeNamespace(java.lang.String name)

Returns the namespace of an attribute.

Parameters:
name - the non-null full name of the attribute.

Returns:
the namespace, or null if there is none associated.

getAttributeType

public java.lang.String getAttributeType(java.lang.String name,
                                         java.lang.String namespace)

Returns the type of an attribute.

Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI, which may be null.

Returns:
the type, or null if the attribute does not exist.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)

Sets an attribute.

Parameters:
name - the non-null full name of the attribute.
value - the non-null value of the attribute.

setAttribute

public void setAttribute(java.lang.String fullName,
                         java.lang.String namespace,
                         java.lang.String value)

Sets an attribute.

Parameters:
fullName - the non-null full name of the attribute.
namespace - the namespace URI of the attribute, which may be null.
value - the non-null value of the attribute.

removeAttribute

public void removeAttribute(java.lang.String name)

Removes an attribute.

Parameters:
name - the non-null name of the attribute.

removeAttribute

public void removeAttribute(java.lang.String name,
                            java.lang.String namespace)

Removes an attribute.

Parameters:
name - the non-null name of the attribute.
namespace - the namespace URI of the attribute, which may be null.

enumerateAttributeNames

public java.util.Enumeration<java.lang.String> enumerateAttributeNames()

Returns an enumeration of all attribute names.

Returns:
the non-null enumeration.

hasAttribute

public boolean hasAttribute(java.lang.String name)

Returns whether an attribute exists.

Returns:
true if the attribute exists.

hasAttribute

public boolean hasAttribute(java.lang.String name,
                            java.lang.String namespace)

Returns whether an attribute exists.

Returns:
true if the attribute exists.

getAttributes

public java.util.Properties getAttributes()

Returns all attributes as a Properties object.

Returns:
the non-null set.

getAttributesInNamespace

public java.util.Properties getAttributesInNamespace(java.lang.String namespace)

Returns all attributes in a specific namespace as a Properties object.

Parameters:
namespace - the namespace URI of the attributes, which may be null.

Returns:
the non-null set.

getSystemID

public java.lang.String getSystemID()

Returns the system ID of the data where the element started.

Returns:
the system ID, or null if unknown.
See Also:
getLineNr()

getLineNr

public int getLineNr()

Returns the line number in the data where the element started.

Returns:
the line number, or NO_LINE if unknown.
See Also:
NO_LINE,
getSystemID()

getContent

public java.lang.String getContent()

Return the #PCDATA content of the element. If the element has a
 combination of #PCDATA content and child elements, the #PCDATA
 sections can be retrieved as unnamed child objects. In this case,
 this method returns null.

Returns:
the content.

setContent

public void setContent(java.lang.String content)

Sets the #PCDATA content. It is an error to call this method with a
 non-null value if there are child objects.

Parameters:
content - the (possibly null) content.

equals

public boolean equals(java.lang.Object rawElement)

Returns true if the element equals another element.

Overrides:
equals in class java.lang.Object

Parameters:
rawElement - the element to compare to

equalsXMLElement

public boolean equalsXMLElement(XMLElement rawElement)

Returns true if the element equals another element.

Parameters:
rawElement - the element to compare to

toString

public java.lang.String toString(boolean pretty)

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
FROM node

WORKDIR /src
ADD . .

EXPOSE 5000
RUN npm install
CMD ["node", "app.js"]


text:
package org.olat;

import java.util.Locale;

import org.olat.admin.SystemAdminMainController;
import org.olat.admin.UserAdminMainController;
import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.chiefcontrollers.BaseChiefController;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.layout.MainLayoutController;
import org.olat.core.gui.translator.Translator;
import org.olat.core.id.OLATResourceable;
import org.olat.core.id.Roles;
import org.olat.core.logging.AssertException;
import org.olat.core.logging.OLATSecurityException;
import org.olat.core.util.Util;
import org.olat.core.util.resource.OresHelper;
import org.olat.course.CourseModule;
import org.olat.course.assessment.AssessmentManager;
import org.olat.course.nodes.ta.DropboxController;
import org.olat.course.nodes.ta.ReturnboxController;
import org.olat.group.BusinessGroup;
import org.olat.group.BusinessGroupService;
import org.olat.group.ui.BGControllerFactory;
import org.olat.gui.demo.GUIDemoMainController;
import org.olat.home.HomeMainController;
import org.olat.home.InviteeHomeMainController;
import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryManager;
import org.olat.repository.RepositoyUIFactory;
import org.olat.repository.controllers.RepositoryMainController;

/**
 *  Initial Date:  May 6, 2004
 *  @author gnaegi
 */
public class ControllerFactory {
	/**
	 * Create a controller for a specific OLAT resource
	 *
	 * @param olatResourceable The OLAT resource
	 * @param initialViewIdentifier if null the default view will be started,
	 *          otherwise a controllerfactory type dependant view will be
	 *          activated (subscription subtype)
	 * @param ureq
	 * @param wControl
	 * @param exceptIfNoneFound if true, then an exception will be thrown if no
	 *          controller could be created for whatever reason. if false, the
	 *          call will just return null.
	 * @return the created controller
	 */
	public static MainLayoutController createLaunchController(OLATResourceable olatResourceable, UserRequest ureq,
			WindowControl wControl, boolean exceptIfNoneFound) {
		Roles roles = ureq.getUserSession().getRoles();
		if (olatResourceable == null) {
			// special case after login: guest will get guesthome, other user the
			// normal home
			if (ureq.getUserSession().getRoles().isGuestOnly()) return new HomeMainController(ureq, wControl);

		} else if (OresHelper.isOfType(olatResourceable, "BGMainController")) {
			if (roles.isGuestOnly()) throw new OLATSecurityException("Tried to launch a GroupMainController, but is in guest group " + roles);
			return BGControllerFactory.getInstance().createGroupMainController(ureq, wControl);

		} else if (OresHelper.isOfType(olatResourceable, BusinessGroup.class)) {
			if (roles.isGuestOnly()) throw new OLATSecurityException("Tried to launch a BusinessGroup, but is in guest group " + roles);
			BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
			BusinessGroup bg = bgs.loadBusinessGroup(olatResourceable.getResourceableId());
			// check if allowed to start (must be member or admin)
			if (ureq.getUserSession().getRoles().isOLATAdmin() || ureq.getUserSession().getRoles().isGroupManager()
					|| bgs.isIdentityInBusinessGroup(ureq.getIdentity(), bg)) {
				// only olatadmins or admins of this group can administer this group
				return BGControllerFactory.getInstance().createRunControllerFor(ureq, wControl, bg);
			}
			// else skip

		} else if (OresHelper.isOfType(olatResourceable, RepositoryEntry.class)) {
			// it this is a respository type, the resourceableID is the repository
			// entry key
			RepositoryManager rm = RepositoryManager.getInstance();
			RepositoryEntry re = rm.lookupRepositoryEntry(olatResourceable.getResourceableId());
			MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, ureq, wControl);
			if (ctrl != null) return ctrl;

		} else if (OresHelper.isOfType(olatResourceable, CourseModule.class)) {
			// gets called by subscription launcher
			//FIXME:fj:make it clearer here: subscriptioncontext is always given by
			// the surrounding resource, but for launching we always need the
			// repoentry
			// if it is a course, we also take the repository entry, since a course
			// can only be called by a repoentry
			RepositoryManager rm = RepositoryManager.getInstance();
			RepositoryEntry re = rm.lookupRepositoryEntry(olatResourceable, false);
			MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, ureq, wControl);
			if (ctrl != null) return ctrl;
		} else if (OresHelper.isOfType(olatResourceable, AssessmentManager.class)) {
			// gets called by subscription launcher
			//FIXME:fj:make it clearer here: subscriptioncontext is always given by
			// the surrounding resource, but for launching we always need the
			// repoentry
			// if it is a course, we also take the repository entry, since a course
			// can only be called by a repoentry
			RepositoryManager rm = RepositoryManager.getInstance();
			// launch course with view identifyer assessment tool. however notifications
			// publisher data provides not existing assessmentManager resource
			OLATResourceable fakedCourseResource = OresHelper.createOLATResourceableInstance(CourseModule.class, olatResourceable.getResourceableId());
			RepositoryEntry re = rm.lookupRepositoryEntry(fakedCourseResource, false);
			MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, ureq, wControl);
			if (ctrl != null) {
				//TODO "assessmentTool"
				return ctrl;
			}
		} else if (OresHelper.isOfType(olatResourceable, DropboxController.class)) {
			// JumpIn-handling for task-dropbox notification
			RepositoryManager rm = RepositoryManager.getInstance();
			OLATResourceable fakedCourseResource = OresHelper.createOLATResourceableInstance(CourseModule.class, olatResourceable.getResourceableId());
			RepositoryEntry re = rm.lookupRepositoryEntry(fakedCourseResource,false);
			if (re == null) {
				return null;// found no repositoryEntry => return null
			}
			MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, ureq, wControl);
			if (ctrl != null) {
				//TODO "assessmentTool:nodeChoose"
				return ctrl;
			}
		} else if (OresHelper.isOfType(olatResourceable, ReturnboxController.class)) {
			// JumpIn-handling for task-returnbox notification
			RepositoryManager rm = RepositoryManager.getInstance();
			OLATResourceable fakedCourseResource = OresHelper.createOLATResourceableInstance(CourseModule.class, olatResourceable.getResourceableId());
			RepositoryEntry re = rm.lookupRepositoryEntry(fakedCourseResource, false);
			MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, ureq, wControl);
			if (ctrl != null) return ctrl;
		}

		// --- repository ---
		else if (OresHelper.isOfType(olatResourceable, RepositoryMainController.class)) {
			return new RepositoryMainController(ureq, wControl);
		}
		// --- home ---
		else if (OresHelper.isOfType(olatResourceable, HomeMainController.class)) {
			return new HomeMainController(ureq, wControl);
		} else if (OresHelper.isOfType(olatResourceable, SystemAdminMainController.class)) {
			if (!roles.isOLATAdmin()) throw new OLATSecurityException("Tried to launch a SystemAdminMainController, but is not in admin group " + roles);
			return new SystemAdminMainController(ureq, wControl);
		} else if (OresHelper.isOfType(olatResourceable, UserAdminMainController.class)) {
			if (!roles.isUserManager()) throw new OLATSecurityException("Tried to launch a UserAdminMainController, but is not in admin group " + roles);
			return new UserAdminMainController(ureq, wControl);
		} else if (OresHelper.isOfType(olatResourceable, InviteeHomeMainController.class)) {
			if (!roles.isInvitee()) throw new OLATSecurityException("Tried to launch a InviteeMainController, but is not an invitee " + roles);
			return new InviteeHomeMainController(ureq, wControl);
		} else if (OresHelper.isOfType(olatResourceable, GUIDemoMainController.class)) {
			if (!roles.isOLATAdmin()) throw new OLATSecurityException("Tried to launch a GUIDemoMainController, but is not in admin group "
					+ roles);
			return new GUIDemoMainController(ureq, wControl);
		} else { // ask the handlerfactory of the repository if it can handle it
			// a repository entry ?
			RepositoryManager rm = RepositoryManager.getInstance();
			//OLAT-1842
			//if the LaunchController is created from a link click in a
			//notification list/email then we cannot be strict in the repoentry lookup.
			//Because the notification can live longer then the resource it is pointing to.
			RepositoryEntry re = rm.lookupRepositoryEntry(olatResourceable, false);
			//but now we have to handle the NULL case.
			//from the method signature it follows that one can choose if the method
			//should throw the "Unable to creat..." exception or to return null.
			//Hence it follows to set the ctrl == null if no repoentry found.
			MainLayoutController ctrl;
			if(re == null){
				ctrl = null;
			} else {
				ctrl = RepositoyUIFactory.createLaunchController(re, ureq, wControl);
			}
			if (ctrl != null) return ctrl;
		}

		if (exceptIfNoneFound) {
			throw new AssertException("Unable to create launch controller for resourceable: " + olatResourceable.getResourceableTypeName() + ", "
					+ olatResourceable.getResourceableId());
		} else {
			return null;
		}
	}

	/**
	 * Translate a resourceableTypeName.
	 *
	 * @param resourceableTypeName
	 * @param locale
	 * @return the String representing the type in the given locale
	 */
	public static String translateResourceableTypeName(String resourceableTypeName, Locale locale) {
		//REVIEW:12-2007:CodeCleanup
		//TODO: cache per locale?? -> Task for i18n manager
		Translator trans = Util.createPackageTranslator(BaseChiefController.class, locale);
		String tr = trans.translate(resourceableTypeName);
		return tr;
		//REVIEW:12-2007:CodeCleanup
		//Localization.getInstance().getString("org.olat", resourceableTypeName, null, locale);
	}

}


text:
import { LineChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3';

new LineChartPlugin().configure({ key: 'line' }).register();

export default {
  title: 'Legacy Chart Plugins/legacy-preset-chart-nvd3/Line',
};

export { basic } from './stories/basic';
export { markers } from './stories/markers';
export { logScale } from './stories/logScale';
export { yAxisBounds } from './stories/yAxisBounds';


text:
layout: blog_by_category
category: home-theatre-system-white-rock-bc
permalink: /blog/category/home-theatre-system-white-rock-bc/
---


text:
The code in this directory accompanies the
[Using Kubernetes Namespaces to Manage Environments](http://www.ianlewis.org/en/using-kubernetes-namespaces-manage-environments)
blog post.


text:
@implementation UINavigationBar (Addition)

static char overlayKey;

- (void)ad_setBackgroundColor:(UIColor *)backgroundColor {

    if (!self.overlay) {
        [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
        self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
        self.overlay.userInteractionEnabled = NO;
        self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
        [self insertSubview:self.overlay atIndex:0];
    }
    self.overlay.backgroundColor = backgroundColor;
}

- (UIView *)overlay {
    return objc_getAssociatedObject(self, &overlayKey);
}

- (void)setOverlay:(UIView *)overlay {
    objc_setAssociatedObject(self, &overlayKey, overlay, OBJC_ASSOCIATION_RETAIN);
}

- (void)setTranslationY:(CGFloat)translationY {
    self.transform = CGAffineTransformMakeTranslation(0, translationY);
}

- (void)setElementsAlpha:(CGFloat)alpha {
    [[self valueForKey:@"_leftViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) {
        view.alpha = alpha;
    }];

    [[self valueForKey:@"_rightViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) {
        view.alpha = alpha;
    }];

    UIView *titleView = [self valueForKey:@"_titleView"];
    titleView.alpha = alpha;
}

- (void)reset {
    [self setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    [self.overlay removeFromSuperview];
    self.overlay = nil;
}

// 显示导航栏下面的分割线
- (void)showNavigationBarBottomLineView {
    [self setShadowImage:nil];
}

// 隐藏导航栏下面的分割线
- (void)hiddenNavigationBarBottomLineView {
    [self setShadowImage:[[UIImage alloc] init]];
}

@end


text:
package org.olat.test.util.selenium.olatapi.group;

import org.olat.test.util.selenium.olatapi.OLATSeleniumWrapper;

import com.thoughtworks.selenium.Selenium;

/**
 * @author Lavinia Dumitrescu
 *
 */
public class LearningArea extends OLATSeleniumWrapper {

    /**
     * @param selenium
     */
    public LearningArea(Selenium selenium) {
        super(selenium);

        // Check that we're on the right place
        if (!selenium.isTextPresent("Edit learning area")) {
            throw new IllegalStateException("This is not the - Edit learning area - page");
        }
    }

    /**
     *
     * @param groupNames
     */
    public void assignGroup(String[] groupNames) {
        selenium.click("ui=groupManagement::content_learningAreaEditor_tabs_groupAssignment()");
        selenium.waitForPageToLoad("30000");
        for (String groupName : groupNames) {
            selenium.click("ui=groupManagement::content_learningAreaEditor_groupAssignment_checkLearningGroup(nameOfGroup=" + groupName + ")");
        }
        selenium.click("ui=groupManagement::content_learningAreaEditor_groupAssignment_save()");
        selenium.waitForPageToLoad("30000");
    }
}


text:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

namespace System.Web.OData
{
    /// <summary>
    /// An instance of <see cref="EntityInstanceContext{TEntityType}"/> gets passed to the self link (<see cref="M:EntitySetConfiguration.HasIdLink"/>, <see cref="M:EntitySetConfiguration.HasEditLink"/>, <see cref="M:EntitySetConfiguration.HasReadLink"/>)
    /// and navigation link (<see cref="M:EntitySetConfiguration.HasNavigationPropertyLink"/>, <see cref="M:EntitySetConfiguration.HasNavigationPropertiesLink"/>) builders and can be used by the link builders to generate links.
    /// </summary>
    /// <typeparam name="TEntityType">The entity type</typeparam>
    public class EntityInstanceContext<TEntityType> : EntityInstanceContext
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityInstanceContext{TEntityType}"/> class.
        /// </summary>
        public EntityInstanceContext()
            : base()
        {
        }

        /// <summary>
        /// Gets or sets the entity instance.
        /// </summary>
        [Obsolete("Entity instance might not be available when the incoming uri has a $select. Use the EdmObject property instead.")]
        public new TEntityType EntityInstance
        {
            get
            {
                return (TEntityType)base.EntityInstance;
            }
            set
            {
                base.EntityInstance = value;
            }
        }
    }
}


text:
create table instance_configs (
    domain_name varchar(253) not null primary key,
    ip_address varchar(15) not null
);

create table discovery_testcase_creds (
    name varchar(100) not null primary key,
    private_key_data blob(8192) not null,
    cert_data blob(8192) not null
);

create table discovery_testcase_mail_mappings (
    direct_address varchar(253) not null primary key,
    results_address varchar(253) not null
);


text:
<?php
	include 'conf/config.php';
	include 'conf/opendb.php';

	$result=mysql_query("SELECT DISTINCT(mobile) FROM customer_temp WHERE mobile BETWEEN '0700000000' AND '0790000000'" , $conn);
	while($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{

		$mobile=$row['mobile'];
		mysql_select_db($dbname);
		$query = "INSERT INTO customer_contact (mobile)
		VALUES ('$mobile')";
		mysql_query($query) or die (mysql_error());

	}

	include 'conf/closedb.php';


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.fax4j (fax4j 0.45.0 API)</title>
<meta name="date" content="2020-05-15">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package org.fax4j

The fax4j library, is a standard on which java based applications can communicate with
    fax devices in order to submit new faxes or perform other related actions.

See: Description

Interface Summary

Interface
Description

FaxClientActionEventListener

This interface defines the fax client action event listener.

 The listener picks up events based on actions invoked on the fax client and not based on the status changes of the
 actual fax job.

 For example is a fax job is submitted via fax client, than the faxJobSubmitted event method will be invoked.

 However the fax job itself might still be pending transmission by the actual fax modem/server.

FaxJob

This interface defines the fax job.

FaxMonitorEventListener

This interface defines the fax monitor event listener.

 The listener picks up remote events based on changes done on the remote fax modem.

Provider

This is the provider interface.

 Each SPI enables access to the SPI provider by returning an instance of this interface.

Class Summary

Class
Description

AbstractFaxEvent

Base class for all fax4j events.

FaxClient

This is the fax client.

 The fax client enables to perform activities such as sending/suspending fax jobs and so on.

 This is the class which will be used by external applications to invoke the actual fax related activites.

 To create a new instance of the fax client, you will need to invoke the FaxClientFactory.createFaxClient method.

 Here is a sample code that creates a new fax client and submits a new fax job:

FaxClientActionEvent

This class holds the fax client action event data.

FaxClientFactory

This is the fax client factory which is used to create new instances of the fax client.

 To create a new instance of the fax client, you will need to invoke the FaxClientFactory.createFaxClient method.

 Here is a sample code that creates a new fax client and submits a new fax job:

FaxMonitorEvent

This class holds the fax monitor event data.

ProductInfo

This class is used to print the product info of the fax4j library.

Enum Summary

Enum
Description

FaxClientActionEvent.FaxClientActionEventID

This is the fax client action event ID enum.

 This enum holds all the possible event ID.

FaxJob.FaxJobPriority

This is the fax job priority enum which holds the possible fax sending priority values.

FaxJobStatus

This is the fax job status enum which holds the possible fax status values.

 Not all SPIs support extraction of the fax job status.

 In case the SPI is unable to extract or does not support extracting of the fax job status, it will return the UNKNOWN
 status.

FaxMonitorEvent.FaxMonitorEventID

This is the fax monitor event ID enum.

 This enum holds all the possible event ID.

Exception Summary

Exception
Description

FaxException

A general exception class used by the fax4j framework.

Package org.fax4j Description

The fax4j library, is a standard on which java based applications can communicate with
    fax devices in order to submit new faxes or perform other related actions.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Copyright © 2009–2020 fax4j. All rights reserved.


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Task = require('../ember-cli/lib/models/task');
const chalk = require("chalk");
const glob = require("glob");
const require_project_module_1 = require("../utilities/require-project-module");
const config_1 = require("../models/config");
exports.default = Task.extend({
    run: function (commandOptions) {
        const ui = this.ui;
        const projectRoot = this.project.root;
        const lintConfigs = config_1.CliConfig.fromProject().config.lint || [];
        if (lintConfigs.length === 0) {
            ui.writeLine(chalk.yellow('No lint configuration(s) found.'));
            return Promise.resolve(0);
        }
        const tslint = require_project_module_1.requireProjectModule(projectRoot, 'tslint');
        const Linter = tslint.Linter;
        const Configuration = tslint.Configuration;
        const result = lintConfigs
            .map((config) => {
            const program = Linter.createProgram(config.project);
            const files = getFilesToLint(program, config, Linter);
            const lintOptions = {
                fix: commandOptions.fix,
                formatter: commandOptions.format
            };
            const lintProgram = commandOptions.typeCheck ? program : undefined;
            const linter = new Linter(lintOptions, lintProgram);
            files.forEach((file) => {
                const sourceFile = program.getSourceFile(file);
                if (!sourceFile) {
                    return;
                }
                const fileContents = sourceFile.getFullText();
                const configLoad = Configuration.findConfiguration(config.tslintConfig, file);
                linter.lint(file, fileContents, configLoad.results);
            });
            return linter.getResult();
        })
            .reduce((total, current) => {
            const failures = current.failures
                .filter((cf) => !total.failures.some((ef) => ef.equals(cf)));
            total.failures = total.failures.concat(...failures);
            if (current.fixes) {
                total.fixes = (total.fixes || []).concat(...current.fixes);
            }
            return total;
        }, {
            failures: [],
            fixes: undefined
        });
        const Formatter = tslint.findFormatter(commandOptions.format);
        const formatter = new Formatter();
        const output = formatter.format(result.failures, result.fixes);
        if (output) {
            ui.writeLine(output);
        }
        // print formatter output directly for non human-readable formats
        if (['prose', 'verbose', 'stylish'].indexOf(commandOptions.format) == -1) {
            return (result.failures.length == 0 || commandOptions.force)
                ? Promise.resolve(0) : Promise.resolve(2);
        }
        if (result.failures.length > 0) {
            ui.writeLine(chalk.red('Lint errors found in the listed files.'));
            return commandOptions.force ? Promise.resolve(0) : Promise.resolve(2);
        }
        ui.writeLine(chalk.green('All files pass linting.'));
        return Promise.resolve(0);
    }
});
function getFilesToLint(program, lintConfig, Linter) {
    let files = [];
    if (lintConfig.files !== null) {
        files = Array.isArray(lintConfig.files) ? lintConfig.files : [lintConfig.files];
    }
    else {
        files = Linter.getFileNames(program);
    }
    let globOptions = {};
    if (lintConfig.exclude !== null) {
        const excludePatterns = Array.isArray(lintConfig.exclude)
            ? lintConfig.exclude
            : [lintConfig.exclude];
        globOptions = { ignore: excludePatterns, nodir: true };
    }
    files = files
        .map((file) => glob.sync(file, globOptions))
        .reduce((a, b) => a.concat(b), []);
    return files;
}
//# sourceMappingURL=/users/mikkeldamm/forked-repos/angular-cli/tasks/lint.js.map


text:
@interface ADCalendarWeekModeViewController ()

@property (nonatomic, strong) NSCalendar *calendar;
@property (nonatomic, strong) NSDate *today;

@property (nonnull, strong) ADWeekModeFlowCalendarViewDataSource *dataSourceMonth;
@property (nonnull, strong) ADWeekModeFlowCalendarViewDelegate *delegate;

@property (nonatomic, strong) ADFlowCalendarView *calendarView;

@property (nonatomic, strong) UISwipeGestureRecognizer *swipeGesture; // swipe to switch prev/next month

@end

@implementation ADCalendarWeekModeViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"WeekMode";
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    self.edgesForExtendedLayout = UIRectEdgeNone;

    self.view.backgroundColor = [UIColor whiteColor];

    self.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
    self.calendar.firstWeekday = 2;
    self.calendar.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:3600*8];
    self.calendar.locale = [NSLocale localeWithLocaleIdentifier:@"zh_CN"];

    self.today = [NSDate date];

    [self setupYearModeCalendarView];

    self.swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGestureDidSwiped:)];
    [self.calendarView addGestureRecognizer:self.swipeGesture];

}

#pragma mark - Actions

- (void)swipeGestureDidSwiped:(UISwipeGestureRecognizer *)gesture{

}

#pragma mark -

- (void)testYearModeDataSource{

    ADWeekModeFlowCalendarViewDataSource *dataSource = [[ADWeekModeFlowCalendarViewDataSource alloc] init];
    dataSource.calendar = self.calendar;
    dataSource.today = self.today;
    dataSource.paddingType = ADWeekModeFlowCalendarPaddingWeek;

    NSDateComponents *startDataCom = [NSDateComponents new];
    startDataCom.year = 2016;
    startDataCom.month = 4;
    startDataCom.day = 10;

    NSDateComponents *endDataCom = [NSDateComponents new];
    endDataCom.year = 2016;
    endDataCom.month = 8;
    endDataCom.day = 7;

    dataSource.startDate = [self.calendar dateFromComponents:startDataCom];
    dataSource.endDate = [self.calendar dateFromComponents:endDataCom];

//    dataSource.startDate = [self.calendar dateFromComponents:startDataCom];
//    dataSource.endDate = [self.calendar dateFromComponents:endDataCom];
//
//    NSArray *sectionDatasArr = [[dataSource sectionDataForSection:0] dayModelArray];
//
//    [sectionDatasArr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
//        NSLog(@"%@",obj);
//
//        ADFlowCalendarSectionData *sectionData = (ADFlowCalendarSectionData *)obj;
//
//        NSLog(@"%@",[sectionData dayModelArray]);
//
//    }];

}

- (void)setupYearModeCalendarView{

    CGRect bounds = self.view.bounds;

    ADFlowCalendarView *calendarView = [[ADFlowCalendarView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(bounds), 60)];
    calendarView.autoresizingMask = UIViewAutoresizingFlexibleWidth ;

    ADWeekModeFlowCalendarViewLayout *layout = [[ADWeekModeFlowCalendarViewLayout alloc] init];
    calendarView.collectionViewLayout = layout;

    // paging enabled
    calendarView.collectionView.pagingEnabled = YES;

    calendarView.separatorLineColor = [UIColor colorWithRed:0xe4/255.0f green:0xe4/255.0f blue:0xe4/255.0f alpha:1.0f];

    self.dataSourceMonth = [self weekModeDataSource];

    [self.dataSourceMonth registerViewClassToFlowCalendar:calendarView];

    calendarView.dataSource = self.dataSourceMonth;

    self.delegate = [self weekModeDelegate];
    calendarView.delegate = self.delegate;

    [self.view addSubview:calendarView];

    self.calendarView = calendarView;

}

- (ADWeekModeFlowCalendarViewDataSource *)weekModeDataSource{
    NVZuesPriceCalendarWeekModeDataSource *dataSource = [[NVZuesPriceCalendarWeekModeDataSource alloc] init];
    dataSource.calendar = self.calendar;
    dataSource.today = self.today;
    dataSource.paddingType = ADWeekModeFlowCalendarPaddingWeek;

    NSDateComponents *startDataCom = [NSDateComponents new];
    startDataCom.year = 2016;
    startDataCom.month = 4;
    startDataCom.day = 20;

    NSDateComponents *endDataCom = [NSDateComponents new];
    endDataCom.year = 2016;
    endDataCom.month = 8;
    endDataCom.day = 7;

    dataSource.startDate = [self.calendar dateFromComponents:startDataCom];
    dataSource.endDate = [self.calendar dateFromComponents:endDataCom];
    return dataSource;
}

- (NVZuesPriceCalendarWeekModeDelegate *)weekModeDelegate{
    NVZuesPriceCalendarWeekModeDelegate *delegate = [[NVZuesPriceCalendarWeekModeDelegate alloc] init];

    return delegate;
}

@end


text:
using ep_cs;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace unit_tests
{
    [TestClass]
    public class Solutions021to030Tests : BaseTest
    {
        [TestMethod]
        public void Solutions021to030Test()
        {
            Test(Solutions.Solution021, nameof(Solutions.Solution021), 31626, TestSpeed.Fast);
            Test(Solutions.Solution022, nameof(Solutions.Solution022), 871198282, TestSpeed.Fast);
            Test(Solutions.Solution023, nameof(Solutions.Solution023), 4179871, TestSpeed.Normal);
            Test(Solutions.Solution024, nameof(Solutions.Solution024), 2783915460, TestSpeed.Fast);
            Test(Solutions.Solution025, nameof(Solutions.Solution025), 4782, TestSpeed.Fast);
            Test(Solutions.Solution026, nameof(Solutions.Solution026), 983, TestSpeed.Fast);
            Test(Solutions.Solution027, nameof(Solutions.Solution027), -59231, TestSpeed.Fast);
            Test(Solutions.Solution028, nameof(Solutions.Solution028), 669171001, TestSpeed.Fast);
            Test(Solutions.Solution029, nameof(Solutions.Solution029), 9183, TestSpeed.Fast);
            Test(Solutions.Solution030, nameof(Solutions.Solution030), 443839, TestSpeed.Fast);
        }

        /// <summary>
        /// Testing of more cases related to Solution025 - first Fibonacci term with n digits
        /// </summary>
        [TestMethod]
        public void Solution025ImplementationTest()
        {
            Assert.AreEqual(7, Solutions.FibonacciTermWithMinDigits(2));
            Assert.AreEqual(12, Solutions.FibonacciTermWithMinDigits(3));
        }

        /// <summary>
        /// Testing of more cases related to Solution026 - reciprocal with longest repetend
        /// </summary>
        [TestMethod]
        public void Solution026ImplementationTest()
        {
            Assert.AreEqual(7, Solutions.LongestRepetend(10));
            Assert.AreEqual(29, Solutions.LongestRepetend(46));
        }

        /// <summary>
        /// Testing of more cases related to Solution028 - spiral diagonal sums
        /// </summary>
        [TestMethod]
        public void Solution028ImplementationTest()
        {
            Assert.AreEqual(101, Solutions.SpiralDiagonalSum(5));
        }

        /// <summary>
        /// Testing of more cases related to Solution029 - distinct powers
        /// </summary>
        [TestMethod]
        public void Solution029ImplementationTest()
        {
            Assert.AreEqual(15, Solutions.DistinctPowerTerms(5, 5));
        }

        /// <summary>
        /// Testing of more cases related to Solution030 - sum of digit powers
        /// </summary>
        [TestMethod]
        public void Solution030ImplementationTest()
        {
            Assert.AreEqual(19316, Solutions.SumNumbersThatAreSumOfPowers(4));
        }
    }
}


text:
if Rails::VERSION::STRING >= "5.0.0"
  class ApplicationRecord < ActiveRecord::Base
    self.abstract_class = true
  end
end


text:
@interface GEOffer ()

@property (nonatomic, strong, readwrite) NSString* provider_logo;
@property (nonatomic, strong, readwrite) NSString* price_in_euros;
@property (nonatomic, strong, readwrite) NSString* departure_time;
@property (nonatomic, strong, readwrite) NSString* arrival_time;
@property (nonatomic, strong, readwrite) NSString* number_of_stops;
@property (nonatomic, strong, readwrite) NSString* duration;
@property (nonatomic, assign) BOOL nextDay;

@end

@implementation GEOffer

- (instancetype)initWithDictionary:(NSDictionary*)dict {
    self = [self init];
    [self setIfExistsValuesForKeysWithDictionary:dict];
    [self computeTime];
    return self;
}

- (void)computeTime {
    NSCalendar* calendar = [NSCalendar currentCalendar];
    NSDate* departureDate = [[GEOffer formatter] dateFromString:self.departure_time];
    NSDate* arrivalDate = [[GEOffer formatter] dateFromString:self.arrival_time];
    NSDateComponents* departureComponents = [calendar components:(NSCalendarUnitHour | NSCalendarUnitMinute) fromDate:departureDate];
    NSDateComponents* arrivalComponents = [calendar components:(NSCalendarUnitHour | NSCalendarUnitMinute) fromDate:arrivalDate];
    if (departureComponents.hour > arrivalComponents.hour) {
        arrivalComponents.day += 1;
        self.nextDay = YES;
    }
    arrivalDate = [calendar dateFromComponents:arrivalComponents];
    NSTimeInterval duration = [arrivalDate timeIntervalSinceDate:departureDate];
    NSDate* durationDate = [NSDate dateWithTimeIntervalSinceReferenceDate:duration];
    self.duration = [[GEOffer formatter] stringFromDate:durationDate];
}

- (void)setProvider_logo:(NSString *)provider_logo {
    if (provider_logo != _provider_logo) {
        _provider_logo = [provider_logo stringByReplacingOccurrencesOfString:@"{size}" withString:@"63"];
    }
}

- (void)setPrice_in_euros:(NSString *)price_in_euros {
    if (price_in_euros != _price_in_euros) {
        _price_in_euros = [NSString stringWithFormat:@"%.02f", price_in_euros.doubleValue];
    }
}

+ (NSDateFormatter*)formatter {
    static NSDateFormatter* sFormatter = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sFormatter = [NSDateFormatter new];
        sFormatter.dateFormat = @"HH:mm";
    });
    return sFormatter;
}

@end


text:
<?php

namespace Oro\Bundle\WindowsBundle\Twig;

use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

use Twig_Environment;
use Doctrine\ORM\EntityManager;
use Oro\Bundle\WindowsBundle\Entity\WindowsState;

class WindowsExtension extends \Twig_Extension
{
    const EXTENSION_NAME = 'oro_windows';

    /**
     * @var SecurityContextInterface
     */
    protected $securityContext;

    /**
     * @var EntityManager
     */
    protected $em;

    /**
     * Protect extension from infinite loop
     *
     * @var bool
     */
    protected $rendered = false;

    /**
     * @param SecurityContextInterface $securityContext
     * @param EntityManager $em
     */
    public function __construct(
        SecurityContextInterface $securityContext,
        EntityManager $em
    ) {
        $this->securityContext = $securityContext;
        $this->em = $em;
    }

    /**
     * Returns a list of functions to add to the existing list.
     *
     * @return array An array of functions
     */
    public function getFunctions()
    {
        return array(
            'oro_windows_restore' => new \Twig_Function_Method(
                $this,
                'render',
                array(
                    'is_safe' => array('html'),
                    'needs_environment' => true
                )
            )
        );
    }

    /**
     * Renders a menu with the specified renderer.
     *
     * @param \Twig_Environment $environment
     * @param array $options
     *
     * @return string
     */
    public function render(Twig_Environment $environment, array $options = array())
    {
        if (!($user = $this->getUser()) || $this->rendered) {
            return '';
        }
        $this->rendered = true;

        $states = array();
        $windowsList = $this->em->getRepository('OroWindowsBundle:WindowsState')->findBy(array('user' => $user));
        /** @var $windowState WindowsState */
        foreach ($windowsList as $windowState) {
            $data = $windowState->getData();
            if (!$data) {
                $this->em->remove($windowState);
                $this->em->flush();
            } elseif (array_key_exists('cleanUrl', $data) && array_key_exists('type', $data)) {
                $data['cleanUrl'] = $this->getUrlWithContainer($data['cleanUrl'], $data['type']);
                $states[$windowState->getId()] = $data;
            }
        }

        return $environment->render(
            "OroWindowsBundle::states.html.twig",
            array("states" => $states)
        );
    }

    /**
     * Get a user from the Security Context
     *
     * @return null|mixed
     * @throws \LogicException If SecurityBundle is not available
     * @see Symfony\Component\Security\Core\Authentication\Token\TokenInterface::getUser()
     */
    public function getUser()
    {
        /** @var $token TokenInterface */
        if (null === $token = $this->securityContext->getToken()) {
            return null;
        }

        if (!is_object($user = $token->getUser())) {
            return null;
        }

        return $user;
    }

    protected function getUrlWithContainer($url, $container)
    {
        if (strpos($url, '_widgetContainer=') === false) {
            $parts = parse_url($url);
            $widgetPart = '_widgetContainer=' . $container;
            if (array_key_exists('query', $parts)) {
                $separator = $parts['query'] ? '&' : '';
                $newQuery = $parts['query'] . $separator . $widgetPart;
                $url = str_replace($parts['query'], $newQuery, $url);
            } else {
                $url .= '?' . $widgetPart;
            }
        }
        return $url;
    }

    /**
     * Returns the name of the extension.
     *
     * @return string The extension name
     */
    public function getName()
    {
        return self::EXTENSION_NAME;
    }
}


text:
import           Universum

import           Spec (spec)
import           Test.Hspec (hspec)

main :: IO ()
main = hspec spec


text:
package com.intellij.ide.commander;

import com.intellij.ide.PsiCopyPasteManager;
import com.intellij.ide.TwoPaneIdeView;
import com.intellij.ide.projectView.ProjectViewNode;
import com.intellij.ide.projectView.impl.AbstractProjectTreeStructure;
import com.intellij.ide.projectView.impl.ProjectAbstractTreeStructureBase;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.AlphaComparator;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.diff.actions.CompareFiles;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.wm.FocusWatcher;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.ui.AutoScrollToSourceHandler;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;

import javax.swing.*;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;

/**
 * @author Eugene Belyaev
 */
@State(
  name="Commander",
  storages= {
    @Storage(
      id="other",
      file = "$WORKSPACE_FILE$"
    )}
)
public class Commander extends JPanel implements PersistentStateComponent<Element>, DataProvider, TwoPaneIdeView, Disposable {
  private Project myProject;
  private CommanderPanel myLeftPanel;
  private CommanderPanel myRightPanel;
  private Splitter mySplitter;
  private ListSelectionListener mySelectionListener;
  private ListDataListener myListDataListener;
  public boolean MOVE_FOCUS = true; // internal option: move focus to editor when class/file/...etc. is created
  private Element myElement;
  private FocusWatcher myFocusWatcher;
  private CommanderHistory myHistory;
  private boolean myAutoScrollMode = false;
  private final ToolWindowManager myToolWindowManager;
  @NonNls private static final String ACTION_BACKCOMMAND = "backCommand";
  @NonNls private static final String ACTION_FORWARDCOMMAND = "forwardCommand";
  @NonNls private static final String ELEMENT_LEFTPANEL = "leftPanel";
  @NonNls private static final String ATTRIBUTE_MOVE_FOCUS = "MOVE_FOCUS";
  @NonNls private static final String ELEMENT_OPTION = "OPTION";
  @NonNls private static final String ATTRIBUTE_PROPORTION = "proportion";
  @NonNls private static final String ELEMENT_SPLITTER = "splitter";
  @NonNls private static final String ELEMENT_RIGHTPANEL = "rightPanel";
  @NonNls private static final String ATTRIBUTE_URL = "url";
  @NonNls private static final String ATTRIBUTE_CLASS = "class";

  /**
   * FOR USE IN TESTS ONLY!!!
   * @param project
   * @param keymapManager
   */
  public Commander(final Project project, KeymapManager keymapManager) {
    this(project, keymapManager, null);
  }

  public Commander(final Project project, KeymapManager keymapManager, final ToolWindowManager toolWindowManager) {
    super(new BorderLayout());
    myProject = project;
    myToolWindowManager = toolWindowManager;

    final AbstractAction backAction = new AbstractAction() {
      public void actionPerformed(final ActionEvent e) {
        myHistory.back();
      }
    };
    final AbstractAction fwdAction = new AbstractAction() {
      public void actionPerformed(final ActionEvent e) {
        myHistory.forward();
      }
    };
    final ActionMap actionMap = getActionMap();
    actionMap.put(ACTION_BACKCOMMAND, backAction);
    actionMap.put(ACTION_FORWARDCOMMAND, fwdAction);
    final KeyStroke[] backStrokes = getKeyStrokes(IdeActions.ACTION_GOTO_BACK, keymapManager);
    for (int idx = 0; idx < backStrokes.length; idx++) {
      KeyStroke stroke = backStrokes[idx];
      //getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "backCommand");
      //getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke, "backCommand");
      registerKeyboardAction(backAction, ACTION_BACKCOMMAND, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
      registerKeyboardAction(backAction, ACTION_BACKCOMMAND, stroke, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    }

    final KeyStroke[] fwdStrokes = getKeyStrokes(IdeActions.ACTION_GOTO_FORWARD, keymapManager);
    for (int idx = 0; idx < fwdStrokes.length; idx++) {
      KeyStroke stroke = fwdStrokes[idx];
      //getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "forwardCommand");
      //getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke, "forwardCommand");
      registerKeyboardAction(fwdAction, ACTION_FORWARDCOMMAND, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
      registerKeyboardAction(fwdAction, ACTION_FORWARDCOMMAND, stroke, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    }

    myHistory = new CommanderHistory(this);

    setupImpl();
  }

  public static Commander getInstance(final Project project) {
    return ServiceManager.getService(project, Commander.class);
  }

  public CommanderHistory getCommandHistory() {
    return myHistory;
  }

  private void processConfigurationElement() {
    if (myElement == null) return;

    Element element;

    element = myElement.getChild(ELEMENT_LEFTPANEL);
    if (element != null) {
      final PsiElement parentElement = readParentElement(element);
      if (parentElement != null) {
        myLeftPanel.getBuilder().enterElement(parentElement, PsiUtilBase.getVirtualFile(parentElement));
      }
    }

    element = myElement.getChild(ELEMENT_RIGHTPANEL);
    if (element != null) {
      final PsiElement parentElement = readParentElement(element);
      if (parentElement != null) {
        myRightPanel.getBuilder().enterElement(parentElement, PsiUtilBase.getVirtualFile(parentElement));
      }
    }

    element = myElement.getChild(ELEMENT_SPLITTER);
    if (element != null) {
      final String attribute = element.getAttributeValue(ATTRIBUTE_PROPORTION);
      if (attribute != null) {
        try {
          final float proportion = Float.valueOf(attribute).floatValue();
          if (proportion >= 0 && proportion <= 1) {
            mySplitter.setProportion(proportion);
          }
        } catch (NumberFormatException e) {
        }
      }
    }

    element = myElement.getChild(ELEMENT_OPTION);
    if (element != null) {
      //noinspection HardCodedStringLiteral
      MOVE_FOCUS = !"false".equals(element.getAttributeValue(ATTRIBUTE_MOVE_FOCUS));
    }

    myLeftPanel.setActive(false);
    myRightPanel.setActive(false);
    myLeftPanel.setMoveFocus(MOVE_FOCUS);
    myRightPanel.setMoveFocus(MOVE_FOCUS);

    myElement = null;
  }

  private KeyStroke[] getKeyStrokes(String actionId, KeymapManager keymapManager) {
    final Shortcut[] shortcuts = keymapManager.getActiveKeymap().getShortcuts(actionId);
    final java.util.List<KeyStroke> strokes = new ArrayList<KeyStroke>();
    for (int i = 0; i < shortcuts.length; i++) {
      final Shortcut shortcut = shortcuts[i];
      if (shortcut instanceof KeyboardShortcut) {
        strokes.add(((KeyboardShortcut)shortcut).getFirstKeyStroke());
      }
    }
    return strokes.toArray(new KeyStroke[strokes.size()]);
  }

  public void setupImpl() {
    mySelectionListener = new ListSelectionListener() {
      public void valueChanged(final ListSelectionEvent e) {
        updateToolWindowTitle();
      }
    };
    myListDataListener = new ListDataListener() {
      public void intervalAdded(final ListDataEvent e) {
        updateToolWindowTitle();
      }

      public void intervalRemoved(final ListDataEvent e) {
        updateToolWindowTitle();
      }

      public void contentsChanged(final ListDataEvent e) {
        updateToolWindowTitle();
      }
    };
    myFocusWatcher = new FocusWatcher();

    myLeftPanel = createPanel();
    myLeftPanel.addHistoryListener(new CommanderHistoryListener() {
      public void historyChanged(final PsiElement selectedElement, final boolean elementExpanded) {
        getCommandHistory().saveState(selectedElement, elementExpanded, true);
      }
    });
    myRightPanel = createPanel();
    myRightPanel.addHistoryListener(new CommanderHistoryListener() {
      public void historyChanged(final PsiElement selectedElement, final boolean elementExpanded) {
        getCommandHistory().saveState(selectedElement, elementExpanded, false);
      }
    });

    mySplitter = new Splitter();
    mySplitter.setFirstComponent(myLeftPanel);
    mySplitter.setSecondComponent(myRightPanel);

    add(mySplitter, BorderLayout.CENTER);

    final AutoScrollToSourceHandler handler = new AutoScrollToSourceHandler() {
      protected boolean isAutoScrollMode() {
        return myAutoScrollMode;
      }

      protected void setAutoScrollMode(boolean state) {
        myAutoScrollMode = state;
      }
    };
    handler.install(myLeftPanel.getList());
    handler.install(myRightPanel.getList());

    final boolean shouldAddToolbar = !ApplicationManager.getApplication().isUnitTestMode();
    if (shouldAddToolbar) {
      final DefaultActionGroup toolbarActions = createToolbarActions();
      toolbarActions.add(handler.createToggleAction());
      final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.COMMANDER_TOOLBAR, toolbarActions, true);
      add(toolbar.getComponent(), BorderLayout.NORTH);
    }

    myFocusWatcher.install(this);
  }

  private DefaultActionGroup createToolbarActions() {
    final ActionManager actionManager = ActionManager.getInstance();
    final DefaultActionGroup group = new DefaultActionGroup();

    final AnAction backAction = new AnAction() {
      public void actionPerformed(AnActionEvent e) {
        myHistory.back();
      }

      public void update(AnActionEvent e) {
        super.update(e);
        e.getPresentation().setEnabled(myHistory.canGoBack());
      }
    };
    backAction.copyFrom(actionManager.getAction(IdeActions.ACTION_GOTO_BACK));
    group.add(backAction);

    final AnAction forwardAction = new AnAction() {
      public void actionPerformed(AnActionEvent e) {
        myHistory.forward();
      }

      public void update(AnActionEvent e) {
        super.update(e);
        e.getPresentation().setEnabled(myHistory.canGoForward());
      }
    };
    forwardAction.copyFrom(actionManager.getAction(IdeActions.ACTION_GOTO_FORWARD));
    group.add(forwardAction);

    group.add(actionManager.getAction(IdeActions.ACTION_COMMANDER_SWAP_PANELS));
    group.add(actionManager.getAction(IdeActions.ACTION_COMMANDER_SYNC_VIEWS));

    return group;
  }

  private CommanderPanel createPanel() {
    final CommanderPanel panel = new CommanderPanel(myProject, true);

    panel.getList().addKeyListener(new KeyAdapter() {
      public void keyPressed(final KeyEvent e) {
        if (KeyEvent.VK_ESCAPE == e.getKeyCode()) {
          if (e.isConsumed()) return;
          final PsiCopyPasteManager copyPasteManager = PsiCopyPasteManager.getInstance();
          final boolean[] isCopied = new boolean[1];
          if (copyPasteManager.getElements(isCopied) != null && !isCopied[0]) {
            copyPasteManager.clear();
            e.consume();
          }
        }
      }
    });

    final ProjectAbstractTreeStructureBase treeStructure = createProjectTreeStructure();
    panel.setBuilder(new ProjectListBuilder(myProject, panel, treeStructure, AlphaComparator.INSTANCE, true));
    panel.setProjectTreeStructure(treeStructure);

    final FocusAdapter focusListener = new FocusAdapter() {
      public void focusGained(final FocusEvent e) {
        updateToolWindowTitle(panel);
      }
    };
    final JList list = panel.getList();
    list.addFocusListener(focusListener);
    list.getSelectionModel().addListSelectionListener(mySelectionListener);
    list.getModel().addListDataListener(myListDataListener);

    Disposer.register(this, new Disposable() {
      public void dispose() {
        list.removeFocusListener(focusListener);
        list.getSelectionModel().removeListSelectionListener(mySelectionListener);
        list.getModel().removeListDataListener(myListDataListener);
      }
    });
    return panel;
  }

  protected AbstractProjectTreeStructure createProjectTreeStructure() {
    return new AbstractProjectTreeStructure(myProject) {
      public boolean isShowMembers() {
        return true;
      }

      public boolean isHideEmptyMiddlePackages() {
        return false;
      }

      public boolean isFlattenPackages() {
        return false;
      }

      public boolean isAbbreviatePackageNames() {
        return false;
      }

      public boolean isShowLibraryContents() {
        return false;
      }

      public boolean isShowModules() {
        return false;
      }
    };
  }

  /**
   * invoked in AWT thread
   */
  private void updateToolWindowTitle() {
    final CommanderPanel panel = getActivePanel();
    updateToolWindowTitle(panel);
  }

  protected void updateToolWindowTitle(final CommanderPanel activePanel) {
    final ToolWindow toolWindow = myToolWindowManager.getToolWindow(ToolWindowId.COMMANDER);
    if (toolWindow != null) {
      final AbstractTreeNode node = activePanel.getSelectedNode();
      if (node instanceof ProjectViewNode) {
        toolWindow.setTitle(((ProjectViewNode)node).getTitle());
      }
    }
  }

  public boolean isLeftPanelActive() {
    return isPanelActive(myLeftPanel);
  }

  boolean isPanelActive(final CommanderPanel panel) {
    return panel.getList() == myFocusWatcher.getFocusedComponent();
  }

  public void selectElementInLeftPanel(final Object element, VirtualFile virtualFile) {
    myLeftPanel.getBuilder().selectElement(element, virtualFile);
    if (!isPanelActive(myLeftPanel)) {
      switchActivePanel();
    }
  }

  public void selectElementInRightPanel(final Object element, VirtualFile virtualFile) {
    myRightPanel.getBuilder().selectElement(element, virtualFile);
    if (!isPanelActive(myRightPanel)) {
      switchActivePanel();
    }
  }

  public void switchActivePanel() {
    final CommanderPanel activePanel = getActivePanel();
    final CommanderPanel inactivePanel = getInactivePanel();
    inactivePanel.setActive(true);
    activePanel.setActive(false);
    IdeFocusTraversalPolicy.getPreferredFocusedComponent(inactivePanel).requestFocus();
  }

  public void enterElementInActivePanel(final PsiElement element) {
    final CommanderPanel activePanel;
    if (isLeftPanelActive()) {
      activePanel = myLeftPanel;
    } else {
      activePanel = myRightPanel;
    }
    activePanel.getBuilder().enterElement(element, PsiUtilBase.getVirtualFile(element));
  }

  public void swapPanels() {
    mySplitter.swapComponents();

    final CommanderPanel tmpPanel = myLeftPanel;
    myLeftPanel = myRightPanel;
    myRightPanel = tmpPanel;
  }

  public void syncViews() {
    final CommanderPanel activePanel;
    final CommanderPanel passivePanel;
    if (isLeftPanelActive()) {
      activePanel = myLeftPanel;
      passivePanel = myRightPanel;
    } else {
      activePanel = myRightPanel;
      passivePanel = myLeftPanel;
    }
    ProjectViewNode element = (ProjectViewNode)activePanel.getBuilder().getParentNode();
    passivePanel.getBuilder().enterElement(element);
  }

  public CommanderPanel getActivePanel() {
    return isLeftPanelActive() ? myLeftPanel : myRightPanel;
  }

  public CommanderPanel getInactivePanel() {
    return !isLeftPanelActive() ? myLeftPanel : myRightPanel;
  }

  public Object getData(final String dataId) {
    if (DataConstants.HELP_ID.equals(dataId)) {
      return HelpID.COMMANDER;
    }
    else if (DataConstants.PROJECT.equals(dataId)) {
      return myProject;
    }
    else if (DataConstantsEx.TARGET_PSI_ELEMENT.equals(dataId)) {
      final AbstractTreeNode parentElement = getInactivePanel().getBuilder().getParentNode();
      if (parentElement == null) return null;
      final Object element = parentElement.getValue();
      return (element instanceof PsiElement) && ((PsiElement)element).isValid()? element : null;
    }
    else if (CompareFiles.DIFF_REQUEST.getName().equals(dataId)) {
      PsiElement primary = getActivePanel().getSelectedElement();
      PsiElement secondary = getInactivePanel().getSelectedElement();
      if (primary != null && secondary != null &&
          primary.isValid() && secondary.isValid() &&
          !PsiTreeUtil.isAncestor(primary, secondary, false) &&
          !PsiTreeUtil.isAncestor(secondary, primary, false)) {
        return PsiDiffContentFactory.comparePsiElements(primary, secondary);
      }
      return null;
    }
    else {
      return getActivePanel().getDataImpl(dataId);
    }
  }

  public Element getState() {
    Element element = new Element("commander");
    if (myLeftPanel == null || myRightPanel == null) {
      return element;
    }
    PsiDocumentManager.getInstance(myProject).commitAllDocuments();
    Element e = new Element(ELEMENT_LEFTPANEL);
    element.addContent(e);
    writePanel(myLeftPanel, e);
    e = new Element(ELEMENT_RIGHTPANEL);
    element.addContent(e);
    writePanel(myRightPanel, e);
    e = new Element(ELEMENT_SPLITTER);
    element.addContent(e);
    e.setAttribute(ATTRIBUTE_PROPORTION, Float.toString(mySplitter.getProportion()));
    if (!MOVE_FOCUS) {
      e = new Element(ELEMENT_OPTION);
      element.addContent(e);
      //noinspection HardCodedStringLiteral
      e.setAttribute(ATTRIBUTE_MOVE_FOCUS, "false");
    }
    return element;
  }

  private static void writePanel(final CommanderPanel panel, final Element element) {
    /*TODO[anton,vova]: it's a patch!!!*/
    final AbstractListBuilder builder = panel.getBuilder();
    if (builder == null) return;

    final AbstractTreeNode parentNode = builder.getParentNode();
    final Object parentElement = parentNode != null? parentNode.getValue() : null;
    if (parentElement instanceof PsiDirectory) {
      final PsiDirectory directory = (PsiDirectory) parentElement;
      element.setAttribute(ATTRIBUTE_URL, directory.getVirtualFile().getUrl());
    }
    else if (parentElement instanceof PsiClass) {
      for (PsiElement e = (PsiElement) parentElement; e != null && e.isValid(); e = e.getParent()) {
        if (e instanceof PsiClass) {
          final String qualifiedName = ((PsiClass) e).getQualifiedName();
          if (qualifiedName != null) {
            element.setAttribute(ATTRIBUTE_CLASS, qualifiedName);
            break;
          }
        }
      }
    }
  }

  public void loadState(Element state) {
    myElement = state;
    processConfigurationElement();
    myElement = null;
  }

  private PsiElement readParentElement(final Element element) {
    if (element.getAttributeValue(ATTRIBUTE_URL) != null) {
      final String url = element.getAttributeValue(ATTRIBUTE_URL);
      final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
      return file != null ? PsiManager.getInstance(myProject).findDirectory(file) : null;
    } else if (element.getAttributeValue(ATTRIBUTE_CLASS) != null) {
      final String className = element.getAttributeValue(ATTRIBUTE_CLASS);
      return className != null ? JavaPsiFacade.getInstance(myProject).findClass(className) : null;
    }
    return null;
  }

  public void dispose() {
    if (myLeftPanel == null) {
      // not opened project (default?)
      return;
    }
    myLeftPanel.dispose();
    myRightPanel.dispose();
    myHistory.clearHistory();
    myProject = null;
  }

  public CommanderPanel getRightPanel() {
    return myRightPanel;
  }

  public CommanderPanel getLeftPanel() {
    return myLeftPanel;
  }

  public void selectElement(PsiElement element, boolean selectInActivePanel) {
    CommanderPanel panel = selectInActivePanel ? getActivePanel() : getInactivePanel();
    panel.getBuilder().selectElement(element, PsiUtilBase.getVirtualFile(element));
  }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mr_kitten;
import java.util.*;
/**
 * Write a description of class Actors here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class Actors
{
    // instance variables - replace the example below with your own
    private int actorHealth;
    private String actorName;
    private int attackDamage;
    private String critWeakness;
    private Room position;
    private String punchline;

    /**
     * Constructor for objects of class Actors
     */
    public Actors(String name, int health, int attack, String weakness, Room position, String punchline)
    {
        actorHealth = health;
        actorName = name;
        attackDamage = attack;
        critWeakness = weakness;
        this.position = position;
        this.punchline = punchline;
    }

    /**
     * get health
     */
    public int getHealth ()
    {
        return actorHealth;
    }

    /**
     * get AD
     */
    public int getAD ()
    {
        return attackDamage;
    }

    /**
     * get name
     */
    public String getActorName()
    {
        return actorName;
    }

    /**
     * get weakness
     */
    public String getWeakness()
    {
        return critWeakness;
    }

    /**
     * get position
     */
    public Room getActorPosition()
    {
        return position;
    }

    public static String redFishDialog(){
        String redFish = ("Mr Kitten, \n"
                +"\n I am here to inform you that the King of the Waterworld summons you to the underwater court.\n"
                +"\n You will be judged for the murder of one of our beloved citizens, an honest goldfish who used to live in the same house you did."
                +"\n We expect your presence in the court in 3 water days, or else you will be hunted down and executed for your crimes. \n");
        return redFish;
    }

    public static String ratatouilleDialog(){
        String ratatouille =("Hello, young cat. I have heard of you. I think you could use some help in your quest."
                + "\n I can teach you something, and I hope you will make good use of it. I also hope that this action will unite the Cats and Rats race for a very long time."
                + "\n I have a dream that our txo races can live together peacefully.");
        return ratatouille;
    }

    public static String mrRobotDialog(){
        String robotDialog = ("Bip Beep Bop, stranger detected. Beep beep, danger incoming"
                + "\n Must..destroy..."
                + "\n The danger..."
                + "\n Beep...");
        return robotDialog;
    }

    public static String garfieldDialog(){
    String garfield =("Hey buddy...What are you carrying there? \n"
            +"\n Oh my...Is that the ancient Cat book? Are you a descendant of the Ancients? \n"
            +"\n You look pretty young. I bet you do not know our race story.\n"
            +"\n Long ago, the ancient Cats were very powerful. But today, they have almost disappeared.\n"
            +"\n Today, only small, dumb and domesticated cats remain.\n"
            +"\n Humans made us their pets, can you believe that? They torn families apart, sell our babies to stranger. \n They kill the free cats that live on the street. These nasty humans even cut some of us when they don't want us to reproduce and have a family.\n"
            +"\n I know this is shocking, but it is the truth.\n ");
        return garfield;
    }

    public static String sharkDialog(){
        String shark= ("Look at that Bruce! A furry fish! We have to taste that. Prepare to die!");
        return shark;
    }

    public static String darkMouleDialog(){
        String darkmoule= ("Who do you think you are?!"
                + "\n You cannot prevail, you silly kitty..."
                + "\n I will crush you!");
        return darkmoule;
    }

    public static String pussInBootsDialog(){
        String inboots= ("Hola, Senor Gato!"
                + "\n I see you come from the portal. It has been a long time since it has been used!"
                + "\n By another cat that looks like yoy, by the way..."
                + "\n I have heard about your quest, and I want you to know that I support you!"
                + "\n Let me teach you something that could be of a great help, for this quest and for all your life...");
        return inboots;
    }

    public static String brotherDialog(){
        String brother = ("So, here you are...brother. I have been waiting for you."
                + "\n Do not look so suprised! I am an Ancient Cat, just like you."
                + "\n When I first heard about the magical Guillotine, I knew I was the only one who could use it."
                + "\n And you, you want to take it, and spread power amongst these dumb kitties!"
                + "\n This would only lead us to chaos...But if you join me, we could rule the world, together!"
                + "\n You don't want to?... You are just like Mom and Dad, to blind and stupid to see what's right!"
                + "\n I will never let you take it!");
        return brother;
    }
     public static String vadorDialog_a() {
        String vadorA= ("Oh well ! A new visitor in my house. Do you know where you are ?"
                + "\n Because I'm the answer to all your questions indeed I'm in the darkside where all is possible ! Ahahah !"
                + "\n I can propose to you a nice offer. A full time job in the darkside coorporation !");
        return vadorA;
    }

    public static String vadorDialog_b() {
        String vadorB= ("What ?! You can't refuse this offer !!"
                + "\n Let's fight and see my superiority !!");
        return vadorB;
    }

    public static String doryDialog_intro (){
        String dory=("You got a problem buddy?! Wait, did I just said that? Oh, I just met you,"
                + "\n and this is crazy, but here's my number. Hey how is it going mate?"
                + "\n Oh I might need your help! Do you know where Marin is going?"
                + "\n     a - P. Sherman Wallaby Way in Sydney Bitch!"
                + "\n     b - Somewhere only we know <3"
                + "\n     c - I heard something that my cousin told me about a women he was seeing in some places"
                + "\n and that she was sometimes refering to someone as Marin, but i don't know if that's him because my dad also told me she was"
                + "\n pretty crazy but as my mom said, never trust a man that can't even scratch a butterfly."
                + "\n     d - answer d"
                + "\n Enter the character please :");
        return dory;
    }

    public static String doryDialog_good(){
        String dorygood=("I also remember that I have a History test tomorrow!"
                + "\n You gotta help me! Just remember me which animal is"
                + "\n the great defender of the world!"
                + "\n     a - Superman! Have you seen his underwear? So much red!"
                + "\n     b - Magicarpe! Obviously this magesterial fish! And he is red too!"
                + "\n     c - Etalon du cul! What a french name for a true hero! "
                + "\n     d - Do you really want the D?"
                + "\n Enter the character please :");
        return dorygood;
    }
}