text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.imagineteam.mobilecanberraphase2"
    android:versionCode="2"
    android:versionName="1.1" >

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:name="com.imagineteam.mobilecanberraphase2.AppDelegate"
        android:theme="@android:style/Theme.NoTitleBar" >
        <activity
            android:name="com.imagineteam.mobilecanberraphase2.SplashScreen"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.imagineteam.mobilecanberraphase2.ParalaxActivity"
            android:label="@string/title_activity_paralax"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.imagineteam.mobilecanberraphase2.DatasetsActivity"
            android:label="@string/title_activity_datasets"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.imagineteam.mobilecanberraphase2.MapActivity"
            android:label="@string/title_activity_map"
             android:screenOrientation="portrait"  >
        </activity>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="INSERT_MAP_KEY_HERE"/>
    </application>

</manifest>


text:
package org.apache.solr.schema;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.invoke.MethodHandles;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.apache.commons.io.IOUtils;
import org.apache.solr.cloud.ZkController;
import org.apache.solr.cloud.ZkSolrResourceLoader;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.solr.common.cloud.ZkCmdExecutor;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.ConfigSetService;
import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrCore;
import org.apache.solr.core.SolrResourceLoader;
import org.apache.solr.core.SolrResourceNotFoundException;
import org.apache.solr.util.SystemIdResolver;
import org.apache.solr.util.plugin.SolrCoreAware;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;

