text:
#pragma once
#ifndef ZORBA_MMAP_FILE_H
#define ZORBA_MMAP_FILE_H

#include <zorba/config.h>
#ifdef ZORBA_WITH_FILE_ACCESS

#include <cstddef>                      /* for ptrdiff_t, size_t */
#include <fstream>                      /* for openmode */
#include <iterator>
#include <string>
#include <sys/types.h>                  /* needed by FreeBSD systems */

#ifdef WIN32
# include <windows.h>                   /* for HANDLE */
#endif /* WIN32 */

#include "fs_util.h"

//
// Some C headers on some implementations define open/close as macros to remap
// them to functions that handle files larger than 2 GB.  This works fine in C,
// but can break C++ where classes have open/close member functions.  Undefine
// them and live with the consequence of not being able to deal with large
// files on such implementations.
//
#ifdef  open
# undef open
#endif
#ifdef  close
# undef close
#endif

namespace zorba {

/**
 * An %mmap_file is an object that maps a file into memory (via the Unix system
 * call mmap(2)) allowing it to be accessed via iterators.  Processing a file,
 * especially files accessed randomly, is MUCH faster than standard I/O.
 */
class mmap_file {
public:

  ////////// typedefs /////////////////////////////////////////////////////////

  typedef char value_type;
  typedef value_type* pointer;
  typedef value_type const* const_pointer;
  typedef value_type& reference;
  typedef value_type const& const_reference;
  typedef fs::size_type size_type;
  typedef ptrdiff_t difference_type;

  typedef pointer iterator;
  typedef const_pointer const_iterator;
  typedef std::reverse_iterator<iterator> reverse_iterator;
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;

  ////////// constructors & destructor ////////////////////////////////////////

  /**
   * Constructs an %mmap_file not mapped to any file.
   */
  mmap_file() {
    init();
  }

  /**
   * Constructs an %mmap_file mapped to the given file.
   *
   * @param path The full path of the file to map.
   * @param mode The mode to use for opening/mapping the file.
   */
  explicit mmap_file( char const *path,
                      std::ios::openmode mode = std::ios::in ) {
    init();
    open( path, mode );
  }

  /**
   * Destructs this %mmap_file that unmaps the file.
   */
  ~mmap_file() {
    close();
  }

  ////////// iterators ////////////////////////////////////////////////////////

  /**
   * Returns a read/write iterator positioned at the first byte of the file.
   *
   * @return Returns said iterator.
   */
  iterator begin() {
    return static_cast<iterator>( addr_ );
  }

  /**
   * Returns a read-only iterator positioned at the first byte of the file.
   *
   * @return Returns said iterator.
   */
  const_iterator begin() const {
    return static_cast<const_iterator>( addr_ );
  }

  /**
   * Returns a read/write iterator positioned at one past the last byte of the
   * file.
   *
   * @return Returns said iterator.
   */
  iterator end() {
    return begin() + size_;
  }

  /**
   * Returns a read-only iterator positioned at one past the last byte of the
   * file.
   *
   * @return Returns said iterator.
   */
  const_iterator end() const {
    return begin() + size_;
  }

  /**
   * Returns a read/write reverse iterator positioned at the last byte of the
   * file.
   *
   * @return Returns said iterator.
   */
  reverse_iterator rbegin() {
    return reverse_iterator( end() );
  }

  /**
   * Returns a read-only reverse iterator positioned at the last byte of the
   * file.
   *
   * @return Returns said iterator.
   */
  const_reverse_iterator rbegin() const {
    return const_reverse_iterator( end() );
  }

  /**
   * Returns a read/write reverse iterator positioned at the last byte of the
   * file.
   *
   * @return Returns said iterator.
   */
  reverse_iterator rend() {
    return reverse_iterator( begin() );
  }

  /**
   * Returns a read-only reverse iterator positioned at the last byte of the
   * file.
   *
   * @return Returns said iterator.
   */
  const_reverse_iterator rend() const {
    return const_reverse_iterator( begin() );
  }

  ////////// other functions //////////////////////////////////////////////////

  /**
   * Gets the last character.
   *
   * @return Returns a reference to said character.
   */
  reference back() {
    return *( end() - 1 );
  }

  /**
   * Gets the last character.
   *
   * @return Returns a reference to said character.
   */
  const_reference back() const {
    return *( end() - 1 );
  }

  /**
   * Gets the first character.
   *
   * @return Returns a reference to said character.
   */
  reference front() {
    return *begin();
  }

  /**
   * Gets the first character.
   *
   * @return Returns a reference to said character.
   */
  const_reference front() const {
    return *begin();
  }

  /**
   * Maps the given file.  If this %mmap_file is already mapped to a file, that
   * file is unmapped first.
   *
   * @param path The full path of the file to map.
   * @param mode The mode to use for opening/mapping the file.
   */
  void open( char const *path, std::ios::openmode = std::ios::in );

  /**
   * Unmaps the file.  If this %mmap_file is not mapped to a file, does
   * nothing.
   */
  void close();

  /**
   * Checks whether the mapped file is empty.
   *
   * @return Returns \c true either if the mapped file is empty or this
   * %mmap_file is not mapped to a file.
   */
  bool empty() const {
    return !size_;
  }

  /**
   * Gets the size of the mapped file.
   *
   * @return Returns said size or 0 if this %mmap_file is not mapped to a file.
   */
  size_type size() const {
    return size_;
  }

  /**
   * Checks whether this %mmap_file is mapped to a file.
   *
   * @return Returns \c true only if it is.
   */
  operator bool() const {
    return !!addr_;
  }

  /**
   * Gets the ith character.
   *
   * @param i The index of the character.
   * @return Returns a reference to said character.
   */
  reference operator[]( size_type i ) {
    return *( begin() + i );
  }

  /**
   * Gets the ith character.
   *
   * @param i The index of the character.
   * @return Returns a reference to said character.
   */
  const_reference operator[]( size_type i ) const {
    return *( begin() + i );
  }

 //////////////////////////////////////////////////////////////////////////////

private:
  std::string path_;
#ifdef WIN32
  HANDLE      fd_;
  HANDLE      mapping_;
#else
  int         fd_;
#endif /* WIN32 */
  size_type   size_;
  void        *addr_;

  void        init();

  // forbid these
  mmap_file( mmap_file const& );
  mmap_file& operator=( mmap_file const& );
};

} // namespace zorba
#endif /* ZORBA_WITH_FILE_ACCESS */
#endif /* ZORBA_MMAP_FILE_H */
/* vim:set et sw=2 ts=2: */


text:
namespace content {

string16 IAccessibleRoleToString(int32 ia_role);
string16 IAccessible2RoleToString(int32 ia_role);
string16 IAccessibleStateToString(int32 ia_state);
void IAccessibleStateToStringVector(int32 ia_state,
                                    std::vector<string16>* result);
string16 IAccessible2StateToString(int32 ia2_state);
void IAccessible2StateToStringVector(int32 ia_state,
                                     std::vector<string16>* result);

}  // namespace content

#endif  // CONTENT_PUBLIC_TEST_ACCESSIBILITY_TEST_UTILS_WIN_H_

redpajama_set_name: RedPajamaGithub


text:
package net.sf.sdedit.util;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

import javax.swing.ListModel;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;

import net.sf.sdedit.util.CollectionState.CollectionStateChangeListener;

public class ListModelAdapter implements ListModel, CollectionStateChangeListener {

	private List<ListDataListener> listeners;

	private CollectionState collectionState;

	private Object [] data;

	public ListModelAdapter () {
		listeners = new LinkedList<ListDataListener>();
		collectionState = new CollectionState();
		collectionState.addListener(this);
	}

	public void setData (Collection<?> data) {
		this.data = data.toArray();
		collectionState.update(data);
	}

	public void addListDataListener(ListDataListener l) {
		listeners.add(l);
	}

	public Object [] getData () {
		return data;
	}

	public Object getElementAt(int index) {
		return data[index];
	}

	public int getSize() {
		if (data == null) {
			return 0;
		}
		return data.length;
	}

	public void removeListDataListener(ListDataListener l) {
		listeners.remove(l);
	}

	public void itemsAdded(int[] indices) {
		ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, indices[0], indices[indices.length-1]);
		for (ListDataListener listener : listeners) {
			listener.intervalAdded(lde);
		}
	}

	public void itemsChanged(int[] indices) {
		for (ListDataListener listener : listeners) {
			for (int i : indices) {
				ListDataEvent lde = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, i, i);
				listener.contentsChanged(lde);
			}
		}
	}

	public void itemsRemoved(int[] indices) {
		ListDataEvent lde = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, indices[0], indices[indices.length-1]);
		for (ListDataListener listener : listeners) {
			listener.intervalRemoved(lde);
		}
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="java"/>
  <fixed facet="jst.web"/>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.7"/>
  <installed facet="jst.web" version="2.2"/>
  <installed facet="me.hibernate" version="4.1"/>
  <installed facet="me.spring" version="3.1"/>
  <installed facet="maven" version="1.0"/>
</faceted-project>


text:
layout: single
title:  "*Flying*  Edition 1"
sidebar:
  nav: news
---

## Dear Spinnaker enthusiasts,

Hi! Welcome to the Spinnaker Newsletter, your source for info about the project and community. We'll focus on news for Spinnaker users, operators, and contributors.

## Spinnaker Summit 2019 (the best yet!)

We just wrapped an incredible Summit. In case you missed it (or want to replay each delicious moment) here's a [reflection from the Armory blog](http://go.armory.io/keynote) and a video of [Isaac Mosquera's keynote](https://www.youtube.com/watch?v=BBdFOZASQ_4), along with recaps from OpsMX highlighting [5 key takeaways](https://blog.opsmx.com/spinnaker-summit-2019-recap/),  as well as [technical and feature takeaways](https://blog.opsmx.com/spinnaker-summit-2019-some-key-technical-takeaways/).

Attendees had numerous opportunities to connect, and high-quality sessions to choose from. Apart from helpful accounts of enterprise Spinnaker adoption journeys, we also hosted discussions on:
* Learning from incidents and using Spinnaker to automate their resolution
* Service Mesh & Spinnaker
* Spinnaker Ops: provisioning w/ Terraform, debugging, monitoring, account mgmt, security
* [Secrets management](https://blog.armory.io/spinnaker-secrets-management-secrets-are-no-fun-when-you-share-with-everyone/)
* [Plugin framework](https://www.spinnakersummit.com/blog/how-armory-is-extending-spinnaker-for-the-enterprise)
* [Managed Delivery](https://blog.spinnaker.io/managed-delivery-evolving-continuous-delivery-at-netflix-eb74877fb33c) & Managed Pipeline Templates v2
* Experimentation using Canary analyses and more
* [Using custom stages for your CD and Kubernetes workflows](https://blog.spinnaker.io/running-jobs-stories-from-the-field-pt-1-4330e1e6ebb)

And much more! Access the [slides from all event presentations here](https://go.armory.io/spinsumslides). Look out for video, to be posted on YouTube and announced in [Spinnaker Slack](https://join.spinnaker.io/). Important discussions about the roadmap and future of Spinnaker also took place. Read more on that below!

---
## Spinnaker Roadmap

All eyes were on the [2020 roadmap](https://go.armory.io/spinmap) at the Summit, with themes of managed delivery, operator and developer experience, cloud-nativization, community, and runtime support on the brain. Dev workflows for those using K8S, the AWS clouddriver, Cloud Run, and Tekton figure prominently in H1, as do modern tools for managing Spinnaker: config-as-code approaches to provisioning, auto-generated docs, cloud integration tests, Prometheus monitoring, and more.

## Version 1.17

Read the [release highlights](https://www.spinnaker.io/community/releases/versions/1-17-0-changelog). Notable feature adds include baseline git repo artifact support, and Kustomize support to leverage that new artifact type. In addition, Spinnaker now proudly supports Kubernetes' new kubectl-initiated rolling restart capability, as well as isolation between multiple K8S V2 accounts. Also added: a more flexible authorization model which allows Fiat to accept and resolve permissions from various sources.

---

## Spinnaker Evangelism Spotlight

We'll highlight Spinnaker evangelism here as users share love on the interwebs. In a *delightful* new Medium post, [Serge Poueme discusses SAPs evaluation and adoption of Spinnaker](https://blog.spinnaker.io/pipeline-redemption-how-spinnaker-is-shaping-delivery-excellence-at-sap-3b3c931b4f63). He praises the "digestible UI on the surface and .. controlled environment in the back end," as well as the interoperability with Jenkins, Slack, and GitHub his teams enjoy as they take a developer-self-service approach to CD. My fave quote:

"When William found a bug, he determined the root cause and then proposed a fix via a pull request. Spinnaker responded swiftly, then provided further documentation for him to contribute to the project — another well-deserved high five to Spinnaker for being open source!"

You can say that again, Serge! He also boldly shares his feature requests, including a Halyard API for automation changes to Spinnaker instances, and better security, particularly around Docker image sourcing. His top request? Better documentation. Let's put that on the agenda of the upcoming hackathon!

---
## Spinnaker Contributor Experience

As we invite users and contributors into the community, opportunities to unite on clear project goals and milestones arise. The TOC, SIG leads, and community advocates are working improve the Spinnaker contributor experience. If you have feedback about this, please share it at your next SIG meeting, and/or in the #community channel on [Spinnaker Slack](https://join.spinnaker.io/).
Look out for experiments that aim to organize issues and improve your experience in advance of our first hackathon. Also: please be un-shy in filing issues. We have a particular need for first-hand "end-user"/developer feedback. Don't be afraid to engage!

---
## CDF Strategic Goals

Netflix and Google donated Spinnaker to the [Continuous Delivery Foundation]https://go.armory.io/cdf) in March. The Foundation aims to tell the world the crucial story of CD, and to foster a vibrant community around it. From Spinnaker's perspective, we want to improve collaboration among open-source partners, considering the importance of solution interoperability and clarity to our shared users (Jenkins, in particular, comes to mind here).

Check out the strategic goals the CDF has charted for us:
* Drive continuous delivery adoption
* Cultivate, grow, and promote adoption of projects
* Foster tool interoperability
* Champion diversity & inclusion in our communities
* Foster community relations
* Grow the membership base
* Create value for all members
* Promote security as a first-class citizen
* Expand into emerging technology areas

Looking forward to working with the amazing Spinnaker community to realize these!


text:
<resources>
<string name="app_name">Grow It</string>
<string name="action_settings">Settings</string>
<string name="drawer_open">Open</string>
<string name="drawer_close">Close</string>

<string name="nav_item_home">Home</string>
<string name="nav_item_achieve">Achievements</string>
<string name="nav_item_topten">Top 10</string>

<!-- navigation drawer item labels  -->
<string-array name="nav_drawer_labels">
    <item>@string/nav_item_home</item>
    <item>@string/nav_item_achieve</item>
    <item>@string/nav_item_topten</item>
</string-array>

<string name="title_top">Top 10</string>
<string name="title_achieve">Achievements</string>
<string name="title_home">Home</string>
</resources>


text:
// The MIT License
//
// Copyright (c) 2012-2015 Jordan E. Terrell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using iSynaptic.Commons.Linq;

namespace iSynaptic.Commons
{
    internal delegate Outcome<string> MethodSpecification(MethodInfo candidate);

    internal static class MethodSpecificationBuilder
    {
        public static readonly MethodSpecification Any = m => Outcome.Success();

        public static MethodSpecification Named(string name)
        {
            return Any.Named(name);
        }

        public static MethodSpecification Named(this MethodSpecification @this, string name)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(m.Name != name, String.Format("Was not named '{0}'.", name)));
        }

        public static MethodSpecification IsStatic()
        {
            return Any.IsStatic();
        }

        public static MethodSpecification IsStatic(this MethodSpecification @this)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(!m.IsStatic, "Was not static."));
        }

        public static MethodSpecification IsPublic()
        {
            return Any.IsPublic();
        }

        public static MethodSpecification IsPublic(this MethodSpecification @this)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(!m.IsPublic, "Was not public."));
        }

        public static MethodSpecification IsOpenGeneric()
        {
            return Any.IsOpenGeneric();
        }

        public static MethodSpecification IsOpenGeneric(this MethodSpecification @this)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(!m.IsGenericMethodDefinition, "Was not open generic."));
        }

        public static MethodSpecification IsClosedGeneric()
        {
            return Any.IsClosedGeneric();
        }

        public static MethodSpecification IsClosedGeneric(this MethodSpecification @this)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(m.IsGenericMethodDefinition, "Was not closed generic."));
        }

        public static MethodSpecification HasGenericArguments(int count)
        {
            return Any.HasGenericArguments(count);
        }

        public static MethodSpecification HasGenericArguments(this MethodSpecification @this, int count)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(m.GetGenericArguments().Length != count, String.Format("Did not have {0} generic argument(s).", count)));
        }

        public static MethodSpecification HasParameters(int count)
        {
            return Any.HasParameters(count);
        }

        public static MethodSpecification HasParameters(this MethodSpecification @this, int count)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(m.GetParameters().Length != count, String.Format("Did not have {0} parameter(s).", count)));
        }

        public static MethodSpecification GenericArgument(Func<TypeArgumentSpecification, TypeArgumentSpecification> argumentSpecification)
        {
            return Any.GenericArgument(argumentSpecification);
        }

        public static MethodSpecification GenericArgument(Func<MethodInfo, TypeArgumentSpecification, TypeArgumentSpecification> argumentSpecification)
        {
            return Any.GenericArgument(argumentSpecification);
        }

        public static MethodSpecification GenericArgument(this MethodSpecification @this, Func<TypeArgumentSpecification, TypeArgumentSpecification> argumentSpecification)
        {
            Guard.NotNull(argumentSpecification, "argumentSpecification");
            return @this.GenericArgument((m, ga) => argumentSpecification(ga));
        }

        public static MethodSpecification GenericArgument(this MethodSpecification @this, Func<MethodInfo, TypeArgumentSpecification, TypeArgumentSpecification> argumentSpecification)
        {
            Guard.NotNull(@this, "this");
            Guard.NotNull(argumentSpecification, "argumentSpecification");

            return @this.Combine(m =>
            {
                var argSpec = argumentSpecification(m, TypeArgumentSpecificationBuilder.Any);
                var outcomes = m.GetGenericArguments().Select(x => argSpec(x));
                return outcomes
                    .TryFirst(x => x.WasSuccessful)
                    .ValueOrDefault(() => outcomes.Combine());
            });
        }

        public static MethodSpecification Parameter(Func<MethodInfo, ParameterSpecification, ParameterSpecification> parameterSpecification)
        {
            return Any.Parameter(parameterSpecification);
        }

        public static MethodSpecification Parameter(this MethodSpecification @this, Func<MethodInfo, ParameterSpecification, ParameterSpecification> parameterSpecification)
        {
            Guard.NotNull(@this, "this");
            Guard.NotNull(parameterSpecification, "parameterSpecification");

            return @this.Combine(m =>
            {
                var parameterSpec = parameterSpecification(m, ParameterSpecificationBuilder.Any);
                var outcomes = m.GetParameters().Select(x => parameterSpec(x));
                return outcomes
                    .TryFirst(x => x.WasSuccessful)
                    .ValueOrDefault(() => outcomes.Combine());
            });
        }

        public static MethodSpecification Returns(Func<MethodInfo, TypeSpecification, TypeSpecification> returnSpecification)
        {
            return Any.Returns(returnSpecification);
        }

        public static MethodSpecification Returns(this MethodSpecification @this, Func<MethodInfo, TypeSpecification, TypeSpecification> returnSpecification)
        {
            Guard.NotNull(@this, "this");
            Guard.NotNull(returnSpecification, "returnSpecification");

            return @this.Combine(m =>
            {
                var returnSpec = returnSpecification(m, TypeSpecificationBuilder.Any);
                return returnSpec(m.ReturnType);
            });
        }

        public static MethodSpecification IsExtensionMethod(this MethodSpecification @this)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(!m.GetParameters().TryElementAt(0).Select(x => x.IsDefined(typeof(ExtensionAttribute), true)).ValueOrDefault(), "Not an extension method."));
        }

        public static MethodSpecification IsNotExtensionMethod(this MethodSpecification @this)
        {
            Guard.NotNull(@this, "this");
            return @this.Combine(m => Outcome.FailIf(m.GetParameters().TryElementAt(0).Select(x => x.IsDefined(typeof(ExtensionAttribute), true)).ValueOrDefault(), "Should not be an extension method."));
        }

        public static Func<MethodInfo, bool> ToFunc(this MethodSpecification @this)
        {
            Guard.NotNull(@this, "this");
            return m => @this(m);
        }

        public static MethodSpecification Combine(this MethodSpecification left, MethodSpecification right)
        {
            if (left == Any)
                return right;

            if (right == Any)
                return left;

            if (left == null || right == null)
                return left ?? right;

            return x =>
            {
                var leftOutcome = left(x);
                return leftOutcome.WasSuccessful
                    ? leftOutcome & right(x)
                    : leftOutcome;
            };
        }
    }
}