/** Factory for ManagedIndexSchema */
public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements SolrCoreAware {
  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
  public static final String UPGRADED_SCHEMA_EXTENSION = ".bak";
  private static final String SCHEMA_DOT_XML = "schema.xml";

  public static final String DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME = "managed-schema.xml";
  public static final String LEGACY_MANAGED_SCHEMA_RESOURCE_NAME = "managed-schema";
  public static final String MANAGED_SCHEMA_RESOURCE_NAME = "managedSchemaResourceName";

  private boolean isMutable = true;
  private String managedSchemaResourceName = DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME;

  public String getManagedSchemaResourceName() {
    return managedSchemaResourceName;
  }

  private SolrConfig config;
  private SolrResourceLoader loader;

  public SolrResourceLoader getResourceLoader() {
    return loader;
  }

  private String resourceName;
  private ManagedIndexSchema schema;
  private SolrCore core;
  private ZkIndexSchemaReader zkIndexSchemaReader;

  private String loadedResource;
  private boolean shouldUpgrade = false;

  @Override
  public void init(NamedList<?> args) {
    SolrParams params = args.toSolrParams();
    isMutable = params.getBool("mutable", true);
    args.remove("mutable");
    managedSchemaResourceName =
        params.get(MANAGED_SCHEMA_RESOURCE_NAME, DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME);
    args.remove(MANAGED_SCHEMA_RESOURCE_NAME);
    if (SCHEMA_DOT_XML.equals(managedSchemaResourceName)) {
      String msg = MANAGED_SCHEMA_RESOURCE_NAME + " can't be '" + SCHEMA_DOT_XML + "'";
      log.error(msg);
      throw new SolrException(ErrorCode.SERVER_ERROR, msg);
    }
    if (args.size() > 0) {
      String msg = "Unexpected arg(s): " + args;
      log.error(msg);
      throw new SolrException(ErrorCode.SERVER_ERROR, msg);
    }
  }

  @Override
  public String getSchemaResourceName(String cdResourceName) {
    // actually a guess; reality depends on the actual files in the config set :-(
    return managedSchemaResourceName;
  }

  /**
   * Lookup the path to the managed schema, dealing with falling back to the legacy managed-schema
   * file, instead of the expected managed-schema.xml file if the legacy file exists.
   *
   *
This method is duplicated in ManagedIndexSchema.
   */
  public String lookupZKManagedSchemaPath() {
    final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) loader;
    final ZkController zkController = zkLoader.getZkController();
    final SolrZkClient zkClient = zkController.getZkClient();
    String managedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + managedSchemaResourceName;
    final String legacyManagedSchemaPath =
        zkLoader.getConfigSetZkPath()
            + "/"
            + ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME;
    try {
      // check if we are using the legacy managed-schema file name.
      if (zkClient.exists(legacyManagedSchemaPath, true)) {
        log.debug(
            "Legacy managed schema resource {} found - loading legacy managed schema instead of {} file.",
            ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME,
            managedSchemaResourceName);
        managedSchemaPath = legacyManagedSchemaPath;
      }
    } catch (KeeperException e) {
      throw new RuntimeException(e);
    } catch (InterruptedException e) {
      // Restore the interrupted status
      Thread.currentThread().interrupt();
      throw new RuntimeException(e);
    }
    return managedSchemaPath;
  }

  /**
   * Lookup the path to the managed schema, dealing with falling back to the legacy managed-schema
   * file, instead of the expected managed-schema.xml file if the legacy file exists.
   */
  public Path lookupLocalManagedSchemaPath() {
    final Path legacyManagedSchemaPath =
        Paths.get(
            loader.getConfigPath().toString(),
            ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME);

    Path managedSchemaPath =
        Paths.get(loader.getConfigPath().toString(), managedSchemaResourceName);

    // check if we are using the legacy managed-schema file name.
    if (Files.exists(legacyManagedSchemaPath)) {
      log.debug(
          "Legacy managed schema resource {} found - loading legacy managed schema instead of {} file.",
          ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME,
          managedSchemaResourceName);
      managedSchemaPath = legacyManagedSchemaPath;
    }

    Path parentPath = managedSchemaPath.getParent();
    if (!Files.isDirectory(parentPath)) {
      try {
        Files.createDirectories(parentPath);
      } catch (IOException ioe) {
        final String msg = "Can't create managed schema directory " + parentPath;
        log.error(msg);
        throw new SolrException(ErrorCode.SERVER_ERROR, msg);
      }
    }

    return managedSchemaPath;
  }
  /**
   * First, try to locate the managed schema file named in the managedSchemaResourceName param. If
   * the managed schema file exists and is accessible, it is used to instantiate an IndexSchema.
   *
   *
If the managed schema file can't be found, the resource named by the resourceName parameter
   * is used to instantiate an IndexSchema.
   *
   *
Once the IndexSchema is instantiated, if the managed schema file does not exist, the
   * instantiated IndexSchema is persisted to the managed schema file named in the
   * managedSchemaResourceName param, in the directory given by {@link
   * SolrResourceLoader#getConfigPath()}, or if configs are in ZooKeeper, under {@link
   * org.apache.solr.cloud.ZkSolrResourceLoader#getConfigSetZkPath()}.
   *
   *
After the managed schema file is persisted, the original schema file is renamed by appending
   * the extension named in {@link #UPGRADED_SCHEMA_EXTENSION}.
   */
  @Override
  public ManagedIndexSchema create(
      String resourceName, SolrConfig config, ConfigSetService configSetService) {
    this.resourceName = resourceName;
    this.config = config;
    this.loader = config.getResourceLoader();
    InputStream schemaInputStream = null;

    if (null == resourceName) {
      resourceName = IndexSchema.DEFAULT_SCHEMA_FILE;
    }

    int schemaZkVersion = -1;
    if (!(loader instanceof ZkSolrResourceLoader)) {
      schemaInputStream = readSchemaLocally();
    } else { // ZooKeeper
      final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) loader;
      final SolrZkClient zkClient = zkLoader.getZkController().getZkClient();
      final String managedSchemaPath = lookupZKManagedSchemaPath();
      managedSchemaResourceName =
          managedSchemaPath.substring(managedSchemaPath.lastIndexOf("/") + 1); // not loving this
      Stat stat = new Stat();
      try {
        // Attempt to load the managed schema
        byte[] data = zkClient.getData(managedSchemaPath, null, stat, true);
        schemaZkVersion = stat.getVersion();
        schemaInputStream =
            new ZkSolrResourceLoader.ZkByteArrayInputStream(data, managedSchemaPath, stat);
        loadedResource = managedSchemaResourceName;
        warnIfNonManagedSchemaExists();
      } catch (InterruptedException e) {
        // Restore the interrupted status
        Thread.currentThread().interrupt();
        log.warn("", e);
      } catch (KeeperException.NoNodeException e) {
        log.info(
            "The schema is configured as managed, but managed schema resource {} not found - loading non-managed schema {} instead",
            managedSchemaResourceName,
            resourceName);
      } catch (KeeperException e) {
        String msg = "Error attempting to access " + managedSchemaPath;
        log.error(msg, e);
        throw new SolrException(ErrorCode.SERVER_ERROR, msg, e);
      }
      if (null == schemaInputStream) {
        // The managed schema file could not be found - load the non-managed schema
        try {
          schemaInputStream = loader.openResource(resourceName);
          loadedResource = resourceName;
          shouldUpgrade = true;
        } catch (IOException e) {
          try {
            // Retry to load the managed schema, in case it was created since the first attempt
            byte[] data = zkClient.getData(managedSchemaPath, null, stat, true);
            schemaZkVersion = stat.getVersion();
            schemaInputStream = new ByteArrayInputStream(data);
            loadedResource = managedSchemaPath;
            warnIfNonManagedSchemaExists();
          } catch (Exception e1) {
            if (e1 instanceof InterruptedException) {
              Thread.currentThread().interrupt(); // Restore the interrupted status
            }
            final String msg =
                "Error loading both non-managed schema '"
                    + resourceName
                    + "' and managed schema '"
                    + managedSchemaResourceName
                    + "'";
            log.error(msg, e);
            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg, e);
          }
        }
      }
    }
    InputSource inputSource = new InputSource(schemaInputStream);
    inputSource.setSystemId(SystemIdResolver.createSystemIdFromResourceName(loadedResource));
    try {
      schema =
          new ManagedIndexSchema(
              config,
              loadedResource,
              IndexSchemaFactory.getConfigResource(
                  configSetService, schemaInputStream, loader, managedSchemaResourceName),
              isMutable,
              managedSchemaResourceName,
              schemaZkVersion,
              getSchemaUpdateLock());
    } catch (Exception e) {
      throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading parsing schema", e);
    }
    if (shouldUpgrade) {
      // Persist the managed schema if it doesn't already exist
      synchronized (schema.getSchemaUpdateLock()) {
        upgradeToManagedSchema();
      }
    }

    return schema;
  }

  private InputStream readSchemaLocally() {
    InputStream schemaInputStream = null;
    try {
      // Attempt to load the managed schema
      final Path managedSchemaPath = lookupLocalManagedSchemaPath();
      managedSchemaResourceName =
          managedSchemaPath.getName(managedSchemaPath.getNameCount() - 1).toString();
      schemaInputStream = loader.openResource(managedSchemaResourceName);
      loadedResource = managedSchemaResourceName;
      warnIfNonManagedSchemaExists();
    } catch (IOException e) {
      log.info(
          "The schema is configured as managed, but managed schema resource {}  not found - loading non-managed schema {} instead",
          managedSchemaResourceName,
          resourceName);
    }
    if (null == schemaInputStream) {
      // The managed schema file could not be found - load the non-managed schema
      try {
        schemaInputStream = loader.openResource(resourceName);
        loadedResource = resourceName;
        shouldUpgrade = true;
      } catch (Exception e) {
        final String msg =
            "Error loading both non-managed schema '"
                + resourceName
                + "' and managed schema '"
                + managedSchemaResourceName
                + "'";
        log.error(msg, e);
        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg, e);
      }
    }
    return schemaInputStream;
  }

  /** Return whether a non-managed schema exists, either in local storage or on ZooKeeper. */
  private void warnIfNonManagedSchemaExists() {
    if (!resourceName.equals(managedSchemaResourceName)) {
      boolean exists = false;
      SolrResourceLoader loader = config.getResourceLoader();
      if (loader instanceof ZkSolrResourceLoader) {
        ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) loader;
        String nonManagedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + resourceName;
        try {
          exists = zkLoader.getZkController().pathExists(nonManagedSchemaPath);
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt(); // Restore the interrupted status
          log.warn("", e); // Log as warning and suppress the exception
        } catch (KeeperException e) {
          // log as warning and suppress the exception
          log.warn(
              "Error checking for the existence of the non-managed schema {}", resourceName, e);
        }
      } else { // Config is not in ZooKeeper
        InputStream nonManagedSchemaInputStream = null;
        try {
          nonManagedSchemaInputStream = loader.openResource(resourceName);
          if (null != nonManagedSchemaInputStream) {
            exists = true;
          }
        } catch (SolrResourceNotFoundException e) {
          // This is expected when the non-managed schema does not exist
        } catch (IOException e) {
          throw new RuntimeException(e);
          // This is expected when the non-managed schema does not exist
        } finally {
          IOUtils.closeQuietly(nonManagedSchemaInputStream);
        }
      }
      if (exists) {
        log.warn(
            "The schema has been upgraded to managed, but the non-managed schema {} is still loadable.  PLEASE REMOVE THIS FILE.",
            resourceName);
      }
    }
  }

  /**
   * Persist the managed schema and rename the non-managed schema by appending {@link
   * #UPGRADED_SCHEMA_EXTENSION}.
   *
   *
Failure to rename the non-managed schema will be logged as a warning, and no exception will
   * be thrown.
   */
  private void upgradeToManagedSchema() {
    SolrResourceLoader loader = config.getResourceLoader();
    if (loader instanceof ZkSolrResourceLoader) {
      zkUgradeToManagedSchema();
    } else {
      // Configs are not on ZooKeeper
      schema.persistManagedSchema(true); // Only create it - don't update it if it already exists

      // After successfully persisting the managed schema, rename the non-managed
      // schema file by appending UPGRADED_SCHEMA_EXTENSION to its name.

      if (resourceName.equals(managedSchemaResourceName)) {
        log.info(
            "On upgrading to managed schema, did not rename non-managed schema '{}' because it's the same as the managed schema's name.",
            resourceName);
      } else {
        final File nonManagedSchemaFile = locateConfigFile(resourceName);
        if (null == nonManagedSchemaFile) {
          // Don't throw an exception for failure to rename the non-managed schema
          log.warn(
              "On upgrading to managed schema, did not rename non-managed schema {} {}{}{}",
              resourceName,
              "because it's neither an absolute file ",
              "nor under SolrConfig.getConfigDir() or the current directory. ",
              "PLEASE REMOVE THIS FILE.");
        } else {
          File upgradedSchemaFile = new File(nonManagedSchemaFile + UPGRADED_SCHEMA_EXTENSION);
          if (nonManagedSchemaFile.renameTo(upgradedSchemaFile)) {
            // Set the resource name to the managed schema so that the CoreAdminHandler returns a
            // findable filename
            schema.setResourceName(managedSchemaResourceName);

            log.info(
                "After upgrading to managed schema, renamed the non-managed schema {} to {}",
                nonManagedSchemaFile,
                upgradedSchemaFile);
          } else {
            // Don't throw an exception for failure to rename the non-managed schema
            log.warn(
                "Can't rename {} to {} - PLEASE REMOVE THIS FILE.",
                nonManagedSchemaFile,
                upgradedSchemaFile);
          }
        }
      }
    }
  }

  /**
   * Finds any resource by its name on the filesystem. The classpath is not consulted.
   *
   *
If the resource is not absolute, the resource is sought in $configDir and then in the
   * current directory.
   *
   * @return the File for the named resource, or null if it can't be found
   */
  private File locateConfigFile(String resource) {
    String location = config.getResourceLoader().resourceLocation(resource);
    if (location == null || location.equals(resource) || location.startsWith("classpath:"))
      return null;
    return new File(location);
  }

  /**
   * Persist the managed schema to ZooKeeper and rename the non-managed schema by appending {@link
   * #UPGRADED_SCHEMA_EXTENSION}.
   *
   *
Failure to rename the non-managed schema will be logged as a warning, and no exception will
   * be thrown.
   */
  private void zkUgradeToManagedSchema() {
    if (resourceName.equals(managedSchemaResourceName)) {
      log.info(
          "On upgrading to managed schema, did not rename non-managed schema {} because it's the same as the managed schema's name.",
          resourceName);
      return;
    }
    final ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) loader;
    final ZkController zkController = zkLoader.getZkController();
    final SolrZkClient zkClient = zkController.getZkClient();
    final String lockPath = zkLoader.getConfigSetZkPath() + "/schemaUpgrade.lock";
    boolean locked = false;
    try {
      try {
        zkClient.makePath(lockPath, null, CreateMode.EPHEMERAL, null, true, true);
        locked = true;
      } catch (Exception e) {
        // some other node already started the upgrade, or an error occurred - bail out
        return;
      }
      // Only create, don't update it if it already exists
      schema.persistManagedSchemaToZooKeeper(true);

      // After successfully persisting the managed schema, rename the non-managed
      // schema znode by appending UPGRADED_SCHEMA_EXTENSION to its name.

      // Rename the non-managed schema znode in ZooKeeper
      final String nonManagedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + resourceName;
      try {
        ZkCmdExecutor zkCmdExecutor = new ZkCmdExecutor(zkController.getClientTimeout());
        if (zkController.pathExists(nonManagedSchemaPath)) {
          // First, copy the non-managed schema znode content to the upgraded schema znode
          byte[] bytes = zkController.getZkClient().getData(nonManagedSchemaPath, null, null, true);
          final String upgradedSchemaPath = nonManagedSchemaPath + UPGRADED_SCHEMA_EXTENSION;
          zkCmdExecutor.ensureExists(upgradedSchemaPath, zkController.getZkClient());
          zkController.getZkClient().setData(upgradedSchemaPath, bytes, true);
          // Then delete the non-managed schema znode
          if (zkController.getZkClient().exists(nonManagedSchemaPath, true)) {
            try {
              zkController.getZkClient().delete(nonManagedSchemaPath, -1, true);
            } catch (KeeperException.NoNodeException ex) {
              // ignore - someone beat us to it
            }
          }

          // Set the resource name to the managed schema so that the CoreAdminHandler returns a
          // findable filename
          schema.setResourceName(managedSchemaResourceName);

          log.info(
              "After upgrading to managed schema in ZooKeeper, renamed the non-managed schema {} to {}",
              nonManagedSchemaPath,
              upgradedSchemaPath);
        } else {
          log.info(
              "After upgrading to managed schema in ZooKeeper, the non-managed schema {} no longer exists.",
              nonManagedSchemaPath);
        }
      } catch (Exception e) {
        if (e instanceof InterruptedException) {
          Thread.currentThread().interrupt(); // Restore the interrupted status
        }
        final String msg = "Error persisting managed schema resource " + managedSchemaResourceName;
        log.warn(msg, e); // Log as warning and suppress the exception
      }
    } finally {
      if (locked) {
        // unlock
        try {
          zkClient.delete(lockPath, -1, true);
        } catch (KeeperException.NoNodeException nne) {
          // ignore - someone else deleted it
        } catch (Exception e) {
          log.warn("Unable to delete schema upgrade lock file {}", lockPath, e);
        }
      }
    }
  }

  private Object schemaUpdateLock = new Object();

  public Object getSchemaUpdateLock() {
    return schemaUpdateLock;
  }

  @Override
  public void inform(SolrCore core) {
    this.core = core;
    if (loader instanceof ZkSolrResourceLoader) {
      this.zkIndexSchemaReader = new ZkIndexSchemaReader(this, core);
      ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) loader;
      zkLoader.setZkIndexSchemaReader(this.zkIndexSchemaReader);
      try {
        zkIndexSchemaReader.refreshSchemaFromZk(-1); // update immediately if newer is available
        core.setLatestSchema(getSchema());
      } catch (KeeperException e) {
        String msg =
            "Error attempting to access "
                + zkLoader.getConfigSetZkPath()
                + "/"
                + managedSchemaResourceName;
        log.error(msg, e);
        throw new SolrException(ErrorCode.SERVER_ERROR, msg, e);
      } catch (InterruptedException e) {
        // Restore the interrupted status
        Thread.currentThread().interrupt();
        log.warn("", e);
      }
    } else {
      this.zkIndexSchemaReader = null;
    }
  }

  public ManagedIndexSchema getSchema() {
    return schema;
  }

  public void setSchema(ManagedIndexSchema schema) {
    this.schema = schema;
    core.setLatestSchema(schema);
  }

  public boolean isMutable() {
    return isMutable;
  }

  public SolrConfig getConfig() {
    return config;
  }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef KERNEL_ENTRY_H