text:
package tarea.processors;

import java.util.ArrayList;

public class IntervalProcessor {

	private int maximum,minimum;
	private ArrayList<Integer> data;
	private boolean holdMaximum, holdMinimum;

	public IntervalProcessor(int minimum,int maximum){
		data = new ArrayList<Integer>();
		setMinimum(minimum);
		setMaximum(maximum);
		setHoldMaximum(true);
		setHoldMinimum(true);
	}
	public void setHoldMaximum(boolean  holding){
		holdMaximum = holding;
	}
	public void setHoldMinimum(boolean  holding){
		holdMinimum = holding;
	}

	public boolean addNumber(int number){
		// verify if you are adding the number to the right interval
		if( number <= maximum && number >= minimum ){
			if( !holdMaximum && number == maximum  ){
				return false;
			}
			if( !holdMinimum && number == minimum  ){
				return false;
			}
			data.add(number);
			return true;
		}
		return false;
	}

	public void setMaximum(int number){
		maximum = number;
	}

	public void setMinimum(int number){
		minimum = number;
	}

	public int getSize(){
		return data.size();
	}
	public String getInterval() {

		if( maximum == minimum ){
			return String.valueOf(maximum);
		}

		StringBuilder  interval = new StringBuilder();

		if( holdMinimum ){
			interval.append("[ ");
		}else{
			interval.append("] ");
		}

		interval.append(String.valueOf(minimum));
		interval.append(" , ");
		interval.append(String.valueOf(maximum));

		if( holdMaximum ){
			interval.append(" ]");
		}else{
			interval.append(" [");
		}

		return interval.toString();
	}
	public int getMaximum() {
		return maximum;
	}
	public int getMinimum() {
		return minimum;
	}
	public ArrayList<Integer> getData() {
		return data;
	}
}


text:
function logThis
{
    echo -e "\n[`date`] $1"
}

logThis "Starting the Developer Cloud Sandbox preparation for snapshot..."

# check the application disk
app_disk=`blkid | grep CIOP_APP | cut -d: -f1`

if [[ -z "$app_disk" ]]; then
  logThis "There is a problem with your Application disk. Please contact the Operations Support Team at Terradue"
  exit 1
fi

# remove all external disks from /etc/fstab
cp /etc/fstab /etc/fstab.bkp
cp ./fstab /etc/fstab

# move the old contextualization log file to another name
mv /var/log/context.log /var/log/context.log.sandbox

# remove the persistent rules (e.g. network interfaces)
rm -f /etc/udev/rules.d/70-persistent-*

# (Optional) mv the old oozie log files (they can be heavy)
logThis "do you want to remove all the Oozie log (they will be not available in the new Sandbox)? (y/n)"
read -n 1 answer
if [ "$answer" == "y" ]; then mv /var/log/oozie /tmp/; fi

# Prepare the Application disk
logThis "Preparing Application disk..."

umount /application
mkdir -p /mnt/application
mount $app_disk /mnt/application
cp -r /mnt/application /application/

# Prepare the remote contextualization
logThis "Preparing the remote contextualization..."

cp ./pre_init.sh /mnt/context/
chmod +x /mnt/context/pre_init.sh

mv /etc/rc.d/rc.local /etc/rc.d/rc.local.bkp

cat > /etc/rc.d/rc.local << EOF
touch /var/lock/subsys/local

if [ -f /mnt/context/pre_init.sh ]; then
  sh -x /mnt/context/pre_init.sh >>/var/log/context.log 2>&1
fi
EOF

exit 0


text:
ACCEPTED

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

#### Published in
Trans. Cambridge Philos. Soc. 12:199. 1873

#### Original name
null

### Remarks
null


text:
<?xml version="1.0"?>
<layout version="0.1.0">
       <cms_index_index>
         <reference name ="head">
            <action method="addCss" ><stylesheet>magentothem/bannersequence/css/bannersequence.css</stylesheet></action>
            <action method="addJs" ><script>magentothem/ma.jq.slide.js</script></action>
            <action method="addJs" ><script>magentothem/bannersequence/jquery.sequence-min.js</script></action>
        </reference>
        <reference name="ma_banner">
            <block type="bannersequence/bannersequence" name="bannersequence" template="magentothem/bannersequence/bannersequence.phtml" />
        </reference>
      </cms_index_index>
</layout>


text:
typedef void *FT81X_G_RAM_Manager_Allocation_Data;

typedef struct _GRAM_Linked_List_Node
{
    uint32_t address_and_flags;
    struct _GRAM_Linked_List_Node *next;
    struct _GRAM_Linked_List_Node *prev;
} GRAM_Linked_List_Node;

typedef struct
{
    GRAM_Linked_List_Node head;
} FT81X_G_RAM_Manager_Data;

// forward declarations for ft81x.h
enum _ft81x_result;
typedef enum _ft81x_result ft81x_result;
struct _FT81X_Handle;
typedef struct _FT81X_Handle FT81X_Handle;

ft81x_result ft81x_g_ram_manager_initialise(FT81X_Handle *handle);
ft81x_result ft81x_g_ram_manager_allocate(FT81X_Handle *handle, uint32_t count, FT81X_G_RAM_Manager_Allocation_Data *allocation_data);
ft81x_result ft81x_g_ram_manager_write(FT81X_Handle *handle, const FT81X_G_RAM_Manager_Allocation_Data *allocation_data, uint32_t offset, uint32_t count, const uint8_t *data);

ft81x_result ft81x_g_ram_manager_get_addr(FT81X_Handle *handle, const FT81X_G_RAM_Manager_Allocation_Data *allocation_data, uint32_t *addr);

void ft81x_g_ram_manager_dump_nodes(FT81X_Handle *handle);

#endif


text:
require "delegate"

# Weak Reference class that allows a referenced object to be
# garbage-collected.
#
# A WeakRef may be used exactly like the object it references.
#
# Usage:
#
#   foo = Object.new            # create a new object instance
#   p foo.to_s                  # original's class
#   foo = WeakRef.new(foo)      # reassign foo with WeakRef instance
#   p foo.to_s                  # should be same class
#   GC.start                    # start the garbage collector
#   p foo.to_s                  # should raise exception (recycled)
#
# == Example
#
# With help from WeakRef, we can implement our own redimentary WeakHash class.
#
# We will call it WeakHash, since it's really just a Hash except all of it's
# keys and values can be garbage collected.
#
#     require 'weakref'
#
#     class WeakHash < Hash
#       def []= key, obj
#         super WeakRef.new(key), WeakRef.new(obj)
#       end
#     end
#
# This is just a simple implementation, we've opened the Hash class and changed
# Hash#store to create a new WeakRef object with +key+ and +obj+ parameters
# before passing them as our key-value pair to the hash.
#
# With this you will have to limit your self to String key's, otherwise you
# will get an ArgumentError because WeakRef cannot create a finalizer for a
# Symbol. Symbols are immutable and cannot be garbage collected.
#
# Let's see it in action:
#
#   omg = "lol"
#   c = WeakHash.new
#   c['foo'] = "bar"
#   c['baz'] = Object.new
#   c['qux'] = omg
#   puts c.inspect
#   #=> {"foo"=>"bar", "baz"=>#<Object:0x007f4ddfc6cb48>, "qux"=>"lol"}
#
#   # Now run the garbage collector
#   GC.start
#   c['foo'] #=> nil
#   c['baz'] #=> nil
#   c['qux'] #=> nil
#   omg      #=> "lol"
#
#   puts c.inspect
#   #=> WeakRef::RefError: Invalid Reference - probably recycled
#
# You can see the local variable +omg+ stayed, although it's reference in our
# hash object was garbage collected, along with the rest of the keys and
# values. Also, when we tried to inspect our hash, we got a WeakRef::RefError,
# this is because these objects were also garbage collected.

class WeakRef < Delegator

  ##
  # RefError is raised when a referenced object has been recycled by the
  # garbage collector

  class RefError < StandardError
  end

  @@__map = ::ObjectSpace::WeakMap.new

  ##
  # Creates a weak reference to +orig+
  #
  # Raises an ArgumentError if the given +orig+ is immutable, such as Symbol,
  # Fixnum, or Float.

  def initialize(orig)
    case orig
    when true, false, nil
      @delegate_sd_obj = orig
    else
      @@__map[self] = orig
    end
    super
  end

  def __getobj__ # :nodoc:
    @@__map[self] or defined?(@delegate_sd_obj) ? @delegate_sd_obj :
      Kernel::raise(RefError, "Invalid Reference - probably recycled", Kernel::caller(2))
  end

  def __setobj__(obj) # :nodoc:
  end

  ##
  # Returns true if the referenced object is still alive.

  def weakref_alive?
    !!(@@__map[self] or defined?(@delegate_sd_obj))
  end
end

if __FILE__ == $0
#  require 'thread'
  foo = Object.new
  p foo.to_s                    # original's class
  foo = WeakRef.new(foo)
  p foo.to_s                    # should be same class
  ObjectSpace.garbage_collect
  ObjectSpace.garbage_collect
  p foo.to_s                    # should raise exception (recycled)
end


text:
@interface FilterEnumerator : NSEnumerator
- (FilterEnumerator *)initWithEnumerator:(NSEnumerator *)anEnumerator andFilter:(BOOL (^)(id))aFunc;

+ (NSEnumerator *)withEnumerator:(NSEnumerator *)enumerator andFilter:(BOOL (^)(id))func;
@end


text:
package org.squonk.rdkit.db;

import org.postgresql.ds.PGPoolingDataSource;
import org.squonk.util.IOUtils;

import javax.sql.DataSource;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.sql.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class ChemcentralConfig {

    private static final Logger LOG = Logger.getLogger(ChemcentralConfig.class.getName());

    public static final String DEFAULT_SCHEMA = "vendordbs";

    private boolean initialised = false;
    private Map<String, RDKitTable> chemTables;
    private final DataSource dataSource;
    private final String statsRoute;

    public ChemcentralConfig() {
        this(null);
    }

    public ChemcentralConfig(String statsRoute) {

        this(
                IOUtils.getConfiguration("CHEMCENTRAL_HOST", "postgres"),
                new Integer(IOUtils.getConfiguration("CHEMCENTRAL_PORT", "5432")),
                IOUtils.getConfiguration("CHEMCENTRAL_DB", "chemcentral"),
                IOUtils.getConfiguration("CHEMCENTRAL_USER", "chemcentral"),
                IOUtils.getConfiguration("CHEMCENTRAL_PASSWORD", "chemcentral"),
                statsRoute);
    }

    public ChemcentralConfig(
            String host,
            Integer port,
            String database,
            String username,
            String password,
            String statsRoute) {

        this.statsRoute = statsRoute;

        PGPoolingDataSource ds = new PGPoolingDataSource();
        ds.setServerName(host);
        ds.setPortNumber(new Integer(port));
        ds.setDatabaseName(database);
        ds.setUser(username);
        ds.setPassword(password);
        dataSource = ds;
        LOG.info("Created postgres datasource for " + host + " as user " + username);
    }

    public ChemcentralConfig(DataSource dataSource, String statsRoute) {
        this.dataSource = dataSource;
        this.statsRoute = statsRoute;

        LOG.info("Connecting to postgres using provided DataSource");
    }

    public String getStatsRoute() {
        return statsRoute;
    }

    public DataSource getDataSource() {
        return dataSource;
    }

    public Connection getConnection() throws SQLException {
        return dataSource.getConnection();
    }

    private void initRDKitTables() throws SQLException {

        if (!initialised) {

            LOG.info("Checking if table_info table is present");

            try (Connection con = dataSource.getConnection()) {
                try (Statement stmt = con.createStatement()) {
                    String sql = "SELECT count(*) FROM table_info";
                    LOG.info("SQL: " + sql);
                    stmt.execute(sql);
                    LOG.info("table_info table already exists");
                } catch (SQLException e) {
                    LOG.log(Level.WARNING, "Failed to select from TABLE_INFO");
                    LOG.info("Table table_info does not appear to exist. Creating it.");

                    String sql = "CREATE TABLE table_info (\n" +
                            "schema_name VARCHAR(64) NOT NULL,\n" +
                            "table_name VARCHAR(64) NOT NULL,\n" +
                            "class_name TEXT NOT NULL,\n" +
                            "CONSTRAINT pk_table_info PRIMARY KEY (schema_name,table_name)\n" +
                            ")";
                    LOG.info("SQL: " + sql);

                    try (Statement stmt = con.createStatement()) {
                        stmt.execute(sql);
                    }
                    LOG.info("table_info created");
                }
                initialised = true;
            }
        }
    }

    public RDKitTable getRDKitTable(String table) {
        // expand out the schema if not specified
        if (!table.contains(".")) {
            table = DEFAULT_SCHEMA + "." + table;
        }
        RDKitTable rdkt;
        // first look in the cached tables
        if (chemTables != null) {
            rdkt = chemTables.get(table);
            if (rdkt != null) {
                return rdkt;
            }
        }
        // if not found then try reading the tables
        try {
            rdkt = readRDKitTables().get(table);
        } catch (SQLException e) {
            throw new RuntimeException("Failed to read table definitions", e);
        }
        return rdkt;
    }

    /**
     * Get the cached set of table definitions if they are present, or read them from the database if not.
     *
     * @return
     * @throws SQLException
     */
    public Map<String, RDKitTable> getRDKitTables() {
        if (chemTables == null) {
            try {
                chemTables = readRDKitTables();
            } catch (SQLException e) {
                throw new RuntimeException("Failed to load table definitions", e);
            }
        }
        return chemTables;
    }

    /**
     * Read the table definitions from the database and updated the cache.
     *
     * @return
     * @throws SQLException
     */
    public Map<String, RDKitTable> readRDKitTables() throws SQLException {

        initRDKitTables();

        try (Connection con = dataSource.getConnection()) {
            try (Statement stmt = con.createStatement()) {
                stmt.execute("SELECT * FROM table_info");
                try (ResultSet rs = stmt.getResultSet()) {
                    Map<String, RDKitTable> map = new HashMap<>();
                    while (rs.next()) {
                        String schema = rs.getString("schema_name");
                        String table = rs.getString("table_name");
                        String className = rs.getString("class_name");
                        String schemaPlusTable = schema + "." + table;

                        try {
                            RDKitTable rdkt = createRDKitTable(schema, table, className);
                            map.put(schemaPlusTable, rdkt);
                            LOG.info("Discovered table " + schemaPlusTable);
                        } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
                            LOG.log(Level.WARNING, "Invalid table definition for " + schemaPlusTable + " as " + className, e);
                        }
                    }
                    chemTables = map;
                    return map;
                }
            }
        }
    }

    public String[] getShortTableNames() {

        LOG.info("Getting short names");

        Set<String> longNames = getRDKitTables().keySet();
        List<String> shortNames = new ArrayList();
        for (String longName : longNames) {
            if (longName.startsWith(DEFAULT_SCHEMA + ".")) {
                String shortName = longName.substring(DEFAULT_SCHEMA.length() + 1, longName.length());
                shortNames.add(shortName);
                LOG.info("Found table " + longName + " -> " + shortName);
            }
        }
        return shortNames.toArray(new String[shortNames.size()]);
    }

    private RDKitTable createRDKitTable(String schema, String tableName, String className)
            throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class cls = Class.forName(className);
        Constructor constr = cls.getConstructor(String.class, String.class);
        RDKitTable rdkt = (RDKitTable) constr.newInstance(schema, tableName);
        return rdkt;
    }

    /**
     * Add this table to the set of definitions stored in the database and clear the cache.
     *
     * @param schema
     * @param tableName
     * @throws SQLException
     */
    public void putRDKitTable(String schema, String tableName, Class className) throws SQLException {

        initRDKitTables();

        try (Connection con = dataSource.getConnection()) {
            doRemoveRDKitTable(con, schema, tableName);
            doPutRDKitTable(con, schema, tableName, className);
        }
        chemTables = null;
    }

    /**
     * Remove this table from the set of definitions stored in the database and clear the cache.
     *
     * @param schema
     * @param tableName
     * @throws SQLException
     */
    public void removeRDKitTable(String schema, String tableName) throws SQLException {

        initRDKitTables();

        try (Connection con = dataSource.getConnection()) {
            doRemoveRDKitTable(con, schema, tableName);
        }
        chemTables = null;
    }

    private void doRemoveRDKitTable(Connection con, String schema, String tableName) throws SQLException {
        String sql = "DELETE FROM table_info WHERE schema_name=? AND table_name=?";
        LOG.info("SQL: " + sql);
        try (PreparedStatement stmt = con.prepareStatement(sql)) {
            stmt.setString(1, schema);
            stmt.setString(2, tableName);
            int count = stmt.executeUpdate();
            if (count == 1) {
                LOG.info("Existing table info for " + schema + "." + tableName + " deleted");
            }
        }
    }

    private void doPutRDKitTable(Connection con, String schema, String tableName, Class className) throws SQLException {
        String sql = "INSERT INTO table_info (schema_name, table_name, class_name) VALUES (?,?,?)";
        LOG.info("SQL: " + sql);
        try (PreparedStatement stmt = con.prepareStatement(sql)) {
            stmt.setString(1, schema);
            stmt.setString(2, tableName);
            stmt.setString(3, className.getName());
            int count = stmt.executeUpdate();
            if (count == 1) {
                LOG.info("Table info for " + schema + "." + tableName + " added");
            }
        }
    }

}


text:
package com.toy.model.generate;

import java.util.ArrayList;
import java.util.List;