#define KERNEL_ENTRY_H

#include "common/common.h"

/**
 * @brief      Kernel main
 */
void kernel(void);

/**
 * @brief      Kernel entry point
 */
void kernel_entry(void);

#endif


text:
import JsonFile from 'jsonfile';
import Chalk from 'chalk';
import Bluebird from 'bluebird';
import _ from 'lodash';

import Providers from './providers';
import * as Store from './utils/store';
import * as Imdb from './enhancers/imdb';
import * as Youtube from './enhancers/youtube';
import * as Slug from './enhancers/slug';

Promise.all([Providers.LeetX.Process(), Providers.PirateBay.Process()]).then((values) => {
  const data = [].concat.apply([], values);

  Bluebird.map(data, Imdb.fetchFor, {concurrency: 10})
    .filter((el) => {
      const hasAllMeta = _.get(el.movie, 'meta.rated', null);

      return !_.isUndefined(el.movie.meta) && !_.isNull(hasAllMeta);
    })
    .map(Youtube.fetchFor)
    .map(Slug.store)
    .map(Store.saveMovie)
    .then((movies) => {
      JsonFile.writeFile('./data/bulk.json', movies, {spaces: 2}, function(err) {
        if (err) {
          console.log(Chalk.red('Error storing data on disk'));
          console.log(err);
        }

        console.log(`${Chalk.green('Done')} - ${movies.length} movies fetched`);
      });
    }).catch(err => {
      console.log(Chalk.red('Error while scraping imdb metadata from apis'));
      console.log(err);
    });
}).catch(err => {
  console.log(Chalk.red('Error while scraping data from providers'));
  console.log(err);
});


text:
var app = angular.module('myApp', ['dgModal']);

app.controller('appController', ['$scope','dgModal',
function($scope, dgModal){

    $scope.open = function(){
        dgModal.display();
    };

    $scope.close = function(){
        dgModal.close()
            .then(function(){
                alert('Closed the Modal!')
            })
    };

}]);


text:
package ch.admin.seco.jobroom.security.registration.eiam;

import ch.adnovum.nevisidm.ws.services.v1.BusinessException;

class RoleCouldNotBeRemovedException extends EiamClientRuntimeException {

    RoleCouldNotBeRemovedException(String userExtId, String roleName, BusinessException businessException) {
        super("The roleName " + roleName + " could not be removed to the user with userExtId " + userExtId
            + " with the error message: " + businessException.getMessage()
            + " and the reason: " + businessException.getReason());
    }
}