public class OrderItemExample {
    /**
	 * This field was generated by MyBatis Generator. This field corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	protected String orderByClause;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	protected boolean distinct;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	protected List<Criteria> oredCriteria;

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public OrderItemExample() {
		oredCriteria = new ArrayList<Criteria>();
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public void setOrderByClause(String orderByClause) {
		this.orderByClause = orderByClause;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public String getOrderByClause() {
		return orderByClause;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public void setDistinct(boolean distinct) {
		this.distinct = distinct;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public boolean isDistinct() {
		return distinct;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public List<Criteria> getOredCriteria() {
		return oredCriteria;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public void or(Criteria criteria) {
		oredCriteria.add(criteria);
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public Criteria or() {
		Criteria criteria = createCriteriaInternal();
		oredCriteria.add(criteria);
		return criteria;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public Criteria createCriteria() {
		Criteria criteria = createCriteriaInternal();
		if (oredCriteria.size() == 0) {
			oredCriteria.add(criteria);
		}
		return criteria;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	protected Criteria createCriteriaInternal() {
		Criteria criteria = new Criteria();
		return criteria;
	}

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public void clear() {
		oredCriteria.clear();
		orderByClause = null;
		distinct = false;
	}

	/**
	 * This class was generated by MyBatis Generator. This class corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	protected abstract static class GeneratedCriteria {
		protected List<Criterion> criteria;

		protected GeneratedCriteria() {
			super();
			criteria = new ArrayList<Criterion>();
		}

		public boolean isValid() {
			return criteria.size() > 0;
		}

		public List<Criterion> getAllCriteria() {
			return criteria;
		}

		public List<Criterion> getCriteria() {
			return criteria;
		}

		protected void addCriterion(String condition) {
			if (condition == null) {
				throw new RuntimeException("Value for condition cannot be null");
			}
			criteria.add(new Criterion(condition));
		}

		protected void addCriterion(String condition, Object value, String property) {
			if (value == null) {
				throw new RuntimeException("Value for " + property + " cannot be null");
			}
			criteria.add(new Criterion(condition, value));
		}

		protected void addCriterion(String condition, Object value1, Object value2, String property) {
			if (value1 == null || value2 == null) {
				throw new RuntimeException("Between values for " + property + " cannot be null");
			}
			criteria.add(new Criterion(condition, value1, value2));
		}

		public Criteria andIdIsNull() {
			addCriterion("id is null");
			return (Criteria) this;
		}

		public Criteria andIdIsNotNull() {
			addCriterion("id is not null");
			return (Criteria) this;
		}

		public Criteria andIdEqualTo(String value) {
			addCriterion("id =", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdNotEqualTo(String value) {
			addCriterion("id <>", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdGreaterThan(String value) {
			addCriterion("id >", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdGreaterThanOrEqualTo(String value) {
			addCriterion("id >=", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdLessThan(String value) {
			addCriterion("id <", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdLessThanOrEqualTo(String value) {
			addCriterion("id <=", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdLike(String value) {
			addCriterion("id like", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdNotLike(String value) {
			addCriterion("id not like", value, "id");
			return (Criteria) this;
		}

		public Criteria andIdIn(List<String> values) {
			addCriterion("id in", values, "id");
			return (Criteria) this;
		}

		public Criteria andIdNotIn(List<String> values) {
			addCriterion("id not in", values, "id");
			return (Criteria) this;
		}

		public Criteria andIdBetween(String value1, String value2) {
			addCriterion("id between", value1, value2, "id");
			return (Criteria) this;
		}

		public Criteria andIdNotBetween(String value1, String value2) {
			addCriterion("id not between", value1, value2, "id");
			return (Criteria) this;
		}

		public Criteria andOrderIdIsNull() {
			addCriterion("order_id is null");
			return (Criteria) this;
		}

		public Criteria andOrderIdIsNotNull() {
			addCriterion("order_id is not null");
			return (Criteria) this;
		}

		public Criteria andOrderIdEqualTo(String value) {
			addCriterion("order_id =", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdNotEqualTo(String value) {
			addCriterion("order_id <>", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdGreaterThan(String value) {
			addCriterion("order_id >", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdGreaterThanOrEqualTo(String value) {
			addCriterion("order_id >=", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdLessThan(String value) {
			addCriterion("order_id <", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdLessThanOrEqualTo(String value) {
			addCriterion("order_id <=", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdLike(String value) {
			addCriterion("order_id like", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdNotLike(String value) {
			addCriterion("order_id not like", value, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdIn(List<String> values) {
			addCriterion("order_id in", values, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdNotIn(List<String> values) {
			addCriterion("order_id not in", values, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdBetween(String value1, String value2) {
			addCriterion("order_id between", value1, value2, "orderId");
			return (Criteria) this;
		}

		public Criteria andOrderIdNotBetween(String value1, String value2) {
			addCriterion("order_id not between", value1, value2, "orderId");
			return (Criteria) this;
		}

		public Criteria andItemTypeIsNull() {
			addCriterion("item_type is null");
			return (Criteria) this;
		}

		public Criteria andItemTypeIsNotNull() {
			addCriterion("item_type is not null");
			return (Criteria) this;
		}

		public Criteria andItemTypeEqualTo(String value) {
			addCriterion("item_type =", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeNotEqualTo(String value) {
			addCriterion("item_type <>", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeGreaterThan(String value) {
			addCriterion("item_type >", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeGreaterThanOrEqualTo(String value) {
			addCriterion("item_type >=", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeLessThan(String value) {
			addCriterion("item_type <", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeLessThanOrEqualTo(String value) {
			addCriterion("item_type <=", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeLike(String value) {
			addCriterion("item_type like", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeNotLike(String value) {
			addCriterion("item_type not like", value, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeIn(List<String> values) {
			addCriterion("item_type in", values, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeNotIn(List<String> values) {
			addCriterion("item_type not in", values, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeBetween(String value1, String value2) {
			addCriterion("item_type between", value1, value2, "itemType");
			return (Criteria) this;
		}

		public Criteria andItemTypeNotBetween(String value1, String value2) {
			addCriterion("item_type not between", value1, value2, "itemType");
			return (Criteria) this;
		}

		public Criteria andResourceIdIsNull() {
			addCriterion("resource_id is null");
			return (Criteria) this;
		}

		public Criteria andResourceIdIsNotNull() {
			addCriterion("resource_id is not null");
			return (Criteria) this;
		}

		public Criteria andResourceIdEqualTo(String value) {
			addCriterion("resource_id =", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdNotEqualTo(String value) {
			addCriterion("resource_id <>", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdGreaterThan(String value) {
			addCriterion("resource_id >", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
			addCriterion("resource_id >=", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdLessThan(String value) {
			addCriterion("resource_id <", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdLessThanOrEqualTo(String value) {
			addCriterion("resource_id <=", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdLike(String value) {
			addCriterion("resource_id like", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdNotLike(String value) {
			addCriterion("resource_id not like", value, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdIn(List<String> values) {
			addCriterion("resource_id in", values, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdNotIn(List<String> values) {
			addCriterion("resource_id not in", values, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdBetween(String value1, String value2) {
			addCriterion("resource_id between", value1, value2, "resourceId");
			return (Criteria) this;
		}

		public Criteria andResourceIdNotBetween(String value1, String value2) {
			addCriterion("resource_id not between", value1, value2, "resourceId");
			return (Criteria) this;
		}

		public Criteria andCountIsNull() {
			addCriterion("count is null");
			return (Criteria) this;
		}

		public Criteria andCountIsNotNull() {
			addCriterion("count is not null");
			return (Criteria) this;
		}

		public Criteria andCountEqualTo(Integer value) {
			addCriterion("count =", value, "count");
			return (Criteria) this;
		}

		public Criteria andCountNotEqualTo(Integer value) {
			addCriterion("count <>", value, "count");
			return (Criteria) this;
		}

		public Criteria andCountGreaterThan(Integer value) {
			addCriterion("count >", value, "count");
			return (Criteria) this;
		}

		public Criteria andCountGreaterThanOrEqualTo(Integer value) {
			addCriterion("count >=", value, "count");
			return (Criteria) this;
		}

		public Criteria andCountLessThan(Integer value) {
			addCriterion("count <", value, "count");
			return (Criteria) this;
		}

		public Criteria andCountLessThanOrEqualTo(Integer value) {
			addCriterion("count <=", value, "count");
			return (Criteria) this;
		}

		public Criteria andCountIn(List<Integer> values) {
			addCriterion("count in", values, "count");
			return (Criteria) this;
		}

		public Criteria andCountNotIn(List<Integer> values) {
			addCriterion("count not in", values, "count");
			return (Criteria) this;
		}

		public Criteria andCountBetween(Integer value1, Integer value2) {
			addCriterion("count between", value1, value2, "count");
			return (Criteria) this;
		}

		public Criteria andCountNotBetween(Integer value1, Integer value2) {
			addCriterion("count not between", value1, value2, "count");
			return (Criteria) this;
		}
	}

	/**
	 * This class was generated by MyBatis Generator. This class corresponds to the database table order_item
	 * @mbggenerated  Mon Dec 07 22:17:15 CST 2015
	 */
	public static class Criterion {
		private String condition;
		private Object value;
		private Object secondValue;
		private boolean noValue;
		private boolean singleValue;
		private boolean betweenValue;
		private boolean listValue;
		private String typeHandler;

		public String getCondition() {
			return condition;
		}

		public Object getValue() {
			return value;
		}

		public Object getSecondValue() {
			return secondValue;
		}

		public boolean isNoValue() {
			return noValue;
		}

		public boolean isSingleValue() {
			return singleValue;
		}

		public boolean isBetweenValue() {
			return betweenValue;
		}

		public boolean isListValue() {
			return listValue;
		}

		public String getTypeHandler() {
			return typeHandler;
		}

		protected Criterion(String condition) {
			super();
			this.condition = condition;
			this.typeHandler = null;
			this.noValue = true;
		}

		protected Criterion(String condition, Object value, String typeHandler) {
			super();
			this.condition = condition;
			this.value = value;
			this.typeHandler = typeHandler;
			if (value instanceof List<?>) {
				this.listValue = true;
			} else {
				this.singleValue = true;
			}
		}

		protected Criterion(String condition, Object value) {
			this(condition, value, null);
		}

		protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
			super();
			this.condition = condition;
			this.value = value;
			this.secondValue = secondValue;
			this.typeHandler = typeHandler;
			this.betweenValue = true;
		}

		protected Criterion(String condition, Object value, Object secondValue) {
			this(condition, value, secondValue, null);
		}
	}

	/**
     * This class was generated by MyBatis Generator.
     * This class corresponds to the database table order_item
     *
     * @mbggenerated do_not_delete_during_merge Mon Dec 07 20:37:43 CST 2015
     */
    public static class Criteria extends GeneratedCriteria {

        protected Criteria() {
            super();
        }
    }
}


text:
package de.ailis.jollada.model;

/**
 * List of visual scenes.
 *
 * @author Klaus Reimer (k@ailis.de)
 */

public final class VisualScenes extends Elements<VisualScene>
{
    /** Serial version UID. */
    private static final long serialVersionUID = 1L;

    /**
     * Constructor.
     *
     * @param parent
     *            The parent element
     */

    VisualScenes(final Element parent)
    {
        super(parent);
    }
}


text:
from nose.tools import eq_, ok_

from goodreads import apikey
from goodreads.client import GoodreadsClient

class TestGroup():
    @classmethod
    def setup_class(cls):
        client = GoodreadsClient(apikey.key, apikey.secret)
        client.authenticate(apikey.oauth_access_token,
                            apikey.oauth_access_token_secret)
        cls.group = client.group(1)

    def test_title(self):
        eq_(self.group.title, 'Goodreads Feedback')

    def test_gid(self):
    	eq_(self.group.gid,'1')

    def test_description(self):
    	assert self.group.description.startswith('This is a place to')

    def test_category(self):
    	eq_(self.group.category,'Business')

    def test_subcategory(self):
    	eq_(self.group.subcategory,'Companies')

    def test_rules(self):
    	assert self.group.rules.startswith('Please keep')

    def test_image_url(self):
    	eq_(self.group.image_url,'https://images.gr-assets.com/groups/1182455834p2/1.jpg')

    def test_access(self):
    	eq_(self.group.access,'public')

    def test_users_count(self):
        assert len(self.group.users_count) > 1

    def test_members(self):
    	assert len(self.group.members) > 1


text:
define(['./isArray', './_stringToPath'], function(isArray, stringToPath) {

  /**
   * Casts `value` to a path array if it's not one.
   *
   * @private
   * @param {*} value The value to inspect.
   * @returns {Array} Returns the cast property path array.
   */
  function castPath(value) {
    return isArray(value) ? value : stringToPath(value);
  }

  return castPath;
});


text:
/******************************************************************************
 *
 * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
 *
 *****************************************************************************/

/******************************************************************************
 *
 * 1. Copyright Notice
 *
 * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
 * All rights reserved.
 *
 * 2. License
 *
 * 2.1. This is your license from Intel Corp. under its intellectual property
 * rights. You may have additional license terms from the party that provided
 * you this software, covering your right to use that party's intellectual
 * property rights.
 *
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
 * copy of the source code appearing in this file ("Covered Code") an
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
 * base code distributed originally by Intel ("Original Intel Code") to copy,
 * make derivatives, distribute, use and display any portion of the Covered
 * Code in any form, with the right to sublicense such rights; and
 *
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
 * license (with the right to sublicense), under only those claims of Intel
 * patents that are infringed by the Original Intel Code, to make, use, sell,
 * offer to sell, and import the Covered Code and derivative works thereof
 * solely to the minimum extent necessary to exercise the above copyright
 * license, and in no event shall the patent license extend to any additions
 * to or modifications of the Original Intel Code. No other license or right
 * is granted directly or by implication, estoppel or otherwise;
 *
 * The above copyright and patent license is granted only if the following
 * conditions are met:
 *
 * 3. Conditions
 *
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification with rights to further distribute source must include
 * the above Copyright Notice, the above License, this list of Conditions,
 * and the following Disclaimer and Export Compliance provision. In addition,
 * Licensee must cause all Covered Code to which Licensee contributes to
 * contain a file documenting the changes Licensee made to create that Covered
 * Code and the date of any change. Licensee must include in that file the
 * documentation of any changes made by any predecessor Licensee. Licensee
 * must include a prominent statement that the modification is derived,
 * directly or indirectly, from Original Intel Code.
 *
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification without rights to further distribute source must
 * include the following Disclaimer and Export Compliance provision in the
 * documentation and/or other materials provided with distribution. In
 * addition, Licensee may not authorize further sublicense of source of any
 * portion of the Covered Code, and must include terms to the effect that the
 * license from Licensee to its licensee is limited to the intellectual
 * property embodied in the software Licensee provides to its licensee, and
 * not to intellectual property embodied in modifications its licensee may
 * make.
 *
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
 * substantial portion of the Covered Code or modification must reproduce the
 * above Copyright Notice, and the following Disclaimer and Export Compliance
 * provision in the documentation and/or other materials provided with the
 * distribution.
 *
 * 3.4. Intel retains all right, title, and interest in and to the Original
 * Intel Code.
 *
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
 * Intel shall be used in advertising or otherwise to promote the sale, use or
 * other dealings in products derived from or relating to the Covered Code
 * without prior written authorization from Intel.
 *
 * 4. Disclaimer and Export Compliance
 *
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY

 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE.
 *
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
 * LIMITED REMEDY.
 *
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
 * software or system incorporating such software without first obtaining any
 * required license or other approval from the U. S. Department of Commerce or
 * any other agency or department of the United States Government. In the
 * event Licensee exports any such software from the United States or
 * re-exports any such software from a foreign destination, Licensee shall
 * ensure that the distribution and export/re-export of the software is in
 * compliance with all laws, regulations, orders, or other restrictions of the
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
 * any of its subsidiaries will export/re-export any technical data, process,
 * software, or service, directly or indirectly, to any country for which the
 * United States government or any agency thereof requires an export license,
 * other governmental approval, or letter of assurance, without first obtaining
 * such license, approval or letter.
 *
 *****************************************************************************/

#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "acparser.h"
#include "amlcode.h"

#define _COMPONENT          ACPI_EXECUTER
        ACPI_MODULE_NAME    ("exoparg6")

/*!
 * Naming convention for AML interpreter execution routines.
 *
 * The routines that begin execution of AML opcodes are named with a common
 * convention based upon the number of arguments, the number of target operands,
 * and whether or not a value is returned:
 *
 *      AcpiExOpcode_xA_yT_zR
 *
 * Where:
 *
 * xA - ARGUMENTS:    The number of arguments (input operands) that are
 *                    required for this opcode type (1 through 6 args).
 * yT - TARGETS:      The number of targets (output operands) that are required
 *                    for this opcode type (0, 1, or 2 targets).
 * zR - RETURN VALUE: Indicates whether this opcode type returns a value
 *                    as the function return (0 or 1).
 *
 * The AcpiExOpcode* functions are called via the Dispatcher component with
 * fully resolved operands.
!*/

/* Local prototypes */

static BOOLEAN
AcpiExDoMatch (
    UINT32                  MatchOp,
    ACPI_OPERAND_OBJECT     *PackageObj,
    ACPI_OPERAND_OBJECT     *MatchObj);

/*******************************************************************************
 *
 * FUNCTION:    AcpiExDoMatch
 *
 * PARAMETERS:  MatchOp         - The AML match operand
 *              PackageObj      - Object from the target package
 *              MatchObj        - Object to be matched
 *
 * RETURN:      TRUE if the match is successful, FALSE otherwise
 *
 * DESCRIPTION: Implements the low-level match for the ASL Match operator.
 *              Package elements will be implicitly converted to the type of
 *              the match object (Integer/Buffer/String).
 *
 ******************************************************************************/

static BOOLEAN
AcpiExDoMatch (
    UINT32                  MatchOp,
    ACPI_OPERAND_OBJECT     *PackageObj,
    ACPI_OPERAND_OBJECT     *MatchObj)
{
    BOOLEAN                 LogicalResult = TRUE;
    ACPI_STATUS             Status;

    /*
     * Note: Since the PackageObj/MatchObj ordering is opposite to that of
     * the standard logical operators, we have to reverse them when we call
     * DoLogicalOp in order to make the implicit conversion rules work
     * correctly. However, this means we have to flip the entire equation
     * also. A bit ugly perhaps, but overall, better than fussing the
     * parameters around at runtime, over and over again.
     *
     * Below, P[i] refers to the package element, M refers to the Match object.
     */
    switch (MatchOp)
    {
    case MATCH_MTR:

        /* Always true */

        break;

    case MATCH_MEQ:
        /*
         * True if equal: (P[i] == M)
         * Change to:     (M == P[i])
         */
        Status = AcpiExDoLogicalOp (AML_LEQUAL_OP, MatchObj, PackageObj,
                    &LogicalResult);
        if (ACPI_FAILURE (Status))
        {
            return (FALSE);
        }
        break;

    case MATCH_MLE:
        /*
         * True if less than or equal: (P[i] <= M) (P[i] NotGreater than M)
         * Change to:                  (M >= P[i]) (M NotLess than P[i])
         */
        Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
                    &LogicalResult);
        if (ACPI_FAILURE (Status))
        {
            return (FALSE);
        }
        LogicalResult = (BOOLEAN) !LogicalResult;
        break;

    case MATCH_MLT:
        /*
         * True if less than: (P[i] < M)
         * Change to:         (M > P[i])
         */
        Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
                    &LogicalResult);
        if (ACPI_FAILURE (Status))
        {
            return (FALSE);
        }
        break;

    case MATCH_MGE:
        /*
         * True if greater than or equal: (P[i] >= M) (P[i] NotLess than M)
         * Change to:                     (M <= P[i]) (M NotGreater than P[i])
         */
        Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
                    &LogicalResult);
        if (ACPI_FAILURE (Status))
        {
            return (FALSE);
        }
        LogicalResult = (BOOLEAN)!LogicalResult;
        break;

    case MATCH_MGT:
        /*
         * True if greater than: (P[i] > M)
         * Change to:            (M < P[i])
         */
        Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
                    &LogicalResult);
        if (ACPI_FAILURE (Status))
        {
            return (FALSE);
        }
        break;

    default:

        /* Undefined */

        return (FALSE);
    }

    return (LogicalResult);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiExOpcode_6A_0T_1R
 *
 * PARAMETERS:  WalkState           - Current walk state
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Execute opcode with 6 arguments, no target, and a return value
 *
 ******************************************************************************/

ACPI_STATUS
AcpiExOpcode_6A_0T_1R (
    ACPI_WALK_STATE         *WalkState)
{
    ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
    ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
    ACPI_STATUS             Status = AE_OK;
    UINT64                  Index;
    ACPI_OPERAND_OBJECT     *ThisElement;

    ACPI_FUNCTION_TRACE_STR (ExOpcode_6A_0T_1R,
        AcpiPsGetOpcodeName (WalkState->Opcode));

    switch (WalkState->Opcode)
    {
    case AML_MATCH_OP:
        /*
         * Match (SearchPkg[0], MatchOp1[1], MatchObj1[2],
         *                      MatchOp2[3], MatchObj2[4], StartIndex[5])
         */

        /* Validate both Match Term Operators (MTR, MEQ, etc.) */

        if ((Operand[1]->Integer.Value > MAX_MATCH_OPERATOR) ||
            (Operand[3]->Integer.Value > MAX_MATCH_OPERATOR))
        {
            ACPI_ERROR ((AE_INFO, "Match operator out of range"));
            Status = AE_AML_OPERAND_VALUE;
            goto Cleanup;
        }

        /* Get the package StartIndex, validate against the package length */

        Index = Operand[5]->Integer.Value;
        if (Index >= Operand[0]->Package.Count)
        {
            ACPI_ERROR ((AE_INFO,
                "Index (0x%8.8X%8.8X) beyond package end (0x%X)",
                ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
            Status = AE_AML_PACKAGE_LIMIT;
            goto Cleanup;
        }

        /* Create an integer for the return value */
        /* Default return value is ACPI_UINT64_MAX if no match found */

        ReturnDesc = AcpiUtCreateIntegerObject (ACPI_UINT64_MAX);
        if (!ReturnDesc)
        {
            Status = AE_NO_MEMORY;
            goto Cleanup;

        }

        /*
         * Examine each element until a match is found. Both match conditions
         * must be satisfied for a match to occur. Within the loop,
         * "continue" signifies that the current element does not match
         * and the next should be examined.
         *
         * Upon finding a match, the loop will terminate via "break" at
         * the bottom. If it terminates "normally", MatchValue will be
         * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no
         * match was found.
         */
        for ( ; Index < Operand[0]->Package.Count; Index++)
        {
            /* Get the current package element */

            ThisElement = Operand[0]->Package.Elements[Index];

            /* Treat any uninitialized (NULL) elements as non-matching */

            if (!ThisElement)
            {
                continue;
            }

            /*
             * Both match conditions must be satisfied. Execution of a continue
             * (proceed to next iteration of enclosing for loop) signifies a
             * non-match.
             */
            if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value,
                                ThisElement, Operand[2]))
            {
                continue;
            }

            if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value,
                                ThisElement, Operand[4]))
            {
                continue;
            }

            /* Match found: Index is the return value */

            ReturnDesc->Integer.Value = Index;
            break;
        }
        break;

    case AML_LOAD_TABLE_OP:

        Status = AcpiExLoadTableOp (WalkState, &ReturnDesc);
        break;

    default:

        ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
            WalkState->Opcode));
        Status = AE_AML_BAD_OPCODE;
        goto Cleanup;
    }