text:
Telegraf is an agent written in Go for collecting metrics from the system it's
running on, or from other services, and writing them into InfluxDB or other
[outputs](https://github.com/influxdata/telegraf#supported-output-plugins).

Design goals are to have a minimal memory footprint with a plugin system so
that developers in the community can easily add support for collecting metrics
from well known services (like Hadoop, Postgres, or Redis) and third party
APIs (like Mailchimp, AWS CloudWatch, or Google Analytics).

New input and output plugins are designed to be easy to contribute,
we'll eagerly accept pull
requests and will manage the set of plugins that Telegraf supports.
See the [contributing guide](CONTRIBUTING.md) for instructions on writing
new plugins.

## Installation:

### Linux deb and rpm Packages:

Latest:
* https://dl.influxdata.com/telegraf/releases/telegraf_1.0.1_amd64.deb
* https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1.x86_64.rpm

Latest (arm):
* https://dl.influxdata.com/telegraf/releases/telegraf_1.0.1_armhf.deb
* https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1.armhf.rpm

##### Package Instructions:

* Telegraf binary is installed in `/usr/bin/telegraf`
* Telegraf daemon configuration file is in `/etc/telegraf/telegraf.conf`
* On sysv systems, the telegraf daemon can be controlled via
`service telegraf [action]`
* On systemd systems (such as Ubuntu 15+), the telegraf daemon can be
controlled via `systemctl [action] telegraf`

### yum/apt Repositories:

There is a yum/apt repo available for the whole InfluxData stack, see
[here](https://docs.influxdata.com/influxdb/v0.10/introduction/installation/#installation)
for instructions on setting up the repo. Once it is configured, you will be able
to use this repo to install & update telegraf.

### Linux tarballs:

Latest:
* https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1_linux_amd64.tar.gz
* https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1_linux_i386.tar.gz
* https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1_linux_armhf.tar.gz

### FreeBSD tarball:

Latest:
* https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1_freebsd_amd64.tar.gz

### Ansible Role:

Ansible role: https://github.com/rossmcdonald/telegraf

### OSX via Homebrew:

```
brew update
brew install telegraf
```

### Windows Binaries (EXPERIMENTAL)

Latest:
* https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1_windows_amd64.zip

### From Source:

Telegraf manages dependencies via [gdm](https://github.com/sparrc/gdm),
which gets installed via the Makefile
if you don't have it already. You also must build with golang version 1.5+.

1. [Install Go](https://golang.org/doc/install)
2. [Setup your GOPATH](https://golang.org/doc/code.html#GOPATH)
3. Run `go get github.com/influxdata/telegraf`
4. Run `cd $GOPATH/src/github.com/influxdata/telegraf`
5. Run `make`

## How to use it:

```console
$ telegraf -help
Telegraf, The plugin-driven server agent for collecting and reporting metrics.

Usage:

  telegraf <flags>

The flags are:

  -config <file>     configuration file to load
  -test              gather metrics once, print them to stdout, and exit
  -sample-config     print out full sample configuration to stdout
  -config-directory  directory containing additional *.conf files
  -input-filter      filter the input plugins to enable, separator is :
  -output-filter     filter the output plugins to enable, separator is :
  -usage             print usage for a plugin, ie, 'telegraf -usage mysql'
  -debug             print metrics as they're generated to stdout
  -quiet             run in quiet mode
  -version           print the version to stdout

Examples:

  # generate a telegraf config file:
  telegraf -sample-config > telegraf.conf

  # generate config with only cpu input & influxdb output plugins defined
  telegraf -sample-config -input-filter cpu -output-filter influxdb

  # run a single telegraf collection, outputing metrics to stdout
  telegraf -config telegraf.conf -test

  # run telegraf with all plugins defined in config file
  telegraf -config telegraf.conf

  # run telegraf, enabling the cpu & memory input, and influxdb output plugins
  telegraf -config telegraf.conf -input-filter cpu:mem -output-filter influxdb
```

## Configuration

See the [configuration guide](docs/CONFIGURATION.md) for a rundown of the more advanced
configuration options.

## Supported Input Plugins

Telegraf currently has support for collecting metrics from many sources. For
more information on each, please look at the directory of the same name in
`plugins/inputs`.

Currently implemented sources:

* [aws cloudwatch](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cloudwatch)
* [aerospike](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/aerospike)
* [apache](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/apache)
* [bcache](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/bcache)
* [cassandra](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cassandra)
* [ceph](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ceph)
* [chrony](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/chrony)
* [consul](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/consul)
* [conntrack](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/conntrack)
* [couchbase](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/couchbase)
* [couchdb](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/couchdb)
* [disque](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/disque)
* [dns query time](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/dns_query)
* [docker](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/docker)
* [dovecot](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/dovecot)
* [elasticsearch](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/elasticsearch)
* [exec](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/exec) (generic executable plugin, support JSON, influx, graphite and nagios)
* [filestat](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/filestat)
* [haproxy](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/haproxy)
* [hddtemp](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/hddtemp)
* [http_response](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_response)
* [httpjson](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/httpjson) (generic JSON-emitting http service plugin)
* [influxdb](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb)
* [ipmi_sensor](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ipmi_sensor)
* [iptables](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/iptables)
* [jolokia](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/jolokia)
* [leofs](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/leofs)
* [lustre2](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/lustre2)
* [mailchimp](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mailchimp)
* [memcached](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/memcached)
* [mesos](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mesos)
* [mongodb](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mongodb)
* [mysql](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mysql)
* [net_response](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/net_response)
* [nginx](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nginx)
* [nsq](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nsq)
* [nstat](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nstat)
* [ntpq](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ntpq)
* [phpfpm](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/phpfpm)
* [phusion passenger](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/passenger)
* [ping](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ping)
* [postgresql](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/postgresql)
* [postgresql_extensible](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/postgresql_extensible)
* [powerdns](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/powerdns)
* [procstat](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/procstat)
* [prometheus](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/prometheus)
* [puppetagent](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/puppetagent)
* [rabbitmq](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/rabbitmq)
* [raindrops](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/raindrops)
* [redis](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/redis)
* [rethinkdb](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/rethinkdb)
* [riak](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/riak)
* [sensors](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/sensors)
* [snmp](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/snmp)
* [snmp_legacy](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/snmp_legacy)
* [sql server](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/sqlserver) (microsoft)
* [twemproxy](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/twemproxy)
* [varnish](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/varnish)
* [zfs](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/zfs)
* [zookeeper](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/zookeeper)
* [win_perf_counters ](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters) (windows performance counters)
* [sysstat](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/sysstat)
* [system](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system)
    * cpu
    * mem
    * net
    * netstat
    * disk
    * diskio
    * swap
    * processes
    * kernel (/proc/stat)
    * kernel (/proc/vmstat)

Telegraf can also collect metrics via the following service plugins:

* [http_listener](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_listener)
* [kafka_consumer](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/kafka_consumer)
* [mqtt_consumer](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mqtt_consumer)
* [nats_consumer](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nats_consumer)
* [nsq_consumer](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nsq_consumer)
* [logparser](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/logparser)
* [statsd](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd)
* [tail](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/tail)
* [tcp_listener](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/tcp_listener)
* [udp_listener](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/udp_listener)
* [webhooks](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/webhooks)
  * [filestack](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/webhooks/filestack)
  * [github](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/webhooks/github)
  * [mandrill](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/webhooks/mandrill)
  * [rollbar](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/webhooks/rollbar)

We'll be adding support for many more over the coming months. Read on if you
want to add support for another service or third-party API.

## Supported Output Plugins

* [influxdb](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb)
* [amon](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/amon)
* [amqp](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/amqp)
* [aws kinesis](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/kinesis)
* [aws cloudwatch](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/cloudwatch)
* [datadog](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/datadog)
* [file](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/file)
* [graphite](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/graphite)
* [graylog](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/graylog)
* [instrumental](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/instrumental)
* [kafka](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/kafka)
* [librato](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/librato)
* [mqtt](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/mqtt)
* [nats](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/nats)
* [nsq](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/nsq)
* [opentsdb](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/opentsdb)
* [prometheus](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/prometheus_client)
* [riemann](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/riemann)

## Contributing

Please see the
[contributing guide](CONTRIBUTING.md)
for details on contributing a plugin to Telegraf.


text:
begin;

update ncaa_pbp.team_summaries_pitching
set gs2 = replace(gs2, ',', ''),
    bf = replace(bf, ',', ''),
    p_oab = replace(p_oab, ',', ''),
    pitches = replace(pitches, ',', '');

alter table ncaa_pbp.team_summaries_pitching
  alter column gs2
    type integer using (gs2::integer);

alter table ncaa_pbp.team_summaries_pitching
  alter column bf
    type integer using (bf::integer);

alter table ncaa_pbp.team_summaries_pitching
  alter column p_oab
    type integer using (p_oab::integer);

alter table ncaa_pbp.team_summaries_pitching
  alter column pitches
    type integer using (pitches::integer);

commit;


text:
package com.kmitl.ce.b_mw.datacenterVisualization.queryAdapter.vCenter.queryProgram.objectQuery;

import com.vmware.vim25.mo.*;
import java.util.*;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import com.kmitl.ce.b_mw.datacenterVisualization.queryAdapter.vCenter.queryProgram.connection.Session;

/**
 *
 * @author Noppakorn Chaiboonruang
 */
public class VirtualMachineQuery implements Queryable {

  private static final Logger LOG = Logger.getLogger(VirtualMachineQuery.class.getName());
  private final Session session;

  /**
   *
   * @param session
   */
  public VirtualMachineQuery(Session session) {
    this.session = session;
  }

  @Override
  public JSONObject excuteQuery() {
    LOG.info("Start VirtualMachineQuery.run");

    List<String> includeFields = new ArrayList<>();

    includeFields.add("MOR.val");
    //includeFields.add("alarmActionEabled");
    includeFields.add("availableField.*");
    includeFields.add("capability.*");
    includeFields.add("config.*");
    includeFields.add("configIssue.*");
    includeFields.add("configStatus");
    includeFields.add("customValue.*");
    includeFields.add("datastores.MOR.val");
    includeFields.add("disabledMethod");
    includeFields.add("effectiveRole");
    includeFields.add("environmentBrowser.MOR.val");
    includeFields.add("guest.*");
    includeFields.add("guestHeartbeatStatus");
    includeFields.add("layout.*");
    includeFields.add("layoutEx.*");
    includeFields.add("name");
    includeFields.add("networks.MOR.val");
    includeFields.add("overallStatus");
    includeFields.add("parent.MOR.val");
    includeFields.add("parentVApp.MOR.val");
    includeFields.add("permission.*");
    includeFields.add("recentTasks.MOR.val");
    includeFields.add("resourceConfig.*");
    includeFields.add("resourcePool.MOR.val");
    includeFields.add("resourcePool.owner.MOR.val");
    includeFields.add("rootSnapshot");
    includeFields.add("runtime.*");
    includeFields.add("snapshot.*");
    includeFields.add("storage.*");
    includeFields.add("summary.*");
    includeFields.add("tag");
    includeFields.add("triggeredAlarmState.alarm.val");
    includeFields.add("triggeredAlarmState.overallStatus");
    includeFields.add("triggeredAlarmState.time");
    includeFields.add("values");

    JSONObject json = session.query(VirtualMachine.class, includeFields.toArray(new String[0]));

    return json;
  }
}


text:
/**
 * A Token is an authorization key
 */

export default {
  createToken,
  deleteToken,
  tokenExists,
};

// npm-installed modules
import async from "async";
import uuid from "node-uuid";

// own modules
import orm from "./orm";
import usr from "./user";
import utils from "./utils";

// tokens schema
const tokenSchema = {
  identity: "token",
  connection: "default",
  attributes: {
    uuid: {
      type: "string",
      required: true,
      unique: true,
    },
    owner: {
      model: "user",
    },
  },
};

// register the token schema with orm
orm.registerSchema(tokenSchema);

/**
 * Create a token for a user. A token is simply a v4 uuid.
 *
 * @param {Object} query
 * @param {Function} done - done(err, token)
 */
function createToken(query, done) {
  return usr.getUser(query, function(getUserErr, user) {
    if (getUserErr) {
      return done(getUserErr);
    }

    if (!user) {
      return done(new Error(`user '${query.username || query.id}' not found`));
    }

    const token = uuid.v4();

    return utils.hash(token, function(hashErr, hash) {
      if (hashErr) {
        return done(hashErr);
      }

      return orm.getModels().collections.token
        .create({
          uuid: hash,
          owner: user.id,
        }, function(createTokenErr) {
          if (createTokenErr) {
            return done(createTokenErr);
          }
          return done(null, token);
        });
    }); // hashToken
  }); // getUser
}

/**
 * Retrieve users tokens
 *
 * @param {Object} query
 * @param {Function} done - done(err, hashes)
 */
function getTokenHashes(query, done) {
  return usr.getUser(query, function(getUserErr, user) {
    if (getUserErr) {
      return done(getUserErr);
    }

    if (!user) {
      return done(new Error(`user '${query.username || query.id}' not found`));
    }

    return done(null, user.tokens);
  });
}

/**
 * Check if token exists. If found it is returned.
 *
 * @param {Object} query
 * @param {String} token
 * @param {Function} done - done(err, tokenObj)
 */
function tokenExists(query, token, done) {
  return getTokenHashes(query, function(getTokensErr, hashes) {
    if (getTokensErr) {
      return done(getTokensErr);
    }

    if (!hashes || !hashes.length) {
      return done(null, false);
    }

    let index = 0;
    let found = false;

    async.until(() => found || (index >= hashes.length), function(next) {
      utils.hashCompare(token, hashes[index++].uuid, function(err, match) {
        found = match;
        return next(err);
      });
    }, (err) => done(err, found ? hashes[index - 1] : false));
  });
}

/**
 * Destroy a token. Username is required as we use it to search through
 * tokens.
 *
 * @param {Object} query
 * @param {String} token
 * @param {Function} done - done(err)
 */
function deleteToken(query, token, done) {
  return tokenExists(query, token, function(existsErr, tokenObj) {
    if (existsErr) {
      return done(existsErr);
    }

    if (!tokenObj) {
      return done(new Error(`token '${token}' not found`));
    }

    return tokenObj.destroy(done);
  });
}


text:
from calyptos.plugins.validator.validatorplugin import ValidatorPlugin

class Topology(ValidatorPlugin):
    def validate(self):
        self.failed_hosts = []
        self.good_hosts = []
        # Check each cluster
        self._single_cluster_per_host()

        self.topology = self.environment['default_attributes']['eucalyptus']['topology']
        assert self.roles['clc']
        assert self.roles['walrus']
        assert self.roles['user-facing']
        for name in self.topology['clusters'].keys():
            assert self.topology['clusters'][name]['cc-1']
            assert self.topology['clusters'][name]['sc-1']
            self.success('Cluster ' + name + ' has both an SC and CC')
            assert self.topology['clusters'][name]['nodes']
            self.success('Cluster ' + name + ' has node controllers')

    def _single_cluster_per_host(self):
        cluster_hosts = self.roles['cluster']
        for name, hosts in cluster_hosts.iteritems():
            # Check that each host...
            for host in hosts:
                # Only appears in one cluster
                appearances = []
                for cluster in cluster_hosts.keys():
                    if host in cluster:
                        appearances.append(cluster)
                if len(appearances) > 1:
                    raise AssertionError("Found " + host + " in multiple clusters: " + str(
                            appearances))
                else:
                    self.success(host + " only in 1 cluster")
                    self.good_hosts.append(host)


text:
package com.orasi.bluesource.titlesPage;

import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;

import ru.yandex.qatools.allure.annotations.Step;

import com.orasi.api.restServices.blueSource.BlueSource;
import com.orasi.api.restServices.blueSource.titles.Title;
import com.orasi.core.interfaces.Element;
import com.orasi.core.interfaces.Label;
import com.orasi.core.interfaces.Link;
import com.orasi.core.interfaces.Webtable;
import com.orasi.core.interfaces.impl.ElementImpl;
import com.orasi.core.interfaces.impl.internal.ElementFactory;
import com.orasi.exception.automation.ElementNotVisibleException;
import com.orasi.utils.AlertHandler;
import com.orasi.utils.OrasiDriver;
import com.orasi.utils.TestEnvironment;
import com.orasi.utils.TestReporter;

public class ListingTitlesPage {
    	private OrasiDriver driver = null;

	//All the page elements
	@FindBy(linkText = "New Title")	private Link lnkNewTitle;
	@FindBy(xpath = "//h1[text() = 'Listing titles']") private Label lblTitle;
	@FindBy(css = ".alert-success.alert-dismissable") private Label lblSuccessMsg;
	@FindBy(className = "table") private Webtable tabTitles;

	private By editIcon = By.cssSelector("div:nth-child(1) > a:nth-child(1)");
	private By deleteIcon = By.cssSelector("div:nth-child(1) > a:nth-child(2)");

	// *********************
	// ** Build page area **
	// *********************
	public ListingTitlesPage(OrasiDriver driver){
	    this.driver = driver;
	    ElementFactory.initElements(driver, this);
	}

	public boolean pageLoaded(){
	    return driver.page().pageLoaded(this.getClass(), lnkNewTitle);
	}

	// *****************************************
	// ***Page Interactions ***
	// *****************************************

	@Step("Click the \"New Title\" link")
	public void clickNewTitle(){
	    lnkNewTitle.click();
	}

	public boolean isTitleHeaderDisplayed(){
	    return lblTitle.isDisplayed();
	}

	@Step("Click the \"Edit Title\" icon on the row for title \"{0}\"")
	public void clickModifyTitle(String title){
		driver.findElement(By.xpath("//table/tbody/tr/td[contains(text(),'"+title+"')]/div/a/span[contains(@class,'glyphicon-pencil')]")).click();
	}

	@Step("An alert should appear for confirmation")
	public boolean isSuccessMsgDisplayed() {
		boolean displayed;
		try {
			displayed = lblSuccessMsg.syncVisible();
			return displayed;

		} catch (ElementNotVisibleException e){
			return false;
		}

	}

	@Step("The title \"{0}\" should be found on the Titles table")
	public boolean searchTableByTitle(String title){
	    if(getTitleRowPosition(title) > 0) return true;
	    return false;
	}

	@Step("Delete the title from the table")
	public void deleteTitle(String title, String browser){
		//8/15/2016 Safari driver does not currently handle modal alerts.  This is a work around to accept the alert
		// see issue in github for details: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3862
		if (browser.equalsIgnoreCase("safari")){
			driver.executeJavaScript("confirm = function(message){return true;};");
			driver.executeJavaScript("alert = function(message){return true;};");
			driver.executeJavaScript("prompt = function(message){return true;}");
			driver.findElement(By.xpath("//table/tbody/tr/td[contains(text(),'"+title+"')]/div/a/span[contains(@class,'glyphicon-trash')]")).click();
		}
		else {
			driver.findElement(By.xpath("//table/tbody/tr/td[contains(text(),'"+title+"')]/div/a/span[contains(@class,'glyphicon-trash')]")).click();
			AlertHandler.handleAllAlerts(driver, 2);
		}
	}

	public void ensureNoExistingTitle(String title){
	    if (searchTableByTitle(title)){
		BlueSource blueSource = new BlueSource("Company.admin");
		List<Title>  titles = blueSource.titles().getAllTitles();
		Title tempTitle = null;
		Iterator<Title> titleIterator = titles.iterator();
		while (titleIterator.hasNext()) {
		    tempTitle = titleIterator.next();
		    if(tempTitle.getName().equals(title)) blueSource.titles().deleteTitle(tempTitle);
		}
		TestReporter.log("The title of \"" + title + "\" previously existed. Deleting previous title");

	    }
	}

	private WebElement getTitleRowElement(String title){
	    int titleRow = getTitleRowPosition(title);
	    return tabTitles.getCell( titleRow, 1);
	}

	private int getTitleRowPosition(String title){
	    return tabTitles.getRowWithCellText(title, 1,1,false);
	}
}


text:
from ambry.orm.database import BaseMigration

# This is initial migration and actually does nothing. Leave it here as an example and for testing.

class Migration(BaseMigration):

    def _migrate_sqlite(self, connection):
        pass

    def _migrate_postgresql(self, connection):
        pass


text:
This project provides a testem launcher which can connect to an existing selenium hub.

## Getting Started

1. Install the launcher

```
$ npm install testem-selenium-launcher --save-dev
```

2. Add the launcher configuration to your testem config. NOTE: the '<url>' needs to be as is, this is how testem knows where to put the test url.

```json
{
  ...
  "launchers": {
    "Selenium": {
      "exe": "node_modules/.bin/testem-selenium-launcher",
      "args": ["<url>", "INSERT YOUR HUB URL", "INSERT DESIRED BROWSER (chrome|firefox|etc)"],
      "protocol": "browser"
    }
  }
  ...
}
```

3. Run the suite
```
$ testem -l Selenium
```

For a working example look at the [Example](./example).


text:
package jkind.solvers.yices;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class YicesParser extends Parser {
	static { RuntimeMetaData.checkVersion("4.4", RuntimeMetaData.VERSION); }

	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		T__12=1, T__11=2, T__10=3, T__9=4, T__8=5, T__7=6, T__6=7, T__5=8, T__4=9,
		T__3=10, T__2=11, T__1=12, T__0=13, PREDEFINED_OP=14, BOOL=15, INT=16,
		ID=17, WS=18, ERROR=19;
	public static final String[] tokenNames = {
		"<INVALID>", "'/'", "'ids:'", "'unsat'", "'unknown'", "'core'", "'cost:'",
		"'sat'", "'='", "'assertion'", "'unsatisfied'", "'('", "')'", "'-'", "PREDEFINED_OP",
		"BOOL", "INT", "ID", "WS", "ERROR"
	};
	public static final int
		RULE_result = 0, RULE_satResult = 1, RULE_unsatResult = 2, RULE_model = 3,
		RULE_unsatAssertions = 4, RULE_cost = 5, RULE_unsatCore = 6, RULE_alias = 7,
		RULE_variable = 8, RULE_function = 9, RULE_predefined = 10, RULE_value = 11,
		RULE_integer = 12, RULE_numeric = 13;
	public static final String[] ruleNames = {
		"result", "satResult", "unsatResult", "model", "unsatAssertions", "cost",
		"unsatCore", "alias", "variable", "function", "predefined", "value", "integer",
		"numeric"
	};

	@Override
	public String getGrammarFileName() { return "Yices.g4"; }

	@Override
	public String[] getTokenNames() { return tokenNames; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public String getSerializedATN() { return _serializedATN; }

	@Override
	public ATN getATN() { return _ATN; }

	public YicesParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class ResultContext extends ParserRuleContext {
		public TerminalNode EOF() { return getToken(YicesParser.EOF, 0); }
		public SatResultContext satResult() {
			return getRuleContext(SatResultContext.class,0);
		}
		public UnsatResultContext unsatResult() {
			return getRuleContext(UnsatResultContext.class,0);
		}
		public ResultContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_result; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterResult(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitResult(this);
		}
	}

	public final ResultContext result() throws RecognitionException {
		ResultContext _localctx = new ResultContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_result);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(30);
			switch (_input.LA(1)) {
			case T__9:
			case T__6:
				{
				setState(28); satResult();
				}
				break;
			case T__10:
				{
				setState(29); unsatResult();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
			setState(32); match(EOF);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class SatResultContext extends ParserRuleContext {
		public UnsatAssertionsContext unsatAssertions() {
			return getRuleContext(UnsatAssertionsContext.class,0);
		}
		public CostContext cost() {
			return getRuleContext(CostContext.class,0);
		}
		public ModelContext model() {
			return getRuleContext(ModelContext.class,0);
		}
		public SatResultContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_satResult; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterSatResult(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitSatResult(this);
		}
	}

	public final SatResultContext satResult() throws RecognitionException {
		SatResultContext _localctx = new SatResultContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_satResult);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(34);
			_la = _input.LA(1);
			if ( !(_la==T__9 || _la==T__6) ) {
			_errHandler.recoverInline(this);
			}
			consume();
			setState(36);
			_la = _input.LA(1);
			if (_la==T__3) {
				{
				setState(35); unsatAssertions();
				}
			}

			setState(39);
			_la = _input.LA(1);
			if (_la==T__2) {
				{
				setState(38); model();
				}
			}

			setState(42);
			_la = _input.LA(1);
			if (_la==T__7) {
				{
				setState(41); cost();
				}
			}

			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class UnsatResultContext extends ParserRuleContext {
		public UnsatCoreContext unsatCore() {
			return getRuleContext(UnsatCoreContext.class,0);
		}
		public UnsatResultContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_unsatResult; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterUnsatResult(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitUnsatResult(this);
		}
	}

	public final UnsatResultContext unsatResult() throws RecognitionException {
		UnsatResultContext _localctx = new UnsatResultContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_unsatResult);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(44); match(T__10);
			setState(46);
			_la = _input.LA(1);
			if (_la==T__10) {
				{
				setState(45); unsatCore();
				}
			}

			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ModelContext extends ParserRuleContext {
		public List<AliasContext> alias() {
			return getRuleContexts(AliasContext.class);
		}
		public PredefinedContext predefined(int i) {
			return getRuleContext(PredefinedContext.class,i);
		}
		public AliasContext alias(int i) {
			return getRuleContext(AliasContext.class,i);
		}
		public FunctionContext function(int i) {
			return getRuleContext(FunctionContext.class,i);
		}
		public VariableContext variable(int i) {
			return getRuleContext(VariableContext.class,i);
		}
		public List<PredefinedContext> predefined() {
			return getRuleContexts(PredefinedContext.class);
		}
		public List<VariableContext> variable() {
			return getRuleContexts(VariableContext.class);
		}
		public List<FunctionContext> function() {
			return getRuleContexts(FunctionContext.class);
		}
		public ModelContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_model; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterModel(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitModel(this);
		}
	}

	public final ModelContext model() throws RecognitionException {
		ModelContext _localctx = new ModelContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_model);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(52);
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				setState(52);
				switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
				case 1:
					{
					setState(48); alias();
					}
					break;
				case 2:
					{
					setState(49); variable();
					}
					break;
				case 3:
					{
					setState(50); function();
					}
					break;
				case 4:
					{
					setState(51); predefined();
					}
					break;
				}
				}
				setState(54);
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==T__2 );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class UnsatAssertionsContext extends ParserRuleContext {
		public TerminalNode INT(int i) {
			return getToken(YicesParser.INT, i);
		}
		public List<TerminalNode> INT() { return getTokens(YicesParser.INT); }
		public UnsatAssertionsContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_unsatAssertions; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterUnsatAssertions(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitUnsatAssertions(this);
		}
	}

	public final UnsatAssertionsContext unsatAssertions() throws RecognitionException {
		UnsatAssertionsContext _localctx = new UnsatAssertionsContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_unsatAssertions);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(56); match(T__3);
			setState(57); match(T__4);
			setState(58); match(T__11);
			setState(60);
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(59); match(INT);
				}
				}
				setState(62);
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==INT );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class CostContext extends ParserRuleContext {
		public TerminalNode INT() { return getToken(YicesParser.INT, 0); }
		public CostContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_cost; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterCost(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitCost(this);
		}
	}

	public final CostContext cost() throws RecognitionException {
		CostContext _localctx = new CostContext(_ctx, getState());
		enterRule(_localctx, 10, RULE_cost);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(64); match(T__7);
			setState(65); match(INT);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class UnsatCoreContext extends ParserRuleContext {
		public TerminalNode INT(int i) {
			return getToken(YicesParser.INT, i);
		}
		public List<TerminalNode> INT() { return getTokens(YicesParser.INT); }
		public UnsatCoreContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_unsatCore; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterUnsatCore(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitUnsatCore(this);
		}
	}

	public final UnsatCoreContext unsatCore() throws RecognitionException {
		UnsatCoreContext _localctx = new UnsatCoreContext(_ctx, getState());
		enterRule(_localctx, 12, RULE_unsatCore);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(67); match(T__10);
			setState(68); match(T__8);
			setState(69); match(T__11);
			setState(71);
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(70); match(INT);
				}
				}
				setState(73);
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==INT );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class AliasContext extends ParserRuleContext {
		public List<TerminalNode> ID() { return getTokens(YicesParser.ID); }
		public TerminalNode ID(int i) {
			return getToken(YicesParser.ID, i);
		}
		public AliasContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_alias; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterAlias(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitAlias(this);
		}
	}

	public final AliasContext alias() throws RecognitionException {
		AliasContext _localctx = new AliasContext(_ctx, getState());
		enterRule(_localctx, 14, RULE_alias);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(75); match(T__2);
			setState(76); match(T__5);
			setState(77); match(ID);
			setState(78); match(ID);
			setState(79); match(T__1);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class VariableContext extends ParserRuleContext {
		public TerminalNode ID() { return getToken(YicesParser.ID, 0); }
		public ValueContext value() {
			return getRuleContext(ValueContext.class,0);
		}
		public VariableContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_variable; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterVariable(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitVariable(this);
		}
	}

	public final VariableContext variable() throws RecognitionException {
		VariableContext _localctx = new VariableContext(_ctx, getState());
		enterRule(_localctx, 16, RULE_variable);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(81); match(T__2);
			setState(82); match(T__5);
			setState(83); match(ID);
			setState(84); value();
			setState(85); match(T__1);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class FunctionContext extends ParserRuleContext {
		public TerminalNode ID() { return getToken(YicesParser.ID, 0); }
		public ValueContext value() {
			return getRuleContext(ValueContext.class,0);
		}
		public IntegerContext integer() {
			return getRuleContext(IntegerContext.class,0);
		}
		public FunctionContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_function; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterFunction(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitFunction(this);
		}
	}

	public final FunctionContext function() throws RecognitionException {
		FunctionContext _localctx = new FunctionContext(_ctx, getState());
		enterRule(_localctx, 18, RULE_function);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(87); match(T__2);
			setState(88); match(T__5);
			setState(89); match(T__2);
			setState(90); match(ID);
			setState(91); integer();
			setState(92); match(T__1);
			setState(93); value();
			setState(94); match(T__1);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class PredefinedContext extends ParserRuleContext {
		public List<ValueContext> value() {
			return getRuleContexts(ValueContext.class);
		}
		public ValueContext value(int i) {
			return getRuleContext(ValueContext.class,i);
		}
		public TerminalNode PREDEFINED_OP() { return getToken(YicesParser.PREDEFINED_OP, 0); }
		public PredefinedContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_predefined; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterPredefined(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitPredefined(this);
		}
	}

	public final PredefinedContext predefined() throws RecognitionException {
		PredefinedContext _localctx = new PredefinedContext(_ctx, getState());
		enterRule(_localctx, 20, RULE_predefined);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(96); match(T__2);
			setState(97); match(T__5);
			setState(98); match(T__2);
			setState(99); match(PREDEFINED_OP);
			setState(103);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << BOOL) | (1L << INT))) != 0)) {
				{
				{
				setState(100); value();
				}
				}
				setState(105);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			setState(106); match(T__1);
			setState(107); value();
			setState(108); match(T__1);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ValueContext extends ParserRuleContext {
		public NumericContext numeric() {
			return getRuleContext(NumericContext.class,0);
		}
		public TerminalNode BOOL() { return getToken(YicesParser.BOOL, 0); }
		public ValueContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_value; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterValue(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitValue(this);
		}
	}

	public final ValueContext value() throws RecognitionException {
		ValueContext _localctx = new ValueContext(_ctx, getState());
		enterRule(_localctx, 22, RULE_value);
		try {
			setState(112);
			switch (_input.LA(1)) {
			case BOOL:
				enterOuterAlt(_localctx, 1);
				{
				setState(110); match(BOOL);
				}
				break;
			case T__0:
			case INT:
				enterOuterAlt(_localctx, 2);
				{
				setState(111); numeric();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class IntegerContext extends ParserRuleContext {
		public TerminalNode INT() { return getToken(YicesParser.INT, 0); }
		public IntegerContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_integer; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterInteger(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitInteger(this);
		}
	}

	public final IntegerContext integer() throws RecognitionException {
		IntegerContext _localctx = new IntegerContext(_ctx, getState());
		enterRule(_localctx, 24, RULE_integer);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(115);
			_la = _input.LA(1);
			if (_la==T__0) {
				{
				setState(114); match(T__0);
				}
			}

			setState(117); match(INT);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class NumericContext extends ParserRuleContext {
		public TerminalNode INT(int i) {
			return getToken(YicesParser.INT, i);
		}
		public List<TerminalNode> INT() { return getTokens(YicesParser.INT); }
		public NumericContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_numeric; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).enterNumeric(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof YicesListener ) ((YicesListener)listener).exitNumeric(this);
		}
	}

	public final NumericContext numeric() throws RecognitionException {
		NumericContext _localctx = new NumericContext(_ctx, getState());
		enterRule(_localctx, 26, RULE_numeric);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(120);
			_la = _input.LA(1);
			if (_la==T__0) {
				{
				setState(119); match(T__0);
				}
			}

			setState(122); match(INT);
			setState(125);
			_la = _input.LA(1);
			if (_la==T__12) {
				{
				setState(123); match(T__12);
				setState(124); match(INT);
				}
			}

			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static final String _serializedATN =
		"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\25\u0082\4\2\t\2"+
		"\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
		"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\3\2\3\2\5\2!\n\2\3\2\3\2\3\3"+
		"\3\3\5\3\'\n\3\3\3\5\3*\n\3\3\3\5\3-\n\3\3\4\3\4\5\4\61\n\4\3\5\3\5\3"+
		"\5\3\5\6\5\67\n\5\r\5\16\58\3\6\3\6\3\6\3\6\6\6?\n\6\r\6\16\6@\3\7\3\7"+
		"\3\7\3\b\3\b\3\b\3\b\6\bJ\n\b\r\b\16\bK\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3"+
		"\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3"+
		"\f\3\f\3\f\3\f\7\fh\n\f\f\f\16\fk\13\f\3\f\3\f\3\f\3\f\3\r\3\r\5\rs\n"+
		"\r\3\16\5\16v\n\16\3\16\3\16\3\17\5\17{\n\17\3\17\3\17\3\17\5\17\u0080"+
		"\n\17\3\17\2\2\20\2\4\6\b\n\f\16\20\22\24\26\30\32\34\2\3\4\2\6\6\t\t"+
		"\u0083\2 \3\2\2\2\4$\3\2\2\2\6.\3\2\2\2\b\66\3\2\2\2\n:\3\2\2\2\fB\3\2"+
		"\2\2\16E\3\2\2\2\20M\3\2\2\2\22S\3\2\2\2\24Y\3\2\2\2\26b\3\2\2\2\30r\3"+
		"\2\2\2\32u\3\2\2\2\34z\3\2\2\2\36!\5\4\3\2\37!\5\6\4\2 \36\3\2\2\2 \37"+
		"\3\2\2\2!\"\3\2\2\2\"#\7\2\2\3#\3\3\2\2\2$&\t\2\2\2%\'\5\n\6\2&%\3\2\2"+
		"\2&\'\3\2\2\2\')\3\2\2\2(*\5\b\5\2)(\3\2\2\2)*\3\2\2\2*,\3\2\2\2+-\5\f"+
		"\7\2,+\3\2\2\2,-\3\2\2\2-\5\3\2\2\2.\60\7\5\2\2/\61\5\16\b\2\60/\3\2\2"+
		"\2\60\61\3\2\2\2\61\7\3\2\2\2\62\67\5\20\t\2\63\67\5\22\n\2\64\67\5\24"+
		"\13\2\65\67\5\26\f\2\66\62\3\2\2\2\66\63\3\2\2\2\66\64\3\2\2\2\66\65\3"+
		"\2\2\2\678\3\2\2\28\66\3\2\2\289\3\2\2\29\t\3\2\2\2:;\7\f\2\2;<\7\13\2"+
		"\2<>\7\4\2\2=?\7\22\2\2>=\3\2\2\2?@\3\2\2\2@>\3\2\2\2@A\3\2\2\2A\13\3"+
		"\2\2\2BC\7\b\2\2CD\7\22\2\2D\r\3\2\2\2EF\7\5\2\2FG\7\7\2\2GI\7\4\2\2H"+
		"J\7\22\2\2IH\3\2\2\2JK\3\2\2\2KI\3\2\2\2KL\3\2\2\2L\17\3\2\2\2MN\7\r\2"+
		"\2NO\7\n\2\2OP\7\23\2\2PQ\7\23\2\2QR\7\16\2\2R\21\3\2\2\2ST\7\r\2\2TU"+
		"\7\n\2\2UV\7\23\2\2VW\5\30\r\2WX\7\16\2\2X\23\3\2\2\2YZ\7\r\2\2Z[\7\n"+
		"\2\2[\\\7\r\2\2\\]\7\23\2\2]^\5\32\16\2^_\7\16\2\2_`\5\30\r\2`a\7\16\2"+
		"\2a\25\3\2\2\2bc\7\r\2\2cd\7\n\2\2de\7\r\2\2ei\7\20\2\2fh\5\30\r\2gf\3"+
		"\2\2\2hk\3\2\2\2ig\3\2\2\2ij\3\2\2\2jl\3\2\2\2ki\3\2\2\2lm\7\16\2\2mn"+
		"\5\30\r\2no\7\16\2\2o\27\3\2\2\2ps\7\21\2\2qs\5\34\17\2rp\3\2\2\2rq\3"+
		"\2\2\2s\31\3\2\2\2tv\7\17\2\2ut\3\2\2\2uv\3\2\2\2vw\3\2\2\2wx\7\22\2\2"+
		"x\33\3\2\2\2y{\7\17\2\2zy\3\2\2\2z{\3\2\2\2{|\3\2\2\2|\177\7\22\2\2}~"+
		"\7\3\2\2~\u0080\7\22\2\2\177}\3\2\2\2\177\u0080\3\2\2\2\u0080\35\3\2\2"+
		"\2\20 &),\60\668@Kiruz\177";
	public static final ATN _ATN =
		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}