Cleanup:

    /* Delete return object on error */

    if (ACPI_FAILURE (Status))
    {
        AcpiUtRemoveReference (ReturnDesc);
    }

    /* Save return object on success */

    else
    {
        WalkState->ResultObj = ReturnDesc;
    }

    return_ACPI_STATUS (Status);
}


text:
package org.antkar.syn.internal.ebnf;

import org.antkar.syn.SynException;
import org.antkar.syn.TextPos;
import org.antkar.syn.TokenDescriptor;
import org.antkar.syn.internal.Checks;
import org.antkar.syn.internal.bnf.BnfElement;
import org.antkar.syn.internal.bnf.BnfTerminal;
import org.antkar.syn.internal.grammar.EbnfToBnfConverter;
import org.antkar.syn.internal.parser.IParserGetter;
import org.antkar.syn.internal.parser.ParserStackGetter;

/**
 * Terminal EBNF element.
 */
public final class EbnfTerminalElement extends EbnfElement {
    private final TokenDescriptor tokenDescriptor;

    public EbnfTerminalElement(String key, TextPos keyPos, TokenDescriptor descriptor) {
        super(key, keyPos);
        tokenDescriptor = Checks.notNull(descriptor);
    }

    /**
     * Returns the token descriptor associated with this terminal element.
     */
    public TokenDescriptor getTokenDescriptor() {
        return tokenDescriptor;
    }

    @Override
    public String toString() {
        String string = tokenDescriptor.toString();
        return string;
    }

    @Override
    public BnfElement convert(EbnfToBnfConverter converter, String currentNt) {
        BnfTerminal bTerminal = converter.convertTerminal(tokenDescriptor);
        return bTerminal;
    }

    @Override
    public boolean isValuableElement() {
        boolean valuable = tokenDescriptor.getType().isLiteral();
        return valuable;
    }

    @Override
    public IParserGetter getGetter(int offset) {
        return new ParserStackGetter(offset);
    }

    @Override
    public <T> T invokeProcessor(EbnfElementProcessor<T> processor) throws SynException {
        return processor.processTerminalElement(this);
    }
}


text:
from typing import Optional

import tensorflow as tf
from check_shapes import check_shapes, inherit_check_shapes

from ..base import Parameter, TensorType
from ..utilities import positive
from .base import ActiveDims, Kernel

class Static(Kernel):
    """
    Kernels who don't depend on the value of the inputs are 'Static'.  The only
    parameter is a variance, σ².
    """

    @check_shapes(
        "variance: []",
    )
    def __init__(
        self, variance: TensorType = 1.0, active_dims: Optional[ActiveDims] = None
    ) -> None:
        super().__init__(active_dims)
        self.variance = Parameter(variance, transform=positive())

    @inherit_check_shapes
    def K_diag(self, X: TensorType) -> tf.Tensor:
        return tf.fill(tf.shape(X)[:-1], tf.squeeze(self.variance))

class White(Static):
    """
    The White kernel: this kernel produces 'white noise'. The kernel equation is

        k(x_n, x_m) = δ(n, m) σ²

    where:
    δ(.,.) is the Kronecker delta,
    σ²  is the variance parameter.
    """

    @inherit_check_shapes
    def K(self, X: TensorType, X2: Optional[TensorType] = None) -> tf.Tensor:
        if X2 is None:
            d = tf.fill(tf.shape(X)[:-1], tf.squeeze(self.variance))
            return tf.linalg.diag(d)
        else:
            shape = tf.concat([tf.shape(X)[:-1], tf.shape(X2)[:-1]], axis=0)
            return tf.zeros(shape, dtype=X.dtype)

class Constant(Static):
    """
    The Constant (aka Bias) kernel. Functions drawn from a GP with this kernel
    are constant, i.e. f(x) = c, with c ~ N(0, σ^2). The kernel equation is

        k(x, y) = σ²

    where:
    σ²  is the variance parameter.
    """

    @inherit_check_shapes
    def K(self, X: TensorType, X2: Optional[TensorType] = None) -> tf.Tensor:
        if X2 is None:
            shape = tf.concat(
                [
                    tf.shape(X)[:-2],
                    tf.reshape(tf.shape(X)[-2], [1]),
                    tf.reshape(tf.shape(X)[-2], [1]),
                ],
                axis=0,
            )
        else:
            shape = tf.concat([tf.shape(X)[:-1], tf.shape(X2)[:-1]], axis=0)

        return tf.fill(shape, tf.squeeze(self.variance))


text:
execute :load_postgis_sql do
	user "postgres"
	command "psql -d #{node[:postgis][:template_name]} -f `pg_config --sharedir`/contrib/postgis-2.1/postgis.sql"
	only_if "psql -qAt --list | grep '^#{node[:postgis][:template_name]}\|'", :user => 'postgres'
	action :run
end

execute :load_postgis_comments_sql do
	user "postgres"
	command "psql -d #{node[:postgis][:template_name]} -f `pg_config --sharedir`/contrib/postgis-2.1/postgis_comments.sql"
	only_if "psql -qAt --list | grep '^#{node[:postgis][:template_name]}\|'", :user => 'postgres'
	action :run
end

execute :load_spatial_ref_sys_sql do
	user "postgres"
	command "psql -d #{node[:postgis][:template_name]} -f `pg_config --sharedir`/contrib/postgis-2.1/spatial_ref_sys.sql"
	only_if "psql -qAt --list | grep '^#{node[:postgis][:template_name]}\|'", :user => 'postgres'
	action :run
end

execute :load_rtpostgis_sql do
	user "postgres"
	command "psql -d #{node[:postgis][:template_name]} -f `pg_config --sharedir`/contrib/postgis-2.1/rtpostgis.sql"
	only_if "psql -qAt --list | grep '^#{node[:postgis][:template_name]}\|'", :user => 'postgres'
	action :run
end

execute :load_raster_comments_sql do
	user "postgres"
	command "psql -d #{node[:postgis][:template_name]} -f `pg_config --sharedir`/contrib/postgis-2.1/raster_comments.sql"
	only_if "psql -qAt --list | grep '^#{node[:postgis][:template_name]}\|'", :user => 'postgres'
	action :run
end

execute :load_topology_sql do
	user "postgres"
	command "psql -d #{node[:postgis][:template_name]} -f `pg_config --sharedir`/contrib/postgis-2.1/topology.sql"
	only_if "psql -qAt --list | grep '^#{node[:postgis][:template_name]}\|'", :user => 'postgres'
	action :run
end

execute :load_topology_comments_sql do
	user "postgres"
	command "psql -d #{node[:postgis][:template_name]} -f `pg_config --sharedir`/contrib/postgis-2.1/topology_comments.sql"
	only_if "psql -qAt --list | grep '^#{node[:postgis][:template_name]}\|'", :user => 'postgres'
	action :run
end


text:
package org.kuali.kra.web.struts.action;

import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;
import org.kuali.kra.budget.BudgetDecimal;
import org.kuali.kra.budget.RateDecimal;
import org.kuali.kra.infrastructure.BudgetDecimalFormatter;
import org.kuali.kra.infrastructure.RateDecimalFormatter;
import org.kuali.rice.core.web.format.Formatter;

import javax.servlet.ServletException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * This class provides a central place for application-wide {@link Formatter Formatter} registration.
 *
 *

 * It's important to have Formatter registration happen early and in a centralized fashion so that our application
 * will always be in a state where Formatters are registered when they should be.
 *

 *
 *

 * Without this central approach, we are relying on the registration code to be executed before a page is accessed
 * requiring a specific formatter.  This has been troublesome for KC in the past.
 *

 */
public class GlobalFormatterRegistry implements PlugIn {

    private static final Map<Class<?>, Class<? extends Formatter>> KC_FORMATTERS;
    static {
        final Map<Class<?>, Class<? extends Formatter>> temp = new HashMap<Class<?>, Class<? extends Formatter>>();
        temp.put(BudgetDecimal.class, BudgetDecimalFormatter.class);
        temp.put(RateDecimal.class, RateDecimalFormatter.class);

        KC_FORMATTERS = Collections.unmodifiableMap(temp);
    }

    private ActionServlet servlet;
    private ModuleConfig config;

    private final Map<Class<?>, Class<? extends Formatter>> previousRegisters = new HashMap<Class<?>, Class<? extends Formatter>>();

    /** {@inheritDoc} */
    public void init(final ActionServlet aServlet, final ModuleConfig aConfig) throws ServletException {
        servlet = aServlet;
        config = aConfig;

        register();
    }

    /** {@inheritDoc} */
    public void destroy() {
        servlet = null;
        config = null;

        deRegister();
    }

    /**
     * Saves the current Formatter registration then registers KC specific formatters possibly overwriting a registration.
     */
    private void register() {
        for (Map.Entry<Class<?>, Class<? extends Formatter>> entry : KC_FORMATTERS.entrySet()) {
            previousRegisters.put(entry.getKey(), Formatter.formatterForType(entry.getKey()));
            Formatter.registerFormatter(entry.getKey(), entry.getValue());
        }
    }

    /**
     * Removes any KC Formatter registration and restores things they way they were.
     */
    private void deRegister() {
        for (Map.Entry<Class<?>, Class<? extends Formatter>> entry : previousRegisters.entrySet()) {
            Formatter.registerFormatter(entry.getKey(), entry.getValue());
        }

        previousRegisters.clear();
    }
}


text:
namespace tcamprop1_gobj::impl
{
    TcamPropertyBase* create_float( tcamprop1::property_interface_float* prop_itf_ptr, const guard_state_handle& handle );
    TcamPropertyBase* create_integer( tcamprop1::property_interface_integer* prop_itf_ptr, const guard_state_handle& handle );
    TcamPropertyBase* create_boolean( tcamprop1::property_interface_boolean* prop_itf_ptr, const guard_state_handle& handle );
    TcamPropertyBase* create_enumeration( tcamprop1::property_interface_enumeration* prop_itf_ptr, const guard_state_handle& handle );
    TcamPropertyBase* create_command( tcamprop1::property_interface_command* prop_itf_ptr, const guard_state_handle& handle );
    TcamPropertyBase* create_string(tcamprop1::property_interface_string* prop_itf_ptr, const guard_state_handle& handle);

    void    fill_GError( GError** gerr_loc, tcamprop1::status errc );

    void    fill_GError( const std::error_code& errc, GError** gerr_loc );
    void    fill_GError_device_lost( GError** gerr_loc );

    std::string         number_to_hexstr( uint64_t w );
    std::string         make_module_unique_name( std::string_view base, gpointer module_static_pointer );

    struct PropNodeImplBase
    {
        PropNodeImplBase() = default;

        PropNodeImplBase( const PropNodeImplBase& ) = delete;
        PropNodeImplBase( PropNodeImplBase&& ) = delete;

        void    init_base( tcamprop1::property_interface* itf, const guard_state_handle& handle ) noexcept
        {
            base_itf_ptr_ = itf;
            static_info_ = itf->get_property_info();

            guard_state_handle_ = handle;
        }
        void    dispose() noexcept
        {
            guard_state_handle_.reset();
            base_itf_ptr_ = nullptr;
        }

        tcamprop1::prop_static_info_str             static_info_;
        tcamprop1_gobj::impl::guard_state_handle    guard_state_handle_;

        std::string                                 unit_cache_;    // this cache is always initialized in the init method and will never change

        std::mutex                                          enum_range_cache_mutex_;   // Because range requests can fail, we have to have a mutex to guard against this here
        std::optional<tcamprop1::prop_range_enumeration>    enum_range_cache_;
    private:
        tcamprop1::property_interface*  base_itf_ptr_;
    public:

        const char* get_name() const noexcept { return static_info_.name.c_str(); }
        const char* get_category() const noexcept { return static_info_.iccategory.c_str(); }
        const char* get_display_name() const noexcept { return static_info_.display_name.c_str(); }
        const char* get_description() const noexcept { return static_info_.description.c_str(); }

        auto make_raii_guard() { return tcamprop1_gobj::impl::guard_state_raii{ guard_state_handle_ }; }

        TcamPropertyVisibility get_visibility() const noexcept
        {
            switch( static_info_.visibility )
            {
            case tcamprop1::Visibility_t::Beginner:    return TCAM_PROPERTY_VISIBILITY_BEGINNER;
            case tcamprop1::Visibility_t::Expert:      return TCAM_PROPERTY_VISIBILITY_EXPERT;
            case tcamprop1::Visibility_t::Guru:        return TCAM_PROPERTY_VISIBILITY_GURU;
            case tcamprop1::Visibility_t::Invisible:   return TCAM_PROPERTY_VISIBILITY_INVISIBLE;
            }
            return TCAM_PROPERTY_VISIBILITY_INVISIBLE;
        }
        TcamPropertyAccess get_access() const noexcept
        {
            switch (static_info_.access)
            {
            case tcamprop1::Access_t::RW:
                return TCAM_PROPERTY_ACCESS_RW;
            case tcamprop1::Access_t::RO:
                return TCAM_PROPERTY_ACCESS_RO;
            case tcamprop1::Access_t::WO:
                return TCAM_PROPERTY_ACCESS_WO;
            }
            return TCAM_PROPERTY_ACCESS_RW;
        }
        bool        get_is_available( GError** err ) noexcept
        {
            auto guard = make_raii_guard();
            if( !guard ) {
                fill_GError_device_lost( err );
                return false;
            }

            if( auto state = base_itf_ptr_->get_property_state(); state.has_error() ) {
                fill_GError( state.error(), err );
                return false;
            } else {
                return state.value().is_available;
            }
        }
        bool        get_is_locked( GError** err ) noexcept
        {
            auto guard = make_raii_guard();
            if( !guard ) {
                fill_GError_device_lost( err );
                return false;
            }

            if( auto state = base_itf_ptr_->get_property_state(); state.has_error() ) {
                fill_GError( state.error(), err );
                return false;
            } else {
                return state.value().is_locked;
            }
        }

        template<class TImplStruct,TcamPropertyType Tprop_type>
        static void init_TcamPropertyBaseInterface( TcamPropertyBaseInterface* iface )
        {
            iface->get_name = []( TcamPropertyBase* self ) -> const char* { return TImplStruct::fetch_PropImpl( self ).get_name(); };
            iface->get_display_name = []( TcamPropertyBase* self ) -> const char* { return TImplStruct::fetch_PropImpl( self ).get_display_name(); };
            iface->get_description = []( TcamPropertyBase* self ) -> const char* { return TImplStruct::fetch_PropImpl( self ).get_description(); };
            iface->get_category = []( TcamPropertyBase* self ) -> const char* { return TImplStruct::fetch_PropImpl( self ).get_category(); };

            iface->get_visibility = []( TcamPropertyBase* self ) -> TcamPropertyVisibility { return TImplStruct::fetch_PropImpl( self ).get_visibility(); };
            iface->get_access = []( TcamPropertyBase* self ) -> TcamPropertyAccess { return TImplStruct::fetch_PropImpl( self ).get_access(); };
            iface->get_property_type = []( TcamPropertyBase* ) { return Tprop_type; };

            iface->is_available = []( TcamPropertyBase* self, GError** err ) -> gboolean { return TImplStruct::fetch_PropImpl( self ).get_is_available( err ); };
            iface->is_locked = []( TcamPropertyBase* self, GError** err ) -> gboolean { return TImplStruct::fetch_PropImpl( self ).get_is_locked( err ); };
        }
    };

    template<class TItf>
    struct PropNodeImpl : PropNodeImplBase
    {
        using self_type = PropNodeImpl<TItf>;

        void    init( TItf* itf, const guard_state_handle& handle ) noexcept
        {
            prop_itf_ = itf;
            init_base( itf, handle );
        }

        TItf*               prop_itf_ = nullptr;

        struct guard
        {
            PropNodeImpl&       parent;
            tcamprop1_gobj::impl::guard_state_raii    access_guard;

            auto    fetch_interface() -> auto& { return *parent.prop_itf_; }

            auto operator->() noexcept { return parent.prop_itf_; }
            const auto operator->() const noexcept { return parent.prop_itf_; }

            explicit operator bool() const noexcept { return access_guard.owning_lock(); }
        };

        guard       make_guard( GError** err )
        {
            guard res{ *this, make_raii_guard() };
            if( !res ) {
                fill_GError_device_lost( err );
            }
            return res;
        }
    };

    template<class TDataStruct>
    GType   generate_and_fetch_type()
    {
        static gsize g_define_type_id_volatile = 0;
        if( g_once_init_enter( &g_define_type_id_volatile ) )
        {
            GType g_define_type_id =
                g_type_register_static_simple( G_TYPE_OBJECT,
                                               TDataStruct::get_type_class_name().c_str(),
                                               sizeof( typename TDataStruct::class_type ),
                                               (GClassInitFunc)(void (*)(void)) TDataStruct::class_init,
                                               sizeof( typename TDataStruct::instance_type ),
                                               (GInstanceInitFunc)(void (*)(void)) TDataStruct::instance_init,
                                               (GTypeFlags)0 );

            TDataStruct::register_interfaces( g_define_type_id );
            g_once_init_leave( &g_define_type_id_volatile, g_define_type_id );
        }
        return g_define_type_id_volatile;
    }
}


text:
#ifndef TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_THREAD_POOL_FACTORY_H_
#define TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_THREAD_POOL_FACTORY_H_

#include "tensorflow/core/platform/threadpool.h"
#include "tensorflow/core/platform/threadpool_options.h"
#include "tensorflow_serving/util/class_registration.h"

namespace tensorflow {
namespace serving {

// This class takes inter- and intra-op thread pools and returns
// tensorflow::thread::ThreadPoolOptions. The thread pools passed to an
// instance of this class will be kept alive for the lifetime of this instance.
class ScopedThreadPools {
 public:
  // The default constructor will set inter- and intra-op thread pools in the
  // ThreadPoolOptions to nullptr, which will be ingored by Tensorflow runtime.
  ScopedThreadPools() = default;
  ScopedThreadPools(
      std::shared_ptr<thread::ThreadPoolInterface> inter_op_thread_pool,
      std::shared_ptr<thread::ThreadPoolInterface> intra_op_thread_pool);
  ~ScopedThreadPools() = default;

  tensorflow::thread::ThreadPoolOptions get();

 private:
  std::shared_ptr<thread::ThreadPoolInterface> inter_op_thread_pool_;
  std::shared_ptr<thread::ThreadPoolInterface> intra_op_thread_pool_;
};

// Factory for returning intra- and inter-op thread pools to be used by
// Tensorflow.
class ThreadPoolFactory {
 public:
  virtual ~ThreadPoolFactory() = default;

  virtual ScopedThreadPools GetThreadPools() = 0;
};

DEFINE_CLASS_REGISTRY(ThreadPoolFactoryRegistry, ThreadPoolFactory);
#define REGISTER_THREAD_POOL_FACTORY(ClassCreator, ConfigProto)              \
  REGISTER_CLASS(ThreadPoolFactoryRegistry, ThreadPoolFactory, ClassCreator, \
                 ConfigProto);

}  // namespace serving
}  // namespace tensorflow

#endif  // TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_THREAD_POOL_FACTORY_H_